Changeset 860
- Timestamp:
- Jan 21, 2016, 2:49:19 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Error/Error.php
r838 r860 23 23 function DoStart() 24 24 { 25 if(isset($this->System->Config['Web']['ShowPHPError'])) 26 $this->ErrorHandler->ShowError = $this->System->Config['Web']['ShowPHPError']; 27 else $this->ErrorHandler->ShowError = true; 25 28 $this->ErrorHandler->Start(); 26 29 } -
trunk/Modules/Referrer/Referrer.php
r838 r860 20 20 function DoStart() 21 21 { 22 $this->Excludes[] = $this->System->Config['Web']['Host']; 22 23 $this->Log(); 23 24 $this->System->RegisterPage('referrer', 'PageReferrer'); -
trunk/Modules/Translation/Translation.php
r859 r860 24 24 function DoStart() 25 25 { 26 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();27 28 26 $this->System->RegisterPage('comparison.php', 'PageTranslationComparison'); 29 27 $this->System->RegisterPage('form.php', 'PageTranslationForm'); … … 51 49 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 52 50 { 51 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 53 52 foreach($TranslationTree as $Group) 54 53 { -
trunk/Modules/User/Profile.php
r852 r860 163 163 T('Number of translated:').' <a href="'.$this->System->Link('/TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0').'" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />'. 164 164 T('Level:').' <strong>'.$XP['Level'].'</strong> '.T('experience:').' '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br/>'; 165 if($ UserLine['TeamName'] != '')165 if($this->System->ModuleManager->ModuleRunning('Team') and ($UserLine['TeamName'] != '')) 166 166 $Output .= T('Member of team:').' <a href="'.$this->System->Link('/team/?action=team&id='.$UserLine['Team']).'"><strong>'.htmlspecialchars($UserLine['TeamName']).'</strong></a><br />'; 167 167 -
trunk/Modules/User/User.php
r843 r860 37 37 $this->System->ModuleManager->Modules['Search']->RegisterSearch('user', 38 38 T('Translators'), array('Name'), '`User`', $this->System->Link('/users/?search=')); 39 $this->System->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback')); 39 40 } 40 41 … … 51 52 $Name = '<a href="'.$this->System->Link('/user/?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>'; 52 53 $Output .= $Name.'<br />'; 54 } 55 return($Output); 56 } 57 58 function TopBarCallback() 59 { 60 $Output = ''; 61 if($this->System->User->Licence(LICENCE_USER)) 62 { 63 //$DbResult =$this->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team); 64 //$Team = $DbResult->fetch_assoc(); 65 //$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>'; 66 $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'. 67 ' <a href="'.$this->System->Link('/user/?user='.$this->System->User->Id).'">'.T('My page').'</a>'. 68 ' <a href="'.$this->System->Link('/options/').'">'.T('Options').'</a>'. 69 ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='. 70 $this->System->User->Id.'&group=0&state=2&text=&entry=').'">'.T('Translated').'</a>'. 71 ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='. 72 $this->System->User->Id.'&group=0&state=3&text=&entry=').'">'.T('Unfinished').'</a>'. 73 ' <a title="Nikým nepřeložené texty" href="'. 74 $this->System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">'.T('Untranslated').'</a>'; 75 } else 76 { 77 $Output .= '<a href="'.$this->System->Link('/login/').'">'.T('Login').'</a> '. 78 '<a href="'.$this->System->Link('/registration/').'">'.T('Registration').'</a>'; 53 79 } 54 80 return($Output); -
trunk/Packages/Common/AppModule.php
r858 r860 197 197 $this->Modules = array(); 198 198 $this->System = &$System; 199 $this->FileName = 'Config/Modules.php';199 $this->FileName = dirname(__FILE__).'/../../Config/ModulesConfig.php'; 200 200 $this->ModulesDir = dirname(__FILE__).'/../../Modules'; 201 201 } … … 318 318 } 319 319 320 function ModuleEnabled($Name) 321 { 322 return(array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Enabled); 323 } 324 325 function ModuleRunning($Name) 326 { 327 return(array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Running); 328 } 329 320 330 /* @return Module */ 321 331 function SearchModuleById($Id) -
trunk/Packages/Common/Setup.php
r858 r860 362 362 { 363 363 $Output = ''; 364 if(!$this->Database->Connected()) $Output .= 'Nelze se připojit k databázi.<br>';364 if(!$this->Database->Connected()) $Output .= T('Can\'t connect to database').'<br>'; 365 365 else { 366 366 if(!$this->System->Setup->UpdateManager->IsInstalled()) 367 $Output .= 'Systém vyžaduje instalaci databáze.<br>';367 $Output .= T('System requires database initialization').'<br>'; 368 368 else 369 369 if(!$this->System->Setup->UpdateManager->IsUpToDate()) 370 $Output .= 'Systém vyžaduje aktualizaci databáze.<br>';371 } 372 $Output .= 'Pokračujte <a href="'.$this->System->Link('/setup/').'">zde</a>';370 $Output .= T('System requires database upgrade').'<br>'; 371 } 372 $Output .= sprintf(T('Front page was not configured. Continue to %s'), '<a href="'.$this->System->Link('/setup/').'">'.T('setup').'</a>'); 373 373 return($Output); 374 374 } -
trunk/includes/Global.php
r859 r860 9 9 include_once(dirname(__FILE__).'/../Application/Version.php'); 10 10 require_once(dirname(__FILE__).'/../HTML/BBCodeParser2.php'); 11 12 // Include application modules13 // TODO: Make modules configurable14 include_once(dirname(__FILE__).'/../Modules/Error/Error.php');15 include_once(dirname(__FILE__).'/../Modules/Log/Log.php');16 include_once(dirname(__FILE__).'/../Modules/Translation/Translation.php');17 include_once(dirname(__FILE__).'/../Modules/AoWoW/AoWoW.php');18 include_once(dirname(__FILE__).'/../Modules/Referrer/Referrer.php');19 include_once(dirname(__FILE__).'/../Modules/Team/Team.php');20 include_once(dirname(__FILE__).'/../Modules/User/User.php');21 include_once(dirname(__FILE__).'/../Modules/Dictionary/Dictionary.php');22 include_once(dirname(__FILE__).'/../Modules/Import/Import.php');23 include_once(dirname(__FILE__).'/../Modules/Export/Export.php');24 include_once(dirname(__FILE__).'/../Modules/Server/Server.php');25 include_once(dirname(__FILE__).'/../Modules/ClientVersion/ClientVersion.php');26 include_once(dirname(__FILE__).'/../Modules/ShoutBox/ShoutBox.php');27 include_once(dirname(__FILE__).'/../Modules/News/News.php');28 include_once(dirname(__FILE__).'/../Modules/Wiki/Wiki.php');29 include_once(dirname(__FILE__).'/../Modules/Search/Search.php');30 include_once(dirname(__FILE__).'/../Modules/FrontPage/FrontPage.php');31 include_once(dirname(__FILE__).'/../Modules/Download/Download.php');32 include_once(dirname(__FILE__).'/../Modules/Forum/Forum.php');33 include_once(dirname(__FILE__).'/../Modules/Redirection/Redirection.php');34 include_once(dirname(__FILE__).'/../Modules/Admin/Admin.php');35 include_once(dirname(__FILE__).'/../Modules/Info/Info.php');36 37 11 38 12 // Back compatibility, will be 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.