Location: PHPKode > projects > MembersGear > membersgear/admin/admin_theme_m.php
<?php

   require_once "../config/config.php";
   
   require_once "../includes/theme_class.php";
   
   require_once "../includes/themepages_class.php";
  
  require_once INCLUDE_DIR."/users_class.php";  
  
  if($_SERVER['REQUEST_METHOD']=="GET")
        $_SESSION[SESSION_PREFIX.'page_referrer']=$_SERVER['HTTP_REFERER'];
        
  $users = new users_class();
  
  if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can view template manager')==false)
  {
                Redirect('admin_nopermission.php',true);  
  } 
  if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can manage template manager')==false)
  {
                Redirect('admin_nopermission.php',true);     
  } 
   
   $loManageTheme = new themes_class();
   
   $loManageThemePages = new themespages_class();
   
    switch($_action)
    {
        case 'insert':
                  $lTypes=null;
                  
                  /*********************************************************************************************/
                  /*                        Check Theme Name is exist or not                                   */  
                  /*********************************************************************************************/
                  $selectQuery = 'SELECT * FROM '.TABLE_PREFIX.'theme WHERE name=?';
                  $lsThemeName = array($_POST['txtThemeName']);
                  
                  $dataIsExist = $loManageTheme->View($selectQuery,$lsThemeName,null);
                  
                   if($dataIsExist != null)
                   {
                        $message->SetMessage('Record with "'.$_POST['txtThemeName'].'" theme name is alredy exist.');
                          
                        if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
                          Redirect($_SESSION[SESSION_PREFIX.'page_referrer'],true);
                       else  
                          Redirect('admin_theme_v.php');
                      
                        break;
                   
                   }
                  
                  /*********************************************************************************************/
                  
                  $query = 'INSERT INTO '.TABLE_PREFIX.'theme (name, description, isdefault, createdon, createdby, createdipaddress,modifiedon, modifiedby, modifiedipaddress) VALUES(?,?,?,?,?,?,?,?,?)';
                  
                  $lsValues = array();
                  
                      $lsValues[0]  = $_POST['txtThemeName'];
                      $lsValues[1]  = $_POST['txtDescription'];
                      $lsValues[2]  = 0;//$_POST['ddlStatus']; 
                      $lsValues[3]  = mktime();
                      $lsValues[4]  =  $_SESSION[SESSION_PREFIX.'Admin_UserID'];
                      $lsValues[5]  = $_SERVER['REMOTE_ADDR'];
                      $lsValues[6]  = 0;
                      $lsValues[7]  = 0;
                      $lsValues[8]  = 0;
                  
                  $lsInsertedrows = $loManageTheme->Insert($query,$lsValues,null);
                  
                  if($lsInsertedrows > 0)
                  {
                      
                      $query = "SELECT id FROM ".TABLE_PREFIX."theme WHERE name='$lsValues[0]' AND createdon=$lsValues[3]";
                      $lithemeid = $loManageTheme->View($query); 
                      unset($lsValues);
                     
                      //Default theme pages
                      //If you want to add new page then add it into the array
                      $laThemePage = array('USER_HEADER','USER_LEFTPANE','USER_RIGHTPANE','WEBSITE_LOGO','USER_FOOTER','WEBSITE_LOGINFORM','WEBSITE_FORGOTPASSWORD','WEBSITE_CSS','USER_PAGE_MAIN','USER_UNSUBSCRIBE','USER_SUBSCRIBE');
                     
                      
                          $lsValues[] = $lithemeid[0]['id'];
                          $lsValues[] = ' ';
                          $lsValues[] = 1;
                          $lsValues[] = mktime();
                          $lsValues[] = $_SESSION[SESSION_PREFIX.'Admin_UserID'];
                          $lsValues[] = $_SERVER['REMOTE_ADDR'];
                          $lsValues[] = 0;
                          $lsValues[] = 0;
                          $lsValues[] = 0;
                     
                      foreach($laThemePage as $name)
                      {
                            $DefaultContentPageList = array('USER_HEADER','USER_FOOTER','USER_PAGE_MAIN','WEBSITE_CSS','USER_UNSUBSCRIBE','USER_SUBSCRIBE');
                            if(in_array($name,$DefaultContentPageList))
                            {
                                switch ($name){
                                    case 'USER_HEADER':
                                            $lsValues[1] = '
<div id="header">
            <img src="{$WEB_URL}/images/space.gif" id="logo" style="_background:none !important;filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src=\'{$WEB_URL}/images/logo.png\',sizingMethod=\'image\');" alt="" />
            <ul style="left:750px !important;">
                <li>
                    <a href="{$WEB_URL}/support.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'m6\',\'\',\'{$WEB_URL}/images/m6-act.gif\',1)">
                        <img src="{$WEB_URL}/images/m6.gif" alt="" id="m6" />
                    </a>
                </li>
                <li>
                    <a href="{$MEMBERSITE_LOGINSTATUS_LINK}" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'{$MEMBERSITE_LOGINSTATUS}-m7\',\'\',\'{$WEB_URL}/images/{$MEMBERSITE_LOGINSTATUS}-m7-act.gif\',1)">
                        <img src="{$WEB_URL}/images/{$MEMBERSITE_LOGINSTATUS}-m7.gif" alt="" id="{$MEMBERSITE_LOGINSTATUS}-m7" />
                    </a>
                </li>
            </ul>
</div>
                                            ';
                                            break;
                                            
                                    case 'USER_FOOTER':
                                            $lsValues[1] = '
<div id="footer">
                <p>
                    <span>MembersGear (c) 2011</span> | <a href="pricacypolicy.php">Privacy policy</a></p>
                <div id="container">
                    <div class="inner">
                        <div class="inner">
                            <ul>
                                <li class="extra"><a href="{$WEB_URL}/support.php">Support</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>                                            ';
                                            break;
                                            
                                    case 'USER_PAGE_MAIN':
                                            $lsValues[1] = '
<div class="headerdiv"> 
 <div><h1>Your Header Goes Here </h1></div>  
<div style="width: 35%;float:right"> 
    <div style="float:right;text-align:left;"> 
      <ul> 
       <li></li>
       <li></li> 
       <li></li>    
     </ul>
    </div> 
  </div> 
</div>
       <div id="content">
                <table cellpadding="5" align="center" cellspacing="5" width="100%">
                    <tr>
                            <td style="width:20%" valign="top">
                               <!-- your left pane here !--><!-- left pane end here -->
                            </td>    
                            
                            <td valign="top" style="width:auto">
                                {$USER_CONTENT}
                            </td>    
                            
                            <td style="width:20%" valign="top">
                               <!-- your right pane here !--><!-- right pane end here -->
                            </td>    
                            
                    </tr>
                </table>
        </div>

<!-- user footer -->
<div id="footer">
                <div id="container">
                    <div class="inner">
                        <div class="inner">
                          <h1>Your footer goes here</h1>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- user footer end here--> ';
 break;
                                            
                                    case 'WEBSITE_CSS':

                                            $lsValues[1] = '
/*show  vertical scrollbars so page does not shift */ 
html {
     overflow-y: -moz-scrollbars-vertical; /* IE7, IE8, FF */
     overflow-y: scroll;          /* Chrome, Opera, safari */
}
/* default for all body tag document */
body
{
    margin:0px;
    padding:0px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #666;
    font-size: 11px;
    width:100%;
    list-style:none;
    list-style-image:none;

}
/* css for header div*/
.headerdiv
{
    width:100%;
    text-align:center;
    clear:both;
    overflow:hidden;
    background:transparent url(../images/divfooter.gif)  repeat-x scroll 1% 100%;
    margin-top:15px;
    padding-bottom:20px;
}
/* css for header div image tag*/       
.headerdiv img
{
    border:none;
    text-decoration:none;
}
/* common for all h1, h2, h3 tag */    
h1,h2,h3
{
    clear:both;
    overflow:hidden;
    border:0pt none;
    margin:0pt;
    padding:0pt;
    color:#000000;
}

/* common for all h1 tag */   
h1
{
    font-size:19px;
}

/* common for all h2 tag */   
h2
{
    font-size:16px;
}

/* common for all h2 tag */ 
h3
{
    font-size:13px;
}

/* common for all table td */  
td
{
    padding-left:0px;
}
/* common for ul tag*/  
ul
{
    width:100%;
    list-style:none;
    list-style-image:none;
    margin:0px;
    padding:0px;
}
/* common for ul tag*/ 
li
{
    float:left;
    margin-left:15px;
}

/* common for all anchor tag */   
a{
    color:#000000;
    font-size: 1.1em;
    text-decoration:none;
}

/* common for all anchor tag hover */   
a:hover
{
    text-decoration:underline;
    color:#000000;
}

/* common css for all fieldlabel description*/ 
.FieldLabelNote
{
    font-size    :10px;
    color        :#55717D;
    font-weight :normal;
}

/* common css for all forms */ 
.formformat
{
    padding-left:30px;
    position:relative;
    z-index:1;
    width:100%;
}

/* common css for all forms  td*/ 
.formformat td
{
 
    font-size:11px;
}

/* common css for all forms  th h1*/
.formformat th,
.formformat h1
{
    text-align:center;
    padding:10px;
    font-size:13px;
}

/* common css for  all forms  label  span borderless label borderless span*/
.formformat label,
.formformat span,
.borderless label,
.borderless span
{
    /*float:left;*/
    width:auto;
    font-weight:bold;
}
/* common css for leftside td borderless table*/
.right-side-text-borderless  table
{
    border:none !important;  
    text-align:left;
      
}
/*common css for rightside td borderless table*/
.left-side-text-borderless  table
{
    border:none !important;  
    text-align:left;  
}

/* common css for rightside and leftside td for borderless table */
.borderless .left-side-text
.borderless .right-side-text
{
    border:none;
}

/* common css for borderless table td th tr */
.borderless,
.borderless table,
.borderless td,
.borderless th,
.borderless tr
{
       border:none !important;     
}

/* css for space */
.space
{
   padding-left:5px ;
   padding-right: 5px ; 
}

/* css for horizontal-line*/
.horizontal-line 
{
    border-bottom:1px solid #7D9CB0;/*#F2C18A;*/
    margin-bottom:10px;
    padding-bottom:10px;
    text-align:left;
    clear: both;
    overflow: hidden;
}

/* css for comment div*/
.comment-div 
{
    background-attachment:scroll;
    background-color:#FFE9CF;
    background-image:none;
    background-repeat:repeat;
    border: solid 1px #EA7222;
    font-size:11px;
    font-weight:normal;
    margin-bottom:10px;
    margin-left:0pt;
    margin-right:0pt;
    margin-top:5px;
    padding-bottom:5px;
    padding-left:10px;
    padding-right:10px;
    padding-top:5px;
    width:96%;
}

/* css for borderless dropdown css */
.selectcss,
.borderless select
{
    border:1px solid #000000;
    padding:3px; 
    color:#666666;
    font-size:11px;
    font-family:Tahoma,Arial,sans-serif;
    margin-bottom:5px;
}

/* css for textbox */
.txtcss
{
    border:1px solid #000000;
    padding:3px;
}

/* css for textarea */
.txtareacss
{
    border:1px solid #000000;
    margin-bottom: 5px; 
    color:#666666;
    font-size:11px;
    font-family:Tahoma,Arial,sans-serif;
}

/* css for checkbox*/
.chkcss
{
    padding:0px 4px;
    vertical-align:middle;
}

/* css for buttun td*/
.buttontd
{ 
    text-align :left;
    padding-left:5px;
    height:40px;
}

/* css for txtbox hover*/
.txthover
{
    background:#000000;
    border:solid 1px #00000;
    padding:3px;
}
/* css for table leftside td*/ 
.right-side-text
{
    text-align:left;
    padding-right:5px;
    width: 35% !important;  
}
/* css for table right side td*/  
.left-side-text
{
    text-align:left;
    padding-left:5px;
    width: 65% !important;
}
/* common css for all form label and span*/
.formformat label,
.formformat span
{
     width:auto;
}
/*common class for all input control (textbox,checkbox,radio)*/    
input
{
    color:#666666;
    font-size:11px;
    font-family:Tahoma,Arial,sans-serif;
    margin-bottom:5px;
}
/* css class for button*/  
.btncss
{
    border:1px solid #000000;
    padding: 1px 5px;
    background:  url(../images/btnbg.gif) repeat-x;
    font-family:Verdana;
    Color :#703838;
    cursor:pointer;
}
  
.chkcss
{
    padding:0px 4px;
    vertical-align:middle;
}
/* class for user error message */   
.errormsg
{
    color:#FF3737;
 
    padding:5px;
 
    margin:0px auto;
    text-align:center;
}
/* class for user success message */     
.succmsg
{    
    color:#539F2F;
    padding:5px;
    margin:0px auto;
    text-align:center;
}

/* css class for disable button*/ 
.btndisabled
{
    border:1px solid #000000;
    padding: 1px 5px;
    background:  url(../images/btnbgdisabled.gif) repeat-x;
    font-family:Verdana;
    Color :#703838;
    cursor:pointer;
}

 /* css class for your subscriptions ul div*/  
.Ulset
{

}
 /* css class for your subscriptions ul of ul div*/ 
.Ulset ul
{
       list-style-type:disc;
    list-style:disc;
    color:#000000;
    padding-left:16px;
    *padding:0px;
}
/* css class for your subscriptions li of ul*/ 
.Ulset li
{
    width:100%;
    
}

/* css class for payment history default page */
.gridPayment{
 border:1px solid #C0C0C0;
}
/* css class for payment history default page */
.gridPayment th {
background-color:#C0C0C0;
border-left: 1px solid #888;
font-weight:bold;
font-size:12px;
padding:5px;
text-align:center;
color:#093854;
}
/* css class for payment history default page */
.gridPayment th:first-child
{
border-left:0px;
}
/* css class for Add/Renew Subscription td*/
.noTDpadding
{
    padding:0px;
}
/* css class for Add/Renew Subscription radio button label td*/    
.TDLitepadding
{
    padding-left:5px;
}
/* css class for Required feild lable*/
.star
{
    color: #BD2801 !important;
    font-size: 12px !important;
}
/* css for rounded fixed width login box */
#login
{
    width:470px;
    background: transparent;
    overflow:hidden;
    margin:0px auto;
}

/* css for login box top image */
#login-top
{
    width:470px;
    background: transparent url(../images/login-box-top.gif) no-repeat;
    height: 22px;
}

/* css for login box background image */
#login-bg
{
    width:470px;
    background: #fff url(../images/login-box-bg.gif) repeat-y;
    overflow:hidden;
}

/* css for login box bottom image */
#login-bottom
{
    width:470px;
    background: transparent url(../images/login-box-bottom.gif) no-repeat;
    height:22px;
}

/* css for login box subdivision */
#login .subdiv
{
    width:420px;
    margin:0px auto;
    overflow: hidden;
}

/* css for login/formlayout box h1 tag */
#login h1, 
#formlayout h1 {
    
    border-bottom:1px dotted #171717;
    color:#171717;
    font-size:20px;
    margin-bottom:14px;
    margin-top: 8px;
    padding-bottom:18px;
}
/* css for formlayout box h1 tag */    
#formlayout h1 {
    
    border-bottom:1px dotted #171717;
    color:#171717;
    font-size:20px;
    margin-bottom:14px;
    margin-top: 8px;
    padding-bottom:18px;
}

/* class for p tag in formlayout id */
#formlayout-bg p
{
    padding: 8px 1px 20px 5px;
    line-height: 1.308em;
    font-size: 1.083em;
    text-align:justify;
}

/* class for p and span tag in formlayout id */
#formlayout-bg p span
{
    margin-left:0px;
}

/* css for login/formlayout box seprator between two forms/tables/div */
#login .userdiv, 
#formlayout .userdiv
{
    width:100%;
    background: #fff url(../images/login-seprate.gif) no-repeat scroll center bottom; 
}

/* css for login box forgot password */
#login .forgotpassdiv
{
    width:100%;
    margin-top:15px;
}  

/* css for login/formlayout box span and label */
#login span,label,
#formlayout span,label
{
    color: #626262;
    line-height: 1.23em;
    font-size: 13px
}
 
/* css for fixed width rounded box layout for wide with */
#formlayout
{
    width:670px;
    background: transparent;
    overflow:hidden;
    margin:0px auto;
}

/* css for formlayout box top image */
#formlayout-top
{
    width:650px;
    background: transparent url(../images/top.gif) no-repeat;
    height: 22px;
    margin: 0px auto;
}

/* css for formlayout box repeat background image */
#formlayout-bg
{
    width:650px;
    background: #fff url(../images/bg.gif) repeat-y;
    overflow:hidden;
    margin: 0px auto;

}

/* css for formlayout box bottom image */
#formlayout-bottom
{
    width:650px;
    background: transparent url(../images/bottom.gif) no-repeat;
    height:22px;
    margin: 0px auto;
}

/* css for footer of the page */
#footer {
     background:url("../images/divfooter.gif") repeat-x scroll -1% -11% transparent;
     clear:both;
     margin-top:10px;
     overflow:hidden; 
      text-align:center;
      width:100%;
      height: 79px;
}
#footer .inner{
padding-top:20px;
}
/* css for content between header and footer */
#content {
    padding: 28px 33px 33px 33px;
   min-height:400px;
   height:auto !important;
  _height: 400px
}

/* css for  for rotators div */
#rotatordiv{
padding-left:179px;
}

/* css for user invalid page access link*/
.userinvalid
{
    color:blue !important;
}
/* class for user success message anchor tag */    
.succmsg a
{
  color:#539F2F !important; 
   
}
/* class for user error message anchor tag */      
.errormsg a
{
    color:#FF3737 !important;  ;
}

/* css for main area page upper link  header*/
#divmemberslinkheader
{
    text-align: center; 
    vertical-align: top; 
    padding-top: 7px;
}
/* css for main area page upper link */  
#divmemberslinkheader a
{
    
    
}
/* css for main area page upper link hover */ 
#divmemberslinkheader a:hover
{
   
    
}
/* css for members pages main div */  
#divmaindefaultpage
{
    width: 98%; 
    margin: 0px auto;
}
/* css for main area page main div */    
#divmaindefaultpagecss
{
    width:100%;
    margin: 0px auto; 

}

/* css for main area page h1(heading) */  
#divmaindefaultpagecss  h1
{
  /*margin-top:8px;*/
} 
/* css for main area page td */            
#divmaindefaultpagecss td
{
  
}
/* css for main area page header table */   
#defaulttableheader
{
    
}
/* css for main area page content table */    
#defaulttablecontent
{
    margin-left:20px;
}

/* css for main area page left side content table(Your Subscriptions)*/
#defaulttablesubcontent1
{
  width:48%;
  vertical-align:top;
  padding:12px 0px !important;

}
/* css for main area page left side content table td(Your Subscriptions)*/  
#defaulttablesubcontent1 td
{
  

}
/* css for main area page right side content table (Add/Renew Subscription)*/
#defaulttablesubcontent2
{
   width:470px;
   border-left:solid 1px #ccc;
   vertical-align:top;
   /*padding:12px 0px !important;   */
   padding:12px 6px !important; 

}
/* css for main area page right side content table td(Add/Renew Subscription)*/   
#defaulttablesubcontent2  td
{
   padding-left: 10px;   
}
/* css for main area page product subscription ul*/
#divdefaultpagesubscriptionul
{


           padding:0px;
}
/* css for main area page product subscription ul of ul*/ 
#divdefaultpagesubscriptionul ul
{
    color:#000000;
    list-style-position: outside;
}
/* css for main area page product subscription li of ul */
#divdefaultpagesubscriptionul li
{

  /*  margin:1px;   */    
    list-style-position: outside;   
    float:none;   
    color: #000000;

}
/* css for main area page product subscription li link of ul*/ 
#divdefaultpagesubscriptionul li a
{

}
/* css for main area page product subscription  li link  hover of ul */ 
#divdefaultpagesubscriptionul li a:hover
{

}
/* css for main area page product subscription drip li */
#divdefaultpagesubscriptiondripli
{
    list-style:none;  
    margin: 0px;
}

/* css for main area page  product subscription main  li */ 
#divdefaultpagesubscriptionli
{
           padding:0px;
}
/* css for main area page product subscription drip  ol*/ 
#divdefaultpagesubscriptiondripli ol
{
    list-style-type: lower-roman;
    *padding :0px;
}
/* css for main area page product subscription drip  li of ol*/  
#divdefaultpagesubscriptiondripli ol li
{
      margin-left: 0px;
 }
/* css for main area page Product subscription drip  li link of ol*/
#divdefaultpagesubscriptiondripli ol li a
{
      font-size: 12px;
}
/* css for main area page product subscription drip  li link hover of ol*/       
#divdefaultpagesubscriptiondripli ol li a:hover
{
   

}

/* css for main area page product subscription li of ul ul*/   
#divdefaultpagesubscriptionul ul li
{


}
/* css for  main area page Newsletter Subscriptions table*/

#defaulttablemailsubscribe
{

}
/* css for  main area page  Newsletter Subscriptions table td*/ 
#defaulttablemailsubscribe td
{
   
}
/* css for  main area page Newsletter Subscriptions label*/ 
#defaulttablemailsubscribe label
{
      color:#000;
}
/* css for  main area page  Add/Renew Subscription  */
#defaulttableadd_renew_subscription
{

}
/* css for  main area page h3*/
.TdPaddingAddRenewSubscriptionMemberDefaultPage h3
{
   
}
/* css for  main area page checkbox*/
.TdPaddingAddRenewSubscriptionMemberDefaultPage .chkcss
{
  vertical-align:middle;
}
/*  css for  main area page checkbox label for checkbox*/   
.TdPaddingAddRenewSubscriptionMemberDefaultPage .TDLitepadding label
{
  color:#000;
}
/* css for  main area page agreement table */
#defaulttableAgreement
{
   padding-top:30px;
   padding-left:10px;

}
/* css for  main area page agreement table td */
#trdispAgree td
{
   margin-left:12px;
   padding-top:5px;
}

/* css for main area page and signup page  agreement */
#agreement
{
  padding-right:3px;
  height:300px;
  overflow:auto;
  width:98%;

  border:1px solid #cccccc;
}
/* css for main area page and signup page agreement checkbox*/    
#dispAgree
{

  width:285px;
  margin-top:10px;
}
/* css class for main area page and signup page agreement checkbox*/
#dispAgree .chkcss
{
 vertical-align:middle;
}
/* css class for main area page and signup page agreement  agreement Checkbox label stong attribute*/ 
#dispAgree strong
{
   color:#000;
}
/* css class for main area page payment grid td */  
.gridPayment td
{ 
    
}
/* css class for main area page payment grid tr */  
.gridPaymenttr
{

  font-weight: normal;
}
/* css class for main area page payment grid product name td*/    
.gridPaymentnametd
{
    width:220px;
    padding-left: 10px;
}
/* css class for main area page payment grid period Date td*/
.gridPaymentPeriodDatetd
{
  border-right-style:none;
  width:90px;
  padding:0px 0px 0px 30px;
}
/* css class for main area page payment grid periode TO td*/ 
.gridPaymentPeriodTOtd
{
  text-align:center;
  padding:0px !important;
  border-left-style:none;
  border-right-style:none;
}
/* css class for main area page payment grid periode lifetime td*/
.gridPaymentPeriodLifetimetd
{
  border-left-style:none;
  width:90px;
  text-align:left;
  padding:0px 0px 0px 30px;
} 
/* css class for main area page payment grid price td*/                           
.gridPaymentPricetd
{
    text-align:right;
}
/* css for mian div of  edit Profile */
#divMemberPageContent
{
  width:100%;
  margin:0px auto;
} 
/* css for edit profile page table*/
#tableeditprofile
{
  width:100%;
}
/* css for edit profile page table td*/     
#tableeditprofile td
{
  /* width: 150px; */
}
/* css for your affiliate link page table*/
#tableaffiliate
{
   width:100%;
   margin: 0px auto;
}
/* css for your affiliate link page table td*/
#tableaffiliate td
{
 
}
/* css for your affiliate link page anchor tag*/    
#tableaffiliate a
{
    
}
/* css for Button td of your affiliate link page anchor tag*/ 
.buttontdaffiliate
{
 padding-left:5px;
}
/* css for change password  page table*/
#tablechangepassword
{
    margin:0px auto;
 
}
/* css for change password  page table td*/  
#tablechangepassword td
{
   /* width:200px;*/
}
/* css class for change Password button*/
.btnchangepassword
{
   padding:0px !important;
}
/* css for support page table*/
#tablesupport
{
    width:100%;
    
}
/* css for support page table td*/   
#tablesupport td
{
   width:150px;
}
/* css class for support page table header td*/     
#tablesupport .headertd
{
   width:100%;
}
/* css class for support page button */ 
.buttontdsupport
{
    padding:0px 6px 0px 8px !important;
}
/* css for login page table*/
#tablelogin
{


}
/* css for login page table td*/ 
#tablelogin td
{
  width:200px;

}
/* css class for login page textbox*/  
#tablelogin .txtcss
{

   width:170px;
}
/* css for login page capcha image*/
#capchaimg
{
    border:1px solid #F78E19;
    margin-bottom:5px;
}
/* css for login page secretcode textbox*/  
#tablelogin #txtSecretCode
{
    text-transform:uppercase;
    width:170px;
}
 /* css for login page forgot password  table*/  
#tableforgotpassword
{

   width:100%
}
/* css for login page forgot password  table td*/ 
 #tableforgotpassword td
{

   text-align:center !important;
}
/* css class for login page forgot password  textbox */  
#tableforgotpassword .txtcss
{
    width:200px;
   
}
/* css for login page forgot password h2 tag (heading) */  
#h2forgotpassword
{
   margin-bottom:10px;
}
/* css for change password page table*/
#tableforgotpasswordform
{

}
/* css for change password page table td*/  
#tableforgotpasswordform td
{


}
/* css class for change password page  error td*/ 
.forgotpassworderror
{
    color:red
}
/* css for user unsubscribe mailing page table*/
#tableunsubscibe_maling
{
   width:100%;
    
}
/* css for user unsubscribe mailing page table td*/ 
#tableunsubscibe_maling td
{

}
/* css for user unsubscribe mailing page anchor tag*/ 
#tableunsubscibe_maling a
{
 
}
/* css for user unsubscribe mailing page anchor tag hover*/  
#tableunsubscibe_maling a:hover
{
  
}
/* css class for user unsubscribe mailing page table td*/  
.tableunsubscibe_maling_td
{
      width:200px; 
}
/* css for login rotate page table */  
#tableloginrotatecontent
{


}
/* css for login rotate page table td */  
#tableloginrotatecontent td
{

}
/* css for login rotate page anchor tag */
#tableloginrotatecontent td a
{
 
} 
/* css for login rotate page  anchor tag hover */
#tableloginrotatecontent td a:hover
{
 
}
/* css for login rotate page  anchor tag hover */
#divloginrotatecontent
{
  width:100%;
  margin:0px auto;

}
/* css class  for login rotate page div */ 
.rotatordiv1
{
    margin:0px auto;
    overflow:hidden;
}
/* css class  for login rotate page div strong tag*/ 
.rotatordiv1 strong
{
    font-size: 13px;
}
/* css class  for login rotate page div image tag*/ 
.rotatordiv1 img
{
    vertical-align:middle !important;
}
/* css for logot rotate page table*/  
#tablelogoutrotatecontent
{


}
/* css for logot rotate page table td*/   
#tablelogoutrotatecontent td
{

}
/* css for logot rotate page anchor tag*/   
#tablelogoutrotatecontent td a
{
 
}
/* css for logot rotate page anchor tag hover*/  
#tablelogoutrotatecontent td a:hover
{
 
}
/* css for logout rotate page div */ 
#divlogoutrotatecontent
{
  width:100%;
  margin:0px auto;

}
/* css class for logout rotate page div */     
.rotatordivlogout
{
   margin:0px auto;
   overflow:hidden;
}
/* css class for logout rotate page div strong tag */   
.rotatordivlogout strong
{
    font-size: 13px;
}
/* css class for logout rotate page div image*/  
.rotatordivlogout img
{
    vertical-align:middle !important;
}
/* css class for login page user signup link td  */
.tdusersignup
{
    padding-bottom:10px;
    width:300px;

}
/* css class for login page user signup link */ 
.tdusersignup a
{
   /* text-decoration: underline;*/
    /*font-weight: bold;*/
   white-space: nowrap;
   color:#666666;

}  
/* css class for login page user signup link  hover*/    
.tdusersignup a:hover
{

    text-decoration: underline;
    white-space: nowrap;
     color:#666666;    
    /*font-weight: bold; */
}
/* css class for login page left side td */  
#tablelogin .right-side-text
{
    text-align:left;
    padding-right:5px;
    width:200px !important;
   /* width: 35%;  */
}
/* css class for login page right side td*/ 
#tablelogin .left-side-text
{
    text-align:left;
    padding-left:5px;
    width:200px !important;
 /*   width: 65%; */
}
/* css class for login roatate page left side td*/ 
#tableloginrotatecontent .right-side-text
{
   text-align:left; 
    padding-right:5px;
 
   /* width: 35%;  */
}
/* css class for login roatate page right side td*/ 
#tableloginrotatecontent .left-side-text
{
    text-align:left;
    padding-left:5px;
   
 /*   width: 65%; */
}
/* css class for login roatate page left side td*/   
#tablelogoutrotatecontent .right-side-text
{
   text-align:left; 
    padding-right:5px;
 
   /* width: 35%;  */
}
/* css class for login roatate page right side td*/   
#tablelogoutrotatecontent .left-side-text
{
    text-align:left;
    padding-left:5px;
   
 /*   width: 65%; */
}
/* css for edit profile page delete profile table */
#tabledeleteprofile
{
    margin:0px auto;
}
/* css class for login roatate page left side td*/
/* css for edit  delete profile table td*/ 
#tabledeleteprofile td
{

}
/* css for edit  delete profile span */ 
#tabledeleteprofile span
{
    font-size:13px;
    font-weight:bold;
    color:#FF0000;
}
/* css class for  delete profile button */ 
#tabledeleteprofile #buttondeleteprofile
{
  text-align:center !important;

}
/* css class for edit delete profile button */ 
#tabledeleteprofile #buttondeleteprofile .big-button  
{
  padding:0px !important;
}
/* css class for edit  delete profile small button  */ 
#tabledeleteprofile #buttondeleteprofile .small-button  
{

}
.subheadtd
{
    padding-top: 5px;
    text-align:center;
    padding-bottom: 15px;
    font-size:12px;
    font-weight:bold;
}
.border_left
{
     border-right:solid 1px #000000;
     text-align:left;
}

.border_right
{
     border-left:solid 1px #000000;
     text-align:left;
}
/* css for disaply countdown counter for redirect to login page*/
div.counter {
   margin-top: 5px;
   /*color: blue;*/
    color: #666666;
    font-size: 37pt;
   cursor: default;
}

div.info {
   margin: 0 auto;
   text-align: left;
   font-size: smaller;
   width: 80%;
   margin-top: 2em;
}
/* css class for please wait div*/
.model{
  padding-bottom:15px;
   padding-top:15px;
}
.affiliatesectionspace 
{
padding-top:20px;
}

#divMemberPageheight
{
   height:35px;     

}
/* common css for small button*/
.small-button
{
    
}
/* common css for big button*/  
.big-button      
{

}
/* common css for textbox focus */ 
.txtcss:focus
{
    
} 
/* common css for bigger button*/ 
.bigger-button
{

}
/* common css for normal button*/ 
.normal-button
{

}
/* css for one time offer page div*/
#divonetimeoffer
{
    width:90%;
    margin:0px auto;
    
}
/* css for one time offer page tabel*/ 
#tableonetimeoffer
{
    width:100%;
    margin:0px auto;

}
/* css for one time offer page tabel td*/     
#tableonetimeoffer td
{
    

}
/* css class for one time offer page left side td*/    
#tableonetimeoffer .right-side-text
{
    
}
/* css class for one time offer page right side td*/  
#tableonetimeoffer .left-side-text
{
   
}
/* css class for one time offer page radio lable/ 
#tableonetimeoffer .lblonetimeoffer
{
    padding-right:8px;
}
/* css class for one time offer page radio lable strong tag*/  
#tableonetimeoffer .lblonetimeoffer #strong
{
    color:#000;
}

 /* css class for one time offer page radio button*/  
#tableonetimeoffer .radioonetimeoffer
{
  vertical-align:middle;
}
/* css class for one time offer page product table */   
#tableonetimeofferproduct
{

}
/* css class for one time offer page product table td*/  
#tableonetimeofferproduct td
{

}
/* css class for one time offer page product table right td*/  
#tableonetimeofferproduct #tdrightonetimeoffer
{
   padding-left:0px;
}
/* css class for one time offer page product table left td*/  
#tableonetimeofferproduct #tdleftonetimeoffer
{
   padding-right:8px;
}
/* css class for one time offer page product table left td*/ 
#tableonetimeoffer .tdonetimeofferagreement
{
    padding:6px;
    padding-left:15px;

}
/* css  for one time offer page agreement div*/  
#tableonetimeoffer #agreement
{
    height:300px;
    width:365px;
    overflow:auto;
    border:1px solid #cccccc;
}
/* css  for one time offer page agreement radio button td*/  
#tableonetimeoffer .onetimeofferchktd
{
    padding:6px;
    padding-left:8px;

}
/* css  for one time offer page agreement radio  button div*/ 
 #tableonetimeoffer #dispAgree
{
   width:200px;
   clear:both;
}
/* css class for one time offer page agreement radio  button */ 
#tableonetimeoffer #dispAgree .chkcss
{
   vertical-align:middle;
}
/* css class for one time offer page button td */
#tableonetimeoffer .btnonetimetd
{
 padding:6px;
 
 padding-left:13px;
}      
/* Css class for Product subscription  li of ul*/
ul li.divdefaultpagesubscriptiondripli
{
margin: 0px;
padding: 0px;
line-height: 0px;
*font-size: 0px;  
}
/* Css class for Product subscription li of ol in ul li */  
ul li.divdefaultpagesubscriptiondripli ol li
{
font-size: 12px !important;
} 
/* Css class for Product subscription anchor tag of ul li */  
ul li.divdefaultpagesubscriptiondripli a
{
font-size: 1.1em;
line-height: normal;
}                                      
';
 break;
                                            
                                    case 'USER_UNSUBSCRIBE':
                                            $lsValues[1] = '
<div class="formformat"> 
<table width="100%" cellspacing="0" cellpadding="0" align="center"> 
<tbody> 
  <tr> 
    <td class="right-side-text"><center> 
        <label>You are successfully unsubscribed from mailing list</label></center></td> 
  </tr> 
</tbody> 
</table> 
</div>                                                
                                            ';
                                            break;
                                            
                                    case 'USER_SUBSCRIBE':
                                            $lsValues[1] = '
<div class="formformat"> 
<table width="100%" cellspacing="0" cellpadding="0" align="center"> 
<tbody> 
  <tr> 
    <td class="right-side-text"><center> 
        <label>You are successfully subscribed from mailing list</label></center></td> 
  </tr> 
</tbody> 
</table> 
</div>                                                
                                            ';
                                            break;
                                            
                                }   
                            }
                            $lsValues[1] = htmlentities($lsValues[1],ENT_QUOTES);
                            
                            $query = $loManageThemePages->GetQuery($lsValues[0],$name,$lsValues[1],$lsValues[2],$lsValues[3],$lsValues[4],$lsValues[5]);
                            
                            $lsInsertedrows = $loManageThemePages->Insert($query);
                            $lsValues[1] = ' '; 
                      }
                      
                      
                      
                  }
                  //echo "Total Inserted Rows = ".$lsInsertedrows."<br />";
                  $message->SetMessage('Theme is Added Successfully.');
                  
                    if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
                          Redirect($_SESSION[SESSION_PREFIX.'page_referrer'],true);
                       else  
                          Redirect('admin_theme_v.php');
                      
                  
                break;
        
        case 'update':
                  $lTypes = null;
                  
                  if($_POST)
                  {
                          /*********************************************************************************************/
                          /*                        Check Theme Name is exist or not                                   */  
                          /*********************************************************************************************/
                          $selectQuery = 'SELECT * FROM '.TABLE_PREFIX.'theme WHERE name=?';
                          $lsThemeName = array($_POST['txtThemeName']);
                          
                          $dataIsExist = $loManageTheme->View($selectQuery,$lsThemeName,null);
                          
                           if($dataIsExist != null and $dataIsExist[0]['id'] != $_POST['hiddID'])
                           {
                                $message->SetMessage('Record with "'.$_POST['txtThemeName'].'" theme name is alredy exist.');
                                  
                           if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
                                Redirect($_SESSION[SESSION_PREFIX.'page_referrer'],true);
                            else  
                              Redirect('admin_theme_v.php');
                                break;
                           
                           }
                          
                          /*********************************************************************************************/
                          $query = 'SELECT name FROM '.TABLE_PREFIX.'theme WHERE id='.$_POST['hiddID'];
                          $lsThemeName = $loManageTheme->View($query,null,null);
                                            
                          $lsValues = array();
                          
                          if(strtoupper($lsThemeName[0]['name']) == 'DEFAULT')
                          {
                                $query = 'UPDATE '.TABLE_PREFIX.'theme SET description=?, isdefault=?, modifiedon=?, modifiedby=?, modifiedipaddress=? WHERE id=?';  
                          }
                          else
                          {
                                $query = 'UPDATE '.TABLE_PREFIX.'theme SET name=?, description=?, isdefault=?, modifiedon=?, modifiedby=?, modifiedipaddress=? WHERE id=?';  
                                $lsValues[] = $_POST['txtThemeName'];
                          }
                          
                          $lsValues[] = $_POST['txtDescription'];
                          $lsValues[] = $_POST['hiddIsDefault'];//$_POST['ddlStatus'];
                          $lsValues[] = mktime();
                          $lsValues[] =  $_SESSION[SESSION_PREFIX.'Admin_UserID'];
                          $lsValues[] = $_SERVER['REMOTE_ADDR'];
                          $lsValues[] = $_POST['hiddID'];
                          
                          $lsUpdatedrows = $loManageTheme->Update($query,$lsValues,null);
                          
                          //echo "Total Updated Row = ".$lsUpdatedrows."<br/>";
                           $message->SetMessage('Theme is Update Successfully.');
                  }       
                    
                    
                  if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
                          Redirect($_SESSION[SESSION_PREFIX.'page_referrer'],true);
                    else  
                       Redirect('admin_theme_v.php');
                      
                                                                                
                break;
        
        case 'delete':
                      if(isset($_GET['id']) and $_GET['id'] != '')
                      {
                            $lTypes = null;
                            $query = 'SELECT * FROM '.TABLE_PREFIX.'theme WHERE id=? AND isdefault=1';  
                            $lsValues = array($_GET['id']);
                            
                            $lsResultrow = $loManageTheme->View($query,$lsValues,null);
                            if($lsResultrow > 0 or strtoupper($lsResultrow[0]['name']) == "DEFAULT")
                            {
                                    $message->SetMessage('You can not delete default selected theme.');
                            }
                            else
                            {
                                    unset($lsValues);
                                    
                                    $query = 'SELECT name FROM '.TABLE_PREFIX.'theme WHERE id='.$_GET['id'];
                                    $lsThemeName = $loManageTheme->View($query,null,null);
                                    
                                    if(strtoupper($lsThemeName[0]['name']) == 'DEFAULT')
                                    {
                                        $message->SetMessage('You can not delete default theme.');
                                    }
                                    else
                                    {
                                        $query = 'DELETE t,tp FROM '.TABLE_PREFIX.'theme t INNER JOIN '.TABLE_PREFIX.'theme_pages tp WHERE t.id=tp.themeid and t.id=?';
                                        $lsValues = array($_GET['id']);
                                    
                                        $lsDeletedrow = $loManageTheme->Delete($query,$lsValues,null);
                                        
                                        if($lsDeletedrow > 0)
                                        {
                                            $message->SetMessage('Theme is delete successfully.');
                                        }
                                        else
                                        {
                                            $message->SetMessage('Some error occure! Please try again.');    
                                        }
                                    }
                                    
                                   // Redirect('admin_theme_v.php');
                            }
                      }
                      
                    $quest="&";
                    if(isset($_GET) && !empty($_GET))
                     {
                         foreach($_GET as $keyname => $value) {
                              if(strtoupper($keyname)!='ACTION')
                                 $quest.=$keyname."=".$value."&";
                            }     
                     
                     }
                     
               
                  if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
                      Redirect($_SESSION[SESSION_PREFIX.'page_referrer'],true);
                   else  
                      Redirect("admin_theme_v.php?$quest"); 
                       
                    
                break;
        
        case 'edit':
                if(isset($_GET['id']) and $_GET['id'] != '')
                {
                        $lTypes = null;
                        $query = 'SELECT * FROM '.TABLE_PREFIX.'theme WHERE id=?';
                        
                        $lsValues = array($_GET['id']);
                        
                        $lsUpdaterows = $loManageTheme->View($query,$lsValues,null);
                        if(strtoupper($lsUpdaterows[0]['name']) == "DEFAULT")
                        {
                            $smarty->assign('IsDefaultTheme','yes');
                        }
                        $smarty->assign('data',$lsUpdaterows);
                                      
                        $smarty->assign('IsEdit','yes');
                        $smarty->display('admin_theme_m.tpl');
                }
                else
                {
                    if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
                       Redirect($_SESSION[SESSION_PREFIX.'page_referrer'],true);
                     else  
                     Redirect('admin_theme_v.php'); 
                }
                break;
                
        case 'make_default':
                 $lTypes = null;
                    /******************************* check created file permission ******************************************/
                    $lsCreatedFile = array('USER_PAGE_MAIN');
                    $lsCreatedCss  = array('WEBSITE_CSS');
                    
                    $folderpath = PHYSICAL_DIR.'/templates/';
                    $flag = 1;
                    $error = '<div style="text-align:left"><b>Please change the read and write permission to following files:</b><br/>';
                    foreach($lsCreatedFile as $key=>$pagename)
                    {
                           $pagename .= '.tpl';
                           
                            if(function_exists('chmod'))
                                 @chmod($folderpath.$pagename,0777);
                           
                           //$pagename = strtolower($pagename);
                            if(!is_writable($folderpath.strtolower($pagename)))
                            { 
                                   $error .= '/templates/'.strtolower($pagename).'<br/>';
                                   //$message->SetMessage('Please change /templates/ folders all templates file permission to read and write');
                                   //Redirect('admin_theme_v.php',true);
                                   $flag = 0;
                            }
                    }
                    $folderpath = PHYSICAL_DIR.'/css/';
                    $cssfile = 'userpanel.css';
                      
                    if(function_exists('chmod'))
                        @chmod($folderpath.$cssfile,0777);
                                 
                    if(!is_writable($folderpath.$cssfile))
                    { 
                           //$message->SetMessage('Please change /css/ folder userpanel.css file permission to read and write');
                           $error .= '/css/userpanel.css';
                           $flag = 0;
                           //Redirect('admin_theme_v.php',true);
                    }
                    $error .= '</div>';
                    if($flag == 0)
                    {
                        $message->SetMessage($error);
                        $_SESSION[SESSION_PREFIX.'is_err']=true;
                        
                        if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
                             Redirect($_SESSION[SESSION_PREFIX.'page_referrer'],true);
                         else  
                            Redirect('admin_theme_v.php'); 
                    }
                            
                    /******************************* end check created file permission ******************************************/
                    
                 $query = 'UPDATE '.TABLE_PREFIX.'theme SET `isdefault` = CASE WHEN id = ? THEN 1 ELSE 0 END';
                 
                 $lsValues = array($_GET['id']);
                 
                 $lsUpdatedrows = $loManageTheme->Update($query,$lsValues,null);
                 
                  if($lsUpdatedrows > 0)
                  { 
                          /*********************** Code for crate user templates file ***********************/
                       // $lsCreatedFile = array('USER_HEADER','USER_LEFTPANE','USER_RIGHTPANE','USER_FOOTER');
                       //$lsCreatedFile = array('user_header','user_leftpane','user_rightpane','user_footer','user_page_main','user_unsubscribe','user_subscribe');
                       $lsCreatedFile = array('USER_FOOTER','USER_HEADER','USER_LEFTPANE','USER_PAGE_MAIN','USER_RIGHTPANE','USER_SUBSCRIBE','USER_UNSUBSCRIBE');
                       
                       $lTypes = null;
                       //$query = 'SELECT * FROM '.TABLE_PREFIX.'theme_pages WHERE themeid = ? AND (name LIKE(\'USER_%\') OR name LIKE(\'%_CSS\'))';
                       $query = 'SELECT * FROM '.TABLE_PREFIX.'theme_pages WHERE themeid = ? AND name LIKE(\'USER_%\') order by `name`';
                       //echo $query;
                       $lsValues = array($_GET['id']);
                 
                       $result = $loManageThemePages->View($query,$lsValues,null);
                       //echo "<pre>";
                       //print_r($result);                      
                       //echo "</pre>";
                       //die;
                       $folderpath = PHYSICAL_DIR.'/templates';
                       
                       $liArrayIndex = 0;
                       
                       foreach($lsCreatedFile as $createfile)
                       {
                                $filename   = strtolower($createfile);
                                
                                $folder = $folderpath;
                                if(!file_exists($folder))
                                {
                                    $slastFolder=""; 
                                    $explodedFolder=explode("/", $folder);
                                    foreach($explodedFolder as $key=>$value)
                                    {
                                        if(!file_exists($slastFolder.$value))
                                        {
                                          mkdir($slastFolder.$value) ;
                                        }  
                                        $slastFolder.=$value."/";
                                    }  
                                      $filefolder = $slastFolder;
                                }
                                else
                                {
                                        $filefolder = $folderpath;   
                                }



                                $fileContent = (isset($result[$liArrayIndex]['content']) && ($result[$liArrayIndex]['content'] != '')) ? stripslashes($result[$liArrayIndex]['content']) : '<div></div>';
                                
                                
                                
                                if(trim($filename) == 'user_page_main')
                                {                                    
                                    $fileContent = '
                                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                                    <html xmlns="http://www.w3.org/1999/xhtml">
                                    <head>
                                        <title>{$PAGE_TITLE}</title> 
                                        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                                        <meta http-equiv="Content-Style-Type" content="text/css" />
                                        <link href="{$WEB_URL}/css/userpanel.css" rel="stylesheet" type="text/css" />
                                        <link href="{$WEB_URL}/css/layout.css" rel="stylesheet" type="text/css" />
                                        
                                        <script language="javascript" type="text/javascript" src="{$WEB_URL}/js/gen_validator.js" >
                                        </script>
                                         
                                        <script language="javascript" type="text/javascript" src="{$WEB_URL}/js/coolRedirect.js" >
                                        </script>
                                        
                                        <script language="javascript" type="text/javascript" src="{$WEB_URL}/js/functions.js" >
                                        </script>

                                        <script src="{$WEB_URL}/js/rollover.js" type="text/javascript"></script>
                                        <script src="{$WEB_URL}/admin/js/functions.js" type="text/javascript"></script>   
                                         <script language="javascript" type="text/javascript" src="{$USER_JS_DIR}/jquery-1.4.2.min.js"></script>
                                         <script language="javascript" type="text/javascript" src="{$USER_JS_DIR}/jquery.blockUI.js"></script> 
                                    </head>
                                    <body>
                                    '.$fileContent.'


</body>
</html>';
                                }
      
                                
                                
                                //add literal tag for script tag
                                $fileContent = eregi_replace('<style','{literal}<style',$fileContent);
                                $fileContent = eregi_replace('</style>','</style>{/literal}',$fileContent);
                                
                                //$fileContent = eregi_replace('<script','{literal}<script',$fileContent);
                                //$fileContent = eregi_replace('</script>','</script>{/literal}',$fileContent);      
                                $fileContent = html_entity_decode($fileContent,ENT_QUOTES);
                                $handle = fopen($filefolder."/".strtolower($filename).".tpl","w+");
                                fwrite($handle,$fileContent);
                                fclose($handle);
                                $liArrayIndex = $liArrayIndex + 1;   
                                
                                
                        }
                         
                         /********************* For user panel css ***********************/
                         $query = 'SELECT * FROM '.TABLE_PREFIX.'theme_pages WHERE themeid = ? AND name LIKE(\'%_CSS\')';
                 
                         //$lsValues = array($_GET['id']);
                 
                         $result = $loManageThemePages->View($query,$lsValues,null);
                         
                         $liArrayIndex = 0;
                         
                         $folderpath = PHYSICAL_DIR.'/css';
                         $filename   = 'userpanel';
                            
                            $folder = $folderpath;
                            if(!file_exists($folder))
                            {
                                $slastFolder=""; 
                                $explodedFolder=explode("/", $folder);
                                foreach($explodedFolder as $key=>$value)
                                {
                                    if(!file_exists($slastFolder.$value))
                                    {
                                      mkdir($slastFolder.$value) ;
                                    }  
                                    $slastFolder.=$value."/";
                                }  
                                  $filefolder = $slastFolder;
                            }
                            else
                            {
                                    $filefolder = $folderpath;   
                            }
                            $fileContent = ($result[$liArrayIndex]['content'] != '') ? stripslashes($result[$liArrayIndex]['content']) : 'Page is under construction!';
                            $handle = fopen($filefolder."/".strtolower($filename).".css","w+");
                            fwrite($handle,$fileContent);
                            fclose($handle);
                            $liArrayIndex = $liArrayIndex + 1;
                           
                         /*********************** End of code ***********************/
                  }
                  
                    foreach($lsCreatedFile as $key=>$pagename)
                    {
                           $pagename .= '.tpl';
                           
                            if(function_exists('chmod'))
                                 @chmod($folderpath.$pagename,0644);
                           
                    } 
                    
                    $folderpath = PHYSICAL_DIR.'/css/';
                    $cssfile = 'userpanel.css';
                      
                    if(function_exists('chmod'))
                        @chmod($folderpath.$cssfile,0644);
                  
                  $message->SetMessage('Theme is change successfully.');
                 
                  if(isset($_SESSION[SESSION_PREFIX.'page_referrer']))
                       Redirect($_SESSION[SESSION_PREFIX.'page_referrer'],true);
                     else  
                     Redirect('admin_theme_v.php'); 
                 
                break;
       
        default:
                $smarty->display('admin_theme_m.tpl');
    }
?>
Return current item: MembersGear