includes/template.php
changeset 578 02bc119a6dd3
parent 577 5118610ce160
child 579 6e23d8a99616
equal deleted inserted replaced
577:5118610ce160 578:02bc119a6dd3
    13  */
    13  */
    14  
    14  
    15 class template
    15 class template
    16 {
    16 {
    17   var $tpl_strings, $tpl_bool, $vars_assign_history, $theme, $style, $no_headers, $additional_headers, $sidebar_extra, $sidebar_widgets, $toolbar_menu, $theme_list, $named_theme_list, $default_theme, $default_style, $plugin_blocks, $namespace_string, $style_list, $theme_loaded, $initted_to_page_id, $initted_to_namespace;
    17   var $tpl_strings, $tpl_bool, $vars_assign_history, $theme, $style, $no_headers, $additional_headers, $sidebar_extra, $sidebar_widgets, $toolbar_menu, $theme_list, $named_theme_list, $default_theme, $default_style, $plugin_blocks, $namespace_string, $style_list, $theme_loaded, $initted_to_page_id, $initted_to_namespace;
       
    18   
       
    19   var $initted_to_theme = array(
       
    20       'theme' => false,
       
    21       'style' => false
       
    22     );
    18   
    23   
    19   /**
    24   /**
    20    * The list of themes that are critical for Enano operation. This doesn't include oxygen which
    25    * The list of themes that are critical for Enano operation. This doesn't include oxygen which
    21    * remains a user theme. By default this is admin and printable which have to be loaded on demand.
    26    * remains a user theme. By default this is admin and printable which have to be loaded on demand.
    22    * @var array
    27    * @var array
   340   }
   345   }
   341   
   346   
   342   /**
   347   /**
   343    * Initializes all variables related to on-page content. This includes sidebars and what have you.
   348    * Initializes all variables related to on-page content. This includes sidebars and what have you.
   344    * @param object Optional PageProcessor object to use for passing metadata and permissions on. If omitted, uses information from $paths and $session.
   349    * @param object Optional PageProcessor object to use for passing metadata and permissions on. If omitted, uses information from $paths and $session.
   345    */
   350    * @param bool If true, re-inits even if already initted with this page_id and namespace
   346   
   351    */
   347   function init_vars($page = false)
   352   
       
   353   function init_vars($page = false, $force_init = false)
   348   {
   354   {
   349     global $db, $session, $paths, $template, $plugins; // Common objects
   355     global $db, $session, $paths, $template, $plugins; // Common objects
   350     global $email;
   356     global $email;
   351     global $lang;
   357     global $lang;
   352     
   358     
   393       $local_page_exists =& $paths->page_exists;
   399       $local_page_exists =& $paths->page_exists;
   394       $local_page_protected =& $paths->page_protected;
   400       $local_page_protected =& $paths->page_protected;
   395       $perms =& $session;
   401       $perms =& $session;
   396     }
   402     }
   397     
   403     
   398     if ( $local_page_id === $this->initted_to_page_id && $local_namespace === $this->initted_to_namespace )
   404     if ( $local_page_id === $this->initted_to_page_id && $local_namespace === $this->initted_to_namespace && $this->theme === $this->initted_to_theme['theme'] && $this->style === $this->initted_to_theme['style'] && !$force_init )
   399     {
   405     {
   400       // we're already initted with this page.
   406       // we're already initted with this page.
   401       return true;
   407       return true;
   402     }
   408     }
   403     
   409     
   404     $this->initted_to_page_id = $local_page_id;
   410     $this->initted_to_page_id = $local_page_id;
   405     $this->initted_to_namespace = $local_namespace;
   411     $this->initted_to_namespace = $local_namespace;
       
   412     $this->initted_to_theme = array(
       
   413         'theme' => $this->theme,
       
   414         'style' => $this->style
       
   415       );
   406     
   416     
   407     if ( $local_page_exists && isset($paths->pages[$local_page]) )
   417     if ( $local_page_exists && isset($paths->pages[$local_page]) )
   408     {
   418     {
   409       $local_cdata =& $paths->pages[$local_page];
   419       $local_cdata =& $paths->pages[$local_page];
   410     }
   420     }