includes/template.php
changeset 582 a38876c0793c
parent 581 5e8fd89c02ea
child 585 35e91d16ecf5
equal deleted inserted replaced
581:5e8fd89c02ea 582:a38876c0793c
   295     $this->plugin_blocks[$t] = $parser->run();
   295     $this->plugin_blocks[$t] = $parser->run();
   296     $this->sidebar_widgets .= $parser->run();
   296     $this->sidebar_widgets .= $parser->run();
   297   }
   297   }
   298   function add_header($html)
   298   function add_header($html)
   299   {
   299   {
   300     $this->additional_headers .= "\n" . $html;
   300     /* debug only **
       
   301     $bt = debug_backtrace();
       
   302     $bt = $bt[1];
       
   303     $this->additional_headers .= "\n    <!-- {$bt['file']}:{$bt['line']} -->\n    " . $html;
       
   304     */
       
   305     $this->additional_headers .= "\n   " . $html;
   301   }
   306   }
   302   function get_css($s = false)
   307   function get_css($s = false)
   303   {
   308   {
   304     global $db, $session, $paths, $template, $plugins; // Common objects
   309     global $db, $session, $paths, $template, $plugins; // Common objects
   305     if(!defined('ENANO_TEMPLATE_LOADED'))
   310     if(!defined('ENANO_TEMPLATE_LOADED'))
   975     $p = ( isset($_GET['printable']) ) ? '/printable' : '';
   980     $p = ( isset($_GET['printable']) ) ? '/printable' : '';
   976     
   981     
   977     // Add the e-mail address client code to the header
   982     // Add the e-mail address client code to the header
   978     $this->add_header($email->jscode());
   983     $this->add_header($email->jscode());
   979     
   984     
   980     // Add language file
       
   981     $lang_uri = makeUrlNS('Special', 'LangExportJSON/' . $lang->lang_id, false, true);
       
   982     $this->add_header("<script type=\"text/javascript\" src=\"$lang_uri\"></script>");
       
   983     
       
   984     // Generate the code for the Log out and Change theme sidebar buttons
   985     // Generate the code for the Log out and Change theme sidebar buttons
   985     // Once again, the new template parsing system can be used here
   986     // Once again, the new template parsing system can be used here
   986     
   987     
   987     $parser = $this->makeParserText($tplvars['sidebar_button']);
   988     $parser = $this->makeParserText($tplvars['sidebar_button']);
   988     
   989     
  1059       var prot = ' . ( ($protected) ? 'true' : 'false' ) .'; // No, hacking this var won\'t work, it\'s re-checked on the server
  1060       var prot = ' . ( ($protected) ? 'true' : 'false' ) .'; // No, hacking this var won\'t work, it\'s re-checked on the server
  1060       var ENANO_SPECIAL_CREATEPAGE = \''. makeUrl($paths->nslist['Special'].'CreatePage') .'\';
  1061       var ENANO_SPECIAL_CREATEPAGE = \''. makeUrl($paths->nslist['Special'].'CreatePage') .'\';
  1061       var ENANO_CREATEPAGE_PARAMS = \'_do=&pagename='. $urlname_clean .'&namespace=' . $local_namespace . '\';
  1062       var ENANO_CREATEPAGE_PARAMS = \'_do=&pagename='. $urlname_clean .'&namespace=' . $local_namespace . '\';
  1062       var ENANO_SPECIAL_CHANGESTYLE = \''. makeUrlNS('Special', 'ChangeStyle') .'\';
  1063       var ENANO_SPECIAL_CHANGESTYLE = \''. makeUrlNS('Special', 'ChangeStyle') .'\';
  1063       var namespace_list = new Array();
  1064       var namespace_list = new Array();
       
  1065       var msg_loading_component = \'' . addslashes($lang->get('ajax_msg_loading_component')) . '\';
  1064       var AES_BITS = '.AES_BITS.';
  1066       var AES_BITS = '.AES_BITS.';
  1065       var AES_BLOCKSIZE = '.AES_BLOCKSIZE.';
  1067       var AES_BLOCKSIZE = '.AES_BLOCKSIZE.';
  1066       var pagepass = \''. ( ( isset($_REQUEST['pagepass']) ) ? sha1($_REQUEST['pagepass']) : '' ) .'\';
  1068       var pagepass = \''. ( ( isset($_REQUEST['pagepass']) ) ? sha1($_REQUEST['pagepass']) : '' ) .'\';
  1067       var ENANO_THEME_LIST = \'';
  1069       var ENANO_THEME_LIST = \'';
  1068           foreach($this->theme_list as $t) {
  1070           foreach($this->theme_list as $t) {
  1095       'ADMIN_SID_QUES'=>$asq,
  1097       'ADMIN_SID_QUES'=>$asq,
  1096       'ADMIN_SID_AMP'=>$asa,
  1098       'ADMIN_SID_AMP'=>$asa,
  1097       'ADMIN_SID_AMP_HTML'=>$ash,
  1099       'ADMIN_SID_AMP_HTML'=>$ash,
  1098       'ADMIN_SID_AUTO'=>$as2,
  1100       'ADMIN_SID_AUTO'=>$as2,
  1099       'ADMIN_SID_RAW'=> ( is_string($session->sid_super) ? $session->sid_super : '' ),
  1101       'ADMIN_SID_RAW'=> ( is_string($session->sid_super) ? $session->sid_super : '' ),
  1100       'ADDITIONAL_HEADERS'=>$this->additional_headers,
       
  1101       'COPYRIGHT'=>RenderMan::parse_internal_links(getConfig('copyright_notice')),
  1102       'COPYRIGHT'=>RenderMan::parse_internal_links(getConfig('copyright_notice')),
  1102       'TOOLBAR_EXTRAS'=>$this->toolbar_menu,
  1103       'TOOLBAR_EXTRAS'=>$this->toolbar_menu,
  1103       'REQUEST_URI'=>$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
  1104       'REQUEST_URI'=>$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
  1104       'STYLE_LINK'=>makeUrlNS('Special', 'CSS'.$p, null, true), //contentPath.$paths->nslist['Special'].'CSS' . $p,
  1105       'STYLE_LINK'=>makeUrlNS('Special', 'CSS'.$p, null, true), //contentPath.$paths->nslist['Special'].'CSS' . $p,
  1105       'LOGIN_LINK'=>$login_link,
  1106       'LOGIN_LINK'=>$login_link,
  1127     
  1128     
  1128     list($this->tpl_strings['SIDEBAR_LEFT'], $this->tpl_strings['SIDEBAR_RIGHT'], $min) = $this->fetch_sidebar();
  1129     list($this->tpl_strings['SIDEBAR_LEFT'], $this->tpl_strings['SIDEBAR_RIGHT'], $min) = $this->fetch_sidebar();
  1129     $this->tpl_bool['sidebar_left']  = ( $this->tpl_strings['SIDEBAR_LEFT']  != $min) ? true : false;
  1130     $this->tpl_bool['sidebar_left']  = ( $this->tpl_strings['SIDEBAR_LEFT']  != $min) ? true : false;
  1130     $this->tpl_bool['sidebar_right'] = ( $this->tpl_strings['SIDEBAR_RIGHT'] != $min) ? true : false;
  1131     $this->tpl_bool['sidebar_right'] = ( $this->tpl_strings['SIDEBAR_RIGHT'] != $min) ? true : false;
  1131     $this->tpl_bool['right_sidebar'] = $this->tpl_bool['sidebar_right']; // backward compatibility
  1132     $this->tpl_bool['right_sidebar'] = $this->tpl_bool['sidebar_right']; // backward compatibility
       
  1133     
       
  1134     // and finally one that needs to be symlinked...
       
  1135     if ( !isset($this->tpl_strings['ADDITIONAL_HEADERS']) )
       
  1136     {
       
  1137       $this->tpl_strings['ADDITIONAL_HEADERS'] =& $this->additional_headers;
       
  1138     }
  1132     
  1139     
  1133     $code = $plugins->setHook('template_var_init_end');
  1140     $code = $plugins->setHook('template_var_init_end');
  1134     foreach ( $code as $cmd )
  1141     foreach ( $code as $cmd )
  1135     {
  1142     {
  1136       eval($cmd);
  1143       eval($cmd);