Permalink
Browse files

Merge branch 'feature/upgrader' into feature/advanced-search

  • Loading branch information...
protich committed Apr 13, 2012
2 parents 4feeb82 + 550015d commit 4e545fad41320bd1ed911fae9f1061cef14d433b
View
@@ -28,21 +28,12 @@
define('ASSETS_PATH',ROOT_PATH.'assets/default/');
-
//Check the status of the HelpDesk.
-if(!is_object($cfg) || !$cfg->getId() || $cfg->isHelpDeskOffline()) {
+if(!is_object($cfg) || !$cfg->getId() || $cfg->isHelpDeskOffline() || $cfg->isUpgradePending()) {
include('./offline.php');
exit;
}
-//Forced upgrade? Version mismatch.
-if(defined('THIS_VERSION') && strcasecmp($cfg->getVersion(),THIS_VERSION)) {
- die('System is offline for an upgrade.');
- exit;
-}
-
-
-
/* include what is needed on client stuff */
require_once(INCLUDE_DIR.'class.client.php');
require_once(INCLUDE_DIR.'class.ticket.php');
View
@@ -67,22 +67,35 @@ function isHelpDeskOffline() {
return !$this->isSystemOnline();
}
+ function isHelpDeskOnline() {
+ return $this->isSystemOnline();
+ }
+
function isSystemOnline() {
- return ($this->config['isonline']);
+ return ($this->config['isonline'] && !$this->isUpgradePending());
}
- function isKnowledgebaseEnabled() {
+ function isUpgradePending() {
+ return (defined('SCHEMA_SIGNATURE') && strcasecmp($this->getSchemaSignature(), SCHEMA_SIGNATURE));
+ }
+ function isKnowledgebaseEnabled() {
require_once(INCLUDE_DIR.'class.faq.php');
return ($this->config['enable_kb'] && FAQ::countPublishedFAQs());
}
function getVersion() {
- return '1.7-DPR2';
+ return THIS_VERSION;
}
function getSchemaSignature() {
- return $this->config['schema_signature'];
+
+ if($this->config['schema_signature'])
+ return $this->config['schema_signature'];
+ elseif($this->config['ostversion']) //old version 1.6 st.
+ return md5($this->config['ostversion']);
+
+ return null;
}
function setMysqlTZ($tz) {
View
@@ -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';
}
View
@@ -63,19 +63,19 @@ function staffLoginPage($msg) {
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 @@ function staffLoginPage($msg) {
$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>.';
}
View
@@ -1,24 +0,0 @@
-<?php
-/*********************************************************************
- cleanup.php
-
- Cleanup script called via ajax to migrate attachments.
-
- Peter Rotich <peter@osticket.com>
- Copyright (c) 2006-2012 osTicket
- http://www.osticket.com
-
- Released under the GNU General Public License WITHOUT ANY WARRANTY.
- See LICENSE.TXT for details.
-
- vim: expandtab sw=4 ts=4 sts=4:
-**********************************************************************/
-session_start();
-if($_GET['c']>10) { //When Done send 304 - nothing else to do.
- $_SESSION['s']='done';
- session_write_close();
- header("HTTP/1.1 304 Not Modified");
- exit;
-}
-echo "Cleaning up...".time();
-?>
View
@@ -70,7 +70,7 @@ form .row span { width: 600px; color: #666666; }
#overlay { display: none; position: fixed; background: #000; z-index: 2000; }
-#loading { padding: 10px 10px 10px 60px; width: 300px; height: 100px; background: url('../images/ajax-loader.gif?1312925608') 10px 50% no-repeat white; position: fixed; display: none; z-index: 3000; }
+#loading { padding: 10px 10px 10px 60px; width: 400px; height: 150px; background: url('../images/ajax-loader.gif?1312925608') 10px 50% no-repeat white; position: fixed; display: none; z-index: 3000; }
#loading h4 { margin: 3px 0 0 0; padding: 0; color: #d80; }
.tip { display: inline-block; width: 16px; height: 16px; outline: none; text-decoration: none; color: #d80; }
Oops, something went wrong.

0 comments on commit 4e545fa

Please sign in to comment.