| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * Smarty Internal Plugin Debug | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |  * Class to collect data for the Smarty Debugging Console | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Debug | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Uwe Tews | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * Smarty Internal Plugin Debug Class | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Debug | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | class Smarty_Internal_Debug extends Smarty_Internal_Data | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * template data | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public $template_data = array(); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * List of uid's which shall be ignored | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public $ignore_uid = array(); | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * Index of display() and fetch() calls | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public $index = 0; | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Counter for window offset | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @var int | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public $offset = 0; | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Start logging template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param \Smarty_Internal_Template $template template | 
					
						
							| 
									
										
										
										
											2015-09-15 00:18:17 +02:00
										 |  |  |      * @param null                      $mode     true: display   false: fetch  null: subtemplate | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function start_template(Smarty_Internal_Template $template, $mode = null) | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |         if (isset($mode) && !$template->_isSubTpl()) { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |             $this->index ++; | 
					
						
							|  |  |  |             $this->offset ++; | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $this->template_data[ $this->index ] = null; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         $key = $this->get_key($template); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true); | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * End logging of cache time | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param \Smarty_Internal_Template $template cached template | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function end_template(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         $key = $this->get_key($template); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->template_data[ $this->index ][ $key ][ 'total_time' ] += | 
					
						
							|  |  |  |             microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ]; | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         //$this->template_data[$this->index][$key]['properties'] = $template->properties;
 | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Start logging of compile time | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param \Smarty_Internal_Template $template | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function start_compile(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |         static $_is_stringy = array('string' => true, 'eval' => true); | 
					
						
							|  |  |  |         if (!empty($template->compiler->trace_uid)) { | 
					
						
							|  |  |  |             $key = $template->compiler->trace_uid; | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if (!isset($this->template_data[ $this->index ][ $key ])) { | 
					
						
							|  |  |  |                 if (isset($_is_stringy[ $template->source->type ])) { | 
					
						
							|  |  |  |                     $this->template_data[ $this->index ][ $key ][ 'name' ] = | 
					
						
							| 
									
										
										
										
											2015-09-15 00:18:17 +02:00
										 |  |  |                         '\'' . substr($template->source->name, 0, 25) . '...\''; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0; | 
					
						
							|  |  |  |                 $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; | 
					
						
							|  |  |  |                 $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if (isset($this->ignore_uid[ $template->source->uid ])) { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                 return; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |             $key = $this->get_key($template); | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * End logging of compile time | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param \Smarty_Internal_Template $template | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function end_compile(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |         if (!empty($template->compiler->trace_uid)) { | 
					
						
							|  |  |  |             $key = $template->compiler->trace_uid; | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if (isset($this->ignore_uid[ $template->source->uid ])) { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                 return; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |             $key = $this->get_key($template); | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->template_data[ $this->index ][ $key ][ 'compile_time' ] += | 
					
						
							|  |  |  |             microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Start logging of render time | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param \Smarty_Internal_Template $template | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function start_render(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         $key = $this->get_key($template); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * End logging of compile time | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param \Smarty_Internal_Template $template | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function end_render(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         $key = $this->get_key($template); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->template_data[ $this->index ][ $key ][ 'render_time' ] += | 
					
						
							|  |  |  |             microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-11-11 22:09:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Start logging of cache time | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param \Smarty_Internal_Template $template cached template | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function start_cache(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         $key = $this->get_key($template); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-11-11 22:09:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * End logging of cache time | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-13 18:04:29 +02:00
										 |  |  |      * @param \Smarty_Internal_Template $template cached template | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function end_cache(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         $key = $this->get_key($template); | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->template_data[ $this->index ][ $key ][ 'cache_time' ] += | 
					
						
							|  |  |  |             microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ]; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Register template object | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param \Smarty_Internal_Template $template cached template | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function register_template(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Register data object | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param \Smarty_Data $data data object | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |     public static function register_data(Smarty_Data $data) | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * Opens a window for the Smarty Debugging Console and display the data | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @param Smarty_Internal_Template|Smarty $obj object to debug | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param bool                            $full | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function display_debug($obj, $full = false) | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |         if (!$full) { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |             $this->offset ++; | 
					
						
							|  |  |  |             $savedIndex = $this->index; | 
					
						
							|  |  |  |             $this->index = 9999; | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |         $smarty = $obj->_getSmartyObj(); | 
					
						
							| 
									
										
										
										
											2015-05-13 18:04:29 +02:00
										 |  |  |         // create fresh instance of smarty for displaying the debug console
 | 
					
						
							|  |  |  |         // to avoid problems if the application did overload the Smarty class
 | 
					
						
							|  |  |  |         $debObj = new Smarty(); | 
					
						
							|  |  |  |         // copy the working dirs from application
 | 
					
						
							|  |  |  |         $debObj->setCompileDir($smarty->getCompileDir()); | 
					
						
							|  |  |  |         // init properties by hand as user may have edited the original Smarty class
 | 
					
						
							|  |  |  |         $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir()); | 
					
						
							|  |  |  |         $debObj->force_compile = false; | 
					
						
							|  |  |  |         $debObj->compile_check = true; | 
					
						
							|  |  |  |         $debObj->left_delimiter = '{'; | 
					
						
							|  |  |  |         $debObj->right_delimiter = '}'; | 
					
						
							|  |  |  |         $debObj->security_policy = null; | 
					
						
							|  |  |  |         $debObj->debugging = false; | 
					
						
							|  |  |  |         $debObj->debugging_ctrl = 'NONE'; | 
					
						
							|  |  |  |         $debObj->error_reporting = E_ALL & ~E_NOTICE; | 
					
						
							|  |  |  |         $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl'; | 
					
						
							|  |  |  |         $debObj->registered_plugins = array(); | 
					
						
							|  |  |  |         $debObj->registered_resources = array(); | 
					
						
							|  |  |  |         $debObj->registered_filters = array(); | 
					
						
							|  |  |  |         $debObj->autoload_filters = array(); | 
					
						
							|  |  |  |         $debObj->default_modifiers = array(); | 
					
						
							|  |  |  |         $debObj->escape_html = true; | 
					
						
							|  |  |  |         $debObj->caching = false; | 
					
						
							|  |  |  |         $debObj->compile_id = null; | 
					
						
							|  |  |  |         $debObj->cache_id = null; | 
					
						
							|  |  |  |         // prepare information of assigned variables
 | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         $ptr = $this->get_debug_vars($obj); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $_assigned_vars = $ptr->tpl_vars; | 
					
						
							|  |  |  |         ksort($_assigned_vars); | 
					
						
							|  |  |  |         $_config_vars = $ptr->config_vars; | 
					
						
							|  |  |  |         ksort($_config_vars); | 
					
						
							| 
									
										
										
										
											2015-05-13 18:04:29 +02:00
										 |  |  |         $debugging = $smarty->debugging; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj); | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |         if ($obj->_isTplObj()) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-08-23 01:50:05 +02:00
										 |  |  |         if ($obj->_objType == 1 || $full) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $_template->assign('template_data', $this->template_data[ $this->index ]); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             $_template->assign('template_data', null); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         $_template->assign('assigned_vars', $_assigned_vars); | 
					
						
							|  |  |  |         $_template->assign('config_vars', $_config_vars); | 
					
						
							|  |  |  |         $_template->assign('execution_time', microtime(true) - $smarty->start_time); | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |         $_template->assign('display_mode', $debugging == 2 || !$full); | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |         $_template->assign('offset', $this->offset * 50); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         echo $_template->fetch(); | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |         if (isset($full)) { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |             $this->index --; | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |         if (!$full) { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |             $this->index = $savedIndex; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-11-11 22:09:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Recursively gets variables from all template/data scopes | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  Smarty_Internal_Template|Smarty_Data $obj object to debug | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @return StdClass | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function get_debug_vars($obj) | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |         $config_vars = array(); | 
					
						
							|  |  |  |         foreach ($obj->config_vars as $key => $var) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $config_vars[ $key ][ 'value' ] = $var; | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |             if ($obj->_isTplObj()) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name; | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |             } elseif ($obj->_isDataObj()) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $config_vars[ $key ][ 'scope' ] = 'Smarty object'; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $tpl_vars = array(); | 
					
						
							|  |  |  |         foreach ($obj->tpl_vars as $key => $var) { | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |             foreach ($var as $varkey => $varvalue) { | 
					
						
							|  |  |  |                 if ($varkey == 'value') { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     $tpl_vars[ $key ][ $varkey ] = $varvalue; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |                     if ($varkey == 'nocache') { | 
					
						
							|  |  |  |                         if ($varvalue == true) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                             $tpl_vars[ $key ][ $varkey ] = $varvalue; | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |                         } | 
					
						
							|  |  |  |                     } else { | 
					
						
							|  |  |  |                         if ($varkey != 'scope' || $varvalue !== 0) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                             $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |             if ($obj->_isTplObj()) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name; | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |             } elseif ($obj->_isDataObj()) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $tpl_vars[ $key ][ 'scope' ] = 'Smarty object'; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-11 22:09:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         if (isset($obj->parent)) { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |             $parent = $this->get_debug_vars($obj->parent); | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |             foreach ($parent->tpl_vars as $name => $pvar) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { | 
					
						
							|  |  |  |                     $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars); | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |             foreach ($parent->config_vars as $name => $pvar) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { | 
					
						
							|  |  |  |                     $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $config_vars = array_merge($parent->config_vars, $config_vars); | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |             foreach (Smarty::$global_tpl_vars as $key => $var) { | 
					
						
							|  |  |  |                 if (!array_key_exists($key, $tpl_vars)) { | 
					
						
							|  |  |  |                     foreach ($var as $varkey => $varvalue) { | 
					
						
							|  |  |  |                         if ($varkey == 'value') { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                             $tpl_vars[ $key ][ $varkey ] = $varvalue; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |                         } else { | 
					
						
							|  |  |  |                             if ($varkey == 'nocache') { | 
					
						
							|  |  |  |                                 if ($varvalue == true) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                                     $tpl_vars[ $key ][ $varkey ] = $varvalue; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |                                 } | 
					
						
							|  |  |  |                             } else { | 
					
						
							|  |  |  |                                 if ($varkey != 'scope' || $varvalue !== 0) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                                     $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue; | 
					
						
							| 
									
										
										
										
											2014-11-03 22:27:32 +01:00
										 |  |  |                                 } | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     $tpl_vars[ $key ][ 'scope' ] = 'Global'; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-11-11 22:09:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Return key into $template_data for template | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |      * @param \Smarty_Internal_Template $template template object | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @return string key into $template_data | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     private function get_key(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-10-01 18:10:48 +00:00
										 |  |  |         static $_is_stringy = array('string' => true, 'eval' => true); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         // calculate Uid if not already done
 | 
					
						
							|  |  |  |         if ($template->source->uid == '') { | 
					
						
							|  |  |  |             $template->source->filepath; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         $key = $template->source->uid; | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($this->template_data[ $this->index ][ $key ])) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             return $key; | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if (isset($_is_stringy[ $template->source->type ])) { | 
					
						
							|  |  |  |                 $this->template_data[ $this->index ][ $key ][ 'name' ] = | 
					
						
							| 
									
										
										
										
											2015-09-15 00:18:17 +02:00
										 |  |  |                     '\'' . substr($template->source->name, 0, 25) . '...\''; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                 $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0; | 
					
						
							|  |  |  |             $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; | 
					
						
							|  |  |  |             $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; | 
					
						
							|  |  |  |             $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0; | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             return $key; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Ignore template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param \Smarty_Internal_Template $template | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |     public function ignore(Smarty_Internal_Template $template) | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |         // calculate Uid if not already done
 | 
					
						
							|  |  |  |         if ($template->source->uid == '') { | 
					
						
							|  |  |  |             $template->source->filepath; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $this->ignore_uid[ $template->source->uid ] = true; | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * handle 'URL' debugging mode | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-12-13 10:16:10 +01:00
										 |  |  |      * @param Smarty $smarty | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-12-13 10:16:10 +01:00
										 |  |  |     public function debugUrl(Smarty $smarty) | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($_SERVER[ 'QUERY_STRING' ])) { | 
					
						
							|  |  |  |             $_query_string = $_SERVER[ 'QUERY_STRING' ]; | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             $_query_string = ''; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-12-13 10:16:10 +01:00
										 |  |  |         if (false !== strpos($_query_string, $smarty->smarty_debug_id)) { | 
					
						
							|  |  |  |             if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) { | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  |                 // enable debugging for this browser session
 | 
					
						
							|  |  |  |                 setcookie('SMARTY_DEBUG', true); | 
					
						
							| 
									
										
										
										
											2015-12-13 10:16:10 +01:00
										 |  |  |                 $smarty->debugging = true; | 
					
						
							|  |  |  |             } elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) { | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  |                 // disable debugging for this browser session
 | 
					
						
							|  |  |  |                 setcookie('SMARTY_DEBUG', false); | 
					
						
							| 
									
										
										
										
											2015-12-13 10:16:10 +01:00
										 |  |  |                 $smarty->debugging = false; | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  |             } else { | 
					
						
							|  |  |  |                 // enable debugging for this page
 | 
					
						
							| 
									
										
										
										
											2015-12-13 10:16:10 +01:00
										 |  |  |                 $smarty->debugging = true; | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) { | 
					
						
							| 
									
										
										
										
											2015-12-13 10:16:10 +01:00
										 |  |  |                 $smarty->debugging = true; | 
					
						
							| 
									
										
										
										
											2014-12-30 17:17:15 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-12-01 21:19:20 +00:00
										 |  |  | } |