-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpost.php
60 lines (49 loc) · 1.15 KB
/
post.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
59
60
<?php
/**
* post
*
* @package Delus
* @author Dmitry
*/
// fetch bootloader
require('bootloader.php');
// user access
if (!$system['system_public']) {
user_access();
}
// valid inputs
if (!isset($_GET['post_id']) || !is_numeric($_GET['post_id'])) {
_error(404);
}
try {
// get post
define('PRIVACY_ERRORS', true);
$post = $user->get_post($_GET['post_id']);
if (!$post) {
_error(404);
}
/* assign variables */
$smarty->assign('post', $post);
// get ads campaigns
$ads_campaigns = $user->ads_campaigns();
/* assign variables */
$smarty->assign('ads_campaigns', $ads_campaigns);
// get ads
$ads = $user->ads('post');
$ads_footer = $user->ads('post_footer');
/* assign variables */
$smarty->assign('ads', $ads);
$smarty->assign('ads_footer', $ads_footer);
// get widgets
$widgets = $user->widgets('post');
/* assign variables */
$smarty->assign('widgets', $widgets);
} catch (PrivacyException $e) {
_error('PERMISSION');
} catch (Exception $e) {
_error(__("Error"), $e->getMessage());
}
// page header
page_header($post['og_title'], $post['og_description'], $post['og_image']);
// page footer
page_footer('post');