page == "phone_home")) { global $user; if($user->is_admin()) { $this->phone_home(); } } if(is_a($event, 'AdminBuildingEvent')) { global $page; $page->add_main_block(new Block("Gather System Info", $this->build_phone_home()), 99); } } // }}} // do it {{{ private function phone_home() { global $page; $page->set_title("System Info"); $page->set_heading("System Info"); $page->add_side_block(new NavBlock()); $page->add_main_block(new Block("Data which is to be sent:", $this->build_data_form())); } private function build_data_form() { global $database; global $config; $data = ""; $data .= "Optional:\n"; $data .= "Add this site to the public shimmie users list: No\n"; $data .= "Site title: ".($config->get_string("title"))."\n"; $data .= "Theme: ".($config->get_string("theme"))."\n"; $data .= "Genre: [please write something here]\n"; $data .= "\nSystem stats:\n"; $data .= "PHP: ".phpversion()."\n"; $data .= "OS: ".php_uname()."\n"; $data .= "Server: ".($_SERVER["SERVER_SOFTWARE"])."\n"; include "config.php"; $proto = preg_replace("#(.*)://.*#", "$1", $database_dsn); $db = $database->db->ServerInfo(); $data .= "Database: $proto / {$db['version']}\n"; $data .= "\nShimmie stats:\n"; $uri = isset($_SERVER['SCRIPT_URI']) ? dirname($_SERVER['SCRIPT_URI']) : "???"; $data .= "URL: ".($uri)."\n"; $data .= "Version: ".($config->get_string("version"))."\n"; $data .= "Images: ".($database->db->GetOne("SELECT COUNT(*) FROM images"))."\n"; $data .= "Comments: ".($database->db->GetOne("SELECT COUNT(*) FROM comments"))."\n"; $data .= "Users: ".($database->db->GetOne("SELECT COUNT(*) FROM users"))."\n"; $data .= "Tags: ".($database->db->GetOne("SELECT COUNT(*) FROM tags"))."\n"; $html = "


Your stats are useful so that I know which combinations of web servers / databases / etc I need to support,
and so that I can get some idea of how people use shimmie generally
"; return $html; } // }}} // admin page HTML {{{ private function build_phone_home() { global $database; $h_bans = ""; $html = " This button will gather various bits of information about your system (PHP version, database, etc) which will be useful in debugging~

"; return $html; } // }}} } add_event_listener(new ET()); ?>