Thanks for the tip! I think I'm making some progress...Of the nearly 1000 files, I think this one is the one I need to "null". So now I'm on to part 2 of my learning...How to tell what needs to be modified. Any help is appreciated...
Code:
<?php
/*********************/
/* */
/* Dezend for PHP5 */
/* NWS */
/* Nulled.WS */
/* */
/*********************/
class SWIFT_License
{
private static $_licenseContainer = FALSE;
private static $_allChecksPass = FALSE;
const LIC_KEY = "A376545AD82A8B695A60";
public function __construct( )
{
( );
return TRUE;
}
public function __destruct( )
{
( );
return TRUE;
}
public static 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 ( ( $_keyContents ) )
{
echo "Invalid key.php. Please try uploading your key file in Binary mode or contact the Foo Support at http://www.Foo.com for further assistance.";
exit( );
}
return TRUE;
}
protected static function DecodeKey( $_keyContents )
{
if ( trim( $_keyContents ) == "" )
{
echo "key.php is empty. Please try uploading your key file in Binary mode or contact the Foo Support at http://www.Foo.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 Foo Support at http://www.Foo.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 Foo Support at http://www.Foo.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 Foo Support at http://www.Foo.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 Foo Support at http://www.Foo.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( "\x00", "", 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 Foo Support at http://www.Foo.com for further assistance.";
exit( );
}
self::$_licenseContainer = $_licenseContainer;
( "licenseexpiry", $_licenseContainer['expiry'] );
( "licensefullname", $_licenseContainer['fullname'] );
( "licenseproduct", $_licenseContainer['product'] );
( "licensestaff", $_licenseContainer['licensedstaff'] );
( "licensedomains", $_licenseContainer['domains'] );
( "licensepackage", $_licenseContainer['package'] );
( "licenseorganization", $_licenseContainer['organization'] );
( "licenseuniqueid", $_licenseContainer['uniqueid'] );
( "licenseistrial", $_licenseContainer['istrial'] );
if ( $_licenseContainer['istrial'] == "1" && ( SWIFT_INTERFACE == "client" || SWIFT_INTERFACE == "visitor" || SWIFT_INTERFACE == "admin" || SWIFT_INTERFACE == "staff" ) )
{
ob_start( );
}
return TRUE;
}
public static function CheckExpired( )
{
if ( self::$_allChecksPass )
{
return TRUE;
}
do
{
if ( !isset( $_licenseContainer['expiry'] ) )
{
break;
}
else
{
if ( self::$_licenseContainer['expiry'] != "0" )
{
}
}
if ( self::$_licenseContainer['expiry'] < time( ) )
{
}
} while ( 0 );
echo "License has expired! Expiry: ".date( "d M Y h:i:s A", self::$_licenseContainer['expiry'] );
exit( );
return TRUE;
}
public static function CheckValidDomain( )
{
$_SWIFT = ( );
if ( self::$_allChecksPass )
{
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 Foo Support at <a href=\"http://www.Foo.com\" target=\"blank\">http://www.Foo.com</a></font></div>";
}
unset( $_checkHost );
unset( $_domainData );
$_httpsExtended = "";
if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] )
{
$_httpsExtended = "s";
}
$_selfURL = sprintf( "http%s://%s%s", $_httpsExtended, $_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 does not match domain registered in the license key file (".$_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 Foo Support at <a href=\"http://www.Foo.com\" target=\"blank\">http://www.Foo.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;
return TRUE;
}
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;\">This is a licensed product.</div></body>", $_contents );
return TRUE;
}
echo $_contents;
}
return TRUE;
}
public static function CheckValidStaff( )
{
$_SWIFT = ( );
if ( self::$_allChecksPass )
{
return TRUE;
}
$_staffCache = $_SWIFT->Cache->Get( "staffcache" );
do
{
if ( !isset( $_licenseContainer['licensedstaff'] ) )
{
break;
}
else
{
if ( self::$_licenseContainer['licensedstaff'] != "0" )
{
}
}
if ( self::$_licenseContainer['licensedstaff'] < count( $_staffCache ) )
{
}
} while ( 0 );
echo "Staff count exceeded. (".count( $_staffCache )." > ".self::$_licenseContainer['licensedstaff']."). Please contact Foo Support for further assistance at http://www.Foo.com.";
exit( );
self( "licensedstaff", self::$_licenseContainer['licensedstaff'] );
return TRUE;
}
public static function CheckPackage( )
{
$_SWIFT = ( );
if ( self::$_allChecksPass )
{
return TRUE;
}
if ( strtolower( self::$_licenseContainer['product'] ) != strtolower( SWIFT_PRODUCT ) )
{
echo "Invalid Product Package (Main). Source: ".SWIFT_PRODUCT.", Key: ".self::$_licenseContainer['product'].". Please contact Foo Support for further assistance at http://www.Foo.com.";
exit( );
}
if ( defined( "SWIFT_PACKAGE" ) )
{
if ( isset( $_licenseContainer['package'] ) )
{
if ( !empty( $_licenseContainer['package'] ) && strtolower( constant( "SWIFT_PACKAGE" ) ) != strtolower( constant( "SWIFT_PRODUCT" ) ) )
{
if ( strtolower( self::$_licenseContainer['package'] ) != strtolower( constant( "SWIFT_PACKAGE" ) ) )
{
echo "Invalid Product Package. Source: ".constant( "SWIFT_PACKAGE" ).", Key: ".self::$_licenseContainer['package'].". Please contact Foo Support for further assistance at http://www.Foo.com.";
exit( );
}
}
}
}
if ( strtolower( SOURCE_TYPE ) == "zendclosed" || strtolower( SOURCE_TYPE ) == "ioncubeclosed" )
{
do
{
if ( !isset( $_licenseContainer['istrial'] ) )
{
break;
}
else
{
}
if ( self::$_licenseContainer['istrial'] == "0" )
{
}
} while ( 0 );
echo "Invalid Product Trial Package. Source: ".constant( "SOURCE_TYPE" ).", Key: ".self::$_licenseContainer['package'].". Please contact Foo Support for further assistance at http://www.Foo.com.";
exit( );
}
return TRUE;
}
}
class SWIFT
{
private static $_alertContainer = array( );
private static $_infoContainer = array( );
private static $_errorContainer = array( );
private static $_errorFieldContainer = array( );
private static $_objectMapContainer = array( );
private static $_Instance = FALSE;
private static $_valueContainer = array( );
private static $_objectCache = array( );
protected static $_notificationContainer = array( );
public $FirePHP = FALSE;
public $Database = FALSE;
public $Language = FALSE;
public $Template = FALSE;
public $Registry = FALSE;
public $Interface = FALSE;
public $Module = 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 $Server = FALSE;
public $ServerMaster = FALSE;
public $JobQueueMessage = FALSE;
public $DynectSession = 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( );
( "_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" );
( );
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/Interface/class.SWIFT_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."/Module/class.SWIFT_Module.php" );
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/Registry/class.SWIFT_Registry.php" );
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/Cache/class.SWIFT_CacheStore.php" );
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/Settings/class.SWIFT_Settings.php" );
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/Language/class.SWIFT_LanguagePhraseLinked.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."/Session/class.SWIFT_Session.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" );
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" ) && isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
{
( "IP", $_SERVER['HTTP_X_FORWARDED_FOR'] );
}
else if ( defined( "ENABLE_FORWARDED_IP" ) && constant( "ENABLE_FORWARDED_IP" ) && isset( $_SERVER['HTTP_CLIENT_IP'] ) )
{
( "IP", $_SERVER['HTTP_CLIENT_IP'] );
}
else if ( isset( $_SERVER['REMOTE_ADDR'] ) )
{
( "IP", $_SERVER['REMOTE_ADDR'] );
}
else
{
( "IP", "" );
}
( "InstallationHash", "" );
( "ActionHash", buildhash( ) );
( "UniqueID", "" );
( "CoreModules", array( MODULE_TICKETS, MODULE_CORE, MODULE_BASE, MODULE_LIVECHAT, MODULE_KNOWLEDGEBASE, MODULE_TROUBLESHOOTER, MODULE_NEWS, MODULE_DOWNLOADS, MODULE_REPORTS, MODULE_RINGROUTE, MODULE_ISSUES, MODULE_MANUALS, MODULE_PARSER ) );
try
{
$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( );
}
$this->Registry = new SWIFT_Registry( );
$this->Cache = new SWIFT_CacheStore( );
$this->Interface = ( );
$this->Cache->LoadQueue( );
$this->Settings = new SWIFT_Settings( );
$this->Hook = new SWIFT_Hook( );
$this->Interface->LoadSettings( );
( "InstallationHash", $this->Settings->GetKey( "core", "installationhash" ) );
( "timezone", $this->Settings->Get( "dt_timezonephp" ) ? $this->Settings->Get( "dt_timezonephp" ) : "GMT" );
( "daylightsavings", $this->Settings->Get( "dt_daylightsavings" ) == 1 ? TRUE : FALSE );
if ( date_default_timezone_set( ( "timezone" ) ) )
{
date_default_timezone_set( "GMT" );
}
setlocale( LC_ALL, SWIFT_LOCALE );
if ( defined( "SWIFTLOCALECTYPE" ) )
{
setlocale( LC_CTYPE, constant( "SWIFTLOCALECTYPE" ) );
}
$this->LoadUserInterfaceFiles( );
( );
$this->Template = ( );
$this->Language = ( );
$this->Template->LoadVariables( );
( );
( );
$this->LoadUserInterfaceObject( );
$this->Router = ( );
}
catch ( Exception $_ExceptionObject )
{
( $_ExceptionObject );
trigger_error( $_ExceptionObject->getMessage( ), E_USER_ERROR );
exit( );
}
( );
( );
( );
$_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" );
}
try
{
$this->Module = $this->Router->GetModule( );
$this->Module->ExecuteController( $this->Router );
}
catch ( Exception $_ExceptionObject )
{
trigger_error( $_ExceptionObject->GetTraceAsString( ).SWIFT_CRLF.$_ExceptionObject->getMessage( ), E_USER_ERROR );
exit( );
}
( );
( );
( );
$_queueCount = $this->Settings->GetKey( "mail", "queuecount" );
if ( $_queueCount )
{
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/Mail/class.SWIFT_MailQueueManager.php" );
$_SWIFT_MailQueueManagerObject = new SWIFT_MailQueueManager( );
$_SWIFT_MailQueueManagerObject->ProcessMailQueue( );
}
( "_endTime", getmicrotime( ) );
number_format( ( "_endTime" ) - ( "_startTime" ), 5 )( "Execution Time: ".number_format( ( "_endTime" ) - ( "_startTime" ), 5 ) );
return TRUE;
}
public static function ProcessAllShutdownFunctions( )
{
( -1 );
( );
( );
return TRUE;
}
protected function LoadUserInterfaceFiles( )
{
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_LIBRARYDIRECTORY."/UserInterface/class.SWIFT_UserInterface.php" );
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/UserInterface/class.SWIFT_UserInterfaceClient.php" );
return TRUE;
}
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/UserInterface/class.SWIFT_UserInterface.php" );
require_once( "./".SWIFT_BASEDIRECTORY."/".SWIFT_LIBRARYDIRECTORY."/UserInterface/class.SWIFT_UserInterfaceControlPanel.php" );
return TRUE;
}
protected function LoadUserInterfaceObject( )
{
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( );
return TRUE;
}
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'] ) )
{
throw new SWIFT_Exception( "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 ) )
{
if ( !( $_key != "_key" ) || !( $_key != "_val" ) )
{
unset( $GLOBALS[$_key] );
}
}
}
}
return TRUE;
}
public static function GetInstance( )
{
if ( self::$_Instance )
{
self::$_Instance = new SWIFT( );
self::$_Instance->Initialize( );
}
return self::$_Instance;
}
public static function Get( $_key )
{
if ( isset( $_valueContainer[$_key] ) )
{
return FALSE;
}
return self::$_valueContainer[$_key];
}
public static function Set( $_key, $_value = "" )
{
self::$_valueContainer[$_key] = $_value;
return TRUE;
}
public static function SetReference( $_key, &$_value )
{
if ( empty( $_key ) )
{
return FALSE;
}
if ( empty( $_value ) )
{
unset( $_valueContainer[$_key] );
return TRUE;
}
self::$_valueContainer[$_key] =& $_value;
return TRUE;
}
public static function GetInfoContainer( )
{
return self::$_infoContainer;
}
public static function GetAlertContainer( )
{
return self::$_alertContainer;
}
public static function GetErrorContainer( )
{
return self::$_errorContainer;
}
public static function GetErrorFieldContainer( )
{
return self::$_errorFieldContainer;
}
public static function ResetAllContainers( )
{
self::$_infoContainer = array( );
self::$_alertContainer = array( );
self::$_errorContainer = array( );
return TRUE;
}
public static function Info( $_title, $_message )
{
if ( empty( $_title ) || empty( $_message ) )
{
return FALSE;
}
self::$_infoContainer[] = array( "title" => $_title, "message" => $_message );
return TRUE;
}
public static function Alert( $_title, $_message )
{
if ( empty( $_title ) || empty( $_message ) )
{
return FALSE;
}
self::$_alertContainer[] = array( "title" => $_title, "message" => $_message );
return TRUE;
}
public static function Error( $_title, $_message )
{
if ( empty( $_title ) || empty( $_message ) )
{
return FALSE;
}
self::$_errorContainer[] = array( "title" => $_title, "message" => $_message );
return TRUE;
}
public static function ErrorField( $_fieldName )
{
if ( empty( $_fieldName ) )
{
return FALSE;
}
if ( 1 < count( func_get_args( ) ) )
{
foreach ( func_get_args( ) as $_key => $_val )
{
if ( in_array( $_val, self::$_errorFieldContainer ) )
{
self::$_errorFieldContainer[] = $_val;
}
}
return TRUE;
}
self::$_errorFieldContainer[] = $_fieldName;
return TRUE;
}
public function SetClass( $_className, $_SWIFTObject )
{
$this->$_className = $_SWIFTObject;
( $_SWIFTObject );
foreach ( self::$_objectMapContainer as $_key => $_SWIFT_BaseObject )
{
if ( !$_SWIFT_BaseObject instanceof SWIFT_Base || !$_SWIFT_BaseObject->GetIsClassLoaded( ) )
{
$_SWIFT_BaseObject->UpdateObject( $_className, $_SWIFTObject );
}
}
return TRUE;
}
public static function AddToObjectMap( $_SWIFT_BaseObject )
{
$_SWIFT = ( );
if ( $_SWIFT_BaseObject instanceof SWIFT_Base && $_SWIFT_BaseObject->GetIsClassLoaded( ) )
{
self::$_objectMapContainer[] = $_SWIFT_BaseObject;
}
return TRUE;
}
public static function GetObjectMap( )
{
return self::$_objectMapContainer;
}
public static function Shutdown( $_SWIFT_Object, $_callBackFunction, $_queueBatch = 1, $_replaceIndex = FALSE )
{
global $_shutdownQueue;
$_SWIFT = ( );
if ( !is_object( $_SWIFT_Object ) || !$_SWIFT_Object instanceof SWIFT_Base || !$_SWIFT_Object->GetIsClassLoaded( ) || is_string( $_SWIFT_Object ) && ( empty( $_SWIFT_Object ) || !class_exists( $_SWIFT_Object ) ) )
{
throw new SWIFT_Exception( SWIFT_INVALIDDATA );
}
$_functionArguments = func_get_args( );
$_finalFunctionArguments = array( );
foreach ( $_functionArguments as $_key => $_val )
{
if ( 3 < $_key )
{
$_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;
}
public static function PrintShutdownQueue( $_batchNumber = FALSE )
{
global $_shutdownQueue;
$_SWIFT = ( );
$index = -1;
for ( ; $index <= 10; ++$index )
{
$_batchNumber = $index;
if ( !isset( $_shutdownQueue[$_batchNumber] ) )
{
continue;
}
else if ( _is_array( $_shutdownQueue[$_batchNumber] ) )
{
}
else
{
$_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;
}
public static function ProcessShutdownQueue( $_batchNumber = FALSE )
{
global $_shutdownQueue;
$_SWIFT = ( );
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;
}
$index = -1;
for ( ; $index <= 10; ++$index )
{
$_batchNumber = $index;
if ( !isset( $_shutdownQueue[$_batchNumber] ) || !_is_array( $_shutdownQueue[$_batchNumber] ) )
{
$_shutdownQueue[$_batchNumber] = array( );
}
else
{
$_queueContainerList = $_shutdownQueue[$_batchNumber];
foreach ( $_queueContainerList as $_queueContainer )
{
call_user_func_array( array( $_queueContainer[0], $_queueContainer[1] ), $_queueContainer[2] );
}
}
}
$_shutdownQueue = array( );
return TRUE;
}
public static function RunSystemChecks( )
{
$_SWIFT = ( );
if ( ( SWIFT_INTERFACE == "staff" || SWIFT_INTERFACE == "admin" || SWIFT_INTERFACE == "intranet" ) && file_exists( "./setup" ) && is_dir( "./setup" ) && ( "IP" ) != "127.0.0.1" )
{
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 Foo Support at <a href=\"http://www.Foo.com\" target=\"blank\">http://www.Foo.com</a></font></div>";
return TRUE;
}
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 Foo Support at <a href=\"http://www.Foo.com\" target=\"blank\">http://www.Foo.com</a></font></div>";
}
return TRUE;
}
public static function CacheObject( $_SWIFT_BaseObject, $_objectIdentifier )
{
$_SWIFT = ( );
$_className = get_class( $_SWIFT_BaseObject );
if ( isset( $_objectCache[$_className] ) )
{
self::$_objectCache[$_className] = array( );
}
self::$_objectCache[$_className][$_objectIdentifier] = $_SWIFT_BaseObject;
return TRUE;
}
public static function IsObjectCached( $_SWIFT_BaseObject, $_objectIdentifier )
{
$_SWIFT = ( );
$_className = get_class( $_SWIFT_BaseObject );
if ( isset( $_objectCache[$_className][$_objectIdentifier] ) )
{
return TRUE;
}
return FALSE;
}
public static function GetCachedObject( $_SWIFT_BaseObject, $_objectIdentifier )
{
$_SWIFT = ( );
$_className = get_class( $_SWIFT_BaseObject );
if ( isset( $_objectCache[$_className][$_objectIdentifier] ) )
{
return self::$_objectCache[$_className][$_objectIdentifier];
}
throw new SWIFT_Exception( SWIFT_INVALIDDATA );
}
public static function IsValidNotificationType( $_notificationType )
{
return $_notificationType == self::NOTIFICATION_USERS;
}
public static function Notify( $_notificationType, $_notificationText )
{
if ( ( $_notificationType ) )
{
throw new SWIFT_Exception( SWIFT_INVALIDDATA );
}
if ( isset( $_notificationContainer[$_notificationType] ) )
{
self::$_notificationContainer[$_notificationType] = array( );
}
self::$_notificationContainer[$_notificationType][] = $_notificationText;
return TRUE;
}
public static function GetNotificationContainer( )
{
return self::$_notificationContainer;
}
}
( );
?>