Changeset 215
- Timestamp:
- Jun 23, 2009, 10:03:53 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/index.php
r214 r215 45 45 } 46 46 47 function WriteSetting($ExportSetting) { 48 echo '<textarea rows="10" cols="100">'.serialize($ExportSetting).'</textarea><br />'. 47 function WriteSetting($ExportSetting) 48 { 49 echo('<textarea rows="10" cols="100">'.serialize($ExportSetting).'</textarea><br />'. 49 50 'Odkaz ke stažení s vlastním nastavením: '. 50 '<a href="?action=output& ExportSetting='.htmlspecialchars(serialize($ExportSetting)).'">Odkaz vlastního exportu</a><br />'.51 'I když se nastavení ukládá, pro jistotu si jej můžete uložit nebo poslat příteli.' ;52 } 53 54 if (array_key_exists('ExportSetting',$_GET))51 '<a href="?action=output&ExportSetting='.htmlspecialchars(serialize($ExportSetting)).'">Odkaz vlastního exportu</a><br />'. 52 'I když se nastavení ukládá, pro jistotu si jej můžete uložit nebo poslat příteli.'); 53 } 54 55 if(array_key_exists('ExportSetting', $_GET)) 55 56 { 56 57 $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting']))); … … 350 351 } 351 352 352 if (in_array($ExportSetting['Export'],$Addon_verses)) { //addon pro různé verze 353 if(in_array($ExportSetting['Export'], $Addon_verses)) 354 { // Addon pro různé verze 353 355 $Addon_verse = $Addon_verses[array_search($ExportSetting['Export'],$Addon_verses)]; 354 356 if(function_exists('gzcompress')) { … … 388 390 $ExportSetting['language'.$Language['Id']] = array_key_exists('language'.$Language['Id'], $_POST); 389 391 390 if (array_key_exists('ExportSetting',$_GET))391 $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting'])));392 if(array_key_exists('ExportSetting', $_GET)) 393 $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting']))); 392 394 393 395 echo('<strong>Krok 3. - Typ výstupu</strong><br /><br />'); 394 396 echo('<form action="?action=result" method="post"><div>'. 395 '<table><tr><td>'.397 '<table><tr><td>'. 396 398 '<fieldset><legend>Forma výstupu</legend>'. 397 399 RadioButton('Export', 'MangosSQLDirect', $ExportSetting['Export'] == 'MangosSQLDirect').'MaNGOS SQL - přímo zobrazit<br />'. 398 400 RadioButton('Export', 'MangosSQLCompressed', $ExportSetting['Export'] == 'MangosSQLCompressed').'MaNGOS SQL - komprimovaný soubor<br />'. 399 401 RadioButton('Export', 'AoWoWSQLDirect', $ExportSetting['Export'] == 'AoWoWSQLDirect').'AoWoW SQL - přímo zobrazit<br />'. -
trunk/import/import_lua.php
r214 r215 1 1 <?php 2 function HaveSameText($Group,$DbRow2,$Value) 2 3 function HaveSameText($Group, $DbRow2, $Value) 3 4 { 4 $result = true; 5 foreach($Group['Items'] as $GroupItem) { 6 $old = $DbRow2[$GroupItem['Column']]; 7 $old = str_replace(chr(10),'',$old); 8 $old = str_replace(chr(13),'',$old); 9 $old = str_replace('\n','',$old); 10 $old = str_replace('\r','',$old); 11 $old = str_replace('\"','"',$old); 12 $old = str_replace('\\\\','\\',$old); 13 $old = str_replace('\32','32',$old); 14 $old = str_replace('\124','124',$old); 15 16 $new = $Value[$GroupItem['Column']]; 17 $new = str_replace(chr(10),'',$new); 18 $new = str_replace(chr(13),'',$new); 19 $new = str_replace('\n','',$new); 20 $new = str_replace('\r','',$new); 21 $new = str_replace('\"','"',$new); 22 $new = str_replace('\\\\','\\',$new); 23 $new = str_replace('\32','32',$new); 24 $new = str_replace('\124','124',$new); 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); 25 27 26 if (($old <> $new) and ($GroupItem['Column'] <> 'Comment')) { 27 // echo $old.'-'.$new; 28 $result = false; 29 } 30 } 31 return($result); 28 if(($old <> $new) and ($GroupItem['Column'] <> 'Comment')) 29 { 30 // echo $old.'-'.$new; 31 $result = false; 32 } 33 } 34 return($result); 32 35 } 33 36 … … 41 44 if(($Group['LuaFileName'] != '') and ($Group['TablePrefix'] != '')) 42 45 { 43 echo('<br />'.$Group['Name'].'<br />'); 44 45 46 47 48 49 50 51 52 53 46 echo('<br />'.$Group['Name'].'<br />'); 47 $File = new FileStream(); 48 $File->OpenFile('../source/'.$import_version.'/lua/'.$Group['LuaFileName'].'.lua'); 49 $NewCount = 0; 50 $Count = 0; 51 while(!$File->EOF()) 52 { 53 $Line = $File->ReadLine(); 54 if(strpos($Line, '=') !== false) 55 { 56 $LineParts = explode(';', $Line); 54 57 $LineParts2 = explode('=', $LineParts[0]); 55 56 57 58 $Value['ShortCut'] = trim($LineParts2[0]); 59 $Value['Text'] = substr(trim($LineParts2[1]), 1, -1); 60 $Value['Comment'] = addslashes(substr(trim($LineParts[1]), 3)); 58 61 59 60 $Columns = ''; 61 foreach($Group['Items'] as $GroupItem) 62 { 63 $Columns .= ', '.$GroupItem['Column'].' '; 64 } 65 $Columns = substr($Columns, 1); 62 $Columns = ''; 63 foreach($Group['Items'] as $GroupItem) 64 { 65 $Columns .= ', '.$GroupItem['Column'].' '; 66 } 67 $Columns = substr($Columns, 1); 66 68 67 69 $DbResult2 = $Database->SQLCommand('SELECT ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE ShortCut="'.$Value['ShortCut'].'" AND (Language=0) ORDER BY VersionStart DESC LIMIT 1'); 68 70 if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0)) 69 { 70 $DbRow2 = mysql_fetch_assoc($DbResult2); 71 if (HaveSameText($Group,$DbRow2,$Value)) { 71 { 72 // Update existed text 73 $DbRow2 = mysql_fetch_assoc($DbResult2); 74 if(HaveSameText($Group, $DbRow2, $Value)) 75 { 72 76 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.GetBuildNumber($import_version).'" WHERE ID='.$DbRow2['ID']); 73 } else { 74 75 $Columns = 'entry, language, VersionStart, VersionEnd'; 76 $Values = $DbRow2['entry'].', 0, '.GetBuildNumber($import_version).', '.GetBuildNumber($import_version); 77 foreach($Group['Items'] as $GroupItem) { 78 $Columns .= ', `'.$GroupItem['Column'].'`'; 79 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 80 } 81 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 82 echo('# '); 83 $NewCount++; 84 85 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); 86 } 87 88 echo('. '); 89 } else 90 { 91 $Entry = 1; 92 $DbResult = $Database->SQLCommand('SELECT MAX(`entry`) FROM `'.$Group['TablePrefix'].'`'); 93 if(mysql_num_rows($DbResult) > 0) 94 { 95 $DbRow = mysql_fetch_row($DbResult); 96 $Entry += $DbRow[0]; 77 } else 78 { 79 $Columns = 'entry, language, VersionStart, VersionEnd'; 80 $Values = $DbRow2['entry'].', 0, '.GetBuildNumber($import_version).', '.GetBuildNumber($import_version); 81 foreach($Group['Items'] as $GroupItem) 82 { 83 $Columns .= ', `'.$GroupItem['Column'].'`'; 84 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 85 } 86 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 87 echo('# '); 88 $NewCount++; 89 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 } 91 echo('. '); 92 } else 93 { 94 // Insert new text 95 $Entry = 1; 96 $DbResult = $Database->SQLCommand('SELECT MAX(`entry`) FROM `'.$Group['TablePrefix'].'`'); 97 if(mysql_num_rows($DbResult) > 0) 98 { 99 $DbRow = mysql_fetch_row($DbResult); 100 $Entry += $DbRow[0]; 101 } 102 $Columns = 'entry, language, VersionStart, VersionEnd'; 103 $Values = $Entry.', 0, '.GetBuildNumber($import_version).', '.GetBuildNumber($import_version); 104 foreach($Group['Items'] as $GroupItem) 105 { 106 $Columns .= ', `'.$GroupItem['Column'].'`'; 107 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 97 108 } 98 99 $Columns = 'entry, language, VersionStart, VersionEnd'; 100 $Values = $Entry.', 0, '.GetBuildNumber($import_version).', '.GetBuildNumber($import_version); 101 foreach($Group['Items'] as $GroupItem) 102 { 103 $Columns .= ', `'.$GroupItem['Column'].'`'; 104 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 105 } 106 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 107 echo('# '); 108 $NewCount++; 109 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); 110 } 111 }; 109 $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 110 echo('# '); 111 $NewCount++; 112 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); 113 } 114 }; 112 115 $Count++; 113 114 115 } 116 } 117 echo('<br />Celkem: '.$Count.' Nových: '.$NewCount.'<br />'); 118 } 116 119 } 117 120 echo('<strong>Dokončeno.</strong>'); -
trunk/import/index.php
r214 r215 29 29 { 30 30 case 'sql_mangos': 31 31 ImportSQLMangos(); 32 32 break; 33 33 case 'dbc': 34 35 34 ImportDBC(); 35 break; 36 36 case 'lua': 37 38 39 37 ImportLUA($Config['Web']['GameVersion']); //$Config['Web']['GameVersion'] 38 UpdateVersion(); 39 break; 40 40 case 'xml': 41 42 43 44 break;41 // echo('<textarea rows="34" cols="104">'); 42 include('generatecodeXML.php'); 43 // echo('</textarea>'); 44 break; 45 45 } 46 46 WriteLog('Plnění databáze', 4); 47 47 echo('</div>'); 48 49 48 } 50 49 -
trunk/import/update_version.php
r214 r215 4 4 { 5 5 global $Database, $TranslationTree, $PatchVersion, $Config; 6 echo ('<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />'); 7 foreach($TranslationTree as $Group) { 8 echo('<br />'.$Group['Name'].' '); 9 $DbResult = $Database->SQLCommand('SELECT gs_tran.ID, 10 gs_tran.VersionEnd as VersionEnd_tran, 11 gs_orig.VersionEnd as VersionEnd_orig 12 FROM '.$Group['TablePrefix'].' as gs_tran 13 JOIN '.$Group['TablePrefix'].' as gs_orig ON gs_orig.ID = gs_tran.Take 14 WHERE gs_tran.VersionEnd <> gs_orig.VersionEnd'); 15 while ($DbRow = mysql_fetch_assoc($DbResult)) { 16 $Database->SQLCommand('UPDATE '.$Group['TablePrefix'].' SET VersionEnd = '.$DbRow['VersionEnd_orig'].' WHERE ID = '.$DbRow['ID']); 17 echo('. '); 18 } 19 echo('<strong>Dokončeno.</strong>'); 6 7 echo('<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />'); 8 foreach($TranslationTree as $Group) 9 { 10 echo('<br />'.$Group['Name'].' '); 11 $DbResult = $Database->SQLCommand('SELECT gs_tran.ID, gs_tran.VersionEnd AS VersionEnd_tran, gs_orig.VersionEnd AS VersionEnd_orig FROM '.$Group['TablePrefix'].' AS gs_tran JOIN '.$Group['TablePrefix'].' AS gs_orig ON gs_orig.ID = gs_tran.Take WHERE gs_tran.VersionEnd <> gs_orig.VersionEnd'); 12 while($DbRow = mysql_fetch_assoc($DbResult)) 13 { 14 $Database->SQLCommand('UPDATE '.$Group['TablePrefix'].' SET VersionEnd = '.$DbRow['VersionEnd_orig'].' WHERE ID = '.$DbRow['ID']); 15 echo('. '); 16 } 17 echo('<strong>Dokončeno.</strong>'); 20 18 } 21 19 }
Note:
See TracChangeset
for help on using the changeset viewer.