CMS Made Simple PHP Cross Reference Content Management Systems

Source: /admin/header.php - 111 lines - 3350 bytes - Summary - Text - Print

   1  <?php
   2  
   3  cms_admin_sendheaders();
   4  $orig_memory = (function_exists('memory_get_usage')?memory_get_usage():0);
   5  $starttime = microtime();
   6  if (!(isset($USE_OUTPUT_BUFFERING) && $USE_OUTPUT_BUFFERING == false))
   7  {
   8      @ob_start();
   9  }
  10  
  11  $gCms = cmsms();
  12  $config = $gCms->GetConfig();
  13  $userid = get_userid();
  14  
  15  if (isset($USE_THEME) && $USE_THEME == false)
  16  {
  17    //echo '<!-- admin theme disabled -->';
  18  }
  19  else
  20  {
  21    debug_buffer('before theme load');
  22    $themeObject = cms_utils::get_theme_object();
  23    debug_buffer('after theme load');
  24  
  25    if( isset($headtext) && $headtext != '' ) {
  26      $themeObject->set_value('headertext',$headtext);
  27    }
  28  
  29    // Display notification stuff from modules
  30    // should be controlled by preferences or something
  31    $ignoredmodules = explode(',',get_preference($userid,'ignoredmodules'));
  32    if( get_site_preference('enablenotifications',1) && get_preference($userid,'enablenotifications',1) )
  33      {
  34        debug_buffer('before notifications');
  35        if( ($data = get_site_preference('__NOTIFICATIONS__')) )
  36      {
  37        $data = unserialize($data);
  38        if( is_array($data) && count($data) )
  39          {
  40            foreach( $data as $item )
  41          {
  42            $old = $item->html;
  43            $regex = '/'.CMS_SECURE_PARAM_NAME.'\=[0-9a-z]{8}/';
  44            $to = CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY];
  45            $new = preg_replace($regex,$to,$old);
  46  
  47            $themeObject->AddNotification($item->priority,
  48                          $item->name,
  49                          $item->html);
  50          }
  51          }
  52      }
  53            
  54        // if the install directory still existsx
  55        // add a priority 1 dashboard item
  56        if( file_exists(dirname(dirname(__FILE__)).'/install') )
  57      {
  58        $themeObject->AddNotification(1,'Core', lang('installdirwarning'));
  59      }
  60      
  61        // Display a warning if safe mode is enabled
  62        if( ini_get_boolean('safe_mode') && get_site_preference('disablesafemodewarning',0) == 0 )
  63      {
  64        $themeObject->AddNotification(1,'Core',lang('warning_safe_mode'));
  65      }
  66      
  67        // Display a warning sitedownwarning
  68        $sitedown_message = lang('sitedownwarning', TMP_CACHE_LOCATION . '/SITEDOWN');
  69        $sitedown_file = TMP_CACHE_LOCATION . '/SITEDOWN';
  70        if (file_exists($sitedown_file))
  71      {
  72        $themeObject->AddNotification(1,'Core',$sitedown_message);
  73      }
  74      
  75        // Display an upgrade notification 
  76        // but only do a check once per day
  77        {
  78      $timelastchecked = get_site_preference('lastcmsversioncheck',0);
  79      if( (get_site_preference('checkversion',1) && (time() - $timelastchecked) > (24 * 60 * 60)) || isset($_GET['forceversioncheck']) )
  80        {
  81          $req = new cms_http_request();
  82          $req->setTimeout(10);
  83          $req->execute(CMS_DEFAULT_VERSIONCHECK_URL);
  84          if( $req->getStatus() == 200 )
  85            {
  86          $remote_ver = trim($req->getResult());
  87          if( strpos($remote_ver,':') !== FALSE )
  88            {
  89              list($tmp,$remote_ver) = explode(':',$remote_ver,2);
  90              $remote_ver = trim($remote_ver);
  91            }
  92          if( version_compare(CMS_VERSION,$remote_ver) < 0 )
  93            {
  94              set_site_preference('cms_is_uptodate',0);
  95              $themeObject->AddNotification(1,'Core',lang('new_version_available'));
  96              audit('','Core','CMSMS version '.$remote_ver.' is available');
  97            }
  98          else
  99            {
 100              set_site_preference('cms_is_uptodate',1);
 101              audit('','Core','Tested for newer CMSMS Version. None Available.');
 102            }
 103            }
 104          set_site_preference('lastcmsversioncheck',mktime(23,59,55));
 105        }
 106        }
 107      }
 108  
 109    $themeObject->do_header();
 110  }
 111  ?>

title

Description

title

Description

title

Description

title

title

Body