includes/template.php
changeset 957 6b7644fec887
parent 953 323c4cd1aa37
child 971 bc8f3ab74e5e
equal deleted inserted replaced
955:de4f81abc5e3 957:6b7644fec887
   334     $this->additional_headers .= "\n   " . $html;
   334     $this->additional_headers .= "\n   " . $html;
   335   }
   335   }
   336   function get_css($s = false)
   336   function get_css($s = false)
   337   {
   337   {
   338     global $db, $session, $paths, $template, $plugins; // Common objects
   338     global $db, $session, $paths, $template, $plugins; // Common objects
   339     if(!defined('ENANO_TEMPLATE_LOADED'))
   339     $this->init_vars();
   340       $this->load_theme($session->theme, $session->style);
   340     
   341     $path = ( $s ) ? 'css/'.$s : 'css/'.$this->style.'.css';
   341     $path = ( $s ) ? 'css/'.$s : 'css/'.$this->style.'.css';
       
   342     
   342     if ( !file_exists(ENANO_ROOT . '/themes/' . $this->theme . '/' . $path) )
   343     if ( !file_exists(ENANO_ROOT . '/themes/' . $this->theme . '/' . $path) )
   343     {
   344     {
   344       echo "/* WARNING: Falling back to default file because file $path does not exist */\n";
   345       echo "/* WARNING: Falling back to default file because file $path does not exist */\n";
   345       $path = 'css/' . $this->style_list[0] . '.css';
   346       $path = 'css/' . $this->style_list[0] . '.css';
   346     }
   347     }
   347     return '<enano:no-opt>' . $this->process_template($path) . '</enano:no-opt>';
   348     
       
   349     return $this->process_template($path);
   348   }
   350   }
   349   function load_theme($name = false, $css = false)
   351   function load_theme($name = false, $css = false)
   350   {
   352   {
   351     global $db, $session, $paths, $template, $plugins; // Common objects
   353     global $db, $session, $paths, $template, $plugins; // Common objects
   352     $this->theme = ( $name ) ? $name : $session->theme;
   354     $this->theme = ( $name ) ? $name : $session->theme;
   637         'SIDEBAR_LINK' => $sidebar_link,
   639         'SIDEBAR_LINK' => $sidebar_link,
   638         'THEME_ID' => $this->theme,
   640         'THEME_ID' => $this->theme,
   639         'STYLE_ID' => $this->style
   641         'STYLE_ID' => $this->style
   640       ));
   642       ));
   641     
   643     
       
   644     // Add the site description sidebar block
       
   645     $this->sidebar_widget($lang->get('sidebar_title_about'), '<p>' . htmlspecialchars(getConfig('site_desc')) . '</p>');
       
   646     
   642     $this->theme_initted = true;
   647     $this->theme_initted = true;
   643   }
   648   }
   644   
   649   
   645   /**
   650   /**
   646    * Init page vars, like the toolbar, local JS, etc.
   651    * Init page vars, like the toolbar, local JS, etc.
   871     }
   876     }
   872     
   877     
   873     // Protect button
   878     // Protect button
   874     if ( $conds['protect'] )
   879     if ( $conds['protect'] )
   875     {
   880     {
   876       switch($this->page->ns->page_protected)
   881       switch($this->page->ns->cdata['protected'])
   877       {
   882       {
   878         case PROTECT_FULL: $protect_status = $lang->get('onpage_btn_protect_on'); break;
   883         case PROTECT_FULL: $protect_status = $lang->get('onpage_btn_protect_on'); break;
   879         case PROTECT_SEMI: $protect_status = $lang->get('onpage_btn_protect_semi'); break;
   884         case PROTECT_SEMI: $protect_status = $lang->get('onpage_btn_protect_semi'); break;
   880         case PROTECT_NONE: $protect_status = $lang->get('onpage_btn_protect_off'); break;
   885         case PROTECT_NONE: $protect_status = $lang->get('onpage_btn_protect_off'); break;
   881       }
   886       }
   883       $label = $this->makeParserText($this->elements['toolbar_label']);
   888       $label = $this->makeParserText($this->elements['toolbar_label']);
   884       $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_protect') . ' ' . "<b><span id=\"tb_ajax_protect_status\">$protect_status</span></b>"));
   889       $label->assign_vars(array('TEXT' => $lang->get('onpage_lbl_protect') . ' ' . "<b><span id=\"tb_ajax_protect_status\">$protect_status</span></b>"));
   885       $t0 = $label->run();
   890       $t0 = $label->run();
   886       
   891       
   887       $menubtn->assign_vars(array(
   892       $menubtn->assign_vars(array(
   888           'FLAGS' => 'accesskey="p" onclick="ajaxProtect(' . $this->page->ns->page_protected . '); return false;" id="tb_ajax_protect_btn" title="' . $lang->get('onpage_tip_protect') . '"',
   893           'FLAGS' => 'accesskey="p" onclick="ajaxProtect(' . $this->page->ns->cdata['protected'] . '); return false;" id="tb_ajax_protect_btn" title="' . $lang->get('onpage_tip_protect') . '"',
   889           'HREF' => makeUrl($local_page, 'do=protect', true),
   894           'HREF' => makeUrl($local_page, 'do=protect', true),
   890           'TEXT' => $lang->get('onpage_btn_protect_change')
   895           'TEXT' => $lang->get('onpage_btn_protect_change')
   891         ));
   896         ));
   892       $t1 = $menubtn->run();
   897       $t1 = $menubtn->run();
   893       
   898       
  2861     {
  2866     {
  2862       return false;
  2867       return false;
  2863     }
  2868     }
  2864     return $ds;
  2869     return $ds;
  2865   }
  2870   }
  2866   function get_css($s = false) {
  2871   function get_css($s = false)
  2867     if($s)
  2872   {
       
  2873     if ( $s )
  2868       return $this->process_template('css/'.$s);
  2874       return $this->process_template('css/'.$s);
  2869     else
  2875     else
  2870       return $this->process_template('css/'.$this->style.'.css');
  2876       return $this->process_template('css/'.$this->style.'.css');
  2871   }
  2877   }
  2872   function load_theme($name, $css, $auto_init = true)
  2878   function load_theme($name, $css, $auto_init = true)