forked from osTicket/osTicket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
62 lines (48 loc) · 1.48 KB
/
index.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
61
62
<?php
/*********************************************************************
pages/index.php
Custom pages servlet
Peter Rotich <[email protected]>
Jared Hancock <[email protected]>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
@chdir(dirname(__file__).'/../');
require_once('client.inc.php');
require_once(INCLUDE_DIR.'class.format.php');
require_once(INCLUDE_DIR.'class.page.php');
// Determine the requested page
// - Strip extension
$slug = Format::slugify(Osticket::get_path_info());
// Get the part before the first dash
$first_word = explode('-', $slug);
$first_word = $first_word[0];
$pages = Page::objects()->filter(array(
'name__like' => "$first_word%"
));
$selected_page = null;
foreach ($pages as $P) {
if (Format::slugify($P->name) == $slug) {
$selected_page = $P;
break;
}
}
if (!$selected_page)
Http::response(404, __('Page Not Found'));
if (!$selected_page->isActive() || $selected_page->getType() != 'other')
Http::response(404, __('Page Not Found'));
require(CLIENTINC_DIR.'header.inc.php');
$BUTTONS = false;
include CLIENTINC_DIR.'templates/sidebar.tmpl.php';
?>
<div class="main-content">
<?php
print $selected_page->getBodyWithImages();
?>
</div>
<?php
require(CLIENTINC_DIR.'footer.inc.php');
?>