SQLCommand('SET NAMES '.$Config['Database']['Charset']); $Database->SelectDatabase($Config['Database']['Database']); if(Licence(LICENCE_ADMIN)) { // echo 'Přístup povolen'; } else die('Přístup zamítnut!'); include ('define.php'); function ReplaceVarInText($string) { $string = str_replace('$N', '"..strlower(UnitName("player")).."', $string); $string = str_replace('$n', '"..strlower(UnitName("player")).."', $string); $string = str_replace('$c', '"..strlower(UnitClass("player")).."', $string); $string = str_replace('$C', '"..strlower(UnitClass("player")).."', $string); $string = str_replace('$R', '"..strlower(UnitRace("player")).."', $string); $string = str_replace('$r', '"..strlower(UnitRace("player")).."', $string); $string = str_replace('$', '', $string); $string = str_replace(chr(13), '', $string); $string = str_replace(chr(10), '', $string); return($string); } // Funkce na přepsání zlých znaků function ReplaceEnText($string) { // $string = mysql_escape_string($string); $string = strtolower($string); $string = str_replace('$gman:woman;', '"..gsub(gsub(UnitSex("player"), "^2$", "man"), "^3$", "woman").."', $string); $string = str_replace('$g man : woman;', '"..gsub(gsub(UnitSex("player"), "^2$", "man"), "^3$", "woman").."', $string); $string = str_replace('$ghis:her;', '"..gsub(gsub(UnitSex("player"), "^2$", "his"), "^3$", "her").."', $string); $string = str_replace('$g his : her;', '"..gsub(gsub(UnitSex("player"), "^2$", "his"), "^3$", "her").."', $string); $string = str_replace('$glad:lass;', '"..gsub(gsub(UnitSex("lad"), "^2$", "his"), "^3$", "lass").."', $string); $string = str_replace('$g lad : lass;', '"..gsub(gsub(UnitSex("lad"), "^2$", "his"), "^3$", "lass").."', $string); $string = str_replace('"', '\"', $string); $string = str_replace('$b$b', ' ', $string); $string = str_replace('$b $b', ' ', $string); $string = str_replace('$b', ' ', $string); $string = str_replace(' ', ' ', $string); $string = ReplaceVarInText($string); return($string); } function ReplaceCzText($string) { $string = mysql_escape_string($string); $string = str_replace('$B', '\r\n', $string); $string = str_replace('$b', '\r\n', $string); $string = ReplaceVarInText($string); return($string); } for($j = 0; $j < count($ListFile); $j++) { //hlavní cyklus souborů echo $dir_out.$ListFile[$j]['File'].': '; $i = 0; $buffer = $ListFile[$j]['Header']; //hlavička souboru $sql = $ListFile[$j]['sql']; $ID = $Database->SQLCommand($sql); while ($Line = mysql_fetch_array($ID)) { $en = ReplaceEnText($Line['en']); $cz = ReplaceCzText($Line['cz']); if($en <> '' and $cz <> '') { $buffer = $buffer.' ["'.$en.'"]="'.$cz.'",'; $i = $i + 1; } } $buffer = $buffer.' '.$ListFile[0]['Footer'].'+'.$i.'; '; //patička souboru if($i > 0) { $file_handle = fopen($dir_out.$ListFile[$j]['File'], 'w'); $write_result = fwrite($file_handle, $buffer); fclose($file_handle); echo('HOTOVO
'); } else echo('ŽÁDNÝ TEXT
'); } ?>