function admin_page($mod) { global $repository, $site_name, $menu, $modules, $user; function module($name, $module) { global $menu, $modules, $user; if ($module["admin"]) { $output .= user_access($user, $name) ? "<A HREF=\"admin.php?mod={$name}\">{$name}</A> | " : " {$name} | "; } $menu .= $output; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD><TITLE><?php echo $site_name; ?> administration</TITLE></HEAD> <STYLE> body { font-family: helvetica, arial; } h1 { font-size: 18pt; font-weight: bold; color: #990000; } h2 { font-family: helvetica, arial; font-size: 18pt; font-weight: bold; } h3 { font-family: helvetica, arial; font-size: 14pt; font-weight: bold; } th { font-family: helvetica, arial; text-align: center; vertical-align: top; background-color: #CCCCCC; color: #995555; } td { font-family: helvetica, arial; } </STYLE> <BODY BGCOLOR="#FFFFFF" LINK="#005599" VLINK="#004499" ALINK="#FF0000"> <H1>Administration</H1> <?php ksort($repository); module_iterate("module"); ?> <HR><?php echo $menu; ?> <A HREF="index.php">home</A><HR> <?php if (user_access($user, $mod)) { module_execute($mod, "admin"); } ?> </BODY> </HTML> <?php }
function account_user($uname) { global $user, $theme; function module($name, $module, $username) { global $theme; if ($module["user"] && ($block = $module["user"]($username, "user", "view"))) { if ($block["content"]) { $theme->box($block["subject"], $block["content"]); } } } if ($user->id && $user->userid == $uname) { $output .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TD ALIGN=\"right\"><B>" . t("Username") . ":</B></TD><TD>{$user->userid}</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>" . t("E-mail") . ":</B></TD><TD>" . format_email($user->fake_email) . "</A></TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>" . t("Homepage") . ":</B></TD><TD>" . format_url($user->url) . "</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>" . t("Bio") . ":</B></TD><TD>" . check_output($user->bio) . "</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>" . t("Signature") . ":</B></TD><TD>" . check_output($user->signature) . "</TD></TR>\n"; $output .= "</TABLE>\n"; // Display account information: $theme->header(); $theme->box(t("Personal information"), $output); $theme->footer(); } elseif ($uname && ($account = account_get_user($uname))) { $block1 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n"; $block1 .= " <TR><TD ALIGN=\"right\"><B>" . t("Username") . ":</B></TD><TD>{$account->userid}</TD></TR>\n"; $block1 .= " <TR><TD ALIGN=\"right\"><B>" . t("E-mail") . ":</B></TD><TD>" . format_email($account->fake_email) . "</TD></TR>\n"; $block1 .= " <TR><TD ALIGN=\"right\"><B>" . t("Homepage") . ":</B></TD><TD>" . format_url($account->url) . "</TD></TR>\n"; $block1 .= " <TR><TD ALIGN=\"right\"><B>" . t("Bio") . ":</B></TD><TD>" . check_output($account->bio) . "</TD></TR>\n"; $block1 .= "</TABLE>\n"; $result = db_query("SELECT c.cid, c.pid, c.lid, c.subject, c.timestamp, s.subject AS story FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN stories s ON s.id = c.lid WHERE u.userid = '{$uname}' AND s.status = 2 AND c.link = 'story' AND s.timestamp > " . (time() - 1209600) . " ORDER BY cid DESC LIMIT 10"); while ($comment = db_fetch_object($result)) { $block2 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n"; $block2 .= " <TR><TD ALIGN=\"right\"><B>" . t("Comment") . ":</B></TD><TD><A HREF=\"story.php?id={$comment->lid}&cid={$comment->cid}&pid={$comment->pid}#{$comment->cid}\">" . check_output($comment->subject) . "</A></TD></TR>\n"; $block2 .= " <TR><TD ALIGN=\"right\"><B>" . t("Date") . ":</B></TD><TD>" . format_date($comment->timestamp) . "</TD></TR>\n"; $block2 .= " <TR><TD ALIGN=\"right\"><B>" . t("Story") . ":</B></TD><TD><A HREF=\"story.php?id={$comment->lid}\">" . check_output($comment->story) . "</A></TD></TR>\n"; $block2 .= "</TABLE>\n"; $block2 .= "<P>\n"; $comments++; } // Display account information: $theme->header(); if ($block1) { $theme->box(strtr(t("%a's user information"), array("%a" => $uname)), $block1); } if ($block2) { $theme->box(strtr(t("%a has posted %b recently"), array("%a" => $uname, "%b" => format_plural($comments, "comment", "comments"))), $block2); } module_iterate("module", $uname); $theme->footer(); } else { // Display login form: $theme->header(); $theme->box(t("Create user account"), account_create()); $theme->box(t("E-mail new password"), account_email()); $theme->footer(); } }
<?php include_once "includes/common.inc"; function find_module($name, $module) { global $options, $type; if ($module["find"]) { $options .= "<OPTION VALUE=\"{$name}\"" . ($name == $type ? " SELECTED" : "") . ">{$name}</OPTION>\n"; } } module_iterate("find_module"); $search .= "<FORM ACTION=\"search.php\" METHOD=\"POST\">\n"; $search .= " <INPUT SIZE=\"50\" VALUE=\"" . check_textfield($keys) . "\" NAME=\"keys\" TYPE=\"text\">\n"; $search .= " <SELECT NAME=\"type\">{$options}</SELECT>\n"; $search .= " <INPUT TYPE=\"submit\" VALUE=\"" . t("Search") . "\">\n"; $search .= "</FORM>\n"; $output = search_data(check_input($keys), check_input($type)); $theme->header(); $theme->box(t("Search"), $search); $theme->box(t("Result"), $output); $theme->footer();