- Timestamp:
- Mar 14, 2010, 10:08:33 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/import/index.php
r381 r382 3 3 include_once('../includes/global.php'); 4 4 include_once('../includes/dbc.php'); 5 include_once('import_lua.php'); 6 include_once('import_sql_mangos.php'); 7 include_once('import_dbc.php'); 8 include_once('update_version.php'); 5 include_once('import.php'); 9 6 10 7 ShowPage(); … … 17 14 } 18 15 19 if(!array_key_exists('source', $_GET))16 function ShowInstructions() 20 17 { 21 18 echo('<div> … … 32 29 <li>Až máme všechno pripraveno spustíme v konzoli script príkazem "php wowpreklad/import/cmd.php" kde jsou popsané možnosti paremetu s kterýma se tento script spoucí pro ruzné importy.</li> 33 30 <li>Po provedení importu je potreba nekolikrát spustit script na aktualizaci verze u prekladu. Je potreba ho prováde opakovane dokud nezmizí tecky oznacující že byly provedeny zmeny.</li> 34 </ol> 35 36 </div><div><strong>Načíst zdroj:</strong></div>'); 37 echo('<div><a href="?source=dbc">DBC soubory</a></div>'); 38 echo('<div><a href="?source=sql_mangos">SQL MaNGOS</a></div>'); 39 echo('<div><a href="?source=lua">LUA soubory</a></div>'); 40 echo('<div><a href="generatecodeXML.php">xml soubory</a></div>'); 41 echo('<div><a href="?source=update_version">aktualizace verze u překladů</a></div>'); 42 } else 31 </ol>'); 32 } 33 34 function ShowImportGroup() 43 35 { 44 echo('<div style="font-size: xx-small;">'); 45 switch($_GET['source']) 36 global $Config; 37 38 if(array_key_exists('id', $_GET)) 46 39 { 47 case 'sql_mangos': 48 foreach($TranslationTree as $Group) 49 { 50 if(($Group['MangosTable'] != '') and ($Group['TablePrefix'] != '') and ($Group['MangosDatabase'] == 'mangos')) 51 { 52 $tables[] = $Group['Id']; 53 } 54 } 55 if(!array_key_exists('group', $_GET)) 56 { 57 foreach($tables as $table) 58 { 59 echo('<a href="?source=sql_mangos&group='.$table.'">'.$TranslationTree[$table]['Name']. '</a>'); 60 if($table == $tables[0]) echo(' <strong>Pracuje</strong>'); 61 echo('<br />'); 62 } 63 echo('<br />'); 64 echo('<br />'); 65 ImportSQLMangos($Config['Web']['GameVersion'], $tables[0]); 66 if(isset($tables[1])) 67 { 68 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 69 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('?source=sql_mangos&group='.$tables[1]).'\'", 3000)</script>'); 70 } else 71 { 72 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 73 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('?source=update_version').'\'", 3000)</script>'); 74 } 75 } else 76 { 77 foreach($tables as $table) 78 { 79 echo('<a href="?source=sql_mangos&group='.$table.'">'.$TranslationTree[$table]['Name'].'</a>'); 80 if($table < $_GET['group']) echo(' <strong>Hotovo</strong>'); 81 if($table == $_GET['group']) echo(' <strong>Pracuje</strong>'); 82 echo('<br />'); 83 } 84 echo('<br />'); 85 echo('<br />'); 86 ImportSQLMangos($Config['Web']['GameVersion'], $_GET['group']); 87 if(isset($tables[array_search($_GET['group'],$tables) + 1])) 88 { 89 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 90 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('?source=sql_mangos&group='.$tables[array_search($_GET['group'],$tables)+1]).'\'", 3000)</script>'); 91 } else 92 { 93 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 94 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('?source=update_version').'\'", 3000)</script>'); 95 } 96 } 97 break; 98 case 'dbc': 99 foreach($TranslationTree as $Group) 100 { 101 if(($Group['DBCFileName'] != '') and ($Group['TablePrefix'] != '')) 102 { 103 $tables[] = $Group['Id']; 104 } 105 } 106 if(!array_key_exists('group', $_GET)) 107 { 108 foreach($tables as $table) 109 { 110 echo('<a href="?source=dbc&group='.$table.'">'.$TranslationTree[$table]['Name'].'</a>'); 111 if($table == $tables[0]) echo(' <strong>Pracuje</strong>'); 112 echo('<br />'); 113 } 114 echo('<br />'); echo ('<br />'); 115 ImportDBC($Config['Web']['GameVersion'], $tables[0]); 116 if(isset($tables[1])) 117 { 118 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 119 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('?source=dbc&group='.$tables[1]).'\'", 3000)</script>'); 120 } else 121 { 122 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 123 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('?source=update_version').'\'", 3000)</script>'); 124 } 125 } else 126 { 127 foreach($tables as $table) 128 { 129 echo('<a href="?source=dbc&group='.$table.'">'.$TranslationTree[$table]['Name'].'</a>'); 130 if($table < $_GET['group']) echo (' <strong>Hotovo</strong>'); 131 if($table == $_GET['group']) echo (' <strong>Pracuje</strong>'); 132 echo('<br />'); 133 } 134 echo('<br />'); 135 echo('<br />'); 136 ImportDBC($Config['Web']['GameVersion'], $_GET['group']); 137 if(isset($tables[array_search($_GET['group'], $tables) + 1])) 138 { 139 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 140 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('?source=dbc&group='.$tables[array_search($_GET['group'],$tables)+1]).'\'", 3000)</script>'); 141 } else 142 { 143 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 144 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('?source=update_version').'\'", 3000)</script>'); 145 } 146 } 147 break; 148 case 'update_version': 149 UpdateVersion(); 150 break; 151 case 'lua': 152 ImportLUA($Config['Web']['GameVersion']); //$Config['Web']['GameVersion'] 153 UpdateVersion(); 154 break; 155 case 'xml': 156 // echo('<textarea rows="34" cols="104">'); 157 include('generatecodeXML.php'); 158 // echo('</textarea>'); 159 break; 40 echo('<div style="font-size: xx-small;">'); 41 42 $GroupId = (int)$_GET['id']; 43 $Import = new Import(); 44 $Import->SetVersion($Config['Web']['GameVersion']); 45 $Import->ImportGroup($GroupId); 46 47 WriteLog('Plnění databáze', LOG_TYPE_MODERATOR); 48 echo('</div>'); 49 } else echo('Nebylo zadáno id skupiny'); 50 } 51 52 function ShowMenu() 53 { 54 global $TranslationTree, $Database; 55 56 echo('</div><div><strong>Import zdrojů:</strong></div>'); 57 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Group`'); 58 $DbRow = mysql_fetch_row($DbResult); 59 $PageList = GetPageList($DbRow[0]); 60 echo('<h3>Seznam překladových skupin</h3>'); 61 echo($PageList['Output']); 62 63 echo('<table class="BaseTable">'); 64 $TableColumns = array( 65 array('Name' => 'Name', 'Title' => 'Jméno'), 66 array('Name' => 'SourceType', 'Title' => 'Typ zdroje'), 67 array('Name' => 'SourceName', 'Title' => 'Jméno zdroje'), 68 array('Name' => '', 'Title' => 'Akce'), 69 ); 70 71 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 72 echo($Order['Output']); 73 74 $ID = $Database->SQLCommand('SELECT *, CONCAT(`MangosDatabase`, ".", `MangosTable`, ", ", `DBCFileName`, ".dbc, ", `LuaMPQFolder`, "/", `LuaFileName`, ".lua" ) AS `SourceName` FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 75 while($Group = mysql_fetch_assoc($ID)) 76 { 77 echo('<tr><td>'.$Group['Name'].'</td><td>'.$Group['SourceType'].'</td><td>'.$Group['SourceName'].'</td><td><a href="?action=importgroup&id='.$Group['Id'].'">Imporotovat</a></td></tr>'); 160 78 } 161 WriteLog('Plnění databáze', LOG_TYPE_MODERATOR); 162 echo('</div>'); 79 echo('</table>'); 163 80 } 164 81 82 if(array_key_exists('action', $_GET)) 83 { 84 if($_GET['action'] == 'instructions') ShowInstructions(); 85 else if($_GET['action'] == 'importgroup') ShowImportGroup(); 86 else ShowMenu(); 87 } else ShowMenu(); 88 165 89 ShowFooter(); 166 90 -
trunk/includes/global_function.php
r381 r382 292 292 } 293 293 294 function HaveSameText($Group, $DbRow2, $Value)295 {296 $result = true;297 foreach($Group['Items'] as $GroupItem)298 {299 $old = $DbRow2[$GroupItem['Column']];300 $old = str_replace(chr(10), '', $old);301 $old = str_replace(chr(13), '', $old);302 $old = str_replace('\n', '', $old);303 $old = str_replace('\r', '', $old);304 $old = str_replace('\"', '"', $old);305 $old = str_replace('\\\\', '\\', $old);306 $old = str_replace('\32', '32', $old);307 $old = str_replace('\124', '124', $old);308 $old = str_replace("\'", "'", $old);309 $old = str_replace("Â", "", $old);310 $old = str_replace("�", "", $old);311 312 313 if (($GroupItem['MangosColumn'] <> '') and ($Group['MangosDatabase'] == 'mangos'))314 $new = $Value[$GroupItem['MangosColumn']];315 else316 $new = $Value[$GroupItem['Column']];317 $new = str_replace(chr(10), '', $new);318 $new = str_replace(chr(13), '', $new);319 $new = str_replace('\n', '', $new);320 $new = str_replace('\r', '', $new);321 $new = str_replace('\"', '"', $new);322 $new = str_replace('\\\\', '\\', $new);323 $new = str_replace('\32', '32', $new);324 $new = str_replace('\124', '124', $new);325 $new = str_replace("\'", "'", $new);326 $new = str_replace("Â", "", $new);327 $new = str_replace("�", "", $new);328 329 if (($old == 'null') or ($old == 'NULL')) $old = '';330 if (($new == 'null') or ($new == 'NULL')) $new = '';331 332 333 if(($old <> $new) and ($GroupItem['Column'] <> 'Comment'))334 {335 // echo $old.'X'.$new;336 $result = false;337 }338 }339 return($result);340 }341 342 294 function GetBuildNumber($Version) 343 295 {
Note:
See TracChangeset
for help on using the changeset viewer.