includes/template.php
changeset 243 a7d0f2711df1
parent 231 b11a2f1353c0
child 244 09f8a9a03ccf
equal deleted inserted replaced
241:c671f3bb8aed 243:a7d0f2711df1
  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     if ( defined('IN_ENANO_INSTALL') )
       
  1929     {
       
  1930       $headers .= '<script type="text/javascript" src="install.php?mode=langjs"></script>';
       
  1931     }
       
  1932     
  1926     // The rewritten template engine will process all required vars during the load_template stage instead of (cough) re-processing everything each time around.
  1933     // 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(
  1934     $tpl_strings = Array(
  1928       'PAGE_NAME'=>$this_page,
  1935       'PAGE_NAME'=>$this_page,
  1929       'PAGE_URLNAME'=>'Null',
  1936       'PAGE_URLNAME'=>'Null',
  1930       'SITE_NAME'=>'Enano Installation',
  1937       'SITE_NAME'=>$lang->get('meta_site_name'),
  1931       'USERNAME'=>'admin',
  1938       'USERNAME'=>'admin',
  1932       'SITE_DESC'=>'Install Enano on your server.',
  1939       'SITE_DESC'=>$lang->get('meta_site_desc'),
  1933       'TOOLBAR'=>$tb,
  1940       'TOOLBAR'=>$tb,
  1934       'SCRIPTPATH'=>scriptPath,
  1941       'SCRIPTPATH'=>scriptPath,
  1935       'CONTENTPATH'=>contentPath,
  1942       'CONTENTPATH'=>contentPath,
  1936       'ADMIN_SID_QUES'=>$asq,
  1943       'ADMIN_SID_QUES'=>$asq,
  1937       'ADMIN_SID_AMP'=>$asa,
  1944       'ADMIN_SID_AMP'=>$asa,
  1938       'ADMIN_SID_AMP_HTML'=>'',
  1945       '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>',
  1946       'ADDITIONAL_HEADERS'=>$headers,
  1940       'SIDEBAR_EXTRA'=>'',
  1947       '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.',
  1948       'COPYRIGHT'=>$lang->get('meta_enano_copyright'),
  1942       'TOOLBAR_EXTRAS'=>'',
  1949       'TOOLBAR_EXTRAS'=>'',
  1943       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
  1950       'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'],
  1944       'STYLE_LINK'=>$slink,
  1951       'STYLE_LINK'=>$slink,
  1945       'LOGOUT_LINK'=>'',
  1952       'LOGOUT_LINK'=>'',
  1946       'THEME_LINK'=>'',
  1953       'THEME_LINK'=>'',
  1947       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
  1954       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
  1948       'THEME_ID'=>$this->theme,
  1955       'THEME_ID'=>$this->theme,
  1949       'STYLE_ID'=>$this->style,
  1956       '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>',
  1957       '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=\'\'; var ENANO_LANG_ID = \'0\';</script>',
  1951       'SIDEBAR_RIGHT'=>'',
  1958       'SIDEBAR_RIGHT'=>'',
  1952       );
  1959       );
  1953     $this->tpl_strings = array_merge($tpl_strings, $this->tpl_strings);
  1960     $this->tpl_strings = array_merge($tpl_strings, $this->tpl_strings);
  1954     
  1961     
  1955     $sidebar = ( gettype($sideinfo) == 'string' ) ? $sideinfo : '';
  1962     $sidebar = ( gettype($sideinfo) == 'string' ) ? $sideinfo : '';
  1962       } else {
  1969       } else {
  1963         $top = '';
  1970         $top = '';
  1964       }
  1971       }
  1965       $p = $this->makeParserText($tplvars['sidebar_section']);
  1972       $p = $this->makeParserText($tplvars['sidebar_section']);
  1966       $p->assign_vars(Array(
  1973       $p->assign_vars(Array(
  1967           'TITLE'=>'Installation progress',
  1974           'TITLE'=>$lang->get('meta_sidebar_heading'),
  1968           'CONTENT'=>$sidebar,
  1975           'CONTENT'=>$sidebar,
  1969         ));
  1976         ));
  1970       $sidebar = $p->run();
  1977       $sidebar = $p->run();
  1971       if(isset($tplvars['sidebar_bottom']))
  1978       if(isset($tplvars['sidebar_bottom']))
  1972       {
  1979       {