/
page.php
51 lines (41 loc) · 1.68 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
<?php
include_once('internal/Smarty.class.php');
$main_smarty = new Smarty;
include('config.php');
include(mnminclude.'html1.php');
include(mnminclude.'link.php');
include(mnminclude.'tags.php');
include(mnminclude.'user.php');
include(mnminclude.'csrf.php');
include(mnminclude.'smartyvariables.php');
// sidebar
$main_smarty = do_sidebar($main_smarty);
// pagename
define('pagename', 'page');
$main_smarty->assign('pagename', pagename);
if ($_REQUEST['page']) {
global $db, $main_smarty;
$page = $db->escape(sanitize($_REQUEST['page'], 4));
$page_results = $db->get_row($sql = " SELECT * from ".table_links." where link_title_url='$page' and link_status='page'");
// Search in old urls if not found
if (!$page_results->link_id) {
$page_results = $db->get_row($sql = "SELECT * FROM ".table_old_urls."
LEFT JOIN ".table_links." ON old_link_id=link_id AND link_status='page'
WHERE `old_title_url` = '$page' AND !ISNULL(link_id)");
}
if ($page_results->link_id) {
$main_smarty->assign('page_title', $page_results->link_title);
$main_smarty->assign('meta_keywords', $page_results->link_field1);
$main_smarty->assign('meta_description', $page_results->link_field2);
$main_smarty->assign('page_content', $page_results->link_content);
$main_smarty->assign('posttitle', $page_results->link_title);
$main_smarty->assign('link_id', $page_results->link_id);
}
if (!$page_results->link_id) {
header("Location: $my_pligg_base/error_404.php");
die();
}
}
// show the template
$main_smarty->assign('tpl_center', $the_template.'/page_center');
$main_smarty->display($the_template.'/pligg.tpl');