2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class ET extends Extension {
|
2007-06-30 01:19:11 +00:00
|
|
|
var $theme;
|
2007-04-16 11:58:25 +00:00
|
|
|
// event handler {{{
|
|
|
|
public function receive_event($event) {
|
2007-06-30 01:19:11 +00:00
|
|
|
if(is_null($this->theme)) $this->theme = get_theme_object("et", "ETTheme");
|
|
|
|
|
2007-07-17 07:45:35 +00:00
|
|
|
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "system_info")) {
|
2007-04-16 11:58:25 +00:00
|
|
|
global $user;
|
|
|
|
if($user->is_admin()) {
|
2007-07-17 07:45:35 +00:00
|
|
|
$this->theme->display_info_page($event->page, $this->get_info());
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-30 01:19:11 +00:00
|
|
|
if(is_a($event, 'UserBlockBuildingEvent')) {
|
|
|
|
if($event->user->is_admin()) {
|
|
|
|
$event->add_link("System Info", make_link("system_info"));
|
|
|
|
}
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// }}}
|
|
|
|
// do it {{{
|
2007-06-30 01:19:11 +00:00
|
|
|
private function get_info() {
|
2007-04-16 11:58:25 +00:00
|
|
|
global $database;
|
|
|
|
global $config;
|
2007-05-16 21:23:01 +00:00
|
|
|
global $_event_listeners; // yay for using secret globals \o/
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2007-06-30 01:19:11 +00:00
|
|
|
$info = array();
|
|
|
|
$info['site_title'] = $config->get_string("title");
|
|
|
|
$info['site_theme'] = $config->get_string("theme");
|
|
|
|
$info['site_genre'] = "[please write something here]";
|
|
|
|
$info['site_url'] = isset($_SERVER['SCRIPT_URI']) ? dirname($_SERVER['SCRIPT_URI']) : "???";
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2007-06-30 01:19:11 +00:00
|
|
|
$info['sys_shimmie'] = $config->get_string("version");
|
|
|
|
$info['sys_php'] = phpversion();
|
|
|
|
$info['sys_os'] = php_uname();
|
|
|
|
$info['sys_server'] = $_SERVER["SERVER_SOFTWARE"];
|
|
|
|
include "config.php"; // more magical hax
|
2007-04-16 11:58:25 +00:00
|
|
|
$proto = preg_replace("#(.*)://.*#", "$1", $database_dsn);
|
|
|
|
$db = $database->db->ServerInfo();
|
2007-06-30 01:19:11 +00:00
|
|
|
$info['sys_db'] = "$proto / {$db['version']}";
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2007-06-30 01:19:11 +00:00
|
|
|
$info['stat_images'] = $database->db->GetOne("SELECT COUNT(*) FROM images");
|
|
|
|
$info['stat_comments'] = $database->db->GetOne("SELECT COUNT(*) FROM comments");
|
|
|
|
$info['stat_users'] = $database->db->GetOne("SELECT COUNT(*) FROM users");
|
|
|
|
$info['stat_tags'] = $database->db->GetOne("SELECT COUNT(*) FROM tags");
|
2007-07-05 21:30:37 +00:00
|
|
|
$info['stat_image_tags'] = $database->db->GetOne("SELECT COUNT(*) FROM image_tags");
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2007-05-16 21:23:01 +00:00
|
|
|
$els = array();
|
|
|
|
foreach($_event_listeners as $el) {
|
|
|
|
$els[] = get_class($el);
|
|
|
|
}
|
2007-06-30 01:19:11 +00:00
|
|
|
$info['sys_extensions'] = join(', ', $els);
|
2007-05-16 21:28:56 +00:00
|
|
|
|
|
|
|
//$cfs = array();
|
|
|
|
//foreach($database->db->GetAll("SELECT name, value FROM config") as $pair) {
|
|
|
|
// $cfs[] = $pair['name']."=".$pair['value'];
|
|
|
|
//}
|
2007-06-30 01:19:11 +00:00
|
|
|
//$info[''] = "Config: ".join(", ", $cfs);
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2007-06-30 01:19:11 +00:00
|
|
|
return $info;
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
// }}}
|
|
|
|
}
|
|
|
|
add_event_listener(new ET());
|
|
|
|
?>
|