includes/template.php
changeset 274 2d4bb97fa75a
parent 272 e0ec986c0af3
child 276 acfdccf7a2bf
equal deleted inserted replaced
273:96524a56d475 274:2d4bb97fa75a
   820       
   820       
   821       global $_starttime;
   821       global $_starttime;
   822       if(isset($_GET['sqldbg']) && $session->get_permissions('mod_misc'))
   822       if(isset($_GET['sqldbg']) && $session->get_permissions('mod_misc'))
   823       {
   823       {
   824         echo '<h3>Query list as requested on URI</h3><pre style="margin-left: 1em">';
   824         echo '<h3>Query list as requested on URI</h3><pre style="margin-left: 1em">';
   825         echo $db->sql_backtrace();
   825         echo htmlspecialchars($db->sql_backtrace());
   826         echo '</pre>';
   826         echo '</pre>';
   827       }
   827       }
   828       
   828       
   829       $f = microtime_float();
   829       $f = microtime_float();
   830       $f = $f - $_starttime;
   830       $f = $f - $_starttime;
  1801     $this->tpl_bool    = Array();
  1801     $this->tpl_bool    = Array();
  1802     $this->tpl_strings = Array();
  1802     $this->tpl_strings = Array();
  1803     $this->sidebar_extra = '';
  1803     $this->sidebar_extra = '';
  1804     $this->sidebar_widgets = '';
  1804     $this->sidebar_widgets = '';
  1805     $this->toolbar_menu = '';
  1805     $this->toolbar_menu = '';
  1806     $this->additional_headers = '';
  1806     $this->additional_headers = '<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>';
  1807     
  1807     
  1808     $this->theme_list = Array(Array(
  1808     $this->theme_list = Array(Array(
  1809       'theme_id'=>'oxygen',
  1809       'theme_id'=>'oxygen',
  1810       'theme_name'=>'Oxygen',
  1810       'theme_name'=>'Oxygen',
  1811       'theme_order'=>1,
  1811       'theme_order'=>1,
  1826     $this->style = $css;
  1826     $this->style = $css;
  1827     
  1827     
  1828     $this->tpl_strings['SCRIPTPATH'] = scriptPath;
  1828     $this->tpl_strings['SCRIPTPATH'] = scriptPath;
  1829     if ( $auto_init )
  1829     if ( $auto_init )
  1830       $this->init_vars();
  1830       $this->init_vars();
       
  1831   }
       
  1832   function add_header($html)
       
  1833   {
       
  1834     $this->additional_headers .= "\n<!-- ----------------------------------------------------------- -->\n\n    " . $html;
  1831   }
  1835   }
  1832   function init_vars()
  1836   function init_vars()
  1833   {
  1837   {
  1834     global $sideinfo;
  1838     global $sideinfo;
  1835     global $this_page;
  1839     global $this_page;
  1873       'SCRIPTPATH'=>scriptPath,
  1877       'SCRIPTPATH'=>scriptPath,
  1874       'CONTENTPATH'=>contentPath,
  1878       'CONTENTPATH'=>contentPath,
  1875       'ADMIN_SID_QUES'=>$asq,
  1879       'ADMIN_SID_QUES'=>$asq,
  1876       'ADMIN_SID_AMP'=>$asa,
  1880       'ADMIN_SID_AMP'=>$asa,
  1877       'ADMIN_SID_AMP_HTML'=>'',
  1881       'ADMIN_SID_AMP_HTML'=>'',
  1878       'ADDITIONAL_HEADERS'=>'<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>',
  1882       'ADDITIONAL_HEADERS'=>$this->additional_headers,
  1879       'SIDEBAR_EXTRA'=>'',
  1883       'SIDEBAR_EXTRA'=>'',
  1880       'COPYRIGHT'=>'Enano and all of its code, graphics, and more code is copyright &copy; 2006 Dan Fuhry.<br />This program is Free Software; see the file "GPL" included with this package for details.',
  1884       'COPYRIGHT'=>'Enano and all of its code, graphics, and more code is copyright &copy; 2006 Dan Fuhry.<br />This program is Free Software; see the file "GPL" included with this package for details.',
  1881       'TOOLBAR_EXTRAS'=>'',
  1885       'TOOLBAR_EXTRAS'=>'',
  1882       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
  1886       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
  1883       'STYLE_LINK'=>$slink,
  1887       'STYLE_LINK'=>$slink,
  1921     $this->tpl_bool['sidebar_left']  = ( $this->tpl_strings['SIDEBAR_LEFT']  != '') ? true : false;
  1925     $this->tpl_bool['sidebar_left']  = ( $this->tpl_strings['SIDEBAR_LEFT']  != '') ? true : false;
  1922     $this->tpl_bool['sidebar_right'] = ( $this->tpl_strings['SIDEBAR_RIGHT'] != '') ? true : false;
  1926     $this->tpl_bool['sidebar_right'] = ( $this->tpl_strings['SIDEBAR_RIGHT'] != '') ? true : false;
  1923     $this->tpl_bool['right_sidebar'] = $this->tpl_bool['sidebar_right']; // backward compatibility
  1927     $this->tpl_bool['right_sidebar'] = $this->tpl_bool['sidebar_right']; // backward compatibility
  1924     $this->tpl_bool['stupid_mode'] = true;
  1928     $this->tpl_bool['stupid_mode'] = true;
  1925   }
  1929   }
  1926   function header() 
  1930   function header($simple = false) 
  1927   {
  1931   {
  1928     if(!$this->no_headers) echo $this->process_template('header.tpl');
  1932     $filename = ( $simple ) ? 'simple-header.tpl' : 'header.tpl';
  1929   }
  1933     if ( !$this->no_headers )
  1930   function footer()
  1934     {
       
  1935       echo $this->process_template($filename);
       
  1936     }
       
  1937   }
       
  1938   function footer($simple = false)
  1931   {
  1939   {
  1932     global $db, $session, $paths, $template, $plugins; // Common objects
  1940     global $db, $session, $paths, $template, $plugins; // Common objects
  1933     if(!$this->no_headers) {
  1941     if(!$this->no_headers) {
  1934       global $_starttime;
  1942       global $_starttime;
  1935       
  1943       
  1938       $f = round($f, 4);
  1946       $f = round($f, 4);
  1939       if(defined('IN_ENANO_INSTALL')) $nq = 'N/A';
  1947       if(defined('IN_ENANO_INSTALL')) $nq = 'N/A';
  1940       else $nq = $db->num_queries;
  1948       else $nq = $db->num_queries;
  1941       if($nq == 0) $nq = 'N/A';
  1949       if($nq == 0) $nq = 'N/A';
  1942       $dbg = 'Time: '.$f.'s  |  Queries: '.$nq;
  1950       $dbg = 'Time: '.$f.'s  |  Queries: '.$nq;
  1943       $t = $this->process_template('footer.tpl');
  1951       $filename = ( $simple ) ? 'simple-footer.tpl' : 'footer.tpl';
       
  1952       $t = $this->process_template($filename);
  1944       $t = str_replace('[[Stats]]', $dbg, $t);
  1953       $t = str_replace('[[Stats]]', $dbg, $t);
  1945       if ( is_object($db) )
  1954       if ( is_object($db) )
  1946       {
  1955       {
  1947         $t = str_replace('[[NumQueries]]', (string)$db->num_queries, $t);
  1956         $t = str_replace('[[NumQueries]]', (string)$db->num_queries, $t);
  1948       }
  1957       }