0 Members and 1 Guest are viewing this topic.
ALTER TABLE `osdate_user` ADD `style` VARCHAR(10) NOT NULL DEFAULT '' AFTER `level`;
function setStyle($user_id=0,$style=''){ if($user_id > 0) { global $osDB; switch ($style) { // will use style_blue.css case 'blue': $style_selected='blue'; break; // will use style_green.css case 'green': $style_selected='green'; break; // Copy & Paste the custom case for each of your options, replacing the word "custom" with your new style name // will use style_custom.css case 'custom': $style_selected='custom'; break; // Default empty (will use the main style.css file) default: $style_selected=''; break; } if(!empty($style_selected)){ $style_selected='_'.$style_selected; } $osDB->query('UPDATE ! SET style = ? WHERE id = ?', array(USER_TABLE, $style_selected, $user_id)); $_SESSION['site_style']=$style_selected; } return true;}
function getStyle(){ global $osDB,$config; $return=''; if(isset($_SESSION['site_style'])){ $return=$_SESSION['site_style']; }else{ if(isset($_SESSION['UserId']) && $_SESSION['UserId'] > 0){ $return=$osDB->getOne('SELECT style FROM ! WHERE id = ?', array(USER_TABLE, $_SESSION['UserId'])); if($return && !empty($return)){ $_SESSION['site_style']=$return; } } } if(!is_file(FULL_PATH.'templates/'.$config['skin_name'].'/css/style'.$return.'.css')){ $return=''; } return $return;}
function styleLink($base=''){ $empty='?'; if(!empty($base)){ $arr=explode('&',$base); if(!empty($arr)){ foreach($arr as $x => $v){ if(strpos($v,'style') !== FALSE){ unset($arr[$x]); } } } $str=implode('&',$arr); if(strpos($str,'?') !== FALSE){ $str=$str.'&'; }else{ $str=$str.'?'; } return $str; }else{ return $empty; }}
if (isset($_GET['style']) && $_GET['style'] != '') { if(isset($_SESSION['UserId']) && $_SESSION['UserId'] > 0){ setStyle($_SESSION['UserId'],$_GET['style']); }}$t->assign ('site_style',getStyle());$style_uri=(((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);$t->assign ('style_link',styleLink($style_uri));
if ( strlen( $_SERVER['QUERY_STRING'] ) <= 0 or $_SERVER['QUERY_STRING'] == 'affid='.$affid || $_SERVER['QUERY_STRING'] == 'lang='.$getlang or(( $errid == NOT_YET_APPROVED or $errid == NOT_ACTIVE ) && (isset($_SESSION['UserId']) && $_SESSION['UserId'] > 0) ) ){
$getstyle = isset($_GET['style'])?$_GET['style']:'';if ( strlen( $_SERVER['QUERY_STRING'] ) <= 0 or $_SERVER['QUERY_STRING'] == 'affid='.$affid || $_SERVER['QUERY_STRING'] == 'lang='.$getlang || $_SERVER['QUERY_STRING'] == 'style='.$getstyle or(( $errid == NOT_YET_APPROVED or $errid == NOT_ACTIVE ) && (isset($_SESSION['UserId']) && $_SESSION['UserId'] > 0) ) ){
<link href="{$css_path}css/style{$site_style}.css" rel="stylesheet">
.style_picker { text-align: center;}.style_picker .blue a i{ color: #2196F3;}.style_picker .green a i{ color: #263130;}
.style_picker .custom a i{ color: #263130;}
<link href="{$css_path}css/stylepicker.css" rel="stylesheet">
<div class="modal fade" id="selectStyle" tabindex="-1" role="dialog" aria-labelledby="selectStyleLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header text-center"> Select Color Style <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> </div> <div class="modal-body clearfix"> <div class="row"> <div class="col-sm-8 col-sm-offset-2"> <ul class="list-group style_picker"> <li class="list-group-item blue"> <a href="{$style_link}style=blue" title="Blue"> <i class="fa fa-square" aria-hidden="true"></i> Team Blue</a> </li> <li class="list-group-item green"> <a href="{$style_link}style=green" title="Green"> <i class="fa fa-square" aria-hidden="true"></i> Team Green</a> </li> </ul> </div> </div> </div> <div class="modal-footer"> <div class="text-center"> <a href="{$style_link}style=xx" class="btn btn-danger"><i class="fa fa-refresh" aria-hidden="true"></i> {lang mkey='reset'}</a> </div> </div> </div> </div></div>
<li class="list-group-item custom"> <a href="{$style_link}style=custom" title="custom"> <i class="fa fa-square" aria-hidden="true"></i> Team Custom</a></li>
<li><a href="#" data-toggle="modal" data-target="#selectStyle" >Change Style</a></li>
{literal}<script language="JavaScript"><!--function MM_jumpMenu(targ,selObj,restore){ //v4.0eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if (restore) selObj.selectedIndex=0;}//--></script>{/literal}
<div class="col-sm-8 col-sm-offset-2"> <ul class="list-group style_picker"><center> <select style="" name="boards" onChange="MM_jumpMenu('parent',this,0)" size="1"> <option value="">Choose your Theme</option> <option value="">-------------------</option> <option value="{$style_link}style=blue">Blue</option> <option value="{$style_link}style=green">Green</option> <option value="{$style_link}style=purple">Purple</option> </select> </center> </ul> </div>