Current file: /home/greg/workspace/PHPDS-dev-trunk/PHPDevShell/stable/trunk/includes/legacy/template.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 / 31 CRAP
0.91%0.91%
0.91% 3 / 331
 
template
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 4
3.57%3.57%
3.57% 1 / 28
 output_language ($return = false)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 5
 output_charset ($return = false)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 5
 output_title ()
0.00%0.00%
0.00% 0 / 1 12
0.00%0.00%
0.00% 0 / 8
 output_logo ()
0.00%0.00%
0.00% 0 / 1 12
0.00%0.00%
0.00% 0 / 7
Functions
  
   
0.00%0.00%
0.00% 0 / 27
100.00%100.00%
100.00% 0 / 0
 output_active_info ()
0.00%0.00%
0.00% 0 / 1 12
0.00%0.00%
0.00% 0 / 14
 output_breadcrumbs ()
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 5
 output_menu ()
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 5
 extend_menu_loop ($extended_menu_id)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 output_script ()
0.00%0.00%
0.00% 0 / 1 1640
0.00%0.00%
0.00% 0 / 148
 hook ($hook_point_id)
0.00%0.00%
0.00% 0 / 1 72
0.00%0.00%
0.00% 0 / 21
 output_footer ()
0.00%0.00%
0.00% 0 / 1 20
0.00%0.00%
0.00% 0 / 5
 iconize ($img,$text)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 3
 info_mark ($info_mark, $print = false)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 6
 out ($variable)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 alt_color ($alt)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 3
 random_color ($id)
0.00%0.00%
0.00% 0 / 1 12
0.00%0.00%
0.00% 0 / 12
 template_cron_output ()
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 result ($RESULT, $colspan = 0)
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 3
 load_icons ()
0.00%0.00%
0.00% 0 / 1 6
0.00%0.00%
0.00% 0 / 5
 get_template ()
0.00%0.00%
0.00% 0 / 1 42
0.00%0.00%
0.00% 0 / 14
 login_emplate ($goto, $redirect = false, $return = false)
0.00%0.00%
0.00% 0 / 1 56
0.00%0.00%
0.00% 0 / 24
 script_logo ($menu_link, $active_plugin, $alias = null)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 show ($load_template=false, $plugin=false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 display ($load_template=false, $plugin=false)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 set ($var, $value)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 assign ($var, $value)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 2
 dofetch ($var, $value)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 fetch ($var, $value)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 html_entity_decode ($string_to_decode)
0.00%0.00%
0.00% 0 / 1 2
0.00%0.00%
0.00% 0 / 1
 _i ($info_mark)
0.00%0.00%
0.00% 0 / 1 1.42
25.00%25.00%
25.00% 1 / 4
 __i ($info_mark, $domain)
0.00%0.00%
0.00% 0 / 1 1.42
25.00%25.00%
25.00% 1 / 4


       1                 : <?php                                                                                                                                                                                                                                                                                                                                             
       2                 : /**                                                                                                                                                                                                                                                                                                                                               
       3                 :  * PHPDevShell is a RAD Framework aimed at developing administrative applications.                                                                                                                                                                                                                                                                
       4                 :  *                                                                                                                                                                                                                                                                                                                                                
       5                 :  * @package PHPDevShell                                                                                                                                                                                                                                                                                                                           
       6                 :  * @link http://www.phpdevshell.org                                                                                                                                                                                                                                                                                                               
       7                 :  * @copyright Copyright (C) 2007 Jason Schoeman, All rights reserved.                                                                                                                                                                                                                                                                             
       8                 :  * @license GNU/LGPL, see readme/licensed_under_lgpl or http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html                                                                                                                                                                                                                                    
       9                 :  * @author Jason Schoeman, Contact: titan [at] phpdevshell [dot] org.                                                                                                                                                                                                                                                                             
      10                 :  * Copyright notice: See readme/notice                                                                                                                                                                                                                                                                                                            
      11                 :  * By using PHPDevShell you agree to notice and license, if you dont agree to this notice/license you are not allowed to use PHPDevShell.                                                                                                                                                                                                         
      12                 :  */                                                                                                                                                                                                                                                                                                                                               
      13                 : /**                                                                                                                                                                                                                                                                                                                                               
      14                 :  * This class contains methods that prints out to the template system, the template system is what the user see when using your application.                                                                                                                                                                                                      
      15                 :  * This means everything that is supposed to echo to the users browser is done with this class.                                                                                                                                                                                                                                                   
      16                 :  * This class resides in the global variable $template and these methods can be called by $template->call_any_method().                                                                                                                                                                                                                           
      17                 :  * Stop Here                                                                                                                                                                                                                                                                                                                                      
      18                 :  * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                         
      19                 :  * @deprecated                                                                                                                                                                                                                                                                                                                                    
      20                 :  * @since 2007/01/03                                                                                                                                                                                                                                                                                                                              
      21                 :  */                                                                                                                                                                                                                                                                                                                                               
      22                 : class template extends PHPDS_dependant                                                                                                                                                                                                                                                                                                            
      23               1 : {                                                                                                                                                                                                                                                                                                                                                 
      24                 :     /**                                                                                                                                                                                                                                                                                                                                           
      25                 :      * When this variable is assigned, the cronjob will output to his template system if it is enabled in the config.                                                                                                                                                                                                                             
      26                 :      *                                                                                                                                                                                                                                                                                                                                            
      27                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      28                 :      */                                                                                                                                                                                                                                                                                                                                           
      29                 :     public $cron_output;                                                                                                                                                                                                                                                                                                                          
      30                 :     /**                                                                                                                                                                                                                                                                                                                                           
      31                 :      * Contains active language identifier being used.                                                                                                                                                                                                                                                                                            
      32                 :      *                                                                                                                                                                                                                                                                                                                                            
      33                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      34                 :      */                                                                                                                                                                                                                                                                                                                                           
      35                 :     public $active_language;                                                                                                                                                                                                                                                                                                                      
      36                 :     //////////////////////////////////// TEMPLATE MODIFY INJECTIONS ///////////////////////////////////////////                                                                                                                                                                                                                                   
      37                 :     /**                                                                                                                                                                                                                                                                                                                                           
      38                 :      * Use this variable to modify the output templates title.                                                                                                                                                                                                                                                                                    
      39                 :      *                                                                                                                                                                                                                                                                                                                                            
      40                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      41                 :      */                                                                                                                                                                                                                                                                                                                                           
      42                 :     public $modify_output_title = false;                                                                                                                                                                                                                                                                                                          
      43                 :     /**                                                                                                                                                                                                                                                                                                                                           
      44                 :      * Use this variable to modify the output templates active info.                                                                                                                                                                                                                                                                              
      45                 :      *                                                                                                                                                                                                                                                                                                                                            
      46                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      47                 :      */                                                                                                                                                                                                                                                                                                                                           
      48                 :     public $modify_output_active_info = false;                                                                                                                                                                                                                                                                                                    
      49                 :     /**                                                                                                                                                                                                                                                                                                                                           
      50                 :      * Use this variable to modify the output templates breadcrumbs.                                                                                                                                                                                                                                                                              
      51                 :      *                                                                                                                                                                                                                                                                                                                                            
      52                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      53                 :      */                                                                                                                                                                                                                                                                                                                                           
      54                 :     public $modify_output_breadcrumbs = false;                                                                                                                                                                                                                                                                                                    
      55                 :     /**                                                                                                                                                                                                                                                                                                                                           
      56                 :      * Use this variable to modify the output templates menu.                                                                                                                                                                                                                                                                                     
      57                 :      *                                                                                                                                                                                                                                                                                                                                            
      58                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      59                 :      */                                                                                                                                                                                                                                                                                                                                           
      60                 :     public $modify_output_menu = false;                                                                                                                                                                                                                                                                                                           
      61                 :     /**                                                                                                                                                                                                                                                                                                                                           
      62                 :      * Use this variable to modify the output templates script.                                                                                                                                                                                                                                                                                   
      63                 :      *                                                                                                                                                                                                                                                                                                                                            
      64                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      65                 :      */                                                                                                                                                                                                                                                                                                                                           
      66                 :     public $modify_output_script = false;                                                                                                                                                                                                                                                                                                         
      67                 :     /**                                                                                                                                                                                                                                                                                                                                           
      68                 :      * Use this variable to modify the output templates footer.                                                                                                                                                                                                                                                                                   
      69                 :      *                                                                                                                                                                                                                                                                                                                                            
      70                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      71                 :      */                                                                                                                                                                                                                                                                                                                                           
      72                 :     public $modify_output_footer = false;                                                                                                                                                                                                                                                                                                         
      73                 :     /**                                                                                                                                                                                                                                                                                                                                           
      74                 :      * Contains array with existing registered hook points for active script.                                                                                                                                                                                                                                                                     
      75                 :      *                                                                                                                                                                                                                                                                                                                                            
      76                 :      * @var array                                                                                                                                                                                                                                                                                                                                 
      77                 :      */                                                                                                                                                                                                                                                                                                                                           
      78                 :     public $hook_array;                                                                                                                                                                                                                                                                                                                           
      79                 :     /**                                                                                                                                                                                                                                                                                                                                           
      80                 :      * The hook position id (head, foot, aaa, etc...) that is being required in main script.                                                                                                                                                                                                                                                      
      81                 :      * This helps the developer split its code to only a specific hook area.                                                                                                                                                                                                                                                                      
      82                 :      *                                                                                                                                                                                                                                                                                                                                            
      83                 :      * Example:                                                                                                                                                                                                                                                                                                                                   
      84                 :      * <code>                                                                                                                                                                                                                                                                                                                                     
      85                 :      * if ($template->hook_request = 'head')                                                                                                                                                                                                                                                                                                      
      86                 :      * {                                                                                                                                                                                                                                                                                                                                          
      87                 :      *         // Do head code here.                                                                                                                                                                                                                                                                                                              
      88                 :      * }                                                                                                                                                                                                                                                                                                                                          
      89                 :      *                                                                                                                                                                                                                                                                                                                                            
      90                 :      * </code>                                                                                                                                                                                                                                                                                                                                    
      91                 :      *                                                                                                                                                                                                                                                                                                                                            
      92                 :      * @var string                                                                                                                                                                                                                                                                                                                                
      93                 :      */                                                                                                                                                                                                                                                                                                                                           
      94                 :     public $hook_request;                                                                                                                                                                                                                                                                                                                         
      95                 :     /**                                                                                                                                                                                                                                                                                                                                           
      96                 :      * Used to remember the last random color.                                                                                                                                                                                                                                                                                                    
      97                 :      *                                                                                                                                                                                                                                                                                                                                            
      98                 :      * @var array                                                                                                                                                                                                                                                                                                                                 
      99                 :      */                                                                                                                                                                                                                                                                                                                                           
     100                 :     private $existing_random_color;                                                                                                                                                                                                                                                                                                               
     101                 :     /**                                                                                                                                                                                                                                                                                                                                           
     102                 :      * Contains script HTML data.                                                                                                                                                                                                                                                                                                                 
     103                 :      *                                                                                                                                                                                                                                                                                                                                            
     104                 :      * @var string                                                                                                                                                                                                                                                                                                                                
     105                 :      */                                                                                                                                                                                                                                                                                                                                           
     106                 :     public $HTML = '';                                                                                                                                                                                                                                                                                                                            
     107                 :     /**                                                                                                                                                                                                                                                                                                                                           
     108                 :      * Contains script HOOK data.                                                                                                                                                                                                                                                                                                                 
     109                 :      *                                                                                                                                                                                                                                                                                                                                            
     110                 :      * @var string                                                                                                                                                                                                                                                                                                                                
     111                 :      */                                                                                                                                                                                                                                                                                                                                           
     112                 :     public $HOOK = '';                                                                                                                                                                                                                                                                                                                            
     113                 :     /**                                                                                                                                                                                                                                                                                                                                           
     114                 :      * Use to manage the view class.                                                                                                                                                                                                                                                                                                              
     115                 :      *                                                                                                                                                                                                                                                                                                                                            
     116                 :      * @var object                                                                                                                                                                                                                                                                                                                                
     117                 :      */                                                                                                                                                                                                                                                                                                                                           
     118                 :     public $view;                                                                                                                                                                                                                                                                                                                                 
     119                 :                                                                                                                                                                                                                                                                                                                                                   
     120                 :     ////////////////////////////////// END TEMPLATE MODIFY INJECTIONS /////////////////////////////////////////                                                                                                                                                                                                                                   
     121                 :     /**                                                                                                                                                                                                                                                                                                                                           
     122                 :      * Outputs current language identifier being used.                                                                                                                                                                                                                                                                                            
     123                 :      *                                                                                                                                                                                                                                                                                                                                            
     124                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     125                 :      */                                                                                                                                                                                                                                                                                                                                           
     126                 :     public function output_language ($return = false)                                                                                                                                                                                                                                                                                             
     127                 :     {                                                                                                                                                                                                                                                                                                                                             
     128                 :         // Check if we should return or print.                                                                                                                                                                                                                                                                                                    
     129               0 :         if ($return == false) {                                                                                                                                                                                                                                                                                                                   
     130                 :             // Simply output charset.                                                                                                                                                                                                                                                                                                             
     131               0 :             print $this->configuration['language'];                                                                                                                                                                                                                                                                                               
     132               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     133               0 :             return $this->configuration['language'];                                                                                                                                                                                                                                                                                              
     134                 :         }                                                                                                                                                                                                                                                                                                                                         
     135               0 :     }                                                                                                                                                                                                                                                                                                                                             
     136                 :                                                                                                                                                                                                                                                                                                                                                   
     137                 :     /**                                                                                                                                                                                                                                                                                                                                           
     138                 :      * Outputs charset.                                                                                                                                                                                                                                                                                                                           
     139                 :      *                                                                                                                                                                                                                                                                                                                                            
     140                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     141                 :      */                                                                                                                                                                                                                                                                                                                                           
     142                 :     public function output_charset ($return = false)                                                                                                                                                                                                                                                                                              
     143                 :     {                                                                                                                                                                                                                                                                                                                                             
     144                 :         // Check if we should return or print.                                                                                                                                                                                                                                                                                                    
     145               0 :         if ($return == false) {                                                                                                                                                                                                                                                                                                                   
     146                 :             // Simply output charset.                                                                                                                                                                                                                                                                                                             
     147               0 :             print $this->configuration['charset'];                                                                                                                                                                                                                                                                                                
     148               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     149               0 :             return $this->configuration['charset'];                                                                                                                                                                                                                                                                                               
     150                 :         }                                                                                                                                                                                                                                                                                                                                         
     151               0 :     }                                                                                                                                                                                                                                                                                                                                             
     152                 :                                                                                                                                                                                                                                                                                                                                                   
     153                 :     /**                                                                                                                                                                                                                                                                                                                                           
     154                 :      * Outputs the active scripts title.                                                                                                                                                                                                                                                                                                          
     155                 :      *                                                                                                                                                                                                                                                                                                                                            
     156                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     157                 :      */                                                                                                                                                                                                                                                                                                                                           
     158                 :     public function output_title ()                                                                                                                                                                                                                                                                                                               
     159                 :     {                                                                                                                                                                                                                                                                                                                                             
     160                 :         // Check if output should be modified.                                                                                                                                                                                                                                                                                                    
     161               0 :         if ($this->modify_output_title == false) {                                                                                                                                                                                                                                                                                                
     162               0 :             if (isset($this->navigation->navigation[$this->configuration['m']]['menu_name'])) {                                                                                                                                                                                                                                                   
     163               0 :                 print $this->navigation->navigation[$this->configuration['m']]['menu_name'] . ' - ' . $this->configuration['scripts_name_version'];                                                                                                                                                                                               
     164               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     165               0 :                 print ___('Error!');                                                                                                                                                                                                                                                                                                              
     166                 :             }                                                                                                                                                                                                                                                                                                                                     
     167               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     168               0 :             print $this->modify_output_title;                                                                                                                                                                                                                                                                                                     
     169                 :         }                                                                                                                                                                                                                                                                                                                                         
     170               0 :     }                                                                                                                                                                                                                                                                                                                                             
     171                 :                                                                                                                                                                                                                                                                                                                                                   
     172                 :     /**                                                                                                                                                                                                                                                                                                                                           
     173                 :      * Gets the desired logo and displays it. This method will try its best to deliver a logo, whatever the case.                                                                                                                                                                                                                                 
     174                 :      *                                                                                                                                                                                                                                                                                                                                            
     175                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     176                 :      */                                                                                                                                                                                                                                                                                                                                           
     177                 :     public function output_logo ()                                                                                                                                                                                                                                                                                                                
     178                 :     {                                                                                                                                                                                                                                                                                                                                             
     179                 :         // First we need to see if we will be using the custom logo.                                                                                                                                                                                                                                                                              
     180               0 :         if (! empty($this->configuration['custom_logo'])) {                                                                                                                                                                                                                                                                                       
     181                 :             // Give him his custom logo.                                                                                                                                                                                                                                                                                                          
     182               0 :             $logo = sprintf($this->module['logo'], $this->configuration['absolute_url'], $this->configuration['custom_logo'], $this->configuration['scripts_name_version'], $this->configuration['scripts_name_version']);                                                                                                                        
     183               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     184                 :             // Ok so we have no set logo, does the developer want a custom logo?                                                                                                                                                                                                                                                                  
     185               0 :             if (! empty($this->db->pluginLogo)) {                                                                                                                                                                                                                                                                                                 
     186                 :                 // Ok lets get the logo that the user wishes to display.                                                                                                                                                                                                                                                                          
     187               0 :                 $logo = sprintf($this->module['logo'], $this->configuration['absolute_url'], "plugins/{$this->db->pluginLogo}/images/logo.png", $this->configuration['scripts_name_version'], $this->configuration['scripts_name_version']);                                                                                                      
     188               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     189                 :                 // Oops we have no logo, so lets just default to the orginal PHPDevShell logo.                                                                                                                                                                                                                                                    
     190               0 :                 $logo = sprintf($this->module['logo'], $this->configuration['absolute_url'], "plugins/PHPDevShell/images/logo.png", $this->configuration['scripts_name_version'], $this->configuration['scripts_name_version']);                                                                                                                  
     191                 :             }                                                                                                                                                                                                                                                                                                                                     
     192                 :         }                                                                                                                                                                                                                                                                                                                                         
     193                 :         // Ok return the logo.                                                                                                                                                                                                                                                                                                                    
     194               0 :         print $logo;                                                                                                                                                                                                                                                                                                                              
     195               0 :     }                                                                                                                                                                                                                                                                                                                                             
     196                 :                                                                                                                                                                                                                                                                                                                                                   
     197                 :     /**                                                                                                                                                                                                                                                                                                                                           
     198                 :      * Returns "users version number" and some other detail to the template system. Intended to be used by the engine.                                                                                                                                                                                                                            
     199                 :      *                                                                                                                                                                                                                                                                                                                                            
     200                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     201                 :      */                                                                                                                                                                                                                                                                                                                                           
     202                 :     public function output_active_info ()                                                                                                                                                                                                                                                                                                         
     203                 :     {                                                                                                                                                                                                                                                                                                                                             
     204                 :         // Check if output should be modified.                                                                                                                                                                                                                                                                                                    
     205               0 :         if ($this->modify_output_active_info == false) {                                                                                                                                                                                                                                                                                          
     206               0 :             if ($this->user->isLoggedIn()) {                                                                                                                                                                                                                                                                                                      
     207               0 :                 $login_information = sprintf(___('<a href="%s">Log Out, %s</a>'), $this->navigation->buildURL($this->configuration['loginandout'], 'logout=1'), $this->configuration['user_display_name']);                                                                                                                                       
     208               0 :                 $logged_in_icon = 'logged_in_icon';                                                                                                                                                                                                                                                                                               
     209               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     210               0 :                 $login_information = sprintf(___('<a href="%s">Log in, %s</a>'), $this->navigation->buildURL($this->configuration['loginandout']), $this->configuration['user_display_name']);                                                                                                                                                    
     211               0 :                 $logged_in_icon = 'logged_out_icon';                                                                                                                                                                                                                                                                                              
     212                 :             }                                                                                                                                                                                                                                                                                                                                     
     213                 :             // Set active group.                                                                                                                                                                                                                                                                                                                  
     214               0 :             $active_group = sprintf(___('%s Group'), $this->configuration['user_group_name']);                                                                                                                                                                                                                                                    
     215                 :             // Set active role.                                                                                                                                                                                                                                                                                                                   
     216               0 :             $active_role = sprintf(___('%s Role'), $this->configuration['user_role_name']);                                                                                                                                                                                                                                                       
     217                 :             // Glue active area.                                                                                                                                                                                                                                                                                                                  
     218               0 :             $active_area = sprintf($this->module['login'], $logged_in_icon, $this->configuration['scripts_name_version'], $this->core->formatTimeDate($this->configuration['time']), $login_information, $active_group, $active_role);                                                                                                            
     219                 :             // Output active info.                                                                                                                                                                                                                                                                                                                
     220               0 :             print $active_area;                                                                                                                                                                                                                                                                                                                   
     221               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     222               0 :             print $this->modify_output_active_info;                                                                                                                                                                                                                                                                                               
     223                 :         }                                                                                                                                                                                                                                                                                                                                         
     224               0 :     }                                                                                                                                                                                                                                                                                                                                             
     225                 :                                                                                                                                                                                                                                                                                                                                                   
     226                 :     /**                                                                                                                                                                                                                                                                                                                                           
     227                 :      * Returns "breadcrumbs" to the template system. Intended to be used by the engine.                                                                                                                                                                                                                                                           
     228                 :      *                                                                                                                                                                                                                                                                                                                                            
     229                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     230                 :      */                                                                                                                                                                                                                                                                                                                                           
     231                 :     public function output_breadcrumbs ()                                                                                                                                                                                                                                                                                                         
     232                 :     {                                                                                                                                                                                                                                                                                                                                             
     233                 :         // Check if output should be modified.                                                                                                                                                                                                                                                                                                    
     234               0 :         if ($this->modify_output_breadcrumbs == false) {                                                                                                                                                                                                                                                                                          
     235               0 :             print $this->navigation->generate_history_tree();                                                                                                                                                                                                                                                                                     
     236               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     237               0 :             print $this->modify_output_breadcrumbs;                                                                                                                                                                                                                                                                                               
     238                 :         }                                                                                                                                                                                                                                                                                                                                         
     239               0 :     }                                                                                                                                                                                                                                                                                                                                             
     240                 :                                                                                                                                                                                                                                                                                                                                                   
     241                 :     /**                                                                                                                                                                                                                                                                                                                                           
     242                 :      * Returns "menus" to the template system. Intended to be used by the engine.                                                                                                                                                                                                                                                                 
     243                 :      *                                                                                                                                                                                                                                                                                                                                            
     244                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     245                 :      */                                                                                                                                                                                                                                                                                                                                           
     246                 :     public function output_menu ()                                                                                                                                                                                                                                                                                                                
     247                 :     {                                                                                                                                                                                                                                                                                                                                             
     248                 :         // Check if output should be modified.                                                                                                                                                                                                                                                                                                    
     249               0 :         if ($this->modify_output_menu == false) {                                                                                                                                                                                                                                                                                                 
     250               0 :             print $this->navigation->createMenuStructure();                                                                                                                                                                                                                                                                                       
     251               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     252               0 :             print $this->modify_output_menu;                                                                                                                                                                                                                                                                                                      
     253                 :         }                                                                                                                                                                                                                                                                                                                                         
     254               0 :     }                                                                                                                                                                                                                                                                                                                                             
     255                 :                                                                                                                                                                                                                                                                                                                                                   
     256                 :     /**                                                                                                                                                                                                                                                                                                                                           
     257                 :      * This function support output_script by looking deeper into menu structure to find last linked menu item that is not linked to another.                                                                                                                                                                                                     
     258                 :      *                                                                                                                                                                                                                                                                                                                                            
     259                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                
     260                 :      * @param integer $extended_menu_id                                                                                                                                                                                                                                                                                                           
     261                 :      * @return integer                                                                                                                                                                                                                                                                                                                            
     262                 :      */                                                                                                                                                                                                                                                                                                                                           
     263                 :     public function extend_menu_loop ($extended_menu_id)                                                                                                                                                                                                                                                                                          
     264                 :     {                                                                                                                                                                                                                                                                                                                                             
     265               0 :         return $this->extendMenuLoop($extended_menu_id);                                                                                                                                                                                                                                                                                          
     266                 :     }                                                                                                                                                                                                                                                                                                                                             
     267                 :                                                                                                                                                                                                                                                                                                                                                   
     268                 :     /**                                                                                                                                                                                                                                                                                                                                           
     269                 :      * Returns "output script" to the template system. Intended to be used by the engine.                                                                                                                                                                                                                                                         
     270                 :      *                                                                                                                                                                                                                                                                                                                                            
     271                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     272                 :      */                                                                                                                                                                                                                                                                                                                                           
     273                 :     public function output_script ()                                                                                                                                                                                                                                                                                                              
     274                 :     {                                                                                                                                                                                                                                                                                                                                             
     275                 :         ////////////////////////////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                  
     276                 :         // Check if output should be modified.                                                                                                                                                                                                                                                                                                    
     277               0 :         if ($this->modify_output_script == false) {                                                                                                                                                                                                                                                                                               
     278                 :             // Start SQL transactions.                                                                                                                                                                                                                                                                                                            
     279               0 :             $this->db->start_transaction();                                                                                                                                                                                                                                                                                                       
     280                 :             // Content buffer.                                                                                                                                                                                                                                                                                                                    
     281               0 :             ob_start();                                                                                                                                                                                                                                                                                                                           
     282                 :             // Are we in demo mode?                                                                                                                                                                                                                                                                                                               
     283               0 :             if ($this->configuration['demo_mode'] == true) {                                                                                                                                                                                                                                                                                      
     284               0 :                 if ($this->configuration['user_role'] != $this->configuration['root_role']) {                                                                                                                                                                                                                                                     
     285                 :                     // Show demo mode message for end user.                                                                                                                                                                                                                                                                                       
     286               0 :                     $this->notice(sprintf(___('%s is currently in a demo mode state, no actual database transactions will occur.'), $this->configuration['scripts_name_version']));                                                                                                                                                               
     287               0 :                 } else {                                                                                                                                                                                                                                                                                                                          
     288                 :                     // Show demo mode message for root user.                                                                                                                                                                                                                                                                                      
     289               0 :                     $this->notice(sprintf(___('%s is currently in a demo mode state, only Root users are able to save database transactions.'), $this->configuration['scripts_name_version']));                                                                                                                                                   
     290                 :                 }                                                                                                                                                                                                                                                                                                                                 
     291               0 :             }                                                                                                                                                                                                                                                                                                                                     
     292                 :             // Load script to buffer.                                                                                                                                                                                                                                                                                                             
     293               0 :             if (! empty($this->navigation->navigation[$this->configuration['m']]['menu_id'])) {                                                                                                                                                                                                                                                   
     294                 :                 // We need to assign active menu_id.                                                                                                                                                                                                                                                                                              
     295               0 :                 $menu_id = $this->configuration['m'];                                                                                                                                                                                                                                                                                             
     296                 :                 // Determine correct menu action.                                                                                                                                                                                                                                                                                                 
     297               0 :                 switch ($this->navigation->navigation[$this->configuration['m']]['menu_type']) {                                                                                                                                                                                                                                                  
     298                 :                     // Plugin File.                                                                                                                                                                                                                                                                                                               
     299               0 :                     case 1:                                                                                                                                                                                                                                                                                                                       
     300                 :                         // Do case.                                                                                                                                                                                                                                                                                                               
     301               0 :                         $menu_case = 1;                                                                                                                                                                                                                                                                                                           
     302               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     303                 :                     // Link.                                                                                                                                                                                                                                                                                                                      
     304               0 :                     case 2:                                                                                                                                                                                                                                                                                                                       
     305               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     306                 :                     // Jump.                                                                                                                                                                                                                                                                                                                      
     307               0 :                     case 3:                                                                                                                                                                                                                                                                                                                       
     308               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     309                 :                     // External File.                                                                                                                                                                                                                                                                                                             
     310               0 :                     case 4:                                                                                                                                                                                                                                                                                                                       
     311                 :                         // Do case.                                                                                                                                                                                                                                                                                                               
     312               0 :                         $menu_case = 4;                                                                                                                                                                                                                                                                                                           
     313               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     314                 :                     // HTTP URL.                                                                                                                                                                                                                                                                                                                  
     315               0 :                     case 5:                                                                                                                                                                                                                                                                                                                       
     316                 :                         // Do case.                                                                                                                                                                                                                                                                                                               
     317               0 :                         $menu_case = 5;                                                                                                                                                                                                                                                                                                           
     318               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     319                 :                     // Placeholder.                                                                                                                                                                                                                                                                                                               
     320               0 :                     case 6:                                                                                                                                                                                                                                                                                                                       
     321               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     322                 :                     // iFrame.                                                                                                                                                                                                                                                                                                                    
     323               0 :                     case 7:                                                                                                                                                                                                                                                                                                                       
     324                 :                         // Do case.                                                                                                                                                                                                                                                                                                               
     325               0 :                         $menu_case = 7;                                                                                                                                                                                                                                                                                                           
     326               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     327                 :                     // Cronjob.                                                                                                                                                                                                                                                                                                                   
     328               0 :                     case 8:                                                                                                                                                                                                                                                                                                                       
     329                 :                         // Do case.                                                                                                                                                                                                                                                                                                               
     330               0 :                         $menu_case = 8;                                                                                                                                                                                                                                                                                                           
     331               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     332               0 :                     default:                                                                                                                                                                                                                                                                                                                      
     333                 :                         // Do case.                                                                                                                                                                                                                                                                                                               
     334               0 :                         $menu_case = 1;                                                                                                                                                                                                                                                                                                           
     335               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     336               0 :                 }                                                                                                                                                                                                                                                                                                                                 
     337                 :                 ///////////////////////////////////                                                                                                                                                                                                                                                                                               
     338                 :                 // Do further checking on links. //                                                                                                                                                                                                                                                                                               
     339                 :                 ///////////////////////////////////                                                                                                                                                                                                                                                                                               
     340               0 :                 if (empty($menu_case)) {                                                                                                                                                                                                                                                                                                          
     341                 :                     // So we have some kind of link, we now need to see what kind of link we have.                                                                                                                                                                                                                                                
     342                 :                     // Get menu extended data.                                                                                                                                                                                                                                                                                                    
     343               0 :                     $extend = $this->navigation->navigation[$menu_id]['extend'];                                                                                                                                                                                                                                                                  
     344                 :                     // Get menu type.                                                                                                                                                                                                                                                                                                             
     345               0 :                     if (!empty($this->navigation->navigation[$extend]['menu_type'])) {                                                                                                                                                                                                                                                            
     346               0 :                         $linked_menu_type = $this->navigation->navigation[$extend]['menu_type'];                                                                                                                                                                                                                                                  
     347               0 :                     } else {                                                                                                                                                                                                                                                                                                                      
     348               0 :                         $this->stopScript = sprintf(___('I had a problem extending menu item %s, it does not seem to exist.'), $extend);                                                                                                                                                                                                          
     349                 :                     }                                                                                                                                                                                                                                                                                                                             
     350                 :                     // We now have the linked menu type and can now work accordingly.                                                                                                                                                                                                                                                             
     351                 :                     // Determine correct menu action.                                                                                                                                                                                                                                                                                             
     352                 :                     switch ($linked_menu_type) {                                                                                                                                                                                                                                                                                                  
     353                 :                         // Plugin File.                                                                                                                                                                                                                                                                                                           
     354               0 :                         case 1:                                                                                                                                                                                                                                                                                                                   
     355                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     356               0 :                             $menu_case = 1;                                                                                                                                                                                                                                                                                                       
     357                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     358               0 :                             $menu_id = $extend;                                                                                                                                                                                                                                                                                                   
     359               0 :                             break;                                                                                                                                                                                                                                                                                                                
     360                 :                         // Link.                                                                                                                                                                                                                                                                                                                  
     361               0 :                         case 2:                                                                                                                                                                                                                                                                                                                   
     362                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     363               0 :                             $menu_case = 2;                                                                                                                                                                                                                                                                                                       
     364                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     365               0 :                             $this->extend_menu_loop($this->navigation->navigation[$extend]['extend']);                                                                                                                                                                                                                                            
     366               0 :                             $menu_id = $this->extended_menu_id;                                                                                                                                                                                                                                                                                   
     367               0 :                             break;                                                                                                                                                                                                                                                                                                                
     368                 :                         // Jump.                                                                                                                                                                                                                                                                                                                  
     369               0 :                         case 3:                                                                                                                                                                                                                                                                                                                   
     370                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     371               0 :                             $menu_case = 2;                                                                                                                                                                                                                                                                                                       
     372                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     373               0 :                             $this->extend_menu_loop($this->navigation->navigation[$extend]['extend']);                                                                                                                                                                                                                                            
     374               0 :                             $menu_id = $this->extended_menu_id;                                                                                                                                                                                                                                                                                   
     375               0 :                             break;                                                                                                                                                                                                                                                                                                                
     376                 :                         // External File.                                                                                                                                                                                                                                                                                                         
     377               0 :                         case 4:                                                                                                                                                                                                                                                                                                                   
     378                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     379               0 :                             $menu_case = 4;                                                                                                                                                                                                                                                                                                       
     380                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     381               0 :                             $menu_id = $extend;                                                                                                                                                                                                                                                                                                   
     382               0 :                             break;                                                                                                                                                                                                                                                                                                                
     383                 :                         // HTTP URL.                                                                                                                                                                                                                                                                                                              
     384               0 :                         case 5:                                                                                                                                                                                                                                                                                                                   
     385                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     386               0 :                             $menu_case = 5;                                                                                                                                                                                                                                                                                                       
     387                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     388               0 :                             $menu_id = $extend;                                                                                                                                                                                                                                                                                                   
     389               0 :                             break;                                                                                                                                                                                                                                                                                                                
     390                 :                         // Placeholder.                                                                                                                                                                                                                                                                                                           
     391               0 :                         case 6:                                                                                                                                                                                                                                                                                                                   
     392                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     393               0 :                             $menu_case = 2;                                                                                                                                                                                                                                                                                                       
     394                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     395               0 :                             $this->extend_menu_loop($this->navigation->navigation[$extend]['extend']);                                                                                                                                                                                                                                            
     396               0 :                             $menu_id = $this->extended_menu_id;                                                                                                                                                                                                                                                                                   
     397               0 :                             break;                                                                                                                                                                                                                                                                                                                
     398                 :                         // iFrame.                                                                                                                                                                                                                                                                                                                
     399               0 :                         case 7:                                                                                                                                                                                                                                                                                                                   
     400                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     401               0 :                             $menu_case = 7;                                                                                                                                                                                                                                                                                                       
     402                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     403               0 :                             $menu_id = $extend;                                                                                                                                                                                                                                                                                                   
     404               0 :                             break;                                                                                                                                                                                                                                                                                                                
     405                 :                         // Cronjob.                                                                                                                                                                                                                                                                                                               
     406               0 :                         case 8:                                                                                                                                                                                                                                                                                                                   
     407                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     408               0 :                             $menu_case = 8;                                                                                                                                                                                                                                                                                                       
     409                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     410               0 :                             $menu_id = $extend;                                                                                                                                                                                                                                                                                                   
     411               0 :                             break;                                                                                                                                                                                                                                                                                                                
     412               0 :                         default:                                                                                                                                                                                                                                                                                                                  
     413                 :                             // Do case.                                                                                                                                                                                                                                                                                                           
     414               0 :                             $menu_case = 1;                                                                                                                                                                                                                                                                                                       
     415                 :                             // We need to assign active menu_id.                                                                                                                                                                                                                                                                                  
     416               0 :                             $menu_id = $extend;                                                                                                                                                                                                                                                                                                   
     417               0 :                             break;                                                                                                                                                                                                                                                                                                                
     418               0 :                     }                                                                                                                                                                                                                                                                                                                             
     419               0 :                 }                                                                                                                                                                                                                                                                                                                                 
     420                 :                 // Execute repeated menu cases.                                                                                                                                                                                                                                                                                                   
     421                 :                 switch ($menu_case) {                                                                                                                                                                                                                                                                                                             
     422                 :                     // Plugin Script.                                                                                                                                                                                                                                                                                                             
     423               0 :                     case 1:                                                                                                                                                                                                                                                                                                                       
     424                 :                         // Set plugin folder.                                                                                                                                                                                                                                                                                                     
     425               0 :                         $plugin_folder = $this->navigation->navigation[$menu_id]['plugin_folder'];                                                                                                                                                                                                                                                
     426                 :                         // Set active script directory.                                                                                                                                                                                                                                                                                           
     427               0 :                         $active_dir = $plugin_folder . $this->navigation->navigation[$menu_id]['menu_link'];                                                                                                                                                                                                                                      
     428                 :                         // Require script.                                                                                                                                                                                                                                                                                                        
     429               0 :                         $this->view = new view();                                                                                                                                                                                                                                                                                                 
     430               0 :                         if (!$this->core->loadFile($active_dir)) {                                                                                                                                                                                                                                                                                
     431               0 :                             $this->stopScript = sprintf(___('The script could not be found, I tried to execute filename : %s'), $active_dir);                                                                                                                                                                                                     
     432               0 :                         }                                                                                                                                                                                                                                                                                                                         
     433               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     434                 :                     // Link, Jump, Placeholder.                                                                                                                                                                                                                                                                                                   
     435               0 :                     case 2:                                                                                                                                                                                                                                                                                                                       
     436                 :                         // Is this an empty menu item?                                                                                                                                                                                                                                                                                            
     437               0 :                         if (empty($menu_id)) {                                                                                                                                                                                                                                                                                                    
     438                 :                             // Lets take user to the front page as last option.                                                                                                                                                                                                                                                                   
     439                 :                             // Get correct frontpage id.                                                                                                                                                                                                                                                                                          
     440               0 :                             ($this->user->isLoggedIn()) ? $menu_id = $this->configuration['front_page_id_in'] : $menu_id = $this->configuration['front_page_id'];                                                                                                                                                                                 
     441               0 :                         }                                                                                                                                                                                                                                                                                                                         
     442                 :                         // Set plugin folder.                                                                                                                                                                                                                                                                                                     
     443               0 :                         $plugin_folder = $this->navigation->navigation[$menu_id]['plugin_folder'];                                                                                                                                                                                                                                                
     444                 :                         // Set active script directory.                                                                                                                                                                                                                                                                                           
     445               0 :                         $active_dir = $plugin_folder . $this->navigation->navigation[$menu_id]['menu_link'];                                                                                                                                                                                                                                      
     446                 :                         // Load template engine.                                                                                                                                                                                                                                                                                                  
     447               0 :                         $this->view = new view();                                                                                                                                                                                                                                                                                                 
     448                 :                         // Require script.                                                                                                                                                                                                                                                                                                        
     449               0 :                         if (!$this->core->loadFile($active_dir)) {                                                                                                                                                                                                                                                                                
     450               0 :                             $this->stopScript = sprintf(___('The script could not be found, I tried to execute filename : %s'), $active_dir);                                                                                                                                                                                                     
     451               0 :                         }                                                                                                                                                                                                                                                                                                                         
     452               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     453                 :                     // External File.                                                                                                                                                                                                                                                                                                             
     454               0 :                     case 4:                                                                                                                                                                                                                                                                                                                       
     455                 :                         // Load template engine.                                                                                                                                                                                                                                                                                                  
     456               0 :                         $this->view = new view();                                                                                                                                                                                                                                                                                                 
     457                 :                         // Require external file.                                                                                                                                                                                                                                                                                                 
     458               0 :                         if (!$this->core->loadFile($this->navigation->navigation[$menu_id]['menu_link'])) {                                                                                                                                                                                                                                       
     459               0 :                             $this->stopScript = sprintf(___('The script could not be found, I tried to execute filename : %s'), $this->navigation->navigation[$menu_id]['menu_link']);                                                                                                                                                            
     460               0 :                         }                                                                                                                                                                                                                                                                                                                         
     461               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     462                 :                     // HTTP URL.                                                                                                                                                                                                                                                                                                                  
     463               0 :                     case 5:                                                                                                                                                                                                                                                                                                                       
     464                 :                         // Redirect to external http url.                                                                                                                                                                                                                                                                                         
     465               0 :                         $this->ok(sprintf(___('You are now being redirected to an external url, %s'), $this->navigation->navigation[$menu_id]['menu_link']), false, false);                                                                                                                                                                       
     466               0 :                         $this->navigation->redirect($this->navigation->navigation[$menu_id]['menu_link']);                                                                                                                                                                                                                                        
     467               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     468                 :                     // iFrame.                                                                                                                                                                                                                                                                                                                    
     469               0 :                     case 7:                                                                                                                                                                                                                                                                                                                       
     470                 :                         // Clean up height.                                                                                                                                                                                                                                                                                                       
     471               0 :                         $height = preg_replace('/px/i', '', $this->navigation->navigation[$menu_id]['extend']);                                                                                                                                                                                                                                   
     472                 :                         // Create Iframe.                                                                                                                                                                                                                                                                                                         
     473               0 :                         $this->HTML = sprintf($this->module['iframe'], $this->navigation->navigation[$menu_id]['menu_link'], $height);                                                                                                                                                                                                            
     474               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     475                 :                     // Cronjob.                                                                                                                                                                                                                                                                                                                   
     476               0 :                     case 8:                                                                                                                                                                                                                                                                                                                       
     477                 :                         // Set plugin folder.                                                                                                                                                                                                                                                                                                     
     478               0 :                         $plugin_folder = $this->navigation->navigation[$menu_id]['plugin_folder'];                                                                                                                                                                                                                                                
     479                 :                         // Set active script directory.                                                                                                                                                                                                                                                                                           
     480               0 :                         $active_dir = $plugin_folder . $this->navigation->navigation[$menu_id]['menu_link'];                                                                                                                                                                                                                                      
     481                 :                         // Load template engine.                                                                                                                                                                                                                                                                                                  
     482               0 :                         $this->view = new view();                                                                                                                                                                                                                                                                                                 
     483                 :                         // Require script.                                                                                                                                                                                                                                                                                                        
     484               0 :                         if (!$this->core->loadFile($active_dir)) {                                                                                                                                                                                                                                                                                
     485               0 :                             $this->stopScript = sprintf(___('The script could not be found, I tried to execute filename : %s'), $active_dir);                                                                                                                                                                                                     
     486               0 :                         } else {                                                                                                                                                                                                                                                                                                                  
     487               0 :                             $time_now = time();                                                                                                                                                                                                                                                                                                   
     488                 :                             // Update last execution.                                                                                                                                                                                                                                                                                             
     489               0 :                             $this->db->new_query("                                                                                                                                                                                                                                                                                                
     490                 :                                 UPDATE                                                                                                                                                                                                                                                                                                            
     491                 :                                     _db_core_cron t1                                                                                                                                                                                                                                                                                              
     492                 :                                 SET                                                                                                                                                                                                                                                                                                               
     493                 :                                     t1.last_execution = '$time_now'                                                                                                                                                                                                                                                                               
     494                 :                                 WHERE                                                                                                                                                                                                                                                                                                             
     495               0 :                                     t1.menu_id = '{$menu_id}'                                                                                                                                                                                                                                                                                     
     496               0 :                             ");                                                                                                                                                                                                                                                                                                                   
     497                 :                             // Always log manual touched cronjobs.                                                                                                                                                                                                                                                                                
     498               0 :                             $this->ok(sprintf(___('Cronjob %s executed manually.'), $this->navigation->navigation[$menu_id]['menu_name']));                                                                                                                                                                                                       
     499                 :                         }                                                                                                                                                                                                                                                                                                                         
     500               0 :                         break;                                                                                                                                                                                                                                                                                                                    
     501                 :                 }                                                                                                                                                                                                                                                                                                                                 
     502                 :                 // This is used for debugging scripts.                                                                                                                                                                                                                                                                                            
     503                 :                 // It will always show if $template->debugStr is set.                                                                                                                                                                                                                                                                             
     504               0 :                 ($this->debugStr) ? $this->notice($this->debugStr) : null;                                                                                                                                                                                                                                                                        
     505                 :                 // Print HEREDOC HTML.                                                                                                                                                                                                                                                                                                            
     506               0 :                 if (! empty($this->HTML)) print $this->HTML;                                                                                                                                                                                                                                                                                      
     507               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     508               0 :                 $this->stopScript = ___('SECURITY ALERT, There seems to be a security limitation, you are not allowed to run this script or the script could not be found. Make sure your session did not expire, you might be logged out.');                                                                                                     
     509                 :             }                                                                                                                                                                                                                                                                                                                                     
     510               0 :             if (isset($this->stopScript)) {                                                                                                                                                                                                                                                                                                       
     511                 :                 // Roll back current transaction.                                                                                                                                                                                                                                                                                                 
     512               0 :                 mysql_query("ROLLBACK", $this->db->connection);                                                                                                                                                                                                                                                                                   
     513                 :                 // Clear buffer and turn off output buffering.                                                                                                                                                                                                                                                                                    
     514               0 :                 ob_end_clean();                                                                                                                                                                                                                                                                                                                   
     515                 :                 // Output critical message while logging it.                                                                                                                                                                                                                                                                                      
     516               0 :                 $security_output = $this->warning($this->stopScript, true);                                                                                                                                                                                                                                                                       
     517                 :                 // Check if user is logged in.                                                                                                                                                                                                                                                                                                    
     518               0 :                 if (! $this->user->isLoggedIn() && empty($this->skipLogin)) {                                                                                                                                                                                                                                                                     
     519                 :                     // Set heading information.                                                                                                                                                                                                                                                                                                   
     520               0 :                     $security_output .= $this->heading(___('Log In Page'), true);                                                                                                                                                                                                                                                                 
     521               0 :                     $security_output .= $this->info(___('Please fill in your Username and Password. Letters are case sensitive.'), true);                                                                                                                                                                                                         
     522                 :                     // Display login template.                                                                                                                                                                                                                                                                                                    
     523               0 :                     $security_output .= $this->login_template($this->navigation->buildURL(3682403894), $_SERVER['REQUEST_URI'], true);                                                                                                                                                                                                            
     524               0 :                 }                                                                                                                                                                                                                                                                                                                                 
     525               0 :                 print $security_output;                                                                                                                                                                                                                                                                                                           
     526               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     527                 :                 // Print out buffer.                                                                                                                                                                                                                                                                                                              
     528               0 :                 ob_end_flush();                                                                                                                                                                                                                                                                                                                   
     529                 :             }                                                                                                                                                                                                                                                                                                                                     
     530                 :             // End database transactions.                                                                                                                                                                                                                                                                                                         
     531               0 :             $this->db->end_transaction();                                                                                                                                                                                                                                                                                                         
     532               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     533               0 :             print $this->modify_output_script;                                                                                                                                                                                                                                                                                                    
     534                 :         }                                                                                                                                                                                                                                                                                                                                         
     535               0 :     }                                                                                                                                                                                                                                                                                                                                             
     536                 :                                                                                                                                                                                                                                                                                                                                                   
     537                 :     /**                                                                                                                                                                                                                                                                                                                                           
     538                 :      * The exact location where hook should be applied.                                                                                                                                                                                                                                                                                           
     539                 :      *                                                                                                                                                                                                                                                                                                                                            
     540                 :      * @param integer $hook_point_id The unique id given to a hook.                                                                                                                                                                                                                                                                               
     541                 :      */                                                                                                                                                                                                                                                                                                                                           
     542                 :     public function hook ($hook_point_id)                                                                                                                                                                                                                                                                                                         
     543                 :     {                                                                                                                                                                                                                                                                                                                                             
     544                 :         ///////////////////////////////////////////////////////////////////////////////                                                                                                                                                                                                                                                           
     545                 :         // Check if we should even continue.                                                                                                                                                                                                                                                                                                      
     546               0 :         if (empty($this->hook_array) || $this->hook_array == 'empty') return false;                                                                                                                                                                                                                                                               
     547                 :         // Assign hook array for this loop.                                                                                                                                                                                                                                                                                                       
     548               0 :         if (empty($this->hook_array[$this->configuration['m']][$hook_point_id])) {                                                                                                                                                                                                                                                                
     549               0 :             return false;                                                                                                                                                                                                                                                                                                                         
     550                 :         } else {                                                                                                                                                                                                                                                                                                                                  
     551               0 :             $hook_array_foreach = $this->hook_array[$this->configuration['m']][$hook_point_id];                                                                                                                                                                                                                                                   
     552                 :         }                                                                                                                                                                                                                                                                                                                                         
     553                 :         // Now lets include hook files.                                                                                                                                                                                                                                                                                                           
     554               0 :         if (! empty($hook_array_foreach)) {                                                                                                                                                                                                                                                                                                       
     555                 :             // Clear previous results.                                                                                                                                                                                                                                                                                                            
     556               0 :             $results = false;                                                                                                                                                                                                                                                                                                                     
     557                 :             // Loop the array and see what needs be included.                                                                                                                                                                                                                                                                                     
     558               0 :             foreach ($hook_array_foreach as $hook_array) {                                                                                                                                                                                                                                                                                        
     559                 :                 // Set variables.                                                                                                                                                                                                                                                                                                                 
     560               0 :                 $plugin = $hook_array['plugin'];                                                                                                                                                                                                                                                                                                  
     561               0 :                 $hook_name = $hook_array['hook_name'];                                                                                                                                                                                                                                                                                            
     562                 :                 // Create hook file path.                                                                                                                                                                                                                                                                                                         
     563               0 :                 $include_hook_file = 'plugins/' . $plugin . '/hooks/' . $hook_name . '.hook.php';                                                                                                                                                                                                                                                 
     564                 :                                                                                                                                                                                                                                                                                                                                                   
     565                 :                 // But does the file exist?                                                                                                                                                                                                                                                                                                       
     566               0 :                 if (file_exists($include_hook_file)) {                                                                                                                                                                                                                                                                                            
     567                 :                     // Lets give developer an idea of what hook position we are in.                                                                                                                                                                                                                                                               
     568               0 :                     $this->hook_request = $hook_point_id;                                                                                                                                                                                                                                                                                         
     569                 :                     // Execute hook.                                                                                                                                                                                                                                                                                                              
     570               0 :                     $this->core->loadFile ($include_hook_file, false, true, false);                                                                                                                                                                                                                                                               
     571                 :                     // Collect results for output and returning;                                                                                                                                                                                                                                                                                  
     572               0 :                     if (! empty($this->HOOK)) {                                                                                                                                                                                                                                                                                                   
     573               0 :                         $results .= $this->HOOK;                                                                                                                                                                                                                                                                                                  
     574               0 :                         $this->HOOK = '';                                                                                                                                                                                                                                                                                                         
     575               0 :                     }                                                                                                                                                                                                                                                                                                                             
     576               0 :                 }                                                                                                                                                                                                                                                                                                                                 
     577               0 :             }                                                                                                                                                                                                                                                                                                                                     
     578               0 :         }                                                                                                                                                                                                                                                                                                                                         
     579                 :         // Return hook results.                                                                                                                                                                                                                                                                                                                   
     580               0 :         return $results;                                                                                                                                                                                                                                                                                                                          
     581                 :     }                                                                                                                                                                                                                                                                                                                                             
     582                 :                                                                                                                                                                                                                                                                                                                                                   
     583                 :     /**                                                                                                                                                                                                                                                                                                                                           
     584                 :      * Returns the last footer string to the template system. Intended to be used by the engine.                                                                                                                                                                                                                                                  
     585                 :      *                                                                                                                                                                                                                                                                                                                                            
     586                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     587                 :      */                                                                                                                                                                                                                                                                                                                                           
     588                 :     public function output_footer ()                                                                                                                                                                                                                                                                                                              
     589                 :     {                                                                                                                                                                                                                                                                                                                                             
     590                 :         // Create printable template url.                                                                                                                                                                                                                                                                                                         
     591               0 :         if (!empty($this->configuration['printable_template'])) {                                                                                                                                                                                                                                                                                 
     592               0 :             if (empty($_SESSION['fast']) || $_SESSION['fast'] == 'off') {                                                                                                                                                                                                                                                                         
     593               0 :                 $printable = "<a href=\"{$this->navigation->buildURL(false, 'fast=on')}\">" . ___('[Printable|Faster Template On]') . "</a>";                                                                                                                                                                                                     
     594               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     595               0 :                 $printable = "<a href=\"{$this->navigation->buildURL(false, 'fast=off')}\">" . ___('[Printable|Faster Template Off]') . "</a>";                                                                                                                                                                                                   
     596                 :             }                                                                                                                                                                                                                                                                                                                                     
     597               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     598               0 :             $printable = '';                                                                                                                                                                                                                                                                                                                      
     599                 :         }                                                                                                                                                                                                                                                                                                                                         
     600                 :         // Create HTML.                                                                                                                                                                                                                                                                                                                           
     601               0 :         $html = sprintf($this->module['footer'], $this->configuration['scripts_name_version'], $this->configuration['footer_notes'], $printable);                                                                                                                                                                                                 
     602                 :         // Check if output should be modified.                                                                                                                                                                                                                                                                                                    
     603               0 :         if ($this->modify_output_footer == false) {                                                                                                                                                                                                                                                                                               
     604               0 :             print $html;                                                                                                                                                                                                                                                                                                                          
     605               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     606               0 :             print $this->modify_output_footer;                                                                                                                                                                                                                                                                                                    
     607                 :         }                                                                                                                                                                                                                                                                                                                                         
     608               0 :     }                                                                                                                                                                                                                                                                                                                                             
     609                 :                                                                                                                                                                                                                                                                                                                                                   
     610                 :     /**                                                                                                                                                                                                                                                                                                                                           
     611                 :      * Will pick image or text icon depending on print or fast mode.                                                                                                                                                                                                                                                                              
     612                 :      *                                                                                                                                                                                                                                                                                                                                            
     613                 :      * @param string The url of the image icon to display.                                                                                                                                                                                                                                                                                        
     614                 :      * @param string The alternative text if in fast mode.                                                                                                                                                                                                                                                                                        
     615                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     616                 :      */                                                                                                                                                                                                                                                                                                                                           
     617                 :     public function iconize ($img,$text)                                                                                                                                                                                                                                                                                                          
     618                 :     {                                                                                                                                                                                                                                                                                                                                             
     619               0 :         if (empty($_SESSION['fast'])) {                                                                                                                                                                                                                                                                                                           
     620               0 :             return $img;                                                                                                                                                                                                                                                                                                                          
     621                 :         } else {                                                                                                                                                                                                                                                                                                                                  
     622               0 :             return $text;                                                                                                                                                                                                                                                                                                                         
     623                 :         }                                                                                                                                                                                                                                                                                                                                         
     624                 :     }                                                                                                                                                                                                                                                                                                                                             
     625                 :                                                                                                                                                                                                                                                                                                                                                   
     626                 :     /**                                                                                                                                                                                                                                                                                                                                           
     627                 :      * This creates an the [i] when over with mouse a popup with a message appears, this can be placed anywhere. Intended to be used by the developer.                                                                                                                                                                                            
     628                 :      *                                                                                                                                                                                                                                                                                                                                            
     629                 :      * @param string The message to diplay when mouse goes over the [i].                                                                                                                                                                                                                                                                          
     630                 :      * @param boolean Sets to print out confirm link instead of return.                                                                                                                                                                                                                                                                           
     631                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     632                 :      */                                                                                                                                                                                                                                                                                                                                           
     633                 :     public function info_mark ($info_mark, $print = false)                                                                                                                                                                                                                                                                                        
     634                 :     {                                                                                                                                                                                                                                                                                                                                             
     635                 :         // This is yet another IE Fix !                                                                                                                                                                                                                                                                                                           
     636               0 :         $info_mark_clean = preg_replace('/"/', '', $info_mark);                                                                                                                                                                                                                                                                                   
     637               0 :         $info = sprintf($this->module['info_mark'], $this->lang['help_icon'], $info_mark_clean);                                                                                                                                                                                                                                                  
     638               0 :         if ($print == false) {                                                                                                                                                                                                                                                                                                                    
     639               0 :             return $info;                                                                                                                                                                                                                                                                                                                         
     640                 :         } else {                                                                                                                                                                                                                                                                                                                                  
     641               0 :             print $info;                                                                                                                                                                                                                                                                                                                          
     642                 :         }                                                                                                                                                                                                                                                                                                                                         
     643               0 :     }                                                                                                                                                                                                                                                                                                                                             
     644                 :                                                                                                                                                                                                                                                                                                                                                   
     645                 :     /**                                                                                                                                                                                                                                                                                                                                           
     646                 :      * Print out any message given to it (instead of return). Intended to be used by the developer.                                                                                                                                                                                                                                               
     647                 :      *                                                                                                                                                                                                                                                                                                                                            
     648                 :      * @param string Message to print out.                                                                                                                                                                                                                                                                                                        
     649                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     650                 :      */                                                                                                                                                                                                                                                                                                                                           
     651                 :     public function out ($variable)                                                                                                                                                                                                                                                                                                               
     652                 :     {                                                                                                                                                                                                                                                                                                                                             
     653               0 :         print $variable;                                                                                                                                                                                                                                                                                                                          
     654               0 :     }                                                                                                                                                                                                                                                                                                                                             
     655                 :                                                                                                                                                                                                                                                                                                                                                   
     656                 :     /**                                                                                                                                                                                                                                                                                                                                           
     657                 :      * Does the alternating colors of rows when there is more then 1 result. Intended to be used by the developer.                                                                                                                                                                                                                                
     658                 :      *                                                                                                                                                                                                                                                                                                                                            
     659                 :      * @param mixed The value of the previous row.                                                                                                                                                                                                                                                                                                
     660                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     661                 :      */                                                                                                                                                                                                                                                                                                                                           
     662                 :     public function alt_color ($alt)                                                                                                                                                                                                                                                                                                              
     663                 :     {                                                                                                                                                                                                                                                                                                                                             
     664               0 :         if ($alt == 'alt1') {                                                                                                                                                                                                                                                                                                                     
     665               0 :             return 'alt2';                                                                                                                                                                                                                                                                                                                        
     666                 :         } else {                                                                                                                                                                                                                                                                                                                                  
     667               0 :             return 'alt1';                                                                                                                                                                                                                                                                                                                        
     668                 :         }                                                                                                                                                                                                                                                                                                                                         
     669                 :     }                                                                                                                                                                                                                                                                                                                                             
     670                 :                                                                                                                                                                                                                                                                                                                                                   
     671                 :     /**                                                                                                                                                                                                                                                                                                                                           
     672                 :      * Creates a random soft color by group. Intended to be used by the developer.                                                                                                                                                                                                                                                                
     673                 :      *                                                                                                                                                                                                                                                                                                                                            
     674                 :      * @param int Unique id of the group which needs a color.                                                                                                                                                                                                                                                                                     
     675                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     676                 :      */                                                                                                                                                                                                                                                                                                                                           
     677                 :     public function random_color ($id)                                                                                                                                                                                                                                                                                                            
     678                 :     {                                                                                                                                                                                                                                                                                                                                             
     679               0 :         $r = rand(200, 255);                                                                                                                                                                                                                                                                                                                      
     680               0 :         $g = rand(200, 255);                                                                                                                                                                                                                                                                                                                      
     681               0 :         $b = rand(200, 255);                                                                                                                                                                                                                                                                                                                      
     682               0 :         $color = '#' . dechex($r) . dechex($g) . dechex($b);                                                                                                                                                                                                                                                                                      
     683                 :         // Define.                                                                                                                                                                                                                                                                                                                                
     684               0 :         $this->existing_random_color[0] = false;                                                                                                                                                                                                                                                                                                  
     685               0 :         if (is_array($this->existing_random_color)) {                                                                                                                                                                                                                                                                                             
     686               0 :             if (! key_exists($id, $this->existing_random_color)) {                                                                                                                                                                                                                                                                                
     687               0 :                 $this->existing_random_color[$id] = $color;                                                                                                                                                                                                                                                                                       
     688               0 :                 return $this->existing_random_color[$id];                                                                                                                                                                                                                                                                                         
     689                 :             } else {                                                                                                                                                                                                                                                                                                                              
     690               0 :                 return $this->existing_random_color[$id];                                                                                                                                                                                                                                                                                         
     691                 :             }                                                                                                                                                                                                                                                                                                                                     
     692                 :         } else {                                                                                                                                                                                                                                                                                                                                  
     693               0 :             $this->existing_random_color[$id] = $color;                                                                                                                                                                                                                                                                                           
     694               0 :             return $this->existing_random_color[$id];                                                                                                                                                                                                                                                                                             
     695                 :         }                                                                                                                                                                                                                                                                                                                                         
     696                 :     }                                                                                                                                                                                                                                                                                                                                             
     697                 :                                                                                                                                                                                                                                                                                                                                                   
     698                 :     /**                                                                                                                                                                                                                                                                                                                                           
     699                 :      * Outputs data to the cron template if cron debug is enabled in the configuration.                                                                                                                                                                                                                                                           
     700                 :      *                                                                                                                                                                                                                                                                                                                                            
     701                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     702                 :      */                                                                                                                                                                                                                                                                                                                                           
     703                 :     public function template_cron_output ()                                                                                                                                                                                                                                                                                                       
     704                 :     {                                                                                                                                                                                                                                                                                                                                             
     705               0 :         print $this->cron_output;                                                                                                                                                                                                                                                                                                                 
     706               0 :     }                                                                                                                                                                                                                                                                                                                                             
     707                 :                                                                                                                                                                                                                                                                                                                                                   
     708                 :     /**                                                                                                                                                                                                                                                                                                                                           
     709                 :      * Output "no results found" if no results are found in a paging script.                                                                                                                                                                                                                                                                      
     710                 :      *                                                                                                                                                                                                                                                                                                                                            
     711                 :      * @param string $RESULTS                                                                                                                                                                                                                                                                                                                     
     712                 :      * @param integer $colspan                                                                                                                                                                                                                                                                                                                    
     713                 :      * @since 2007/04/16                                                                                                                                                                                                                                                                                                                          
     714                 :      */                                                                                                                                                                                                                                                                                                                                           
     715                 :     public function result ($RESULT, $colspan = 0)                                                                                                                                                                                                                                                                                                
     716                 :     {                                                                                                                                                                                                                                                                                                                                             
     717               0 :         if (! empty($RESULT)) {                                                                                                                                                                                                                                                                                                                   
     718               0 :             return $RESULT;                                                                                                                                                                                                                                                                                                                       
     719                 :         } else {                                                                                                                                                                                                                                                                                                                                  
     720               0 :             return sprintf($this->module['result'], $colspan, ___('No results found!'));                                                                                                                                                                                                                                                          
     721                 :         }                                                                                                                                                                                                                                                                                                                                         
     722                 :     }                                                                                                                                                                                                                                                                                                                                             
     723                 :                                                                                                                                                                                                                                                                                                                                                   
     724                 :     /**                                                                                                                                                                                                                                                                                                                                           
     725                 :      * Will load template icons and assign to lang array.                                                                                                                                                                                                                                                                                         
     726                 :      *                                                                                                                                                                                                                                                                                                                                            
     727                 :      */                                                                                                                                                                                                                                                                                                                                           
     728                 :     public function load_icons ()                                                                                                                                                                                                                                                                                                                 
     729                 :     {                                                                                                                                                                                                                                                                                                                                             
     730                 :         // Create preferred template dir.                                                                                                                                                                                                                                                                                                         
     731               0 :         $template_dir = 'themes/' . $this->configuration['template_folder'];                                                                                                                                                                                                                                                                      
     732                 :         // Check if we have a icons file.                                                                                                                                                                                                                                                                                                         
     733               0 :         if (!$this->core->loadFile ($template_dir . '/icons.php')) {                                                                                                                                                                                                                                                                              
     734                 :             // If all else fail, try default template icon file.                                                                                                                                                                                                                                                                                  
     735               0 :             $this->core->loadFile ('themes/cloud/icons.php');                                                                                                                                                                                                                                                                                     
     736               0 :         }                                                                                                                                                                                                                                                                                                                                         
     737               0 :     }                                                                                                                                                                                                                                                                                                                                             
     738                 :                                                                                                                                                                                                                                                                                                                                                   
     739                 :     /**                                                                                                                                                                                                                                                                                                                                           
     740                 :      * Get and return the supposed to run template.                                                                                                                                                                                                                                                                                               
     741                 :      *                                                                                                                                                                                                                                                                                                                                            
     742                 :      * @return string if not found, return default.                                                                                                                                                                                                                                                                                               
     743                 :      * @author Jason Schoeman                                                                                                                                                                                                                                                                                                                     
     744                 :      */                                                                                                                                                                                                                                                                                                                                           
     745                 :     public function get_template ()                                                                                                                                                                                                                                                                                                               
     746                 :     {                                                                                                                                                                                                                                                                                                                                             
     747                 :         // Assign sessions for fast template.                                                                                                                                                                                                                                                                                                     
     748               0 :         (!empty($_GET['fast'])) ? $fast = $_GET['fast'] : $fast = false;                                                                                                                                                                                                                                                                          
     749               0 :         if ($fast == 'on') {                                                                                                                                                                                                                                                                                                                      
     750               0 :             $_SESSION['fast'] = 'on';                                                                                                                                                                                                                                                                                                             
     751               0 :         } else if ($fast == 'off') {                                                                                                                                                                                                                                                                                                              
     752               0 :             $_SESSION['fast'] = false;                                                                                                                                                                                                                                                                                                            
     753               0 :         }                                                                                                                                                                                                                                                                                                                                         
     754                 :         // Do global check to see if we need to load printable template.                                                                                                                                                                                                                                                                          
     755               0 :         if (!empty($_SESSION['fast'])) {                                                                                                                                                                                                                                                                                                          
     756               0 :             $settings['default_template'] = $this->configuration['printable_template'];                                                                                                                                                                                                                                                           
     757               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     758                 :             // Check if the menu has a defined template.                                                                                                                                                                                                                                                                                          
     759               0 :             if (! empty($this->navigation->navigation[$this->configuration['m']]['template_folder'])) {                                                                                                                                                                                                                                           
     760               0 :                 $settings['default_template'] = $this->navigation->navigation[$this->configuration['m']]['template_folder'];                                                                                                                                                                                                                      
     761               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     762                 :                 // If not check if the gui system settings was set with a default template.                                                                                                                                                                                                                                                       
     763               0 :                 $settings['default_template'] = $this->configuration['default_template'];                                                                                                                                                                                                                                                         
     764                 :             }                                                                                                                                                                                                                                                                                                                                     
     765                 :         }                                                                                                                                                                                                                                                                                                                                         
     766                 :         // Return the complete template.                                                                                                                                                                                                                                                                                                          
     767               0 :         return $settings['default_template'];                                                                                                                                                                                                                                                                                                     
     768                 :     }                                                                                                                                                                                                                                                                                                                                             
     769                 :                                                                                                                                                                                                                                                                                                                                                   
     770                 :     /**                                                                                                                                                                                                                                                                                                                                           
     771                 :      * Loads the username & password html template form.                                                                                                                                                                                                                                                                                          
     772                 :      *                                                                                                                                                                                                                                                                                                                                            
     773                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                
     774                 :      * @param string $goto                                                                                                                                                                                                                                                                                                                        
     775                 :      * @param integer $redirect                                                                                                                                                                                                                                                                                                                   
     776                 :      * @param boolean $return                                                                                                                                                                                                                                                                                                                     
     777                 :      */                                                                                                                                                                                                                                                                                                                                           
     778                 :     public function login_emplate ($goto, $redirect = false, $return = false)                                                                                                                                                                                                                                                                     
     779                 :     {                                                                                                                                                                                                                                                                                                                                             
     780               0 :         $settings = $this->db->essentialSettings;                                                                                                                                                                                                                                                                                                 
     781               0 :         if ($redirect != false) {                                                                                                                                                                                                                                                                                                                 
     782               0 :             $redirect_page = '<input type="hidden" name="redirect" value="' . $redirect . '">';                                                                                                                                                                                                                                                   
     783               0 :         } else {                                                                                                                                                                                                                                                                                                                                  
     784               0 :             $redirect_page = false;                                                                                                                                                                                                                                                                                                               
     785                 :         }                                                                                                                                                                                                                                                                                                                                         
     786               0 :         if (! $this->user->isLoggedIn()) {                                                                                                                                                                                                                                                                                                        
     787                 :             // Check if not registered link should appear.                                                                                                                                                                                                                                                                                        
     788               0 :             if ((boolean) $settings['allow_registration'] == true) {                                                                                                                                                                                                                                                                              
     789                 :                 // Check if we have a custom registration page.                                                                                                                                                                                                                                                                                   
     790               0 :                 (! empty($settings['registration_page'])) ? $registration = $this->navigation->buildURL($settings['registration_page']) : $registration = $this->navigation->buildURL(3727066128);                                                                                                                                                
     791                 :                 // Create generic button for registration.                                                                                                                                                                                                                                                                                        
     792               0 :                 $not_registered_yet = $this->navigation->generic_button(___('Not registered yet?'), $registration);                                                                                                                                                                                                                               
     793               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     794               0 :                 $not_registered_yet = false;                                                                                                                                                                                                                                                                                                      
     795                 :             }                                                                                                                                                                                                                                                                                                                                     
     796                 :             // Create lost password link.                                                                                                                                                                                                                                                                                                         
     797               0 :             $lost_password = $this->navigation->generic_button(___('Lost Password?'), $this->navigation->buildURL(1901799184));                                                                                                                                                                                                                   
     798                 :             // Create login button.                                                                                                                                                                                                                                                                                                               
     799               0 :             $login_button = '<input tabindex="4" type="submit" value="' . ___('Log In') . '" name="login" class="button">';                                                                                                                                                                                                                       
     800                 :             // Create the "remember me" checkbox, if needed                                                                                                                                                                                                                                                                                       
     801               0 :             if (!empty($settings['allow_remember'])){                                                                                                                                                                                                                                                                                             
     802               0 :                 $remember = sprintf($this->module['remember_checkbox'], ___('Remember Me?'), $this->tip(___('Select this to have your login remembered after you close your browser. Do not use on public computers.')));                                                                                                                         
     803               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     804               0 :                 $remember = '';                                                                                                                                                                                                                                                                                                                   
     805                 :             }                                                                                                                                                                                                                                                                                                                                     
     806                 :             // Create HTML login field.                                                                                                                                                                                                                                                                                                           
     807               0 :             $HTML = sprintf($this->module['login_form'], $goto, ___('Username or Email'), '', $this->tip(___('Enter your username or email address here.')), ___('Password'), '', $this->tip(___('Enter your password here.')), $redirect_page, $login_button, $lost_password, $not_registered_yet, $this->security->postValidation(), $remember);
     808               0 :             if ($return == false) {                                                                                                                                                                                                                                                                                                               
     809               0 :                 print $HTML;                                                                                                                                                                                                                                                                                                                      
     810               0 :             } else {                                                                                                                                                                                                                                                                                                                              
     811               0 :                 return $HTML;                                                                                                                                                                                                                                                                                                                     
     812                 :             }                                                                                                                                                                                                                                                                                                                                     
     813               0 :         }                                                                                                                                                                                                                                                                                                                                         
     814               0 :     }                                                                                                                                                                                                                                                                                                                                             
     815                 :                                                                                                                                                                                                                                                                                                                                                   
     816                 :     /**                                                                                                                                                                                                                                                                                                                                           
     817                 :      * Acquire script identification image or logo.                                                                                                                                                                                                                                                                                               
     818                 :      *                                                                                                                                                                                                                                                                                                                                            
     819                 :      * @deprecated                                                                                                                                                                                                                                                                                                                                
     820                 :      * @param string $menu_link                                                                                                                                                                                                                                                                                                                   
     821                 :      * @param string $active_plugin                                                                                                                                                                                                                                                                                                               
     822                 :      */                                                                                                                                                                                                                                                                                                                                           
     823                 :     public function script_logo ($menu_link, $active_plugin, $alias = null)                                                                                                                                                                                                                                                                       
     824                 :     {                                                                                                                                                                                                                                                                                                                                             
     825               0 :         return $this->scriptLogo($menu_link, $active_plugin, $alias);                                                                                                                                                                                                                                                                             
     826                 :     }                                                                                                                                                                                                                                                                                                                                             
     827                 :                                                                                                                                                                                                                                                                                                                                                   
     828                 :     /**                                                                                                                                                                                                                                                                                                                                           
     829                 :      * Loads the default or custom template (tpl) file and prints it out.                                                                                                                                                                                                                                                                         
     830                 :      * Enter the template file for appropriate script here.                                                                                                                                                                                                                                                                                       
     831                 :      *                                                                                                                                                                                                                                                                                                                                            
     832                 :      * @param string The name of the template to be loaded                                                                                                                                                                                                                                                                                        
     833                 :      * @param string If another plugin is to be used in the directory.                                                                                                                                                                                                                                                                            
     834                 :      */                                                                                                                                                                                                                                                                                                                                           
     835                 :     public function show ($load_template=false, $plugin=false)                                                                                                                                                                                                                                                                                    
     836                 :     {                                                                                                                                                                                                                                                                                                                                             
     837               0 :         $this->view->show($load_template, $plugin);                                                                                                                                                                                                                                                                                               
     838               0 :     }                                                                                                                                                                                                                                                                                                                                             
     839                 :                                                                                                                                                                                                                                                                                                                                                   
     840                 :     /**                                                                                                                                                                                                                                                                                                                                           
     841                 :      * Loads the default or custom template (tpl) file and prints it out.                                                                                                                                                                                                                                                                         
     842                 :      * Enter the template file for appropriate script here.                                                                                                                                                                                                                                                                                       
     843                 :      *                                                                                                                                                                                                                                                                                                                                            
     844                 :      * @param string The name of the template to be loaded                                                                                                                                                                                                                                                                                        
     845                 :      * @param string If another plugin is to be used in the directory.                                                                                                                                                                                                                                                                            
     846                 :      */                                                                                                                                                                                                                                                                                                                                           
     847                 :     public function display ($load_template=false, $plugin=false)                                                                                                                                                                                                                                                                                 
     848                 :     {                                                                                                                                                                                                                                                                                                                                             
     849               0 :         $this->view->show($load_template, $plugin);                                                                                                                                                                                                                                                                                               
     850               0 :     }                                                                                                                                                                                                                                                                                                                                             
     851                 :                                                                                                                                                                                                                                                                                                                                                   
     852                 :     /**                                                                                                                                                                                                                                                                                                                                           
     853                 :      * Sets Smarty variables to be passed to it.                                                                                                                                                                                                                                                                                                  
     854                 :      * Alias of assign.                                                                                                                                                                                                                                                                                                                           
     855                 :      *                                                                                                                                                                                                                                                                                                                                            
     856                 :      * @param mixed $var                                                                                                                                                                                                                                                                                                                          
     857                 :      * @param mixed $value                                                                                                                                                                                                                                                                                                                        
     858                 :      */                                                                                                                                                                                                                                                                                                                                           
     859                 :     public function set ($var, $value)                                                                                                                                                                                                                                                                                                            
     860                 :     {                                                                                                                                                                                                                                                                                                                                             
     861               0 :         $this->view->assign($var, $value);                                                                                                                                                                                                                                                                                                        
     862               0 :     }                                                                                                                                                                                                                                                                                                                                             
     863                 :                                                                                                                                                                                                                                                                                                                                                   
     864                 :     /**                                                                                                                                                                                                                                                                                                                                           
     865                 :      * Sets Smarty variables to be passed to it.                                                                                                                                                                                                                                                                                                  
     866                 :      * Alias of assign.                                                                                                                                                                                                                                                                                                                           
     867                 :      *                                                                                                                                                                                                                                                                                                                                            
     868                 :      * @param mixed $var                                                                                                                                                                                                                                                                                                                          
     869                 :      * @param mixed $value                                                                                                                                                                                                                                                                                                                        
     870                 :      */                                                                                                                                                                                                                                                                                                                                           
     871                 :     public function assign ($var, $value)                                                                                                                                                                                                                                                                                                         
     872                 :     {                                                                                                                                                                                                                                                                                                                                             
     873               0 :         $this->view->assign($var, $value);                                                                                                                                                                                                                                                                                                        
     874               0 :     }                                                                                                                                                                                                                                                                                                                                             
     875                 :                                                                                                                                                                                                                                                                                                                                                   
     876                 :     /**                                                                                                                                                                                                                                                                                                                                           
     877                 :      * Loads the default or custom template (tpl) file and returns results.                                                                                                                                                                                                                                                                       
     878                 :      * Enter the template file for appropriate script here.                                                                                                                                                                                                                                                                                       
     879                 :      *                                                                                                                                                                                                                                                                                                                                            
     880                 :      * @param string The name of the template to be loaded                                                                                                                                                                                                                                                                                        
     881                 :      * @param string If another plugin is to be used in the directory.                                                                                                                                                                                                                                                                            
     882                 :      */                                                                                                                                                                                                                                                                                                                                           
     883                 :     public function dofetch ($var, $value)                                                                                                                                                                                                                                                                                                        
     884                 :     {                                                                                                                                                                                                                                                                                                                                             
     885               0 :         return $this->view->dofetch($var, $value);                                                                                                                                                                                                                                                                                                
     886                 :     }                                                                                                                                                                                                                                                                                                                                             
     887                 :                                                                                                                                                                                                                                                                                                                                                   
     888                 :     /**                                                                                                                                                                                                                                                                                                                                           
     889                 :      * Loads the default or custom template (tpl) file and returns results.                                                                                                                                                                                                                                                                       
     890                 :      * Enter the template file for appropriate script here.                                                                                                                                                                                                                                                                                       
     891                 :      *                                                                                                                                                                                                                                                                                                                                            
     892                 :      * @param string The name of the template to be loaded                                                                                                                                                                                                                                                                                        
     893                 :      * @param string If another plugin is to be used in the directory.                                                                                                                                                                                                                                                                            
     894                 :      */                                                                                                                                                                                                                                                                                                                                           
     895                 :     public function fetch ($var, $value)                                                                                                                                                                                                                                                                                                          
     896                 :     {                                                                                                                                                                                                                                                                                                                                             
     897               0 :         return $this->view->dofetch($var, $value);                                                                                                                                                                                                                                                                                                
     898                 :     }                                                                                                                                                                                                                                                                                                                                             
     899                 :                                                                                                                                                                                                                                                                                                                                                   
     900                 :     /**                                                                                                                                                                                                                                                                                                                                           
     901                 :      * Convert all HTML entities to their applicable characters.                                                                                                                                                                                                                                                                                  
     902                 :      *                                                                                                                                                                                                                                                                                                                                            
     903                 :      * @param string $string_to_decode                                                                                                                                                                                                                                                                                                            
     904                 :      * @return string                                                                                                                                                                                                                                                                                                                             
     905                 :      */                                                                                                                                                                                                                                                                                                                                           
     906                 :     public function html_entity_decode ($string_to_decode)                                                                                                                                                                                                                                                                                        
     907                 :     {                                                                                                                                                                                                                                                                                                                                             
     908                 :         // Decode characters.                                                                                                                                                                                                                                                                                                                     
     909               0 :         return $this->htmlEntityDecode($string_to_decode);                                                                                                                                                                                                                                                                                        
     910                 :     }                                                                                                                                                                                                                                                                                                                                             
     911                 : }                                                                                                                                                                                                                                                                                                                                                 
     912                 : /**                                                                                                                                                                                                                                                                                                                                               
     913                 :  * Creates a language tooltip string and prints it out to the template.                                                                                                                                                                                                                                                                           
     914                 :  *                                                                                                                                                                                                                                                                                                                                                
     915                 :  * @param string $info_mark                                                                                                                                                                                                                                                                                                                       
     916                 :  */                                                                                                                                                                                                                                                                                                                                               
     917               1 : function _i ($info_mark)                                                                                                                                                                                                                                                                                                                          
     918                 : {                                                                                                                                                                                                                                                                                                                                                 
     919               0 :     global $template;                                                                                                                                                                                                                                                                                                                             
     920               0 :     $template->tip(_($info_mark), true);                                                                                                                                                                                                                                                                                                          
     921               0 : }                                                                                                                                                                                                                                                                                                                                                 
     922                 : /**                                                                                                                                                                                                                                                                                                                                               
     923                 :  * Creates a language tooltip string inside a text domain and prints it out to the template.                                                                                                                                                                                                                                                      
     924                 :  *                                                                                                                                                                                                                                                                                                                                                
     925                 :  * @param string $info_mark                                                                                                                                                                                                                                                                                                                       
     926                 :  */                                                                                                                                                                                                                                                                                                                                               
     927               1 : function __i ($info_mark, $domain)                                                                                                                                                                                                                                                                                                                
     928                 : {                                                                                                                                                                                                                                                                                                                                                 
     929               0 :     global $template;                                                                                                                                                                                                                                                                                                                             
     930               0 :     $template->tip(dgettext($domain,$info_mark), true);                                                                                                                                                                                                                                                                                           
     931               0 : }                                                                                                                                                                                                                                                                                                                                                 
     932                 : ?>                                                                                                                                                                                                                                                                                                                                                

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.