Changeset 893 for trunk/Modules
- Timestamp:
- Mar 6, 2023, 1:48:45 AM (21 months ago)
- Location:
- trunk/Modules
- Files:
-
- 3 added
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Admin/Admin.php
r888 r893 34 34 35 35 $Output .= '<br />'. 36 '<a href="https://'. $this->System->Config['Web']['Host'].'/phpmyadmin/">'.T('Database management').'</a><br/>'.36 '<a href="https://'.Core::Cast($this->System)->Config['Web']['Host'].'/phpmyadmin/">'.T('Database management').'</a><br/>'. 37 37 '<small>Rozhraní phpMyAdmin pro přímou správu databáze</small><br/><br/>'. 38 38 '<a href="'.$this->System->Link('/import/').'">'.T('Text import').'</a><br/>'. … … 114 114 function RepairVersionEnd() 115 115 { 116 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();116 $TranslationTree = ModuleTranslation::Cast($this->System->ModuleManager->GetModule('Translation'))->GetTranslationTree(); 117 117 118 118 $Output = ''; … … 149 149 function MergeSameText() 150 150 { 151 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();151 $TranslationTree = ModuleTranslation::Cast($this->System->ModuleManager->GetModule('Translation'))->GetTranslationTree(); 152 152 153 153 $Output = ''; … … 205 205 function DbcStructure() 206 206 { 207 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();207 $TranslationTree = ModuleTranslation::Cast($this->System->ModuleManager->GetModule('Translation'))->GetTranslationTree(); 208 208 209 209 $Output = ''; … … 213 213 } 214 214 if (!array_key_exists('GameVersion', $_SESSION)) 215 $_SESSION['GameVersion'] = $this->System->Config['Web']['GameVersion'];215 $_SESSION['GameVersion'] = Core::Cast($this->System)->Config['Web']['GameVersion']; 216 216 217 217 $Output .= '<br />Nastavená verze: '.$_SESSION['GameVersion'].'<br />'; … … 295 295 function ShowLocale() 296 296 { 297 $this->System->LocaleManager->UpdateAll(dirname(dirname(__FILE__)));297 Core::Cast($this->System)->LocaleManager->UpdateAll(dirname(dirname(__FILE__))); 298 298 $Output = 'Překlad rozhraní přegenerován'; 299 299 $Output .= '<table class="BaseTable"><tr><th>Originál</th><th>Překlad</th></tr>'; 300 foreach ( $this->System->LocaleManager->CurrentLocale->Texts->Data as $Index => $Item)300 foreach (Core::Cast($this->System)->LocaleManager->CurrentLocale->Texts->Data as $Index => $Item) 301 301 $Output .= '<tr><td>'.$Index.'</td><td>'.$Item.'</td></tr>'; 302 302 $Output .= '</table>'; … … 307 307 function Show(): string 308 308 { 309 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 309 310 $this->Title = T('Administration'); 310 311 $Output = ''; 311 if ($ this->System->User->Licence(LICENCE_ADMIN))312 if ($User->Licence(LICENCE_ADMIN)) 312 313 { 313 314 if (array_key_exists('action', $_GET)) -
trunk/Modules/Dictionary/Dictionary.php
r888 r893 28 28 $this->System->ModuleManager->Modules['Search']->RegisterSearch('dictionary', 29 29 T('Dictionary'), array('Text', 'Description'), 30 '(SELECT * FROM `Dictionary` WHERE `Language` = '. $this->System->Config['OriginalLanguage'].') AS `T`',30 '(SELECT * FROM `Dictionary` WHERE `Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AS `T`', 31 31 $this->System->Link('/dictionary/?search=')); 32 32 } … … 88 88 function DictionaryInsert() 89 89 { 90 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 90 91 $Output = ''; 91 if ($ this->System->User->Licence(LICENCE_USER))92 if ($User->Licence(LICENCE_USER)) 92 93 { 93 94 $Output .= '<form action="?action=save" method="post">'. … … 108 109 function DictionarySave() 109 110 { 110 if ($this->System->User->Licence(LICENCE_USER)) 111 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 112 if ($User->Licence(LICENCE_USER)) 111 113 { 112 114 if (array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST)) … … 114 116 // Check if original text exists and determine entry id 115 117 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '. 116 '`Text` = "'.$_POST['Original'].'" AND `Language`= '. $this->System->Config['OriginalLanguage']);118 '`Text` = "'.$_POST['Original'].'" AND `Language`= '.Core::Cast($this->System)->Config['OriginalLanguage']); 117 119 if ($DbResult->num_rows > 0) 118 120 { … … 125 127 $Entry = $DbRow[0] + 1; 126 128 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 127 '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '. $this->System->Config['OriginalLanguage'].');');129 '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.Core::Cast($this->System)->Config['OriginalLanguage'].');'); 128 130 } 129 131 130 132 $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '. 131 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$ this->System->User->Id);133 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$User->Id); 132 134 if ($DbResult->num_rows > 0) 133 135 { … … 138 140 $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '. 139 141 '`User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'. 140 $_POST['Description'].'", '.$ this->System->User->Id.', '.$_POST['Language'].')');142 $_POST['Description'].'", '.$User->Id.', '.$_POST['Language'].')'); 141 143 $Output = ShowMessage('Záznam byl uložen!'); 142 144 } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL); … … 147 149 function DictionaryRemove() 148 150 { 149 if ($this->System->User->Licence(LICENCE_USER)) 150 { 151 $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 151 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 152 if ($User->Licence(LICENCE_USER)) 153 { 154 $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 152 155 $Output = ShowMessage(T('Record removed')); 153 156 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); … … 157 160 function DictionaryModify() 158 161 { 159 if ($this->System->User->Licence(LICENCE_USER)) 162 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 163 if ($User->Licence(LICENCE_USER)) 160 164 { 161 165 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1)); … … 164 168 $DbRow = $DbResult->fetch_assoc(); 165 169 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) '. 166 'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '. $this->System->Config['OriginalLanguage'].')');170 'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.Core::Cast($this->System)->Config['OriginalLanguage'].')'); 167 171 $DbRow2 = $DbResult->fetch_assoc(); 168 172 $Output = '<form action="?action=save" method="post">'. … … 216 220 function DictionaryShow() 217 221 { 222 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 218 223 global $LanguageList; 219 224 … … 227 232 <input type="text" value="'.$Search.'" name="search" size="30" /> 228 233 <input type="submit" value="'.T('Search').'" />'; 229 if ($ this->System->User->Licence(LICENCE_USER))234 if ($User->Licence(LICENCE_USER)) 230 235 $Output .= ' <a href="?action=insert">'.T('Add word').'</a>'; 231 236 … … 258 263 '`T1`.`Entry`, `T2`.`Text` AS `Original`, `T1`.`Text` AS `Translated`, `T1`.`Description` '. 259 264 'FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` '. 260 'ON (`T2`.`Entry` = `T1`.`Entry`) AND (`T2`.`Language` = '. $this->System->Config['OriginalLanguage'].') '.265 'ON (`T2`.`Entry` = `T1`.`Entry`) AND (`T2`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') '. 261 266 'JOIN `Language` ON `Language`.`Id` = `T1`.`Language` '. 262 267 'JOIN `User` ON `User`.`ID` = `T1`.`User` '. … … 279 284 $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description')); 280 285 $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator')); 281 if ($ this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action'));286 if ($User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action')); 282 287 $Order = GetOrderTableHeader($TableColumns, 'Original'); 283 288 $Output .= '<table class="BaseTable">'.$Order['Output']; … … 294 299 '<td><a href="'.$this->System->Link('/user/?user='.$Line['UserId']).'">'. 295 300 $Line['UserName'].'</a></td>'; 296 if ($ this->System->User->Licence(LICENCE_USER))297 { 298 if ($Line['UserId'] == $ this->System->User->Id)301 if ($User->Licence(LICENCE_USER)) 302 { 303 if ($Line['UserId'] == $User->Id) 299 304 $Output .= '<td><a href="?action=remove&id='.$Line['Id']. 300 305 '" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'. … … 315 320 global $LanguageList; 316 321 322 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 317 323 $this->Title = T('Dictionary'); 318 324 … … 321 327 if (!isset($_SESSION['language'])) 322 328 { 323 if ($ this->System->User->Licence(LICENCE_USER))324 { 325 $_SESSION['language'] = $ this->System->User->Language;329 if ($User->Licence(LICENCE_USER)) 330 { 331 $_SESSION['language'] = $User->Language; 326 332 } else $_SESSION['language'] = ''; 327 333 } -
trunk/Modules/Download/Download.php
r888 r893 112 112 113 113 if ($DbExport['OutputType'] == 10) 114 $filename = $this->System->Config['Web']['TempFolder'].'Export/'.$ExportId.'/'.'Instalace_CzechWoW_'.$DbExport['Version'].'.exe';114 $filename = Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$ExportId.'/'.'Instalace_CzechWoW_'.$DbExport['Version'].'.exe'; 115 115 if ($DbExport['OutputType'] == 7) 116 $filename = $this->System->Config['Web']['TempFolder'].'Export/'.$ExportId.'/'.'CzWoW_Addon-'.$DbExport['Version'].'.zip';116 $filename = Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$ExportId.'/'.'CzWoW_Addon-'.$DbExport['Version'].'.zip'; 117 117 118 118 if ($DbExport['OutputType'] == 10) -
trunk/Modules/Error/Error.php
r888 r893 23 23 function DoStart(): void 24 24 { 25 if (isset( $this->System->Config['Web']['ShowPHPError']))26 $this->ErrorHandler->ShowError = $this->System->Config['Web']['ShowPHPError'];25 if (isset(Core::Cast($this->System)->Config['Web']['ShowPHPError'])) 26 $this->ErrorHandler->ShowError = Core::Cast($this->System)->Config['Web']['ShowPHPError']; 27 27 else $this->ErrorHandler->ShowError = true; 28 28 $this->ErrorHandler->Start(); -
trunk/Modules/Export/CreateAddon.php
r888 r893 5 5 class ExportAddon extends Export 6 6 { 7 8 7 // Replace special codes by lua functions 9 8 function ReplaceVarInText($string, $strlower = 'strlower') 10 9 { 11 12 10 $string = str_replace('$N', '"..'.$strlower.'(UnitName("player")).."', $string); 13 11 $string = str_replace('$n', '"..'.$strlower.'(UnitName("player")).."', $string); … … 149 147 $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '. 150 148 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 151 if ($ID->num_rows > 0) { 149 if ($ID->num_rows > 0) 150 { 152 151 $ExportVersionOld = $ID->fetch_assoc(); 153 152 $ExportVersionOld = $ExportVersionOld['BuildNumber']; … … 164 163 } 165 164 } 166 165 //last version 167 166 168 167 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); … … 177 176 } 178 177 179 foreach ($TableTexts as $key => $value) { 180 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 181 $i++; 178 foreach ($TableTexts as $key => $value) 179 { 180 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 181 $i++; 182 182 } 183 184 183 185 184 $Buffer = $Buffer."\n};if not CZWOW_".$Column['AddonFileName']." then CZWOW_".$Column['AddonFileName']."=0; end; CZWOW_".$Column['AddonFileName']."=CZWOW_".$Column['AddonFileName']."+".$i.";\n"; … … 189 188 } 190 189 } 191 192 190 193 191 // Generete list file of translated … … 195 193 $Buffer = ''; 196 194 foreach ($CreatedFileList as $CreatedFile) 195 { 197 196 $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n"; 197 } 198 198 foreach ($TranslationTree as $Group) 199 { 199 200 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) 200 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList)))201 201 { 202 $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n"; 202 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 203 { 204 $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n"; 205 } 206 } 203 207 } 204 208 205 209 file_put_contents($this->TempDir.'CzWoW/'.$CountFiles, $Buffer); 206 207 210 208 211 // Generate file Translates.xml … … 210 213 $Buffer .= '<script file="'.$CountFiles.'"/>'."\n"; 211 214 foreach ($CreatedFileList as $CreatedFile) 215 { 212 216 $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n"; 217 } 213 218 $Buffer .= '</Ui>'; 214 219 file_put_contents($this->TempDir.'CzWoW/Translates.xml', $Buffer); 215 220 return $Output; 216 221 } 217 218 222 219 223 function MakeClientStrings() … … 282 286 283 287 '; 284 $DbResult = $ System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC');288 $DbResult = $this->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC'); 285 289 while ($Line = $DbResult->fetch_assoc()) 286 290 { -
trunk/Modules/Export/Export.php
r891 r893 1 1 <?php 2 2 3 class ModuleExport extends Module 4 { 5 function __construct(System $System) 6 { 7 parent::__construct($System); 8 $this->Name = 'Export'; 9 $this->Version = '1.0'; 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPL'; 12 $this->Description = 'Allow parametric export of translated texts to various supported output formats'; 13 $this->Dependencies = array('Translation'); 14 } 15 16 function DoStart(): void 17 { 18 $this->System->RegisterPage(['export'], 'PageExport'); 19 $this->System->RegisterPage(['export', 'progress'], 'PageExportProgress'); 20 Core::Cast($this->System)->RegisterMenuItem(array( 21 'Title' => 'Exporty', 22 'Hint' => 'Zde si můžete stáhnout přeložené texty', 23 'Link' => $this->System->Link('/export/'), 24 'Permission' => LICENCE_ANONYMOUS, 25 'Icon' => '', 26 ), 2); 27 } 28 29 function GetTaskProgress($TaskId) 30 { 31 $Output = ''; 32 $DbResult = $this->Database->query('SELECT * FROM `ExportTask` '. 33 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '. 34 '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 35 '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id 36 while ($Task = $DbResult->fetch_assoc()) 37 { 38 $Export = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; 39 if ($TaskId == $Task['Export']) 40 $Export = ''.$Export.' (tento)'; 41 42 // Show progress bar 43 $Output .= ' <strong>Export '.$Export.':</strong> <div id="progress'.$Task['Export'].'">'. 44 '<strong>'.ProgressBar(300, $Task['Progress']).'</strong> '; 45 46 // Show estimated time to complete 47 $PrefixMultiplier = new PrefixMultiplier(); 48 if ($Task['Progress'] > 0) { 49 $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']); 50 $Output .= T('Elapsed time').': <strong>'.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').'</strong> / '; 51 $EstimatedTime = (time() - MysqlDateTimeToTime($Task['TimeStart'])) / $Task['Progress'] * (100 - $Task['Progress']); 52 $Output .= T('Estimated remaining time').': <strong>'.$PrefixMultiplier->Add($EstimatedTime, '', 4, 'Time').'</strong><br/>'; 53 } 54 $Output .= '</div>'; 55 56 if ($Task['Progress'] > 99) 57 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 58 'setTimeout("parent.location.href=\''.$this->System->Link('/export/?Action=View&Tab=7&ExportId='.$TaskId).'\'", 500)'. 59 '</script>'; 60 } 61 return $Output; 62 } 63 } 3 include_once(dirname(__FILE__).'/ModuleExport.php'); 4 include_once(dirname(__FILE__).'/Page.php'); 5 include_once(dirname(__FILE__).'/ExportOutput.php'); 64 6 65 7 class Export extends Model 66 8 { 67 var$Id;68 var$AnoNe = array('Ne', 'Ano');9 public int $Id; 10 public array $AnoNe = array('Ne', 'Ano'); 69 11 var $WhereLang; 70 12 var $WhereUsers; … … 73 15 var $ClientVersion; 74 16 var $OrderByUserList; 75 var $TempDir; 76 var $SourceDir; 17 public string $TempDir; 18 public string $TempDirRelative; 19 public string $SourceDir; 20 public string $SourceDirRelative; 21 public array $Export; 77 22 78 23 function Init() 79 24 { 80 $this->TempDir = dirname(__FILE__).'/../../'. $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';25 $this->TempDir = dirname(__FILE__).'/../../'.Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 81 26 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 82 $this->TempDirRelative = $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';83 $this->SourceDir = dirname(__FILE__).'/../../'. $this->System->Config['Web']['SourceFolder'];84 $this->SourceDirRelative = $this->System->Config['Web']['SourceFolder'];27 $this->TempDirRelative = Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 28 $this->SourceDir = dirname(__FILE__).'/../../'.Core::Cast($this->System)->Config['Web']['SourceFolder']; 29 $this->SourceDirRelative = Core::Cast($this->System)->Config['Web']['SourceFolder']; 85 30 if (!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true); 86 31 } … … 158 103 // $Columns = substr($Columns, 0, -2); 159 104 160 $Query = 'SELECT * FROM (SELECT ANY_VALUE(`TT`.`ID`) AS `TTID` FROM (SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'. 105 $Query = 'SELECT * FROM (SELECT MIN(`TT`.`ID`) AS `TTID` FROM 106 (SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'. 161 107 ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '. 162 108 ' JOIN `User` ON `User`.`ID`=`T`.`User`'. … … 179 125 $Query = 'SELECT `T4`.*, '.$OriginalColumns.' FROM ('.$Query.') AS `T4` '. 180 126 ' LEFT JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T3`.`Entry` = `T4`.`Entry`) '. 181 'AND (`T3`.`Language` = '. $this->System->Config['OriginalLanguage'].') AND '.127 'AND (`T3`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND '. 182 128 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 183 129 … … 219 165 function ExportToMangosSQL() 220 166 { 167 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 221 168 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 222 169 … … 227 174 "-- ===========================================\n". 228 175 "--\n". 229 "-- Web projektu: ". $this->System->Config['Web']['Host'].$this->System->Link('/')."\n".176 "-- Web projektu: ".Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/')."\n". 230 177 "-- Datum exportu: ".date("j.n.Y H:i:s")."\n". 231 "-- Znaková sada: ". $this->System->Config['Database']['Charset']." / ".$this->System->Config['Web']['Charset']."\n".178 "-- Znaková sada: ".Core::Cast($this->System)->Config['Database']['Charset']." / ".Core::Cast($this->System)->Config['Web']['Charset']."\n". 232 179 "-- Diakritika: ".$this->AnoNe[$this->Export['WithDiacritic']]."\n". 233 "-- Vygeneroval uživatel: ".$ this->System->User->Name."\n".180 "-- Vygeneroval uživatel: ".$User->Name."\n". 234 181 "-- Vzato od uživatelů: ".$this->UserNames."\n". 235 182 "-- Generované tabulky: "; … … 370 317 } 371 318 372 function AddProgress($add = 1) 373 { 374 $DbResult = $this->System->Database->query('SELECT Progress FROM `ExportTask` WHERE `Export`='.$this->Id); 375 $Task = $DbResult->fetch_assoc(); 376 $per = $Task['Progress']+$add; 377 $this->System->Database->query('UPDATE `ExportTask` SET `Progress`='.$per.' WHERE `Export`='.$this->Id); 319 function AddProgress($Add = 1) 320 { 321 $DbResult = $this->System->Database->query('SELECT `Progress` FROM `ExportTask` WHERE `Export`='.$this->Id); 322 if ($DbResult->num_rows > 0) 323 { 324 $Task = $DbResult->fetch_assoc(); 325 $Progress = $Task['Progress'] + $Add; 326 $this->System->Database->query('UPDATE `ExportTask` SET `Progress`='.$Progress.' WHERE `Export`='.$this->Id); 327 } 378 328 } 379 329 … … 723 673 function ExportToXML() 724 674 { 675 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 725 676 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 726 677 … … 730 681 "<document>\n". 731 682 " <meta>\n". 732 " <projecturl>". $this->System->Config['Web']['Host'].$this->System->Link('/')."</projecturl>\n".683 " <projecturl>".Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/')."</projecturl>\n". 733 684 " <time>".date('r')."</time>\n". 734 685 " <diacritics mode=".'"'.$this->Export['WithDiacritic'].'"'." />\n". 735 " <author>".$ this->System->User->Name."</author>\n".686 " <author>".$User->Name."</author>\n". 736 687 " <contributors>\n"; 737 688 foreach (explode(',', $this->UserNames) as $UserName) 738 $Buffer .= " <user>".$UserName."</user>\n"; 689 { 690 $Buffer .= " <user>".trim($UserName)."</user>\n"; 691 } 739 692 $Buffer .= 740 693 " </contributors>\n". … … 755 708 while ($Line = $DbResult2->fetch_assoc()) 756 709 { 757 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; 758 $Values = ''; 710 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['User'].'">'."\n"; 759 711 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 760 712 { … … 774 726 } 775 727 } 776 777 include_once(dirname(__FILE__).'/Page.php');778 include_once(dirname(__FILE__).'/ExportOutput.php');779 -
trunk/Modules/Export/ExportOutput.php
r880 r893 22 22 function OutputAoWoWToFile($ExportId) 23 23 { 24 global $System , $Config;24 global $System; 25 25 26 26 $Output = ''; … … 50 50 function OutputAoWoWToHTML($ExportId) 51 51 { 52 global $System , $Config;52 global $System; 53 53 54 54 $Export = new Export($System); … … 63 63 function OutputMangosSQLToFile($ExportId) 64 64 { 65 global $System , $Config;65 global $System; 66 66 67 67 $Output = ''; … … 140 140 function OutputXMLToFile($ExportId) 141 141 { 142 global $ Config, $System;142 global $System; 143 143 144 144 $Output = ''; … … 318 318 function OutputLua($ExportId) 319 319 { 320 global $System , $Config;320 global $System; 321 321 322 322 $Export = new Export($System); -
trunk/Modules/Export/Page.php
r888 r893 16 16 function ExportList() 17 17 { 18 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 18 19 $Output = '<a href="?Action=ViewList">'.T('All').'</a>'; 19 if ($ this->System->User->Licence(LICENCE_USER))20 if ($User->Licence(LICENCE_USER)) 20 21 { 21 22 $Output .= ' <a href="?Action=ViewList&Filter=Others">'.T('Others').'</a>'. … … 23 24 } 24 25 25 if ($ this->System->User->Licence(LICENCE_USER))26 if ($User->Licence(LICENCE_USER)) 26 27 $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>'; 27 28 … … 29 30 if (array_key_exists('Filter', $_GET)) 30 31 { 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;32 if ($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$User->Id; 33 if ($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$User->Id; 33 34 } 34 35 … … 66 67 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">'.T('View').'</a> '. 67 68 '<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>';69 if ($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>'; 70 if ($User->Id != null) $Action .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>'; 70 71 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 71 72 '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. … … 84 85 function ExportCreate() 85 86 { 86 if ($this->System->User->Licence(LICENCE_USER)) 87 { 88 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 87 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 88 if ($User->Licence(LICENCE_USER)) 89 { 90 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 89 91 $DbRow = $DbResult->fetch_row(); 90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])92 if ($DbRow[0] < Core::Cast($this->System)->Config['MaxExportPerUser']) 91 93 { 92 94 $Output = '<form action="?Action=CreateFinish" method="post">'. … … 96 98 '<tr><td colspan="2"><input type="submit" value="'.T('Create').'" /></td></tr>'. 97 99 '</table></fieldset></form>'; 98 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);100 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), Core::Cast($this->System)->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 99 101 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 100 102 return $Output; … … 103 105 function ExportCreateFinish() 104 106 { 105 if ($this->System->User->Licence(LICENCE_USER)) 107 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 108 if ($User->Licence(LICENCE_USER)) 106 109 { 107 110 if (array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 108 111 { 109 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$ this->System->User->Id);112 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 110 113 $DbRow = $DbResult->fetch_row(); 111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])114 if ($DbRow[0] < Core::Cast($this->System)->Config['MaxExportPerUser']) 112 115 { 113 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$ this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")');116 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); 114 117 $ExportId = $this->System->Database->insert_id; 115 118 $Output = ShowMessage(T('New export created.<br />Direct link to export').': <a href="?Action=View&ExportId='.$ExportId.'">'.T('here').'</a>'); … … 117 120 $_GET['Filter'] = 'my'; 118 121 $this->ExportList(); 119 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);122 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), Core::Cast($this->System)->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 120 123 } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL); 121 124 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); … … 125 128 function ExportDelete() 126 129 { 127 if ($this->System->User->Licence(LICENCE_USER)) 128 { 129 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$this->System->User->Id.')'); 130 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 131 if ($User->Licence(LICENCE_USER)) 132 { 133 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$User->Id.')'); 130 134 if ($DbResult->num_rows > 0) 131 135 { … … 157 161 function ExportViewTranslators() 158 162 { 163 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 159 164 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 160 165 … … 163 168 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 164 169 $Export = $DbResult->fetch_assoc(); 165 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;170 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 166 171 else $Editable = false; 167 172 … … 273 278 function ExportViewGeneral() 274 279 { 280 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 275 281 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 276 282 $DisabledTextArea = array(false => ' readonly="yes"', true => ''); … … 278 284 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 279 285 $Export = $DbRows->fetch_assoc(); 280 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;286 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 281 287 else $Editable = false; 282 288 … … 300 306 $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 301 307 '<table>'; 302 if ($ this->System->User->Id != null)308 if ($User->Id != null) 303 309 { 304 310 $Output .= '<input type="hidden" name="Operation" value="Save"/>'. … … 306 312 if ($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'; 307 313 $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))314 if ($User->Licence(LICENCE_ADMIN)) 309 315 $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' '; 310 316 $Output .= '</td></tr>'; … … 319 325 function ExportViewLanguages() 320 326 { 327 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 321 328 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 322 329 … … 325 332 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 326 333 $Export = $DbRows->fetch_assoc(); 327 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;334 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 328 335 else $Editable = false; 329 336 … … 410 417 function ExportViewGroups() 411 418 { 419 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 412 420 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 413 421 … … 416 424 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 417 425 $Export = $DbRows->fetch_assoc(); 418 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;426 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 419 427 else $Editable = false; 420 428 … … 538 546 function ExportViewOutputFormat() 539 547 { 548 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 540 549 $Output = ''; 541 550 $DisabledInput = array(false => ' disabled="disabled"', true => ''); … … 546 555 { 547 556 $Export = $DbRows->fetch_assoc(); 548 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;557 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 549 558 else $Editable = false; 550 559 … … 583 592 function ExportViewVersion() 584 593 { 594 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 585 595 $Output = ''; 586 596 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 587 597 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 588 598 $Export = $DbRows->fetch_assoc(); 589 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;599 if ($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 590 600 else $Editable = false; 591 601 … … 697 707 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 698 708 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 699 ' WHERE (`Language` = '. $this->System->Config['OriginalLanguage'].') AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'.709 ' WHERE (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'. 700 710 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name`'; 701 711 } … … 777 787 function ExportClone() 778 788 { 779 if ($this->System->User->Licence(LICENCE_USER)) 789 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 790 if ($User->Licence(LICENCE_USER)) 780 791 { 781 792 if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 782 793 { 783 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$ this->System->User->Id);794 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 784 795 $DbRow = $DbResult->fetch_row(); 785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])796 if ($DbRow[0] < Core::Cast($this->System)->Config['MaxExportPerUser']) 786 797 { 787 798 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); … … 791 802 unset($DbRow['Id']); 792 803 $DbRow['UsedCount'] = '0'; 793 $DbRow['User'] = $ this->System->User->Id;804 $DbRow['User'] = $User->Id; 794 805 $DbRow['TimeCreate'] = 'NOW()'; 795 806 $DbRow['Title'] .= ' - '.T('clone'); … … 807 818 } else $Output = ShowMessage('Zdrojový export nenalezen', MESSAGE_CRITICAL); 808 819 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), 809 $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);820 Core::Cast($this->System)->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 810 821 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 811 822 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); -
trunk/Modules/Forum/Forum.php
r891 r893 68 68 function Show(): string 69 69 { 70 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 70 71 $Output = ''; 71 72 $this->Title = T('Forum'); … … 84 85 $Output .= '<h3>'.T('Forum - Thread').'</h3>'; 85 86 if ($Action == 'add2') $Output .= $this->AddFinish(); 86 if ($ this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddForm();87 if ($User->Licence(LICENCE_USER)) $Output .= $this->ShowAddForm(); 87 88 $Output .= $this->ShowList(); 88 89 } else { 89 90 $Output .= '<h3>'.T('Forum - List of Thread').'</h3>'; 90 91 if ($Action == 'add2') $Output .= $this->AddFinish('ForumThread'); 91 if ($ this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddFormThread();92 if ($User->Licence(LICENCE_USER)) $Output .= $this->ShowAddFormThread(); 92 93 $Output .= $this->ShowListThread(); 93 94 } … … 97 98 function Edit() 98 99 { 99 $Output = ''; 100 $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']); 100 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 101 $Output = ''; 102 $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$User->Id.' AND `ID` = '.$_GET['Edit']); 101 103 $Output .= ShowMessage(T('Text edited.')); 102 104 return $Output; … … 105 107 function ShowEditForm() 106 108 { 107 $Output = ''; 108 if ($this->System->User->Licence(LICENCE_USER)) 109 { 110 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']); 109 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 110 $Output = ''; 111 if ($User->Licence(LICENCE_USER)) 112 { 113 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `User` = '.$User->Id.' AND `ID` = '.$_GET['Edit']); 111 114 if ( $DbResult->num_rows > 0) { 112 115 $DbRow = $DbResult->fetch_assoc(); … … 114 117 '<fieldset><legend>'.T('Edit message').'</legend>'. 115 118 T('User').': '; 116 if ($ this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';119 if ($User->Licence(LICENCE_USER)) $Output .= '<b>'.$User->Name.'</b><br />'; 117 120 else $Output .= '<input type="text" name="user" /><br />'; 118 121 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'. … … 173 176 function ShowList() 174 177 { 178 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 175 179 $Output = ''; 176 180 … … 200 204 while ($Line = $DbResult->fetch_assoc()) 201 205 { 202 if ($ this->System->User->Id == $Line['User'])206 if ($User->Id == $Line['User']) 203 207 { 204 208 $edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>'; … … 215 219 function ShowAddForm() 216 220 { 217 $Output = ''; 218 if ($this->System->User->Licence(LICENCE_USER)) 221 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 222 $Output = ''; 223 if ($User->Licence(LICENCE_USER)) 219 224 { 220 225 $Output .= '<form action="?Thread='.$_GET['Thread'].'" method="post">'. 221 226 '<fieldset><legend>'.T('New Forum Message').'</legend>'. 222 227 T('User').': '; 223 if ($ this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';228 if ($User->Licence(LICENCE_USER)) $Output .= '<b>'.$User->Name.'</b><br />'; 224 229 else $Output .= '<input type="text" name="user" /><br />'; 225 230 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'. … … 234 239 function ShowAddFormThread() 235 240 { 236 $Output = ''; 237 if ($this->System->User->Licence(LICENCE_USER)) 241 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 242 $Output = ''; 243 if ($User->Licence(LICENCE_USER)) 238 244 { 239 245 $Output .= '<form action="?" method="post">'. 240 246 '<fieldset><legend>'.T('New thread').'</legend>'.T('User').': '; 241 if ($ this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';247 if ($User->Licence(LICENCE_USER)) $Output .= '<b>'.$User->Name.'</b><br />'; 242 248 else $Output .= '<input type="text" name="user" /><br />'; 243 249 $Output .= T('Name of thread').': <br />'. … … 252 258 function AddFinish($Table = 'ForumText') 253 259 { 254 $Output = ''; 255 if ($this->System->User->Licence(LICENCE_USER)) 260 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 261 $Output = ''; 262 if ($User->Licence(LICENCE_USER)) 256 263 { 257 264 if (array_key_exists('text', $_POST)) … … 265 272 if ($Table == 'ForumText') $Thread = 'AND `Thread` = '.$_GET['Thread']; 266 273 $DbResult = $this->System->Database->query('SELECT `Text` FROM `'.$Table.'` WHERE 1 '.$Thread.' AND (`User` = "'. 267 $ this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1');274 $User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 268 275 if ($DbResult->num_rows > 0) 269 276 { … … 280 287 { 281 288 $this->System->Database->query('INSERT INTO `'.$Table.'` ( `User`, `UserName` , `Text` , `Date` , `IP` , `Thread` ) '. 282 ' VALUES ('.$ this->System->User->Id.', "'.$this->System->User->Name.289 ' VALUES ('.$User->Id.', "'.$User->Name. 283 290 '", "'.$Text.'", NOW(), "'.GetRemoteAddress().'","'.$_GET['Thread'].'")'); 284 291 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 285 292 } else 286 293 $this->System->Database->query('INSERT INTO `'.$Table.'` ( `User`, `UserName` , `Text` , `Date` , `IP`) '. 287 ' VALUES ('.$ this->System->User->Id.', "'.$this->System->User->Name.294 ' VALUES ('.$User->Id.', "'.$User->Name. 288 295 '", "'.$Text.'", NOW(), "'.GetRemoteAddress().'")'); 289 296 $Output .= ShowMessage(T('Added.')); … … 311 318 ( 312 319 'Title' => htmlspecialchars($DbRow['ThreadText']).' - '.$DbRow['UserName'].': ', 313 'Link' => 'http ://'.$this->System->Config['Web']['Host'].$this->System->Link('/forum/?Thread='.$DbRow['Thread']),320 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/forum/?Thread='.$DbRow['Thread']), 314 321 'Description' => ShowBBcodes(htmlspecialchars($DbRow['Text'])), 315 322 'Time' => $DbRow['UnixDate'], … … 318 325 $Output = GenerateRSS(array 319 326 ( 320 'Title' => $this->System->Config['Web']['Title'].' - '.T('Forum'),321 'Link' => 'http ://'.$this->System->Config['Web']['Host'].$this->System->Link('/forum/'),322 'Description' => $this->System->Config['Web']['Description'],323 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],327 'Title' => Core::Cast($this->System)->Config['Web']['Title'].' - '.T('Forum'), 328 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/forum/'), 329 'Description' => Core::Cast($this->System)->Config['Web']['Description'], 330 'WebmasterEmail' => Core::Cast($this->System)->Config['Web']['AdminEmail'], 324 331 'Items' => $Items, 325 332 )); -
trunk/Modules/FrontPage/FrontPage.php
r888 r893 29 29 function HandleLoginForm() 30 30 { 31 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 31 32 global $Message, $MessageType; 32 33 … … 39 40 if (array_key_exists('StayLogged', $_POST)) $StayLogged = true; 40 41 else $StayLogged = false; 41 $ this->System->User->Login($_POST['LoginUser'], $_POST['LoginPass'], $StayLogged);42 if ($ this->System->User->Role == LICENCE_ANONYMOUS)42 $User->Login($_POST['LoginUser'], $_POST['LoginPass'], $StayLogged); 43 if ($User->Role == LICENCE_ANONYMOUS) 43 44 { 44 45 $Message = T('Incorrect name or password'); … … 46 47 } else 47 48 { 48 $Message = sprintf(T('Login successful. Welcome <strong>%s</strong>!'), $ this->System->User->Name);49 $Message = sprintf(T('Login successful. Welcome <strong>%s</strong>!'), $User->Name); 49 50 $MessageType = MESSAGE_INFORMATION; 50 51 } … … 55 56 } 56 57 } else 57 if ($_GET['action'] == 'logout') 58 if ($_GET['action'] == 'logout') 59 { 60 if ($User->Role != LICENCE_ANONYMOUS) 58 61 { 59 if ($this->System->User->Role != LICENCE_ANONYMOUS) 60 { 61 $this->System->ModuleManager->Modules['Log']->WriteLog('Odhlášení', LOG_TYPE_USER); 62 $this->System->User->Logout(); 63 $Message = T('You were logged out'); 64 $MessageType = MESSAGE_INFORMATION; 65 } 62 ModuleLog::Cast($this->System->GetModule('Log'))->WriteLog('Odhlášení', LOG_TYPE_USER); 63 $User->Logout(); 64 $Message = T('You were logged out'); 65 $MessageType = MESSAGE_INFORMATION; 66 66 } 67 } 67 68 } 68 69 } … … 123 124 // Echo text even if it is hidden because of caching by external searching engines 124 125 return '<div style="'.$HideWelcome.'">'. 125 '<div id="bannertitle">'. $this->System->Config['Web']['Title'].'</div>'.126 '<div id="bannertitle">'.Core::Cast($this->System)->Config['Web']['Title'].'</div>'. 126 127 T('Open web system for translation texts from game World of Warcraft (WoW).<br/>'. 127 128 '<ul>'. -
trunk/Modules/Import/Manage.php
r888 r893 47 47 '<a href="?action=instructions">Instrukce pro přípravu zdrojových souborů</a><br/>'. 48 48 '<a href="?action=update_translated">Zaktualizovat verze přeložených</a><br/><br/>'. 49 'Verze klienta použitá pro import: <strong>'. $this->System->Config['Web']['GameVersion'].'</strong><br/>';49 'Verze klienta použitá pro import: <strong>'.Core::Cast($this->System)->Config['Web']['GameVersion'].'</strong><br/>'; 50 50 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Group`'); 51 51 $DbRow = $DbResult->fetch_row(); … … 98 98 function Show(): string 99 99 { 100 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 100 101 $this->Title = T('Import'); 101 102 $Output = ''; 102 if ($ this->System->User->Licence(LICENCE_ADMIN))103 if ($User->Licence(LICENCE_ADMIN)) 103 104 { 104 105 if (array_key_exists('action', $_GET)) -
trunk/Modules/Info/Info.php
r888 r893 93 93 'Addon jako takový je běžný doplněk do hry a je možné jej bez problémů používat i na oficiálních serverech.<br/>'. 94 94 '<iframe width="420" height="315" src="https://www.youtube.com/embed/6EhBFv59syk" frameborder="0" allowfullscreen></iframe><br/>'. 95 '<img src="'.$this->System->Link('/images/promotion. bmp').'" width="800" alt="addon-obr">';95 '<img src="'.$this->System->Link('/images/promotion.png').'" width="800" alt="addon-obr">'; 96 96 return $Output; 97 97 } -
trunk/Modules/Log/Log.php
r891 r893 33 33 function WriteLog($Text, $Type) 34 34 { 35 if (isset($this->System->User) and !is_null($this->System->User->Id)) 36 $UserId = $this->System->User->Id; 35 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 36 if (isset($User) and !is_null($User->Id)) 37 $UserId = $User->Id; 37 38 else $UserId = 'NULL'; 38 39 $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP`, `URL` ) '. … … 40 41 GetRemoteAddress().'", "'.GetRequestURI().'")'; 41 42 $this->System->Database->query($Query); 43 } 44 45 static function Cast(Module $Module): ModuleLog 46 { 47 if ($Module instanceof ModuleLog) 48 { 49 return $Module; 50 } 51 throw new Exception('Expected '.ModuleLog::GetClassName().' type but got '.gettype($Module)); 42 52 } 43 53 } … … 91 101 ( 92 102 'Title' => $LogType['Name'].' ('.$Line['UserName'].', '.$Line['IP'].')', 93 'Link' => 'https://'. $this->System->Config['Web']['Host'].$this->System->Link('/log/'),103 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/log/'), 94 104 'Description' => $LogType['Name'].': '.$Line['Text'].' ('.$Line['UserName']. 95 105 ', '.$Line['IP'].', '.HumanDate($Line['Date']).')', … … 100 110 $Output .= GenerateRSS(array 101 111 ( 102 'Title' => $this->System->Config['Web']['Title'].' - '.T('Logs'),103 'Link' => 'https://'. $this->System->Config['Web']['Host'].$this->System->Link('/'),104 'Description' => $this->System->Config['Web']['Description'],105 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],112 'Title' => Core::Cast($this->System)->Config['Web']['Title'].' - '.T('Logs'), 113 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/'), 114 'Description' => Core::Cast($this->System)->Config['Web']['Description'], 115 'WebmasterEmail' => Core::Cast($this->System)->Config['Web']['AdminEmail'], 106 116 'Items' => $Items, 107 117 )); … … 121 131 function ShowList() 122 132 { 133 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 123 134 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 124 135 … … 141 152 142 153 // Show category filter 143 if ($ this->System->User->Licence(LICENCE_MODERATOR))154 if ($User->Licence(LICENCE_MODERATOR)) 144 155 { 145 156 $Output = '<strong>'.T('Filter').':</strong>'; … … 203 214 $Output .= '</table>'. 204 215 $PageList['Output']; 205 if ($ this->System->User->Licence(LICENCE_ADMIN))216 if ($User->Licence(LICENCE_ADMIN)) 206 217 { 207 218 $Output .= '<div>'.T('Remove').': <a href="'.$this->System->Link('/log/?a=delerrlog&type='.LOG_TYPE_ERROR).'">'.T('Error logs').'</a> '. … … 215 226 function DeleteErrorLog() 216 227 { 217 if ($this->System->User->Licence(LICENCE_ADMIN) and 228 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 229 if ($User->Licence(LICENCE_ADMIN) and 218 230 (($_GET['type'] == LOG_TYPE_ERROR) or ($_GET['type'] == LOG_TYPE_PAGE_NOT_FOUND))) 219 231 { -
trunk/Modules/News/News.php
r891 r893 5 5 class ModuleNews extends Module 6 6 { 7 var $RSSChannels; 7 public array $RSSChannels; 8 public array $RSSChannelsPos; 8 9 9 10 function __construct(System $System) … … 56 57 function ShowRSSHeader() 57 58 { 59 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 58 60 $Output = ''; 59 61 foreach ($this->RSSChannels as $Channel) 60 62 { 61 if ($ this->System->User->Licence($Channel['Permission']))63 if ($User->Licence($Channel['Permission'])) 62 64 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 63 65 $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 64 66 } 65 67 return $Output; … … 84 86 function ShowList() 85 87 { 88 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 86 89 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `News`'); 87 90 $DbRow = $DbResult->fetch_row(); … … 89 92 90 93 $Output = '<h3>'.T('News').'</h3>'; 91 if ($ this->System->User->Licence(LICENCE_ADMIN))94 if ($User->Licence(LICENCE_ADMIN)) 92 95 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 93 96 $Output .= $PageList['Output']; … … 122 125 function ShowAddForm() 123 126 { 124 if ($this->System->User->Licence(LICENCE_ADMIN)) 127 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 128 if ($User->Licence(LICENCE_ADMIN)) 125 129 { 126 130 $Output = '<form action="?" method="POST">'. 127 131 '<fieldset><legend>'.T('New news').'</legend>'. 128 T('User').': '.$ this->System->User->Name.'('.$this->System->User->Id.')<br/> '.132 T('User').': '.$User->Name.'('.$User->Id.')<br/> '. 129 133 T('Title').': <input type="text" name="title" size="40"/><br/>'. 130 134 T('Content').': <textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="Text" name="text"></textarea><br/>'. … … 139 143 function SaveNew() 140 144 { 141 if ($this->System->User->Licence(LICENCE_ADMIN)) 145 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 146 if ($User->Licence(LICENCE_ADMIN)) 142 147 { 143 148 if (array_key_exists('text', $_POST) and array_key_exists('title', $_POST)) 144 149 { 145 150 $querty = 'INSERT INTO `News` (`Title`, `Time` ,`User` ,`Text`) VALUES ( "'.$_POST['title'].'", NOW( ) , '. 146 $ this->System->User->Id.', "'.$_POST['text'].'")';151 $User->Id.', "'.$_POST['text'].'")'; 147 152 $this->System->Database->query($querty); 148 153 $Output = ShowMessage(T('News added')); … … 162 167 while ($DbRow = $DbResult->fetch_assoc()) 163 168 { 164 $Items[] = array165 (166 'Title' => $DbRow['Title'],167 'Link' => 'https://'.$this->System->Config['Web']['Host'].$this->System->Link('/news/?a=item&i='.$DbRow['Id']),168 'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')',169 'Time' => $DbRow['UnixTime'],170 );169 $Items[] = array 170 ( 171 'Title' => $DbRow['Title'], 172 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/news/?a=item&i='.$DbRow['Id']), 173 'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')', 174 'Time' => $DbRow['UnixTime'], 175 ); 171 176 } 172 177 $Output = GenerateRSS(array 173 178 ( 174 'Title' => $this->System->Config['Web']['Title'].' - '.T('System changes'),175 'Link' => 'https://'. $this->System->Config['Web']['Host'].$this->System->Link('/news/'),176 'Description' => $this->System->Config['Web']['Description'],177 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],179 'Title' => Core::Cast($this->System)->Config['Web']['Title'].' - '.T('System changes'), 180 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/news/'), 181 'Description' => Core::Cast($this->System)->Config['Web']['Description'], 182 'WebmasterEmail' => Core::Cast($this->System)->Config['Web']['AdminEmail'], 178 183 'Items' => $Items, 179 184 )); -
trunk/Modules/News/RSS.php
r888 r893 33 33 function Show(): string 34 34 { 35 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 35 36 $this->RawPage = true; 36 37 … … 42 43 { 43 44 $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName]; 44 if ($ this->System->User->Licence($Channel['Permission']) or45 $ this->System->User->CheckToken($Channel['Permission'], $Token))45 if ($User->Licence($Channel['Permission']) or 46 $User->CheckToken($Channel['Permission'], $Token)) 46 47 { 47 48 if (is_string($Channel['Callback'][0])) -
trunk/Modules/Redirection/Redirection.php
r888 r893 3 3 class ModuleRedirection extends Module 4 4 { 5 public array $Excludes; 6 5 7 function __construct(System $System) 6 8 { … … 12 14 $this->Description = 'Redirects erlier obsolete addresses to new ones.'; 13 15 $this->Dependencies = array(); 16 14 17 $this->Excludes = array(); 15 18 } … … 17 20 function DoStart(): void 18 21 { 19 $this->System->OnPageNotFound = array($this, 'ShowRedirect');22 Core::Cast($this->System)->OnPageNotFound = array($this, 'ShowRedirect'); 20 23 } 21 24 … … 30 33 { 31 34 $Output = ''; 32 if (count( $this->System->PathItems) > 0)35 if (count(Core::Cast($this->System)->PathItems) > 0) 33 36 { 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)37 if (Core::Cast($this->System)->PathItems[0] == 'user.php') $Output = $this->Redirect($this->System->Link('/user/')); 38 if (Core::Cast($this->System)->PathItems[0] == 'team.php') $Output = $this->Redirect($this->System->Link('/team/')); 39 if (Core::Cast($this->System)->PathItems[0] == 'version.php') $Output = $this->Redirect($this->System->Link('/client-version/')); 40 if (Core::Cast($this->System)->PathItems[0] == 'phpBB3') $Output = $this->Redirect($this->System->Link('/forum/')); 41 if (Core::Cast($this->System)->PathItems[0] == 'phpbb3') $Output = $this->Redirect($this->System->Link('/forum/')); 42 if (Core::Cast($this->System)->PathItems[0] == 'statistic.php') $Output = $this->Redirect($this->System->Link('/progress/')); 43 if (Core::Cast($this->System)->PathItems[0] == 'register.php') $Output = $this->Redirect($this->System->Link('/registration/')); 44 if (Core::Cast($this->System)->PathItems[0] == 'registrace.php') $Output = $this->Redirect($this->System->Link('/registration/')); 45 if (Core::Cast($this->System)->PathItems[0] == 'dictionary.php') $Output = $this->Redirect($this->System->Link('/dictionary/')); 46 if (Core::Cast($this->System)->PathItems[0] == 'download-addon.php') $Output = $this->Redirect($this->System->Link('/download/')); 47 if (Core::Cast($this->System)->PathItems[0] == 'banners.php') $Output = $this->Redirect($this->System->Link('/referrer/')); 48 if (Core::Cast($this->System)->PathItems[0] == 'download.php') $Output = $this->Redirect($this->System->Link('/download/')); 49 if (Core::Cast($this->System)->PathItems[0] == 'serverlist.php') $Output = $this->Redirect($this->System->Link('/server/')); 50 if (Core::Cast($this->System)->PathItems[0] == 'info.php') $Output = $this->Redirect($this->System->Link('/info/')); 51 if (Core::Cast($this->System)->PathItems[0] == 'userlist.php') $Output = $this->Redirect($this->System->Link('/users/')); 52 if (Core::Cast($this->System)->PathItems[0] == 'promotion.php') $Output = $this->Redirect($this->System->Link('/promotion/')); 53 if (Core::Cast($this->System)->PathItems[0] == 'log.php') $Output = $this->Redirect($this->System->Link('/log/')); 54 if (count(Core::Cast($this->System)->PathItems) > 1) 52 55 { 53 if (( $this->System->PathItems[0] == 'team') and ($this->System->PathItems[1] == 'userlist.php'))56 if ((Core::Cast($this->System)->PathItems[0] == 'team') and (Core::Cast($this->System)->PathItems[1] == 'userlist.php')) 54 57 $Output = $this->Redirect($this->System->Link('/userlist/')); 55 if (( $this->System->PathItems[0] == 'dictionary') and ($this->System->PathItems[1] == 'user.php'))58 if ((Core::Cast($this->System)->PathItems[0] == 'dictionary') and (Core::Cast($this->System)->PathItems[1] == 'user.php')) 56 59 $Output = $this->Redirect($this->System->Link('/user/')); 57 if (( $this->System->PathItems[0] == 'forum') and ($this->System->PathItems[1] == 'index.php'))60 if ((Core::Cast($this->System)->PathItems[0] == 'forum') and (Core::Cast($this->System)->PathItems[1] == 'index.php')) 58 61 $Output = $this->Redirect($this->System->Link('/forum/')); 59 if (( $this->System->PathItems[0] == 'phpbb3') and ($this->System->PathItems[1] == 'index.php'))62 if ((Core::Cast($this->System)->PathItems[0] == 'phpbb3') and (Core::Cast($this->System)->PathItems[1] == 'index.php')) 60 63 $Output = $this->Redirect($this->System->Link('/forum/')); 61 if (( $this->System->PathItems[0] == 'phpBB3') and ($this->System->PathItems[1] == 'index.php'))64 if ((Core::Cast($this->System)->PathItems[0] == 'phpBB3') and (Core::Cast($this->System)->PathItems[1] == 'index.php')) 62 65 $Output = $this->Redirect($this->System->Link('/forum/')); 63 if (( $this->System->PathItems[0] == 'download') and ($this->System->PathItems[1] == 'ceske_fonty_do_wow.zip'))66 if ((Core::Cast($this->System)->PathItems[0] == 'download') and (Core::Cast($this->System)->PathItems[1] == 'ceske_fonty_do_wow.zip')) 64 67 $Output = $this->Redirect($this->System->Link('/files/ceske_fonty_do_wow.zip')); 65 68 } -
trunk/Modules/Referrer/Referrer.php
r891 r893 20 20 function DoStart(): void 21 21 { 22 $this->Excludes[] = $this->System->Config['Web']['Host'];22 $this->Excludes[] = Core::Cast($this->System)->Config['Web']['Host']; 23 23 $this->Log(); 24 24 $this->System->RegisterPage(['referrer'], 'PageReferrer'); … … 77 77 function ShowList() 78 78 { 79 $Banner = '<a href="https://'.$this->System->Config['Web']['Host'].$this->System->Link('/').'">'. 80 '<img src="https://'.$this->System->Config['Web']['Host'].$this->System->Link('/banners/wowpreklad_big.jpg').'" '. 79 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 80 $Banner = '<a href="https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/').'">'. 81 '<img src="https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/banners/wowpreklad_big.jpg').'" '. 81 82 'alt="wowpreklad" title="Otevřený projekt překládání celé hry World of Warcraft" '. 82 83 'class="banner" height="60" width="468" /></a>'; 83 84 84 $BannerSmall = '<a href="https://'. $this->System->Config['Web']['Host'].$this->System->Link('/').'">'.85 '<img src="https://'. $this->System->Config['Web']['Host'].$this->System->Link('/banners/wowpreklad_small.jpg').'" '.85 $BannerSmall = '<a href="https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/').'">'. 86 '<img src="https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/banners/wowpreklad_small.jpg').'" '. 86 87 'alt="wowpreklad" title="Otevřený projekt překládání celé hry World of Warcraft" '. 87 88 'class="banner" height="31" width="88" /></a>'; … … 92 93 $Output .= $BannerSmall.' <textarea rows="2" cols="30">'.htmlspecialchars($BannerSmall).'</textarea><br />'; 93 94 94 if ($ this->System->User->Licence(LICENCE_ADMIN)) {95 if ($User->Licence(LICENCE_ADMIN)) { 95 96 96 97 $MonthAge = 3; … … 99 100 <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 101 101 if (!$ this->System->User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Visible`=1) AND (`Parent` IS NULL)';102 if (!$User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Visible`=1) AND (`Parent` IS NULL)'; 102 103 else $Where = ''; 103 104 $Query = 'SELECT *, (SELECT Web FROM `Referrer` AS T4 WHERE T4.Id = T3.Parent) AS ParentName '. … … 123 124 array('Name' => 'TotalHits', 'Title' => T('Hits')), 124 125 ); 125 if ($ this->System->User->Licence(LICENCE_ADMIN))126 if ($User->Licence(LICENCE_ADMIN)) 126 127 { 127 128 $TableColumns[] = array('Name' => 'Visible', 'Title' => T('Visible')); … … 142 143 '<td>'.HumanDate($Line['MaxDateLast']).'</td>'. 143 144 '<td>'.$Line['TotalHits'].'</td>'; 144 if ($ this->System->User->Licence(LICENCE_ADMIN))145 if ($User->Licence(LICENCE_ADMIN)) 145 146 { 146 147 $Output .= … … 183 184 function Spam() 184 185 { 185 if ($this->System->User->Licence(LICENCE_ADMIN)) 186 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 187 if ($User->Licence(LICENCE_ADMIN)) 186 188 { 187 189 if (array_key_exists('id', $_GET)) … … 207 209 function Edit() 208 210 { 209 if ($this->System->User->Licence(LICENCE_ADMIN)) 211 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 212 if ($User->Licence(LICENCE_ADMIN)) 210 213 { 211 214 if (array_key_exists('id', $_GET)) … … 232 235 function EditSave() 233 236 { 234 if ($this->System->User->Licence(LICENCE_ADMIN)) 237 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 238 if ($User->Licence(LICENCE_ADMIN)) 235 239 { 236 240 if ($_POST['Parent'] == '') $_POST['Parent'] = null; -
trunk/Modules/ShoutBox/ShoutBox.php
r891 r893 27 27 function ShowBox() 28 28 { 29 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 29 30 $Output = '<strong><a href="'.$this->System->Link('/shoutbox/').'">'.T('Shoutbox').':</a></strong>'; 30 31 31 if ($ this->System->User->Licence(LICENCE_USER))32 if ($User->Licence(LICENCE_USER)) 32 33 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 33 34 $Output .= '<div class="box"><div class="shoutbox"><table>'; … … 56 57 function ShowList() 57 58 { 59 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 58 60 $Output = ''; 59 61 if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; … … 71 73 72 74 $Output .= '<h3>'.T('Shoutbox').'</h3>'; 73 if ($ this->System->User->Licence(LICENCE_USER))75 if ($User->Licence(LICENCE_USER)) 74 76 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 75 77 $Output .= $PageList['Output']; … … 84 86 function ShowAddForm() 85 87 { 88 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 86 89 $Output = ''; 87 if ($ this->System->User->Licence(LICENCE_USER))90 if ($User->Licence(LICENCE_USER)) 88 91 { 89 92 $Output .= '<form action="?" method="post">'. 90 93 '<fieldset><legend>'.T('New message').'</legend>'. 91 94 'Uživatel: '; 92 if ($ this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';95 if ($User->Licence(LICENCE_USER)) $Output .= '<b>'.$User->Name.'</b><br />'; 93 96 else $Output .= '<input type="text" name="user" /><br />'; 94 97 $Output .= 'Text zprávy: <br/>'. … … 104 107 function AddFinish() 105 108 { 109 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 106 110 $Output = ''; 107 if ($ this->System->User->Licence(LICENCE_USER))111 if ($User->Licence(LICENCE_USER)) 108 112 { 109 113 if (array_key_exists('text', $_POST)) … … 115 119 // Protection against mutiple post of same message 116 120 $DbResult = $this->System->Database->query('SELECT `Text` FROM `ShoutBox` WHERE (`User` = "'. 117 $ this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1');121 $User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 118 122 if ($DbResult->num_rows > 0) 119 123 { … … 125 129 { 126 130 $this->System->Database->query('INSERT INTO `ShoutBox` ( `User`, `UserName` , `Text` , `Date` , `IP` ) '. 127 ' VALUES ('.$ this->System->User->Id.', "'.$this->System->User->Name.131 ' VALUES ('.$User->Id.', "'.$User->Name. 128 132 '", "'.$Text.'", NOW(), "'.GetRemoteAddress().'")'); 129 133 $Output .= ShowMessage('Zpráva vložena.'); … … 139 143 function ShowRSS() 140 144 { 145 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 141 146 $Items = array(); 142 147 $TitleLength = 50; … … 150 155 ( 151 156 'Title' => $DbRow['UserName'].': '.$Title, 152 'Link' => 'https://'. $this->System->Config['Web']['Host'].$this->System->Link('/shoutbox/'),157 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/shoutbox/'), 153 158 'Description' => $DbRow['Text'], 154 159 'Time' => $DbRow['UnixDate'], … … 157 162 $Output = GenerateRSS(array 158 163 ( 159 'Title' => $this->System->Config['Web']['Title'].' - '.T('Shoutbox'),160 'Link' => 'https://'. $this->System->Config['Web']['Host'].$this->System->Link('/shoutbox/'),161 'Description' => $this->System->Config['Web']['Description'],162 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],164 'Title' => Core::Cast($this->System)->Config['Web']['Title'].' - '.T('Shoutbox'), 165 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/shoutbox/'), 166 'Description' => Core::Cast($this->System)->Config['Web']['Description'], 167 'WebmasterEmail' => Core::Cast($this->System)->Config['Web']['AdminEmail'], 163 168 'Items' => $Items, 164 169 )); -
trunk/Modules/Team/Team.php
r888 r893 34 34 function ShowTeamList() 35 35 { 36 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 36 37 $this->Title = T('Teams'); 37 38 $Output = '<h3>'.T('List of translating teams').'</h3>'; … … 42 43 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 43 44 44 if ($ this->System->User->Licence(LICENCE_USER))45 if ($User->Licence(LICENCE_USER)) 45 46 $Output .= '<br /><div style="text-align: center;"><a href="?action=create">'.T('Create translating team').'</a></div><br/>'; 46 47 if ($_SESSION['search'] != '') … … 64 65 array('Name' => 'TimeCreate', 'Title' => T('Founding date')), 65 66 ); 66 if ($ this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions'));67 if ($User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions')); 67 68 68 69 $Order = GetOrderTableHeader($TableColumns, 'NumberUser', 1); … … 80 81 '<td><a href="'.$this->System->Link('/users/?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'. 81 82 '<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>';83 if ($User->Licence(LICENCE_USER)) 84 { 85 if ($Team['Leader'] == $User->Id) $Action = ' <a href="?action=modify&id='.$Team['Id'].'">'.T('Edit').'</a>'; 85 86 else $Action = ''; 86 if ($Team['Id'] == $ this->System->User->Team) $Action = ' <a href="?action=leave">'.T('Leave').'</a>';87 if ($Team['Id'] == $User->Team) $Action = ' <a href="?action=leave">'.T('Leave').'</a>'; 87 88 $Output .= '<td><a href="?action=gointeam&id='.$Team['Id'].'">'.T('Enter').'</a>'.$Action.'</td>'; 88 89 } … … 97 98 function TeamJoin() 98 99 { 99 if ($this->System->User->Licence(LICENCE_USER)) 100 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 101 if ($User->Licence(LICENCE_USER)) 100 102 { 101 103 if (array_key_exists('id', $_GET)) 102 104 { 103 $this->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$ this->System->User->Id);105 $this->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$User->Id); 104 106 $Output = ShowMessage(T('You joined new team')); 105 107 $this->System->ModuleManager->Modules['Log']->WriteLog('Uživatel vstoupil do týmu '.$_GET['id'], LOG_TYPE_USER); … … 119 121 function TeamCreateFinish() 120 122 { 123 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 121 124 $Output = ''; 122 if ($ this->System->User->Licence(LICENCE_USER))125 if ($User->Licence(LICENCE_USER)) 123 126 { 124 127 if (array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST)) … … 131 134 $this->Database->query('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`, `Leader`)'. 132 135 ' VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'. 133 $_POST['URL'].'", NOW(), '.$ this->System->User->Id.')');134 $this->Database->query('UPDATE `User` SET `Team` = '.$this->Database->insert_id.' WHERE `ID` = '.$ this->System->User->Id);136 $_POST['URL'].'", NOW(), '.$User->Id.')'); 137 $this->Database->query('UPDATE `User` SET `Team` = '.$this->Database->insert_id.' WHERE `ID` = '.$User->Id); 135 138 $Output .= ShowMessage('Překladatelský tým vytvořen.'); 136 139 $this->System->ModuleManager->Modules['Log']->WriteLog('Překladatelský tým vytvořen '.$_POST['Name'], LOG_TYPE_USER); … … 147 150 function TeamModify() 148 151 { 149 if ($this->System->User->Licence(LICENCE_USER)) 152 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 153 if ($User->Licence(LICENCE_USER)) 150 154 { 151 155 if (array_key_exists('id', $_GET)) 152 156 { 153 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$ this->System->User->Id);157 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id); 154 158 if ($DbResult->num_rows > 0) 155 159 { … … 170 174 function TeamModifyFinish() 171 175 { 176 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 172 177 $Output = ''; 173 if ($ this->System->User->Licence(LICENCE_USER))178 if ($User->Licence(LICENCE_USER)) 174 179 { 175 180 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 181 { 177 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$ this->System->User->Id);182 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id); 178 183 if ($DbResult->num_rows > 0) 179 184 { … … 197 202 function TeamCreate() 198 203 { 199 if ($this->System->User->Licence(LICENCE_USER)) 204 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 205 if ($User->Licence(LICENCE_USER)) 200 206 { 201 207 $Output ='<form action="?action=finish_create" method="post">'. … … 212 218 function TeamShow() 213 219 { 220 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 214 221 $Output = ''; 215 222 if (array_key_exists('id', $_GET) and is_numeric($_GET['id'])) … … 237 244 $Output .= '<br />'; 238 245 //$Output .= '<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> '; 239 if ($ this->System->User->Licence(LICENCE_USER))246 if ($User->Licence(LICENCE_USER)) 240 247 $Output .='<a href="?action=gointeam&id='.$Team['Id'].'">'.T('Enter to team').'</a><br /><br />'; 241 248 $XP = GetLevelMinMax($Team['AverageXP']); … … 245 252 T('Average level of team members').': <strong>'.$XP['Level'].'</strong> '.T('experience').': '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br />'. 246 253 '<br />'. 247 '<strong>'.T('Team completion state for version').' '. $this->System->Config['Web']['GameVersion'].'</strong><br />';248 249 $BuildNumber = GetBuildNumber( $this->System->Config['Web']['GameVersion']);254 '<strong>'.T('Team completion state for version').' '.Core::Cast($this->System)->Config['Web']['GameVersion'].'</strong><br />'; 255 256 $BuildNumber = GetBuildNumber(Core::Cast($this->System)->Config['Web']['GameVersion']); 250 257 251 258 $GroupListQuery = 'SELECT `Group`.* FROM `Group`'; … … 259 266 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 260 267 'WHERE (`User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.$Team['Id'].')) '. 261 'AND (`Complete` = 1) AND (`T`.`Language`!='. $this->System->Config['OriginalLanguage'].') '.268 'AND (`Complete` = 1) AND (`T`.`Language`!='.Core::Cast($this->System)->Config['OriginalLanguage'].') '. 262 269 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 263 270 ') AS `C1`) AS `Translated`, '. 264 271 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 265 272 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 266 'WHERE (`Language` = '. $this->System->Config['OriginalLanguage'].') '.273 'WHERE (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') '. 267 274 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 268 275 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; … … 311 318 function TeamLeave() 312 319 { 313 if ($this->System->User->Licence(LICENCE_USER)) 314 { 315 $this->Database->query('UPDATE `User` SET `Team` = NULL WHERE `ID` = '.$this->System->User->Id); 320 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 321 if ($User->Licence(LICENCE_USER)) 322 { 323 $this->Database->query('UPDATE `User` SET `Team` = NULL WHERE `ID` = '.$User->Id); 316 324 $Output = ShowMessage(T('You are now not member of any team')); 317 325 $this->System->ModuleManager->Modules['Log']->WriteLog('Uživatel vystoupil z týmu', LOG_TYPE_USER); -
trunk/Modules/Translation/Comparison.php
r888 r893 40 40 function Show(): string 41 41 { 42 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 42 43 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 43 44 44 45 $Output = ''; 45 46 46 if ($ this->System->User->Licence(LICENCE_USER))47 if ($User->Licence(LICENCE_USER)) 47 48 { 48 49 $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 />'; -
trunk/Modules/Translation/Form.php
r888 r893 19 19 function ShowForm(): string 20 20 { 21 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 21 22 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 22 23 … … 41 42 } else 42 43 { 43 if ( $this->System->Config['OriginalLanguage'] == $Line['Language']){44 if (Core::Cast($this->System)->Config['OriginalLanguage'] == $Line['Language']){ 44 45 $LineAJ = $Line; 45 46 46 if ($ this->System->User->Language <> '') $Language = '`Language` = '.$this->System->User->Language;47 else $Language = '`Language` != '. $this->System->Config['OriginalLanguage'];47 if ($User->Language <> '') $Language = '`Language` = '.$User->Language; 48 else $Language = '`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']; 48 49 $Columns = ''; 49 50 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) … … 55 56 $where = ' WHERE '.'( `Tran`.'.$Language.' ) AND '.'(`Tran`.`Entry` = '.$Line['Entry'].') ORDER BY `Tran`.`ModifyTime` DESC'; 56 57 $DbResult = $this->Database->query($sql.$join.$where); 57 while ($LineSearch = $DbResult->fetch_assoc()) { 58 while ($LineSearch = $DbResult->fetch_assoc()) 59 { 58 60 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 61 { 59 62 if ($TextItem['Visible'] == 1) 63 { 60 64 if (($LineAJ[$TextItem['Column']] <> '') and 61 65 ($LineSearch[$TextItem['Column']] <> '') and 62 66 ($LineSearch['Orig_'.$TextItem['Column']] <> $LineSearch[$TextItem['Column']]) and 63 67 ($LineAJ[$TextItem['Column']] == $Line[$TextItem['Column']]) 64 ) 65 { 66 $Line[$TextItem['Column']] = $LineSearch[$TextItem['Column']]; 67 } 68 } 69 70 } else { 68 ) 69 { 70 $Line[$TextItem['Column']] = $LineSearch[$TextItem['Column']]; 71 } 72 } 73 } 74 } 75 } else 76 { 71 77 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE '. 72 '(`Language` = '. $this->System->Config['OriginalLanguage'].') AND '.78 '(`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND '. 73 79 '(`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1'); 74 80 $LineAJ = $DbResult->fetch_assoc(); … … 79 85 } else 80 86 { 81 82 87 if ($Line['User'] != '') 83 88 { … … 128 133 <input type="hidden" name="ID2" value="'.$TextID.'" />'; 129 134 130 if ($ this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user135 if ($User->Licence(LICENCE_USER)) { // allow to compare only to user 131 136 $Output .= '<select onchange="this.form.submit();" name="ID1"> 132 137 <option value="-1">'.T('Select text for comparison').'</option> … … 155 160 156 161 // Special characters: $B - New line, $N - Name, $C - profession 157 if ($ this->System->User->Licence(LICENCE_USER))162 if ($User->Licence(LICENCE_USER)) 158 163 { 159 164 $Output .= '<form action="'.$this->System->Link('/save.php?group='.$GroupId).'" method="post"><div>'; … … 175 180 176 181 $Output .= '<input type="hidden" name="entry" value="'.$LineAJ['Entry'].'" /> 177 <input type="hidden" name="user" value="'.$ this->System->User->Id.'" />182 <input type="hidden" name="user" value="'.$User->Id.'" /> 178 183 <input type="hidden" name="ID" value="'.$TextID.'" /> 179 184 <table class="BaseTable"> … … 188 193 <td>'; 189 194 if ($Line['Language'] <> 0) $Language = $Line['Language']; 190 else if ($ this->System->User->Id != 0)191 { 192 $Language = $ this->System->User->Language;195 else if ($User->Id != 0) 196 { 197 $Language = $User->Language; 193 198 } else $Language = 0; 194 if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language); 195 else { 199 if ($User->Licence(LICENCE_USER)) 200 { 201 $Output .= WriteLanguages($Language); 202 } 203 else 204 { 196 205 $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '(`Enabled` = 1) AND (`Id`='.$Language.')'); 197 206 if ($DbResult3->num_rows > 0) … … 200 209 $Output .= T($Language['Name']); 201 210 } 202 211 } 203 212 204 213 $Output .= '</td></tr>'; … … 210 219 $Output .= '$(document).ready(function() {'; 211 220 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 221 { 212 222 $Output .= '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");'; 223 } 213 224 214 225 $Output .= '});'. 215 226 '</script>'; 216 227 217 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 228 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 229 { 218 230 if ($TextItem['Visible'] == 1) 219 231 { … … 225 237 $Output .= '<td id="'.$TextItem['Column'].'">'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td> 226 238 <td>'; 227 if ($ this->System->User->Licence(LICENCE_USER))239 if ($User->Licence(LICENCE_USER)) 228 240 $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 229 241 $Output .= htmlspecialchars($Line[$TextItem['Column']]); 230 if ($ this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';242 if ($User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>'; 231 243 } 232 244 } else … … 234 246 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Line[$TextItem['Column']]).'" />'; 235 247 } 236 $Output .= '</table></div>'; 237 if ($this->System->User->Licence(LICENCE_USER)) { 238 $Output .= '</form>'; 239 240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and 241 $this->System->Config['Web']['EnableGoogleTranslate']) 242 { 248 } 249 250 $Output .= '</table></div>'; 251 if ($User->Licence(LICENCE_USER)) 252 { 253 $Output .= '</form>'; 254 255 if (isset(Core::Cast($this->System)->Config['Web']['EnableGoogleTranslate']) and 256 Core::Cast($this->System)->Config['Web']['EnableGoogleTranslate']) 257 { 243 258 $Output .= '<br/><table class="BaseTable">'. 244 259 '<tr><th>'.T('Google translator').':</th><th>'.T('Not translated').'</th><th>'.T('Translated').'</th>'; 245 260 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 261 { 246 262 if ($TextItem['Visible'] == 1) 263 { 247 264 if ($LineAJ[$TextItem['Column']] <> '') 265 { 248 266 $Output .= '<tr><td>'.$TextItem['Column'].'</td>'. 249 267 '<td>'.$LineAJ[$TextItem['Column']].'</td>'. 250 '<td>'.GetTranslateGoogle($LineAJ[$TextItem['Column']]).'</td></tr>'; 251 268 '<td>'.GetTranslateGoogle($this->System, $LineAJ[$TextItem['Column']]).'</td></tr>'; 269 } 270 } 271 } 252 272 $Output .= '</table>'; 253 254 273 } 274 } 255 275 } 256 276 } … … 261 281 function Delete() 262 282 { 283 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 263 284 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 264 285 265 if ($ this->System->User->Licence(LICENCE_MODERATOR))286 if ($User->Licence(LICENCE_MODERATOR)) 266 287 { 267 288 $GroupId = LoadGroupIdParameter(); … … 269 290 $Table = $TranslationTree[$GroupId]['TablePrefix']; 270 291 $TextID = $_GET['ID']; 271 $this->Database->query('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> '. $this->System->Config['OriginalLanguage']);292 $this->Database->query('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> '.Core::Cast($this->System)->Config['OriginalLanguage']); 272 293 $Output = ShowMessage('Překlad byl smazán.'); 273 294 $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); -
trunk/Modules/Translation/LoadNames.php
r888 r893 20 20 return $Text; 21 21 } 22 22 23 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) 23 24 { … … 44 45 $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text); 45 46 $Text = str_replace('$g','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text); 46 foreach ($names as $Line) { 47 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 48 if ($Line[3] <> '') { 49 $Text = $this->ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 50 51 } else { 52 $Text = $this->ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 47 foreach ($names as $Line) 48 { 49 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 50 { 51 if ($Line[3] <> '') 52 { 53 $Text = $this->ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 54 } else 55 { 56 $Text = $this->ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 57 } 53 58 } 54 59 } … … 58 63 function LoadNames() 59 64 { 65 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 60 66 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 61 67 … … 72 78 $Text = $LineAJ[$Column]; 73 79 $names = array(); 74 if ($ this->System->User->Licence(LICENCE_USER))80 if ($User->Licence(LICENCE_USER)) 75 81 if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 76 82 { 77 83 //<span class="edit">barvou.</span> 78 84 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); 79 } else { 80 if (($GroupId == 13)) { 85 } else 86 { 87 if (($GroupId == 13)) 88 { 81 89 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 82 90 'TextGlobalString' => 'Text', 'TextArea' => 'Name', 83 91 'TextItemSubClass' => 'Name', 'TextCharacterRace' => 'Name1',), false); 84 } else { 92 } else 93 { 85 94 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); 86 95 } 87 96 } 88 97 //$LineAJ[$Column] 89 98 return $this->ColorNames(htmlspecialchars($Text),$names); 90 99 } -
trunk/Modules/Translation/Progress.php
r888 r893 9 9 $BuildNumber = GetBuildNumber($_SESSION['StatVersion']); 10 10 if (is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')'; 11 else $LanguageFilter = ' AND (`Language`!='. $this->System->Config['OriginalLanguage'].')';11 else $LanguageFilter = ' AND (`Language`!='.Core::Cast($this->System)->Config['OriginalLanguage'].')'; 12 12 13 13 $GroupListQuery = 'SELECT `Id`, `TablePrefix`, `Name` FROM `Group`'; … … 25 25 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 26 26 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 27 'WHERE (`Language` = '. $this->System->Config['OriginalLanguage'].') '.27 'WHERE (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') '. 28 28 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 29 29 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; … … 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 63 return $Output; … … 66 66 function Show(): string 67 67 { 68 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 68 69 $this->Title = T('Progress'); 69 70 $LanguageList = GetLanguageList(); … … 72 73 if (!array_key_exists('StatVersion', $_SESSION)) 73 74 { 74 if ($ this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))75 if ($User->Licence(LICENCE_USER) and ($User->PreferredVersionGame != '')) 75 76 { 76 $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame; 77 } else { 78 $_SESSION['StatVersion'] = $this->System->Config['Web']['GameVersion']; 77 $_SESSION['StatVersion'] = $User->PreferredVersionGame; 78 } else 79 { 80 $_SESSION['StatVersion'] = Core::Cast($this->System)->Config['Web']['GameVersion']; 79 81 } 80 82 } … … 82 84 if (!isset($_SESSION['language'])) 83 85 { 84 if ($ this->System->User->Licence(LICENCE_USER))86 if ($User->Licence(LICENCE_USER)) 85 87 { 86 $_SESSION['language'] = $this->System->User->Language; 87 } else { 88 $_SESSION['language'] = $User->Language; 89 } else 90 { 88 91 $_SESSION['language'] = ''; 89 92 } … … 93 96 if ($_GET['language'] == '') { 94 97 $_SESSION['language'] = ''; 95 } else { 98 } else 99 { 96 100 $_SESSION['language'] = $_GET['language'] * 1; 97 101 } … … 103 107 $DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`'); 104 108 while ($DbRow = $DbResult->fetch_assoc()) 109 { 105 110 $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> '; 111 } 106 112 $Output .= '<br/>'; 107 113 -
trunk/Modules/Translation/Save.php
r888 r893 5 5 function Translate($Group, $TextID, $Complete, $Language) 6 6 { 7 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 7 8 $Output = ''; 8 9 $Table = $Group['TablePrefix']; … … 17 18 // Get data for english original 18 19 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Entry`='.$SourceText['Entry'].') '. 19 'AND (`Language` = '. $this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '.20 'AND (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '. 20 21 'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')'); 21 22 if ($DbResult->num_rows > 0) … … 33 34 else $Filter = ' AND 0'; 34 35 35 $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '. $this->System->Config['OriginalLanguage'].')'.$Filter;36 $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].')'.$Filter; 36 37 $DbResult = $this->Database->query($Query); 37 38 while ($EnglishFound = $DbResult->fetch_assoc()) 38 39 { 39 40 // Get user translation paired to found english item entry 40 $DbResult2 = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`User` = '.$ this->System->User->Id.41 $DbResult2 = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`User` = '.$User->Id. 41 42 ') AND (`Entry` = '.$EnglishFound['Entry'].') AND (`VersionStart` = '.$EnglishFound['VersionStart']. 42 43 ') AND (`VersionEnd` = '.$EnglishFound['VersionEnd'].')'); … … 110 111 $Columns = '`Entry`, `VersionStart`, `VersionEnd`, `Language`, `User`, `Take`, `ModifyTime`'; 111 112 $Values = $EnglishFound['Entry'].', '.$EnglishFound['VersionStart'].', '. 112 $EnglishFound['VersionEnd'].', '.$Language.', '.$ this->System->User->Id.', '.$TakeID.', NOW()';113 $EnglishFound['VersionEnd'].', '.$Language.', '.$User->Id.', '.$TakeID.', NOW()'; 113 114 114 115 $CompleteParts = 0; … … 178 179 global $Message, $MessageType; 179 180 181 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 180 182 $Output = ''; 181 183 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); … … 188 190 $Group = $TranslationTree[$GroupId]; 189 191 $Table = $Group['TablePrefix']; 190 if ($ this->System->User->Licence(LICENCE_USER))192 if ($User->Licence(LICENCE_USER)) 191 193 { 192 194 if (array_key_exists('ID', $_POST) and is_numeric($_POST['ID'])) … … 202 204 $Output .= $this->ShowRedirection($GroupId, $Table, $TextID); 203 205 204 UserLevelUpdate($ this->System->User->Id);206 UserLevelUpdate($User->Id); 205 207 } else $Output .= ShowMessage('Položka nenalezena', MESSAGE_CRITICAL); 206 208 } else … … 237 239 function ShowRedirection($GroupId, $Table, $TextID) 238 240 { 241 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 239 242 // Address and redirecting 240 243 $Output = '<br />'.T('Translate').': <a href="'.$this->System->Link('/TranslationList.php?group='.$GroupId.'&state=1&user=0&entry=').'">'.T('Not translated').'</a> '; … … 243 246 $next = FollowingTran($TextID, $Table, $GroupId); 244 247 $Output .= '<br /><br />'; 245 $DbResult = $this->Database->query('SELECT `Redirecting` FROM `User` WHERE `ID`='.$ this->System->User->Id);248 $DbResult = $this->Database->query('SELECT `Redirecting` FROM `User` WHERE `ID`='.$User->Id); 246 249 $redirecting = $DbResult->fetch_assoc(); 247 250 -
trunk/Modules/Translation/Translation.php
r888 r893 11 11 class ModuleTranslation extends Module 12 12 { 13 public array $TranslationTree; 14 13 15 function __construct(System $System) 14 16 { … … 79 81 ( 80 82 'Title' => strip_tags($DbRow['Text'].' ('.$DbRow['UserName'].')'), 81 'Link' => 'http://'. $this->System->Config['Web']['Host'].$this->System->Link('/'),83 'Link' => 'http://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/'), 82 84 'Description' => $DbRow['Text'], 83 85 'Time' => $DbRow['Date'], … … 86 88 $Output = GenerateRSS(array 87 89 ( 88 'Title' => $this->System->Config['Web']['Title'].' - '.T('Last translations'),89 'Link' => 'http ://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),90 'Description' => $this->System->Config['Web']['Description'],91 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],90 'Title' => Core::Cast($this->System)->Config['Web']['Title'].' - '.T('Last translations'), 91 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/'), 92 'Description' => Core::Cast($this->System)->Config['Web']['Description'], 93 'WebmasterEmail' => Core::Cast($this->System)->Config['Web']['AdminEmail'], 92 94 'Items' => $Items, 93 95 )); … … 113 115 $DbRow['Id'].' AS `Group`, "'.addslashes($DbRow['Name']).'" AS `GroupName`, `T`.`Take` FROM `'. 114 116 $DbRow['TablePrefix'].'` AS `T`'. 115 ' WHERE (`T`.`Complete` = 1) AND (`T`.`Language` != '. $this->System->Config['OriginalLanguage'].') ORDER BY `T`.`ModifyTime` DESC LIMIT '.117 ' WHERE (`T`.`Complete` = 1) AND (`T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage'].') ORDER BY `T`.`ModifyTime` DESC LIMIT '. 116 118 $Count.') AS `T`'; 117 119 } … … 139 141 { 140 142 if (isset($this->TranslationTree)) return $this->TranslationTree; 141 else { 143 else 144 { 142 145 $Result = array(); 143 146 $Groups = array(); … … 164 167 function ShowTranslatedMenu() 165 168 { 169 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 166 170 $TranslationTree = $this->GetTranslationTree(); 167 171 … … 183 187 ' <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'. 184 188 $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))189 if (isset($User) and $User->Licence(LICENCE_USER)) 186 190 { 187 191 $Output .= ' <a title="'.T('Unfinished translations').'" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=3').'">'.T('Unfinished').'</a><br />'. 188 192 ' <a title="Všechny překlady, které jste přeložil" href="'. 189 193 $this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=1&user='. 190 $ this->System->User->Id).'&entry=&text=">'.T('Own').'</a><br />';194 $User->Id).'&entry=&text=">'.T('Own').'</a><br />'; 191 195 } 192 196 $Output .= ' <a title="'.T('Compose special filter').'" href="'. … … 198 202 return $Output; 199 203 } 204 205 static function Cast(Module $Module): ModuleTranslation 206 { 207 if ($Module instanceof ModuleTranslation) 208 { 209 return $Module; 210 } 211 throw new Exception('Expected '.ModuleTranslation::GetClassName().' type but got '.gettype($Module)); 212 } 200 213 } -
trunk/Modules/Translation/TranslationList.php
r888 r893 13 13 } 14 14 15 16 15 class PageTranslationList extends Page 17 16 { 18 17 function ShowFilter($GroupId = 0) 19 18 { 20 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 19 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 20 $TranslationTree = ModuleTranslation::Cast($this->System->GetModule('Translation'))->GetTranslationTree(); 21 21 22 22 $Filter = array('SQL' => ''); … … 85 85 $Output .= '</select></td>'; 86 86 87 if ($ this->System->User->Licence(LICENCE_USER))88 $Filter['Version'] = GetParameter('version', $ this->System->User->PreferredVersion, true, true);87 if ($User->Licence(LICENCE_USER)) 88 $Filter['Version'] = GetParameter('version', $User->PreferredVersion, true, true); 89 89 else 90 90 $Filter['Version'] = GetParameter('version', 0, true, true); … … 176 176 { 177 177 $WithoutAlter = ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. 178 '(`Sub`.`Language` <> '. $this->System->Config['OriginalLanguage'].')'.$LanguageFilterSub.178 '(`Sub`.`Language` <> '.Core::Cast($this->System)->Config['OriginalLanguage'].')'.$LanguageFilterSub. 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 ) '; … … 184 184 ' < ('. 185 185 'SELECT LENGTH(`Sub`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `Sub`.`'.$GroupItem['Column'].'`, \'$\', \'\' ) ) FROM `'.$Table.'` AS `Sub` WHERE '. 186 ' `Sub`.`Entry` = `T`.`Entry` AND `Sub`.`Language` = '. $this->System->Config['OriginalLanguage'].' AND '.186 ' `Sub`.`Entry` = `T`.`Entry` AND `Sub`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].' AND '. 187 187 '`Sub`.`VersionStart` = `T`.`VersionStart` AND `Sub`.`VersionEnd` = `T`.`VersionEnd` LIMIT 1 '. 188 188 ')'; … … 192 192 } else 193 193 if ($Filter['State'] == CompletionState::NotTranslated) { 194 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '. $this->System->Config['OriginalLanguage'].') '.194 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') '. 195 195 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. 196 '(`Sub`.`Language` <> '. $this->System->Config['OriginalLanguage'].') '.$LanguageFilterSub.$UserFilter.196 '(`Sub`.`Language` <> '.Core::Cast($this->System)->Config['OriginalLanguage'].') '.$LanguageFilterSub.$UserFilter. 197 197 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND '. 198 198 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; … … 202 202 } else 203 203 if ($Filter['State'] == CompletionState::NotFinished) { 204 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '. $this->System->Config['OriginalLanguage'].204 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']. 205 205 ') AND (`T`.`Complete` = 0)'; 206 206 } else 207 207 if ($Filter['State'] == CompletionState::Original) { 208 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '. $this->System->Config['OriginalLanguage'].')';208 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].')'; 209 209 } else 210 210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) { 211 211 $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 212 ' AND (`T`.`Language` != '. $this->System->Config['OriginalLanguage'].212 ' AND (`T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']. 213 213 ') AND (`T`.`Complete` = 0)'; 214 214 } else 215 215 if ($Filter['State'] == CompletionState::Missing1) { 216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '. $this->System->Config['OriginalLanguage'];216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']; 217 217 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 218 218 } else 219 219 if ($Filter['State'] == CompletionState::Missing2) { 220 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '. $this->System->Config['OriginalLanguage'];220 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']; 221 221 $Filter['SQL'] .= ' '. $WithoutAlter; 222 222 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; … … 333 333 function ShowMenu() 334 334 { 335 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 335 336 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 336 337 … … 351 352 '<td>'.T('Texts marked as unfinished').'</td></tr>'; 352 353 353 if ($ this->System->User->Licence(LICENCE_USER))354 if ($User->Licence(LICENCE_USER)) 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>356 $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&state=3&user='.$User->Id.'">'.T('My unfinished').'</a></td> 356 357 <td>'.T('Unfinished texts of logged-in user').'</td></tr> 357 <tr><td><a title="'.T('Translated texts of logged-in user').'" href="?group='.$GroupId.'&state=2&user='.$ this->System->User->Id.'">'.T('My translated').'</a></td>358 <tr><td><a title="'.T('Translated texts of logged-in user').'" href="?group='.$GroupId.'&state=2&user='.$User->Id.'">'.T('My translated').'</a></td> 358 359 <td>'.T('Translated texts of logged-in user').'</td></tr>'; 359 360 } … … 395 396 function ShowList() 396 397 { 398 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 397 399 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Group`'); 398 400 $DbRow = $DbResult->fetch_row(); … … 408 410 array('Name' => 'LastImport', 'Title' => T('Date of last import')), 409 411 array('Name' => 'LastVersion', 'Title' => T('Version of last import')), 410 );411 if ($this->System->User->Licence(LICENCE_ADMIN))412 $TableColumns[] = array('Name' => '', 'Title' => T('Actions'));413 414 $Order = GetOrderTableHeader($TableColumns, 'Name', 0);415 $Output .= $Order['Output'];416 417 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);418 while ($Group = $DbResult->fetch_assoc())419 {420 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.T($Group['Name']).'</a></td>'.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 ';425 $Output .= '</td>';426 if ($this->System->User->Licence(LICENCE_ADMIN))427 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='.428 $Group['Id'].'&type=11').'">'.HumanDate($Group['LastImport']).'</a></td>';429 else $Output .= '<td>'.HumanDate($Group['LastImport']).'</td>';430 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='.431 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>';432 if ($this->System->User->Licence(LICENCE_ADMIN))433 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">'.T('Remove').'</a></td>';434 $Output .= '</tr>';412 ); 413 if ($User->Licence(LICENCE_ADMIN)) 414 $TableColumns[] = array('Name' => '', 'Title' => T('Actions')); 415 416 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 417 $Output .= $Order['Output']; 418 419 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 420 while ($Group = $DbResult->fetch_assoc()) 421 { 422 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.T($Group['Name']).'</a></td>'. 423 '<td>'.$Group['SourceType'].'</td><td>'; 424 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql '; 425 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc '; 426 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua '; 427 $Output .= '</td>'; 428 if ($User->Licence(LICENCE_ADMIN)) 429 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='. 430 $Group['Id'].'&type=11').'">'.HumanDate($Group['LastImport']).'</a></td>'; 431 else $Output .= '<td>'.HumanDate($Group['LastImport']).'</td>'; 432 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='. 433 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>'; 434 if ($User->Licence(LICENCE_ADMIN)) 435 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">'.T('Remove').'</a></td>'; 436 $Output .= '</tr>'; 435 437 } 436 438 $Output .= '</table>'. 437 439 '<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>';440 if ($User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>'; 439 441 return $Output; 440 442 } … … 442 444 function ShowGroupAdd() 443 445 { 444 if ($this->System->User->Licence(LICENCE_ADMIN)) 446 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 447 if ($User->Licence(LICENCE_ADMIN)) 445 448 { 446 449 $Output = '<h3>Vložení nové překladové skupiny</h3>'. … … 457 460 function ShowGroupAddFinish() 458 461 { 459 if ($this->System->User->Licence(LICENCE_ADMIN)) 462 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 463 if ($User->Licence(LICENCE_ADMIN)) 460 464 { 461 465 $TableName = 'Text'.$_POST['TablePrefix']; … … 505 509 function ShowGroupDelete() 506 510 { 507 if ($this->System->User->Licence(LICENCE_ADMIN)) 511 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 512 if ($User->Licence(LICENCE_ADMIN)) 508 513 { 509 514 $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']); -
trunk/Modules/User/Options.php
r892 r893 5 5 function UserOptionsFrom() 6 6 { 7 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 7 8 $Output = '<form action="'.$this->System->Link('/options/?action=save').'" method="post"> 8 9 <fieldset><legend>'.T('User settings').'</legend> 9 10 <table> 10 <tr><td>'.T('E-mail').':</td><td><input type="text" name="Email" value="'.$ this->System->User->Email.'" /></td></tr>11 <tr><td>'.T('E-mail').':</td><td><input type="text" name="Email" value="'.$User->Email.'" /></td></tr> 11 12 <tr><td>'.T('Original password').':</td><td><input type="password" name="OldPass" /></td></tr> 12 13 <tr><td>'.T('New password').':</td><td><input type="password" name="NewPass" /></td></tr> 13 14 <tr><td>'.T('New password confirmation').': </td><td><input type="password" name="NewPass2" /></td></tr> 14 <tr><td>'.T('I will translate normally to').': </td><td>'.WriteLanguages($ this->System->User->Language).'</td></tr>15 <tr><td>'.T('I will translate normally to').': </td><td>'.WriteLanguages($User->Language).'</td></tr> 15 16 <tr><td>'.T('After save translation redirect to').': </td><td>'; 16 17 $Output .= '<select name="redirecting">'. 17 18 '<option value="0">'.T('Nowhere').'</option>'. 18 19 '<option value="1"'; 19 if ($ this->System->User->Redirecting == '1') $Output .= ' selected="selected"';20 if ($User->Redirecting == '1') $Output .= ' selected="selected"'; 20 21 $Output .= '>'.T('To untranslated').'</option>'; 21 22 $Output .= '<option value="2"'; 22 if ($ this->System->User->Redirecting == '2') $Output .= ' selected="selected"';23 if ($User->Redirecting == '2') $Output .= ' selected="selected"'; 23 24 $Output .= '>'.T('To next translation').'</option>'; 24 25 $Output .= '<option value="3"'; 25 if ($ this->System->User->Redirecting == '3') $Output .= ' selected="selected"';26 if ($User->Redirecting == '3') $Output .= ' selected="selected"'; 26 27 $Output .= '>'.T('To previous translation').'</option>'; 27 28 $Output .= '</select>'; 28 29 29 30 $Output .= '</td></tr>'. 30 '<tr><td>'.T('Preferred client version').': </td><td>'.ClientVersionSelection($ this->System->User->PreferredVersion).'</td></tr>'.31 '<tr><td>'.T('Preferred client version').': </td><td>'.ClientVersionSelection($User->PreferredVersion).'</td></tr>'. 31 32 '<tr><td>'.T('Public profile text').':</td><td>'. 32 '<textarea name="info" cols="60" rows="10">'.htmlspecialchars($ this->System->User->Info).'</textarea></td></tr>';33 '<textarea name="info" cols="60" rows="10">'.htmlspecialchars($User->Info).'</textarea></td></tr>'; 33 34 34 35 $Output .= '<tr><td>'; … … 40 41 $Query = 'SELECT * FROM `UserTag` '. 41 42 //'LEFT JOIN `UserTagType` ON `UserTagType`.`ID` = `UserTag`.`UserTagType` '. 42 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($ this->System->User->Id * 1);43 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($User->Id * 1); 43 44 $DbResult2 = $this->Database->query($Query); 44 45 if ($DbResult2->num_rows != 0) $checked = true; … … 64 65 { 65 66 $Output .= '<option value="'.$LineTeam['Id'].'"'; 66 if ($LineTeam['Id'] == $ this->System->User->Team) $Output .= ' selected="selected"';67 if ($LineTeam['Id'] == $User->Team) $Output .= ' selected="selected"'; 67 68 $Output .= '>'.htmlspecialchars($LineTeam['Name']).'</option>'; 68 69 } … … 77 78 { 78 79 $Output = ''; 80 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 79 81 if (array_key_exists('Email', $_POST)) 80 82 { … … 94 96 if ($NewPass == $NewPass2) 95 97 { 96 $DbResult = $this->System->Database->query('SELECT `Pass`, '.$ this->System->User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$this->System->User->Id);98 $DbResult = $this->System->Database->query('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id); 97 99 $DbRow = $DbResult->fetch_assoc(); 98 100 if ($DbRow['Hash'] == $DbRow['Pass']) 99 101 { 100 102 // Update password 101 $Salt = $ this->System->User->GetPasswordSalt();102 $this->Database->query('UPDATE `User` SET `Pass` = '.$ this->System->User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$this->System->User->Id);103 $Salt = $User->GetPasswordSalt(); 104 $this->Database->query('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id); 103 105 $Output .= ShowMessage('Heslo změněno.'); 104 106 } else $Output .= ShowMessage('Staré heslo neodpovídá.', MESSAGE_CRITICAL); … … 113 115 { 114 116 $Query = 'SELECT * FROM `UserTag` '. 115 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($ this->System->User->Id * 1);117 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($User->Id * 1); 116 118 $DbResult2 = $this->Database->query($Query); 117 119 if ($DbResult2->num_rows == 0) 118 120 { 119 121 $Query = 'INSERT INTO `UserTag` (`ID` ,`UserTagType`,`User` ) '. 120 'VALUES (NULL, '.$UserTag['ID'].' , '.($ this->System->User->Id * 1).')';122 'VALUES (NULL, '.$UserTag['ID'].' , '.($User->Id * 1).')'; 121 123 $DbResult2 = $this->Database->query($Query); 122 124 } … … 124 126 { 125 127 $Query = 'DELETE FROM `UserTag` '. 126 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($ this->System->User->Id * 1);128 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($User->Id * 1); 127 129 $DbResult2 = $this->Database->query($Query); 128 130 } 129 131 } 130 132 131 $this->Database->update('User', '`ID` = '.$ this->System->User->Id, array('Email' => $Email,133 $this->Database->update('User', '`ID` = '.$User->Id, array('Email' => $Email, 132 134 'Language' => $Language, 'Redirecting' => $Redirecting, 'Info' => $Info, 133 135 'PreferredVersion' => $PreferredVersion)); 134 $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$ this->System->User->Name.'</b>');136 $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User->Name.'</b>'); 135 137 $this->System->ModuleManager->Modules['Log']->WriteLog('Úprava nastavení!', LOG_TYPE_USER); 136 $ this->System->User->Load();138 $User->Load(); 137 139 } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL); 138 140 return $Output; … … 143 145 $this->Title = T('User settings'); 144 146 $Output = ''; 145 if ($this->System->User->Licence(LICENCE_USER)) 147 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 148 if ($User->Licence(LICENCE_USER)) 146 149 { 147 150 if (array_key_exists('action', $_GET) and ($_GET['action'] == 'save')) -
trunk/Modules/User/Profile.php
r892 r893 5 5 function SendMail() 6 6 { 7 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 7 8 $Output = ''; 8 9 if (array_key_exists('text', $_POST)) 9 if ($ this->System->User->Licence(LICENCE_ADMIN))10 if ($User->Licence(LICENCE_ADMIN)) 10 11 { 11 12 $Text = $_POST['text']; … … 16 17 'Text: <strong>'.$Text.'</strong><br />'; 17 18 18 if (@mail($Email, $Subject, $Text, 'From: '. $this->System->Config['Web']['AdminEmail'].19 '\nReply-To: '. $this->System->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/'))19 if (@mail($Email, $Subject, $Text, 'From: '.Core::Cast($this->System)->Config['Web']['AdminEmail']. 20 '\nReply-To: '.Core::Cast($this->System)->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/')) 20 21 { 21 22 $Output .= ShowMessage(T('Message was sent')); … … 29 30 { 30 31 $Output = ''; 32 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 31 33 $Filter = ' WHERE `Export`.`User` = '.($_GET['user'] * 1); 32 34 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter); … … 61 63 $Action = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Export['Id'].'&Tab=0').'">'.T('Show').'</a> '. 62 64 '<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>';65 if ($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Really remove item?').'\');">'.T('Remove').'</a>'; 66 if ($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 67 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 66 68 '<td>'.htmlspecialchars($Export['Title']).'</td>'. … … 95 97 $DbRow['TablePrefix'].'` AS `T` '. 96 98 'WHERE (`T`.`Complete` = 1) AND '. 97 '(`T`.`Language` != '. $this->System->Config['OriginalLanguage'].') AND '.99 '(`T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND '. 98 100 '(`T`.`User` = '.($_GET['user'] * 1).') ORDER BY `T`.`ModifyTime` DESC LIMIT '. 99 101 $Count.') AS `T`'; … … 139 141 { 140 142 $Output = ''; 143 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 141 144 $Query = 'SELECT `User`.`Name`, `UserTrace`.`LastLogin`, `UserTrace`.`LastIP`, '. 142 145 '`User`.`Email`, `UserTrace`.`UserAgent`, `User`.`PreferredVersion`, '. … … 190 193 '</tr></table>'; 191 194 $Output .= '<br />'.$this->ShowLastForum().'<br />'; 192 if ($ this->System->User->Licence(LICENCE_MODERATOR))195 if ($User->Licence(LICENCE_MODERATOR)) 193 196 { 194 197 $Output .= '<fieldset><legend>Moderování</legend>'; … … 239 242 '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'. 240 243 'Předmět:'. 241 '<input type="text" name="subject" value="'. $this->System->Config['Web']['Title'].'" />'.244 '<input type="text" name="subject" value="'.Core::Cast($this->System)->Config['Web']['Title'].'" />'. 242 245 '<br />'. 243 246 '<textarea name="text" rows="20" cols="62">'. 244 247 ''."\n". 245 'S pozdravem '.$ this->System->User->Name."\n".248 'S pozdravem '.$User->Name."\n". 246 249 '--------------------------------------------------------'."\n". 247 $this->System->Config['Web']['Title'].' '.$this->System->Config['Web']['Host'].$this->System->Link('/')."\n".250 Core::Cast($this->System)->Config['Web']['Title'].' '.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/')."\n". 248 251 '</textarea><br/>'. 249 252 '<input type="submit" value="Odeslat" />'. -
trunk/Modules/User/Registration.php
r888 r893 86 86 function CheckRegistration() 87 87 { 88 global $Config;89 90 88 $Output = ''; 89 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 91 90 $ShowForm = true; 92 91 … … 114 113 if (($UserName != '') and ($Pass != '') and ($Pass2 != '')) 115 114 { 116 if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))115 if (!in_array(strtolower($UserName), Core::Cast($this->System)->Config['ForbiddedUserNames'])) 117 116 { 118 117 if ($Pass == $Pass2) … … 121 120 $Line = $DbResult->fetch_row(); 122 121 if (!$Line) 123 { 122 { 124 123 if ($Team == 0) $Team = 'NULL'; 125 $ this->System->User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion);124 $User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion); 126 125 $Output .= ShowMessage(T('Registration was successful')); 127 126 $Output .= 'Přečtěte si pozorně <a href="'.$this->System->Link('/info/').'">pokyny pro překladání</a> a můžete pak hned začít překládat.'; 128 $ this->System->User->Login($UserName, $Pass);127 $User->Login($UserName, $Pass); 129 128 $this->System->ModuleManager->Modules['Log']->WriteLog('Uživatel se zaregistroval: '.$UserName, LOG_TYPE_USER); 130 129 $ShowForm = false; … … 136 135 if (array_key_exists('Tag'.$UserTag['ID'], $_POST)) { 137 136 $Query = 'SELECT * FROM `UserTag` '. 138 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($ this->System->User->Id * 1);137 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($User->Id * 1); 139 138 $DbResult2 = $this->Database->query($Query); 140 139 if ($DbResult2->num_rows == 0) { 141 140 $Query = 'INSERT INTO `UserTag` (`ID` ,`UserTagType`,`User` ) '. 142 'VALUES (NULL, '.$UserTag['ID'].' , '.($ this->System->User->Id * 1).')';141 'VALUES (NULL, '.$UserTag['ID'].' , '.($User->Id * 1).')'; 143 142 $DbResult2 = $this->Database->query($Query); 144 143 } 145 144 } else { 146 145 $Query = 'DELETE FROM `UserTag` '. 147 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($ this->System->User->Id * 1);146 'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($User->Id * 1); 148 147 $DbResult2 = $this->Database->query($Query); 149 148 } -
trunk/Modules/User/User.php
r892 r893 1 1 <?php 2 2 3 include_once(dirname(__FILE__).'/ModuleUser.php'); 3 4 include_once(dirname(__FILE__).'/UserList.php'); 4 5 include_once(dirname(__FILE__).'/Options.php'); 5 6 include_once(dirname(__FILE__).'/Registration.php'); 6 7 include_once(dirname(__FILE__).'/Profile.php'); 7 8 class ModuleUser extends Module9 {10 function __construct(System $System)11 {12 parent::__construct($System);13 $this->Name = 'User';14 $this->Version = '1.1';15 $this->Creator = 'Chronos';16 $this->License = 'GNU/GPL';17 $this->Description = 'User and permission management';18 $this->Dependencies = array();19 }20 21 function DoStart(): void22 {23 $this->System->User = new User($this->System);24 $this->System->RegisterPage(['users'], 'PageUserList');25 $this->System->RegisterPage(['options'], 'PageUserOptions');26 $this->System->RegisterPage(['registration'], 'PageUserRegistration');27 $this->System->RegisterPage(['user'], 'PageUserProfile');28 $this->System->RegisterPage(['login'], 'PageUserLogin');29 Core::Cast($this->System)->RegisterMenuItem(array(30 'Title' => T('Translators'),31 'Hint' => 'Seznam registrovaných uživatelů',32 'Link' => $this->System->Link('/users/'),33 'Permission' => LICENCE_ANONYMOUS,34 'Icon' => '',35 ), 0);36 if (array_key_exists('Search', $this->System->ModuleManager->Modules))37 $this->System->ModuleManager->Modules['Search']->RegisterSearch('user',38 T('Translators'), array('Name'), '`User`', $this->System->Link('/users/?search='));39 Core::Cast($this->System)->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback'));40 Core::Cast($this->System)->RegisterPageBarItem('Left', 'User', array($this, 'ShowOnlineList'));41 }42 43 function ShowOnlineList()44 {45 $Output = T('Online translators').':<br />';46 $DbResult = $this->System->Database->query('SELECT * FROM ('.47 'SELECT `User`.`Name`, `User`.`ID` FROM `UserOnline` '.48 'JOIN `User` ON `User`.`ID` = `UserOnline`.`User` '.49 'WHERE (`ActivityTime` >= NOW() - 300) '.50 'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`');51 while ($DbUser = $DbResult->fetch_assoc())52 {53 $Name = '<a href="'.$this->System->Link('/user/?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>';54 $Output .= $Name.'<br />';55 }56 return $Output;57 }58 59 function TopBarCallback()60 {61 $Output = '';62 if ($this->System->User->Licence(LICENCE_USER))63 {64 //$DbResult =$this->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team);65 //$Team = $DbResult->fetch_assoc();66 //$Output .= ''<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>';67 $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'.68 ' <a href="'.$this->System->Link('/user/?user='.$this->System->User->Id).'">'.T('My page').'</a>'.69 ' <a href="'.$this->System->Link('/options/').'">'.T('Options').'</a>'.70 ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='.71 $this->System->User->Id.'&group=0&state=2&text=&entry=').'">'.T('Translated').'</a>'.72 ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='.73 $this->System->User->Id.'&group=0&state=3&text=&entry=').'">'.T('Unfinished').'</a>'.74 ' <a title="Nikým nepřeložené texty" href="'.75 $this->System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">'.T('Untranslated').'</a>';76 } else77 {78 $Output .= '<a href="'.$this->System->Link('/login/').'">'.T('Login').'</a> '.79 '<a href="'.$this->System->Link('/registration/').'">'.T('Registration').'</a>';80 }81 return $Output;82 }83 }84 8 85 9 class PageUserLogin extends Page … … 117 41 { 118 42 var $Id; 119 var$Name;43 public string $Name; 120 44 var $Team; 121 45 var $Role; … … 126 50 var $OnlineStateTimeout; 127 51 var $PreferredVersion = 0; 52 public string $PreferredVersionGame; 53 public string $Email; 54 public string $Info; 128 55 129 56 function __construct(System $System) -
trunk/Modules/Wiki/Wiki.php
r888 r893 1 1 <?php 2 2 3 class ModuleWiki extends Module 4 { 5 function __construct(System $System) 6 { 7 parent::__construct($System); 8 $this->Name = 'Wiki'; 9 $this->Version = '1.0'; 10 $this->Creator = 'Chronos'; 11 $this->License = 'GNU/GPLv3'; 12 $this->Description = 'Mediawiki style page management'; 13 $this->Dependencies = array(); 14 } 15 16 function DoStart(): void 17 { 18 $this->LoadPages(); 19 } 20 21 function LoadPages() 22 { 23 $DbResult = $this->Database->select('WikiPage', '*', '`VisibleInMenu`=1'); 24 while ($DbRow = $DbResult->fetch_assoc()) 25 { 26 $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki'); 27 Core::Cast($this->System)->RegisterMenuItem(array( 28 'Title' => $DbRow['Name'], 29 'Hint' => '', 30 'Link' => $this->System->Link('/'.$DbRow['NormalizedName'].'/'), 31 'Permission' => LICENCE_ANONYMOUS, 32 'Icon' => '', 33 ), 6); 34 } 35 } 36 } 3 include_once(dirname(__FILE__).'/ModuleWiki.php'); 37 4 38 5 class PageWiki extends Page … … 52 19 function ShowContent() 53 20 { 54 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 21 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 22 $PageName = Core::Cast($this->System)->PathItems[count(Core::Cast($this->System)->PathItems) - 1]; 55 23 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 56 24 if ($DbResult->num_rows > 0) … … 65 33 $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>'; 66 34 $Output .= $DbRow2['Content']; 67 if ($ this->System->User->Licence(LICENCE_MODERATOR))35 if ($User->Licence(LICENCE_MODERATOR)) 68 36 $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>'; 69 37 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); … … 76 44 $Output = '<h3>'.$DbRow['Name'].'</h3>'; 77 45 $Output .= $DbRow2['Content']; 78 if ($ this->System->User->Licence(LICENCE_MODERATOR))46 if ($User->Licence(LICENCE_MODERATOR)) 79 47 $Output .= '<hr><div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>'; 80 48 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); … … 86 54 function EditContent() 87 55 { 88 if ($this->System->User->Licence(LICENCE_MODERATOR)) 56 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 57 if ($User->Licence(LICENCE_MODERATOR)) 89 58 { 90 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];59 $PageName = Core::Cast($this->System)->PathItems[count(Core::Cast($this->System)->PathItems) - 1]; 91 60 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 92 61 if ($DbResult->num_rows > 0) … … 111 80 function SaveContent() 112 81 { 113 if ($this->System->User->Licence(LICENCE_MODERATOR)) 82 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 83 if ($User->Licence(LICENCE_MODERATOR)) 114 84 { 115 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];85 $PageName = Core::Cast($this->System)->PathItems[count(Core::Cast($this->System)->PathItems) - 1]; 116 86 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 117 87 if ($DbResult->num_rows > 0) … … 121 91 { 122 92 $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']), 123 'User' => $ this->System->User->Id, 'Time' => 'NOW()', 'Page' => $DbRow['Id']));93 'User' => $User->Id, 'Time' => 'NOW()', 'Page' => $DbRow['Id'])); 124 94 $Output = ShowMessage('Wiki stránka uložena', MESSAGE_INFORMATION); 125 95 } else $Output = ShowMessage('Nezadána platná data', MESSAGE_CRITICAL); … … 132 102 function ShowHistory() 133 103 { 134 if ($this->System->User->Licence(LICENCE_MODERATOR)) 104 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 105 if ($User->Licence(LICENCE_MODERATOR)) 135 106 { 136 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];107 $PageName = Core::Cast($this->System)->PathItems[count(Core::Cast($this->System)->PathItems) - 1]; 137 108 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 138 109 if ($DbResult->num_rows > 0)
Note:
See TracChangeset
for help on using the changeset viewer.