..we will make a new module and not just some new module, nope let's make a fully automatic injection script! This tutorial is the first step into making this. Let's first explain what..
<?php
/* Search for potential evil code */
if(!defined("IN_SCRIPT")){
exit;
}
if(!function_exists("GetFilesByDirectory")){
$sDest = $_PATHS['functions_root']."/getfilebydir.php";
include_once($sDest);
}
$sDir = $_PATHS['module_default_root']."/data/languages";
if(!$aFiles = GetFilesByDirectory($sDir)){
die(Screen($sOut."Can't look up for evil code as there are no language files present<br />\n",$_CONTEXT['verbose'],$_CONTEXT['silent']));
}
else{
// get the files to search for
$sDest = $_PATHS['module_default_root']."/data/searchfiles.txt";
if(!@filesize($sDest)){
die($sOut."<b id=h7>Missing or empty ".$sDest." in language folder</b>");
}
$sFileData = @str_replace("\r","",file_get_contents($sDest));
$_CONTEXT['thcaeplugs']['browsable'] = explode("\n",$sFileData);
// feed the evil code arrays
for($x=0;$x<count($aFiles);$x++){
$sDest = $_PATHS['module_default_root']."/data/languages/".$aFiles[$x];
if(!@filesize($sDest)){
die($sOut."<b id=h7>Missing or empty ".$aFiles[$x]." in language folder</b>");
}
$sFileData = @str_replace("\r","",file_get_contents($sDest));
$aExt = explode(".",$aFiles[$x]);
$_CONTEXT['thcaeplugs'][$aExt[0]] = explode("\n",$sFileData);
}
}
?>