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__ );
114 if( $this->AddLimitations ===
'1 = 1' )
116 $this->AddLimitations = $theAddLimitation;
120 throw(
new Exception(
'"AddLimitations" was already set' ) );
123 catch( Exception $e )
158 $this->Database->select(
'*' , $this->NativeTable ,
"( $this->AddLimitations ) AND $Condition" )
161 catch( Exception $e )
205 function select( $Start =
false , $Limit =
false , $Field =
false ,
206 $Order =
false , $Condition =
'1 = 1' )
210 $Condition = $this->DatabaseAlgorithms->select_condition(
211 $Start , $Limit , $Field , $Order , $Condition , $this->NativeTable
216 catch( Exception $e )
244 function delete( $id , $Condition =
' 1 = 1' )
248 $id = $this->Security->get( $id ,
'integer_list' );
249 $this->Database->delete( $this->NativeTable ,
"( $Condition ) AND id IN ( $id )" );
250 $this->Database->commit();
252 catch( Exception $e )
281 $Settings->load_file( dirname( __FILE__ ).
'/conf/cf_pmsg_settings' );
283 return( $Settings->get_setting(
'admin_login' ,
'admin' ) );
285 catch( Exception $e )
317 $Record = $this->SecurityParser->parse_parameters(
318 $Record ,
'author:string;recipient:string;subject:string;message:string'
321 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
323 $Fields [] =
'creation_date';
324 $Values [] =
'NOW()';
326 $id = $this->DatabaseAlgorithms->create( $this->NativeTable , $Fields , $Values );
328 $EventManager =
get_package(
'event_manager' ,
'last' , __FILE__ );
329 $EventManager->trigger_event(
'on_after_create_message' , array(
'id' => $id ) );
333 catch( Exception $e )
365 $id = $this->Security->get( $id ,
'integer_list' );
366 $Record = $this->SecurityParser->parse_parameters(
367 $Record ,
'deleted:integer;recipient:string;author:string;subject:string;'.
368 'message:string;`read`:integer' ,
'allow_not_set'
371 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
373 if( isset( $Fields[ 0 ] ) )
375 $this->Database->update(
376 $this->NativeTable , $Fields , $Values ,
"( $this->AddLimitations ) AND id IN ( $id )"
378 $this->Database->commit();
381 catch( Exception $e )