Changeset 880 for trunk/Modules
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- Location:
- trunk/Modules
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Admin/Admin.php
r859 r880 52 52 '<a href="'.$this->System->Link('/admin/?action=merge').'">Sjednocení textů</a><br/>'. 53 53 '<small>Sjednotí stejné originální texty v databázi</small><br/><br/>'; 54 return ($Output);54 return $Output; 55 55 } 56 56 … … 72 72 function ShowPHPInfo() 73 73 { 74 return (phpinfo());74 return phpinfo(); 75 75 } 76 76 … … 86 86 '<a href="'.$this->System->Link('/admin/?action=sqlerror').'">Chybný SQL dotaz</a><br/>'. 87 87 '<small>Vyvolá testovací chybu</small><br/><br/>'; 88 return ($Output);88 return $Output; 89 89 } 90 90 … … 103 103 ); 104 104 $Output = 'Questy: <br />'; 105 while ($quest = $DbResult->fetch_assoc())105 while ($quest = $DbResult->fetch_assoc()) 106 106 { 107 107 $Output .= $quest['ID'].', '; … … 109 109 } 110 110 $Output .= '<br / ><br / >Questy nastaveny jako nedokončené!'; 111 return ($Output);111 return $Output; 112 112 } 113 113 … … 117 117 118 118 $Output = ''; 119 foreach ($TranslationTree as $Group)119 foreach ($TranslationTree as $Group) 120 120 // $Group = $TranslationTree[1]; 121 121 { … … 130 130 $DbResult = $this->System->Database->query($sql); 131 131 echo ': <br />'.$Group['TablePrefix'].': <br />'; 132 while ($line = $DbResult->fetch_assoc())132 while ($line = $DbResult->fetch_assoc()) 133 133 { 134 134 echo ($line['ID'].', '); … … 138 138 echo '<br / >Verze '.$Group['TablePrefix'].' opraveny!'; 139 139 } 140 return ('Hotovo!');140 return 'Hotovo!'; 141 141 } 142 142 … … 145 145 $Text = strtolower($Text); 146 146 $Text = str_replace(' ', '', $Text); 147 return ($Text);147 return $Text; 148 148 } 149 149 … … 153 153 154 154 $Output = ''; 155 foreach ($TranslationTree as $Group)155 foreach ($TranslationTree as $Group) 156 156 // $Group = $TranslationTree[1]; 157 157 { … … 164 164 $DbResult = $this->System->Database->query($sql); 165 165 echo ': <br />'.$Group['TablePrefix'].': '; 166 while ($line = $DbResult->fetch_assoc())166 while ($line = $DbResult->fetch_assoc()) 167 167 { 168 168 $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '. … … 171 171 // echo $sql; 172 172 $DbResult2 = $this->System->Database->query($sql); 173 if ($DbResult2->num_rows > 0) {173 if ($DbResult2->num_rows > 0) { 174 174 $line2 = $DbResult2->fetch_assoc(); 175 175 176 176 $Same = true; 177 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {177 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 178 178 if ($this->StripText($line[$Column['Column']]) <> $this->StripText($line2[$Column['Column']])) 179 179 $Same = false; … … 186 186 ' WHERE `T`.`Entry` = '.$line['Entry'].' AND (`T`.`Take` = '.$line['ID'].' OR `T`.`Take` = '.$line2['ID'].') '; 187 187 $DbResult3 = $this->System->Database->query($sql); 188 while ($line3 = $DbResult3->fetch_assoc()) {188 while ($line3 = $DbResult3->fetch_assoc()) { 189 189 echo $line3['ID'].' '; 190 190 $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$line2['VersionEnd'].', `VersionStart` = '.$line['VersionStart'].', `Take` = '.$line['ID'].' WHERE ID='.$line3['ID']); … … 199 199 echo('Texty '.$Group['TablePrefix'].' sjednoceny!'); 200 200 } 201 return ('Hotovo!');201 return 'Hotovo!'; 202 202 } 203 203 … … 224 224 $Group = $TranslationTree[$_GET['id']]; 225 225 // $Output .= '<form action="?action=dbcstructure&id='.$Group['Id'].'">'; 226 // foreach ($Group['Items'] as $GroupItem)226 // foreach ($Group['Items'] as $GroupItem) 227 227 // { 228 228 // $Output .= $GroupItem['Column'].': <input name="'.$GroupItem['Id'].'"><br />'; … … 236 236 $Group['DBCFileName'].'.dbc.csv'); 237 237 238 //while (!$File->EOF())238 //while (!$File->EOF()) 239 239 240 240 $Output .= '<table class="BaseTable">'; … … 248 248 $Output .= '</td></tr><tr><td>'; 249 249 for ($i = 0; $i < substr_count($Line, ','); $i++) { 250 foreach ($Group['Items'] as $GroupItem)250 foreach ($Group['Items'] as $GroupItem) 251 251 $Output .= ' <a href="'.$this->System->Link('/admin/?action=dbcstructure&id='. 252 252 $Group['Id'].'&GroupItem='.$GroupItem['Id'].'&ColumnIndex='.$i).'">'. … … 269 269 } else { 270 270 $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion`'); 271 while ($Version = $DbResult->fetch_assoc())271 while ($Version = $DbResult->fetch_assoc()) 272 272 { 273 273 $Output .= '<a href="'.$this->System->Link('/admin/?action=dbcstructure&GameVersion='. … … 276 276 $Output .= '<br /><br />'; 277 277 278 foreach ($TranslationTree as $Group)278 foreach ($TranslationTree as $Group) 279 279 { 280 280 if ($Group['DBCFileName'] <> '') … … 283 283 } 284 284 } 285 return ($Output);285 return $Output; 286 286 } 287 287 … … 291 291 $Output = 'Překlad rozhraní přegenerován'; 292 292 $Output .= '<table class="BaseTable"><tr><th>Originál</th><th>Překlad</th></tr>'; 293 foreach ($this->System->LocaleManager->CurrentLocale->Texts->Data as $Index => $Item)293 foreach ($this->System->LocaleManager->CurrentLocale->Texts->Data as $Index => $Item) 294 294 $Output .= '<tr><td>'.$Index.'</td><td>'.$Item.'</td></tr>'; 295 295 $Output .= '</table>'; 296 296 $Output .= 'Překladové soubory zaktualizovány'; 297 return ($Output);297 return $Output; 298 298 } 299 299 … … 302 302 $this->Title = T('Administration'); 303 303 $Output = ''; 304 if ($this->System->User->Licence(LICENCE_ADMIN))304 if ($this->System->User->Licence(LICENCE_ADMIN)) 305 305 { 306 if (array_key_exists('action', $_GET))306 if (array_key_exists('action', $_GET)) 307 307 { 308 if ($_GET['action'] == 'error') $Output .= $this->TestError(12, 'test');309 else if ($_GET['action'] == 'exception') $Output .= $this->TestException(12, 'test');310 else if ($_GET['action'] == 'sqlerror') $Output .= $this->TestSQLError('SELECT dads FROM sdas');311 else if ($_GET['action'] == 'testing') $Output .= $this->Testing();312 else if ($_GET['action'] == 'phpinfo') $Output .= $this->ShowPHPInfo();313 else if ($_GET['action'] == 'locale') $Output .= $this->ShowLocale();314 else if ($_GET['action'] == 'uncomplete') $Output .= $this->Uncomplete();315 else if ($_GET['action'] == 'repairversion') $Output .= $this->RepairVersionEnd();316 else if ($_GET['action'] == 'dbcstructure') $Output .= $this->DbcStructure();317 else if ($_GET['action'] == 'merge') $Output .= $this->MergeSameText();308 if ($_GET['action'] == 'error') $Output .= $this->TestError(12, 'test'); 309 else if ($_GET['action'] == 'exception') $Output .= $this->TestException(12, 'test'); 310 else if ($_GET['action'] == 'sqlerror') $Output .= $this->TestSQLError('SELECT dads FROM sdas'); 311 else if ($_GET['action'] == 'testing') $Output .= $this->Testing(); 312 else if ($_GET['action'] == 'phpinfo') $Output .= $this->ShowPHPInfo(); 313 else if ($_GET['action'] == 'locale') $Output .= $this->ShowLocale(); 314 else if ($_GET['action'] == 'uncomplete') $Output .= $this->Uncomplete(); 315 else if ($_GET['action'] == 'repairversion') $Output .= $this->RepairVersionEnd(); 316 else if ($_GET['action'] == 'dbcstructure') $Output .= $this->DbcStructure(); 317 else if ($_GET['action'] == 'merge') $Output .= $this->MergeSameText(); 318 318 else $Output .= $this->ShowMenu(); 319 319 } else $Output .= $this->ShowMenu(); 320 320 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 321 return ($Output);321 return $Output; 322 322 } 323 323 } -
trunk/Modules/AoWoW/AoWoW.php
r838 r880 23 23 'Icon' => '', 24 24 )); 25 if (array_key_exists('Search', $this->System->ModuleManager->Modules))25 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 26 26 $this->System->ModuleManager->Modules['Search']->RegisterSearch('aowow', 27 27 T('AoWoW'), array(), '', $this->System->Link('/aowow/?search=')); -
trunk/Modules/ClientVersion/ClientVersion.php
r843 r880 31 31 function Show() 32 32 { 33 if (array_key_exists('action', $_GET))33 if (array_key_exists('action', $_GET)) 34 34 { 35 if ($_GET['action'] == 'item') $Output = $this->ShowItem();35 if ($_GET['action'] == 'item') $Output = $this->ShowItem(); 36 36 else $Output = $this->ShowList(); 37 37 } else $Output = $this->ShowList(); 38 return ($Output);38 return $Output; 39 39 } 40 40 41 41 function ShowItem() 42 42 { 43 if (array_key_exists('id', $_GET))43 if (array_key_exists('id', $_GET)) 44 44 { 45 45 $YesNo = array('Ne', 'Ano'); 46 46 $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.($_GET['id']*1)); 47 if ($DbResult->num_rows > 0)47 if ($DbResult->num_rows > 0) 48 48 { 49 49 $Version = $DbResult->fetch_assoc(); … … 60 60 '</table>'; 61 61 $Output .= '<div><a href="?">'.T('All versions list').'</a></div>'; 62 if ($Version['Imported'])62 if ($Version['Imported']) 63 63 $Output .= '<div><a href="'.$this->System->Link('/progress/?Version='. 64 64 $Version['Version']).'">'.T('Progress').'</a></div>'; 65 65 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 66 66 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 67 return ($Output);67 return $Output; 68 68 } 69 69 … … 92 92 93 93 $DbResult = $this->System->Database->query('SELECT * FROM ClientVersion '.$Order['SQL'].$PageList['SQLLimit']); 94 while ($Version = $DbResult->fetch_assoc())94 while ($Version = $DbResult->fetch_assoc()) 95 95 { 96 96 $Output .= '<tr><td><a href="?action=item&id='.$Version['Id'].'">'. … … 101 101 $Output .= '</table>'. 102 102 $PageList['Output']; 103 return ($Output);103 return $Output; 104 104 } 105 105 } -
trunk/Modules/Dictionary/Dictionary.php
r861 r880 25 25 'Icon' => '', 26 26 ), 1); 27 if (array_key_exists('Search', $this->System->ModuleManager->Modules))27 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 28 28 $this->System->ModuleManager->Modules['Search']->RegisterSearch('dictionary', 29 29 T('Dictionary'), array('Text', 'Description'), … … 65 65 66 66 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 67 foreach ($buff as $Line)67 foreach ($buff as $Line) 68 68 { 69 69 if ($mode == 0) … … 83 83 } 84 84 $Output .= '</table>'; 85 return ($Output);85 return $Output; 86 86 } 87 87 … … 89 89 { 90 90 $Output = ''; 91 if ($this->System->User->Licence(LICENCE_USER))91 if ($this->System->User->Licence(LICENCE_USER)) 92 92 { 93 93 $Output .= '<form action="?action=save" method="post">'. … … 103 103 '</form>'; 104 104 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 105 return ($Output);105 return $Output; 106 106 } 107 107 108 108 function DictionarySave() 109 109 { 110 if ($this->System->User->Licence(LICENCE_USER))111 { 112 if (array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST))110 if ($this->System->User->Licence(LICENCE_USER)) 111 { 112 if (array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST)) 113 113 { 114 114 // Check if original text exists and determine entry id 115 115 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '. 116 116 '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$this->System->Config['OriginalLanguage']); 117 if ($DbResult->num_rows > 0)117 if ($DbResult->num_rows > 0) 118 118 { 119 119 $DbRow = $DbResult->fetch_assoc(); … … 130 130 $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '. 131 131 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id); 132 if ($DbResult->num_rows > 0)132 if ($DbResult->num_rows > 0) 133 133 { 134 134 $DbRow = $DbResult->fetch_assoc(); … … 142 142 } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL); 143 143 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 144 return ($Output);144 return $Output; 145 145 } 146 146 147 147 function DictionaryRemove() 148 148 { 149 if ($this->System->User->Licence(LICENCE_USER))149 if ($this->System->User->Licence(LICENCE_USER)) 150 150 { 151 151 $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 152 152 $Output = ShowMessage(T('Record removed')); 153 153 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 154 return ($Output);154 return $Output; 155 155 } 156 156 157 157 function DictionaryModify() 158 158 { 159 if ($this->System->User->Licence(LICENCE_USER))159 if ($this->System->User->Licence(LICENCE_USER)) 160 160 { 161 161 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1)); 162 if ($DbResult->num_rows > 0)162 if ($DbResult->num_rows > 0) 163 163 { 164 164 $DbRow = $DbResult->fetch_assoc(); … … 180 180 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 181 181 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 182 return ($Output);182 return $Output; 183 183 } 184 184 … … 189 189 $Output = ''; 190 190 $GroupId = LoadGroupIdParameter(); 191 if (array_key_exists('mode', $_GET)) $mode = $_GET['mode'];191 if (array_key_exists('mode', $_GET)) $mode = $_GET['mode']; 192 192 else $mode = 0; //0 = exact names, 1=all names, 2=nontranslated 193 193 $Table = $TranslationTree[$GroupId]['TablePrefix']; 194 194 195 if (array_key_exists('ID', $_GET))195 if (array_key_exists('ID', $_GET)) 196 196 { 197 197 $TextID = $_GET['ID']; … … 202 202 $DbResult = $this->Database->query('SELECT * FROM '.$Table.' WHERE ID = '.$TextID); 203 203 $Line = $DbResult->fetch_assoc(); 204 if (!$Line) $Output .= ShowMessage(T('Translation not found'), MESSAGE_CRITICAL);204 if (!$Line) $Output .= ShowMessage(T('Translation not found'), MESSAGE_CRITICAL); 205 205 else 206 206 { 207 207 $Text = ''; 208 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)208 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 209 209 $Text .= ' '.$Line[$TextItem['Column']]; 210 210 $Output .= $this->WriteTranslatNames($Text, $mode); 211 211 } 212 212 } 213 return ($Output);213 return $Output; 214 214 } 215 215 … … 221 221 '<table style="width: 100%; height: 100%;">'; 222 222 223 if (array_key_exists('search', $_GET)) $Search = $_GET['search'];223 if (array_key_exists('search', $_GET)) $Search = $_GET['search']; 224 224 else $Search = ''; 225 225 … … 227 227 <input type="text" value="'.$Search.'" name="search" size="30" /> 228 228 <input type="submit" value="'.T('Search').'" />'; 229 if ($this->System->User->Licence(LICENCE_USER))229 if ($this->System->User->Licence(LICENCE_USER)) 230 230 $Output .= ' <a href="?action=insert">'.T('Add word').'</a>'; 231 231 … … 233 233 '<tr><td>'.T('Language').': '; 234 234 $Lang = '<a href="?language=">'.T('All').'</a>'; 235 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';235 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> '; 236 236 else $Output .= $Lang; 237 foreach ($LanguageList as $Language)238 if ($Language['Enabled'] == 1)237 foreach ($LanguageList as $Language) 238 if ($Language['Enabled'] == 1) 239 239 { 240 240 $Lang = ' <a href="?language='.$Language['Id'].'">'.T($Language['Name']).'</a>'; 241 if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';241 if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> '; 242 242 else $Output .= $Lang; 243 243 } … … 245 245 '<tr><td>'; 246 246 247 if (!is_numeric($_SESSION['language'])) $LanguageFilter = '';247 if (!is_numeric($_SESSION['language'])) $LanguageFilter = ''; 248 248 else $LanguageFilter = ' AND (`T1`.`Language` = '.$_SESSION['language'].')'; 249 249 250 if ($Search <> '')250 if ($Search <> '') 251 251 { 252 252 $Condition = ' AND (LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '. … … 270 270 $Output .= $PageList['Output']; 271 271 272 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];272 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name']; 273 273 else $LanguageName = T('Translation'); 274 274 $TableColumns = array( … … 276 276 array('Name' => 'Translated', 'Title' => T($LanguageName)), 277 277 ); 278 if (!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language'));278 if (!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language')); 279 279 $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description')); 280 280 $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator')); 281 if ($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action'));281 if ($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action')); 282 282 $Order = GetOrderTableHeader($TableColumns, 'Original'); 283 283 $Output .= '<table class="BaseTable">'.$Order['Output']; … … 285 285 $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit']; 286 286 $DbResult = $this->Database->query($sql_page); 287 while ($Line = $DbResult->fetch_assoc())287 while ($Line = $DbResult->fetch_assoc()) 288 288 { 289 289 $Output .= '<tr>'. 290 290 '<td>'.htmlspecialchars($Line['Original']).'</td>'. 291 291 '<td><strong>'.htmlspecialchars($Line['Translated']).'</strong></td>'; 292 if (!is_numeric($_SESSION['language'])) $Output .= '<td>'.T($Line['LangName']).'</td>';292 if (!is_numeric($_SESSION['language'])) $Output .= '<td>'.T($Line['LangName']).'</td>'; 293 293 $Output .= '<td>'.htmlspecialchars($Line['Description']).'</td>'. 294 294 '<td><a href="'.$this->System->Link('/user/?user='.$Line['UserId']).'">'. 295 295 $Line['UserName'].'</a></td>'; 296 if ($this->System->User->Licence(LICENCE_USER))297 { 298 if ($Line['UserId'] == $this->System->User->Id)296 if ($this->System->User->Licence(LICENCE_USER)) 297 { 298 if ($Line['UserId'] == $this->System->User->Id) 299 299 $Output .= '<td><a href="?action=remove&id='.$Line['Id']. 300 300 '" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'. … … 308 308 '</td></tr>'. 309 309 '</table></form>'; 310 return ($Output);310 return $Output; 311 311 } 312 312 … … 319 319 $LanguageList = GetLanguageList(); 320 320 321 if (!isset($_SESSION['language']))322 { 323 if ($this->System->User->Licence(LICENCE_USER))321 if (!isset($_SESSION['language'])) 322 { 323 if ($this->System->User->Licence(LICENCE_USER)) 324 324 { 325 325 $_SESSION['language'] = $this->System->User->Language; 326 326 } else $_SESSION['language'] = ''; 327 327 } 328 if (array_key_exists('language', $_GET))329 { 330 if ($_GET['language'] == '') $_SESSION['language'] = '';328 if (array_key_exists('language', $_GET)) 329 { 330 if ($_GET['language'] == '') $_SESSION['language'] = ''; 331 331 else $_SESSION['language'] = $_GET['language'] * 1; 332 332 } … … 335 335 336 336 $ShowList = true; 337 if (array_key_exists('action', $_GET))338 { 339 if ($_GET['action'] == 'group')337 if (array_key_exists('action', $_GET)) 338 { 339 if ($_GET['action'] == 'group') 340 340 { 341 341 $Output .= $this->DictionaryGroup(); 342 342 $ShowList = false; 343 343 } 344 else if ($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert();345 else if ($_GET['action'] == 'save') $Output .= $this->DictionarySave();346 else if ($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove();347 else if ($_GET['action'] == 'modify') $Output .= $this->DictionaryModify();344 else if ($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert(); 345 else if ($_GET['action'] == 'save') $Output .= $this->DictionarySave(); 346 else if ($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove(); 347 else if ($_GET['action'] == 'modify') $Output .= $this->DictionaryModify(); 348 348 else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL); 349 349 } 350 if ($ShowList == true) $Output .= $this->DictionaryShow();351 return ($Output);350 if ($ShowList == true) $Output .= $this->DictionaryShow(); 351 return $Output; 352 352 } 353 353 } -
trunk/Modules/Download/Download.php
r850 r880 74 74 '<a href="'.$fileslink.'/DBCtoCSV.exe">DBCtoCSV</a> - '.T('tool for transform DBC files to CSV').'<br />'. 75 75 '<a href="'.$fileslink.'/ClientDBExtractor.exe">ClientDBExtractor.exe</a> - '.T('tool for exporting dbc files from game client').'<br />'; 76 return ($Output);76 return $Output; 77 77 } 78 78 … … 144 144 $PageList['Output']; 145 145 146 return ($Output);146 return $Output; 147 147 } 148 148 … … 154 154 else $Output .= $this->ShowDownload(); 155 155 156 return ($Output);156 return $Output; 157 157 } 158 158 } -
trunk/Modules/Error/Error.php
r860 r880 23 23 function DoStart() 24 24 { 25 if (isset($this->System->Config['Web']['ShowPHPError']))25 if (isset($this->System->Config['Web']['ShowPHPError'])) 26 26 $this->ErrorHandler->ShowError = $this->System->Config['Web']['ShowPHPError']; 27 27 else $this->ErrorHandler->ShowError = true; … … 36 36 function DoError($Error) 37 37 { 38 foreach ($this->OnError as $OnError)38 foreach ($this->OnError as $OnError) 39 39 call_user_func($OnError, $Error); 40 40 } -
trunk/Modules/Export/CreateAddon.php
r859 r880 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)); … … 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)); … … 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 … … 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 return ($string);68 return $string; 69 69 } 70 70 … … 75 75 $string = str_replace('$b', '\r\n', $string); 76 76 $string = $this->ReplaceVarInText($string,''); 77 return ($string);77 return $string; 78 78 } 79 79 … … 81 81 { 82 82 //echo (strpos($string,'<html>')); 83 if (strpos($string,'<html>') > -1) return (false);84 else return (true);83 if (strpos($string,'<html>') > -1) return false; 84 else return true; 85 85 } 86 86 … … 98 98 $string = str_replace('\\\\124', '\\124',$string); 99 99 100 return ($string);100 return $string; 101 101 } 102 102 … … 113 113 $CreatedFileListCount = array(); 114 114 115 if (!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true);115 if (!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true); 116 116 117 117 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`TablePrefix` != ""'); 118 while ($Group = $DbResult->fetch_assoc())118 while ($Group = $DbResult->fetch_assoc()) 119 119 { 120 120 //získání čísla verze pro export … … 126 126 else $ExportVersion = ''; 127 127 128 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)129 if ($Column['AddonFileName'] != '')128 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) 129 if ($Column['AddonFileName'] != '') 130 130 { 131 131 $this->AddProgress(1); 132 if (!isset($CreatedFileListCount[$Column['AddonFileName']]))132 if (!isset($CreatedFileListCount[$Column['AddonFileName']])) 133 133 $CreatedFileListCount[$Column['AddonFileName']] = 0; 134 134 $CreatedFileListCount[$Column['AddonFileName']]++; … … 149 149 $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '. 150 150 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 151 if ($ID->num_rows > 0) {151 if ($ID->num_rows > 0) { 152 152 $ExportVersionOld = $ID->fetch_assoc(); 153 153 $ExportVersionOld = $ExportVersionOld['BuildNumber']; 154 154 155 155 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld)); 156 while ($Line = $DbResult2->fetch_assoc())156 while ($Line = $DbResult2->fetch_assoc()) 157 157 { 158 158 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 159 159 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 160 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))160 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 161 161 { 162 162 $TableTexts[$en] = $cz; … … 167 167 168 168 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); 169 while ($Line = $DbResult2->fetch_assoc())169 while ($Line = $DbResult2->fetch_assoc()) 170 170 { 171 171 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 172 172 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 173 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))173 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 174 174 { 175 175 $TableTexts[$en] = $cz; … … 177 177 } 178 178 179 foreach ($TableTexts as $key => $value) {179 foreach ($TableTexts as $key => $value) { 180 180 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 181 181 $i++; … … 194 194 $CountFiles = 'CountFiles.lua'; 195 195 $Buffer = ''; 196 foreach ($CreatedFileList as $CreatedFile)196 foreach ($CreatedFileList as $CreatedFile) 197 197 $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n"; 198 foreach ($TranslationTree as $Group)199 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)198 foreach ($TranslationTree as $Group) 199 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) 200 200 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 201 201 { … … 209 209 $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"; 210 210 $Buffer .= '<script file="'.$CountFiles.'"/>'."\n"; 211 foreach ($CreatedFileList as $CreatedFile)211 foreach ($CreatedFileList as $CreatedFile) 212 212 $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n"; 213 213 $Buffer .= '</Ui>'; 214 214 file_put_contents($this->TempDir.'CzWoW/Translates.xml', $Buffer); 215 return ($Output);215 return $Output; 216 216 } 217 217 … … 235 235 236 236 $DbResult = $this->Database->query($this->BuildQuery($Group,$CanGenerated)); 237 while ($Line = $DbResult->fetch_array())237 while ($Line = $DbResult->fetch_array()) 238 238 { 239 239 $Original = $this->my_trim($Line['En'.$Column['Column']]); 240 240 $Translated = $this->my_trim($Line[$Column['Column']]); 241 if ($this->ClientVersion['Version'] == '2.4.3')241 if ($this->ClientVersion['Version'] == '2.4.3') 242 242 { 243 243 $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original); … … 247 247 } 248 248 249 if (!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/',0777, true);249 if (!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/',0777, true); 250 250 file_put_contents($this->TempDir.'CzWoW/LocalizationStrings.lua', $Buffer); 251 251 } … … 253 253 function MakeAddon() 254 254 { 255 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);255 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 256 256 $Output = $this->MakeLanguageFiles(); 257 257 $Output .= $this->MakeClientStrings(); 258 258 // $Output .= MakeMainScript($Setting); 259 return ($Output);259 return $Output; 260 260 } 261 261 … … 283 283 '; 284 284 $DbResult = $System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC'); 285 while ($Line = $DbResult->fetch_assoc())285 while ($Line = $DbResult->fetch_assoc()) 286 286 { 287 287 $Buffer .=' -
trunk/Modules/Export/Export.php
r879 r880 17 17 { 18 18 $this->TempDir = dirname(__FILE__).'/../../'.$this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 19 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);19 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 20 20 $this->TempDirRelative = $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 21 21 $this->SourceDir = dirname(__FILE__).'/../../'.$this->System->Config['Web']['SourceFolder']; 22 22 $this->SourceDirRelative = $this->System->Config['Web']['SourceFolder']; 23 if (!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true);23 if (!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true); 24 24 } 25 25 … … 29 29 if ($Export['AllUsers']) { 30 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())31 while ($UserLine = $DbResult2->fetch_assoc()) 32 32 { 33 33 $Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID']; 34 34 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); //,MAX(`Sequence`) as MaxSequence 35 if ($DbResult->num_rows > 0)35 if ($DbResult->num_rows > 0) 36 36 { 37 37 // $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); … … 50 50 { 51 51 $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id); 52 if ($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje');52 if ($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje'); 53 53 $this->Export = $DbResult->fetch_assoc(); 54 54 … … 58 58 'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '. 59 59 'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 60 while ($UserLine = $DbResult->fetch_assoc())60 while ($UserLine = $DbResult->fetch_assoc()) 61 61 { 62 62 $this->UserNames .= ', '.$UserLine['Name']; … … 64 64 $this->UserNames = substr($this->UserNames, 2); 65 65 66 if ($this->Export['ClientVersion'] != '')66 if ($this->Export['ClientVersion'] != '') 67 67 { 68 68 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']); … … 82 82 83 83 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id); 84 while ($GroupItem = $DbResultItem->fetch_assoc())84 while ($GroupItem = $DbResultItem->fetch_assoc()) 85 85 { 86 86 $GroupItems[$GroupItem['GroupItem']] = 1; … … 88 88 // Build selected columns 89 89 $Columns = ''; 90 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {90 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 91 91 if (!isset($GroupItems[$Column['Id']])) $Columns .= ' `T`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, '; 92 92 } … … 104 104 // Build columns for english texts 105 105 $OriginalColumns = ''; 106 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {106 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 107 107 $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, '; 108 108 if (isset($GroupItems[$Column['Id']])) … … 117 117 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 118 118 119 return ($Query);119 return $Query; 120 120 } 121 121 … … 129 129 if (file_exists($file)) 130 130 $date = date('Y-m-d H:i',(filemtime($file))); 131 else return (true);131 else return true; 132 132 // echo $file; 133 133 … … 135 135 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 136 136 $result = false; 137 while ($Group = $DbResult->fetch_assoc())137 while ($Group = $DbResult->fetch_assoc()) 138 138 { 139 139 $Query = 'SELECT * FROM `'.$Group['TablePrefix'].'` AS `T`'. … … 149 149 } 150 150 } 151 return ($result);151 return $result; 152 152 } 153 153 … … 172 172 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 173 173 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 174 while ($Group = $DbResult->fetch_assoc())174 while ($Group = $DbResult->fetch_assoc()) 175 175 { 176 176 $Buffer .= $Group['TablePrefix'].', '; … … 180 180 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 181 181 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 182 while ($Group = $DbResult->fetch_assoc())183 { 184 if ($Group['MangosTable'] != '')182 while ($Group = $DbResult->fetch_assoc()) 183 { 184 if ($Group['MangosTable'] != '') 185 185 { 186 186 $Buffer .= "\n\n-- ".$Group['Name']."\n\n"; 187 187 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 188 if ($DbResult2->num_rows > 0)189 while ($Line = $DbResult2->fetch_array())188 if ($DbResult2->num_rows > 0) 189 while ($Line = $DbResult2->fetch_array()) 190 190 { 191 191 $Values = ''; 192 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)193 if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key192 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 193 if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key 194 194 { 195 if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];195 if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column']; 196 196 $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"'; 197 197 } … … 200 200 // Get multicolumn index 201 201 $ColumnItems = explode(',', $Group['MangosTableIndex']); 202 if (count($ColumnItems) > 1)202 if (count($ColumnItems) > 1) 203 203 { 204 204 $Where = 'CONCAT('; 205 foreach ($ColumnItems as $ColumnItem)205 foreach ($ColumnItems as $ColumnItem) 206 206 $Where .= '`'.$ColumnItem.'`, "_", '; 207 207 $Where = substr($Where, 0, -7).')'; … … 216 216 } 217 217 } 218 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);219 return ($Buffer);218 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 219 return $Buffer; 220 220 } 221 221 … … 243 243 'aowow_skill' => 'skillID', 244 244 ); 245 foreach ($AoWoWTables as $AoWoWTable => $IndexColum)245 foreach ($AoWoWTables as $AoWoWTable => $IndexColum) 246 246 { 247 247 $Buffer .= '--'.$AoWoWTable.', '; … … 249 249 $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`'; 250 250 $DbResult = $Database2->query($Query); 251 while ($Line = $DbResult->fetch_assoc())251 while ($Line = $DbResult->fetch_assoc()) 252 252 { 253 253 $Ori_text = $Line['name']; … … 259 259 $Tran = $DbResult2->fetch_assoc(); 260 260 //echo ($Line['name'].'='.$Tran['tran']); 261 if ($Tran['Tran'] == '')261 if ($Tran['Tran'] == '') 262 262 { 263 263 $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`, … … 270 270 } 271 271 272 if ($Tran['Tran'] <> '')272 if ($Tran['Tran'] <> '') 273 273 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 274 274 } … … 276 276 } 277 277 */ 278 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);279 return ($Buffer);278 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 279 return $Buffer; 280 280 } 281 281 … … 299 299 if (false === strpos($String2,$varible)) { 300 300 // echo $varible; 301 return (false);301 return false; 302 302 } 303 303 } 304 304 } 305 return (true);305 return true; 306 306 } 307 307 … … 324 324 'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""'); 325 325 $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n"; 326 while ($Group = $DbResult->fetch_assoc())326 while ($Group = $DbResult->fetch_assoc()) 327 327 { 328 328 $this->AddProgress(2); 329 329 $Output .= $Group['Name'].', '; 330 if (file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'))330 if (file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 331 331 { 332 332 // Load string column index list … … 335 335 $ColumnIndexes = array(); 336 336 $ColumnFormat = array(); 337 while ($DbRow = $DbResult2->fetch_assoc())337 while ($DbRow = $DbResult2->fetch_assoc()) 338 338 { 339 339 $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING; … … 344 344 $LookupTable = array(); 345 345 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 346 while ($DbRow = $DbResult2->fetch_assoc()) {346 while ($DbRow = $DbResult2->fetch_assoc()) { 347 347 //Export only if translate have same varible % 348 348 $CanExport = true; 349 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {349 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 350 350 $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]); 351 351 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']])) { … … 369 369 370 370 // Create new DBC file 371 if (!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true);371 if (!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true); 372 372 $NewDBCFile = new DBCFile(); 373 373 $NewDBCFile->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat); … … 381 381 $RowCount = $SourceDBCFile->GetRecordCount(); 382 382 $FieldCount = $SourceDBCFile->GetFieldCount(); 383 for ($Row = 0; $Row < $RowCount; $Row++)383 for ($Row = 0; $Row < $RowCount; $Row++) 384 384 { 385 385 $Line = $SourceDBCFile->GetLine($Row); … … 388 388 $PrimaryKeyItem = ''; 389 389 $ColumnItems = explode(',', $Group['DBCIndex']); 390 if (count($ColumnItems) > 1)390 if (count($ColumnItems) > 1) 391 391 { 392 foreach ($ColumnItems as $ColumnItem)392 foreach ($ColumnItems as $ColumnItem) 393 393 $PrimaryKeyItem .= $Line[$ColumnItem].'_'; 394 394 $PrimaryKeyItem = substr($PrimaryKeyItem, 0, -1); 395 395 } else $PrimaryKeyItem = $Line[$Group['DBCIndex']]; 396 396 397 if (array_key_exists($PrimaryKeyItem, $LookupTable))397 if (array_key_exists($PrimaryKeyItem, $LookupTable)) 398 398 { 399 399 // Replace text columns 400 400 $LookupTableItem = $LookupTable[$PrimaryKeyItem]; 401 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)401 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 402 402 { 403 if (array_key_exists($GroupItem['Id'], $ColumnIndexes))403 if (array_key_exists($GroupItem['Id'], $ColumnIndexes)) 404 404 $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']]; 405 405 } … … 409 409 // Show completion progress 410 410 $Progress = round($Row / $RowCount * 100); 411 if ($Progress != $OldProgress)411 if ($Progress != $OldProgress) 412 412 { 413 413 if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01); … … 422 422 } 423 423 $Output .= 'Hotovo <br />'; 424 return ($Output);424 return $Output; 425 425 } 426 426 … … 432 432 433 433 $Output = ''; 434 if (!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true);434 if (!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true); 435 435 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`LuaFileName` != ""'); 436 while ($Group = $DbResult->fetch_assoc())436 while ($Group = $DbResult->fetch_assoc()) 437 437 { 438 438 $this->AddProgress(1); … … 448 448 $LookupTable = array(); 449 449 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 450 while ($DbRow = $DbResult2->fetch_assoc()) {450 while ($DbRow = $DbResult2->fetch_assoc()) { 451 451 $CanExport = true; 452 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {452 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 453 453 // if (strpos($DbRow[$Column['Column']],'\\')) 454 454 // $CanExport = false; … … 502 502 } 503 503 504 while (!$File->EOF())504 while (!$File->EOF()) 505 505 { 506 506 $Line = $File->ReadLine(); 507 if (strpos($Line, '=') !== false)507 if (strpos($Line, '=') !== false) 508 508 { 509 509 $LineParts = explode('=', $Line, 2); … … 511 511 $Line = trim($LineParts[1]); 512 512 513 if ($Line[0] == '"')513 if ($Line[0] == '"') 514 514 { 515 515 // Quoted string value … … 532 532 $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --" 533 533 534 if (array_key_exists($Value['ShortCut'], $LookupTable))534 if (array_key_exists($Value['ShortCut'], $LookupTable)) 535 535 { 536 536 $DbRow = $LookupTable[$Value['ShortCut']]; … … 548 548 } 549 549 $NewLine = $Value['ShortCut'].' = "'.$Value['Text'].'";'; 550 //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];550 //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment']; 551 551 $NewLine .= "\r\n"; 552 552 $File2->WriteLine($NewLine); … … 555 555 $Output .= 'Hotovo <br/>'; 556 556 } 557 return ($Output);557 return $Output; 558 558 } 559 559 … … 656 656 " <author>".$this->System->User->Name."</author>\n". 657 657 " <contributors>\n"; 658 foreach (explode(',', $this->UserNames) as $UserName)658 foreach (explode(',', $this->UserNames) as $UserName) 659 659 $Buffer .= " <user>".$UserName."</user>\n"; 660 660 $Buffer .= … … 665 665 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 666 666 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 667 while ($Group = $DbResult->fetch_assoc())668 { 669 if ($Group['MangosTable'] == '')667 while ($Group = $DbResult->fetch_assoc()) 668 { 669 if ($Group['MangosTable'] == '') 670 670 { 671 671 $Group['MangosTable'] = $Group['TablePrefix']; … … 674 674 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n"; 675 675 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 676 while ($Line = $DbResult2->fetch_assoc())676 while ($Line = $DbResult2->fetch_assoc()) 677 677 { 678 678 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; 679 679 $Values = ''; 680 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)680 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 681 681 { 682 if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];683 if ($Line[$GroupItem['Column']] != '')682 if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column']; 683 if ($Line[$GroupItem['Column']] != '') 684 684 $Buffer .= ' <text index="'.$GroupItem['Id'].'" name="'. 685 685 $GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n"; … … 689 689 $Buffer .= " </group>\n"; 690 690 } 691 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);691 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 692 692 $Buffer .= " </translation>\n". 693 693 "</document>"; 694 return ($Buffer);694 return $Buffer; 695 695 } 696 696 } … … 732 732 '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 733 733 '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id 734 while ($Task = $DbResult->fetch_assoc())734 while ($Task = $DbResult->fetch_assoc()) 735 735 { 736 736 $Export = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; … … 744 744 // Show estimated time to complete 745 745 $PrefixMultiplier = new PrefixMultiplier(); 746 if ($Task['Progress'] > 0) {746 if ($Task['Progress'] > 0) { 747 747 $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']); 748 748 $Output .= T('Elapsed time').': <strong>'.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').'</strong> / '; … … 752 752 $Output .= '</div>'; 753 753 754 if ($Task['Progress'] > 99)754 if ($Task['Progress'] > 99) 755 755 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 756 756 'setTimeout("parent.location.href=\''.$this->System->Link('/export/?Action=View&Tab=7&ExportId='.$TaskId).'\'", 500)'. 757 757 '</script>'; 758 758 } 759 return ($Output);759 return $Output; 760 760 } 761 761 } -
trunk/Modules/Export/ExportOutput.php
r867 r880 10 10 { 11 11 $FileList = scandir($Path); 12 foreach ($FileList as $FileName)13 { 14 if (file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..'))12 foreach ($FileList as $FileName) 13 { 14 if (file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..')) 15 15 { 16 if (is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');16 if (is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/'); 17 17 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 18 18 } … … 28 28 $Export->Id = $ExportId; 29 29 $Export->Init(); 30 if (function_exists('gzcompress'))30 if (function_exists('gzcompress')) 31 31 { 32 32 $SaveFilename = $Export->TempDir.'CzAoWoW_SQL.zip'; … … 45 45 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 46 46 '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.'; 47 return ($Output);47 return $Output; 48 48 } 49 49 … … 58 58 htmlspecialchars($Export->ExportToAoWoWSQL()). 59 59 '</pre>'; 60 return ($Output );60 return $Output ; 61 61 } 62 62 … … 69 69 $Export->Id = $ExportId; 70 70 $Export->Init(); 71 if (function_exists('gzcompress'))71 if (function_exists('gzcompress')) 72 72 { 73 73 $SaveFilename = $Export->TempDir.'CzWoW_SQL.zip'; … … 86 86 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 87 87 '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.'; 88 return ($Output);88 return $Output; 89 89 } 90 90 … … 99 99 htmlspecialchars($Export->ExportToMangosSQL()). 100 100 '</pre>'; 101 return ($Output);101 return $Output; 102 102 } 103 103 … … 106 106 global $System; 107 107 108 if (function_exists('gzcompress'))108 if (function_exists('gzcompress')) 109 109 { 110 110 $Addon = new ExportAddon($System); … … 135 135 '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.'; 136 136 $Output .= '<br /><strong>Použití ve hře</strong><br />Menu addonu ve hře vyvoláte povelem /czwow.'; 137 return ($Output);137 return $Output; 138 138 } 139 139 … … 146 146 $Export->Id = $ExportId; 147 147 $Export->Init(); 148 if (function_exists('gzcompress'))148 if (function_exists('gzcompress')) 149 149 { 150 150 $SaveFilename = $Export->TempDir.'CzWoW_XML.zip'; … … 163 163 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'. 164 164 '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.'; 165 return ($Output);165 return $Output; 166 166 } 167 167 … … 176 176 htmlspecialchars($Export->ExportToXML()). 177 177 '</pre>'; 178 return ($Output);178 return $Output; 179 179 } 180 180 … … 190 190 $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId. 191 191 ') AND ((`TimeFinish` < `TimeStart`) OR (`TimeFinish` IS NULL))'); 192 if ($DbResult->num_rows == 0)193 { 194 if (array_key_exists('Regenerate', $_POST))192 if ($DbResult->num_rows == 0) 193 { 194 if (array_key_exists('Regenerate', $_POST)) 195 195 { 196 196 $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0 , `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId); … … 211 211 212 212 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 213 if ($DbResult->num_rows == 0)213 if ($DbResult->num_rows == 0) 214 214 { 215 215 $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeQueued` ) VALUES ('.$ExportId.', NOW())'); … … 220 220 $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId); 221 221 $ExportTask = $DbResult->fetch_assoc(); 222 if ($ExportTask['TimeFinish'] <> '')222 if ($ExportTask['TimeFinish'] <> '') 223 223 { 224 224 $Output .= '<strong>Souhrný balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_DBC.zip').'">CzWoW_DBC.zip</a></strong><br/>'; 225 225 $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`DBCFileName` != ""'); 226 while ($Group = $DbResult->fetch_assoc())226 while ($Group = $DbResult->fetch_assoc()) 227 227 { 228 if (file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc'))228 if (file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc')) 229 229 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'dbc/'.$Group['DBCFileName'].'.dbc').'">'.$Group['DBCFileName'].'.dbc</a><br/>'; 230 230 } … … 233 233 234 234 } 235 return ($Output);235 return $Output; 236 236 } 237 237 … … 261 261 'WHERE ((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 262 262 '(`TimeFinish` IS NULL) AND (`TimeQueued` < (NOW() - '.$Timeout.'))'); 263 if ($DbResult->num_rows > 0)263 if ($DbResult->num_rows > 0) 264 264 { 265 265 $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR); 266 266 } 267 return ($Output);267 return $Output; 268 268 } 269 269 … … 281 281 $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId. 282 282 ') AND ((`TimeFinish` < `TimeStart`) OR (`TimeFinish` IS NULL))'); 283 if ($DbResult->num_rows == 0)284 { 285 if (array_key_exists('Regenerate', $_POST))283 if ($DbResult->num_rows == 0) 284 { 285 if (array_key_exists('Regenerate', $_POST)) 286 286 { 287 287 $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0, `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId); … … 298 298 // Start task for the first time if export task was not yet started 299 299 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 300 if ($DbResult->num_rows == 0)300 if ($DbResult->num_rows == 0) 301 301 { 302 302 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); … … 306 306 $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId); 307 307 $ExportTask = $DbResult->fetch_assoc(); 308 if ($ExportTask['TimeFinish'] <> '')308 if ($ExportTask['TimeFinish'] <> '') 309 309 { 310 310 $FileName = 'Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe'; … … 313 313 $Output .= ShowProgress($Export); 314 314 } 315 return ($Output);315 return $Output; 316 316 } 317 317 … … 324 324 $Export->Init(); 325 325 326 if (function_exists('gzcompress'))326 if (function_exists('gzcompress')) 327 327 { 328 328 $Output = 'Generování lua souborů...<br />'; … … 342 342 'Souhrný archív <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_Lua.zip').'">CzWoW_Lua.zip</a><br />'; 343 343 $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`LuaFileName` != ""'); 344 while ($Group = $DbResult->fetch_assoc())344 while ($Group = $DbResult->fetch_assoc()) 345 345 { 346 346 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'lua/'.$Group['LuaFileName'].'.lua').'">'.$Group['LuaFileName'].'.lua</a><br/>'; 347 347 } 348 348 $Output .= '<br /><br /><strong>Použití ve hře</strong><br />Ze souborů vytvořte MPQ archív a nahrajte ho do hry do podsložky jako Data/enUS/patch-enUS-5.MPQ nebo Data/enUS/patch-enGB-5.MPQ. Pro starší verze hry než 3.2.0 je nutné spouštět hru pomocí programu WoWMe.exe (WoW Model Editor Fix).'; 349 return ($Output);349 return $Output; 350 350 } 351 351 352 352 function ExportOutput($ExportId, $Type) 353 353 { 354 if ($Type == 1) $Output = OutputMangosSQLToHTML($ExportId);355 else if ($Type == 2) $Output = OutputMangosSQLToFile($ExportId);356 else if ($Type == 3) $Output = OutputAoWoWToHTML($ExportId);357 else if ($Type == 4) $Output = OutputAoWoWToFile($ExportId);358 else if ($Type == 5) $Output = OutputXMLToHTML($ExportId);359 else if ($Type == 6) $Output = OutputXMLToFile($ExportId);360 else if ($Type == 7) $Output = OutputAddon($ExportId);361 else if ($Type == 8) $Output = OutputLua($ExportId);362 else if ($Type == 9) $Output = OutputDBCToFile($ExportId);363 else if ($Type == 10) $Output = OutputEXEToFile($ExportId);354 if ($Type == 1) $Output = OutputMangosSQLToHTML($ExportId); 355 else if ($Type == 2) $Output = OutputMangosSQLToFile($ExportId); 356 else if ($Type == 3) $Output = OutputAoWoWToHTML($ExportId); 357 else if ($Type == 4) $Output = OutputAoWoWToFile($ExportId); 358 else if ($Type == 5) $Output = OutputXMLToHTML($ExportId); 359 else if ($Type == 6) $Output = OutputXMLToFile($ExportId); 360 else if ($Type == 7) $Output = OutputAddon($ExportId); 361 else if ($Type == 8) $Output = OutputLua($ExportId); 362 else if ($Type == 9) $Output = OutputDBCToFile($ExportId); 363 else if ($Type == 10) $Output = OutputEXEToFile($ExportId); 364 364 else $Output = ShowMessage('Nebyl vybrán žádný formát výstupu.', MESSAGE_CRITICAL); 365 return ($Output);366 } 365 return $Output; 366 } -
trunk/Modules/Export/Page.php
r864 r880 17 17 { 18 18 $Output = '<a href="?Action=ViewList">'.T('All').'</a>'; 19 if ($this->System->User->Licence(LICENCE_USER))19 if ($this->System->User->Licence(LICENCE_USER)) 20 20 { 21 21 $Output .= ' <a href="?Action=ViewList&Filter=Others">'.T('Others').'</a>'. … … 23 23 } 24 24 25 if ($this->System->User->Licence(LICENCE_USER))25 if ($this->System->User->Licence(LICENCE_USER)) 26 26 $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>'; 27 27 28 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;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 33 } 34 34 … … 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 while ($Export = $DbResult->fetch_assoc())64 while ($Export = $DbResult->fetch_assoc()) 65 65 { 66 66 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">'.T('View').'</a> '. 67 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>';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 70 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 71 71 '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. … … 79 79 $PageList['Output']; 80 80 81 return ($Output);81 return $Output; 82 82 } 83 83 84 84 function ExportCreate() 85 85 { 86 if ($this->System->User->Licence(LICENCE_USER))86 if ($this->System->User->Licence(LICENCE_USER)) 87 87 { 88 88 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 89 89 $DbRow = $DbResult->fetch_row(); 90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 91 91 { 92 92 $Output = '<form action="?Action=CreateFinish" method="post">'. … … 98 98 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 99 99 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 100 return ($Output);100 return $Output; 101 101 } 102 102 103 103 function ExportCreateFinish() 104 104 { 105 if ($this->System->User->Licence(LICENCE_USER))106 { 107 if (array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))105 if ($this->System->User->Licence(LICENCE_USER)) 106 { 107 if (array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 108 108 { 109 109 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 110 110 $DbRow = $DbResult->fetch_row(); 111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 112 112 { 113 113 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); … … 120 120 } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL); 121 121 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 122 return ($Output);122 return $Output; 123 123 } 124 124 125 125 function ExportDelete() 126 126 { 127 if ($this->System->User->Licence(LICENCE_USER))127 if ($this->System->User->Licence(LICENCE_USER)) 128 128 { 129 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)130 if ($DbResult->num_rows > 0) 131 131 { 132 132 $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']); … … 143 143 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 144 144 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 145 return ($Output);145 return $Output; 146 146 } 147 147 … … 163 163 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 164 164 $Export = $DbResult->fetch_assoc(); 165 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;165 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 166 166 else $Editable = false; 167 167 168 if (array_key_exists('Operation', $_POST))169 { 170 if ($_POST['Operation'] == 'Save')168 if (array_key_exists('Operation', $_POST)) 169 { 170 if ($_POST['Operation'] == 'Save') 171 171 { 172 172 //print_r($_POST); 173 173 // Update user selection page 174 foreach ($_POST as $Index => $Value)174 foreach ($_POST as $Index => $Value) 175 175 { 176 if (substr($Index, 0, 3) == 'seq')176 if (substr($Index, 0, 3) == 'seq') 177 177 { 178 178 $UserId = substr($Index, 3) * 1; 179 if (array_key_exists('sel'.$UserId, $_POST)) $Selected = true;179 if (array_key_exists('sel'.$UserId, $_POST)) $Selected = true; 180 180 else $Selected = false; 181 181 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId; 182 182 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); 183 if ($DbResult->num_rows > 0)183 if ($DbResult->num_rows > 0) 184 184 { 185 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);185 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition); 186 186 else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 187 187 } else 188 188 { 189 if ($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');189 if ($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')'); 190 190 } 191 191 } … … 221 221 ); 222 222 $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1); 223 if ($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10);223 if ($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10); 224 224 else $InitialOrder = ''; 225 225 … … 234 234 $Output .= '<form name="Translators" action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 235 235 '<h3>'.T('Translators').'</h3>'; 236 if ($Editable)236 if ($Editable) 237 237 { 238 238 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 252 252 $this->System->Database->query('SET @I = 0'); 253 253 $DbResult = $this->System->Database->query($Query); 254 while ($UserLine = $DbResult->fetch_assoc())254 while ($UserLine = $DbResult->fetch_assoc()) 255 255 { 256 256 $XP = GetLevelMinMax($UserLine['XP']); … … 268 268 '</form>'. 269 269 $PageList['Output']; 270 return ($Output);270 return $Output; 271 271 } 272 272 … … 278 278 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 279 279 $Export = $DbRows->fetch_assoc(); 280 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;280 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 281 281 else $Editable = false; 282 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;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 287 else $WithDiacritic = 0; 288 288 if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1; … … 296 296 } 297 297 298 if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';298 if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"'; 299 299 else $WithDiacritic = ''; 300 300 $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 301 301 '<table>'; 302 if ($this->System->User->Id != null)302 if ($this->System->User->Id != null) 303 303 { 304 304 $Output .= '<input type="hidden" name="Operation" value="Save"/>'. 305 305 '<tr><td colspan="2">'; 306 if ($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>';306 if ($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'; 307 307 $Output .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a> '; 308 if ($this->System->User->Licence(LICENCE_ADMIN))308 if ($this->System->User->Licence(LICENCE_ADMIN)) 309 309 $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' '; 310 310 $Output .= '</td></tr>'; … … 314 314 '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'. 315 315 '</table></form>'; 316 return ($Output);316 return $Output; 317 317 } 318 318 … … 325 325 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 326 326 $Export = $DbRows->fetch_assoc(); 327 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;327 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 328 328 else $Editable = false; 329 329 330 if (array_key_exists('Operation', $_POST))331 { 332 if ($_POST['Operation'] == 'Save')330 if (array_key_exists('Operation', $_POST)) 331 { 332 if ($_POST['Operation'] == 'Save') 333 333 { 334 334 //print_r($_POST); 335 335 // Update user selection page 336 foreach ($_POST as $Index => $Value)336 foreach ($_POST as $Index => $Value) 337 337 { 338 if (substr($Index, 0, 3) == 'seq')338 if (substr($Index, 0, 3) == 'seq') 339 339 { 340 340 $LanguageId = substr($Index, 3) * 1; 341 if (array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;341 if (array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true; 342 342 else $Selected = false; 343 343 $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId; 344 344 $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition); 345 if ($DbResult->num_rows > 0)345 if ($DbResult->num_rows > 0) 346 346 { 347 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);347 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition); 348 348 else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition); 349 349 } else 350 350 { 351 if ($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');351 if ($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')'); 352 352 } 353 353 } … … 377 377 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 378 378 '<h3>'.T('Languages').'</h3>'; 379 if ($Editable)379 if ($Editable) 380 380 { 381 381 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 393 393 $this->System->Database->query('SET @I = 0'); 394 394 $DbResult = $this->System->Database->query($Query); 395 while ($Langugage = $DbResult->fetch_assoc())395 while ($Langugage = $DbResult->fetch_assoc()) 396 396 { 397 397 $Checked = $Langugage['Sequence'] != ''; … … 405 405 '</form>'. 406 406 $PageList['Output']; 407 return ($Output);407 return $Output; 408 408 } 409 409 … … 416 416 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 417 417 $Export = $DbRows->fetch_assoc(); 418 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;418 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 419 419 else $Editable = false; 420 420 421 if (array_key_exists('Operation', $_POST))422 { 423 if ($_POST['Operation'] == 'Save')421 if (array_key_exists('Operation', $_POST)) 422 { 423 if ($_POST['Operation'] == 'Save') 424 424 { 425 425 //print_r($_POST); 426 426 // Update user selection page 427 foreach ($_POST as $Index => $Value)427 foreach ($_POST as $Index => $Value) 428 428 { 429 if (substr($Index, 0, 3) == 'seq')429 if (substr($Index, 0, 3) == 'seq') 430 430 { 431 431 $GroupId = substr($Index, 3) * 1; 432 if (array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;432 if (array_key_exists('sel'.$GroupId, $_POST)) $Selected = true; 433 433 else $Selected = false; 434 434 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId; 435 435 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition); 436 if ($DbResult->num_rows > 0)436 if ($DbResult->num_rows > 0) 437 437 { 438 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);438 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition); 439 439 } else 440 440 { 441 if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');441 if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')'); 442 442 } 443 443 } … … 446 446 } 447 447 //items 448 foreach ($TranslationTree as $Group)449 { 450 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {451 if (array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true;448 foreach ($TranslationTree as $Group) 449 { 450 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 451 if (array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true; 452 452 else $Selected = false; 453 453 //we will save only forbitten collums and need to be visible … … 457 457 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id']; 458 458 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition); 459 if ($DbResult->num_rows > 0)459 if ($DbResult->num_rows > 0) 460 460 { 461 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);461 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition); 462 462 } else 463 463 { 464 if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')');464 if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')'); 465 465 } 466 466 … … 486 486 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 487 487 '<h3>'.T('Translation groups').'</h3>'; 488 if ($Editable)488 if ($Editable) 489 489 { 490 490 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 500 500 501 501 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']); 502 while ($GroupItem = $DbResultItem->fetch_assoc())502 while ($GroupItem = $DbResultItem->fetch_assoc()) 503 503 { 504 504 $GroupItems[$GroupItem['GroupItem']] = 1; … … 507 507 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 508 508 $DbResult = $this->System->Database->query($Query); 509 while ($Group = $DbResult->fetch_assoc())509 while ($Group = $DbResult->fetch_assoc()) 510 510 { 511 511 $Columns = ''; 512 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {512 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 513 513 if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'], 514 514 !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.T($Column['Name']).' <br/>'; … … 533 533 '</form>'. 534 534 $PageList['Output']; 535 return ($Output);535 return $Output; 536 536 } 537 537 … … 540 540 $Output = ''; 541 541 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 542 if (array_key_exists('ExportId', $_GET))542 if (array_key_exists('ExportId', $_GET)) 543 543 { 544 544 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 545 if ($DbRows->num_rows > 0)545 if ($DbRows->num_rows > 0) 546 546 { 547 547 $Export = $DbRows->fetch_assoc(); 548 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;548 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 549 549 else $Editable = false; 550 550 551 if (array_key_exists('Operation', $_POST))552 if ($_POST['Operation'] == 'Save')551 if (array_key_exists('Operation', $_POST)) 552 if ($_POST['Operation'] == 'Save') 553 553 { 554 if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))554 if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0)) 555 555 { 556 556 $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']); … … 564 564 $Output .= '<h3>'.T('Format the generated output').'</h3>'. 565 565 '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'; 566 if ($Editable)566 if ($Editable) 567 567 { 568 568 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 571 571 } 572 572 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`'); 573 while ($ExportFormat = $DbResult->fetch_assoc())573 while ($ExportFormat = $DbResult->fetch_assoc()) 574 574 { 575 575 $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>'; … … 578 578 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 579 579 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 580 return ($Output);580 return $Output; 581 581 } 582 582 … … 587 587 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 588 588 $Export = $DbRows->fetch_assoc(); 589 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;589 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 590 590 else $Editable = false; 591 591 592 if (array_key_exists('Operation', $_POST))593 if (($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))592 if (array_key_exists('Operation', $_POST)) 593 if (($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST))) 594 594 { 595 595 $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']); … … 600 600 $Export = $DbResult->fetch_assoc(); 601 601 602 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);602 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 603 603 else { 604 604 $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '. … … 620 620 '<h3>'.T('Client version').'</h3>'; 621 621 622 if ($Editable)622 if ($Editable) 623 623 { 624 624 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 633 633 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 634 634 $DbResult = $this->System->Database->query($Query); 635 while ($Version = $DbResult->fetch_assoc())635 while ($Version = $DbResult->fetch_assoc()) 636 636 { 637 637 $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Version['Id']).'">'. … … 646 646 $PageList['Output']; 647 647 } 648 return ($Output);648 return $Output; 649 649 } 650 650 … … 654 654 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 655 655 $Export = $DbResult->fetch_assoc(); 656 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);657 else if ($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);656 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 657 else if ($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 658 658 else { 659 659 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']); 660 if ($DbResult->num_rows > 0)660 if ($DbResult->num_rows > 0) 661 661 { 662 662 $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')'); 663 if ($DbResult->num_rows > 0)663 if ($DbResult->num_rows > 0) 664 664 { 665 665 if (array_key_exists('Auto', $_GET) == false) … … 669 669 } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL); 670 670 } 671 return ($Output);671 return $Output; 672 672 } 673 673 … … 679 679 $Export->LoadFilters(); 680 680 681 if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))681 if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == '')) 682 682 $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 683 683 else { … … 687 687 $UnionItems = array(); 688 688 $DbResult = $this->System->Database->query($GroupListQuery.$Where); 689 while ($DbRow = $DbResult->fetch_assoc())689 while ($DbRow = $DbResult->fetch_assoc()) 690 690 { 691 691 $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 721 721 $Translated = 0; 722 722 $Total = 0; 723 if (count($UnionItems) > 0)723 if (count($UnionItems) > 0) 724 724 { 725 725 $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 726 while ($Group = $ID->fetch_assoc())726 while ($Group = $ID->fetch_assoc()) 727 727 { 728 728 $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; … … 731 731 } 732 732 } 733 if ($Total > 0) $Percent = $Translated / $Total * 100;733 if ($Total > 0) $Percent = $Translated / $Total * 100; 734 734 else $Percent = 100; 735 735 … … 737 737 $Output .= '</table>'; 738 738 } 739 return ($Output);739 return $Output; 740 740 } 741 741 … … 743 743 { 744 744 $Output = ''; 745 if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))745 if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 746 746 { 747 747 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 748 if ($DbResult->num_rows > 0)748 if ($DbResult->num_rows > 0) 749 749 { 750 750 $Export = $DbResult->fetch_assoc(); … … 759 759 T('Statistic'), T('Output'))); 760 760 $Output .= '<div id="content">'; 761 if ($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();762 else if ($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators();763 else if ($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups();764 else if ($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages();765 else if ($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat();766 else if ($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion();767 else if ($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat();768 else if ($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput();761 if ($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral(); 762 else if ($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators(); 763 else if ($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups(); 764 else if ($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages(); 765 else if ($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat(); 766 else if ($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion(); 767 else if ($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat(); 768 else if ($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput(); 769 769 else $Output .= $this->ExportViewGeneral(); 770 770 … … 772 772 } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 773 773 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 774 return ($Output);774 return $Output; 775 775 } 776 776 777 777 function ExportClone() 778 778 { 779 if ($this->System->User->Licence(LICENCE_USER))780 { 781 if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))779 if ($this->System->User->Licence(LICENCE_USER)) 780 { 781 if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 782 782 { 783 783 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 784 784 $DbRow = $DbResult->fetch_row(); 785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 786 786 { 787 787 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 788 if ($DbResult->num_rows > 0)788 if ($DbResult->num_rows > 0) 789 789 { 790 790 $DbRow = $DbResult->fetch_assoc(); … … 810 810 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 811 811 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 812 return ($Output);812 return $Output; 813 813 } 814 814 … … 816 816 { 817 817 $this->Title = T('Export'); 818 if (array_key_exists('Action', $_GET))819 { 820 if ($_GET['Action'] == 'Create') $Output = $this->ExportCreate();821 else if ($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();822 else if ($_GET['Action'] == 'View') $Output = $this->ExportView();823 else if ($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();824 else if ($_GET['Action'] == 'Clone') $Output = $this->ExportClone();818 if (array_key_exists('Action', $_GET)) 819 { 820 if ($_GET['Action'] == 'Create') $Output = $this->ExportCreate(); 821 else if ($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish(); 822 else if ($_GET['Action'] == 'View') $Output = $this->ExportView(); 823 else if ($_GET['Action'] == 'Delete') $Output = $this->ExportDelete(); 824 else if ($_GET['Action'] == 'Clone') $Output = $this->ExportClone(); 825 825 else $Output = $this->ExportList(); 826 826 } else $Output = $this->ExportList(); 827 return ($Output);827 return $Output; 828 828 } 829 829 } … … 839 839 function Show() 840 840 { 841 if (array_key_exists('i', $_GET))841 if (array_key_exists('i', $_GET)) 842 842 $Output = $this->System->ModuleManager->Modules['Export']->GetTaskProgress($_GET['i'] * 1); 843 843 else $Output = 'Missing task id'; 844 return ($Output);844 return $Output; 845 845 } 846 846 } -
trunk/Modules/Export/ProcessAoWoWExport.php
r848 r880 14 14 $Output = ''; 15 15 16 if (defined('STDIN') == false)16 if (defined('STDIN') == false) 17 17 { 18 18 $Output = T('Access denied'); … … 20 20 } 21 21 22 foreach ($_SERVER['argv'] as $parameter)22 foreach ($_SERVER['argv'] as $parameter) 23 23 { 24 if (strpos($parameter, '=') !== false)24 if (strpos($parameter, '=') !== false) 25 25 { 26 26 $index = substr($parameter, 0, strpos($parameter, '=')); … … 33 33 echo 'Generuji Export:'; 34 34 $Export = new Export($System); 35 if (!array_key_exists('AoWoWExportId', $Config)) {35 if (!array_key_exists('AoWoWExportId', $Config)) { 36 36 $Export->Id = $Config['AoWoWExportId']; 37 37 } else $Export->Id = 37; … … 45 45 $UserSelection = array(); 46 46 $DbResult = $System->Database->query('SELECT `ID`, `XP` FROM `User`'); 47 while ($DbRow = $DbResult->fetch_assoc())47 while ($DbRow = $DbResult->fetch_assoc()) 48 48 { 49 49 $UserSelection[$DbRow['ID']] = $DbRow['XP']; … … 53 53 // Update export user selection sequence 54 54 $Sequence = 1; 55 foreach ($UserSelection as $ID => $XP)55 foreach ($UserSelection as $ID => $XP) 56 56 { 57 57 $DbResult = $System->Database->query('SELECT `Id` FROM `ExportUser` WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID); 58 if ($DbResult->num_rows > 0)58 if ($DbResult->num_rows > 0) 59 59 $Query = 'UPDATE `ExportUser` SET `Sequence` = '.$Sequence.' WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID; 60 60 else $Query = 'INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$Config['AoWoWExportId'].', '.$ID.', '.$Sequence.')'; … … 70 70 $Database2->query('SET NAMES '.$Config['Database']['Charset']); 71 71 $Database2->select_db($Config['Database']['DatabaseAoWoW']); 72 foreach ($SQL as $Line)72 foreach ($SQL as $Line) 73 73 { 74 74 //echo '.'; 75 75 //echo($Line."\n"); 76 if (trim($Line) != '') $Database2->query($Line);76 if (trim($Line) != '') $Database2->query($Line); 77 77 } 78 78 echo 'Hotovo … … 83 83 // Delete temporary cache files 84 84 $Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos'); 85 foreach ($Files as $File)85 foreach ($Files as $File) 86 86 { 87 87 $End = substr($File, strlen($File) - 3); 88 if ($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File);88 if ($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File); 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); 94 if ($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File);94 if ($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File); 95 95 } 96 96 echo 'Hotovo -
trunk/Modules/Export/ProcessTask.php
r869 r880 23 23 function DeleteOldFiles($deldir) 24 24 { 25 if (file_exists($deldir.'/'))25 if (file_exists($deldir.'/')) 26 26 { 27 27 $Dir = opendir($deldir.'/') ; 28 while (($File = readdir($Dir)) !== false)28 while (($File = readdir($Dir)) !== false) 29 29 { 30 if (($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File);30 if (($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File); 31 31 } 32 32 closedir($Dir); … … 56 56 function MPQPack($packdir) 57 57 { 58 if (file_exists($packdir.DIRECTORY_SEPARATOR))58 if (file_exists($packdir.DIRECTORY_SEPARATOR)) 59 59 { 60 60 $Dir = opendir($packdir.DIRECTORY_SEPARATOR); 61 while (($File = readdir($Dir)) !== false)61 while (($File = readdir($Dir)) !== false) 62 62 { 63 if (($File != '..') and ($File != '.')) {63 if (($File != '..') and ($File != '.')) { 64 64 $File = str_replace('/', DIRECTORY_SEPARATOR, $File); 65 65 $InDir = ''; … … 109 109 // Delete old files 110 110 $this->DeleteOldFiles($Export->TempDir.'dbc'); 111 if (file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip');111 if (file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip'); 112 112 113 113 $this->SetProgress(20); 114 if (function_exists('gzcompress'))114 if (function_exists('gzcompress')) 115 115 { 116 116 $Export->ExportToDBC(); … … 185 185 global $Config; 186 186 187 while (1)187 while (1) 188 188 { 189 189 $DbResult = $this->Database->query('SELECT `ExportTask`.`Id`, `ExportTask`.`Export`, '. … … 191 191 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '. 192 192 '(`ExportTask`.`TimeFinish` IS NULL) ORDER BY `TimeQueued`'); 193 while ($Task = $DbResult->fetch_assoc())193 while ($Task = $DbResult->fetch_assoc()) 194 194 { 195 195 $this->Id = $Task['Id']; 196 if ($Task['ExportId'] != '')196 if ($Task['ExportId'] != '') 197 197 { 198 198 try … … 201 201 $this->Database->update('ExportTask', '`Id`='.$this->Id, array('TimeStart' => 'NOW()')); 202 202 203 if ($Task['ExportOutput'] == 9)203 if ($Task['ExportOutput'] == 9) 204 204 { 205 205 $this->ExportDBC($Task); 206 206 } else 207 if ($Task['ExportOutput'] == 10)207 if ($Task['ExportOutput'] == 10) 208 208 { 209 209 $this->ExportEXE($Task); -
trunk/Modules/Export/cmdmpqexport.php
r867 r880 17 17 $Output = ''; 18 18 19 if (defined('STDIN') == false)19 if (defined('STDIN') == false) 20 20 { 21 21 $Output = T('Access denied'); … … 23 23 } 24 24 25 foreach ($_SERVER['argv'] as $parameter)25 foreach ($_SERVER['argv'] as $parameter) 26 26 { 27 if (strpos($parameter, '=') !== false)27 if (strpos($parameter, '=') !== false) 28 28 { 29 29 $index = substr($parameter, 0, strpos($parameter, '=')); … … 33 33 } else $_GET[$parameter] = ''; 34 34 } 35 if (!array_key_exists('ExportId', $_GET) and !array_key_exists('needgeneration', $_GET) and !array_key_exists('version', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) {35 if (!array_key_exists('ExportId', $_GET) and !array_key_exists('needgeneration', $_GET) and !array_key_exists('version', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) { 36 36 $Output .= 'Usage type_export=id_export -for export<br />'; 37 37 $Output .= 'Usage ExportId=id_export - for write export info<br />'; … … 43 43 } 44 44 //37 45 if (array_key_exists('lua', $_GET)) {45 if (array_key_exists('lua', $_GET)) { 46 46 $Export = new Export($System); 47 47 $Export->Id = $_GET['lua']; … … 53 53 ',$Output); 54 54 } 55 if (array_key_exists('version', $_GET)) {55 if (array_key_exists('version', $_GET)) { 56 56 $Export = new Export($System); 57 57 $Export->Id = $_GET['version']; … … 63 63 ',$Output); 64 64 } 65 if (array_key_exists('dbc', $_GET)) {65 if (array_key_exists('dbc', $_GET)) { 66 66 $Export = new Export($System); 67 67 $Export->Id = $_GET['dbc']; … … 73 73 ',$Output); 74 74 } 75 if (array_key_exists('addon', $_GET)) {75 if (array_key_exists('addon', $_GET)) { 76 76 $Addon = new ExportAddon($System); 77 77 $Addon->Id = $_GET['addon']; … … 84 84 } 85 85 86 if (array_key_exists('needgeneration', $_GET)) {86 if (array_key_exists('needgeneration', $_GET)) { 87 87 $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` AS `Version`, '. 88 88 '`Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,'. … … 96 96 if ($Export->NeedGeneration()) { 97 97 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$Export->Id); 98 if ($DbResult->num_rows == 0)98 if ($DbResult->num_rows == 0) 99 99 { 100 100 $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())'); … … 114 114 } 115 115 116 if (array_key_exists('ExportId', $_GET)) {116 if (array_key_exists('ExportId', $_GET)) { 117 117 $Export = new Export($System); 118 118 $Export->Id = $_GET['ExportId']; -
trunk/Modules/Forum/Forum.php
r854 r880 21 21 'Permission' => LICENCE_ANONYMOUS)); 22 22 23 if (array_key_exists('Search', $this->System->ModuleManager->Modules))23 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 24 24 $this->System->ModuleManager->Modules['Search']->RegisterSearch('forum', 25 25 T('Forum'), array('UserName', 'Text'), '`ForumText`', $this->System->Link('/forum/?search=')); 26 if (array_key_exists('Search', $this->System->ModuleManager->Modules))26 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 27 27 $this->System->ModuleManager->Modules['Search']->RegisterSearch('forumthread', 28 28 T('Name of thread forum'), array('UserName', 'Text'), '`ForumThread`', … … 53 53 $DbResult = $this->Database->query($Query); 54 54 $Output .= '<table class="MiniTable"><tr><th>'.T('Date').'</th><th>'.T('User').'</th><th>'.T('Post').'</th></tr>'; 55 while ($DbRow = $DbResult->fetch_assoc())55 while ($DbRow = $DbResult->fetch_assoc()) 56 56 { 57 57 $Output .= '<tr>'. … … 62 62 } 63 63 $Output .= '</table></div>'; 64 return ($Output);64 return $Output; 65 65 } 66 66 } … … 72 72 $Output = ''; 73 73 $this->Title = T('Forum'); 74 if (array_key_exists('a', $_POST)) $Action = $_POST['a'];75 else if (array_key_exists('a', $_GET)) $Action = $_GET['a'];74 if (array_key_exists('a', $_POST)) $Action = $_POST['a']; 75 else if (array_key_exists('a', $_GET)) $Action = $_GET['a']; 76 76 else $Action = ''; 77 77 if (array_key_exists('Edit', $_GET)) { … … 86 86 if (array_key_exists('Thread', $_GET)) { 87 87 $Output .= '<h3>'.T('Forum - Thread').'</h3>'; 88 if ($Action == 'add2') $Output .= $this->AddFinish();89 if ($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddForm();88 if ($Action == 'add2') $Output .= $this->AddFinish(); 89 if ($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddForm(); 90 90 $Output .= $this->ShowList(); 91 91 } else { 92 92 $Output .= '<h3>'.T('Forum - List of Thread').'</h3>'; 93 if ($Action == 'add2') $Output .= $this->AddFinish('ForumThread');94 if ($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddFormThread();93 if ($Action == 'add2') $Output .= $this->AddFinish('ForumThread'); 94 if ($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddFormThread(); 95 95 $Output .= $this->ShowListThread(); 96 96 } 97 return ($Output);97 return $Output; 98 98 } 99 99 … … 104 104 $DbResult = $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']); 105 105 $Output .= ShowMessage(T('Text edited.')); 106 return ($Output);106 return $Output; 107 107 } 108 108 … … 110 110 { 111 111 $Output = ''; 112 if ($this->System->User->Licence(LICENCE_USER))112 if ($this->System->User->Licence(LICENCE_USER)) 113 113 { 114 114 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']); … … 118 118 '<fieldset><legend>'.T('Edit message').'</legend>'. 119 119 T('User').': '; 120 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';120 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 121 121 else $Output .= '<input type="text" name="user" /><br />'; 122 122 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'. … … 127 127 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 128 128 } else $Output .= ShowMessage(T('You can edit only your own message.'), MESSAGE_CRITICAL); 129 return ($Output);129 return $Output; 130 130 } 131 131 … … 150 150 $DbResult = $this->System->Database->query('SELECT `ForumText`.`Text`, `ForumText`.`Date`, `ForumText`.`UserName`,'. 151 151 '`ForumThread`.`Text` as `ThreadName`,`ForumText`.`Thread` FROM `ForumText` '.$join.' WHERE '.$where.' ORDER BY `ForumText`.`Date` DESC '.$PageList['SQLLimit']); 152 while ($Line = $DbResult->fetch_assoc())152 while ($Line = $DbResult->fetch_assoc()) 153 153 $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'. 154 154 htmlspecialchars($Line['ThreadName']).'</a><br /><strong>'.$Line['UserName']. 155 155 '</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse(htmlspecialchars($Line['Text'])).'</div> '; 156 156 $Output .= '</div>'.$PageList['Output']; 157 return ($Output);157 return $Output; 158 158 } 159 159 … … 169 169 $Output .= '<div class="shoutbox">'; 170 170 $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE 1 ORDER BY `ID` DESC '.$PageList['SQLLimit']); 171 while ($Line = $DbResult->fetch_assoc())171 while ($Line = $DbResult->fetch_assoc()) 172 172 $Output .= '<div><span style="float:right;"><strong>'.$Line['UserName']. 173 173 '</strong> - ('.HumanDate($Line['Date']).')</span> <a href="?Thread='.$Line['ID'].'">'. 174 174 str_replace("\n", '', htmlspecialchars($Line['Text'])).'</a></div>'; 175 175 $Output .= '</div>'.$PageList['Output']; 176 return ($Output);176 return $Output; 177 177 } 178 178 … … 183 183 $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email'))); 184 184 185 if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];186 else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';187 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';188 if ($_SESSION['search'] != '')185 if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 186 else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 187 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 188 if ($_SESSION['search'] != '') 189 189 { 190 190 $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")'; … … 193 193 194 194 $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE ID='.($_GET['Thread']*1).' LIMIT 1'); 195 if ($DbResult->num_rows > 0)195 if ($DbResult->num_rows > 0) 196 196 { 197 197 $Thread = $DbResult->fetch_assoc(); … … 206 206 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '. 207 207 ($_GET['Thread']*1).' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']); 208 while ($Line = $DbResult->fetch_assoc()) {208 while ($Line = $DbResult->fetch_assoc()) { 209 209 if ($this->System->User->Id == $Line['User']) 210 210 $edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>'; … … 216 216 $Output .= '</div>'.$PageList['Output']; 217 217 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 218 return ($Output);218 return $Output; 219 219 } 220 220 … … 222 222 { 223 223 $Output = ''; 224 if ($this->System->User->Licence(LICENCE_USER))224 if ($this->System->User->Licence(LICENCE_USER)) 225 225 { 226 226 $Output .= '<form action="?Thread='.$_GET['Thread'].'" method="post">'. 227 227 '<fieldset><legend>'.T('New Forum Message').'</legend>'. 228 228 T('User').': '; 229 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';229 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 230 230 else $Output .= '<input type="text" name="user" /><br />'; 231 231 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'. … … 235 235 '</form>'; 236 236 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 237 return ($Output);237 return $Output; 238 238 } 239 239 … … 241 241 { 242 242 $Output = ''; 243 if ($this->System->User->Licence(LICENCE_USER))243 if ($this->System->User->Licence(LICENCE_USER)) 244 244 { 245 245 $Output .= '<form action="?" method="post">'. 246 246 '<fieldset><legend>'.T('New thread').'</legend>'. 247 247 T('User').': '; 248 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';248 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 249 249 else $Output .= '<input type="text" name="user" /><br />'; 250 250 $Output .= T('Name of thread').': <br />'. … … 254 254 '</form>'; 255 255 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 256 return ($Output);256 return $Output; 257 257 } 258 258 … … 260 260 { 261 261 $Output = ''; 262 if ($this->System->User->Licence(LICENCE_USER))263 { 264 if (array_key_exists('text', $_POST))262 if ($this->System->User->Licence(LICENCE_USER)) 263 { 264 if (array_key_exists('text', $_POST)) 265 265 { 266 266 $Text = $_POST['text']; 267 if (trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING);267 if (trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING); 268 268 else 269 269 { … … 273 273 $DbResult = $this->System->Database->query('SELECT `Text` FROM `'.$Table.'` WHERE 1 '.$Thread.' AND (`User` = "'. 274 274 $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 275 if ($DbResult->num_rows > 0)275 if ($DbResult->num_rows > 0) 276 276 { 277 277 $DbRow = $DbResult->fetch_assoc(); 278 278 } else $DbRow['Text'] = ''; 279 279 280 if ($DbRow['Text'] == $Text) $Output .= ShowMessage(T('You can\' add same message twice.'), MESSAGE_WARNING);280 if ($DbRow['Text'] == $Text) $Output .= ShowMessage(T('You can\' add same message twice.'), MESSAGE_WARNING); 281 281 else 282 282 { … … 284 284 285 285 $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE ID='.($_GET['Thread']*1).' LIMIT 1'); 286 if ($DbResult->num_rows > 0)286 if ($DbResult->num_rows > 0) 287 287 { 288 288 $this->System->Database->query('INSERT INTO `'.$Table.'` ( `User`, `UserName` , `Text` , `Date` , `IP` , `Thread` ) '. … … 300 300 $Output .= '<br/>'; 301 301 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 302 return ($Output);302 return $Output; 303 303 } 304 304 … … 313 313 '`User`, `UserName`, `Text`, ( SELECT `Text` FROM `ForumThread` '. 314 314 'WHERE `ID` = `ForumText`.`Thread`) AS `ThreadText` FROM `ForumText` ORDER BY `ID` DESC LIMIT 20'); 315 while ($DbRow = $DbResult->fetch_assoc())315 while ($DbRow = $DbResult->fetch_assoc()) 316 316 { 317 317 $Title = mb_substr($DbRow['Text'], 0, $TitleLength); 318 if (mb_strlen($Title) == $TitleLength) $Title .= '...';318 if (mb_strlen($Title) == $TitleLength) $Title .= '...'; 319 319 $Items[] = array 320 320 ( … … 333 333 'Items' => $Items, 334 334 )); 335 return ($Output);335 return $Output; 336 336 } 337 337 } -
trunk/Modules/FrontPage/FrontPage.php
r854 r880 31 31 global $Message, $MessageType; 32 32 33 if (array_key_exists('action', $_GET))33 if (array_key_exists('action', $_GET)) 34 34 { 35 if ($_GET['action'] == 'login')35 if ($_GET['action'] == 'login') 36 36 { 37 if (array_key_exists('LoginUser', $_POST) and array_key_exists('LoginPass', $_POST))37 if (array_key_exists('LoginUser', $_POST) and array_key_exists('LoginPass', $_POST)) 38 38 { 39 if (array_key_exists('StayLogged', $_POST)) $StayLogged = true;39 if (array_key_exists('StayLogged', $_POST)) $StayLogged = true; 40 40 else $StayLogged = false; 41 41 $this->System->User->Login($_POST['LoginUser'], $_POST['LoginPass'], $StayLogged); 42 if ($this->System->User->Role == LICENCE_ANONYMOUS)42 if ($this->System->User->Role == LICENCE_ANONYMOUS) 43 43 { 44 44 $Message = T('Incorrect name or password'); … … 55 55 } 56 56 } else 57 if ($_GET['action'] == 'logout')57 if ($_GET['action'] == 'logout') 58 58 { 59 if ($this->System->User->Role != LICENCE_ANONYMOUS)59 if ($this->System->User->Role != LICENCE_ANONYMOUS) 60 60 { 61 61 $this->System->ModuleManager->Modules['Log']->WriteLog('Odhlášení', LOG_TYPE_USER); … … 78 78 $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm(); 79 79 $Output = ''; 80 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType);80 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType); 81 81 82 82 $Output .= ''. … … 90 90 '<div class="box-left">'.$this->System->ModuleManager->Modules['Forum']->ShowBox().'</div>'. 91 91 '<div class="box-right">'.$this->System->ModuleManager->Modules['Translation']->ShowBox().'</div>'; 92 return ($Output);92 return $Output; 93 93 } 94 94 … … 96 96 { 97 97 // Cookies have to be used before any text is sent to output 98 if (!array_key_exists('HideWelcome', $_COOKIE)) $_COOKIE['HideWelcome'] = 0;99 if (isset($_GET['Action']))98 if (!array_key_exists('HideWelcome', $_COOKIE)) $_COOKIE['HideWelcome'] = 0; 99 if (isset($_GET['Action'])) 100 100 { 101 if ($_GET['Action'] == 'HideWelcome')101 if ($_GET['Action'] == 'HideWelcome') 102 102 { 103 103 $_COOKIE['HideWelcome'] = 1; 104 104 setcookie('HideWelcome', $_COOKIE['HideWelcome'], time() + 3600 * 24 * 365); 105 105 } 106 if ($_GET['Action'] == 'UnHideWelcome')106 if ($_GET['Action'] == 'UnHideWelcome') 107 107 { 108 108 $_COOKIE['HideWelcome'] = 0; … … 111 111 } 112 112 113 if (isset($_COOKIE['HideWelcome']) and ($_COOKIE['HideWelcome'] == 1))113 if (isset($_COOKIE['HideWelcome']) and ($_COOKIE['HideWelcome'] == 1)) 114 114 { 115 115 $Action = '<a href="?Action=UnHideWelcome">'.T('Show welcome').'</a>'; … … 122 122 123 123 // Echo text even if it is hidden because of caching by external searching engines 124 return ('<div style="'.$HideWelcome.'">'.124 return '<div style="'.$HideWelcome.'">'. 125 125 '<div id="bannertitle">'.$this->System->Config['Web']['Title'].'</div>'. 126 126 T('Open web system for translation texts from game World of Warcraft (WoW).<br/>'. … … 133 133 '<li>Thanks for sophisticated system of selectable exports you can download any part of translation, even just quests. And so exclude translation of items, creatures and others.</li>'. 134 134 '<li>Texts can be translated to multiple languages, e.g. Czech and Slovak.</li>'. 135 '</ul>').'</div>'.$Action );135 '</ul>').'</div>'.$Action; 136 136 } 137 137 } -
trunk/Modules/Import/Import.php
r859 r880 49 49 $Columns = ''; 50 50 //$Values = ''; 51 foreach ($this->Group['Items'] as $GroupItem)51 foreach ($this->Group['Items'] as $GroupItem) 52 52 { 53 53 $Columns .= ', `'.$GroupItem['Column'].'` '; … … 61 61 $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'); 62 62 63 if (($DbResultMiddle->num_rows > 0) or ($DbResultBefore->num_rows > 0) or ($DbResultAfter->num_rows > 0))63 if (($DbResultMiddle->num_rows > 0) or ($DbResultBefore->num_rows > 0) or ($DbResultAfter->num_rows > 0)) 64 64 { 65 65 // Update existed text … … 68 68 $DbRowBefore = $DbResultBefore->fetch_assoc(); 69 69 70 if ($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) )70 if ($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) ) 71 71 { 72 72 $insert = false; … … 78 78 79 79 } else 80 if ($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0))80 if ($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0)) 81 81 { 82 82 $insert = false; … … 104 104 105 105 //if [DEPRECATED] do not import 106 foreach ($this->Group['Items'] as $GroupItem) {106 foreach ($this->Group['Items'] as $GroupItem) { 107 107 if (false !== strpos($Value[$GroupItem['Column']],'[DEPRECATED')) { 108 108 echo('d '.$DbRowBefore['Entry'].' '); … … 113 113 if ($insert) { 114 114 $insert = false; 115 foreach ($this->Group['Items'] as $GroupItem)115 foreach ($this->Group['Items'] as $GroupItem) 116 116 { 117 117 if ($Value[$GroupItem['Column']] <> '') $insert = true; … … 128 128 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 129 129 $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber']; 130 foreach ($this->Group['Items'] as $GroupItem)130 foreach ($this->Group['Items'] as $GroupItem) 131 131 { 132 132 $Columns .= ', `'.$GroupItem['Column'].'`'; … … 150 150 { 151 151 // Insert new text 152 if (is_numeric($Value[$this->Group['PrimaryKeyItem']])) $Value['Entry'] = $Value[$this->Group['PrimaryKeyItem']];152 if (is_numeric($Value[$this->Group['PrimaryKeyItem']])) $Value['Entry'] = $Value[$this->Group['PrimaryKeyItem']]; 153 153 else 154 154 { … … 156 156 $Value['Entry'] = 1; 157 157 $DbResult = $this->System->Database->query('SELECT MAX(`Entry`) FROM `'.$this->Group['TablePrefix'].'`'); 158 if ($DbResult->num_rows > 0)158 if ($DbResult->num_rows > 0) 159 159 { 160 160 $DbRow = $DbResult->fetch_row(); … … 165 165 $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber']; 166 166 $insert = false; 167 foreach ($this->Group['Items'] as $GroupItem)167 foreach ($this->Group['Items'] as $GroupItem) 168 168 { 169 169 $Columns .= ', `'.$GroupItem['Column'].'`'; … … 188 188 $Output = 'Načítání textů z LUA souboru...'; 189 189 190 if (($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != ''))190 if (($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != '')) 191 191 { 192 192 193 193 $Output .= '<br />'.$this->Group['Name'].'<br />'; 194 // if ($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1)194 // if ($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1) 195 195 { 196 196 $File = new FileStream(); … … 199 199 $this->NewItemCount = 0; 200 200 $Count = 0; 201 while (!$File->EOF())201 while (!$File->EOF()) 202 202 { 203 203 $Line = $File->ReadLine(); 204 if (strpos($Line, '=') !== false)204 if (strpos($Line, '=') !== false) 205 205 { 206 206 $LineParts = explode('=', $Line, 2); 207 207 $Value['ShortCut'] = trim($LineParts[0]); 208 208 $Line = trim($LineParts[1]); 209 if ($Line[0] == '"')209 if ($Line[0] == '"') 210 210 { 211 211 // Quoted string value … … 234 234 } else $Output .= ShowMessage('Není definováno jméno zdrojového souboru', MESSAGE_CRITICAL); 235 235 $Output .= ShowMessage('Dokončeno.'); 236 return ($Output);236 return $Output; 237 237 } 238 238 … … 243 243 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 244 244 $Output = '<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />'; 245 foreach ($TranslationTree as $Group)245 foreach ($TranslationTree as $Group) 246 246 { 247 247 $Output .= '<br />'.$Group['Name'].' '; 248 248 $do = true; 249 while ($do)249 while ($do) 250 250 { 251 251 $DbResult = $this->System->Database->query('SELECT `gs_tran`.`ID`, '. … … 258 258 '`gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd` OR `gs_tran`.`VersionStart` <> `gs_orig`.`VersionStart`'); 259 259 $do = ($DbResult->num_rows > 0); 260 while ($DbRow = $DbResult->fetch_assoc())260 while ($DbRow = $DbResult->fetch_assoc()) 261 261 { 262 262 echo('`'); … … 267 267 $Output .= '<strong>Dokončeno.</strong>'; 268 268 } 269 return ($Output);269 return $Output; 270 270 } 271 271 … … 273 273 { 274 274 $result = true; 275 foreach ($Group['Items'] as $GroupItem)275 foreach ($Group['Items'] as $GroupItem) 276 276 { 277 277 $old = $DbRow2[$GroupItem['Column']]; … … 324 324 } 325 325 326 if (($old == 'null') or ($old == 'NULL')) $old = '';327 if (($new == 'null') or ($new == 'NULL')) $new = '';328 329 if (($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment'))326 if (($old == 'null') or ($old == 'NULL')) $old = ''; 327 if (($new == 'null') or ($new == 'NULL')) $new = ''; 328 329 if (($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment')) 330 330 { 331 331 // echo $old.'X'.$new; … … 339 339 } 340 340 341 return ($result);341 return $result; 342 342 } 343 343 … … 348 348 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 349 349 $Output = 'Načítání textů z DBC souboru...'; 350 if (($this->Group['DBCFileName'] != '') and ($this->Group['TablePrefix'] != ''))350 if (($this->Group['DBCFileName'] != '') and ($this->Group['TablePrefix'] != '')) 351 351 { 352 352 $Output .= '<br />'.$this->Group['Name'].'<br />'; … … 357 357 $ColumnIndexes = array(); 358 358 $ColumnFormat = array(); 359 while ($DbRow = $DbResult->fetch_assoc())359 while ($DbRow = $DbResult->fetch_assoc()) 360 360 { 361 361 $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING; … … 369 369 $Count = 0; 370 370 371 for ($I = 0; $I < $ItemCount; $I++)372 { 373 foreach ($this->Group['Items'] as $GroupItem)374 if (array_key_exists($GroupItem['Id'], $ColumnIndexes))371 for ($I = 0; $I < $ItemCount; $I++) 372 { 373 foreach ($this->Group['Items'] as $GroupItem) 374 if (array_key_exists($GroupItem['Id'], $ColumnIndexes)) 375 375 { 376 376 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']])); … … 380 380 $Columns = explode(',', $this->Group['DBCIndex']); 381 381 $ColumnValue = ''; 382 foreach ($Columns as $Column)382 foreach ($Columns as $Column) 383 383 $ColumnValue .= '_'.$DBCFile->GetUint($I, $Column); 384 384 $ColumnValue = substr($ColumnValue, 1); … … 391 391 } 392 392 $Output .= '<strong>Dokončeno.</strong>'; 393 return ($Output);393 return $Output; 394 394 } 395 395 … … 400 400 $this->Group = $TranslationTree[$GroupId]; 401 401 402 if ($this->Group['SourceType'] == 'dbc') $Output = $this->ImportDBC();403 else if ($this->Group['SourceType'] == 'sql') $Output = $this->ImportSQL();404 else if ($this->Group['SourceType'] == 'lua') $Output = $this->ImportLUA();402 if ($this->Group['SourceType'] == 'dbc') $Output = $this->ImportDBC(); 403 else if ($this->Group['SourceType'] == 'sql') $Output = $this->ImportSQL(); 404 else if ($this->Group['SourceType'] == 'lua') $Output = $this->ImportLUA(); 405 405 else $Output = ShowMessage('Neznámý typ zdroje pro import', MESSAGE_CRITICAL); 406 406 $Output .= $this->UpdateTranslated(); 407 return ($Output);407 return $Output; 408 408 } 409 409 … … 420 420 $folow_structure = false; 421 421 $i = 0; 422 while ((!$File->EOF()))422 while ((!$File->EOF())) 423 423 { 424 424 $Line = $File->ReadLine(); 425 425 // Struktura 426 if (strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false)426 if (strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false) 427 427 { 428 428 $Line = ''; … … 430 430 $i = 0; 431 431 } 432 if ((strpos($Line, ';') !== false) and ($folow_structure == true))432 if ((strpos($Line, ';') !== false) and ($folow_structure == true)) 433 433 { 434 434 $folow_structure = false; … … 437 437 // echo ('<br /><br />'); 438 438 } 439 if (($folow_structure == true) and ($Line != ''))439 if (($folow_structure == true) and ($Line != '')) 440 440 { 441 441 $str = substr($Line, 0, strpos($Line, '`')); 442 442 $Line = substr($Line, strpos($Line, '`') + 1); 443 443 $Line = substr($Line, 0, strpos($Line, '`')); 444 if (strlen($str) < 3) $structure[$i] = $Line;444 if (strlen($str) < 3) $structure[$i] = $Line; 445 445 $i++; 446 446 } 447 447 448 448 //data 449 if ((strpos($Line, 'INSERT INTO `'.$this->Group['MangosTable'].'`') !== false) and (isset($structure)))449 if ((strpos($Line, 'INSERT INTO `'.$this->Group['MangosTable'].'`') !== false) and (isset($structure))) 450 450 { 451 451 while ((strpos($Line, ');') === false) or ($File->EOF())) … … 461 461 $value_buff = ''; 462 462 $Value = ''; 463 foreach ($LineParts as $LinePart)463 foreach ($LineParts as $LinePart) 464 464 { 465 465 466 466 unset($Value, $value_buff); 467 foreach ($structure as $i => $column)467 foreach ($structure as $i => $column) 468 468 { 469 469 if (substr($LinePart, 0, 1) != "'") … … 475 475 $LinePart = substr($LinePart, 1); 476 476 $value_buff = substr($LinePart, 0, strpos($LinePart, "'")); 477 while (substr($value_buff, strlen($value_buff) - 1, 1) == "\\")477 while (substr($value_buff, strlen($value_buff) - 1, 1) == "\\") 478 478 { 479 479 $str = substr($LinePart, strlen($value_buff)); … … 484 484 $LinePart = substr($LinePart, strlen($value_buff) + 2); 485 485 } 486 if (($value_buff != 'null') and ($value_buff != 'NULL'))486 if (($value_buff != 'null') and ($value_buff != 'NULL')) 487 487 { 488 488 $str = ''; 489 while (substr($value_buff, strlen($value_buff) - 1,1) == " ")489 while (substr($value_buff, strlen($value_buff) - 1,1) == " ") 490 490 { 491 491 $value_buff = substr($value_buff, 0, strlen($value_buff) - 1); … … 493 493 } 494 494 $str2 = ''; 495 while (substr($value_buff, 0, 1) == ' ')495 while (substr($value_buff, 0, 1) == ' ') 496 496 { 497 497 $value_buff = substr($value_buff, 1, strlen($value_buff) - 1); … … 505 505 // echo ($column.'-"'.$Value[$column].'"<br>'); 506 506 } 507 foreach ($this->Group['Items'] as $GroupItem)507 foreach ($this->Group['Items'] as $GroupItem) 508 508 { 509 if ($GroupItem['MangosColumn'] != '')509 if ($GroupItem['MangosColumn'] != '') 510 510 if (isset($Value[$GroupItem['MangosColumn']])) 511 511 $Value[$GroupItem['Column']] = $Value[$GroupItem['MangosColumn']]; … … 519 519 $Columns = explode(',', $this->Group['MangosTableIndex']); 520 520 $ColumnValue = ''; 521 foreach ($Columns as $Column)521 foreach ($Columns as $Column) 522 522 $ColumnValue .= '_'.$Value[$Column]; 523 523 $ColumnValue = substr($ColumnValue, 1); … … 530 530 $Output = '<br />Celkem: '.$Count.' Nových: '.$this->NewItemCount.'<br />'; 531 531 $this->UpdateLastVersion(); 532 return ($Output);532 return $Output; 533 533 } 534 534 -
trunk/Modules/Import/Manage.php
r859 r880 19 19 '<li>Po provedení importu je potřeba několikrát spustit skript na aktualizaci verze u překladu. Je potřeba ho provádět opakovaně dokud nezmizí tečky označující, že byly provedeny změny.</li>'. 20 20 '</ol>'; 21 return ($Output);21 return $Output; 22 22 } 23 23 … … 26 26 global $System; 27 27 28 if (array_key_exists('id', $_GET))28 if (array_key_exists('id', $_GET)) 29 29 { 30 30 $Output = '<div style="font-size: xx-small;">'; … … 38 38 $Output .= '</div>'; 39 39 } else $Output = ShowMessage('Nebylo zadáno id skupiny.', MESSAGE_CRITICAL); 40 return ($Output);40 return $Output; 41 41 } 42 42 … … 68 68 69 69 $DbResult = $this->System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 70 while ($Group = $DbResult->fetch_assoc())70 while ($Group = $DbResult->fetch_assoc()) 71 71 { 72 72 $Output .= '<tr><td>'.T($Group['Name']).'</td>'. 73 73 '<td>'.$Group['SourceType'].'</td><td>'; 74 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';75 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';76 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';74 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql '; 75 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc '; 76 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua '; 77 77 $Output .= '</td>'. 78 78 '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="../log/?group='.$Group['Id'].'&type=11">'.HumanDate($Group['LastImport']).'</a></td>'. … … 82 82 } 83 83 $Output .= '</table>'; 84 return ($Output);84 return $Output; 85 85 } 86 86 … … 93 93 $Output .= $Import->UpdateTranslated(); 94 94 $Output .= '</div>'; 95 return ($Output);95 return $Output; 96 96 } 97 97 … … 100 100 $this->Title = T('Import'); 101 101 $Output = ''; 102 if ($this->System->User->Licence(LICENCE_ADMIN))102 if ($this->System->User->Licence(LICENCE_ADMIN)) 103 103 { 104 if (array_key_exists('action', $_GET))104 if (array_key_exists('action', $_GET)) 105 105 { 106 if ($_GET['action'] == 'instructions') $Output .= $this->ShowInstructions();107 else if ($_GET['action'] == 'importgroup') $Output .= $this->ShowImportGroup();108 else if ($_GET['action'] == 'update_translated') $Output .= $this->UpdateTranslated();106 if ($_GET['action'] == 'instructions') $Output .= $this->ShowInstructions(); 107 else if ($_GET['action'] == 'importgroup') $Output .= $this->ShowImportGroup(); 108 else if ($_GET['action'] == 'update_translated') $Output .= $this->UpdateTranslated(); 109 109 else $Output .= $this->ShowMenu(); 110 110 } else $Output .= $this->ShowMenu(); 111 111 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 112 return ($Output);112 return $Output; 113 113 } 114 114 } -
trunk/Modules/Import/cmd.php
r859 r880 13 13 $Output = ''; 14 14 15 if (defined('STDIN') == false)15 if (defined('STDIN') == false) 16 16 { 17 17 $Output = T('Access denied'); … … 19 19 } 20 20 21 foreach ($_SERVER['argv'] as $parameter)21 foreach ($_SERVER['argv'] as $parameter) 22 22 { 23 if (strpos($parameter, '=') !== false)23 if (strpos($parameter, '=') !== false) 24 24 { 25 25 $index = substr($parameter, 0, strpos($parameter, '=')); … … 30 30 } 31 31 32 if (!array_key_exists('id', $_GET))32 if (!array_key_exists('id', $_GET)) 33 33 { 34 34 $Output .= ' … … 49 49 $Output .= ' version=<version> - nastaví verzi importu default: '.$System->Config['Web']['GameVersion'].'<br /><br />'; 50 50 $Output .= ' <id_import_group>:'; 51 foreach ($TranslationTree as $Group)51 foreach ($TranslationTree as $Group) 52 52 { 53 53 $Output .= '<br /> '.$Group['Id'].' '; -
trunk/Modules/Import/generatecodeXML.php
r815 r880 30 30 31 31 $files = scandir($verze); 32 foreach ($files as $file)32 foreach ($files as $file) 33 33 { 34 34 $end = substr($file, strlen($file) - 3); 35 if ($end == 'xml')35 if ($end == 'xml') 36 36 { 37 37 echo('<br />--'.$file.'<br /><br />'); -
trunk/Modules/Info/Info.php
r864 r880 69 69 '</ul><br />'. 70 70 '<br />'; 71 return ($Output);71 return $Output; 72 72 } 73 73 } … … 94 94 '<iframe width="420" height="315" src="https://www.youtube.com/embed/6EhBFv59syk" frameborder="0" allowfullscreen></iframe><br/>'. 95 95 '<img src="'.$this->System->Link('/images/promotion.bmp').'" width="800" alt="addon-obr">'; 96 return ($Output);96 return $Output; 97 97 } 98 98 } -
trunk/Modules/Log/Log.php
r861 r880 33 33 function WriteLog($Text, $Type) 34 34 { 35 if (isset($this->System->User) and !is_null($this->System->User->Id))35 if (isset($this->System->User) and !is_null($this->System->User->Id)) 36 36 $UserId = $this->System->User->Id; 37 37 else $UserId = 'NULL'; … … 60 60 global $System, $User; 61 61 62 if (isset($User) and !is_null($User->Id)) $UserId = $User->Id;62 if (isset($User) and !is_null($User->Id)) $UserId = $User->Id; 63 63 else $UserId = 'NULL'; 64 64 $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP`, `URL` ) '. … … 75 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 if ($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']);87 if ($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']); 88 88 $Line['Text'] = str_replace("\n", '<br>', $Line['Text']); 89 89 … … 106 106 'Items' => $Items, 107 107 )); 108 return ($Output);108 return $Output; 109 109 } 110 110 111 111 function Show() 112 112 { 113 if (array_key_exists('a', $_POST)) $Action = $_POST['a'];114 else if (array_key_exists('a', $_GET)) $Action = $_GET['a'];113 if (array_key_exists('a', $_POST)) $Action = $_POST['a']; 114 else if (array_key_exists('a', $_GET)) $Action = $_GET['a']; 115 115 else $Action = ''; 116 if ($Action == 'delerrlog') $Output = $this->DeleteErrorLog();116 if ($Action == 'delerrlog') $Output = $this->DeleteErrorLog(); 117 117 else $Output = $this->ShowList(); 118 return ($Output);118 return $Output; 119 119 } 120 120 … … 125 125 $this->Title = T('System log'); 126 126 $Output = ''; 127 if (array_key_exists('type', $_GET)) $_SESSION['type'] = $_GET['type'] * 1;128 else if (!array_key_exists('type', $_SESSION)) $_SESSION['type'] = '';129 130 if (array_key_exists('group', $_GET)) $_SESSION['group'] = $_GET['group'];131 132 if ($_SESSION['type'] != '') $WhereType = ' (`Type`='.$_SESSION['type'].')';127 if (array_key_exists('type', $_GET)) $_SESSION['type'] = $_GET['type'] * 1; 128 else if (!array_key_exists('type', $_SESSION)) $_SESSION['type'] = ''; 129 130 if (array_key_exists('group', $_GET)) $_SESSION['group'] = $_GET['group']; 131 132 if ($_SESSION['type'] != '') $WhereType = ' (`Type`='.$_SESSION['type'].')'; 133 133 else $WhereType = '1=1'; 134 134 … … 138 138 139 139 // Show category filter 140 if ($this->System->User->Licence(LICENCE_MODERATOR))140 if ($this->System->User->Licence(LICENCE_MODERATOR)) 141 141 { 142 142 $Output = '<strong>'.T('Filter').':</strong>'; 143 143 $Item = '<a href="'.$this->System->Link('/log/?type=').'" title="Bez filtrování">'.T('All').'</a>'; 144 if ($_SESSION['type'] == '') $Item = '<strong>'.$Item.'</strong>';144 if ($_SESSION['type'] == '') $Item = '<strong>'.$Item.'</strong>'; 145 145 $Output .= ' '.$Item; 146 146 $DbResult = $this->System->Database->query('SELECT * FROM `LogType`'); 147 while ($LogType = $DbResult->fetch_assoc())147 while ($LogType = $DbResult->fetch_assoc()) 148 148 { 149 149 $Item = '<a href="'.$this->System->Link('/log/?type='.$LogType['Id']).'" style="color:'. 150 150 $LogType['Color'].'" title="'.$LogType['Name'].'">'.T($LogType['Name']).'</a>'; 151 if ($_SESSION['type'] == $LogType['Id']) $Item = '<strong>'.$Item.'</strong>';151 if ($_SESSION['type'] == $LogType['Id']) $Item = '<strong>'.$Item.'</strong>'; 152 152 $Output .= ' '.$Item; 153 153 } … … 155 155 $Output .= '<br /><br />'; 156 156 157 if (array_key_exists('type', $_SESSION)) $Where = ' WHERE '.$WhereType;157 if (array_key_exists('type', $_SESSION)) $Where = ' WHERE '.$WhereType; 158 158 else 159 159 { 160 if (array_key_exists('group', $_SESSION)) $Where = ' WHERE `Text` LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';160 if (array_key_exists('group', $_SESSION)) $Where = ' WHERE `Text` LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"'; 161 161 else $Where = ''; 162 162 } 163 //if (($Where != '') and (array_key_exists('group', $_SESSION))) $Where .= ' AND text LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';163 //if (($Where != '') and (array_key_exists('group', $_SESSION))) $Where .= ' AND text LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"'; 164 164 165 165 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Log` '.$Where); … … 172 172 array('Name' => 'Date', 'Title' => T('Time')), 173 173 ); 174 if ($_SESSION['type'] == '') $TableColumns[] =174 if ($_SESSION['type'] == '') $TableColumns[] = 175 175 array('Name' => 'LogName', 'Title' => T('Type')); 176 176 $TableColumns = array_merge($TableColumns, array( … … 187 187 '(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']; 188 188 $DbResult = $this->System->Database->query($sql); 189 while ($Line = $DbResult->fetch_assoc())190 { 191 if ($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']);189 while ($Line = $DbResult->fetch_assoc()) 190 { 191 if ($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']); 192 192 $Line['Text'] = str_replace("\n", '<br/>', $Line['Text']); 193 193 $Output .= '<tr><td>'.$Line['Date'].'</td>'; 194 if ($_SESSION['type'] == '') $Output .= '<td>'.T($Line['LogName']).'</td>';194 if ($_SESSION['type'] == '') $Output .= '<td>'.T($Line['LogName']).'</td>'; 195 195 $Output .= '<td><span style="color: '.$Line['LogColor'].'">'.$Line['Text'].'</span></td>'. 196 196 '<td><a href="'.$this->System->Link('/user/?user='.$Line['User']).'">'.$Line['UserName'].'</a></td>'. … … 200 200 $Output .= '</table>'. 201 201 $PageList['Output']; 202 if ($this->System->User->Licence(LICENCE_ADMIN))202 if ($this->System->User->Licence(LICENCE_ADMIN)) 203 203 { 204 204 $Output .= '<div>'.T('Remove').': <a href="'.$this->System->Link('/log/?a=delerrlog&type='.LOG_TYPE_ERROR).'">'.T('Error logs').'</a> '. … … 207 207 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 208 208 209 return ($Output);209 return $Output; 210 210 } 211 211 212 212 function DeleteErrorLog() 213 213 { 214 if ($this->System->User->Licence(LICENCE_ADMIN) and214 if ($this->System->User->Licence(LICENCE_ADMIN) and 215 215 (($_GET['type'] == LOG_TYPE_ERROR) or ($_GET['type'] == LOG_TYPE_PAGE_NOT_FOUND))) 216 216 { … … 223 223 $Output = ShowMessage('Smazáno všech '.$DbRow[0].' záznamů z '.$LogType['Description'].'.'); 224 224 $Output .= $this->ShowList(); 225 return ($Output);225 return $Output; 226 226 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 227 227 } -
trunk/Modules/News/News.php
r862 r880 35 35 $DbResult = $this->Database->query('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text`,`News`.`Title`, `News`.`Id` '. 36 36 ' FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT '.$Count); 37 while ($DbRow = $DbResult->fetch_assoc())37 while ($DbRow = $DbResult->fetch_assoc()) 38 38 { 39 39 $Output .= '<h4><a href="'.$this->System->Link('/news/?a=item&i='.$DbRow['Id']).'">'.$DbRow['Title'].'</a> ('.HumanDate($DbRow['Time']).')</h4>'. … … 41 41 } 42 42 $Output .= '</div></div>'; 43 return ($Output);43 return $Output; 44 44 } 45 45 … … 48 48 $this->RSSChannels[$Channel['Channel']] = $Channel; 49 49 50 if (is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel'];50 if (is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel']; 51 51 else { 52 52 array_splice($this->RSSChannelsPos, $Pos, 0, $Channel['Channel']); … … 57 57 { 58 58 $Output = ''; 59 foreach ($this->RSSChannels as $Channel)59 foreach ($this->RSSChannels as $Channel) 60 60 { 61 if ($this->System->User->Licence($Channel['Permission']))61 if ($this->System->User->Licence($Channel['Permission'])) 62 62 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 63 63 $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 64 64 } 65 return ($Output);65 return $Output; 66 66 } 67 67 } … … 72 72 { 73 73 $this->Title = T('News'); 74 if (array_key_exists('a', $_POST)) $Action = $_POST['a'];75 else if (array_key_exists('a', $_GET)) $Action = $_GET['a'];74 if (array_key_exists('a', $_POST)) $Action = $_POST['a']; 75 else if (array_key_exists('a', $_GET)) $Action = $_GET['a']; 76 76 else $Action = ''; 77 if ($Action == 'add2') $Output = $this->SaveNew();78 else if ($Action == 'add') $Output = $this->ShowAddForm();79 else if ($Action == 'item') $Output = $this->ShowItem();77 if ($Action == 'add2') $Output = $this->SaveNew(); 78 else if ($Action == 'add') $Output = $this->ShowAddForm(); 79 else if ($Action == 'item') $Output = $this->ShowItem(); 80 80 else $Output = $this->ShowList(); 81 return ($Output);81 return $Output; 82 82 } 83 83 … … 89 89 90 90 $Output = '<h3>'.T('News').'</h3>'; 91 if ($this->System->User->Licence(LICENCE_ADMIN))91 if ($this->System->User->Licence(LICENCE_ADMIN)) 92 92 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 93 93 $Output .= $PageList['Output']; … … 95 95 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, `News`.`Id`, '. 96 96 '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` ORDER BY `News`.`Time` DESC '.$PageList['SQLLimit']); 97 while ($Line = $DbResult->fetch_assoc())97 while ($Line = $DbResult->fetch_assoc()) 98 98 { 99 99 $Output .= '<h4><a href="?a=item&i='.$Line['Id'].'">'.$Line['Title'].'</a> ('.HumanDate($Line['Time']).')</h4><div>'.$Line['Text'].' ('.$Line['User'].')</div>'; 100 100 } 101 101 $Output .= '</div>'.$PageList['Output']; 102 return ($Output);102 return $Output; 103 103 } 104 104 105 105 function ShowItem() 106 106 { 107 if (array_key_exists('i', $_GET))107 if (array_key_exists('i', $_GET)) 108 108 { 109 109 $Output = '<h3>'.T('News').'</h3>'; 110 110 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, `News`.`Id`, '. 111 111 '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` WHERE `News`.`Id` = '.($_GET['i'] * 1)); 112 if ($DbResult->num_rows == 1)112 if ($DbResult->num_rows == 1) 113 113 { 114 114 $Line = $DbResult->fetch_assoc(); … … 117 117 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 118 118 $Output .= '<br/><a href="'.$this->System->Link('/news/').'">'.T('All news').'</a>'; 119 return ($Output);119 return $Output; 120 120 } 121 121 122 122 function ShowAddForm() 123 123 { 124 if ($this->System->User->Licence(LICENCE_ADMIN))124 if ($this->System->User->Licence(LICENCE_ADMIN)) 125 125 { 126 126 $Output = '<form action="?" method="POST">'. … … 134 134 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 135 135 $Output .= $this->ShowList(); 136 return ($Output);136 return $Output; 137 137 } 138 138 139 139 function SaveNew() 140 140 { 141 if ($this->System->User->Licence(LICENCE_ADMIN))141 if ($this->System->User->Licence(LICENCE_ADMIN)) 142 142 { 143 if (array_key_exists('text', $_POST) and array_key_exists('title', $_POST))143 if (array_key_exists('text', $_POST) and array_key_exists('title', $_POST)) 144 144 { 145 145 $querty = 'INSERT INTO `News` (`Title`, `Time` ,`User` ,`Text`) VALUES ( "'.$_POST['title'].'", NOW( ) , '. … … 151 151 } else $Output = ShowMessage(T('Data not specified'), MESSAGE_CRITICAL); 152 152 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 153 return ($Output);153 return $Output; 154 154 } 155 155 … … 160 160 '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text`, `News`.`Id` '. 161 161 'FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10'); 162 while ($DbRow = $DbResult->fetch_assoc())162 while ($DbRow = $DbResult->fetch_assoc()) 163 163 { 164 164 $Items[] = array … … 178 178 'Items' => $Items, 179 179 )); 180 return ($Output);180 return $Output; 181 181 } 182 182 } -
trunk/Modules/News/RSS.php
r876 r880 15 15 " <pubDate>".date('r')."</pubDate>\n". 16 16 " <ttl>20</ttl>\n"; 17 foreach ($Data['Items'] as $Item)17 foreach ($Data['Items'] as $Item) 18 18 { 19 19 $Result .= " <item>\n". … … 26 26 $Result .= " </channel>\n". 27 27 "</rss>"; 28 return ($Result);28 return $Result; 29 29 } 30 30 … … 35 35 $this->RawPage = true; 36 36 37 if (array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];37 if (array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel']; 38 38 else $ChannelName = ''; 39 if (array_key_exists('token', $_GET)) $Token = $_GET['token'];39 if (array_key_exists('token', $_GET)) $Token = $_GET['token']; 40 40 else $Token = ''; 41 if (array_key_exists($ChannelName, $this->System->ModuleManager->Modules['News']->RSSChannels))41 if (array_key_exists($ChannelName, $this->System->ModuleManager->Modules['News']->RSSChannels)) 42 42 { 43 43 $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName]; 44 if ($this->System->User->Licence($Channel['Permission']) or44 if ($this->System->User->Licence($Channel['Permission']) or 45 45 $this->System->User->CheckToken($Channel['Permission'], $Token)) 46 46 { 47 if (is_string($Channel['Callback'][0]))47 if (is_string($Channel['Callback'][0])) 48 48 { 49 49 $Class = new $Channel['Callback'][0]($this->System); … … 53 53 } else $Output = T('Access denied'); 54 54 } else $Output = 'Nezadán žádný kanál'; 55 return ($Output);55 return $Output; 56 56 } 57 57 } -
trunk/Modules/Redirection/Redirection.php
r861 r880 24 24 Header($_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently'); 25 25 Header('Location: '.$Location); 26 return ('<h3 align="center">'.T('').'</h3>');26 return '<h3 align="center">'.T('').'</h3>'; 27 27 } 28 28 … … 30 30 { 31 31 $Output = ''; 32 if (count($this->System->PathItems) > 0)32 if (count($this->System->PathItems) > 0) 33 33 { 34 if ($this->System->PathItems[0] == 'user.php') $Output = $this->Redirect($this->System->Link('/user/'));35 if ($this->System->PathItems[0] == 'team.php') $Output = $this->Redirect($this->System->Link('/team/'));36 if ($this->System->PathItems[0] == 'version.php') $Output = $this->Redirect($this->System->Link('/client-version/'));37 if ($this->System->PathItems[0] == 'phpBB3') $Output = $this->Redirect($this->System->Link('/forum/'));38 if ($this->System->PathItems[0] == 'phpbb3') $Output = $this->Redirect($this->System->Link('/forum/'));39 if ($this->System->PathItems[0] == 'statistic.php') $Output = $this->Redirect($this->System->Link('/progress/'));40 if ($this->System->PathItems[0] == 'register.php') $Output = $this->Redirect($this->System->Link('/registration/'));41 if ($this->System->PathItems[0] == 'registrace.php') $Output = $this->Redirect($this->System->Link('/registration/'));42 if ($this->System->PathItems[0] == 'dictionary.php') $Output = $this->Redirect($this->System->Link('/dictionary/'));43 if ($this->System->PathItems[0] == 'download-addon.php') $Output = $this->Redirect($this->System->Link('/download/'));44 if ($this->System->PathItems[0] == 'banners.php') $Output = $this->Redirect($this->System->Link('/referrer/'));45 if ($this->System->PathItems[0] == 'download.php') $Output = $this->Redirect($this->System->Link('/download/'));46 if ($this->System->PathItems[0] == 'serverlist.php') $Output = $this->Redirect($this->System->Link('/server/'));47 if ($this->System->PathItems[0] == 'info.php') $Output = $this->Redirect($this->System->Link('/info/'));48 if ($this->System->PathItems[0] == 'userlist.php') $Output = $this->Redirect($this->System->Link('/users/'));49 if ($this->System->PathItems[0] == 'promotion.php') $Output = $this->Redirect($this->System->Link('/promotion/'));50 if ($this->System->PathItems[0] == 'log.php') $Output = $this->Redirect($this->System->Link('/log/'));51 if (count($this->System->PathItems) > 1)34 if ($this->System->PathItems[0] == 'user.php') $Output = $this->Redirect($this->System->Link('/user/')); 35 if ($this->System->PathItems[0] == 'team.php') $Output = $this->Redirect($this->System->Link('/team/')); 36 if ($this->System->PathItems[0] == 'version.php') $Output = $this->Redirect($this->System->Link('/client-version/')); 37 if ($this->System->PathItems[0] == 'phpBB3') $Output = $this->Redirect($this->System->Link('/forum/')); 38 if ($this->System->PathItems[0] == 'phpbb3') $Output = $this->Redirect($this->System->Link('/forum/')); 39 if ($this->System->PathItems[0] == 'statistic.php') $Output = $this->Redirect($this->System->Link('/progress/')); 40 if ($this->System->PathItems[0] == 'register.php') $Output = $this->Redirect($this->System->Link('/registration/')); 41 if ($this->System->PathItems[0] == 'registrace.php') $Output = $this->Redirect($this->System->Link('/registration/')); 42 if ($this->System->PathItems[0] == 'dictionary.php') $Output = $this->Redirect($this->System->Link('/dictionary/')); 43 if ($this->System->PathItems[0] == 'download-addon.php') $Output = $this->Redirect($this->System->Link('/download/')); 44 if ($this->System->PathItems[0] == 'banners.php') $Output = $this->Redirect($this->System->Link('/referrer/')); 45 if ($this->System->PathItems[0] == 'download.php') $Output = $this->Redirect($this->System->Link('/download/')); 46 if ($this->System->PathItems[0] == 'serverlist.php') $Output = $this->Redirect($this->System->Link('/server/')); 47 if ($this->System->PathItems[0] == 'info.php') $Output = $this->Redirect($this->System->Link('/info/')); 48 if ($this->System->PathItems[0] == 'userlist.php') $Output = $this->Redirect($this->System->Link('/users/')); 49 if ($this->System->PathItems[0] == 'promotion.php') $Output = $this->Redirect($this->System->Link('/promotion/')); 50 if ($this->System->PathItems[0] == 'log.php') $Output = $this->Redirect($this->System->Link('/log/')); 51 if (count($this->System->PathItems) > 1) 52 52 { 53 if (($this->System->PathItems[0] == 'team') and ($this->System->PathItems[1] == 'userlist.php'))53 if (($this->System->PathItems[0] == 'team') and ($this->System->PathItems[1] == 'userlist.php')) 54 54 $Output = $this->Redirect($this->System->Link('/userlist/')); 55 if (($this->System->PathItems[0] == 'dictionary') and ($this->System->PathItems[1] == 'user.php'))55 if (($this->System->PathItems[0] == 'dictionary') and ($this->System->PathItems[1] == 'user.php')) 56 56 $Output = $this->Redirect($this->System->Link('/user/')); 57 if (($this->System->PathItems[0] == 'forum') and ($this->System->PathItems[1] == 'index.php'))57 if (($this->System->PathItems[0] == 'forum') and ($this->System->PathItems[1] == 'index.php')) 58 58 $Output = $this->Redirect($this->System->Link('/forum/')); 59 if (($this->System->PathItems[0] == 'phpbb3') and ($this->System->PathItems[1] == 'index.php'))59 if (($this->System->PathItems[0] == 'phpbb3') and ($this->System->PathItems[1] == 'index.php')) 60 60 $Output = $this->Redirect($this->System->Link('/forum/')); 61 if (($this->System->PathItems[0] == 'phpBB3') and ($this->System->PathItems[1] == 'index.php'))61 if (($this->System->PathItems[0] == 'phpBB3') and ($this->System->PathItems[1] == 'index.php')) 62 62 $Output = $this->Redirect($this->System->Link('/forum/')); 63 if (($this->System->PathItems[0] == 'download') and ($this->System->PathItems[1] == 'ceske_fonty_do_wow.zip'))63 if (($this->System->PathItems[0] == 'download') and ($this->System->PathItems[1] == 'ceske_fonty_do_wow.zip')) 64 64 $Output = $this->Redirect($this->System->Link('/files/ceske_fonty_do_wow.zip')); 65 65 } 66 66 } 67 return ($Output);67 return $Output; 68 68 } 69 69 } -
trunk/Modules/Referrer/Referrer.php
r860 r880 34 34 function Log() 35 35 { 36 if (array_key_exists('HTTP_REFERER', $_SERVER))36 if (array_key_exists('HTTP_REFERER', $_SERVER)) 37 37 { 38 38 $Referrer = addslashes($_SERVER['HTTP_REFERER']); 39 39 $HostName = substr($Referrer, strpos($Referrer, '/') + 2); 40 40 $HostName = substr($HostName, 0, strpos($HostName, '/')); 41 if (!in_array($HostName, $this->Excludes))41 if (!in_array($HostName, $this->Excludes)) 42 42 { 43 43 $IP = GetRemoteAddress(); … … 46 46 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `BlackList` WHERE `IP` = "'.$IP.'"'); 47 47 $DbRow = $DbResult->fetch_row(); 48 if ($DbRow[0] == 0)48 if ($DbRow[0] == 0) 49 49 { 50 50 $Visible = '1'; … … 58 58 // Check if host name is already stored and need just to update hit counter 59 59 $DbResult = $this->System->Database->query('SELECT `Id` FROM `Referrer` WHERE `Web` = "'.$HostName.'"'); 60 if ($DbResult->num_rows > 0)60 if ($DbResult->num_rows > 0) 61 61 { 62 62 $DbRow = $DbResult->fetch_assoc(); … … 92 92 $Output .= $BannerSmall.' <textarea rows="2" cols="30">'.htmlspecialchars($BannerSmall).'</textarea><br />'; 93 93 94 if ($this->System->User->Licence(LICENCE_ADMIN)) {94 if ($this->System->User->Licence(LICENCE_ADMIN)) { 95 95 96 96 $MonthAge = 3; … … 99 99 <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 />'; 100 100 101 if (!$this->System->User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Visible`=1) AND (`Parent` IS NULL)';101 if (!$this->System->User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Visible`=1) AND (`Parent` IS NULL)'; 102 102 else $Where = ''; 103 103 $Query = 'SELECT *, (SELECT Web FROM `Referrer` AS T4 WHERE T4.Id = T3.Parent) AS ParentName '. … … 123 123 array('Name' => 'TotalHits', 'Title' => T('Hits')), 124 124 ); 125 if ($this->System->User->Licence(LICENCE_ADMIN))125 if ($this->System->User->Licence(LICENCE_ADMIN)) 126 126 { 127 127 $TableColumns[] = array('Name' => 'Visible', 'Title' => T('Visible')); … … 137 137 138 138 $DbResult = $this->Database->query($Query); 139 while ($Line = $DbResult->fetch_assoc())139 while ($Line = $DbResult->fetch_assoc()) 140 140 { 141 141 $Output .= '<tr><td><a href="'.$Line['LastURL'].'">'.$Line['Web'].'</a></td>'. 142 142 '<td>'.HumanDate($Line['MaxDateLast']).'</td>'. 143 143 '<td>'.$Line['TotalHits'].'</td>'; 144 if ($this->System->User->Licence(LICENCE_ADMIN))144 if ($this->System->User->Licence(LICENCE_ADMIN)) 145 145 { 146 146 $Output .= … … 158 158 159 159 } 160 return ($Output);160 return $Output; 161 161 } 162 162 … … 165 165 $Output = '<select name="Parent">'; 166 166 $Output .= '<option value=""'; 167 if ($Selected == '')167 if ($Selected == '') 168 168 $Output .= ' selected="selected"'; 169 169 $Output .= '></option>'; 170 170 $DbResult = $this->Database->select('Referrer', '`Id`, `Web`', '`Parent` IS NULL ORDER BY `Web`'); 171 while ($Language = $DbResult->fetch_assoc())172 if ($Language['Id'] != $Self)171 while ($Language = $DbResult->fetch_assoc()) 172 if ($Language['Id'] != $Self) 173 173 { 174 174 $Output .= '<option value="'.$Language['Id'].'"'; 175 if ($Selected == $Language['Id'])175 if ($Selected == $Language['Id']) 176 176 $Output .= ' selected="selected"'; 177 177 $Output .= '>'.$Language['Web'].'</option>'; 178 178 } 179 179 $Output .= '</select>'; 180 return ($Output);180 return $Output; 181 181 } 182 182 183 183 function Spam() 184 184 { 185 if ($this->System->User->Licence(LICENCE_ADMIN))186 { 187 if (array_key_exists('id', $_GET))185 if ($this->System->User->Licence(LICENCE_ADMIN)) 186 { 187 if (array_key_exists('id', $_GET)) 188 188 { 189 189 $DbResult = $this->Database->select('Referrer', '*', 'Id='.$_GET['id']); 190 if ($DbResult->num_rows > 0)190 if ($DbResult->num_rows > 0) 191 191 { 192 192 $Item = $DbResult->fetch_assoc(); 193 193 $this->Database->update('Referrer', 'Id='.$_GET['id'], array('Visible' => 0, 'Description' => 'Spam')); 194 194 $DbResult2 = $this->Database->select('BlackList', '*', 'IP="'.$Item['LastIP'].'"'); 195 if ($DbResult2->num_rows == 0)195 if ($DbResult2->num_rows == 0) 196 196 { 197 197 $this->Database->insert('BlackList', array('Time' => 'NOW()', 'IP' => $Item['LastIP'])); … … 202 202 } else $Output = ShowMessage(T('Item not specified'), MESSAGE_CRITICAL); 203 203 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 204 return ($Output);204 return $Output; 205 205 } 206 206 207 207 function Edit() 208 208 { 209 if ($this->System->User->Licence(LICENCE_ADMIN))210 { 211 if (array_key_exists('id', $_GET))209 if ($this->System->User->Licence(LICENCE_ADMIN)) 210 { 211 if (array_key_exists('id', $_GET)) 212 212 { 213 213 $DbResult = $this->Database->select('Referrer', '*', 'Id='.$_GET['id']); 214 if ($DbResult->num_rows > 0)214 if ($DbResult->num_rows > 0) 215 215 { 216 216 $Item = $DbResult->fetch_assoc(); 217 if ($Item['Visible'] == 1) $Visible = ' checked ';217 if ($Item['Visible'] == 1) $Visible = ' checked '; 218 218 else $Visible = ''; 219 219 $Output = '<form action="?action=editsave&id='.$_GET['id'].'" method="post"><table>'. … … 227 227 } else $Output = ShowMessage(T('Item not specified'), MESSAGE_CRITICAL); 228 228 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 229 return ($Output);229 return $Output; 230 230 } 231 231 232 232 function EditSave() 233 233 { 234 if ($this->System->User->Licence(LICENCE_ADMIN))235 { 236 if ($_POST['Parent'] == '') $_POST['Parent'] = null;234 if ($this->System->User->Licence(LICENCE_ADMIN)) 235 { 236 if ($_POST['Parent'] == '') $_POST['Parent'] = null; 237 237 $_POST['Visible'] = array_key_exists('Visible', $_POST); 238 238 $DbResult = $this->Database->update('Referrer', 'Id='.$_GET['id'], array( … … 243 243 $Output .= $this->ShowList(); 244 244 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 245 return ($Output);245 return $Output; 246 246 } 247 247 … … 249 249 { 250 250 $this->Title = T('Promotion'); 251 if (array_key_exists('action', $_GET))252 { 253 if ($_GET['action'] == 'edit') $Output = $this->Edit();254 else if ($_GET['action'] == 'spam') $Output = $this->Spam();255 else if ($_GET['action'] == 'editsave') $Output = $this->EditSave();251 if (array_key_exists('action', $_GET)) 252 { 253 if ($_GET['action'] == 'edit') $Output = $this->Edit(); 254 else if ($_GET['action'] == 'spam') $Output = $this->Spam(); 255 else if ($_GET['action'] == 'editsave') $Output = $this->EditSave(); 256 256 else $Output = $this->ShowList(); 257 257 } else $Output = $this->ShowList(); 258 return ($Output);258 return $Output; 259 259 } 260 260 } -
trunk/Modules/Search/Search.php
r861 r880 48 48 '</table></div>'. 49 49 '</form>'; 50 return ($Output);50 return $Output; 51 51 } 52 52 } … … 57 57 { 58 58 $this->Title = T('Search'); 59 if (array_key_exists('text', $_GET)) $Search = $_GET['text'];60 else if (array_key_exists('text', $_POST)) $Search = $_POST['text'];59 if (array_key_exists('text', $_GET)) $Search = $_GET['text']; 60 else if (array_key_exists('text', $_POST)) $Search = $_POST['text']; 61 61 else $Search = ''; 62 62 $SearchHTML = urlencode($Search); 63 63 64 64 $Output = '<table class="BaseTable"><tr><th>'.T('Section').'</th><th>'.T('Found count').'</th></tr>'; 65 foreach ($this->System->ModuleManager->Modules['Search']->SearchItems as $SearchItem)65 foreach ($this->System->ModuleManager->Modules['Search']->SearchItems as $SearchItem) 66 66 { 67 67 $ColumnQuery = array(); 68 foreach ($SearchItem['Columns'] as $Column)68 foreach ($SearchItem['Columns'] as $Column) 69 69 { 70 70 $ColumnQuery[] = '(`'.$Column.'` LIKE "%'.$Search.'%")'; 71 71 } 72 72 $ColumnQuery = implode(' OR ', $ColumnQuery); 73 if ($SearchItem['Query'] != '')73 if ($SearchItem['Query'] != '') 74 74 { 75 75 $DbResult = $this->Database->query('SELECT COUNT(*) FROM '.$SearchItem['Query'].' WHERE '.$ColumnQuery); … … 82 82 83 83 $Output .= '</table>'; 84 return ($Output);84 return $Output; 85 85 } 86 86 } -
trunk/Modules/Server/Server.php
r838 r880 57 57 $Output .= '<h3>'.T('Translated server list').'</h3>'; 58 58 $Output .= parent::ViewList(); 59 return ($Output);59 return $Output; 60 60 } 61 61 } -
trunk/Modules/ShoutBox/ShoutBox.php
r857 r880 20 20 'Title' => T('Shoutbox'), 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'), 21 21 'Permission' => LICENCE_ANONYMOUS)); 22 if (array_key_exists('Search', $this->System->ModuleManager->Modules))22 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 23 23 $this->System->ModuleManager->Modules['Search']->RegisterSearch('shoutbox', 24 24 T('Shoutbox'), array('UserName', 'Text'), '`ShoutBox`', $this->System->Link('/shoutbox/?search=')); … … 29 29 $Output = '<strong><a href="'.$this->System->Link('/shoutbox/').'">'.T('Shoutbox').':</a></strong>'; 30 30 31 if ($this->System->User->Licence(LICENCE_USER))31 if ($this->System->User->Licence(LICENCE_USER)) 32 32 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 33 33 $Output .= '<div class="box"><div class="shoutbox"><table>'; 34 34 $DbResult = $this->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30'); 35 while ($Line = $DbResult->fetch_assoc())35 while ($Line = $DbResult->fetch_assoc()) 36 36 $Output .= '<tr><td><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</td></tr>'; 37 37 $Output .= '</table></div></div>'; 38 return ($Output);38 return $Output; 39 39 } 40 40 } … … 45 45 { 46 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'];47 if (array_key_exists('a', $_POST)) $Action = $_POST['a']; 48 else if (array_key_exists('a', $_GET)) $Action = $_GET['a']; 49 49 else $Action = ''; 50 if ($Action == 'add2') $Output = $this->AddFinish();51 if ($Action == 'add') $Output = $this->ShowAddForm();50 if ($Action == 'add2') $Output = $this->AddFinish(); 51 if ($Action == 'add') $Output = $this->ShowAddForm(); 52 52 else $Output = $this->ShowList(); 53 return ($Output);53 return $Output; 54 54 } 55 55 … … 57 57 { 58 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'] != '')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 63 { 64 64 $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")'; … … 71 71 72 72 $Output .= '<h3>'.T('Shoutbox').'</h3>'; 73 if ($this->System->User->Licence(LICENCE_USER))73 if ($this->System->User->Licence(LICENCE_USER)) 74 74 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 75 75 $Output .= $PageList['Output']; 76 76 $Output .= '<div class="shoutbox">'; 77 77 $DbResult = $this->System->Database->query('SELECT * FROM `ShoutBox` WHERE 1'.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']); 78 while ($Line = $DbResult->fetch_assoc())78 while ($Line = $DbResult->fetch_assoc()) 79 79 $Output .= '<div><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</div>'; 80 80 $Output .= '</div>'.$PageList['Output']; 81 return ($Output);81 return $Output; 82 82 } 83 83 … … 85 85 { 86 86 $Output = ''; 87 if ($this->System->User->Licence(LICENCE_USER))87 if ($this->System->User->Licence(LICENCE_USER)) 88 88 { 89 89 $Output .= '<form action="?" method="post">'. 90 90 '<fieldset><legend>'.T('New message').'</legend>'. 91 91 'Uživatel: '; 92 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';92 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />'; 93 93 else $Output .= '<input type="text" name="user" /><br />'; 94 94 $Output .= 'Text zprávy: <br/>'. … … 99 99 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL); 100 100 $Output .= $this->ShowList(); 101 return ($Output);101 return $Output; 102 102 } 103 103 … … 105 105 { 106 106 $Output = ''; 107 if ($this->System->User->Licence(LICENCE_USER))107 if ($this->System->User->Licence(LICENCE_USER)) 108 108 { 109 if (array_key_exists('text', $_POST))109 if (array_key_exists('text', $_POST)) 110 110 { 111 111 $Text = $_POST['text']; 112 if (trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING);112 if (trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING); 113 113 else 114 114 { … … 116 116 $DbResult = $this->System->Database->query('SELECT `Text` FROM `ShoutBox` WHERE (`User` = "'. 117 117 $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 118 if ($DbResult->num_rows > 0)118 if ($DbResult->num_rows > 0) 119 119 { 120 120 $DbRow = $DbResult->fetch_assoc(); 121 121 } else $DbRow['Text'] = ''; 122 122 123 if ($DbRow['Text'] == $Text) $Output .= ShowMessage('Nelze vložit stejnou zprávu vícekrát za sebou.', MESSAGE_WARNING);123 if ($DbRow['Text'] == $Text) $Output .= ShowMessage('Nelze vložit stejnou zprávu vícekrát za sebou.', MESSAGE_WARNING); 124 124 else 125 125 { … … 134 134 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL); 135 135 $Output .= $this->ShowList(); 136 return ($Output);136 return $Output; 137 137 } 138 138 … … 143 143 mb_internal_encoding('utf-8'); 144 144 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `UserName`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20'); 145 while ($DbRow = $DbResult->fetch_assoc())145 while ($DbRow = $DbResult->fetch_assoc()) 146 146 { 147 147 $Title = mb_substr($DbRow['Text'], 0, $TitleLength); 148 if (mb_strlen($Title) == $TitleLength) $Title .= '...';148 if (mb_strlen($Title) == $TitleLength) $Title .= '...'; 149 149 $Items[] = array 150 150 ( … … 163 163 'Items' => $Items, 164 164 )); 165 return ($Output);165 return $Output; 166 166 } 167 167 } -
trunk/Modules/Team/Team.php
r851 r880 24 24 'Icon' => '', 25 25 ), 1); 26 if (array_key_exists('Search', $this->System->ModuleManager->Modules))26 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 27 27 $this->System->ModuleManager->Modules['Search']->RegisterSearch('team', 28 28 T('Teams'), array('Name'), '`Team`', $this->System->Link('/team/?search=')); … … 38 38 $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/>'; 39 39 40 if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];41 else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';40 if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 41 else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 42 42 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 43 43 44 if ($this->System->User->Licence(LICENCE_USER))44 if ($this->System->User->Licence(LICENCE_USER)) 45 45 $Output .= '<br /><div style="text-align: center;"><a href="?action=create">'.T('Create translating team').'</a></div><br/>'; 46 if ($_SESSION['search'] != '')46 if ($_SESSION['search'] != '') 47 47 { 48 48 $SearchQuery = ' AND ((`Name` LIKE "%'.$_SESSION['search'].'%") OR (`Description` LIKE "%'.$_SESSION['search'].'%"))'; … … 64 64 array('Name' => 'TimeCreate', 'Title' => T('Founding date')), 65 65 ); 66 if ($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions'));66 if ($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions')); 67 67 68 68 $Order = GetOrderTableHeader($TableColumns, 'NumberUser', 1); … … 72 72 '(SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` '. 73 73 'FROM `Team` WHERE 1'.$SearchQuery.$Order['SQL'].$PageList['SQLLimit']); 74 while ($Team = $DbResult->fetch_assoc())74 while ($Team = $DbResult->fetch_assoc()) 75 75 { 76 76 $Output .= '<tr>'. … … 80 80 '<td><a href="'.$this->System->Link('/users/?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'. 81 81 '<td>'.HumanDate($Team['TimeCreate']).'</td>'; 82 if ($this->System->User->Licence(LICENCE_USER))83 { 84 if ($Team['Leader'] == $this->System->User->Id) $Action = ' <a href="?action=modify&id='.$Team['Id'].'">'.T('Edit').'</a>';82 if ($this->System->User->Licence(LICENCE_USER)) 83 { 84 if ($Team['Leader'] == $this->System->User->Id) $Action = ' <a href="?action=modify&id='.$Team['Id'].'">'.T('Edit').'</a>'; 85 85 else $Action = ''; 86 if ($Team['Id'] == $this->System->User->Team) $Action = ' <a href="?action=leave">'.T('Leave').'</a>';86 if ($Team['Id'] == $this->System->User->Team) $Action = ' <a href="?action=leave">'.T('Leave').'</a>'; 87 87 $Output .= '<td><a href="?action=gointeam&id='.$Team['Id'].'">'.T('Enter').'</a>'.$Action.'</td>'; 88 88 } … … 92 92 $PageList['Output']; 93 93 94 return ($Output);94 return $Output; 95 95 } 96 96 97 97 function TeamJoin() 98 98 { 99 if ($this->System->User->Licence(LICENCE_USER))100 { 101 if (array_key_exists('id', $_GET))99 if ($this->System->User->Licence(LICENCE_USER)) 100 { 101 if (array_key_exists('id', $_GET)) 102 102 { 103 103 $this->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$this->System->User->Id); … … 114 114 } else $Output = ShowMessage('Nutno zadat id týmu.', MESSAGE_CRITICAL); 115 115 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 116 return ($Output);116 return $Output; 117 117 } 118 118 … … 120 120 { 121 121 $Output = ''; 122 if ($this->System->User->Licence(LICENCE_USER))123 { 124 if (array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST))122 if ($this->System->User->Licence(LICENCE_USER)) 123 { 124 if (array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST)) 125 125 { 126 126 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"'); 127 127 $DbRow = $DbResult->fetch_row(); 128 128 $Count = $DbRow[0]; 129 if (($Count == 0) and ($_POST['Name'] != ''))129 if (($Count == 0) and ($_POST['Name'] != '')) 130 130 { 131 131 $this->Database->query('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`, `Leader`)'. … … 142 142 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 143 143 $Output .= $this->ShowTeamList(); 144 return ($Output);144 return $Output; 145 145 } 146 146 147 147 function TeamModify() 148 148 { 149 if ($this->System->User->Licence(LICENCE_USER))150 { 151 if (array_key_exists('id', $_GET))149 if ($this->System->User->Licence(LICENCE_USER)) 150 { 151 if (array_key_exists('id', $_GET)) 152 152 { 153 153 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$this->System->User->Id); 154 if ($DbResult->num_rows > 0)154 if ($DbResult->num_rows > 0) 155 155 { 156 156 $Team = $DbResult->fetch_assoc(); … … 165 165 } else $Output = ShowMessage('Nezadáno id týmu', MESSAGE_CRITICAL); 166 166 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 167 return ($Output);167 return $Output; 168 168 } 169 169 … … 171 171 { 172 172 $Output = ''; 173 if ($this->System->User->Licence(LICENCE_USER))174 { 175 if (array_key_exists('id', $_GET) and array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST) and array_key_exists('URL', $_POST))173 if ($this->System->User->Licence(LICENCE_USER)) 174 { 175 if (array_key_exists('id', $_GET) and array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST) and array_key_exists('URL', $_POST)) 176 176 { 177 177 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$this->System->User->Id); 178 if ($DbResult->num_rows > 0)178 if ($DbResult->num_rows > 0) 179 179 { 180 180 $Team = $DbResult->fetch_assoc(); … … 182 182 $DbRow = $DbResult->fetch_row(); 183 183 $Count = $DbRow[0]; 184 if (($Count == 0) and ($_POST['Name'] != ''))184 if (($Count == 0) and ($_POST['Name'] != '')) 185 185 { 186 186 $this->Database->query('UPDATE `Team` SET `Name`="'.$_POST['Name'].'", `Description`="'.$_POST['Description'].'", `URL`="'.$_POST['URL'].'" WHERE Id='.$Team['Id']); … … 192 192 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 193 193 $Output .= $this->ShowTeamList(); 194 return ($Output);194 return $Output; 195 195 } 196 196 197 197 function TeamCreate() 198 198 { 199 if ($this->System->User->Licence(LICENCE_USER))199 if ($this->System->User->Licence(LICENCE_USER)) 200 200 { 201 201 $Output ='<form action="?action=finish_create" method="post">'. … … 207 207 '</table></fieldset></form>'; 208 208 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 209 return ($Output);209 return $Output; 210 210 } 211 211 … … 213 213 { 214 214 $Output = ''; 215 if (array_key_exists('id', $_GET) and is_numeric($_GET['id']))215 if (array_key_exists('id', $_GET) and is_numeric($_GET['id'])) 216 216 { 217 217 $DbResult = $this->Database->query('SELECT `Id`, `Name`, `Description`, `URL`, `Leader`, '. … … 221 221 '(SELECT ROUND(AVG(`XP`)) FROM `User` WHERE `Team` = `Team`.`Id`) AS `AverageXP` FROM '. 222 222 '`Team` WHERE `Id`='.($_GET['id'] * 1)); 223 if ($DbResult->num_rows > 0)223 if ($DbResult->num_rows > 0) 224 224 { 225 225 $Team = $DbResult->fetch_assoc(); 226 226 $DbResult2 = $this->Database->query('SELECT `Name`, `Id` FROM `User` WHERE `ID`='.$Team['Leader']); 227 if ($DbResult2->num_rows > 0)227 if ($DbResult2->num_rows > 0) 228 228 { 229 229 $Leader = $DbResult2->fetch_assoc(); … … 233 233 T('Web pages').': <a href="http://'.htmlspecialchars($Team['URL']).'">'.htmlspecialchars($Team['URL']).'</a><br/>'. 234 234 T('Leader').': <a href="'.$this->System->Link('/user/?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>'; 235 if ($Team['Description'] != '')235 if ($Team['Description'] != '') 236 236 $Output .= T('Description').': '.htmlspecialchars($Team['Description']).'<br />'; 237 237 $Output .= '<br />'; 238 238 //$Output .= '<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> '; 239 if ($this->System->User->Licence(LICENCE_USER))239 if ($this->System->User->Licence(LICENCE_USER)) 240 240 $Output .='<a href="?action=gointeam&id='.$Team['Id'].'">'.T('Enter to team').'</a><br /><br />'; 241 241 $XP = GetLevelMinMax($Team['AverageXP']); … … 252 252 $Query = ''; 253 253 $DbResult = $this->Database->query($GroupListQuery); 254 if ($DbResult->num_rows > 0)255 { 256 while ($DbRow = $DbResult->fetch_assoc())254 if ($DbResult->num_rows > 0) 255 { 256 while ($DbRow = $DbResult->fetch_assoc()) 257 257 { 258 258 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 289 289 $Total = 0; 290 290 $DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 291 while ($Group = $DbResult->fetch_assoc())291 while ($Group = $DbResult->fetch_assoc()) 292 292 { 293 293 $Output .='<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated']. … … 296 296 $Total += $Group['Total']; 297 297 } 298 if ($Total > 0) $Progress = round($Translated / $Total * 100, 2);298 if ($Total > 0) $Progress = round($Translated / $Total * 100, 2); 299 299 else $Progress = 0; 300 300 $Output .='<tr><td><strong>'.T('Total').'</strong></td><td><strong>'. … … 306 306 } else $Output .= ShowMessage('Tým nenalezen', MESSAGE_CRITICAL); 307 307 } else $Output .= ShowMessage('Musíte zadat id týmu', MESSAGE_CRITICAL); 308 return ($Output);308 return $Output; 309 309 } 310 310 311 311 function TeamLeave() 312 312 { 313 if ($this->System->User->Licence(LICENCE_USER))313 if ($this->System->User->Licence(LICENCE_USER)) 314 314 { 315 315 $this->Database->query('UPDATE `User` SET `Team` = NULL WHERE `ID` = '.$this->System->User->Id); … … 325 325 $Output .= $this->ShowTeamList(); 326 326 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 327 return ($Output);327 return $Output; 328 328 } 329 329 330 330 function Show() 331 331 { 332 if (array_key_exists('action', $_GET))333 { 334 if ($_GET['action'] == 'gointeam') $Output = $this->TeamJoin();335 else if ($_GET['action'] == 'finish_create') $Output = $this->TeamCreateFinish();336 else if ($_GET['action'] == 'modify') $Output = $this->TeamModify();337 else if ($_GET['action'] == 'finish_modify') $Output = $this->TeamModifyFinish();338 else if ($_GET['action'] == 'create') $Output = $this->TeamCreate();339 else if ($_GET['action'] == 'team') $Output = $this->TeamShow();340 else if ($_GET['action'] == 'leave') $Output = $this->TeamLeave();332 if (array_key_exists('action', $_GET)) 333 { 334 if ($_GET['action'] == 'gointeam') $Output = $this->TeamJoin(); 335 else if ($_GET['action'] == 'finish_create') $Output = $this->TeamCreateFinish(); 336 else if ($_GET['action'] == 'modify') $Output = $this->TeamModify(); 337 else if ($_GET['action'] == 'finish_modify') $Output = $this->TeamModifyFinish(); 338 else if ($_GET['action'] == 'create') $Output = $this->TeamCreate(); 339 else if ($_GET['action'] == 'team') $Output = $this->TeamShow(); 340 else if ($_GET['action'] == 'leave') $Output = $this->TeamLeave(); 341 341 else $Output = $this->ShowTeamList(); 342 342 } else $Output = $this->ShowTeamList(); 343 return ($Output);343 return $Output; 344 344 } 345 345 } -
trunk/Modules/Translation/Comparison.php
r859 r880 12 12 $ArrStr2 = explode(' ', $String2); 13 13 14 for ($i = 0; $i < count($ArrStr1); $i++)14 for ($i = 0; $i < count($ArrStr1); $i++) 15 15 { 16 if (isset($ArrStr2[$i]))16 if (isset($ArrStr2[$i])) 17 17 { 18 if ($ArrStr1[$i] == $ArrStr2[$i])18 if ($ArrStr1[$i] == $ArrStr2[$i]) 19 19 { 20 20 $Result .= $ArrStr1[$i].' '; … … 22 22 { 23 23 $find = false; 24 for ($j = 0; $j < count($ArrStr2); $j++)24 for ($j = 0; $j < count($ArrStr2); $j++) 25 25 { 26 if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false))26 if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false)) 27 27 { 28 28 $Result .= $ArrStr1[$i].' '; … … 30 30 } 31 31 } 32 if ($find == false)32 if ($find == false) 33 33 $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>'; 34 34 } 35 35 } else $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>'; 36 36 } 37 return ($Result);37 return $Result; 38 38 } 39 39 … … 44 44 $Output = ''; 45 45 46 if ($this->System->User->Licence(LICENCE_USER))46 if ($this->System->User->Licence(LICENCE_USER)) 47 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 />'; … … 51 51 $Table = $TranslationTree[$GroupId]['TablePrefix']; 52 52 53 if (array_key_exists('entry', $_GET))53 if (array_key_exists('entry', $_GET)) 54 54 { 55 55 $Textentry = $_GET['entry']; 56 if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů56 if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů 57 57 { 58 58 $TextID1 = $_GET['ID1']; … … 66 66 ' LEFT JOIN `Language` ON `Language`.`Id` = `'.$Table.'`.`Language` '. 67 67 'WHERE `Entry` = '.$Textentry.' '.$WhereID.' ORDER BY `Language`'); 68 while ($Line[] = $DataID->fetch_assoc());68 while ($Line[] = $DataID->fetch_assoc()); 69 69 array_pop($Line); 70 70 … … 74 74 '<table class="BaseTable">'. 75 75 '<tr><th>Přeložil</th>'; 76 foreach ($Line as $Index => $LineItem)76 foreach ($Line as $Index => $LineItem) 77 77 $Output .= '<th>'.$LineItem['UserName'].'</th>'; 78 78 $Output .= '</tr>'. 79 79 '<tr>'. 80 80 '<th>ID textu</th>'; 81 foreach ($Line as $Index => $LineItem)81 foreach ($Line as $Index => $LineItem) 82 82 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>'; 83 83 $Output .= '</tr>'. 84 84 '<tr><th>Převzato</th>'; 85 foreach ($Line as $Index => $LineItem)85 foreach ($Line as $Index => $LineItem) 86 86 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>'; 87 87 $Output .= '</tr>'. 88 88 '<tr><th>'.T('Language').'</th>'; 89 foreach ($Line as $Index => $LineItem)89 foreach ($Line as $Index => $LineItem) 90 90 $Output .= '<td>'.T($LineItem['LanguageName']).'</td>'; 91 91 $Output .= '</tr>'. 92 92 '<tr><th>'.T('Version').'</th>'; 93 foreach ($Line as $Index => $LineItem)93 foreach ($Line as $Index => $LineItem) 94 94 $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>'; 95 95 $Output .= '</tr>'; 96 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)96 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 97 97 { 98 98 $writethis = false; 99 for ($i = 0; $i < count($Line); $i++)99 for ($i = 0; $i < count($Line); $i++) 100 100 { 101 if ($Line[$i][$TextItem['Column']] <> '') $writethis = true;101 if ($Line[$i][$TextItem['Column']] <> '') $writethis = true; 102 102 } 103 if ($writethis)103 if ($writethis) 104 104 { 105 105 $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 106 for ($i = 0; $i < count($Line); $i++)106 for ($i = 0; $i < count($Line); $i++) 107 107 { 108 if ($i > 0)108 if ($i > 0) 109 109 { 110 110 $Output .= '<td>'; … … 120 120 } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL); 121 121 122 return ($Output);122 return $Output; 123 123 } 124 124 } -
trunk/Modules/Translation/Form.php
r859 r880 10 10 $this->Title = T('Translation'); 11 11 $Action = ''; 12 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];13 14 if ($Action == 'delete') $Output = $this->Delete();12 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 13 14 if ($Action == 'delete') $Output = $this->Delete(); 15 15 else $Output = $this->ShowForm(); 16 return ($Output);16 return $Output; 17 17 } 18 18 … … 26 26 $this->GroupId = $GroupId; 27 27 $Table = $TranslationTree[$GroupId]['TablePrefix']; 28 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];28 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 29 29 else $Action = ''; 30 30 31 if (array_key_exists('ID', $_GET))31 if (array_key_exists('ID', $_GET)) 32 32 { 33 33 $TextID = $_GET['ID'] * 1; … … 36 36 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID); 37 37 $Line = $DbResult->fetch_assoc(); 38 if (!$Line)38 if (!$Line) 39 39 { 40 40 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL); … … 47 47 else $Language = '`Language` != '.$this->System->Config['OriginalLanguage']; 48 48 $Columns = ''; 49 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)49 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 50 50 $Columns .= ' `Orig`.`'.$TextItem['Column'].'` as `Orig_'.$TextItem['Column'].'`, `Tran`.`'.$TextItem['Column'].'` as `'.$TextItem['Column'].'`,'; 51 51 … … 56 56 $DbResult = $this->Database->query($sql.$join.$where); 57 57 while ($LineSearch = $DbResult->fetch_assoc()) { 58 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)59 if ($TextItem['Visible'] == 1)58 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 59 if ($TextItem['Visible'] == 1) 60 60 if (($LineAJ[$TextItem['Column']] <> '') and 61 61 ($LineSearch[$TextItem['Column']] <> '') and … … 74 74 $LineAJ = $DbResult->fetch_assoc(); 75 75 } 76 if (!$LineAJ)76 if (!$LineAJ) 77 77 { 78 78 $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); … … 80 80 { 81 81 82 if ($Line['User'] != '')82 if ($Line['User'] != '') 83 83 { 84 84 $IDUser = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); … … 89 89 $Output .= T('Group').': <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'; 90 90 91 if (($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))91 if (($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 92 92 $Output .= T('Translated by').': <a href="'.$this->System->Link('/user/?user='.$Line['User']).'"><strong>'.$LineUser['Name'].'</strong></a> dne '.HumanDate($Line['ModifyTime']).'<br />'; 93 if (($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))93 if (($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID'])) 94 94 { 95 95 $DbResult = $this->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']); … … 105 105 } 106 106 $Output .= 'Text: '; 107 if ($Line['Language'] <> 0)108 { 109 if ($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>';107 if ($Line['Language'] <> 0) 108 { 109 if ($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>'; 110 110 else $Output .= ' <b>'.T('Stored in unfinished').'</b> '; 111 111 } else $Output .= ' <b>'.T('Original version').'</b> '; … … 120 120 $Version = $DbResult->fetch_row(); 121 121 $Version = $Version[0]; 122 if ($Version > 0)122 if ($Version > 0) 123 123 { 124 124 $Output .= '<form action="comparison.php" method="get"><a href="'.$this->System->Link('/TranslationList.php?group='. … … 128 128 <input type="hidden" name="ID2" value="'.$TextID.'" />'; 129 129 130 if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user130 if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user 131 131 $Output .= '<select onchange="this.form.submit();" name="ID1"> 132 132 <option value="-1">'.T('Select text for comparison').'</option> 133 133 <option value="-1">'.T('Show/compare all').'</option>'; 134 134 $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'].')'); 135 while ($Version = $DataID->fetch_array())135 while ($Version = $DataID->fetch_array()) 136 136 { 137 if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'.137 if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'. 138 138 $Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' ('.T('taken over').')</option>'; 139 139 else 140 140 { 141 if ($Version['Language'] == 0) $Version['UserName'] = T('Original');141 if ($Version['Language'] == 0) $Version['UserName'] = T('Original'); 142 142 $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '. 143 143 $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '. … … 155 155 156 156 // Special characters: $B - New line, $N - Name, $C - profession 157 if ($this->System->User->Licence(LICENCE_USER))157 if ($this->System->User->Licence(LICENCE_USER)) 158 158 { 159 159 $Output .= '<form action="'.$this->System->Link('/save.php?group='.$GroupId).'" method="post"><div>'; 160 160 // TODO: Remove fixed group id condition 161 // if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))161 // if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 162 162 $Output .= '<a href="'.$this->System->Link('/dictionary/?action=group&group='. 163 163 $GroupId.'&ID='.$LineAJ['ID']).'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">'.T('Search in names').'</a>'; … … 169 169 } 170 170 171 if ($TranslationTree[$GroupId]['WowheadName'] != '')171 if ($TranslationTree[$GroupId]['WowheadName'] != '') 172 172 $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName']. 173 173 '='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>'; … … 187 187 <td>'.T('Original').'</td> 188 188 <td>'; 189 if ($Line['Language'] <> 0) $Language = $Line['Language'];190 else if ($this->System->User->Id != 0)189 if ($Line['Language'] <> 0) $Language = $Line['Language']; 190 else if ($this->System->User->Id != 0) 191 191 { 192 192 $Language = $this->System->User->Language; 193 193 } else $Language = 0; 194 if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language);194 if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language); 195 195 else { 196 196 $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '(`Enabled` = 1) AND (`Id`='.$Language.')'); 197 if ($DbResult3->num_rows > 0)197 if ($DbResult3->num_rows > 0) 198 198 { 199 199 $Language = $DbResult3->fetch_assoc(); … … 209 209 '<script>'; 210 210 $Output .= '$(document).ready(function() {'; 211 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)211 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 212 212 $Output .= '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");'; 213 213 … … 215 215 '</script>'; 216 216 217 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)218 if ($TextItem['Visible'] == 1)217 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 218 if ($TextItem['Visible'] == 1) 219 219 { 220 if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))220 if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 221 221 { 222 if (($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings')))222 if (($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings'))) 223 223 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>'; 224 224 else $Output .= '<tr><th>'.T($TextItem['Name']).'</th>'; 225 225 $Output .= '<td id="'.$TextItem['Column'].'">'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td> 226 226 <td>'; 227 if ($this->System->User->Licence(LICENCE_USER))227 if ($this->System->User->Licence(LICENCE_USER)) 228 228 $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 229 229 $Output .= htmlspecialchars($Line[$TextItem['Column']]); 230 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';230 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>'; 231 231 } 232 232 } else … … 235 235 } 236 236 $Output .= '</table></div>'; 237 if ($this->System->User->Licence(LICENCE_USER)) {237 if ($this->System->User->Licence(LICENCE_USER)) { 238 238 $Output .= '</form>'; 239 239 240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and 241 241 $this->System->Config['Web']['EnableGoogleTranslate']) 242 242 { 243 243 $Output .= '<br/><table class="BaseTable">'. 244 244 '<tr><th>'.T('Google translator').':</th><th>'.T('Not translated').'</th><th>'.T('Translated').'</th>'; 245 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)246 if ($TextItem['Visible'] == 1)245 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 246 if ($TextItem['Visible'] == 1) 247 247 if ($LineAJ[$TextItem['Column']] <> '') 248 248 $Output .= '<tr><td>'.$TextItem['Column'].'</td>'. … … 256 256 } 257 257 } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 258 return ($Output);258 return $Output; 259 259 } 260 260 … … 263 263 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 264 264 265 if ($this->System->User->Licence(LICENCE_MODERATOR))265 if ($this->System->User->Licence(LICENCE_MODERATOR)) 266 266 { 267 267 $GroupId = LoadGroupIdParameter(); … … 273 273 $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); 274 274 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 275 return ($Output);275 return $Output; 276 276 } 277 277 } -
trunk/Modules/Translation/LoadNames.php
r859 r880 18 18 } 19 19 // } 20 return ($Text);20 return $Text; 21 21 } 22 22 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) … … 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 return ($Text);28 return $Text; 29 29 } 30 30 … … 44 44 $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text); 45 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) {46 foreach ($names as $Line) { 47 47 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 48 48 if ($Line[3] <> '') { … … 61 61 62 62 $Output = ''; 63 if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId'];64 else return (ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL));65 if (!array_key_exists('ID', $_GET)) return(ShowMessage(T('ID not specified'), MESSAGE_CRITICAL));66 if (!array_key_exists('Column', $_GET)) return(ShowMessage(T('Column not specified'), MESSAGE_CRITICAL));63 if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId']; 64 else return ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL); 65 if (!array_key_exists('ID', $_GET)) return ShowMessage(T('ID not specified'), MESSAGE_CRITICAL); 66 if (!array_key_exists('Column', $_GET)) return ShowMessage(T('Column not specified'), MESSAGE_CRITICAL); 67 67 $Table = $TranslationTree[$GroupId]['TablePrefix']; 68 68 $DbResult = $this->System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1'); … … 73 73 $names = array(); 74 74 if ($this->System->User->Licence(LICENCE_USER)) 75 if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))75 if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 76 76 { 77 77 //<span class="edit">barvou.</span> 78 78 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); 79 79 } else { 80 if (($GroupId == 13)) {80 if (($GroupId == 13)) { 81 81 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 82 82 'TextGlobalString' => 'Text', 'TextArea' => 'Name', … … 87 87 } 88 88 //$LineAJ[$Column] 89 return ($this->ColorNames(htmlspecialchars($Text),$names));89 return $this->ColorNames(htmlspecialchars($Text),$names); 90 90 } 91 91 … … 93 93 { 94 94 $this->RawPage = true; 95 return (str_replace("\n", '<br/>', $this->LoadNames()));95 return str_replace("\n", '<br/>', $this->LoadNames()); 96 96 } 97 97 } -
trunk/Modules/Translation/Progress.php
r847 r880 8 8 9 9 $BuildNumber = GetBuildNumber($_SESSION['StatVersion']); 10 if (is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')';10 if (is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')'; 11 11 else $LanguageFilter = ' AND (`Language`!='.$this->System->Config['OriginalLanguage'].')'; 12 12 … … 14 14 $Query = ''; 15 15 $DbResult = $this->Database->query($GroupListQuery); 16 if ($DbResult->num_rows > 0)16 if ($DbResult->num_rows > 0) 17 17 { 18 while ($DbRow = $DbResult->fetch_assoc())18 while ($DbRow = $DbResult->fetch_assoc()) 19 19 { 20 20 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 50 50 $Total = 0; 51 51 $DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 52 while ($Group = $DbResult->fetch_assoc())52 while ($Group = $DbResult->fetch_assoc()) 53 53 { 54 54 $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; … … 56 56 $Total += $Group['Total']; 57 57 } 58 if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);58 if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2); 59 59 else $TotalCount = 0; 60 60 $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $TotalCount).'</strong></td></tr>'. 61 61 '</table>'; 62 62 } 63 return ($Output);63 return $Output; 64 64 } 65 65 … … 69 69 $LanguageList = GetLanguageList(); 70 70 71 if (array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];72 if (!array_key_exists('StatVersion', $_SESSION))71 if (array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version']; 72 if (!array_key_exists('StatVersion', $_SESSION)) 73 73 { 74 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))74 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != '')) 75 75 { 76 76 $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame; … … 80 80 } 81 81 82 if (!isset($_SESSION['language']))82 if (!isset($_SESSION['language'])) 83 83 { 84 if ($this->System->User->Licence(LICENCE_USER))84 if ($this->System->User->Licence(LICENCE_USER)) 85 85 { 86 86 $_SESSION['language'] = $this->System->User->Language; … … 89 89 } 90 90 } 91 if (array_key_exists('language', $_GET))91 if (array_key_exists('language', $_GET)) 92 92 { 93 if ($_GET['language'] == '') {93 if ($_GET['language'] == '') { 94 94 $_SESSION['language'] = ''; 95 95 } else { … … 97 97 } 98 98 } 99 if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';99 if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = ''; 100 100 101 101 // Show client version selection 102 102 $Output = T('Client version:').' '; 103 103 $DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`'); 104 while ($DbRow = $DbResult->fetch_assoc())104 while ($DbRow = $DbResult->fetch_assoc()) 105 105 $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> '; 106 106 $Output .= '<br/>'; … … 109 109 $Output .= T('Language:').' '; 110 110 $Lang = '<a href="?language=">'.T('All').'</a>'; 111 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';111 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> '; 112 112 else $Output .= $Lang; 113 foreach ($LanguageList as $Language)114 if ($Language['Enabled'] == 1)113 foreach ($LanguageList as $Language) 114 if ($Language['Enabled'] == 1) 115 115 { 116 116 $Lang = ' <a href="?language='.$Language['Id'].'">'.T($Language['Name']).'</a>'; 117 if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';117 if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> '; 118 118 else $Output .= $Lang; 119 119 } 120 120 121 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];121 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name']; 122 122 else $LanguageName = T('All'); 123 123 $Output .= '<br/><br/><h3>'.sprintf(T('Statistics of translation completion of language %s for version %s'), T($LanguageName), $_SESSION['StatVersion']).'</h3><br/>'; 124 124 $Output .= $this->ShowStatTable(); 125 125 126 return ($Output);126 return $Output; 127 127 } 128 128 } -
trunk/Modules/Translation/Save.php
r859 r880 11 11 // Get source text record from database by ID 12 12 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID`='.$TextID); 13 if ($DbResult->num_rows > 0)13 if ($DbResult->num_rows > 0) 14 14 { 15 15 $SourceText = $DbResult->fetch_assoc(); … … 19 19 'AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '. 20 20 'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')'); 21 if ($DbResult->num_rows > 0)21 if ($DbResult->num_rows > 0) 22 22 { 23 23 $EnglishText = $DbResult->fetch_assoc(); … … 25 25 // Get all similar english texts 26 26 $Filter = array(); 27 foreach ($Group['Items'] as $GroupItem)27 foreach ($Group['Items'] as $GroupItem) 28 28 { 29 if (($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != ''))29 if (($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != '')) 30 30 $Filter[] = '(`'.$GroupItem['Column'].'` = "'.addslashes($EnglishText[$GroupItem['Column']]).'")'; 31 31 } 32 if (count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')';32 if (count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')'; 33 33 else $Filter = ' AND 0'; 34 34 35 35 $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter; 36 36 $DbResult = $this->Database->query($Query); 37 while ($EnglishFound = $DbResult->fetch_assoc())37 while ($EnglishFound = $DbResult->fetch_assoc()) 38 38 { 39 39 // Get user translation paired to found english item entry … … 41 41 ') AND (`Entry` = '.$EnglishFound['Entry'].') AND (`VersionStart` = '.$EnglishFound['VersionStart']. 42 42 ') AND (`VersionEnd` = '.$EnglishFound['VersionEnd'].')'); 43 if ($DbResult2->num_rows > 0)43 if ($DbResult2->num_rows > 0) 44 44 { 45 45 // Update existed user translation … … 47 47 $Modified = false; 48 48 $Values = '`Language` = '.$Language; 49 if ($Language != $ExistedText['Language']) $Modified = true;49 if ($Language != $ExistedText['Language']) $Modified = true; 50 50 51 51 $Completable = true; 52 52 $CompleteParts = $ExistedText['CompleteParts']; 53 foreach ($Group['Items'] as $GroupItem)54 { 55 if ($GroupItem['Visible'] == 1)56 { 57 if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])53 foreach ($Group['Items'] as $GroupItem) 54 { 55 if ($GroupItem['Visible'] == 1) 56 { 57 if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']]) 58 58 { 59 if (array_key_exists($GroupItem['Column'], $_POST))59 if (array_key_exists($GroupItem['Column'], $_POST)) 60 60 { 61 if ($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']])61 if ($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']]) 62 62 $Modified = true; 63 63 … … 66 66 } 67 67 } 68 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and68 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and 69 69 ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 70 70 } 71 71 } 72 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed72 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 73 73 else $NewComplete = 0; 74 74 75 75 // Update completion status for edited translation item 76 if ($SourceText['ID'] == $ExistedText['ID'])76 if ($SourceText['ID'] == $ExistedText['ID']) 77 77 { 78 78 $NewComplete = $Complete; // Our original user text, set complete according user choice 79 if ($Complete == 1)80 { 81 foreach ($Group['Items'] as $GroupItem)82 if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));79 if ($Complete == 1) 80 { 81 foreach ($Group['Items'] as $GroupItem) 82 if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); 83 83 } 84 84 } 85 85 $Values .= ', `Complete`='.$NewComplete.', `CompleteParts` = '.$CompleteParts; 86 if (($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts']))86 if (($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts'])) 87 87 $Modified = true; 88 88 89 89 $Values .= ', `ModifyTime` = NOW()'; 90 if ($Modified)90 if ($Modified) 91 91 { 92 92 // Update user translation … … 114 114 $CompleteParts = 0; 115 115 $Completable = true; 116 foreach ($Group['Items'] as $GroupItem)116 foreach ($Group['Items'] as $GroupItem) 117 117 { 118 118 $Columns .= ', `'.$GroupItem['Column'].'`'; 119 if ($GroupItem['Visible'] == 1)120 { 121 if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])119 if ($GroupItem['Visible'] == 1) 120 { 121 if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']]) 122 122 { 123 123 // Read form user data 124 if (array_key_exists($GroupItem['Column'], $_POST))124 if (array_key_exists($GroupItem['Column'], $_POST)) 125 125 { 126 126 $Values .= ', "'.$_POST[$GroupItem['Column']].'"'; … … 128 128 } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"'; 129 129 } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"'; 130 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false;130 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 131 131 } else 132 132 { … … 135 135 } 136 136 } 137 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed137 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 138 138 else $NewComplete = 0; 139 139 // Update completion status for edited translation item 140 if ($SourceText['ID'] == $EnglishFound['ID'])140 if ($SourceText['ID'] == $EnglishFound['ID']) 141 141 { 142 142 $TakeID = $TextID; 143 143 $NewComplete = $Complete; // Our original user text, set complete according user choice 144 if ($Complete == 1)145 { 146 foreach ($Group['Items'] as $GroupItem)147 if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));144 if ($Complete == 1) 145 { 146 foreach ($Group['Items'] as $GroupItem) 147 if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); 148 148 } 149 149 } … … 171 171 } else $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); 172 172 } else $Output .= ShowMessage('Zadaná položka nenalezena.', MESSAGE_CRITICAL); 173 return ($Output);173 return $Output; 174 174 } 175 175 … … 183 183 unset($Message); 184 184 $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm(); 185 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType);185 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType); 186 186 187 187 $GroupId = LoadGroupIdParameter(); 188 188 $Group = $TranslationTree[$GroupId]; 189 189 $Table = $Group['TablePrefix']; 190 if ($this->System->User->Licence(LICENCE_USER))191 { 192 if (array_key_exists('ID', $_POST) and is_numeric($_POST['ID']))190 if ($this->System->User->Licence(LICENCE_USER)) 191 { 192 if (array_key_exists('ID', $_POST) and is_numeric($_POST['ID'])) 193 193 { 194 194 $Entry = $_POST['entry'] * 1; 195 195 $TextID = $_POST['ID'] * 1; 196 196 $Language = $_POST['Language'] * 1; 197 if (array_key_exists('End', $_POST)) $Complete = 1;197 if (array_key_exists('End', $_POST)) $Complete = 1; 198 198 else $Complete = 0; 199 199 … … 207 207 { 208 208 // User automatically logged out. Show login dialog and allow to save retry. 209 if (array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST))209 if (array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST)) 210 210 { 211 211 $Output .= 'Byli jste automaticky odhlášeni. Pro <strong>Uložení překladu</strong> se musíte přihlásit zde:<br /><br />'. … … 216 216 '<input type="hidden" name="Language" value="'.$_POST['Language'].'" />'; 217 217 218 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)218 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 219 219 { 220 if (array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = '';220 if (array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = ''; 221 221 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Value).'" />'; 222 222 } … … 232 232 } else $Output = ShowMessage('Nezadány požadované údaje.', MESSAGE_CRITICAL); 233 233 } 234 return ($Output);234 return $Output; 235 235 } 236 236 … … 246 246 $redirecting = $DbResult->fetch_assoc(); 247 247 248 switch ($redirecting['Redirecting'])248 switch ($redirecting['Redirecting']) 249 249 { 250 250 case 1: … … 254 254 break; 255 255 case 2: 256 if ($next <> '')256 if ($next <> '') 257 257 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 258 258 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'. … … 260 260 break; 261 261 case 3: 262 if ($prev <> '')262 if ($prev <> '') 263 263 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 264 264 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'. … … 269 269 $Output .= sprintf(T('You can be redirected automatically from this page. You can set where you want to be transfered here: %s'), '<a href="'. 270 270 $this->System->Link('/options/').'" title="'.T('User settings').'">'.T('Options').'</a>'); 271 return ($Output);271 return $Output; 272 272 } 273 273 } -
trunk/Modules/Translation/Translation.php
r861 r880 47 47 'Icon' => '', 48 48 )); 49 if (array_key_exists('Search', $this->System->ModuleManager->Modules))49 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 50 50 { 51 51 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 52 foreach ($TranslationTree as $Group)52 foreach ($TranslationTree as $Group) 53 53 { 54 54 $Table = $Group['TablePrefix']; 55 55 56 56 $Columns = array('ID', 'Entry'); 57 foreach ($Group['Items'] as $Item)57 foreach ($Group['Items'] as $Item) 58 58 { 59 if ($Item['Column'] != '') $Columns[] = $Item['Column'];59 if ($Item['Column'] != '') $Columns[] = $Item['Column']; 60 60 } 61 61 … … 74 74 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '. 75 75 'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100'); 76 while ($DbRow = $DbResult->fetch_assoc())76 while ($DbRow = $DbResult->fetch_assoc()) 77 77 { 78 78 $Items[] = array … … 92 92 'Items' => $Items, 93 93 )); 94 return ($Output);94 return $Output; 95 95 } 96 96 … … 105 105 $UnionItems = array(); 106 106 $DbResult = $this->Database->query($GroupListQuery); 107 if ($DbResult->num_rows > 0)108 { 109 while ($DbRow = $DbResult->fetch_assoc())107 if ($DbResult->num_rows > 0) 108 { 109 while ($DbRow = $DbResult->fetch_assoc()) 110 110 { 111 111 $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '. … … 122 122 $DbResult = $this->Database->query($Query); 123 123 $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>'; 124 while ($DbRow = $DbResult->fetch_assoc())124 while ($DbRow = $DbResult->fetch_assoc()) 125 125 { 126 126 $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'. … … 133 133 } 134 134 $Output .= '</div>'; 135 return ($Output);135 return $Output; 136 136 } 137 137 138 138 function GetTranslationTree() 139 139 { 140 if (isset($this->TranslationTree)) return($this->TranslationTree);140 if (isset($this->TranslationTree)) return $this->TranslationTree; 141 141 else { 142 142 $Result = array(); 143 143 $Groups = array(); 144 144 $DbResult = $this->System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group`'); 145 while ($DbRow = $DbResult->fetch_assoc())145 while ($DbRow = $DbResult->fetch_assoc()) 146 146 $Groups[T($DbRow['Name'])] = $DbRow; 147 147 ksort($Groups); 148 foreach ($Groups as $Group)148 foreach ($Groups as $Group) 149 149 { 150 150 $Group['Items'] = array(); … … 153 153 } 154 154 $DbResult = $this->System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`'); 155 while ($DbRow = $DbResult->fetch_assoc())155 while ($DbRow = $DbResult->fetch_assoc()) 156 156 { 157 157 $Result[$DbRow['Group']]['Items'][] = $DbRow; 158 158 } 159 159 $this->TranslationTree = $Result; 160 return ($Result);160 return $Result; 161 161 } 162 162 } … … 168 168 $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">'; 169 169 $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`'); 170 while ($Group = $DbResult->fetch_assoc())170 while ($Group = $DbResult->fetch_assoc()) 171 171 { 172 172 $Groups[T($Group['Name'])] = $Group; 173 173 } 174 174 ksort($Groups); 175 foreach ($Groups as $Group)175 foreach ($Groups as $Group) 176 176 { 177 177 $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'. … … 183 183 ' <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'. 184 184 $this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=2&user=0&entry=&text=').'">'.T('Translated').'</a><br />'; 185 if (isset($this->System->User) and $this->System->User->Licence(LICENCE_USER))185 if (isset($this->System->User) and $this->System->User->Licence(LICENCE_USER)) 186 186 { 187 187 $Output .= ' <a title="'.T('Unfinished translations').'" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=3').'">'.T('Unfinished').'</a><br />'. … … 196 196 } 197 197 $Output .= '</div>'; 198 return ($Output);198 return $Output; 199 199 } 200 200 } -
trunk/Modules/Translation/TranslationList.php
r859 r880 47 47 ); 48 48 foreach ($StateTypes as $index => $StateType) { 49 if ($Filter['State'] == $index) $Selected = ' selected="selected"';49 if ($Filter['State'] == $index) $Selected = ' selected="selected"'; 50 50 else $Selected = ''; 51 51 $Output .= '<option value="'.$index.'"'.$Selected.'>'.$StateType.'</option>'; … … 54 54 55 55 // Translation group 56 if ($GroupId == 0)56 if ($GroupId == 0) 57 57 { 58 58 $Filter['Group'] = GetParameter('group', 0, true, true); 59 if ($Filter['Group'] != 0)59 if ($Filter['Group'] != 0) 60 60 { 61 if (isset($TranslationTree[$Filter['Group']]) == false)61 if (isset($TranslationTree[$Filter['Group']]) == false) 62 62 ErrorMessage('Překladová skupina dle zadaného Id neexistuje.'); 63 63 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; … … 70 70 71 71 $Output .= '<td><select name="group" style="width: 80px">'; 72 if ($Filter['Group'] == 0) $Selected = ' selected="selected"';72 if ($Filter['Group'] == 0) $Selected = ' selected="selected"'; 73 73 else $Selected = ''; 74 74 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 75 75 $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group`'); 76 while ($Group = $DbResult->fetch_assoc())76 while ($Group = $DbResult->fetch_assoc()) 77 77 $Groups[T($Group['Name'])] = $Group; 78 78 ksort($Groups); 79 foreach ($Groups as $Group)80 { 81 if ($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"';79 foreach ($Groups as $Group) 80 { 81 if ($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"'; 82 82 else $Selected = ''; 83 83 $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.T($Group['Name']).'</option>'; … … 89 89 else 90 90 $Filter['Version'] = GetParameter('version', 0, true, true); 91 if ($Filter['Version'] != 0)91 if ($Filter['Version'] != 0) 92 92 { 93 93 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')'); 94 if ($DbResult->num_rows > 0)94 if ($DbResult->num_rows > 0) 95 95 { 96 96 $DbRow = $DbResult->fetch_assoc(); … … 99 99 } 100 100 $Output .= '<td><select name="version">'; 101 if ($Filter['Version'] == 0) $Selected = ' selected="selected"';101 if ($Filter['Version'] == 0) $Selected = ' selected="selected"'; 102 102 else $Selected = ''; 103 103 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 104 104 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC'); 105 while ($Version = $DbResult->fetch_assoc())106 { 107 if ($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"';105 while ($Version = $DbResult->fetch_assoc()) 106 { 107 if ($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"'; 108 108 else $Selected = ''; 109 109 $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>'; 110 110 } 111 111 $Output .= '</select></td>'; 112 if ($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')';112 if ($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')'; 113 113 else $VersionFilter = ''; 114 114 //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry) … … 117 117 $Filter['Language'] = GetParameter('lang', 0, true, true); 118 118 $Output .= '<td><select name="lang">'; 119 if ($Filter['Language'] == 0) $Selected = ' selected="selected"';119 if ($Filter['Language'] == 0) $Selected = ' selected="selected"'; 120 120 else $Selected = ''; 121 121 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 122 122 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`'); 123 while ($Language = $DbResult->fetch_assoc())124 { 125 if ($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"';123 while ($Language = $DbResult->fetch_assoc()) 124 { 125 if ($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"'; 126 126 else $Selected = ''; 127 127 $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.T($Language['Name']).'</option>'; … … 130 130 $LanguageFilter = ''; 131 131 $LanguageFilterSub = ''; 132 if ($Filter['Language'] != 0) {132 if ($Filter['Language'] != 0) { 133 133 $LanguageFilter = ' AND (`T`.`Language` = '.$Filter['Language'].')'; 134 134 $LanguageFilterSub = ' AND (`Sub`.`Language` = '.$Filter['Language'].')'; … … 138 138 $Filter['User'] = GetParameter('user', 0, true, true); 139 139 $Output .= '<td><select name="user" style="width: 80px">'; 140 if ($Filter['User'] == 0) $Selected = ' selected="selected"';140 if ($Filter['User'] == 0) $Selected = ' selected="selected"'; 141 141 else $Selected = ''; 142 142 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 143 143 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`'); 144 while ($User = $DbResult->fetch_assoc())145 { 146 if ($User['Id'] == $Filter['User']) $Selected = ' selected="selected"';144 while ($User = $DbResult->fetch_assoc()) 145 { 146 if ($User['Id'] == $Filter['User']) $Selected = ' selected="selected"'; 147 147 else $Selected = ''; 148 148 $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>'; 149 149 } 150 150 $Output .= '</select></td>'; 151 if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';151 if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')'; 152 152 else $UserFilter = ''; 153 153 … … 155 155 $Filter['Text'] = GetParameter('text', '', false, true); 156 156 $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.htmlentities($Filter['Text']).'"></td>'; 157 if ($Filter['Text'] != '')157 if ($Filter['Text'] != '') 158 158 { 159 159 $Items = array('(`T`.`ID` LIKE "%'.$Filter['Text'].'%")', '(`T`.`Entry` LIKE "%'.$Filter['Text'].'%")'); 160 if ($Filter['Group'] != 0)161 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)162 if ($GroupItem['Visible'] == 1)160 if ($Filter['Group'] != 0) 161 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 162 if ($GroupItem['Visible'] == 1) 163 163 $Items[] = '(`T`.`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")'; 164 164 $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')'; … … 168 168 $Filter['Entry'] = GetParameter('entry', '', false, true); 169 169 $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.htmlentities($Filter['Entry']).'"></td>'; 170 if ($Filter['Entry'] != '')170 if ($Filter['Entry'] != '') 171 171 { 172 172 $Filter['SQL'] .= ' AND (`Entry` = "'.$Filter['Entry'].'")'; 173 173 } 174 174 175 if ($Filter['Group'] != 0)175 if ($Filter['Group'] != 0) 176 176 { 177 177 $WithoutAlter = ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. … … 179 179 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`ID` != `T`.`ID`) AND (`Sub`.`Complete` = 1) AND '. 180 180 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`) LIMIT 1 ) '; 181 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)182 if ($GroupItem['Visible'] == 1) {181 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 182 if ($GroupItem['Visible'] == 1) { 183 183 $ItemsVar[] = 'LENGTH(`T`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `T`.`'.$GroupItem['Column'].'`, \'$\', \'\' ) ) '. 184 184 ' < ('. … … 188 188 ')'; 189 189 } 190 if ($Filter['State'] == CompletionState::All) {190 if ($Filter['State'] == CompletionState::All) { 191 191 $Filter['SQL'] .= $UserFilter.$VersionFilter; 192 192 } else 193 if ($Filter['State'] == CompletionState::NotTranslated) {193 if ($Filter['State'] == CompletionState::NotTranslated) { 194 194 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 195 195 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. … … 198 198 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; 199 199 } else 200 if ($Filter['State'] == CompletionState::Translated) {200 if ($Filter['State'] == CompletionState::Translated) { 201 201 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)'; 202 202 } else 203 if ($Filter['State'] == CompletionState::NotFinished) {203 if ($Filter['State'] == CompletionState::NotFinished) { 204 204 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 205 205 ') AND (`T`.`Complete` = 0)'; 206 206 } else 207 if ($Filter['State'] == CompletionState::Original) {207 if ($Filter['State'] == CompletionState::Original) { 208 208 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')'; 209 209 } else 210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) {210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) { 211 211 $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 212 212 ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 213 213 ') AND (`T`.`Complete` = 0)'; 214 214 } else 215 if ($Filter['State'] == CompletionState::Missing1) {215 if ($Filter['State'] == CompletionState::Missing1) { 216 216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 217 217 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 218 218 } else 219 if ($Filter['State'] == CompletionState::Missing2) {219 if ($Filter['State'] == CompletionState::Missing2) { 220 220 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 221 221 $Filter['SQL'] .= ' '. $WithoutAlter; … … 226 226 /* 227 227 // Ownership 228 if (array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner'];228 if (array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner']; 229 229 else $Filter['Owner'] = 0; 230 230 $Output .= ' <td><select name="owner">'; 231 if ($Filter['Owner'] == 0) $Selected = ' selected="selected"';231 if ($Filter['Owner'] == 0) $Selected = ' selected="selected"'; 232 232 else $Selected = ''; 233 233 $Output .= '<option value="0"'.$Selected.'>Všech</option>'; 234 if ($Filter['Owner'] == 1) $Selected = ' selected="selected"';234 if ($Filter['Owner'] == 1) $Selected = ' selected="selected"'; 235 235 else $Selected = ''; 236 236 $Output .= '<option value="1"'.$Selected.'>Překladatelův tým</option>'; 237 if ($Filter['Owner'] == 2) $Selected = ' selected="selected"';237 if ($Filter['Owner'] == 2) $Selected = ' selected="selected"'; 238 238 else $Selected = ''; 239 239 $Output .= '<option value="2"'.$Selected.'>Překladatele</option>'; 240 240 $Output .= '</select></td>'; 241 if (($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')';241 if (($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')'; 242 242 */ 243 243 … … 246 246 $Output .= '</form><br/>'; 247 247 $Filter['Output'] = $Output; 248 return ($Filter);248 return $Filter; 249 249 } 250 250 … … 289 289 290 290 $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 291 while ($Line = $DbResult->fetch_assoc())291 while ($Line = $DbResult->fetch_assoc()) 292 292 { 293 293 $Output .= '<tr><td><a href="'.$this->System->Link('/form.php?group='.$Filter['Group'].'&ID='.$Line['ID']).'">'.$Line['ID'].'</a></td>'. … … 305 305 $Output .= '</table>'. 306 306 $PageList['Output']; 307 return ($Output);307 return $Output; 308 308 } 309 309 … … 316 316 $Output .= '<table class="BaseTable"><tr><th>'.T('Group').'</th><th>'.T('Count').'</th></tr>'; 317 317 $Total = 0; 318 foreach ($TranslationTree as $Group)319 if ($Group['TablePrefix'] != '')318 foreach ($TranslationTree as $Group) 319 if ($Group['TablePrefix'] != '') 320 320 { 321 321 $Filter = $this->ShowFilter($Group['Id']); … … 328 328 $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'. 329 329 '</table>'; 330 return ($Output);330 return $Output; 331 331 } 332 332 … … 336 336 337 337 $GroupId = GetParameter('group', 0, true); 338 if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL);338 if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL); 339 339 else { 340 340 $Table = $TranslationTree[$GroupId]['TablePrefix']; … … 351 351 '<td>'.T('Texts marked as unfinished').'</td></tr>'; 352 352 353 if ($this->System->User->Licence(LICENCE_USER))353 if ($this->System->User->Licence(LICENCE_USER)) 354 354 { 355 355 $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&state=3&user='.$this->System->User->Id.'">'.T('My unfinished').'</a></td> … … 373 373 $Output .= '</table>'; 374 374 } 375 return ($Output);375 return $Output; 376 376 } 377 377 … … 380 380 $this->Title = T('Translation groups'); 381 381 $Action = GetParameter('action', ''); 382 if ($Action == 'filter') $Output = $this->ShowMenu();382 if ($Action == 'filter') $Output = $this->ShowMenu(); 383 383 else 384 384 { 385 385 $Filter = $this->ShowFilter(); 386 if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);386 if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter); 387 387 else $Output = $this->ShowGroupList($Filter); 388 388 } 389 return ($Output);389 return $Output; 390 390 } 391 391 } … … 409 409 array('Name' => 'LastVersion', 'Title' => T('Version of last import')), 410 410 ); 411 if ($this->System->User->Licence(LICENCE_ADMIN))411 if ($this->System->User->Licence(LICENCE_ADMIN)) 412 412 $TableColumns[] = array('Name' => '', 'Title' => T('Actions')); 413 413 … … 416 416 417 417 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 418 while ($Group = $DbResult->fetch_assoc())418 while ($Group = $DbResult->fetch_assoc()) 419 419 { 420 420 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.T($Group['Name']).'</a></td>'. 421 421 '<td>'.$Group['SourceType'].'</td><td>'; 422 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';423 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';424 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';422 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql '; 423 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc '; 424 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua '; 425 425 $Output .= '</td>'; 426 if ($this->System->User->Licence(LICENCE_ADMIN))426 if ($this->System->User->Licence(LICENCE_ADMIN)) 427 427 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='. 428 428 $Group['Id'].'&type=11').'">'.HumanDate($Group['LastImport']).'</a></td>'; … … 430 430 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='. 431 431 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>'; 432 if ($this->System->User->Licence(LICENCE_ADMIN))432 if ($this->System->User->Licence(LICENCE_ADMIN)) 433 433 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">'.T('Remove').'</a></td>'; 434 434 $Output .= '</tr>'; … … 436 436 $Output .= '</table>'. 437 437 '<br /><a title="'.T('Changelog of changes after import').'" href="'.$this->System->Link('/log/?type=11').'">'.T('Changelog of text modification during import').'</a><br/>'; 438 if ($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';439 return ($Output);438 if ($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>'; 439 return $Output; 440 440 } 441 441 442 442 function ShowGroupAdd() 443 443 { 444 if ($this->System->User->Licence(LICENCE_ADMIN))444 if ($this->System->User->Licence(LICENCE_ADMIN)) 445 445 { 446 446 $Output = '<h3>Vložení nové překladové skupiny</h3>'. … … 452 452 '</table></form>'; 453 453 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 454 return ($Output);454 return $Output; 455 455 } 456 456 457 457 function ShowGroupAddFinish() 458 458 { 459 if ($this->System->User->Licence(LICENCE_ADMIN))459 if ($this->System->User->Licence(LICENCE_ADMIN)) 460 460 { 461 461 $TableName = 'Text'.$_POST['TablePrefix']; 462 462 $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"'); 463 if ($DbResult->num_rows == 0)463 if ($DbResult->num_rows == 0) 464 464 { 465 465 … … 500 500 $Output .= $this->ShowList(); 501 501 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 502 return ($Output);502 return $Output; 503 503 } 504 504 505 505 function ShowGroupDelete() 506 506 { 507 if ($this->System->User->Licence(LICENCE_ADMIN))507 if ($this->System->User->Licence(LICENCE_ADMIN)) 508 508 { 509 509 $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']); 510 if ($DbResult->num_rows == 1)510 if ($DbResult->num_rows == 1) 511 511 { 512 512 $Group = $DbResult->fetch_assoc(); … … 518 518 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 519 519 $Output .= $this->ShowList(); 520 return ($Output);520 return $Output; 521 521 } 522 522 … … 525 525 $this->Title = T('Translation groups'); 526 526 $Action = GetParameter('action', ''); 527 if ($Action == 'groupadd') $Output = $this->ShowGroupAdd();528 else if ($Action == 'groupdelete') $Output = $this->ShowGroupDelete();529 else if ($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish();527 if ($Action == 'groupadd') $Output = $this->ShowGroupAdd(); 528 else if ($Action == 'groupdelete') $Output = $this->ShowGroupDelete(); 529 else if ($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish(); 530 530 else $Output = $this->ShowList(); 531 return ($Output);531 return $Output; 532 532 } 533 533 } -
trunk/Modules/Translation/UserLevel.php
r859 r880 11 11 $Diakrit = array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú", 12 12 "ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž"); 13 for ($i = 0; $i < count($Diakrit); $i = $i + 1)13 for ($i = 0; $i < count($Diakrit); $i = $i + 1) 14 14 { 15 if (strpos($Word, $Diakrit[$i]) <> false)15 if (strpos($Word, $Diakrit[$i]) <> false) 16 16 $Result = true; 17 17 } 18 return ($Result);18 return $Result; 19 19 } 20 20 … … 26 26 27 27 $xp = 0; 28 foreach ($TranslationTree as $Group)28 foreach ($TranslationTree as $Group) 29 29 { 30 if ($Group['TablePrefix'] != '')30 if ($Group['TablePrefix'] != '') 31 31 { 32 32 $GroupBy = 'GROUP BY '; 33 33 $TakeColumns = ''; 34 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)34 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 35 35 { 36 36 $GroupBy .= '`T`.`'.$TextItem['Column'].'`, '; … … 42 42 'LEFT JOIN `'.$Group['TablePrefix'].'` AS `T2` ON `T2`.`ID` = `T`.`Take` '. 43 43 'WHERE (`T`.`User` = '.$UserId.') AND (`T`.`Complete` = 1) AND (`T`.`Take` IS NOT NULL) '.$GroupBy); 44 while ($Line = $IDtran->fetch_array())44 while ($Line = $IDtran->fetch_array()) 45 45 { 46 46 $xp_translation = 0; 47 47 $translated = true; 48 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)48 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 49 49 { 50 if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and50 if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and 51 51 (strlen($Line[$TextItem['Column']]) > (strlen($Line[$TextItem['Column'].'_Take']) * 0.5))) 52 52 { 53 53 $TextArr = explode(' ', $Line[$TextItem['Column']]); 54 foreach ($TextArr as $Word)54 foreach ($TextArr as $Word) 55 55 { 56 if (CheckDiakrit($Word)) $indikator = $from_diakrit;56 if (CheckDiakrit($Word)) $indikator = $from_diakrit; 57 57 else $indikator = 1; 58 58 $xp_translation = $xp_translation + ($indikator * $xp_from_word); … … 65 65 } 66 66 } 67 if ($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated67 if ($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated 68 68 } 69 69 } 70 70 } 71 return ($xp);71 return $xp; 72 72 } 73 73 … … 79 79 // Main code for users 80 80 $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `Id` = '.$UserId); 81 if ($DbResult->num_rows > 0)81 if ($DbResult->num_rows > 0) 82 82 { 83 while ($LineUser = $DbResult->fetch_array())83 while ($LineUser = $DbResult->fetch_array()) 84 84 { 85 85 // Build TranslatedCount query 86 86 $TranslatedCount = '('; 87 if (count($TranslationTree) > 0)87 if (count($TranslationTree) > 0) 88 88 { 89 foreach ($TranslationTree as $Group)90 if ($Group['TablePrefix'] != '')89 foreach ($TranslationTree as $Group) 90 if ($Group['TablePrefix'] != '') 91 91 { 92 92 $Count = '(SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`Language` <> '. -
trunk/Modules/User/Options.php
r861 r880 17 17 '<option value="0">'.T('Nowhere').'</option>'. 18 18 '<option value="1"'; 19 if ($this->System->User->Redirecting == '1') $Output .= ' selected="selected"';19 if ($this->System->User->Redirecting == '1') $Output .= ' selected="selected"'; 20 20 $Output .= '>'.T('To untranslated').'</option>'; 21 21 $Output .= '<option value="2"'; 22 if ($this->System->User->Redirecting == '2') $Output .= ' selected="selected"';22 if ($this->System->User->Redirecting == '2') $Output .= ' selected="selected"'; 23 23 $Output .= '>'.T('To next translation').'</option>'; 24 24 $Output .= '<option value="3"'; 25 if ($this->System->User->Redirecting == '3') $Output .= ' selected="selected"';25 if ($this->System->User->Redirecting == '3') $Output .= ' selected="selected"'; 26 26 $Output .= '>'.T('To previous translation').'</option>'; 27 27 $Output .= '</select>'; … … 60 60 '<input type="hidden" name="action" value="gointeam"/>'. 61 61 '<select name="id">'; 62 while ($LineTeam = $DbResult->fetch_assoc())62 while ($LineTeam = $DbResult->fetch_assoc()) 63 63 { 64 64 $Output .= '<option value="'.$LineTeam['Id'].'"'; … … 69 69 </form>'; 70 70 $Output .= '</fieldset>'; 71 return ($Output);71 return $Output; 72 72 } 73 73 … … 75 75 { 76 76 $Output = ''; 77 if (array_key_exists('Email', $_POST))77 if (array_key_exists('Email', $_POST)) 78 78 { 79 79 $Email = $_POST['Email']; … … 84 84 $Redirecting = $_POST['redirecting']; 85 85 $PreferredVersion = $_POST['ClientVersion']; 86 if ($PreferredVersion == '') $PreferredVersion = null;86 if ($PreferredVersion == '') $PreferredVersion = null; 87 87 $Info = $_POST['info']; 88 88 89 89 // Do user want to change password? 90 if (($OldPass != '') or ($NewPass != '') or ($NewPass2 != ''))90 if (($OldPass != '') or ($NewPass != '') or ($NewPass2 != '')) 91 91 { 92 if ($NewPass == $NewPass2)92 if ($NewPass == $NewPass2) 93 93 { 94 94 $DbResult = $this->System->Database->query('SELECT `Pass`, '.$this->System->User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$this->System->User->Id); 95 95 $DbRow = $DbResult->fetch_assoc(); 96 if ($DbRow['Hash'] == $DbRow['Pass'])96 if ($DbRow['Hash'] == $DbRow['Pass']) 97 97 { 98 98 // Update password … … 130 130 $this->System->User->Load(); 131 131 } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL); 132 return ($Output);132 return $Output; 133 133 } 134 134 … … 137 137 $this->Title = T('User settings'); 138 138 $Output = ''; 139 if ($this->System->User->Licence(LICENCE_USER))139 if ($this->System->User->Licence(LICENCE_USER)) 140 140 { 141 if (array_key_exists('action', $_GET) and ($_GET['action'] == 'save'))141 if (array_key_exists('action', $_GET) and ($_GET['action'] == 'save')) 142 142 { 143 143 $Output .= $this->UserOptionsSave(); … … 145 145 $Output .= $this->UserOptionsFrom(); 146 146 } else $Output .= ShowMessage('Nejste přihlášený.', MESSAGE_CRITICAL); 147 return ($Output);147 return $Output; 148 148 } 149 149 } -
trunk/Modules/User/Profile.php
r861 r880 6 6 { 7 7 $Output = ''; 8 if (array_key_exists('text', $_POST))9 if ($this->System->User->Licence(LICENCE_ADMIN))8 if (array_key_exists('text', $_POST)) 9 if ($this->System->User->Licence(LICENCE_ADMIN)) 10 10 { 11 11 $Text = $_POST['text']; … … 16 16 'Text: <strong>'.$Text.'</strong><br />'; 17 17 18 if (@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail'].18 if (@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail']. 19 19 '\nReply-To: '.$this->System->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/')) 20 20 { … … 23 23 else $Output .= ShowMessage('Nepodařilo se odesat E-mail.', MESSAGE_CRITICAL); 24 24 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 25 return ($Output);25 return $Output; 26 26 } 27 27 … … 57 57 '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '. 58 58 'LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']); 59 while ($Export = $DbResult->fetch_assoc())59 while ($Export = $DbResult->fetch_assoc()) 60 60 { 61 61 $Action = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Export['Id'].'&Tab=0').'">'.T('Show').'</a> '. 62 62 '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Export['Id'].'&Tab=7').'">'.T('Export').'</a>'; 63 if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Really remove item?').'\');">'.T('Remove').'</a>';64 if ($this->System->User->Id != null) $Action .= ' <a href="'.$this->System->Link('/export/?Action=Clone&ExportId='.$Export['Id']).'" onclick="return confirmAction(\''.T('Really clone item?').'\');">'.T('Clone').'</a>';63 if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Really remove item?').'\');">'.T('Remove').'</a>'; 64 if ($this->System->User->Id != null) $Action .= ' <a href="'.$this->System->Link('/export/?Action=Clone&ExportId='.$Export['Id']).'" onclick="return confirmAction(\''.T('Really clone item?').'\');">'.T('Clone').'</a>'; 65 65 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 66 66 '<td>'.htmlspecialchars($Export['Title']).'</td>'. … … 74 74 75 75 $Output .= '<div style="text-align: center;"><a href="'.$this->System->Link('/export/').'">'.T('Export page').'</a></div>'; 76 return ($Output);76 return $Output; 77 77 } 78 78 … … 86 86 $UnionItems = array(); 87 87 $DbResult = $this->Database->query($GroupListQuery); 88 if ($DbResult->num_rows > 0)89 { 90 while ($DbRow = $DbResult->fetch_assoc())88 if ($DbResult->num_rows > 0) 89 { 90 while ($DbRow = $DbResult->fetch_assoc()) 91 91 { 92 92 $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '. … … 106 106 $Output .= '<table class="BaseTable"><tr>'. 107 107 '<th>'.T('Date').'</th><th>'.T('New').'</th><th>'.T('Source').'</th><th>'.T('Group').'</th></tr>'; 108 while ($DbRow = $DbResult->fetch_assoc())108 while ($DbRow = $DbResult->fetch_assoc()) 109 109 { 110 110 $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'. … … 115 115 $Output .= '</table>'; 116 116 } 117 return ($Output);117 return $Output; 118 118 } 119 119 … … 130 130 'JOIN `ForumThread` ON `ForumThread`.`ID` = `ForumText`.`Thread` '. 131 131 'WHERE `ForumText`.`User` = '.($_GET['user'] * 1).' ORDER BY `ForumText`.`Date` DESC LIMIT '.$Count); 132 while ($Line = $DbResult->fetch_assoc())132 while ($Line = $DbResult->fetch_assoc()) 133 133 $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'.htmlspecialchars($Line['ThreadName']).'</a><br />'. 134 134 '<strong>'.$Line['UserName'].'</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse(htmlspecialchars($Line['Text'])).'</div> '; 135 135 $Output .= '</div>'; 136 return ($Output);136 return $Output; 137 137 } 138 138 … … 151 151 'WHERE `User`.`Id` = '.($_GET['user'] * 1); 152 152 $DbResult = $this->Database->query($Query); 153 if ($DbResult->num_rows > 0)153 if ($DbResult->num_rows > 0) 154 154 { 155 155 $UserLine = $DbResult->fetch_array(); … … 163 163 T('Number of translated:').' <a href="'.$this->System->Link('/TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0').'" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />'. 164 164 T('Level:').' <strong>'.$XP['Level'].'</strong> '.T('experience:').' '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br/>'; 165 if ($this->System->ModuleManager->ModuleRunning('Team') and ($UserLine['TeamName'] != ''))165 if ($this->System->ModuleManager->ModuleRunning('Team') and ($UserLine['TeamName'] != '')) 166 166 $Output .= T('Member of team:').' <a href="'.$this->System->Link('/team/?action=team&id='.$UserLine['Team']).'"><strong>'.htmlspecialchars($UserLine['TeamName']).'</strong></a><br />'; 167 167 … … 187 187 '</tr></table>'; 188 188 $Output .= '<br />'.$this->ShowLastForum().'<br />'; 189 if ($this->System->User->Licence(LICENCE_MODERATOR))189 if ($this->System->User->Licence(LICENCE_MODERATOR)) 190 190 { 191 191 $Output .= '<fieldset><legend>Moderování</legend>'; … … 243 243 } 244 244 } else $Output .= ShowMessage('Uživatel nenalezen', MESSAGE_CRITICAL); 245 return ($Output);245 return $Output; 246 246 } 247 247 … … 250 250 $this->Title = T('User profile'); 251 251 $Output = $this->SendMail(); 252 if (array_key_exists('user', $_GET))252 if (array_key_exists('user', $_GET)) 253 253 { 254 254 $Output .= $this->ShowProfile(); 255 255 } else $Output .= ShowMessage('Nevybrán uživatel', MESSAGE_CRITICAL); 256 return ($Output);256 return $Output; 257 257 } 258 258 } -
trunk/Modules/User/Registration.php
r861 r880 5 5 function ShowForm() 6 6 { 7 if (array_key_exists('sc', $_POST)) $Human = true;7 if (array_key_exists('sc', $_POST)) $Human = true; 8 8 else $Human = false; 9 if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];9 if (array_key_exists('user', $_POST)) $UserName = $_POST['user']; 10 10 else $UserName = ''; 11 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];11 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 12 12 else $Email = ''; 13 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'];13 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team']; 14 14 else $Team = ''; 15 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'];15 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language']; 16 16 else $Language = 1; 17 17 … … 24 24 <tr> 25 25 <th class="Left">'.T('Are you human?').'</th>'; 26 if ($Human) $Checked = ' checked="checked"';26 if ($Human) $Checked = ' checked="checked"'; 27 27 else $Checked = ''; 28 28 $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td> … … 50 50 <tr> 51 51 <th class="Left">'.T('I belong to team').':</th>'; 52 if ($Team == '') $Selected = ' selected="selected"';52 if ($Team == '') $Selected = ' selected="selected"'; 53 53 else $Selected = ''; 54 54 $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>'.T('none').'</option>'; 55 55 $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`'); 56 while ($Line = $DbResult->fetch_assoc())56 while ($Line = $DbResult->fetch_assoc()) 57 57 { 58 if ($Team == $Line['Id']) $Selected = ' selected="selected"';58 if ($Team == $Line['Id']) $Selected = ' selected="selected"'; 59 59 else $Selected = ''; 60 60 $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.htmlspecialchars($Line['Name']).'</option>'; … … 81 81 </tr> 82 82 </table></fieldset></form>'; 83 return ($Output);83 return $Output; 84 84 } 85 85 … … 91 91 $ShowForm = true; 92 92 93 if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];93 if (array_key_exists('user', $_POST)) $UserName = $_POST['user']; 94 94 else $UserName = ''; 95 if (array_key_exists('pass', $_POST)) $Pass = $_POST['pass'];95 if (array_key_exists('pass', $_POST)) $Pass = $_POST['pass']; 96 96 else $Pass = ''; 97 if (array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2'];97 if (array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2']; 98 98 else $Pass2 = ''; 99 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];99 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 100 100 else $Email = ''; 101 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1;101 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1; 102 102 else $Team = ''; 103 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1;103 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1; 104 104 else $Language = ''; 105 if (array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1;105 if (array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1; 106 106 else $PreferredVersion = ''; 107 if ($PreferredVersion == '') $PreferredVersion = 'NULL';108 if (array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc'];107 if ($PreferredVersion == '') $PreferredVersion = 'NULL'; 108 if (array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc']; 109 109 else $SpamCheck = ''; 110 110 111 if ($SpamCheck != '')111 if ($SpamCheck != '') 112 112 { 113 if (($UserName != '') and ($Pass != '') and ($Pass2 != ''))113 if (($UserName != '') and ($Pass != '') and ($Pass2 != '')) 114 114 { 115 if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))115 if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames'])) 116 116 { 117 if ($Pass == $Pass2)117 if ($Pass == $Pass2) 118 118 { 119 119 $DbResult = $this->Database->query('SELECT * FROM `User` WHERE LOWER(`Name`) = LOWER("'.$UserName.'")'); 120 120 $Line = $DbResult->fetch_row(); 121 if (!$Line)121 if (!$Line) 122 122 { 123 if ($Team == 0) $Team = 'NULL';123 if ($Team == 0) $Team = 'NULL'; 124 124 $this->System->User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion); 125 125 $Output .= ShowMessage(T('Registration was successful')); … … 154 154 } else $Output = ShowMessage('Nejsi člověk. Strojům není dovoleno se registrovat.', MESSAGE_CRITICAL); 155 155 156 if ($ShowForm) $Output .= $this->ShowForm();157 return ($Output);156 if ($ShowForm) $Output .= $this->ShowForm(); 157 return $Output; 158 158 } 159 159 … … 162 162 $this->Title = T('User registration'); 163 163 $Output = ''; 164 if (array_key_exists('user', $_POST))164 if (array_key_exists('user', $_POST)) 165 165 { 166 166 $Output .= $this->CheckRegistration(); 167 167 } else $Output .= $this->ShowForm(); 168 return ($Output);168 return $Output; 169 169 } 170 170 } -
trunk/Modules/User/User.php
r871 r880 34 34 'Icon' => '', 35 35 ), 0); 36 if (array_key_exists('Search', $this->System->ModuleManager->Modules))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('/users/?search=')); … … 49 49 'WHERE (`ActivityTime` >= NOW() - 300) '. 50 50 'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`'); 51 while ($DbUser = $DbResult->fetch_assoc())51 while ($DbUser = $DbResult->fetch_assoc()) 52 52 { 53 53 $Name = '<a href="'.$this->System->Link('/user/?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>'; 54 54 $Output .= $Name.'<br />'; 55 55 } 56 return ($Output);56 return $Output; 57 57 } 58 58 … … 60 60 { 61 61 $Output = ''; 62 if ($this->System->User->Licence(LICENCE_USER))62 if ($this->System->User->Licence(LICENCE_USER)) 63 63 { 64 64 //$DbResult =$this->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team); … … 79 79 '<a href="'.$this->System->Link('/registration/').'">'.T('Registration').'</a>'; 80 80 } 81 return ($Output);81 return $Output; 82 82 } 83 83 } … … 104 104 </table> 105 105 </fieldset></form>'; 106 return ($Output);106 return $Output; 107 107 } 108 108 } … … 132 132 $this->Database = &$System->Database; 133 133 $this->OnlineStateTimeout = 600; // in seconds 134 if (isset($_SESSION)) $this->Check();134 if (isset($_SESSION)) $this->Check(); 135 135 } 136 136 … … 144 144 $DbResult = $this->Database->query('SELECT `ID` FROM `User` WHERE '. 145 145 'LOWER(`Name`) = LOWER("'.$Name.'") AND `Pass` = '.$this->CryptPasswordSQL('"'.$Password.'"', '`Salt`')); 146 if ($DbResult->num_rows > 0)146 if ($DbResult->num_rows > 0) 147 147 { 148 148 $User = $DbResult->fetch_assoc(); … … 151 151 // Prepare cookies for permanent login 152 152 $StayLoggedSalt = $this->GetPasswordSalt(); 153 if ($StayLogged == true) $StayLoggedValue = 1; else $StayLoggedValue = 0;153 if ($StayLogged == true) $StayLoggedValue = 1; else $StayLoggedValue = 0; 154 154 $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array( 155 155 'User' => $User['ID'], 'StayLogged' => $StayLoggedValue, 'StayLoggedHash' => $StayLoggedSalt)); 156 if ($StayLogged)156 if ($StayLogged) 157 157 { 158 158 setcookie('LoginUserId', $User['ID'], time() + 365 * 24 * 60 * 60); … … 176 176 { 177 177 $SID = session_id(); 178 if ($this->Role != LICENCE_ANONYMOUS)178 if ($this->Role != LICENCE_ANONYMOUS) 179 179 { 180 180 $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array('User' => null)); … … 192 192 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `User`.`PreferredVersion` '. 193 193 'WHERE `User`.`ID` = '.$this->Id); 194 if ($DbResult->num_rows > 0)194 if ($DbResult->num_rows > 0) 195 195 { 196 196 $User = $DbResult->fetch_assoc(); … … 222 222 function Licence($Licence) 223 223 { 224 if (GetRemoteAddress() == '') return(true); // Execution from command line225 else return ($this->Role >= $Licence);224 if (GetRemoteAddress() == '') return true; // Execution from command line 225 else return $this->Role >= $Licence; 226 226 } 227 227 … … 229 229 { 230 230 $DbResult = $this->Database->select('APIToken', 'User', '`Token`="'.$Token.'"'); 231 if ($DbResult->num_rows > 0)231 if ($DbResult->num_rows > 0) 232 232 { 233 233 $DbRow = $DbResult->fetch_assoc(); 234 234 $DbResult2 = $this->Database->select('User', 'GM', '`ID`="'.$DbRow['User'].'"'); 235 235 $DbRow2 = $DbResult2->fetch_assoc(); 236 return ($DbRow2['GM'] >= $Licence);237 } else return (false);236 return $DbRow2['GM'] >= $Licence; 237 } else return false; 238 238 } 239 239 240 240 function GetPasswordSalt() 241 241 { 242 return (substr(sha1(mt_rand()), 0, 8));242 return substr(sha1(mt_rand()), 0, 8); 243 243 } 244 244 245 245 function CryptPasswordSQL($Password, $Salt) 246 246 { 247 return ('SHA1(CONCAT(SHA1('.$Password.'), '.$Salt.'))');247 return 'SHA1(CONCAT(SHA1('.$Password.'), '.$Salt.'))'; 248 248 } 249 249 … … 253 253 // Lookup user record 254 254 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 255 if ($Query->num_rows > 0)255 if ($Query->num_rows > 0) 256 256 { 257 257 // Refresh time of last access 258 258 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 259 259 } else { 260 if (GetRemoteAddress() != '') $HostName = gethostbyaddr(GetRemoteAddress());260 if (GetRemoteAddress() != '') $HostName = gethostbyaddr(GetRemoteAddress()); 261 261 else $HostName = ''; 262 262 $this->Database->insert('UserOnline', array('SessionId' => $SID, … … 267 267 268 268 // Logged permanently? 269 if (array_key_exists('LoginHash', $_COOKIE))269 if (array_key_exists('LoginHash', $_COOKIE)) 270 270 { 271 271 $DbResult = $this->Database->query('SELECT * FROM `UserOnline` WHERE `User`='.$_COOKIE['LoginUserId']. 272 272 ' AND `StayLogged`=1 AND SessionId!="'.$SID.'"'); 273 if ($DbResult->num_rows > 0)273 if ($DbResult->num_rows > 0) 274 274 { 275 275 $DbRow = $DbResult->fetch_assoc(); 276 if (sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash'])276 if (sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash']) 277 277 { 278 278 $this->Database->query('DELETE FROM `UserOnline` WHERE `SessionId`="'.$SID.'"'); … … 285 285 $Query = $this->Database->select('UserOnline', '*', '`SessionId`="'.$SID.'"'); 286 286 $Row = $Query->fetch_assoc(); 287 if ($Row['User'] != '')287 if ($Row['User'] != '') 288 288 { 289 289 $this->Id = $Row['User']; … … 296 296 // Remove nonactive users 297 297 $DbResult = $this->Database->select('UserOnline', '`Id`, `User`', '(`ActivityTime` < DATE_SUB(NOW(), INTERVAL '.$this->OnlineStateTimeout.' SECOND)) AND (`StayLogged` = 0)'); 298 while ($DbRow = $DbResult->fetch_array())298 while ($DbRow = $DbResult->fetch_array()) 299 299 { 300 300 $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']); … … 305 305 { 306 306 $Salt = $this->GetPasswordSalt(); 307 if ($Team == null) $Team = 'NULL';308 if ($PreferredVersion == null) $PreferredVersion = 'NULL';307 if ($Team == null) $Team = 'NULL'; 308 if ($PreferredVersion == null) $PreferredVersion = 'NULL'; 309 309 $this->Database->query('INSERT INTO `User` '. 310 310 '(`Name` , `Pass` , `Salt`, `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime`, `PreferredVersion` ) '. -
trunk/Modules/User/UserList.php
r851 r880 7 7 $this->Title = T('Translators'); 8 8 $Output = ''; 9 if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];10 else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';11 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';12 if ($_SESSION['search'] != '')9 if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 10 else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 11 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 12 if ($_SESSION['search'] != '') 13 13 { 14 14 $SearchQuery = ' AND (`User`.`Name` LIKE "%'.$_SESSION['search'].'%")'; … … 17 17 18 18 $TeamFilter = ''; 19 if (array_key_exists('team', $_GET))19 if (array_key_exists('team', $_GET)) 20 20 { 21 21 $TeamId = $_GET['team'] * 1; 22 22 $DbResult = $this->Database->select('Team', 'Name', '`Id`='.$TeamId); 23 if ($DbResult->num_rows > 0)23 if ($DbResult->num_rows > 0) 24 24 { 25 25 $Team = $DbResult->fetch_assoc(); … … 58 58 59 59 $DbResult = $this->Database->query($Query); 60 while ($Line = $DbResult->fetch_assoc())60 while ($Line = $DbResult->fetch_assoc()) 61 61 { 62 62 $XP = GetLevelMinMax($Line['XP']); … … 71 71 $PageList['Output']; 72 72 73 return ($Output);73 return $Output; 74 74 } 75 75 } -
trunk/Modules/Wiki/Wiki.php
r843 r880 22 22 { 23 23 $DbResult = $this->Database->select('WikiPage', '*', '`VisibleInMenu`=1'); 24 while ($DbRow = $DbResult->fetch_assoc())24 while ($DbRow = $DbResult->fetch_assoc()) 25 25 { 26 26 $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki'); … … 40 40 function Show() 41 41 { 42 if (array_key_exists('Action', $_GET))43 { 44 if ($_GET['Action'] == 'Edit') $Output = $this->EditContent();45 else if ($_GET['Action'] == 'EditSave') $Output = $this->SaveContent();46 else if ($_GET['Action'] == 'History') $Output = $this->ShowHistory();42 if (array_key_exists('Action', $_GET)) 43 { 44 if ($_GET['Action'] == 'Edit') $Output = $this->EditContent(); 45 else if ($_GET['Action'] == 'EditSave') $Output = $this->SaveContent(); 46 else if ($_GET['Action'] == 'History') $Output = $this->ShowHistory(); 47 47 else $Output = $this->ShowContent(); 48 48 } else $Output = $this->ShowContent(); 49 return ($Output);49 return $Output; 50 50 } 51 51 … … 54 54 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 55 55 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 56 if ($DbResult->num_rows > 0)56 if ($DbResult->num_rows > 0) 57 57 { 58 58 $DbRow = $DbResult->fetch_assoc(); 59 if (array_key_exists('ver', $_GET))59 if (array_key_exists('ver', $_GET)) 60 60 { 61 61 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$_GET['ver']*1); 62 if ($DbResult2->num_rows > 0)62 if ($DbResult2->num_rows > 0) 63 63 { 64 64 $DbRow2 = $DbResult2->fetch_assoc(); 65 65 $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>'; 66 66 $Output .= $DbRow2['Content']; 67 if ($this->System->User->Licence(LICENCE_MODERATOR))67 if ($this->System->User->Licence(LICENCE_MODERATOR)) 68 68 $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>'; 69 69 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); … … 71 71 { 72 72 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1'); 73 if ($DbResult2->num_rows > 0)73 if ($DbResult2->num_rows > 0) 74 74 { 75 75 $DbRow2 = $DbResult2->fetch_assoc(); 76 76 $Output = '<h3>'.$DbRow['Name'].'</h3>'; 77 77 $Output .= $DbRow2['Content']; 78 if ($this->System->User->Licence(LICENCE_MODERATOR))78 if ($this->System->User->Licence(LICENCE_MODERATOR)) 79 79 $Output .= '<hr><div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>'; 80 80 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 81 81 } 82 82 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 83 return ($Output);83 return $Output; 84 84 } 85 85 86 86 function EditContent() 87 87 { 88 if ($this->System->User->Licence(LICENCE_MODERATOR))88 if ($this->System->User->Licence(LICENCE_MODERATOR)) 89 89 { 90 90 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 91 91 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 92 if ($DbResult->num_rows > 0)92 if ($DbResult->num_rows > 0) 93 93 { 94 94 $DbRow = $DbResult->fetch_assoc(); 95 95 $Output = '<h3>Úprava '.$DbRow['Name'].'</h3>'; 96 96 $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1'); 97 if ($DbResult2->num_rows > 0)97 if ($DbResult2->num_rows > 0) 98 98 { 99 99 $DbRow2 = $DbResult2->fetch_assoc(); … … 106 106 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 107 107 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 108 return ($Output);108 return $Output; 109 109 } 110 110 111 111 function SaveContent() 112 112 { 113 if ($this->System->User->Licence(LICENCE_MODERATOR))113 if ($this->System->User->Licence(LICENCE_MODERATOR)) 114 114 { 115 115 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 116 116 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 117 if ($DbResult->num_rows > 0)117 if ($DbResult->num_rows > 0) 118 118 { 119 119 $DbRow = $DbResult->fetch_assoc(); 120 if (array_key_exists('content', $_POST) and array_key_exists('save', $_POST))120 if (array_key_exists('content', $_POST) and array_key_exists('save', $_POST)) 121 121 { 122 122 $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']), … … 127 127 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 128 128 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 129 return ($Output);129 return $Output; 130 130 } 131 131 132 132 function ShowHistory() 133 133 { 134 if ($this->System->User->Licence(LICENCE_MODERATOR))134 if ($this->System->User->Licence(LICENCE_MODERATOR)) 135 135 { 136 136 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 137 137 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 138 if ($DbResult->num_rows > 0)138 if ($DbResult->num_rows > 0) 139 139 { 140 140 $DbRow = $DbResult->fetch_assoc(); … … 160 160 ' FROM `WikiPageContent` WHERE Page='. 161 161 $DbRow['Id'].' '.$Order['SQL'].$PageList['SQLLimit']); 162 while ($PageContent = $DbResult2->fetch_assoc())162 while ($PageContent = $DbResult2->fetch_assoc()) 163 163 { 164 164 $Output .= '<tr>'. … … 173 173 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 174 174 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 175 return ($Output);175 return $Output; 176 176 } 177 177 … … 200 200 $text = str_replace("\r\n", '<br/>', $text); 201 201 $text = '<p>'.$text.'</p>'; 202 return ($text);202 return $text; 203 203 } 204 204 }
Note:
See TracChangeset
for help on using the changeset viewer.