20 require
"MagicConfig.php";
31 if (!($filehandle = @fopen(
$filename,
"rb")))
return undef;
32 set_magic_quotes_runtime(0);
33 $text = fread($filehandle, filesize(
$filename));
34 set_magic_quotes_runtime(get_magic_quotes_gpc());
41 $arr = unpack(
"C*",
$file);
42 for($i=1; $i<
sizeof($arr); $i++)
44 if ($arr[$i]<32 && $arr[$i]!=13 && $arr[$i]!=10)
return false;
52 $extensionspl = explode($this->config->separator,
$filename);
53 $extension = $extensionspl[
sizeof($extensionspl)-1];
54 $langstr = $this->config->extensions[$extension];
56 $langarr = explode(
"|", $langstr);
59 if (
sizeof($langarr)==1 && $langarr[0]!=
"")
return $langstr;
66 if ($this->config->file == undef)
return "illegal";
67 $this->is_ascii = $this->
_is_ascii($this->config->file);
75 foreach($langarr as
$lang)
77 if ($this->is_ascii && in_array($lang, $this->config->langfunctions))
78 array_push($outarray, $lang);
79 else if(in_array($lang, $this->config->binfunctions))
80 array_push($outarray, $lang);
82 $testarray = $outarray;
86 if ($this->is_ascii) $testarray = $this->config->langfunctions;
87 else $testarray = $this->config->binfunctions;
89 foreach($testarray as
$test)
91 $func =
"detect_".$test;
92 if ($this->config->$func())
return $test;