Changeset 484
- Timestamp:
- Feb 10, 2013, 11:31:12 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.htaccess
r470 r484 11 11 RewriteCond %{REQUEST_FILENAME} !-f 12 12 RewriteCond %{REQUEST_FILENAME} !-d 13 #RewriteRule ^(.*)$ centrala_modular/index.php?$1 14 RewriteRule ^(.*)$ dev/centrala/trunk/index.php?$1 13 RewriteRule ^(.*)$ centrala/index.php?$1 15 14 16 15 # Pretty urls -
trunk/Common/Forms.php
r465 r484 40 40 } else $UseType = $Item['Type']; 41 41 $Edit = $System->Type->ExecuteTypeEvent($UseType, 'OnView', 42 array('Value' => $this->Values[$Index], 'Name' => $Index, 'Type' => $Item['Type'])); 42 array('Value' => $this->Values[$Index], 'Name' => $Index, 43 'Type' => $Item['Type'], 'Values' => $this->Values)); 43 44 if(array_key_exists('Suffix', $Item)) $Edit .= ' '.$Item['Suffix']; 44 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 45 if(!$System->Type->IsHidden($UseType)) 46 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 45 47 } 46 48 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table). … … 62 64 global $Database, $FormTypes, $System; 63 65 66 $Hidden = ''; 67 $IsHidden = false; 64 68 $Table = array( 65 69 //'Header' => array('Položka', 'Hodnota'), … … 76 80 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 77 81 $Parameters = array('Value' => $this->Values[$Index], 'Name' => $Index, 78 'Type' => $Item['Type'] );82 'Type' => $Item['Type'], 'Values' => $this->Values); 79 83 if(array_key_exists('Null', $Item)) $Parameters['Null'] = $Item['Null']; 80 84 else unset($Parameters['Null']); … … 94 98 if(array_key_exists('Suffix', $Item)) $Edit .= $Item['Suffix']; 95 99 96 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 100 if(!$System->Type->IsHidden($UseType)) 101 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 102 else $Hidden .= $Edit; 97 103 } 98 104 } 99 105 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table). 100 '</fieldset>';106 $Hidden.'</fieldset>'; 101 107 return($Output); 102 108 } … … 125 131 $this->Values[$Index] = $System->Type->ExecuteTypeEvent($UseType, 'OnLoadDb', 126 132 array('Value' => $DbRow[$Index], 'Name' => $Index, 127 'Type' => $Item['Type'] ));133 'Type' => $Item['Type'], 'Values' => $this->Values)); 128 134 129 135 //echo($DbRow[$Index].'='.$this->Values[$Index].'<br/>'); … … 142 148 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 143 149 $Parameters = array('Value' => $this->Values[$Index], 'Name' => $Index, 144 'Type' => $Item['Type'] );150 'Type' => $Item['Type'], 'Values' => $this->Values); 145 151 146 152 if(array_key_exists($Item['Type'], $FormTypes)) … … 157 163 } else $UseType = $Item['Type']; 158 164 $Values[$Index] = $System->Type->ExecuteTypeEvent($UseType, 'OnSaveDb', $Parameters); 165 if(($Item['Type'] == 'Password') and ($Values[$Index] == '')) unset($Values[$Index]); 159 166 160 167 //echo($DbRow[$Index].'='.$this->Values[$Index].'<br/>'); … … 181 188 $Values = array(); 182 189 foreach($this->Definition['Items'] as $Index => $Item) 183 if(!array_key_exists($Item['Type'], $FormTypes) or 184 (array_key_exists($Item['Type'], $FormTypes) and ($FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 190 if((!array_key_exists($Item['Type'], $FormTypes) or 191 (array_key_exists($Item['Type'], $FormTypes) and 192 ($FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) and 193 (!array_key_exists('ReadOnly', $Item) or 194 (array_key_exists('ReadOnly', $Item) and 195 ($Item['ReadOnly'] != true)))) 185 196 { 186 197 //if(array_key_exists($Context.$Index, $_POST)) … … 196 207 } else $UseType = $Item['Type']; 197 208 $Values[$Index] = $System->Type->ExecuteTypeEvent($UseType, 'OnLoad', 198 array('Name' => $Index, 'Type' => $Item['Type'] ));209 array('Name' => $Index, 'Type' => $Item['Type'], 'Values' => $this->Values)); 199 210 } 200 211 return($Values); -
trunk/Common/Types/Base.php
r442 r484 5 5 var $System; 6 6 var $DatabaseCompareOperators = array(); 7 var $Hidden; 7 8 8 9 function __construct($System) 9 10 { 10 $this->System = $System; 11 $this->System = &$System; 12 $this->Hidden = false; 11 13 } 12 14 -
trunk/Common/Types/Hidden.php
r428 r484 5 5 class TypeHidden extends TypeBase 6 6 { 7 function __construct($System) 8 { 9 parent::__construct($System); 10 $this->Hidden = true; 11 } 12 7 13 function OnView($Item) 8 14 { -
trunk/Common/Types/Password.php
r442 r484 41 41 return($Result); 42 42 } 43 44 function OnSaveDb($Item) 45 { 46 if($Item['Value'] == '') return(''); 47 else { 48 $PasswordHash = new PasswordHash(); 49 return($PasswordHash->Hash($Item['Value'], $Item['Values']['Salt'])); 50 } 51 } 43 52 44 53 function OnLoadDb($Item) -
trunk/Common/Types/Type.php
r430 r484 20 20 include(dirname(__FILE__).'/IPv4Address.php'); 21 21 include(dirname(__FILE__).'/Color.php'); 22 include(dirname(__FILE__).'/RandomHash.php'); 22 23 23 24 class Type … … 25 26 var $System; 26 27 var $TypeDefinitionList; 28 var $Values; 27 29 28 30 function __construct($System) … … 49 51 'OneToMany' => array('Name' => 'OneToMany', 'Class' => 'OneToMany', 'ParentType' => '', 'Parameters' => array()), 50 52 'Color' => array('Name' => 'Color', 'Class' => 'Color', 'ParentType' => '', 'Parameters' => array()), 53 'RandomHash' => array('Name' => 'RandomHash', 'Class' => 'RandomHash', 'ParentType' => '', 'Parameters' => array()), 51 54 ); 52 55 } … … 62 65 else return($TypeName.'->'.$Event.'('.serialize($Parameters).')'); 63 66 } else return($TypeName); 67 } 68 69 function IsHidden($TypeName) 70 { 71 if(array_key_exists($TypeName, $this->TypeDefinitionList)) 72 { 73 $Type = $this->TypeDefinitionList[$TypeName]; 74 $TypeClass = 'Type'.$Type['Class']; 75 $TypeObject = new $TypeClass($this->System); 76 return($TypeObject->Hidden); 77 } else return(false); 64 78 } 65 79 -
trunk/Modules/IS/IS.php
r479 r484 27 27 28 28 if(array_key_exists('t', $_GET)) $_SESSION['Table'] = $_GET['t']; 29 if(!array_key_exists('Table', $_SESSION)) $_SESSION['Table'] = '';30 29 if(array_key_exists('a', $_GET)) $_SESSION['Action'] = $_GET['a']; 31 30 if(array_key_exists('id', $_GET)) $_SESSION['Id'] = $_GET['id']; 32 31 33 32 if(!array_key_exists('Action', $_SESSION)) $_SESSION['Action'] = 'list'; 33 if(!array_key_exists('Id', $_SESSION) or !array_key_exists('Table', $_SESSION) or 34 ($_SESSION['Table'] == '')) { 35 $_SESSION['Id'] = 0; 36 $_SESSION['Action'] = ''; 37 $_SESSION['Table'] = ''; 38 } 34 39 35 40 if($_SESSION['Action'] == 'list') $Output .= $this->ShowList($_SESSION['Table']); -
trunk/Modules/Portal/Portal.php
r479 r484 179 179 $UserOptions = new Form('UserOptions', array()); 180 180 $UserOptions->LoadValuesFromForm(); 181 if($UserOptions->Values['Password'] == '') unset($UserOptions->Values['Password']);182 else {183 $PasswordHash = new PasswordHash();184 $Salt = $PasswordHash->GetSalt();185 $UserOptions->Values['Password'] = $PasswordHash->Hash($UserOptions->Values['Password'], $Salt);186 $UserOptions->Values['Salt'] = $Salt;187 $this->Database->update('User', 'Id='.$this->System->Modules['User']->User['Id'], array('Salt' => $Salt));188 }189 181 $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']); 190 182 $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.'); -
trunk/config.sample.php
r477 r484 7 7 'Database' => array 8 8 ( 9 'Host' => ' centrala',9 'Host' => 'localhost', 10 10 'User' => 'root', 11 11 'Password' => '', … … 17 17 ( 18 18 'Style' => 'new', 19 'FormatHTML' => false,19 'FormatHTML' => $IsDeveloper, 20 20 'Charset' => 'utf-8', 21 21 'Host' => 'localhost', … … 25 25 'Admin' => 'Admin', 26 26 'AdminEmail' => 'admin@localhost', 27 'ShowSQLError' => false,27 'ShowSQLError' => $IsDeveloper, 28 28 'ShowSQLQuery' => false, 29 'ShowPHPError' => false,30 'ShowRuntimeInfo' => false,31 'ErrorLogFile' => ' /var/www/html/dev/centrala/www/php_script_error.log',29 'ShowPHPError' => $IsDeveloper, 30 'ShowRuntimeInfo' => $IsDeveloper, 31 'ErrorLogFile' => 'php_script_error.log', 32 32 'WebcamPassword' => '', 33 33 'WebcamRefresh' => 5, -
trunk/form_classes.php
r483 r484 351 351 'Login' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 352 352 'Name' => array('Type' => 'String', 'Caption' => 'Celé jméno', 'Default' => ''), 353 'Salt' => array('Type' => 'RandomHash', 'Caption' => 'Sůl', 'Default' => ''), 353 354 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => '', 'Method' => 'DoubleSHA1'), 354 355 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''), … … 563 564 'Items' => array( 564 565 'Login' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''), 566 'Salt' => array('Type' => 'RandomHash', 'Caption' => 'Sůl', 'Default' => ''), 565 567 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''), 566 568 'Name' => array('Type' => 'String', 'Caption' => 'Zobrazované jméno', 'Default' => ''),
Note:
See TracChangeset
for help on using the changeset viewer.