Skip to content
Snippets Groups Projects
Commit 550015dc authored by Peter Rotich's avatar Peter Rotich
Browse files

Add pending upgrade check

parent 88520be7
Branches
Tags
No related merge requests found
...@@ -15,34 +15,29 @@ ...@@ -15,34 +15,29 @@
**********************************************************************/ **********************************************************************/
require('staff.inc.php'); require('staff.inc.php');
//Make sure config is loaded and the staff is set and of admin type //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'); header('Location: index.php');
require('index.php'); // just in case! require('index.php'); // just in case!
exit; exit;
} }
//Some security related warnings - bitch until fixed!!! :) //Some security related warnings - bitch until fixed!!! :)
if(defined('THIS_VERSION') && strcasecmp($cfg->getVersion(),THIS_VERSION)) { if($cfg->isUpgradePending()) {
$sysnotice=sprintf('The script is version %s while the database is version %s.',THIS_VERSION,$cfg->getVersion()); $errors['err']=$sysnotice='System upgrade is pending <a href="../setup/upgrade.php">Upgrade Now</a>';
if(file_exists('../setup/')) } elseif(!$cfg->isHelpDeskOffline()) {
$sysnotice.=' Possibly caused by incomplete <a href="../setup/upgrade.php">upgrade</a>.';
$errors['err']=$sysnotice; if(file_exists('../setup/')) {
}elseif(!$cfg->isHelpDeskOffline()) { $sysnotice='Please take a minute to delete <strong>setup/install</strong> directory (../setup/) for security reasons.';
if(file_exists('../setup/')){ } elseif(CONFIG_FILE && file_exists(CONFIG_FILE) && is_writable(CONFIG_FILE)) {
$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)) {
//Confirm for real that the file is writable by group or world. //Confirm for real that the file is writable by group or world.
clearstatcache(); //clear the cache! clearstatcache(); //clear the cache!
$perms = @fileperms(CONFIG_FILE); $perms = @fileperms(CONFIG_FILE);
if(($perms & 0x0002) || ($perms & 0x0010)) { 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>', $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')) if(!$sysnotice && ini_get('register_globals'))
$sysnotice='Please consider turning off register globals if possible'; $sysnotice='Please consider turning off register globals if possible';
} }
......
...@@ -63,19 +63,19 @@ if(!$thisstaff || !is_object($thisstaff) || !$thisstaff->getId() || !$thisstaff- ...@@ -63,19 +63,19 @@ if(!$thisstaff || !is_object($thisstaff) || !$thisstaff->getId() || !$thisstaff-
exit; exit;
} }
//2) if not super admin..check system status and group status //2) if not super admin..check system status and group status
if(!$thisstaff->isadmin()){ if(!$thisstaff->isadmin()) {
//Staff are not allowed to login in offline mode!!
if($cfg->isHelpDeskOffline()){
staffLoginPage('System Offline');
exit;
}
//Check for disabled staff or group! //Check for disabled staff or group!
if(!$thisstaff->isactive() || !$thisstaff->isGroupActive()) { if(!$thisstaff->isactive() || !$thisstaff->isGroupActive()) {
staffLoginPage('Access Denied. Contact Admin'); staffLoginPage('Access Denied. Contact Admin');
exit; exit;
} }
}
//Staff are not allowed to login in offline mode!!
if($cfg->isHelpDeskOffline() || $cfg->isUpgradePending()) {
staffLoginPage('System Offline');
exit;
}
}
//Keep the session activity alive //Keep the session activity alive
$thisstaff->refreshSession(); $thisstaff->refreshSession();
...@@ -93,10 +93,9 @@ $errors=array(); ...@@ -93,10 +93,9 @@ $errors=array();
$msg=$warn=$sysnotice=''; $msg=$warn=$sysnotice='';
$tabs=array(); $tabs=array();
$submenu=array(); $submenu=array();
if($cfg->isUpgradePending()) {
if(defined('THIS_VERSION') && strcasecmp($cfg->getVersion(),THIS_VERSION)) { $errors['err']=$sysnotice='System upgrade is pending <a href="../setup/upgrade.php">Upgrade Now</a>';
$errors['err']=$sysnotice=sprintf('The script is version %s while the database is version %s',THIS_VERSION,$cfg->getVersion()); } elseif($cfg->isHelpDeskOffline()) {
}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='<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>.'; $sysnotice.=' <a href="settings.php">Enable</a>.';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment