- Patch by Steven: removed redundant permission checks. These are no longer

required thanks to the new 404 handling.
4.4.x
Dries Buytaert 2004-02-15 20:09:46 +00:00
parent ae5136e51b
commit 4b0b2d02ee
39 changed files with 1080 additions and 1348 deletions

View File

@ -19,12 +19,7 @@ function admin_link($type) {
}
function admin_admin() {
if (user_access("access administration pages")) {
print theme("page", watchdog_overview("actions"));
}
else {
print theme("page", message_access());
}
print theme("page", watchdog_overview("actions"));
}
?>

View File

@ -613,59 +613,53 @@ function aggregator_tag() {
function aggregator_admin() {
$edit = $_POST["edit"];
if (user_access("administer news feeds")) {
switch ($_POST["op"] ? $_POST["op"] : arg(3)) {
case "add":
if (arg(4) == "bundle") {
$output = aggregator_form_bundle();
}
else {
$output = aggregator_form_feed();
}
break;
case "edit":
if (arg(4) == "bundle") {
$output = aggregator_form_bundle(aggregator_get_bundle(arg(5)));
}
else {
$output = aggregator_form_feed(aggregator_get_feed(arg(5)));
}
break;
case "remove":
aggregator_remove(aggregator_get_feed(arg(4)));
$output .= aggregator_view();
break;
case "update":
aggregator_refresh(aggregator_get_feed(arg(4)));
$output .= aggregator_view();
break;
case "tag":
$output = aggregator_tag();
break;
case t("Save attributes"):
aggregator_save_attributes($edit);
$output .= aggregator_tag();
break;
case t("Delete"):
$edit["title"] = 0;
// fall through:
case t("Submit"):
if (arg(4) == "bundle") {
aggregator_save_bundle($edit);
}
else {
aggregator_save_feed($edit);
}
// fall through:
default:
$output .= aggregator_view();
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch ($_POST["op"] ? $_POST["op"] : arg(3)) {
case "add":
if (arg(4) == "bundle") {
$output = aggregator_form_bundle();
}
else {
$output = aggregator_form_feed();
}
break;
case "edit":
if (arg(4) == "bundle") {
$output = aggregator_form_bundle(aggregator_get_bundle(arg(5)));
}
else {
$output = aggregator_form_feed(aggregator_get_feed(arg(5)));
}
break;
case "remove":
aggregator_remove(aggregator_get_feed(arg(4)));
$output .= aggregator_view();
break;
case "update":
aggregator_refresh(aggregator_get_feed(arg(4)));
$output .= aggregator_view();
break;
case "tag":
$output = aggregator_tag();
break;
case t("Save attributes"):
aggregator_save_attributes($edit);
$output .= aggregator_tag();
break;
case t("Delete"):
$edit["title"] = 0;
// fall through:
case t("Submit"):
if (arg(4) == "bundle") {
aggregator_save_bundle($edit);
}
else {
aggregator_save_feed($edit);
}
// fall through:
default:
$output .= aggregator_view();
}
print theme("page", $output);
}
function aggregator_page_last() {

View File

@ -613,59 +613,53 @@ function aggregator_tag() {
function aggregator_admin() {
$edit = $_POST["edit"];
if (user_access("administer news feeds")) {
switch ($_POST["op"] ? $_POST["op"] : arg(3)) {
case "add":
if (arg(4) == "bundle") {
$output = aggregator_form_bundle();
}
else {
$output = aggregator_form_feed();
}
break;
case "edit":
if (arg(4) == "bundle") {
$output = aggregator_form_bundle(aggregator_get_bundle(arg(5)));
}
else {
$output = aggregator_form_feed(aggregator_get_feed(arg(5)));
}
break;
case "remove":
aggregator_remove(aggregator_get_feed(arg(4)));
$output .= aggregator_view();
break;
case "update":
aggregator_refresh(aggregator_get_feed(arg(4)));
$output .= aggregator_view();
break;
case "tag":
$output = aggregator_tag();
break;
case t("Save attributes"):
aggregator_save_attributes($edit);
$output .= aggregator_tag();
break;
case t("Delete"):
$edit["title"] = 0;
// fall through:
case t("Submit"):
if (arg(4) == "bundle") {
aggregator_save_bundle($edit);
}
else {
aggregator_save_feed($edit);
}
// fall through:
default:
$output .= aggregator_view();
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch ($_POST["op"] ? $_POST["op"] : arg(3)) {
case "add":
if (arg(4) == "bundle") {
$output = aggregator_form_bundle();
}
else {
$output = aggregator_form_feed();
}
break;
case "edit":
if (arg(4) == "bundle") {
$output = aggregator_form_bundle(aggregator_get_bundle(arg(5)));
}
else {
$output = aggregator_form_feed(aggregator_get_feed(arg(5)));
}
break;
case "remove":
aggregator_remove(aggregator_get_feed(arg(4)));
$output .= aggregator_view();
break;
case "update":
aggregator_refresh(aggregator_get_feed(arg(4)));
$output .= aggregator_view();
break;
case "tag":
$output = aggregator_tag();
break;
case t("Save attributes"):
aggregator_save_attributes($edit);
$output .= aggregator_tag();
break;
case t("Delete"):
$edit["title"] = 0;
// fall through:
case t("Submit"):
if (arg(4) == "bundle") {
aggregator_save_bundle($edit);
}
else {
aggregator_save_feed($edit);
}
// fall through:
default:
$output .= aggregator_view();
}
print theme("page", $output);
}
function aggregator_page_last() {

View File

@ -205,51 +205,46 @@ function archive_page() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("access content")) {
if ($op == t("Show")) {
$year = $edit["year"];
$month = $edit["month"];
$day = $edit["day"];
}
else {
$year = arg(1);
$month = arg(2);
$day = arg(3);
}
$date = mktime(0, 0, 0, $month, $day, $year) - $user->timezone;
$date_end = mktime(0, 0, 0, $month, $day + 1, $year) - $user->timezone;
/*
** Prepare the values of the form fields:
*/
$years = drupal_map_assoc(range(2000, 2005));
$months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
$days = drupal_map_assoc(range(0, 31));
$start = "<div class=\"container-inline\">";
$start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
$start .= "</div>";
$output .= form($start);
/*
** Fetch nodes for the selected date, or current date if none
** selected.
*/
if ($year && $month && $day) {
$result = db_query_range("SELECT nid FROM {node} WHERE status = '1' AND created > %d AND created < %d ORDER BY created", $date, $date_end, 0, 20);
while ($nid = db_fetch_object($result)) {
$output .= node_view(node_load(array("nid" => $nid->nid)), 1);
}
}
print theme("page", $output);
if ($op == t("Show")) {
$year = $edit["year"];
$month = $edit["month"];
$day = $edit["day"];
}
else {
print theme("page", message_access());
$year = arg(1);
$month = arg(2);
$day = arg(3);
}
$date = mktime(0, 0, 0, $month, $day, $year) - $user->timezone;
$date_end = mktime(0, 0, 0, $month, $day + 1, $year) - $user->timezone;
/*
** Prepare the values of the form fields:
*/
$years = drupal_map_assoc(range(2000, 2005));
$months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
$days = drupal_map_assoc(range(0, 31));
$start = "<div class=\"container-inline\">";
$start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
$start .= "</div>";
$output .= form($start);
/*
** Fetch nodes for the selected date, or current date if none
** selected.
*/
if ($year && $month && $day) {
$result = db_query_range("SELECT nid FROM {node} WHERE status = '1' AND created > %d AND created < %d ORDER BY created", $date, $date_end, 0, 20);
while ($nid = db_fetch_object($result)) {
$output .= node_view(node_load(array("nid" => $nid->nid)), 1);
}
}
print theme("page", $output);
}
function archive_settings() {

View File

@ -205,51 +205,46 @@ function archive_page() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("access content")) {
if ($op == t("Show")) {
$year = $edit["year"];
$month = $edit["month"];
$day = $edit["day"];
}
else {
$year = arg(1);
$month = arg(2);
$day = arg(3);
}
$date = mktime(0, 0, 0, $month, $day, $year) - $user->timezone;
$date_end = mktime(0, 0, 0, $month, $day + 1, $year) - $user->timezone;
/*
** Prepare the values of the form fields:
*/
$years = drupal_map_assoc(range(2000, 2005));
$months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
$days = drupal_map_assoc(range(0, 31));
$start = "<div class=\"container-inline\">";
$start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
$start .= "</div>";
$output .= form($start);
/*
** Fetch nodes for the selected date, or current date if none
** selected.
*/
if ($year && $month && $day) {
$result = db_query_range("SELECT nid FROM {node} WHERE status = '1' AND created > %d AND created < %d ORDER BY created", $date, $date_end, 0, 20);
while ($nid = db_fetch_object($result)) {
$output .= node_view(node_load(array("nid" => $nid->nid)), 1);
}
}
print theme("page", $output);
if ($op == t("Show")) {
$year = $edit["year"];
$month = $edit["month"];
$day = $edit["day"];
}
else {
print theme("page", message_access());
$year = arg(1);
$month = arg(2);
$day = arg(3);
}
$date = mktime(0, 0, 0, $month, $day, $year) - $user->timezone;
$date_end = mktime(0, 0, 0, $month, $day + 1, $year) - $user->timezone;
/*
** Prepare the values of the form fields:
*/
$years = drupal_map_assoc(range(2000, 2005));
$months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December"));
$days = drupal_map_assoc(range(0, 31));
$start = "<div class=\"container-inline\">";
$start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
$start .= "</div>";
$output .= form($start);
/*
** Fetch nodes for the selected date, or current date if none
** selected.
*/
if ($year && $month && $day) {
$result = db_query_range("SELECT nid FROM {node} WHERE status = '1' AND created > %d AND created < %d ORDER BY created", $date, $date_end, 0, 20);
while ($nid = db_fetch_object($result)) {
$output .= node_view(node_load(array("nid" => $nid->nid)), 1);
}
}
print theme("page", $output);
}
function archive_settings() {

View File

@ -280,45 +280,39 @@ function block_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer blocks")) {
if (empty($op)) {
$op = arg(3);
}
switch ($op) {
case "preview":
$output = block_admin_preview();
break;
case "add":
$output = block_box_form();
break;
case "edit":
$output = block_box_form(block_box_get(arg(4)));
break;
case "delete":
drupal_set_message(block_box_delete(arg(4)));
cache_clear_all();
$output .= block_admin_display();
break;
case t("Save block"):
drupal_set_message(block_box_save($edit));
cache_clear_all();
$output .= block_admin_display();
break;
case t("Save blocks"):
drupal_set_message(block_admin_save($edit));
cache_clear_all();
// fall through
default:
$output .= block_admin_display();
}
print theme("page", $output);
if (empty($op)) {
$op = arg(3);
}
else {
print theme("page", message_access());
switch ($op) {
case "preview":
$output = block_admin_preview();
break;
case "add":
$output = block_box_form();
break;
case "edit":
$output = block_box_form(block_box_get(arg(4)));
break;
case "delete":
drupal_set_message(block_box_delete(arg(4)));
cache_clear_all();
$output .= block_admin_display();
break;
case t("Save block"):
drupal_set_message(block_box_save($edit));
cache_clear_all();
$output .= block_admin_display();
break;
case t("Save blocks"):
drupal_set_message(block_admin_save($edit));
cache_clear_all();
// fall through
default:
$output .= block_admin_display();
}
print theme("page", $output);
}
function block_user($type, $edit, &$user) {

View File

@ -280,45 +280,39 @@ function block_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer blocks")) {
if (empty($op)) {
$op = arg(3);
}
switch ($op) {
case "preview":
$output = block_admin_preview();
break;
case "add":
$output = block_box_form();
break;
case "edit":
$output = block_box_form(block_box_get(arg(4)));
break;
case "delete":
drupal_set_message(block_box_delete(arg(4)));
cache_clear_all();
$output .= block_admin_display();
break;
case t("Save block"):
drupal_set_message(block_box_save($edit));
cache_clear_all();
$output .= block_admin_display();
break;
case t("Save blocks"):
drupal_set_message(block_admin_save($edit));
cache_clear_all();
// fall through
default:
$output .= block_admin_display();
}
print theme("page", $output);
if (empty($op)) {
$op = arg(3);
}
else {
print theme("page", message_access());
switch ($op) {
case "preview":
$output = block_admin_preview();
break;
case "add":
$output = block_box_form();
break;
case "edit":
$output = block_box_form(block_box_get(arg(4)));
break;
case "delete":
drupal_set_message(block_box_delete(arg(4)));
cache_clear_all();
$output .= block_admin_display();
break;
case t("Save block"):
drupal_set_message(block_box_save($edit));
cache_clear_all();
$output .= block_admin_display();
break;
case t("Save blocks"):
drupal_set_message(block_admin_save($edit));
cache_clear_all();
// fall through
default:
$output .= block_admin_display();
}
print theme("page", $output);
}
function block_user($type, $edit, &$user) {

View File

@ -177,29 +177,23 @@ function blog_form(&$node, &$error) {
function blog_page() {
if (user_access("access content")) {
switch (arg(1)) {
case "feed":
if (arg(2)) {
blog_feed_user(arg(2));
}
else {
blog_feed_last();
}
break;
default:
if (arg(1)) {
blog_page_user(arg(1));
}
else {
blog_page_last();
}
}
switch (arg(1)) {
case "feed":
if (arg(2)) {
blog_feed_user(arg(2));
}
else {
blog_feed_last();
}
break;
default:
if (arg(1)) {
blog_page_user(arg(1));
}
else {
blog_page_last();
}
}
else {
print theme("page", message_access());
}
}
function blog_content($node, $main = 0) {

View File

@ -177,29 +177,23 @@ function blog_form(&$node, &$error) {
function blog_page() {
if (user_access("access content")) {
switch (arg(1)) {
case "feed":
if (arg(2)) {
blog_feed_user(arg(2));
}
else {
blog_feed_last();
}
break;
default:
if (arg(1)) {
blog_page_user(arg(1));
}
else {
blog_page_last();
}
}
switch (arg(1)) {
case "feed":
if (arg(2)) {
blog_feed_user(arg(2));
}
else {
blog_feed_last();
}
break;
default:
if (arg(1)) {
blog_page_user(arg(1));
}
else {
blog_page_last();
}
}
else {
print theme("page", message_access());
}
}
function blog_content($node, $main = 0) {

View File

@ -841,33 +841,28 @@ function book_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer nodes")) {
if (empty($op)) {
$op = arg(3);
}
if (empty($op)) {
$op = arg(3);
}
switch ($op) {
case t("Edit book outline"):
case t("Add to book outline"):
case t("Remove from book outline"):
case t("Update book outline"):
$output = book_node_link();
break;
case "orphan":
$output = book_admin_orphan();
break;
case t("Save book pages"):
drupal_set_message(book_admin_save(arg(3), $edit));
// fall through:
default:
$output .= book_admin_view(arg(3));
break;
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch ($op) {
case t("Edit book outline"):
case t("Add to book outline"):
case t("Remove from book outline"):
case t("Update book outline"):
$output = book_node_link();
break;
case "orphan":
$output = book_admin_orphan();
break;
case t("Save book pages"):
drupal_set_message(book_admin_save(arg(3), $edit));
// fall through:
default:
$output .= book_admin_view(arg(3));
break;
}
print theme("page", $output);
}
function book_help($section = "admin/help#book") {

View File

@ -841,33 +841,28 @@ function book_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer nodes")) {
if (empty($op)) {
$op = arg(3);
}
if (empty($op)) {
$op = arg(3);
}
switch ($op) {
case t("Edit book outline"):
case t("Add to book outline"):
case t("Remove from book outline"):
case t("Update book outline"):
$output = book_node_link();
break;
case "orphan":
$output = book_admin_orphan();
break;
case t("Save book pages"):
drupal_set_message(book_admin_save(arg(3), $edit));
// fall through:
default:
$output .= book_admin_view(arg(3));
break;
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch ($op) {
case t("Edit book outline"):
case t("Add to book outline"):
case t("Remove from book outline"):
case t("Update book outline"):
$output = book_node_link();
break;
case "orphan":
$output = book_admin_orphan();
break;
case t("Save book pages"):
drupal_set_message(book_admin_save(arg(3), $edit));
// fall through:
default:
$output .= book_admin_view(arg(3));
break;
}
print theme("page", $output);
}
function book_help($section = "admin/help#book") {

View File

@ -1181,65 +1181,60 @@ function comment_admin() {
$op = arg(3);
}
if (user_access("administer comments")) {
switch ($op) {
case "edit":
$output = comment_admin_edit(arg(3));
break;
case "search":
$output = search_type("comment", url("admin/comment/search"), $_POST["keys"]);
break;
case "votes":
case t("Add new vote"):
case t("Delete vote"):
case t("Save vote"):
if (user_access("administer moderation")) {
$output = comment_mod_votes($edit);
}
break;
case "roles":
case t("Save scores"):
if (user_access("administer moderation")) {
$output = comment_mod_roles($edit);
}
break;
case "matrix":
case t("Submit votes"):
if (user_access("administer moderation")) {
$output = comment_mod_matrix($edit);
}
break;
case "filters":
case t("Add new threshold"):
case t("Delete threshold"):
case t("Save threshold"):
if (user_access("administer moderation")) {
$output = comment_mod_filters($edit);
}
break;
case "delete":
$output = comment_delete(arg(3), 0);
break;
case t("Delete comment"):
$output = comment_delete(arg(3), 1);
break;
case t("Submit"):
$output = comment_save(check_query(arg(3)), $edit);
$output .= comment_admin_overview(0);
break;
default:
if (arg(3) == 1) {
$output = comment_admin_overview(1);
}
else {
$output = comment_admin_overview(0);
}
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch ($op) {
case "edit":
$output = comment_admin_edit(arg(3));
break;
case "search":
$output = search_type("comment", url("admin/comment/search"), $_POST["keys"]);
break;
case "votes":
case t("Add new vote"):
case t("Delete vote"):
case t("Save vote"):
if (user_access("administer moderation")) {
$output = comment_mod_votes($edit);
}
break;
case "roles":
case t("Save scores"):
if (user_access("administer moderation")) {
$output = comment_mod_roles($edit);
}
break;
case "matrix":
case t("Submit votes"):
if (user_access("administer moderation")) {
$output = comment_mod_matrix($edit);
}
break;
case "filters":
case t("Add new threshold"):
case t("Delete threshold"):
case t("Save threshold"):
if (user_access("administer moderation")) {
$output = comment_mod_filters($edit);
}
break;
case "delete":
$output = comment_delete(arg(3), 0);
break;
case t("Delete comment"):
$output = comment_delete(arg(3), 1);
break;
case t("Submit"):
$output = comment_save(check_query(arg(3)), $edit);
$output .= comment_admin_overview(0);
break;
default:
if (arg(3) == 1) {
$output = comment_admin_overview(1);
}
else {
$output = comment_admin_overview(0);
}
}
print theme("page", $output);
}
/*

View File

@ -1181,65 +1181,60 @@ function comment_admin() {
$op = arg(3);
}
if (user_access("administer comments")) {
switch ($op) {
case "edit":
$output = comment_admin_edit(arg(3));
break;
case "search":
$output = search_type("comment", url("admin/comment/search"), $_POST["keys"]);
break;
case "votes":
case t("Add new vote"):
case t("Delete vote"):
case t("Save vote"):
if (user_access("administer moderation")) {
$output = comment_mod_votes($edit);
}
break;
case "roles":
case t("Save scores"):
if (user_access("administer moderation")) {
$output = comment_mod_roles($edit);
}
break;
case "matrix":
case t("Submit votes"):
if (user_access("administer moderation")) {
$output = comment_mod_matrix($edit);
}
break;
case "filters":
case t("Add new threshold"):
case t("Delete threshold"):
case t("Save threshold"):
if (user_access("administer moderation")) {
$output = comment_mod_filters($edit);
}
break;
case "delete":
$output = comment_delete(arg(3), 0);
break;
case t("Delete comment"):
$output = comment_delete(arg(3), 1);
break;
case t("Submit"):
$output = comment_save(check_query(arg(3)), $edit);
$output .= comment_admin_overview(0);
break;
default:
if (arg(3) == 1) {
$output = comment_admin_overview(1);
}
else {
$output = comment_admin_overview(0);
}
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch ($op) {
case "edit":
$output = comment_admin_edit(arg(3));
break;
case "search":
$output = search_type("comment", url("admin/comment/search"), $_POST["keys"]);
break;
case "votes":
case t("Add new vote"):
case t("Delete vote"):
case t("Save vote"):
if (user_access("administer moderation")) {
$output = comment_mod_votes($edit);
}
break;
case "roles":
case t("Save scores"):
if (user_access("administer moderation")) {
$output = comment_mod_roles($edit);
}
break;
case "matrix":
case t("Submit votes"):
if (user_access("administer moderation")) {
$output = comment_mod_matrix($edit);
}
break;
case "filters":
case t("Add new threshold"):
case t("Delete threshold"):
case t("Save threshold"):
if (user_access("administer moderation")) {
$output = comment_mod_filters($edit);
}
break;
case "delete":
$output = comment_delete(arg(3), 0);
break;
case t("Delete comment"):
$output = comment_delete(arg(3), 1);
break;
case t("Submit"):
$output = comment_save(check_query(arg(3)), $edit);
$output .= comment_admin_overview(0);
break;
default:
if (arg(3) == 1) {
$output = comment_admin_overview(1);
}
else {
$output = comment_admin_overview(0);
}
}
print theme("page", $output);
}
/*

View File

@ -95,20 +95,15 @@ function filter_admin_settings() {
}
function filter_admin() {
if (user_access("administer site configuration")) {
switch (arg(3)) {
case "order":
$output = filter_admin_order();
break;
default:
$output = filter_admin_settings();
break;
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch (arg(3)) {
case "order":
$output = filter_admin_order();
break;
default:
$output = filter_admin_settings();
break;
}
print theme("page", $output);
}
function filter_refresh() {

View File

@ -95,20 +95,15 @@ function filter_admin_settings() {
}
function filter_admin() {
if (user_access("administer site configuration")) {
switch (arg(3)) {
case "order":
$output = filter_admin_order();
break;
default:
$output = filter_admin_settings();
break;
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch (arg(3)) {
case "order":
$output = filter_admin_order();
break;
default:
$output = filter_admin_settings();
break;
}
print theme("page", $output);
}
function filter_refresh() {

View File

@ -404,40 +404,35 @@ function forum_page() {
$op = $_POST['op'];
if (user_access('access content')) {
if (module_exist('taxonomy')) {
$tid = arg(1);
if (module_exist('taxonomy')) {
$tid = arg(1);
if (arg(2) == 'new') {
if ($nid = _forum_new($tid)) {
drupal_goto("node/view/$nid");
}
if (arg(2) == 'new') {
if ($nid = _forum_new($tid)) {
drupal_goto("node/view/$nid");
}
if (empty($sortby)) {
$sortby = isset($user->sortby) ? $user->sortby : variable_get('forum_order', 1);
}
if (empty($forum_per_page)) {
$forum_per_page = isset($user->forum_per_page) ? $user->forum_per_page : variable_get('forum_per_page', 25);
}
$offset = ($from / $forum_per_page) + 1;
$forums = forum_get_forums($tid);
$parents = taxonomy_get_parents_all($tid);
if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
$topics = forum_get_topics($tid, $sortby, $forum_per_page);
}
print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset);
}
else {
print theme('page', forum_help('admin/system/modules/forum'), t('Warning'));
if (empty($sortby)) {
$sortby = isset($user->sortby) ? $user->sortby : variable_get('forum_order', 1);
}
if (empty($forum_per_page)) {
$forum_per_page = isset($user->forum_per_page) ? $user->forum_per_page : variable_get('forum_per_page', 25);
}
$offset = ($from / $forum_per_page) + 1;
$forums = forum_get_forums($tid);
$parents = taxonomy_get_parents_all($tid);
if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
$topics = forum_get_topics($tid, $sortby, $forum_per_page);
}
print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset);
}
else {
print theme('page', message_access());
print theme('page', forum_help('admin/system/modules/forum'), t('Warning'));
}
}

View File

@ -404,40 +404,35 @@ function forum_page() {
$op = $_POST['op'];
if (user_access('access content')) {
if (module_exist('taxonomy')) {
$tid = arg(1);
if (module_exist('taxonomy')) {
$tid = arg(1);
if (arg(2) == 'new') {
if ($nid = _forum_new($tid)) {
drupal_goto("node/view/$nid");
}
if (arg(2) == 'new') {
if ($nid = _forum_new($tid)) {
drupal_goto("node/view/$nid");
}
if (empty($sortby)) {
$sortby = isset($user->sortby) ? $user->sortby : variable_get('forum_order', 1);
}
if (empty($forum_per_page)) {
$forum_per_page = isset($user->forum_per_page) ? $user->forum_per_page : variable_get('forum_per_page', 25);
}
$offset = ($from / $forum_per_page) + 1;
$forums = forum_get_forums($tid);
$parents = taxonomy_get_parents_all($tid);
if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
$topics = forum_get_topics($tid, $sortby, $forum_per_page);
}
print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset);
}
else {
print theme('page', forum_help('admin/system/modules/forum'), t('Warning'));
if (empty($sortby)) {
$sortby = isset($user->sortby) ? $user->sortby : variable_get('forum_order', 1);
}
if (empty($forum_per_page)) {
$forum_per_page = isset($user->forum_per_page) ? $user->forum_per_page : variable_get('forum_per_page', 25);
}
$offset = ($from / $forum_per_page) + 1;
$forums = forum_get_forums($tid);
$parents = taxonomy_get_parents_all($tid);
if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
$topics = forum_get_topics($tid, $sortby, $forum_per_page);
}
print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset);
}
else {
print theme('page', message_access());
print theme('page', forum_help('admin/system/modules/forum'), t('Warning'));
}
}

View File

@ -256,52 +256,46 @@ function locale_admin() {
$op = $_POST["op"];
$edit =& $_POST["edit"];
if (user_access('administer locales')) {
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case 'delete':
$output .= locale_delete(check_query(arg(3)));
$output .= locale_seek();
break;
case 'edit':
$output .= locale_edit(check_query(arg(3)));
$output .= locale_seek();
break;
case 'search':
if (locale_seek_query()) {
$output = locale_seek();
}
$output .= locale_seek_form();
break;
case t('Search'):
$output = locale_seek();
$output .= locale_seek_form();
break;
case t('Save translations'):
$output .= locale_save(check_query(arg(3)));
$output .= locale_seek_form();
break;
default:
if (arg(3) == 'translated') {
$edit['status'] = 1;
$edit['language'] = arg(2);
}
else {
$edit['status'] = 2;
$edit['language'] = arg(2);
}
$output = locale_seek();
$output .= locale_seek_form();
}
print theme('page', $output);
if (empty($op)) {
$op = arg(2);
}
else {
print theme('page', message_access());
switch ($op) {
case 'delete':
$output .= locale_delete(check_query(arg(3)));
$output .= locale_seek();
break;
case 'edit':
$output .= locale_edit(check_query(arg(3)));
$output .= locale_seek();
break;
case 'search':
if (locale_seek_query()) {
$output = locale_seek();
}
$output .= locale_seek_form();
break;
case t('Search'):
$output = locale_seek();
$output .= locale_seek_form();
break;
case t('Save translations'):
$output .= locale_save(check_query(arg(3)));
$output .= locale_seek_form();
break;
default:
if (arg(3) == 'translated') {
$edit['status'] = 1;
$edit['language'] = arg(2);
}
else {
$edit['status'] = 2;
$edit['language'] = arg(2);
}
$output = locale_seek();
$output .= locale_seek_form();
}
print theme('page', $output);
}
function locale($string) {

View File

@ -256,52 +256,46 @@ function locale_admin() {
$op = $_POST["op"];
$edit =& $_POST["edit"];
if (user_access('administer locales')) {
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case 'delete':
$output .= locale_delete(check_query(arg(3)));
$output .= locale_seek();
break;
case 'edit':
$output .= locale_edit(check_query(arg(3)));
$output .= locale_seek();
break;
case 'search':
if (locale_seek_query()) {
$output = locale_seek();
}
$output .= locale_seek_form();
break;
case t('Search'):
$output = locale_seek();
$output .= locale_seek_form();
break;
case t('Save translations'):
$output .= locale_save(check_query(arg(3)));
$output .= locale_seek_form();
break;
default:
if (arg(3) == 'translated') {
$edit['status'] = 1;
$edit['language'] = arg(2);
}
else {
$edit['status'] = 2;
$edit['language'] = arg(2);
}
$output = locale_seek();
$output .= locale_seek_form();
}
print theme('page', $output);
if (empty($op)) {
$op = arg(2);
}
else {
print theme('page', message_access());
switch ($op) {
case 'delete':
$output .= locale_delete(check_query(arg(3)));
$output .= locale_seek();
break;
case 'edit':
$output .= locale_edit(check_query(arg(3)));
$output .= locale_seek();
break;
case 'search':
if (locale_seek_query()) {
$output = locale_seek();
}
$output .= locale_seek_form();
break;
case t('Search'):
$output = locale_seek();
$output .= locale_seek_form();
break;
case t('Save translations'):
$output .= locale_save(check_query(arg(3)));
$output .= locale_seek_form();
break;
default:
if (arg(3) == 'translated') {
$edit['status'] = 1;
$edit['language'] = arg(2);
}
else {
$edit['status'] = 2;
$edit['language'] = arg(2);
}
$output = locale_seek();
$output .= locale_seek_form();
}
print theme('page', $output);
}
function locale($string) {

View File

@ -932,48 +932,42 @@ function node_admin() {
$op = $_POST['op'];
$edit = $_POST['edit'];
if (user_access('administer nodes')) {
if (empty($op)) {
$op = arg(2);
}
/*
** Compile a list of the administrative links:
*/
switch ($op) {
case 'search':
$output = search_type('node', url('admin/node/search'), $_POST['keys']);
break;
case 'edit':
$output = node_admin_edit(arg(3));
break;
case 'delete':
$output = node_delete(array('nid' => arg(3)));
break;
case t('Preview'):
$edit = node_validate($edit, $error);
$output = node_preview($edit, $error);
break;
case t('Submit'):
$output = node_submit($edit);
break;
case t('Delete'):
$output = node_delete($edit);
break;
case t('Save configuration'):
case t('Reset to defaults'):
case 'settings':
$output = node_admin_settings($edit);
break;
default:
$output = node_admin_nodes();
}
print theme('page', $output);
if (empty($op)) {
$op = arg(2);
}
else {
print theme('page', message_access());
/*
** Compile a list of the administrative links:
*/
switch ($op) {
case 'search':
$output = search_type('node', url('admin/node/search'), $_POST['keys']);
break;
case 'edit':
$output = node_admin_edit(arg(3));
break;
case 'delete':
$output = node_delete(array('nid' => arg(3)));
break;
case t('Preview'):
$edit = node_validate($edit, $error);
$output = node_preview($edit, $error);
break;
case t('Submit'):
$output = node_submit($edit);
break;
case t('Delete'):
$output = node_delete($edit);
break;
case t('Save configuration'):
case t('Reset to defaults'):
case 'settings':
$output = node_admin_settings($edit);
break;
default:
$output = node_admin_nodes();
}
print theme('page', $output);
}
function node_block($op = 'list', $delta = 0) {
@ -1519,59 +1513,53 @@ function node_page_default() {
}
function node_page() {
if (user_access('access content')) {
$op = $_POST['op'] ? $_POST['op'] : arg(1);
$edit = $_POST['edit'];
$op = $_POST['op'] ? $_POST['op'] : arg(1);
$edit = $_POST['edit'];
switch ($op) {
case 'feed':
node_feed();
return;
case 'add':
// When a module defines multiple node types, the URL is of the form 'foo/bar':
print theme('page', node_add(arg(3) ? arg(2) ."/". arg(3) : arg(2)));
break;
case 'edit':
print theme('page', node_edit(arg(2)));
break;
case 'view':
if ($node = node_load(array('nid' => arg(2)), $_GET['revision'])) {
print theme('page', node_show($node, arg(3)), $node->title);
}
else {
drupal_not_found();
}
break;
case 'revisions':
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case 'rollback-revision':
node_revision_rollback(arg(2), arg(3));
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case 'delete-revision':
node_revision_delete(arg(2), arg(3));
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case t('Preview'):
$edit = node_validate($edit, $error);
print theme('page', node_preview($edit, $error), t('Preview %name', array('%name' => $name)));
break;
case t('Submit'):
drupal_set_title(t('Submit %name', array('%name' => $name)));
print theme('page', node_submit($edit));
break;
case t('Delete'):
print theme('page', node_delete($edit), t('Delete %name', array('%name' => $name)));
break;
default:
print theme('page', node_page_default(), '');
}
switch ($op) {
case 'feed':
node_feed();
return;
case 'add':
// When a module defines multiple node types, the URL is of the form 'foo/bar':
print theme('page', node_add(arg(3) ? arg(2) ."/". arg(3) : arg(2)));
break;
case 'edit':
print theme('page', node_edit(arg(2)));
break;
case 'view':
if ($node = node_load(array('nid' => arg(2)), $_GET['revision'])) {
print theme('page', node_show($node, arg(3)), $node->title);
}
else {
drupal_not_found();
}
break;
case 'revisions':
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case 'rollback-revision':
node_revision_rollback(arg(2), arg(3));
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case 'delete-revision':
node_revision_delete(arg(2), arg(3));
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case t('Preview'):
$edit = node_validate($edit, $error);
print theme('page', node_preview($edit, $error), t('Preview %name', array('%name' => $name)));
break;
case t('Submit'):
drupal_set_title(t('Submit %name', array('%name' => $name)));
print theme('page', node_submit($edit));
break;
case t('Delete'):
print theme('page', node_delete($edit), t('Delete %name', array('%name' => $name)));
break;
default:
print theme('page', node_page_default(), '');
}
else {
print theme('page', message_access());
}
}
function node_update_index() {

View File

@ -932,48 +932,42 @@ function node_admin() {
$op = $_POST['op'];
$edit = $_POST['edit'];
if (user_access('administer nodes')) {
if (empty($op)) {
$op = arg(2);
}
/*
** Compile a list of the administrative links:
*/
switch ($op) {
case 'search':
$output = search_type('node', url('admin/node/search'), $_POST['keys']);
break;
case 'edit':
$output = node_admin_edit(arg(3));
break;
case 'delete':
$output = node_delete(array('nid' => arg(3)));
break;
case t('Preview'):
$edit = node_validate($edit, $error);
$output = node_preview($edit, $error);
break;
case t('Submit'):
$output = node_submit($edit);
break;
case t('Delete'):
$output = node_delete($edit);
break;
case t('Save configuration'):
case t('Reset to defaults'):
case 'settings':
$output = node_admin_settings($edit);
break;
default:
$output = node_admin_nodes();
}
print theme('page', $output);
if (empty($op)) {
$op = arg(2);
}
else {
print theme('page', message_access());
/*
** Compile a list of the administrative links:
*/
switch ($op) {
case 'search':
$output = search_type('node', url('admin/node/search'), $_POST['keys']);
break;
case 'edit':
$output = node_admin_edit(arg(3));
break;
case 'delete':
$output = node_delete(array('nid' => arg(3)));
break;
case t('Preview'):
$edit = node_validate($edit, $error);
$output = node_preview($edit, $error);
break;
case t('Submit'):
$output = node_submit($edit);
break;
case t('Delete'):
$output = node_delete($edit);
break;
case t('Save configuration'):
case t('Reset to defaults'):
case 'settings':
$output = node_admin_settings($edit);
break;
default:
$output = node_admin_nodes();
}
print theme('page', $output);
}
function node_block($op = 'list', $delta = 0) {
@ -1519,59 +1513,53 @@ function node_page_default() {
}
function node_page() {
if (user_access('access content')) {
$op = $_POST['op'] ? $_POST['op'] : arg(1);
$edit = $_POST['edit'];
$op = $_POST['op'] ? $_POST['op'] : arg(1);
$edit = $_POST['edit'];
switch ($op) {
case 'feed':
node_feed();
return;
case 'add':
// When a module defines multiple node types, the URL is of the form 'foo/bar':
print theme('page', node_add(arg(3) ? arg(2) ."/". arg(3) : arg(2)));
break;
case 'edit':
print theme('page', node_edit(arg(2)));
break;
case 'view':
if ($node = node_load(array('nid' => arg(2)), $_GET['revision'])) {
print theme('page', node_show($node, arg(3)), $node->title);
}
else {
drupal_not_found();
}
break;
case 'revisions':
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case 'rollback-revision':
node_revision_rollback(arg(2), arg(3));
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case 'delete-revision':
node_revision_delete(arg(2), arg(3));
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case t('Preview'):
$edit = node_validate($edit, $error);
print theme('page', node_preview($edit, $error), t('Preview %name', array('%name' => $name)));
break;
case t('Submit'):
drupal_set_title(t('Submit %name', array('%name' => $name)));
print theme('page', node_submit($edit));
break;
case t('Delete'):
print theme('page', node_delete($edit), t('Delete %name', array('%name' => $name)));
break;
default:
print theme('page', node_page_default(), '');
}
switch ($op) {
case 'feed':
node_feed();
return;
case 'add':
// When a module defines multiple node types, the URL is of the form 'foo/bar':
print theme('page', node_add(arg(3) ? arg(2) ."/". arg(3) : arg(2)));
break;
case 'edit':
print theme('page', node_edit(arg(2)));
break;
case 'view':
if ($node = node_load(array('nid' => arg(2)), $_GET['revision'])) {
print theme('page', node_show($node, arg(3)), $node->title);
}
else {
drupal_not_found();
}
break;
case 'revisions':
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case 'rollback-revision':
node_revision_rollback(arg(2), arg(3));
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case 'delete-revision':
node_revision_delete(arg(2), arg(3));
print theme('page', node_revision_overview(arg(2)), t('Revisions'));
break;
case t('Preview'):
$edit = node_validate($edit, $error);
print theme('page', node_preview($edit, $error), t('Preview %name', array('%name' => $name)));
break;
case t('Submit'):
drupal_set_title(t('Submit %name', array('%name' => $name)));
print theme('page', node_submit($edit));
break;
case t('Delete'):
print theme('page', node_delete($edit), t('Delete %name', array('%name' => $name)));
break;
default:
print theme('page', node_page_default(), '');
}
else {
print theme('page', message_access());
}
}
function node_update_index() {

View File

@ -5,44 +5,38 @@ function path_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer url aliases")) {
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case "add":
$output = path_form();
break;
case "edit":
$output = path_form(path_load(arg(3)));
break;
case "help":
$output = path_help();
break;
case "delete":
path_delete(arg(3));
$output .= path_overview();
break;
case t("Create new alias"):
case t("Update alias"):
$output = path_save($edit);
break;
default:
$output .= path_overview();
}
print theme("page", $output);
if (empty($op)) {
$op = arg(2);
}
else {
print theme("page", message_access());
switch ($op) {
case "add":
$output = path_form();
break;
case "edit":
$output = path_form(path_load(arg(3)));
break;
case "help":
$output = path_help();
break;
case "delete":
path_delete(arg(3));
$output .= path_overview();
break;
case t("Create new alias"):
case t("Update alias"):
$output = path_save($edit);
break;
default:
$output .= path_overview();
}
print theme("page", $output);
}
function path_set_alias($path = NULL, $alias = NULL) {
@ -154,7 +148,7 @@ function path_link($type, $node = NULL) {
menu("admin/path", t("url aliasing"), "path_admin", 4);
menu("admin/path/add", t("new alias"), "path_admin");
menu("admin/path/help", t("help"), "path_admin", 9);
}
}
}
function path_nodeapi(&$node, $op, $arg) {

View File

@ -5,44 +5,38 @@ function path_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer url aliases")) {
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case "add":
$output = path_form();
break;
case "edit":
$output = path_form(path_load(arg(3)));
break;
case "help":
$output = path_help();
break;
case "delete":
path_delete(arg(3));
$output .= path_overview();
break;
case t("Create new alias"):
case t("Update alias"):
$output = path_save($edit);
break;
default:
$output .= path_overview();
}
print theme("page", $output);
if (empty($op)) {
$op = arg(2);
}
else {
print theme("page", message_access());
switch ($op) {
case "add":
$output = path_form();
break;
case "edit":
$output = path_form(path_load(arg(3)));
break;
case "help":
$output = path_help();
break;
case "delete":
path_delete(arg(3));
$output .= path_overview();
break;
case t("Create new alias"):
case t("Update alias"):
$output = path_save($edit);
break;
default:
$output .= path_overview();
}
print theme("page", $output);
}
function path_set_alias($path = NULL, $alias = NULL) {
@ -154,7 +148,7 @@ function path_link($type, $node = NULL) {
menu("admin/path", t("url aliasing"), "path_admin", 4);
menu("admin/path/add", t("new alias"), "path_admin");
menu("admin/path/help", t("help"), "path_admin", 9);
}
}
}
function path_nodeapi(&$node, $op, $arg) {

View File

@ -190,16 +190,11 @@ function queue_view($nid) {
function queue_page() {
global $user, $vote;
if ($user->uid && user_access("access submission queue")) {
if (arg(1)) {
queue_view(arg(1));
}
else {
queue_overview();
}
if (arg(1)) {
queue_view(arg(1));
}
else {
print theme("page", message_access());
queue_overview();
}
}

View File

@ -58,27 +58,6 @@ function search_settings() {
return $output;
}
/**
* search engine administration actions
*/
function search_admin() {
$op = $_POST["op"];
// Only allow people with sufficient access.
if (user_access("administer search")) {
if ($op == "reindex") {
search_invalidate();
$output = t("index invalidated") ."<br />\n";
search_cron();
$output .= t("index recreated") ."<br /><hr />\n";
print theme("page", $output);
}
}
else {
print theme("page", message_access());
}
}
/**
* perform a regularly run action across all modules that have the
* <i>module</i>_update_index function in them.

View File

@ -58,27 +58,6 @@ function search_settings() {
return $output;
}
/**
* search engine administration actions
*/
function search_admin() {
$op = $_POST["op"];
// Only allow people with sufficient access.
if (user_access("administer search")) {
if ($op == "reindex") {
search_invalidate();
$output = t("index invalidated") ."<br />\n";
search_cron();
$output .= t("index recreated") ."<br /><hr />\n";
print theme("page", $output);
}
}
else {
print theme("page", message_access());
}
}
/**
* perform a regularly run action across all modules that have the
* <i>module</i>_update_index function in them.

View File

@ -192,30 +192,23 @@ function statistics_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
/* Only allow people with sufficient access. */
if ((user_access("administer statistics module")) || (user_access("administer statistics"))) {
if (empty($op)) {
$op = arg(2);
}
/* non-configuration admin pages */
switch ($op) {
case "referrers":
$output = statistics_top_refer();
break;
case "log":
$output = statistics_admin_displaylog();
break;
default:
$output = statistics_admin_topnodes();
}
print theme("page", $output);
if (empty($op)) {
$op = arg(2);
}
else {
print theme("page", message_access());
/* non-configuration admin pages */
switch ($op) {
case "referrers":
$output = statistics_top_refer();
break;
case "log":
$output = statistics_admin_displaylog();
break;
default:
$output = statistics_admin_topnodes();
}
print theme("page", $output);
}
@ -497,42 +490,36 @@ function statistics_block($op = "list", $delta = 0) {
function statistics_page() {
if (user_access("access content")) {
$output = "";
$output = "";
// build day's most popular content list if enabled
if ($displaycount = variable_get("statistics_userpage_day_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("daycount", $displaycount);
$table .= "</table>";
// build day's most popular content list if enabled
if ($displaycount = variable_get("statistics_userpage_day_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("daycount", $displaycount);
$table .= "</table>";
$output .= theme("box", t("Day's most popular content:"), $table, "main");
}
// build all time most popular content list if enabled
if ($displaycount = variable_get("statistics_userpage_all_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("totalcount", $displaycount);
$table .= "</table>";
$output .= theme("box", t("All time most popular content:"), $table, "main");
}
// build last viewed content list if enabled
if ($displaycount = variable_get("statistics_userpage_last_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("timestamp", $displaycount);
$table .= "</table>";
$output .= theme("box", t("Last viewed content:"), $table, "main");
}
print theme("page", $output);
$output .= theme("box", t("Day's most popular content:"), $table, "main");
}
else {
// access denied
print theme("page", message_access());
// build all time most popular content list if enabled
if ($displaycount = variable_get("statistics_userpage_all_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("totalcount", $displaycount);
$table .= "</table>";
$output .= theme("box", t("All time most popular content:"), $table, "main");
}
// build last viewed content list if enabled
if ($displaycount = variable_get("statistics_userpage_last_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("timestamp", $displaycount);
$table .= "</table>";
$output .= theme("box", t("Last viewed content:"), $table, "main");
}
print theme("page", $output);
}

View File

@ -192,30 +192,23 @@ function statistics_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
/* Only allow people with sufficient access. */
if ((user_access("administer statistics module")) || (user_access("administer statistics"))) {
if (empty($op)) {
$op = arg(2);
}
/* non-configuration admin pages */
switch ($op) {
case "referrers":
$output = statistics_top_refer();
break;
case "log":
$output = statistics_admin_displaylog();
break;
default:
$output = statistics_admin_topnodes();
}
print theme("page", $output);
if (empty($op)) {
$op = arg(2);
}
else {
print theme("page", message_access());
/* non-configuration admin pages */
switch ($op) {
case "referrers":
$output = statistics_top_refer();
break;
case "log":
$output = statistics_admin_displaylog();
break;
default:
$output = statistics_admin_topnodes();
}
print theme("page", $output);
}
@ -497,42 +490,36 @@ function statistics_block($op = "list", $delta = 0) {
function statistics_page() {
if (user_access("access content")) {
$output = "";
$output = "";
// build day's most popular content list if enabled
if ($displaycount = variable_get("statistics_userpage_day_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("daycount", $displaycount);
$table .= "</table>";
// build day's most popular content list if enabled
if ($displaycount = variable_get("statistics_userpage_day_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("daycount", $displaycount);
$table .= "</table>";
$output .= theme("box", t("Day's most popular content:"), $table, "main");
}
// build all time most popular content list if enabled
if ($displaycount = variable_get("statistics_userpage_all_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("totalcount", $displaycount);
$table .= "</table>";
$output .= theme("box", t("All time most popular content:"), $table, "main");
}
// build last viewed content list if enabled
if ($displaycount = variable_get("statistics_userpage_last_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("timestamp", $displaycount);
$table .= "</table>";
$output .= theme("box", t("Last viewed content:"), $table, "main");
}
print theme("page", $output);
$output .= theme("box", t("Day's most popular content:"), $table, "main");
}
else {
// access denied
print theme("page", message_access());
// build all time most popular content list if enabled
if ($displaycount = variable_get("statistics_userpage_all_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("totalcount", $displaycount);
$table .= "</table>";
$output .= theme("box", t("All time most popular content:"), $table, "main");
}
// build last viewed content list if enabled
if ($displaycount = variable_get("statistics_userpage_last_cnt", 0)) {
$table = "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" style=\"width: 100%;\">";
$table .= statistics_summary("timestamp", $displaycount);
$table .= "</table>";
$output .= theme("box", t("Last viewed content:"), $table, "main");
}
print theme("page", $output);
}

View File

@ -361,13 +361,8 @@ function system_settings_save() {
}
function system_admin() {
if (user_access("administer site configuration")) {
$output = system_view(arg(2), arg(3));
print theme("page", $output);
}
else {
print theme("page", message_access());
}
$output = system_view(arg(2), arg(3));
print theme("page", $output);
}
?>

View File

@ -361,13 +361,8 @@ function system_settings_save() {
}
function system_admin() {
if (user_access("administer site configuration")) {
$output = system_view(arg(2), arg(3));
print theme("page", $output);
}
else {
print theme("page", message_access());
}
$output = system_view(arg(2), arg(3));
print theme("page", $output);
}
?>

View File

@ -767,68 +767,63 @@ function taxonomy_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer taxonomy")) {
if (empty($op)) {
$op = arg(2);
}
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case "add":
switch ($op) {
case "add":
if (arg(3) == "vocabulary") {
$output .= taxonomy_form_vocabulary();
}
else if (arg(3) == "term") {
$output .= taxonomy_form_term();
}
break;
case "edit":
if (arg(3) == "vocabulary") {
$output .= taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary(arg(4))));
}
else if (arg(3) == "term") {
$output .= taxonomy_form_term(object2array(taxonomy_get_term(arg(4))));
}
break;
case "preview":
$output .= taxonomy_form(arg(4));
break;
case "help":
$output .= taxonomy_help();
break;
case t("Delete"):
if (!$edit["confirm"]) {
if (arg(3) == "vocabulary") {
$output .= taxonomy_form_vocabulary();
$output .= _taxonomy_confirm_del_vocabulary($edit["vid"]);
}
else if (arg(3) == "term") {
else {
$output .= _taxonomy_confirm_del_term($edit["tid"]);
}
break;
}
else {
$edit["name"] = 0;
// fall through:
}
case t("Submit"):
if (arg(3) == "vocabulary") {
taxonomy_save_vocabulary($edit);
}
else {
taxonomy_save_term($edit);
if (!$edit["tid"]) {
// if INSERT show form again
$output .= taxonomy_form_term();
}
break;
case "edit":
if (arg(3) == "vocabulary") {
$output .= taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary(arg(4))));
}
else if (arg(3) == "term") {
$output .= taxonomy_form_term(object2array(taxonomy_get_term(arg(4))));
}
break;
case "preview":
$output .= taxonomy_form(arg(4));
break;
case "help":
$output .= taxonomy_help();
break;
case t("Delete"):
if (!$edit["confirm"]) {
if (arg(3) == "vocabulary") {
$output .= _taxonomy_confirm_del_vocabulary($edit["vid"]);
}
else {
$output .= _taxonomy_confirm_del_term($edit["tid"]);
}
break;
}
else {
$edit["name"] = 0;
// fall through:
}
case t("Submit"):
if (arg(3) == "vocabulary") {
taxonomy_save_vocabulary($edit);
}
else {
taxonomy_save_term($edit);
if (!$edit["tid"]) {
// if INSERT show form again
$output .= taxonomy_form_term();
break;
}
// else (UPDATE or DELETE) fall through
}
// fall through:
default:
$output .= taxonomy_overview();
}
}
else {
$output .= message_access();
// else (UPDATE or DELETE) fall through
}
// fall through:
default:
$output .= taxonomy_overview();
}
print theme("page", $output);

View File

@ -767,68 +767,63 @@ function taxonomy_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer taxonomy")) {
if (empty($op)) {
$op = arg(2);
}
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case "add":
switch ($op) {
case "add":
if (arg(3) == "vocabulary") {
$output .= taxonomy_form_vocabulary();
}
else if (arg(3) == "term") {
$output .= taxonomy_form_term();
}
break;
case "edit":
if (arg(3) == "vocabulary") {
$output .= taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary(arg(4))));
}
else if (arg(3) == "term") {
$output .= taxonomy_form_term(object2array(taxonomy_get_term(arg(4))));
}
break;
case "preview":
$output .= taxonomy_form(arg(4));
break;
case "help":
$output .= taxonomy_help();
break;
case t("Delete"):
if (!$edit["confirm"]) {
if (arg(3) == "vocabulary") {
$output .= taxonomy_form_vocabulary();
$output .= _taxonomy_confirm_del_vocabulary($edit["vid"]);
}
else if (arg(3) == "term") {
else {
$output .= _taxonomy_confirm_del_term($edit["tid"]);
}
break;
}
else {
$edit["name"] = 0;
// fall through:
}
case t("Submit"):
if (arg(3) == "vocabulary") {
taxonomy_save_vocabulary($edit);
}
else {
taxonomy_save_term($edit);
if (!$edit["tid"]) {
// if INSERT show form again
$output .= taxonomy_form_term();
}
break;
case "edit":
if (arg(3) == "vocabulary") {
$output .= taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary(arg(4))));
}
else if (arg(3) == "term") {
$output .= taxonomy_form_term(object2array(taxonomy_get_term(arg(4))));
}
break;
case "preview":
$output .= taxonomy_form(arg(4));
break;
case "help":
$output .= taxonomy_help();
break;
case t("Delete"):
if (!$edit["confirm"]) {
if (arg(3) == "vocabulary") {
$output .= _taxonomy_confirm_del_vocabulary($edit["vid"]);
}
else {
$output .= _taxonomy_confirm_del_term($edit["tid"]);
}
break;
}
else {
$edit["name"] = 0;
// fall through:
}
case t("Submit"):
if (arg(3) == "vocabulary") {
taxonomy_save_vocabulary($edit);
}
else {
taxonomy_save_term($edit);
if (!$edit["tid"]) {
// if INSERT show form again
$output .= taxonomy_form_term();
break;
}
// else (UPDATE or DELETE) fall through
}
// fall through:
default:
$output .= taxonomy_overview();
}
}
else {
$output .= message_access();
// else (UPDATE or DELETE) fall through
}
// fall through:
default:
$output .= taxonomy_overview();
}
print theme("page", $output);

View File

@ -23,44 +23,38 @@ function title_link($type) {
function title_page() {
if (user_access("access content")) {
$title = urldecode(arg(1));
$result = db_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.title = '%s' AND n.status = 1 ORDER BY n.created DESC", $title);
$title = urldecode(arg(1));
$result = db_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.title = '%s' AND n.status = 1 ORDER BY n.created DESC", $title);
if (db_num_rows($result) == 0) {
// No node with exact title found, try substring.
$result = db_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.title LIKE '%%%s%%' AND n.status = 1 ORDER BY n.created DESC", $title);
}
if (db_num_rows($result) == 0) {
// No node with exact title found, try substring.
$result = db_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.title LIKE '%%%s%%' AND n.status = 1 ORDER BY n.created DESC", $title);
}
if (db_num_rows($result) == 0 && module_exist("search")) {
// still no matches ... return a full text search
search_view($title);
}
else if (db_num_rows($result) == 1) {
$node = db_fetch_object($result);
$node = node_load(array("nid" => $node->nid));
print theme("page", node_show($node, NULL), $node->title);
}
else {
$header = array(t("Type"), t("Title"), t("Author"));
while ($node = db_fetch_object($result)) {
$type = ucfirst(module_invoke($node->type, "node", "name"));
$title = l($node->title, "node/view/$node->nid");
$author = format_name($node);
$rows[] = array(array("data" => $type, "class" => "type"), array("data" => $title, "class" => "content"), array("data" => $author, "class" => "author"));
}
$output = "<div id=\"title\">";
$output .= theme("table", $header, $rows);
$output .= "</div>";
drupal_set_title(t("Matching Posts"));
print theme("page", $output);
}
if (db_num_rows($result) == 0 && module_exist("search")) {
// still no matches ... return a full text search
search_view($title);
}
else if (db_num_rows($result) == 1) {
$node = db_fetch_object($result);
$node = node_load(array("nid" => $node->nid));
print theme("page", node_show($node, NULL), $node->title);
}
else {
print theme("page", message_access());
$header = array(t("Type"), t("Title"), t("Author"));
while ($node = db_fetch_object($result)) {
$type = ucfirst(module_invoke($node->type, "node", "name"));
$title = l($node->title, "node/view/$node->nid");
$author = format_name($node);
$rows[] = array(array("data" => $type, "class" => "type"), array("data" => $title, "class" => "content"), array("data" => $author, "class" => "author"));
}
$output = "<div id=\"title\">";
$output .= theme("table", $header, $rows);
$output .= "</div>";
drupal_set_title(t("Matching Posts"));
print theme("page", $output);
}
}

View File

@ -103,12 +103,7 @@ function tracker_user($type, &$edit, &$user) {
function tracker_page() {
global $user;
if (user_access("access content")) {
print theme("page", tracker_posts(arg(1)), t("Recent posts"));
}
else {
print theme("page", message_access());
}
print theme("page", tracker_posts(arg(1)), t("Recent posts"));
}
?>

View File

@ -103,12 +103,7 @@ function tracker_user($type, &$edit, &$user) {
function tracker_page() {
global $user;
if (user_access("access content")) {
print theme("page", tracker_posts(arg(1)), t("Recent posts"));
}
else {
print theme("page", message_access());
}
print theme("page", tracker_posts(arg(1)), t("Recent posts"));
}
?>

View File

@ -1494,49 +1494,44 @@ function user_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer users")) {
if (empty($op)) {
$op = arg(2);
}
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case "search":
$output = search_type('user', url("admin/user/search"), $_POST["keys"]);
break;
case t("Add rule"):
case t("Check"):
case "access":
$output .= user_admin_access($edit);
break;
case t("Save permissions"):
drupal_set_message(t("user permissions saved."));
case "permission":
$output .= user_admin_perm($edit);
break;
case t("Create account"):
case "create":
$output = user_admin_create($edit);
break;
case t("Add role"):
case t("Delete role"):
case t("Save role"):
drupal_set_message(t("your role changes were saved."));
case "role":
$output .= user_admin_role($edit);
break;
case t("Delete account"):
case t("Save account"):
case "edit":
$output = user_admin_edit($edit);
break;
default:
$output = user_admin_account();
}
print theme('page', $output);
}
else {
print theme('page', message_access());
switch ($op) {
case "search":
$output = search_type('user', url("admin/user/search"), $_POST["keys"]);
break;
case t("Add rule"):
case t("Check"):
case "access":
$output .= user_admin_access($edit);
break;
case t("Save permissions"):
drupal_set_message(t("user permissions saved."));
case "permission":
$output .= user_admin_perm($edit);
break;
case t("Create account"):
case "create":
$output = user_admin_create($edit);
break;
case t("Add role"):
case t("Delete role"):
case t("Save role"):
drupal_set_message(t("your role changes were saved."));
case "role":
$output .= user_admin_role($edit);
break;
case t("Delete account"):
case t("Save account"):
case "edit":
$output = user_admin_edit($edit);
break;
default:
$output = user_admin_account();
}
print theme('page', $output);
}
// the following functions comprise help for admins and developers
function user_help($section = "admin/help#user") {

View File

@ -1494,49 +1494,44 @@ function user_admin() {
$op = $_POST["op"];
$edit = $_POST["edit"];
if (user_access("administer users")) {
if (empty($op)) {
$op = arg(2);
}
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case "search":
$output = search_type('user', url("admin/user/search"), $_POST["keys"]);
break;
case t("Add rule"):
case t("Check"):
case "access":
$output .= user_admin_access($edit);
break;
case t("Save permissions"):
drupal_set_message(t("user permissions saved."));
case "permission":
$output .= user_admin_perm($edit);
break;
case t("Create account"):
case "create":
$output = user_admin_create($edit);
break;
case t("Add role"):
case t("Delete role"):
case t("Save role"):
drupal_set_message(t("your role changes were saved."));
case "role":
$output .= user_admin_role($edit);
break;
case t("Delete account"):
case t("Save account"):
case "edit":
$output = user_admin_edit($edit);
break;
default:
$output = user_admin_account();
}
print theme('page', $output);
}
else {
print theme('page', message_access());
switch ($op) {
case "search":
$output = search_type('user', url("admin/user/search"), $_POST["keys"]);
break;
case t("Add rule"):
case t("Check"):
case "access":
$output .= user_admin_access($edit);
break;
case t("Save permissions"):
drupal_set_message(t("user permissions saved."));
case "permission":
$output .= user_admin_perm($edit);
break;
case t("Create account"):
case "create":
$output = user_admin_create($edit);
break;
case t("Add role"):
case t("Delete role"):
case t("Save role"):
drupal_set_message(t("your role changes were saved."));
case "role":
$output .= user_admin_role($edit);
break;
case t("Delete account"):
case t("Save account"):
case "edit":
$output = user_admin_edit($edit);
break;
default:
$output = user_admin_account();
}
print theme('page', $output);
}
// the following functions comprise help for admins and developers
function user_help($section = "admin/help#user") {

View File

@ -83,7 +83,7 @@ function watchdog_overview($type) {
$header = array(
array("data" => t("date"), "field" => "w.timestamp", "sort" => "desc"),
array("data" => t("event"), "field" => "w.message"),
array("data" => t("message"), "field" => "w.message"),
array("data" => t("user"), "field" => "u.name"),
array("data" => t("operations"), "colspan" => "2")
);
@ -132,22 +132,17 @@ function watchdog_view($id) {
function watchdog_admin() {
if (user_access("administer watchdog")) {
switch (arg(2)) {
case "help":
$output = watchdog_help();
break;
case "view":
$output = watchdog_view(arg(3));
break;
default:
$output = watchdog_overview(arg(2));
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch (arg(2)) {
case "help":
$output = watchdog_help();
break;
case "view":
$output = watchdog_view(arg(3));
break;
default:
$output = watchdog_overview(arg(2));
}
print theme("page", $output);
}
function _watchdog_get_message_types() {

View File

@ -83,7 +83,7 @@ function watchdog_overview($type) {
$header = array(
array("data" => t("date"), "field" => "w.timestamp", "sort" => "desc"),
array("data" => t("event"), "field" => "w.message"),
array("data" => t("message"), "field" => "w.message"),
array("data" => t("user"), "field" => "u.name"),
array("data" => t("operations"), "colspan" => "2")
);
@ -132,22 +132,17 @@ function watchdog_view($id) {
function watchdog_admin() {
if (user_access("administer watchdog")) {
switch (arg(2)) {
case "help":
$output = watchdog_help();
break;
case "view":
$output = watchdog_view(arg(3));
break;
default:
$output = watchdog_overview(arg(2));
}
print theme("page", $output);
}
else {
print theme("page", message_access());
switch (arg(2)) {
case "help":
$output = watchdog_help();
break;
case "view":
$output = watchdog_view(arg(3));
break;
default:
$output = watchdog_overview(arg(2));
}
print theme("page", $output);
}
function _watchdog_get_message_types() {