-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
page.php
58 lines (47 loc) · 1.73 KB
/
page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
define('PMD_SECTION', 'public');
include('./defaults.php');
// Load the language variables required on this page
$PMDR->loadLanguage();
// Get the page data from the database by the page ID
if(isset($_GET['id'])) {
$page = $PMDR->get('CustomPage')->getRow($_GET['id']);
}
// If the page does not exist we return a 404 error
if(!$page OR !$page['active']) {
$PMDR->get('Error',404);
}
// We want to ignore custom query parameters. Ensure the
// friendly_url_full is entirely included as the first part of the URL.
if(strpos(URL,$page['friendly_url_full']) !== 0) {
$PMDR->get('Error',301);
redirect($page['friendly_url_full']);
}
if($page['id'] == $PMDR->getConfig('browse_index_type')) {
$PMDR->get('Error',301);
redirect(BASE_URL);
}
// Set the content of the page to the template content
$template_content = $page['content_parsed'];
// Set the page meta details based on the custom page meta data
$PMDR->set('meta_description',$page['meta_description']);
$PMDR->set('meta_keywords',$page['meta_keywords']);
// Set the page title according to the page title data
if(!empty($page['meta_title'])) {
$PMDR->set('meta_title',$page['meta_title']);
}
$PMDR->setAdd('page_title',$page['title']);
// Set the breadcrumb links
$PMDR->setAddArray('breadcrumb',array('link'=>$page['friendly_url_full'],'text'=>$page['title']));
// Set the page templates
if(trim($page['header_template_file']) != '') {
$PMDR->set('header_file',$page['header_template_file']);
}
if(trim($page['footer_template_file']) != '') {
$PMDR->set('footer_file',$page['footer_template_file']);
}
if(trim($page['wrapper_template_file']) != '') {
$PMDR->set('wrapper_file',$page['wrapper_template_file']);
}
include(PMDROOT.'/includes/template_setup.php');
?>