- Timestamp:
- Jan 21, 2016, 9:54:58 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/DefaultConfig.php
r837 r858 1 1 <?php 2 2 3 $IsDeveloper = in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1')); 4 5 $DefaultConfig = array( 6 'Database' => array( 7 'Host' => 'localhost', 8 'User' => 'root', 9 'Password' => '', 10 'Database' => 'wowpreklad', 11 'DatabaseAoWoW' => 'wowpreklad_mangos', 12 'Prefix' => '', 13 'Charset' => 'utf8', 14 'MangosPrefix' => '', 15 ), 16 'Style' => 'maron', 17 'Web' => array( 18 'Title' => 'Projekt překládání textů hry WoW', 19 'Description' => '', 20 'Keywords' => 'world of warcraft, wow, translation', 21 'Charset' => 'utf-8', 22 'Host' => 'localhost', 23 'BaseURL' => '', 24 'AdminEmail' => 'admin@localhost', 25 'Authors' => 'autor', 26 'ShowSQLQuery' => false, 27 'ShowSQLError' => $IsDeveloper, 28 'LogSQLQuery' => $IsDeveloper, 29 'ShowPHPError' => $IsDeveloper, 30 'ShowRuntimeInfo' => $IsDeveloper, 31 'FormatOutput' => $IsDeveloper, 32 'ItemsPerPage' => 40, 33 'TempFolder' => 'tmp/', 34 'SourceFolder' => 'source/', 35 'GameVersion' => '3.3.5a', 36 'VisiblePagingItems' => 20, 37 'Timezone' => 'Europe/Prague', 38 'WebCounter' => '', 39 'Advertisement' => '', 40 'Locale' => 'cs', 41 ), 42 'ForbiddedUserNames' => array('addon', 'admin', 'administrator'), 43 'ExportTaskProcessPeriod' => 10, 44 'MaxExportPerUser' => 10, 45 'AoWoWExportId' => 1, 46 'OriginalLanguage' => 1, 47 'SystemPassword' => '', 48 ); 3 class DefaultConfig 4 { 5 function Get() 6 { 7 $IsDeveloper = in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1')); 8 return(array( 9 array('Name' => 'SystemPassword', 'Type' => 'PasswordEncoded', 'Default' => '', 'Title' => 'System password'), 10 array('Name' => 'Database/Host', 'Type' => 'String', 'Default' => 'localhost', 'Title' => 'Server'), 11 array('Name' => 'Database/User', 'Type' => 'String', 'Default' => 'root', 'Title' => 'User'), 12 array('Name' => 'Database/Password', 'Type' => 'Password', 'Default' => '', 'Title' => 'Password'), 13 array('Name' => 'Database/Database', 'Type' => 'String', 'Default' => 'wowpreklad', 'Title' => 'Database'), 14 array('Name' => 'Database/Prefix', 'Type' => 'String', 'Default' => '', 'Title' => 'Prefix'), 15 array('Name' => 'Database/Charset', 'Type' => 'String', 'Default' => 'utf8', 'Title' => 'Charset'), 16 array('Name' => 'Database/DatabaseAoWoW', 'Type' => 'String', 'Default' => 'wowpreklad_mangos', 'Title' => 'Database AoWoW'), 17 array('Name' => 'Database/MangosPrefix', 'Type' => 'String', 'Default' => '', 'Title' => 'Mangos prefix'), 18 array('Name' => 'Web/Style', 'Type' => 'String', 'Default' => 'maron', 'Title' => 'Style'), 19 array('Name' => 'Web/Title', 'Type' => 'String', 'Default' => 'Project of translation of WoW game', 'Title' => 'Title'), 20 array('Name' => 'Web/Description', 'Type' => 'String', 'Default' => '', 'Title' => 'Description'), 21 array('Name' => 'Web/Keywords', 'Type' => 'String', 'Default' => 'world of warcraft, wow, translation', 'Title' => 'Keywords'), 22 array('Name' => 'Web/Charset', 'Type' => 'String', 'Default' => 'utf-8', 'Title' => 'Charset'), 23 array('Name' => 'Web/Host', 'Type' => 'String', 'Default' => 'localhost', 'Title' => 'Host domain name'), 24 array('Name' => 'Web/BaseURL', 'Type' => 'String', 'Default' => '', 'Title' => 'Root URL'), 25 array('Name' => 'Web/AdminEmail', 'Type' => 'String', 'Default' => 'admin@localhost', 'Title' => 'Admin e-mail'), 26 array('Name' => 'Web/Authors', 'Type' => 'String', 'Default' => '', 'Title' => 'Authors'), 27 array('Name' => 'Web/ShowSQLError', 'Type' => 'Boolean', 'Default' => '0', 'Title' => 'Show SQL errors'), 28 array('Name' => 'Web/ShowSQLQuery', 'Type' => 'Boolean', 'Default' => '0', 'Title' => 'Show SQL queries'), 29 array('Name' => 'Web/ShowPHPError', 'Type' => 'Boolean', 'Default' => '0', 'Title' => 'Show PHP errors'), 30 array('Name' => 'Web/ShowRuntimeInfo', 'Type' => 'Boolean', 'Default' => '0', 'Title' => 'Show runtime information'), 31 array('Name' => 'Web/LogSQLQuery', 'Type' => 'Boolean', 'Default' => '0', 'Title' => 'Log SQL queries'), 32 array('Name' => 'Web/FormatOutput', 'Type' => 'Boolean', 'Default' => '0', 'Title' => 'Format produced HTML code'), 33 array('Name' => 'Web/ItemsPerPage', 'Type' => 'Integer', 'Default' => '50', 'Title' => 'Items per page'), 34 array('Name' => 'Web/TempFolder', 'Type' => 'String', 'Default' => 'tmp/', 'Title' => 'Temporary directory'), 35 array('Name' => 'Web/SourceFolder', 'Type' => 'String', 'Default' => 'source/', 'Title' => 'Source directory'), 36 array('Name' => 'Web/GameVersion', 'Type' => 'String', 'Default' => '3.3.5a', 'Title' => 'Game version'), 37 array('Name' => 'Web/VisiblePagingItems', 'Type' => 'Integer', 'Default' => 20, 'Title' => 'Visible paging items'), 38 array('Name' => 'Web/Timezone', 'Type' => 'String', 'Default' => 'Europe/Prague', 'Title' => 'Time zone'), 39 array('Name' => 'Web/WebCounter', 'Type' => 'String', 'Default' => '', 'Title' => 'Web counter HTML code'), 40 array('Name' => 'Web/Advertisement', 'Type' => 'String', 'Default' => '', 'Title' => 'Advertisement HTML code'), 41 array('Name' => 'Web/Locale', 'Type' => 'String', 'Default' => 'cs', 'Title' => 'Default locale code'), 42 array('Name' => 'ForbiddedUserNames', 'Type' => 'Array', 'Default' => array('addon', 'admin', 'administrator'), 'Title' => 'Forbidded user names'), 43 array('Name' => 'ExportTaskProcessPeriod', 'Type' => 'Integer', 'Default' => 10, 'Title' => 'Export task process period'), 44 array('Name' => 'MaxExportPerUser', 'Type' => 'Integer', 'Default' => 10, 'Title' => 'Max export count per user'), 45 array('Name' => 'AoWoWExportId', 'Type' => 'Integer', 'Default' => 1, 'Title' => 'ID of AoWoW export'), 46 array('Name' => 'OriginalLanguage', 'Type' => 'Integer', 'Default' => 1, 'Title' => 'Original language'), 47 array('Name' => 'EnableGoogleTranslate', 'Type' => 'Boolean', 'Default' => false, 'Title' => 'Enable Google translate'), 48 )); 49 } 50 } -
trunk/Application/Version.php
r857 r858 7 7 8 8 $Version = '1.0-alfa'; 9 $Revision = 85 7; // Subversion revision9 $Revision = 858; // Subversion revision 10 10 $DatabaseRevision = 857; // Database structure revision 11 $ReleaseTime = '2016-01- 19';11 $ReleaseTime = '2016-01-20'; -
trunk/Modules/Redirection/Redirection.php
r857 r858 39 39 if($this->System->PathItems[0] == 'statistic.php') $Output = $this->Redirect($this->System->Link('/progress/')); 40 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/')); 41 42 if($this->System->PathItems[0] == 'dictionary.php') $Output = $this->Redirect($this->System->Link('/dictionary/')); 42 43 if($this->System->PathItems[0] == 'download-addon.php') $Output = $this->Redirect($this->System->Link('/download/')); … … 60 61 if(($this->System->PathItems[0] == 'phpBB3') and ($this->System->PathItems[1] == 'index.php')) 61 62 $Output = $this->Redirect($this->System->Link('/forum/')); 63 if(($this->System->PathItems[0] == 'download') and ($this->System->PathItems[1] == 'ceske_fonty_do_wow.zip')) 64 $Output = $this->Redirect($this->System->Link('/files/ceske_fonty_do_wow.zip')); 62 65 } 63 66 } -
trunk/Packages/Common/AppModule.php
r838 r858 232 232 { 233 233 if(!array_key_exists($Dependency, $this->Modules)) 234 throw new Exception( 'Module "'.$Module->Name.'" dependency "'.$Dependency.'" not found');234 throw new Exception(sprintf(T('Module "%s" dependency "%s" not found'), $Module->Name, $Dependency)); 235 235 $DepModule = $this->Modules[$Dependency]; 236 236 if(in_array(ModuleCondition::All, $Conditions) or -
trunk/Packages/Common/Common.php
r856 r858 16 16 include_once(dirname(__FILE__).'/Page.php'); 17 17 include_once(dirname(__FILE__).'/Locale.php'); 18 include_once(dirname(__FILE__).'/Update.php'); 19 include_once(dirname(__FILE__).'/Setup.php'); 20 include_once(dirname(__FILE__).'/Table.php'); 18 21 19 22 class PackageCommon … … 34 37 } 35 38 } 39 40 class Paging 41 { 42 var $TotalCount; 43 var $ItemPerPage; 44 var $Around; 45 var $SQLLimit; 46 var $Page; 47 48 function __construct() 49 { 50 global $System; 51 52 $this->ItemPerPage = $System->Config['Web']['ItemsPerPage']; 53 $this->Around = $System->Config['Web']['VisiblePagingItems']; 54 } 55 56 function Show() 57 { 58 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 59 60 $Result = ''; 61 if(array_key_exists('all', $QueryItems)) 62 { 63 $PageCount = 1; 64 $ItemPerPage = $this->TotalCount; 65 } else 66 { 67 $ItemPerPage = $this->ItemPerPage; 68 $Around = round($this->Around / 2); 69 $PageCount = floor($this->TotalCount / $ItemPerPage) + 1; 70 } 71 72 if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; 73 if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1; 74 if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0; 75 if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1; 76 $CurrentPage = $_SESSION['Page']; 77 78 $Result .= 'Počet položek: <strong>'.$this->TotalCount.'</strong> Stránky: '; 79 80 $Result = ''; 81 if($PageCount > 1) 82 { 83 if($CurrentPage > 0) 84 { 85 $QueryItems['page'] = 0; 86 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'"><<</a> '; 87 $QueryItems['page'] = ($CurrentPage - 1); 88 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'"><</a> '; 89 } 90 $PagesMax = $PageCount - 1; 91 $PagesMin = 0; 92 if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around; 93 if($PagesMin < ($CurrentPage - $Around)) 94 { 95 $Result.= ' ... '; 96 $PagesMin = $CurrentPage - $Around; 97 } 98 for($i = $PagesMin; $i <= $PagesMax; $i++) 99 { 100 if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 101 else { 102 $QueryItems['page'] = $i; 103 $Result .= '<a href="?'.SetQueryStringArray($QueryItems).'">'.($i + 1).'</a> '; 104 } 105 } 106 if($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 107 if($CurrentPage < ($PageCount - 1)) 108 { 109 $QueryItems['page'] = ($CurrentPage + 1); 110 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'">></a> '; 111 $QueryItems['page'] = ($PageCount - 1); 112 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'">>></a>'; 113 } 114 } 115 $QueryItems['all'] = '1'; 116 if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>'; 117 118 $Result = '<div style="text-align: center">'.$Result.'</div>'; 119 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 120 $this->Page = $CurrentPage; 121 return($Result); 122 } 123 } -
trunk/Packages/Common/Database.php
r838 r858 84 84 function query($Query) 85 85 { 86 if(!$this->Connected()) throw new Exception( 'Not connected to database');86 if(!$this->Connected()) throw new Exception(T('Not connected to database')); 87 87 if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime(); 88 88 $this->LastQuery = $Query; -
trunk/Packages/Common/Locale.php
r856 r858 51 51 $ClassName = 'LocaleText'.$Language; 52 52 $this->Texts = new $ClassName(); 53 } else throw new Exception( 'Language file '.$FileName.' not found');53 } else throw new Exception(sprintf(T('Language file %s not found'), $FileName)); 54 54 $this->Texts->Load(); 55 55 } … … 236 236 $this->CurrentLocale->Dir = $this->Dir; 237 237 $this->CurrentLocale->Load($Code); 238 } else throw new Exception( 'Unsupported locale code '.$Code);238 } else throw new Exception(sprintf(T('Unsupported locale code %s'), $Code)); 239 239 } 240 240 } -
trunk/Packages/Common/Mail.php
r838 r858 96 96 function Send() 97 97 { 98 if(count($this->Bodies) == 0) throw new Exception( 'Mail: Need at least one text body');98 if(count($this->Bodies) == 0) throw new Exception(T('Mail message need at least one text body')); 99 99 100 100 $Body = $this->BuildAttachment($this->BuildBody()); … … 126 126 } 127 127 } 128 if($To == '') throw new Exception( 'Mail: Need at least one recipient address');128 if($To == '') throw new Exception(T('Mail message need at least one recipient address')); 129 129 130 130 $this->Headers['Mime-Version'] = '1.0'; … … 142 142 $this->Subject = strtr($this->Subject, "\r\n", ' '); 143 143 144 if($this->Subject == '') throw new Exception( 'Mail: Missing Subject');144 if($this->Subject == '') throw new Exception(T('Mail message missing Subject')); 145 145 146 146 … … 162 162 { 163 163 if(!$this->ValidEmail($Address)) 164 throw new Exception( 'Mail: Invalid address '.$Address);164 throw new Exception(sprintf(T('Mail message invalid address %s'), $Address)); 165 165 } 166 166 } … … 190 190 { 191 191 if(!file_exists($FileName)) 192 throw new Exception( 'Mail: Attached file '.$FileName.' can\'t be found');192 throw new Exception(sprintf(T('Mail message attached file %s can\'t be found'), $FileName)); 193 193 $Data = file_get_contents($FileName); 194 194 } else -
trunk/includes/Global.php
r856 r858 2 2 3 3 include_once(dirname(__FILE__).'/../Packages/Common/Common.php'); 4 include_once(dirname(__FILE__).'/System.php');5 include_once(dirname(__FILE__).'/Update.php');6 include_once(dirname(__FILE__).'/PageEdit.php');7 4 if(file_exists(dirname(__FILE__).'/../Config/Config.php')) 8 5 include_once(dirname(__FILE__).'/../Config/Config.php'); 9 else die('Config file Config/Config.php not found'); 6 include_once(dirname(__FILE__).'/System.php'); 7 include_once(dirname(__FILE__).'/../Application/DefaultConfig.php'); 8 include_once(dirname(__FILE__).'/PageEdit.php'); 10 9 include_once(dirname(__FILE__).'/../Application/Version.php'); 11 10 require_once(dirname(__FILE__).'/../HTML/BBCodeParser2.php'); -
trunk/includes/System.php
r855 r858 29 29 $this->Config = $Config; 30 30 date_default_timezone_set($this->Config['Web']['Timezone']); 31 31 mb_internal_encoding("UTF-8"); 32 33 if(isset($this->Config['Database'])) 34 { 32 35 $this->Database->Connect($this->Config['Database']['Host'], 33 36 $this->Config['Database']['User'], $this->Config['Database']['Password'], … … 37 40 $this->Database->ShowSQLError = $this->Config['Web']['ShowSQLError']; 38 41 $this->Database->LogSQLQuery = $this->Config['Web']['LogSQLQuery']; 42 } 39 43 40 44 $this->LocaleManager = new LocaleManager($this); … … 88 92 { 89 93 global $ScriptStartTime, $TranslationTree, $StopAfterUpdateManager, 90 $UpdateManager , $DatabaseRevision;94 $UpdateManager; 91 95 92 96 $ScriptStartTime = GetMicrotime(); 93 97 if(GetRemoteAddress() != '') session_start(); 94 95 if(!isset($this->Config)) die('Systém není nainstalován. Pokračujte v instalaci <a href="admin/install.php">zde</a>.');96 97 $this->Init();98 99 // Check database persistence structure100 $UpdateManager = new UpdateManager();101 $UpdateManager->Database = $this->Database;102 $UpdateManager->Revision = $DatabaseRevision;103 if(!$UpdateManager->IsInstalled()) die('Systém vyžaduje instalaci databáze. Pokračujte <a href="'.$this->Link('/Application/install.php').'">zde</a>');104 if(!$UpdateManager->IsUpToDate()) die('Systém vyžaduje aktualizaci databáze. Pokračujte <a href="'.$this->Link('/Application/install.php').'">zde</a>');105 98 106 99 // SQL injection hack protection … … 112 105 } 113 106 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 107 108 $this->Init(); 109 110 // Register and start existing modules 111 $this->Setup = new Setup($this); 112 $this->Setup->Start(); 113 $this->Setup->UpdateManager->VersionTable = 'DbVersion'; 114 if($this->Setup->CheckState()) 115 { 116 $this->ModuleManager->Start(); 117 } 114 118 115 119 // TODO: Global initialized variable should be removed
Note:
See TracChangeset
for help on using the changeset viewer.