Source for file skin.inc.php
Documentation is available at skin.inc.php
* @author Matthias Reuter ($LastChangedBy: matthias $)
* @version $LastChangedDate: 2008-10-31 23:53:28 +0000 (Fr, 31 Okt 2008) $
* @copyright 2007-2010 IPBWI development team
* @link http://ipbwi.com/examples/skin.php
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License
* @desc Loads and checks different vars when class is initiating
* @author Matthias Reuter
public function __construct($ipbwi){
* @desc Returns the Skin ID of the skin used by a member.
* @param int $memberID Member ID. If Member ID is ommitted, the current User will be used.
* @return int Skin ID or false on failure
* @author Matthias Reuter
* $ipbwi->skin->id($memberID);
public function id($memberID = false){
$member = $this->ipbwi->member->info(); // get user info...
if(isset ($member['skin']) && $member['skin'] != ''){
$sql = $this->ipbwi->ips_wrapper->DB->query('SELECT set_id FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'skin_collections WHERE set_key = "default"');
if($row = $this->ipbwi->ips_wrapper->DB->fetch($sql)){
* @desc Gets information on a skin.
* @param int $skinID ID of the Skin
* @return array Information on Skin or false on failure
* @author Matthias Reuter
* $ipbwi->skin->info($skinID);
public function info($skinID){
if($skinID >= 0){ // If they've specified a skin
$sql = $this->ipbwi->ips_wrapper->DB->query('SELECT * FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'skin_collections WHERE set_id="'. $skinID. '"');
if($row = $this->ipbwi->ips_wrapper->DB->fetch($sql)){
* @desc Gets emoticon directory of currently logged in user.
* @return array emoticon dir
* @author Matthias Reuter
* $ipbwi->skin->info($skinID);
$member = $this->ipbwi->member->info(); // get user info...
if(isset ($member['skin']) && $member['skin'] != ''){ // for guests or if no skin is set...
$skinID = $member['skin']; // ...for skin id
$default = false; // ...make it the default skin
$sql = $this->ipbwi->ips_wrapper->DB->query('SELECT set_emo_dir FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'skin_collections WHERE '. (($default === true) ? 'set_key = "default"' : 'set_id = '. $skinID));
$emodir = $this->ipbwi->ips_wrapper->DB->fetch($sql);
return $emodir['set_emo_dir']. '/';
* @desc Pulls and displays CSS from forums depending on user's skin.
* @return array stylesheet fields
* @author Matthias Reuter
* $ipbwi->skin->css(true,false);
$member = $this->ipbwi->member->info(); // get user info...
if(isset ($member['skin']) && $member['skin'] != ''){ // for guests or if no skin is set...
$skinID = $member['skin']; // ...for skin id
$default = false; // ...make it the default skin
$sql = $this->ipbwi->ips_wrapper->DB->query('SELECT set_css_groups,set_image_dir FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'skin_collections WHERE '. (($default === true) ? 'set_key = "default"' : ' set_id = '. $skinID));
$skin = $this->ipbwi->ips_wrapper->DB->fetch($sql);
$CSSids['list'] = 'WHERE (css_id = ';
foreach($CSSgroups as $IDs => $g){
$delimiter = ') OR (css_id = ';
$CSSids['list'] .= $IDs[1]. $delimiter;
// get CSS fields from DB
$query = 'SELECT * FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'skin_css '. $CSSids['list']. ' ORDER BY css_position ASC';
$sql = $this->ipbwi->ips_wrapper->DB->query($query);
while($entry = $this->ipbwi->ips_wrapper->DB->fetch($sql)){
$style[$entry['css_group']] = str_replace('{style_images_url}', $skin['set_image_dir'], $entry['css_content']);
* @desc Grabs the IDs of all the avaliable skins.
* @author Matthias Reuter
* $ipbwi->skin->getList();
// Grab all skins which aren't hidden
$sql = $this->ipbwi->ips_wrapper->DB->query('SELECT set_id FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'skin_collections WHERE set_hide_from_list="0"');
while($row = $this->ipbwi->ips_wrapper->DB->fetch($sql)){
$skins[] = $row['set_id'];
* @desc Changes the current user's skin.
* @param int $skinID Skin ID
* @param int $memberID Member ID. If Member ID is ommitted, the current User will be used.
* @return bool true on success, otherwise false
* @author Matthias Reuter
public function set($skinID,$memberID= false){
if($this->info($skinID)){
// Grab current member id unless specified
$member = $this->ipbwi->member->info(); // get user info...
if($this->ipbwi->member->updateMember(array('skin' => $skinID), $member['member_id'])){
$this->ipbwi->addSystemMessage('Error',$this->ipbwi->getLibLang('skinNotExist'),'Located in file <strong>'.__FILE__. '</strong> at class <strong>'.__CLASS__. '</strong> in function <strong>'.__FUNCTION__. '</strong> on line #<strong>'.__LINE__. '</strong>');
|