73 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
74 $this->DatabaseAlgorithms =
get_package(
'database::database_algorithms' ,
'last' , __FILE__ );
75 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
76 $this->SecurityParser =
get_package(
'security::security_parser' ,
'last' , __FILE__ );
118 if( $this->AddLimitations ===
'1 = 1' )
120 $this->AddLimitations = $theAddLimitation;
124 throw(
new Exception(
'"AddLimitations" was already set' ) );
127 catch( Exception $e )
162 $this->Database->select(
'*' , $this->NativeTable ,
"( $this->AddLimitations ) AND $Condition" )
165 catch( Exception $e )
209 function select( $Start =
false , $Limit =
false , $Field =
false ,
210 $Order =
false , $Condition =
'1 = 1' )
214 $Condition = $this->DatabaseAlgorithms->select_condition(
215 $Start , $Limit , $Field , $Order , $Condition , $this->NativeTable
220 catch( Exception $e )
248 function delete( $id , $Options =
' 1 = 1' )
254 if( count( $Files ) )
256 foreach( $Files as $i => $File )
258 @unlink(
get_field( $File ,
'file_path' ) );
262 $id = $this->Security->get( $id ,
'integer_list' );
263 $this->Database->delete( $this->NativeTable ,
"( $this->AddLimitations ) AND id IN ( $id )" );
264 $this->Database->commit();
267 catch( Exception $e )
299 $Record = $this->SecurityParser->parse_parameters(
300 $Record ,
'file_path:string;original_file_name:string;preview_image:string,allow_not_set'
303 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
305 $id = $this->DatabaseAlgorithms->create( $this->NativeTable , $Fields , $Values );
307 $EventManager =
get_package(
'event_manager' ,
'last' , __FILE__ );
308 $EventManager->trigger_event(
'on_after_create_uploaded_file' , array(
'id' => $id ) );
312 catch( Exception $e )
344 $id = $this->Security->get( $id ,
'integer_list' );
345 $Record = $this->SecurityParser->parse_parameters(
346 $Record ,
'file_path:string;original_file_name:string;preview_image:string' ,
'allow_not_set'
349 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
351 if( isset( $Fields[ 0 ] ) )
353 $this->Database->update(
354 $this->NativeTable , $Fields , $Values ,
"( $this->AddLimitations ) AND id IN ( $id )"
356 $this->Database->commit();
359 catch( Exception $e )
391 $id = $this->Security->get( $id ,
'integer_list' );
393 return( $this->
unsafe_select( $this->NativeTable.
".id IN ( $id )" ) );
395 catch( Exception $e )