diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/ban.inc | 10 | ||||
-rw-r--r-- | includes/database.inc | 4 | ||||
-rw-r--r-- | includes/hostname.conf | 32 | ||||
-rw-r--r-- | includes/module.inc | 6 | ||||
-rw-r--r-- | includes/submission.inc | 6 | ||||
-rw-r--r-- | includes/theme.inc | 18 | ||||
-rw-r--r-- | includes/user.inc | 8 | ||||
-rw-r--r-- | includes/watchdog.inc | 6 |
8 files changed, 45 insertions, 45 deletions
diff --git a/includes/ban.inc b/includes/ban.inc index fe8e6153a..618b275ec 100644 --- a/includes/ban.inc +++ b/includes/ban.inc @@ -1,11 +1,11 @@ <? -$type2index = array("addresses" => 0x01, - "profanity" => 0x02, +$type2index = array("addresses" => 0x01, + "profanity" => 0x02, "hostnames" => 0x03, "usernames" => 0x04); -$index2type = array(0x01 => "addresses", +$index2type = array(0x01 => "addresses", 0x02 => "profanity", 0x03 => "hostnames", 0x04 => "usernames"); @@ -14,7 +14,7 @@ $index2type = array(0x01 => "addresses", function ban_match($mask, $category) { // Perform query: $result = db_query("SELECT * FROM bans WHERE type = $category AND LOWER('$mask') LIKE LOWER(mask)"); - + // Return result: return db_fetch_object($result); } @@ -36,7 +36,7 @@ function ban_add($mask, $category, $reason, $message = "") { watchdog("message", "added new ban `$mask' to category `". $index2type[$category] ."' with reason `$reason'."); } } - + function ban_delete($id) { global $index2type; diff --git a/includes/database.inc b/includes/database.inc index 99d8391a4..6e72de158 100644 --- a/includes/database.inc +++ b/includes/database.inc @@ -20,8 +20,8 @@ function db_query($query, $debug = false) { // debug output (if required): if ($debug) print "<PRE>query: ". htmlspecialchars($query) ."<BR>error message: ". mysql_error() ."</PRE>"; if (!$qid) watchdog("error", "database: ". mysql_error() ."<BR>query: ". htmlspecialchars($query) .""); - - // return result from query: + + // return result from query: return $qid; } diff --git a/includes/hostname.conf b/includes/hostname.conf index c5af2febf..238d413ed 100644 --- a/includes/hostname.conf +++ b/includes/hostname.conf @@ -19,21 +19,21 @@ $site_email = "info@yourdomain.com"; # # Comment votes: -# the keys of this associative array are displayed in each -# comment's selection box whereas the corresponding values -# represent the mathematical calculation to be performed +# the keys of this associative array are displayed in each +# comment's selection box whereas the corresponding values +# represent the mathematical calculation to be performed # to update a comment's value. # -$comment_votes = array("none" => "none", - "-1" => "- 1", +$comment_votes = array("none" => "none", + "-1" => "- 1", "0" => "+ 0", "+1" => "+ 1", "+2" => "+ 2", - "+3" => "+ 3", - "+4" => "+ 4", + "+3" => "+ 3", + "+4" => "+ 4", "+5" => "+ 5"); -# +# # Allowed HTML tags: # $allowed_html = "<A><B><BLOCKQUOTE><BR><DD><DL><DT><EM><HR><I><LI><SMALL><OL><U><UL>"; @@ -52,18 +52,18 @@ $themes = array("UnConeD" => array( "themes/unconed/unconed.theme", "modern theme, gray and blue, high coolness factor"), "Marvin" => array( - "themes/marvin/marvin.theme", + "themes/marvin/marvin.theme", "classic theme, white, basic design with a fresh look")); # # Submission moderation votes: -# the keys of this associative array are displayed in each -# submission's selection box whereas the corresponding values -# represent the mathematical calculation to be performed to +# the keys of this associative array are displayed in each +# submission's selection box whereas the corresponding values +# represent the mathematical calculation to be performed to # update a comment's value. # Warning: changing $submission_votes will affect the integrity -# of all pending stories in the open submission queue. Do not -# change this setting unless there are no pending stories in the +# of all pending stories in the open submission queue. Do not +# change this setting unless there are no pending stories in the # submission queue or unless you know what you are doing. $submission_votes = array("neutral (+0)" => "+ 0", "post it (+1)" => "+ 1", @@ -75,7 +75,7 @@ $submission_votes = array("neutral (+0)" => "+ 0", # submission. It is supposed to stop malicious attempts to screw # with the database and to stop denial of service attacks. # Example: -# '"comment" => 60' means that there is only one new comment +# '"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 @@ -83,7 +83,7 @@ $submission_rate = array("comment" => "60", // 60 seconds = 1 minute "story" => "300"); // 300 seconds = 5 minutes # # Submission size: -# the maximum length (i.e. the maximum number of characters) a +# the maximum length (i.e. the maximum number of characters) a # story, a diary entry, or a comment is allowed to be. # $submission_size = 12000; // 12.000 characters is more or less 300 lines diff --git a/includes/module.inc b/includes/module.inc index e52f612e1..6c11a358d 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -16,7 +16,7 @@ function module_rehash_crons($name, $module) { if ($module["cron"]) { if (!db_fetch_object(db_query("SELECT * FROM crons WHERE module = '$name'"))) { db_query("INSERT INTO crons (module, scheduled, timestamp) VALUES ('". check_input($name) ."', '172800', '0')"); - } + } } else { db_query("DELETE FROM crons WHERE module = '$name'"); @@ -24,7 +24,7 @@ function module_rehash_crons($name, $module) { } function module_rehash_blocks($name, $module) { - db_query("DELETE FROM blocks WHERE module = '$name'"); + db_query("DELETE FROM blocks WHERE module = '$name'"); if ($module["block"] && $blocks = $module["block"]()) { foreach ($blocks as $offset=>$block) { db_query("INSERT INTO blocks (name, module, offset) VALUES ('". check_input($block["info"]) ."', '". check_input($name) ."', '". check_input($offset) ."')"); @@ -34,7 +34,7 @@ function module_rehash_blocks($name, $module) { function module_rehash($name) { global $repository; - + if ($module = $repository[$name]) { $result = db_query("SELECT * FROM modules WHERE name = '$name'"); diff --git a/includes/submission.inc b/includes/submission.inc index 2c5711ab5..2b3cf7ebd 100644 --- a/includes/submission.inc +++ b/includes/submission.inc @@ -12,7 +12,7 @@ function submission_score($id) { function submission_vote($id, $vote, $comment) { global $user; - + if (!user_getHistory($user->history, "s$id")) { // Update submission's score- and votes-field: db_query("UPDATE stories SET score = score $vote, votes = votes + 1 WHERE id = $id"); @@ -25,9 +25,9 @@ function submission_vote($id, $vote, $comment) { // Update user's history record: user_setHistory($user, "s$id", $vote); - + // Update story table (if required): - $result = db_query("SELECT * FROM stories WHERE id = $id"); + $result = db_query("SELECT * FROM stories WHERE id = $id"); if ($submission = db_fetch_object($result)) { if (section_post_threshold($submission->section) <= $submission->score) { db_query("UPDATE stories SET status = 2, timestamp = '". time() ."' WHERE id = $id"); diff --git a/includes/theme.inc b/includes/theme.inc index 6f9785aa4..f46c29e0b 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -4,7 +4,7 @@ function theme_load() { global $user, $themes; if ($user->theme && file_exists($themes[$user->theme][0])) { - include_once $themes[$user->theme][0]; + include_once $themes[$user->theme][0]; } else { include_once $themes[key($themes)][0]; @@ -14,8 +14,8 @@ function theme_load() { function theme_account($theme) { global $user, $site_name, $links, $menu; - - if ($user->id) { + + if ($user->id) { function submission_number() { $result = db_query("SELECT COUNT(id) FROM stories WHERE status = 1"); @@ -72,7 +72,7 @@ function theme_account($theme) { function theme_blocks($region, $theme) { global $id, $PHP_SELF, $user; - + switch (strrchr($PHP_SELF, "/")) { case "/story.php": if ($user->id) $story = db_fetch_object(db_query("SELECT * FROM stories WHERE id = '$id'")); @@ -84,7 +84,7 @@ function theme_blocks($region, $theme) { else $result = db_query("SELECT * FROM blocks WHERE status = 2 ORDER BY weight"); while ($block = db_fetch_object($result)) { $blocks = module_execute($block->module, "block"); - $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]); + $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]); } break; } @@ -102,7 +102,7 @@ function theme_moderation_results($theme, $story) { while ($account = db_fetch_object($result)) { $output .= format_username($account->userid) ." voted `". user_getHistory($account->history, "s$story->id") ."'.<BR>"; } - + $theme->box("Moderation results", ($output ? $output : "This story has not been moderated yet.")); } } @@ -116,7 +116,7 @@ function theme_related_links($theme, $story) { if (!stristr($link, "mailto:")) $content .= "<LI>$link</LI>"; } - // Stories in the same section: + // Stories in the same section: $content .= " <LI>More about <A HREF=\"index.php?section=". urlencode($story->section) ."\">$story->section</A>.</LI>"; // Stories from the same author: @@ -137,11 +137,11 @@ function theme_new_headlines($theme, $num = 10) { function theme_old_headlines($theme, $num = 10) { global $user; - + if ($user->stories) $result = db_query("SELECT id, subject, timestamp FROM stories WHERE status = 2 ORDER BY timestamp DESC LIMIT $user->stories, $num"); else $result = db_query("SELECT id, subject, timestamp FROM stories WHERE status = 2 ORDER BY timestamp DESC LIMIT $num, $num"); - while ($story = db_fetch_object($result)) { + while ($story = db_fetch_object($result)) { if ($time != date("F jS", $story->timestamp)) { $content .= "<P><B>". date("l, M jS", $story->timestamp) ."</B></P>\n"; $time = date("F jS", $story->timestamp); diff --git a/includes/user.inc b/includes/user.inc index 6f87df47e..90e1dc1e8 100644 --- a/includes/user.inc +++ b/includes/user.inc @@ -12,12 +12,12 @@ class User { function user_save($data, $id = 0) { global $user; - + foreach ($data as $key=>$value) { if ($key == "passwd") $query .= "$key = PASSWORD('". addslashes($value) ."'), "; else $query .= "$key = '". addslashes($value) ."', "; } - + if (empty($id)) { db_query("INSERT INTO users SET $query last_access = '". time() ."', last_host = '$GLOBALS[REMOTE_HOST]'"); } @@ -36,7 +36,7 @@ function user_getHistory($history, $field) { if (reset($entry) == $field) $rval = end($entry); } return $rval; -} +} function user_setHistory(&$user, $field, $value) { @@ -56,7 +56,7 @@ function user_setHistory(&$user, $field, $value) { $entry = explode(":", current($data)); if ($entry[0] == $field) $entry[1] = $value; $rval .= "$entry[0]:$entry[1];"; - } + } } else { // not found: add new entry: diff --git a/includes/watchdog.inc b/includes/watchdog.inc index 97c6ca063..f50fab57e 100644 --- a/includes/watchdog.inc +++ b/includes/watchdog.inc @@ -12,8 +12,8 @@ function watchdog($id, $message) { if ($watchdog[$id][1] && !($user->permissions == 1 || $user->id == 1)) { if ($log = db_fetch_object(db_query("SELECT * FROM watchdog WHERE hostname = '". getenv("REMOTE_ADDR") ."' AND level = '". $watchdog[$id][0] ."'"))) { - if (time() - $log->timestamp < $watchdog[$id][1]) { - watchdog("warning", "'". getenv("REMOTE_ADDR") ."' exceeded '$id' submission rate"); + if (time() - $log->timestamp < $watchdog[$id][1]) { + watchdog("warning", "'". getenv("REMOTE_ADDR") ."' exceeded '$id' submission rate"); header("Location: error.php?op=flood"); exit(); } @@ -28,5 +28,5 @@ function watchdog_clean($history = 302400) { $timestamp = time() - $history; db_query("DELETE FROM watchdog WHERE timestamp < $timestamp"); } - + ?> |