includes/template.php
changeset 245 54392ae2c222
parent 244 09f8a9a03ccf
child 248 ed13b72b13cc
equal deleted inserted replaced
242:78a94f7bb5e3 245:54392ae2c222
  1892   }
  1892   }
  1893   function init_vars()
  1893   function init_vars()
  1894   {
  1894   {
  1895     global $sideinfo;
  1895     global $sideinfo;
  1896     global $this_page;
  1896     global $this_page;
       
  1897     global $lang;
  1897     global $db, $session, $paths, $template, $plugins; // Common objects
  1898     global $db, $session, $paths, $template, $plugins; // Common objects
  1898     $tplvars = $this->extract_vars('elements.tpl');
  1899     $tplvars = $this->extract_vars('elements.tpl');
  1899     $tb = '';
  1900     $tb = '';
  1900     // Get the "article" button text (depends on namespace)
  1901     // Get the "article" button text (depends on namespace)
  1901     if(defined('IN_ENANO_INSTALL')) $ns = 'installation page';
  1902     if(defined('IN_ENANO_INSTALL')) $ns = $lang->get('meta_btn_article');
  1902     else $ns = 'system error page';
  1903     else $ns = 'system error page';
  1903     $t = str_replace('{FLAGS}', 'onclick="if ( !KILL_SWITCH ) { return false; }" title="Hey! A button that doesn\'t do anything. Clever..." accesskey="a"', $tplvars['toolbar_button']);
  1904     $t = str_replace('{FLAGS}', 'onclick="return false;" title="Hey! A button that doesn\'t do anything. Clever..." accesskey="a"', $tplvars['toolbar_button']);
  1904     $t = str_replace('{HREF}', '#', $t);
  1905     $t = str_replace('{HREF}', '#', $t);
  1905     $t = str_replace('{TEXT}', $ns, $t);
  1906     $t = str_replace('{TEXT}', $ns, $t);
  1906     $tb .= $t;
  1907     $tb .= $t;
  1907     
  1908     
  1908     // Page toolbar
  1909     // Page toolbar
  1921     $this->tpl_bool['fixed_menus'] = false;
  1922     $this->tpl_bool['fixed_menus'] = false;
  1922     $slink = defined('IN_ENANO_INSTALL') ? scriptPath.'/install.php?mode=css' : makeUrlNS('Special', 'CSS');
  1923     $slink = defined('IN_ENANO_INSTALL') ? scriptPath.'/install.php?mode=css' : makeUrlNS('Special', 'CSS');
  1923     
  1924     
  1924     $title = ( is_object($paths) ) ? $paths->page : 'Critical error';
  1925     $title = ( is_object($paths) ) ? $paths->page : 'Critical error';
  1925     
  1926     
       
  1927     $headers = '<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>';
       
  1928     
       
  1929     $js_dynamic = '';
       
  1930     if ( defined('IN_ENANO_INSTALL') )
       
  1931     {
       
  1932       $js_dynamic .= '<script type="text/javascript" src="install.php?mode=langjs"></script>';
       
  1933     }
       
  1934     $js_dynamic .= '<script type="text/javascript">var title="'. $title .'"; var scriptPath="'.scriptPath.'"; var ENANO_SID=""; var AES_BITS='.AES_BITS.'; var AES_BLOCKSIZE=' . AES_BLOCKSIZE . '; var pagepass=\'\'; var ENANO_LANG_ID = 1;</script>';
       
  1935     
  1926     // The rewritten template engine will process all required vars during the load_template stage instead of (cough) re-processing everything each time around.
  1936     // The rewritten template engine will process all required vars during the load_template stage instead of (cough) re-processing everything each time around.
  1927     $tpl_strings = Array(
  1937     $tpl_strings = Array(
  1928       'PAGE_NAME'=>$this_page,
  1938       'PAGE_NAME'=>$this_page,
  1929       'PAGE_URLNAME'=>'Null',
  1939       'PAGE_URLNAME'=>'Null',
  1930       'SITE_NAME'=>'Enano Installation',
  1940       'SITE_NAME'=>$lang->get('meta_site_name'),
  1931       'USERNAME'=>'admin',
  1941       'USERNAME'=>'admin',
  1932       'SITE_DESC'=>'Install Enano on your server.',
  1942       'SITE_DESC'=>$lang->get('meta_site_desc'),
  1933       'TOOLBAR'=>$tb,
  1943       'TOOLBAR'=>$tb,
  1934       'SCRIPTPATH'=>scriptPath,
  1944       'SCRIPTPATH'=>scriptPath,
  1935       'CONTENTPATH'=>contentPath,
  1945       'CONTENTPATH'=>contentPath,
  1936       'ADMIN_SID_QUES'=>$asq,
  1946       'ADMIN_SID_QUES'=>$asq,
  1937       'ADMIN_SID_AMP'=>$asa,
  1947       'ADMIN_SID_AMP'=>$asa,
  1938       'ADMIN_SID_AMP_HTML'=>'',
  1948       'ADMIN_SID_AMP_HTML'=>'',
  1939       'ADDITIONAL_HEADERS'=>'<style type="text/css">div.pagenav { border-top: 1px solid #CCC; padding-top: 7px; margin-top: 10px; }</style>',
  1949       'ADDITIONAL_HEADERS'=>$headers,
  1940       'SIDEBAR_EXTRA'=>'',
  1950       'SIDEBAR_EXTRA'=>'',
  1941       '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.',
  1951       'COPYRIGHT'=>$lang->get('meta_enano_copyright'),
  1942       'TOOLBAR_EXTRAS'=>'',
  1952       'TOOLBAR_EXTRAS'=>'',
  1943       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
  1953       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
  1944       'STYLE_LINK'=>$slink,
  1954       'STYLE_LINK'=>$slink,
  1945       'LOGOUT_LINK'=>'',
  1955       'LOGOUT_LINK'=>'',
  1946       'THEME_LINK'=>'',
  1956       'THEME_LINK'=>'',
  1947       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
  1957       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
  1948       'THEME_ID'=>$this->theme,
  1958       'THEME_ID'=>$this->theme,
  1949       'STYLE_ID'=>$this->style,
  1959       'STYLE_ID'=>$this->style,
  1950       'JS_DYNAMIC_VARS'=>'<script type="text/javascript">var title="'. $title .'"; var scriptPath="'.scriptPath.'"; var ENANO_SID=""; var AES_BITS='.AES_BITS.'; var AES_BLOCKSIZE=' . AES_BLOCKSIZE . '; var pagepass=\'\';</script>',
  1960       'JS_DYNAMIC_VARS'=>$js_dynamic,
  1951       'SIDEBAR_RIGHT'=>'',
  1961       'SIDEBAR_RIGHT'=>'',
  1952       );
  1962       );
  1953     $this->tpl_strings = array_merge($tpl_strings, $this->tpl_strings);
  1963     $this->tpl_strings = array_merge($tpl_strings, $this->tpl_strings);
  1954     
  1964     
  1955     $sidebar = ( gettype($sideinfo) == 'string' ) ? $sideinfo : '';
  1965     $sidebar = ( gettype($sideinfo) == 'string' ) ? $sideinfo : '';
  1962       } else {
  1972       } else {
  1963         $top = '';
  1973         $top = '';
  1964       }
  1974       }
  1965       $p = $this->makeParserText($tplvars['sidebar_section']);
  1975       $p = $this->makeParserText($tplvars['sidebar_section']);
  1966       $p->assign_vars(Array(
  1976       $p->assign_vars(Array(
  1967           'TITLE'=>'Installation progress',
  1977           'TITLE'=>$lang->get('meta_sidebar_heading'),
  1968           'CONTENT'=>$sidebar,
  1978           'CONTENT'=>$sidebar,
  1969         ));
  1979         ));
  1970       $sidebar = $p->run();
  1980       $sidebar = $p->run();
  1971       if(isset($tplvars['sidebar_bottom']))
  1981       if(isset($tplvars['sidebar_bottom']))
  1972       {
  1982       {