69 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
70 $this->DatabaseAlgorithms =
get_package(
'database::database_algorithms' ,
'last' , __FILE__ );
71 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
72 $this->SecurityParser =
get_package(
'security::security_parser' ,
'last' , __FILE__ );
108 $Settings = $this->Database->select(
'*' , $this->NativeTable ,
"$Condition" );
112 catch( Exception $e )
144 $Record = $this->SecurityParser->parse_parameters( $Record ,
'name:string;value:string' );
146 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
148 $this->Database->lock( array( $this->NativeTable ) , array(
'WRITE' ) );
150 $this->Database->insert( $this->NativeTable , implode(
',' , $Fields ) , implode(
',' , $Values ) );
151 $this->Database->commit();
153 $id = $this->Database->select(
'*' , $this->NativeTable ,
'1 = 1 ORDER by id DESC LIMIT 0 , 1' );
156 $this->Database->unlock();
160 catch( Exception $e )
188 function get_setting( $SettingName , $DefaultValue =
'_throw_exception' )
192 $SettingName = $this->Security->get( $SettingName ,
'command' );
196 "name LIKE '$SettingName' AND date_from <= $Time AND $Time <= date_to"
199 if( isset( $Settings[ 0 ] ) )
201 return(
get_field( $Settings[ 0 ] ,
'value' ) );
203 elseif( $DefaultValue ===
'_throw_exception' )
205 throw(
new Exception(
"Setting \"$SettingName\" was not found" ) );
209 return( $DefaultValue );
212 catch( Exception $e )
244 $SettingName = $this->Security->get( $SettingName ,
'command' );
248 "name LIKE '$SettingName' AND date_from <= $Time AND $Time <= date_to"
251 if( isset( $Settings[ 0 ] ) )
253 $id =
get_field( $Settings[ 0 ] ,
'id' );
254 $Chronological =
get_package(
'database::chronological' ,
'last' , __FILE__ );
255 $Chronological->update_record(
256 $id , array(
'name' =>
get_field( $Settings[ 0 ] ,
'name' ) ,
'value' => $Value ) , $this
261 throw(
new Exception(
"Setting \"$SettingName\" was not found" ) );
264 catch( Exception $e )
292 return( serialize( $this->SettingsList ) );
294 catch( Exception $e )