Changeset 178 for trunk/export/export.php
- Timestamp:
- Apr 11, 2009, 12:34:37 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/export.php
r150 r178 80 80 return($Buffer); 81 81 } 82 83 function ExportToAoWoWSQL($Setting) { 84 global $Database, $Config, $TranslationTree,$AoWoWconf; 85 require_once('../aowow/configs/config.php'); 86 87 $Buffer = ExportToMangosSQL($Setting); 88 89 $AnoNe = array('Ne', 'Ano'); 90 if($_SESSION['UserID'] != '') 91 { 92 $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']); 93 $User = mysql_fetch_assoc($DbResult); 94 } else $User = array('user' => 'Neznámý'); 95 96 $WhereLang = ''; 97 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)"; 98 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)"; 99 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)"; 100 if($WhereLang == '') $WhereLang = 1; 101 else $WhereLang = '('.substr($WhereLang, 4).')'; 102 103 $SelectedUsers = ''; 104 foreach($Setting['users-selection'] as $Item) 105 $SelectedUsers .= ','.$Item; 106 $SelectedUsers = substr($SelectedUsers, 1); 107 108 if($SelectedUsers == '') $Where = 0; 109 else $Where = 'ID IN ('.$SelectedUsers.')'; 110 111 $UserNames = ''; 112 $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE '.$Where); 113 while($DbRow = mysql_fetch_assoc($DbResult)) 114 $UserNames .= ','.$DbRow['user']; 115 $UserNames = substr($UserNames, 1); 116 117 if($SelectedUsers == '') $WhereUsers = 1; 118 else $WhereUsers = '(User IN ('.$SelectedUsers.'))'; 119 120 121 //data to aowow 122 123 $Database->SelectDatabase($AoWoWconf['mangos']['db']); 124 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 125 $AoWoWTables = array('aowow_resistances', 'aowow_spelldispeltype', 'aowow_skill'); 126 foreach($AoWoWTables as $AoWoWTable) { 127 $Buffer .= $AoWoWTable.', '; 128 $Buffer .= "\n\n"; 129 $Query = 'SELECT name FROM '.$AoWoWTable; 130 $ID = $Database->SQLCommand($Query); 131 while($Line = mysql_fetch_assoc($ID)) { 132 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT text as en, 133 (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran 134 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$WhereLang.' 135 AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.') LIMIT 1) as tran 136 FROM '.$Config['Database']['Database'].'.global_strings as tableen WHERE 137 text = "'.addslashes($Line['name']).'" LIMIT 1')); 138 //echo ($Line['name'].'='.$Tran['tran']); 139 if ($Tran['tran'] <> '') 140 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET name = "'.addslashes($Tran['tran']).'" WHERE name = "'.addslashes($Line['name']).'";'."\n"; 141 } 142 $Buffer .= "\n\n"; 143 } 144 return($Buffer); 145 } 146 82 147 83 148 function ExportToXML($Setting)
Note:
See TracChangeset
for help on using the changeset viewer.