diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-03-28 07:03:47 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-03-28 07:03:47 +0000 |
commit | 3f2b0e0b3f0322dac929bb997a331cb7c021f295 (patch) | |
tree | 01940cabb5f1b50c16822e8585092ab9cee543ce | |
parent | 6bb49b4bb8d7c73e1cce62e27375559b9837b898 (diff) | |
download | brdo-3f2b0e0b3f0322dac929bb997a331cb7c021f295.tar.gz brdo-3f2b0e0b3f0322dac929bb997a331cb7c021f295.tar.bz2 |
Flushing my backlog (in case Natrak wants to make more changes):
- tidied up some of the code
- fixed a small problems
-rw-r--r-- | account.php | 4 | ||||
-rw-r--r-- | error.php | 4 | ||||
-rw-r--r-- | includes/hostname.conf | 3 | ||||
-rw-r--r-- | includes/user.inc | 2 | ||||
-rw-r--r-- | includes/watchdog.inc | 3 | ||||
-rw-r--r-- | modules/account.module | 2 | ||||
-rw-r--r-- | modules/rating.module | 9 | ||||
-rw-r--r-- | modules/section.module | 6 | ||||
-rw-r--r-- | modules/story.module | 12 | ||||
-rw-r--r-- | modules/story/story.module | 12 | ||||
-rw-r--r-- | node.php | 1 |
11 files changed, 29 insertions, 29 deletions
diff --git a/account.php b/account.php index 3810aca05..709ebc0af 100644 --- a/account.php +++ b/account.php @@ -226,8 +226,8 @@ function account_user($uname) { function module($name, $module, $username) { global $theme; - if ($module["account"] && $block = $module["account"]($username, "account", "view")) { - if ($block["content"]) $theme->box($block["subject"], $block["content"]); + if ($module[account] && $block = $module[account]($username, "account", "view")) { + if ($block[content]) $theme->box($block[subject], $block[content]); } } @@ -7,7 +7,7 @@ function error_flood() { } function error_httpd() { - global $REDIRECT_STATUS, $REDIRECT_URL, $HTTP_REFERER, $HTTP_USER_AGENT, $site_url; + global $REDIRECT_STATUS, $REDIRECT_URL, $HTTP_REFERER, $HTTP_USER_AGENT; switch($REDIRECT_STATUS) { case 500: @@ -35,7 +35,7 @@ function error_httpd() { print "<H1>Oops, an error occured!</H1>\n"; print "<B>Processed output:</B><BR>\n"; print " * $message<BR>\n"; - print " * Return to the <A HREF=\"$site_url\">main page</A>.\n"; + print " * Return to the <A HREF=\"index.php\">main page</A>.\n"; print "</PRE>\n"; } diff --git a/includes/hostname.conf b/includes/hostname.conf index dff4d0732..3d55ddcd3 100644 --- a/includes/hostname.conf +++ b/includes/hostname.conf @@ -70,8 +70,7 @@ $moderation_votes = array("neutral (+0)" => "+ 0", # Example: '"comment" => 60' means that there is only one new comment allowed from the same IP-address every 60 seconds. # $submission_rate = array("comment" => "60", // 60 seconds = 1 minute - "diary" => "300", // 300 seconds = 5 minutes - "story" => "300"); // 300 seconds = 5 minutes + "node" => "300") // 300 seconds = 5 minutes # # Submission size: diff --git a/includes/user.inc b/includes/user.inc index ad73efa8b..ce5820023 100644 --- a/includes/user.inc +++ b/includes/user.inc @@ -41,7 +41,7 @@ function user_save($account, $array) { else db_query("INSERT INTO users SET $query last_access = '". time() ."', last_host = '$GLOBALS[REMOTE_ADDR]'"); // return account: - return user_load(($account->userid ? $account->userid : $array["userid"])); + return user_load(($account->userid ? $account->userid : $array[userid])); } function user_get($account, $column, $field) { diff --git a/includes/watchdog.inc b/includes/watchdog.inc index 4512be755..2d221c842 100644 --- a/includes/watchdog.inc +++ b/includes/watchdog.inc @@ -1,8 +1,7 @@ <?php $watchdog = array("comment" => array("0", $submission_rate["comment"]), - "diary" => array("1", $submission_rate["diary"]), - "story" => array("2", $submission_rate["story"]), + "node" => array("1", $submission_rate["node"]), "message" => array("3", "0"), "warning" => array("4", "0"), "error" => array("5", "0")); diff --git a/modules/account.module b/modules/account.module index 82b01092d..178b31301 100644 --- a/modules/account.module +++ b/modules/account.module @@ -87,7 +87,7 @@ function account_delete($name) { function account_edit_save($name, $edit) { foreach ($edit as $key=>$value) if ($key != "access") $query .= "$key = '". addslashes($value) ."', "; db_query("UPDATE users SET $query access = '' WHERE userid = '$name'"); - if ($edit["access"]) foreach ($edit["access"] as $key=>$value) user_set(user_load($name), "access", $value, 1); + if ($edit[access]) foreach ($edit[access] as $key=>$value) user_set(user_load($name), "access", $value, 1); watchdog("message", "account: modified user '$name'"); } diff --git a/modules/rating.module b/modules/rating.module index c38f2a2d4..563876bd0 100644 --- a/modules/rating.module +++ b/modules/rating.module @@ -26,7 +26,7 @@ function rating_cron() { $bonus -= $story->number / 2; } - $r4 = db_query("SELECT score, votes FROM comments WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number"); + $r4 = db_query("SELECT score, votes FROM comments WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number", 1); while ($comment = db_fetch_object($r4)) { $weight++; $score += $weight * $comment->score; @@ -35,6 +35,7 @@ function rating_cron() { if ($weight >= $offset && $votes > 0) { $value = ($score + $weight) / $votes + $bonus; + print "update $rating->id : $value<BR>"; db_query("UPDATE users SET rating = '$value' WHERE id = '$rating->id'"); } } @@ -74,9 +75,9 @@ function rating_page() { } function rating_block() { - $block[0]["subject"] = "Top 10:<BR>users"; - $block[0]["content"] = rating_list(10); - $block[0]["info"] = "Top 10: users"; + $block[0][subject] = "Top 10:<BR>users"; + $block[0][content] = rating_list(10); + $block[0][info] = "Top 10: users"; return $block; } diff --git a/modules/section.module b/modules/section.module index 052004b00..07054903e 100644 --- a/modules/section.module +++ b/modules/section.module @@ -23,9 +23,9 @@ function section_block() { $content .= "<LI><A HREF=\"?section=". urlencode($_section->name) ."\">$_section->name</A> (". check_output($_section->stories, 0) .")</LI>\n"; } - $block[0]["subject"] = "Sections"; - $block[0]["content"] = $content; - $block[0]["info"] = "Section list"; + $block[0][subject] = "Sections"; + $block[0][content] = $content; + $block[0][info] = "Section list"; return $block; } diff --git a/modules/story.module b/modules/story.module index 06ace2f70..dc557a4c5 100644 --- a/modules/story.module +++ b/modules/story.module @@ -193,9 +193,9 @@ function story_block() { $content .= "<LI><A HREF=\"node.php?id=$story->id\">". check_output($story->title) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; } - $blocks[0]["subject"] = "Top 10:<BR>all stories"; - $blocks[0]["content"] = $content; - $blocks[0]["info"] = "Top 10: all stories"; + $blocks[0][subject] = "Top 10:<BR>all stories"; + $blocks[0][content] = $content; + $blocks[0][info] = "Top 10: all stories"; unset($content); @@ -204,9 +204,9 @@ function story_block() { $content .= "<LI><A HREF=\"node.php?id=$story->id\">". check_output($story->title) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; } - $blocks[1]["subject"] = "Top 10:<BR>recent stories"; - $blocks[1]["content"] = $content; - $blocks[1]["info"] = "Top 10: recent stories"; + $blocks[1][subject] = "Top 10:<BR>recent stories"; + $blocks[1][content] = $content; + $blocks[1][info] = "Top 10: recent stories"; return $blocks; */ diff --git a/modules/story/story.module b/modules/story/story.module index 06ace2f70..dc557a4c5 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -193,9 +193,9 @@ function story_block() { $content .= "<LI><A HREF=\"node.php?id=$story->id\">". check_output($story->title) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; } - $blocks[0]["subject"] = "Top 10:<BR>all stories"; - $blocks[0]["content"] = $content; - $blocks[0]["info"] = "Top 10: all stories"; + $blocks[0][subject] = "Top 10:<BR>all stories"; + $blocks[0][content] = $content; + $blocks[0][info] = "Top 10: all stories"; unset($content); @@ -204,9 +204,9 @@ function story_block() { $content .= "<LI><A HREF=\"node.php?id=$story->id\">". check_output($story->title) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; } - $blocks[1]["subject"] = "Top 10:<BR>recent stories"; - $blocks[1]["content"] = $content; - $blocks[1]["info"] = "Top 10: recent stories"; + $blocks[1][subject] = "Top 10:<BR>recent stories"; + $blocks[1][content] = $content; + $blocks[1][info] = "Top 10: recent stories"; return $blocks; */ @@ -27,6 +27,7 @@ if ($node && node_visible($node)) { $theme->footer(); break; default: + if ($user->id) user_load($user->userid); node_view($node, 1); } } |