Changeset 860 for trunk/includes/System.php
- Timestamp:
- Jan 21, 2016, 2:49:19 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/System.php
r859 r860 11 11 /* @var LocaleManager */ 12 12 var $LocaleManager; 13 var $Bars; 13 14 14 15 function __construct() … … 21 22 $this->OnPageNotFound = array(); 22 23 $this->Pages = array(); 24 $this->Bars = array(); 23 25 } 24 26 … … 28 30 29 31 $this->Config = $Config; 30 date_default_timezone_set($this->Config['Web']['Timezone']); 32 if(isset($this->Config['Web']['Timezone'])) 33 date_default_timezone_set($this->Config['Web']['Timezone']); 31 34 mb_internal_encoding("UTF-8"); 32 35 … … 78 81 'Icon' => '', 79 82 ), 80 */ 83 81 84 array( 82 85 'Title' => T('IRC chat'), … … 86 89 'Icon' => '', 87 90 ), 91 */ 88 92 ); 89 93 } … … 106 110 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 107 111 112 $this->RegisterPageBar('Top'); 113 $this->RegisterPageBar('Left'); 114 $this->RegisterPageBar('Right'); 108 115 $this->Init(); 109 116 … … 116 123 $this->ModuleManager->Start(); 117 124 } 118 119 // Initialize application modules120 $this->ModuleManager->RegisterModule(new ModuleError($this));121 $this->ModuleManager->Modules['Error']->ErrorHandler->ShowError = $this->Config['Web']['ShowPHPError'];122 $this->ModuleManager->RegisterModule(new ModuleLog($this));123 $this->ModuleManager->RegisterModule(new ModuleUser($this));124 $this->ModuleManager->RegisterModule(new ModuleAoWoW($this));125 $this->ModuleManager->RegisterModule(new ModuleReferrer($this));126 $this->ModuleManager->Modules['Referrer']->Excludes[] = $this->Config['Web']['Host'];127 $this->ModuleManager->RegisterModule(new ModuleTeam($this));128 $this->ModuleManager->RegisterModule(new ModuleDictionary($this));129 $this->ModuleManager->RegisterModule(new ModuleTranslation($this));130 $this->ModuleManager->RegisterModule(new ModuleImport($this));131 $this->ModuleManager->RegisterModule(new ModuleExport($this));132 $this->ModuleManager->RegisterModule(new ModuleServer($this));133 $this->ModuleManager->RegisterModule(new ModuleClientVersion($this));134 $this->ModuleManager->RegisterModule(new ModuleShoutBox($this));135 $this->ModuleManager->RegisterModule(new ModuleNews($this));136 $this->ModuleManager->RegisterModule(new ModuleWiki($this));137 $this->ModuleManager->RegisterModule(new ModuleSearch($this));138 $this->ModuleManager->RegisterModule(new ModuleFrontPage($this));139 $this->ModuleManager->RegisterModule(new ModuleDownload($this));140 $this->ModuleManager->RegisterModule(new ModuleForum($this));141 $this->ModuleManager->RegisterModule(new ModuleRedirection($this));142 $this->ModuleManager->RegisterModule(new ModuleAdmin($this));143 $this->ModuleManager->RegisterModule(new ModuleInfo($this));144 $this->ModuleManager->FileName = dirname(__FILE__).'/../Config/ModulesConfig.php';145 // TODO: Allow control from web which modules should be installed146 $this->ModuleManager->InstallAll();147 $this->ModuleManager->StartAll();148 125 149 126 $this->BaseView = new BaseView($this); … … 327 304 echo($Output); 328 305 } 306 307 function RegisterPageBar($Name) 308 { 309 $this->Bars[$Name] = array(); 310 } 311 312 function UnregisterPageBar($Name) 313 { 314 unset($this->Bars[$Name]); 315 } 316 317 function RegisterPageBarItem($BarName, $ItemName, $Callback) 318 { 319 $this->Bars[$BarName][$ItemName] = $Callback; 320 } 329 321 } 330 322 … … 357 349 { 358 350 $Output = '<div class="Menu">'; 359 if(!$this->System->User->Licence(LICENCE_USER)) 360 $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>'; 351 if(isset($this->System->User)) 352 { 353 if(!$this->System->User->Licence(LICENCE_USER)) 354 $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>'; 355 } 361 356 $Output .= '<span class="MenuItem"></span><span class="MenuItem2">'; 362 if($this->System->User->Licence(LICENCE_USER)) 363 { 364 //$DbResult =$this->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team); 365 //$Team = $DbResult->fetch_assoc(); 366 //$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>'; 367 $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'. 368 ' <a href="'.$this->System->Link('/user/?user='.$this->System->User->Id).'">'.T('My page').'</a>'. 369 ' <a href="'.$this->System->Link('/options/').'">'.T('Options').'</a>'. 370 ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='. 371 $this->System->User->Id.'&group=0&state=2&text=&entry=').'">'.T('Translated').'</a>'. 372 ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='. 373 $this->System->User->Id.'&group=0&state=3&text=&entry=').'">'.T('Unfinished').'</a>'. 374 ' <a title="Nikým nepřeložené texty" href="'. 375 $this->System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">'.T('Untranslated').'</a>'; 376 } else 377 { 378 $Output .= '<a href="'.$this->System->Link('/login/').'">'.T('Login').'</a> '. 379 '<a href="'.$this->System->Link('/registration/').'">'.T('Registration').'</a>'; 380 } 357 358 // Show bars items 359 $Bar = ''; 360 foreach($this->System->Bars['Top'] as $BarItem) 361 $Bar .= call_user_func($BarItem); 362 if(trim($Bar) != '') $Output .= $Bar; 363 else $Output .= ' '; 364 381 365 $Output .= $this->ShowLocaleSelector(); 382 366 //$Output .= '</form>'; … … 432 416 '<div class="verticalmenu"><ul>'; 433 417 foreach($this->System->Menu as $MenuItem) 434 if( $this->System->User->Licence($MenuItem['Permission']))418 if(!isset($this->System->User) or $this->System->User->Licence($MenuItem['Permission'])) 435 419 { 436 420 if(isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"'; … … 466 450 ' <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'. 467 451 $this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=2&user=0&entry=&text=').'">'.T('Translated').'</a><br />'; 468 if( $this->System->User->Licence(LICENCE_USER))452 if(isset($this->System->User) and $this->System->User->Licence(LICENCE_USER)) 469 453 { 470 454 $Output .= ' <a title="'.T('Unfinished translations').'" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=3').'">'.T('Unfinished').'</a><br />'.
Note:
See TracChangeset
for help on using the changeset viewer.