- Timestamp:
- Feb 22, 2015, 11:20:50 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 59 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HTML/BBCodeParser2/Filter/Images.php
r760 r816 73 73 $ce = $options['close_esc']; 74 74 $this->_preparsed = preg_replace( 75 76 75 "!".$oe."img(\s?.*)".$ce."(.*)".$oe."/img".$ce."!Ui", 76 $o."img=\"\$2\" alt=\"\"\$1".$c.$o."/img".$c, 77 77 $this->_text); 78 78 } -
trunk/Modules/AoWoW/AoWoW.php
r815 r816 16 16 function Start() 17 17 { 18 19 20 21 22 23 18 $this->System->RegisterMenuItem(array( 19 'Title' => 'AoWoW', 20 'Hint' => 'Vyhledávací databáze podobná WoWHead s překlady', 21 'Link' => $this->System->Link('/aowow/'), 22 'Permission' => LICENCE_ANONYMOUS, 23 'Icon' => '', 24 24 )); 25 25 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) -
trunk/Modules/ClientVersion/ClientVersion.php
r800 r816 16 16 function Start() 17 17 { 18 19 20 21 22 23 24 18 $this->System->RegisterPage('client-version', 'PageClientVersion'); 19 $this->System->RegisterMenuItem(array( 20 'Title' => T('Game version'), 21 'Hint' => T('List of the game client versions'), 22 'Link' => $this->System->Link('/client-version/'), 23 'Permission' => LICENCE_ANONYMOUS, 24 'Icon' => '', 25 25 ), 10); 26 26 } … … 29 29 class PageClientVersion extends Page 30 30 { 31 32 33 34 35 36 37 38 39 31 function Show() 32 { 33 if(array_key_exists('action', $_GET)) 34 { 35 if($_GET['action'] == 'item') $Output = $this->ShowItem(); 36 else $Output = $this->ShowList(); 37 } else $Output = $this->ShowList(); 38 return($Output); 39 } 40 40 41 42 41 function ShowItem() 42 { 43 43 if(array_key_exists('id', $_GET)) 44 44 { … … 64 64 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 65 65 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 66 67 66 return($Output); 67 } 68 68 69 70 71 69 function ShowList() 70 { 71 $this->Title = T('Game version'); 72 72 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ClientVersion`'); 73 73 $DbRow = $DbResult->fetch_row(); -
trunk/Modules/Dictionary/Dictionary.php
r809 r816 13 13 $this->Dependencies = array(); 14 14 } 15 15 16 16 function Start() 17 17 { 18 19 20 21 22 23 24 25 18 $this->System->RegisterPage('dictionary', 'PageDictionary'); 19 $this->System->RegisterMenuItem(array( 20 'Name' => 'Dictionary', 21 'Title' => T('Dictionary'), 22 'Hint' => T('Dictionary words from WoW'), 23 'Link' => $this->System->Link('/dictionary/'), 24 'Permission' => LICENCE_ANONYMOUS, 25 'Icon' => '', 26 26 ), 1); 27 27 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 28 28 $this->System->ModuleManager->Modules['Search']->RegisterSearch('dictionary', 29 T('Dictionary'), array('Text', 'Description'), 29 T('Dictionary'), array('Text', 'Description'), 30 30 '(SELECT * FROM `Dictionary` WHERE `Language` = '.$this->System->Config['OriginalLanguage'].') AS `T`', $this->System->Link('/dictionary/?search=')); 31 31 } … … 35 35 { 36 36 37 function WriteTranslatNames($Text, $mode) 37 function WriteTranslatNames($Text, $mode) 38 38 { 39 39 $Output = ''; … … 62 62 63 63 $buff = GetTranslatNames($Text,$mode,GetTranslatNamesArray()); 64 64 65 65 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 66 66 foreach($buff as $Line) { 67 if ($mode == 0) 68 { 69 if (strpos(strtolower($Text), strtolower($Line[2])) > 0) 67 if ($mode == 0) 68 { 69 if (strpos(strtolower($Text), strtolower($Line[2])) > 0) 70 70 { 71 71 $Output .= '<tr><td>'.$Line[2].'</td>'; … … 73 73 else $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&ID='.$Line[0]).'">Překládat</a></td></tr>'; 74 74 } 75 } else 75 } else 76 76 { 77 77 $Output .= '<tr><td>'.$Line[2].'</td>'; … … 101 101 '</form>'; 102 102 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 103 return($Output); 103 return($Output); 104 104 } 105 105 … … 125 125 '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.$this->System->Config['OriginalLanguage'].');'); 126 126 } 127 127 128 128 $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '. 129 129 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id); … … 136 136 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 137 137 '`User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'. 138 138 $_POST['Description'].'", '.$this->System->User->Id.', '.$_POST['Language'].')'); 139 139 $Output = ShowMessage('Záznam byl uložen!'); 140 140 } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL); 141 141 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 142 return($Output); 142 return($Output); 143 143 } 144 144 … … 176 176 '</fieldset>'. 177 177 '</form>'; 178 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 178 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 179 179 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 180 180 return($Output); … … 184 184 { 185 185 global $TranslationTree; 186 186 187 187 $Output = ''; 188 188 $GroupId = LoadGroupIdParameter(); … … 190 190 else $mode = 0; //0 = exact names, 1=all names, 2=nontranslated 191 191 $Table = $TranslationTree[$GroupId]['TablePrefix']; 192 192 193 193 if(array_key_exists('ID', $_GET)) 194 194 { … … 208 208 $Output .= $this->WriteTranslatNames($Text, $mode); 209 209 } 210 } 210 } 211 211 return($Output); 212 212 } … … 215 215 { 216 216 global $LanguageList; 217 217 218 218 $Output = '<form action="?" method="get" style="margin: 0px; padding: 0px;">'. 219 219 '<table style="width: 100%; height: 100%;">'; … … 221 221 if(array_key_exists('search', $_GET)) $Search = $_GET['search']; 222 222 else $Search = ''; 223 223 224 224 $Output .= '<tr><td> 225 225 <input type="text" value="'.$Search.'" name="search" size="30" /> 226 226 <input type="submit" value="'.T('Search').'" />'; 227 if($this->System->User->Licence(LICENCE_USER)) 228 229 230 $Output .= '</td></tr>'. 227 if($this->System->User->Licence(LICENCE_USER)) 228 $Output .= ' <a href="?action=insert">'.T('Add word').'</a>'; 229 230 $Output .= '</td></tr>'. 231 231 '<tr><td>'.T('Language').': '; 232 232 $Lang = '<a href="?language=">'.T('All').'</a>'; … … 236 236 if($Language['Enabled'] == 1) 237 237 { 238 238 $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>'; 239 239 if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> '; 240 240 else $Output .= $Lang; … … 247 247 else $LanguageFilter = ' AND (`T1`.`Language` = '.$_SESSION['language'].')'; 248 248 249 if($Search <> '') 249 if($Search <> '') 250 250 { 251 251 $Condition = ' AND (LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '. 252 252 ' (LOWER(`T2`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '. 253 253 '(LOWER(`T1`.`Description`) LIKE LOWER("%'.$Search.'%"))'; 254 } else $Condition = ''; 254 } else $Condition = ''; 255 255 $sql = 'SELECT `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId`, '. 256 256 '`Language`.`Name` AS `LangName`, `T1`.`Id` AS `Id`, '. 257 '`T1`.`Entry`, `T2`.`Text` AS `Original`, `T1`.`Text` AS `Translated`, `T1`.`Description` '. 257 '`T1`.`Entry`, `T2`.`Text` AS `Original`, `T1`.`Text` AS `Translated`, `T1`.`Description` '. 258 258 'FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` '. 259 259 'ON (`T2`.`Entry` = `T1`.`Entry`) AND (`T2`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. … … 262 262 'WHERE 1'. 263 263 $LanguageFilter.$Condition; 264 264 265 265 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$sql.') AS `T1`'); 266 266 $DbRow = $DbResult->fetch_row(); 267 $PageList = GetPageList($DbRow[0]); 267 $PageList = GetPageList($DbRow[0]); 268 268 269 269 $Output .= $PageList['Output']; 270 270 271 271 if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name']; 272 272 else $LanguageName = 'Překlad'; 273 $TableColumns = array( 274 array('Name' => 'Original', 'Title' => T('English')), 273 $TableColumns = array( 274 array('Name' => 'Original', 'Title' => T('English')), 275 275 array('Name' => 'Translated', 'Title' => $LanguageName), 276 ); 276 ); 277 277 if(!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language')); 278 278 $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description')); 279 $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator')); 279 $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator')); 280 280 if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action')); 281 281 $Order = GetOrderTableHeader($TableColumns, 'Original'); … … 284 284 $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit']; 285 285 $DbResult = $this->Database->query($sql_page); 286 while($Line = $DbResult->fetch_assoc()) 286 while($Line = $DbResult->fetch_assoc()) 287 287 { 288 288 $Output .= '<tr>'. … … 294 294 if($this->System->User->Licence(LICENCE_USER)) 295 295 { 296 if($Line['UserId'] == $this->System->User->Id) 296 if($Line['UserId'] == $this->System->User->Id) 297 297 $Output .= '<td><a href="?action=remove&id='.$Line['Id'].'" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'. 298 298 ' <a href="?action=modify&id='.$Line['Id'].'">'.T('Modify').'</a></td>'; … … 301 301 $Output .= '</tr>'; 302 302 } 303 $Output .= '</table>'. 303 $Output .= '</table>'. 304 304 $PageList['Output']. 305 '</td></tr>'. 305 '</td></tr>'. 306 306 '</table></form>'; 307 307 return($Output); … … 310 310 function Show() 311 311 { 312 313 314 315 312 global $LanguageList; 313 314 $this->Title = T('Dictionary'); 315 316 316 $LanguageList = GetLanguageList(); 317 317 318 318 if(!isset($_SESSION['language'])) 319 319 { 320 321 322 320 if($this->System->User->Licence(LICENCE_USER)) 321 { 322 $_SESSION['language'] = $this->System->User->Language; 323 323 } else $_SESSION['language'] = ''; 324 324 } 325 325 if(array_key_exists('language', $_GET)) { 326 326 if($_GET['language'] == '') $_SESSION['language'] = ''; 327 327 else $_SESSION['language'] = $_GET['language'] * 1; 328 328 } 329 329 … … 331 331 332 332 $ShowList = true; 333 if(array_key_exists('action', $_GET)) 333 if(array_key_exists('action', $_GET)) 334 334 { 335 335 if($_GET['action'] == 'group') { … … 337 337 $ShowList = false; 338 338 } 339 else if($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert(); 340 else if($_GET['action'] == 'save') $Output .= $this->DictionarySave(); 339 else if($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert(); 340 else if($_GET['action'] == 'save') $Output .= $this->DictionarySave(); 341 341 else if($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove(); 342 342 else if($_GET['action'] == 'modify') $Output .= $this->DictionaryModify(); 343 else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL); 344 } 343 else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL); 344 } 345 345 if($ShowList == true) $Output .= $this->DictionaryShow(); 346 346 return($Output); -
trunk/Modules/Download/Download.php
r800 r816 3 3 class ModuleDownload extends AppModule 4 4 { 5 6 7 8 9 10 11 12 13 14 5 function __construct($System) 6 { 7 parent::__construct($System); 8 $this->Name = 'Download'; 9 $this->Version = '1.0'; 10 $this->Creator = 'Maron'; 11 $this->License = 'GNU/GPL'; 12 $this->Description = 'Show list of selected export and link to static files'; 13 $this->Dependencies = array(); 14 } 15 15 16 17 18 19 16 function Start() 17 { 18 $this->System->RegisterPage('download', 'PageDownload'); 19 $this->System->RegisterMenuItem(array( 20 20 'Title' => T('Download'), 21 21 'Hint' => T('List of czech to download'), … … 24 24 'Icon' => '', 25 25 ), 1); 26 26 } 27 27 } 28 28 29 29 class PageDownload extends Page 30 30 { 31 32 31 function ShowFiles() 32 { 33 33 $fileslink = $this->System->Link('/files'); 34 34 $Output = '<h3>'.T('Accessories for client').'</h3>'. … … 75 75 '<a href="'.$fileslink.'/ClientDBExtractor.exe">ClientDBExtractor.exe</a> - '.T('tool for exporting dbc files from game client').'<br />'; 76 76 return($Output); 77 77 } 78 78 79 80 79 function ShowDownload() 80 { 81 81 $Output = '<h3>'.T('Download czech').'</h3><br />'; 82 82 … … 101 101 $Output .= '<table class="BaseTable">'. 102 102 $Order['Output']; 103 103 $DbRows = $this->Database->query('SELECT `ClientVersion`.`Version` AS `Version`, '. 104 104 '`Export`.`Id`, `Export`.`ClientVersion`, `Export`.`OutputType`, `Export`.`Title`, '. 105 105 '`Export`.`Description` FROM `Export` '. … … 110 110 $ExportId = $DbExport['Id']; 111 111 112 113 114 115 112 if ($DbExport['OutputType'] == 10) 113 $filename = $this->System->Config['Web']['TempFolder'].'Export/'.$ExportId.'/'.'Instalace_CzechWoW_'.$DbExport['Version'].'.exe'; 114 if ($DbExport['OutputType'] == 7) 115 $filename = $this->System->Config['Web']['TempFolder'].'Export/'.$ExportId.'/'.'CzWoW_Addon-'.$DbExport['Version'].'.zip'; 116 116 117 117 if ($DbExport['OutputType'] == 10) 118 118 $Output .= '<tr><td><a href="'.$this->System->Link('/'.$filename). 119 119 '">CzechWoW_'.$DbExport['Version'].'.exe</a><br /> <a href="'. 120 120 $this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">Export '.$ExportId.'</a></td>'; 121 121 else 122 122 if ($DbExport['OutputType'] == 7) 123 123 $Output .= '<tr><td><a href="'.$this->System->Link('/'.$filename). 124 124 '">CzWoW_Addon-'.$DbExport['Version'].'.zip</a><br /> <a href="'. … … 131 131 $Output .= '<td>'.$DbExport['Title'].'</td>'; //.'<td>'.$DbExport['ClientVersion'].'</td>'; 132 132 133 133 if ((($DbExport['OutputType'] == 10) or ($DbExport['OutputType'] == 7)) and (file_exists($filename))) 134 134 $Output .= '<td>'.date('d.m.y H:i',filemtime($filename)).'</td>'; 135 135 else 136 136 $Output .= '<td> </td>'; 137 137 138 139 138 $Output .= 139 '<td>'.str_replace("\n", '<br />',$DbExport['Description']).'</td>'. 140 140 '</tr>'; 141 141 } … … 146 146 } 147 147 148 149 150 151 148 function Show() 149 { 150 $this->Title = T('Download'); 151 $Output = ''; 152 152 if (isset($_GET['Files'])) $Output .= $this->ShowFiles(); 153 153 else $Output .= $this->ShowDownload(); -
trunk/Modules/Error/Error.php
r790 r816 7 7 var $UserErrors; 8 8 var $OnError; 9 9 10 10 function __construct($System) 11 11 { … … 23 23 $this->OnError = array(); 24 24 } 25 25 26 26 function Install() 27 27 { … … 32 32 { 33 33 parent::UnInstall(); 34 } 35 34 } 35 36 36 function Start() 37 37 { … … 40 40 set_exception_handler(array($this, 'ExceptionHandler')); 41 41 } 42 42 43 43 function Stop() 44 44 { 45 46 47 45 restore_error_handler(); 46 restore_exception_handler(); 47 parent::Stop(); 48 48 } 49 49 50 50 function ErrorHandler($Number, $Message, $FileName, $LineNumber, $Variables) 51 51 { … … 64 64 1024 => 'User Notice' 65 65 ); 66 66 67 67 if(($this->UserErrors & $Number)) 68 68 { … … 73 73 $Backtrace[0]['line'] = $LineNumber; 74 74 $this->Report($Backtrace); 75 //if((E_ERROR | E_PARSE) & $Number) 76 die(); 75 //if((E_ERROR | E_PARSE) & $Number) 76 die(); 77 77 } 78 78 } 79 80 function ExceptionHandler(Exception $Exception) 79 80 function ExceptionHandler(Exception $Exception) 81 81 { 82 $Backtrace = $Exception->getTrace(); 82 $Backtrace = $Exception->getTrace(); 83 83 array_unshift($Backtrace, array( 84 84 'function' => $Exception->getMessage(), … … 89 89 die(); 90 90 } 91 91 92 92 function Report($Backtrace) 93 93 { 94 $Date = date('Y-m-d H:i:s'); 94 $Date = date('Y-m-d H:i:s'); 95 95 $Error = '# '.$Date."\n"; 96 96 foreach($Backtrace as $Item) … … 98 98 if(!array_key_exists('line', $Item)) $Item['line'] = ''; 99 99 if(!array_key_exists('file', $Item)) $Item['file'] = ''; 100 100 101 101 $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function']; 102 102 $Arguments = ''; … … 112 112 } 113 113 $Error .= "\n"; 114 114 115 115 // Show error message 116 116 $Output = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>'."\n". 117 117 '<meta http-equiv="Content-Language" content="cs">'."\n". 118 118 '<meta http-equiv="Content-Type" content="text/html; charset='.$this->Encoding.'"></head><body>'."\n". 119 T('An internal error occurred! <br /> Administrator has been made aware of it and the error soon will be removed.').'<br/><br/>'; 119 T('An internal error occurred! <br /> Administrator has been made aware of it and the error soon will be removed.').'<br/><br/>'; 120 120 if($this->ShowError == true) 121 121 $Output .= '<pre>'.$Error.'</pre><br/>'; … … 125 125 $OnError[0]->$OnError[1]($Error); 126 126 } 127 } 127 } -
trunk/Modules/Export/CreateAddon.php
r788 r816 5 5 class ExportAddon extends Export 6 6 { 7 7 8 8 // Replace special codes by lua functions 9 9 function ReplaceVarInText($string, $strlower = 'strlower') 10 10 { 11 11 12 12 $string = str_replace('$N', '"..'.$strlower.'(UnitName("player")).."', $string); 13 13 $string = str_replace('$n', '"..'.$strlower.'(UnitName("player")).."', $string); … … 17 17 $string = str_replace('$r', '"..'.$strlower.'(UnitRace("player")).."', $string); 18 18 $Gender = '$G'; 19 while(strpos($string, $Gender) !== false) 19 while(strpos($string, $Gender) !== false) 20 20 { 21 21 $Before = substr($string, 0, strpos($string, $Gender)); … … 28 28 $Woman = str_replace(' ', '', $Woman); 29 29 $string = $Before.'"..gsub(gsub(UnitSex("player"), "^2$", "'.$Man.'"), "^3$", "'.$Woman.'").."'.$After; 30 } 30 } 31 31 $Gender = '$g'; 32 while(strpos($string, $Gender) !== false) 32 while(strpos($string, $Gender) !== false) 33 33 { 34 34 $Before = substr($string, 0, strpos($string, $Gender)); … … 41 41 $Woman = str_replace(' ', '', $Woman); 42 42 $string = $Before.'"..gsub(gsub(UnitSex("player"), "^2$", "'.$Man.'"),"^3$", "'.$Woman.'").."'.$After; 43 } 43 } 44 44 45 45 $string = str_replace('$', '', $string); 46 46 $string = str_replace("\r", '', $string); 47 47 $string = str_replace("\n", '\r\n', $string); 48 return($string); 48 return($string); 49 49 } 50 50 … … 53 53 // $string = mysql_escape_string($string); 54 54 $string = strtolower($string); 55 55 56 56 $string = str_replace('"', '\"', $string); 57 $string = str_replace('$b$b', ' ', $string); 58 $string = str_replace('$b $b', ' ', $string); 59 $string = str_replace('$b', ' ', $string); 60 $string = $this->ReplaceVarInText($string); 57 $string = str_replace('$b$b', ' ', $string); 58 $string = str_replace('$b $b', ' ', $string); 59 $string = str_replace('$b', ' ', $string); 60 $string = $this->ReplaceVarInText($string); 61 61 $string = str_replace("\r", ' ', $string); 62 62 $string = str_replace("\n", ' ', $string); … … 64 64 $string = str_replace('\\n', ' ', $string); 65 65 $string = str_replace(' ', '', $string); 66 // while(strpos($string, ' ')) 66 // while(strpos($string, ' ')) 67 67 // $string = str_replace(' ', ' ', $string); 68 68 return($string); … … 73 73 $string = $this->Database->real_escape_string($string); 74 74 $string = str_replace('$B', '\r\n', $string); 75 $string = str_replace('$b', '\r\n', $string); 75 $string = str_replace('$b', '\r\n', $string); 76 76 $string = $this->ReplaceVarInText($string,''); 77 77 return($string); … … 104 104 { 105 105 global $TranslationTree, $CreatedFileList; 106 106 107 107 $Output = ''; 108 108 $this->LoadFilters(); 109 109 110 110 $CreatedFileList = array(); 111 111 $CreatedFileListCount = array(); 112 112 113 113 if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true); 114 114 115 115 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`TablePrefix` != ""'); 116 116 while($Group = $DbResult->fetch_assoc()) 117 117 { 118 118 //získání čísla verze pro export 119 $ID = $this->Database->query('SELECT LastVersion FROM `Group` WHERE Id = '.$Group['Id']); 119 $ID = $this->Database->query('SELECT LastVersion FROM `Group` WHERE Id = '.$Group['Id']); 120 120 $LastVersion = $ID->fetch_assoc(); 121 121 122 122 if ($LastVersion['LastVersion'] < $this->ClientVersion['BuildNumber']) 123 123 $ExportVersion = $LastVersion['LastVersion']; … … 125 125 126 126 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) 127 if($Column['AddonFileName'] != '') 127 if($Column['AddonFileName'] != '') 128 128 { 129 129 $this->AddProgress(1); 130 if(!isset($CreatedFileListCount[$Column['AddonFileName']])) 130 if(!isset($CreatedFileListCount[$Column['AddonFileName']])) 131 131 $CreatedFileListCount[$Column['AddonFileName']] = 0; 132 132 $CreatedFileListCount[$Column['AddonFileName']]++; 133 133 $FileIndex = $CreatedFileListCount[$Column['AddonFileName']]; 134 134 135 135 $CreatedFileList[] = $Column['AddonFileName'].'_'.$FileIndex; 136 $FileName = $this->TempDir.'CzWoW/'.$Column['AddonFileName'].'_'.$FileIndex.'.lua'; 136 $FileName = $this->TempDir.'CzWoW/'.$Column['AddonFileName'].'_'.$FileIndex.'.lua'; 137 137 $Output .= $Column['AddonFileName'].': '; 138 138 $i = 0; … … 140 140 $Buffer = 'CZWOW_'.$Column['AddonFileName'].'_count='.$FileIndex.';CZWOW_'.$Column['AddonFileName'].'_'.$FileIndex.'={'; 141 141 $TableTexts = array(); 142 142 143 143 //old version 144 144 //get version before … … 146 146 if ($ExportVersion == '') $BuildNumber = $this->ClientVersion['BuildNumber']; 147 147 $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '. 148 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 149 if($ID->num_rows > 0) { 148 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 149 if($ID->num_rows > 0) { 150 150 $ExportVersionOld = $ID->fetch_assoc(); 151 151 $ExportVersionOld = $ExportVersionOld['BuildNumber']; 152 153 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld)); 154 while($Line = $DbResult2->fetch_assoc()) 152 153 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld)); 154 while($Line = $DbResult2->fetch_assoc()) 155 155 { 156 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 156 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 157 157 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 158 if(($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 158 if(($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 159 159 { 160 $TableTexts[$en] = $cz; 160 $TableTexts[$en] = $cz; 161 161 } 162 162 } 163 163 } 164 164 //last version 165 166 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); 167 while($Line = $DbResult2->fetch_assoc()) 165 166 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); 167 while($Line = $DbResult2->fetch_assoc()) 168 168 { 169 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 169 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 170 170 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 171 if(($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 171 if(($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 172 172 { 173 $TableTexts[$en] = $cz; 173 $TableTexts[$en] = $cz; 174 174 } 175 175 } 176 176 177 177 foreach($TableTexts as $key => $value) { 178 178 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 179 179 $i++; 180 180 } 181 182 181 182 183 183 $Buffer = $Buffer."\n};if not CZWOW_".$Column['AddonFileName']." then CZWOW_".$Column['AddonFileName']."=0; end; CZWOW_".$Column['AddonFileName']."=CZWOW_".$Column['AddonFileName']."+".$i.";\n"; 184 184 … … 193 193 $Buffer = ''; 194 194 foreach($CreatedFileList as $CreatedFile) 195 $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n"; 195 $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n"; 196 196 foreach($TranslationTree as $Group) 197 197 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) 198 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 198 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 199 199 { 200 $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n"; 201 } 202 200 $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n"; 201 } 202 203 203 file_put_contents($this->TempDir.'CzWoW/'.$CountFiles, $Buffer); 204 205 204 205 206 206 // Generate file Translates.xml 207 207 $Buffer = '<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/.\FrameXML\UI.xsd">'."\n"; … … 218 218 { 219 219 global $TranslationTree; 220 220 221 221 $this->LoadFilters(); 222 222 223 223 $Buffer = "local f=function(name, en, cz) CzWoW_interface[name]=cz;CzWoW_interface_entoname[en]=name; end; CzWoW_interface={};CzWoW_interface_entoname={ };\n"; 224 224 $Group = $TranslationTree[14]; // client table 225 225 $Column['Column'] = 'Text'; 226 226 227 227 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`TablePrefix` != "" AND `Group`.`Id` = 14'); 228 228 //$Group = $DbResult->fetch_assoc(); … … 231 231 else 232 232 $CanGenerated = ''; 233 233 234 234 $DbResult = $this->Database->query($this->BuildQuery($Group,$CanGenerated)); 235 while($Line = $DbResult->fetch_array()) 235 while($Line = $DbResult->fetch_array()) 236 236 { 237 237 $Original = $this->my_trim($Line['En'.$Column['Column']]); 238 238 $Translated = $this->my_trim($Line[$Column['Column']]); 239 if($this->ClientVersion['Version'] == '2.4.3') 239 if($this->ClientVersion['Version'] == '2.4.3') 240 240 { 241 241 $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original); … … 265 265 $Buffer = ' 266 266 Čeština pro klienty: 267 Vytvořeno v projektu http://wowpreklad.zdechov.net/ 267 Vytvořeno v projektu http://wowpreklad.zdechov.net/ 268 268 Obsahuje Fonty pro správné zobrazování českých znaků, WoW addon překládající 269 269 texty 270 270 271 271 Instalace: 272 272 Soubory rozbalte/zkopírujte do kořenové složky s hrou. Obvikle bývá 273 273 "C:/Program Files/World of Warcraft/". 274 274 275 275 Verze: 276 Verze Addonu: '.$Line['Version'].' 276 Verze Addonu: '.$Line['Version'].' 277 277 Tato verze je pro verzi hry '.$this->ClientVersion['Version'].' 278 278 279 279 Změny ve verzích: 280 280 281 281 '; 282 282 $DbResult = $System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC'); 283 while($Line = $DbResult->fetch_assoc()) 283 while($Line = $DbResult->fetch_assoc()) 284 284 { 285 285 $Buffer .=' 286 Verze: '.$Line['Version'].' 286 Verze: '.$Line['Version'].' 287 287 ============= 288 288 '.$Line['text'].' 289 289 290 290 '; 291 291 } -
trunk/Modules/Export/Export.php
r799 r816 13 13 var $TempDir; 14 14 var $SourceDir; 15 15 16 16 function Init() 17 17 { … … 23 23 if(!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true); 24 24 } 25 25 26 26 function SaveAllUsers() { 27 28 29 30 31 32 33 34 35 36 37 //$this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);38 39 27 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id); 28 $Export = $DbResult->fetch_assoc(); 29 if ($Export['AllUsers']) { 30 $DbResult2 = $this->System->Database->query('SELECT ID FROM `User` WHERE `ID` NOT IN(SELECT `User` FROM `ExportUser` WHERE `Export`='.$this->Id.')'); 31 while($UserLine = $DbResult2->fetch_assoc()) 32 { 33 $Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID']; 34 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); //,MAX(`Sequence`) as MaxSequence 35 if($DbResult->num_rows > 0) 36 { 37 // $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 38 } else 39 { 40 40 $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$this->Id.', '.$UserLine['ID'].', 0)'); 41 42 43 41 } 42 } 43 44 44 $this->System->Database->query('SET @I = 0'); 45 46 47 } 48 45 $this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$this->Id.' ORDER BY `Sequence`;'); 46 } 47 } 48 49 49 function LoadFilters() 50 { 50 { 51 51 $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id); 52 52 if($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje'); 53 $this->Export = $DbResult->fetch_assoc(); 53 $this->Export = $DbResult->fetch_assoc(); 54 54 55 55 // Filter selected users 56 56 $this->UserNames = ''; 57 57 $DbResult = $this->Database->query('SELECT `ExportUser`.*, `User`.`Name`, `User`.`ID` FROM `ExportUser` '. 58 59 58 'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '. 59 'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 60 60 while($UserLine = $DbResult->fetch_assoc()) 61 61 { 62 62 $this->UserNames .= ', '.$UserLine['Name']; 63 63 } 64 $this->UserNames = substr($this->UserNames, 2); 65 64 $this->UserNames = substr($this->UserNames, 2); 65 66 66 if($this->Export['ClientVersion'] != '') 67 67 { 68 68 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']); 69 69 $this->ClientVersion = $DbResult->fetch_assoc(); 70 } else $this->ClientVersion = ''; 71 } 72 70 } else $this->ClientVersion = ''; 71 } 72 73 73 function BuildQuery($Group, $Version = '') 74 74 { 75 75 global $TranslationTree; 76 76 $this->SaveAllUsers(); 77 78 if ($Version <> '') 77 78 if ($Version <> '') 79 79 $ExportVersion = $Version; 80 80 else 81 81 $ExportVersion = $this->ClientVersion['BuildNumber']; 82 82 83 84 85 86 83 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id); 84 while($GroupItem = $DbResultItem->fetch_assoc()) 85 { 86 $GroupItems[$GroupItem['GroupItem']] = 1; 87 87 } 88 88 // Build selected columns … … 93 93 // $Columns = substr($Columns, 0, -2); 94 94 95 95 96 96 $Query = 'SELECT * FROM (SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'. 97 97 ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '. … … 105 105 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 106 106 $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, '; 107 if (isset($GroupItems[$Column['Id']])) 107 if (isset($GroupItems[$Column['Id']])) 108 108 $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, '; 109 109 } 110 110 $OriginalColumns = substr($OriginalColumns, 0, -2); 111 111 112 112 // Expand query for loading english texts 113 113 $Query = 'SELECT `T4`.*, '.$OriginalColumns.' FROM ('.$Query.') AS `T4` '. 114 114 ' LEFT JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T3`.`Entry` = `T4`.`Entry`) '. 115 115 'AND (`T3`.`Language` = '.$this->System->Config['OriginalLanguage'].') AND '. 116 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 116 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 117 117 118 118 return($Query); 119 119 } 120 120 121 121 function NeedGeneration() 122 122 { … … 130 130 else return(true); 131 131 // echo $file; 132 132 133 133 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 134 135 $result = false; 134 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 135 $result = false; 136 136 while($Group = $DbResult->fetch_assoc()) 137 137 { … … 146 146 if ($DbResult2->num_rows > 0) { 147 147 $result = true; 148 } 149 } 148 } 149 } 150 150 return($result); 151 151 } 152 152 153 153 function ExportToMangosSQL() 154 154 { 155 155 global $TranslationTree; 156 156 157 157 $this->LoadFilters(); 158 159 $Buffer = 160 "-- Generováno projektem wowpreklad.zdechov.net\n". 158 159 $Buffer = 160 "-- Generováno projektem wowpreklad.zdechov.net\n". 161 161 "-- ===========================================\n". 162 162 "--\n". … … 168 168 "-- Vzato od uživatelů: ".$this->UserNames."\n". 169 169 "-- Generované tabulky: "; 170 170 171 171 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 172 172 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 173 173 while($Group = $DbResult->fetch_assoc()) 174 174 { 175 175 $Buffer .= $Group['TablePrefix'].', '; 176 176 } 177 $Buffer .= "\n\n"; 177 $Buffer .= "\n\n"; 178 178 179 179 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 180 180 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 181 181 while($Group = $DbResult->fetch_assoc()) 182 182 { … … 186 186 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 187 187 if($DbResult2->num_rows > 0) 188 while($Line = $DbResult2->fetch_array()) 188 while($Line = $DbResult2->fetch_array()) 189 189 { 190 190 $Values = ''; … … 199 199 // Get multicolumn index 200 200 $ColumnItems = explode(',', $Group['MangosTableIndex']); 201 if(count($ColumnItems) > 1) 201 if(count($ColumnItems) > 1) 202 202 { 203 203 $Where = 'CONCAT('; … … 206 206 $Where = substr($Where, 0, -7).')'; 207 207 } else $Where = '`'.$Group['MangosTableIndex'].'`'; 208 $Where .= ' = "'.$Line[$Group['PrimaryKeyItem']].'";'; 209 208 $Where .= ' = "'.$Line[$Group['PrimaryKeyItem']].'";'; 209 210 210 $Line = 'UPDATE `'.$Group['MangosTable'].'` SET '.$Values.' WHERE '.$Where; 211 211 $Line = str_replace("\n", '\n', $Line); 212 212 $Line = str_replace("\r", '', $Line); 213 213 $Buffer .= $Line."\n"; 214 } 214 } 215 215 } 216 216 } … … 218 218 return($Buffer); 219 219 } 220 221 function ExportToAoWoWSQL() 220 221 function ExportToAoWoWSQL() 222 222 { 223 223 global $TranslationTree, $AoWoWconf; 224 224 225 225 //require_once('../aowow/configs/config.php'); 226 226 227 227 $Buffer = $this->ExportToMangosSQL(); 228 228 229 229 /* 230 230 // Data to aowow 231 231 $Database2 = new mysqli($this->Config['Database']['Host'], $this->Config['Database']['User'], $this->Config['Database']['Password'], $this->Config['Database']['Database']); 232 232 $Database2->query('SET NAMES '.$this->Config['Database']['Charset']); 233 $Database2->select_db($AoWoWconf['mangos']['db']); 233 $Database2->select_db($AoWoWconf['mangos']['db']); 234 234 $AoWoWTables = array( 235 'aowow_resistances' => 'Id', 236 'aowow_spelldispeltype' => 'Id', 235 'aowow_resistances' => 'Id', 236 'aowow_spelldispeltype' => 'Id', 237 237 'aowow_skill' => 'skillID', 238 238 ); 239 foreach($AoWoWTables as $AoWoWTable => $IndexColum) 239 foreach($AoWoWTables as $AoWoWTable => $IndexColum) 240 240 { 241 241 $Buffer .= '--'.$AoWoWTable.', '; 242 $Buffer .= "\n\n"; 242 $Buffer .= "\n\n"; 243 243 $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`'; 244 244 $DbResult = $Database2->query($Query); 245 while($Line = $DbResult->fetch_assoc()) 245 while($Line = $DbResult->fetch_assoc()) 246 246 { 247 247 $Ori_text = $Line['name']; … … 253 253 $Tran = $DbResult2->fetch_assoc(); 254 254 //echo ($Line['name'].'='.$Tran['tran']); 255 if($Tran['Tran'] == '') 255 if($Tran['Tran'] == '') 256 256 { 257 257 $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`, … … 263 263 $Tran = $DbResult2->fetch_assoc(); 264 264 } 265 265 266 266 if($Tran['Tran'] <> '') 267 267 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 268 268 } 269 $Buffer .= "\n\n"; 269 $Buffer .= "\n\n"; 270 270 } 271 271 */ 272 272 if($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 273 273 return($Buffer); 274 } 275 276 function HaveVarible($String1, $String2, $StartChar = '$') 274 } 275 276 function HaveVarible($String1, $String2, $StartChar = '$') 277 277 { 278 278 //Export only if translate have same varible % 279 279 280 280 if (strpos($String1,$StartChar) !== false) { 281 281 282 282 while ( strpos($String1,$StartChar) !== false) { 283 283 $pos = strpos($String1,$StartChar); … … 291 291 // echo $pos.'-'.$varible.'-'.$String1.'-' .$String2.' 292 292 // '; 293 293 294 294 if (false === strpos($String2,$varible)) { 295 // echo $varible; 295 // echo $varible; 296 296 return(false); 297 297 } … … 299 299 } 300 300 return (true); 301 } 301 } 302 302 303 303 function AddProgress($add = 1) { … … 312 312 { 313 313 global $TranslationTree; 314 314 315 315 $this->LoadFilters(); 316 316 317 317 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 318 319 318 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` '. 319 'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""'); 320 320 $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n"; 321 321 while($Group = $DbResult->fetch_assoc()) … … 323 323 $this->AddProgress(2); 324 324 $Output .= $Group['Name'].', '; 325 if(file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 325 if(file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 326 326 { 327 327 // Load string column index list 328 328 $DbResult2 = $this->Database->query('SELECT * FROM `GroupItem` '. 329 'JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']);329 'JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']); 330 330 $ColumnIndexes = array(); 331 331 $ColumnFormat = array(); … … 347 347 $CanExport = false; 348 348 $Output .= ', NE='.$DbRow['ID']; 349 } 349 } 350 350 if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']])) { 351 351 $CanExport = false; 352 352 $Output .= ', NE='.$DbRow['ID']; 353 } 353 } 354 354 } 355 355 356 356 if ($CanExport) 357 357 $LookupTable[$DbRow[$Group['PrimaryKeyItem']]] = $DbRow; 358 358 359 359 } 360 360 361 361 // Open original DBC file 362 362 $SourceDBCFile = new DBCFile(); 363 363 $SourceDBCFile->OpenFile($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat); 364 364 365 365 // Create new DBC file 366 366 if(!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true); … … 375 375 $Output .= "\n\r"; 376 376 $RowCount = $SourceDBCFile->GetRecordCount(); 377 $FieldCount = $SourceDBCFile->GetFieldCount(); 377 $FieldCount = $SourceDBCFile->GetFieldCount(); 378 378 for($Row = 0; $Row < $RowCount; $Row++) 379 379 { 380 380 $Line = $SourceDBCFile->GetLine($Row); 381 381 382 382 // Get multicolumn index value 383 383 $PrimaryKeyItem = ''; 384 384 $ColumnItems = explode(',', $Group['DBCIndex']); 385 if(count($ColumnItems) > 1) 385 if(count($ColumnItems) > 1) 386 386 { 387 387 foreach($ColumnItems as $ColumnItem) … … 391 391 392 392 if(array_key_exists($PrimaryKeyItem, $LookupTable)) 393 { 393 { 394 394 // Replace text columns 395 $LookupTableItem = $LookupTable[$PrimaryKeyItem]; 395 $LookupTableItem = $LookupTable[$PrimaryKeyItem]; 396 396 foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 397 { 397 { 398 398 if(array_key_exists($GroupItem['Id'], $ColumnIndexes)) 399 399 $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']]; … … 401 401 } 402 402 $NewDBCFile->SetLine($Row, $Line); 403 403 404 404 // Show completion progress 405 405 $Progress = round($Row / $RowCount * 100); … … 412 412 $OldProgress = $Progress; 413 413 } 414 } 415 $NewDBCFile->Commit(); 414 } 415 $NewDBCFile->Commit(); 416 416 } else $Output .= ShowMessage('Zdrojový soubor '.$this->SourceDirRelative.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n", MESSAGE_CRITICAL); 417 417 } … … 423 423 { 424 424 global $TranslationTree; 425 425 426 426 $this->LoadFilters(); 427 427 … … 440 440 $File2 = new FileStream(); 441 441 $File2->CreateFile($this->TempDir.'lua/'.$Group['LuaFileName'].'.lua'); 442 442 443 443 $LookupTable = array(); 444 444 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); … … 454 454 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 455 455 $CanExport = false; 456 } 456 } 457 457 if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']])) { 458 458 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 459 459 $CanExport = false; 460 } 460 } 461 461 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']],'%')) { 462 462 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 463 463 $CanExport = false; 464 } 464 } 465 465 if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']],'%')) { 466 466 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 467 467 $CanExport = false; 468 } 468 } 469 469 if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']],'\\')) { 470 470 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 471 471 $CanExport = false; 472 } 472 } 473 473 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']],'\\')) { 474 474 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; … … 478 478 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 479 479 $CanExport = false; 480 } 480 } 481 481 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']],'|')) { 482 482 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; … … 486 486 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 487 487 $CanExport = false; 488 } 488 } 489 489 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']],chr(10))) { 490 490 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; … … 492 492 } 493 493 } 494 494 495 495 if ($CanExport) 496 496 $LookupTable[$DbRow['ShortCut']] = $DbRow; 497 497 } 498 498 499 499 while(!$File->EOF()) 500 500 { … … 505 505 $Value['ShortCut'] = trim($LineParts[0]); 506 506 $Line = trim($LineParts[1]); 507 507 508 508 if($Line[0] == '"') 509 509 { … … 519 519 // $Value['Text'] = addslashes(stripslashes($Value['Text'])); 520 520 $Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon { 521 } else 521 } else 522 522 { 523 523 // Nonstring value … … 552 552 return($Output); 553 553 } 554 554 555 555 function GetReadme() { 556 556 $_GET['ExportId'] = $this->Id; 557 557 $PageExport = new PageExport($this->System); 558 $this->LoadFilters(); 558 $this->LoadFilters(); 559 559 $Output = ''; 560 560 //generation readme … … 572 572 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 573 573 '<title>Čeština pro WoW</title>'. 574 '</head><body>'. 574 '</head><body>'. 575 575 '<h1>České WoW - čestina pro klienta hry World of Warcraft</h1>'. 576 576 577 577 '<table cellspacing="10"><tr><td valign="top">'. 578 578 579 579 '<p>Texty přebírány z projektu <a href="http://wowpreklad.zdechov.net/">wowpreklad.zdechov.net</a><br>'. 580 580 '<a href="http://wowpreklad.zdechov.net/export/?Action=View&ExportId='.$this->Id.'&Tab=0">Export '.$this->Id.'</a></p><br>'. 581 582 581 582 583 583 '<p><strong>Vlastnosti</strong>'. 584 584 '<ul>'. … … 591 591 '</p>'. 592 592 '<br>'. 593 593 594 594 '<h2>Nejčastější otázky</h2>'. 595 '<p><strong>Jak mám vyhledávat věci v aukci nebo výpravy na internetu s nainstalovanou češtinou?</strong><br> 596 Pokud používáte addon, který mění názvy předmětů jenom zdánlivě pro vás, potřebujete pro vyhledávání v aukci zjistit původní anglický název. Tento název zjistíte jednoduše držením klávesy shift a kliknutím na předmět při otevřené aukci, nebo chatu. Vytvořený odkaz v chatu, nebo text v aukci je v původním znění. Stejně zjistíte i název výpravy kliknutím se shift na výpravu v "quest logu". 595 '<p><strong>Jak mám vyhledávat věci v aukci nebo výpravy na internetu s nainstalovanou češtinou?</strong><br> 596 Pokud používáte addon, který mění názvy předmětů jenom zdánlivě pro vás, potřebujete pro vyhledávání v aukci zjistit původní anglický název. Tento název zjistíte jednoduše držením klávesy shift a kliknutím na předmět při otevřené aukci, nebo chatu. Vytvořený odkaz v chatu, nebo text v aukci je v původním znění. Stejně zjistíte i název výpravy kliknutím se shift na výpravu v "quest logu". 597 597 Pokud jste na serveru s českou lokalizaci (tedy nepoužíváte addon), musíte využít český název pro vyhledávání. Server by měl mít spuštěnou vlastní obdobu databáze wowhead.</p>'. 598 598 599 '<p><strong>Po nainstalování češtiny a spouštění přes soubor WoWlua.exe mi klesl výrazně výkon</strong><br> 600 Problém může být spojen s použitím integrované grafiky místo herní.</p>'. 601 602 '<p><strong>Při spouštění hry přes soubor WoWLua.exe se mi neukládá žádné nastavení addonů a podobně</strong><br> 603 Problém může být způsoben špatně nastavenými právy u souboru WoWLua.exe. Můžete přenastavit práva, nebo spouštět jako správce.</p>'. 604 605 '<p><strong>Po spuštění souboru WoWLua.exe mi píše chybu:</strong><br> 606 Cannot stream required archive data. Please check the network connection. 607 Chyba může být způsobena tím, že jste nenainstalovali češtinu do adresáře se hrou. 608 Nebo jste nainstalovali do jiné verze hry, než je požadovaná. Může se vztahovat i na požadovanou lokalizaci (enUS, enGB)</p>'. 609 610 '<p><strong>Po nainstalování češtiny nemám žádné výpravy (questy) česky</strong><br> 611 Zkontrolujte si v přihlášení, jestli máte povolený addon CzWoW v seznamu addonů.</p>'. 612 613 '<p><strong>Addon mi hlásí spoustu chyb.</strong><br> 614 Chyba může být způsobena kolizí s jinými addony. Vyzkoušejte spuštění hry pouze s addonem CzWoW.</p>'. 615 616 '<p><strong>Ve hře se mi špatně zobrazuje diakritika (háčky, čárky)</strong><br> 617 Chyba je způsobena chybějícími fonty do hry. Potřebné fonty si stáhněte mezi soubory ke stažení.</p>'. 618 619 '<p><strong>Mám nainstalovánu češtinu a nejde mi spustit Wow.exe.</strong><br> 620 Pokud chcete opět spouštět hru přes původní Wow.exe v angličtině, musíte češtinu nejprve odinstalovat ze systému. Především se jedná o soubor Data/enGB/patch-enGB-5.MPQ či Data/enUS/patch-enUS-5.MPQ, který je nutno smazat. U novějších verzí se soubor může jmenovat wow-update-base-50000.MPQ.</p>'. 621 622 '<p><strong>Jak mám hru spustit?</strong><br> 623 Hru musíte spustit přes soubor WowLua.exe v kořenovém adresáři hry.</p>'. 624 625 '<p><strong>Mohu použít tuto češtinu na oficiálních serverech?</strong><br> 599 '<p><strong>Po nainstalování češtiny a spouštění přes soubor WoWlua.exe mi klesl výrazně výkon</strong><br> 600 Problém může být spojen s použitím integrované grafiky místo herní.</p>'. 601 602 '<p><strong>Při spouštění hry přes soubor WoWLua.exe se mi neukládá žádné nastavení addonů a podobně</strong><br> 603 Problém může být způsoben špatně nastavenými právy u souboru WoWLua.exe. Můžete přenastavit práva, nebo spouštět jako správce.</p>'. 604 605 '<p><strong>Po spuštění souboru WoWLua.exe mi píše chybu:</strong><br> 606 Cannot stream required archive data. Please check the network connection. 607 Chyba může být způsobena tím, že jste nenainstalovali češtinu do adresáře se hrou. 608 Nebo jste nainstalovali do jiné verze hry, než je požadovaná. Může se vztahovat i na požadovanou lokalizaci (enUS, enGB)</p>'. 609 610 '<p><strong>Po nainstalování češtiny nemám žádné výpravy (questy) česky</strong><br> 611 Zkontrolujte si v přihlášení, jestli máte povolený addon CzWoW v seznamu addonů.</p>'. 612 613 '<p><strong>Addon mi hlásí spoustu chyb.</strong><br> 614 Chyba může být způsobena kolizí s jinými addony. Vyzkoušejte spuštění hry pouze s addonem CzWoW.</p>'. 615 616 '<p><strong>Ve hře se mi špatně zobrazuje diakritika (háčky, čárky)</strong><br> 617 Chyba je způsobena chybějícími fonty do hry. Potřebné fonty si stáhněte mezi soubory ke stažení.</p>'. 618 619 '<p><strong>Mám nainstalovánu češtinu a nejde mi spustit Wow.exe.</strong><br> 620 Pokud chcete opět spouštět hru přes původní Wow.exe v angličtině, musíte češtinu nejprve odinstalovat ze systému. Především se jedná o soubor Data/enGB/patch-enGB-5.MPQ či Data/enUS/patch-enUS-5.MPQ, který je nutno smazat. U novějších verzí se soubor může jmenovat wow-update-base-50000.MPQ.</p>'. 621 622 '<p><strong>Jak mám hru spustit?</strong><br> 623 Hru musíte spustit přes soubor WowLua.exe v kořenovém adresáři hry.</p>'. 624 625 '<p><strong>Mohu použít tuto češtinu na oficiálních serverech?</strong><br> 626 626 Ne úplně, protože se vystavujete riziku zablokování vašeho účtu z důvodu použití upravené hry. Na oficiálním serveru lze využít pouze Addon s češtinou CzWoW. Instalační soubor určený pro oficiální servery je už takto přizpůsoben.</p>'. 627 627 628 628 '</td><td>'; 629 629 … … 631 631 632 632 $Output .= '</td></tr></table>'. 633 634 633 634 635 635 '</body></html>'; 636 636 return $Output; 637 } 638 637 } 638 639 639 function ExportToXML() 640 640 { 641 641 global $TranslationTree; 642 642 643 643 $this->LoadFilters(); 644 644 … … 653 653 foreach(explode(',', $this->UserNames) as $UserName) 654 654 $Buffer .= " <user>".$UserName."</user>\n"; 655 $Buffer .= 655 $Buffer .= 656 656 " </contributors>\n". 657 657 " </meta>\n". … … 659 659 660 660 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 661 661 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 662 662 while($Group = $DbResult->fetch_assoc()) 663 663 { … … 669 669 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n"; 670 670 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 671 while($Line = $DbResult2->fetch_assoc()) 671 while($Line = $DbResult2->fetch_assoc()) 672 672 { 673 673 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; … … 681 681 } 682 682 $Buffer .= " </item>\n"; 683 } 683 } 684 684 $Buffer .= " </group>\n"; 685 685 } … … 688 688 "</document>"; 689 689 return($Buffer); 690 } 690 } 691 691 } 692 692 … … 706 706 $this->Dependencies = array(); 707 707 } 708 708 709 709 function Start() 710 710 { 711 712 713 714 715 716 717 711 $this->System->RegisterPage('export', 'PageExport'); 712 $this->System->RegisterMenuItem(array( 713 'Title' => 'Exporty', 714 'Hint' => 'Zde si můžete stáhnout přeložené texty', 715 'Link' => $this->System->Link('/export/'), 716 'Permission' => LICENCE_ANONYMOUS, 717 'Icon' => '', 718 718 ), 2); 719 719 } -
trunk/Modules/Export/ExportOutput.php
r743 r816 17 17 //echo($Path.$FileName.'<br />'); 18 18 if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/'); 19 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 20 } 19 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 20 } 21 21 } 22 22 } … … 25 25 { 26 26 global $System, $Config; 27 28 $Output = ''; 29 $Export = new Export($System); 30 $Export->Id = $ExportId; 31 $Export->Init(); 32 if(function_exists('gzcompress')) 27 28 $Output = ''; 29 $Export = new Export($System); 30 $Export->Id = $ExportId; 31 $Export->Init(); 32 if(function_exists('gzcompress')) 33 33 { 34 34 $SaveFilename = $Export->TempDir.'CzAoWoW_SQL.zip'; 35 $SQLFilename = 'CzAoWoW_SQL.sql'; 35 $SQLFilename = 'CzAoWoW_SQL.sql'; 36 36 $BufferZip = $Export->ExportToAoWoWSQL(); 37 37 $ZipFile = new zipfile(); … … 43 43 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 44 44 // '</script>'; 45 46 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 45 46 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 47 47 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 48 48 'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.'; … … 53 53 { 54 54 global $System, $Config; 55 56 $Export = new Export($System); 57 $Export->Id = $ExportId; 58 55 56 $Export = new Export($System); 57 $Export->Id = $ExportId; 58 59 59 $Output = 'Vygenerovaný SQL kód: <br /><pre class="SQLCode">'. 60 60 htmlspecialchars($Export->ExportToAoWoWSQL()). … … 66 66 { 67 67 global $System, $Config; 68 69 $Output = ''; 70 $Export = new Export($System); 71 $Export->Id = $ExportId; 72 $Export->Init(); 73 if(function_exists('gzcompress')) 68 69 $Output = ''; 70 $Export = new Export($System); 71 $Export->Id = $ExportId; 72 $Export->Init(); 73 if(function_exists('gzcompress')) 74 74 { 75 75 $SaveFilename = $Export->TempDir.'CzWoW_SQL.zip'; 76 $SQLFilename = 'CzWoW_SQL.sql'; 76 $SQLFilename = 'CzWoW_SQL.sql'; 77 77 $BufferZip = $Export->ExportToMangosSQL(); 78 78 $ZipFile = new zipfile(); … … 84 84 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 85 85 // '</script>'; 86 87 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 86 87 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 88 88 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 89 89 'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.'; 90 return($Output); 90 return($Output); 91 91 } 92 92 … … 94 94 { 95 95 global $System; 96 96 97 97 $Export = new Export($System); 98 98 $Export->Id = $ExportId; … … 107 107 { 108 108 global $System; 109 110 if(function_exists('gzcompress')) 109 110 if(function_exists('gzcompress')) 111 111 { 112 112 $Addon = new ExportAddon($System); … … 114 114 $Addon->Init(); 115 115 $Output = $Addon->MakeAddon(); 116 116 117 117 $Output .= 'Generování addonu...<br />'; 118 $SaveFilename = $Addon->TempDir.'CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip'; 118 $SaveFilename = $Addon->TempDir.'CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip'; 119 119 $Zip = new zipfile(); 120 120 CreateZipFromDir($Zip, $Addon->TempDir.'CzWoW/', 'CzWoW/'); 121 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml'); 122 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml'); 123 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc'); 124 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua'); 125 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml'); 126 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua'); 121 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml'); 122 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml'); 123 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc'); 124 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua'); 125 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml'); 126 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua'); 127 127 $Buffer = $Zip->file(); 128 128 file_put_contents($SaveFilename, $Buffer); … … 132 132 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 133 133 // '</script>'; 134 135 $Output .= 'Soubor ke stažení: '. 134 135 $Output .= 'Soubor ke stažení: '. 136 136 '<a href="'.$System->Link('/'.$Addon->TempDirRelative.'CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip').'">CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip</a><br />'. 137 137 'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.'; … … 143 143 { 144 144 global $Config, $System; 145 146 $Output = ''; 147 $Export = new Export($System); 148 $Export->Id = $ExportId; 149 $Export->Init(); 150 if(function_exists('gzcompress')) 145 146 $Output = ''; 147 $Export = new Export($System); 148 $Export->Id = $ExportId; 149 $Export->Init(); 150 if(function_exists('gzcompress')) 151 151 { 152 152 $SaveFilename = $Export->TempDir.'CzWoW_XML.zip'; 153 $SQLFilename = 'CzWoW_XML.sql'; 153 $SQLFilename = 'CzWoW_XML.sql'; 154 154 $BufferZip = $Export->ExportToXML(); 155 155 $ZipFile = new zipfile(); … … 161 161 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 162 162 // '</script>'; 163 164 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 163 164 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 165 165 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'. 166 166 'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.'; … … 171 171 { 172 172 global $System; 173 173 174 174 $Export = new Export($System); 175 175 $Export->Id = $ExportId; … … 188 188 $Export->Id = $ExportId; 189 189 $Export->Init(); 190 190 191 191 $Output = ''; 192 192 if(array_key_exists('Regenerate', $_POST)) … … 199 199 $Output .= '<form action="?Action=View&Tab=7&ExportId='.$ExportId.'" method="post"><input type="submit" name="Regenerate" value="Přegenerovat"/></form><br />'; 200 200 $Output .= 'U DBC souborů export textů funguje jinak, protože generování je náročné, jsou požadavky zařazovány do fronty a postupně zpracovávány.<br />DBC soubory je nutné zabalit do souboru patch-enGB-5.MPQ uvnitř složky "DBFilesClient" a hru spouštět přes upravený spouštěcí soubor. Zabalit je můžete pomocí programu <a href="../download/mpqediten32.zip">Ladik\'s MPQ Editor</a>. Stav vygenerování můžete sledovat na této stránce.<br /><br />'; 201 201 202 202 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$ExportId); 203 203 if($DbResult->num_rows == 0) … … 206 206 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 207 207 $System->Database->query('UPDATE `ExportTask` SET `Progress`=0 WHERE `Export`='.$Export->Id); 208 } 209 208 } 209 210 210 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 211 211 $ExportTask = $DbResult->fetch_assoc(); … … 216 216 while($Group = $DbResult->fetch_assoc()) 217 217 { 218 if(file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc')) 219 218 if(file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc')) 219 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'dbc/'.$Group['DBCFileName'].'.dbc').'">'.$Group['DBCFileName'].'.dbc</a><br/>'; 220 220 } 221 221 } else { 222 222 $Output .= ShowProgress($Export); 223 223 224 } 224 } 225 225 return($Output); 226 226 } … … 232 232 233 233 234 234 $Output .= '<script src="http://code.jquery.com/jquery-latest.js"></script>'. 235 235 '<script>'. 236 236 '$(document).ready(function() {'. … … 241 241 '</script>'; 242 242 243 243 244 244 $Output .= ' <strong><div id="progress"></div></strong><br />'; 245 245 … … 248 248 if($DbResult->num_rows > 0) { 249 249 $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR); 250 250 251 251 } 252 252 return ($Output); … … 256 256 { 257 257 global $System; 258 258 259 259 $Export = new Export($System); 260 260 $Export->Id = $ExportId; … … 272 272 $Output .= '<form action="?Action=View&Tab=7&ExportId='.$ExportId.'" method="post"><input type="submit" name="Regenerate" value="Přegenerovat"/></form><br />'; 273 273 $Output .= 'U souhrné instalace češtiny funguje export textů jinak, protože generování je náročné, jsou požadavky zařazovány do fronty a postupně zpracovávány.<br /><br />'; 274 274 275 275 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$ExportId); 276 276 if($DbResult->num_rows == 0) … … 278 278 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); 279 279 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 280 } 281 280 } 281 282 282 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 283 283 $ExportTask = $DbResult->fetch_assoc(); … … 287 287 288 288 } else { 289 289 290 290 $Output .= ShowProgress($Export); 291 291 } … … 296 296 { 297 297 global $System, $Config; 298 299 $Export = new Export($System); 300 $Export->Id = $ExportId; 301 $Export->Init(); 302 303 if(function_exists('gzcompress')) 298 299 $Export = new Export($System); 300 $Export->Id = $ExportId; 301 $Export->Init(); 302 303 if(function_exists('gzcompress')) 304 304 { 305 305 $Output = 'Generování lua souborů...<br />'; 306 306 $Export->ExportToLua(); 307 $SaveFilename = $Export->TempDir.'CzWoW_Lua.zip'; 307 $SaveFilename = $Export->TempDir.'CzWoW_Lua.zip'; 308 308 $ZipFile = new zipfile(); 309 309 CreateZipFromDir($ZipFile, $Export->TempDir.'lua/', ''); … … 315 315 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 316 316 // '</script>'; 317 318 $Output .= '<strong>Soubory:</strong><br/>'. 317 318 $Output .= '<strong>Soubory:</strong><br/>'. 319 319 'Souhrný archív <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_Lua.zip').'">CzWoW_Lua.zip</a><br />'; 320 320 $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`LuaFileName` != ""'); -
trunk/Modules/Export/Page.php
r809 r816 14 14 class PageExport extends Page 15 15 { 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 16 function ExportList() 17 { 18 $Output = '<a href="?Action=ViewList">'.T('All').'</a>'; 19 if($this->System->User->Licence(LICENCE_USER)) 20 { 21 $Output .= ' <a href="?Action=ViewList&Filter=Others">Ostatních</a>'. 22 ' <a href="?Action=ViewList&Filter=My">'.T('Mine').'</a>'; 23 } 24 25 if($this->System->User->Licence(LICENCE_USER)) 26 $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>'; 27 28 $Filter = ''; 29 if(array_key_exists('Filter', $_GET)) 30 { 31 if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$this->System->User->Id; 32 if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$this->System->User->Id; 33 } 34 35 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter); 36 $DbRow = $DbResult->fetch_row(); 37 $PageList = GetPageList($DbRow[0]); 38 39 $Output .= '<h3>'.T('List of export').'</h3>'. 40 $PageList['Output']; 41 42 $TableColumns = array( 43 array('Name' => 'TimeCreate', 'Title' => T('Time made')), 44 array('Name' => 'UserName', 'Title' => T('Translator')), 45 array('Name' => 'Title', 'Title' => T('Name od export')), 46 // array('Name' => 'UserCount', 'Title' => 'Vybraných překladatelů'), 47 // array('Name' => 'GroupCount', 'Title' => 'Překladových skupin'), 48 array('Name' => 'OutputType', 'Title' => T('Type of output')), 49 array('Name' => 'ClientVersion', 'Title' => T('Client version')), 50 array('Name' => 'UsedCount', 'Title' => T('Viewed count')), 51 array('Name' => '', 'Title' => T('Action')), 52 ); 53 $Order = GetOrderTableHeader($TableColumns, 'TimeCreate', 1); 54 $Output .= '<table class="BaseTable">'. 55 $Order['Output']; 56 57 $DbResult = $this->System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, '. 58 58 '(SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`, '. 59 59 '(SELECT Id FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersionId`, '. … … 62 62 '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '. 63 63 'LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']); 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 64 while($Export = $DbResult->fetch_assoc()) 65 { 66 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">'.T('View').'</a> '. 67 '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">'.T('Make export').'</a>'; 68 if($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>'; 69 if($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>'; 70 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 71 '<td><a href="'.$this->System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. 72 '<td>'.$Export['Title'].'</td>'. 73 '<td>'.$Export['OutputType'].'</td>'. 74 '<td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Export['ClientVersionId']).'">'.$Export['ClientVersion'].'</a></td>'. 75 '<td>'.$Export['UsedCount'].'</td>'. 76 '<td>'.$Action.'</td></tr>'; 77 } 78 $Output .= '</table>'. 79 $PageList['Output']; 80 81 return($Output); 82 } 83 84 function ExportCreate() 85 { 86 if($this->System->User->Licence(LICENCE_USER)) 87 { 88 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 89 $DbRow = $DbResult->fetch_row(); 90 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 91 { 92 $Output = '<form action="?Action=CreateFinish" method="post">'. 93 '<fieldset><legend>'.T('Creation of new export').'</legend>'. 94 '<table><tr><td>'.T('Identification').':</td><td><input type="text" name="Title" /></td></tr>'. 95 '<tr><td>'.T('Description').':</td><td><textarea name="Description" cols="54" rows="10"></textarea></td></tr>'. 96 '<tr><td colspan="2"><input type="submit" value="'.T('Create').'" /></td></tr>'. 97 '</table></fieldset></form>'; 98 } else $Output = ShowMessage(T('You can\'t create another export. Max for one user is').$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 99 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 100 return($Output); 101 } 102 103 function ExportCreateFinish() 104 { 105 if($this->System->User->Licence(LICENCE_USER)) 106 { 107 if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 108 { 109 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 110 $DbRow = $DbResult->fetch_row(); 111 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 112 { 113 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); 114 $ExportId = $this->System->Database->insert_id; 115 $Output = ShowMessage(T('New export created.<br />Direct link to export').': <a href="?Action=View&ExportId='.$ExportId.'">'.T('here').'</a>'); 116 $this->System->ModuleManager->Modules['Log']->WriteLog(T('New export created').' <a href="'.$this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT); 117 $_GET['Filter'] = 'my'; 118 $this->ExportList(); 119 } else $Output = ShowMessage(T('You can\'t create another export. Max for one user is').' '.$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 120 } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL); 121 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 122 return($Output); 123 } 124 125 function ExportDelete() 126 { 127 if($this->System->User->Licence(LICENCE_USER)) 128 { 129 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$this->System->User->Id.')'); 130 if($DbResult->num_rows > 0) 131 { 132 $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']); 133 $this->System->Database->query('DELETE FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']); 134 $this->System->Database->query('DELETE FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId']); 135 $this->System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$_GET['ExportId']); 136 $this->System->Database->query('DELETE FROM `ExportUser` WHERE `Export`='.$_GET['ExportId']); 137 $this->System->Database->query('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']); 138 DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/'); 139 $Output = ShowMessage(T('Export deleted.')); 140 $_GET['Filter'] = 'my'; 141 $this->System->ModuleManager->Modules['Log']->WriteLog('Smazán export '.$_GET['ExportId'], LOG_TYPE_EXPORT); 142 $Output .= $this->ExportList(); 143 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 144 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 145 return($Output); 146 } 147 148 function SaveAllUsers() 149 { 150 global $System; 151 $Export = new Export($System); 152 152 $Export->Id = $_GET['ExportId']; 153 153 $Export->SaveAllUsers(); 154 155 } 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 if (array_key_exists('AllUsers', $_POST)) { 154 155 } 156 157 function ExportViewTranslators() 158 { 159 global $TranslationTree; 160 161 $Output = ''; 162 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 163 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 164 $Export = $DbResult->fetch_assoc(); 165 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 166 else $Editable = false; 167 168 if(array_key_exists('Operation', $_POST)) 169 { 170 if($_POST['Operation'] == 'Save') 171 { 172 //print_r($_POST); 173 // Update user selection page 174 foreach($_POST as $Index => $Value) 175 { 176 if(substr($Index, 0, 3) == 'seq') 177 { 178 $UserId = substr($Index, 3) * 1; 179 if(array_key_exists('sel'.$UserId, $_POST)) $Selected = true; 180 else $Selected = false; 181 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId; 182 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); 183 if($DbResult->num_rows > 0) 184 { 185 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition); 186 else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 187 } else 188 { 189 if($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')'); 190 } 191 } 192 } 193 194 if (array_key_exists('AllUsers', $_POST)) { 195 195 //add allusers to export 196 197 198 196 $this->System->Database->query('UPDATE `Export` SET `AllUsers`=1 WHERE `Id`='.$_GET['ExportId']); 197 198 //update export stat 199 199 $Export['AllUsers'] = 1; 200 200 $this->SaveAllUsers(); 201 201 } else { 202 202 //update export stat 203 203 $Export['AllUsers'] = 0; 204 204 $this->System->Database->query('UPDATE `Export` SET `AllUsers`=0 WHERE `Id`='.$_GET['ExportId']); 205 205 } 206 206 207 208 209 210 211 212 213 214 215 216 217 218 array('Name' => 'XP', 'Title' => T('Experience')), 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 207 // Recalculate sequence number 208 $this->System->Database->query('SET @I = 0'); 209 $this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;'); 210 $Output .= ShowMessage(T('Select saved.')); 211 } 212 } 213 214 $TableColumns = array( 215 array('Name' => 'Name', 'Title' => T('Name')), 216 array('Name' => 'TranslatedCount', 'Title' => T('Translated count')), 217 array('Name' => 'XP', 'Title' => T('Level')), 218 array('Name' => 'XP', 'Title' => T('Experience')), 219 array('Name' => '', 'Title' => T('Select')), 220 array('Name' => 'Sequence2', 'Title' => T('Order')), 221 ); 222 $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1); 223 if($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10); 224 else $InitialOrder = ''; 225 226 $Query = 'SELECT (@I := @I + 1) AS `Sequence2`, `TT`.* FROM (SELECT `ExportUser`.`Sequence`, `T`.`ID`, `T`.`TranslatedCount`, `T`.`Name`, `T`.`XP` FROM (SELECT `User`.`ID`, `User`.`Name`, `User`.`XP`, `TranslatedCount` FROM `User`) AS T'; 227 $Query .=' LEFT JOIN `ExportUser` ON `ExportUser`.`Export` = '.$_GET['ExportId'].' AND `ExportUser`.`User`=`T`.`ID`'; 228 $Query .=' WHERE `T`.`TranslatedCount` > 0 ORDER BY COALESCE(`ExportUser`.`Sequence`, 100000000)'.$InitialOrder.') AS `TT`'; 229 230 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`'); 231 $DbRow = $DbResult->fetch_row(); 232 $PageList = GetPageList($DbRow[0]); 233 234 $Output .= '<form name="Translators" action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 235 '<h3>'.T('Translators').'</h3>'; 236 if($Editable) 237 { 238 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 239 '<input type="hidden" name="Operation" value="Save"/><br />'. 240 ' <span onclick="CheckAllCheckbox();">'.CheckBox('CheckAll', False, 'CheckAll').' '.T('Select all on page').'</span> <br />'. 241 ' <span>'.CheckBox('AllUsers', $Export['AllUsers']).' '.T('Export allways from all users').'</span> '. 242 '<br />'. 243 T('Select users from list which you want to export from. And edit their order.').'<br />'. 244 T('Order is done by numeric value which is can be edit to desirable order. Lines with same number will be renumbered in ascending order.'); 245 } 246 247 $Output .= $PageList['Output']. 248 '<table class="BaseTable">'. 249 $Order['Output']; 250 251 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 252 $this->System->Database->query('SET @I = 0'); 253 $DbResult = $this->System->Database->query($Query); 254 while($UserLine = $DbResult->fetch_assoc()) 255 { 256 $XP = GetLevelMinMax($UserLine['XP']); 257 $Checked = $UserLine['Sequence'] != ''; 258 $Selection = CheckBox('sel'.$UserLine['ID'], $Checked, '', 'CheckBox', ((!$Editable) or ($Export['AllUsers']))); 259 $Sequence = '<input type="text" name="seq'.$UserLine['ID'].'" style="text-align: center; width: 40px;" value="'.$UserLine['Sequence2'].'"'.$DisabledInput[$Editable].'/>'; 260 $Output .= '<tr>'. 261 '<td><a href="'.$this->System->Link('/TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0').'" title="Zobrazit všechny jeho přeložené texty">'.$UserLine['Name'].'</a></td>'. 262 '<td>'.$UserLine['TranslatedCount'].'</td>'. 263 '<td>'.$XP['Level'].'</td>'. 264 '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'. 265 '<td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>'; 266 } 267 $Output .= '</table>'. 268 '</form>'. 269 $PageList['Output']; 270 return($Output); 271 } 272 273 function ExportViewGeneral() 274 { 275 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 276 $DisabledTextArea = array(false => ' readonly="yes"', true => ''); 277 $Output = '<h3>Obecná nastavení</h3>'; 278 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 279 $Export = $DbRows->fetch_assoc(); 280 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 281 else $Editable = false; 282 283 if(array_key_exists('Operation', $_POST)) 284 if($_POST['Operation'] == 'Save') if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 285 { 286 if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1; 287 else $WithDiacritic = 0; 288 if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1; 289 $this->System->Database->query('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Featured`='.$Export['Featured'].', `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']); 290 $Export['Title'] = $_POST['Title']; 291 $Export['Description'] = $_POST['Description']; 292 $Export['WithDiacritic'] = $WithDiacritic; 293 $Output .= ShowMessage('Nastavení uloženo.'); 294 } 295 296 if($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"'; 297 else $WithDiacritic = ''; 298 $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 299 '<table>'; 300 if($this->System->User->Id != null) 301 { 302 $Output .= '<input type="hidden" name="Operation" value="Save"/>'. 303 '<tr><td colspan="2">'; 304 304 if($Editable) $Output .= ' <input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/>'; 305 305 $Output .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a> '; 306 306 if($this->System->User->Licence(LICENCE_ADMIN)) 307 307 $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' '; 308 308 $Output .= '</td></tr>'; 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 foreach($TranslationTree as $Group) 447 448 309 } 310 $Output .= '<tr><td>'.T('Identification').':</td><td><input type="text" style="width: 400px" name="Title" value="'.$Export['Title'].'"'.$DisabledInput[$Editable].'/></td></tr>'. 311 '<tr><td>Popis:</td><td><textarea name="Description" cols="54" rows="10"'.$DisabledTextArea[$Editable].'>'.$Export['Description'].'</textarea></td></tr>'. 312 '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'. 313 '</table></form>'; 314 return($Output); 315 } 316 317 function ExportViewLanguages() 318 { 319 global $TranslationTree; 320 321 $Output = ''; 322 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 323 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 324 $Export = $DbRows->fetch_assoc(); 325 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 326 else $Editable = false; 327 328 if(array_key_exists('Operation', $_POST)) 329 { 330 if($_POST['Operation'] == 'Save') 331 { 332 //print_r($_POST); 333 // Update user selection page 334 foreach($_POST as $Index => $Value) 335 { 336 if(substr($Index, 0, 3) == 'seq') 337 { 338 $LanguageId = substr($Index, 3) * 1; 339 if(array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true; 340 else $Selected = false; 341 $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId; 342 $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition); 343 if($DbResult->num_rows > 0) 344 { 345 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition); 346 else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition); 347 } else 348 { 349 if($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')'); 350 } 351 } 352 } 353 354 // Recalculate sequence number 355 $this->System->Database->query('SET @I = 0'); 356 $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;'); 357 $Output .= ShowMessage('Výběr uložen.'); 358 } 359 } 360 361 $Query = 'SELECT (@I := @I + 1) AS `Sequence2`, `Sequence`, `Language`.`Id`, `Name` FROM `Language`'; 362 $Query .=' LEFT JOIN `ExportLanguage` ON `ExportLanguage`.`Export` = '.$_GET['ExportId'].' AND `ExportLanguage`.`Language`=`Language`.`Id`'; 363 $Query .=' WHERE `Language`.`Enabled` = 1 ORDER BY COALESCE(`Sequence`, 100)'; 364 365 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X'); 366 $DbRow = $DbResult->fetch_row(); 367 $PageList = GetPageList($DbRow[0]); 368 369 $TableColumns = array( 370 array('Name' => 'Name', 'Title' => T('Name')), 371 array('Name' => '', 'Title' => T('Select')), 372 array('Name' => 'Sequence2', 'Title' => T('Order')), 373 ); 374 $Order = GetOrderTableHeader($TableColumns, 'Sequence2'); 375 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 376 '<h3>'.T('Languages').'</h3>'; 377 if($Editable) 378 { 379 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 380 '<input type="hidden" name="Operation" value="Save"/>'. 381 '<br />'. 382 T('Select languades from list witch you want to export from. And edit theirs order.').'<br />'. 383 T('Order is done by numeric value which is can be edit to desirable order. Lines with same number will be renumbered in ascending order.'); 384 } 385 386 $Output .= $PageList['Output']. 387 '<table class="BaseTable">'. 388 $Order['Output']; 389 390 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 391 $this->System->Database->query('SET @I = 0'); 392 $DbResult = $this->System->Database->query($Query); 393 while($Langugage = $DbResult->fetch_assoc()) 394 { 395 $Checked = $Langugage['Sequence'] != ''; 396 $Selection = CheckBox('sel'.$Langugage['Id'], $Checked, '', 'CheckBox', !$Editable); 397 $Sequence = '<input type="text" name="seq'.$Langugage['Id'].'" style="text-align: center; width: 40px;" value="'.$Langugage['Sequence2'].'"'.$DisabledInput[$Editable].'/>'; 398 $Output .= '<tr> 399 <td>'.$Langugage['Name'].'</td> 400 <td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>'; 401 } 402 $Output .= '</table>'. 403 '</form>'. 404 $PageList['Output']; 405 return($Output); 406 } 407 408 function ExportViewGroups() 409 { 410 global $TranslationTree; 411 412 $Output = ''; 413 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 414 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 415 $Export = $DbRows->fetch_assoc(); 416 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 417 else $Editable = false; 418 419 if(array_key_exists('Operation', $_POST)) 420 { 421 if($_POST['Operation'] == 'Save') 422 { 423 //print_r($_POST); 424 // Update user selection page 425 foreach($_POST as $Index => $Value) 426 { 427 if(substr($Index, 0, 3) == 'seq') 428 { 429 $GroupId = substr($Index, 3) * 1; 430 if(array_key_exists('sel'.$GroupId, $_POST)) $Selected = true; 431 else $Selected = false; 432 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId; 433 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition); 434 if($DbResult->num_rows > 0) 435 { 436 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition); 437 } else 438 { 439 if($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')'); 440 } 441 } 442 } 443 $Output .= ShowMessage(T('Select saved.')); 444 } 445 //items 446 foreach($TranslationTree as $Group) 447 { 448 // echo $Group['Id'].' '; 449 449 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 450 450 if(array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true; … … 452 452 //we will save only forbitten collums and need to be visible 453 453 $Selected = !$Selected; 454 if (!$Column['Visible']) $Selected = false; 455 456 457 458 459 460 461 462 463 464 454 if (!$Column['Visible']) $Selected = false; 455 456 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id']; 457 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition); 458 if($DbResult->num_rows > 0) 459 { 460 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition); 461 } else 462 { 463 if($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')'); 464 } 465 465 466 466 } 467 467 } 468 469 470 471 472 473 474 475 476 477 478 479 480 //array('Name' => 'DBCFileName', 'Title' => 'DBC soubor'),481 //array('Name' => 'LuaFileName', 'Title' => 'Lua soubor'),482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 } 505 506 507 508 509 468 } 469 470 $Query = 'SELECT `Group`.*, `ExportGroup`.`Id` AS `ExportGroupId` FROM `Group` LEFT JOIN `ExportGroup` ON `ExportGroup`.`Export`='.$_GET['ExportId'].' AND `Group`=`Group`.`Id`'; 471 472 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X'); 473 $DbRow = $DbResult->fetch_row(); 474 $PageList = GetPageList($DbRow[0]); 475 476 $TableColumns = array( 477 array('Name' => '', 'Title' => T('Select')), 478 array('Name' => 'Name', 'Title' => T('Name')), 479 array('Name' => 'MangosTable', 'Title' => 'Mangos/DBC/Lua'), 480 // array('Name' => 'DBCFileName', 'Title' => 'DBC soubor'), 481 // array('Name' => 'LuaFileName', 'Title' => 'Lua soubor'), 482 array('Name' => '', 'Title' => T('Items of tranlation')), 483 ); 484 $Order = GetOrderTableHeader($TableColumns, 'Name'); 485 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 486 '<h3>Překladové skupiny</h3>'; 487 if($Editable) 488 { 489 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 490 '<input type="hidden" name="Operation" value="Save"/>'. 491 ' <span onclick="CheckAllCheckbox();">'.CheckBox('CheckAll', False, 'CheckAll').' '.T('Select all').'</span> '. 492 '<br />'. 493 T('Select translation groups witch you want to export.').'<br />'; 494 } 495 496 $Output .= $PageList['Output']. 497 '<table class="BaseTable">'. 498 $Order['Output']; 499 500 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']); 501 while($GroupItem = $DbResultItem->fetch_assoc()) 502 { 503 $GroupItems[$GroupItem['GroupItem']] = 1; 504 } 505 506 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 507 $DbResult = $this->System->Database->query($Query); 508 while($Group = $DbResult->fetch_assoc()) 509 { 510 510 $Columns = ''; 511 511 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 512 512 if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'], !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.$Column['Name'].' <br />'; 513 513 } 514 515 516 517 518 519 520 521 522 523 524 525 526 $Output .= 527 $Output .= $Columns.'</td>';514 $Checked = $Group['ExportGroupId'] != ''; 515 $Selection = CheckBox('sel'.$Group['Id'], $Checked, '', 'CheckBox', !$Editable); 516 $Output .= '<tr>'. 517 '<td>'.$Selection.'<input type="hidden" name="seq'.$Group['Id'].'"/></td>'. 518 '<td>'.$Group['Name'].'</td><td>'; 519 if ($Group['MangosTable'] <> '') 520 $Output .= $Group['MangosTable'].'.sql '; 521 if ($Group['LuaFileName'] <> '') 522 $Output .= $Group['LuaFileName'].'.lua '; 523 if ($Group['DBCFileName'] <> '') 524 $Output .= $Group['DBCFileName'].'.dbc '; 525 526 $Output .= '</td><td>'; 527 $Output .= $Columns. '</td>'; 528 528 $Output .= '</tr>'; 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 if (array_key_exists('Auto', $_GET) == false) 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 $DbRow['User'] = $this->System->User->Id; 788 789 529 } 530 $Output .= '</table>'. 531 '</form>'. 532 $PageList['Output']; 533 return($Output); 534 } 535 536 function ExportViewOutputFormat() 537 { 538 $Output = ''; 539 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 540 if(array_key_exists('ExportId', $_GET)) 541 { 542 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 543 if($DbRows->num_rows > 0) 544 { 545 $Export = $DbRows->fetch_assoc(); 546 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 547 else $Editable = false; 548 549 if(array_key_exists('Operation', $_POST)) 550 if($_POST['Operation'] == 'Save') 551 { 552 if(array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0)) 553 { 554 $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']); 555 $Output .= ShowMessage(T('Select saved.')); 556 } else $Output .= ShowMessage(T('Format wasn\'t selected'), MESSAGE_CRITICAL); 557 } 558 559 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 560 $Export = $DbResult->fetch_assoc(); 561 562 $Output .= '<h3>'.T('Format the generated output').'</h3>'. 563 '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'; 564 if($Editable) 565 { 566 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 567 '<input type="hidden" name="Operation" value="Save"/>'. 568 '<br />'; 569 } 570 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`'); 571 while($ExportFormat = $DbResult->fetch_assoc()) 572 { 573 $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>'; 574 } 575 $Output .= '</form>'; 576 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 577 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 578 return($Output); 579 } 580 581 function ExportViewVersion() 582 { 583 $Output = ''; 584 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 585 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 586 $Export = $DbRows->fetch_assoc(); 587 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 588 else $Editable = false; 589 590 if(array_key_exists('Operation', $_POST)) 591 if(($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST))) 592 { 593 $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']); 594 $Output .= ShowMessage(T('Select saved.')); 595 } 596 597 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 598 $Export = $DbResult->fetch_assoc(); 599 600 if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 601 else { 602 $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '. 603 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id`=`ExportVersion`.`ClientVersion` WHERE `ExportType`='.$Export['OutputType']; 604 605 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`'); 606 $DbRow = $DbResult->fetch_row(); 607 $PageList = GetPageList($DbRow[0]); 608 609 $TableColumns = array( 610 array('Name' => 'Version', 'Title' => T('Version')), 611 array('Name' => 'BuildNumber', 'Title' => T('Build')), 612 array('Name' => 'ReleaseDate', 'Title' => T('Release date')), 613 array('Name' => 'Title', 'Title' => T('Name2')), 614 array('Name' => '', 'Title' => T('Select')), 615 ); 616 $Order = GetOrderTableHeader($TableColumns, 'BuildNumber', 1); 617 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 618 '<h3>'.T('Client version').'</h3>'; 619 620 if($Editable) 621 { 622 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 623 '<input type="hidden" name="Operation" value="Save"/>'. 624 '<br />'. 625 T('Select version of game client witch you want to export.').'<br />'; 626 } 627 $Output .= $PageList['Output']. 628 '<table class="BaseTable">'. 629 $Order['Output']; 630 631 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 632 $DbResult = $this->System->Database->query($Query); 633 while($Version = $DbResult->fetch_assoc()) 634 { 635 $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Version['Id']).'">'. 636 $Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'. 637 HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'. 638 RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable 639 ).'</td></tr>'; 640 641 } 642 $Output .= '</table>'. 643 '</form>'. 644 $PageList['Output']; 645 } 646 return($Output); 647 } 648 649 function ExportViewOutput() 650 { 651 $Output = ''; 652 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 653 $Export = $DbResult->fetch_assoc(); 654 if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 655 else if($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 656 else { 657 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']); 658 if($DbResult->num_rows > 0) 659 { 660 $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')'); 661 if($DbResult->num_rows > 0) 662 { 663 if (array_key_exists('Auto', $_GET) == false) 664 $this->System->Database->query('UPDATE `Export` SET `UsedCount` = `UsedCount` + 1 WHERE `Id`='.$Export['Id']); 665 $Output = ExportOutput($Export['Id'], $Export['OutputType']); 666 } else $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 667 } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL); 668 } 669 return($Output); 670 } 671 672 function ExportViewStat($Where = '') 673 { 674 $Export = new Export($this->System); 675 $Export->Id = $_GET['ExportId']; 676 $Export->Init(); 677 $Export->LoadFilters(); 678 679 if(($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == '')) 680 $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 681 else { 682 $GroupListQuery = 'SELECT `Group`.* FROM `Group` '. 683 ' JOIN `ExportGroup` ON (`ExportGroup`.`Export`='.$Export->Id.') AND (`ExportGroup`.`Group`=`Group`.`Id`)'; 684 $Query = ''; 685 $UnionItems = array(); 686 $DbResult = $this->System->Database->query($GroupListQuery.$Where); 687 while($DbRow = $DbResult->fetch_assoc()) 688 { 689 $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 690 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 691 ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$Export->Id.') '. 692 ' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$Export->Id.')'. 693 ' WHERE (`Complete` = 1) AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'. 694 ') AS `C1`) AS `Translated`, '. 695 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 696 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 697 ' WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'. 698 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name`'; 699 } 700 $Query = substr($Query, 0, - 6); 701 702 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`'); 703 $DbRow = $DbResult->fetch_row(); 704 $PageList = GetPageList($DbRow[0]); 705 $Output = '<h3>'.T('Statistic of coplection selected groups').'</h3>'. 706 $PageList['Output']; 707 708 $Output .= '<table class="BaseTable">'; 709 $TableColumns = array( 710 array('Name' => 'Name', 'Title' => T('Name')), 711 array('Name' => 'Translated', 'Title' => T('Translated count')), 712 array('Name' => 'Total', 'Title' => T('English')), 713 array('Name' => 'Percent', 'Title' => T('Percent')), 714 ); 715 716 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 717 $Output .= $Order['Output']; 718 719 $Translated = 0; 720 $Total = 0; 721 if(count($UnionItems) > 0) 722 { 723 $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 724 while($Group = $ID->fetch_assoc()) 725 { 726 $Output .= '<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; 727 $Translated += $Group['Translated']; 728 $Total += $Group['Total']; 729 } 730 } 731 if($Total > 0) $Percent = $Translated / $Total * 100; 732 else $Percent = 100; 733 734 $Output .= '<tr><td><strong>'.T('Altogether').'</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, round($Percent, 2)).'</strong></td></tr>'; 735 $Output .= '</table>'; 736 } 737 return($Output); 738 } 739 740 function ExportView() 741 { 742 $Output = ''; 743 if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 744 { 745 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 746 if($DbResult->num_rows > 0) 747 { 748 $Export = $DbResult->fetch_assoc(); 749 750 $DbResult = $this->System->Database->query('SELECT * FROM `User` WHERE `ID`='.$Export['User']); 751 $UserLine = $DbResult->fetch_assoc(); 752 $Output .= '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>'; 753 $Output .= ShowTabs(array(T('General'), T('Translators'), 'Překlady', T('Languages'), T('Format'), T('Version'), T('Statistic'), T('Output'))); 754 $Output .= '<div id="content">'; 755 if($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral(); 756 else if($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators(); 757 else if($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups(); 758 else if($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages(); 759 else if($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat(); 760 else if($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion(); 761 else if($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat(); 762 else if($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput(); 763 else $Output .= $this->ExportViewGeneral(); 764 765 $Output .= '</div>'; 766 } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 767 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 768 return($Output); 769 } 770 771 function ExportClone() 772 { 773 if($this->System->User->Licence(LICENCE_USER)) 774 { 775 if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 776 { 777 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 778 $DbRow = $DbResult->fetch_row(); 779 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 780 { 781 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 782 if($DbResult->num_rows > 0) 783 { 784 $DbRow = $DbResult->fetch_assoc(); 785 unset($DbRow['Id']); 786 $DbRow['UsedCount'] = '0'; 787 $DbRow['User'] = $this->System->User->Id; 788 $DbRow['TimeCreate'] = 'NOW()'; 789 $DbRow['Title'] .= ' - '.T('clone'); 790 790 $DbRow['Featured'] = 0; 791 792 $ExportId = $this->System->Database->insert_id; 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 { 811 791 $this->System->Database->insert('Export', $DbRow); 792 $ExportId = $this->System->Database->insert_id; 793 $this->System->Database->query('INSERT INTO `ExportGroup` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `Group` FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId'].')'); 794 $this->System->Database->query('INSERT INTO `ExportGroupItem` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `GroupItem` FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId'].')'); 795 $this->System->Database->query('INSERT INTO `ExportLanguage` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `Language`, `Sequence` FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId'].')'); 796 $this->System->Database->query('INSERT INTO `ExportUser` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `User`, `Sequence` FROM `ExportUser` WHERE `Export`='.$_GET['ExportId'].')'); 797 $Output = ShowMessage(T('Clone export created.<br />Direct link to export').': <a href="?Action=View&ExportId='.$ExportId.'">zde</a>'); 798 $this->System->ModuleManager->Modules['Log']->WriteLog(T('Clone export created').' <a href="'.$this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT); 799 $_GET['Filter'] = 'my'; 800 $this->ExportList(); 801 } else $Output = ShowMessage('Zdrojový export nenalezen', MESSAGE_CRITICAL); 802 } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '. 803 $this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 804 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 805 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 806 return($Output); 807 } 808 809 function Show() 810 { 811 $this->Title = T('Export'); 812 812 if(array_key_exists('Action', $_GET)) 813 813 { … … 820 820 } else $Output = $this->ExportList(); 821 821 return($Output); 822 } 822 } 823 823 } -
trunk/Modules/Export/ProcessAoWoWExport.php
r805 r816 5 5 include_once('../../includes/global.php'); 6 6 //include_once('../../includes/dbc.php'); 7 include_once('Export.php'); 8 include_once('Page.php'); 7 include_once('Export.php'); 8 include_once('Page.php'); 9 9 10 10 $System = new System(); 11 11 $System->DoNotShowPage = true; 12 12 $System->Run(); 13 13 14 14 $Output = ''; 15 15 16 if(defined('STDIN') == false) 16 if(defined('STDIN') == false) 17 17 { 18 18 $Output = T('Access denied'); 19 19 exit($Output); 20 } 20 } 21 21 22 22 foreach($_SERVER['argv'] as $parameter) … … 36 36 $Export->Id = $Config['AoWoWExportId']; 37 37 } else $Export->Id = 37; 38 $Output .= $Export->Init(); 38 $Output .= $Export->Init(); 39 39 $SQL = $Export->ExportToAoWoWSQL(); 40 40 echo 'Hotovo … … 89 89 } 90 90 $Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead'); 91 foreach($Files as $File) 91 foreach($Files as $File) 92 92 { 93 93 $End = substr($File, strlen($File) - 3); -
trunk/Modules/Export/ProcessTask.php
r811 r816 12 12 $System = new System(); 13 13 $System->DoNotShowPage = true; 14 14 $System->Run(); 15 15 16 16 function SetProgress($Export,$per) { -
trunk/Modules/Export/Progress.php
r743 r816 2 2 3 3 include_once(dirname(__FILE__).'/../../includes/global.php'); 4 4 5 5 $System = new System(); 6 6 $System->DoNotShowPage = true; 7 7 $System->Run(); 8 8 9 9 10 10 $Output = ''; … … 12 12 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE (`Export`.`OutputType` = 9 OR `Export`.`OutputType` = 10 ) AND `TimeFinish` IS NULL OR `Export` ='.$_GET['RedirectId'].' ORDER BY `Progress` DESC');// `Export`='.$Export->Id 13 13 while($Task = $DbResult->fetch_assoc()) { 14 $Export = '<a href="'.$System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; 14 $Export = '<a href="'.$System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; 15 15 if ($_GET['RedirectId'] == $Task['Export']) 16 16 $Export = ''.$Export.' (tento)'; … … 19 19 'setTimeout("parent.location.href=\''.$System->Link('/export/?Action=View&Tab=7&ExportId='.$_GET['RedirectId']).'\'", 500)'. 20 20 '</script>'; 21 } 21 } 22 22 23 23 echo $Output; -
trunk/Modules/Export/cmdmpqexport.php
r805 r816 5 5 include_once(dirname(__FILE__).'/../../includes/global.php'); 6 6 //include_once('../../includes/dbc.php'); 7 include_once('Export.php'); 8 include_once('Page.php'); 7 include_once('Export.php'); 8 include_once('Page.php'); 9 9 10 10 $System = new System(); 11 11 $System->DoNotShowPage = true; 12 12 $System->Run(); 13 13 $PageExport = new PageExport($System); 14 14 … … 17 17 $Output = ''; 18 18 19 if(defined('STDIN') == false) 19 if(defined('STDIN') == false) 20 20 { 21 21 $Output = T('Access denied'); 22 22 exit($Output); 23 } 23 } 24 24 25 25 foreach($_SERVER['argv'] as $parameter) … … 37 37 $Output .= 'Usage ExportId=id_export - for write export info<br />'; 38 38 $Output .= 'Usage needgeneration=id_export - for write export info<br />'; 39 39 40 40 $Output .= 'type_export={lua,dbc,addon} <br />'; 41 41 $Output = str_replace('<br />',' … … 46 46 $Export = new Export($System); 47 47 $Export->Id = $_GET['lua']; 48 $Output .= $Export->Init(); 48 $Output .= $Export->Init(); 49 49 $Output .= $Export->ExportToLua(); 50 50 $Output = str_replace('<br/>',' … … 56 56 $Export = new Export($System); 57 57 $Export->Id = $_GET['version']; 58 $Export->LoadFilters(); 58 $Export->LoadFilters(); 59 59 $Output .= $Export->ClientVersion['Version']; 60 60 $Output = str_replace('<br/>',' … … 66 66 $Export = new Export($System); 67 67 $Export->Id = $_GET['dbc']; 68 $Output .= $Export->Init(); 68 $Output .= $Export->Init(); 69 69 $Output .= $Export->ExportToDbc(); 70 70 $Output = str_replace('<br/>',' … … 85 85 86 86 if(array_key_exists('needgeneration', $_GET)) { 87 87 $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` as Version, `Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,`Export`.`Description` FROM `Export` JOIN `ClientVersion` as `ClientVersion` ON `ClientVersion`.`Id`=`Export`.`ClientVersion` WHERE `Featured`=1 ORDER BY `ClientVersion`.`BuildNumber` DESC'); 88 88 while ($DbExport = $DbRows->fetch_assoc()) { 89 89 $Export = new Export($System); 90 90 $Export->Id = $DbExport['Id']; 91 $Output .= $Export->Init(); 91 $Output .= $Export->Init(); 92 92 if ($Export->NeedGeneration()) { 93 93 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$Export->Id); … … 95 95 { 96 96 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())'); 97 } else 97 } else 98 98 $System->Database->query('UPDATE ExportTask SET `TimeStart` = NOW(), `Progress` = 0, `TimeFinish` = NULL WHERE Export = '.$Export->Id); 99 99 … … 113 113 $Export = new Export($System); 114 114 $Export->Id = $_GET['ExportId']; 115 $Export->LoadFilters(); 116 115 $Export->LoadFilters(); 116 117 117 //generation readme 118 118 $Output .= '<?xml version="1.0" encoding="utf-8"?\>'. … … 129 129 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 130 130 '<title>Čeština pro WoW</title>'. 131 '</head><body>'. 131 '</head><body>'. 132 132 '<h1>České WoW - čestina pro klienta hry World of Warcraft</h1>'. 133 133 134 134 '<table cellspacing="10"><tr><td valign="top">'. 135 135 136 136 '<p>Texty přebírány z projektu <a href="http://wowpreklad.zdechov.net/">wowpreklad.zdechov.net</a><br>'. 137 137 '<a href="http://wowpreklad.zdechov.net/export/?Action=View&ExportId='.$_GET['ExportId'].'&Tab=0">Export '.$_GET['ExportId'].'</a></p><br>'. 138 139 138 139 140 140 '<p><strong>Vlastnosti</strong>'. 141 141 '<ul>'. … … 148 148 '</p>'. 149 149 '<br>'. 150 150 151 151 '<h2>Nejčastější otázky</h2>'. 152 152 '<p><strong>Jak mám hru spustit?</strong><br>'. … … 155 155 '<p><strong>Mohu použít tuto češtinu na oficiálních serverech?</strong><br>'. 156 156 'Ne úplně, protože se vystavujete riziku zablokování vašeho účtu z důvodu použití upravené hry. Na oficiálním serveru lze využít pouze Addon s češtinou CzWoW.</p>'. 157 157 158 158 '<p><strong>Mám nainstalovánu češtinu a nejde mi spustit Wow.exe.</strong><br>'. 159 159 'Pokud chcete opět spouštět hru přes původní Wow.exe v angličtině, musíte češtinu nejprve odinstalovat ze systému. Především se jedná o soubor Data/enGB/patch-enGB-5.MPQ či Data/enUS/patch-enUS-5.MPQ, který je nutno smazat.</p>'. 160 160 161 161 '<p><strong>Nedaří se mi provést aktualizaci klienta s nainstalovanou češtinou.</strong><br>'. 162 162 'Před aktualizací na novější verzi klienta musíte nejprve češtinu odinstalovat. Čeština totiž mění v rámci patch MPQ souboru některé soubory hry, což oficiální instalátory vyhodnotí jako poškození hry.</p>'. 163 163 164 164 '</td><td>'; 165 165 … … 167 167 168 168 $Output .= '</td></tr></table>'. 169 170 169 170 171 171 '</body></html>'; 172 172 173 173 } 174 174 //$_GET['ExportId'] -
trunk/Modules/Forum/Forum.php
r805 r816 3 3 class ModuleForum extends AppModule 4 4 { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 'Title' => T('Forum'), 'Channel' => 'forum', 'Callback' => array('PageForum', 'ShowRSS'),21 'Permission' => LICENCE_ANONYMOUS));22 5 function __construct($System) 6 { 7 parent::__construct($System); 8 $this->Name = 'Forum'; 9 $this->Version = '1.0'; 10 $this->Creator = 'Maron'; 11 $this->License = 'GNU/GPL'; 12 $this->Description = ''; 13 $this->Dependencies = array(); 14 } 15 16 function Start() 17 { 18 $this->System->RegisterPage('forum', 'PageForum'); 19 $this->System->ModuleManager->Modules['News']->RegisterRSS(array( 20 'Title' => T('Forum'), 'Channel' => 'forum', 'Callback' => array('PageForum', 'ShowRSS'), 21 'Permission' => LICENCE_ANONYMOUS)); 22 23 23 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 24 24 $this->System->ModuleManager->Modules['Search']->RegisterSearch('forum', … … 27 27 $this->System->ModuleManager->Modules['Search']->RegisterSearch('forumthread', 28 28 T('Name of thread forum'), array('UserName', 'Text'), '`ForumThread`', $this->System->Link('/forum/?search=')); 29 29 30 30 $this->System->RegisterMenuItem(array( 31 31 'Title' => T('Forum'), … … 35 35 'Icon' => '', 36 36 ), 17); 37 37 } 38 38 } 39 39 40 40 class PageForum extends Page 41 41 { 42 43 44 $Output = ''; 45 46 47 42 function Show() 43 { 44 $Output = ''; 45 $this->Title = T('Forum'); 46 if(array_key_exists('a', $_POST)) $Action = $_POST['a']; 47 else if(array_key_exists('a', $_GET)) $Action = $_GET['a']; 48 48 else $Action = ''; 49 49 if (array_key_exists('Edit', $_GET)) { 50 if (array_key_exists('text', $_POST)) 51 $Output .= $this->Edit(); 50 if (array_key_exists('text', $_POST)) 51 $Output .= $this->Edit(); 52 52 $Output .= $this->ShowEditForm(); 53 53 54 54 } else 55 55 if (array_key_exists('search', $_GET)) … … 57 57 else 58 58 if (array_key_exists('Thread', $_GET)) { 59 60 61 62 59 $Output .= '<h3>'.T('Forum - Thread').'</h3>'; 60 if($Action == 'add2') $Output .= $this->AddFinish(); 61 if($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddForm(); 62 $Output .= $this->ShowList(); 63 63 } else { 64 65 66 64 $Output .= '<h3>'.T('Forum - List of Thread').'</h3>'; 65 if($Action == 'add2') $Output .= $this->AddFinish('ForumThread'); 66 if($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddFormThread(); 67 67 $Output .= $this->ShowListThread(); 68 68 } 69 70 71 72 function Edit() 73 { 74 $Output = ''; 75 76 77 78 79 69 return($Output); 70 } 71 72 function Edit() 73 { 74 $Output = ''; 75 76 $Text = $_POST['text']; 77 78 $DbResult = $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']); 79 80 80 $Output .= ShowMessage(T('Text edited.')); 81 81 82 82 83 83 return ($Output); 84 84 } 85 86 87 88 89 90 91 85 86 function ShowEditForm() 87 { 88 $Output = ''; 89 if($this->System->User->Licence(LICENCE_USER)) 90 { 91 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']); 92 92 if ( $DbResult->num_rows > 0) { 93 93 $DbRow = $DbResult->fetch_assoc(); 94 95 96 97 98 99 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'.100 101 102 103 104 }else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL);105 } 106 return($Output); 107 108 109 94 $Output .= '<form action="?Edit='.$_GET['Edit'].'" method="post">'. 95 '<fieldset><legend>'.T('Edit message').'</legend>'. 96 T('User').': '; 97 if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 98 else $Output .= '<input type="text" name="user" /><br />'; 99 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'. 100 '<textarea onkeydown="ResizeTextArea(this)" rows="8" name="text" cols="80">'.$DbRow['Text'].'</textarea> <br/>'. 101 '<input type="hidden" name="a" value="add2"/>'. 102 '<input type="submit" value="'.T('Send').'" /><br /></fieldset>'. 103 '</form>'; 104 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 105 } else $Output .= ShowMessage(T('You can edit only your own message.'), MESSAGE_CRITICAL); 106 return($Output); 107 } 108 109 function ShowSearchForum() 110 110 { 111 111 $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email'))); 112 113 114 115 112 $Count = 20; 113 $Output = ''; 114 115 $Output .= '<div class="shoutbox">'; 116 116 $where = '`ForumText`.`Text` LIKE "%'.($_GET['search'] ).'%" OR '. 117 117 ' `ForumThread`.`Text` LIKE "%'.($_GET['search'] ).'%" OR `ForumThread`.`UserName` LIKE "%'.($_GET['search'] ).'%" OR '. … … 119 119 $join = ' JOIN `ForumThread` ON `ForumThread`.`ID` = `ForumText`.`Thread`'; 120 120 121 122 123 $PageList = GetPageList($DbRow[0]); 124 125 126 127 121 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ForumText` '.$join.' WHERE '.$where); 122 $DbRow = $DbResult->fetch_row(); 123 $PageList = GetPageList($DbRow[0]); 124 125 $Output .= $PageList['Output']; 126 127 $DbResult = $this->System->Database->query('SELECT `ForumText`.`Text`, `ForumText`.`Date`, `ForumText`.`UserName`,'. 128 128 '`ForumThread`.`Text` as `ThreadName`,`ForumText`.`Thread` FROM `ForumText` '.$join.' WHERE '.$where.' ORDER BY `ForumText`.`Date` DESC '.$PageList['SQLLimit']); 129 130 131 132 133 } 134 135 136 137 138 139 140 141 $PageList = GetPageList($DbRow[0]); 142 143 144 145 146 147 148 149 150 151 152 153 154 155 129 while($Line = $DbResult->fetch_assoc()) 130 $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'.$Line['ThreadName'].'</a><br /><strong>'.$Line['UserName'].'</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse($Line['Text']).'</div> '; 131 $Output .= '</div>'.$PageList['Output']; 132 return($Output); 133 } 134 135 function ShowListThread() 136 { 137 $Output = ''; 138 139 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ForumThread` WHERE 1'); 140 $DbRow = $DbResult->fetch_row(); 141 $PageList = GetPageList($DbRow[0]); 142 143 $Output .= $PageList['Output']; 144 $Output .= '<div class="shoutbox">'; 145 $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE 1 ORDER BY `ID` DESC '.$PageList['SQLLimit']); 146 while($Line = $DbResult->fetch_assoc()) 147 $Output .= '<div><span style="float:right;"><strong>'.$Line['UserName'].'</strong> - ('.HumanDate($Line['Date']).')</span> <a href="?Thread='.$Line['ID'].'">'.str_replace("\n", '',$Line['Text']).'</a> </div>'; 148 $Output .= '</div>'.$PageList['Output']; 149 return($Output); 150 } 151 152 function ShowList() 153 { 154 $Output = ''; 155 156 156 $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email'))); 157 // echo $parser->qparse('[youtube]http://www.youtube.com/watch?v=hwgO6p2Jh-A[/youtube][img]http://www.bbcode.org/images/lubeck_small.jpg[/img]normal [i][b]bold[/b][/i] [img]http://imageshack.com/a/img203/7462/6ctg.jpg[/img] and normal again'); 158 159 160 161 162 163 164 165 166 } else $SearchQuery = ''; 167 168 169 170 171 157 // echo $parser->qparse('[youtube]http://www.youtube.com/watch?v=hwgO6p2Jh-A[/youtube][img]http://www.bbcode.org/images/lubeck_small.jpg[/img]normal [i][b]bold[/b][/i] [img]http://imageshack.com/a/img203/7462/6ctg.jpg[/img] and normal again'); 158 159 if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 160 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 161 if(array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 162 if($_SESSION['search'] != '') 163 { 164 $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")'; 165 $Output .= '<div><a href="?search=">'.sprintf(T('Disable filter "%s"'), $_SESSION['search']).'</a></div>'; 166 } else $SearchQuery = ''; 167 168 $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE ID='.($_GET['Thread']*1).' LIMIT 1'); 169 if($DbResult->num_rows > 0) 170 { 171 $Thread = $DbResult->fetch_assoc(); 172 172 $Output .= '<h3>'.$Thread['Text'].'</h3>'; 173 173 174 175 176 $PageList = GetPageList($DbRow[0]); 177 178 179 180 181 182 183 174 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ForumText` WHERE `Thread` = '.($_GET['Thread']*1).' '.$SearchQuery); 175 $DbRow = $DbResult->fetch_row(); 176 $PageList = GetPageList($DbRow[0]); 177 178 $Output .= $PageList['Output']; 179 $Output .= '<div class="shoutbox">'; 180 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '. 181 ($_GET['Thread']*1).' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']); 182 while($Line = $DbResult->fetch_assoc()) { 183 if ($this->System->User->Id == $Line['User']) 184 184 $edit = '<a href="?Edit='.$Line['ID'].'">editovat</a>'; 185 185 else $edit = ''; … … 187 187 ')</span><strong>'.$Line['UserName'].'</strong>: '.str_replace("\n", '<br />',$parser->qparse($Line['Text'])).' </div> '; 188 188 } 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'.205 206 207 208 209 }else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL);210 return($Output); 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 }else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL);229 return($Output); 230 231 232 233 234 235 236 237 238 239 240 241 242 243 189 $Output .= '</div>'.$PageList['Output']; 190 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 191 return($Output); 192 } 193 194 function ShowAddForm() 195 { 196 $Output = ''; 197 if($this->System->User->Licence(LICENCE_USER)) 198 { 199 $Output .= '<form action="?Thread='.$_GET['Thread'].'" method="post">'. 200 '<fieldset><legend>'.T('New Forum Message').'</legend>'. 201 'Uživatel: '; 202 if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 203 else $Output .= '<input type="text" name="user" /><br />'; 204 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'. 205 '<textarea onkeydown="ResizeTextArea(this)" name="text" cols="80"></textarea> <br/>'. 206 '<input type="hidden" name="a" value="add2"/>'. 207 '<input type="submit" value="'.T('Send').'" /><br /></fieldset>'. 208 '</form>'; 209 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 210 return($Output); 211 } 212 213 function ShowAddFormThread() 214 { 215 $Output = ''; 216 if($this->System->User->Licence(LICENCE_USER)) 217 { 218 $Output .= '<form action="?" method="post">'. 219 '<fieldset><legend>'.T('New thread').'</legend>'. 220 'Uživatel: '; 221 if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 222 else $Output .= '<input type="text" name="user" /><br />'; 223 $Output .= T('Name of thread').': <br />'. 224 '<textarea onkeydown="ResizeTextArea(this)" name="text" rows="1" cols="30"></textarea> <br/>'. 225 '<input type="hidden" name="a" value="add2"/>'. 226 '<input type="submit" value="'.T('Send').'" /><br /></fieldset>'. 227 '</form>'; 228 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 229 return($Output); 230 } 231 232 function AddFinish($Table = 'ForumText') 233 { 234 $Output = ''; 235 if($this->System->User->Licence(LICENCE_USER)) 236 { 237 if(array_key_exists('text', $_POST)) 238 { 239 $Text = $_POST['text']; 240 if(trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING); 241 else 242 { 243 // Protection against mutiple post of same message 244 244 $Thread = ''; 245 if ($Table == 'ForumText') $Thread = 'AND `Thread` = '.$_GET['Thread']; 246 $DbResult = $this->System->Database->query('SELECT `Text` FROM `'.$Table.'` WHERE 1 '.$Thread.' AND (`User` = "'. 247 248 249 250 251 252 253 254 255 256 257 258 259 260 245 if ($Table == 'ForumText') $Thread = 'AND `Thread` = '.$_GET['Thread']; 246 $DbResult = $this->System->Database->query('SELECT `Text` FROM `'.$Table.'` WHERE 1 '.$Thread.' AND (`User` = "'. 247 $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 248 if($DbResult->num_rows > 0) 249 { 250 $DbRow = $DbResult->fetch_assoc(); 251 } else $DbRow['Text'] = ''; 252 253 if($DbRow['Text'] == $Text) $Output .= ShowMessage(T('You can\' add same message twice.'), MESSAGE_WARNING); 254 else 255 { 256 if ($Table == 'ForumText') { 257 258 $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE ID='.($_GET['Thread']*1).' LIMIT 1'); 259 if($DbResult->num_rows > 0) 260 { 261 261 $this->System->Database->query('INSERT INTO `'.$Table.'` ( `User`, `UserName` , `Text` , `Date` , `IP` , `Thread` ) '. 262 263 262 ' VALUES ('.$this->System->User->Id.', "'.$this->System->User->Name. 263 '", "'.$Text.'", NOW(), "'.GetRemoteAddress().'","'.$_GET['Thread'].'")'); 264 264 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 265 265 } else 266 266 $this->System->Database->query('INSERT INTO `'.$Table.'` ( `User`, `UserName` , `Text` , `Date` , `IP`) '. 267 268 269 270 271 272 } else $Output .= ShowMessage(T('You have to specified new message.'), MESSAGE_CRITICAL); 273 274 275 276 } 277 278 279 267 ' VALUES ('.$this->System->User->Id.', "'.$this->System->User->Name. 268 '", "'.$Text.'", NOW(), "'.GetRemoteAddress().'")'); 269 $Output .= ShowMessage(T('Added.')); 270 } 271 } 272 } else $Output .= ShowMessage(T('You have to specified new message.'), MESSAGE_CRITICAL); 273 $Output .= '<br/>'; 274 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 275 return($Output); 276 } 277 278 function ShowRSS() 279 { 280 280 $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email'))); 281 281 282 282 $Items = array(); 283 284 285 283 $TitleLength = 50; 284 mb_internal_encoding('utf-8'); 285 $DbResult = $this->Database->query('SELECT `Thread`, `ID`, UNIX_TIMESTAMP(`Date`) AS `UnixDate`, '. 286 286 '`User`, `UserName`, `Text`, ( SELECT `Text` FROM `ForumThread` '. 287 287 'WHERE `ID` = `ForumText`.`Thread`) AS `ThreadText` FROM `ForumText` ORDER BY `ID` DESC LIMIT 20'); 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 288 while($DbRow = $DbResult->fetch_assoc()) 289 { 290 $Title = mb_substr($DbRow['Text'], 0, $TitleLength); 291 if(mb_strlen($Title) == $TitleLength) $Title .= '...'; 292 $Items[] = array 293 ( 294 'Title' => $DbRow['ThreadText'].' - '.$DbRow['UserName'].': ', 295 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/forum/?Thread='.$DbRow['Thread']), 296 'Description' => $parser->qparse($DbRow['Text']), 297 'Time' => $DbRow['UnixDate'], 298 ); 299 } 300 $Output = GenerateRSS(array 301 ( 302 'Title' => $this->System->Config['Web']['Title'].' - '.T('Forum'), 303 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/forum/'), 304 'Description' => $this->System->Config['Web']['Description'], 305 305 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'], 306 306 'Items' => $Items, 307 307 )); 308 308 return($Output); 309 309 } 310 310 } -
trunk/Modules/FrontPage/FrontPage.php
r809 r816 28 28 function HandleLoginForm() 29 29 { 30 30 global $Message, $MessageType; 31 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 32 if(array_key_exists('action', $_GET)) 33 { 34 if($_GET['action'] == 'login') 35 { 36 if(array_key_exists('LoginUser', $_POST) and array_key_exists('LoginPass', $_POST)) 37 { 38 if(array_key_exists('StayLogged', $_POST)) $StayLogged = true; 39 else $StayLogged = false; 40 $this->System->User->Login($_POST['LoginUser'], $_POST['LoginPass'], $StayLogged); 41 if($this->System->User->Role == LICENCE_ANONYMOUS) 42 { 43 $Message = T('Incorrect name or password'); 44 $MessageType = MESSAGE_CRITICAL; 45 } else 46 { 47 $Message = sprintf(T('Login successful. Welcome <strong>%s</strong>!'), $this->System->User->Name); 48 $MessageType = MESSAGE_INFORMATION; 49 } 50 } else 51 { 52 $Message = T('User name or password was not entered'); 53 $MessageType = MESSAGE_CRITICAL; 54 } 55 } else 56 if($_GET['action'] == 'logout') 57 { 58 if($this->System->User->Role != LICENCE_ANONYMOUS) 59 { 60 $this->System->ModuleManager->Modules['Log']->WriteLog('Odhlášení', LOG_TYPE_USER); 61 $this->System->User->Logout(); 62 $Message = T('You were logged out'); 63 $MessageType = MESSAGE_INFORMATION; 64 } 65 } 66 } 67 67 } 68 68 } … … 72 72 function Show() 73 73 { 74 74 global $Message, $MessageType; 75 75 76 77 78 79 76 $this->Title = T('Home'); 77 $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm(); 78 $Output = ''; 79 if(isset($Message)) $Output .= ShowMessage($Message, $MessageType); 80 80 81 82 83 81 $Output .= '<br />'. 82 '<table class="Home"><tr><td colspan="3">'.$this->ShowWelcome(). 83 '</td></tr>'; 84 84 $Output .= '<tr><td colspan="3"><h3><a href="'.$this->System->Link('/download/').'">'.T('Download Czech File').'</a></h3></td></tr>'; 85 85 86 87 88 89 90 86 $Output .= '<tr><td class="SideBox">'.$this->ShowLastTranslated().'</td>'. 87 '<td class="news-box">'.$this->System->ModuleManager->Modules['News']->ShowBox().'</td>'. 88 '<td class="SideBox">'.$this->System->ModuleManager->Modules['ShoutBox']->ShowBox().'</td>'. 89 '</tr></table>'; 90 return($Output); 91 91 } 92 92 93 93 function ShowLastTranslated() 94 94 { 95 96 95 $Count = 40; 96 $Output = '<strong>'.T('Last translated').':</strong>'; 97 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 98 $GroupListQuery = 'SELECT `Group`.* FROM `Group`'; 99 $Query = ''; 100 $UnionItems = array(); 101 $DbResult = $this->Database->query($GroupListQuery); 102 if($DbResult->num_rows > 0) 103 { 104 while($DbRow = $DbResult->fetch_assoc()) 105 { 106 $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '. 107 'FROM (SELECT `T`.`User`, `T`.`ID`, `T`.`ModifyTime`, '. 108 $DbRow['Id'].' AS `Group`, "'.addslashes($DbRow['Name']).'" AS `GroupName`, `T`.`Take` FROM `'. 109 $DbRow['TablePrefix'].'` AS `T`'. 110 ' WHERE (`T`.`Complete` = 1) AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].') ORDER BY `T`.`ModifyTime` DESC LIMIT '. 111 $Count.') AS `T`'; 112 } 113 $Query = 'SELECT `TT`.*, `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId` '. 114 ' FROM ('.implode(' UNION ', $UnionItems).') AS `TT`'. 115 ' JOIN `User` ON `User`.`Id` = `TT`.`User`'. 116 ' ORDER BY `ModifyTime` DESC LIMIT '.$Count; 117 $DbResult = $this->Database->query($Query); 118 $Output .= '<table class="MiniTable"><tr><th>'.T('Date').'</th><th>'.T('Who').'</th><th>'.T('New').'</th><th>'.T('Source').'</th><th>'.T('Group').'</th></tr>'; 119 while($DbRow = $DbResult->fetch_assoc()) 120 { 121 $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'. 122 '<td><a href="user.php?user='.$DbRow['UserId'].'">'.$DbRow['UserName'].'</a></td>'. 123 '<td><a href="form.php?group='.$DbRow['Group'].'&ID='.$DbRow['ID'].'">'.$DbRow['ID'].'</a></td>'. 124 '<td><a href="form.php?group='.$DbRow['Group'].'&ID='.$DbRow['Take'].'">'.$DbRow['Take'].'</a></td>'. 125 '<td><a href="TranslationList.php?group='.$DbRow['Group'].'&action=filter">'.$DbRow['GroupName'].'</a></td></tr>'; 126 } 127 $Output .= '</table>'; 128 } 129 return($Output); 130 130 } 131 131 132 132 function ShowWelcome() 133 133 { 134 135 136 137 138 134 // Cookies have to be used before any text is sent to output 135 if(!array_key_exists('HideWelcome', $_COOKIE)) $_COOKIE['HideWelcome'] = 0; 136 if(isset($_GET['Action'])) 137 { 138 if($_GET['Action'] == 'HideWelcome') 139 139 { 140 140 $_COOKIE['HideWelcome'] = 1; 141 141 setcookie('HideWelcome', $_COOKIE['HideWelcome'], time() + 3600 * 24 * 365); 142 142 } 143 143 if($_GET['Action'] == 'UnHideWelcome') 144 144 { 145 145 $_COOKIE['HideWelcome'] = 0; 146 146 setcookie('HideWelcome', $_COOKIE['HideWelcome'], time() + 3600 * 24 * 365); 147 148 147 } 148 } 149 149 150 151 152 153 154 155 156 157 158 150 if(isset($_COOKIE['HideWelcome']) and ($_COOKIE['HideWelcome'] == 1)) 151 { 152 $Action = '<a href="?Action=UnHideWelcome">'.T('Show welcome').'</a>'; 153 $HideWelcome = 'display: none'; 154 } else 155 { 156 $Action = '<a href="?Action=HideWelcome">'.T('Hide welcome').'</a>'; 157 $HideWelcome = ''; 158 } 159 159 160 161 162 163 164 165 166 167 168 169 160 // Echo text even if it is hidden because of caching by external searching engines 161 return('<div style="'.$HideWelcome.'">'. 162 '<div id="bannertitle">'.$this->System->Config['Web']['Title'].'</div>'. 163 'Otevřený webový systém pro překládání textů ze hry World of Warcraft (WoW).<br />'. 164 '<ul>'. 165 '<li>Projekt je provozován jako otevřený vyznává principy volnosti a otevřenosti. Proto jsou texty volně ke stažení.</li>'. 166 '<li>Projekt slouží k týmovému překladu. Kdokoliv může přispět přeložením textů a uveřejněním odkazu popř. banneru na svých stránkách.</li>'. 167 '<li>Projekt není zaměřen pouze na jeden server a umožňuje společné překládání lidem z různých serverů. Překladatelé mohou překládat v týmech podle jména svého serveru a exportovat texty pouze od vybraných překladatelů.</li>'. 168 '<li>Přeložené texty lze volně stahovat v různých tvarech jako XML, SQL, Addon a Lua. Přeložené texty lze tedy snadno importovat do svého free serveru nebo použít v jiných projektech.</li>'. 169 '<li>Cílem projektu je přeložit všechny texty ze hry. Nikoliv pouze texty výprav (questů).</li>'. 170 170 '<li>Díky propracovanému systému volitelných exportů si můžete stáhnout libovolnou část překladu, klidně pouze výpravy. A vynechat tak překlady předmětů, jména postav a jiných.</li>'. 171 172 171 '<li>Texty lze překládat do dvou jazyků, češtiny a slovenštiny.</li>'. 172 '</ul></div>'.$Action); 173 173 } 174 174 } -
trunk/Modules/Import/Import.php
r756 r816 7 7 class ModuleImport extends AppModule 8 8 { 9 10 11 12 13 14 15 16 17 $this->Dependencies = array(); 18 19 20 21 22 $this->System->RegisterPage('import', 'PageImport'); 23 9 function __construct($System) 10 { 11 parent::__construct($System); 12 $this->Name = 'Import'; 13 $this->Version = '1.0'; 14 $this->Creator = 'Chronos'; 15 $this->License = 'GNU/GPL'; 16 $this->Description = 'Support for import of data.'; 17 $this->Dependencies = array(); 18 } 19 20 function Start() 21 { 22 $this->System->RegisterPage('import', 'PageImport'); 23 } 24 24 } 25 25 26 26 class Import 27 27 { 28 var $Version; 28 var $Version; 29 29 var $Group; 30 30 var $NewItemCount; 31 31 var $System; 32 32 33 33 function __construct($System) 34 34 { 35 35 $this->System = &$System; 36 36 } 37 37 38 38 function SetVersion($Version) 39 39 { 40 40 global $System; 41 41 42 42 $DbResult = $System->Database->query('SELECT * FROM `ClientVersion` WHERE `Version` = "'.$Version.'"'); 43 $this->Version = $DbResult->fetch_assoc(); 44 } 45 43 $this->Version = $DbResult->fetch_assoc(); 44 } 45 46 46 function InsertItem($Value) 47 { 47 { 48 48 $insert = true; 49 49 $Columns = ''; … … 58 58 $Where = ' (`'.$this->Group['PrimaryKeyItem'].'` = "'.$Value[$this->Group['PrimaryKeyItem']].'") AND (`Language`=0) ' ; 59 59 //print_r($Value); 60 61 $DbResultMiddle = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` <= '.$this->Version['BuildNumber'].' AND `VersionEnd` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1'); 60 61 $DbResultMiddle = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` <= '.$this->Version['BuildNumber'].' AND `VersionEnd` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1'); 62 62 $DbResultBefore = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionEnd` <= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1'); 63 63 $DbResultAfter = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionStart` LIMIT 1'); … … 69 69 $DbRowAfter = $DbResultAfter->fetch_assoc(); 70 70 $DbRowBefore = $DbResultBefore->fetch_assoc(); 71 72 if($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) ) 71 72 if($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) ) 73 73 { 74 74 $insert = false; 75 75 if ($this->Group['Id'] == 1) { 76 76 $set = ' , EndText = "'.$Value['EndText'].'" , ObjectiveText1 = "'.$Value['ObjectiveText1'].'"'.' , ObjectiveText2 = "'.$Value['ObjectiveText2'].'"'.' , ObjectiveText3 = "'.$Value['ObjectiveText3'].'"'.' , ObjectiveText4 = "'.$Value['ObjectiveText4'].'"'; 77 } else $set = ''; 77 } else $set = ''; 78 78 $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionEnd` = "'.$this->Version['BuildNumber'].'" '.$set.' WHERE `ID`='.$DbRowBefore['ID']); 79 echo('b '); 80 81 } else 82 if($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0)) 79 echo('b '); 80 81 } else 82 if($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0)) 83 83 { 84 84 $insert = false; 85 85 if ($this->Group['Id'] == 1) { 86 86 $set = ' , EndText = "'.$Value['EndText'].'" , ObjectiveText1 = "'.$Value['ObjectiveText1'].'"'.' , ObjectiveText2 = "'.$Value['ObjectiveText2'].'"'.' , ObjectiveText3 = "'.$Value['ObjectiveText3'].'"'.' , ObjectiveText4 = "'.$Value['ObjectiveText4'].'"'; 87 } else $set = ''; 87 } else $set = ''; 88 88 $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionStart` = "'.$this->Version['BuildNumber'].'" '.$set.' WHERE `ID`='.$DbRowAfter['ID']); 89 echo('a '); 90 91 } else 92 { 93 94 if (isset($DbRowAfter['VersionStart'])) { 89 echo('a '); 90 91 } else 92 { 93 94 if (isset($DbRowAfter['VersionStart'])) { 95 95 if ($DbRowAfter['VersionStart'] <= $this->Version['BuildNumber']) { 96 96 echo('Allready imported '.$DbRowBefore['Entry'].' '); … … 103 103 $inserted = false; 104 104 } 105 } 106 105 } 106 107 107 //if [DEPRECATED] do not import 108 foreach($this->Group['Items'] as $GroupItem) { 108 foreach($this->Group['Items'] as $GroupItem) { 109 109 if (false !== strpos($Value[$GroupItem['Column']],'[DEPRECATED')) { 110 110 echo('d '.$DbRowBefore['Entry'].' '); 111 111 $insert = false; 112 } 113 } 112 } 113 } 114 114 115 115 if ($insert) { 116 116 $insert = false; 117 117 foreach($this->Group['Items'] as $GroupItem) 118 { 118 { 119 119 if ($Value[$GroupItem['Column']] <> '') $insert = true; 120 120 } 121 121 } 122 122 123 123 if (isset($DbRowMiddle['Entry'])) $insert = false; 124 124 if (isset($DbRowAfter['Entry'])) $Value['Entry'] = $DbRowAfter['Entry']; 125 125 if (isset($DbRowBefore['Entry'])) $Value['Entry'] = $DbRowBefore['Entry']; 126 126 127 if ($insert) 128 { 129 127 if ($insert) 128 { 129 130 130 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 131 131 $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber']; 132 foreach($this->Group['Items'] as $GroupItem) 133 { 132 foreach($this->Group['Items'] as $GroupItem) 133 { 134 134 $Columns .= ', `'.$GroupItem['Column'].'`'; 135 135 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; 136 136 } 137 137 $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'); 138 138 139 139 echo ' 140 '.$Value['Entry'].' = '.$DbRowBefore['VersionStart'].'.'.$DbRowBefore['VersionEnd'].'< '.$this->Version['BuildNumber'].' <'.$DbRowAfter['VersionStart'].'.'.$DbRowAfter['VersionEnd'].'... '.$DbRowMiddle['VersionStart'].' '.$DbRowMiddle['VersionEnd'].' 140 '.$Value['Entry'].' = '.$DbRowBefore['VersionStart'].'.'.$DbRowBefore['VersionEnd'].'< '.$this->Version['BuildNumber'].' <'.$DbRowAfter['VersionStart'].'.'.$DbRowAfter['VersionEnd'].'... '.$DbRowMiddle['VersionStart'].' '.$DbRowMiddle['VersionEnd'].' 141 141 '; 142 143 if (false !== strpos($Values,'[DEPRECATED')) 142 143 if (false !== strpos($Values,'[DEPRECATED')) 144 144 echo $Values; 145 145 146 146 echo('# '); 147 147 $InsertId = $this->System->Database->insert_id; 148 148 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&ID='.$InsertId.'">'.$InsertId.'</a> ('.$Value['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' změněn.', LOG_TYPE_IMPORT); 149 149 } 150 } 151 } else 150 } 151 } else 152 152 { 153 153 // Insert new text … … 162 162 $DbRow = $DbResult->fetch_row(); 163 163 $Value['Entry'] += $DbRow[0]; 164 } 164 } 165 165 } 166 166 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; … … 168 168 $insert = false; 169 169 foreach($this->Group['Items'] as $GroupItem) 170 { 170 { 171 171 $Columns .= ', `'.$GroupItem['Column'].'`'; 172 172 $Values .= ', "'.$Value[$GroupItem['Column']].'"'; … … 182 182 } 183 183 } 184 184 185 185 function ImportLUA() 186 186 { 187 187 global $TranslationTree, $PatchVersion; 188 188 $Output = 'Načítání textů z LUA souboru...'; 189 189 190 190 if(($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != '')) 191 191 { 192 192 193 $Output .= '<br />'.$this->Group['Name'].'<br />'; 193 $Output .= '<br />'.$this->Group['Name'].'<br />'; 194 194 // if($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1) 195 195 { 196 196 $File = new FileStream(); 197 197 198 198 $File->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/lua/'.$this->Group['LuaFileName'].'.lua'); 199 199 $this->NewItemCount = 0; … … 215 215 $Value['Text'] = str_replace('\n', "\n", $Value['Text']); 216 216 $Value['Text'] = addslashes(stripslashes($Value['Text'])); 217 $Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon 218 } else 217 $Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon 218 } else 219 219 { 220 220 // Nonstring value … … 224 224 $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --" 225 225 //print_r($Value); 226 226 227 227 $this->InsertItem($Value); 228 }; 228 }; 229 229 $Count++; 230 230 } … … 237 237 return ($Output); 238 238 } 239 239 240 240 function UpdateTranslated() 241 241 { 242 242 global $TranslationTree, $PatchVersion, $Config; 243 243 244 244 $Output = '<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />'; 245 foreach($TranslationTree as $Group) 246 { 247 $Output .= '<br />'.$Group['Name'].' '; 248 $do = true; 249 while($do) 245 foreach($TranslationTree as $Group) 246 { 247 $Output .= '<br />'.$Group['Name'].' '; 248 $do = true; 249 while($do) 250 250 { 251 251 $DbResult = $this->System->Database->query('SELECT `gs_tran`.`ID`, '. 252 253 254 255 256 257 258 259 260 while($DbRow = $DbResult->fetch_assoc()) 261 { 252 '`gs_tran`.`VersionEnd` AS `VersionEnd_tran`, '. 253 '`gs_tran`.`VersionStart` AS `VersionStart_tran`, '. 254 '`gs_orig`.`VersionEnd` AS `VersionEnd_orig`, '. 255 '`gs_orig`.`VersionStart` AS `VersionStart_orig` FROM `'. 256 $Group['TablePrefix'].'` AS `gs_tran` JOIN `'.$Group['TablePrefix']. 257 '` AS `gs_orig` ON `gs_orig`.`ID` = `gs_tran`.`Take` WHERE '. 258 '`gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd` OR `gs_tran`.`VersionStart` <> `gs_orig`.`VersionStart`'); 259 $do = ($DbResult->num_rows > 0); 260 while($DbRow = $DbResult->fetch_assoc()) 261 { 262 262 echo '`'; 263 263 $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$DbRow['VersionEnd_orig'].', `VersionStart` = '.$DbRow['VersionStart_orig'].' WHERE `ID` = '.$DbRow['ID']); 264 $Output .= '. '; 265 } 266 } 264 $Output .= '. '; 265 } 266 } 267 267 $Output .= '<strong>Dokončeno.</strong>'; 268 268 } 269 269 return($Output); 270 270 } 271 271 272 272 function HaveSameText($Group, $DbRow2, $Value) 273 273 { 274 274 $result = true; 275 foreach($Group['Items'] as $GroupItem) 276 { 275 foreach($Group['Items'] as $GroupItem) 276 { 277 277 $old = $DbRow2[$GroupItem['Column']]; 278 278 $old = str_replace(chr(10), '', $old); … … 291 291 $old = strtolower($old); 292 292 $old = str_replace('$b', '', $old); 293 294 if ($this->Group['Id'] == 1) 293 294 if ($this->Group['Id'] == 1) 295 295 while ($part = substr($old, strpos($old, '<'), strpos($old, '>')-strpos($old, '<'))) 296 if ($part <> '') { 296 if ($part <> '') { 297 297 $old = str_replace($part.'>', '', $old); 298 298 } 299 299 300 300 if (($GroupItem['MangosColumn'] <> '') and ($Group['MangosDatabase'] == 'mangos')) 301 301 $new = $Value[$GroupItem['MangosColumn']]; 302 302 else $new = $Value[$GroupItem['Column']]; 303 303 304 304 $new = str_replace(chr(10), '', $new); 305 305 $new = str_replace(chr(13), '', $new); … … 318 318 $new = str_replace('$b', '', $new); 319 319 320 if ($this->Group['Id'] == 1) 320 if ($this->Group['Id'] == 1) 321 321 while ($part = substr($new, strpos($new, '<'), strpos($new, '>')-strpos($new, '<'))) 322 if ($part <> '') { 322 if ($part <> '') { 323 323 $new = str_replace($part.'>', '', $new); 324 324 } 325 325 326 326 if(($old == 'null') or ($old == 'NULL')) $old = ''; 327 327 if(($new == 'null') or ($new == 'NULL')) $new = ''; 328 329 if(($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment')) 328 329 if(($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment')) 330 330 { 331 331 // echo $old.'X'.$new; 332 if ( ($GroupItem['Column'] <> 'EndText') 333 and ($GroupItem['Column'] <> 'ObjectiveText1') 334 and ($GroupItem['Column'] <> 'ObjectiveText2') 335 and ($GroupItem['Column'] <> 'ObjectiveText3') 336 and ($GroupItem['Column'] <> 'ObjectiveText4') ) 332 if ( ($GroupItem['Column'] <> 'EndText') 333 and ($GroupItem['Column'] <> 'ObjectiveText1') 334 and ($GroupItem['Column'] <> 'ObjectiveText2') 335 and ($GroupItem['Column'] <> 'ObjectiveText3') 336 and ($GroupItem['Column'] <> 'ObjectiveText4') ) 337 337 $result = false; 338 338 } 339 339 } 340 340 341 341 return($result); 342 342 } 343 343 344 344 function ImportDBC() 345 345 { 346 346 global $System, $TranslationTree, $Config; 347 347 348 348 $Output = 'Načítání textů z DBC souboru...'; 349 349 if(($this->Group['DBCFileName'] != '') and ($this->Group['TablePrefix'] != '')) 350 350 { 351 $Output .= '<br />'.$this->Group['Name'].'<br />'; 351 $Output .= '<br />'.$this->Group['Name'].'<br />'; 352 352 353 353 // Load string column index list 354 $DbResult = $System->Database->query('SELECT * FROM `GroupItem` JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->Version['Id'].' WHERE `GroupItem`.`Group` = '.$this->Group['Id']); 355 354 $DbResult = $System->Database->query('SELECT * FROM `GroupItem` JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->Version['Id'].' WHERE `GroupItem`.`Group` = '.$this->Group['Id']); 355 356 356 $ColumnIndexes = array(); 357 357 $ColumnFormat = array(); … … 361 361 $ColumnIndexes[$DbRow['GroupItem']] = $DbRow['ColumnIndex']; 362 362 } 363 363 364 364 $DBCFile = new DBCFile(); 365 365 $DBCFile->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', $ColumnFormat); 366 366 $ItemCount = $DBCFile->GetRecordCount(); 367 367 $this->NewItemCount = 0; 368 $Count = 0; 369 368 $Count = 0; 369 370 370 for($I = 0; $I < $ItemCount; $I++) 371 371 { … … 373 373 if(array_key_exists($GroupItem['Id'], $ColumnIndexes)) 374 374 { 375 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']])); 376 } 377 375 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']])); 376 } 377 378 378 // Get multicolumn value 379 379 $Columns = explode(',', $this->Group['DBCIndex']); … … 381 381 foreach($Columns as $Column) 382 382 $ColumnValue .= '_'.$DBCFile->GetUint($I, $Column); 383 $ColumnValue = substr($ColumnValue, 1); 384 $Value[$this->Group['PrimaryKeyItem']] = $ColumnValue; 383 $ColumnValue = substr($ColumnValue, 1); 384 $Value[$this->Group['PrimaryKeyItem']] = $ColumnValue; 385 385 $this->InsertItem($Value); 386 386 $Count++; 387 } 387 } 388 388 $Output .= '<br />Celkem: '.$Count.' Nových: '.$this->NewItemCount.'<br />'; 389 389 $this->UpdateLastVersion(); … … 396 396 { 397 397 global $TranslationTree; 398 398 399 399 $this->Group = $TranslationTree[$GroupId]; 400 400 401 401 if($this->Group['SourceType'] == 'dbc') $Output = $this->ImportDBC(); 402 402 else if($this->Group['SourceType'] == 'sql') $Output = $this->ImportSQL(); … … 406 406 return($Output); 407 407 } 408 408 409 409 function ImportSQL() 410 410 { 411 411 global $TranslationTree, $PatchVersion; 412 412 413 413 $Output= ''; 414 414 $File = new FileStream(); … … 422 422 $Line = $File->ReadLine(); 423 423 // Struktura 424 if(strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false) 424 if(strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false) 425 425 { 426 426 $Line = ''; … … 428 428 $i = 0; 429 429 } 430 if((strpos($Line, ';') !== false) and ($folow_structure == true)) 430 if((strpos($Line, ';') !== false) and ($folow_structure == true)) 431 431 { 432 432 $folow_structure = false; … … 443 443 $i++; 444 444 } 445 445 446 446 //data 447 447 if((strpos($Line, 'INSERT INTO `'.$this->Group['MangosTable'].'`') !== false) and (isset($structure))) 448 { 448 { 449 449 while ((strpos($Line, ');') === false) or ($File->EOF())) 450 450 $Line = $Line.$File->ReadLine(); 451 451 $Line = str_replace("),\n(", '),(', $Line); 452 452 453 453 $Line = substr($Line, strpos($Line, '(') + 1); 454 454 $Line = substr($Line, 0, strpos($Line, ');')); 455 455 $LineParts = explode('),(', $Line); 456 456 457 457 unset($Line); 458 458 459 459 $value_buff = ''; 460 460 $Value = ''; 461 461 foreach($LineParts as $LinePart) 462 462 { 463 463 464 464 unset($Value, $value_buff); 465 465 foreach($structure as $i => $column) … … 469 469 $value_buff = substr($LinePart, 0, strpos($LinePart, ',')); 470 470 $LinePart = substr($LinePart, strlen($value_buff) + 1); 471 } else 471 } else 472 472 { 473 473 $LinePart = substr($LinePart, 1); 474 474 $value_buff = substr($LinePart, 0, strpos($LinePart, "'")); 475 while(substr($value_buff, strlen($value_buff) - 1, 1) == "\\") 475 while(substr($value_buff, strlen($value_buff) - 1, 1) == "\\") 476 476 { 477 477 $str = substr($LinePart, strlen($value_buff)); … … 479 479 $value_buff = $value_buff.$str2; 480 480 $str = substr($str, strlen($str2)); 481 } 481 } 482 482 $LinePart = substr($LinePart, strlen($value_buff) + 2); 483 } 483 } 484 484 if(($value_buff != 'null') and ($value_buff != 'NULL')) 485 485 { 486 486 $str = ''; 487 while(substr($value_buff, strlen($value_buff) - 1,1) == " ") 487 while(substr($value_buff, strlen($value_buff) - 1,1) == " ") 488 488 { 489 489 $value_buff = substr($value_buff, 0, strlen($value_buff) - 1); … … 491 491 } 492 492 $str2 = ''; 493 while(substr($value_buff, 0, 1) == ' ') 493 while(substr($value_buff, 0, 1) == ' ') 494 494 { 495 495 $value_buff = substr($value_buff, 1, strlen($value_buff) - 1); … … 497 497 } 498 498 $Value[$column] = $str2.trim($value_buff).$str; 499 } else 500 { 499 } else 500 { 501 501 $Value[$column] = ''; 502 502 } … … 513 513 } 514 514 } 515 515 516 516 // Get multicolumn value 517 517 $Columns = explode(',', $this->Group['MangosTableIndex']); … … 519 519 foreach($Columns as $Column) 520 520 $ColumnValue .= '_'.$Value[$Column]; 521 $ColumnValue = substr($ColumnValue, 1); 521 $ColumnValue = substr($ColumnValue, 1); 522 522 $Value[$this->Group['PrimaryKeyItem']] = $ColumnValue; 523 523 $this->InsertItem($Value); 524 524 $Count++; 525 525 } 526 } 526 } 527 527 } 528 528 $Output = '<br />Celkem: '.$Count.' Nových: '.$this->NewItemCount.'<br />'; … … 530 530 return($Output); 531 531 } 532 532 533 533 function UpdateLastVersion() { 534 534 $DbResult = $this->System->Database->query('SELECT * FROM `Group` WHERE `Id`='.$this->Group['Id']); 535 $Version = $DbResult->fetch_assoc(); 535 $Version = $DbResult->fetch_assoc(); 536 536 if ($Version['LastVersion'] < $this->Version['BuildNumber']) 537 537 $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']); -
trunk/Modules/Import/Manage.php
r636 r816 26 26 { 27 27 global $System; 28 29 if(array_key_exists('id', $_GET)) 28 29 if(array_key_exists('id', $_GET)) 30 30 { 31 31 $Output = '<div style="font-size: xx-small;">'; 32 32 33 33 $GroupId = (int)$_GET['id']; 34 34 $Import = new Import($System); 35 35 $Import->SetVersion($System->Config['Web']['GameVersion']); 36 36 $Output .= $Import->ImportGroup($GroupId); 37 37 38 38 $this->System->ModuleManager->Modules['Log']->WriteLog('Plnění databáze', LOG_TYPE_MODERATOR); 39 39 $Output .= '</div>'; … … 45 45 { 46 46 global $TranslationTree, $System; 47 48 $Output = '</div><div><strong>Import zdrojů:</strong></div>'. 47 48 $Output = '</div><div><strong>Import zdrojů:</strong></div>'. 49 49 '<div><a href="?action=instructions">Instrukce pro přípravu zdrojových souborů</a></div>'. 50 50 '<div><a href="?action=update_translated">Zaktualizovat verze přeložených</a></div><br/>'. … … 52 52 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Group`'); 53 53 $DbRow = $DbResult->fetch_row(); 54 $PageList = GetPageList($DbRow[0]); 54 $PageList = GetPageList($DbRow[0]); 55 55 $Output .= '<h3>Seznam překladových skupin</h3>'; 56 56 $Output .= $PageList['Output']; 57 57 58 58 $Output .= '<table class="BaseTable">'; 59 59 $TableColumns = array( 60 array('Name' => 'Name', 'Title' => 'Jméno'), 61 array('Name' => 'SourceType', 'Title' => 'Typ zdroje'), 62 array('Name' => 'SourceName', 'Title' => 'Jméno zdroje'), 63 array('Name' => 'LastImport', 'Title' => 'Datum'), 60 array('Name' => 'Name', 'Title' => 'Jméno'), 61 array('Name' => 'SourceType', 'Title' => 'Typ zdroje'), 62 array('Name' => 'SourceName', 'Title' => 'Jméno zdroje'), 63 array('Name' => 'LastImport', 'Title' => 'Datum'), 64 64 array('Name' => 'LastVersion', 'Title' => 'Verze'), 65 array('Name' => '', 'Title' => 'Akce'), 65 array('Name' => '', 'Title' => 'Akce'), 66 66 ); 67 67 … … 70 70 71 71 $DbResult = $System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 72 while($Group = $DbResult->fetch_assoc()) 72 while($Group = $DbResult->fetch_assoc()) 73 73 { 74 74 $Output .= '<tr><td>'.$Group['Name'].'</td><td>'.$Group['SourceType'].'</td><td>'; … … 85 85 { 86 86 global $System; 87 87 88 88 $Output = '<div style="font-size: xx-small;">'; 89 89 $Import = new Import($System); … … 93 93 } 94 94 95 96 97 95 function Show() 96 { 97 $this->Title = T('Import'); 98 98 $Output = ''; 99 99 if($this->System->User->Licence(LICENCE_ADMIN)) … … 104 104 else if($_GET['action'] == 'importgroup') $Output .= $this->ShowImportGroup(); 105 105 else if($_GET['action'] == 'update_translated') $Output .= $this->UpdateTranslated(); 106 else $Output .= $this->ShowMenu(); 106 else $Output .= $this->ShowMenu(); 107 107 } else $Output .= $this->ShowMenu(); 108 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 108 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 109 109 return($Output); 110 110 } 111 111 } -
trunk/Modules/Import/cmd.php
r805 r816 7 7 $System = new System(); 8 8 $System->DoNotShowPage = true; 9 9 $System->Run(); 10 10 $Import = new Import($System); 11 11 12 12 $Output = ''; 13 13 14 if(defined('STDIN') == false) 14 if(defined('STDIN') == false) 15 15 { 16 16 $Output = T('Access denied'); 17 17 exit($Output); 18 } 18 } 19 19 20 20 foreach($_SERVER['argv'] as $parameter) … … 32 32 { 33 33 $Output .= ' 34 34 35 35 1. Pripojíme se pres SSH na server (wowpreklad.zdechov.net) napríklad pres program putty.exe nebo terminál v linuxu. 36 2. Nejprve je potreba získat zdrojová data. Není zapotrebí mít všechny typy textu. 36 2. Nejprve je potreba získat zdrojová data. Není zapotrebí mít všechny typy textu. 37 37 a) SQL databázi UDB seženeme na fóru: http://udbforums.kicks-ass.net/index.php?board=5.0 , sobor rozbalíme a uložíme do adresáre "wowpreklad/source/císlo_verze/sql/" 38 38 b) DBC a LUA soubory exportujeme přímo ze hry z souboru "World of Warcraft\Data\enGB\locale-enGB.MPQ" a všechny soubory "wow-update-enGB-<buildnumber>.MPQ". Tyto soubory je nutné otevřít najednou v merge modu programu "MPQEditor.exe", který je ke stažení v adresáři "wowpreklad/download". DBC soubory jsou v MPQ souboru uloženy ve složce "DBFilesClient". Lua ve složce "Interface". Tyto soubory zkopírujte do složky "wowpreklad/source/císlo_verze/dbc/" nebo "lua" … … 41 41 5. 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. 42 42 6. 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. 43 44 43 44 45 45 Parametry: 46 46 '; … … 48 48 $Output .= ' version=<version> - nastaví verzi importu default: '.$System->Config['Web']['GameVersion'].'<br /><br />'; 49 49 $Output .= ' <id_import_group>:'; 50 foreach($TranslationTree as $Group) 50 foreach($TranslationTree as $Group) 51 51 { 52 $Output .= '<br /> '.$Group['Id'].' '; 53 $Output .= ' '.$Group['Name'].' '; 52 $Output .= '<br /> '.$Group['Id'].' '; 53 $Output .= ' '.$Group['Name'].' '; 54 54 } 55 55 … … 61 61 else 62 62 $Import->SetVersion($System->Config['Web']['GameVersion']); 63 63 64 64 $Output .= $Import->ImportGroup($_GET['id']); //$Config['Web']['GameVersion'] 65 65 // $Import->UpdateTranslated(); … … 72 72 $Output .= '<br />'. 73 73 'aktuálně nastavená importovávaná verze: '.$_GET['version'].'<br />'; 74 else 74 else 75 75 $Output .= '<br />'. 76 76 'aktuálně nastavená importovávaná verze: '.$Config['Web']['GameVersion'].'<br />'; … … 79 79 $Output = str_replace('<br />',' 80 80 ',$Output); 81 echo($Output); 82 //ShowFooter(); 81 echo($Output); 82 //ShowFooter(); -
trunk/Modules/Log/Log.php
r808 r816 3 3 class ModuleLog extends AppModule 4 4 { 5 6 5 var $Excludes; 6 7 7 function __construct($System) 8 8 { … … 14 14 $this->Description = 'Log various application events'; 15 15 $this->Dependencies = array('Error', 'News'); 16 16 17 17 $this->Excludes = array(); 18 18 } 19 19 20 20 function Start() 21 21 { 22 23 24 $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Logs'),25 26 } 27 22 $this->System->RegisterPage('log.php', 'PageLog'); 23 $this->System->ModuleManager->Modules['Error']->OnError[] = array($this, 'DoAddItem'); 24 $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Logs'), 25 'Channel' => 'log', 'Callback' => array('PageLog', 'ShowRSS'), 'Permission' => LICENCE_ADMIN)); 26 } 27 28 28 function DoAddItem($Message) 29 29 { 30 30 $this->WriteLog($Message, LOG_TYPE_ERROR); 31 31 } 32 32 33 33 function WriteLog($Text, $Type) 34 34 { 35 if(isset($this->System->User) and !is_null($this->System->User->Id))36 37 38 39 40 41 35 if(isset($this->System->User) and !is_null($this->System->User->Id)) 36 $UserId = $this->System->User->Id; 37 else $UserId = 'NULL'; 38 $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP`, `URL` ) '. 39 'VALUES ('.$UserId.', '.$Type.', "'.addslashes($Text).'", NOW(), "'. 40 GetRemoteAddress().'", "'.GetRequestURI().'")'; 41 $this->System->Database->query($Query); 42 42 } 43 43 } … … 55 55 define('LOG_TYPE_PAGE_NOT_FOUND', 15); 56 56 57 // TODO: Change global function to module class local method 57 // TODO: Change global function to module class local method 58 58 function WriteLog($Text, $Type) 59 59 { 60 61 62 63 64 65 60 global $System, $User; 61 62 if(isset($User) and !is_null($User->Id)) $UserId = $User->Id; 63 else $UserId = 'NULL'; 64 $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP`, `URL` ) '. 65 'VALUES ('.$UserId.', '.$Type.', "'.addslashes($Text).'", NOW(), "'. 66 66 GetRemoteAddress().'", "'.GetRequestURI().'")'; 67 67 $System->Database->query($Query); 68 68 } 69 69 … … 72 72 function ShowRSS() 73 73 { 74 75 74 $this->RawPage = true; 75 $Output = ''; 76 76 $Items = array(); 77 if(array_key_exists('type', $_GET)) $Where = ' WHERE `Type` = "'.($_GET['type'] * 1).'"'; 77 if(array_key_exists('type', $_GET)) $Where = ' WHERE `Type` = "'.($_GET['type'] * 1).'"'; 78 78 else $Where = ''; 79 79 $sql = 'SELECT *, UNIX_TIMESTAMP(`Date`) AS `TimeCreate`, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `UserName`, `Date` FROM `Log`'. 80 80 $Where.' ORDER BY `Date` DESC LIMIT 100'; 81 81 $DbResult = $this->System->Database->query($sql); 82 while($Line = $DbResult->fetch_assoc()) 82 while($Line = $DbResult->fetch_assoc()) 83 83 { 84 84 $DbResult2 = $this->System->Database->query('SELECT * FROM `LogType` WHERE `Id`='.$Line['Type']); 85 85 $LogType = $DbResult2->fetch_assoc(); 86 86 87 87 if($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']); 88 88 $Line['Text'] = str_replace("\n", '<br>', $Line['Text']); 89 89 90 90 $Items[] = array 91 91 ( … … 96 96 'Time' => $Line['TimeCreate'], 97 97 ); 98 } 98 } 99 99 100 100 $Output .= GenerateRSS(array … … 108 108 return($Output); 109 109 } 110 110 111 111 function Show() 112 112 { 113 114 115 else $Action = ''; 116 117 118 119 } 120 113 if(array_key_exists('a', $_POST)) $Action = $_POST['a']; 114 else if(array_key_exists('a', $_GET)) $Action = $_GET['a']; 115 else $Action = ''; 116 if($Action == 'delerrlog') $Output = $this->DeleteErrorLog(); 117 else $Output = $this->ShowList(); 118 return($Output); 119 } 120 121 121 function ShowList() 122 122 { 123 123 global $TranslationTree; 124 124 125 125 $this->Title = T('System log'); 126 126 $Output = ''; 127 if(array_key_exists('type', $_GET)) $_SESSION['type'] = $_GET['type'] * 1; 127 if(array_key_exists('type', $_GET)) $_SESSION['type'] = $_GET['type'] * 1; 128 128 else if(!array_key_exists('type', $_SESSION)) $_SESSION['type'] = ''; 129 129 130 130 if(array_key_exists('group', $_GET)) $_SESSION['group'] = $_GET['group']; 131 131 132 if($_SESSION['type'] != '') $WhereType = ' (`Type`='.$_SESSION['type'].')'; 132 if($_SESSION['type'] != '') $WhereType = ' (`Type`='.$_SESSION['type'].')'; 133 133 else $WhereType = '1=1'; 134 134 135 135 $RSSChannels = array( 136 136 array('Title' => 'Záznamy změn', 'Channel' => 'log&type='.$_SESSION['type']) 137 137 ); 138 138 139 139 // Show category filter 140 140 if($this->System->User->Licence(LICENCE_MODERATOR)) … … 154 154 $Output .= '<br /><br />'; 155 155 156 if(array_key_exists('type', $_SESSION)) $Where = ' WHERE '.$WhereType; 156 if(array_key_exists('type', $_SESSION)) $Where = ' WHERE '.$WhereType; 157 157 else 158 158 { 159 159 if(array_key_exists('group', $_SESSION)) $Where = ' WHERE `Text` LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"'; 160 160 else $Where = ''; 161 } 161 } 162 162 //if(($Where != '') and (array_key_exists('group', $_SESSION))) $Where .= ' AND text LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"'; 163 163 164 164 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Log` '.$Where); 165 165 $DbRow = $DbResult->fetch_row(); 166 $PageList = GetPageList($DbRow[0]); 167 166 $PageList = GetPageList($DbRow[0]); 167 168 168 $Output .= $PageList['Output']; 169 169 170 170 $TableColumns = array( 171 171 array('Name' => 'Date', 'Title' => 'Čas'), 172 172 ); 173 if($_SESSION['type'] == '') $TableColumns[] = 173 if($_SESSION['type'] == '') $TableColumns[] = 174 174 array('Name' => 'LogName', 'Title' => 'Typ'); 175 $TableColumns = array_merge($TableColumns, array( 176 array('Name' => 'Text', 'Title' => 'Text'),177 array('Name' => 'UserName', 'Title' => 'Uživatel'), 178 array('Name' => 'IP', 'Title' => 'Adresa'), 175 $TableColumns = array_merge($TableColumns, array( 176 array('Name' => 'Text', 'Title' => 'Text'), 177 array('Name' => 'UserName', 'Title' => 'Uživatel'), 178 array('Name' => 'IP', 'Title' => 'Adresa'), 179 179 array('Name' => 'URL', 'Title' => 'URL'), 180 180 )); … … 182 182 $Output .= '<table width="98%" class="BaseTable">'. 183 183 $Order['Output']; 184 184 185 185 $sql = 'SELECT *, `LogType`.`Color` AS `LogColor`, `LogType`.`Name` AS `LogName`, '. 186 186 '(SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `UserName` FROM `Log` LEFT JOIN `LogType` ON `LogType`.`Id`=`Log`.`Type` '.$Where.$Order['SQL'].$PageList['SQLLimit']; 187 187 $DbResult = $this->System->Database->query($sql); 188 while($Line = $DbResult->fetch_assoc()) 189 { 190 188 while($Line = $DbResult->fetch_assoc()) 189 { 190 if($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']); 191 191 $Line['Text'] = str_replace("\n", '<br>', $Line['Text']); 192 193 192 $Output .= '<tr><td>'.$Line['Date'].'</td>'; 193 if($_SESSION['type'] == '') $Output .= '<td>'.$Line['LogName'].'</td>'; 194 194 $Output .= '<td><span style="color: '.$Line['LogColor'].'">'.$Line['Text'].'</span></td>'. 195 195 '<td><a href="'.$this->System->Link('/user.php?user='.$Line['User']).'">'.$Line['UserName'].'</a></td>'. 196 196 '<td>'.$Line['IP'].'</td>'. 197 197 '<td>'.$Line['URL'].'</td></tr>'; 198 198 } 199 199 $Output .= '</table>'. … … 203 203 $Output .= '<div>Vymazat: <a href="'.$this->System->Link('/log.php?a=delerrlog&type='.LOG_TYPE_ERROR).'">Chybové záznamy</a> '. 204 204 '<a href="'.$this->System->Link('/log.php?a=delerrlog&type='.LOG_TYPE_PAGE_NOT_FOUND).'">Neznámé stránky</a></div>'; 205 } 205 } 206 206 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 207 208 return($Output); 209 } 210 207 208 return($Output); 209 } 210 211 211 function DeleteErrorLog() 212 212 { 213 if($this->System->User->Licence(LICENCE_ADMIN) and214 215 216 217 218 219 220 221 222 223 224 225 213 if($this->System->User->Licence(LICENCE_ADMIN) and 214 (($_GET['type'] == LOG_TYPE_ERROR) or ($_GET['type'] == LOG_TYPE_PAGE_NOT_FOUND))) 215 { 216 $DbResult = $this->System->Database->select('LogType', '*', 'Id='.$_GET['type']); 217 $LogType = $DbResult->fetch_assoc(); 218 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Log` WHERE `Type`='.$_GET['type']); 219 $DbRow = $DbResult->fetch_row(); 220 $this->System->Database->query('DELETE FROM `Log` WHERE `Type`='.$_GET['type']); 221 $this->System->ModuleManager->Modules['Log']->WriteLog('Vymazáno záznamů z '.$LogType['Description'].'.', LOG_TYPE_ADMINISTRATION); 222 $Output = ShowMessage('Smazáno všech '.$DbRow[0].' záznamů z '.$LogType['Description'].'.'); 223 $Output .= $this->ShowList(); 224 return($Output); 225 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 226 226 } 227 227 } -
trunk/Modules/News/News.php
r815 r816 20 20 function Start() 21 21 { 22 23 24 25 22 $this->System->RegisterPage('news', 'PageNews'); 23 $this->System->RegisterPage('rss', 'PageRSS'); 24 $this->RegisterRSS(array('Title' => T('News'), 'Channel' => 'news', 25 'Callback' => array('PageNews', 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS)); 26 26 } 27 27 28 28 function ShowBox() 29 29 { 30 31 32 33 34 35 36 $Output .= '</div>';37 30 $Output = '<strong>'.T('System changes').':</strong><div class="NewsBox">'; 31 $DbResult = $this->Database->query('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text`,`News`.`Title`'. 32 ' FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10'); 33 while($DbRow = $DbResult->fetch_assoc()) 34 $Output .= '<div><strong>'.$DbRow['Title'].' ('.HumanDate($DbRow['Time']).')</strong> <br />'.$DbRow['Text'].' ('.$DbRow['Name'].')</div>'; 35 $Output .= '<a href="'.$this->System->Link('/news/').'">'.T('All news').'</a>'; 36 $Output .= '</div>'; 37 return($Output); 38 38 } 39 39 … … 41 41 { 42 42 $this->RSSChannels[$Channel['Channel']] = $Channel; 43 43 44 44 if(is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel']; 45 45 else { … … 52 52 $Output = ''; 53 53 foreach($this->RSSChannels as $Channel) 54 55 56 57 58 54 { 55 if($this->System->User->Licence($Channel['Permission'])) 56 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 57 $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 58 } 59 59 return($Output); 60 60 } … … 63 63 class PageNews extends Page 64 64 { 65 66 67 68 69 70 71 72 73 74 75 65 function Show() 66 { 67 $this->Title = T('News'); 68 if(array_key_exists('a', $_POST)) $Action = $_POST['a']; 69 else if(array_key_exists('a', $_GET)) $Action = $_GET['a']; 70 else $Action = ''; 71 if($Action == 'add2') $Output = $this->SaveNew(); 72 if($Action == 'add') $Output = $this->ShowAddForm(); 73 else $Output = $this->ShowList(); 74 return($Output); 75 } 76 76 77 function ShowList() 78 { 79 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `News`'); 80 $DbRow = $DbResult->fetch_row(); 81 $PageList = GetPageList($DbRow[0]); 82 83 $Output = '<h3>'.T('News').'</h3>'.$PageList['Output']; 84 if($this->System->User->Licence(LICENCE_ADMIN)) 85 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 86 $Output .= '<div class="shoutbox">'; 87 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, '. 88 '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` ORDER BY `News`.`Time` DESC '.$PageList['SQLLimit']); 89 while($Line = $DbResult->fetch_assoc()) 90 $Output .= '<div><strong>'.$Line['Title'].' ('.HumanDate($Line['Time']).')</strong><br/> '.$Line['Text'].' ('.$Line['User'].')</div>'; 91 $Output .= '</div>'.$PageList['Output']; 92 return($Output); 93 } 77 function ShowList() 78 { 79 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `News`'); 80 $DbRow = $DbResult->fetch_row(); 81 $PageList = GetPageList($DbRow[0]); 94 82 95 function ShowAddForm() 96 { 97 if($this->System->User->Licence(LICENCE_ADMIN)) 98 { 99 $Output = '<form action="?" method="POST">'. 100 T('User').': '.$this->System->User->Name.'('.$this->System->User->Id.')<br/> '. 101 T('Title').': <input type="text" name="title" size="40"/><br/>'. 102 T('Content').': <textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="Text" name="text"></textarea><br/>'. 103 '<input type="hidden" name="a" value="add2"/>'. 104 '<input type="submit" value="'.T('Save').'"/><br/>'. 105 '</form>'; 106 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 107 return($Output); 108 } 109 110 function SaveNew() 111 { 112 if($this->System->User->Licence(LICENCE_ADMIN)) 113 { 114 if(array_key_exists('text', $_POST) and array_key_exists('title', $_POST)) 115 { 116 $querty = 'INSERT INTO `News` (`Title`, `Time` ,`User` ,`Text`) VALUES ( "'.$_POST['title'].'", NOW( ) , '. 117 $this->System->User->Id.', "'.$_POST['text'].'")'; 118 $this->System->Database->query($querty); 119 $Output = ShowMessage(T('News added')); 120 $this->System->ModuleManager->Modules['Log']->WriteLog('Vložena nová aktualita', LOG_TYPE_ADMINISTRATION); 121 $Output .= $this->ShowList(); 122 } else $Output = ShowMessage(T('Data not specified'), MESSAGE_CRITICAL); 123 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 124 return($Output); 125 } 83 $Output = '<h3>'.T('News').'</h3>'.$PageList['Output']; 84 if($this->System->User->Licence(LICENCE_ADMIN)) 85 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 86 $Output .= '<div class="shoutbox">'; 87 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, '. 88 '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` ORDER BY `News`.`Time` DESC '.$PageList['SQLLimit']); 89 while($Line = $DbResult->fetch_assoc()) 90 $Output .= '<div><strong>'.$Line['Title'].' ('.HumanDate($Line['Time']).')</strong><br/> '.$Line['Text'].' ('.$Line['User'].')</div>'; 91 $Output .= '</div>'.$PageList['Output']; 92 return($Output); 93 } 126 94 127 function ShowRSS() 128 { 129 $Items = array(); 95 function ShowAddForm() 96 { 97 if($this->System->User->Licence(LICENCE_ADMIN)) 98 { 99 $Output = '<form action="?" method="POST">'. 100 T('User').': '.$this->System->User->Name.'('.$this->System->User->Id.')<br/> '. 101 T('Title').': <input type="text" name="title" size="40"/><br/>'. 102 T('Content').': <textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="Text" name="text"></textarea><br/>'. 103 '<input type="hidden" name="a" value="add2"/>'. 104 '<input type="submit" value="'.T('Save').'"/><br/>'. 105 '</form>'; 106 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 107 return($Output); 108 } 109 110 function SaveNew() 111 { 112 if($this->System->User->Licence(LICENCE_ADMIN)) 113 { 114 if(array_key_exists('text', $_POST) and array_key_exists('title', $_POST)) 115 { 116 $querty = 'INSERT INTO `News` (`Title`, `Time` ,`User` ,`Text`) VALUES ( "'.$_POST['title'].'", NOW( ) , '. 117 $this->System->User->Id.', "'.$_POST['text'].'")'; 118 $this->System->Database->query($querty); 119 $Output = ShowMessage(T('News added')); 120 $this->System->ModuleManager->Modules['Log']->WriteLog('Vložena nová aktualita', LOG_TYPE_ADMINISTRATION); 121 $Output .= $this->ShowList(); 122 } else $Output = ShowMessage(T('Data not specified'), MESSAGE_CRITICAL); 123 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 124 return($Output); 125 } 126 127 function ShowRSS() 128 { 129 $Items = array(); 130 130 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, '. 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 131 '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text` '. 132 'FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10'); 133 while($DbRow = $DbResult->fetch_assoc()) 134 { 135 $Items[] = array 136 ( 137 'Title' => $DbRow['Title'], 138 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/news/'), 139 'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')', 140 'Time' => $DbRow['UnixTime'], 141 ); 142 } 143 $Output = GenerateRSS(array 144 ( 145 'Title' => $this->System->Config['Web']['Title'].' - '.T('System changes'), 146 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/news/'), 147 'Description' => $this->System->Config['Web']['Description'], 148 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'], 149 'Items' => $Items, 150 )); 151 return($Output); 152 } 153 153 } -
trunk/Modules/News/RSS.php
r609 r816 3 3 function GenerateRSS($Data) 4 4 { 5 5 global $Config; 6 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 7 $Result = '<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'" ?>'."\n". //<? 8 '<rss version="2.0">'."\n". 9 " <channel>\n". 10 " <title>".$Data['Title']."</title>\n". 11 " <link>".$Data['Link']."</link>\n". 12 " <description>".$Data['Description']."</description>\n". 13 " <language>cs</language>\n". 14 " <webMaster>".$Data['WebmasterEmail']."</webMaster>\n". 15 " <pubDate>".date('r')."</pubDate>\n". 16 " <ttl>20</ttl>\n"; 17 foreach($Data['Items'] as $Item) 18 { 19 $Result .= " <item>\n". 20 ' <title>'.htmlspecialchars($Item['Title'])."</title>\n". 21 ' <description>'.htmlspecialchars($Item['Description'])."</description>\n". 22 ' <pubDate>'.date('r',$Item['Time'])."</pubDate>\n". 23 ' <link>'.$Item['Link']."</link>\n". 24 " </item>\n"; 25 } 26 $Result .= " </channel>\n". 27 "</rss>"; 28 return($Result); 29 29 } 30 30 31 31 class PageRSS extends Page 32 32 { 33 34 { 35 36 37 38 39 40 41 42 43 $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName]; 44 if($this->System->User->Licence($Channel['Permission']) or 45 46 47 48 49 50 51 52 53 33 function Show() 34 { 35 $this->RawPage = true; 36 37 if(array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel']; 38 else $ChannelName = ''; 39 if(array_key_exists('token', $_GET)) $Token = $_GET['token']; 40 else $Token = ''; 41 if(array_key_exists($ChannelName, $this->System->ModuleManager->Modules['News']->RSSChannels)) 42 { 43 $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName]; 44 if($this->System->User->Licence($Channel['Permission']) or 45 $this->System->User->CheckToken($Channel['Permission'], $Token)) 46 { 47 if(is_string($Channel['Callback'][0])) 48 { 49 $Class = new $Channel['Callback'][0]($this->System); 50 $Output = $Class->$Channel['Callback'][1](); 51 } else $Output = call_user_func($Channel['Callback']); 52 } else $Output = T('Access denied'); 53 } else $Output = 'Nezadán žádný kanál'; 54 54 return($Output); 55 55 } 56 56 } -
trunk/Modules/Redirection/Redirection.php
r812 r816 17 17 function Start() 18 18 { 19 19 $this->System->OnPageNotFound = array($this, 'ShowRedirect'); 20 20 } 21 21 22 22 function Redirect($Location) 23 23 { 24 24 Header($_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently'); 25 25 Header('Location: '.$Location); 26 26 return('<h3 align="center">Požadovaná stránka byla přesunuta do nového umístění.</h3>'); … … 32 32 if(count($this->System->PathItems) > 0) 33 33 { 34 34 if($this->System->PathItems[0] == 'team.php') $Output = $this->Redirect($this->System->Link('/team/')); 35 35 if($this->System->PathItems[0] == 'version.php') $Output = $this->Redirect($this->System->Link('/client-version/')); 36 36 if($this->System->PathItems[0] == 'phpBB3') $Output = $this->Redirect($this->System->Link('/forum/')); -
trunk/Modules/Referrer/Referrer.php
r811 r816 3 3 class ModuleReferrer extends AppModule 4 4 { 5 5 var $Excludes; 6 6 7 7 function __construct($System) … … 20 20 function Start() 21 21 { 22 23 24 25 26 27 28 29 22 $this->Log(); 23 $this->System->RegisterPage('referrer', 'PageReferrer'); 24 $this->System->RegisterMenuItem(array( 25 'Title' => T('Promotion'), 26 'Hint' => 'Informace k propagaci tohoto projektu', 27 'Link' => $this->System->Link('/referrer/'), 28 'Permission' => LICENCE_ANONYMOUS, 29 'Icon' => '', 30 30 )); 31 31 } … … 40 40 if(!in_array($HostName, $this->Excludes)) 41 41 { 42 42 $IP = GetRemoteAddress(); 43 43 44 44 // Check if client IP is not blaclisted as spam source. If yes then add new referrer as invisible … … 65 65 { 66 66 $this->System->Database->query('INSERT INTO `Referrer` (`Web`, `DateFirst`, `DateLast`, `LastURL`, `Hits`, `LastIP`, `Visible`, `Description`) '. 67 67 'VALUES ("'.$HostName.'", NOW(), NOW( ), "'.addslashes($Referrer).'", 1, "'.$IP.'", '.$Visible.', "'.$Description.'")'); 68 68 } 69 69 } … … 93 93 $MonthAge = 3; 94 94 $YesNo = array('Ne', 'Ano'); 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 95 $Output .= '<br/><strong>'.T('Servers referring to us').':</strong> <br /> 96 <div style="font-size: 10px;">Seznam je automaticky aktualizován a zobrazeny jsou servery, ze kterých přišli uživatelé během posledních třech měsíců řazený sestupně dle nejnovějších.</div><br />'; 97 98 if(!$this->System->User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Visible`=1) AND (`Parent` IS NULL)'; 99 else $Where = ''; 100 $Query = 'SELECT *, (SELECT Web FROM `Referrer` AS T4 WHERE T4.Id = T3.Parent) AS ParentName '. 101 'FROM (SELECT *, '. 102 '(`Hits` + COALESCE((SELECT SUM(`Hits`) FROM '. 103 '`Referrer` AS `T1` WHERE `T1`.`Parent` = `T2`.`Id`), 0)) AS `TotalHits`, '. 104 'GREATEST(`DateLast`, COALESCE((SELECT MAX(`DateLast`) FROM '. 105 '`Referrer` AS `T1` WHERE `T1`.`Parent` = `T2`.`Id`), 0)) AS `MaxDateLast` FROM '. 106 '`Referrer` AS `T2` '.$Where.') AS `T3` '. 107 'WHERE (`T3`.`MaxDateLast` > (NOW() - INTERVAL '.$MonthAge.' MONTH))'; 108 109 110 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS T'); 111 $DbRow = $DbResult->fetch_row(); 112 $PageList = GetPageList($DbRow[0]); 113 114 $Output .= $PageList['Output']. 115 '<table class="BaseTable">'; 116 117 $TableColumns = array( 118 array('Name' => 'Web', 'Title' => T('Address')), 119 array('Name' => 'MaxDateLast', 'Title' => T('Last visit')), 120 array('Name' => 'TotalHits', 'Title' => T('Hits')), 121 ); 122 if($this->System->User->Licence(LICENCE_ADMIN)) 123 { 124 $TableColumns[] = array('Name' => 'Visible', 'Title' => T('Visible')); 125 $TableColumns[] = array('Name' => 'Parent', 'Title' => T('Parent')); 126 $TableColumns[] = array('Name' => 'Description', 'Title' => T('Comment')); 127 127 $TableColumns[] = array('Name' => 'LastIP', 'Title' => T('Last IP address')); 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 128 $TableColumns[] = array('Name' => 'Action', 'Title' => T('Actions')); 129 } 130 $Order = GetOrderTableHeader($TableColumns, 'MaxDateLast', 1); 131 $Output .= $Order['Output']; 132 133 $Query .= $Order['SQL'].$PageList['SQLLimit']; 134 135 $DbResult = $this->Database->query($Query); 136 while($Line = $DbResult->fetch_assoc()) 137 { 138 $Output .= '<tr><td><a href="'.$Line['LastURL'].'">'.$Line['Web'].'</a></td>'. 139 '<td>'.HumanDate($Line['MaxDateLast']).'</td>'. 140 '<td>'.$Line['TotalHits'].'</td>'; 141 if($this->System->User->Licence(LICENCE_ADMIN)) 142 { 143 $Output .= 144 '<td>'.$YesNo[$Line['Visible']].'</td>'. 145 '<td>'.$Line['ParentName'].'</td>'. 146 '<td>'.$Line['Description'].'</td>'. 147 147 '<td>'.$Line['LastIP'].'</td>'. 148 148 '<td><a href="?action=edit&id='.$Line['Id'].'">'.T('Modify').'</a> '. 149 149 '<a href="?action=spam&id='.$Line['Id'].'">'.T('Spam').'</a></td>'; 150 151 152 153 154 155 150 } 151 $Output .= '</tr>'; 152 } 153 $Output .= '</table>'; 154 $Output .= $PageList['Output']; 155 return($Output); 156 156 } 157 157 … … 203 203 { 204 204 if($this->System->User->Licence(LICENCE_ADMIN)) 205 206 207 205 { 206 if(array_key_exists('id', $_GET)) 207 { 208 208 $DbResult = $this->Database->select('Referrer', '*', 'Id='.$_GET['id']); 209 210 211 212 213 214 215 216 217 218 209 if($DbResult->num_rows > 0) 210 { 211 $Item = $DbResult->fetch_assoc(); 212 if($Item['Visible'] == 1) $Visible = ' checked '; 213 else $Visible = ''; 214 $Output = '<form action="?action=editsave&id='.$_GET['id'].'" method="post"><table>'. 215 '<tr><td>'.T('Web').'</td><td>'.$Item['Web'].'</td></tr>'. 216 '<tr><td>'.T('Visible').'</td><td><input type="checkbox" name="Visible" '.$Visible.'/></td></tr>'. 217 '<tr><td>'.T('Description').'</td><td><input type="text" name="Description" value="'.$Item['Description'].'"/></td></tr>'. 218 '<tr><td>'.T('Parent item').'</td><td>'.$this->SelectParentItem($Item['Parent'], $Item['Id']).'</td></tr>'. 219 219 '<tr><td>'.T('Last IP address').'</td><td><input type="text" name="LastIP" value="'.$Item['LastIP'].'"/></td></tr>'. 220 221 222 223 224 220 '<tr><td colspan="2"><input type="submit" value="Uložit"/></td></tr></table></form>'; 221 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 222 } else $Output = ShowMessage(T('Item not specified'), MESSAGE_CRITICAL); 223 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 224 return($Output); 225 225 } 226 226 227 227 function EditSave() 228 228 { 229 230 231 232 233 234 235 236 237 229 if($this->System->User->Licence(LICENCE_ADMIN)) 230 { 231 if($_POST['Parent'] == '') $_POST['Parent'] = null; 232 $_POST['Visible'] = array_key_exists('Visible', $_POST); 233 $DbResult = $this->Database->update('Referrer', 'Id='.$_GET['id'], array( 234 'Visible' => $_POST['Visible'], 'LastIP' => $_POST['LastIP'], 235 'Parent' => $_POST['Parent'], 'Description' => $_POST['Description'])); 236 $_SERVER['QUERY_STRING'] = ''; 237 $Output = ShowMessage(T('Settings saved')); 238 238 $Output .= $this->ShowList(); 239 240 239 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 240 return($Output); 241 241 } 242 242 243 243 function Show() 244 244 { 245 245 $this->Title = T('Promotion'); 246 246 if(array_key_exists('action', $_GET)) 247 247 { -
trunk/Modules/Search/Search.php
r760 r816 3 3 class ModuleSearch extends AppModule 4 4 { 5 var $SearchItems; 6 7 function __construct($System) 8 { 9 parent::__construct($System); 10 $this->Name = 'Search'; 11 $this->Version = '1.0'; 12 $this->Creator = 'Chronos'; 13 $this->License = 'GNU/GPL'; 14 $this->Description = 'Allow test search in other modules content.'; 15 $this->Dependencies = array(); 16 $this->SearchItems = array(); 17 } 5 var $SearchItems; 18 6 19 function Start()20 21 $this->System->RegisterPage('search', 'PageSearch');22 } 23 24 function RegisterSearch($Name, $Title, $Columns, $Query, $Link) 25 { 26 // Query can be table name or subselect query 27 $this->SearchItems[$Name] = array('Name' => $Title, 'Columns' => $Columns, 28 'Query' => $Query, 'Link' => $Link);29 7 function __construct($System) 8 { 9 parent::__construct($System); 10 $this->Name = 'Search'; 11 $this->Version = '1.0'; 12 $this->Creator = 'Chronos'; 13 $this->License = 'GNU/GPL'; 14 $this->Description = 'Allow test search in other modules content.'; 15 $this->Dependencies = array(); 16 $this->SearchItems = array(); 17 } 30 18 31 function UnregisterSearch($Name) 32 { 33 unset($this->SearchItems[$Name]); 34 } 19 function Start() 20 { 21 $this->System->RegisterPage('search', 'PageSearch'); 22 } 23 24 function RegisterSearch($Name, $Title, $Columns, $Query, $Link) 25 { 26 // Query can be table name or subselect query 27 $this->SearchItems[$Name] = array('Name' => $Title, 'Columns' => $Columns, 28 'Query' => $Query, 'Link' => $Link); 29 } 30 31 function UnregisterSearch($Name) 32 { 33 unset($this->SearchItems[$Name]); 34 } 35 35 } 36 36 37 37 class PageSearch extends Page 38 38 { 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 } 55 56 57 { 58 59 60 61 39 function Show() 40 { 41 $this->Title = T('Search'); 42 if(array_key_exists('text', $_GET)) $Search = $_GET['text']; 43 else if(array_key_exists('text', $_POST)) $Search = $_POST['text']; 44 else $Search = ''; 45 $SearchHTML = urlencode($Search); 46 47 $Output = '<table class="BaseTable"><tr><th>'.T('Section').'</th><th>'.T('Found count').'</th></tr>'; 48 foreach($this->System->ModuleManager->Modules['Search']->SearchItems as $SearchItem) 49 { 50 $ColumnQuery = array(); 51 foreach($SearchItem['Columns'] as $Column) 52 { 53 $ColumnQuery[] = '(`'.$Column.'` LIKE "%'.$Search.'%")'; 54 } 55 $ColumnQuery = implode(' OR ', $ColumnQuery); 56 if($SearchItem['Query'] != '') 57 { 58 $DbResult = $this->Database->query('SELECT COUNT(*) FROM '.$SearchItem['Query'].' WHERE '.$ColumnQuery); 59 $Line = $DbResult->fetch_row(); 60 $Line = $Line[0]; 61 } else $Line = ''; 62 62 if ($Line <> 0) 63 64 65 66 67 68 63 $Output .= '<tr><td><a href="'.$SearchItem['Link'].$SearchHTML.'">'.$SearchItem['Name'].'</a></td><td>'.$Line.'</td></tr>'; 64 } 65 66 $Output .= '</table>'; 67 return($Output); 68 } 69 69 } -
trunk/Modules/Server/Server.php
r766 r816 3 3 class ModuleServer extends AppModule 4 4 { 5 6 7 8 9 10 11 12 13 14 5 function __construct($System) 6 { 7 parent::__construct($System); 8 $this->Name = 'Server'; 9 $this->Version = '1.0'; 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL'; 12 $this->Description = 'Show list of WoW servers which supports translated texts.'; 13 $this->Dependencies = array(); 14 } 15 15 16 17 18 19 16 function Start() 17 { 18 $this->System->RegisterPage('server', 'PageServerList'); 19 $this->System->RegisterMenuItem(array( 20 20 'Title' => T('Servers'), 21 21 'Hint' => 'Seznam serverů, kde je nasazena čeština v praxi', … … 24 24 'Icon' => '', 25 25 ), 5); 26 26 } 27 27 } 28 28 29 29 class PageServerList extends PageEdit 30 30 { 31 32 33 34 35 31 function __construct($System) 32 { 33 parent::__construct($System); 34 $this->Table = 'Server'; 35 $this->TableSQL = 'SELECT `Server`.`Id`, `Name`, `URL`, `Parts`, `XPRate`, `GameplayStyle`, `Description`, `CheckIP`, `CheckPort`, '. 36 36 '`ClientVersion`.`Version` AS `ClientVersion` FROM `Server` '. 37 37 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `Server`.`ClientVersion`'; 38 39 40 'URL' => array('Type' => 'URL', 'Title' => T('URL'), 'InList' => true), 41 'Parts' => array('Type' => 'String', 'Title' => T('Translated'), 'InList' => true), 38 $this->Definition = array( 39 'Name' => array('Type' => 'String', 'Title' => T('Name'), 'InList' => true), 40 'URL' => array('Type' => 'URL', 'Title' => T('URL'), 'InList' => true), 41 'Parts' => array('Type' => 'String', 'Title' => T('Translated'), 'InList' => true), 42 42 'XPRate' => array('Type' => 'String', 'Title' => T('XP rate'), 'InList' => true), 43 43 'GameplayStyle' => array('Type' => 'String', 'Title' => T('Style'), 'InList' => true), 44 'ClientVersion' => array('Type' => 'String', 'Title' => T('Client version'), 'InList' => true), 44 'ClientVersion' => array('Type' => 'String', 'Title' => T('Client version'), 'InList' => true), 45 45 'Description' => array('Type' => 'Text', 'Title' => T('Description'), 'InList' => false), 46 46 'CheckIP' => array('Type' => 'Text', 'Title' => T('Online check IP'), 'InList' => false), 47 47 'CheckPort' => array('Type' => 'Text', 'Title' => T('Online check port'), 'InList' => false), 48 ); 49 50 51 52 53 48 ); 49 } 50 51 function ViewList() 52 { 53 $this->Title = T('Servers'); 54 54 $Output = '<p>'.T('There are servers listed which are in fact offering translated game. '. 55 55 'There is resoluted if translation is offered either on client side, on server side or both. '. 56 56 'Term "Czech server" doesn\'t mean that server is operated by Czech people but that it is possible to play in Czech.').'.</p>'; 57 57 $Output .= '<h3>'.T('Translated server list').'</h3>'; 58 59 60 58 $Output .= parent::ViewList(); 59 return($Output); 60 } 61 61 } -
trunk/Modules/ShoutBox/ShoutBox.php
r815 r816 16 16 function Start() 17 17 { 18 19 20 21 18 $this->System->RegisterPage('shoutbox', 'PageShoutBox'); 19 $this->System->ModuleManager->Modules['News']->RegisterRSS(array( 20 'Title' => T('Shoutbox'), 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'), 21 'Permission' => LICENCE_ANONYMOUS)); 22 22 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 23 23 $this->System->ModuleManager->Modules['Search']->RegisterSearch('shoutbox', … … 27 27 function ShowBox() 28 28 { 29 30 31 32 33 34 35 36 37 38 29 $Output = '<strong><a href="'.$this->System->Link('/shoutbox/').'">'.T('Shoutbox').':</a></strong>'; 30 31 if($this->System->User->Licence(LICENCE_USER)) 32 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 33 $Output .= '<div class="box"><table>'; 34 $DbResult = $this->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30'); 35 while($Line = $DbResult->fetch_assoc()) 36 $Output .= '<tr><td><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</td></tr>'; 37 $Output .= '</table></div>'; 38 return($Output); 39 39 } 40 40 } … … 42 42 class PageShoutBox extends Page 43 43 { 44 45 46 47 48 49 50 51 52 53 54 44 function Show() 45 { 46 $this->Title = T('Shoutbox'); 47 if(array_key_exists('a', $_POST)) $Action = $_POST['a']; 48 else if(array_key_exists('a', $_GET)) $Action = $_GET['a']; 49 else $Action = ''; 50 if($Action == 'add2') $Output = $this->AddFinish(); 51 if($Action == 'add') $Output = $this->ShowAddForm(); 52 else $Output = $this->ShowList(); 53 return($Output); 54 } 55 55 56 57 58 59 60 61 62 63 64 65 66 56 function ShowList() 57 { 58 $Output = ''; 59 if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 60 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 61 if(array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 62 if($_SESSION['search'] != '') 63 { 64 $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")'; 65 $Output .= '<div><a href="?search=">'.sprintf(T('Disable filter "%s"'), $_SESSION['search']).'</a></div>'; 66 } else $SearchQuery = ''; 67 67 68 69 70 $PageList = GetPageList($DbRow[0]); 68 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ShoutBox` WHERE 1'.$SearchQuery); 69 $DbRow = $DbResult->fetch_row(); 70 $PageList = GetPageList($DbRow[0]); 71 71 72 73 74 75 76 77 78 79 80 81 72 $Output .= '<h3>'.T('Shoutbox').'</h3>'.$PageList['Output']; 73 if($this->System->User->Licence(LICENCE_USER)) 74 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 75 $Output .= '<div class="shoutbox">'; 76 $DbResult = $this->System->Database->query('SELECT * FROM `ShoutBox` WHERE 1'.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']); 77 while($Line = $DbResult->fetch_assoc()) 78 $Output .= '<div><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</div>'; 79 $Output .= '</div>'.$PageList['Output']; 80 return($Output); 81 } 82 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 }else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL);99 100 101 83 function ShowAddForm() 84 { 85 $Output = ''; 86 if($this->System->User->Licence(LICENCE_USER)) 87 { 88 $Output .= '<form action="?" method="post">'. 89 '<fieldset><legend>'.T('New message').'</legend>'. 90 'Uživatel: '; 91 if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 92 else $Output .= '<input type="text" name="user" /><br />'; 93 $Output .= 'Text zprávy: <br/>'. 94 '<textarea onkeydown="ResizeTextArea(this)" name="text" cols="40"></textarea> <br/>'. 95 '<input type="hidden" name="a" value="add2"/>'. 96 '<input type="submit" value="Odeslat" /><br /></fieldset>'. 97 '</form>'; 98 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL); 99 $Output .= $this->ShowList(); 100 return($Output); 101 } 102 102 103 function AddFinish() 104 { 105 $Output = ''; 106 if($this->System->User->Licence(LICENCE_USER)) 107 { 108 if(array_key_exists('text', $_POST)) 109 { 110 $Text = $_POST['text']; 111 if(trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING); 112 else 113 { 114 // Protection against mutiple post of same message 115 $DbResult = $this->System->Database->query('SELECT `Text` FROM `ShoutBox` WHERE (`User` = "'. 116 $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 117 if($DbResult->num_rows > 0) 118 { 119 $DbRow = $DbResult->fetch_assoc(); 120 } else $DbRow['Text'] = ''; 121 122 if($DbRow['Text'] == $Text) $Output .= ShowMessage('Nelze vložit stejnou zprávu vícekrát za sebou.', MESSAGE_WARNING); 123 else 124 { 125 $this->System->Database->query('INSERT INTO `ShoutBox` ( `User`, `UserName` , `Text` , `Date` , `IP` ) '. 126 ' VALUES ('.$this->System->User->Id.', "'.$this->System->User->Name. 127 '", "'.$Text.'", NOW(), "'.GetRemoteAddress().'")'); 128 $Output .= ShowMessage('Zpráva vložena.'); 129 } 130 } 131 } else $Output .= ShowMessage('Nezadán text pro novou zprávu.', MESSAGE_CRITICAL); 132 $Output .= '<br/>'; 133 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL); 134 $Output .= $this->ShowList(); 135 return($Output); 136 } 103 function AddFinish() 104 { 105 $Output = ''; 106 if($this->System->User->Licence(LICENCE_USER)) 107 { 108 if(array_key_exists('text', $_POST)) 109 { 110 $Text = $_POST['text']; 111 if(trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING); 112 else 113 { 114 // Protection against mutiple post of same message 115 $DbResult = $this->System->Database->query('SELECT `Text` FROM `ShoutBox` WHERE (`User` = "'. 116 $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 117 if($DbResult->num_rows > 0) 118 { 119 $DbRow = $DbResult->fetch_assoc(); 120 } else $DbRow['Text'] = ''; 137 121 138 function ShowRSS() 139 { 140 $Items = array(); 141 $TitleLength = 50; 142 mb_internal_encoding('utf-8'); 143 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `UserName`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20'); 144 while($DbRow = $DbResult->fetch_assoc()) 145 { 146 $Title = mb_substr($DbRow['Text'], 0, $TitleLength); 147 if(mb_strlen($Title) == $TitleLength) $Title .= '...'; 148 $Items[] = array 149 ( 150 'Title' => $DbRow['UserName'].': '.$Title, 151 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/shoutbox/'), 152 'Description' => $DbRow['Text'], 153 'Time' => $DbRow['UnixDate'], 154 ); 155 } 156 $Output = GenerateRSS(array 122 if($DbRow['Text'] == $Text) $Output .= ShowMessage('Nelze vložit stejnou zprávu vícekrát za sebou.', MESSAGE_WARNING); 123 else 124 { 125 $this->System->Database->query('INSERT INTO `ShoutBox` ( `User`, `UserName` , `Text` , `Date` , `IP` ) '. 126 ' VALUES ('.$this->System->User->Id.', "'.$this->System->User->Name. 127 '", "'.$Text.'", NOW(), "'.GetRemoteAddress().'")'); 128 $Output .= ShowMessage('Zpráva vložena.'); 129 } 130 } 131 } else $Output .= ShowMessage('Nezadán text pro novou zprávu.', MESSAGE_CRITICAL); 132 $Output .= '<br/>'; 133 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL); 134 $Output .= $this->ShowList(); 135 return($Output); 136 } 137 138 function ShowRSS() 139 { 140 $Items = array(); 141 $TitleLength = 50; 142 mb_internal_encoding('utf-8'); 143 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `UserName`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20'); 144 while($DbRow = $DbResult->fetch_assoc()) 145 { 146 $Title = mb_substr($DbRow['Text'], 0, $TitleLength); 147 if(mb_strlen($Title) == $TitleLength) $Title .= '...'; 148 $Items[] = array 149 ( 150 'Title' => $DbRow['UserName'].': '.$Title, 151 'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/shoutbox/'), 152 'Description' => $DbRow['Text'], 153 'Time' => $DbRow['UnixDate'], 154 ); 155 } 156 $Output = GenerateRSS(array 157 157 ( 158 158 'Title' => $this->System->Config['Web']['Title'].' - '.T('Shoutbox'), … … 163 163 )); 164 164 return($Output); 165 165 } 166 166 } -
trunk/Modules/Team/Team.php
r636 r816 13 13 $this->Dependencies = array('User'); 14 14 } 15 15 16 16 function Start() 17 17 { 18 19 18 $this->System->RegisterPage('team', 'PageTeam'); 19 $this->System->RegisterMenuItem(array( 20 20 'Title' => T('Teams'), 21 'Hint' => T('List of translating teams'), 21 'Hint' => T('List of translating teams'), 22 22 'Link' => $this->System->Link('/team/'), 23 'Permission' => LICENCE_ANONYMOUS, 24 'Icon' => '', 23 'Permission' => LICENCE_ANONYMOUS, 24 'Icon' => '', 25 25 ), 1); 26 26 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) … … 34 34 class PageTeam extends Page 35 35 { 36 37 38 39 40 36 function ShowTeamList() 37 { 38 $this->Title = T('Teams'); 39 $Output = '<h3>'.T('List of translating teams').'</h3>'; 40 $Output .= 'Týmy jsou seskupení překladatelů, kteří se hlásí k něčemu společnému jako např. WoW serveru, způsobu překladu, ke stejnému hernímu spolku, aj. Být členem týmu samo o sobě nemá žádný zásadní důsledek a spíše to může pomoci se lépe orientovat mezi překladateli někomu, kdo sestavuje export.<br/>'; 41 41 42 42 if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 43 44 45 46 47 48 49 50 $SearchQuery = ' AND ((`Name` LIKE "%'.$_SESSION['search'].'%") OR (`Description` LIKE "%'.$_SESSION['search'].'%"))'; 51 52 } else $SearchQuery = ''; 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 $Output .= $Order['Output']; 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 43 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 44 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 45 46 if($this->System->User->Licence(LICENCE_USER)) 47 $Output .= '<br /><div style="text-align: center;"><a href="?action=create">'.T('Create translating team').'</a></div><br/>'; 48 if($_SESSION['search'] != '') 49 { 50 $SearchQuery = ' AND ((`Name` LIKE "%'.$_SESSION['search'].'%") OR (`Description` LIKE "%'.$_SESSION['search'].'%"))'; 51 $Output .= '<div><a href="?search=">'.sprintf(T('Disable filter "%s"'), $_SESSION['search']).'</a></div>'; 52 } else $SearchQuery = ''; 53 54 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE 1'.$SearchQuery); 55 $DbRow = $DbResult->fetch_row(); 56 $PageList = GetPageList($DbRow[0]); 57 58 $Output .= $PageList['Output']; 59 $Output .= '<table class="BaseTable">'; 60 61 $TableColumns = array( 62 array('Name' => 'Name', 'Title' => T('Name')), 63 array('Name' => 'URL', 'Title' => T('Web pages')), 64 array('Name' => 'LeaderName', 'Title' => T('Leader')), 65 array('Name' => 'NumberUser', 'Title' => T('Member count')), 66 array('Name' => 'TimeCreate', 'Title' => T('Founding date')), 67 ); 68 if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions')); 69 70 $Order = GetOrderTableHeader($TableColumns, 'NumberUser', 1); 71 $Output .= $Order['Output']; 72 73 $DbResult = $this->Database->query('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) AS `NumberUser`, '. 74 '(SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` '. 75 'FROM `Team` WHERE 1'.$SearchQuery.$Order['SQL'].$PageList['SQLLimit']); 76 while($Team = $DbResult->fetch_assoc()) 77 { 78 $Output .= '<tr>'. 79 '<td><a href="?action=team&id='.$Team['Id'].'">'.$Team['Name'].'</a></td>'. 80 '<td><a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a></td>'. 81 '<td><a href="'.$this->System->Link('/user.php?user='.$Team['Leader']).'">'.$Team['LeaderName'].'</a></td>'. 82 '<td><a href="'.$this->System->Link('/userlist.php?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'. 83 '<td>'.HumanDate($Team['TimeCreate']).'</td>'; 84 if($this->System->User->Licence(LICENCE_USER)) 85 { 86 if($Team['Leader'] == $this->System->User->Id) $Action = ' <a href="?action=modify&id='.$Team['Id'].'">Upravit</a>'; 87 else $Action = ''; 88 if($Team['Id'] == $this->System->User->Team) $Action = ' <a href="?action=leave">Opustit</a>'; 89 $Output .= '<td><a href="?action=gointeam&id='.$Team['Id'].'">Vstoupit</a>'.$Action.'</td>'; 90 } 91 $Output .= '</tr>'; 92 } 93 $Output .= '</table>'. 94 $PageList['Output']; 95 96 return($Output); 97 } 98 99 function TeamJoin() 100 { 101 if($this->System->User->Licence(LICENCE_USER)) 102 { 103 if(array_key_exists('id', $_GET)) 104 { 105 $this->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$this->System->User->Id); 106 $Output = ShowMessage('Vstoupil jsi do týmu.'); 107 $this->System->ModuleManager->Modules['Log']->WriteLog('Uživatel vstoupil do týmu '.$_GET['id'], LOG_TYPE_USER); 108 109 // Delete all teams without users 110 $this->Database->query('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0'); 111 112 // Set new leader for teams where old leader went to other team 113 $this->Database->query('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);'); 114 115 $Output .= $this->ShowTeamList(); 116 } else $Output = ShowMessage('Nutno zadat id týmu.', MESSAGE_CRITICAL); 117 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 118 return($Output); 119 } 120 121 function TeamCreateFinish() 122 { 123 $Output = ''; 124 if($this->System->User->Licence(LICENCE_USER)) 125 { 126 if(array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST)) 127 { 128 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"'); 129 $DbRow = $DbResult->fetch_row(); 130 $Count = $DbRow[0]; 131 if(($Count == 0) and ($_POST['Name'] != '')) 132 { 133 $this->Database->query('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`, `Leader`)'. 134 ' VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'. 135 $_POST['URL'].'", NOW(), '.$this->System->User->Id.')'); 136 $this->Database->query('UPDATE `User` SET `Team` = '.$this->Database->insert_id.' WHERE `ID` = '.$this->System->User->Id); 137 $Output .= ShowMessage('Překladatelský tým vytvořen.'); 138 $this->System->ModuleManager->Modules['Log']->WriteLog('Překladatelský tým vytvořen '.$_POST['Name'], LOG_TYPE_USER); 139 140 // Delete all teams without users 141 $this->Database->query('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0'); 142 } else $Output .= ShowMessage('Již existuje tým se stejným jménem', MESSAGE_CRITICAL); 143 } else $Output .= ShowMessage('Chybí údaje formuláře', MESSAGE_CRITICAL); 144 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 145 $Output .= $this->ShowTeamList(); 146 return($Output); 147 } 148 149 function TeamModify() 150 { 151 if($this->System->User->Licence(LICENCE_USER)) 152 { 153 if(array_key_exists('id', $_GET)) 154 { 155 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$this->System->User->Id); 156 if($DbResult->num_rows > 0) 157 { 158 $Team = $DbResult->fetch_assoc(); 159 $Output = '<form action="?action=finish_modify&id='.$_GET['id'].'" method="post">'. 160 '<fieldset><legend>Nastavení týmu</legend>'. 161 '<table><tr><td>Jméno:</td><td><input type="text" name="Name" value="'.$Team['Name'].'"/></td></tr>'. 162 '<tr><td>Webové stránky:</td><td>http://<input type="text" name="URL" value="'.$Team['URL'].'"/></td></tr>'. 163 '<tr><td>Popis:</td><td><input type="text" name="Description" value="'.$Team['Description'].'"/></td></tr>'. 164 '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'. 165 '</table></fieldset></form>'; 166 } else $Output = ShowMesage('Tým nenalezen.', MESSAGE_CRITICAL); 167 } else $Output = ShowMessage('Nezadáno id týmu', MESSAGE_CRITICAL); 168 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 169 return($Output); 170 } 171 172 function TeamModifyFinish() 173 { 174 $Output = ''; 175 if($this->System->User->Licence(LICENCE_USER)) 176 { 177 if(array_key_exists('id', $_GET) and array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST) and array_key_exists('URL', $_POST)) 178 { 179 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$this->System->User->Id); 180 if($DbResult->num_rows > 0) 181 { 182 $Team = $DbResult->fetch_assoc(); 183 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"'); 184 $DbRow = $DbResult->fetch_row(); 185 $Count = $DbRow[0]; 186 if(($Count == 0) and ($_POST['Name'] != '')) 187 { 188 $this->Database->query('UPDATE `Team` SET `Name`="'.$_POST['Name'].'", `Description`="'.$_POST['Description'].'", `URL`="'.$_POST['URL'].'" WHERE Id='.$Team['Id']); 189 $Output .= ShowMessage('Nastavení týmu uloženo.'); 190 $this->System->ModuleManager->Modules['Log']->WriteLog('Překladatelský tým upraven '.$_POST['Name'], LOG_TYPE_USER); 191 } else $Output .= ShowMessage('Již existuje tým se stejným jménem.', MESSAGE_CRITICAL); 192 } else $Output .= ShowMessage('Tým nenalezen nebo nemáte oprávnění.', MESSAGE_CRITICAL); 193 } else $Output .= ShowMessage('Nezadáno id týmu nebo některé položky formuláře.', MESSAGE_CRITICAL); 194 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 195 $Output .= $this->ShowTeamList(); 196 return($Output); 197 } 198 199 function TeamCreate() 200 { 201 if($this->System->User->Licence(LICENCE_USER)) 202 { 203 $Output ='<form action="?action=finish_create" method="post">'. 204 '<fieldset><legend>Vytvoření nového týmu</legend>'. 205 '<table><tr><td>Jméno:</td><td><input type="text" name="Name" /></td></tr>'. 206 '<tr><td>Webové stránky:</td><td>http://<input type="text" name="URL" value=""/></td></tr>'. 207 '<tr><td>Popis:</td><td><input type="text" name="Description" /></td></tr>'. 208 '<tr><td colspan="2"><input type="submit" value="Vytvořit a vstoupit" /></td></tr>'. 209 '</table></fieldset></form>'; 210 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 211 return($Output); 212 } 213 214 function TeamShow() 215 { 216 $Output = ''; 217 if(array_key_exists('id', $_GET) and is_numeric($_GET['id'])) 218 { 219 ImgLevelUpdate(); 220 221 $DbResult = $this->Database->query('SELECT `Id`, `Name`, `Description`, `URL`, `Leader`, '. 222 '(SELECT COUNT(*) FROM `User` WHERE '. 223 '`Team` = `Team`.`Id`) AS `NumberUser`, (SELECT SUM(`TranslatedCount`) FROM `User` WHERE '. 224 '`Team` = `Team`.`Id`) AS `NumberTranslate` FROM '. 225 '`Team` WHERE `Id`='.($_GET['id'] * 1)); 226 if($DbResult->num_rows > 0) 227 { 228 $Team = $DbResult->fetch_assoc(); 229 $DbResult2 = $this->Database->query('SELECT `Name`, `Id` FROM `User` WHERE `ID`='.$Team['Leader']); 230 if($DbResult2->num_rows > 0) 231 { 232 $Leader = $DbResult2->fetch_assoc(); 233 } else $Leader = array('Name' => '', 'Id' => 0); 234 235 $Output .='<strong>Překladatelský tým '.$Team['Name'].'</strong><br />'. 236 'Webové stránky: <a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a><br/>'. 237 'Vedoucí: <a href="'.$this->System->Link('/user.php?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>'. 238 'Popis: '.$Team['Description'].'<br /><br />'; 239 //$Output .= '<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> '; 240 if($this->System->User->Licence(LICENCE_USER)) 241 $Output .='<a href="?action=gointeam&id='.$Team['Id'].'">Vstoupit do týmu</a><br /><br />'; 242 $Output .='<fieldset><legend>Statistika</legend>'. 243 'Počet členů týmu: <a href="'.$this->System->Link('/userlist.php?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a><br />'. 244 'Počet přeložených textů týmu: <strong>'.$Team['NumberTranslate'].'</strong><br />'. 245 'Průměrná úroveň překladatelů v týmu: <img src="'.$this->System->Link('/tmp/team/'.$Team['Name'].'/level.png').'" /><br /><br />'. 246 '<strong>Stav dokončení týmu pro verzi '.$this->System->Config['Web']['GameVersion'].'</strong><br />'; 247 248 $BuildNumber = GetBuildNumber($this->System->Config['Web']['GameVersion']); 249 250 $GroupListQuery = 'SELECT `Group`.* FROM `Group`'; 251 $Query = ''; 252 $DbResult = $this->Database->query($GroupListQuery); 253 if($DbResult->num_rows > 0) 254 { 255 while($DbRow = $DbResult->fetch_assoc()) 256 { 257 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 258 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 259 'WHERE (`User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.$Team['Id'].')) '. 260 'AND (`Complete` = 1) AND (`T`.`Language`!='.$this->System->Config['OriginalLanguage'].') '. 261 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 262 ') AS `C1`) AS `Translated`, '. 263 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 264 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 265 'WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') '. 266 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 267 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; 268 } 269 $Query = substr($Query, 0, - 6); 270 271 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`'); 272 $DbRow = $DbResult->fetch_row(); 273 $PageList = GetPageList($DbRow[0]); 274 $Output .= $PageList['Output']; 275 276 $Output .='<table class="BaseTable">'; 277 $TableColumns = array( 278 array('Name' => 'Name', 'Title' => 'Jméno'), 279 array('Name' => 'Translated', 'Title' => 'Přeložených'), 280 array('Name' => 'Total', 'Title' => 'Anglických'), 281 array('Name' => 'Percent', 'Title' => 'Procenta'), 282 ); 283 284 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 285 $Output .= $Order['Output']; 286 287 $Translated = 0; 288 $Total = 0; 289 $DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 290 while($Group = $DbResult->fetch_assoc()) 291 { 292 $Output .='<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; 293 $Translated += $Group['Translated']; 294 $Total += $Group['Total']; 295 } 296 if($Total > 0) $Progress = round($Translated / $Total * 100, 2); 297 else $Progress = 0; 298 $Output .='<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $Progress).'</strong></td></tr>'; 299 $Output .='</table>'; 300 } 301 $Output .='</fieldset>'; 302 } else $Output .= ShowMessage('Tým nenalezen', MESSAGE_CRITICAL); 303 } else $Output .= ShowMessage('Musíte zadat id týmu', MESSAGE_CRITICAL); 304 return($Output); 305 } 306 307 function TeamLeave() 308 { 309 if($this->System->User->Licence(LICENCE_USER)) 310 { 311 $this->Database->query('UPDATE `User` SET `Team` = NULL WHERE `ID` = '.$this->System->User->Id); 312 $Output = ShowMessage('Nyní nejste členem žádného týmu.'); 313 $this->System->ModuleManager->Modules['Log']->WriteLog('Uživatel vystoupil z týmu', LOG_TYPE_USER); 314 315 // Delete all teams without users 316 $this->Database->query('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0'); 317 318 // Set new leader for teams where old leader went to other team 319 $this->Database->query('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);'); 320 321 $Output .= $this->ShowTeamList(); 322 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 323 return($Output); 324 } 325 326 function Show() 327 { 328 if(array_key_exists('action', $_GET)) 329 { 330 if($_GET['action'] == 'gointeam') $Output = $this->TeamJoin(); 331 else if($_GET['action'] == 'finish_create') $Output = $this->TeamCreateFinish(); 332 else if($_GET['action'] == 'modify') $Output = $this->TeamModify(); 333 else if($_GET['action'] == 'finish_modify') $Output = $this->TeamModifyFinish(); 334 else if($_GET['action'] == 'create') $Output = $this->TeamCreate(); 335 else if($_GET['action'] == 'team') $Output = $this->TeamShow(); 336 else if($_GET['action'] == 'leave') $Output = $this->TeamLeave(); 337 else $Output = $this->ShowTeamList(); 338 } else $Output = $this->ShowTeamList(); 339 return($Output); 340 } 341 341 } -
trunk/Modules/Translation/Comparison.php
r752 r816 3 3 class PageTranslationComparison extends Page 4 4 { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 5 function CompareString($String1, $String2) 6 { 7 $Result = ''; 8 //TODO: Implement colored comparison 9 //strcasecmp($String1, $String2) == 0 je totožné 10 // echo $String1.'<br /><br />'; 11 $ArrStr1 = explode(' ', $String1); 12 $ArrStr2 = explode(' ', $String2); 13 14 for($i = 0; $i < count($ArrStr1); $i++) 15 { 16 if(isset($ArrStr2[$i])) 17 { 18 if($ArrStr1[$i] == $ArrStr2[$i]) 19 { 20 $Result .= $ArrStr1[$i].' '; 21 } else 22 { 23 $find = false; 24 for($j = 0; $j < count($ArrStr2); $j++) 25 { 26 if(($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false)) 27 { 28 $Result .= $ArrStr1[$i].' '; 29 $find = true; 30 } 31 } 32 if($find == false) 33 $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>'; 34 } 35 } else $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>'; 36 } 37 return($Result); 38 } 39 40 function Show() 41 { 42 global $TranslationTree; 43 44 44 $Output = ''; 45 45 46 47 46 if($this->System->User->Licence(LICENCE_USER)) 47 { 48 48 $Output = 'Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span class="edit">barvou.</span><br /><br />'; 49 50 $GroupId = LoadGroupIdParameter();51 $Table = $TranslationTree[$GroupId]['TablePrefix'];52 53 if(array_key_exists('entry', $_GET))54 {55 $Textentry = $_GET['entry'];56 if((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů57 {58 $TextID1 = $_GET['ID1'];59 $TextID2 = $_GET['ID2'];60 $WhereID = ' AND ((`'.$Table.'`.`ID` = '.$TextID1.') OR (`'.$Table.'`.`ID` = '.$TextID2.'))';61 } else $WhereID = '';62 63 $DataID = $this->Database->query('SELECT `'.$Table.'`.*, `User`.`Name` AS `UserName`, '.64 '`Language`.`Name` AS `LanguageName` '.65 'FROM '.$Table.' LEFT JOIN `User` ON `User`.`Id` = `'.$Table.'`.`User` '.66 ' LEFT JOIN `Language` ON `Language`.`Id` = `'.$Table.'`.`Language` '.67 'WHERE `Entry` = '.$Textentry.' '.$WhereID.' ORDER BY `Language`');68 while($Line[] = $DataID->fetch_assoc());69 array_pop($Line);70 71 $Output .= 'Počet porovnávaných textů: <strong>'.count($Line).'</strong><br /> ';72 73 $Output .= '<strong>Číslo textu: <a href="http://www.wowhead.com/?quest='.$Textentry.'">'.$Textentry.'</a></strong>'.74 '<table class="BaseTable">'.75 '<tr><th>Přeložil</th>';76 foreach($Line as $Index => $LineItem)77 $Output .= '<th>'.$LineItem['UserName'].'</th>';78 $Output .= '</tr>'.79 '<tr>'.80 '<th>ID textu</th>';81 foreach($Line as $Index => $LineItem)82 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>';83 $Output .= '</tr>'.84 '<tr><th>Převzato</th>';85 foreach($Line as $Index => $LineItem)86 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>';87 $Output .= '</tr>'.88 '<tr><th>Jazyk</th>';89 foreach($Line as $Index => $LineItem)90 $Output .= '<td>'.$LineItem['LanguageName'].'</td>';91 $Output .= '</tr>'.92 '<tr><th>Verze</th>';93 foreach($Line as $Index => $LineItem)94 $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>';95 $Output .= '</tr>';96 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)97 {98 $writethis = false;99 for($i = 0; $i < count($Line); $i++)100 {101 if($Line[$i][$TextItem['Column']] <> '') $writethis = true;102 }103 if($writethis)104 {105 $Output .= '<tr><th>'.$TextItem['Name'].'</th>';106 for($i = 0; $i < count($Line); $i++)107 {108 if($i > 0)109 {110 $Output .= '<td>';111 $Output .= str_replace("\n", '<br/>', $this->CompareString(htmlspecialchars($Line[$i][$TextItem['Column']]),htmlspecialchars($Line[$i - 1][$TextItem['Column']])));112 $Output .= '</td>';113 } else $Output .= '<td>'.htmlspecialchars($Line[$i][$TextItem['Column']]).'</td>';114 }115 $Output .= '</tr>';116 }117 }118 $Output .= '</table>';119 } else $Output .= ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL);120 } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL);121 49 122 return($Output); 123 } 50 $GroupId = LoadGroupIdParameter(); 51 $Table = $TranslationTree[$GroupId]['TablePrefix']; 52 53 if(array_key_exists('entry', $_GET)) 54 { 55 $Textentry = $_GET['entry']; 56 if((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů 57 { 58 $TextID1 = $_GET['ID1']; 59 $TextID2 = $_GET['ID2']; 60 $WhereID = ' AND ((`'.$Table.'`.`ID` = '.$TextID1.') OR (`'.$Table.'`.`ID` = '.$TextID2.'))'; 61 } else $WhereID = ''; 62 63 $DataID = $this->Database->query('SELECT `'.$Table.'`.*, `User`.`Name` AS `UserName`, '. 64 '`Language`.`Name` AS `LanguageName` '. 65 'FROM '.$Table.' LEFT JOIN `User` ON `User`.`Id` = `'.$Table.'`.`User` '. 66 ' LEFT JOIN `Language` ON `Language`.`Id` = `'.$Table.'`.`Language` '. 67 'WHERE `Entry` = '.$Textentry.' '.$WhereID.' ORDER BY `Language`'); 68 while($Line[] = $DataID->fetch_assoc()); 69 array_pop($Line); 70 71 $Output .= 'Počet porovnávaných textů: <strong>'.count($Line).'</strong><br /> '; 72 73 $Output .= '<strong>Číslo textu: <a href="http://www.wowhead.com/?quest='.$Textentry.'">'.$Textentry.'</a></strong>'. 74 '<table class="BaseTable">'. 75 '<tr><th>Přeložil</th>'; 76 foreach($Line as $Index => $LineItem) 77 $Output .= '<th>'.$LineItem['UserName'].'</th>'; 78 $Output .= '</tr>'. 79 '<tr>'. 80 '<th>ID textu</th>'; 81 foreach($Line as $Index => $LineItem) 82 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>'; 83 $Output .= '</tr>'. 84 '<tr><th>Převzato</th>'; 85 foreach($Line as $Index => $LineItem) 86 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>'; 87 $Output .= '</tr>'. 88 '<tr><th>Jazyk</th>'; 89 foreach($Line as $Index => $LineItem) 90 $Output .= '<td>'.$LineItem['LanguageName'].'</td>'; 91 $Output .= '</tr>'. 92 '<tr><th>Verze</th>'; 93 foreach($Line as $Index => $LineItem) 94 $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>'; 95 $Output .= '</tr>'; 96 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 97 { 98 $writethis = false; 99 for($i = 0; $i < count($Line); $i++) 100 { 101 if($Line[$i][$TextItem['Column']] <> '') $writethis = true; 102 } 103 if($writethis) 104 { 105 $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 106 for($i = 0; $i < count($Line); $i++) 107 { 108 if($i > 0) 109 { 110 $Output .= '<td>'; 111 $Output .= str_replace("\n", '<br/>', $this->CompareString(htmlspecialchars($Line[$i][$TextItem['Column']]),htmlspecialchars($Line[$i - 1][$TextItem['Column']]))); 112 $Output .= '</td>'; 113 } else $Output .= '<td>'.htmlspecialchars($Line[$i][$TextItem['Column']]).'</td>'; 114 } 115 $Output .= '</tr>'; 116 } 117 } 118 $Output .= '</table>'; 119 } else $Output .= ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 120 } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL); 121 122 return($Output); 123 } 124 124 } -
trunk/Modules/Translation/Form.php
r813 r816 6 6 var $ID; 7 7 8 9 10 11 8 function Show() 9 { 10 $this->Title = T('Translation'); 11 $Action = ''; 12 12 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 13 13 14 14 if($Action == 'delete') $Output = $this->Delete(); 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 15 else $Output = $this->ShowForm(); 16 return($Output); 17 } 18 19 function ShowForm() 20 { 21 global $TranslationTree; 22 23 $Output = ''; 24 25 $GroupId = LoadGroupIdParameter(); 26 $this->GroupId = $GroupId; 27 $Table = $TranslationTree[$GroupId]['TablePrefix']; 28 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 29 else $Action = ''; 30 31 if(array_key_exists('ID', $_GET)) 32 { 33 $TextID = $_GET['ID'] * 1; 34 $this->ID = $TextID; 35 36 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID); 37 $Line = $DbResult->fetch_assoc(); 38 if(!$Line) 39 { 40 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL); 41 } else 42 { 43 if ($this->System->Config['OriginalLanguage'] == $Line['Language']){ 44 44 $LineAJ = $Line; 45 45 … … 51 51 52 52 53 53 $sql = 'SELECT '.$Columns.' Tran.`Entry` FROM `'.$Table.'` as Tran'; 54 54 $join = ' JOIN `'.$Table.'` as `Orig` ON `Orig`.`Language` = 0 AND `Tran`.`Entry` = `Orig`.`Entry` AND `Tran`.`VersionEnd` = `Orig`.`VersionEnd` '; 55 55 $where = ' WHERE '.'( `Tran`.'.$Language.' ) AND '.'(`Tran`.`Entry` = '.$Line['Entry'].') ORDER BY `Tran`.`ModifyTime` DESC'; 56 56 $DbResult = $this->Database->query($sql.$join.$where); 57 57 while ($LineSearch = $DbResult->fetch_assoc()) { 58 59 60 58 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 59 if($TextItem['Visible'] == 1) 60 if (($LineAJ[$TextItem['Column']] <> '') and 61 61 ($LineSearch[$TextItem['Column']] <> '') and 62 62 ($LineSearch['Orig_'.$TextItem['Column']] <> $LineSearch[$TextItem['Column']]) and … … 65 65 { 66 66 $Line[$TextItem['Column']] = $LineSearch[$TextItem['Column']]; 67 67 // echo $Line[$TextItem['Column']].'<br />'; 68 68 } 69 69 } 70 70 71 71 } else { 72 73 74 75 72 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE '. 73 '(`Language` = '.$this->System->Config['OriginalLanguage'].') AND '. 74 '(`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1'); 75 $LineAJ = $DbResult->fetch_assoc(); 76 76 } 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 77 if(!$LineAJ) 78 { 79 $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); 80 } else 81 { 82 83 if($Line['User'] != '') 84 { 85 $IDUser = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); 86 $LineUser = $IDUser->fetch_array(); 87 } else 88 $LineUser = array('Name' => ''); 89 90 $Output .= 'Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'; 91 92 if(($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 93 $Output .= 'Přeložil: <strong>'.$LineUser['Name'].'</strong> dne '.HumanDate($Line['ModifyTime']).'<br />'; 94 if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID'])) 95 { 96 $DbResult = $this->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']); 97 $Language = $DbResult->fetch_assoc(); 98 // echo $Language['Language'].' '.$Line['Take']; 99 100 $DbResult = $this->Database->query('SELECT `Name` FROM `Language` WHERE `Id` ='.$Language['Language']); 101 $Lang = $DbResult->fetch_assoc(); 102 103 $Output .= 'Původní text: <strong>'. 104 ' ID <a href="form.php?group='.$GroupId.'&ID='.$Line['Take'].'">'.$Line['Take'].'</a></strong>'. 105 ' ('.$Lang['Name'].')'. 106 ' <br />'; 107 } 108 $Output .= 'Text: '; 109 if($Line['Language'] <> 0) 110 { 111 if($Line['Complete'] == 1) $Output .= ' <b>Hotov</b>'; 112 else $Output .= ' <b> Uložen v rozepsaných</b> '; 113 } else $Output .= ' <b>Anglická, původní verze</b> '; 114 115 $Output .= '<br />'. 116 'Verze: <b><a href="'.$this->System->Link('/client-version/?action=item&id='.GetVersionWOWId($Line['VersionStart'])).'">'.GetVersionWOW($Line['VersionStart']). 117 117 '</a> - <a href="'.$this->System->Link('/client-version/?action=item&id='.GetVersionWOWId($Line['VersionEnd'])).'">'.GetVersionWOW($Line['VersionEnd']).'</a></b>'. 118 119 120 121 122 123 124 125 126 127 128 129 130 118 '<br />'; 119 120 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `'.$Table.'` WHERE '. 121 '(`Entry` = '.$Line['Entry'].')'); 122 $Version = $DbResult->fetch_row(); 123 $Version = $Version[0]; 124 if($Version > 0) 125 { 126 $Output .= '<form action="comparison.php" method="get"><a href="TranslationList.php?group='. 127 $GroupId.'&user=0&state=2&entry='.$Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a> 128 <input type="hidden" name="group" value="'.$GroupId.'" /> 129 <input type="hidden" name="entry" value="'.$Line['Entry'].'" /> 130 <input type="hidden" name="ID2" value="'.$TextID.'" />'; 131 131 132 132 if($this->System->User->Licence(LICENCE_USER)) { //allow to compare only to user 133 133 $Output .= '<select onchange="this.form.submit();" name="ID1"> 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 134 <option value="-1">Vyberte text k porovnání</option> 135 <option value="-1">Zobrazit/porovnat všechny</option>'; 136 $DataID = $this->Database->query('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].')'); 137 while($Version = $DataID->fetch_array()) 138 { 139 if($Version['ID'] == $Line['Take']) $Output .= '<option value="'. 140 $Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' (převzato)</option>'; 141 else 142 { 143 if($Version['Language'] == 0) $Version['UserName'] = 'Předloha'; 144 $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '. 145 $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '. 146 GetVersionWOW($Version['VersionEnd']).')</option>'; 147 } 148 } 149 $Output .= '</select>'; 150 150 } 151 151 $Output .= '</form>'; 152 153 154 155 156 157 158 159 160 161 162 163 //if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 152 } else 153 { 154 $Output .= '<a href="TranslationList.php?group='.$GroupId.'&user=0&state=2&entry='. 155 $Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a>'; 156 } 157 158 // Special characters: $B - New line, $N - Name, $C - profession 159 if($this->System->User->Licence(LICENCE_USER)) 160 { 161 $Output .= '<form action="save.php?group='.$GroupId.'" method="post"><div>'; 162 // TODO: Remove fixed group id condition 163 // if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 164 $Output .= '<a href="'.$this->System->Link('/dictionary/?action=group&group='.$GroupId.'&ID='.$LineAJ['ID']).'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">Vyhledat v názvech</a>'; 165 $Output .= ' <input type="submit" value="Uložit do rozepsaných" name="save" title="Klikněte na uložit pro pozdější dokončení překladu" />'. 166 '<input type="submit" value="Dokončeno" name="End" title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat" /> '; 167 FollowingTran($TextID, $Table, $GroupId, true); 168 FollowingTran($TextID, $Table, $GroupId); 169 } 170 171 if($TranslationTree[$GroupId]['WowheadName'] != '') 172 $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName'].'='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>'; 173 else $WowheadLink = $LineAJ['Entry']; 174 175 $Output .= '<input type="hidden" name="entry" value="'.$LineAJ['Entry'].'" /> 176 <input type="hidden" name="user" value="'.$this->System->User->Id.'" /> 177 <input type="hidden" name="ID" value="'.$TextID.'" /> 178 <table class="BaseTable"> 179 <tr> 180 <th>Číslo textu: '.$WowheadLink.'</th> 181 <th>Nepřeložené</th> 182 <th>Přeložené</th> 183 </tr> 184 <tr> 185 <th>Jazyk</th> 186 <td>Anglický</td> 187 <td>'; 188 if($Line['Language'] <> 0) $Language = $Line['Language']; 189 else if($this->System->User->Id != 0) 190 { 191 $Language = $this->System->User->Language; 192 } else $Language = 0; 193 if($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language); 194 else { 195 $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '(`Enabled` = 1) AND (`Id`='.$Language.')'); 196 if($DbResult3->num_rows > 0) 197 { 198 $Language = $DbResult3->fetch_assoc(); 199 $Output .= $Language['Name']; 200 } 201 } 202 203 $Output .= '</td></tr>'; 204 204 205 205 //todo javascript 206 206 207 207 $Output .= '<script src="http://code.jquery.com/jquery-latest.js"></script>'. 208 208 '<script>'; 209 209 $Output .= '$(document).ready(function() {'; 210 210 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 211 211 $Output .= '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");'; 212 212 … … 214 214 '</script>'; 215 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 216 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 217 if($TextItem['Visible'] == 1) 218 { 219 if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 220 { 221 if(($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings'))) 222 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>'; 223 else $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 224 $Output .= '<td id="'.$TextItem['Column'].'">'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td> 225 <td>'; 226 if($this->System->User->Licence(LICENCE_USER)) 227 $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 228 $Output .= htmlspecialchars($Line[$TextItem['Column']]); 229 if($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>'; 230 } 231 } else 232 { 233 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Line[$TextItem['Column']]).'" />'; 234 } 235 $Output .= '</table></div>'; 236 if($this->System->User->Licence(LICENCE_USER)) { 237 237 $Output .= '</form>'; 238 238 239 239 $Output .= '<table class="BaseTable">'. 240 241 242 243 240 '<tr><th>Překladač:</th><th>Nepřeložené</th><th>Přeložené</th>'; 241 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 242 if($TextItem['Visible'] == 1) 243 if ($LineAJ[$TextItem['Column']] <> '') 244 244 $Output .= '<tr><td>'.$TextItem['Column'].'</td><td>'.$LineAJ[$TextItem['Column']].'</td><td>'.GetTranslateGoogle($LineAJ[$TextItem['Column']]).'</td></tr>'; 245 245 … … 247 247 $Output .= '</table>'; 248 248 } 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 249 } 250 } 251 } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 252 return($Output); 253 } 254 255 function Delete() 256 { 257 global $TranslationTree; 258 259 if($this->System->User->Licence(LICENCE_MODERATOR)) 260 { 261 $GroupId = LoadGroupIdParameter(); 262 $this->GroupId = $GroupId; 263 $Table = $TranslationTree[$GroupId]['TablePrefix']; 264 $TextID = $_GET['ID']; 265 $this->Database->query('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> '.$this->System->Config['OriginalLanguage']); 266 $Output = ShowMessage('Překlad byl smazán.'); 267 $this->System->ModuleManager->Modules['Log']->WriteLog('Překlad byl smazán! <a href="'.$this->System->Link('/form.php?group='.$this->GroupId.'&ID='.$TextID).'">'.$TextID.'</a>', LOG_TYPE_MODERATOR); 268 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 269 return($Output); 270 } 271 271 } -
trunk/Modules/Translation/LoadNames.php
r806 r816 3 3 class PageLoadNames extends Page 4 4 { 5 function ReplaceTranslated($orig,$tran,$Text,$ID,$Group) 5 function ReplaceTranslated($orig,$tran,$Text,$ID,$Group) 6 6 { 7 7 $tran_replace = str_replace(' ',' ',htmlspecialchars($tran)); … … 9 9 10 10 // if (strlen($orig) < strlen($Text)-1) { 11 if ($Group <> '') 11 if ($Group <> '') 12 12 { 13 13 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace. 14 14 '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 15 } else { 15 } else { 16 16 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace. 17 17 '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/dictionary/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text); 18 18 } 19 //}19 // } 20 20 return ($Text); 21 21 } 22 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) 22 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) 23 23 { 24 24 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 25 25 26 26 $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'. 27 27 $this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 28 28 return ($Text); 29 29 } 30 31 32 30 31 function ColorNames($Text, $names) 32 { 33 33 $Text = ' '.$Text; 34 34 $Text = str_replace('$B$B','$B$B ',$Text); 35 36 37 38 39 40 41 42 43 44 45 46 47 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 35 36 $Text = str_replace('$B','<span Title="Znamená odřádkování, překladu zachovej na stejné pozici." class="edit">$B</span>',$Text); 37 $Text = str_replace('$N','<span Title="Znamená jméno hráče, překladu zachovej na stejné pozici." class="edit">$N</span>',$Text); 38 $Text = str_replace('$R','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text); 39 $Text = str_replace('$C','<span Title="Znamená povolání hráče, překladu zachovej na stejné pozici." class="edit">$C</span>',$Text); 40 $Text = str_replace('$G','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text); 41 $Text = str_replace('$b','<span Title="Znamená odřádkování, překladu zachovej na stejné pozici." class="edit">$B</span>',$Text); 42 $Text = str_replace('$n','<span Title="Znamená jméno hráče, překladu zachovej na stejné pozici." class="edit">$N</span>',$Text); 43 $Text = str_replace('$c','<span Title="Znamená povolání hráče, překladu zachovej na stejné pozici." class="edit">$c</span>',$Text); 44 $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text); 45 $Text = str_replace('$g','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text); 46 foreach($names as $Line) { 47 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 48 48 if ($Line[3] <> '') { 49 49 $Text = $this->ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 50 51 50 51 } else { 52 52 $Text = $this->ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 53 54 55 56 } 53 } 54 } 55 return $Text; 56 } 57 57 58 function LoadNames() 58 function LoadNames() 59 59 { 60 60 global $TranslationTree; 61 61 62 62 $Output = ''; 63 63 if(array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId']; … … 71 71 //$Text = $LineAJ[$TranslationTree[$GroupId]['Items'][$_GET['Item']]]; 72 72 $Text = $LineAJ[$Column]; 73 74 75 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 73 $names = array(); 74 if ($this->System->User->Licence(LICENCE_USER)) 75 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 76 76 { 77 78 79 80 81 77 //<span class="edit">barvou.</span> 78 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); 79 } else { 80 if(($GroupId == 13)) { 81 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 'TextGlobalString' => 'Text', 'TextArea' => 'Name', 'TextItemSubClass' => 'Name', 'TextCharacterRace' => 'Name1',),false); 82 82 } else { 83 84 85 86 87 83 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); 84 } 85 } 86 //$LineAJ[$Column] 87 return ($this->ColorNames(htmlspecialchars($Text),$names)); 88 88 } 89 89 90 90 function Show() 91 91 { 92 92 $this->RawPage = true; 93 93 return(str_replace("\n", '<br/>', $this->LoadNames())); 94 94 } -
trunk/Modules/Translation/Progress.php
r793 r816 6 6 { 7 7 $Output = ''; 8 8 9 9 $BuildNumber = GetBuildNumber($_SESSION['StatVersion']); 10 10 if(is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')'; 11 11 else $LanguageFilter = ' AND (`Language`!='.$this->System->Config['OriginalLanguage'].')'; 12 12 13 13 $GroupListQuery = 'SELECT `Id`, `TablePrefix`, `Name` FROM `Group`'; 14 14 $Query = ''; … … 30 30 } 31 31 $Query = substr($Query, 0, - 6); 32 32 33 33 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`'); 34 34 $DbRow = $DbResult->fetch_row(); 35 35 $PageList = GetPageList($DbRow[0]); 36 36 $Output .= $PageList['Output']; 37 37 38 38 $Output .= '<table class="BaseTable">'; 39 39 $TableColumns = array( … … 43 43 array('Name' => 'Percent', 'Title' => 'Procenta'), 44 44 ); 45 45 46 46 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 47 47 $Output .= $Order['Output']; 48 48 49 49 $Translated = 0; 50 50 $Total = 0; … … 62 62 } 63 63 return($Output); 64 } 64 } 65 65 66 66 function Show() 67 67 { 68 68 $this->Title = T('Progress'); 69 69 $LanguageList = GetLanguageList(); 70 70 71 71 if(array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version']; 72 if(!array_key_exists('StatVersion', $_SESSION)) 73 { 72 if(!array_key_exists('StatVersion', $_SESSION)) 73 { 74 74 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != '')) 75 75 { 76 76 $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame; 77 77 } else 78 78 $_SESSION['StatVersion'] = $this->System->Config['Web']['GameVersion']; 79 } 79 } 80 80 81 81 if(!isset($_SESSION['language'])) 82 82 { 83 84 85 83 if($this->System->User->Licence(LICENCE_USER)) 84 { 85 $_SESSION['language'] = $this->System->User->Language; 86 86 } else $_SESSION['language'] = ''; 87 87 } 88 88 if(array_key_exists('language', $_GET)) { 89 89 if($_GET['language'] == '') $_SESSION['language'] = ''; 90 91 92 90 else { 91 $_SESSION['language'] = $_GET['language'] * 1; 92 } 93 93 } 94 94 if(!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = ''; … … 109 109 if($Language['Enabled'] == 1) 110 110 { 111 111 $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>'; 112 112 if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> '; 113 113 else $Output .= $Lang; -
trunk/Modules/Translation/Save.php
r800 r816 5 5 function Show() 6 6 { 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 //JOIN `TextSpell` as sub1 ON sub1.Language = 0 AND T.`Entry` = sub1.`Entry` AND T.`VersionStart` = sub1.`VersionStart` 7 global $TranslationTree, $Message, $MessageType; 8 9 $Output = ''; 10 $CompleteText = array('nedokončený', 'dokončený'); 11 12 unset($Message); 13 $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm(); 14 if(isset($Message)) $Output .= ShowMessage($Message, $MessageType); 15 16 $GroupId = LoadGroupIdParameter(); 17 $Group = $TranslationTree[$GroupId]; 18 $Table = $Group['TablePrefix']; 19 if($this->System->User->Licence(LICENCE_USER)) 20 { 21 if(array_key_exists('ID', $_POST) and is_numeric($_POST['ID'])) 22 { 23 $Entry = $_POST['entry'] * 1; 24 $TextID = $_POST['ID'] * 1; 25 $Language = $_POST['Language'] * 1; 26 if(array_key_exists('End', $_POST)) $Complete = 1; 27 else $Complete = 0; 28 29 // Get source text record from database by ID 30 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID`='.$TextID); 31 if($DbResult->num_rows > 0) 32 { 33 $SourceText = $DbResult->fetch_assoc(); 34 35 // Get data for english original 36 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Entry`='.$SourceText['Entry'].') '. 37 'AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '. 38 'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')'); 39 if($DbResult->num_rows > 0) 40 { 41 $EnglishText = $DbResult->fetch_assoc(); 42 43 // Get all similar english texts 44 $Filter = ''; 45 foreach($Group['Items'] as $GroupItem) 46 if(($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != '')) 47 $Filter .= ' OR (`'.$GroupItem['Column'].'` = "'.addslashes($EnglishText[$GroupItem['Column']]).'")'; 48 if(substr($Filter, 0, 3) == ' OR') $Filter = ' AND ('.substr($Filter, 3).')'; 49 50 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter); 51 while($EnglishFound = $DbResult->fetch_assoc()) 52 { 53 // Get user translation paired to found english item entry 54 //TODO: and need update sql 55 //SELECT T.ID,T.Take,sub1.ID,T.`VersionStart`,T.`VersionEnd`,sub1.`VersionStart` as OrigStart,sub1.`VersionEnd` as OrigEnd FROM `TextSpell` as T 56 //JOIN `TextSpell` as sub1 ON sub1.Language = 0 AND T.`Entry` = sub1.`Entry` AND T.`VersionStart` = sub1.`VersionStart` 57 57 //WHERE T.Language != 0 AND T.`VersionEnd` != sub1.`VersionEnd` 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 58 $DbResult2 = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`User` = '.$this->System->User->Id. 59 ') AND (`Entry` = '.$EnglishFound['Entry'].') AND (`VersionStart` = '.$EnglishFound['VersionStart']. 60 ') AND (`VersionEnd` = '.$EnglishFound['VersionEnd'].')'); 61 if($DbResult2->num_rows > 0) 62 { 63 // Update existed user translation 64 $ExistedText = $DbResult2->fetch_assoc(); 65 $Values = '`Language` = '.$Language; 66 67 $UpdateModifyTime = false; 68 $Completable = true; 69 $CompleteParts = $ExistedText['CompleteParts']; 70 foreach($Group['Items'] as $GroupItem) 71 { 72 if($GroupItem['Visible'] == 1) 73 { 74 if($SourceText[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']]) 75 $UpdateModifyTime = true; 76 77 if($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']]) 78 { 79 if(array_key_exists($GroupItem['Column'], $_POST)) 80 { 81 $Values .= ', `'.$GroupItem['Column'].'` = "'.$_POST[$GroupItem['Column']].'"'; 82 $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); 83 } 84 } 85 if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and 86 ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 87 } 88 } 89 if($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 90 else $NewComplete = 0; 91 if($SourceText['ID'] == $ExistedText['ID']) 92 { 93 $NewComplete = $Complete; // Our original user text, set complete according user choice 94 if($Complete == 1) 95 { 96 foreach($Group['Items'] as $GroupItem) 97 if($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); 98 } 99 } 100 $Values .= ', `Complete`='.$NewComplete.', `CompleteParts` = '.$CompleteParts; 101 102 if($UpdateModifyTime) $Values .= ', `ModifyTime` = NOW()'; 103 104 // Update user translation 105 $this->Database->query('UPDATE `'.$Table.'` SET '.$Values.' WHERE `ID` = '.$ExistedText['ID']); 106 107 $Output .= 'Změny v překladu <a href="'.$this->System->Link('/form.php?group='. 108 $GroupId.'&ID='.$ExistedText['ID']).'">'.$ExistedText['ID'].'</a> ('. 109 $ExistedText['Entry'].') uloženy jako '.$CompleteText[$NewComplete].'.<br />'; 110 $this->System->ModuleManager->Modules['Log']->WriteLog('Změny v překladu <a href="'. 111 $this->System->Link('/form.php?group='.$GroupId.'&ID='.$ExistedText['ID']).'">'. 112 $ExistedText['ID'].'</a> ('.$ExistedText['Entry'].') uloženy jako '.$CompleteText[$NewComplete].'.', LOG_TYPE_TRANSLATION); 113 } else 114 { 115 // Insert new user translation 116 $Columns = '`Entry`, `VersionStart`, `VersionEnd`, `Language`, `User`, `Take`, `ModifyTime`'; 117 $Values = $EnglishFound['Entry'].', '.$EnglishFound['VersionStart'].', '. 118 $EnglishFound['VersionEnd'].', '.$Language.', '.$this->System->User->Id.', '.$EnglishFound['ID'].', NOW()'; 119 120 $CompleteParts = 0; 121 $Completable = true; 122 122 $OnlyRank = true; 123 124 125 126 127 128 129 130 131 132 133 if (44 <> $GroupItem['Id']) $OnlyRank = false; 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 if (!$OnlyRank) 160 { 161 162 163 164 165 166 167 168 169 170 171 172 173 174 } 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 }244 return($Output); 123 foreach($Group['Items'] as $GroupItem) 124 { 125 $Columns .= ', `'.$GroupItem['Column'].'`'; 126 if($GroupItem['Visible'] == 1) 127 { 128 if($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']]) 129 { 130 // Read form user data 131 if(array_key_exists($GroupItem['Column'], $_POST)) 132 { 133 if (44 <> $GroupItem['Id']) $OnlyRank = false; 134 $Values .= ', "'.$_POST[$GroupItem['Column']].'"'; 135 $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); 136 } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"'; 137 } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"'; 138 if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 139 } else 140 { 141 // Read from english text 142 $Values .= ', "'.$EnglishFound[$GroupItem['Column']].'"'; 143 } 144 } 145 if($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 146 else $NewComplete = 0; 147 if($SourceText['ID'] == $EnglishFound['ID']) 148 { 149 $NewComplete = $Complete; // Our original user text, set complete according user choice 150 if($Complete == 1) 151 { 152 foreach($Group['Items'] as $GroupItem) 153 if($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); 154 } 155 } 156 $Columns .= ', `Complete`, `CompleteParts`'; 157 $Values .= ', '.$NewComplete.', '.$CompleteParts; 158 159 if (!$OnlyRank) 160 { 161 $this->Database->query('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')'); 162 $LastID = $this->Database->insert_id; 163 164 $Output .= 'Text <a href="'.$this->System->Link('/form.php?group='. 165 $GroupId.'&ID='.$LastID).'">'.$LastID.'</a> ze skupiny <a href="TranslationList.php?group='. 166 $GroupId.'&user=0&action=filter">'.$TranslationTree[$GroupId]['Name'].'</a> uložen jako '. 167 $CompleteText[$NewComplete].'. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.<br/>'; 168 $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="'. 169 $this->System->Link('/form.php?group='.$GroupId.'&ID='.$LastID).'">'. 170 $LastID.'</a> ze skupiny <a href="TranslationList.php?group='. 171 $GroupId.'&user=0&text=&entry=&action=filter">'. 172 $TranslationTree[$GroupId]['Name'].'</a> uložen jako '.$CompleteText[$NewComplete]. 173 '. Převzat z <a href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a>.', LOG_TYPE_TRANSLATION); 174 } 175 } 176 } 177 } else $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); 178 } else $Output .= ShowMessage('Zadaná položka nenalezena.', MESSAGE_CRITICAL); 179 180 181 // Address and redirecting 182 $Output .= '<br />Překládat: <a href="TranslationList.php?group='.$GroupId.'&state=1&user=0&entry=">Nepřeložené</a> '; 183 184 $prev = FollowingTran($TextID, $Table, $GroupId, True); 185 $next = FollowingTran($TextID, $Table, $GroupId); 186 $Output .= '<br /><br />'; 187 $DbResult = $this->Database->query('SELECT `Redirecting` FROM `User` WHERE `ID`='.$this->System->User->Id); 188 $redirecting = $DbResult->fetch_assoc(); 189 190 switch($redirecting['Redirecting']) 191 { 192 case 1: 193 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 194 'setTimeout("parent.location.href=\''.htmlspecialchars_decode('TranslationList.php?group='.$GroupId.'&state=1&user=0').'\'", 1500)'. 195 '</script>'; 196 break; 197 case 2: 198 if($next <> '') 199 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 200 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'. 201 '</script>'; 202 break; 203 case 3: 204 if($prev <> '') 205 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 206 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'. 207 '</script>'; 208 break; 209 } 210 211 $Output .= 'Z této stránky můžete být automaticky přesměrování. Nastavit kam chcete být přesměrování si můžete v <a href="'. 212 $this->System->Link('/Options.php').'" title="Nastavení uživatele">Nastavení</a>'; 213 214 // Update flag for experience info load 215 $this->Database->query('UPDATE `User` SET `NeedUpdate` = 1 WHERE `ID` = '.$this->System->User->Id); 216 } else $Output .= ShowMessage('Položka nenalezena', MESSAGE_CRITICAL); 217 } else 218 { 219 if(array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST)) 220 { 221 $Output .= 'Byli jste automaticky odhlášeni. Pro <strong>Uložení překladu</strong> se musíte přihlásit zde:<br /><br />'. 222 '<form action="save.php?action=login&group='.$GroupId.'" method="post"><div>'. 223 '<input type="hidden" name="entry" value="'.$_POST['entry'].'" />'. 224 '<input type="hidden" name="user" value="'.$_POST['user'].'" />'. 225 '<input type="hidden" name="ID" value="'.$_POST['ID'].'" />'. 226 '<input type="hidden" name="Language" value="'.$_POST['Language'].'" />'; 227 228 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 229 { 230 if(array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = ''; 231 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Value).'" />'; 232 } 233 $Output .= '<table>'. 234 '<tr>'. 235 '<td>Jméno: <input type="text" name="LoginUser" size="13" /></td>'. 236 '</tr><tr>'. 237 '<td>Heslo: <input type="password" name="LoginPass" size="13" /></td>'. 238 '</tr><tr>'. 239 '<th><input type="submit" value="Přihlásit a uložit překlad" /></th>'. 240 '</tr>'. 241 '</table>'; 242 } else $Output = ShowMessage('Nezadány požadované údaje.', MESSAGE_CRITICAL); 243 } 244 return($Output); 245 245 } 246 246 } -
trunk/Modules/Translation/Translation.php
r815 r816 23 23 function Start() 24 24 { 25 25 global $TranslationTree; 26 26 27 28 29 30 27 $this->System->RegisterPage('comparison.php', 'PageTranslationComparison'); 28 $this->System->RegisterPage('form.php', 'PageTranslationForm'); 29 $this->System->RegisterPage('save.php', 'PageTranslationSave'); 30 $this->System->RegisterPage('progress', 'PageProgress'); 31 31 $this->System->RegisterPage('TranslationList.php', 'PageTranslationList'); 32 32 $this->System->RegisterPage('LoadNames.php', 'PageLoadNames'); … … 42 42 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 43 43 { 44 45 46 44 foreach($TranslationTree as $Group) 45 { 46 $Table = $Group['TablePrefix']; 47 47 48 49 50 51 52 48 $Columns = array('ID', 'Entry'); 49 foreach($Group['Items'] as $Item) 50 { 51 if($Item['Column'] != '') $Columns[] = $Item['Column']; 52 } 53 53 54 54 $this->System->ModuleManager->Modules['Search']->RegisterSearch('group'.$Group['Id'], 55 55 sprintf(T('Translation group "%s"'), $Group['Name']), $Columns, '`'.$Table.'`', $this->System->Link('/TranslationList.php?group='. 56 56 $Group['Id'].'&user=0&state=0&entry=&text=')); 57 57 } 58 58 } 59 59 } … … 61 61 function ShowRSS() 62 62 { 63 63 $Items = array(); 64 64 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '. 65 65 'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100'); … … 81 81 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'], 82 82 'Items' => $Items, 83 83 )); 84 84 return($Output); 85 85 } -
trunk/Modules/Translation/TranslationList.php
r791 r816 3 3 class CompletionState 4 4 { 5 6 7 8 9 10 11 12 5 const All = 0; 6 const NotTranslated = 1; 7 const Translated = 2; 8 const NotFinished = 3; 9 const Original = 4; 10 const NotFinishedNotTranslated = 5; 11 const Missing1 = 6; 12 const Missing2 = 7; 13 13 } 14 14 … … 16 16 class PageTranslationList extends Page 17 17 { 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 18 function ShowFilter($GroupId = 0) 19 { 20 global $TranslationTree; 21 22 $Filter = array('SQL' => ''); 23 24 $Output = '<form action="?" method="post">'. 25 '<table class="BaseTable"><tr>'. 26 '<th>Zpracování</th>'. 27 '<th>Skupina</th>'. 28 '<th>Verze</th>'. 29 '<th>Jazyk</th>'. 30 '<th>Překladatel</th>'. 31 '<th>Slova</th>'. 32 '<th>Položka</th>'. 33 '<th></th></tr><tr>'; 34 35 // State 36 $Filter['State'] = GetParameter('state', 0, true, true); 37 $Output .= '<td><select name="state">'; 38 $StateTypes = array( 39 CompletionState::All => 'Všechny', 40 40 CompletionState::NotTranslated => 'Nepřeložené', 41 41 CompletionState::Translated => 'Přeložené', … … 46 46 CompletionState::Missing2 => 'Chybějící $-Neopravený' 47 47 ); 48 49 50 51 52 } 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 48 foreach ($StateTypes as $index=>$StateType) { 49 if($Filter['State'] == $index) $Selected = ' selected="selected"'; 50 else $Selected = ''; 51 $Output .= '<option value="'.$index.'"'.$Selected.'>'.$StateType.'</option>'; 52 } 53 $Output .= '</select></td>'; 54 55 // Translation group 56 if($GroupId == 0) 57 { 58 $Filter['Group'] = GetParameter('group', 0, true, true); 59 if($Filter['Group'] != 0) 60 { 61 if(isset($TranslationTree[$Filter['Group']]) == false) ErrorMessage('Překladová skupina dle zadaného Id neexistuje.'); 62 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; 63 } 64 } else 65 { 66 $Filter['Group'] = $GroupId; 67 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; 68 } 69 70 $Output .= '<td><select name="group" style="width: 80px">'; 71 if($Filter['Group'] == 0) $Selected = ' selected="selected"'; 72 else $Selected = ''; 73 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 74 $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group` ORDER BY `Name`'); 75 while($Group = $DbResult->fetch_assoc()) 76 { 77 if($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"'; 78 else $Selected = ''; 79 $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.$Group['Name'].'</option>'; 80 } 81 $Output .= '</select></td>'; 82 82 83 83 if ($this->System->User->Licence(LICENCE_USER)) 84 85 else 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 84 $Filter['Version'] = GetParameter('version', $this->System->User->PreferredVersion, true, true); 85 else 86 $Filter['Version'] = GetParameter('version', 0, true, true); 87 if($Filter['Version'] != 0) 88 { 89 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')'); 90 if($DbResult->num_rows > 0) 91 { 92 $DbRow = $DbResult->fetch_assoc(); 93 $Filter['BuildNumber'] = $DbRow['BuildNumber']; 94 } else ErrorMessage('Zadaná verze klienta nenalezena'); 95 } 96 $Output .= '<td><select name="version">'; 97 if($Filter['Version'] == 0) $Selected = ' selected="selected"'; 98 else $Selected = ''; 99 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 100 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC'); 101 while($Version = $DbResult->fetch_assoc()) 102 { 103 if($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"'; 104 else $Selected = ''; 105 $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>'; 106 } 107 $Output .= '</select></td>'; 108 if($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')'; 109 else $VersionFilter = ''; 110 //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry) 111 112 // Language 113 $Filter['Language'] = GetParameter('lang', 0, true, true); 114 $Output .= '<td><select name="lang">'; 115 if($Filter['Language'] == 0) $Selected = ' selected="selected"'; 116 else $Selected = ''; 117 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 118 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`'); 119 while($Language = $DbResult->fetch_assoc()) 120 { 121 if($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"'; 122 else $Selected = ''; 123 $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.$Language['Name'].'</option>'; 124 } 125 $Output .= '</select></td>'; 126 $LanguageFilter = ''; 127 $LanguageFilterSub = ''; 128 if($Filter['Language'] != 0) { 129 129 $LanguageFilter = ' AND (`T`.`Language` = '.$Filter['Language'].')'; 130 130 $LanguageFilterSub = ' AND (`Sub`.`Language` = '.$Filter['Language'].')'; 131 131 } 132 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 133 // User 134 $Filter['User'] = GetParameter('user', 0, true, true); 135 $Output .= '<td><select name="user" style="width: 80px">'; 136 if($Filter['User'] == 0) $Selected = ' selected="selected"'; 137 else $Selected = ''; 138 $Output .= '<option value="0"'.$Selected.'>Všichni</option>'; 139 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`'); 140 while($User = $DbResult->fetch_assoc()) 141 { 142 if($User['Id'] == $Filter['User']) $Selected = ' selected="selected"'; 143 else $Selected = ''; 144 $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>'; 145 } 146 $Output .= '</select></td>'; 147 if($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')'; 148 else $UserFilter = ''; 149 150 // Words 151 $Filter['Text'] = GetParameter('text', '', false, true); 152 $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.htmlentities($Filter['Text']).'"></td>'; 153 if($Filter['Text'] != '') 154 { 155 $Items = array('(`T`.`ID` LIKE "%'.$Filter['Text'].'%")', '(`T`.`Entry` LIKE "%'.$Filter['Text'].'%")'); 156 if($Filter['Group'] != 0) 157 foreach($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 158 if($GroupItem['Visible'] == 1) 159 $Items[] = '(`T`.`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")'; 160 $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')'; 161 } 162 163 // Entry 164 $Filter['Entry'] = GetParameter('entry', '', false, true); 165 $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.htmlentities($Filter['Entry']).'"></td>'; 166 if($Filter['Entry'] != '') 167 { 168 $Filter['SQL'] .= ' AND (`Entry` = "'.$Filter['Entry'].'")'; 169 } 170 171 if($Filter['Group'] != 0) 172 { 173 $WithoutAlter = ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. 174 '(`Sub`.`Language` <> '.$this->System->Config['OriginalLanguage'].')'.$LanguageFilterSub. 175 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`ID` != `T`.`ID`) AND (`Sub`.`Complete` = 1) AND '. 176 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`) LIMIT 1 ) '; 177 foreach($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 178 if($GroupItem['Visible'] == 1) { 179 $ItemsVar[] = 'LENGTH(`T`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `T`.`'.$GroupItem['Column'].'`, \'$\', \'\' ) ) '. 180 180 ' < ('. 181 181 'SELECT LENGTH(`Sub`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `Sub`.`'.$GroupItem['Column'].'`, \'$\', \'\' ) ) FROM `'.$Table.'` AS `Sub` WHERE '. 182 183 182 ' `Sub`.`Entry` = `T`.`Entry` AND `Sub`.`Language` = '.$this->System->Config['OriginalLanguage'].' AND '. 183 '`Sub`.`VersionStart` = `T`.`VersionStart` AND `Sub`.`VersionEnd` = `T`.`VersionEnd` LIMIT 1 '. 184 184 ')'; 185 186 187 188 189 190 191 192 193 194 195 196 185 } 186 if($Filter['State'] == CompletionState::All) $Filter['SQL'] .= $UserFilter.$VersionFilter.''; 187 else if($Filter['State'] == CompletionState::NotTranslated) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 188 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. 189 '(`Sub`.`Language` <> '.$this->System->Config['OriginalLanguage'].') '.$LanguageFilterSub.$UserFilter. 190 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND '. 191 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; 192 else if($Filter['State'] == CompletionState::Translated) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)'; 193 else if($Filter['State'] == CompletionState::NotFinished) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 194 ') AND (`T`.`Complete` = 0)'; 195 else if($Filter['State'] == CompletionState::Original) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')'; 196 else if($Filter['State'] == CompletionState::NotFinishedNotTranslated) $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 197 197 ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 198 198 ') AND (`T`.`Complete` = 0)'. 199 199 ''; 200 200 else if($Filter['State'] == CompletionState::Missing1) { 201 201 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 202 202 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 203 204 203 } 204 else if($Filter['State'] == CompletionState::Missing2) { 205 205 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 206 206 $Filter['SQL'] .= ' '. $WithoutAlter; 207 207 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 208 } 209 } 210 211 /* 212 // Ownership 213 if(array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner']; 214 else $Filter['Owner'] = 0; 215 $Output .= ' <td><select name="owner">'; 216 if($Filter['Owner'] == 0) $Selected = ' selected="selected"'; 217 else $Selected = ''; 218 $Output .= '<option value="0"'.$Selected.'>Všech</option>'; 219 if($Filter['Owner'] == 1) $Selected = ' selected="selected"'; 220 else $Selected = ''; 221 $Output .= '<option value="1"'.$Selected.'>Překladatelův tým</option>'; 222 if($Filter['Owner'] == 2) $Selected = ' selected="selected"'; 223 else $Selected = ''; 224 $Output .= '<option value="2"'.$Selected.'>Překladatele</option>'; 225 $Output .= '</select></td>'; 226 if(($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')'; 227 */ 228 229 $Output .= '<td><input type="submit" value="Filtrovat"/></td>'; 230 $Output .= '</tr></table>'; 231 $Output .= '</form><br/>'; 232 $Filter['Output'] = $Output; 233 return($Filter); 234 } 235 236 function ShowTranslationList($Filter) 237 { 238 global $TranslationTree; 239 240 $Output = $Filter['Output']; 241 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; 242 243 $Query = 'SELECT `T`.`ModifyTime`, `T`.`ID`, `T`.`Entry`, `T`.`VersionStart`, `T`.`VersionEnd`, '. 244 '`T`.`'.$TranslationTree[$Filter['Group']]['Items'][0]['Column'].'`, '. 245 '`User`.`Name` AS `UserName`, `User`.`ID` AS `UserId`, '. 246 '`Language`.`Name` AS `LanguageName`, `TS`.`Version` AS `VersionStartText`, `TE`.`Version` AS `VersionEndText` '. 247 'FROM `'.$Table.'` AS `T` '. 248 'LEFT JOIN `User` ON `User`.`ID` = `T`.`User` '. 249 'LEFT JOIN `Language` ON `Language`.`ID` = `T`.`Language` '. 250 'LEFT JOIN `ClientVersion` AS `TS` ON `TS`.`BuildNumber` = `T`.`VersionStart` '. 251 'LEFT JOIN `ClientVersion` AS `TE` ON `TE`.`BuildNumber` = `T`.`VersionEnd` '. 252 'WHERE 1 '.$Filter['SQL']; 253 254 // Get total item count 255 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `TT`'); 256 $DbRow = $DbResult->fetch_row(); 257 $PageList = GetPageList($DbRow[0]); 258 259 $Output .= $PageList['Output']; 260 $TableColumns = array( 261 array('Name' => 'ID', 'Title' => 'Číslo'), 262 array('Name' => 'Entry', 'Title' => 'Položka'), 263 array('Name' => $TranslationTree[$Filter['Group']]['Items'][0]['Column'], 'Title' => 'Název'), 264 array('Name' => 'VersionStart', 'Title' => 'Verze'), 265 array('Name' => 'LanguageName', 'Title' => 'Jazyk'), 266 array('Name' => 'UserName', 'Title' => 'Překladatel'), 267 array('Name' => 'ModifyTime', 'Title' => 'Datum'), 268 ); 269 270 $Order = GetOrderTableHeader($TableColumns, 'VersionStart', 1); 271 $Output .= '<table class="BaseTable">'. 272 $Order['Output']; 273 274 $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 275 while($Line = $DbResult->fetch_assoc()) 276 { 277 $Output .= '<tr><td><a href="form.php?group='.$Filter['Group'].'&ID='.$Line['ID'].'">'.$Line['ID'].'</a></td><td>'.$Line['Entry'].'</td>'. 278 '<td>'.htmlspecialchars($Line[$TranslationTree[$Filter['Group']]['Items'][0]['Column']]).'</td>'. 279 '<td>'.$Line['VersionStartText'].'-'.$Line['VersionEndText'].'</td>'. 280 '<td>'.$Line['LanguageName'].'</td>'. 281 '<td><a href="user.php?user='.$Line['UserId'].'">'.$Line['UserName'].'</a></td>'. 282 '<td>'.HumanDate($Line['ModifyTime']).'</td>' 283 283 ; 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 284 '</tr>'; 285 } 286 $Output .= '</table>'. 287 $PageList['Output']; 288 return($Output); 289 } 290 291 function ShowGroupList($Filter) 292 { 293 global $TranslationTree; 294 295 $Output = $Filter['Output']; 296 297 $Output .= '<table class="BaseTable"><tr><th>Skupina</th><th>Počet</th></tr>'; 298 $Total = 0; 299 foreach($TranslationTree as $Group) 300 if($Group['TablePrefix'] != '') 301 { 302 $Filter = $this->ShowFilter($Group['Id']); 303 $ID = $this->Database->query('SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` AS `T` WHERE 1 '.$Filter['SQL']); 304 $Line = $ID->fetch_row(); 305 if ($Line[0] <> '0') 306 $Output .= '<tr><td><a href="?group='.$Group['Id'].'">'.$Group['Name'].'</td><td>'.$Line[0].'</a></tr>'; 307 $Total += $Line[0]; 308 } 309 $Output .= '<tr><td><strong>Celkem</strong></td><td><strong>'.$Total.'</strong></td></tr>'. 310 '</table>'; 311 return($Output); 312 } 313 314 function ShowGroupTypeList() 315 { 316 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Group`'); 317 $DbRow = $DbResult->fetch_row(); 318 $PageList = GetPageList($DbRow[0]); 319 $Output = '<h3>Seznam překladových skupin</h3>'. 320 $PageList['Output']; 321 322 $Output .= '<table class="BaseTable">'; 323 $TableColumns = array( 324 array('Name' => 'Name', 'Title' => 'Jméno'), 325 array('Name' => 'SourceType', 'Title' => 'Typ zdroje'), 326 array('Name' => '', 'Title' => 'Zdroje'), 327 array('Name' => 'LastImport', 'Title' => 'Datum posledního importu'), 328 array('Name' => 'LastVersion', 'Title' => 'Verze posledního importu'), 329 ); 330 if($this->System->User->Licence(LICENCE_ADMIN)) 331 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 332 333 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 334 $Output .= $Order['Output']; 335 336 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 337 while($Group = $DbResult->fetch_assoc()) 338 { 339 $Output .= '<tr><td><a href="?group='.$Group['Id'].'&action=filter">'.$Group['Name'].'</a></td><td>'.$Group['SourceType'].'</td><td>'; 340 if($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql '; 341 if($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc '; 342 if($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua '; 343 $Output .= '</td>'; 344 344 if($this->System->User->Licence(LICENCE_ADMIN)) 345 345 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="log.php?group='. 346 346 $Group['Id'].'&type=11">'.HumanDate($Group['LastImport']).'</a></td>'; 347 347 else $Output .= '<td>'.HumanDate($Group['LastImport']).'</td>'; 348 348 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='. 349 349 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>'; 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 350 if($this->System->User->Licence(LICENCE_ADMIN)) 351 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">Smazat</a></td>'; 352 $Output .= '</tr>'; 353 354 } 355 $Output .= '</table>'. 356 '<br /><a title="Záznam změn po importu" href="log.php?type=11">Záznam změn v textech při importu</a><br/>'; 357 if($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">Přidat překladovou skupinu</a>'; 358 return($Output); 359 } 360 361 function ShowMenu() 362 { 363 global $TranslationTree; 364 365 $GroupId = GetParameter('group', 0, true); 366 if($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL); 367 else { 368 $Table = $TranslationTree[$GroupId]['TablePrefix']; 369 370 $Output = '<h3>Základní filtrování textů</h3><br/>'. 371 '<table class="BaseTable"><tr><th>Odkaz</th><th>Popis</th></tr>'. 372 '<tr><td><a title="Všechny dostupné texty ve skupině" href="?group='.$GroupId.'&state=4">Všechny</a></td>'. 373 '<td>Zobrazit všechny dostupné anglické texty ve skupině.</td></tr>'. 374 '<tr><td><a title="Přeložené texty, můžete zde hlasovat, nebo text opravovat" href="?group='.$GroupId.'&state=2">Přeložené</a></td>'. 375 '<td>Zobrazit pouze již přeložené texty.</td></tr>'. 376 '<tr><td><a title="Nepřeložené texty" href="?group='.$GroupId.'&state=1">Nepřeložené</a></td>'. 377 '<td>Dosud nepřeložené texty, které je potřeba přeložit.</td></tr>'. 378 '<tr><td><a title="Nedokončené texty" href="?group='.$GroupId.'&state=3">Nedokončené</a></td>'. 379 '<td>Texty označené jako rozpracované.</td></tr>'; 380 381 if($this->System->User->Licence(LICENCE_USER)) 382 { 383 $Output .= '<tr><td><a title="Nedokončené texty" href="?group='.$GroupId.'&state=3&user='.$this->System->User->Id.'">Moje nedokončené</a></td> 384 <td>Nedokončené texty přihlášeného uživatele</td></tr> 385 <tr><td><a title="Přeložené texty přihlášeného uživatele" href="?group='.$GroupId.'&state=2&user='.$this->System->User->Id.'">Moje přeložené</a></td> 386 <td>Přeložené texty přihlášeného uživatele</td></tr>'; 387 } 388 389 $Output .= '<tr><td><form action="?group='.$GroupId.'&entry=" method="post"><div>'. 390 '<input type="text" name="text" size="8" />'. 391 '<input type="submit" value="Hledat" />'. 392 '</div></form>'. 393 '</td><td>Vyhledat pomocí textu</td></tr>'; 394 395 $Output .= '<tr><td><form action="?group='.$GroupId.'&text=" method="post"><div>'. 396 '<input type="text" name="entry" size="8" />'. 397 '<input type="submit" value="Hledat" />'. 398 '</div></form>'. 399 '</td><td>Zobrazit podle ID textu v databázi MaNGOSu</td></tr>'; 400 401 $Output .= '</table>'; 402 } 403 return($Output); 404 } 405 406 function ShowGroupAdd() 407 { 408 if($this->System->User->Licence(LICENCE_ADMIN)) 409 { 410 $Output = '<h3>Vložení nové překladové skupiny</h3>'. 411 '<form action="?action=groupaddfinish" method="post">'. 412 '<table>'. 413 '<tr><td>Název:</td><td><input type="text" name="Name"/></td></tr>'. 414 '<tr><td>Název tabulky v databázi:</td><td>Text<input type="text" name="TablePrefix"/></td></tr>'. 415 '<tr><td colspan="2"><input type="submit" name="add" value="Přidat"/></td></tr>'. 416 '</table></form>'; 417 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 418 return($Output); 419 } 420 421 function ShowGroupAddFinish() 422 { 423 if($this->System->User->Licence(LICENCE_ADMIN)) 424 { 425 $TableName = 'Text'.$_POST['TablePrefix']; 426 $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"'); 427 if($DbResult->num_rows == 0) 428 { 429 430 $this->System->Database->query('CREATE TABLE IF NOT EXISTS `'.$TableName.'` ( 431 431 `ID` int(11) NOT NULL AUTO_INCREMENT, 432 432 `Entry` int(11) NOT NULL, … … 455 455 ADD CONSTRAINT `'.$TableName.'_ibfk_2` FOREIGN KEY (`User`) REFERENCES `User` (`ID`), 456 456 ADD CONSTRAINT `'.$TableName.'_ibfk_3` FOREIGN KEY (`Take`) REFERENCES `'.$TableName.'` (`ID`);'); 457 458 459 460 457 $DbResult = $this->System->Database->insert('Group', array('Name' => $_POST['Name'], 458 'TablePrefix' => $TableName, 'PrimaryKeyItem' => 'Entry')); 459 $Group = $this->System->Database->insert_id; 460 $this->System->Database->insert('GroupItem', array('Group' => $Group, 461 461 'Name' => 'Jméno', 'Column' => 'Name', 'Visible' => 1)); 462 462 $Output = ShowMessage('Překladová skupina vytvořena', MESSAGE_INFORMATION); 463 463 } else $Output = ShowMessage('Překladová skupina '.$TableName.' již existuje', MESSAGE_CRITICAL); 464 464 $Output .= $this->ShowGroupTypeList(); 465 466 return($Output); 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 465 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 466 return($Output); 467 } 468 469 function ShowGroupDelete() 470 { 471 if($this->System->User->Licence(LICENCE_ADMIN)) 472 { 473 $DbResult = $this->System->Database->select('Group', '*', 'Id='.$_GET['id']); 474 if($DbResult->num_rows == 1) 475 { 476 $Group = $DbResult->fetch_assoc(); 477 $this->Database->query('DROP TABLE `'.$Group['TablePrefix'].'`'); 478 $this->Database->query('DELETE FROM `GroupItem` WHERE `Group`='.$Group['Id']); 479 $this->Database->query('DELETE FROM `Group` WHERE `Id`='.$Group['Id']); 480 $Output = ShowMessage('Překladová skupina '.$Group['Name'].' smazána', MESSAGE_INFORMATION); 481 } else $Output = ShowMessage('Překladová skupina nenalezena', MESSAGE_CRITICAL); 482 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 483 $Output .= $this->ShowGroupTypeList(); 484 return($Output); 485 } 486 487 function Show() 488 { 489 $this->Title = T('Translation groups'); 490 $Action = GetParameter('action', ''); 491 if($Action == 'filter') $Output = $this->ShowMenu(); 492 else if($Action == 'grouplist') $Output = $this->ShowGroupTypeList(); 493 else if($Action == 'groupadd') $Output = $this->ShowGroupAdd(); 494 else if($Action == 'groupdelete') $Output = $this->ShowGroupDelete(); 495 else if($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish(); 496 else 497 { 498 $Filter = $this->ShowFilter(); 499 if($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter); 500 else $Output = $this->ShowGroupList($Filter); 501 } 502 return($Output); 503 } 504 504 } -
trunk/Modules/User/Options.php
r787 r816 3 3 class PageUserOptions extends Page 4 4 { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 5 function UserOptionsFrom() 6 { 7 $Output = '<form action="Options.php?action=save" method="post"> 8 <fieldset><legend>Nastavení uživatele</legend> 9 <table> 10 <tr><td>Email:</td><td><input type="text" name="Email" value="'.$this->System->User->Email.'" /></td></tr> 11 <tr><td>Původní heslo:</td><td><input type="password" name="OldPass" /></td></tr> 12 <tr><td>Nové heslo:</td><td><input type="password" name="NewPass" /></td></tr> 13 <tr><td>Nové heslo pro potvrzení: </td><td><input type="password" name="NewPass2" /></td></tr> 14 <tr><td>Normálně budu překládat do: </td><td>'.WriteLanguages($this->System->User->Language).'</td></tr> 15 <tr><td>Po uložení překladu přesměrovat: </td><td>'; 16 $Output .= '<select name="redirecting">'. 17 '<option value="0">Nikam</option>'. 18 '<option value="1"'; 19 if($this->System->User->Redirecting == '1') $Output .= ' selected="selected"'; 20 $Output .= '>Na nepřeložené</option>'; 21 $Output .= '<option value="2"'; 22 if($this->System->User->Redirecting == '2') $Output .= ' selected="selected"'; 23 $Output .= '>Na další překlad</option>'; 24 $Output .= '<option value="3"'; 25 if($this->System->User->Redirecting == '3') $Output .= ' selected="selected"'; 26 $Output .= '>Na předchozí překlad</option>'; 27 $Output .= '</select>'; 28 29 $Output .= '</td></tr>'. 30 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection($this->System->User->PreferredVersion).'</td></tr>'. 31 '<tr><td>Veřejný text profilu:</td><td>'. 32 '<textarea name="info" cols="60" rows="10">'.$this->System->User->Info.'</textarea></td></tr>'; 33 34 35 35 $Output .= '<tr><td>'; 36 37 36 $Query = 'SELECT * FROM UserTagType'; 37 $DbResult = $this->Database->query($Query); 38 38 $Output .= 'Překladatel se řídí zaškrtnutými pravidly:</td><td>'; 39 while ($UserTag = $DbResult->fetch_array()) { 40 39 while ($UserTag = $DbResult->fetch_array()) { 40 $Query = 'SELECT * FROM `UserTag` '. 41 41 //'LEFT JOIN `UserTagType` ON `UserTagType`.`ID` = `UserTag`.`UserTagType` '. 42 42 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1); 43 43 $DbResult2 = $this->Database->query($Query); 44 44 if ($DbResult2->num_rows != 0) $checked = true; 45 else $checked = false; 46 47 $Output .= CheckBox('Tag'.$UserTag['ID'], $checked, 'CheckBox'); 45 else $checked = false; 46 47 $Output .= CheckBox('Tag'.$UserTag['ID'], $checked, 'CheckBox'); 48 48 $Output .= ''.$UserTag['Text'].'<br />'; 49 49 } 50 50 $Output .= '</td></tr>'; 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 51 52 $Output .= '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'. 53 '</table></fieldset>'. 54 '</form>'; 55 56 $Output .= ' <fieldset><legend>Překladatelský tým</legend>'; 57 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Team`'); 58 $Output .= '<a href="team/?action=create">Vytvořit tým</a><br />'. 59 '<a href="team/?action=leave">Opustit tým</a><br />'. 60 '<br /><form action="team/" method="get">'. 61 '<input type="hidden" name="action" value="gointeam"/>'. 62 '<select name="id">'; 63 while($LineTeam = $DbResult->fetch_assoc()) 64 { 65 $Output .= '<option value="'.$LineTeam['Id'].'"'; 66 if ($LineTeam['Id'] == $this->System->User->Team) $Output .= ' selected="selected"'; 67 $Output .= '>'.$LineTeam['Name'].'</option>'; 68 } 69 $Output .= '</select> <input type="submit" value="Vstoupit" /> 70 </form>'; 71 $Output .= '</fieldset>'; 72 return($Output); 73 } 74 75 function UserOptionsSave() 76 { 77 $Output = ''; 78 if(array_key_exists('Email', $_POST)) 79 { 80 $Email = $_POST['Email']; 81 $OldPass = $_POST['OldPass']; 82 $NewPass = $_POST['NewPass']; 83 $NewPass2 = $_POST['NewPass2']; 84 $Language = $_POST['Language']; 85 $Redirecting = $_POST['redirecting']; 86 $PreferredVersion = $_POST['ClientVersion']; 87 if($PreferredVersion == '') $PreferredVersion = null; 88 $Info = $_POST['info']; 89 90 // Do user want to change password? 91 if(($OldPass != '') or ($NewPass != '') or ($NewPass2 != '')) 92 { 93 if($NewPass == $NewPass2) 94 { 95 $DbResult = $this->System->Database->query('SELECT `Pass`, '.$this->System->User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$this->System->User->Id); 96 $DbRow = $DbResult->fetch_assoc(); 97 if($DbRow['Hash'] == $DbRow['Pass']) 98 { 99 // Update password 100 $Salt = $this->System->User->GetPasswordSalt(); 101 $this->Database->query('UPDATE `User` SET `Pass` = '.$this->System->User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$this->System->User->Id); 102 $Output .= ShowMessage('Heslo změněno.'); 103 } else $Output .= ShowMessage('Staré heslo neodpovídá.', MESSAGE_CRITICAL); 104 } else $Output .= ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL); 105 } 106 106 //tag 107 108 109 while ($UserTag = $DbResult->fetch_array()) { 107 $Query = 'SELECT * FROM UserTagType'; 108 $DbResult = $this->Database->query($Query); 109 while ($UserTag = $DbResult->fetch_array()) { 110 110 if (array_key_exists('Tag'.$UserTag['ID'], $_POST)) { 111 111 $Query = 'SELECT * FROM `UserTag` '. 112 112 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1); 113 113 $DbResult2 = $this->Database->query($Query); 114 114 if ($DbResult2->num_rows == 0) { 115 115 $Query = 'INSERT INTO `UserTag` (`ID` ,`UserTagType`,`User` ) '. 116 116 'VALUES (NULL, '.$UserTag['ID'].' , '.($this->System->User->Id * 1).')'; 117 117 $DbResult2 = $this->Database->query($Query); 118 118 } 119 119 } else { 120 120 $Query = 'DELETE FROM `UserTag` '. 121 121 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1); 122 122 $DbResult2 = $this->Database->query($Query); 123 123 } 124 124 } 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 } 150 } 125 126 $this->Database->update('User', '`ID` = '.$this->System->User->Id, array('Email' => $Email, 127 'Language' => $Language, 'Redirecting' => $Redirecting, 'Info' => $Info, 128 'PreferredVersion' => $PreferredVersion)); 129 $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$this->System->User->Name.'</b>'); 130 $this->System->ModuleManager->Modules['Log']->WriteLog('Úprava nastavení!', LOG_TYPE_USER); 131 $this->System->User->Load(); 132 } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL); 133 return($Output); 134 } 135 136 function Show() 137 { 138 $this->Title = T('User settings'); 139 $Output = ''; 140 if($this->System->User->Licence(LICENCE_USER)) 141 { 142 if(array_key_exists('action', $_GET) and ($_GET['action'] == 'save')) 143 { 144 $Output .= $this->UserOptionsSave(); 145 } 146 $Output .= $this->UserOptionsFrom(); 147 } else $Output .= ShowMessage('Nejste přihlášený.', MESSAGE_CRITICAL); 148 return($Output); 149 } 150 } -
trunk/Modules/User/Profile.php
r797 r816 3 3 class PageUserProfile extends Page 4 4 { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 5 function SendMail() 6 { 7 $Output = ''; 8 if(array_key_exists('text', $_POST)) 9 if($this->System->User->Licence(LICENCE_ADMIN)) 10 { 11 $Text = $_POST['text']; 12 $Email = $_POST['email']; 13 $Subject = $_POST['subject']; 14 $Output = 'Email: <strong>'.$Email.'</strong><br />'. 15 'Předmět: <strong>'.$Subject.'</strong><br />'. 16 'Text: <strong>'.$Text.'</strong><br />'; 17 18 if(@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail'].'\nReply-To: '.$this->System->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/')) 19 { 20 $Output .= ShowMessage(T('Message was sent')); 21 } 22 else $Output .= ShowMessage('Nepodařilo se odesat E-mail.', MESSAGE_CRITICAL); 23 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 24 return($Output); 25 } 26 27 function ExportList() 28 { 29 $Output = ''; 30 $Filter = ' WHERE `Export`.`User` = '.($_GET['user'] * 1); 31 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter); 32 $DbRow = $DbResult->fetch_row(); 33 $PageList = GetPageList($DbRow[0]); 34 35 $Output .= '<h3>Exporty</h3>'. 36 $PageList['Output']; 37 38 $TableColumns = array( 39 array('Name' => 'TimeCreate', 'Title' => 'Čas vytvoření'), 40 array('Name' => 'Title', 'Title' => 'Označení'), 41 // array('Name' => 'UserCount', 'Title' => 'Vybraných překladatelů'), 42 // array('Name' => 'GroupCount', 'Title' => 'Překladových skupin'), 43 array('Name' => 'OutputType', 'Title' => 'Typ výstupu'), 44 array('Name' => 'ClientVersion', 'Title' => 'Verze klienta'), 45 array('Name' => 'UsedCount', 'Title' => 'Prohlédnutí výstupu'), 46 array('Name' => '', 'Title' => 'Akce'), 47 ); 48 $Order = GetOrderTableHeader($TableColumns, 'TimeCreate', 1); 49 $Output .= '<table class="BaseTable">'. 50 $Order['Output']; 51 52 $DbResult = $this->System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, `Export`.`ClientVersion` AS `ClientVersionId`, '. 53 53 '(SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`, '. 54 54 '(SELECT Name FROM `ExportOutputType` WHERE `ExportOutputType`.`Id`=`Export`.`OutputType`) AS `OutputType`, '. … … 56 56 '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '. 57 57 'LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']); 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 { 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 } 118 119 58 while($Export = $DbResult->fetch_assoc()) 59 { 60 $Action = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Export['Id'].'&Tab=0').'">Zobrazit</a> '. 61 '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Export['Id'].'&Tab=7').'">Exportovat</a>'; 62 if($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'; 63 if($this->System->User->Id != null) $Action .= ' <a href="'.$this->System->Link('/export/?Action=Clone&ExportId='.$Export['Id']).'" onclick="return confirmAction(\'Opravdu klonovat položku?\');">Klonovat</a>'; 64 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 65 '<td>'.$Export['Title'].'</td>'. 66 '<td>'.$Export['OutputType'].'</td>'. 67 '<td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Export['ClientVersionId']).'">'.$Export['ClientVersion'].'</a></td>'. 68 '<td>'.$Export['UsedCount'].'</td>'. 69 '<td>'.$Action.'</td></tr>'; 70 } 71 $Output .= '</table>'. 72 $PageList['Output']; 73 74 $Output .= '<div style="text-align: center;"><a href="'.$this->System->Link('/export/').'">Stránka exportů</a></div>'; 75 return($Output); 76 } 77 78 function ShowLastTranslated() 79 { 80 $Count = 20; 81 $Output = '<strong>Poslední překlady:</strong>'; 82 83 $GroupListQuery = 'SELECT `Group`.* FROM `Group`'; 84 $Query = ''; 85 $UnionItems = array(); 86 $DbResult = $this->Database->query($GroupListQuery); 87 if($DbResult->num_rows > 0) 88 { 89 while($DbRow = $DbResult->fetch_assoc()) 90 { 91 $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '. 92 'FROM (SELECT `T`.`User`, `T`.`ID`, `T`.`ModifyTime`, '. 93 $DbRow['Id'].' AS `Group`, "'.addslashes($DbRow['Name']).'" AS `GroupName`, `T`.`Take` FROM `'. 94 $DbRow['TablePrefix'].'` AS `T` '. 95 'WHERE (`T`.`Complete` = 1) AND '. 96 '(`T`.`Language` != '.$this->System->Config['OriginalLanguage'].') AND '. 97 '(`T`.`User` = '.($_GET['user'] * 1).') ORDER BY `T`.`ModifyTime` DESC LIMIT '. 98 $Count.') AS `T`'; 99 } 100 $Query = 'SELECT `TT`.*, `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId` '. 101 'FROM ('.implode(' UNION ', $UnionItems).') AS `TT` '. 102 'JOIN `User` ON `User`.`Id` = `TT`.`User` '. 103 'ORDER BY `ModifyTime` DESC LIMIT '.$Count; 104 $DbResult = $this->Database->query($Query); 105 $Output .= '<table class="BaseTable"><tr>'. 106 '<th>Datum</th><th>Nový</th><th>Zdroj</th><th>Skupina</th></tr>'; 107 while($DbRow = $DbResult->fetch_assoc()) 108 { 109 $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'. 110 '<td><a href="form.php?group='.$DbRow['Group'].'&ID='.$DbRow['ID'].'">'.$DbRow['ID'].'</a></td>'. 111 '<td><a href="form.php?group='.$DbRow['Group'].'&ID='.$DbRow['Take'].'">'.$DbRow['Take'].'</a></td>'. 112 '<td><a href="TranslationList.php?group='.$DbRow['Group'].'&action=filter">'.$DbRow['GroupName'].'</a></td></tr>'; 113 } 114 $Output .= '</table>'; 115 } 116 return($Output); 117 } 118 119 function ShowLastForum() 120 120 { 121 121 $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email'))); 122 123 124 125 126 127 128 129 130 131 } 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 122 $Count = 20; 123 $Output = '<strong>Poslední příspěvky ve fóru:</strong>'; 124 125 $Output .= '<div class="shoutbox">'; 126 $DbResult = $this->System->Database->query('SELECT `ForumText`.`Text`, `ForumText`.`Date`, `ForumText`.`UserName`,`ForumThread`.`Text` as `ThreadName`,`ForumText`.`Thread` FROM `ForumText` JOIN `ForumThread` ON `ForumThread`.`ID` = `ForumText`.`Thread` WHERE `ForumText`.`User` = '.($_GET['user'] * 1).' ORDER BY `ForumText`.`Date` DESC LIMIT '.$Count); 127 while($Line = $DbResult->fetch_assoc()) 128 $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'.$Line['ThreadName'].'</a><br /><strong>'.$Line['UserName'].'</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse($Line['Text']).'</div> '; 129 $Output .= '</div>'; 130 return($Output); 131 } 132 133 function ShowProfile() 134 { 135 $Output = ''; 136 $Query = 'SELECT `User`.`Name`, `UserTrace`.`LastLogin`, `UserTrace`.`LastIP`, '. 137 '`User`.`Email`, `UserTrace`.`UserAgent`, `User`.`PreferredVersion`, '. 138 '`User`.`TranslatedCount`, `User`.`Team`, `User`.`ID`, `User`.`Info`, '. 139 '`Team`.`Name` AS `TeamName`, `Language`.`Name` AS `LanguageName`, '. 140 '`ClientVersion`.`Version` AS `Version` FROM `User` '. 141 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '. 142 'LEFT JOIN `Language` ON `Language`.`Id` = `User`.`Language` '. 143 'LEFT JOIN `Team` ON `Team`.`Id` = `User`.`Team` '. 144 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `User`.`PreferredVersion` '. 145 'WHERE `User`.`Id` = '.($_GET['user'] * 1); 146 $DbResult = $this->Database->query($Query); 147 if($DbResult->num_rows > 0) 148 { 149 $UserLine = $DbResult->fetch_array(); 150 151 $Output .= 152 '<h3>Překladatel '.$UserLine['Name'].'</h3>'. 153 'Výchozí jazyk: <strong>'.$UserLine['LanguageName'].'</strong><br />'. 154 'Výchozí verze klienta: <a href="'.$this->System->Link('/client-version/?action=item&id='.$UserLine['PreferredVersion']).'"><strong>'.$UserLine['Version'].'</strong></a><br />'. 155 'Poslední připojení: <strong>'.HumanDateTime($UserLine['LastLogin']).'</strong><br />'. 156 'Počet přeložených: <a href="TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />'; 157 if($UserLine['TeamName'] != '') 158 $Output .= 'Člen týmu: <a href="team/?action=team&id='.$UserLine['Team'].'"><strong>'.$UserLine['TeamName'].'</strong></a><br />'; 159 //user tags 160 $Query = 'SELECT * FROM `UserTag` '. 161 161 'LEFT JOIN `UserTagType` ON `UserTagType`.`ID` = `UserTag`.`UserTagType` '. 162 162 'WHERE `User` = '.($_GET['user'] * 1); 163 163 $DbResult = $this->Database->query($Query); 164 164 if ($DbResult->num_rows != 0) { 165 165 $Output .= 'Překladatel se řídí těmito pravidly:<br />'; … … 174 174 $Output .= '<br /><fieldset><legend>Text profilu:</legend>'.str_replace("\n", '<br/>', $UserLine['Info']).'</fieldset><br/>'; 175 175 176 177 178 179 180 181 182 183 176 $Output .= '<table class="Home"><tr>'. 177 '<td>'.$this->ShowLastTranslated().'</td>'. 178 '<td>'.$this->ExportList().'</td>'. 179 '</tr></table>'; 180 $Output .= '<br />'.$this->ShowLastForum().'<br />'; 181 if($this->System->User->Licence(LICENCE_MODERATOR)) 182 { 183 $Output .= '<fieldset><legend>Moderování</legend>'; 184 184 185 185 $Output .= '<form action="?user='.($_GET['user'] * 1).'" method="post">Přidání tagu uživateli:<br />'; 186 187 186 $Query = 'SELECT * FROM UserTagType'; 187 $DbResult = $this->Database->query($Query); 188 188 while ($UserTag = $DbResult->fetch_array()) { 189 189 //save: 190 190 if (array_key_exists('save', $_POST)) { 191 191 if (array_key_exists('Tag'.$UserTag['ID'], $_POST)) { 192 192 $Query = 'SELECT * FROM `UserTag` '. 193 193 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($_GET['user']*1); 194 194 $DbResult2 = $this->Database->query($Query); 195 195 if ($DbResult2->num_rows == 0) { 196 196 $Query = 'INSERT INTO `UserTag` (`ID` ,`UserTagType`,`User` ) '. 197 197 'VALUES (NULL, '.$UserTag['ID'].' , '.($_GET['user']*1).')'; 198 198 $DbResult2 = $this->Database->query($Query); 199 199 } 200 200 } else { 201 201 $Query = 'DELETE FROM `UserTag` '. 202 202 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($_GET['user'] * 1); 203 203 $DbResult2 = $this->Database->query($Query); 204 204 } 205 205 } 206 206 207 207 $Query = 'SELECT * FROM `UserTag` '. 208 208 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($_GET['user'] * 1); 209 209 $DbResult2 = $this->Database->query($Query); 210 210 if ($DbResult2->num_rows != 0) $checked = true; 211 211 else $checked = false; … … 216 216 $Output .= '<input name="save" type="submit" value="Uložit" /></form>'; 217 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 218 $Output .= ' PosledníIP: <strong>'.$UserLine['LastIP'].'</strong><br />'. 219 'Prohlížeč: <strong>'.$UserLine['UserAgent'].'</strong><br />'. 220 'Email: <strong>'.$UserLine['Email'].'</strong><br />'; 221 $Output .= '<br/><form action="user.php" method="post"><div>'. 222 'Napsat E-mail:'. 223 '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'. 224 'Předmět:'. 225 '<input type="text" name="subject" value="'.$this->System->Config['Web']['Title'].'" />'. 226 '<br />'. 227 '<textarea name="text" rows="20" cols="62">'. 228 ''."\n". 229 'S pozdravem '.$this->System->User->Name."\n". 230 '--------------------------------------------------------'."\n". 231 $this->System->Config['Web']['Title'].' '.$this->System->Config['Web']['Host'].$this->System->Link('/')."\n". 232 '</textarea><br/>'. 233 '<input type="submit" value="Odeslat" />'. 234 '</div></form></fieldset>'; 235 } 236 } else $Output .= ShowMessage('Uživatel nenalezen', MESSAGE_CRITICAL); 237 return($Output); 238 } 239 240 function Show() 241 { 242 $this->Title = T('User profile'); 243 $Output = $this->SendMail(); 244 if(array_key_exists('user', $_GET)) 245 { 246 $Output .= $this->ShowProfile(); 247 } else $Output .= ShowMessage('Nevybrán uživatel', MESSAGE_CRITICAL); 248 return($Output); 249 } 250 250 } -
trunk/Modules/User/Registration.php
r801 r816 3 3 class PageUserRegistration extends Page 4 4 { 5 6 7 5 function ShowForm() 6 { 7 if(array_key_exists('sc', $_POST)) $Human = true; 8 8 else $Human = false; 9 10 11 12 13 14 15 16 9 if(array_key_exists('user', $_POST)) $UserName = $_POST['user']; 10 else $UserName = ''; 11 if(array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 12 else $Email = ''; 13 if(array_key_exists('Team', $_POST)) $Team = $_POST['Team']; 14 else $Team = ''; 15 if(array_key_exists('Language', $_POST)) $Language = $_POST['Language']; 16 else $Language = 1; 17 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 18 $Output = '<form action="?" method="post"> 19 <fieldset><legend>'.T('New user registration').'</legend> 20 <table> 21 <tr><td colspan="2">Pozorně si přečtěte <a href="info.php">pokyny k překladu</a> a řiďte se jimi. Překládat je nutno včetně háčků a čárek!<br/><br/></td></tr> 22 <tr> 23 <td>Jsi člověk? </td>'; 24 if($Human) $Checked = ' checked="checked"'; 25 else $Checked = ''; 26 $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td> 27 </tr> 28 <tr> 29 <td>Jméno:</td> 30 <td><input type="text" name="user" value="'.$UserName.'"/></td> 31 </tr> 32 <tr> 33 <td>Heslo:</td> 34 <td><input type="password" name="pass" /></td> 35 </tr> 36 <tr> 37 <td>Potvrzení Hesla: </td> 38 <td><input type="password" name="pass2" /></td> 39 </tr> 40 <tr> 41 <td>Email: </td> 42 <td><input type="text" name="Email" value="'.$Email.'"/></td> 43 </tr> 44 <tr> 45 <td>Normálně budu překládat do: </td> 46 <td>'.WriteLanguages($Language).'</td> 47 </tr> 48 <tr> 49 <td>Patřím do týmu: </td>'; 50 if($Team == '') $Selected = ' selected="selected"'; 51 else $Selected = ''; 52 $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>Žádného</option> 53 '; 54 $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`'); 55 while($Line = $DbResult->fetch_assoc()) 56 { 57 if($Team == $Line['Id']) $Selected = ' selected="selected"'; 58 else $Selected = ''; 59 $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.$Line['Name'].'</option>'; 60 } 61 $Output .= '</select></td> 62 </tr>'; 63 $Output .= '</td></tr>'. 64 '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection('').'</td></tr>'; 65 65 66 66 $Output .= '<tr><td>'; 67 68 67 $Query = 'SELECT * FROM UserTagType'; 68 $DbResult = $this->Database->query($Query); 69 69 $Output .= 'Vyberte pravidla, kterými se při překladu chcete řídit:</td><td>'; 70 70 while ($UserTag = $DbResult->fetch_array()) { 71 71 $checked = false; 72 72 73 73 $Output .= CheckBox('Tag'.$UserTag['ID'], $checked, 'CheckBox'); … … 77 77 78 78 $Output .= '<tr> 79 80 81 82 83 79 <th><input type="submit" value="Registrovat" /></th> 80 </tr> 81 </table></fieldset></form>'; 82 return($Output); 83 } 84 84 85 85 function CheckRegistration() … … 157 157 } 158 158 159 160 161 162 163 164 159 function Show() 160 { 161 $this->Title = T('User registration'); 162 $Output = ''; 163 if(array_key_exists('user', $_POST)) 164 { 165 165 $Output .= $this->CheckRegistration(); 166 167 168 166 } else $Output .= $this->ShowForm(); 167 return($Output); 168 } 169 169 } -
trunk/Modules/User/User.php
r805 r816 8 8 class ModuleUser extends AppModule 9 9 { 10 11 12 13 14 15 16 17 18 19 20 21 22 23 10 function __construct($System) 11 { 12 parent::__construct($System); 13 $this->Name = 'User'; 14 $this->Version = '1.1'; 15 $this->Creator = 'Chronos'; 16 $this->License = 'GNU/GPL'; 17 $this->Description = 'User and permission management'; 18 $this->Dependencies = array(); 19 } 20 21 function Start() 22 { 23 $this->System->User = new User($this->System); 24 24 $this->System->RegisterPage('userlist.php', 'PageUserList'); 25 26 27 28 29 30 31 32 33 34 25 $this->System->RegisterPage('Options.php', 'PageUserOptions'); 26 $this->System->RegisterPage('registrace.php', 'PageUserRegistration'); 27 $this->System->RegisterPage('user.php', 'PageUserProfile'); 28 $this->System->RegisterPage('login', 'PageUserLogin'); 29 $this->System->RegisterMenuItem(array( 30 'Title' => T('Translators'), 31 'Hint' => 'Seznam registrovaných uživatelů', 32 'Link' => $this->System->Link('/userlist.php'), 33 'Permission' => LICENCE_ANONYMOUS, 34 'Icon' => '', 35 35 ), 0); 36 36 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 37 37 $this->System->ModuleManager->Modules['Search']->RegisterSearch('user', 38 38 T('Translators'), array('Name'), '`User`', $this->System->Link('/userlist.php?search=')); 39 40 41 42 43 44 39 } 40 41 function ShowOnlineList() 42 { 43 $Output = T('Online translators').':<br />'; 44 $DbResult = $this->System->Database->query('SELECT * FROM ('. 45 45 'SELECT `User`.`Name`, `User`.`ID` FROM `UserOnline` '. 46 47 48 49 50 51 52 53 54 55 46 'JOIN `User` ON `User`.`ID` = `UserOnline`.`User` '. 47 'WHERE (`ActivityTime` >= NOW() - 300) '. 48 'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`'); 49 while($DbUser = $DbResult->fetch_assoc()) 50 { 51 $Name = '<a href="'.$this->System->Link('/user.php?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>'; 52 $Output .= $Name.'<br />'; 53 } 54 return($Output); 55 } 56 56 } 57 57 58 58 class PageUserLogin extends Page 59 59 { 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 60 function Show() 61 { 62 $Output = '<form action="'.$this->System->Link('/?action=login').'" method="post">'. 63 '<fieldset><legend>'.T('Login').'</legend> 64 <table> 65 <tr> 66 <td>'.T('Name').':</td><td><input type="text" name="LoginUser" size="13" /></td> 67 </tr> 68 <tr> 69 <td>'.T('Password').':</td><td><input type="password" name="LoginPass" size="13" /></td> 70 </tr> 71 <tr> 72 <td>'.T('Stay logged').':</td><td><input type="checkbox" name="StayLogged" /></td> 73 </tr> 74 <tr> 75 <th><input type="submit" value="'.T('Do login').'" /></th> 76 </tr> 77 </table> 78 </fieldset></form>'; 79 return($Output); 80 } 81 81 } 82 82 … … 114 114 function Login($Name, $Password, $StayLogged = false) 115 115 { 116 116 $SID = session_id(); 117 117 $DbResult = $this->Database->query('SELECT `ID` FROM `User` WHERE '. 118 118 'LOWER(`Name`) = LOWER("'.$Name.'") AND `Pass` = '.$this->CryptPasswordSQL('"'.$Password.'"', '`Salt`')); … … 147 147 function Logout() 148 148 { 149 149 $SID = session_id(); 150 150 if($this->Role != LICENCE_ANONYMOUS) 151 151 { … … 162 162 $DbResult = $this->Database->query('SELECT `User`.`PreferredVersion`,`User`.`ID`,`User`.`Team`,`User`.`Redirecting`,`User`.`Email`,`User`.`Info`,'. 163 163 '`User`.`Language`,`User`.`Name`,`User`.`GM`,`ClientVersion`.`Version` AS `PreferredVersionGame` FROM `User` '. 164 164 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `User`.`PreferredVersion` '. 165 165 'WHERE `User`.`ID` = '.$this->Id); 166 166 if($DbResult->num_rows > 0) … … 230 230 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 231 231 } else { 232 233 234 232 if(GetRemoteAddress() != '') $HostName = gethostbyaddr(GetRemoteAddress()); 233 else $HostName = ''; 234 $this->Database->insert('UserOnline', array('SessionId' => $SID, 235 235 'User' => null, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()', 236 236 'IpAddress' => GetRemoteAddress(), 'HostName' => $HostName, 237 237 'ScriptName' => GetRequestURI())); 238 238 } 239 239 240 240 // Logged permanently? 241 242 243 244 245 246 247 248 249 250 251 252 253 254 } 255 256 241 if(array_key_exists('LoginHash', $_COOKIE)) 242 { 243 $DbResult = $this->Database->query('SELECT * FROM `UserOnline` WHERE `User`='.$_COOKIE['LoginUserId']. 244 ' AND `StayLogged`=1 AND SessionId!="'.$SID.'"'); 245 if($DbResult->num_rows > 0) 246 { 247 $DbRow = $DbResult->fetch_assoc(); 248 if(sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash']) 249 { 250 $this->Database->query('DELETE FROM `UserOnline` WHERE `SessionId`="'.$SID.'"'); 251 $this->Database->query('UPDATE `UserOnline` SET `SessionId`="'.$SID.'" WHERE `Id`='.$DbRow['Id']); 252 } 253 } 254 } 255 256 // Check login 257 257 $Query = $this->Database->select('UserOnline', '*', '`SessionId`="'.$SID.'"'); 258 258 $Row = $Query->fetch_assoc(); 259 259 if($Row['User'] != '') 260 260 { 261 261 $this->Id = $Row['User']; 262 262 $this->Load(); 263 263 } else -
trunk/Modules/User/UserList.php
r637 r816 5 5 class PageUserList extends Page 6 6 { 7 8 9 10 11 12 13 14 15 16 17 18 19 20 } else $SearchQuery = ''; 7 function Show() 8 { 9 $this->Title = T('Translators'); 10 ImgLevelUpdate(); 11 12 $Output = ''; 13 if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 14 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 15 if(array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 16 if($_SESSION['search'] != '') 17 { 18 $SearchQuery = ' AND (`User`.`Name` LIKE "%'.$_SESSION['search'].'%")'; 19 $Output .= '<div><a href="?search=">'.sprintf(T('Disable filter "%s"'), $_SESSION['search']).'</a></div>'; 20 } else $SearchQuery = ''; 21 21 22 22 $TeamFilter = ''; 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 $Output .= $Order['Output']; 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 } 23 if(array_key_exists('team', $_GET)) 24 { 25 $TeamId = $_GET['team'] * 1; 26 $DbResult = $this->Database->select('Team', 'Name', 'Id='.$TeamId); 27 if($DbResult->num_rows > 0) 28 { 29 $Team = $DbResult->fetch_assoc(); 30 $Output .= '<h3>'.sprintf(T('Users in team %s'), $Team['Name']).'</h3>'; 31 $TeamFilter = ' AND (`Team`='.$_GET['team'].')'; 32 } else { 33 $Output .= ShowMessage(sprintf(T('Team %d not found'), $TeamId), MESSAGE_CRITICAL); 34 } 35 } else 36 { 37 $Output .= '<h3>'.T('User list').'</h3>'; 38 } 39 40 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `User` WHERE 1'.$SearchQuery.$TeamFilter); 41 $DbRow = $DbResult->fetch_row(); 42 $PageList = GetPageList($DbRow[0]); 43 44 $Output .= $PageList['Output']. 45 '<table class="BaseTable">'; 46 47 $TableColumns = array( 48 array('Name' => 'Name', 'Title' => T('Name')), 49 array('Name' => 'TranslatedCount', 'Title' => T('Translated count')), 50 array('Name' => 'XP', 'Title' => T('Level')), 51 array('Name' => 'XP', 'Title' => T('Experience')), 52 //array('Name' => 'GM', 'Title' => T('GM')), 53 array('Name' => 'LastLogin', 'Title' => T('Last logged in')), 54 array('Name' => 'RegistrationTime', 'Title' => T('Registration time')), 55 ); 56 $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1); 57 $Output .= $Order['Output']; 58 59 $Query = 'SELECT `User`.`ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount`, `RegistrationTime` '. 60 'FROM `User` '. 61 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '. 62 'WHERE 1'.$SearchQuery.$TeamFilter.$Order['SQL'].$PageList['SQLLimit']; 63 64 $DbResult = $this->Database->query($Query); 65 while($Line = $DbResult->fetch_assoc()) 66 { 67 $XP = GetLevelMinMax($Line['XP']); 68 $Output .= '<tr><td><a href="user.php?user='.$Line['ID'].'">'.$Line['Name'].'</a></td>'. 69 '<td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&group=0&state=2" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'. 70 '<td>'.$XP['Level'].'</td>'. 71 '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'. 72 //<td>'.$Moderators[$Line['GM']].'</td> 73 '<td>'.HumanDate($Line['LastLogin']).'</td>'. 74 '<td>'.HumanDate($Line['RegistrationTime']).'</td></tr>'; 75 } 76 $Output .= '</table>'. 77 $PageList['Output']; 78 79 return($Output); 80 } 81 81 } -
trunk/Modules/Wiki/Wiki.php
r609 r816 13 13 $this->Dependencies = array(); 14 14 } 15 15 16 16 function Install() 17 17 { … … 22 22 { 23 23 parent::UnInstall(); 24 } 25 24 } 25 26 26 function Start() 27 27 { … … 29 29 $this->LoadPages(); 30 30 } 31 31 32 32 function Stop() 33 33 { 34 35 } 36 34 parent::Stop(); 35 } 36 37 37 function LoadPages() 38 38 { 39 40 41 42 43 44 45 46 47 48 49 50 39 $DbResult = $this->Database->select('WikiPage', '*', 'VisibleInMenu=1'); 40 while($DbRow = $DbResult->fetch_assoc()) 41 { 42 $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki'); 43 $this->System->RegisterMenuItem(array( 44 'Title' => $DbRow['Name'], 45 'Hint' => '', 46 'Link' => $this->System->Link('/'.$DbRow['NormalizedName'].'/'), 47 'Permission' => LICENCE_ANONYMOUS, 48 'Icon' => '', 49 ), 6); 50 } 51 51 } 52 52 } … … 54 54 class PageWiki extends Page 55 55 { 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 } else 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 $Output = ShowMessage('Wiki stránka uložena', MESSAGE_INFORMATION); 141 142 143 144 145 146 147 148 149 { 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 '<td><a href="'.$this->System->Link('/user.php?user='.$PageContent['User']).'">'.$PageContent['UserName'].'</a></td>'.183 184 185 } 186 187 188 189 190 191 192 193 194 56 function Show() 57 { 58 if(array_key_exists('Action', $_GET)) 59 { 60 if($_GET['Action'] == 'Edit') $Output = $this->EditContent(); 61 else if($_GET['Action'] == 'EditSave') $Output = $this->SaveContent(); 62 else if($_GET['Action'] == 'History') $Output = $this->ShowHistory(); 63 else $Output = $this->ShowContent(); 64 } else $Output = $this->ShowContent(); 65 return($Output); 66 } 67 68 function ShowContent() 69 { 70 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 71 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 72 if($DbResult->num_rows > 0) 73 { 74 $DbRow = $DbResult->fetch_assoc(); 75 if(array_key_exists('ver', $_GET)) 76 { 77 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$_GET['ver']*1); 78 if($DbResult2->num_rows > 0) 79 { 80 $DbRow2 = $DbResult2->fetch_assoc(); 81 $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>'; 82 $Output .= $DbRow2['Content']; 83 if($this->System->User->Licence(LICENCE_MODERATOR)) 84 $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>'; 85 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 86 } else 87 { 88 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1'); 89 if($DbResult2->num_rows > 0) 90 { 91 $DbRow2 = $DbResult2->fetch_assoc(); 92 $Output = '<h3>'.$DbRow['Name'].'</h3>'; 93 $Output .= $DbRow2['Content']; 94 if($this->System->User->Licence(LICENCE_MODERATOR)) 95 $Output .= '<hr><div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>'; 96 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 97 } 98 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 99 return($Output); 100 } 101 102 function EditContent() 103 { 104 if($this->System->User->Licence(LICENCE_MODERATOR)) 105 { 106 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 107 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 108 if($DbResult->num_rows > 0) 109 { 110 $DbRow = $DbResult->fetch_assoc(); 111 $Output = '<h3>Úprava '.$DbRow['Name'].'</h3>'; 112 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1'); 113 if($DbResult2->num_rows > 0) 114 { 115 $DbRow2 = $DbResult2->fetch_assoc(); 116 $Output .= '<form action="?Action=EditSave" method="post">'. 117 '<textarea name="content" rows="8" cols="80" onkeydown="ResizeTextArea(this)" class="textedit">'.$DbRow2['Content'].'</textarea><br/>'. 118 '<input type="submit" name="save" value="Uložit"/> '. 119 '<input type="button" name="cancel" value="Zrušit" onclick="location.href=\'?\'"/>'. 120 '</form>'; 121 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 122 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 123 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 124 return($Output); 125 } 126 127 function SaveContent() 128 { 129 if($this->System->User->Licence(LICENCE_MODERATOR)) 130 { 131 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 132 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 133 if($DbResult->num_rows > 0) 134 { 135 $DbRow = $DbResult->fetch_assoc(); 136 if(array_key_exists('content', $_POST) and array_key_exists('save', $_POST)) 137 { 138 $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']), 139 'User' => $this->System->User->Id, 'Time' => 'NOW()', 'Page' => $DbRow['Id'])); 140 $Output = ShowMessage('Wiki stránka uložena', MESSAGE_INFORMATION); 141 } else $Output = ShowMessage('Nezadána platná data', MESSAGE_CRITICAL); 142 $Output .= $this->ShowContent(); 143 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 144 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 145 return($Output); 146 } 147 148 function ShowHistory() 149 { 150 if($this->System->User->Licence(LICENCE_MODERATOR)) 151 { 152 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 153 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 154 if($DbResult->num_rows > 0) 155 { 156 $DbRow = $DbResult->fetch_assoc(); 157 158 $Output = '<h3>Historie stránky '.$DbRow['Name'].'</h3>'; 159 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM `WikiPageContent` WHERE Page='.$DbRow['Id']); 160 $DbRow2 = $DbResult2->fetch_row(); 161 $PageList = GetPageList($DbRow2[0]); 162 163 $Output .= $PageList['Output']; 164 $Output .= '<table class="BaseTable">'; 165 166 $TableColumns = array( 167 array('Name' => 'Time', 'Title' => 'Čas'), 168 array('Name' => 'User', 'Title' => 'Uživatel'), 169 array('Name' => 'Action', 'Title' => 'Akce'), 170 ); 171 172 $Order = GetOrderTableHeader($TableColumns, 'Time', 1); 173 $Output .= $Order['Output']; 174 175 $DbResult2 = $this->Database->query('SELECT *, (SELECT `Name` FROM `User` WHERE `User`.`ID`=`WikiPageContent`.`User`) AS `UserName` '. 176 ' FROM `WikiPageContent` WHERE Page='. 177 $DbRow['Id'].' '.$Order['SQL'].$PageList['SQLLimit']); 178 while($PageContent = $DbResult2->fetch_assoc()) 179 { 180 $Output .= '<tr>'. 181 '<td>'.HumanDateTime($PageContent['Time']).'</td>'. 182 '<td><a href="'.$this->System->Link('/user.php?user='.$PageContent['User']).'">'.$PageContent['UserName'].'</a></td>'. 183 '<td><a href="?id='.$PageContent['Id'].'&ver='.$PageContent['Id'].'">Zobrazit</a></td>'; 184 $Output .= '</tr>'; 185 } 186 187 $Output .= '</table>'. 188 $PageList['Output']; 189 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 190 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 191 return($Output); 192 } 193 194 function ToHtml($text) 195 195 { 196 196 $text = preg_replace('/<source lang="(.*?)">(.*?)<\/source>/', '<pre lang="$1">$2</pre>', $text); -
trunk/admin/DefaultConfig.php
r603 r816 25 25 'ShowSQLError' => $IsDeveloper, 26 26 'LogSQLQuery' => $IsDeveloper, 27 28 27 'ShowPHPError' => $IsDeveloper, 28 'ShowRuntimeInfo' => $IsDeveloper, 29 29 'FormatOutput' => $IsDeveloper, 30 30 'ItemsPerPage' => 40, 31 31 'TempFolder' => 'tmp/', 32 32 'SourceFolder' => 'source/', 33 33 'GameVersion' => '3.3.5a', 34 34 'VisiblePagingItems' => 20, 35 35 'Timezone' => 'Europe/Prague', … … 39 39 ), 40 40 'ForbiddedUserNames' => array('addon', 'admin', 'administrator'), 41 41 'ExportTaskProcessPeriod' => 10, 42 42 'MaxExportPerUser' => 10, 43 43 'AoWoWExportId' => 1, 44 'OriginalLanguage' => 1, 45 44 'OriginalLanguage' => 1, 45 'SystemPassword' => '', 46 46 ); -
trunk/admin/UpdateTrace.php
r811 r816 2524 2524 $Manager->Execute('ALTER TABLE `User` ADD INDEX ( `PreferredVersion` )'); 2525 2525 $Manager->Execute('ALTER TABLE `User` ADD FOREIGN KEY ( `PreferredVersion` ) '. 2526 2526 'REFERENCES `ClientVersion` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;'); 2527 2527 $Manager->Execute('ALTER TABLE `User` ADD `Info` TEXT NOT NULL'); 2528 2528 } … … 2571 2571 { 2572 2572 $Manager->Execute('CREATE TABLE IF NOT EXISTS `WikiPage` ( 2573 2574 2575 2576 2577 2578 2579 2573 `Id` int(11) NOT NULL AUTO_INCREMENT, 2574 `Name` varchar(255) NOT NULL, 2575 `NormalizedName` varchar(255) NOT NULL, 2576 `VisibleInMenu` int(11) NOT NULL, 2577 PRIMARY KEY (`Id`), 2578 UNIQUE KEY `Name` (`Name`), 2579 KEY `VisibleInMenu` (`VisibleInMenu`) 2580 2580 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 2581 2581 2582 2582 $Manager->Execute('CREATE TABLE IF NOT EXISTS `WikiPageContent` ( 2583 2584 2585 2586 2587 2588 2589 2590 2583 `Id` int(11) NOT NULL AUTO_INCREMENT, 2584 `Page` int(11) NOT NULL, 2585 `Time` datetime NOT NULL, 2586 `Content` text NOT NULL, 2587 `User` int(11) NOT NULL, 2588 PRIMARY KEY (`Id`), 2589 KEY `User` (`User`), 2590 KEY `Page` (`Page`) 2591 2591 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 2592 2592 … … 2611 2611 function UpdateTo600($Manager) 2612 2612 { 2613 2613 $Manager->Execute("INSERT INTO `LogType` (`Id` ,`Name` ,`Color` ,`Description`) 2614 2614 VALUES (NULL , 'Nenalezené', 'teal', 'Nenalezené stránky');"); 2615 2615 } … … 2617 2617 function UpdateTo604($Manager) 2618 2618 { 2619 2619 $Manager->Execute("INSERT INTO `ClientVersion` (`Id` ,`Version` ,`BuildNumber` ,`ReleaseDate` ,`Title` ,`Imported`) 2620 2620 VALUES ( NULL , '5.2.0', '16650', '2013-03-05', 'The Thunder King', 0 2621 2621 ), ( NULL , '5.3.0', '16977', '2013-05-21', 'Escalation', 0 … … 2651 2651 function UpdateTo639($Manager) 2652 2652 { 2653 2653 $Manager->Execute('ALTER TABLE `ServerList` ADD `ClientVersion` INT NOT NULL , 2654 2654 ADD INDEX ( `ClientVersion` ) ;'); 2655 2655 $Manager->Execute('ALTER TABLE `ServerList` ADD FOREIGN KEY ( `ClientVersion` ) REFERENCES `ClientVersion` ( … … 2667 2667 function UpdateTo646($Manager) 2668 2668 { 2669 2669 $Manager->Execute('ALTER TABLE `Export` ADD `AllUsers` TINYINT( 1 ) NOT NULL ;'); 2670 2670 2671 2671 } … … 2673 2673 function UpdateTo666($Manager) 2674 2674 { 2675 2676 2675 $Manager->Execute('INSERT INTO `ExportOutputType` (`Id` ,`Name`) VALUES (\'10\' , \'Instalace - Instalační soubor pro klienta\');'); 2676 $Manager->Execute('INSERT INTO `ExportVersion` (`Id` ,`ExportType` ,`ClientVersion`)VALUES (NULL , \'10\', \'84\');'); 2677 2677 } 2678 2678 2679 2679 function UpdateTo678($Manager) 2680 2680 { 2681 2681 $Manager->Execute('INSERT INTO `ExportVersion` (`Id` ,`ExportType` ,`ClientVersion`)VALUES (NULL , \'10\', \'11\');'); 2682 2682 } 2683 2683 2684 2684 function UpdateTo695($Manager) 2685 2685 { 2686 2686 $Manager->Execute('CREATE TABLE IF NOT EXISTS `ExportGroupItem` (`Id` int(11) NOT NULL AUTO_INCREMENT,'. 2687 2687 '`Export` int(11) NOT NULL,`GroupItem` int(11) NOT NULL, PRIMARY KEY (`Id`), KEY `Export` (`Export`),'. 2688 2688 ' KEY `GroupItem` (`GroupItem`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'); 2689 2689 $Manager->Execute('ALTER TABLE `ExportGroupItem`'. 2690 2690 'ADD CONSTRAINT `ExportGroupItem_ibfk_1` FOREIGN KEY (`Export`) REFERENCES `Export` (`Id`),'. 2691 2691 'ADD CONSTRAINT `ExportGroupItem_ibfk_2` FOREIGN KEY (`GroupItem`) REFERENCES `GroupItem` (`Id`);'); … … 2694 2694 function UpdateTo712($Manager) 2695 2695 { 2696 2696 $Manager->Execute('CREATE TABLE IF NOT EXISTS `UserOnline` ( 2697 2697 `Id` int(11) NOT NULL AUTO_INCREMENT, 2698 2698 `User` int(11) DEFAULT NULL, … … 2711 2711 function UpdateTo716($Manager) 2712 2712 { 2713 2713 $Manager->Execute('ALTER TABLE `Export` ADD `Featured` TINYINT NOT NULL'); 2714 2714 } 2715 2715 2716 2716 function UpdateTo725($Manager) 2717 2717 { 2718 2718 $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;'); 2719 2719 } 2720 2720 2721 2721 function UpdateTo731($Manager) 2722 2722 { 2723 2723 $Manager->Execute('ALTER TABLE `ExportTask` ADD `Progress` TINYINT NOT NULL ;'); 2724 2724 } 2725 2725 2726 2726 function UpdateTo732($Manager) 2727 2727 { 2728 2728 $Manager->Execute('ALTER TABLE `ExportTask` CHANGE `Progress` `Progress` DOUBLE( 4, 2 ) NOT NULL ;'); 2729 2729 } 2730 2730 … … 2817 2817 2818 2818 $Updates = array( 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2819 498 => array('Revision' => 506, 'Function' => 'UpdateTo506'), 2820 506 => array('Revision' => 510, 'Function' => 'UpdateTo510'), 2821 510 => array('Revision' => 524, 'Function' => 'UpdateTo524'), 2822 524 => array('Revision' => 537, 'Function' => 'UpdateTo537'), 2823 537 => array('Revision' => 539, 'Function' => 'UpdateTo539'), 2824 539 => array('Revision' => 543, 'Function' => 'UpdateTo543'), 2825 543 => array('Revision' => 567, 'Function' => 'UpdateTo567'), 2826 567 => array('Revision' => 574, 'Function' => 'UpdateTo574'), 2827 574 => array('Revision' => 585, 'Function' => 'UpdateTo585'), 2828 585 => array('Revision' => 600, 'Function' => 'UpdateTo600'), 2829 600 => array('Revision' => 604, 'Function' => 'UpdateTo604'), 2830 604 => array('Revision' => 609, 'Function' => 'UpdateTo609'), 2831 609 => array('Revision' => 610, 'Function' => 'UpdateTo610'), 2832 610 => array('Revision' => 639, 'Function' => 'UpdateTo639'), 2833 639 => array('Revision' => 646, 'Function' => 'UpdateTo646'), 2834 646 => array('Revision' => 666, 'Function' => 'UpdateTo666'), 2835 666 => array('Revision' => 678, 'Function' => 'UpdateTo678'), 2836 678 => array('Revision' => 695, 'Function' => 'UpdateTo695'), 2837 695 => array('Revision' => 712, 'Function' => 'UpdateTo712'), 2838 712 => array('Revision' => 716, 'Function' => 'UpdateTo716'), 2839 716 => array('Revision' => 725, 'Function' => 'UpdateTo725'), 2840 725 => array('Revision' => 731, 'Function' => 'UpdateTo731'), 2841 731 => array('Revision' => 732, 'Function' => 'UpdateTo732'), 2842 732 => array('Revision' => 748, 'Function' => 'UpdateTo748'), 2843 2843 748 => array('Revision' => 787, 'Function' => 'UpdateTo787'), 2844 2844 787 => array('Revision' => 803, 'Function' => 'UpdateTo803'), -
trunk/admin/index.php
r734 r816 10 10 { 11 11 global $System, $Config; 12 13 14 $Output = '<h3>Volby pro správu</h3>'; 15 12 13 14 $Output = '<h3>Volby pro správu</h3>'; 15 16 16 $Output .= '<br />'. 17 17 '<a href="https://'.$Config['Web']['Host'].'/phpmyadmin/">Správa databáze</a><br/>'. … … 22 22 '<small>Procházení všech systémových záznamů akcí a událostí</small><br/><br/>'. 23 23 '<a href="'.$System->Link('/admin/?action=img_level').'">Generování obrázků úrovní překladatelů</a><br/>'. 24 '<small>Ihned provede přegenerování všech obrázků úrovní překladatelů</small><br/><br/>'. 24 '<small>Ihned provede přegenerování všech obrázků úrovní překladatelů</small><br/><br/>'. 25 25 '<a href="'.$System->Link('/news/?a=add').'">Přidání aktuality</a><br/>'. 26 '<small>Přidá aktualitu na hlavní stranu projektu</small><br/><br/>'. 26 '<small>Přidá aktualitu na hlavní stranu projektu</small><br/><br/>'. 27 27 '<a href="'.$System->Link('/admin/?action=testing').'">Testování</a><br/>'. 28 '<small>Testovací funkce</small><br/><br/>'. 28 '<small>Testovací funkce</small><br/><br/>'. 29 29 '<a href="'.$System->Link('/admin/?action=locale').'">Exportovat překlad rozhraní</a><br/>'. 30 30 '<small>Exportovat texty z PHP souborů pro překlad rozhraní</small><br/><br/>'. 31 31 '<a href="'.$System->Link('/admin/?action=uncomplete').'">Nastavit nekompletní texty</a><br/>'. 32 '<small>Nastaví questy, které jsou v popisu nebo objektu stejné jako nedokončené</small><br/><br/>'. 32 '<small>Nastaví questy, které jsou v popisu nebo objektu stejné jako nedokončené</small><br/><br/>'. 33 33 '<a href="'.$System->Link('/admin/?action=repairversion').'">Opravit špatně nastavené VersionEnd</a><br/>'. 34 '<small>Nastaví špatné version end a Take na originální text, které vzniklo v důsledku importu a špatně indexovaného indexu Take</small><br/><br/>'. 34 '<small>Nastaví špatné version end a Take na originální text, které vzniklo v důsledku importu a špatně indexovaného indexu Take</small><br/><br/>'. 35 35 '<a href="'.$System->Link('/admin/?action=dbcstructure').'">Připravit dbc strukturu</a><br/>'. 36 '<small>Otevře dbc soubory převedené do textové formy pro přípravu struktury pro import</small><br/><br/>'. 36 '<small>Otevře dbc soubory převedené do textové formy pro přípravu struktury pro import</small><br/><br/>'. 37 37 '<a href="'.$System->Link('/admin/?action=merge').'">Sjednocení textů</a><br/>'. 38 '<small>Sjednotí stejné originální texty v databázi</small><br/><br/>'; 38 '<small>Sjednotí stejné originální texty v databázi</small><br/><br/>'; 39 39 return($Output); 40 40 } … … 53 53 { 54 54 global $System; 55 56 $DbResult = $System->Database->query($Query); 55 56 $DbResult = $System->Database->query($Query); 57 57 } 58 58 59 59 function ShowPHPInfo() 60 60 { 61 return(phpinfo()); 61 return(phpinfo()); 62 62 } 63 63 … … 65 65 { 66 66 global $System; 67 67 68 68 $this->Title = T('Testing'); 69 69 $Output = '<a href="'.$System->Link('/admin/?action=phpinfo').'">PHP info</a><br/>'. … … 81 81 { 82 82 global $System; 83 84 85 .'`TextQuest` AS `gs_tran` ' 86 .'JOIN `TextQuest` AS `gs_orig` ON `gs_orig`.`Entry` = `gs_tran`.`Entry` ' 83 84 $DbResult = $System->Database->query('SELECT `gs_tran`.`ID`,`gs_tran`.`Details`,`gs_tran`.`Objectives` FROM ' 85 .'`TextQuest` AS `gs_tran` ' 86 .'JOIN `TextQuest` AS `gs_orig` ON `gs_orig`.`Entry` = `gs_tran`.`Entry` ' 87 87 .'AND `gs_orig`.`Language` =0 ' 88 88 .'WHERE `gs_tran`.`Language` !=0 ' … … 92 92 .' OR ( `gs_tran`.`Details` != `gs_orig`.`Details` AND "" = `gs_tran`.`Details` )' 93 93 .' OR (`gs_tran`.`Objectives` = `gs_orig`.`Objectives` AND "" != `gs_orig`.`Objectives` ))' 94 ); 94 ); 95 95 $Output = 'Questy: <br />'; 96 97 98 $Output .= $quest['ID'].', '; 99 100 96 while($quest = $DbResult->fetch_assoc()) 97 { 98 $Output .= $quest['ID'].', '; 99 $System->Database->query('UPDATE `TextQuest` SET `complete` = 0 WHERE ID='.$quest['ID']); 100 } 101 101 $Output .= '<br / ><br / >Questy nastaveny jako nedokončené!'; 102 102 return($Output); 103 } 103 } 104 104 105 105 function RepairVersionEnd() … … 107 107 global $System,$TranslationTree; 108 108 $Output = ''; 109 foreach($TranslationTree as $Group) 109 foreach($TranslationTree as $Group) 110 110 // $Group = $TranslationTree[1]; 111 111 { 112 112 113 113 $sql = 'SELECT `T`.`ID`,`T`.`Take`,`sub1`.`ID` as `origID`,T.`VersionStart`,T.`VersionEnd`,`sub1`.`VersionStart` as OrigStart,sub1.`VersionEnd` as `OrigEnd` FROM `'.$Group['TablePrefix'] .'` as `T` '. 114 114 ' JOIN `'.$Group['TablePrefix'].'` as `sub1` ON `sub1`.`Language` = 0 AND `T`.`Entry` = `sub1`.`Entry` AND `T`.`VersionStart` = `sub1`.`VersionStart` '. 115 ' WHERE `T`.`Take` != `sub1`.`ID` AND `T`.`Language` != 0'. 116 // ' WHERE `T`.`Language` != 0 AND `T`.`VersionEnd` != `sub1`.`VersionEnd` AND `T`.`Take` NOT IN'. 115 ' WHERE `T`.`Take` != `sub1`.`ID` AND `T`.`Language` != 0'. 116 // ' WHERE `T`.`Language` != 0 AND `T`.`VersionEnd` != `sub1`.`VersionEnd` AND `T`.`Take` NOT IN'. 117 117 // '(Select `ID` FROM `'.$Group['TablePrefix'].'` as `sub2` WHERE `sub2`.`Language` = 0 AND `T`.`Entry` = `sub2`.`Entry` AND `T`.`VersionStart` = `sub2`.`VersionStart`)'. 118 ' '; //LIMIT 1000 118 ' '; //LIMIT 1000 119 119 //echo $sql; 120 120 $DbResult = $System->Database->query($sql); 121 121 echo ': <br />'.$Group['TablePrefix'].': <br />'; 122 123 124 echo ($line['ID'].', '); 125 126 122 while($line = $DbResult->fetch_assoc()) 123 { 124 echo ($line['ID'].', '); 125 $System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$line['OrigEnd'].', `Take` = '.$line['origID'].' WHERE ID='.$line['ID']); 126 } 127 127 echo '<br / >Verze '.$Group['TablePrefix'].' opraveny!'; 128 128 } 129 129 return('Hotovo!'); 130 } 130 } 131 131 132 132 function StripText($Text) { … … 134 134 $Text = str_replace(' ', '', $Text); 135 135 return ($Text); 136 } 136 } 137 137 138 138 function MergeSameText() … … 140 140 global $System,$TranslationTree; 141 141 $Output = ''; 142 foreach($TranslationTree as $Group) 142 foreach($TranslationTree as $Group) 143 143 // $Group = $TranslationTree[1]; 144 144 { 145 145 146 146 $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '. 147 147 // ' JOIN `'.$Group['TablePrefix'].'` as `sub1` ON `sub1`.`Language` = 0 AND `T`.`Entry` = `sub1`.`Entry` AND `T`.`VersionStart` < `sub1`.`VersionStart` '. 148 ' WHERE `T`.`Language` = 0 '. 149 ' ORDER BY `T`.`VersionStart`'; //LIMIT 1000 148 ' WHERE `T`.`Language` = 0 '. 149 ' ORDER BY `T`.`VersionStart`'; //LIMIT 1000 150 150 //echo $sql; 151 151 $DbResult = $System->Database->query($sql); 152 152 echo ': <br />'.$Group['TablePrefix'].': '; 153 154 153 while($line = $DbResult->fetch_assoc()) 154 { 155 155 $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '. 156 ' WHERE `T`.`Language` = 0 AND `T`.`VersionStart` > '.$line['VersionEnd'].' AND `T`.`Entry` = '.$line['Entry']. 157 ' ORDER BY `T`.`VersionStart` LIMIT 1'; //LIMIT 1000 156 ' WHERE `T`.`Language` = 0 AND `T`.`VersionStart` > '.$line['VersionEnd'].' AND `T`.`Entry` = '.$line['Entry']. 157 ' ORDER BY `T`.`VersionStart` LIMIT 1'; //LIMIT 1000 158 158 // echo $sql; 159 160 159 $DbResult2 = $System->Database->query($sql); 160 if($DbResult2->num_rows > 0) { 161 161 $line2 = $DbResult2->fetch_assoc(); 162 163 $Same = true; 162 163 $Same = true; 164 164 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 165 if ($this->StripText($line[$Column['Column']]) <> $this->StripText($line2[$Column['Column']])) 165 if ($this->StripText($line[$Column['Column']]) <> $this->StripText($line2[$Column['Column']])) 166 166 $Same = false; 167 } 167 } 168 168 if ($Same) { 169 169 echo $line['ID'].'='.$line2['ID'].' ('; 170 //$System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `Take` = NULL WHERE ID='.$line2['ID']);170 // $System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `Take` = NULL WHERE ID='.$line2['ID']); 171 171 172 172 $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '. 173 ' WHERE `T`.`Entry` = '.$line['Entry'].' AND (`T`.`Take` = '.$line['ID'].' OR `T`.`Take` = '.$line2['ID'].') '; 174 175 173 ' WHERE `T`.`Entry` = '.$line['Entry'].' AND (`T`.`Take` = '.$line['ID'].' OR `T`.`Take` = '.$line2['ID'].') '; 174 $DbResult3 = $System->Database->query($sql); 175 while($line3 = $DbResult3->fetch_assoc()) { 176 176 echo $line3['ID'].' '; 177 177 $System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$line2['VersionEnd'].', `VersionStart` = '.$line['VersionStart'].', `Take` = '.$line['ID'].' WHERE ID='.$line3['ID']); 178 178 } 179 179 180 181 180 $System->Database->query('DELETE FROM`'.$Group['TablePrefix'].'` WHERE ID='.$line2['ID']); 181 $System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$line2['VersionEnd'].' WHERE ID='.$line['ID']); 182 182 echo '), '; 183 183 } 184 } 185 184 } 185 } 186 186 echo 'Texty '.$Group['TablePrefix'].' sjednoceny!'; 187 187 } 188 188 return('Hotovo!'); 189 } 189 } 190 190 191 191 function DbcStructure() { … … 193 193 $Output = ''; 194 194 if (array_key_exists('GameVersion', $_GET)) { 195 $_SESSION['GameVersion'] = $_GET['GameVersion']; 196 } 197 if (!array_key_exists('GameVersion', $_SESSION)) 198 $_SESSION['GameVersion'] = $System->Config['Web']['GameVersion']; 199 195 $_SESSION['GameVersion'] = $_GET['GameVersion']; 196 } 197 if (!array_key_exists('GameVersion', $_SESSION)) 198 $_SESSION['GameVersion'] = $System->Config['Web']['GameVersion']; 199 200 200 $Output .= '<br />Nastavená verze: '.$_SESSION['GameVersion'].'<br />'; 201 201 202 202 if (array_key_exists('GroupItem', $_GET)) { 203 203 $DbResult = $System->Database->query('SELECT * FROM `ClientVersion` WHERE `Version` = "'.$_SESSION['GameVersion'].'"'); 204 $Version = $DbResult->fetch_assoc(); 204 $Version = $DbResult->fetch_assoc(); 205 205 $System->Database->query('INSERT INTO `GroupItemDBC` (`Id` ,`ClientVersion` ,`GroupItem` ,`ColumnIndex`)VALUES (NULL , \''.$Version['Id'].'\', \''.$_GET['GroupItem'].'\', \''.$_GET['ColumnIndex'].'\')'); 206 206 $Output .= 'vloženo <br />'; 207 } 207 } 208 208 if (array_key_exists('id', $_GET)) { 209 209 $Group = $TranslationTree[$_GET['id']]; … … 214 214 // } 215 215 // $Output .= '<input type="submit" value="uložit"></form>'; 216 217 216 217 218 218 $File = new FileStream(); 219 219 220 220 $File->OpenFile(dirname(__FILE__).'/../source/'.$_SESSION['GameVersion'].'/dbc/'.$Group['DBCFileName'].'.dbc.csv'); 221 221 222 222 //while(!$File->EOF()) 223 223 224 224 $Output .= '<table class="BaseTable">'; 225 225 $Output .= '<tr><td>'; 226 226 $Line = $File->ReadLine(); 227 227 228 228 for ($i=0;$i<substr_count($Line,',');$i++) { 229 229 $Output .= $i; … … 236 236 $Output .= '</td><td>'; 237 237 } 238 238 239 239 $Output .= '</td></tr><tr><td>'; 240 240 … … 251 251 } else { 252 252 253 $DbResult = $System->Database->query('SELECT * FROM `ClientVersion`'); 254 while($Version = $DbResult->fetch_assoc()) 253 $DbResult = $System->Database->query('SELECT * FROM `ClientVersion`'); 254 while($Version = $DbResult->fetch_assoc()) 255 255 { 256 256 $Output .= '<a href="'.$System->Link('/admin/?action=dbcstructure&GameVersion='.$Version['Version']).'">'.$Version['Version'].'</a> '; 257 257 258 } 258 } 259 259 $Output .= '<br /><br />'; 260 260 261 foreach($TranslationTree as $Group) 261 foreach($TranslationTree as $Group) 262 262 { 263 263 if ($Group['DBCFileName'] <> '') 264 264 $Output .= '<a href="'.$System->Link('/admin/?action=dbcstructure&id='.$Group['Id']).'">'.$Group['DBCFileName'].'</a><br/>'; 265 265 266 } 267 } 268 269 270 return($Output); 271 } 266 } 267 } 268 269 270 return($Output); 271 } 272 272 273 273 function ShowLocale() 274 274 { 275 276 277 278 279 280 281 282 283 284 275 global $LocaleManager, $System; 276 277 $LocaleManager->UpdateAll(dirname(dirname(__FILE__))); 278 $Output = 'Překlad rozhraní přegenerován'; 279 $Output .= '<table class="BaseTable"><tr><th>Originál</th><th>Překlad</th></tr>'; 280 foreach($LocaleManager->CurrentLocale->Texts->Data as $Index => $Item) 281 $Output .= '<tr><td>'.$Index.'</td><td>'.$Item.'</td></tr>'; 282 $Output .= '</table>'; 283 $Output .= 'Překladové soubory zaktualizovány'; 284 return($Output); 285 285 } 286 286 287 287 function Show() 288 288 { 289 289 $this->Title = T('Administration'); 290 290 $Output = ''; 291 291 if($this->System->User->Licence(LICENCE_ADMIN)) … … 305 305 else if($_GET['action'] == 'merge') $Output .= $this->MergeSameText(); 306 306 else $Output .= $this->ShowMenu(); 307 } else $Output .= $this->ShowMenu(); 307 } else $Output .= $this->ShowMenu(); 308 308 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 309 309 return($Output); 310 310 } 311 } 311 } 312 312 $Page = new PageAdmin($System); 313 313 ShowPageClass($Page); -
trunk/admin/install.php
r805 r816 20 20 { 21 21 global $UpdateManager; 22 22 23 23 $YesNo = array(false => 'Ne', true => 'Ano'); 24 24 $Output = '<h3>Správa instance</h3>'. … … 43 43 function PrepareConfig($Config) 44 44 { 45 45 $Output = ''; 46 46 if(!file_exists('../includes/config.php') and !is_writable('../includes')) 47 47 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože složka includes není povolená pro zápis!'; 48 48 if(file_exists('../includes/config.php') and !is_writable('../includes/config.php')) 49 49 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor config.php není povolen pro zápis!'; 50 50 $Output .= '<h3>Nastavení systému</h3>'. 51 51 '<form action="" method="post">'. 52 '<table>'. 52 '<table>'. 53 53 '<tr><td>Systémové heslo:</td><td> <input type="password" name="SystemPassword" value=""/></td></tr>'. 54 54 '<tr><td>Adresa serveru:</td><td> <input type="text" name="Host" value="'.$Config['Database']['Host'].'"/></td></tr>'. … … 62 62 '<tr><td>Počet položek navigace stránkování:</td><td> <input type="text" name="VisiblePagingItems" value="'.$Config['Web']['VisiblePagingItems'].'"/></td></tr>'. 63 63 '<tr><td>Počet řádků tabulek na stránku:</td><td> <input type="text" name="ItemsPerPage" value="'.$Config['Web']['ItemsPerPage'].'"/></td></tr>'. 64 64 65 65 '<tr><td colspan="2"><input type="submit" name="configure_save" value="Nastavit"/></td></tr>'. 66 '</table>'. 66 '</table>'. 67 67 '</form>'; 68 68 return($Output); … … 72 72 { 73 73 $Config = $DefaultConfig; 74 if(array_key_exists('SystemPassword', $_POST) and ($_POST['SystemPassword'] != '')) 75 74 if(array_key_exists('SystemPassword', $_POST) and ($_POST['SystemPassword'] != '')) 75 $Config['SystemPassword'] = sha1($_POST['SystemPassword']); 76 76 if(array_key_exists('Host', $_POST)) $Config['Database']['Host'] = $_POST['Host']; 77 77 if(array_key_exists('User', $_POST)) $Config['Database']['User'] = $_POST['User']; 78 if(array_key_exists('Password', $_POST) and ($_POST['Password'] != '')) 79 78 if(array_key_exists('Password', $_POST) and ($_POST['Password'] != '')) 79 $Config['Database']['Password'] = $_POST['Password']; 80 80 if(array_key_exists('Schema', $_POST)) $Config['Database']['Database'] = $_POST['Schema']; 81 81 if(array_key_exists('Title', $_POST)) $Config['Web']['Title'] = $_POST['Title']; … … 88 88 file_put_contents('../includes/config.php', $ConfigText); 89 89 $Output .= 'Konfigurace nastavena<br/>'; 90 return($Output); 90 return($Output); 91 91 } 92 92 … … 137 137 'MaxExportPerUser' => 10, 138 138 'AoWoWExportId' => 1, 139 'OriginalLanguage' => 1, 139 'OriginalLanguage' => 1, 140 140 'SystemPassword' => '".$Config['SystemPassword']."', 141 141 );"; … … 145 145 function LoginPanel() 146 146 { 147 148 149 150 151 152 153 '</form>'; 154 147 $Output = '<h3>Přihlášení k instalaci</h3>'. 148 '<form action="" method="post">'. 149 '<table>'. 150 '<tr><td>Systémové heslo:</td><td> <input type="password" name="SystemPassword" value=""/></td></tr>'. 151 '</table>'. 152 '<input type="submit" name="login" value="Přihlásit"/>'. 153 '</form>'; 154 return($Output); 155 155 } 156 156 … … 166 166 if(isset($Config)) 167 167 { 168 169 170 171 172 173 } else 174 168 if(!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = ''; 169 if(array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword']; 170 if(sha1($_SESSION['SystemPassword']) != $Config['SystemPassword']) 171 { 172 $Output .= LoginPanel(); 173 } else 174 { 175 175 $System = new System(); 176 176 $System->Init(); … … 183 183 if(array_key_exists('logout', $_POST)) 184 184 { 185 186 185 $_SESSION['SystemPassword'] = ''; 186 $Output .= 'Odhlášen'; 187 187 $Output .= LoginPanel(); 188 188 } else … … 208 208 { 209 209 $Output .= ConfigSave($Config); 210 $Output .= ControlPanel(); 211 } else 210 $Output .= ControlPanel(); 211 } else 212 212 if(array_key_exists('configure', $_POST)) 213 213 { … … 215 215 } else 216 216 { 217 $Output .= ControlPanel(); 218 } 219 220 } else 217 $Output .= ControlPanel(); 218 } 219 } 220 } else 221 221 { 222 222 if(array_key_exists('configure_save', $_POST)) 223 223 { 224 224 $Output .= ConfigSave($DefaultConfig); 225 $Output .= 'Pokračujte k přihlášení <a href="">zde</a>'; 225 $Output .= 'Pokračujte k přihlášení <a href="">zde</a>'; 226 226 } else { 227 227 $Output .= PrepareConfig($DefaultConfig); 228 228 } 229 229 } -
trunk/alert.php
r700 r816 14 14 15 15 $Output = 'SERVERALERT:'."\n"; 16 16 17 17 $Output .= 'Toto jsou aktuality z projektu wowpreklad.zdechov.net:'."\n"."\n"; 18 18 19 19 $Database = new mysqli($Config['Database']['Host'],$Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); 20 20 $Database->query('SET NAMES "'.$Config['Database']['Charset'].'"'); 21 22 21 $DbResult = $Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, '. 22 '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` ORDER BY `News`.`Time` DESC '); 23 23 while($Article = $DbResult->fetch_assoc()) 24 24 { -
trunk/img_level.php
r771 r816 14 14 $Diakrit = array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú", 15 15 "ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž"); 16 for($i = 0; $i < count($Diakrit); $i = $i + 1) 16 for($i = 0; $i < count($Diakrit); $i = $i + 1) 17 17 { 18 if(strpos($Word, $Diakrit[$i]) <> false) 18 if(strpos($Word, $Diakrit[$i]) <> false) 19 19 $Result = true; 20 20 } … … 22 22 } 23 23 24 function CreateImg($prefix, $user, $xp) 24 function CreateImg($prefix, $user, $xp) 25 25 { 26 global $index_level, $FontFile; 27 28 if($xp > 0) 26 global $index_level, $FontFile; 27 28 if($xp > 0) 29 29 { 30 30 $level = sqrt($xp / $index_level); … … 35 35 $xp_max = $xp_max - $xp_min; 36 36 $xp = $xp - $xp_min; 37 38 if($xp_max > 0) $Percent = ( $xp / $xp_max) * 100; 37 38 if($xp_max > 0) $Percent = ( $xp / $xp_max) * 100; 39 39 else $Percent = 0; 40 40 $Percent = substr($Percent, 0, 5); … … 49 49 ImageTTFText($Image, 11, 0, 10, 12, $Color3, $FontFile, $level.' Level'); 50 50 ImageTTFText($Image, 8, 0, 80, 12, $Color3, $FontFile, $xp.'/'.$xp_max.' xp '.$user); 51 51 52 52 if(!file_exists('tmp/'.$prefix.'/')) mkdir('tmp/'.$prefix.'/'); 53 53 if(!file_exists('tmp/'.$prefix.'/'.$user.'/')) mkdir('tmp/'.$prefix.'/'.$user.'/'); 54 ImagePNG($Image, 'tmp/'.$prefix.'/'.$user.'/level.png'); 54 ImagePNG($Image, 'tmp/'.$prefix.'/'.$user.'/level.png'); 55 55 } 56 56 57 function GetXPFromTranslation($UserId) 57 function GetXPFromTranslation($UserId) 58 58 { 59 59 global $System, $TranslationTree, $xp_from_word, $from_diakrit; 60 60 61 61 $xp = 0; 62 foreach($TranslationTree as $Group) 63 { 64 if($Group['TablePrefix'] != '') 62 foreach($TranslationTree as $Group) 63 { 64 if($Group['TablePrefix'] != '') 65 65 { 66 66 $GroupBy = 'GROUP BY '; 67 foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 68 { 67 foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 68 { 69 69 $GroupBy .= '`'.$TextItem['Column'].'`, '; 70 } 70 } 71 71 $GroupBy = substr($GroupBy, 0, -2); 72 72 73 73 $IDtran = $System->Database->query('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`User` = '.$UserId.') AND (`Complete` = 1) AND (`Take` IS NOT NULL) '.$GroupBy); 74 while($Line = $IDtran->fetch_array()) 75 { 74 while($Line = $IDtran->fetch_array()) 75 { 76 76 $DbResult = $System->Database->query('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE `ID` = '.$Line['Take']); 77 77 $LineComparison = $DbResult->fetch_assoc(); 78 $xp_translation = 0; 78 $xp_translation = 0; 79 79 $translated = true; 80 foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 81 { 82 if(($Line[$TextItem['Column']] <> $LineComparison[$TextItem['Column']]) and (strlen($Line[$TextItem['Column']]) > (strlen($LineComparison[$TextItem['Column']]) * 0.5))) 83 { 80 foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 81 { 82 if(($Line[$TextItem['Column']] <> $LineComparison[$TextItem['Column']]) and (strlen($Line[$TextItem['Column']]) > (strlen($LineComparison[$TextItem['Column']]) * 0.5))) 83 { 84 84 $TextArr = explode(' ', $Line[$TextItem['Column']]); 85 foreach($TextArr as $Word) 86 { 85 foreach($TextArr as $Word) 86 { 87 87 if(CheckDiakrit($Word)) $indikator = $from_diakrit; 88 88 else $indikator = 1; 89 89 $xp_translation = $xp_translation + ($indikator * $xp_from_word); 90 } 91 } else 90 } 91 } else 92 92 { 93 93 if (($Line[$TextItem['Column']] == $LineComparison[$TextItem['Column']]) and ('0' == $LineComparison['Language']) and ($LineComparison[$TextItem['Column']] <> '') and ($TextItem['Column'] <> 'ShortCut')) $translated = false; 94 94 } 95 } 95 } 96 96 if($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated 97 97 } … … 102 102 103 103 function ImgLevelUpdate() 104 { 104 { 105 105 global $System, $TranslationTree, $Config; 106 106 … … 109 109 if($DbResult->num_rows > 0) 110 110 { 111 while($LineUser = $DbResult->fetch_array()) 111 while($LineUser = $DbResult->fetch_array()) 112 112 { 113 113 // Build TranslatedCount query … … 115 115 if(count($TranslationTree) > 0) 116 116 { 117 117 foreach($TranslationTree as $Group) 118 118 if($Group['TablePrefix'] != '') 119 119 { … … 124 124 $TranslatedCount = substr($TranslatedCount, 0, -3).')'; 125 125 } else $TranslatedCount = 0; 126 127 $xp = GetXPFromTranslation($LineUser['ID']); 126 127 $xp = GetXPFromTranslation($LineUser['ID']); 128 128 $System->Database->query('UPDATE `User` SET `XP` = '.$xp.', `TranslatedCount` = '.$TranslatedCount.' WHERE `User`.`ID` = '.$LineUser['ID']); 129 129 CreateImg('user', $LineUser['Name'], $xp); … … 133 133 $DbResult = $System->Database->query('SELECT `ID`, `Name`, (SELECT AVG(`XP`) FROM `User` WHERE `Team` = `Team`.`Id`) AS `Average` '. 134 134 'FROM `Team` WHERE `ID` IN (SELECT `Team` FROM `User` WHERE `NeedUpdate` = 1)'); 135 while($LineTeam = $DbResult->fetch_array()) 135 while($LineTeam = $DbResult->fetch_array()) 136 136 { 137 137 CreateImg('team', $LineTeam['Name'], substr($LineTeam['Average'], 0, strpos($LineTeam['Average'],'.'))); //image creation … … 144 144 { 145 145 global $System; 146 146 147 147 // Do update for all users 148 148 $System->Database->query('UPDATE `User` SET `NeedUpdate` = 1'); 149 149 ImgLevelUpdate(); 150 150 151 151 $Output = '<strong>Uživatelé</strong><br/>'; 152 152 $ID = $System->Database->query('SELECT `ID`, `Name` FROM `User`'); 153 while($LineUser = $ID->fetch_array()) 153 while($LineUser = $ID->fetch_array()) 154 154 { 155 155 $Output .= '<img src="tmp/user/'.$LineUser['Name'].'/level.png" /> '.$LineUser['Name'].'<br />'; … … 158 158 $Output .= '<br/><strong>Týmy</strong><br/>'; 159 159 $ID = $System->Database->query('SELECT `ID`, `Name` FROM `Team`'); 160 while($LineTeam = $ID->fetch_array()) 160 while($LineTeam = $ID->fetch_array()) 161 161 { 162 162 $Output .= '<img src="tmp/team/'.$LineTeam['Name'].'/level.png" /> '.$LineTeam['Name'].'<br />'; 163 163 } 164 WriteLog('Přegenerovány obrázky úrovní překladatelů a týmů', LOG_TYPE_ADMINISTRATION); 164 WriteLog('Přegenerovány obrázky úrovní překladatelů a týmů', LOG_TYPE_ADMINISTRATION); 165 165 return($Output); 166 166 } -
trunk/img_statistic.php
r577 r816 9 9 $GroupId = LoadGroupIdParameter(); 10 10 $Group = $TranslationTree[$GroupId]; 11 if(array_key_exists('team', $_GET)) 11 if(array_key_exists('team', $_GET)) 12 12 { 13 13 $team = ' AND `User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.($_GET['team'] * 1).')'; 14 14 } else $team = ''; 15 15 16 if(array_key_exists('language', $_GET)) 16 if(array_key_exists('language', $_GET)) 17 17 { 18 18 $language = ' AND (`Language` = '.$_GET['language'].')'; … … 29 29 $ID = $DbResult->fetch_row(); 30 30 $NumberTranslate = $ID[0]; 31 31 32 32 $DbResult = $System->Database->query('SELECT COUNT(DISTINCT(`Entry`)) FROM `'.$Group['TablePrefix'].'` WHERE (`VersionEnd` = '.$BuildNumber_max.') AND (`Language` = '.$Config['OriginalLanguage'].')'); 33 33 $ID = $DbResult->fetch_row(); 34 34 $NumberAJ = $ID[0]; 35 35 36 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; 36 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; 37 37 else $Percent = 0; 38 38 $Percent = substr($Percent, 0, 5); … … 54 54 ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date('m.d.y H:i')); 55 55 56 Header('Content-type: image/png'); 57 ImagePNG($Image); 58 ImageDestroy($Image); 56 Header('Content-type: image/png'); 57 ImagePNG($Image); 58 ImageDestroy($Image); -
trunk/includes/Application.php
r815 r816 3 3 class Application 4 4 { 5 6 5 var $Name; 6 var $System; 7 7 8 9 8 function Run() 9 { 10 10 11 11 } 12 12 } -
trunk/includes/Database.php
r800 r816 40 40 function __construct() 41 41 { 42 43 44 45 46 47 42 $this->Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()'); 43 $this->Type = 'mysql'; // mysql, pgsql 44 $this->ShowSQLError = false; 45 $this->ShowSQLQuery = false; 46 $this->LogSQLQuery = false; 47 $this->LogFile = dirname(__FILE__).'/../Query.log'; 48 48 } 49 49 … … 63 63 function query($Query) 64 64 { 65 65 if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime(); 66 66 $this->LastQuery = $Query; 67 67 $Result = new DatabaseResult(); … … 167 167 function quote($Text) 168 168 { 169 169 return($this->PDO->quote($Text)); 170 170 } 171 171 -
trunk/includes/Locale.php
r815 r816 3 3 class LocaleText 4 4 { 5 6 7 5 var $Data; 6 var $Code; 7 var $Title; 8 8 9 9 function __construct() 10 10 { 11 12 13 14 } 15 16 17 18 19 20 21 22 23 24 25 11 $this->Data = array(); 12 $this->Code = 'en'; 13 $this->Title = 'English'; 14 } 15 16 function Load() 17 { 18 } 19 20 function Translate($Text) 21 { 22 if(array_key_exists($Text, $this->Data) and ($this->Data[$Text] != '')) 23 return($this->Data[$Text]); 24 else return($Text); 25 } 26 26 } 27 27 28 28 class LocaleFile extends Model 29 29 { 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 { 52 30 var $Texts; 31 var $Dir; 32 33 function __construct($System) 34 { 35 parent::__construct($System); 36 $this->Texts = new LocaleText(); 37 } 38 39 function Load($Language) 40 { 41 $FileName = $this->Dir.'/'.$Language.'.php'; 42 if(file_exists($FileName)) { 43 include_once($FileName); 44 $ClassName = 'LocaleText'.$Language; 45 $this->Texts = new $ClassName(); 46 } else throw new Exception('Language file '.$FileName.' not found'); 47 $this->Texts->Load(); 48 } 49 50 function AnalyzeCode($Path) 51 { 52 // Search for php files 53 53 $FileList = scandir($Path); 54 54 foreach($FileList as $FileName) 55 55 { 56 57 58 59 56 $FullName = $Path.'/'.$FileName; 57 if(($FileName == '.') or ($FileName == '..')) ; // Skip virtual items 58 else if(substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files 59 else if(is_dir($FullName)) $this->AnalyzeCode($FullName); 60 60 else if(file_exists($FullName)) 61 61 { 62 62 if(substr($FullName, -4) == '.php') 63 63 { 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 64 $Content = file_get_contents($FullName); 65 // Search occurence of T() function 66 while(strpos($Content, 'T(') !== false) 67 { 68 $Previous = strtolower(substr($Content, strpos($Content, 'T(') - 1, 1)); 69 $Content = substr($Content, strpos($Content, 'T(') + 2); 70 $Ord = ord($Previous); 71 //echo($Ord.','); 72 if(!(($Ord >= ord('a')) and ($Ord <= ord('z')))) 73 { 74 // Do for non-alpha previous character 75 $Original = substr($Content, 0, strpos($Content, ')')); 76 $Original2 = ''; 77 if((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'")) 78 $Original2 = substr($Original, 1, -1); 79 if((substr($Original, 0, 1) == '"') and (substr($Original, -1, 1) == '"')) 80 $Original2 = substr($Original, 1, -1); 81 if($Original2 != '') 82 { 83 if(!array_key_exists($Original2, $this->Texts->Data)) 84 $this->Texts->Data[$Original2] = ''; 85 } 86 } 87 } 88 88 } 89 89 } … … 93 93 function SaveToFile($FileName) 94 94 { 95 95 $Content = '<?php'."\n". 96 96 ''."\n". 97 97 'class LocaleText'.$this->Texts->Code.' extends LocaleText'."\n". 98 98 '{'."\n". 99 100 101 102 103 104 105 106 107 108 109 99 ' function Load()'."\n". 100 ' {'."\n". 101 ' $this->Code = \''.$this->Texts->Code.'\';'."\n". 102 ' $this->Title = \''.$this->Texts->Title.'\';'."\n". 103 ' $this->Data = array('."\n"; 104 foreach($this->Texts->Data as $Index => $Item) 105 { 106 $Content .= " '".$Index."' => '".$Item."',\n"; 107 } 108 $Content .= ' );'."\n". 109 ' }'."\n". 110 110 '}'."\n"; 111 111 file_put_contents($FileName, $Content); … … 114 114 function LoadFromDatabase($Database, $LangCode) 115 115 { 116 117 118 119 120 121 122 123 124 116 $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode)); 117 if($DbResult->num_rows > 0) 118 { 119 $Language = $DbResult->fetch_assoc(); 120 $this->Texts->Data = array(); 121 $DbResult = $Database->select('Locale', '`Original`, `Translated`', '`Language`='.$Language['Id']); 122 while($DbRow = $DbResult->fetch_assoc()) 123 $this->Texts->Data[$DbRow['Original']] = $DbRow['Translated']; 124 } 125 125 } 126 126 127 127 function SaveToDatabase(Database $Database, $LangCode) 128 128 { 129 130 131 132 133 134 135 136 137 129 $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode)); 130 if($DbResult->num_rows > 0) 131 { 132 $Language = $DbResult->fetch_assoc(); 133 $Database->delete('Locale', '`Language`='.$Language['Id']); 134 foreach($this->Texts->Data as $Index => $Item) 135 $Database->query('INSERT INTO `Locale` (`Language`,`Original`,`Translated`) '. 136 'VALUES('.$Language['Id'].','.$Database->quote($Index).','.$Database->quote($Item).')'); 137 } 138 138 } 139 139 140 140 function UpdateToDatabase(Database $Database, $LangCode) 141 141 { 142 143 144 145 146 147 { 148 149 150 142 $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode)); 143 if($DbResult->num_rows > 0) 144 { 145 $Language = $DbResult->fetch_assoc(); 146 foreach($this->Texts->Data as $Index => $Item) 147 { 148 $DbResult = $Database->select('Locale', '*', '(`Original` ='.$Database->quote($Index).') AND (`Language`='.($Language['Id']).')'); 149 if($DbResult->num_rows > 0) 150 $Database->update('Locale', '(`Language`='.($Language['Id']).') AND '. 151 151 '(`Original` ='.$Database->quote($Index).')', array('Translated' => $Item)); 152 152 else $Database->insert('Locale', array('Language' => $Language['Id'], 153 153 'Original' => $Index, 'Translated' => $Item)); 154 154 } 155 155 } 156 156 } 157 157 } … … 159 159 class LocaleManager extends Model 160 160 { 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 161 var $CurrentLocale; 162 var $Codes; 163 var $Dir; 164 165 function __construct($System) 166 { 167 parent::__construct($System); 168 $this->Codes = array('en'); 169 $this->CurrentLocale = new LocaleFile($System); 170 } 171 172 function LoadAvailable() 173 { 174 $this->Available = array(); 175 $FileList = scandir($this->Dir); 176 176 foreach($FileList as $FileName) 177 177 { 178 179 180 181 182 183 184 185 186 187 } 188 189 190 191 192 193 178 if(substr($FileName, -4) == '.php') 179 { 180 $Code = substr($FileName, 0, -4); 181 $Locale = new LocaleFile($this->System); 182 $Locale->Dir = $this->Dir; 183 $Locale->Load($Code); 184 $this->Available['Code'] = array('Code' => $Code, 'Title' => $Locale->Texts->Title); 185 } 186 } 187 } 188 189 function UpdateAll($Directory) 190 { 191 $Locale = new LocaleFile($this->System); 192 $Locale->AnalyzeCode($Directory); 193 $FileList = scandir($this->Dir); 194 194 foreach($FileList as $FileName) 195 195 { 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 196 if(substr($FileName, -4) == '.php') 197 { 198 $FileLocale = new LocaleFile($this->System); 199 $FileLocale->Dir = $this->Dir; 200 $FileLocale->Load(substr($FileName, 0, -4)); 201 202 // Add new 203 foreach($Locale->Texts->Data as $Index => $Item) 204 if(!array_key_exists($Index, $FileLocale->Texts->Data)) 205 $FileLocale->Texts->Data[$Index] = $Item; 206 // Remove old 207 foreach($FileLocale->Texts->Data as $Index => $Item) 208 if(!array_key_exists($Index, $Locale->Texts->Data)) 209 unset($FileLocale->Texts->Data[$Index]); 210 $FileLocale->UpdateToDatabase($this->System->Database, $FileLocale->Texts->Code); 211 $FileName = $this->Dir.'/'.$FileLocale->Texts->Code.'.php'; 212 $FileLocale->SaveToFile($FileName); 213 } 214 } 215 $this->CurrentLocale->Load($this->CurrentLocale->Texts->Code); 216 } 217 218 function LoadLocale($Code) 219 { 220 220 $this->CurrentLocale->Dir = $this->Dir; 221 222 221 $this->CurrentLocale->Load($Code); 222 } 223 223 } 224 224 … … 226 226 function T($Text) 227 227 { 228 229 230 231 232 } 228 global $LocaleManager; 229 230 if(isset($LocaleManager)) return($LocaleManager->CurrentLocale->Texts->Translate($Text)); 231 else return($Text); 232 } -
trunk/includes/Page.php
r768 r816 7 7 var $RawPage; 8 8 var $Title; 9 9 10 10 function __construct($System) 11 11 { … … 14 14 $this->RawPage = false; 15 15 } 16 17 18 19 20 } 21 16 17 function Show() 18 { 19 return(''); 20 } 21 22 22 function GetOutput() 23 { 24 25 23 { 24 $Output = $this->Show(); 25 return($Output); 26 26 } 27 27 } … … 29 29 class PageEdit extends Page 30 30 { 31 32 33 34 35 36 31 var $Table; 32 var $Definition; 33 var $ItemActions; 34 35 function __construct($System) 36 { 37 37 parent::__construct($System); 38 38 $this->Table = ''; … … 41 41 array('Name' => T('View'), 'URL' => '?action=view&id=#Id'), 42 42 ); 43 $this->AllowEdit = false; 43 $this->AllowEdit = false; 44 44 if($this->AllowEdit) $this->ItemActions[] = array('Name' => T('Delete'), 'URL' => '?action=remove&id=#Id'); 45 46 47 48 49 50 if(array_key_exists('action', $_GET))45 } 46 47 function Show() 48 { 49 $Output = ''; 50 if(array_key_exists('action', $_GET)) 51 51 { 52 if($_GET['action'] == 'add') $Output .= $this->AddItem(); 52 if($_GET['action'] == 'add') $Output .= $this->AddItem(); 53 53 else if($_GET['action'] == 'view') $Output .= $this->ViewItem(); 54 54 else if($_GET['action'] == 'edit') $Output .= $this->ModifyItem(); … … 56 56 else if($_GET['action'] == 'delete') $Output .= $this->DeleteItem(); 57 57 else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL); 58 } else $Output .= $this->ViewList(); 59 return($Output); 58 } else $Output .= $this->ViewList(); 59 return($Output); 60 60 } 61 61 62 62 function ViewItem() 63 63 { 64 65 66 67 64 $DbResult = $this->Database->query('SELECT * FROM ('.$this->TableSQL.') AS `T` WHERE `Id`='.$_GET['id']); 65 if($DbResult->num_rows > 0) 66 { 67 $DbRow = $DbResult->fetch_assoc(); 68 68 69 69 $Output = T('Item'). … … 71 71 foreach($this->Definition as $DefIndex => $Def) 72 72 { 73 74 } 73 $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->ViewControl($Def['Type'], $DefIndex, $DbRow[$DefIndex]).'</tr>'; 74 } 75 75 $Output .= '<tr>'. 76 76 '</table>'; 77 78 if($this->AllowEdit) 79 80 81 82 83 84 85 return($Output); 77 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 78 if($this->AllowEdit) 79 { 80 $Output .= '<a href="?action=add">'.T('Add').'</a> '; 81 $Output .= '<a href="?action=edit&id='.$_GET['id'].'">'.T('Edit').'</a> '; 82 $Output .= '<a href="?action=delete&id='.$_GET['id'].'">'.T('Add').'</a> '; 83 } 84 $Output .= '<a href="?">'.T('List').'</a><br/>'; 85 return($Output); 86 86 } 87 87 88 88 function ViewList() 89 89 { 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 90 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$this->TableSQL.') AS `T`'); 91 $DbRow = $DbResult->fetch_row(); 92 $PageList = GetPageList($DbRow[0]); 93 $Output = $PageList['Output']; 94 95 $Output .= '<table class="BaseTable">'; 96 $TableColumns = array(); 97 foreach($this->Definition as $Index => $Def) 98 if($Def['InList']) 99 $TableColumns[] = array('Name' => $Index, 'Title' => $Def['Title']); 100 if(count($this->ItemActions) > 0) 101 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 102 103 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 104 $Output .= $Order['Output']; 105 106 $DbResult = $this->Database->query('SELECT * FROM ('.$this->Table.') '.$Order['SQL'].$PageList['SQLLimit']); 107 while($Item = $DbResult->fetch_assoc()) 108 { 109 $Output .= '<tr>'; 110 110 foreach($this->Definition as $Index => $Def) 111 111 if($Def['InList']) 112 112 { 113 114 113 if($Def['Type'] == 'URL') $Output .= '<td><a href="'.$Item[$Index].'">'.$Item[$Index].'</a></td>'; 114 else $Output .= '<td>'.$Item[$Index].'</td>'; 115 115 } 116 116 if(count($this->ItemActions) > 0) 117 { 118 119 120 121 122 117 { 118 $Output .= '<td>'; 119 foreach($this->ItemActions as $Index => $Action) 120 { 121 $URL = $Action['URL']; 122 if(strpos($URL, '#Id')) $URL = str_replace('#Id', $Item['Id'], $URL); 123 123 $Output .= '<a href="'.$URL.'">'.$Action['Name'].'</a> '; 124 }124 } 125 125 $Output .= '</td>'; 126 126 } 127 $Output .= '</tr>'; 128 129 130 131 127 $Output .= '</tr>'; 128 } 129 $Output .= '</table>'; 130 if($this->AllowEdit) $Output .= '<a href="?action=add">'.T('Add').'</a><br/>'; 131 return($Output); 132 132 } 133 134 133 134 function AddItem() 135 135 { 136 136 $Output = ''; 137 137 if($this->System->User->Licence(LICENCE_USER)) 138 138 { 139 140 141 142 143 144 $Items[$Index] = $_POST[$Index];145 146 147 $Output = ShowMessage(T('Item added'), MESSAGE_INFORMATION);148 } else149 139 if(array_key_exists('finish', $_GET)) 140 { 141 $Items = array(); 142 foreach($this->Definition as $Index => $Def) 143 { 144 $Items[$Index] = $_POST[$Index]; 145 } 146 $this->Database->insert($this->Table, $Items); 147 $Output = ShowMessage(T('Item added'), MESSAGE_INFORMATION); 148 } else 149 { 150 150 $Output .= '<form action="?action=add&finish=1" method="post">'. 151 151 '<fieldset><legend>'.T('New item').'</legend>'. … … 153 153 foreach($this->Definition as $DefIndex => $Def) 154 154 { 155 156 } 155 $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->GetControl($Def['Type'], $DefIndex, '').'</tr>'; 156 } 157 157 $Output .= '<tr><td colspan="2"><input type="submit" value="'.T('Add').'" /></td></tr>'. 158 158 '</table>'. 159 159 '</fieldset>'. 160 160 '</form>'; 161 161 } 162 162 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 163 return($Output); 164 } 165 166 163 return($Output); 164 } 165 166 function DeleteItem() 167 167 { 168 168 if($this->System->User->Licence(LICENCE_USER)) … … 173 173 return($Output); 174 174 } 175 175 176 176 function GetControl($Type, $Name, $Value) 177 177 { 178 179 180 181 182 } 178 if($Type == 'Text') $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>'; 179 else if($Type == 'Boolean') $Output = '<input type="checkbox" name="'.$Name.'"/>'; 180 else $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>'; 181 return($Output); 182 } 183 183 184 184 function ViewControl($Type, $Name, $Value) 185 185 { 186 187 188 189 190 191 } 186 if($Type == 'Text') $Output = $Value; 187 else if($Type == 'URL') $Output = '<a href="'.$Value.'">'.$Value.'</a>'; 188 else if($Type == 'Boolean') $Output = $Value; 189 else $Output = $Value; 190 return($Output); 191 } 192 192 } -
trunk/includes/Update.php
r815 r816 11 11 function __construct() 12 12 { 13 14 15 13 $this->Revision = 0; 14 $this->Trace = array(); 15 $this->VersionTable = 'DbVersion'; 16 16 } 17 17 18 18 function GetDbVersion() 19 19 { 20 21 20 $DbResult = $this->Database->select('DbVersion', '*', 'Id=1'); 21 $Version = $DbResult->fetch_assoc(); 22 22 return($Version['Revision']); 23 23 } … … 25 25 function IsInstalled() 26 26 { 27 27 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"'); 28 28 return($DbResult->num_rows > 0); 29 29 } … … 31 31 function IsUpToDate() 32 32 { 33 33 return($this->Revision <= $this->GetDbVersion()); 34 34 } 35 35 36 36 function Update() 37 37 { 38 39 40 38 $DbRevision = $this->GetDbVersion(); 39 $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>'; 40 while($this->Revision > $DbRevision) 41 41 { 42 43 44 45 46 47 48 49 42 $TraceItem = $this->Trace[$DbRevision]; 43 $Output .= 'Aktualizace na verzi: '.$TraceItem['Revision'].'<br/>'; 44 $RevUpdate = $TraceItem['Function']; 45 $RevUpdate($this); 46 $DbRevision = $TraceItem['Revision']; 47 $this->Database->query('UPDATE `DbVersion` SET `Revision`= '.$TraceItem['Revision'].' WHERE `Id`=1'); 48 } 49 return($Output); 50 50 } 51 51 52 52 function Install() 53 53 { 54 55 56 54 $InstallMethod = $this->InstallMethod; 55 $InstallMethod($this); 56 $this->Update(); 57 57 } 58 58 … … 64 64 function Execute($Query) 65 65 { 66 67 68 66 echo($Query.'<br/>'); 67 flush(); 68 return($this->Database->query($Query)); 69 69 } 70 70 } -
trunk/includes/Version.php
r815 r816 6 6 // and system will need database update. 7 7 8 $Revision = 81 5; // Subversion revision8 $Revision = 816; // Subversion revision 9 9 $DatabaseRevision = 811; // Database structure revision 10 10 $ReleaseTime = '2015-02-22'; -
trunk/includes/global.php
r806 r816 42 42 $System = new System(); 43 43 $System->DoNotShowPage = true; 44 44 $System->Run(); 45 45 $User = $System->User; // Back compatibility, will be removed 46 46 } … … 48 48 class TempPage extends Page 49 49 { 50 51 52 53 54 50 function Show() 51 { 52 global $TempPageContent; 53 return($TempPageContent); 54 } 55 55 } 56 56 57 57 function ShowPageClass($Page) 58 58 { 59 59 global $TempPageContent, $System; 60 60 61 61 $System->Pages['temporary-page'] = get_class($Page); 62 62 $_SERVER['REDIRECT_QUERY_STRING'] = 'temporary-page'; 63 63 $System->PathItems = ProcessURL(); 64 64 $System->ShowPage(); 65 65 } 66 66 67 67 function ShowPage($Content) 68 68 { 69 69 global $TempPageContent, $System; 70 70 71 71 $TempPage = new TempPage($System); 72 72 $System->Pages['temporary-page'] = 'TempPage'; 73 74 73 $_SERVER['REDIRECT_QUERY_STRING'] = 'temporary-page'; 74 $TempPageContent = $Content; 75 75 $System->PathItems = ProcessURL(); 76 76 $System->ShowPage(); 77 77 } 78 78 … … 260 260 if(array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol']; 261 261 if(array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage))) 262 262 $_SESSION['OrderDir'] = $_GET['OrderDir']; 263 263 if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn; 264 264 if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder; … … 557 557 } 558 558 559 function GetTranslatNamesArray() 559 function GetTranslatNamesArray() 560 560 { 561 561 $TablesColumn = array … … 733 733 734 734 $IconName = array( 735 735 MESSAGE_INFORMATION => 'information', 736 736 MESSAGE_WARNING => 'warning', 737 737 MESSAGE_CRITICAL => 'critical' 738 738 ); 739 739 $BackgroundColor = array( 740 740 MESSAGE_INFORMATION => '#e0e0ff', 741 741 MESSAGE_WARNING => '#ffffe0', 742 742 MESSAGE_CRITICAL => '#ffe0e0' 743 743 ); 744 744 745 745 return('<div class="message" style="background-color: '.$BackgroundColor[$Type]. 746 747 748 746 ';"><table><tr><td class="icon"><img src="'. 747 $System->Link('/images/message/'.$IconName[$Type].'.png').'" alt="'. 748 $IconName[$Type].'"><td>'.$Text.'</td></tr></table></div>'); 749 749 } 750 750 751 751 function ProcessURL() 752 752 { 753 754 755 756 757 758 759 760 761 753 if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 754 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 755 else $PathString = ''; 756 if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 757 $PathItems = explode('/', $PathString); 758 if(strpos(GetRequestURI(), '?') !== false) 759 $_SERVER['QUERY_STRING'] = substr(GetRequestURI(), strpos(GetRequestURI(), '?') + 1); 760 else $_SERVER['QUERY_STRING'] = ''; 761 parse_str($_SERVER['QUERY_STRING'], $_GET); 762 762 // SQL injection hack protection 763 763 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 764 764 return($PathItems); 765 765 } 766 766 767 767 function WriteLanguages($Selected) 768 768 { 769 770 771 772 773 774 775 776 777 778 779 780 781 769 global $System; 770 771 $Output = '<select name="Language">'; 772 $DbResult = $System->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1'); 773 while($Language = $DbResult->fetch_assoc()) 774 { 775 $Output .= '<option value="'.$Language['Id'].'"'; 776 if($Selected == $Language['Id']) 777 $Output .= ' selected="selected"'; 778 $Output .= '>'.$Language['Name'].'</option>'; 779 } 780 $Output .= '</select>'; 781 return($Output); 782 782 } 783 783 -
trunk/includes/system.php
r812 r816 25 25 function Init() 26 26 { 27 27 global $Config, $LocaleManager; 28 28 29 29 $this->Config = $Config; … … 59 59 $this->Menu = array 60 60 ( 61 /* 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 61 /* array( 62 'Title' => T('Files'), 63 'Hint' => 'Stahování různých pomocných souborů a programů', 64 'Link' => $this->Link('/download.php'), 65 'Permission' => LICENCE_ANONYMOUS, 66 'Icon' => '', 67 ), 68 */ 69 array( 70 'Title' => T('Instructions'), 71 'Hint' => 'Informace k překladu hry', 72 'Link' => $this->Link('/info.php'), 73 'Permission' => LICENCE_ANONYMOUS, 74 'Icon' => '', 75 ), 76 array( 77 'Title' => T('Data source'), 78 'Hint' => 'Informace o překladových skupinách', 79 'Link' => $this->Link('/TranslationList.php?action=grouplist'), 80 'Permission' => LICENCE_ANONYMOUS, 81 'Icon' => '', 82 ), 83 array( 84 'Title' => T('Presentation'), 85 'Hint' => 'Prezentace a motivace překladu', 86 'Link' => $this->Link('/promotion.php'), 87 'Permission' => LICENCE_ANONYMOUS, 88 'Icon' => '', 89 ), 90 array( 91 'Title' => T('IRC chat'), 92 'Hint' => 'IRC chat pro překladatele', 93 'Link' => 'http://embed.mibbit.com/?server=game.zdechov.net%3A6667&channel=%23wowpreklad&forcePrompt=true&charset=utf-8', 94 'Permission' => LICENCE_ANONYMOUS, 95 'Icon' => '', 96 ), 97 array( 98 'Title' => T('Administration'), 99 'Hint' => 'Volby pro správu', 100 'Link' => $this->Link('/admin/'), 101 'Permission' => LICENCE_ADMIN, 102 'Icon' => '', 103 ), 104 104 ); 105 105 } … … 108 108 { 109 109 global $System, $ScriptStartTime, $TranslationTree, $User, $StopAfterUpdateManager, 110 110 $UpdateManager, $Config, $DatabaseRevision; 111 111 112 112 $ScriptStartTime = GetMicrotime(); … … 129 129 foreach($_POST as $Index => $Item) 130 130 { 131 132 133 131 if(is_array($_POST[$Index])) 132 foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2); 133 else $_POST[$Index] = addslashes($_POST[$Index]); 134 134 } 135 135 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); … … 166 166 if($this->DoNotShowPage == false) 167 167 { 168 168 $this->ShowPage(); 169 169 } 170 170 } … … 183 183 function RegisterPage($Path, $Handler) 184 184 { 185 185 if(is_array($Path)) 186 186 { 187 187 $Page = &$this->Pages; … … 198 198 function RegisterMenuItem($MenuItem, $Pos = NULL) 199 199 { 200 201 202 203 200 if(is_null($Pos)) $this->Menu[] = $MenuItem; 201 else { 202 array_splice($this->Menu, $Pos, 0, array($MenuItem)); 203 } 204 204 } 205 205 … … 216 216 } else 217 217 { 218 219 218 if(count($PathItems) == 1) return($Pages[$PathItem]); 219 else return(''); // Unexpected subpages 220 220 } 221 221 } else return(''); … … 224 224 function PageNotFound() 225 225 { 226 227 228 229 230 231 232 233 226 // Send correct HTTP status code to signal unknown page 227 if(array_key_exists('SERVER_PROTOCOL', $_SERVER)) 228 Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); 229 if(array_key_exists('HTTP_REFERER', $_SERVER)) $Referer = ' Referer: '.$_SERVER['HTTP_REFERER']; 230 else $Referer = ''; 231 if(isset($this->ModuleManager->Modules['Log'])) 232 $this->ModuleManager->Modules['Log']->WriteLog('Stránka "'. 233 implode('/', $this->PathItems).'" nenalezena'.$Referer, LOG_TYPE_PAGE_NOT_FOUND); 234 234 return(ShowMessage(sprintf(T('Page "%s" not found'), implode('/', $this->PathItems)), MESSAGE_CRITICAL)); 235 235 } … … 237 237 function ShowPage() 238 238 { 239 239 $Output = ''; 240 240 /* @var $Page Page */ 241 241 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); … … 248 248 } else { 249 249 $Output2 = ''; 250 250 if((count($this->OnPageNotFound) == 2) 251 251 and method_exists($this->OnPageNotFound[0], $this->OnPageNotFound[1])) 252 252 $Output2 = call_user_func_array($this->OnPageNotFound, array()); 253 253 if($Output2 != '') $Output .= $this->BaseView->ShowPage($Output2); 254 255 256 254 else { 255 $Output = $this->PageNotFound(); 256 $this->BaseView->Title = T('Page not found'); 257 257 $Output = $this->BaseView->ShowPage($Output); 258 259 258 } 259 } 260 260 echo($Output); 261 261 } … … 264 264 class BaseView extends View 265 265 { 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 266 var $Title; 267 268 function ShowTopBar() 269 { 270 global $LocaleManager; 271 272 $Output = '<div class="Menu">'; 273 if(!$this->System->User->Licence(LICENCE_USER)) 274 $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>'; 275 $Output .= '<span class="MenuItem"></span><span class="MenuItem2">'; 276 if($this->System->User->Licence(LICENCE_USER)) 277 { 278 //$DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team); 279 //$Team = $DbResult->fetch_assoc(); 280 //$Output .= ''<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>'; 281 $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'. 282 ' <a href="'.$this->System->Link('/user.php?user='.$this->System->User->Id).'">'.T('My page').'</a>'. 283 ' <a href="'.$this->System->Link('/Options.php').'">'.T('Options').'</a>'. 284 ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='. 285 $this->System->User->Id.'&group=0&state=2&text=&entry=').'">'.T('Translated').'</a>'. 286 ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='. 287 $this->System->User->Id.'&group=0&state=3&text=&entry=').'">'.T('Unfinished').'</a>'. 288 ' <a title="Nikým nepřeložené texty" href="'. 289 $this->System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">'.T('Untranslated').'</a>'; 290 } else 291 { 292 $Output .= '<a href="'.$this->System->Link('/login/').'">'.T('Login').'</a> '. 293 '<a href="'.$this->System->Link('/registrace.php').'">'.T('Registration').'</a>'; 294 } 295 //$Output .= ' <form action="?setlocale" method="get">'; 296 $Output .= ' <select onchange="window.location=\'?locale=\'+this.value">'; 297 foreach($LocaleManager->Available as $Locale) 298 { 299 if($Locale['Code'] == $LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"'; 300 else $Selected = ''; 301 $Output .= '<option title="" value="'.$Locale['Code'].'"'.$Selected.' onchange="this.form.submit()">'.$Locale['Title'].'</option>'; 302 } 303 $Output .= '</select><noscript><span><input type="submit" value="Submit"/></span></noscript>'; 304 //$Output .= '</form>'; 305 $Output .= '</span></div>'; 306 return($Output); 307 } 308 309 function ShowLoginBox() 310 { 311 $Output = ''; 312 if($this->System->User->Licence(LICENCE_USER)) 313 { 314 // $Output .= 'Jste přihlášen jako: <b>'.$tUser->Id.'</b> <a href="index.php?Logout">Odhlásit</a>'; 315 } else 316 { 317 $Output .= '<strong>'.T('Login').':</strong> 318 <form action="" method="post"> 319 <table> 320 <tr> 321 <td><input type="text" name="LoginUser" size="13" /></td> 322 </tr> 323 <tr> 324 <td><input type="password" name="LoginPass" size="13" /></td> 325 </tr> 326 <tr> 327 <th><input type="submit" value="'.T('Do login').'" /></th> 328 </tr> 329 </table> 330 </form>'; 331 } 332 return($Output); 333 } 334 335 function ShowSearchBox() 336 { 337 $Output = '<strong>'.T('Search').':</strong>'. 338 '<form action="'.$this->System->Link('/search/').'" method="get"><div>'. 339 '<table>'. 340 '<tr>'. 341 '<td><input type="text" name="text" size="13" /></td>'. 342 '</tr>'. 343 '<tr>'. 344 '<th><input type="submit" value="'.T('Do search').'" /></th>'. 345 '</tr>'. 346 '</table></div>'. 347 '</form>'; 348 return($Output); 349 } 350 351 function ShowMainMenu() 352 { 353 $Output = '<strong>'.T('Menu').':</strong>'. 354 '<div class="verticalmenu"><ul>'; 355 foreach($this->System->Menu as $MenuItem) 356 if($this->System->User->Licence($MenuItem['Permission'])) 357 { 358 if(isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"'; 359 else $OnClick = ''; 360 if($MenuItem['Icon'] != '') $Icon = '<img src="'.$this->System->Link('/images/menu/'.$MenuItem['Icon']).'"/>'; 361 else $Icon = ''; 362 $Output .= '<li>'.$Icon.'<a class="verticalmenua" title="'.$MenuItem['Hint'].'" href="'. 363 $MenuItem['Link'].'"'.$OnClick.'>'.$MenuItem['Title'].'</a></li>'; 364 } 365 $Output .= '</ul></div>'; 366 return($Output); 367 } 368 369 function ShowTranslatedMenu() 370 { 371 global $TranslationTree; 372 373 $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">'; 374 $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`'); 375 while($Group = $DbResult->fetch_assoc()) 376 { 377 $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'. 378 '<a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.str_replace(' ',' ',$Group['Name']).'</a></div>'. 379 '<div id="group'.$Group['Id'].'" class="hidden-menu-item" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'; 380 $Output .= ' <a title="Zde můžete začít překládat" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=1&user=0&entry=&text=').'">Nepřeložené</a><br />'. 381 ' <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=2&user=0&entry=&text=').'">Přeložené</a><br />'; 382 if($this->System->User->Licence(LICENCE_USER)) 383 { 384 $Output .= ' <a title="Nedokončené překlady" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=3').'">Rozepsané</a><br /> 385 <a title="Všechny překlady, které jste přeložil" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=1&user='.$this->System->User->Id).'&entry=&text=">Vlastní</a><br />'; 386 } 387 $Output .= ' <a title="Sestavit speciální filtr" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">Filtr</a><br />'; 388 $Output .= '</div>'; 389 } 390 $Output .= '</div>'; 391 return($Output); 392 } 393 394 function ShowHeader() 395 { 396 $Output = ''. 397 '<!DOCTYPE html>'. 398 '<html>'. 399 '<head>'. 400 '<meta http-equiv="content-type" content="text/html; charset='.$this->System->Config['Web']['Charset'].'" />'. 401 '<meta name="keywords" content="wow, quest, questy, questů, preklad, mangos, překlad, překládání, přeložený, přeložení, čeština, world of warcraft, open source, free, addon" />'. 402 '<meta name="description" content="'.$this->System->Config['Web']['Description'].'" />'. 403 '<meta name="robots" content="all" />'. 404 '<link rel="stylesheet" href="'.$this->System->Link('/style/style.css').'" type="text/css" media="all" />'. 405 '<script type="text/javascript" src="'.$this->System->Link('/style/global.js').'"></script>'. 406 '<link rel="shortcut icon" href="'.$this->System->Link('/images/favicon.ico').'" />'; 407 $Output .= $this->System->ModuleManager->Modules['News']->ShowRSSHeader(); 408 $Title = $this->System->Config['Web']['Title']; 409 if($this->Title != '') $Title = $this->Title.' - '.$Title; 410 $Output .= '<title>'.$Title.'</title>'. 411 '</head><body>'; 412 413 $Output .= $this->ShowTopBar(); 414 $Output .= '<table class="page"><tr><td class="menu">'; 415 $Output .= $this->ShowMainMenu(); 416 $Output .= $this->System->ModuleManager->Modules['User']->ShowOnlineList(); 417 $Output .= '<br />'; 418 $Output .= $this->ShowSearchBox(); 419 420 $Output .= '</td><td id="border-left"></td><td class="content">'; 421 return($Output); 422 } 423 424 function ShowFooter() 425 { 426 global $ScriptStartTime, $Revision, $ReleaseTime; 427 428 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2); 429 430 $Output = '</td>'. 431 431 '<td class="menu2">'; 432 433 432 $Output .= $this->ShowTranslatedMenu(); 433 $Output .= '</td>'. 434 434 '</tr><tr>'. 435 435 '<td colspan="4" class="page-bottom">'.T('Version').': '.$Revision.' ('.HumanDate($ReleaseTime).')'. … … 438 438 $this->System->Config['Web']['WebCounter']; 439 439 440 441 442 443 444 445 446 440 $Output .= '</td></tr>'; 441 if($this->System->Config['Web']['ShowRuntimeInfo'] == true) 442 $Output .= '<tr><td colspan="3" style="text-align: center;">'.T('Generating duration').': '. 443 $ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s '.T('Used memory').': '. 444 HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B <a href="http://validator.w3.org/check?uri='. 445 htmlentities('http://'.$_SERVER['HTTP_HOST'].GetRequestURI().'?'.$_SERVER['QUERY_STRING']).'">HTML validator</a></td></tr>'; 446 $Output .= '</table>'. 447 447 '</body>'. 448 448 '</html>'; 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 449 return($Output); 450 } 451 452 function ShowPage($Content) 453 { 454 $Output = $this->ShowHeader().$Content.$this->ShowFooter(); 455 if($this->System->Config['Web']['FormatOutput']) 456 $Output = $this->FormatOutput($Output); 457 return($Output); 458 } 459 460 function FormatOutput($s) 461 { 462 $out = ''; 463 $nn = 0; 464 $n = 0; 465 while($s != '') 466 { 467 $start = strpos($s, '<'); 468 $end = strpos($s, '>'); 469 if($start != 0) 470 { 471 $end = $start - 1; 472 $start = 0; 473 } 474 $line = trim(substr($s, $start, $end + 1)); 475 if(strlen($line) > 0) 476 if($line[0] == '<') 477 { 478 if($s[$start + 1] == '/') 479 { 480 $n = $n - 2; 481 $nn = $n; 482 } else 483 { 484 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); 485 else $cmd = substr($line, 1, strlen($line) - 2); 486 //echo('['.$cmd.']'); 487 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2; 488 } 489 }// else $line = '['.$line.']'; 490 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); 491 if($line != '') $out .= (str_repeat(' ', $nn).$line."\n"); 492 $s = substr($s, $end + 1, strlen($s)); 493 $nn = $n; 494 } 495 return($out); 496 } 497 497 } -
trunk/info.php
r798 r816 8 8 function Show() 9 9 { 10 11 10 $this->Title = T('Information for translators'); 11 $Output = '<h2>Informace a pokyny pro překladatele:</h2>'. 12 12 '<ul>'. 13 13 '<li>Texty překládejte <strong>včetně diakritiky</strong> (háčků a čárek). Ta bude v případě potřeby odstraněna při exportování. </li>'. -
trunk/locale/cs.php
r805 r816 245 245 'Missing data in form.' => 'Chybí údaje formuláře.', 246 246 'Export deleted.' => 'Export smazán.', 247 'Export not found.' => 'Export nenalezen.', 247 'Export not found.' => 'Export nenalezen.', 248 248 'Select saved.' => 'Výběr uložen.', 249 249 'Order' => 'Pořadí', … … 259 259 'Select translation groups witch you want to export.' => 'Zvolte ze překladových skupin, ze kterých chcete načítat překlady.', 260 260 'Format wasn\'t selected' => 'Nevybrán žádný formát', 261 'Format the generated output' => 'Formát generovaného výstupu', 261 'Format the generated output' => 'Formát generovaného výstupu', 262 262 'Is isn\'t select' => 'Nebylo zadáno Id.', 263 263 'Select version of game client witch you want to export.' => 'Vyberte pro jakou verzi herního klienta se budou texty exportovat.', … … 281 281 '' => '', 282 282 '' => '', 283 283 284 284 ); 285 285 } -
trunk/promotion.php
r782 r816 6 6 class PagePromotion extends Page 7 7 { 8 9 10 8 function Show() 9 { 10 $this->Title = T('Promotion'); 11 11 $Output = '<br>Zde naleznete prezentaci překladu ve hře. Můžete se podívat jak může vypadat i vaše hra. Pokud se vám to líbí, zkuste si češtinu nainstalovat i do svého klienta a lépe také i pomoci projektu, sami to nepřeložíme.<br/><br/>'. 12 12 … … 23 23 '<img src="images/promotion.bmp" width="800" alt="addon-obr">'; 24 24 return($Output); 25 25 } 26 26 } 27 27 28 28 $Page = new PagePromotion($System); 29 ShowPageClass($Page); 29 ShowPageClass($Page);
Note:
See TracChangeset
for help on using the changeset viewer.