/** * Builds entire debug module window * prints it by default. * * @access private */ function doDebug() { // 2006-08-12, SD: new option 'DEBUG_WITHOUT_JAVASCRIPT' if ($this->OPTIONS['DEBUG_WITHOUT_JAVASCRIPT']) { $vLIBtmpl = new vlibTemplate($this->VLIBTEMPLATE_DEBUGMOD_NO_JAVASCRIPT); } else { $vLIBtmpl = new vlibTemplate($this->VLIBTEMPLATE_DEBUGMOD); } // set vars needed for JavaScript in popup window $filename_enc = md5($this->_tmplfilename); $vLIBtmpl->setvar('vLIB_template_name', $this->_tmplfilename); $vLIBtmpl->setvar('filename_enc', $filename_enc); // grab the vars and loops array ob_start(); print_r($this->_arrvars); $vLIB_allarrvars = ob_get_contents(); ob_end_clean(); ob_start(); print_r($this->_vars); $vLIB_allvars = ob_get_contents(); ob_end_clean(); $vLIBtmpl->setvar('vLIB_allarrvars', wordwrap($vLIB_allarrvars, 70, "\n", 1)); $vLIBtmpl->setvar('vLIB_allvars', wordwrap($vLIB_allvars, 70, "\n", 1)); $vLIBtmpl->setvar('vLIB_num_global_vars', count($this->_vars) ? count($this->_vars) : '0'); $vLIBtmpl->setvar('vLIB_num_top_level_loops', count($this->_arrvars) ? count($this->_arrvars) : '0'); // get all files included using <tmpl_include> $incdpaths = ""; foreach ($this->_debugIncludedfiles as $v) { $incdpaths .= $v . '<br>'; } // get the Options and some other stuff $params = array('vlibTemplate Root' => $this->VLIBTEMPLATE_ROOT); foreach ($this->OPTIONS as $option => $value) { empty($value) and $value = '<i>null</i>'; is_array($value) and $value = join('<br>', $value); $params[$option] = $value; } $paramsarr = array(); foreach ($params as $k => $v) { array_push($paramsarr, array('param_name' => $k, 'param_value' => $v)); } $vLIBtmpl->setloop('vLIB_list_params', $paramsarr); // template vars and stuff $filesarr = array(); if (!is_array($this->_debugTemplatevars['include'])) { $this->_debugTemplatevars['include'] = array(); } foreach ($this->_debugTemplatevars['include'] as $v) { array_push($filesarr, array('filename' => $v)); } $vLIBtmpl->setloop('vLIB_include_files', $filesarr); $varsarr = array(); if (!is_array($this->_debugTemplatevars['var'])) { $this->_debugTemplatevars['var'] = array(); } foreach ($this->_debugTemplatevars['var'] as $v) { array_push($varsarr, array('varname' => $v)); } $vLIBtmpl->setloop('vLIB_vars', $varsarr); $ifsarr = array(); if (!is_array($this->_debugTemplatevars['if'])) { $this->_debugTemplatevars['if'] = array(); } foreach ($this->_debugTemplatevars['if'] as $v) { array_push($ifsarr, array('ifname' => $v)); } $vLIBtmpl->setloop('vLIB_ifs', $ifsarr); $elseifsarr = array(); if (!is_array($this->_debugTemplatevars['elseif'])) { $this->_debugTemplatevars['elseif'] = array(); } foreach ($this->_debugTemplatevars['elseif'] as $v) { array_push($elseifsarr, array('elseifname' => $v)); } $vLIBtmpl->setloop('vLIB_elseifs', $elseifsarr); $unlessarr = array(); if (!is_array($this->_debugTemplatevars['unless'])) { $this->_debugTemplatevars['unless'] = array(); } foreach ($this->_debugTemplatevars['unless'] as $v) { array_push($unlessarr, array('unlessname' => $v)); } $vLIBtmpl->setloop('vLIB_unless', $unlessarr); $loopsarr = array(); if (!is_array($this->_debugTemplatevars['loop'])) { $this->_debugTemplatevars['loop'] = array(); } foreach ($this->_debugTemplatevars['loop'] as $v) { array_push($loopsarr, array('loopname' => $v)); } $vLIBtmpl->setloop('vLIB_loops', $loopsarr); $varsarr = array(); foreach ($this->_vars as $k => $v) { array_push($varsarr, array('varname' => $k)); } $vLIBtmpl->setloop('vLIB_tmplvars', $varsarr); $loopsarr = array(); $loopst = array_keys($this->_arrvars); foreach ($loopst as $v) { array_push($loopsarr, array('loopname' => $v)); } $vLIBtmpl->setloop('vLIB_tmplloops', $loopsarr); $this->doDebugParse(); // does real debugging $warningsarr = array(); if (count($this->_debugwarningmsgs) > 0) { $vLIBtmpl->setvar('warnings', 1); } foreach ($this->_debugwarningmsgs as $v) { $vals = array_values($v); list($problem, $detail, $location) = $vals; array_push($warningsarr, array('problem' => $problem, 'detail' => $detail, 'location' => $location)); } $vLIBtmpl->setloop('vLIB_warnings', $warningsarr); // finally grab and echo in JS formatted way $output = $vLIBtmpl->grab(); // 2006-08-12, SD: new option 'DEBUG_WITHOUT_JAVASCRIPT' if ($this->OPTIONS['DEBUG_WITHOUT_JAVASCRIPT']) { $wrapper_tmpl = new vlibTemplate($this->VLIBTEMPLATE_DEBUGWRAPPER_NO_JAVASCRIPT); } else { $wrapper_tmpl = new vlibTemplate($this->VLIBTEMPLATE_DEBUGWRAPPER); } $filename = $this->_tmplfilename; $filename = str_replace('\\', "\\\\", $filename); $filename = str_replace('\'', "\\'", $filename); $filename = str_replace("\r", '', $filename); $filename = str_replace("\n", "\\n", $filename); $filename = str_replace("\t", "\\t", $filename); $wrapper_tmpl->setVar('filename', $filename); $wrapper_tmpl->setvar('filename_enc', $filename_enc); $wrapper_tmpl->setvar('securecode', md5(time())); // 2006-08-12, SD: new option 'DEBUG_WITHOUT_JAVASCRIPT' if ($this->OPTIONS['DEBUG_WITHOUT_JAVASCRIPT']) { $wrapper_tmpl->setVar('debug_content', $output); } else { $wrapper_tmpl->setVar('debug_content', $this->enjavanate($output, 120)); } $wrapper_tmpl->pparse(); }
/** * @brief Print the HTML footer * * @param array $messages @li the messages which should be displayed at the bottom of the site * @li Example: array('text' => 'this is a message', 'strong' => true, 'color' => 'red') * @param string $messages_div_title If this is a non-empty string, and there are messages to display, * the messages will be displayed in a box with this title. * * @throws Exception if there was an error */ public function print_footer($messages = array(), $messages_div_title = '') { global $config; $vlib_foot = BASE . '/templates/' . $this->meta['theme'] . '/vlib_foot.tmpl'; if (!is_readable($vlib_foot)) { debug('error', 'File "' . $vlib_foot . '" not found!', __FILE__, __LINE__, __METHOD__); throw new Exception('Template Footer-Datei "' . $vlib_foot . '" wurde nicht gefunden!'); } if ($config['debug']['template_debugging_enable']) { include_once BASE . '/lib/vlib/vlibTemplate/debug.php'; $tmpl = new vlibTemplateDebug($vlib_foot); } else { $tmpl = new vlibTemplate($vlib_foot); } $tmpl->setVar('relative_path', BASE_RELATIVE . '/'); // constant from start_session.php $tmpl->setVar('frameset', $this->meta['frameset']); // messages if (is_array($messages) && count($messages) > 0) { $tmpl->setLoop('messages', $messages); $tmpl->setVar('messages_div_title', $messages_div_title); } $tmpl->pparse(); }