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 )
157 $Records = $this->Database->select(
158 '*' , $this->NativeTable ,
"( $this->AddLimitations ) AND $Condition"
161 foreach( $Records as $k => $v )
163 $Records[ $k ]->page = htmlspecialchars_decode( $Records[ $k ]->page , ENT_QUOTES );
164 $Records[ $k ]->root_page = htmlspecialchars_decode( $Records[ $k ]->root_page , ENT_QUOTES );
165 $Records[ $k ]->navigation = htmlspecialchars_decode( $Records[ $k ]->navigation , ENT_QUOTES );
166 $Records[ $k ]->navigation = htmlspecialchars_decode( $Records[ $k ]->navigation , ENT_QUOTES );
171 catch( Exception $e )
215 function select( $Start , $Limit , $Field =
false , $Order =
false , $Condition =
'1 = 1' )
219 $Condition = $this->DatabaseAlgorithms->select_condition(
220 $Start , $Limit , $Field , $Order , $Condition , $this->NativeTable
225 foreach( $Items as $k => $i )
227 $Items[ $k ]->navigation = str_replace(
'{' ,
'[lfb]' , $Items[ $k ]->navigation );
228 $Items[ $k ]->navigation = str_replace(
'}' ,
'[rfb]' , $Items[ $k ]->navigation );
233 catch( Exception $e )
265 $id = $this->Security->get( $id ,
'integer' );
267 $Records = $this->
unsafe_select( $this->NativeTable.
".id = $id" );
269 if( count( $Records ) == 0 )
271 throw(
new Exception(
'Record was not found' ) );
274 return( $Records[ 0 ] );
276 catch( Exception $e )
312 $Params = $this->SecurityParser->parse_parameters(
313 func_get_args() ,
'0:string,alias_page;1:string,alias_root_page;2:string,alias_navigation'
316 $this->Database->insert(
318 'page , root_page , navigation' ,
319 "'".$Params->page.
"' , '".$Params->root_page.
"' , '".$Params->navigation.
"'"
321 $this->Database->commit();
323 catch( Exception $e )
347 function delete( $id )
351 $id = $this->Security->get( $id ,
'integer_list' );
355 $this->Database->delete( $this->NativeTable ,
"( $this->AddLimitations ) AND id IN ( $id )" );
356 $this->Database->commit();
358 catch( Exception $e )
390 $id = $this->Security->get( $id ,
'integer_list' );
391 $Record = $this->SecurityParser->parse_parameters(
392 $Record ,
'page:command;root_page:command;navigation:raw' ,
'allow_not_set'
395 list( $Fields , $Values ) = $this->DatabaseAlgorithms->compile_fields_values( $Record );
397 if( isset( $Fields[ 0 ] ) )
399 $this->Database->update(
400 $this->NativeTable , $Fields , $Values ,
"( $this->AddLimitations ) AND id IN ( $id )"
402 $this->Database->commit();
405 catch( Exception $e )
437 $id = $this->Security->get( $id ,
'integer_list' );
439 return( $this->
unsafe_select( $this->NativeTable.
".id IN ( $id )" ) );
441 catch( Exception $e )