includes/template.php
changeset 279 8acd77a6c19d
parent 266 917dcc6c4ceb
parent 276 acfdccf7a2bf
child 304 e2cb5f1432c8
equal deleted inserted replaced
278:53ba55d33abb 279:8acd77a6c19d
   849       
   849       
   850       global $_starttime;
   850       global $_starttime;
   851       if(isset($_GET['sqldbg']) && $session->get_permissions('mod_misc'))
   851       if(isset($_GET['sqldbg']) && $session->get_permissions('mod_misc'))
   852       {
   852       {
   853         echo '<h3>Query list as requested on URI</h3><pre style="margin-left: 1em">';
   853         echo '<h3>Query list as requested on URI</h3><pre style="margin-left: 1em">';
   854         echo $db->sql_backtrace();
   854         echo htmlspecialchars($db->sql_backtrace());
   855         echo '</pre>';
   855         echo '</pre>';
   856       }
   856       }
   857       
   857       
   858       $f = microtime_float();
   858       $f = microtime_float();
   859       $f = $f - $_starttime;
   859       $f = $f - $_starttime;
  1854  * A version of the template compiler that does not rely at all on the other parts of Enano. Used during installation and for showing
  1854  * A version of the template compiler that does not rely at all on the other parts of Enano. Used during installation and for showing
  1855  * "critical error" messages. ** REQUIRES ** the Oxygen theme.
  1855  * "critical error" messages. ** REQUIRES ** the Oxygen theme.
  1856  */
  1856  */
  1857 
  1857 
  1858 class template_nodb {
  1858 class template_nodb {
  1859   var $tpl_strings, $tpl_bool, $theme, $style, $no_headers, $additional_headers, $sidebar_extra, $sidebar_widgets, $toolbar_menu, $theme_list;
  1859   var $fading_button, $tpl_strings, $tpl_bool, $theme, $style, $no_headers, $additional_headers, $sidebar_extra, $sidebar_widgets, $toolbar_menu, $theme_list;
  1860   function __construct() {
  1860   function __construct() {
  1861     
  1861     
  1862     $this->tpl_bool    = Array();
  1862     $this->tpl_bool    = Array();
  1863     $this->tpl_strings = Array();
  1863     $this->tpl_strings = Array();
  1864     $this->sidebar_extra = '';
  1864     $this->sidebar_extra = '';
  1865     $this->sidebar_widgets = '';
  1865     $this->sidebar_widgets = '';
  1866     $this->toolbar_menu = '';
  1866     $this->toolbar_menu = '';
  1867     $this->additional_headers = '';
  1867     $this->additional_headers = '<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>';
       
  1868     
       
  1869     $this->fading_button = '<div style="background-image: url('.scriptPath.'/images/about-powered-enano-hover.png); background-repeat: no-repeat; width: 88px; height: 31px; margin: 0 auto 5px auto;">
       
  1870                               <a href="http://enanocms.org/" onclick="window.open(this.href); return false;"><img style="border-width: 0;" alt=" " src="'.scriptPath.'/images/about-powered-enano.png" onmouseover="domOpacity(this, 100, 0, 500);" onmouseout="domOpacity(this, 0, 100, 500);" /></a>
       
  1871                             </div>';
  1868     
  1872     
  1869     $this->theme_list = Array(Array(
  1873     $this->theme_list = Array(Array(
  1870       'theme_id'=>'oxygen',
  1874       'theme_id'=>'oxygen',
  1871       'theme_name'=>'Oxygen',
  1875       'theme_name'=>'Oxygen',
  1872       'theme_order'=>1,
  1876       'theme_order'=>1,
  1887     $this->style = $css;
  1891     $this->style = $css;
  1888     
  1892     
  1889     $this->tpl_strings['SCRIPTPATH'] = scriptPath;
  1893     $this->tpl_strings['SCRIPTPATH'] = scriptPath;
  1890     if ( $auto_init )
  1894     if ( $auto_init )
  1891       $this->init_vars();
  1895       $this->init_vars();
       
  1896   }
       
  1897   function add_header($html)
       
  1898   {
       
  1899     $this->additional_headers .= "\n<!-- ----------------------------------------------------------- -->\n\n    " . $html;
  1892   }
  1900   }
  1893   function init_vars()
  1901   function init_vars()
  1894   {
  1902   {
  1895     global $sideinfo;
  1903     global $sideinfo;
  1896     global $this_page;
  1904     global $this_page;
  1944       'SCRIPTPATH'=>scriptPath,
  1952       'SCRIPTPATH'=>scriptPath,
  1945       'CONTENTPATH'=>contentPath,
  1953       'CONTENTPATH'=>contentPath,
  1946       'ADMIN_SID_QUES'=>$asq,
  1954       'ADMIN_SID_QUES'=>$asq,
  1947       'ADMIN_SID_AMP'=>$asa,
  1955       'ADMIN_SID_AMP'=>$asa,
  1948       'ADMIN_SID_AMP_HTML'=>'',
  1956       'ADMIN_SID_AMP_HTML'=>'',
  1949       'ADDITIONAL_HEADERS'=>$headers,
  1957       'ADDITIONAL_HEADERS'=>$this->additional_headers,
  1950       'SIDEBAR_EXTRA'=>'',
  1958       'SIDEBAR_EXTRA'=>'',
  1951       'COPYRIGHT'=>$lang->get('meta_enano_copyright'),
  1959       'COPYRIGHT'=>$lang->get('meta_enano_copyright'),
  1952       'TOOLBAR_EXTRAS'=>'',
  1960       'TOOLBAR_EXTRAS'=>'',
  1953       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
  1961       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
  1954       'STYLE_LINK'=>$slink,
  1962       'STYLE_LINK'=>$slink,
  1992     $this->tpl_bool['sidebar_left']  = ( $this->tpl_strings['SIDEBAR_LEFT']  != '') ? true : false;
  2000     $this->tpl_bool['sidebar_left']  = ( $this->tpl_strings['SIDEBAR_LEFT']  != '') ? true : false;
  1993     $this->tpl_bool['sidebar_right'] = ( $this->tpl_strings['SIDEBAR_RIGHT'] != '') ? true : false;
  2001     $this->tpl_bool['sidebar_right'] = ( $this->tpl_strings['SIDEBAR_RIGHT'] != '') ? true : false;
  1994     $this->tpl_bool['right_sidebar'] = $this->tpl_bool['sidebar_right']; // backward compatibility
  2002     $this->tpl_bool['right_sidebar'] = $this->tpl_bool['sidebar_right']; // backward compatibility
  1995     $this->tpl_bool['stupid_mode'] = true;
  2003     $this->tpl_bool['stupid_mode'] = true;
  1996   }
  2004   }
  1997   function header() 
  2005   function header($simple = false) 
  1998   {
  2006   {
  1999     if(!$this->no_headers) echo $this->process_template('header.tpl');
  2007     $filename = ( $simple ) ? 'simple-header.tpl' : 'header.tpl';
  2000   }
  2008     if ( !$this->no_headers )
  2001   function footer()
  2009     {
       
  2010       echo $this->process_template($filename);
       
  2011     }
       
  2012   }
       
  2013   function footer($simple = false)
  2002   {
  2014   {
  2003     global $db, $session, $paths, $template, $plugins; // Common objects
  2015     global $db, $session, $paths, $template, $plugins; // Common objects
  2004     if(!$this->no_headers) {
  2016     if(!$this->no_headers) {
  2005       global $_starttime;
  2017       global $_starttime;
  2006       
  2018       
  2009       $f = round($f, 4);
  2021       $f = round($f, 4);
  2010       if(defined('IN_ENANO_INSTALL')) $nq = 'N/A';
  2022       if(defined('IN_ENANO_INSTALL')) $nq = 'N/A';
  2011       else $nq = $db->num_queries;
  2023       else $nq = $db->num_queries;
  2012       if($nq == 0) $nq = 'N/A';
  2024       if($nq == 0) $nq = 'N/A';
  2013       $dbg = 'Time: '.$f.'s  |  Queries: '.$nq;
  2025       $dbg = 'Time: '.$f.'s  |  Queries: '.$nq;
  2014       $t = $this->process_template('footer.tpl');
  2026       $filename = ( $simple ) ? 'simple-footer.tpl' : 'footer.tpl';
       
  2027       $t = $this->process_template($filename);
  2015       $t = str_replace('[[Stats]]', $dbg, $t);
  2028       $t = str_replace('[[Stats]]', $dbg, $t);
  2016       if ( is_object($db) )
  2029       if ( is_object($db) )
  2017       {
  2030       {
  2018         $t = str_replace('[[NumQueries]]', (string)$db->num_queries, $t);
  2031         $t = str_replace('[[NumQueries]]', (string)$db->num_queries, $t);
  2019       }
  2032       }