Current file: /home/greg/workspace/PHPDS-dev-trunk/PHPDevShell/stable/trunk/includes/legacy/db.class.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 35 CRAP
0.00%0.00%
0.00% 0 / 192
 
db
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 10
0.00%0.00%
0.00% 0 / 76
 connect_mysql()
0.00%0.00%
0.00% 0 / 1 20
0.00%0.00%
0.00% 0 / 11
 connect_memcache()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 start_transaction()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 end_transaction()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 table_exists($table)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 count_rows($table_name, $column = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 return_sql_error($query)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 new_query($query)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 query_split($query, $print_pages_link = true)
0.00%0.00%
0.00% 0 / 1 272
0.00%0.00%
0.00% 0 / 50
 search($column_array = false, $where_and_or = false, $order_by_array = false, $append_html = false, $return_html = false)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 4
Functions
  
   
0.00%0.00%
0.00% 0 / 25
100.00%100.00%
100.00% 0 / 0
 log_menu_access()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 log_this()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 get_roles($user_id = false, $return_array = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 get_groups($user_id = false, $return_array = false, $alias_only = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 role_exist($role_id)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 group_exist($group_id)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 belongs_to_role($user_id = false, $user_role)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 belongs_to_group($user_id = false, $user_group)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 set_role_query($query_request, $query_root_request = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 set_group_query($query_request, $query_root_request = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 settings_prefix($custom_prefix = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 write_settings($write_settings, $custom_prefix = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 delete_settings($settings_to_delete = false, $custom_prefix = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 get_settings($settings_required = false, $custom_prefix = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 get_essential_settings()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 does_record_exist($table_name, $search_column_names, $search_field_values, $column_name_for_exclusion = false, $exclude_field_value = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 get_hooks()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 select_quick($from_table_name, $select_column_name, $where_column_name, $is_equal_to_column_value)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 delete_quick($from_table_name, $where_column_name, $is_equal_to_column_value, $return_column_value = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 name_of_new_copy($table_name, $name_field, $orig_name)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 installed_plugins()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 cache_write($cache_unique_name, $cache_data)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 cache_read($cache_unique_name)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 cache_clear($cache_unique_name = false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 cache_empty($cache_unique_name)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1


       1                 : <?php                                                                                                                                                                                                                                                                                                                                                                                                                                               
       2                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
       3                 : /**                                                                                                                                                                                                                                                                                                                                                                                                                                                 
       4                 :  * PHPDevShell is a RAD Framework aimed at developing administrative applications.                                                                                                                                                                                                                                                                                                                                                                  
       5                 :  *                                                                                                                                                                                                                                                                                                                                                                                                                                                  
       6                 :  * @package PHPDevShell                                                                                                                                                                                                                                                                                                                                                                                                                             
       7                 :  * @link http://www.phpdevshell.org                                                                                                                                                                                                                                                                                                                                                                                                                 
       8                 :  * @copyright Copyright (C) 2007 Jason Schoeman, All rights reserved.                                                                                                                                                                                                                                                                                                                                                                               
       9                 :  * @license GNU/LGPL, see readme/licensed_under_lgpl or http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html                                                                                                                                                                                                                                                                                                                                      
      10                 :  * @author Jason Schoeman, Contact: titan [at] phpdevshell [dot] org.                                                                                                                                                                                                                                                                                                                                                                               
      11                 :  *                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      12                 :  * Copyright notice: See readme/notice                                                                                                                                                                                                                                                                                                                                                                                                              
      13                 :  * By using PHPDevShell you agree to notice and license, if you dont agree to this notice/license you are not allowed to use PHPDevShell.                                                                                                                                                                                                                                                                                                           
      14                 :  */                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      15                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
      16                 : /**                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      17                 :  * This class makes connections to the database and makes the queries.                                                                                                                                                                                                                                                                                                                                                                              
      18                 :  * Handles database related subjects.                                                                                                                                                                                                                                                                                                                                                                                                               
      19                 :  * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                      
      20                 :  */                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      21                 : class db extends PHPDS_dependant                                                                                                                                                                                                                                                                                                                                                                                                                    
      22                 : {                                                                                                                                                                                                                                                                                                                                                                                                                                                   
      23                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
      24                 :      * If you want to capture the form html to use it in a different location set to true.                                                                                                                                                                                                                                                                                                                                                          
      25                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
      26                 :      * @var mixed                                                                                                                                                                                                                                                                                                                                                                                                                                   
      27                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
      28                 :     public $SEARCH;                                                                                                                                                                                                                                                                                                                                                                                                                                 
      29                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
      30                 :      * This will contain data with a search result message.                                                                                                                                                                                                                                                                                                                                                                                         
      31                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
      32                 :      * @var mixed                                                                                                                                                                                                                                                                                                                                                                                                                                   
      33                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
      34                 :     public $SEARCH_RESULTS;                                                                                                                                                                                                                                                                                                                                                                                                                         
      35                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
      36                 :      * Override limit count results.                                                                                                                                                                                                                                                                                                                                                                                                                
      37                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
      38                 :      * @var mixed                                                                                                                                                                                                                                                                                                                                                                                                                                   
      39                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
      40                 :     public $limit_count;                                                                                                                                                                                                                                                                                                                                                                                                                            
      41                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
      42                 :      * Contains current filter data.                                                                                                                                                                                                                                                                                                                                                                                                                
      43                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
      44                 :      * @var mixed                                                                                                                                                                                                                                                                                                                                                                                                                                   
      45                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
      46                 :     public $filter;                                                                                                                                                                                                                                                                                                                                                                                                                                 
      47                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
      48                 :      * Assigns query object.                                                                                                                                                                                                                                                                                                                                                                                                                        
      49                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
      50                 :      * @var object                                                                                                                                                                                                                                                                                                                                                                                                                                  
      51                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
      52                 :     public $query;                                                                                                                                                                                                                                                                                                                                                                                                                                  
      53                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
      54                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
      55                 :      * This method connects to the database, if fails return a message to the template system.                                                                                                                                                                                                                                                                                                                                                      
      56                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
      57                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
      58                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
      59                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
      60                 :     public function connect_mysql()                                                                                                                                                                                                                                                                                                                                                                                                                 
      61                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
      62                 :         try {                                                                                                                                                                                                                                                                                                                                                                                                                                       
      63                 :             // Does user want a persistant connection?                                                                                                                                                                                                                                                                                                                                                                                              
      64               0 :             if ($this->configuration['persistent_db_connection'] == true) {                                                                                                                                                                                                                                                                                                                                                                         
      65               0 :                 $this->connection = mysql_pconnect($this->server, $this->dbUsername, $this->dbPassword);                                                                                                                                                                                                                                                                                                                                            
      66               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                
      67               0 :                 $this->connection = mysql_connect($this->server, $this->dbUsername, $this->dbPassword);                                                                                                                                                                                                                                                                                                                                             
      68                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
      69                 :             // Create database link.                                                                                                                                                                                                                                                                                                                                                                                                                
      70               0 :             $link = mysql_select_db($this->dbName, $this->connection);                                                                                                                                                                                                                                                                                                                                                                              
      71                 :             // Display error on link.                                                                                                                                                                                                                                                                                                                                                                                                               
      72               0 :             if (empty($link))                                                                                                                                                                                                                                                                                                                                                                                                                       
      73               0 :                     throw new PHPDS_databaseException(mysql_error(), mysql_errno());                                                                                                                                                                                                                                                                                                                                                                
      74               0 :         } catch (Exception $e) {                                                                                                                                                                                                                                                                                                                                                                                                                    
      75               0 :             $code = mysql_errno();                                                                                                                                                                                                                                                                                                                                                                                                                  
      76               0 :             throw new PHPDS_databaseException(mysql_error(), mysql_errno(), $e);                                                                                                                                                                                                                                                                                                                                                                    
      77                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                           
      78               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
      79                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
      80                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
      81                 :      * Does the connection to the memcache server.                                                                                                                                                                                                                                                                                                                                                                                                  
      82                 :      * Currently memcache is the primary supported engine.                                                                                                                                                                                                                                                                                                                                                                                          
      83                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
      84                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
      85                 :     public function connect_memcache()                                                                                                                                                                                                                                                                                                                                                                                                              
      86                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
      87                 :         // Check connection type.                                                                                                                                                                                                                                                                                                                                                                                                                   
      88               0 :         $this->connectMemcache();                                                                                                                                                                                                                                                                                                                                                                                                                   
      89               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
      90                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
      91                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
      92                 :      * Set the starting point for a SQL transaction                                                                                                                                                                                                                                                                                                                                                                                                 
      93                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
      94                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
      95                 :      * You should call end_transaction(true) for the queries to actually occur                                                                                                                                                                                                                                                                                                                                                                      
      96                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
      97                 :     public function start_transaction()                                                                                                                                                                                                                                                                                                                                                                                                             
      98                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
      99               0 :         return $this->startTransaction();                                                                                                                                                                                                                                                                                                                                                                                                           
     100                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     101                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     102                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     103                 :      * Commits database transactions.                                                                                                                                                                                                                                                                                                                                                                                                               
     104                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     105                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     106                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     107                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     108                 :     public function end_transaction()                                                                                                                                                                                                                                                                                                                                                                                                               
     109                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     110               0 :         return $this->endTransaction();                                                                                                                                                                                                                                                                                                                                                                                                             
     111                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     112                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     113                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     114                 :      * Checks if a database table exists.                                                                                                                                                                                                                                                                                                                                                                                                           
     115                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     116                 :      * @param string $table                                                                                                                                                                                                                                                                                                                                                                                                                         
     117                 :      * @return boolean                                                                                                                                                                                                                                                                                                                                                                                                                              
     118                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     119                 :     public function table_exists($table)                                                                                                                                                                                                                                                                                                                                                                                                            
     120                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     121               0 :         return $this->tableExist($table);                                                                                                                                                                                                                                                                                                                                                                                                           
     122                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     123                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     124                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     125                 :      * Simple method to count number of rows in a table.                                                                                                                                                                                                                                                                                                                                                                                            
     126                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     127                 :      * @param string $table_name                                                                                                                                                                                                                                                                                                                                                                                                                    
     128                 :      * @param string $column                                                                                                                                                                                                                                                                                                                                                                                                                        
     129                 :      * @return integer                                                                                                                                                                                                                                                                                                                                                                                                                              
     130                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     131                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     132                 :     public function count_rows($table_name, $column = false)                                                                                                                                                                                                                                                                                                                                                                                        
     133                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     134               0 :         return $this->countRows($table_name, $column);                                                                                                                                                                                                                                                                                                                                                                                              
     135                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     136                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     137                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     138                 :      * This method returns the last MySQL error as a string if there is any. It will also                                                                                                                                                                                                                                                                                                                                                           
     139                 :      * return the actual erroneous SQL statement if the display_sql_on_error property is                                                                                                                                                                                                                                                                                                                                                            
     140                 :      * set to true. This is very helpfull when debugging an SQL related problem.                                                                                                                                                                                                                                                                                                                                                                    
     141                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     142                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     143                 :      * @param string The actual query string.                                                                                                                                                                                                                                                                                                                                                                                                       
     144                 :      * @return string                                                                                                                                                                                                                                                                                                                                                                                                                               
     145                 :      * @version 1.0.1                                                                                                                                                                                                                                                                                                                                                                                                                               
     146                 :      * @date 20100329 prevent an exception if display_sql_on_error is not set                                                                                                                                                                                                                                                                                                                                                                       
     147                 :      * @author Don Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                                 
     148                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     149                 :     public function return_sql_error($query)                                                                                                                                                                                                                                                                                                                                                                                                        
     150                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     151               0 :         return $this->returnSqlError($query);                                                                                                                                                                                                                                                                                                                                                                                                       
     152                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     153                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     154                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     155                 :      * Compatibility method to allow PHPDS_db to replace db                                                                                                                                                                                                                                                                                                                                                                                         
     156                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     157                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     158                 :      * @date                20100219                                                                                                                                                                                                                                                                                                                                                                                                                
     159                 :      * @version        1.0                                                                                                                                                                                                                                                                                                                                                                                                                          
     160                 :      * @author        greg                                                                                                                                                                                                                                                                                                                                                                                                                          
     161                 :      * @see stable/phpdevshell/includes/db#new_query($query)                                                                                                                                                                                                                                                                                                                                                                                        
     162                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     163                 :     public function new_query($query)                                                                                                                                                                                                                                                                                                                                                                                                               
     164                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     165               0 :         return $this->newQuery($query);                                                                                                                                                                                                                                                                                                                                                                                                             
     166                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     167                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     168                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     169                 :      * This method is used if you would like to split result pages in your PHP script.                                                                                                                                                                                                                                                                                                                                                              
     170                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     171                 :      * Usage Example :                                                                                                                                                                                                                                                                                                                                                                                                                              
     172                 :      * <code>                                                                                                                                                                                                                                                                                                                                                                                                                                       
     173                 :      *     $select_phonebookentries = $db->query_split                                                                                                                                                                                                                                                                                                                                                                                              
     174                 :      *   ("                                                                                                                                                                                                                                                                                                                                                                                                                                         
     175                 :      *       SELECT                                                                                                                                                                                                                                                                                                                                                                                                                                 
     176                 :      *           t1.user_id, t1.user_display_name, t1.user_name,                                                                                                                                                                                                                                                                                                                                                                                    
     177                 :      *           t2.cell_number, t2.work_number, t2.fax_number, t2.home_number                                                                                                                                                                                                                                                                                                                                                                      
     178                 :      *       FROM                                                                                                                                                                                                                                                                                                                                                                                                                                   
     179                 :      *           _db_core_users t1                                                                                                                                                                                                                                                                                                                                                                                                                  
     180                 :      *       LEFT JOIN                                                                                                                                                                                                                                                                                                                                                                                                                              
     181                 :      *           _db_simple_phonebook t2                                                                                                                                                                                                                                                                                                                                                                                                            
     182                 :      *       ON                                                                                                                                                                                                                                                                                                                                                                                                                                     
     183                 :      *           t1.user_id = t2.user_id                                                                                                                                                                                                                                                                                                                                                                                                            
     184                 :      *       {$db->search(array(__('User ID')=>'user_id', __('Cell Number')=>'cell_number', __('Work Number')=>'work_number', __('Fax Number')=>'fax_number', __('Home Number')=>'home_number', __('User Display Name')=>'user_display_name'), 'WHERE')}                                                                                                                                                                                            
     185                 :      *   ");                                                                                                                                                                                                                                                                                                                                                                                                                                        
     186                 :      * </code>                                                                                                                                                                                                                                                                                                                                                                                                                                      
     187                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     188                 :      * @deprecated you should use a plugin                                                                                                                                                                                                                                                                                                                                                                                                          
     189                 :      * @param string The actual query string.                                                                                                                                                                                                                                                                                                                                                                                                       
     190                 :      * @param boolean If true, print page links, else dont. If no limit value is provided, all resluts will be displayed.                                                                                                                                                                                                                                                                                                                           
     191                 :      * @return array Results of query.                                                                                                                                                                                                                                                                                                                                                                                                              
     192                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     193                 :     public function query_split($query, $print_pages_link = true)                                                                                                                                                                                                                                                                                                                                                                                   
     194                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     195               0 :         if (empty($this->limit_count)) {                                                                                                                                                                                                                                                                                                                                                                                                            
     196                 :             // Get split results. ///////////////////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                           
     197               0 :             $settings = $this->essentialSettings;                                                                                                                                                                                                                                                                                                                                                                                                   
     198                 :             // Assign limit count. //////////////////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                           
     199               0 :             $this->limit_count = $settings['split_results'];                                                                                                                                                                                                                                                                                                                                                                                        
     200               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                           
     201                 :         // This part returns the result inside the LIMIT command set by the user. ///////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                               
     202               0 :         $query_replace_prefix = preg_replace('/_db_/', $this->configuration['database_prefix'], $query);                                                                                                                                                                                                                                                                                                                                            
     203                 :         // I am not 100% sure if this will work with SUB queries, if someone could confirm that it is working, please let me know. //                                                                                                                                                                                                                                                                                                               
     204               0 :         $query_replace_prefix = preg_replace('/SELECT/', 'SELECT SQL_CALC_FOUND_ROWS', $query_replace_prefix);                                                                                                                                                                                                                                                                                                                                      
     205                 :         // Get the p variable to select and calculate the LIMIT from where the database needs to select data from. //////////////////                                                                                                                                                                                                                                                                                                               
     206               0 :         (isset($this->security->get['p']) && $this->security->get['p'] != false) ? $current_page = $this->security->get['p'] : $current_page = 1;                                                                                                                                                                                                                                                                                                   
     207                 :         // Simple calculation to see from what result the query needs to LIMIT. /////////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                               
     208               0 :         $from = (($current_page - 1) * $this->limit_count);                                                                                                                                                                                                                                                                                                                                                                                         
     209                 :         // Set limit property. //////////////////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                               
     210               0 :         $limit = " LIMIT $from, $this->limit_count ";                                                                                                                                                                                                                                                                                                                                                                                               
     211                 :         // This here is the query where the LIMIT function is added. ////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                               
     212               0 :         $limit = $this->new_query($query_replace_prefix . $limit);                                                                                                                                                                                                                                                                                                                                                                                  
     213                 :         // This part saves the total number of rows available without the LIMIT function effecting it. //////////////////////////////                                                                                                                                                                                                                                                                                                               
     214               0 :         $total_rows = $this->new_query('SELECT FOUND_ROWS()');                                                                                                                                                                                                                                                                                                                                                                                      
     215               0 :         $total_rows = mysql_result($total_rows, 0, 'FOUND_ROWS()');                                                                                                                                                                                                                                                                                                                                                                                 
     216                 :         // Calculated the total number of pages. ////////////////////////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                               
     217               0 :         $total_pages = ceil($total_rows / $this->limit_count); //////////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                               
     218                 :         // END DATABASE SET /////////////////////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                                                                               
     219                 :         // Check to see if there is only 1 page, if so, give the end of results message.                                                                                                                                                                                                                                                                                                                                                            
     220               0 :         if ($total_pages <= 1) {                                                                                                                                                                                                                                                                                                                                                                                                                    
     221                 :             // Show message if only 1 page exists.                                                                                                                                                                                                                                                                                                                                                                                                  
     222               0 :             $this->SEARCH_RESULTS = sprintf($this->template->module['no_results'], ___('Showing the only page [1/1]'));                                                                                                                                                                                                                                                                                                                             
     223               0 :         } else {                                                                                                                                                                                                                                                                                                                                                                                                                                    
     224                 :             // Other paging calculations.                                                                                                                                                                                                                                                                                                                                                                                                           
     225               0 :             $previous_page = $current_page - 1;                                                                                                                                                                                                                                                                                                                                                                                                     
     226               0 :             $next_page = $current_page + 1;                                                                                                                                                                                                                                                                                                                                                                                                         
     227                 :             // FAST-FORWARD and REWIND functionality.                                                                                                                                                                                                                                                                                                                                                                                               
     228               0 :             $ff_ = floor(($total_pages / 2) + ($current_page / 2));                                                                                                                                                                                                                                                                                                                                                                                 
     229               0 :             $rw_ = floor($current_page / 2);                                                                                                                                                                                                                                                                                                                                                                                                        
     230                 :             // Make sure FF is not empty.                                                                                                                                                                                                                                                                                                                                                                                                           
     231               0 :             if (($ff_ != 0) && ($ff_ != $total_pages) && ($ff_ != $next_page) && ($ff_ != $current_page)) {                                                                                                                                                                                                                                                                                                                                         
     232               0 :                 $ff = '<a href="' . $this->navigation->buildURL(false, "p=$ff_") . '" class="page-ff">' . $this->lang['ff_icon'] . '</a>';                                                                                                                                                                                                                                                                                                          
     233               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                
     234               0 :                 $ff = false;                                                                                                                                                                                                                                                                                                                                                                                                                        
     235                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     236                 :             // Make sure RW is not empty.                                                                                                                                                                                                                                                                                                                                                                                                           
     237               0 :             if (($rw_ != 0) && ($rw_ != 1) && ($rw_ != $previous_page) && ($rw_ != $current_page)) {                                                                                                                                                                                                                                                                                                                                                
     238               0 :                 $rw = '<a href="' . $this->navigation->buildURL(false, "p=$rw_") . '" class="page-rw">' . $this->lang['rw_icon'] . '</a>';                                                                                                                                                                                                                                                                                                          
     239               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                
     240               0 :                 $rw = false;                                                                                                                                                                                                                                                                                                                                                                                                                        
     241                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     242                 :             // URL control for [First].                                                                                                                                                                                                                                                                                                                                                                                                             
     243               0 :             if ($current_page == 1) {                                                                                                                                                                                                                                                                                                                                                                                                               
     244               0 :                 $first_page = $this->lang['first_disabled_icon'];                                                                                                                                                                                                                                                                                                                                                                                   
     245               0 :                 $previous_page = $this->lang['previous_disabled_icon'];                                                                                                                                                                                                                                                                                                                                                                             
     246               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                
     247               0 :                 $first_page = '<a href="' . $this->navigation->buildURL(false, "p=1") . '" class="page-first">' . $this->lang['first_icon'] . '</a>';                                                                                                                                                                                                                                                                                               
     248               0 :                 $previous_page = '<a href="' . $this->navigation->buildURL(false, "p=$previous_page") . '" class="page-previous">' . $this->lang['previous_icon'] . '</a>';                                                                                                                                                                                                                                                                         
     249                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     250                 :             // URL control for [Last].                                                                                                                                                                                                                                                                                                                                                                                                              
     251               0 :             if ($current_page == $total_pages) {                                                                                                                                                                                                                                                                                                                                                                                                    
     252               0 :                 $last_page = $this->lang['last_disabled_icon'];                                                                                                                                                                                                                                                                                                                                                                                     
     253               0 :                 $next_page = $this->lang['next_disabled_icon'];                                                                                                                                                                                                                                                                                                                                                                                     
     254                 :                 // Current records.                                                                                                                                                                                                                                                                                                                                                                                                                 
     255               0 :                 $current_records = $total_rows;                                                                                                                                                                                                                                                                                                                                                                                                     
     256               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                
     257               0 :                 $last_page = '<a href="' . $this->navigation->buildURL(false, "p=$total_pages") . '" class="page-last">' . $this->lang['last_icon'] . '</a>';                                                                                                                                                                                                                                                                                       
     258               0 :                 $next_page = '<a href="' . $this->navigation->buildURL(false, "p=$next_page") . '" class="page-next">' . $this->lang['next_icon'] . '</a>';                                                                                                                                                                                                                                                                                         
     259                 :                 // Current records.                                                                                                                                                                                                                                                                                                                                                                                                                 
     260               0 :                 $current_records = $current_page * $this->limit_count;                                                                                                                                                                                                                                                                                                                                                                              
     261                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     262                 :             // Compile result strings.                                                                                                                                                                                                                                                                                                                                                                                                              
     263               0 :             $paging_back = $first_page . $rw . $previous_page;                                                                                                                                                                                                                                                                                                                                                                                      
     264               0 :             $paging_results = ___('&nbsp;[') . $current_page . ___('/') . $total_pages . ___('&nbsp;Pages') . ___(']&nbsp;') . ___('&nbsp;[') . $current_records . ___('/') . $total_rows . ___('&nbsp;Records') . ___(']&nbsp;');                                                                                                                                                                                                                  
     265               0 :             $paging_forward = $next_page . $ff . $last_page;                                                                                                                                                                                                                                                                                                                                                                                        
     266                 :             // This part creates the links to the pages.                                                                                                                                                                                                                                                                                                                                                                                            
     267               0 :             $this->SEARCH_RESULTS = sprintf($this->template->module['results'], $paging_back, $paging_results, $paging_forward);                                                                                                                                                                                                                                                                                                                    
     268                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                           
     269                 :         // Check to see if pages links needs to be print out to the browser.                                                                                                                                                                                                                                                                                                                                                                        
     270               0 :         if ($print_pages_link == true) {                                                                                                                                                                                                                                                                                                                                                                                                            
     271               0 :             print $this->SEARCH_RESULTS;                                                                                                                                                                                                                                                                                                                                                                                                            
     272               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                           
     273                 :         // Return limit.                                                                                                                                                                                                                                                                                                                                                                                                                            
     274               0 :         return $limit;                                                                                                                                                                                                                                                                                                                                                                                                                              
     275                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     276                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     277                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     278                 :      * This very usefull method is used to implement a search form in your script.                                                                                                                                                                                                                                                                                                                                                                  
     279                 :      * Users can seach for everything using the * or % character.                                                                                                                                                                                                                                                                                                                                                                                   
     280                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     281                 :      * @deprecated you should use a plugin                                                                                                                                                                                                                                                                                                                                                                                                          
     282                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     283                 :      * @param array Array containing column names you would like the method to search in.                                                                                                                                                                                                                                                                                                                                                           
     284                 :      * @param string Can have values 'WHERE', 'AND', 'OR' depending on your query.                                                                                                                                                                                                                                                                                                                                                                  
     285                 :      * @param array Additional ORDER BY columns, i.e. (0=>'column1 ASC', 1=>'column2 DESC')                                                                                                                                                                                                                                                                                                                                                         
     286                 :      * @param string Allows additional HTML to be appended within the search form                                                                                                                                                                                                                                                                                                                                                                   
     287                 :      * @param boolean Would you like to return the search form instead of printing it out.                                                                                                                                                                                                                                                                                                                                                          
     288                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     289                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     290                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     291                 :     public function search($column_array = false, $where_and_or = false, $order_by_array = false, $append_html = false, $return_html = false)                                                                                                                                                                                                                                                                                                       
     292                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     293               0 :         if (!empty($this->configuration['user_id'])) {                                                                                                                                                                                                                                                                                                                                                                                              
     294                 :             // Lets query search filters from database first.                                                                                                                                                                                                                                                                                                                                                                                       
     295               0 :             $search_filter_db = $this->new_query("                                                                                                                                                                                                                                                                                                                                                                                                  
     296                 :                 SELECT                                                                                                                                                                                                                                                                                                                                                                                                                              
     297                 :                     t1.search_id, t1.filter_search, t1.filter_order, t1.filter_by, t1.exact_match                                                                                                                                                                                                                                                                                                                                                   
     298                 :                 FROM                                                                                                                                                                                                                                                                                                                                                                                                                                
     299                 :                     _db_core_filter t1                                                                                                                                                                                                                                                                                                                                                                                                              
     300                 :                 WHERE                                                                                                                                                                                                                                                                                                                                                                                                                               
     301               0 :                     t1.menu_id = '{$this->configuration['m']}'                                                                                                                                                                                                                                                                                                                                                                                      
     302                 :                 AND                                                                                                                                                                                                                                                                                                                                                                                                                                 
     303               0 :                     t1.user_id = '{$this->configuration['user_id']}'                                                                                                                                                                                                                                                                                                                                                                                
     304                 :                 LIMIT                                                                                                                                                                                                                                                                                                                                                                                                                               
     305                 :                     0,1                                                                                                                                                                                                                                                                                                                                                                                                                             
     306               0 :             ");                                                                                                                                                                                                                                                                                                                                                                                                                                     
     307                 :             // Collect values.                                                                                                                                                                                                                                                                                                                                                                                                                      
     308               0 :             $this->filter = mysql_fetch_array($search_filter_db);                                                                                                                                                                                                                                                                                                                                                                                   
     309               0 :         } else if (!empty($_SESSION['filter_search']) && empty($this->configuration['user_id'])) {                                                                                                                                                                                                                                                                                                                                                  
     310               0 :             $this->filter['filter_search'] = $_SESSION['filter_search'];                                                                                                                                                                                                                                                                                                                                                                            
     311               0 :             $this->filter['filter_order'] = $_SESSION['filter_order'];                                                                                                                                                                                                                                                                                                                                                                              
     312               0 :             $this->filter['filter_by'] = $_SESSION['filter_by'];                                                                                                                                                                                                                                                                                                                                                                                    
     313               0 :             $this->filter['exact_match'] = $_SESSION['exact_match'];                                                                                                                                                                                                                                                                                                                                                                                
     314               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                           
     315                 :         // Check if method search variables are valid.                                                                                                                                                                                                                                                                                                                                                                                              
     316               0 :         if (is_array($column_array) && !empty($where_and_or)) {                                                                                                                                                                                                                                                                                                                                                                                     
     317                 :             // Lets save the new values to the database.                                                                                                                                                                                                                                                                                                                                                                                            
     318               0 :             if (!empty($this->security->post['search'])) {                                                                                                                                                                                                                                                                                                                                                                                          
     319                 :                 // Set filter array.                                                                                                                                                                                                                                                                                                                                                                                                                
     320               0 :                 $this->filter['filter_search'] = $this->security->post['search_field'];                                                                                                                                                                                                                                                                                                                                                             
     321               0 :                 $this->filter['filter_order'] = $this->security->post['filter_module_order'];                                                                                                                                                                                                                                                                                                                                                       
     322               0 :                 $this->filter['filter_by'] = $this->security->post['filter_module_by'];                                                                                                                                                                                                                                                                                                                                                             
     323               0 :                 $this->filter['exact_match'] = $this->security->post['exact_match'];                                                                                                                                                                                                                                                                                                                                                                
     324                 :                 // Define.                                                                                                                                                                                                                                                                                                                                                                                                                          
     325               0 :                 if (empty($this->filter['search_id'])) $this->filter['search_id'] = false;                                                                                                                                                                                                                                                                                                                                                          
     326                 :                 // Lets update the database with the latest search filter.                                                                                                                                                                                                                                                                                                                                                                          
     327               0 :                 if ($this->configuration['user_id'] != 0) {                                                                                                                                                                                                                                                                                                                                                                                         
     328               0 :                     $this->new_query("                                                                                                                                                                                                                                                                                                                                                                                                              
     329                 :                         REPLACE INTO                                                                                                                                                                                                                                                                                                                                                                                                                
     330                 :                             _db_core_filter                                                                                                                                                                                                                                                                                                                                                                                                         
     331                 :                         VALUES                                                                                                                                                                                                                                                                                                                                                                                                                      
     332               0 :                             ('{$this->filter['search_id']}', '{$this->configuration['user_id']}', '{$this->configuration['m']}', '{$this->filter['filter_search']}', '{$this->filter['filter_order']}', '{$this->filter['filter_by']}', '{$this->filter['exact_match']}')                                                                                                                                                                           
     333               0 :                     ");                                                                                                                                                                                                                                                                                                                                                                                                                             
     334               0 :                 } else {                                                                                                                                                                                                                                                                                                                                                                                                                            
     335               0 :                     $_SESSION['filter_search'] = $this->security->post['search_field'];                                                                                                                                                                                                                                                                                                                                                             
     336               0 :                     $_SESSION['filter_order'] = $this->security->post['filter_module_order'];                                                                                                                                                                                                                                                                                                                                                       
     337               0 :                     $_SESSION['filter_by'] = $this->security->post['filter_module_by'];                                                                                                                                                                                                                                                                                                                                                             
     338               0 :                     $_SESSION['exact_match'] = $this->security->post['exact_match'];                                                                                                                                                                                                                                                                                                                                                                
     339                 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                   
     340               0 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     341                 :             // Check which options to select.                                                                                                                                                                                                                                                                                                                                                                                                       
     342               0 :             if ($this->filter['filter_order'] == 'ASC') {                                                                                                                                                                                                                                                                                                                                                                                           
     343               0 :                 $filter_module_order1 = 'selected';                                                                                                                                                                                                                                                                                                                                                                                                 
     344               0 :                 $filter_module_order2 = false;                                                                                                                                                                                                                                                                                                                                                                                                      
     345               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                
     346               0 :                 $filter_module_order2 = 'selected';                                                                                                                                                                                                                                                                                                                                                                                                 
     347               0 :                 $filter_module_order1 = false;                                                                                                                                                                                                                                                                                                                                                                                                      
     348                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     349                 :             // Check if checkbox should be checked.                                                                                                                                                                                                                                                                                                                                                                                                 
     350               0 :             if ($this->filter['exact_match'] == 2) {                                                                                                                                                                                                                                                                                                                                                                                                
     351               0 :                 $check_exact_match_2 = 'selected';                                                                                                                                                                                                                                                                                                                                                                                                  
     352               0 :                 $check_exact_match_1 = false;                                                                                                                                                                                                                                                                                                                                                                                                       
     353               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                
     354               0 :                 $check_exact_match_1 = 'selected';                                                                                                                                                                                                                                                                                                                                                                                                  
     355               0 :                 $check_exact_match_2 = false;                                                                                                                                                                                                                                                                                                                                                                                                       
     356                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     357                 :             // Set.                                                                                                                                                                                                                                                                                                                                                                                                                                 
     358               0 :             $display_columns = false;                                                                                                                                                                                                                                                                                                                                                                                                               
     359               0 :             $order_column_option = false;                                                                                                                                                                                                                                                                                                                                                                                                           
     360               0 :             $search_columns = false;                                                                                                                                                                                                                                                                                                                                                                                                                
     361                 :             // Create info and database query string.                                                                                                                                                                                                                                                                                                                                                                                               
     362               0 :             foreach ($column_array as $name_key => $column) {                                                                                                                                                                                                                                                                                                                                                                                       
     363                 :                 // Create information string.                                                                                                                                                                                                                                                                                                                                                                                                       
     364               0 :                 if (is_string($name_key)) {                                                                                                                                                                                                                                                                                                                                                                                                         
     365               0 :                     $defined_name = $name_key;                                                                                                                                                                                                                                                                                                                                                                                                      
     366               0 :                     $display_columns .= $defined_name . '<br />';                                                                                                                                                                                                                                                                                                                                                                                   
     367               0 :                 } else {                                                                                                                                                                                                                                                                                                                                                                                                                            
     368               0 :                     $defined_name = $column;                                                                                                                                                                                                                                                                                                                                                                                                        
     369               0 :                     $display_columns .= $defined_name . '<br />';                                                                                                                                                                                                                                                                                                                                                                                   
     370                 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                   
     371                 :                 // Mark selected column option.                                                                                                                                                                                                                                                                                                                                                                                                     
     372               0 :                 if ($this->filter['filter_by'] == $column) {                                                                                                                                                                                                                                                                                                                                                                                        
     373                 :                     // Build by options.                                                                                                                                                                                                                                                                                                                                                                                                            
     374               0 :                     $order_column_option .= "<option value='$column' selected>$defined_name</option>";                                                                                                                                                                                                                                                                                                                                              
     375               0 :                 } else {                                                                                                                                                                                                                                                                                                                                                                                                                            
     376                 :                     // Build by options.                                                                                                                                                                                                                                                                                                                                                                                                            
     377               0 :                     $order_column_option .= "<option value='$column'>$defined_name</option>";                                                                                                                                                                                                                                                                                                                                                       
     378                 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                   
     379                 :                 // Exact match?                                                                                                                                                                                                                                                                                                                                                                                                                     
     380               0 :                 if ($this->filter['exact_match'] == 2) {                                                                                                                                                                                                                                                                                                                                                                                            
     381                 :                     // Create databse query string exact.                                                                                                                                                                                                                                                                                                                                                                                           
     382               0 :                     $search_columns .= " $column LIKE '{$this->filter['filter_search']}' OR ";                                                                                                                                                                                                                                                                                                                                                      
     383               0 :                 } else {                                                                                                                                                                                                                                                                                                                                                                                                                            
     384                 :                     // Create databse query string search all.                                                                                                                                                                                                                                                                                                                                                                                      
     385               0 :                     $search_columns .= " $column LIKE '%{$this->filter['filter_search']}%' OR ";                                                                                                                                                                                                                                                                                                                                                    
     386                 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                   
     387               0 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     388                 :             // Glue and ready database string.                                                                                                                                                                                                                                                                                                                                                                                                      
     389               0 :             if (strlen($this->filter['filter_search']) != 0) {                                                                                                                                                                                                                                                                                                                                                                                      
     390                 :                 // Remove last OR.                                                                                                                                                                                                                                                                                                                                                                                                                  
     391               0 :                 $search_columns = $this->core->right_trim($search_columns, ' OR ');                                                                                                                                                                                                                                                                                                                                                                 
     392                 :                 // Glue final database string.                                                                                                                                                                                                                                                                                                                                                                                                      
     393               0 :                 $database_string = ' ' . $where_and_or . ' (' . $search_columns . ') ';                                                                                                                                                                                                                                                                                                                                                             
     394               0 :             } else {                                                                                                                                                                                                                                                                                                                                                                                                                                
     395                 :                 // Return nothing if no $this->filter['filter_search'] value.                                                                                                                                                                                                                                                                                                                                                                       
     396               0 :                 $database_string = false;                                                                                                                                                                                                                                                                                                                                                                                                           
     397                 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     398               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                           
     399                 :         // Create HTML form.                                                                                                                                                                                                                                                                                                                                                                                                                        
     400               0 :         $this->SEARCH = sprintf($this->template->module['search'], $this->navigation->selfUrl(), $this->filter['filter_search'], $this->template->tip(___('Search by : <br>') . $display_columns), $order_column_option, $filter_module_order1, ___('Ascending'), $filter_module_order2, ___('Descending'), $check_exact_match_1, ___('Find All'), $check_exact_match_2, ___('Strict Search'), $this->security->search_validation() . $append_html);
     401                 :         // Set.                                                                                                                                                                                                                                                                                                                                                                                                                                     
     402               0 :         $order_str = false;                                                                                                                                                                                                                                                                                                                                                                                                                         
     403                 :         // Database order.                                                                                                                                                                                                                                                                                                                                                                                                                          
     404               0 :         if (!empty($this->filter['filter_by']) && ($this->filter['filter_order'] != 'ASC' || $this->filter['filter_order'] != 'DESC')) {                                                                                                                                                                                                                                                                                                            
     405               0 :             if (is_array($order_by_array)) {                                                                                                                                                                                                                                                                                                                                                                                                        
     406               0 :                 foreach ($order_by_array as $element) {                                                                                                                                                                                                                                                                                                                                                                                             
     407               0 :                     $order_str .= $order_str . $element . ', ';                                                                                                                                                                                                                                                                                                                                                                                     
     408               0 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                   
     409               0 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     410                 :             // Set order by.                                                                                                                                                                                                                                                                                                                                                                                                                        
     411               0 :             $order_by = " ORDER BY $order_str {$this->filter['filter_by']}\n {$this->filter['filter_order']} ";                                                                                                                                                                                                                                                                                                                                     
     412               0 :         } else {                                                                                                                                                                                                                                                                                                                                                                                                                                    
     413               0 :             if (is_array($order_by_array)) {                                                                                                                                                                                                                                                                                                                                                                                                        
     414               0 :                 $order_by_count = count($order_by_array);                                                                                                                                                                                                                                                                                                                                                                                           
     415               0 :                 if ($order_by_count > 0) {                                                                                                                                                                                                                                                                                                                                                                                                          
     416               0 :                     for ($i = 0; $i < $order_by_count; $i++) {                                                                                                                                                                                                                                                                                                                                                                                      
     417               0 :                         if ($i == $order_by_count - 1) {                                                                                                                                                                                                                                                                                                                                                                                            
     418               0 :                             $order_str .= $order_by_array[$i];                                                                                                                                                                                                                                                                                                                                                                                      
     419               0 :                         } else {                                                                                                                                                                                                                                                                                                                                                                                                                    
     420               0 :                             $order_str .= $order_by_array[$i] . ', ';                                                                                                                                                                                                                                                                                                                                                                               
     421                 :                         }                                                                                                                                                                                                                                                                                                                                                                                                                           
     422               0 :                     }                                                                                                                                                                                                                                                                                                                                                                                                                               
     423               0 :                     $order_by = " ORDER BY $order_str";                                                                                                                                                                                                                                                                                                                                                                                             
     424               0 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                   
     425               0 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                       
     426                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                           
     427                 :         // Output search html.                                                                                                                                                                                                                                                                                                                                                                                                                      
     428               0 :         if (!empty($this->SEARCH) && empty($return_html)) {                                                                                                                                                                                                                                                                                                                                                                                         
     429               0 :             print $this->SEARCH;                                                                                                                                                                                                                                                                                                                                                                                                                    
     430               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                           
     431                 :         // Define.                                                                                                                                                                                                                                                                                                                                                                                                                                  
     432               0 :         if (empty($order_by)) $order_by = false;                                                                                                                                                                                                                                                                                                                                                                                                    
     433                 :         // Return database query string.                                                                                                                                                                                                                                                                                                                                                                                                            
     434               0 :         return $database_string . $order_by;                                                                                                                                                                                                                                                                                                                                                                                                        
     435                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     436                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     437                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     438                 :      * Method logs menu access per user.                                                                                                                                                                                                                                                                                                                                                                                                            
     439                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     440                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     441                 :     public function log_menu_access()                                                                                                                                                                                                                                                                                                                                                                                                               
     442                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     443               0 :         $this->logMenuAccess();                                                                                                                                                                                                                                                                                                                                                                                                                     
     444               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     445                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     446                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     447                 :      * This method logs error and success entries to the database.                                                                                                                                                                                                                                                                                                                                                                                  
     448                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     449                 :      * @param integer $log_type                                                                                                                                                                                                                                                                                                                                                                                                                     
     450                 :      * @param string $log_description                                                                                                                                                                                                                                                                                                                                                                                                               
     451                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     452                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     453                 :      * @version 1.0.1     Changed mysql_escape_string() to mysql_real_escape_string() [see http://www.php.net/manual/en/function.mysql-escape-string.php ]                                                                                                                                                                                                                                                                                          
     454                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     455                 :     public function log_this()                                                                                                                                                                                                                                                                                                                                                                                                                      
     456                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     457               0 :         $this->logThis();                                                                                                                                                                                                                                                                                                                                                                                                                           
     458               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     459                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     460                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     461                 :      * This function gets all role id's for a given user id, while returning a string divided by ',' character or an array with ids.                                                                                                                                                                                                                                                                                                                
     462                 :      * To pull multiple user roles, provide a string for $user_ids like so: '2,5,10,19'.                                                                                                                                                                                                                                                                                                                                                            
     463                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     464                 :      * @param string $user_id                                                                                                                                                                                                                                                                                                                                                                                                                       
     465                 :      * @param boolean $return_array                                                                                                                                                                                                                                                                                                                                                                                                                 
     466                 :      * @return mixed If $return_array = false a comma delimited string will be returned, else an array.                                                                                                                                                                                                                                                                                                                                             
     467                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     468                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     469                 :     public function get_roles($user_id = false, $return_array = false)                                                                                                                                                                                                                                                                                                                                                                              
     470                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     471               0 :         return $this->getRoles($user_id, $return_array);                                                                                                                                                                                                                                                                                                                                                                                            
     472                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     473                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     474                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     475                 :      * This function gets all group id's for given user ids, while returning a string divided by ',' character or an array with ids.                                                                                                                                                                                                                                                                                                                
     476                 :      * To pull multiple user groups, provide a string for $user_ids like so : '2,5,10,19'.                                                                                                                                                                                                                                                                                                                                                          
     477                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     478                 :      * @param string $user_id Leave this field empty if you want skip if user is root.                                                                                                                                                                                                                                                                                                                                                              
     479                 :      * @param boolean $return_array                                                                                                                                                                                                                                                                                                                                                                                                                 
     480                 :      * @param string $alias_only If you would like only items of a certain alias to be called.                                                                                                                                                                                                                                                                                                                                                      
     481                 :      * @return mixed If $return_array = false a comma delimited string will be returned, else an array.                                                                                                                                                                                                                                                                                                                                             
     482                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     483                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     484                 :     public function get_groups($user_id = false, $return_array = false, $alias_only = false)                                                                                                                                                                                                                                                                                                                                                        
     485                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     486               0 :         return $this->getGroups($user_id, $return_array, $alias_only);                                                                                                                                                                                                                                                                                                                                                                              
     487                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     488                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     489                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     490                 :      * Simple check to see if a certain role exists.                                                                                                                                                                                                                                                                                                                                                                                                
     491                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     492                 :      * @param integer $role_id                                                                                                                                                                                                                                                                                                                                                                                                                      
     493                 :      * @return boolean                                                                                                                                                                                                                                                                                                                                                                                                                              
     494                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     495                 :     public function role_exist($role_id)                                                                                                                                                                                                                                                                                                                                                                                                            
     496                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     497               0 :         return $this->roleExist($role_id);                                                                                                                                                                                                                                                                                                                                                                                                          
     498                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     499                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     500                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     501                 :      * Simple check to see if a certain group exists.                                                                                                                                                                                                                                                                                                                                                                                               
     502                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     503                 :      * @param integer $group_id                                                                                                                                                                                                                                                                                                                                                                                                                     
     504                 :      * @return boolean                                                                                                                                                                                                                                                                                                                                                                                                                              
     505                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     506                 :     public function group_exist($group_id)                                                                                                                                                                                                                                                                                                                                                                                                          
     507                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     508               0 :         return groupExist($group_id);                                                                                                                                                                                                                                                                                                                                                                                                               
     509                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     510                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     511                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     512                 :      * Check if user belongs to given role. Returns true if user belongs to user role.                                                                                                                                                                                                                                                                                                                                                              
     513                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     514                 :      * @param integer $user_id                                                                                                                                                                                                                                                                                                                                                                                                                      
     515                 :      * @param integer $user_role                                                                                                                                                                                                                                                                                                                                                                                                                    
     516                 :      * @return boolean Returns true if user belongs to user role.                                                                                                                                                                                                                                                                                                                                                                                   
     517                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     518                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     519                 :     public function belongs_to_role($user_id = false, $user_role)                                                                                                                                                                                                                                                                                                                                                                                   
     520                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     521               0 :         return $this->belongsToRole($user_id, $user_role);                                                                                                                                                                                                                                                                                                                                                                                          
     522                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     523                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     524                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     525                 :      * Check if user belongs to given group. Returns true if user belongs to user group.                                                                                                                                                                                                                                                                                                                                                            
     526                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     527                 :      * @param integer $user_id                                                                                                                                                                                                                                                                                                                                                                                                                      
     528                 :      * @param integer $user_group                                                                                                                                                                                                                                                                                                                                                                                                                   
     529                 :      * @return boolean Returns true if user belongs to user group.                                                                                                                                                                                                                                                                                                                                                                                  
     530                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     531                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     532                 :     public function belongs_to_group($user_id = false, $user_group)                                                                                                                                                                                                                                                                                                                                                                                 
     533                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     534               0 :         return $this->belongsToGroup($user_id, $user_group);                                                                                                                                                                                                                                                                                                                                                                                        
     535                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     536                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     537                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     538                 :      * Creates a query to extend a role query, it will return false if user is root so everything can get listed.                                                                                                                                                                                                                                                                                                                                   
     539                 :      * This is meant to be used inside an existing role query.                                                                                                                                                                                                                                                                                                                                                                                      
     540                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     541                 :      * @param string $query_request Normal query to be returned if user is not a root user.                                                                                                                                                                                                                                                                                                                                                         
     542                 :      * @param string $query_root_request If you want a query to be processed for a root user seperately.                                                                                                                                                                                                                                                                                                                                            
     543                 :      * @return mixed                                                                                                                                                                                                                                                                                                                                                                                                                                
     544                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     545                 :     public function set_role_query($query_request, $query_root_request = false)                                                                                                                                                                                                                                                                                                                                                                     
     546                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     547               0 :         return $this->setRoleQuery($query_request, $query_root_request);                                                                                                                                                                                                                                                                                                                                                                            
     548                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     549                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     550                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     551                 :      * Creates a query to extend a group query, it will return false if user is root so everything can get listed.                                                                                                                                                                                                                                                                                                                                  
     552                 :      * This is meant to be used inside an existing group query.                                                                                                                                                                                                                                                                                                                                                                                     
     553                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     554                 :      * @param string $query_request Normal query to be returned if user is not a root user.                                                                                                                                                                                                                                                                                                                                                         
     555                 :      * @param string $query_root_request If you want a query to be processed for a root user seperately.                                                                                                                                                                                                                                                                                                                                            
     556                 :      * @return mixed                                                                                                                                                                                                                                                                                                                                                                                                                                
     557                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     558                 :     public function set_group_query($query_request, $query_root_request = false)                                                                                                                                                                                                                                                                                                                                                                    
     559                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     560               0 :         return $this->setGroupQuery($query_request, $query_root_request);                                                                                                                                                                                                                                                                                                                                                                           
     561                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     562                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     563                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     564                 :      * Generates a prefix for plugin general settings.                                                                                                                                                                                                                                                                                                                                                                                              
     565                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     566                 :      * @param string $custom_prefix                                                                                                                                                                                                                                                                                                                                                                                                                 
     567                 :      * @return string Complete string with prefix.                                                                                                                                                                                                                                                                                                                                                                                                  
     568                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     569                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     570                 :     public function settings_prefix($custom_prefix = false)                                                                                                                                                                                                                                                                                                                                                                                         
     571                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     572               0 :         return $this->settingsPrefix($custom_prefix);                                                                                                                                                                                                                                                                                                                                                                                               
     573                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     574                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     575                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     576                 :      * Used to write general plugin settings to the database.                                                                                                                                                                                                                                                                                                                                                                                       
     577                 :      * Class will always use plugin name as prefix for settings if no custom prefix is provided.                                                                                                                                                                                                                                                                                                                                                    
     578                 :      * <code>                                                                                                                                                                                                                                                                                                                                                                                                                                       
     579                 :      * // Example:                                                                                                                                                                                                                                                                                                                                                                                                                                  
     580                 :      * $db->write_settings(array('setting_name'=>'value')[,'Example']);                                                                                                                                                                                                                                                                                                                                                                             
     581                 :      * </code>                                                                                                                                                                                                                                                                                                                                                                                                                                      
     582                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     583                 :      * @param array $write_settings This array should contain settings to write.                                                                                                                                                                                                                                                                                                                                                                    
     584                 :      * @param string $custom_prefix If you would like to have a custom prefix added to your settings.                                                                                                                                                                                                                                                                                                                                               
     585                 :      * @return boolean On success true will be returned.                                                                                                                                                                                                                                                                                                                                                                                            
     586                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     587                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     588                 :     public function write_settings($write_settings, $custom_prefix = false)                                                                                                                                                                                                                                                                                                                                                                         
     589                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     590               0 :         return $this->writeSettings($write_settings, $custom_prefix);                                                                                                                                                                                                                                                                                                                                                                               
     591                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     592                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     593                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     594                 :      * Delete all settings stored by a given plugins name, is used when uninstalling a plugin.                                                                                                                                                                                                                                                                                                                                                      
     595                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     596                 :      * Example:                                                                                                                                                                                                                                                                                                                                                                                                                                     
     597                 :      * <code>                                                                                                                                                                                                                                                                                                                                                                                                                                       
     598                 :      * delete_settings(false, 'SimplePhonebook')                                                                                                                                                                                                                                                                                                                                                                                                    
     599                 :      * </code>                                                                                                                                                                                                                                                                                                                                                                                                                                      
     600                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     601                 :      * @param array $settings_to_delete                                                                                                                                                                                                                                                                                                                                                                                                             
     602                 :      * @param string $custom_prefix                                                                                                                                                                                                                                                                                                                                                                                                                 
     603                 :      * @return boolean                                                                                                                                                                                                                                                                                                                                                                                                                              
     604                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     605                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     606                 :     public function delete_settings($settings_to_delete = false, $custom_prefix = false)                                                                                                                                                                                                                                                                                                                                                            
     607                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     608               0 :         return $this->deleteSetting($settings_to_delete, $custom_prefix);                                                                                                                                                                                                                                                                                                                                                                           
     609                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     610                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     611                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     612                 :      * Loads and returns required settings from database.                                                                                                                                                                                                                                                                                                                                                                                           
     613                 :      * Class will always use plugin name as prefix for settings if no custom prefix is provided.                                                                                                                                                                                                                                                                                                                                                    
     614                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     615                 :      * @param array $settings_required                                                                                                                                                                                                                                                                                                                                                                                                              
     616                 :      * @param string $prefix This allows you to use a prefix value of your choice to select a setting from another plugin, otherwise PHPDevShell will be used.                                                                                                                                                                                                                                                                                      
     617                 :      * @return array An array will be returned containing all the values requested.                                                                                                                                                                                                                                                                                                                                                                 
     618                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     619                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     620                 :     public function get_settings($settings_required = false, $custom_prefix = false)                                                                                                                                                                                                                                                                                                                                                                
     621                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     622               0 :         return $this->getSettings($settings_required, $custom_prefix);                                                                                                                                                                                                                                                                                                                                                                              
     623                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     624                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     625                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     626                 :      * Used to get all essential system settings from the database, preventing multiple queries.                                                                                                                                                                                                                                                                                                                                                    
     627                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     628                 :      * @return array Contains array with essential settings.                                                                                                                                                                                                                                                                                                                                                                                        
     629                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     630                 :     public function get_essential_settings()                                                                                                                                                                                                                                                                                                                                                                                                        
     631                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     632                 :         // Pull essential settings and assign it to essential_settings.                                                                                                                                                                                                                                                                                                                                                                             
     633               0 :         $this->getEssentialSettings();                                                                                                                                                                                                                                                                                                                                                                                                              
     634               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     635                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     636                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     637                 :      * Determines whether the specified search string already exists in the specified field within the supplied table.                                                                                                                                                                                                                                                                                                                              
     638                 :      * Optional: Also looks at an id field (typically the primary key of a table) to make sure that the record you are working with                                                                                                                                                                                                                                                                                                                 
     639                 :      * is NOT included in the search.                                                                                                                                                                                                                                                                                                                                                                                                               
     640                 :      * Usefull when modifying an existing record and you need first to check if another record with the same value doesn't already exist.                                                                                                                                                                                                                                                                                                           
     641                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     642                 :      * Please note that this function is not case sensitive.                                                                                                                                                                                                                                                                                                                                                                                        
     643                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     644                 :      * Usage Example :                                                                                                                                                                                                                                                                                                                                                                                                                              
     645                 :      * <code>                                                                                                                                                                                                                                                                                                                                                                                                                                       
     646                 :      *     if ($db->does_record_exist('_db_core_users', array('user_name', 'user_email'), array('root', 'titan@phpdevshell.org'), 'user_id', '123'))                                                                                                                                                                                                                                                                                                
     647                 :      *     {                                                                                                                                                                                                                                                                                                                                                                                                                                        
     648                 :      *         $this->template->debugStr = "Found!";                                                                                                                                                                                                                                                                                                                                                                                                
     649                 :      *     }                                                                                                                                                                                                                                                                                                                                                                                                                                        
     650                 :      *     else                                                                                                                                                                                                                                                                                                                                                                                                                                     
     651                 :      *     {                                                                                                                                                                                                                                                                                                                                                                                                                                        
     652                 :      *         $this->template->debugStr = "Not Found!";                                                                                                                                                                                                                                                                                                                                                                                            
     653                 :      *     }                                                                                                                                                                                                                                                                                                                                                                                                                                        
     654                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     655                 :      *  // Or you could use single values instead of arrays.                                                                                                                                                                                                                                                                                                                                                                                        
     656                 :      *     if ($db->does_record_exist('_db_core_users', 'user_name', 'root', 'user_id', '123'))                                                                                                                                                                                                                                                                                                                                                     
     657                 :      *     {                                                                                                                                                                                                                                                                                                                                                                                                                                        
     658                 :      *         $this->template->debugStr = "Found!";                                                                                                                                                                                                                                                                                                                                                                                                
     659                 :      *     }                                                                                                                                                                                                                                                                                                                                                                                                                                        
     660                 :      *     else                                                                                                                                                                                                                                                                                                                                                                                                                                     
     661                 :      *     {                                                                                                                                                                                                                                                                                                                                                                                                                                        
     662                 :      *         $this->template->debugStr = "Not Found!";                                                                                                                                                                                                                                                                                                                                                                                            
     663                 :      *     }                                                                                                                                                                                                                                                                                                                                                                                                                                        
     664                 :      * </code>                                                                                                                                                                                                                                                                                                                                                                                                                                      
     665                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     666                 :      * @param string The name of the database table.                                                                                                                                                                                                                                                                                                                                                                                                
     667                 :      * @param mixed The array names of the columns in which to look for the search strings, a single value can also be given.                                                                                                                                                                                                                                                                                                                       
     668                 :      * @param mixed In the same order as $search_column_name array, the search strings in array that should not be duplicated, a single value can also be given.                                                                                                                                                                                                                                                                                    
     669                 :      * @param string The name of the primary key column name of the record you will be updating.                                                                                                                                                                                                                                                                                                                                                    
     670                 :      * @param string The value of the primary key of the record you will be updating that should not be included in the search.                                                                                                                                                                                                                                                                                                                     
     671                 :      * @return boolean If TRUE is returned it means the record already exists, FALSE means the record doesn't exist.                                                                                                                                                                                                                                                                                                                                
     672                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     673                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     674                 :     public function does_record_exist($table_name, $search_column_names, $search_field_values, $column_name_for_exclusion = false, $exclude_field_value = false)                                                                                                                                                                                                                                                                                    
     675                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     676                 :         // Check if we should exclude the id.                                                                                                                                                                                                                                                                                                                                                                                                       
     677               0 :         return $this->doesRecordExist($table_name, $search_column_names, $search_field_values, $column_name_for_exclusion, $exclude_field_value);                                                                                                                                                                                                                                                                                                   
     678                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     679                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     680                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     681                 :      * Pulls all registered hooks from the database and prepares them in an array.                                                                                                                                                                                                                                                                                                                                                                  
     682                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     683                 :      * @return array                                                                                                                                                                                                                                                                                                                                                                                                                                
     684                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     685                 :     public function get_hooks()                                                                                                                                                                                                                                                                                                                                                                                                                     
     686                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     687                 :         // Get all registered hooks for this script.                                                                                                                                                                                                                                                                                                                                                                                                
     688               0 :         return false;                                                                                                                                                                                                                                                                                                                                                                                                                               
     689                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     690                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     691                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     692                 :      * Get a single result from database with minimal effort.                                                                                                                                                                                                                                                                                                                                                                                       
     693                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     694                 :      * @param string $from_table_name                                                                                                                                                                                                                                                                                                                                                                                                               
     695                 :      * @param string $select_column_name                                                                                                                                                                                                                                                                                                                                                                                                            
     696                 :      * @param string $where_column_name                                                                                                                                                                                                                                                                                                                                                                                                             
     697                 :      * @param string $is_equal_to_column_value                                                                                                                                                                                                                                                                                                                                                                                                      
     698                 :      * @return string                                                                                                                                                                                                                                                                                                                                                                                                                               
     699                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     700                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     701                 :     public function select_quick($from_table_name, $select_column_name, $where_column_name, $is_equal_to_column_value)                                                                                                                                                                                                                                                                                                                              
     702                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     703               0 :         return $this->selectQuick($from_table_name, $select_column_name, $where_column_name, $is_equal_to_column_value);                                                                                                                                                                                                                                                                                                                            
     704                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     705                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     706                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     707                 :      * Delete data from the database with minimal effort.                                                                                                                                                                                                                                                                                                                                                                                           
     708                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     709                 :      * @param string $from_table_name                                                                                                                                                                                                                                                                                                                                                                                                               
     710                 :      * @param string $where_column_name                                                                                                                                                                                                                                                                                                                                                                                                             
     711                 :      * @param string $is_equal_to_column_value                                                                                                                                                                                                                                                                                                                                                                                                      
     712                 :      * @param string $return_column_value                                                                                                                                                                                                                                                                                                                                                                                                           
     713                 :      * @return string                                                                                                                                                                                                                                                                                                                                                                                                                               
     714                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     715                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     716                 :     public function delete_quick($from_table_name, $where_column_name, $is_equal_to_column_value, $return_column_value = false)                                                                                                                                                                                                                                                                                                                     
     717                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     718               0 :         return $this->deleteQuick($from_table_name, $where_column_name, $is_equal_to_column_value, $return_column_value);                                                                                                                                                                                                                                                                                                                           
     719                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     720                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     721                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     722                 :      * This method is used to generate a new name value for a particular string in the database.                                                                                                                                                                                                                                                                                                                                                    
     723                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     724                 :      * Usage Example :                                                                                                                                                                                                                                                                                                                                                                                                                              
     725                 :      * <code>                                                                                                                                                                                                                                                                                                                                                                                                                                       
     726                 :      *  // This code generates a copy of the text "Some Value". The name_of_new_copy function                                                                                                                                                                                                                                                                                                                                                       
     727                 :      *  // checks that it doesn't duplicate the name.                                                                                                                                                                                                                                                                                                                                                                                               
     728                 :      *  $result = $db->name_of_new_copy('PHPDS_table', 'some_field', 'Some Value');                                                                                                                                                                                                                                                                                                                                                                 
     729                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     730                 :      *  // name_of_new_copy() returns 'Copy of Some Value', unless 'Copy of Some Value' already exists. If                                                                                                                                                                                                                                                                                                                                          
     731                 :      *  // it does, the function will return with 'Copy (x) of Some Value' where x is the next available                                                                                                                                                                                                                                                                                                                                            
     732                 :      *  // number that is not in use.                                                                                                                                                                                                                                                                                                                                                                                                               
     733                 :      * </code>                                                                                                                                                                                                                                                                                                                                                                                                                                      
     734                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                              
     735                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     736                 :      * @param string The name of the table to search within.                                                                                                                                                                                                                                                                                                                                                                                        
     737                 :      * @param string The fieldname to search withing.                                                                                                                                                                                                                                                                                                                                                                                               
     738                 :      * @param string The original text to search for.                                                                                                                                                                                                                                                                                                                                                                                               
     739                 :      * @author Don Schoeman <don@delphexonline.com>                                                                                                                                                                                                                                                                                                                                                                                                 
     740                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     741                 :     function name_of_new_copy($table_name, $name_field, $orig_name)                                                                                                                                                                                                                                                                                                                                                                                 
     742                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     743               0 :         return $this->nameOfNewCopy($table_name, $name_field, $orig_name);                                                                                                                                                                                                                                                                                                                                                                          
     744                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     745                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     746                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     747                 :      * Writes array of all the installed plugins on the system.                                                                                                                                                                                                                                                                                                                                                                                     
     748                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     749                 :      * @author Jason Schoeman <titan@phpdevshell.org>                                                                                                                                                                                                                                                                                                                                                                                               
     750                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     751                 :     public function installed_plugins()                                                                                                                                                                                                                                                                                                                                                                                                             
     752                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     753               0 :         $this->installedPlugins();                                                                                                                                                                                                                                                                                                                                                                                                                  
     754               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     755                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     756                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     757                 :      * Writes new data to cache.                                                                                                                                                                                                                                                                                                                                                                                                                    
     758                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     759                 :      * @param string $cache_unique_name                                                                                                                                                                                                                                                                                                                                                                                                             
     760                 :      * @param mixed $cache_data                                                                                                                                                                                                                                                                                                                                                                                                                     
     761                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     762                 :     public function cache_write($cache_unique_name, $cache_data)                                                                                                                                                                                                                                                                                                                                                                                    
     763                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     764               0 :         return $this->cacheWrite($cache_unique_name, $cache_data);                                                                                                                                                                                                                                                                                                                                                                                  
     765                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     766                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     767                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     768                 :      * Return exising cache result to required item.                                                                                                                                                                                                                                                                                                                                                                                                
     769                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     770                 :      * @param mixed $cache_unique_name                                                                                                                                                                                                                                                                                                                                                                                                              
     771                 :      * @return mixed                                                                                                                                                                                                                                                                                                                                                                                                                                
     772                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     773                 :     public function cache_read($cache_unique_name)                                                                                                                                                                                                                                                                                                                                                                                                  
     774                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     775               0 :         return $this->cacheRead($cache_unique_name);                                                                                                                                                                                                                                                                                                                                                                                                
     776                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     777                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     778                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     779                 :      * Clear specific or all cache memory.                                                                                                                                                                                                                                                                                                                                                                                                          
     780                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     781                 :      * @param mixed $cache_unique_name                                                                                                                                                                                                                                                                                                                                                                                                              
     782                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     783                 :     public function cache_clear($cache_unique_name = false)                                                                                                                                                                                                                                                                                                                                                                                         
     784                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     785               0 :         $this->cacheClear($cache_unique_name);                                                                                                                                                                                                                                                                                                                                                                                                      
     786               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     787                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     788                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                             
     789                 :      * Checks if we have an empty cache container.                                                                                                                                                                                                                                                                                                                                                                                                  
     790                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                  
     791                 :      * @param mixed $cache_unique_name                                                                                                                                                                                                                                                                                                                                                                                                              
     792                 :      * @return boolean                                                                                                                                                                                                                                                                                                                                                                                                                              
     793                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                             
     794                 :     public function cache_empty($cache_unique_name)                                                                                                                                                                                                                                                                                                                                                                                                 
     795                 :     {                                                                                                                                                                                                                                                                                                                                                                                                                                               
     796               0 :         return $this->cacheEmpty($cache_unique_name);                                                                                                                                                                                                                                                                                                                                                                                               
     797                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                               
     798                 : }                                                                                                                                                                                                                                                                                                                                                                                                                                                   
     799                 :                                                                                                                                                                                                                                                                                                                                                                                                                                                     

Generated by PHP_CodeCoverage 1.0.4 using PHP 5.3.6 and PHPUnit 3.5.14 at Mon Aug 8 22:35:38 PDT 2011.