Advertisement
Guest User

Untitled

a guest
Oct 6th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.96 KB | None | 0 0
  1. #0 File: ./__swift/apps/base/models/CustomField/class.SWIFT_CustomFieldValue.php Line: 97 Function: SWIFT_Database->AutoExecute(swcustomfieldvalues, (, 67, integer 0, integer 0, integer 31), UPDATE, customfieldvalueid = '4434608')
  2.  
  3. 92 return false;
  4. 93 } else if (!_is_array($this->GetUpdatePool())) {
  5. 94 return false;
  6. 95 }
  7. 96
  8. 97 $this->Database->AutoExecute(TABLE_PREFIX . 'customfieldvalues', $this->GetUpdatePool(), 'UPDATE', "customfieldvalueid = '" . intval($this->GetCustomFieldValueID()) . "'");
  9. 98
  10. 99 $this->ClearUpdatePool();
  11. 100
  12. 101 return true;
  13. 102 }
  14.  
  15. #1 File: ./__swift/apps/base/models/CustomField/class.SWIFT_CustomFieldValue.php Line: 344 Function: SWIFT_CustomFieldValue->ProcessUpdatePool()
  16.  
  17. 339 ### $this->UpdatePool('staffid', intval($_SWIFT->Staff->GetStaffID()));
  18. 340 ### }
  19. 341 #------------hronop code end
  20. 342 }
  21. 343
  22. 344 $this->ProcessUpdatePool();
  23. 345
  24. 346 return true;
  25. 347 }
  26. 348
  27. 349 /**
  28.  
  29. #2 File: ./__swift/apps/base/library/CustomField/class.SWIFT_CustomFieldManager.php Line: 486 Function: SWIFT_CustomFieldValue->Update(67, FALSE, FALSE)
  30.  
  31. 481 }
  32. 482
  33. 483 // If the value is already set then update it
  34. 484 if (isset($_customFieldValueObjectContainer[$_customFieldID]))
  35. 485 {
  36. 486 $_customFieldValueObjectContainer[$_customFieldID]->Update($_fieldValue, $_isSerialized, $_isEncrypted);
  37. 487
  38. 488 // Or create a new one if it doesnt exist
  39. 489 } else {
  40. 490 SWIFT_CustomFieldValue::Create($_customFieldID, $_linkTypeID, $_fieldValue, $_isSerialized, $_isEncrypted);
  41. 491 }
  42.  
  43. #3 File: ./__apps/tickets/staff/class.Controller_Ticket.php Line: 2727 Function: SWIFT_CustomFieldManager->Update(integer 1, integer 1, (integer 3, integer 4, integer 9), integer 1, 76903, 6)
  44.  
  45. 2722 }
  46. 2723
  47. 2724 // Update Custom Field Values
  48. 2725 $this->CustomFieldManager->Update(SWIFT_CustomFieldManager::MODE_POST, SWIFT_UserInterface::MODE_EDIT,
  49. 2726 array(SWIFT_CustomFieldGroup::GROUP_STAFFTICKET, SWIFT_CustomFieldGroup::GROUP_USERTICKET, SWIFT_CustomFieldGroup::GROUP_STAFFUSERTICKET),
  50. 2727 SWIFT_CustomFieldManager::CHECKMODE_STAFF, $_SWIFT_TicketObject->GetTicketID(), $_SWIFT_TicketObject->GetProperty('departmentid'));
  51. 2728
  52. 2729 $_SWIFT_TicketObject->ProcessUpdatePool();
  53. 2730
  54. 2731 /*
  55. 2732 * BUG FIX - Ravi Sharma
  56.  
  57. #4 File: Line: Function: Controller_Ticket->EditSubmit(76903, vyhwingmyoofi32n157d0b1n3m, -1, -1, -1)
  58. #5 File: ./__swift/library/MVC/class.SWIFT_Controller.php Line: 371 Function: call_user_func_array(((object) Controller_Ticket, EditSubmit), (76903, vyhwingmyoofi32n157d0b1n3m, -1, -1, -1))
  59. #6 File: ./__swift/library/App/class.SWIFT_App.php Line: 176 Function: SWIFT_Controller::Load((object) SWIFT_Interface, (object) SWIFT_App, (object) SWIFT_Router, FALSE)
  60. #7 File: ./__swift/library/class.SWIFT.php Line: 16 Function: SWIFT_App->ExecuteController((object) SWIFT_Router)
  61.  
  62. 11 * @link http://www.kayako.com
  63. 12 *
  64. 13 * ###############################################
  65. 14 */
  66. 15
  67. 16 class SWIFT_License { const LIC_KEY = 'A376545AD82A8B695A60'; static private $_licenseContainer = false; static private $_allChecksPass = false; public function __construct() { parent::__construct(); return true; } public function __destruct() { parent::__destruct(); return true; } static public function Load() { if (SWIFT_INTERFACE == 'setup' || SWIFT_INTERFACE == 'console' || SWIFT_INTERFACE == 'winapp' || SWIFT_INTERFACE == 'visitor') { self::$_allChecksPass = true; return true; } if (!file_exists('./key.php')) { echo 'Unable to locate key.php, please ensure that the key.php is placed in the root directory of the package.'; exit; } $_keyContents = file_get_contents('./key.php'); if (!self::DecodeKey($_keyContents)) { echo 'Invalid key.php. Please try uploading your key file in Binary mode or contact the Kayako Support at https://support.kayako.com for further assistance.'; exit; } return true; } static protected function DecodeKey($_keyContents) { if (trim($_keyContents) == '') { echo 'key.php is empty. Please try uploading your key file in Binary mode or contact the Kayako Support at https://support.kayako.com for further assistance.'; exit; } $_finalKeyContents = ''; $_matches = array(); if (!preg_match('@\[([^\[\]]*)\]@', $_keyContents, $_matches)) { echo 'Invalid key.php (3). Please try uploading your key file in Binary mode or contact the Kayako Support at https://support.kayako.com for further assistance.'; exit; } $_finalKeyContents = $_matches[1]; $_keyChunksContainer = explode(';', $_finalKeyContents); if (count($_keyChunksContainer) != 4) { echo 'Invalid key.php (2). Please try uploading your key file in Binary mode or contact the Kayako Support at https://support.kayako.com for further assistance.'; exit; } $_md5Base64 = $_keyChunksContainer[0]; $_md5Decrypted = $_keyChunksContainer[1]; $_extendedKey = $_keyChunksContainer[2]; $_base64Data = $_keyChunksContainer[3]; if (md5($_base64Data) != $_md5Base64) { echo 'Invalid key.php (INVALID BASE64HASH). Please try uploading your key file in Binary mode or contact the Kayako Support at https://support.kayako.com for further assistance.'; exit; } if (empty($_extendedKey)) { echo 'Invalid key.php (INVALID EXTENDEDKEY). Please try uploading your key file in Binary mode or contact the Kayako Support at https://support.kayako.com for further assistance.'; exit; } $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $_decryptedData = str_replace("\x0", '', mcrypt_decrypt(MCRYPT_RIJNDAEL_256, self::LIC_KEY . $_extendedKey, base64_decode($_base64Data), MCRYPT_MODE_ECB, $iv)); $_licenseContainer = mb_unserialize($_decryptedData); if (empty($_decryptedData) || md5($_decryptedData) != $_md5Decrypted || !_is_array($_licenseContainer)) { echo 'Invalid key.php (INVALID DECRYPT). Please try uploading your key file in Binary mode or contact the Kayako Support at https://support.kayako.com for further assistance.'; exit; } self::$_licenseContainer = $_licenseContainer; SWIFT::Set('licenseexpiry', $_licenseContainer['expiry']); SWIFT::Set('licensefullname', $_licenseContainer['fullname']); SWIFT::Set('licenseproduct', $_licenseContainer['product']); SWIFT::Set('licensestaff', $_licenseContainer['licensedstaff']); SWIFT::Set('licensedomains', $_licenseContainer['domains']); SWIFT::Set('licensepackage', $_licenseContainer['package']); SWIFT::Set('licenseorganization', $_licenseContainer['organization']); SWIFT::Set('licenseuniqueid', $_licenseContainer['uniqueid']); SWIFT::Set('licenseistrial', $_licenseContainer['istrial']); if (isset($_licenseContainer['renewalduedateline'])) { SWIFT::Set('licenserenewal', $_licenseContainer['renewalduedateline']); } else if (isset($_licenseContainer['susexpiry'])) { SWIFT::Set('licenserenewal', $_licenseContainer['susexpiry']); } else { SWIFT::Set('licenserenewal', false); } if ($_licenseContainer['istrial'] == '1' && (SWIFT_INTERFACE == 'client' || SWIFT_INTERFACE == 'visitor' || SWIFT_INTERFACE == 'admin' || SWIFT_INTERFACE == 'staff')) { ob_start(); } return true; } static public function CheckExpired() { if (self::$_allChecksPass == true) { return true; } if (!isset(self::$_licenseContainer['expiry']) || (self::$_licenseContainer['expiry'] != '0' && self::$_licenseContainer['expiry'] < time())) { echo 'License has expired! Expiry: ' . date('d M Y h:i:s A', self::$_licenseContainer['expiry']); exit; } return true; } static public function CheckValidDomain() { $_SWIFT = SWIFT::GetInstance(); if (self::$_allChecksPass == true) { return true; } $_checkHost = false; $_domainData = parse_url($_SWIFT->Settings->Get('general_producturl')); if (strtolower(substr($_domainData['host'], 0, 4)) == 'www.') { $_checkHost = trim(strtolower(substr($_domainData['host'], 4))); } else { $_checkHost = trim(strtolower($_domainData['host'])); } $_allowedDomains = implode(',', self::$_licenseContainer['domains']); if (!in_array($_checkHost, self::$_licenseContainer['domains'])) { echo '<div style="position: absolute; left: 10px; top: 0; right: 10px; border: 1px SOLID darkred; background: #ffefbb; z-index: 999999999;"><font face="verdana, arial, helvetica, serif" size="3" color="red"><b>ERROR:</b> Domain does not match license key file domain (' . $_checkHost . '), allowed domains: ' . $_allowedDomains . ', please change the product path to match the domain under Admin CP > Settings > General Settings<br>This Product will not work properly unless untill that value is changed.<br /><br />For more information please contact the kayako support at <a href="https://support.kayako.com" target="blank">https://support.kayako.com</a></font></div>'; } unset($_checkHost); unset($_domainData); $_httpsExtended = ''; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE) { $_httpsExtended = 's'; } $_selfURL = sprintf('http%s://%s%s', $_httpsExtended, (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''), $_SERVER['REQUEST_URI']); $_checkHost = false; $_domainData = parse_url($_selfURL); if (strtolower(substr($_domainData['host'], 0, 4)) == 'www.') { $_checkHost = trim(strtolower(substr($_domainData['host'], 4))); } else { $_checkHost = trim(strtolower($_domainData['host'])); } $_allowedDomains = implode(',', self::$_licenseContainer['domains']); if (!in_array($_checkHost, self::$_licenseContainer['domains'])) { echo '<div style="position: absolute; left: 10px; top: 0; right: 10px; border: 1px SOLID darkred; background: #ffefbb; z-index: 999999999;"><font face="verdana, arial, helvetica, serif" size="3" color="red"><b>ERROR:</b> This domain name (' . $_checkHost . '), does not match the domain name in the license key file ' . $_allowedDomains . '.<br /><br />For assistance with your license, please contact the Kayako support team: <a href="https://support.kayako.com" target="blank">https://support.kayako.com</a></font></div>'; } if (self::$_licenseContainer['istrial'] == '1' && (SWIFT_INTERFACE == 'client' || SWIFT_INTERFACE == 'visitor' || SWIFT_INTERFACE == 'admin' || SWIFT_INTERFACE == 'staff')) { $_contents = ob_get_contents(); ob_end_clean(); if (isset($_SWIFT->Router) && $_SWIFT->Router instanceof SWIFT_Router && strtolower($_SWIFT->Router->GetAction()) == 'compressor') { echo $_contents; } else if (stristr($_contents, '</body>')) { echo str_replace('</body>', '<div style="width: 500px; margin: 6px auto; padding: 10px; font-weight: bold; text-align: center; border: 1px solid rgb(133, 171, 197); background: none repeat scroll 0% 0% rgb(239, 245, 249); font-size: 10px;"><a href="http://www.kayako.com">This is a trial product. To upgrade to a full version, please visit www.kayako.com</a></div></body>', $_contents); } else { echo $_contents; } } return true; } static public function CheckValidStaff() { $_SWIFT = SWIFT::GetInstance(); if (self::$_allChecksPass == true) { return true; } $_activeStaffCount = 0; $_staffCache = $_SWIFT->Cache->Get('staffcache'); foreach ($_staffCache as $_staffContainer) { if ($_staffContainer['isenabled'] == '1') { $_activeStaffCount++; } } if (!isset(self::$_licenseContainer['licensedstaff']) || (self::$_licenseContainer['licensedstaff'] != '0' && $_activeStaffCount > self::$_licenseContainer['licensedstaff'])) { echo 'Staff count exceeded. (' . $_activeStaffCount . ' > ' . self::$_licenseContainer['licensedstaff'] . '). Please contact Kayako Support for further assistance at https://support.kayako.com.'; exit; } SWIFT::Set('licensedstaff', self::$_licenseContainer['licensedstaff']); return true; } static public function CheckPackage() { $_SWIFT = SWIFT::GetInstance(); if (self::$_allChecksPass == true) { return true; } if (strtolower(self::$_licenseContainer['product']) != strtolower(SWIFT_PRODUCT)) { echo 'Invalid Product Package (Main). Source: ' . SWIFT_PRODUCT . ', Key: ' . self::$_licenseContainer['product'] . '. Please contact Kayako support for further assistance at https://support.kayako.com.'; exit; } if (defined('SWIFT_PACKAGE') && isset(self::$_licenseContainer['package']) && !empty(self::$_licenseContainer['package']) && strtolower(constant('SWIFT_PACKAGE')) != strtolower(constant('SWIFT_PRODUCT')) && strtolower(self::$_licenseContainer['package']) != strtolower(constant('SWIFT_PACKAGE'))) { echo 'Invalid Product Package. Source: ' . constant('SWIFT_PACKAGE') . ', Key: ' . self::$_licenseContainer['package'] . '. Please contact Kayako support for further assistance at https://support.kayako.com.'; exit; } if ((strtolower(SOURCE_TYPE) == 'zendclosed' || strtolower(SOURCE_TYPE) == 'ioncubeclosed' || strtolower(SOURCE_TYPE) == 'obfuscated') && (!isset(self::$_licenseContainer['istrial']) || self::$_licenseContainer['istrial'] == '0')) { echo 'Invalid Product Trial Package. Source: ' . constant('SOURCE_TYPE') . ', Key: ' . self::$_licenseContainer['package'] . '. Please contact Kayako support for further assistance at https://support.kayako.com.'; exit; } return true; } } SWIFT_License::Load(); class SWIFT { static private $_alertContainer = array(); static private $_infoContainer = array(); static private $_errorContainer = array(); static private $_errorFieldContainer = array(); static private $_themePathContainer = array(); static private $_objectMapContainer = array(); static private $_Instance = false; static private $_valueContainer = array(); static private $_objectCache = array(); static protected $_notificationContainer = array(); static protected $_isDebug = false; static private $_interfaceLoaded = false; public $FirePHP = false; public $Database = false; public $Language = false; public $Template; public $Registry = false; public $Interface = false; public $App = false; public $Session = false; public $Settings = false; public $Cache = false; public $Router = false; public $View = false; public $Cookie = false; public $Console = false; public $System = false; public $Controller = false; public $UserInterface = false; public $Load = false; public $Staff = false; public $User = false; public $Hook = false; public $HTMLPurifier = false; public $TemplateGroup = false; public $Input = false; public $Server = false; public $Cluster = false; public $ServerMaster = false; public $JavaScript = false; public $JobQueueMessage = false; public $DynectSession = false; public $Log = false; const NOTIFICATION_INFO = 'info'; const NOTIFICATION_ALERT = 'alert'; const NOTIFICATION_ERROR = 'error'; const NOTIFICATION_USERS = 'users'; const DEFAULT_ERROR_REPORTING = E_ALL; private function __construct() { return true; } protected function Initialize() { global $_shutdownQueue; $this->SanitizeGlobals(); $_shutdownQueue = array(); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_CONFIGDIRECTORY . '/config.php'); $this->FirePHP = new SWIFT_FirePHP(); self::Set('_startTime', GetMicroTime()); error_reporting(self::DEFAULT_ERROR_REPORTING); set_error_handler(array('SWIFT_Exception', 'GlobalErrorHandler')); set_exception_handler(array('SWIFT_Exception', 'GlobalExceptionHandler')); @ini_set('session.use_trans_sid',false); @ini_set('session.bug_compat_42',true); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Database/class.SWIFT_Database.php'); SWIFT_Database::DefineDSN(); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Interface/class.SWIFT_Interface.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/MVC/class.SWIFT_Model_Interface.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/MVC/class.SWIFT_Model.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/MVC/class.SWIFT_View.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/MVC/class.SWIFT_Controller.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/MVC/class.SWIFT_Library.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Log/class.SWIFT_Log.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/App/class.SWIFT_App.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Cache/class.SWIFT_CacheStore.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/LanguageEngine/class.SWIFT_LanguageEngine.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/TemplateEngine/class.SWIFT_TemplateEngine.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Date/class.SWIFT_Date.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Loader/class.SWIFT_Loader.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Cookie/class.SWIFT_Cookie.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Router/class.SWIFT_Router.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Data/class.SWIFT_Data.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Data/class.SWIFT_DataID.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Data/class.SWIFT_DataStore.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Hook/class.SWIFT_Hook.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/JavaScript/class.SWIFT_JavaScript.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_MODELSDIRECTORY . '/Registry/class.SWIFT_Registry.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_MODELSDIRECTORY . '/Settings/class.SWIFT_Settings.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_MODELSDIRECTORY . '/Session/class.SWIFT_Session.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Input/class.SWIFT_Input.php'); if (SWIFT_INTERFACE == 'tests') { require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Test/class.SWIFT_TestCase.php'); } $this->Log = new SWIFT_Log(); if (SWIFT_INTERFACE == 'console') { require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/Console/class.SWIFT_Console.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_LIBRARYDIRECTORY . '/System/class.SWIFT_System.php'); $this->Console = new SWIFT_Console(); $this->System = new SWIFT_System(); } if (defined('ENABLE_FORWARDED_IP') && constant('ENABLE_FORWARDED_IP') == true && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { self::Set('IP', GetClientIPFromXForwardedFor($_SERVER['HTTP_X_FORWARDED_FOR'])); } elseif (defined('ENABLE_FORWARDED_IP') && constant('ENABLE_FORWARDED_IP') == true && isset($_SERVER['HTTP_CLIENT_IP'])) { self::Set('IP', $_SERVER['HTTP_CLIENT_IP']); } elseif (isset($_SERVER['REMOTE_ADDR'])) { self::Set('IP', $_SERVER['REMOTE_ADDR']); } else { self::Set('IP', ''); } self::Set('InstallationHash', ''); self::Set('ActionHash', BuildHash()); self::Set('UniqueID', ''); self::Set('CoreApps', array(APP_TICKETS, APP_CORE, APP_BASE, APP_LIVECHAT, APP_KNOWLEDGEBASE, APP_TROUBLESHOOTER, APP_NEWS, APP_REPORTS, APP_PARSER)); self::Set('DefaultApps', array(APP_CORE, APP_BASE, APP_STATS)); try { SWIFT_Loader::RegisterAutoLoad(); $this->Cookie = new SWIFT_Cookie(); $this->Database = new SWIFT_Database(); if (!$this->Database->IsConnected()) { trigger_error('Unable to connect to Database. Please verify the username, password, grant permissions and the database status.', E_USER_ERROR); exit; } self::ProcessDebugMode(); register_shutdown_function(array($this, 'ProcessShutdown')); $this->Registry = new SWIFT_Registry(); $this->Cache = new SWIFT_CacheStore(); $this->Interface = SWIFT_Interface::Load(); $this->Cache->LoadQueue(); $this->Settings = new SWIFT_Settings(); $this->Hook = new SWIFT_Hook(); $this->Input = new SWIFT_Input(); self::Set('InstallationHash', $this->Settings->GetKey('core', 'installationhash')); self::Set('timezone', ($this->Settings->Get('dt_timezonephp')) ? $this->Settings->Get('dt_timezonephp') : 'GMT'); self::Set('daylightsavings', ($this->Settings->Get('dt_daylightsavings') == 1) ? true : false); if (!date_default_timezone_set(SWIFT::Get('timezone'))) { date_default_timezone_set('GMT'); } setlocale(LC_ALL, SWIFT_LOCALE); if (defined('SWIFTLOCALECTYPE')) { setlocale(LC_CTYPE, constant('SWIFTLOCALECTYPE')); } $this->Interface->LoadSettings(); $this->LoadUserInterfaceFiles(); SWIFT_Router::ParseTemplateGroup(); $this->Template = SWIFT_TemplateEngine::LoadEngine(); $this->Language = SWIFT_LanguageEngine::LoadEngine(); $this->Template->LoadVariables(); SWIFT_App::ParseInstalledApps(); SWIFT_App::ParseConfig(); SWIFT_Loader::LoadCache(); $this->LoadUserInterfaceObject(); $this->Router = SWIFT_Router::Load(); $this->JavaScript = new SWIFT_JavaScript(); } catch (Exception $_ExceptionObject) { SWIFT_Exception::GlobalExceptionHandler($_ExceptionObject); trigger_error($_ExceptionObject->getTraceAsString() . SWIFT_CRLF . $_ExceptionObject->getMessage(), E_USER_ERROR); exit; } SWIFT_License::CheckExpired(); SWIFT_License::CheckValidStaff(); SWIFT_License::CheckPackage(); if (SWIFT_INTERFACE != 'tests') { $_interfaceType = $this->Interface->GetInterface(); if ($_interfaceType == SWIFT_Interface::INTERFACE_ADMIN || $_interfaceType == SWIFT_Interface::INTERFACE_STAFF || $_interfaceType == SWIFT_Interface::INTERFACE_WINAPP || $_interfaceType == SWIFT_Interface::INTERFACE_SYNCWORKS || $_interfaceType == SWIFT_Interface::INTERFACE_RSS || $_interfaceType == SWIFT_Interface::INTERFACE_INTRANET || $_interfaceType == SWIFT_Interface::INTERFACE_PDA || $_interfaceType == SWIFT_Interface::INTERFACE_INSTAALERT || $_interfaceType == SWIFT_Interface::INTERFACE_MOBILE || $_interfaceType == SWIFT_Interface::INTERFACE_API || $_interfaceType == SWIFT_Interface::INTERFACE_STAFFAPI) { $this->Language->Load('staffactivitylog'); } } $this->App = $this->Router->GetApp(); $this->App->Initialize(); $this->Cache->LoadQueue(); $this->App->ExecuteController($this->Router); if (SWIFT_INTERFACE != 'tests') { self::RunSystemChecks(); } SWIFT_Loader::RebuildCache(); SWIFT_License::CheckValidDomain(); self::ProcessAllShutdownFunctions(); $_queueCount = $this->Settings->GetKey('mail', 'queuecount'); if ($_queueCount) { require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_MODELSDIRECTORY . '/Mail/class.SWIFT_MailQueueManager.php'); $_SWIFT_MailQueueManagerObject = new SWIFT_MailQueueManager(); $_SWIFT_MailQueueManagerObject->ProcessMailQueue(); } self::Set('_endTime', GetMicroTime()); $this->FirePHP->Info('Execution Time: ' . number_format(self::Get('_endTime') - self::Get('_startTime'), 5)); return true; } static public function ProcessAllShutdownFunctions() { self::ProcessShutdownQueue(-1); SWIFT_Model::ProcessShutdownUpdatePool(); self::ProcessShutdownQueue(); return true; } protected function LoadUserInterfaceFiles() { if (!file_exists('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_COREAPPSDIRECTORY . '/base/')) { return false; } if ($this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_CLIENT || $this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_VISITOR || $this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_RSS) { require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_COREAPPSDIRECTORY . '/base/' . SWIFT_LIBRARYDIRECTORY . '/UserInterface/class.SWIFT_UserInterface.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_COREAPPSDIRECTORY . '/base/' . SWIFT_LIBRARYDIRECTORY . '/UserInterface/class.SWIFT_UserInterfaceClient.php'); } else { require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_COREAPPSDIRECTORY . '/base/' . SWIFT_LIBRARYDIRECTORY . '/UserInterface/class.SWIFT_UserInterface.php'); require_once ('./' . SWIFT_BASEDIRECTORY . '/' . SWIFT_COREAPPSDIRECTORY . '/base/' . SWIFT_LIBRARYDIRECTORY . '/UserInterface/class.SWIFT_UserInterfaceControlPanel.php'); } self::$_interfaceLoaded = true; return true; } protected function LoadUserInterfaceObject() { if (self::$_interfaceLoaded === false) { return false; } if ($this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_CLIENT || $this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_VISITOR || $this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_RSS) { $this->UserInterface = new SWIFT_UserInterfaceClient(); } else if ($this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_STAFF || $this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_INTRANET || $this->Interface->GetInterface() == SWIFT_Interface::INTERFACE_ADMIN) { $this->UserInterface = new SWIFT_UserInterfaceControlPanel(); } return true; } protected function SanitizeGlobals() { if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS']) ) { die('Globals overwrite attempt detected! Terminating.'); } $_reserved = array('_reserved', 'GLOBALS', '_GET', '_POST', '_COOKIE', '_SERVER', '_ENV', '_REQUEST', '_FILES', 'argv'); if (is_array($GLOBALS)) { reset($GLOBALS); while (list($_key, $_val) = each($GLOBALS)) { if (!in_array($_key, $_reserved) && ($_key != '_key' && $_key != '_val')) { unset($GLOBALS[$_key]); } } } return true; } static public function GetInstance() { if (!self::$_Instance) { self::$_Instance = new SWIFT(); self::$_Instance->Initialize(); } return self::$_Instance; } static public function Get($_key) { if (!isset(self::$_valueContainer[$_key])) { return false; } return self::$_valueContainer[$_key]; } static public function Set($_key, $_value = '') { self::$_valueContainer[$_key] = $_value; return true; } static public function SetReference($_key, &$_value) { if (empty($_key)) { return false; } if (empty($_value)) { unset(self::$_valueContainer[$_key]); return true; } self::$_valueContainer[$_key] = &$_value; return true; } static public function GetInfoContainer() { return self::$_infoContainer; } static public function GetAlertContainer() { return self::$_alertContainer; } static public function GetErrorContainer() { return self::$_errorContainer; } static public function GetErrorFieldContainer() { return self::$_errorFieldContainer; } static public function ResetAllContainers() { self::$_infoContainer = array(); self::$_alertContainer = array(); self::$_errorContainer = array(); return true; } static public function Info($_title, $_message) { if (empty($_title) || empty($_message)) { return false; } self::$_infoContainer[] = array('title' => self::$_Instance->Input->SanitizeForXSS($_title), 'message' => self::$_Instance->Input->SanitizeForXSS($_message)); return true; } static public function Alert($_title, $_message) { if (empty($_title) || empty($_message)) { return false; } self::$_alertContainer[] = array('title' => self::$_Instance->Input->SanitizeForXSS($_title), 'message' => self::$_Instance->Input->SanitizeForXSS($_message)); return true; } static public function Error($_title, $_message) { if (empty($_title) || empty($_message)) { return false; } self::$_errorContainer[] = array('title' => self::$_Instance->Input->SanitizeForXSS($_title), 'message' => self::$_Instance->Input->SanitizeForXSS($_message)); return true; } static public function ErrorField($_fieldName) { if (empty($_fieldName)) { return false; } if (count(func_get_args()) > 1) { foreach (func_get_args() as $_key => $_val) { if (!in_array($_val, self::$_errorFieldContainer)) { self::$_errorFieldContainer[] = $_val; } } } else { self::$_errorFieldContainer[] = $_fieldName; } return true; } public function SetClass($_className, SWIFT_Base $_SWIFTObject) { $this->$_className = $_SWIFTObject; self::AddToObjectMap($_SWIFTObject); foreach (self::$_objectMapContainer as $_key => $_SWIFT_BaseObject) { if ($_SWIFT_BaseObject instanceof SWIFT_Base && $_SWIFT_BaseObject->GetIsClassLoaded()) { $_SWIFT_BaseObject->UpdateObject($_className, $_SWIFTObject); } } return true; } static public function AddToObjectMap(SWIFT_Base $_SWIFT_BaseObject) { $_SWIFT = SWIFT::GetInstance(); if ($_SWIFT_BaseObject instanceof SWIFT_Base && $_SWIFT_BaseObject->GetIsClassLoaded()) { self::$_objectMapContainer[] = $_SWIFT_BaseObject; } return true; } static public function GetObjectMap() { return self::$_objectMapContainer; } static public function Shutdown($_SWIFT_Object, $_callBackFunction, $_queueBatch = 1, $_replaceIndex = false) { global $_shutdownQueue; $_SWIFT = SWIFT::GetInstance(); if ((is_object($_SWIFT_Object) && (!$_SWIFT_Object instanceof SWIFT_Base || !$_SWIFT_Object->GetIsClassLoaded())) || (is_string($_SWIFT_Object) && (empty($_SWIFT_Object) || !class_exists($_SWIFT_Object, false)))) { throw new SWIFT_Exception(SWIFT_INVALIDDATA); } $_functionArguments = func_get_args(); $_finalFunctionArguments = array(); foreach ($_functionArguments as $_key => $_val) { if ($_key > 3) { $_finalFunctionArguments[] = $_val; } } $_index = 0; if (isset($_shutdownQueue[$_queueBatch])) { $_index = count($_shutdownQueue[$_queueBatch]); } else { $_shutdownQueue[$_queueBatch] = array(); } if ($_replaceIndex !== false) { $_index = $_replaceIndex; } $_shutdownQueue[$_queueBatch][$_index] = array($_SWIFT_Object, $_callBackFunction, $_finalFunctionArguments); return $_index; } static public function PrintShutdownQueue($_batchNumber = false) { global $_shutdownQueue; $_SWIFT = SWIFT::GetInstance(); for ($index = -1; $index <= 10; $index++) { $_batchNumber = $index; if (!isset($_shutdownQueue[$_batchNumber]) || !_is_array($_shutdownQueue[$_batchNumber])) { continue; } $_queueContainerList = $_shutdownQueue[$_batchNumber]; foreach ($_queueContainerList as $_queueContainer) { if (is_string($_queueContainer[0])) { echo 'S:' . $_queueContainer[0]; } else { echo 'C:' . get_class($_queueContainer[0]) . '(' . $_queueContainer[0]->GetInstanceID() . ')'; } echo '::' . $_queueContainer[1] . '<br />'; echo '<br />' . SWIFT_CRLF; } } return true; } static public function ProcessShutdownQueue($_batchNumber = false) { global $_shutdownQueue; $_SWIFT = SWIFT::GetInstance(); if ($_batchNumber !== false) { if (isset($_shutdownQueue[$_batchNumber]) && _is_array($_shutdownQueue[$_batchNumber])) { foreach ($_shutdownQueue[$_batchNumber] as $_queueContainer) { $_result = call_user_func_array(array($_queueContainer[0], $_queueContainer[1]), $_queueContainer[2]); } } $_shutdownQueue[$_batchNumber] = array(); return true; } for ($index = -1; $index <= 10; $index++) { $_batchNumber = $index; if (!isset($_shutdownQueue[$_batchNumber]) || !_is_array($_shutdownQueue[$_batchNumber])) { $_shutdownQueue[$_batchNumber] = array(); continue; } $_queueContainerList = $_shutdownQueue[$_batchNumber]; foreach ($_queueContainerList as $_queueContainer) { call_user_func_array(array($_queueContainer[0], $_queueContainer[1]), $_queueContainer[2]); } } $_shutdownQueue = array(); return true; } static public function RunSystemChecks() { $_SWIFT = SWIFT::GetInstance(); if ((SWIFT_INTERFACE == 'staff' || SWIFT_INTERFACE == 'admin' || SWIFT_INTERFACE == 'intranet') && file_exists('./setup') && is_dir('./setup') && SWIFT::Get('IP') != '127.0.0.1' && !preg_match('/kayako-test.com/', $_SWIFT->Settings->Get('general_producturl'))) { echo '<div style="position: absolute; left: 10px; top: 0; right: 10px; border: 1px SOLID darkred; background: #ffefbb; z-index: 999999999;"><font face="verdana, arial, helvetica, serif" size="3" color="red"><b>ERROR:</b> Setup directory has not been deleted. It is recommended that you immediately delete the setup directory to prevent any damage to your database.<br /><br />For more information please contact the kayako support at <a href="https://my.kayako.com" target="blank">https://my.kayako.com</a></font></div>'; } else if ((SWIFT_INTERFACE == 'staff' || SWIFT_INTERFACE == 'admin' || SWIFT_INTERFACE == 'intranet') && $_SWIFT->Settings->GetKey('core', 'version') != SWIFT_VERSION) { echo '<div style="position: absolute; left: 10px; top: 0; right: 10px; border: 1px SOLID darkred; background: #ffefbb; z-index: 999999999;"><font face="verdana, arial, helvetica, serif" size="3" color="red"><b>ERROR:</b> Product file version (' . SWIFT_VERSION . ') does not match with the database version (' . $_SWIFT->Settings->GetKey('core', 'version') . '). Please run the upgrade script to ensure that the product is up to date.<br /><br />For more information please contact the kayako support at <a href="https://my.kayako.com" target="blank">https://my.kayako.com</a></font></div>'; } return true; } static public function CacheObject(SWIFT_Base $_SWIFT_BaseObject, $_objectIdentifier) { $_SWIFT = SWIFT::GetInstance(); $_className = get_class($_SWIFT_BaseObject); if (!isset(self::$_objectCache[$_className])) { self::$_objectCache[$_className] = array(); } self::$_objectCache[$_className][$_objectIdentifier] = $_SWIFT_BaseObject; return true; } static public function IsObjectCached(SWIFT_Base $_SWIFT_BaseObject, $_objectIdentifier) { $_SWIFT = SWIFT::GetInstance(); $_className = get_class($_SWIFT_BaseObject); if (isset(self::$_objectCache[$_className][$_objectIdentifier])) { return true; } return false; } static public function GetCachedObject(SWIFT_Base $_SWIFT_BaseObject, $_objectIdentifier) { $_SWIFT = SWIFT::GetInstance(); $_className = get_class($_SWIFT_BaseObject); if (isset(self::$_objectCache[$_className][$_objectIdentifier])) { return self::$_objectCache[$_className][$_objectIdentifier]; } throw new SWIFT_Exception(SWIFT_INVALIDDATA); return false; } static public function IsValidNotificationType($_notificationType) { return ($_notificationType == self::NOTIFICATION_INFO || $_notificationType == self::NOTIFICATION_ALERT || $_notificationType == self::NOTIFICATION_ERROR || $_notificationType == self::NOTIFICATION_USERS); } static public function Notify($_notificationType, $_notificationText) { if (!self::IsValidNotificationType($_notificationType)) { throw new SWIFT_Exception(SWIFT_INVALIDDATA); } if (!isset(self::$_notificationContainer[$_notificationType])) { self::$_notificationContainer[$_notificationType] = array(); } self::$_notificationContainer[$_notificationType][] = $_notificationText; return true; } static public function GetNotificationContainer() { return self::$_notificationContainer; } static public function IsCP() { $_SWIFT = SWIFT::GetInstance(); $_interfaceName = $_SWIFT->Interface->GetName(); if ($_interfaceName == 'staff' || $_interfaceName == 'admin' || $_interfaceName == 'intranet') { return true; } return false; } static public function IsDebug() { return self::$_isDebug; } static public function ProcessDebugMode() { $_SWIFT = SWIFT::GetInstance(); if ((defined('SWIFT_DEBUG') && constant('SWIFT_DEBUG') === true) || (SWIFT::Get('IP') == '127.0.0.1') || (SWIFT::Get('IP') == '::1') ) { self::$_isDebug = true; } else { self::$_isDebug = false; } return true; } public function ProcessShutdown() { $_errorContainer = error_get_last(); if ($_errorContainer !== NULL) { chdir(SWIFT_BASEPATH); $_SWIFT_LogObject = new SWIFT_Log('error'); $_SWIFT_LogObject->Log($_errorContainer['type'] . ': ' . $_errorContainer['message'] . ' in ' . $_errorContainer['file'] . ':' . $_errorContainer['line']); } return true; } static public function SetThemePath($_themePathName, $_templateVariableName, $_themePath) { SWIFT::Set($_themePathName, $_themePath); self::$_themePathContainer[$_themePathName] = array($_templateVariableName, $_themePath); return true; } static public function GetThemePath() { return self::$_themePathContainer; } } ?>
  68.  
  69. #8 File: ./__swift/library/class.SWIFT.php Line: 16 Function: SWIFT->Initialize()
  70. #9 File: ./__swift/swift.php Line: 16 Function: SWIFT::GetInstance()
  71. #10 File: ./staff/index.php Line: 29 Function: require_once(./__swift/swift.php)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement