public function display_page(Page $page, $sitename, $base_href, $theme_name, $body) { $page->set_mode("data"); $page->set_data(<<<EOD <html> \t<head> \t\t<title>{$sitename}</title> \t\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> \t\t<meta name="viewport" content="width=device-width, initial-scale=1"> \t\t<link rel='stylesheet' href='{$base_href}/themes/{$theme_name}/style.css' type='text/css'> \t</head> \t<style> \t\tdiv#front-page h1 {font-size: 4em; margin-top: 2em; margin-bottom: 0px; text-align: center; border: none; background: none; box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none;} \t\tdiv#front-page {text-align:center;} \t\t.space {margin-bottom: 1em;} \t\tdiv#front-page div#links a {margin: 0 0.5em;} \t\tdiv#front-page li {list-style-type: none; margin: 0;} \t\t@media (max-width: 800px) { \t\t\tdiv#front-page h1 {font-size: 3em; margin-top: 0.5em; margin-bottom: 0.5em;} \t\t\t#counter {display: none;} \t\t} \t</style> \t<body> \t\t{$body} \t</body> </html> EOD ); }
public function display_upload_status(Page $page, $ok) { if ($ok) { $page->set_mode("redirect"); $page->set_redirect(make_link()); } else { $page->set_title("Upload Status"); $page->set_heading("Upload Status"); $page->add_block(new NavBlock()); } }
public function display_page(Page $page, $sitename, $data_href, $theme_name, $body) { $page->set_mode("data"); $page->set_data(<<<EOD <html> \t<head> \t\t<title>{$sitename}</title> \t\t<link rel='stylesheet' href='{$data_href}/themes/{$theme_name}/style.css' type='text/css'> \t</head> \t<style> \t\tdiv#front-page h1 {font-size: 4em; margin-top: 2em; margin-bottom: 0px; text-align: center; border: none; background: none;} \t\tdiv#front-page {text-align:center;} \t\t.space {margin-bottom: 1em;} \t\tdiv#front-page div#links a {margin: 0 0.5em;} \t\tdiv#front-page li {list-style-type: none; margin: 0;} \t</style> \t<body> \t\t{$body} \t</body> </html> EOD ); }
/** * @param Page $page * @param bool $with_images * @param bool $with_comments */ private function delete_user(Page $page, $with_images = false, $with_comments = false) { global $user, $config, $database; $page->set_title("Error"); $page->set_heading("Error"); $page->add_block(new NavBlock()); if (!$user->can("delete_user")) { $page->add_block(new Block("Not Admin", "Only admins can delete accounts")); } else { if (!isset($_POST['id']) || !is_numeric($_POST['id'])) { $page->add_block(new Block("No ID Specified", "You need to specify the account number to edit")); } else { log_warning("user", "Deleting user #{$_POST['id']}"); if ($with_images) { log_warning("user", "Deleting user #{$_POST['id']}'s uploads"); $rows = $database->get_all("SELECT * FROM images WHERE owner_id = :owner_id", array("owner_id" => $_POST['id'])); foreach ($rows as $key => $value) { $image = Image::by_id($value['id']); if ($image) { send_event(new ImageDeletionEvent($image)); } } } else { $database->Execute("UPDATE images SET owner_id = :new_owner_id WHERE owner_id = :old_owner_id", array("new_owner_id" => $config->get_int('anon_id'), "old_owner_id" => $_POST['id'])); } if ($with_comments) { log_warning("user", "Deleting user #{$_POST['id']}'s comments"); $database->execute("DELETE FROM comments WHERE owner_id = :owner_id", array("owner_id" => $_POST['id'])); } else { $database->Execute("UPDATE comments SET owner_id = :new_owner_id WHERE owner_id = :old_owner_id", array("new_owner_id" => $config->get_int('anon_id'), "old_owner_id" => $_POST['id'])); } send_event(new UserDeletionEvent($_POST['id'])); $database->execute("DELETE FROM users WHERE id = :id", array("id" => $_POST['id'])); $page->set_mode("redirect"); $page->set_redirect(make_link("post/list")); } } }