Changeset 47 for trunk/Base
- Timestamp:
- Jul 27, 2014, 9:14:56 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 2 1 config.php 2 .project
-
- Property svn:ignore
-
trunk/Base/Config/ConfigSample.php
r46 r47 27 27 'ShowRuntimeInfo' => false, 28 28 'FormatHTML' => false, 29 'ErrorLogFile' => 'php_script_error.log', 29 'ErrorLogFile' => 'php_script_error.log', 30 30 'TableRowPerPage' => 30, 31 31 'Style' => 'Basic', … … 34 34 ), 35 35 ); 36 37 ?> -
trunk/Base/Controller.php
r45 r47 4 4 5 5 class Controller extends Module 6 { 6 { 7 7 function OnAccessDenied($Action, $Id) 8 8 { 9 9 return($this->System->Output->SystemMessage('Nemáte oprávnění provést akci "'.$Action.'" modulu "'.substr(get_class($this), 0, -10).'" na položce "'.$Id.'"')); 10 10 } 11 11 12 12 function Process() 13 13 { … … 29 29 } 30 30 } 31 32 ?> -
trunk/Base/Database.php
r46 r47 106 106 } 107 107 } 108 109 ?> -
trunk/Base/Error.php
r42 r47 4 4 { 5 5 global $Config; 6 6 7 7 $Date = date('Y-m-d H:i:s'); // časové razítko položky 8 8 $ErrorType = array … … 21 21 ); 22 22 $UserErrors = E_ALL; //E_ERROR | E_WARNING | E_PARSE; 23 23 24 24 if(($UserErrors & $Number)) 25 25 { … … 32 32 //$First = array_shift($Backtrace); 33 33 //print_r($First); 34 34 35 35 //array_unshift($Backtrace, $First); 36 36 //array_shift($Backtrace); … … 48 48 if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')'; 49 49 $Error .= "\n"; 50 50 51 51 } 52 52 $Error .= "\n"; … … 63 63 '<head>'. 64 64 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 65 '</head><body>'. 65 '</head><body>'. 66 66 'Došlo k vnitřní chybě!<br /> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br /><br />'); 67 67 echo('<pre>'.$Error.'</pre><br />'); // V případě ladění chybu i zobraz 68 68 echo('</body></html>'); 69 69 } 70 if((E_ERROR | E_PARSE) & $Number) die(); 70 if((E_ERROR | E_PARSE) & $Number) die(); 71 71 } 72 72 } 73 73 74 74 set_error_handler('CustomErrorHandler'); 75 76 ?> -
trunk/Base/HTML/Form.php
r42 r47 8 8 var $Values = array(); 9 9 var $OnSubmit = ''; 10 10 11 11 function __construct($System, $FormClass) 12 12 { … … 16 16 { 17 17 $this->Values[$Index] = ''; 18 } 18 } 19 19 } 20 20 … … 36 36 if($Item['Type'] != 'Hidden') 37 37 { 38 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 38 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 39 39 $Edit = $this->System->Type->ExecuteTypeEvent($Item['Type'], 'OnView', 40 40 array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type'])); … … 43 43 } 44 44 $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.$this->Table($Table, 'WideTable'); 45 return($Output); 45 return($Output); 46 46 } 47 47 … … 62 62 foreach($this->Definition['Items'] as $Index => $Item) 63 63 { 64 if($Item['Type'] != 'Hidden') 64 if($Item['Type'] != 'Hidden') 65 65 { 66 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 66 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 67 67 $Edit = $this->System->Type->ExecuteTypeEvent($Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type'])); 68 68 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); … … 73 73 foreach($this->Definition['Items'] as $Index => $Item) 74 74 if($Item['Type'] == 'Hidden') $Output .= $this->System->Type->ExecuteTypeEvent($Item['Type'], 'OnEdit', array('Name' => $Index, 'Value' => $this->Values[$Index], 'Type' => $Item['Type'])); 75 return($Output); 75 return($Output); 76 76 } 77 77 … … 119 119 } 120 120 } 121 122 ?> -
trunk/Base/HTML/HTML.php
r42 r47 16 16 { 17 17 $Indentation = 2; 18 18 19 19 $Output = ''; 20 20 $Indent = 0; … … 30 30 } 31 31 $Line = trim(substr($Text, $Start, $End + 1)); 32 if(strlen($Line) > 0) 32 if(strlen($Line) > 0) 33 33 if($Line[0] == '<') 34 34 { 35 if($Text[$Start + 1] == '/') 35 if($Text[$Start + 1] == '/') 36 36 { 37 37 $IndentNew = $IndentNew - $Indentation; 38 38 $Indent = $IndentNew; 39 } else 39 } else 40 40 { 41 41 if(strpos($Line, ' ')) $Command = substr($Line, 1, strpos($Line, ' ') - 1); 42 42 else $Command = substr($Line, 1, strlen($Line) - $Indentation); 43 43 if(strpos($Text, '</'.$Command.'>')) $IndentNew = $IndentNew + $Indentation; 44 } 44 } 45 45 } 46 46 if($Line != '') $Output .= (str_repeat(' ', $Indent).$Line."\n"); … … 59 59 function MakeLink($Title, $Target) 60 60 { 61 return('<a href="'.$Target.'">'.$Title.'</a>'); 61 return('<a href="'.$Target.'">'.$Title.'</a>'); 62 62 } 63 63 … … 89 89 // Zobrazení číselný seznamu stránek 90 90 function PageList($QueryStringVar, $Page, $TotalCount, $CountPerPage, $Around = 10) 91 { 91 { 92 92 $QueryStringArray = $this->System->HTTP->GetQueryStringArray(); 93 93 $Count = ceil($TotalCount / $CountPerPage); … … 95 95 if($Count > 1) 96 96 { 97 if($Page > 0) 97 if($Page > 0) 98 98 { 99 99 $QueryStringArray[$QueryStringVar] = 0; … … 118 118 } 119 119 if($PagesMax < ($Count - 1)) $Result .= ' .. '; 120 if($Page < ($Count - 1)) 120 if($Page < ($Count - 1)) 121 121 { 122 122 $QueryStringArray[$QueryStringVar] = $Page + 1; … … 138 138 } 139 139 } 140 141 ?> -
trunk/Base/HTML/Table.php
r42 r47 14 14 var $TotalRowCount; 15 15 var $RowPerPage = 20; 16 16 17 17 function __construct($System, $FormClass) 18 18 { 19 19 $this->System = $System; 20 $this->Definition = $FormClass; 20 $this->Definition = $FormClass; 21 21 $this->QueryParameters = array(); 22 22 } 23 23 24 24 function CheckOrder() 25 25 { … … 33 33 { 34 34 if(array_key_exists('DefaultOrderColumn', $this->Definition)) $_GET['Column'] = $this->Definition['DefaultOrderColumn']; 35 else 35 else 36 36 { 37 37 $Keys = array_keys($this->Definition['Items']); … … 64 64 $Output .= '<div class="Pager">'.$this->PageList('Page', $this->Page, $this->TotalRowCount, $this->RowPerPage).'</div>'; 65 65 return($Output); 66 } 67 66 } 67 68 68 function LoadValuesFromDatabase($Database) 69 { 69 { 70 70 $this->CheckOrder(); 71 71 $OrderType = array('ASC', 'DESC'); … … 103 103 $this->Values[] = $Row; 104 104 } 105 } 105 } 106 106 } 107 108 ?> -
trunk/Base/HTML/XHTML.php
r42 r47 34 34 } 35 35 } 36 37 ?> -
trunk/Base/HTTP.php
r44 r47 28 28 } 29 29 } 30 31 ?> -
trunk/Base/Mail.php
r42 r47 30 30 } 31 31 } 32 33 ?> -
trunk/Base/Model.php
r42 r47 6 6 { 7 7 } 8 9 ?> -
trunk/Base/Module.php
r40 r47 7 7 var $Config; 8 8 9 function __construct($System) 9 function __construct($System) 10 10 { 11 11 $this->Database = $System->Database; … … 14 14 } 15 15 } 16 17 ?> -
trunk/Base/Output.php
r42 r47 21 21 } 22 22 } 23 24 ?> -
trunk/Base/Permission.php
r42 r47 9 9 function Check($Module, $Action, $Item = '') 10 10 { 11 // TODO: Use permission check 11 12 return(true); 12 13 if($this->BuildCache) … … 76 77 } 77 78 } 78 79 ?> -
trunk/Base/System.php
r45 r47 84 84 { 85 85 } 86 86 87 87 class System 88 88 { 89 var $Model = array(); 90 var $View = array(); 91 var $Controller = array(); 89 var $Model = array(); 90 var $View = array(); 91 var $Controller = array(); 92 92 var $Config; 93 93 var $Database; … … 106 106 107 107 $TimeStart = $this->GetMicrotime(); 108 108 109 109 // Change base dir to index. Helpfull if script is executed from command line with related path. 110 110 chdir(dirname(__FILE__)); … … 119 119 } 120 120 121 $Config = array(); 122 121 123 $FileName = dirname(__FILE__).'/../Application/Config/Config.php'; 122 124 if(file_exists($FileName)) include($FileName); 123 125 124 126 $this->Config = $Config; 125 127 126 128 $ShowPHPError = $this->Config['System']['ShowPHPError']; 127 129 130 $Translation = array(); 128 131 $FileName = dirname(__FILE__).'/../Application/Locale/'.$this->Config['System']['Locale'].'.php'; 129 132 if(file_exists($FileName)) include($FileName); … … 142 145 $this->Database->Prefix = $this->Config['Database']['Prefix']; 143 146 $this->Database->charset($this->Config['Database']['Charset']); 144 147 145 148 $this->HTTP = new HTTP(); 146 149 $this->HTML = new HTML($this); … … 152 155 { 153 156 $this->TimeStart = $this->GetMicrotime(); 154 157 155 158 // SQL injection hack protection 156 159 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item); … … 183 186 $this->Modules[$Name] = new $Name($this); 184 187 } 185 188 186 189 function HumanDate($Time) 187 190 { … … 214 217 $I = $PrefixMultipliers[$PrefixType]['BaseIndex']; 215 218 if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 216 217 if($Value > 1) 219 220 if($Value > 1) 218 221 { 219 222 while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1)) 220 223 $I = $I + 1; 221 } else 224 } else 222 225 if($Value < 1) 223 226 { … … 226 229 } 227 230 $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]; 228 231 229 232 // Truncate digits count 230 233 $Value = $this->TruncateDigits($Value, $Digits); … … 232 235 return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 233 236 } 234 237 235 238 function NetworkPortState($Address, $Port, $Timeout = 1) 236 239 { … … 281 284 } 282 285 } 283 284 ?> -
trunk/Base/Types/Base.php
r42 r47 31 31 } 32 32 } 33 34 ?> -
trunk/Base/Types/Boolean.php
r42 r47 21 21 function OnLoad($Item) 22 22 { 23 if(array_key_exists($Item['Name'], $_POST)) return(1); 23 if(array_key_exists($Item['Name'], $_POST)) return(1); 24 24 else return(0); 25 25 } 26 26 } 27 28 ?> -
trunk/Base/Types/Date.php
r42 r47 60 60 } 61 61 } 62 63 ?> -
trunk/Base/Types/DateTime.php
r42 r47 10 10 { 11 11 global $MonthNames; 12 12 13 13 if($Item['Value'] != '') 14 14 { … … 92 92 } 93 93 } 94 95 ?> -
trunk/Base/Types/Enumeration.php
r42 r47 32 32 } 33 33 } 34 35 ?> -
trunk/Base/Types/File/File.php
r40 r47 43 43 } 44 44 } 45 46 ?> -
trunk/Base/Types/File/FileDownload.php
r40 r47 20 20 echo(file_get_contents($Config['UploadFileFolder'].'/'.$DbRow['Id'])); 21 21 } else echo('Soubor nenalezen!'); 22 23 ?> -
trunk/Base/Types/Float.php
r42 r47 24 24 } 25 25 } 26 27 ?> -
trunk/Base/Types/GPS.php
r42 r47 70 70 } 71 71 } 72 73 ?> -
trunk/Base/Types/Hidden.php
r42 r47 22 22 } 23 23 } 24 25 ?> -
trunk/Base/Types/Hyperlink.php
r42 r47 22 22 } 23 23 } 24 25 ?> -
trunk/Base/Types/IPv4Address.php
r42 r47 22 22 } 23 23 } 24 25 ?> -
trunk/Base/Types/Integer.php
r42 r47 24 24 } 25 25 } 26 27 ?> -
trunk/Base/Types/Password.php
r42 r47 27 27 $Result = $_POST[$Item['Name']]; 28 28 /* 29 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 29 if(!array_key_exists('SourceItemId', $Item)) $Result = sha1($_POST[$Item['Name']]); 30 30 else 31 31 { … … 42 42 } 43 43 } 44 45 ?> -
trunk/Base/Types/PointerOneToMany.php
r42 r47 7 7 function OnView($Item) 8 8 { 9 $Type = $this->System->Type->TypeDefinitionList[$Item['Type']]; 9 10 $Output = '<a href="?Action=ShowList&TableId='.$Type['TypeDefinition'].'&ParentTable='.$Item['SourceTable'].'&ParentColumn='.$Item['SourceItemId'].'">Seznam</a>'; 10 11 return($Output); … … 13 14 function OnEdit($Item) 14 15 { 16 $Type = $this->System->Type->TypeDefinitionList[$Item['Type']]; 15 17 $Output = '<a href="?Action=ShowList&TableId='.$Type['TypeDefinition'].'&ParentTable='.$Item['SourceTable'].'&ParentColumn='.$Item['SourceItemId'].'">Seznam</a>'; 16 18 return($Output); … … 22 24 } 23 25 } 24 25 ?> -
trunk/Base/Types/PointerOneToOne.php
r42 r47 37 37 } 38 38 } 39 40 ?> -
trunk/Base/Types/String.php
r42 r47 29 29 } 30 30 } 31 32 ?> -
trunk/Base/Types/Text.php
r42 r47 29 29 } 30 30 } 31 32 ?> -
trunk/Base/Types/Time.php
r42 r47 56 56 } 57 57 } 58 59 ?> -
trunk/Base/Types/Type.php
r42 r47 68 68 $Type = $this->TypeDefinitionList[$ParentType]; 69 69 } else $Type = array(); 70 70 71 71 $Type['Name'] = $Name; 72 72 $Type['Parameters'] = array_merge($Type['Parameters'], $Parameters); … … 79 79 } 80 80 } 81 82 83 ?> -
trunk/Base/UTF8.php
r40 r47 21 21 ISO8859-1: iso1 22 22 Windows1257: win1257 23 23 24 24 example: $new_string=to_utf8($some_string,"win1250"); 25 25 */ … … 28 28 /* 29 29 translation table - actually, it's array where key is hexadecimal number of 30 character in ISO8859-2/Windows1250 and value is its two byte representation in UTF-8 30 character in ISO8859-2/Windows1250 and value is its two byte representation in UTF-8 31 31 */ 32 32 … … 527 527 528 528 $Result = ''; 529 for($I = 0; $I < strlen($String); $I++) 529 for($I = 0; $I < strlen($String); $I++) 530 530 { 531 531 if(ord($String[$I]) < 128) $Result .= $String[$I]; … … 563 563 return($Result); 564 564 } 565 566 ?> -
trunk/Base/View.php
r42 r47 6 6 { 7 7 } 8 9 ?> -
trunk/Base/XML.php
r42 r47 48 48 var $Content; 49 49 var $Indentation; 50 50 51 51 function __construct() 52 52 { … … 56 56 $this->Indentation = 2; 57 57 } 58 58 59 59 function GetOutput() 60 60 { … … 104 104 } 105 105 } 106 107 ?>
Note:
See TracChangeset
for help on using the changeset viewer.