Changeset 376 for trunk/export
- Timestamp:
- Mar 11, 2010, 8:40:32 AM (15 years ago)
- Location:
- trunk/export
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/create_addon.php
r366 r376 174 174 $Group = $TranslationTree[14]; // client table 175 175 $Column['Column'] = 'Text'; 176 $Query = 'SELECT T2.'.$Column['Column'].' AS Translation, T3.'.$Column['Column'].' as Original, T3.ShortCut FROM (SELECT T1.entry, T1.'.$Column['Column'].' FROM (SELECT entry,'.$Column['Column'].' FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].' AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS T1 GROUP BY T1.entry) as T2 JOIN '.$Group['TablePrefix'].' AS T3 ON (T2.entry = T3.entry) AND (T3.Language= 0)';176 $Query = 'SELECT `T2`.`'.$Column['Column'].'` AS `Translation`, `T3`.`'.$Column['Column'].'` AS `Original`, `T3`.`ShortCut` FROM (SELECT `T1`.`Entry`, `T1`.`'.$Column['Column'].'` FROM (SELECT `Entry`,`'.$Column['Column'].'` FROM '.$Group['TablePrefix'].' WHERE (`Complete` = 1) AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].') AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.') AS `T1` GROUP BY `T1`.`Entry`) AS `T2` JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T2`.`Entry` = `T3`.`Entry`) AND (`T3`.`Language` = 0)'; 177 177 $DbResult = $this->Database->query($Query); 178 178 while($Line = $DbResult->fetch_array()) -
trunk/export/export.php
r375 r376 11 11 var $SelectedUsers; 12 12 var $UserNames; 13 var $User;14 13 var $ClientVersion; 15 14 var $OrderByUserList; … … 38 37 $this->UserNames = ''; 39 38 $DbResult = $this->Database->query('SELECT `ExportUser`.*, `User`.`Name`, `User`.`ID` FROM `ExportUser` LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 40 while($User = $DbResult->fetch_assoc())41 { 42 $this->SelectedUsers .= ','.$User ['ID'];43 $this->UserNames .= ','.$User ['Name'];39 while($UserLine = $DbResult->fetch_assoc()) 40 { 41 $this->SelectedUsers .= ','.$UserLine['ID']; 42 $this->UserNames .= ','.$UserLine['Name']; 44 43 } 45 44 $this->SelectedUsers = substr($this->SelectedUsers, 1); … … 56 55 } 57 56 58 // Load logged user59 if(isset($_SESSION) and ($_SESSION['UserID'] != ''))60 {61 $DbResult = $this->Database->query('SELECT `Name` FROM `User` WHERE `ID`='.$_SESSION['UserID']);62 $this->User = $DbResult->fetch_assoc();63 } else $this->User = array('User' => 'Neznámý');64 65 66 57 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']); 67 58 $this->ClientVersion = $DbResult->fetch_assoc(); … … 70 61 function ExportToMangosSQL() 71 62 { 72 global $TranslationTree, $LanguageList ;63 global $TranslationTree, $LanguageList, $User, $Config; 73 64 74 65 $this->LoadFilters(); … … 82 73 "-- Znaková sada: ".$this->Config['Database']['Charset']." / ".$this->Config['Web']['Charset']."\n". 83 74 "-- Diakritika: ".$this->AnoNe[$this->Export['WithDiacritic']]."\n". 84 "-- Vygeneroval uživatel: ".$ this->User['Name']."\n".75 "-- Vygeneroval uživatel: ".$User->Name."\n". 85 76 "-- Vzato od uživatelů: ".$this->UserNames."\n". 86 77 "-- Generované tabulky: "; … … 89 80 while($Group = $DbResult->fetch_assoc()) 90 81 { 91 $Buffer .= $Group['MangosTable'].', ';82 $Buffer .= $Group['TablePrefix'].', '; 92 83 } 93 84 $Buffer .= "\n\n"; … … 146 137 { 147 138 $Ori_text = $Line['name']; 148 $DbResult2 = $Database2->query('SELECT ` text` AS en,149 (SELECT ` text` FROM `'.$Config['Database']['Database'].'`.`global_strings` AS `tabletran`150 WHERE ` tableen`.`entry` = `tabletran`.`entry` AND (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `tran`151 FROM `'.$Config['Database']['Database'].'`.` global_strings` AS `tableen` WHERE152 ` text` = "'.addslashes($Ori_text).'" LIMIT 1');139 $DbResult2 = $Database2->query('SELECT `Text` AS `En`, 140 (SELECT `Text` FROM `'.$Config['Database']['Database'].'`.`TextGlobalString` AS `TableTran` 141 WHERE `TableEn`.`Entry` = `TableTran`.`Entry` AND (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `Tran` 142 FROM `'.$Config['Database']['Database'].'`.`TextGlobalString` AS `TableEn` WHERE 143 `Text` = "'.addslashes($Ori_text).'" LIMIT 1'); 153 144 $Tran = $DbResult2->fetch_assoc(); 154 145 //echo ($Line['name'].'='.$Tran['tran']); 155 if($Tran[' tran'] == '')146 if($Tran['Tran'] == '') 156 147 { 157 $DbResult2 = $Database2->query('SELECT `OptionText` AS ` en`,158 (SELECT `OptionText` FROM `'.$this->Config['Database']['Database'].'`.` npc_option` AS `tabletran`159 WHERE ` tableen`.`entry` = `tabletran`.`entry` AND (`Complete` = 1) AND '.$this->WhereLang.'160 AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS ` tran`161 FROM `'.$this->Config['Database']['Database'].'`.` npc_option` AS `tableen` WHERE148 $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`, 149 (SELECT `OptionText` FROM `'.$this->Config['Database']['Database'].'`.`TextNPCOption` AS `TableTran` 150 WHERE `TableEn`.`Entry` = `TableTran`.`Entry` AND (`Complete` = 1) AND '.$this->WhereLang.' 151 AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `Tran` 152 FROM `'.$this->Config['Database']['Database'].'`.`TextNPCOption` AS `TableEn` WHERE 162 153 `OptionText` = "'.addslashes($Ori_text).'" LIMIT 1'); 163 154 $Tran = $DbResult2->fetch_assoc(); 164 155 } 165 156 166 if($Tran[' tran'] <> '')167 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran[' tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";157 if($Tran['Tran'] <> '') 158 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 168 159 } 169 160 $Buffer .= "\n\n"; … … 176 167 function ExportToXML() 177 168 { 178 global $TranslationTree, $LanguageList ;169 global $TranslationTree, $LanguageList, $User; 179 170 180 171 $this->LoadFilters($this->Id); … … 186 177 " <time>".date('r')."</time>\n". 187 178 " <diacritics mode=".'"'.$this->Export['WithDiacritic'].'"'." />\n". 188 " <author>".$ this->User['Name']."</author>\n".179 " <author>".$User->Name."</author>\n". 189 180 " <contributors>\n"; 190 181 foreach(explode(',', $this->UserNames) as $UserName) … … 209 200 while($Line = $DbResult2->fetch_assoc()) 210 201 { 211 $Buffer .= ' <item id="'.$Line[' entry'].'" user="'.$Line['UserName'].'">'."\n";202 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; 212 203 $Values = ''; 213 204 foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem) … … 242 233 $columns = ''; 243 234 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 244 $columns .= ' T.'.$Column['Column'].' as text'.$i.',';235 $columns .= ' `T`.`'.$Column['Column'].'` AS `Text`'.$i.','; 245 236 $i = $i+1; 246 237 } 247 238 248 $querty = '"SELECT '.$columns.' T.Entry as entry FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND VersionStart <= '.$this->ClientVersion['BuildNumber'].' AND VersionEnd >= '.$this->ClientVersion['BuildNumber'].') AS T GROUP BY T.Entry"';239 $querty = '"SELECT '.$columns.' `T`.`Entry` AS `Entry` FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')) AS `T` GROUP BY `T`.`Entry`"'; 249 240 250 241 $params = '-u '.$Config['Database']['User'].' -p '.$Config['Database']['Password'].' -f ../source/'.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc -n '.$this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc -c '.GetDBCColumns($this->ClientVersion['Version'], $Group['DBCFileName']).' -q '.$querty; -
trunk/export/index.php
r366 r376 6 6 function ExportList() 7 7 { 8 global $Database ;8 global $Database, $User; 9 9 10 10 echo('<a href="?Action=ViewList">Všechny</a>'); 11 if( Licence(LICENCE_USER))11 if($User->Licence(LICENCE_USER)) 12 12 { 13 13 echo(' <a href="?Action=ViewList&Filter=Others">Ostatních</a>'); … … 18 18 if(array_key_exists('Filter', $_GET)) 19 19 { 20 if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$ _SESSION['UserID'];21 if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$ _SESSION['UserID'];20 if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$User->Id; 21 if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$User->Id; 22 22 } 23 23 … … 46 46 { 47 47 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'">Zobrazit</a> <a href="?Action=View&ExportId='.$Export['Id'].'&Tab=6">Exportovat</a>'; 48 if($Export['User'] == $ _SESSION['UserID']) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>';48 if($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'; 49 49 echo('<tr><td>'.HumanDate($Export['TimeCreate']).'</td><td>'.$Export['UserName'].'</td><td>'.$Export['Title'].'</td><td>'.$Export['UsedCount'].'</td><td>'.$Export['UserCount'].'</td><td>'.$Export['GroupCount'].'</td><td>'.$Action.'</td></tr>'); 50 50 } … … 52 52 echo($PageList['Output']); 53 53 54 if( Licence(LICENCE_USER)) echo('<br/><div style="text-align: center;"><a href="?Action=Create">Vytvořit nový export</a></div>');54 if($User->Licence(LICENCE_USER)) echo('<br/><div style="text-align: center;"><a href="?Action=Create">Vytvořit nový export</a></div>'); 55 55 } 56 56 57 57 function ExportCreate() 58 58 { 59 global $Database, $Config ;60 61 if( Licence(LICENCE_USER))59 global $Database, $Config, $User; 60 61 if($User->Licence(LICENCE_USER)) 62 62 { 63 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM Export WHERE User='.$_SESSION['UserID']);63 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 64 64 $DbRow = mysql_fetch_row($DbResult); 65 65 if($DbRow[0] < $Config['MaxExportPerUser']) … … 77 77 function ExportCreateFinish() 78 78 { 79 global $Database, $Config ;80 81 if( Licence(LICENCE_USER))79 global $Database, $Config, $User; 80 81 if($User->Licence(LICENCE_USER)) 82 82 { 83 83 if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 84 84 { 85 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$ _SESSION['UserID']);85 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 86 86 $DbRow = mysql_fetch_row($DbResult); 87 87 if($DbRow[0] < $Config['MaxExportPerUser']) 88 88 { 89 $Database->SQLCommand('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$ _SESSION['UserID'].', NOW(), 1, "'.$_POST['Description'].'")');89 $Database->SQLCommand('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); 90 90 $ExportId = mysql_insert_id(); 91 91 echo('Nový export vytvořen.<br/>Přímý odkaz na tento export: <a href="?Action=View&ExportId='.$ExportId.'">zde</a><br/><br/>'); … … 100 100 function ExportDelete() 101 101 { 102 global $Database ;103 104 if( Licence(LICENCE_USER))102 global $Database, $User; 103 104 if($User->Licence(LICENCE_USER)) 105 105 { 106 106 if(array_key_exists('ExportId', $_GET)) 107 107 { 108 $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId'].' AND User='.$_SESSION['UserID']);108 $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId'].' AND `User`='.$User->Id); 109 109 if(mysql_num_rows($DbResult) > 0) 110 110 { 111 $Database->SQLCommand('DELETE FROM Export WHERE Id='.$_GET['ExportId']);111 $Database->SQLCommand('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']); 112 112 DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/'); 113 113 echo('Export smazán.<br/><br/>'); … … 122 122 function ExportViewTranslators() 123 123 { 124 global $Database, $TranslationTree, $Config ;124 global $Database, $TranslationTree, $Config, $User; 125 125 126 126 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 131 131 { 132 132 $Export = mysql_fetch_assoc($DbRows); 133 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;133 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 134 134 else $Editable = false; 135 135 … … 204 204 $Database->SQLCommand('SET @I = 0'); 205 205 $DbResult = $Database->SQLCommand($Query); 206 while($User = mysql_fetch_assoc($DbResult))207 { 208 $Checked = $User ['Sequence'] != '';209 $Selection = CheckBox('sel'.$User ['ID'], $Checked, '', 'CheckBox', !$Editable);210 $Sequence = '<input type="text" name="seq'.$User ['ID'].'" style="text-align: center; width: 40px;" value="'.$User['Sequence2'].'"'.$DisabledInput[$Editable].'/>';206 while($UserLine = mysql_fetch_assoc($DbResult)) 207 { 208 $Checked = $UserLine['Sequence'] != ''; 209 $Selection = CheckBox('sel'.$UserLine['ID'], $Checked, '', 'CheckBox', !$Editable); 210 $Sequence = '<input type="text" name="seq'.$UserLine['ID'].'" style="text-align: center; width: 40px;" value="'.$UserLine['Sequence2'].'"'.$DisabledInput[$Editable].'/>'; 211 211 echo('<tr> 212 <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$User ['ID'].'&action=userall" title="Zobrazit všechny jeho přeložené texty">'.$User['Name'].'</a></td>213 <td>'.$User ['TranslatedCount'].'</td>214 <td><img src="'.$Config['Web']['TempFolder'].'/user/'.$User ['Name'].'/level.png" alt="Úroveň uživatele" /></td>212 <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$UserLine['ID'].'&action=userall" title="Zobrazit všechny jeho přeložené texty">'.$UserLine['Name'].'</a></td> 213 <td>'.$UserLine['TranslatedCount'].'</td> 214 <td><img src="'.$Config['Web']['TempFolder'].'/user/'.$UserLine['Name'].'/level.png" alt="Úroveň uživatele" /></td> 215 215 <td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>'); 216 216 } … … 224 224 function ExportViewGeneral() 225 225 { 226 global $Database ;226 global $Database, $User; 227 227 228 228 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 235 235 { 236 236 $Export = mysql_fetch_assoc($DbRows); 237 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;237 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 238 238 else $Editable = false; 239 239 if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) … … 264 264 function ExportViewLanguages() 265 265 { 266 global $Database, $TranslationTree, $Config ;266 global $Database, $TranslationTree, $Config, $User; 267 267 268 268 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 273 273 { 274 274 $Export = mysql_fetch_assoc($DbRows); 275 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;275 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 276 276 else $Editable = false; 277 277 … … 357 357 function ExportViewGroups() 358 358 { 359 global $Database, $TranslationTree, $Config ;359 global $Database, $TranslationTree, $Config, $User; 360 360 361 361 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 366 366 { 367 367 $Export = mysql_fetch_assoc($DbRows); 368 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;368 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 369 369 else $Editable = false; 370 370 … … 446 446 function ExportViewOutputFormat() 447 447 { 448 global $Database ;448 global $Database, $User; 449 449 450 450 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 455 455 { 456 456 $Export = mysql_fetch_assoc($DbRows); 457 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;457 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 458 458 else $Editable = false; 459 459 … … 485 485 function ExportViewVersion() 486 486 { 487 global $Database, $Config ;487 global $Database, $Config, $User; 488 488 489 489 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 494 494 { 495 495 $Export = mysql_fetch_assoc($DbRows); 496 if( Licence(LICENCE_USER) and ($_SESSION['UserID']== $Export['User'])) $Editable = true;496 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 497 497 else $Editable = false; 498 498 … … 572 572 $Export = mysql_fetch_assoc($DbResult); 573 573 $DbResult = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID`='.$Export['User']); 574 $User = mysql_fetch_assoc($DbResult);575 echo('Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$User ['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>');574 $UserLine = mysql_fetch_assoc($DbResult); 575 echo('Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>'); 576 576 ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Výstup')); 577 577 echo('<div id="content">');
Note:
See TracChangeset
for help on using the changeset viewer.