31 var $fading_button = ''; |
31 var $fading_button = ''; |
32 |
32 |
33 function __construct() |
33 function __construct() |
34 { |
34 { |
35 global $db, $session, $paths, $template, $plugins; // Common objects |
35 global $db, $session, $paths, $template, $plugins; // Common objects |
36 dc_here('template: initializing all class variables'); |
|
37 $this->tpl_bool = Array(); |
36 $this->tpl_bool = Array(); |
38 $this->tpl_strings = Array(); |
37 $this->tpl_strings = Array(); |
39 $this->sidebar_extra = ''; |
38 $this->sidebar_extra = ''; |
40 $this->toolbar_menu = ''; |
39 $this->toolbar_menu = ''; |
41 $this->additional_headers = ''; |
40 $this->additional_headers = ''; |
135 { |
134 { |
136 global $db, $session, $paths, $template, $plugins; // Common objects |
135 global $db, $session, $paths, $template, $plugins; // Common objects |
137 global $email; |
136 global $email; |
138 global $lang; |
137 global $lang; |
139 |
138 |
140 dc_here("template: initializing all variables"); |
|
141 |
|
142 if(!$this->theme || !$this->style) |
139 if(!$this->theme || !$this->style) |
143 { |
140 { |
144 $this->load_theme(); |
141 $this->load_theme(); |
145 } |
142 } |
146 |
143 |
147 if(defined('ENANO_TEMPLATE_LOADED')) |
144 if(defined('ENANO_TEMPLATE_LOADED')) |
148 { |
145 { |
149 dc_here('template: access denied to call template::init_vars(), bailing out'); |
|
150 die_semicritical('Illegal call', '<p>$template->load_theme was called multiple times, this is not supposed to happen. Exiting with fatal error.</p>'); |
146 die_semicritical('Illegal call', '<p>$template->load_theme was called multiple times, this is not supposed to happen. Exiting with fatal error.</p>'); |
151 } |
147 } |
152 |
148 |
153 define('ENANO_TEMPLATE_LOADED', ''); |
149 define('ENANO_TEMPLATE_LOADED', ''); |
154 |
150 |
155 $tplvars = $this->extract_vars('elements.tpl'); |
151 $tplvars = $this->extract_vars('elements.tpl'); |
156 |
|
157 dc_here('template: setting all template vars'); |
|
158 |
152 |
159 if(isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) |
153 if(isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) |
160 { |
154 { |
161 $this->add_header(' |
155 $this->add_header(' |
162 <!--[if lt IE 7]> |
156 <!--[if lt IE 7]> |
225 $ns = $lang->get('onpage_lbl_page_project'); |
219 $ns = $lang->get('onpage_lbl_page_project'); |
226 break; |
220 break; |
227 case "Category": |
221 case "Category": |
228 $ns = $lang->get('onpage_lbl_page_category'); |
222 $ns = $lang->get('onpage_lbl_page_category'); |
229 break; |
223 break; |
|
224 case "Anonymous": |
|
225 $ns = 'external page'; |
|
226 break; |
230 } |
227 } |
231 $this->namespace_string = $ns; |
228 $this->namespace_string = $ns; |
232 unset($ns); |
229 unset($ns); |
233 $code = $plugins->setHook('page_type_string_set'); |
230 $code = $plugins->setHook('page_type_string_set'); |
234 foreach ( $code as $cmd ) |
231 foreach ( $code as $cmd ) |
243 // Create "xx page" button |
240 // Create "xx page" button |
244 |
241 |
245 $btn_selected = ( isset($tplvars['toolbar_button_selected'])) ? $tplvars['toolbar_button_selected'] : $tplvars['toolbar_button']; |
242 $btn_selected = ( isset($tplvars['toolbar_button_selected'])) ? $tplvars['toolbar_button_selected'] : $tplvars['toolbar_button']; |
246 $parser = $this->makeParserText($btn_selected); |
243 $parser = $this->makeParserText($btn_selected); |
247 |
244 |
248 $parser->assign_vars(array( |
245 if ( true || !$paths->anonymous_page ) |
249 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxReset()); return false; }" title="' . $lang->get('onpage_tip_article') . '" accesskey="a"', |
246 { |
250 'PARENTFLAGS' => 'id="mdgToolbar_article"', |
247 $parser->assign_vars(array( |
251 'HREF' => makeUrl($paths->page, null, true), |
248 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxReset()); return false; }" title="' . $lang->get('onpage_tip_article') . '" accesskey="a"', |
252 'TEXT' => $this->namespace_string |
249 'PARENTFLAGS' => 'id="mdgToolbar_article"', |
253 )); |
250 'HREF' => makeUrl($paths->page, null, true), |
254 |
251 'TEXT' => $this->namespace_string |
255 $tb .= $parser->run(); |
252 )); |
|
253 |
|
254 $tb .= $parser->run(); |
|
255 } |
256 |
256 |
257 $button = $this->makeParserText($tplvars['toolbar_button']); |
257 $button = $this->makeParserText($tplvars['toolbar_button']); |
258 |
258 |
259 // Page toolbar |
259 // Page toolbar |
260 // Comments button |
260 // Comments button |
575 |
575 |
576 $this->toolbar_menu .= '<table border="0" cellspacing="0" cellpadding="0"><tr><td>'.$t0.'</td><td><input type="password" id="mdgPassSetField" size="10" /></td><td>'.$t.'</td></tr></table>'; |
576 $this->toolbar_menu .= '<table border="0" cellspacing="0" cellpadding="0"><tr><td>'.$t0.'</td><td><input type="password" id="mdgPassSetField" size="10" /></td><td>'.$t.'</td></tr></table>'; |
577 } |
577 } |
578 |
578 |
579 // Manage ACLs button |
579 // Manage ACLs button |
580 if($session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN) |
580 if ( !$paths->anonymous_page && ( $session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN ) ) |
581 { |
581 { |
582 $menubtn->assign_vars(array( |
582 $menubtn->assign_vars(array( |
583 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="' . $lang->get('onpage_tip_aclmanager') . '" accesskey="m"', |
583 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="' . $lang->get('onpage_tip_aclmanager') . '" accesskey="m"', |
584 'HREF' => makeUrl($paths->page, 'do=aclmanager', true), |
584 'HREF' => makeUrl($paths->page, 'do=aclmanager', true), |
585 'TEXT' => $lang->get('onpage_btn_acl'), |
585 'TEXT' => $lang->get('onpage_btn_acl'), |
808 { |
808 { |
809 $this->load_theme($session->theme, $session->style); |
809 $this->load_theme($session->theme, $session->style); |
810 } |
810 } |
811 |
811 |
812 $headers_sent = true; |
812 $headers_sent = true; |
813 dc_here('template: generating and sending the page header'); |
|
814 if(!defined('ENANO_HEADERS_SENT')) |
813 if(!defined('ENANO_HEADERS_SENT')) |
815 define('ENANO_HEADERS_SENT', ''); |
814 define('ENANO_HEADERS_SENT', ''); |
816 if ( !$this->no_headers ) |
815 if ( !$this->no_headers ) |
817 { |
816 { |
818 $header = ( $simple ) ? |
817 $header = ( $simple ) ? |
840 } |
839 } |
841 } |
840 } |
842 function footer($simple = false) |
841 function footer($simple = false) |
843 { |
842 { |
844 global $db, $session, $paths, $template, $plugins; // Common objects |
843 global $db, $session, $paths, $template, $plugins; // Common objects |
845 dc_here('template: generating and sending the page footer'); |
|
846 if(!$this->no_headers) { |
844 if(!$this->no_headers) { |
847 |
845 |
848 if(!defined('ENANO_HEADERS_SENT')) |
846 if(!defined('ENANO_HEADERS_SENT')) |
849 $this->header(); |
847 $this->header(); |
850 |
848 |
871 else return ''; |
869 else return ''; |
872 } |
870 } |
873 function getHeader() |
871 function getHeader() |
874 { |
872 { |
875 $headers_sent = true; |
873 $headers_sent = true; |
876 dc_here('template: generating and sending the page header'); |
|
877 if(!defined('ENANO_HEADERS_SENT')) |
874 if(!defined('ENANO_HEADERS_SENT')) |
878 define('ENANO_HEADERS_SENT', ''); |
875 define('ENANO_HEADERS_SENT', ''); |
879 if(!$this->no_headers) return $this->process_template('header.tpl'); |
876 if(!$this->no_headers) return $this->process_template('header.tpl'); |
880 } |
877 } |
881 function getFooter() |
878 function getFooter() |
882 { |
879 { |
883 global $db, $session, $paths, $template, $plugins; // Common objects |
880 global $db, $session, $paths, $template, $plugins; // Common objects |
884 dc_here('template: generating and sending the page footer'); |
|
885 if(!$this->no_headers) { |
881 if(!$this->no_headers) { |
886 global $_starttime; |
882 global $_starttime; |
887 $t = ''; |
883 $t = ''; |
888 |
884 |
889 if(isset($_GET['sqldbg']) && $session->get_permissions('mod_misc')) |
885 if(isset($_GET['sqldbg']) && $session->get_permissions('mod_misc')) |