Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by paco ( 17 years ago )
function IncludeClasses()
{
	$ClassesPath = "include/".CLASSES_DIR;
	$Files = array_diff(scandir($ClassesPath), array(".", "..", STATIC_DIR, CLASSES_DIR, SECTIONS_DIR));
	$Eval = "";
	foreach($Files as $ClassFile)
	{
		preg_match("/(.*).class.php/", $ClassFile, $Matches);
		if(empty($Matches[1]))
			continue;
		$ClassPath = $ClassesPath."/".$ClassFile;
		require_once($ClassPath);
		$ClassName = GetClassName($ClassPath);
		if(!empty($ClassName))
		{
			$Name = str_replace(array(" "), array("_"), $Matches[1]);
			$Eval .= "$".$Name." = new ".$ClassName."();";
		}
		unset($ClassPath);
	}
	if(!empty($Eval))
		return $Eval;
}
function GetClassName($Path = "")
{
	if(empty($Path) || !file_exists($Path))
		return;
	$FileContents = file_get_contents($Path);
	preg_match("/.*class(.*){.*/Uis", $FileContents, $Matches);
	unset($FileContents);
	return trim($Matches[1]);	
}
/* END FUNCTIONS */

/* INCLUDE ALL CLASSES IN CLASSES_DIR DIRECTORY */
eval(IncludeClasses());

/* DISPLAY THE PAGE */
preg_match("/.*/(.*).php(.*)/", $_SERVER['PHP_SELF'], $Matches);
$ActiveDir = SECTIONS_DIR."/".$Matches[1];
if(!is_dir("include/".$ActiveDir))
	die($Lang->Write("BASE_DIR_ERROR", array(htmlspecialchars($ActiveDir))));
if(!empty($Matches[2]))
	$File = $ActiveDir.$Matches[2].".php";
else
	$File = $ActiveDir."/index.php";
if(file_exists("include/".$File))
	require_once($File);
else
	die($Lang->Write("BASE_FILE_ERROR", array(htmlspecialchars($File))));
unset($File, $ActiveDir);
/* END DISPLAY THE PAGE */

 

Revise this Paste

Your Name: Code Language: