172 global $db, $session, $paths, $template, $plugins; // Common objects |
172 global $db, $session, $paths, $template, $plugins; // Common objects |
173 global $lang; |
173 global $lang; |
174 |
174 |
175 profiler_log("PageProcessor [{$this->namespace}:{$this->page_id}]: Started send process"); |
175 profiler_log("PageProcessor [{$this->namespace}:{$this->page_id}]: Started send process"); |
176 |
176 |
177 if ( $this->send_headers ) |
|
178 { |
|
179 $template->init_vars($this); |
|
180 } |
|
181 |
|
182 if ( !$this->perms->get_permissions('read') ) |
177 if ( !$this->perms->get_permissions('read') ) |
183 { |
178 { |
|
179 if ( $this->send_headers ) |
|
180 { |
|
181 $template->init_vars($this); |
|
182 } |
184 // Permission denied to read page. Is this one of our core pages that must always be allowed? |
183 // Permission denied to read page. Is this one of our core pages that must always be allowed? |
185 // NOTE: Not even the administration panel will work if ACLs deny access to it. |
184 // NOTE: Not even the administration panel will work if ACLs deny access to it. |
186 if ( $this->namespace == 'Special' && in_array($this->page_id, array('Login', 'Logout', 'LangExportJSON', 'CSS')) ) |
185 if ( $this->namespace == 'Special' && in_array($this->page_id, array('Login', 'Logout', 'LangExportJSON', 'CSS')) ) |
187 { |
186 { |
188 // Do nothing; allow execution to continue |
187 // Do nothing; allow execution to continue |
197 } |
196 } |
198 $pathskey = $paths->nslist[ $this->namespace ] . $this->page_id; |
197 $pathskey = $paths->nslist[ $this->namespace ] . $this->page_id; |
199 $strict_no_headers = false; |
198 $strict_no_headers = false; |
200 if ( $this->namespace == 'Admin' && strstr($this->page_id, '/') ) |
199 if ( $this->namespace == 'Admin' && strstr($this->page_id, '/') ) |
201 { |
200 { |
|
201 if ( $this->send_headers ) |
|
202 { |
|
203 $template->init_vars($this); |
|
204 } |
202 $this->page_id = substr($this->page_id, 0, strpos($this->page_id, '/')); |
205 $this->page_id = substr($this->page_id, 0, strpos($this->page_id, '/')); |
203 $funcname = "page_{$this->namespace}_{$this->page_id}"; |
206 $funcname = "page_{$this->namespace}_{$this->page_id}"; |
204 if ( function_exists($funcname) ) |
207 if ( function_exists($funcname) ) |
205 { |
208 { |
206 $this->page_exists = true; |
209 $this->page_exists = true; |
207 } |
210 } |
208 } |
211 } |
209 if ( isset($paths->pages[$pathskey]) ) |
212 if ( isset($paths->pages[$pathskey]) ) |
210 { |
213 { |
|
214 if ( $this->send_headers ) |
|
215 { |
|
216 $template->init_vars($this); |
|
217 } |
211 if ( $paths->pages[$pathskey]['special'] == 1 ) |
218 if ( $paths->pages[$pathskey]['special'] == 1 ) |
212 { |
219 { |
213 $this->send_headers = false; |
220 $this->send_headers = false; |
214 $strict_no_headers = true; |
221 $strict_no_headers = true; |
215 } |
222 } |
231 { |
238 { |
232 doStats($this->page_id, $this->namespace); |
239 doStats($this->page_id, $this->namespace); |
233 } |
240 } |
234 if ( $this->namespace == 'Special' || $this->namespace == 'Admin' ) |
241 if ( $this->namespace == 'Special' || $this->namespace == 'Admin' ) |
235 { |
242 { |
|
243 if ( $this->send_headers ) |
|
244 { |
|
245 $template->init_vars($this); |
|
246 } |
|
247 |
236 $this->revision_time = time(); |
248 $this->revision_time = time(); |
237 |
249 |
238 if ( !$this->page_exists ) |
250 if ( !$this->page_exists ) |
239 { |
251 { |
240 $func_name = "page_{$this->namespace}_{$this->page_id}"; |
252 $func_name = "page_{$this->namespace}_{$this->page_id}"; |
270 return false; |
282 return false; |
271 } |
283 } |
272 } |
284 } |
273 else if ( $this->namespace == 'User' && strpos($this->page_id, '/') === false ) |
285 else if ( $this->namespace == 'User' && strpos($this->page_id, '/') === false ) |
274 { |
286 { |
|
287 if ( $this->send_headers ) |
|
288 { |
|
289 $template->init_vars($this); |
|
290 } |
|
291 |
275 $this->_handle_userpage(); |
292 $this->_handle_userpage(); |
276 } |
293 } |
277 else if ( ( $this->namespace == 'Template' || $this->namespace == 'System' ) && $this->page_exists ) |
294 else if ( ( $this->namespace == 'Template' || $this->namespace == 'System' ) && $this->page_exists ) |
278 { |
295 { |
|
296 if ( $this->send_headers ) |
|
297 { |
|
298 $template->init_vars($this); |
|
299 } |
|
300 |
279 $this->header(); |
301 $this->header(); |
280 |
302 |
281 $text = $this->fetch_text(); |
303 $text = $this->fetch_text(); |
282 $text = preg_replace('/<noinclude>(.*?)<\/noinclude>/is', '\\1', $text); |
304 $text = preg_replace('/<noinclude>(.*?)<\/noinclude>/is', '\\1', $text); |
283 $text = preg_replace('/<nodisplay>(.*?)<\/nodisplay>/is', '', $text); |
305 $text = preg_replace('/<nodisplay>(.*?)<\/nodisplay>/is', '', $text); |
288 |
310 |
289 $this->footer(); |
311 $this->footer(); |
290 } |
312 } |
291 else if ( $this->namespace == 'Anonymous' ) |
313 else if ( $this->namespace == 'Anonymous' ) |
292 { |
314 { |
|
315 if ( $this->send_headers ) |
|
316 { |
|
317 $template->init_vars($this); |
|
318 } |
|
319 |
293 $uri = scriptPath . '/' . $this->page_id; |
320 $uri = scriptPath . '/' . $this->page_id; |
294 if ( !$this->send_headers ) |
321 if ( !$this->send_headers ) |
295 { |
322 { |
296 $sep = ( strstr($uri, '?') ) ? '&' : '?'; |
323 $sep = ( strstr($uri, '?') ) ? '&' : '?'; |
297 $uri .= "{$sep}noheaders"; |
324 $uri .= "{$sep}noheaders"; |
325 } |
356 } |
326 } |
357 } |
327 else // (disabled for compatibility reasons) if ( in_array($this->namespace, array('Article', 'User', 'Project', 'Help', 'File', 'Category')) && $this->page_exists ) |
358 else // (disabled for compatibility reasons) if ( in_array($this->namespace, array('Article', 'User', 'Project', 'Help', 'File', 'Category')) && $this->page_exists ) |
328 { |
359 { |
329 // Send as regular page |
360 // Send as regular page |
|
361 if ( $this->send_headers ) |
|
362 { |
|
363 $template->init_vars($this); |
|
364 } |
330 |
365 |
331 // die($this->page_id); |
366 // die($this->page_id); |
332 |
367 |
333 $text = $this->fetch_text(); |
368 $text = $this->fetch_text(); |
334 if ( $text == 'err_no_text_rows' ) |
369 if ( $text == 'err_no_text_rows' ) |