Changeset 8
- Timestamp:
- Jan 22, 2016, 5:13:22 PM (9 years ago)
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/AppModule.php
r5 r8 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 } … … 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 … … 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) -
Common/Common.php
r6 r8 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 … … 21 24 var $Name; 22 25 var $Version; 26 var $ReleaseDate; 23 27 var $License; 24 28 var $Creator; … … 28 32 { 29 33 $this->Name = 'Common'; 30 $this->Version = '1.1'; 34 $this->Version = '1.2'; 35 $this->ReleaseDate = strtotime('2016-01-22'); 31 36 $this->Creator = 'Chronos'; 32 37 $this->License = 'GNU/GPL'; … … 34 39 } 35 40 } 41 42 class Paging 43 { 44 var $TotalCount; 45 var $ItemPerPage; 46 var $Around; 47 var $SQLLimit; 48 var $Page; 49 50 function __construct() 51 { 52 global $System; 53 54 $this->ItemPerPage = $System->Config['Web']['ItemsPerPage']; 55 $this->Around = $System->Config['Web']['VisiblePagingItems']; 56 } 57 58 function Show() 59 { 60 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 61 62 $Result = ''; 63 if(array_key_exists('all', $QueryItems)) 64 { 65 $PageCount = 1; 66 $ItemPerPage = $this->TotalCount; 67 } else 68 { 69 $ItemPerPage = $this->ItemPerPage; 70 $Around = round($this->Around / 2); 71 $PageCount = floor($this->TotalCount / $ItemPerPage) + 1; 72 } 73 74 if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; 75 if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1; 76 if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0; 77 if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1; 78 $CurrentPage = $_SESSION['Page']; 79 80 $Result .= 'Počet položek: <strong>'.$this->TotalCount.'</strong> Stránky: '; 81 82 $Result = ''; 83 if($PageCount > 1) 84 { 85 if($CurrentPage > 0) 86 { 87 $QueryItems['page'] = 0; 88 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'"><<</a> '; 89 $QueryItems['page'] = ($CurrentPage - 1); 90 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'"><</a> '; 91 } 92 $PagesMax = $PageCount - 1; 93 $PagesMin = 0; 94 if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around; 95 if($PagesMin < ($CurrentPage - $Around)) 96 { 97 $Result.= ' ... '; 98 $PagesMin = $CurrentPage - $Around; 99 } 100 for($i = $PagesMin; $i <= $PagesMax; $i++) 101 { 102 if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 103 else { 104 $QueryItems['page'] = $i; 105 $Result .= '<a href="?'.SetQueryStringArray($QueryItems).'">'.($i + 1).'</a> '; 106 } 107 } 108 if($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 109 if($CurrentPage < ($PageCount - 1)) 110 { 111 $QueryItems['page'] = ($CurrentPage + 1); 112 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'">></a> '; 113 $QueryItems['page'] = ($PageCount - 1); 114 $Result.= '<a href="?'.SetQueryStringArray($QueryItems).'">>></a>'; 115 } 116 } 117 $QueryItems['all'] = '1'; 118 if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>'; 119 120 $Result = '<div style="text-align: center">'.$Result.'</div>'; 121 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 122 $this->Page = $CurrentPage; 123 return($Result); 124 } 125 } -
Common/Database.php
r5 r8 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; -
Common/Locale.php
r6 r8 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 } -
Common/Mail.php
r4 r8 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 -
PackageTemplate.php
r3 r8 5 5 var $Name; 6 6 var $Version; 7 var $ReleaseDate; 7 8 var $License; 8 9 var $Creator; … … 13 14 $this->Name = 'Template'; 14 15 $this->Version = '1.0'; 16 $this->ReleaseDate = strtotime('2016-01-01'); 15 17 $this->Creator = 'Noname'; 16 18 $this->License = 'GNU/GPL';
Note:
See TracChangeset
for help on using the changeset viewer.