"; if (isset($_FILES['userfile'])) { // Inhalt aus der Uploaddatei ermitteln echo JAVAHELP_INFO1."
"; $handle = @fopen ($_FILES['userfile']['tmp_name'], "r"); if (!$handle) { // Kann nicht mit TMP Dateien arbeiten, also vorher verschieben $res = @move_uploaded_file($_FILES['userfile']['tmp_name'],"upload/galas.txt"); if (!$res) { echo "Upload der Datei fehlgeschlagen!
Bitte erstellen sie im secret Ordner ein Verzeichnis \"upload\" und geben sie Schreibrechte fÃŒr dieses Verzeichnis (\"chmod 777 upload\")!
"; } else { $contents = file_get_contents("upload/galas.txt"); $indirect_input = false; } } else { // Arbeiten mit dem Tempfile $contents = @fread ($handle, filesize ($_FILES['userfile']['tmp_name'])); @fclose ($handle); $indirect_input = false; } } else { // Wie frÃŒher die galas.txt aus dem eigenen Verzeichnis nehmen // liest den Inhalt einer Datei in einen String echo JAVAHELP_INFO2."
"; $filename = "galas.txt"; if (file_exists($filename)) { $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); fclose ($handle); } else { echo JAVAHELP_ERROR1."
"; } $indirect_input = true; } if (isset($contents) && !empty($contents) && is_utf8($contents)) { $contents = str_replace("\r","",$contents); // in Englische Version portieren $contents = str_replace("System","Solar system",$contents); // new english + swedish $contents = str_replace("Sonnensystem","Solar system",$contents); // German $contents = str_replace("Sistema solare","Solar system",$contents); // Italian $contents = str_replace("Sistema solar","Solar system",$contents); // Spanish $contents = str_replace("Sistema Solar","Solar system",$contents); // Portugues $contents = str_replace("Zonnestelsel","Solar system",$contents); // Dutch $contents = str_replace("Solarni sistem","Solar system",$contents); // Balkan $contents = str_replace("Système solaire","Solar system",$contents); // French $contents = str_replace("Układ Słoneczny","Solar system",$contents); // Polish $contents = str_replace("Günes Sistemi","Solar system",$contents); // Turkish $contents = str_replace("Solsystem","Solar system",$contents); // Danish $contents = str_replace("Солнечная система","Solar system",$contents); // Russian $contents = str_replace("Σύστημα","Solar system",$contents); // Greek $contents = str_replace("Sistem","Solar system",$contents); // Romanian $contents = str_replace("Rendszer","Solar system",$contents); // Hungarian $contents = str_replace("Systém","Solar system",$contents); // Czech $contents = str_replace($korean_solar_system,"Solar system",$contents); // korean if (strpos($contents,"itibariyle mevcut olan hammadde") !== false) { $contents = preg_replace("/(.*\s\[\d+\:\d+\:\d+\]\s+\(.*\)\s\w+\s+\d+\-\d+\s\d+:\d+:\d+\s)(itibariyle mevcut olan hammadde)/","$2 $1",$contents); } $contents = str_replace("Rohstoffe auf","Resources on",$contents); // German $contents = str_replace("Recursos en","Resources on",$contents); // Spanish $contents = str_replace("Recursos em","Resources on",$contents); // Portugues $contents = str_replace("Grondstoffen op","Resources on",$contents); // Dutch $contents = str_replace("Sirovine na","Resources on",$contents); // Balkan $contents = str_replace("Matières premières sur","Resources on",$contents); // French $contents = str_replace("Surowce na","Resources on",$contents); // Polish $contents = str_replace("Risorse su","Resources on",$contents); // Italian $contents = str_replace("itibariyle mevcut olan hammadde","Resources on",$contents); // Turkish $contents = str_replace("Råstoffer","Resources on",$contents); // Danish $contents = str_replace("Сырьё на","Resources on",$contents); // Russian $contents = str_replace("Πόροι στο","Resources on",$contents); // Greek $contents = str_replace("Resurser på","Resources on",$contents); // Swedish $contents = str_replace("Resursele pe","Resources on",$contents); // Romanian $contents = str_replace("Erőforrások a","Resources on",$contents); // Hungarian $contents = str_replace("Suroviny na","Resources on",$contents); // Czech $contents = str_replace("Ressurser på","Resources on",$contents); // Norwegian $contents = str_replace("Ресирси на","Resources on",$contents); // Bulgarian $contents = str_replace("Resursai","Resources on",$contents); // Lithuanian $contents = str_replace("Resursi uz","Resources on",$contents); // Latvian $contents = str_replace("Resurssit","Resources on",$contents); // Finnish $contents = str_replace($taiwan_resources_on,"Resources on",$contents); // Taiwan // $contents = preg_replace("/(\d+\-\d+\s\d+\:\d+\:\d+)(\s+Flottbefällhavare\s+Spionagerapport av\s+[\w\s\_\-]+\[\d+\:\d+\:\d+\])/","$2 $1",$contents); // Swedish // $contents = str_replace("Spionagerapport av","Resources on",$contents); // Swedish // $contents = str_replace("Resurser på","",$contents); // Swedish has a bug - no coodinates or name behind the report only visible at fleet status if (strpos($contents,$korean_resources_on) !== false) { // korean $contents .= "Resources on ".$contents; } $contents = preg_replace($japan_resource_pattern,"Resources on $3 $4 at $1",$contents); // Japan // prÃŒfen ob es eine Datei mit Galaxieansichten ist if (strpos($contents,"Solar system") === false) { // Spioberichte if ($_SESSION['s_probeview']) { // turkish version! if ($_SESSION['lang'] == "turkish") { $contents = str_replace("\r","",$contents); $tmp = explode("\n",$contents); $new = ""; foreach ($tmp as $line) { if (strpos($line,"Resources on") !== false) { $line = str_replace("Resources on","",$line); $new .= "Resources on " . $line."\n"; } else { $new .= $line."\n"; } } } $spio_array = preg_split('/Resources on/',$contents,-1); $spioparser = new Probeparser($dbusername,$dbpassword,$dbname,$reporttable,$dbtablename,$playertable,$dbhost); if (!$indirect_input) { // Keine Datei erstellen for ($i=1;$iparseEntry("Resources on".$spio_array[$i],$_SESSION['s_userid']) === false) { // error handling foreach ($spioparser->error as $error_entry) { if (is_array($error_entry)) { $error_text = implode(" ",$error_entry); echo "
".REPORTS_UNKNOWN_ENTRIES.": ".$error_text."
"; } else { echo "
".$error_entry."
"; } } } } } } else { echo READ_PERMISSION."
"; } } else { // Galaxieansichten // String zerlegen $gala_array = preg_split('/Solar system[\n|\t|\s]+Solar system/',$contents,-1); $parser = new Parser($dbusername,$dbpassword,$dbname,$dbtablename,$allytable,$playertable,$dbhost); if (!$indirect_input) { // Keine Datei erstellen for ($i=1;$iparseString("Solar system\n\nSolar system".$gala_array[$i],false,false); if ($queryarray === false) { echo $parser->error."
"; } } } else { // dbquery.sql Datei erstellen - Problem sind dann die nicht aktualisierten Notizen! (depricated!!!) $filename = fopen("dbquery.sql","w"); if (!$filename) { echo JAVAHELP_ERROR2."
"; } else { if (!fwrite($filename, "\n")) { echo JAVAHELP_ERROR3."
"; } else { // Datei erstellt und beschreibbar. for ($i=0;$iparseString($gala_array[$i],true); foreach ($queryarray as $query) fwrite($filename,trim($query)."\n"); } } } } } } elseif (isset($contents) && !is_utf8($contents)) { echo "Data must be UTF-8 encoded."; } echo ""; // Returns true if $string is valid UTF-8 and false otherwise. function is_utf8($string) { // From http://w3.org/International/questions/qa-forms-utf-8.html return preg_match('%^(?: [\x09\x0A\x0D\x20-\x7E] # ASCII | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 )*$%xs', $string); } // function is_utf8 ?>