Location: PHPKode > scripts > SecureLab > securelab/handlers/SLScriptHandler.Class.php
<?php
/*
 *  SecureLabs Project, 2012-Alfa.
 *  CLOSED TESTING ONLY!
 *
 *  Enercom Labs 2010-2012 (c) www.fileimg.ru/en/
 *
 *  This file is general controller of system.
 *  Any outside changes can be detected as hacker's
 *  attack attempt. This file marked as self-protected,
 *  system class 0-1: self-recovering, full rights (SYSTEM-SYS).
 *
 *  Information about this file:
 *
 *  @name       securelab-main.php
 *  @class      CLASS0-1
 *  @rigts      1: Full on SYSTEM-SYS
 *  @add        self-protected;self-copying;self-secured;self-restoring
 *  @package    Secure Lab PHP Lib
 *  @author     Alexander Belov (c), Enercom Labs
 *  @destrib    Enercom Labs 2010-2012 (c)
 *  @support    www.fileimg.ru/support:en-securelab-phplib
 *  @ver        from 11.02.2012
 */

 class SLScriptHandler {
	 
	 // Use this function to collect information about third-party scripts.
	 public function ScriptFileInfo($ScriptFileLocation, $EventArgs = array()) {
		$FileEx = explode(".", $ScriptFileLocation);
		if( file_exists($ScriptFileLocation) && $FileEx[(substr_count($ScriptFileLocation, "."))] == "slcs" ) {
			$FileContents = file_get_contents($ScriptFileLocation);
		}
	 }
	 
     /*
	 This function is loading the scripts file. Can be called with magic methods:
	 __("script:$filename")
	 $_SL["script:$filename"]
	 */
     public function LoadScriptFile($ScriptFileLocation, $EventArgs = array()) {
	 
		$ScriptVer1_0FunctionsColloction = array("filecheck", "include");
		$ScriptVer1_1FunctionsColloction = array("fchk", "load");
		$Collection = $ScriptVer1_0FunctionsColloction;
		
		$FileEx = explode(".", $ScriptFileLocation);
		if( file_exists($ScriptFileLocation) && $FileEx[(substr_count($ScriptFileLocation, "."))] == "slcs" ) {
			$FileContents = file_get_contents($ScriptFileLocation);
			$FilePreSettingsDetector = explode("/", $FileContents);
			if($FilePreSettingsDetector[0] == "delimiter") {
				if($FilePreSettingsDetector[1] == "lbr") {
						$Delimiter = "\r\n";
						$IgnoringDelimiter = ";";
				} elseif($FilePreSettingsDetector[1] == "semicolon") {
						$Delimiter = ";";
						$IgnoringDelimiter = "\r\n";
				} else {
						/*
						We can't detect the delimiter, so we must break the operatoion.
						Please, be shure you have set the right delimiter.
						*/
						echo "delimiter problem";exit;
						SLErrorReporter::ReportNewError( 951, array("SL_ERROR_SUBTEXT"=>"") );
						return false;
				}
				
				$Lines = explode( $Delimiter, strtr( $FileContents, array( $IgnoringDelimiter => "" ) ) );
				
				for( $Delimiters = 1; $Delimiters < substr_count( $FileContents, $Delimiter); $Delimiters ++ ) {
					if( $Lines[$Delimiters] != "" ) {
						$LineDetail = explode( " ", $Lines[$Delimiters] );
						switch( $LineDetail[0] ) {
							case "securelabscript":
								if( $LineDetail[1] == "ver1/0" ) {
									$Collection = $ScriptVer1_0FunctionsColloction;
								} elseif( $LineDetail[1] == "ver1/1" ) {
									$Collection = $ScriptVer1_1FunctionsColloction;
								} else {
									/*
									We can't detect the script version, operation cannot to be continued.
									Please, be shure you have set the right script version.
									You can use versions:
									1/0 - Intuitive features
									1/1 - For advanced users
									*/
									SLErrorReporter::ReportNewError( 632, array("SL_ERROR_SUBTEXT"=>"") );
									return false;
								}
								
								break;
								
							case $Collection[0]:
								if( file_exists( $LineDetail[1] ) ) {
								
								}
								
								break;
						}
					}
				}
			}
		} else { echo "no file"; }
	 }
 }

SLScriptHandler::LoadScriptFile("index.slcs");
?>
Return current item: SecureLab