forked from ACCORD5/TrellisDesk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
executable file
·147 lines (120 loc) · 3.83 KB
/
admin.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/**
* Trellis Desk
*
* @copyright Copyright (C) 2009-2012 ACCORD5. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
*/
define( 'IN_TD', true );
define( 'IN_TDA', true );
#=============================
# Lets Play Nice With Output
#=============================
ob_end_clean();
ob_start();
#=============================
# Safe and Secure
#=============================
if ( function_exists('date_default_timezone_get') )
{
date_default_timezone_set( date_default_timezone_get() );
}
ini_set( 'register_globals', 0 );
if ( @ini_get( 'register_globals' ) )
{
foreach ( $_REQUEST as $key => $value )
{
unset( $$key );
}
}
#=============================
# Define Our Paths
#=============================
define( "TD_PATH", str_replace( '//', '/', dirname(__FILE__).'/' ) );
define( 'TD_INC', TD_PATH ."includes/" );
define( 'TD_CLASS', TD_PATH ."includes/classes/class_" );
define( 'TD_FUNC', TD_PATH ."includes/functions/func_" );
define( 'TD_SRC', TD_PATH ."sources/" );
define( 'TD_SKIN', TD_PATH ."skins/" );
define( 'TD_ADMIN', TD_PATH ."admin/" );
#=============================
# Main Class
#=============================
require_once TD_INC . "trellis.php";
require_once TD_INC . "trellis_admin.php";
$trellis = new trellis_admin();
$trellis->initialize();
#=============================
# Other Junk
#=============================
$choice = array(
'admin' => array(
'about',
'home',
'settings',
),
'manage' => array(
'articles',
'categories',
'cdfields',
'cpfields',
'departs',
'flags',
'groups',
'news',
'pages',
'priorities',
'rtemplates',
'statuses',
'tickets',
'users',
),
'look' => array(
'emails',
'langs',
'skins',
),
'tools' => array(
'backup',
'cache',
'logs',
'maint',
'settings',
'stats',
),
);
#=============================
# Require & Run
#=============================
$folder = $trellis->input['section'];
if ( $folder && in_array( $trellis->input['page'], $choice[ $folder ] ) ) $required = $trellis->input['page'];
if ( ! isset( $required ) )
{
if ( $trellis->input['section'] == 'manage' )
{
$folder = 'manage';
$required = 'tickets';
}
elseif ( $trellis->input['section'] == 'look' )
{
$folder = 'look';
$required = 'skins';
}
elseif ( $trellis->input['section'] == 'tools' )
{
$folder = 'tools';
$required = 'settings';
}
else
{
$folder = 'admin';
$required = 'home';
}
}
$required = "ad_". $required;
require_once TD_ADMIN . $folder ."/". $required .".php";
$required = 'td_'. $required;
$run = new $required();
$run->trellis =& $trellis;
$run->auto_run();
?>