Changeset 216
- Timestamp:
- Jun 24, 2009, 10:30:42 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r213 r216 52 52 echo ('<a href="?action=dbkit&Take">Opravit data v sloupci Take</a><br />'); 53 53 echo ('<a href="?action=dbkit&ShortCut">Opravit data v sloupci ShortCut</a><br />'); 54 55 echo ('<br /><form action="?action=dbkit" method="post">'); 56 echo('Vymazat log typ : <input type="text" name="Type" /> '); 57 echo('<input type="submit" value="Vymazat" /><br />'); 58 echo('</form><br />'); 59 60 if (array_key_exists('Type',$_POST)) { 61 $sql = 'DELETE FROM log WHERE Type = '.$_POST['Type']; 62 $Database->SQLCommand($sql); 63 WriteLog('Vymazán log '.$_POST['Type'], 4); 64 echo (' Vymazán log '.$_POST['Type']); 65 } 54 66 55 67 if (array_key_exists('find',$_POST)) { 56 68 echo ('Začínám nahrazovat: <br />'); 57 69 $find = $_POST['find']; … … 123 135 foreach($Tables as $Table) { 124 136 echo ($Table.' '); 125 $sql = 'SELECT gs_orig.ID, 126 gs_tran.entry, 127 gs_tran.ShortCut as ShortCut_tran, 128 gs_orig.ShortCut as ShortCut_orig 129 FROM '.$Table.' as gs_tran 130 JOIN '.$Table.' as gs_orig ON gs_orig.entry = gs_tran.entry 131 WHERE gs_tran.Language <> 0 AND gs_tran.ShortCut <> gs_orig.ShortCut'; 132 137 $sql = 'SELECT gs_orig.ID, gs_tran.entry, gs_tran.ShortCut as ShortCut_tran, gs_orig.ShortCut as ShortCut_orig FROM '.$Table.' as gs_tran JOIN '.$Table.' as gs_orig ON gs_orig.entry = gs_tran.entry WHERE gs_tran.Language <> 0 AND gs_tran.ShortCut <> gs_orig.ShortCut'; 133 138 $ID = $Database->SQLCommand($sql); 134 139 while ($Line = mysql_fetch_assoc($ID)) { -
trunk/import/import_dbc.php
r214 r216 1 1 <?php 2 /* 3 DELETE FROM `gametips` WHERE ID > 266; 4 DELETE FROM `spell` WHERE ID > 43672; 5 UPDATE `gametips` SET VersionStart = 8606,VersionEnd = 8606; 6 UPDATE `spell` SET VersionStart = 8606,VersionEnd = 8606; 7 DELETE FROM `log` WHERE Type = 11; 8 */ 9 2 10 3 function ImportDBC() 11 12 function ImportDBC($import_version) 4 13 { 5 14 global $Database, $TranslationTree, $Config; 15 $BuildNumber = GetBuildNumber($import_version); 6 16 7 17 echo('Načítání textů z DBC souborů...'); … … 12 22 echo('<br />'.$Group['Name'].'<br />'); 13 23 $DBCFile = new DBCFile(); 14 $DBCFile->OpenFile('../source/'.$ Config['Web']['GameVersion'].'/dbc/'.$Group['DBCFileName'].'.dbc', $Group['DBCColumns']);24 $DBCFile->OpenFile('../source/'.$import_version.'/dbc/'.$Group['DBCFileName'].'.dbc', GetDBCColumns($import_version,$Group['DBCFileName'])); 15 25 $ItemCount = $DBCFile->GetRecordCount(); 16 26 $NewCount = 0; … … 18 28 for($i = 0; $i < $ItemCount; $i++) 19 29 { 30 foreach($Group['Items'] as $GroupItem) 31 { 32 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($i, GetDBCColumnIndex($import_version,$Group['DBCFileName'],$GroupItem['Column']))); 33 } 34 35 $Columns = ''; 36 foreach($Group['Items'] as $GroupItem) 37 { 38 $Columns .= ', '.$GroupItem['Column'].' '; 39 } 40 $Columns = substr($Columns, 1); 41 20 42 $ItemId = $DBCFile->GetUint($i, 0); 21 $DbResult2 = $Database->SQLCommand('SELECT ID FROM '.$Group['TablePrefix'].' WHERE entry='.$ItemId.' AND Language=0');43 $DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE entry='.$ItemId.' AND Language=0 ORDER BY VersionStart DESC LIMIT 1'); 22 44 if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0)) 23 45 { 24 $DbRow2 = mysql_fetch_assoc($DbResult2); 25 //echo($DbRow2['ID']); 26 $ColumnsValues = ''; 27 foreach($Group['Items'] as $GroupItem) 28 { 29 $ColumnsValues .= ', `'.$GroupItem['Column'].'`="'.addslashes($DBCFile->GetString($i, $GroupItem['DBCColumnIndex'])).'"'; 30 } 31 $ColumnsValues = substr($ColumnsValues, 2); 32 echo('. '); //'UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']."<br>"); 33 //print_r($DbRow2); 34 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']); 46 // Update existed text 47 $DbRow2 = mysql_fetch_assoc($DbResult2); 48 if(HaveSameText($Group, $DbRow2, $Value)) 49 { 50 if ($DbRow2['VersionEnd'] <> $BuildNumber) { 51 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']); 52 echo(', '); 53 } else 54 echo('. '); 55 } else 56 { 57 $Columns = 'entry, language, VersionStart, VersionEnd'; 58 $Values = $DbRow2['entry'].', 0, '.$BuildNumber.', '.$BuildNumber; 59 foreach($Group['Items'] as $GroupItem) 60 { 61 $Columns .= ', `'.$GroupItem['Column'].'`'; 62 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 63 } 64 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 65 echo('# '); 66 $NewCount++; 67 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.$DbRow2['ID'].'">'.$DbRow2['ID'].'</a> ('.$DbRow2['entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', 11); 68 } 69 35 70 } else 36 { 37 $Columns = 'entry, language';38 $Values = $ItemId.', 0';39 foreach($Group['Items'] as $GroupItem) 40 { 41 $Columns .= ', `'.$GroupItem['Column'].'`'; 42 $Values .= ', "'.addslashes($DBCFile->GetString($i, $GroupItem['DBCColumnIndex'])).'"';43 } 44 //$Columns = substr($Columns, 2); 45 //$Values = substr($Values, 2);46 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');47 echo('# ');48 //echo('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'."<br>");49 $NewCount++; 71 { 72 // Insert new text 73 $Columns = 'entry, language, VersionStart, VersionEnd'; 74 $Values = $ItemId.', 0, '.$BuildNumber.', '.$BuildNumber; 75 foreach($Group['Items'] as $GroupItem) 76 { 77 $Columns .= ', `'.$GroupItem['Column'].'`'; 78 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 79 } 80 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 81 echo('+ '); 82 $NewCount++; 83 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.$DbRow2['ID'].'</a> ('.$ItemId.') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' přidán.', 11); 84 50 85 } 51 86 $Count++; -
trunk/import/import_lua.php
r215 r216 1 1 <?php 2 3 function HaveSameText($Group, $DbRow2, $Value)4 {5 $result = true;6 foreach($Group['Items'] as $GroupItem)7 {8 $old = $DbRow2[$GroupItem['Column']];9 $old = str_replace(chr(10), '', $old);10 $old = str_replace(chr(13), '', $old);11 $old = str_replace('\n', '', $old);12 $old = str_replace('\r', '', $old);13 $old = str_replace('\"', '"', $old);14 $old = str_replace('\\\\', '\\', $old);15 $old = str_replace('\32', '32', $old);16 $old = str_replace('\124', '124', $old);17 18 $new = $Value[$GroupItem['Column']];19 $new = str_replace(chr(10), '', $new);20 $new = str_replace(chr(13), '', $new);21 $new = str_replace('\n', '', $new);22 $new = str_replace('\r', '', $new);23 $new = str_replace('\"', '"', $new);24 $new = str_replace('\\\\', '\\', $new);25 $new = str_replace('\32', '32', $new);26 $new = str_replace('\124', '124', $new);27 28 if(($old <> $new) and ($GroupItem['Column'] <> 'Comment'))29 {30 // echo $old.'-'.$new;31 $result = false;32 }33 }34 return($result);35 }36 2 37 3 function ImportLUA($import_version) 38 4 { 39 5 global $Database, $TranslationTree, $PatchVersion, $Config; 6 $BuildNumber = GetBuildNumber($import_version); 40 7 41 8 echo('Načítání textů z LUA souborů...'); … … 74 41 if(HaveSameText($Group, $DbRow2, $Value)) 75 42 { 76 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.GetBuildNumber($import_version).'" WHERE ID='.$DbRow2['ID']); 43 if ($DbRow2['VersionEnd'] <> $BuildNumber) { 44 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']); 45 echo(', '); 46 } else 47 echo('. '); 77 48 } else 78 49 { 79 50 $Columns = 'entry, language, VersionStart, VersionEnd'; 80 $Values = $DbRow2['entry'].', 0, '. GetBuildNumber($import_version).', '.GetBuildNumber($import_version);51 $Values = $DbRow2['entry'].', 0, '.$BuildNumber.', '.$BuildNumber; 81 52 foreach($Group['Items'] as $GroupItem) 82 53 { … … 89 60 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.$DbRow2['ID'].'">'.$DbRow2['ID'].'</a> ('.$DbRow2['entry'].') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' změněn.', 11); 90 61 } 91 echo('. ');92 62 } else 93 63 { … … 101 71 } 102 72 $Columns = 'entry, language, VersionStart, VersionEnd'; 103 $Values = $Entry.', 0, '. GetBuildNumber($import_version).', '.GetBuildNumber($import_version);73 $Values = $Entry.', 0, '.$BuildNumber.', '.$BuildNumber; 104 74 foreach($Group['Items'] as $GroupItem) 105 75 { … … 108 78 } 109 79 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 110 echo(' #');80 echo('+ '); 111 81 $NewCount++; 112 82 WriteLog('Text <a href="form.php?group='.$Group['Id'].'&ID='.mysql_insert_id().'">'.$DbRow2['ID'].'</a> ('.$Entry.') ze skupiny '.$Group['Name'].' byl v nové verzi '.$import_version.' přidán.', 11); -
trunk/import/index.php
r215 r216 23 23 echo('<div><a href="?source=lua">LUA soubory</a></div>'); 24 24 echo('<div><a href="generatecodeXML.php">xml soubory</a></div>'); 25 echo('<div><a href="?source=update_version">aktualizace verze u překladů</a></div>'); 25 26 } else 26 27 { … … 32 33 break; 33 34 case 'dbc': 34 ImportDBC(); 35 ImportDBC($Config['Web']['GameVersion']); 36 break; 37 case 'update_version': 38 UpdateVersion(); 35 39 break; 36 40 case 'lua': -
trunk/includes/global_function.php
r214 r216 233 233 } 234 234 235 236 function HaveSameText($Group, $DbRow2, $Value) 237 { 238 $result = true; 239 foreach($Group['Items'] as $GroupItem) 240 { 241 $old = $DbRow2[$GroupItem['Column']]; 242 $old = str_replace(chr(10), '', $old); 243 $old = str_replace(chr(13), '', $old); 244 $old = str_replace('\n', '', $old); 245 $old = str_replace('\r', '', $old); 246 $old = str_replace('\"', '"', $old); 247 $old = str_replace('\\\\', '\\', $old); 248 $old = str_replace('\32', '32', $old); 249 $old = str_replace('\124', '124', $old); 250 $old = str_replace("\'", "'", $old); 251 252 $new = $Value[$GroupItem['Column']]; 253 $new = str_replace(chr(10), '', $new); 254 $new = str_replace(chr(13), '', $new); 255 $new = str_replace('\n', '', $new); 256 $new = str_replace('\r', '', $new); 257 $new = str_replace('\"', '"', $new); 258 $new = str_replace('\\\\', '\\', $new); 259 $new = str_replace('\32', '32', $new); 260 $new = str_replace('\124', '124', $new); 261 $new = str_replace("\'", "'", $new); 262 263 if(($old <> $new) and ($GroupItem['Column'] <> 'Comment')) 264 { 265 // echo $old.'-'.$new; 266 $result = false; 267 } 268 } 269 return($result); 270 } 271 272 235 273 function GetBuildNumber($Version) 236 274 { … … 251 289 } 252 290 291 function GetDBCColumns($Version,$DBCFileName) 292 { 293 global $Database; 294 295 $sql = 'SELECT DBCColumns_'.$DBCFileName.' as DBCColumns FROM `wow_client_version` WHERE Version = "'.$Version.'"'; 296 $DbRow = mysql_fetch_assoc($Database->SQLCommand($sql)); 297 return($DbRow['DBCColumns']); 298 } 299 300 function GetDBCColumnIndex($Version,$DBCFileName,$Column) 301 { 302 global $Database; 303 304 $sql = 'SELECT '.$DBCFileName.'_'.$Column.' as DBCColumns FROM `wow_client_version` WHERE Version = "'.$Version.'"'; 305 $DbRow = mysql_fetch_assoc($Database->SQLCommand($sql)); 306 return($DbRow['DBCColumns']); 307 } 308 253 309 ?>
Note:
See TracChangeset
for help on using the changeset viewer.