Revision 1700
Added by Dietmar about 12 years ago
class.admin.php | ||
---|---|---|
4 | 4 |
* @category framewotk |
5 | 5 |
* @package backend admin |
6 | 6 |
* @author Ryan Djurovich, WebsiteBaker Project |
7 |
* @copyright 2009-2012, Website Baker Org. e.V.
|
|
7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V. |
|
8 | 8 |
* @link http://www.websitebaker2.org/ |
9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
10 | 10 |
* @platform WebsiteBaker 2.8.x |
... | ... | |
71 | 71 |
|
72 | 72 |
// Now check if they are allowed in this section |
73 | 73 |
if($this->get_permission($section_permission) == false) { |
74 |
die($MESSAGE['ADMIN']['INSUFFICIENT_PRIVELLIGES']);
|
|
74 |
die($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
|
|
75 | 75 |
} |
76 | 76 |
} |
77 | 77 |
|
... | ... | |
143 | 143 |
$row = @$result->fetchRow(); |
144 | 144 |
if($row) $view_url .= PAGES_DIRECTORY .$row['link']. PAGE_EXTENSION; |
145 | 145 |
} |
146 |
|
|
146 |
$sServerAdress = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '127.0.0.1'; |
|
147 | 147 |
$header_template->set_var( array( |
148 | 148 |
'SECTION_FORGOT' => $MENU['FORGOT'], |
149 | 149 |
'SECTION_NAME' => $MENU['LOGIN'], |
150 | 150 |
'BODY_TAGS' => $body_tags, |
151 | 151 |
'WEBSITE_TITLE' => ($title['value']), |
152 | 152 |
'TEXT_ADMINISTRATION' => $TEXT['ADMINISTRATION'], |
153 |
'CURRENT_USER' => $MESSAGE['START']['CURRENT_USER'],
|
|
153 |
'CURRENT_USER' => $MESSAGE['START_CURRENT_USER'],
|
|
154 | 154 |
'DISPLAY_NAME' => $this->get_display_name(), |
155 | 155 |
'CHARSET' => $charset, |
156 | 156 |
'LANGUAGE' => strtolower(LANGUAGE), |
157 | 157 |
'VERSION' => VERSION, |
158 | 158 |
'SP' => (defined('SP') ? SP : ''), |
159 | 159 |
'REVISION' => REVISION, |
160 |
'SERVER_ADDR' => ((int)$this->get_user_id()==1 ? $_SERVER['SERVER_ADDR'] : ''),
|
|
160 |
'SERVER_ADDR' => ((int)$this->get_user_id()==1 ? $sServerAdress : ''),
|
|
161 | 161 |
'WB_URL' => WB_URL, |
162 | 162 |
'ADMIN_URL' => ADMIN_URL, |
163 | 163 |
'THEME_URL' => THEME_URL, |
... | ... | |
168 | 168 |
'TITLE_HELP' => $MENU['HELP'], |
169 | 169 |
'URL_VIEW' => $view_url, |
170 | 170 |
'TITLE_LOGOUT' => $MENU['LOGIN'], |
171 |
'LOGIN_DISPLAY_NONE' => ' display: none; ', |
|
171 |
'LOGIN_DISPLAY_HIDDEN' => !$this->is_authenticated() ? 'hidden' : '', |
|
172 |
'LOGIN_DISPLAY_NONE' => !$this->is_authenticated() ? 'none' : '', |
|
172 | 173 |
'LOGIN_LINK' => $_SERVER['SCRIPT_NAME'], |
173 | 174 |
'LOGIN_ICON' => 'login', |
174 | 175 |
'START_ICON' => 'blank', |
... | ... | |
181 | 182 |
// Create the menu |
182 | 183 |
if(!$this->is_authenticated()) |
183 | 184 |
{ |
185 |
$header_template->set_var('STYLE', 'login'); |
|
184 | 186 |
$menu = array( |
185 | 187 |
// array('http://www.websitebaker.org/', '_blank', 'WebsiteBaker Home', 'help', 0), |
186 | 188 |
// array($view_url, '_blank', $TEXT['FRONTEND'], '', 0), |
187 | 189 |
// array(ADMIN_URL.'/login/index.php', '', $MENU['LOGIN'], '', 0) |
188 | 190 |
); |
189 | 191 |
} else { |
192 |
$header_template->set_var('STYLE', 'start'); |
|
190 | 193 |
$header_template->set_var( array( |
191 | 194 |
'SECTION_NAME' => $MENU[strtoupper($this->section_name)], |
192 | 195 |
'TITLE_LOGOUT' => $MENU['LOGOUT'], |
... | ... | |
204 | 207 |
// array($view_url, '_blank', $MENU['FRONTEND'], 'pages', 1), |
205 | 208 |
array(ADMIN_URL.'/media/index.php', '', $MENU['MEDIA'], 'media', 1), |
206 | 209 |
array(ADMIN_URL.'/addons/index.php', '', $MENU['ADDONS'], 'addons', 1), |
207 |
array(ADMIN_URL.'/preferences/index.php', '', $MENU['PREFERENCES'], 'preferences', 0),
|
|
210 |
array(ADMIN_URL.'/preferences/index.php', '', $MENU['PREFERENCES'], 'preferences', 1),
|
|
208 | 211 |
array(ADMIN_URL.'/settings/index.php', '', $MENU['SETTINGS'], 'settings', 1), |
209 | 212 |
array(ADMIN_URL.'/admintools/index.php', '', $MENU['ADMINTOOLS'], 'admintools', 1), |
210 | 213 |
array(ADMIN_URL.'/access/index.php', '', $MENU['ACCESS'], 'access', 1), |
... | ... | |
215 | 218 |
} |
216 | 219 |
|
217 | 220 |
$header_template->set_block('header_block', 'linkBlock', 'link'); |
218 |
foreach($menu AS $menu_item) { |
|
221 |
foreach($menu AS $menu_item) |
|
222 |
{ |
|
219 | 223 |
$link = $menu_item[0]; |
220 | 224 |
$target = ($menu_item[1] == '') ? '_self' : $menu_item[1]; |
221 | 225 |
$title = $menu_item[2]; |
... | ... | |
229 | 233 |
// If link is the current section apply a class name |
230 | 234 |
if($permission_title == strtolower($this->section_name)) { |
231 | 235 |
$header_template->set_var('CLASS', $menu_item[3] . ' current'); |
236 |
$header_template->set_var('STYLE', $menu_item[3] ); |
|
232 | 237 |
} else { |
233 |
$header_template->set_var('CLASS', $menu_item[3]); |
|
238 |
$header_template->set_var('CLASS', $menu_item[3] );
|
|
234 | 239 |
} |
235 | 240 |
$header_template->set_var('TITLE', $title); |
236 | 241 |
// Print link |
... | ... | |
239 | 244 |
} |
240 | 245 |
$header_template->parse('header', 'header_block', false); |
241 | 246 |
$header_template->pparse('output', 'page'); |
247 |
unset($header_template); |
|
242 | 248 |
} |
243 | 249 |
|
244 | 250 |
// Print the admin footer |
245 | 251 |
function print_footer($activateJsAdmin = false) { |
246 |
global $database,$starttime; |
|
252 |
global $database,$starttime,$iPhpDeclaredClasses;
|
|
247 | 253 |
// include the required file for Javascript admin |
248 | 254 |
if($activateJsAdmin != false) { |
249 | 255 |
if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php')){ |
... | ... | |
270 | 276 |
if( $bDevInfo ) |
271 | 277 |
{ |
272 | 278 |
|
273 |
$footer_template->set_var('MEMORY', number_format(memory_get_peak_usage(), 0, ',', '.').' Byte' ); |
|
279 |
$footer_template->set_var('MEMORY', number_format(memory_get_peak_usage(true), 0, ',', '.').' Byte' ); |
|
280 |
// $footer_template->set_var('MEMORY', number_format(memory_get_usage(true), 0, ',', '.').' Byte' ); |
|
274 | 281 |
$footer_template->set_var('QUERIES', $database->getQueryCount ); |
275 | 282 |
// $footer_template->set_var('QUERIES', 'disabled' ); |
276 | 283 |
$included_files = get_included_files(); |
277 | 284 |
$footer_template->set_var('INCLUDES', sizeof($included_files) ); |
285 |
$included_classes = get_declared_classes(); |
|
286 |
$footer_template->set_var('CLASSES', sizeof($included_classes)-$iPhpDeclaredClasses ); |
|
278 | 287 |
|
288 |
$sum_classes = 0; |
|
279 | 289 |
$sum_filesize = 0; |
280 | 290 |
$footer_template->set_block('show_debug_block', 'show_block_list', 'show_list'); |
281 | 291 |
$footer_template->set_block('show_block_list', 'include_block_list', 'include_list'); |
... | ... | |
305 | 315 |
$footer_template->set_var('FILESIZE', ini_get('memory_limit')); |
306 | 316 |
$footer_template->set_var('TXT_SUM_FILESIZE', 'Summary size of included files: '); |
307 | 317 |
$footer_template->set_var('SUM_FILESIZE', number_format($sum_filesize, 0, ',', '.').' Byte'); |
318 |
$footer_template->set_var('SUM_CLASSES', number_format($sum_classes, 0, ',', '.').' Byte'); |
|
308 | 319 |
$footer_template->set_var('PAGE_LOAD_TIME', round($iEndTime-$iStartTime,3 )); |
320 |
$footer_template->set_var('DUMP_CLASSES', '<pre>'.var_export($included_classes,true).'</pre>'); |
|
309 | 321 |
|
310 | 322 |
$footer_template->parse('show_debug', 'show_debug_block', true); |
311 | 323 |
} else { |
... | ... | |
315 | 327 |
} |
316 | 328 |
$footer_template->parse('header', 'footer_block', false); |
317 | 329 |
$footer_template->pparse('output', 'page'); |
330 |
unset($footer_template); |
|
318 | 331 |
} |
319 | 332 |
|
320 | 333 |
// Return a system permission |
321 | 334 |
function get_permission($name, $type = 'system') { |
335 |
|
|
322 | 336 |
// Append to permission type |
323 | 337 |
$type .= '_permissions'; |
324 | 338 |
// Check if we have a section to check for |
... | ... | |
346 | 360 |
} |
347 | 361 |
} |
348 | 362 |
} |
363 |
|
|
349 | 364 |
} |
350 |
/* |
|
351 |
function get_user_details($user_id) { |
|
352 |
global $database; |
|
353 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'users` '; |
|
354 |
$sql .= 'WHERE `user_id`='.(int)$user_id.' LIMIT 1'; |
|
355 |
if(($resUser = $database->query($sql))){ |
|
356 |
if(!($recUser = $resUser->fetchRow())) { |
|
357 |
$recUser['display_name'] = 'Unknown'; |
|
358 |
$recUser['username'] = 'unknown'; |
|
359 |
} |
|
360 |
} |
|
361 |
return $recUser; |
|
362 |
} |
|
363 |
*/ |
|
365 |
|
|
364 | 366 |
function get_user_details($user_id) { |
365 | 367 |
global $database; |
366 | 368 |
$retval = array('username'=>'unknown','display_name'=>'Unknown','email'=>''); |
Also available in: Unified diff
! change multi-dimensional arrays (variables) to similar arrays
+ add variables for backend-menu, header.htt and footer.htt