diff --git a/scp/admin.inc.php b/scp/admin.inc.php index a580fa6986b87661b039419bcf178e5ae46ad12e..8b3da09e6e6fbd55eeb81f9a93f9216fb6fe183e 100644 --- a/scp/admin.inc.php +++ b/scp/admin.inc.php @@ -15,34 +15,29 @@ **********************************************************************/ require('staff.inc.php'); //Make sure config is loaded and the staff is set and of admin type -if(!$cfg or !$thisstaff or !$thisstaff->isadmin()){ +if(!$cfg or !$thisstaff or !$thisstaff->isadmin()) { header('Location: index.php'); require('index.php'); // just in case! exit; } //Some security related warnings - bitch until fixed!!! :) -if(defined('THIS_VERSION') && strcasecmp($cfg->getVersion(),THIS_VERSION)) { - $sysnotice=sprintf('The script is version %s while the database is version %s.',THIS_VERSION,$cfg->getVersion()); - if(file_exists('../setup/')) - $sysnotice.=' Possibly caused by incomplete <a href="../setup/upgrade.php">upgrade</a>.'; - $errors['err']=$sysnotice; -}elseif(!$cfg->isHelpDeskOffline()) { - if(file_exists('../setup/')){ - $sysnotice='Please take a minute to delete <strong>setup/install</strong> directory for security reasons.'; - }else{ - - if(CONFIG_FILE && file_exists(CONFIG_FILE) && is_writable(CONFIG_FILE)) { +if($cfg->isUpgradePending()) { + $errors['err']=$sysnotice='System upgrade is pending <a href="../setup/upgrade.php">Upgrade Now</a>'; +} elseif(!$cfg->isHelpDeskOffline()) { + + if(file_exists('../setup/')) { + $sysnotice='Please take a minute to delete <strong>setup/install</strong> directory (../setup/) for security reasons.'; + } elseif(CONFIG_FILE && file_exists(CONFIG_FILE) && is_writable(CONFIG_FILE)) { //Confirm for real that the file is writable by group or world. clearstatcache(); //clear the cache! $perms = @fileperms(CONFIG_FILE); if(($perms & 0x0002) || ($perms & 0x0010)) { $sysnotice=sprintf('Please change permission of config file (%s) to remove write access. e.g <i>chmod 644 %s</i>', - basename(CONFIG_FILE),basename(CONFIG_FILE)); + basename(CONFIG_FILE), basename(CONFIG_FILE)); } - } - } + if(!$sysnotice && ini_get('register_globals')) $sysnotice='Please consider turning off register globals if possible'; } diff --git a/scp/staff.inc.php b/scp/staff.inc.php index b3ee30a4ec3a555c2fd8c3c86ed6e72b2c6517ca..bddf874cf976f4a170b3782330b7fdc3b8a87732 100644 --- a/scp/staff.inc.php +++ b/scp/staff.inc.php @@ -63,19 +63,19 @@ if(!$thisstaff || !is_object($thisstaff) || !$thisstaff->getId() || !$thisstaff- exit; } //2) if not super admin..check system status and group status -if(!$thisstaff->isadmin()){ - //Staff are not allowed to login in offline mode!! - if($cfg->isHelpDeskOffline()){ - staffLoginPage('System Offline'); - exit; - } +if(!$thisstaff->isadmin()) { //Check for disabled staff or group! if(!$thisstaff->isactive() || !$thisstaff->isGroupActive()) { staffLoginPage('Access Denied. Contact Admin'); exit; } -} + //Staff are not allowed to login in offline mode!! + if($cfg->isHelpDeskOffline() || $cfg->isUpgradePending()) { + staffLoginPage('System Offline'); + exit; + } +} //Keep the session activity alive $thisstaff->refreshSession(); @@ -93,10 +93,9 @@ $errors=array(); $msg=$warn=$sysnotice=''; $tabs=array(); $submenu=array(); - -if(defined('THIS_VERSION') && strcasecmp($cfg->getVersion(),THIS_VERSION)) { - $errors['err']=$sysnotice=sprintf('The script is version %s while the database is version %s',THIS_VERSION,$cfg->getVersion()); -}elseif($cfg->isHelpDeskOffline()){ +if($cfg->isUpgradePending()) { + $errors['err']=$sysnotice='System upgrade is pending <a href="../setup/upgrade.php">Upgrade Now</a>'; +} elseif($cfg->isHelpDeskOffline()) { $sysnotice='<strong>System is set to offline mode</strong> - Client interface is disabled and ONLY admins can access staff control panel.'; $sysnotice.=' <a href="settings.php">Enable</a>.'; }