From d386c110f449d39631c6af1aabced9799c7a372d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 26 Jan 2001 13:38:46 +0000 Subject: - removed redundant spaces --- modules/account.module | 10 +++++----- modules/affiliate-site.module | 4 ++-- modules/backend.class | 34 ++++++++++++++++++---------------- modules/ban.module | 8 ++++---- modules/block.module | 20 ++++++++++---------- modules/block/block.module | 20 ++++++++++---------- modules/box.module | 8 ++++---- modules/calendar.class | 16 ++++++++-------- modules/calendar.module | 2 +- modules/comment.module | 6 +++--- modules/comment/comment.module | 6 +++--- modules/cron.module | 2 +- modules/diary.module | 18 +++++++++--------- modules/documentation.module | 36 ++++++++++++++++++------------------ modules/drupal-site.module | 4 ++-- modules/drupal.module | 8 ++++---- modules/drupal/drupal.module | 8 ++++---- modules/faq.module | 4 ++-- modules/headline.module | 26 +++++++++++++------------- modules/module.module | 8 ++++---- modules/section.module | 4 ++-- modules/watchdog.module | 4 ++-- modules/watchdog/watchdog.module | 4 ++-- modules/wishlist.module | 6 +++--- 24 files changed, 134 insertions(+), 132 deletions(-) (limited to 'modules') diff --git a/modules/account.module b/modules/account.module index 942cf6072..0de1cbc2e 100644 --- a/modules/account.module +++ b/modules/account.module @@ -24,7 +24,7 @@ function account_display($order = "username") { // Perform query: $result = db_query("SELECT u.id, u.userid, u.". strtok($sort[$order], " ") .", u.url FROM users u ORDER BY $sort[$order]"); - + // Generate output: $output .= "\n"; $output .= " \n"; @@ -57,7 +57,7 @@ function account_display($order = "username") { case "last_access": $output .= " \n"; break; - case "status": + case "status": $output .= " \n"; break; case "permissions": @@ -117,12 +117,12 @@ function account_edit($name) { if ($account = db_fetch_object($result)) { foreach ($status as $key=>$value) { - $stat .= " \n"; + $stat .= " \n"; } $stat = "\n"; foreach ($permissions as $key=>$value) { - $perm .= " \n"; + $perm .= " \n"; } $perm = "\n"; @@ -202,7 +202,7 @@ function account_admin() { account_display($order); break; default: - account_display(); + account_display(); } } diff --git a/modules/affiliate-site.module b/modules/affiliate-site.module index 42c95c616..d8e1e1079 100644 --- a/modules/affiliate-site.module +++ b/modules/affiliate-site.module @@ -36,7 +36,7 @@ function affiliate_block() { $content .= " \n"; $content .= "\n"; $content .= "\n"; - + $blocks[0]["subject"] = "Affiliate sites"; $blocks[0]["content"] = $content; $blocks[0]["info"] = "Affiliate sites (selection)"; @@ -51,7 +51,7 @@ function affiliate_block() { $blocks[1]["subject"] = "Affiliate sites"; $blocks[1]["content"] = $content; $blocks[1]["info"] = "Affiliate sites (sequential)"; - + return $blocks; } diff --git a/modules/backend.class b/modules/backend.class index 7869b6530..04e25520d 100644 --- a/modules/backend.class +++ b/modules/backend.class @@ -48,27 +48,29 @@ class backend { } function rdf2sql($timout = 10) { + global $site_name; + if ($this->file) { // Decode URL: $url = parse_url($this->file); $host = $url[host]; $port = $url[port] ? $url[port] : 80; $path = $url[path]; - + // print "
Debug: $url - $host - $port - $path
"; - + // Retrieve data from website: $fp = fsockopen($host, $port, &$errno, &$errstr, $timout); if ($fp) { // Get data from URL: fputs($fp, "GET $path HTTP/1.0\n"); - fputs($fp, "User-Agent: headline grabber\n"); + fputs($fp, "User-Agent: $site_name\n"); fputs($fp, "Host: ". $host ."\n"); fputs($fp, "Accept: */*\n\n"); while(!feof($fp)) $data .= fgets($fp, 128); - + // print "
$data

"; if (strstr($data, "200 OK")) { @@ -80,7 +82,7 @@ class backend { $data = ereg_replace("", "", $data); $data = ereg_replace("", $data); $number = 0; @@ -90,18 +92,18 @@ class backend { $link = ereg_replace(".*", "", $item); $link = ereg_replace(".*", "", $link); $title = ereg_replace(".*", "", $item); - $title = ereg_replace(".*", "", $title); + $title = ereg_replace(".*", "", $title); // Clean headlines: $title = stripslashes($title); - + // Count the number of stories: $number += 1; // Insert item in database: $result = db_query("INSERT INTO headlines (id, title, link, number) VALUES('". check_input($this->id) ."', '". check_input($title) ."', '". check_input($link) ."', '". check_input($number) ."')"); } - + // Mark channels as being updated: $result = db_query("UPDATE channel SET timestamp = '". time() ."' WHERE id = $this->id"); $this->timestamp = time(); @@ -143,8 +145,8 @@ class backend { } // Add timestamp: $update = round((time() - $this->timestamp) / 60); - $content .= "

[ site\">hlcolor2\">reset | updated $update min. ago ]

"; - + $content .= "

[ site\">hlcolor2\">reset | updated $update min. ago ]

"; + // Display box: $theme->box("$this->site", $content); } @@ -152,24 +154,24 @@ class backend { } function add() { - // Add channel: + // Add channel: $result = db_query("INSERT INTO channel (site, file, url, contact, timestamp) VALUES ('". check_input($this->site) ."', '". check_input($this->file) ."', '". check_input($this->url) ."', '". check_input($this->contact) ."', 1)"); } - + function delete() { - // Delete channel: + // Delete channel: $result = db_query("DELETE FROM channel WHERE id = $this->id"); // Delete headlines: - $result = db_query("DELETE FROM headlines WHERE id = $this->id"); + $result = db_query("DELETE FROM headlines WHERE id = $this->id"); } function refresh() { // Delete headlines: - $result = db_query("DELETE FROM headlines WHERE id = $this->id"); + $result = db_query("DELETE FROM headlines WHERE id = $this->id"); // Mark channel as invalid to enforce an update: - $result = db_query("UPDATE channel SET timestamp = 1 WHERE id = $this->id"); + $result = db_query("UPDATE channel SET timestamp = 1 WHERE id = $this->id"); } function dump() { diff --git a/modules/ban.module b/modules/ban.module index f602c177f..b14dc492e 100644 --- a/modules/ban.module +++ b/modules/ban.module @@ -37,12 +37,12 @@ function ban_admin_new($mask, $category, $reason) { function ban_display($category = "") { global $type2index; - // initialize variable: + // initialize variable: $category = $category ? $category : 1; // Perform query: $result = db_query("SELECT * FROM bans WHERE type = $category ORDER BY mask"); - + // Generate output: $output .= "
". format_interval(time() - $account[$value]) ." ago". $stat[$account[$value]] ."
\n"; $output .= " \n"; @@ -67,7 +67,7 @@ function ban_display($category = "") { } $output .= " \n"; $output .= "
%: matches any number of characters, even zero characters.
_: matches exactly one character.
\n"; - + print $output; } @@ -88,7 +88,7 @@ function ban_admin_add() { $output .= "

\n"; $output .= "
\n"; $output .= "\n"; - + print $output; } diff --git a/modules/block.module b/modules/block.module index ce994d704..bfa38bae9 100644 --- a/modules/block.module +++ b/modules/block.module @@ -17,18 +17,18 @@ function block_page() { global $theme; $result = db_query("SELECT * FROM blocks WHERE status = 1 ORDER BY module"); - + $theme->header(); print "\n"; while ($block = db_fetch_object($result)) { if ($state % 3 == 0) print " \n"; - print " \n"; if ($state % 3 == 2) print " \n"; $state += 1; - } + } print "
\n"; + print " \n"; $blocks = module_execute($block->module, "block"); $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]); print "
\n"; $theme->footer(); } @@ -43,12 +43,12 @@ function block_admin_display() { global $repository; $result = db_query("SELECT * FROM blocks ORDER BY module"); - + // Generate output: $output .= "

\n"; $output .= "\n"; $output .= " \n"; - + while ($block = db_fetch_object($result)) { $module = ($repository[$block->module]["admin"]) ? "module\">$block->module" : $block->module; @@ -70,12 +70,12 @@ function block_admin_display() { $region .= "\n"; $output .= " \n"; - + unset($status); unset($weight); unset($region); } - + $output .= "
blockmodulestatusweightregion
". $block->name ."$module$status$weight$region
\n"; $output .= "\n"; $output .= "
\n"; @@ -95,7 +95,7 @@ function block_admin_overview() { $rblocks .= "\n"; while ($block = db_fetch_object($result)) $rblocks .= " \n"; $rblocks .= "
". ($block->status == 2 ? "$block->name" : $block->name) ."$block->weight
\n"; - + $output .= "

layout 1:

\n"; $output .= "\n"; $output .= " \n"; @@ -127,7 +127,7 @@ function block_admin_overview() { function block_admin() { global $op, $edit; - + print "configure | overview | help
\n"; switch ($op) { @@ -143,7 +143,7 @@ function block_admin() { default: block_admin_display(); } - + } ?> diff --git a/modules/block/block.module b/modules/block/block.module index ce994d704..bfa38bae9 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -17,18 +17,18 @@ function block_page() { global $theme; $result = db_query("SELECT * FROM blocks WHERE status = 1 ORDER BY module"); - + $theme->header(); print "
$site_name header
\n"; while ($block = db_fetch_object($result)) { if ($state % 3 == 0) print " \n"; - print " \n"; if ($state % 3 == 2) print " \n"; $state += 1; - } + } print "
\n"; + print " \n"; $blocks = module_execute($block->module, "block"); $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]); print "
\n"; $theme->footer(); } @@ -43,12 +43,12 @@ function block_admin_display() { global $repository; $result = db_query("SELECT * FROM blocks ORDER BY module"); - + // Generate output: $output .= "
\n"; $output .= "\n"; $output .= " \n"; - + while ($block = db_fetch_object($result)) { $module = ($repository[$block->module]["admin"]) ? "module\">$block->module" : $block->module; @@ -70,12 +70,12 @@ function block_admin_display() { $region .= "\n"; $output .= " \n"; - + unset($status); unset($weight); unset($region); } - + $output .= "
blockmodulestatusweightregion
". $block->name ."$module$status$weight$region
\n"; $output .= "\n"; $output .= "
\n"; @@ -95,7 +95,7 @@ function block_admin_overview() { $rblocks .= "\n"; while ($block = db_fetch_object($result)) $rblocks .= " \n"; $rblocks .= "
". ($block->status == 2 ? "$block->name" : $block->name) ."$block->weight
\n"; - + $output .= "

layout 1:

\n"; $output .= "\n"; $output .= " \n"; @@ -127,7 +127,7 @@ function block_admin_overview() { function block_admin() { global $op, $edit; - + print "configure | overview | help
\n"; switch ($op) { @@ -143,7 +143,7 @@ function block_admin() { default: block_admin_display(); } - + } ?> diff --git a/modules/box.module b/modules/box.module index a271462aa..9a2cd51a9 100644 --- a/modules/box.module +++ b/modules/box.module @@ -50,9 +50,9 @@ function box_block() { function box_admin_display() { $type = array(0 => "ASCII", 1 => "HTML", 2 => "PHP"); - + $result = db_query("SELECT * FROM boxes"); - + while ($block = db_fetch_object($result)) { $output .= "
$site_name header
\n"; $output .= " \n"; @@ -89,7 +89,7 @@ function box_admin_new() { } function box_admin_add($subject, $content, $info, $link, $type) { - db_query("INSERT INTO boxes (subject, content, info, link, type) VALUES ('". check_input($subject) ."', '". check_code($content) ."', '". check_input($info) ."', '". check_input($link) ."', '". check_input($type) ."')"); + db_query("INSERT INTO boxes (subject, content, info, link, type) VALUES ('". check_input($subject) ."', '". check_code($content) ."', '". check_input($info) ."', '". check_input($link) ."', '". check_input($type) ."')"); } function box_admin_delete($id) { @@ -108,7 +108,7 @@ function box_admin_edit($id) { if ($block = db_fetch_object($result)) { $output .= "\n"; - + $output .= "

\n"; $output .= " Subject:
\n"; $output .= " subject) ."\">\n"; diff --git a/modules/calendar.class b/modules/calendar.class index 16498c6bb..0c16001cc 100644 --- a/modules/calendar.class +++ b/modules/calendar.class @@ -17,7 +17,7 @@ class Calendar { // Extract first day of the month: $first = date("w", mktime(0, 0, 0, $month, 1, $year)); - + // Extract last day of the month: $last = date("t", mktime(0, 0, 0, $month, 1, $year)); @@ -30,11 +30,11 @@ class Calendar { $output .= "

Subject:". format_data($block->subject) ."
\n"; $output .= " \n"; $output .= " \n"; - + // Initialize temporary variables: $nday = 1; $sday = $first; - + // Loop through all the days of the month: while ($nday <= $last) { // Set up blank days for first week of the month: @@ -42,25 +42,25 @@ class Calendar { $output .= " \n"; $first = 0; } - + // Start every week on a new line: if ($sday == 0) $output .= " \n"; - + // Print one cell: $date = mktime(23, 59, 59, $month, $nday, $year); if ($nday == $day) $output .= " \n"; else if ($date > time()) $output .= " \n"; else $output .= " \n"; - + // Start every week on a new line: if ($sday == 6) $output .= " \n"; - + // Update temporary variables: $sday++; $sday = $sday % 7; $nday++; } - + // Complete the calendar: if ($sday) { $end = 7 - $sday; diff --git a/modules/calendar.module b/modules/calendar.module index 0f4e2868c..fbceef7a0 100644 --- a/modules/calendar.module +++ b/modules/calendar.module @@ -12,7 +12,7 @@ function calendar_block() { $block[0]["subject"] = "Browse archives"; $block[0]["content"] = $calendar->display(); $block[0]["info"] = "Calendar to browse archives"; - + return $block; } diff --git a/modules/comment.module b/modules/comment.module index bdda1cc0e..e4a8ca9ac 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -28,7 +28,7 @@ function comment_edit($id) { $output .= " \n"; $output .= "

\n"; $output .= "\n"; - + print $output; } @@ -43,7 +43,7 @@ function comment_display($order = "date") { // Perform SQL query: $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY c.$fields[$order] LIMIT 50"); - + // Display comments: $output .= "
<   ". date("F Y", $this->date) ."   >
SMTWTFS
 
$nday$nday$nday
\n"; $output .= " \n"; @@ -70,7 +70,7 @@ function comment_display($order = "date") { } $output .= "
\n"; - + print $output; } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index bdda1cc0e..e4a8ca9ac 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -28,7 +28,7 @@ function comment_edit($id) { $output .= " \n"; $output .= "

\n"; $output .= "\n"; - + print $output; } @@ -43,7 +43,7 @@ function comment_display($order = "date") { // Perform SQL query: $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY c.$fields[$order] LIMIT 50"); - + // Display comments: $output .= "\n"; $output .= " \n"; @@ -70,7 +70,7 @@ function comment_display($order = "date") { } $output .= "
\n"; - + print $output; } diff --git a/modules/cron.module b/modules/cron.module index 67a147a7c..54d55c41b 100644 --- a/modules/cron.module +++ b/modules/cron.module @@ -22,7 +22,7 @@ function cron_display() { // Perform query: $result = db_query("SELECT * FROM crons"); - + // Generate output: $output .= "
\n"; $output .= "\n"; diff --git a/modules/diary.module b/modules/diary.module index 4f9f39203..584a51b8a 100644 --- a/modules/diary.module +++ b/modules/diary.module @@ -56,7 +56,7 @@ function diary_page_display($username) { global $theme, $user; $username = empty($username) ? $user->userid : $username; - + $result = db_query("SELECT d.*, u.userid FROM diaries d LEFT JOIN users u ON d.author = u.id WHERE u.userid = '$username' ORDER BY timestamp DESC"); if ($username == $user->userid) { @@ -75,10 +75,10 @@ function diary_page_display($username) { function diary_page_add() { global $theme, $user, $allowed_html; - + $output .= "\n"; - $output .= "

\n"; + $output .= "

\n"; $output .= " Enter new diary entry:
\n"; $output .= "
\n"; $output .= " Allowed HTML tags: ". htmlspecialchars($allowed_html) .".\n"; @@ -89,7 +89,7 @@ function diary_page_add() { $output .= "

\n"; $output .= "\n"; - + $theme->header(); $theme->box("Edit you diary", $output); $theme->footer(); @@ -118,7 +118,7 @@ function diary_page_edit($id) { $output .= "

\n"; $output .= "\n"; - + $theme->header(); $theme->box("Edit your diary", $output); $theme->footer(); @@ -263,7 +263,7 @@ function diary_admin_edit($id) { $output .= " \n"; $output .= "

\n"; $output .= "\n"; - + print $output; } @@ -278,7 +278,7 @@ function diary_admin_display($order = "date") { // Perform SQL query: $result = db_query("SELECT d.*, u.userid FROM diaries d LEFT JOIN users u ON u.id = d.author ORDER BY d.$fields[$order] LIMIT 50"); - + // Display stories: $output .= "
\n"; $output .= " \n"; @@ -305,14 +305,14 @@ function diary_admin_display($order = "date") { } $output .= "
\n"; - + print $output; } function diary_admin() { global $op, $id, $text, $order; - + switch ($op) { case "edit": diary_admin_edit($id); diff --git a/modules/documentation.module b/modules/documentation.module index 5b5cb4f69..9150be178 100644 --- a/modules/documentation.module +++ b/modules/documentation.module @@ -12,7 +12,7 @@ function documentation_module($name, $module) { function documentation() { ?> $Id$ - +

Chapter 1: introduction

Drupal is the English pronunciation for the Dutch word 'druppel' which means 'drop'. Drupal is a fully-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims to provide easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design, drupal is flexible and easy to adapt or extend.

@@ -88,10 +88,10 @@ function documentation() {

Chapter 3: drupal engine

-

While we in no way consider the design and implementation of the drupal engine to be finished, we feel that our own accompanying intensive experience has given us a fairly stable and well-proven design. The following provides a brief over-view of the different aspects of drupal's core engine and features.

+

While we in no way consider the design and implementation of the drupal engine to be finished, we feel that our own accompanying intensive experience has given us a fairly stable and well-proven design. The following provides a brief over-view of the different aspects of drupal's core engine and features.

Cron

- +

Cron (which stands for chronograph) is a periodic command scheduler: it executes commands at intervals specified in seconds. It can be used to control the execution of daily, weekly and monthly jobs (or anything with a period of n seconds). Automating tasks is one of the best ways to keep a system running smoothly, and if most of your administration does not require your direct involvement, cron is an ideal solution.

Note that cron does not guarantee that the commands will be executed at the specified interval. However, the engine will make sure that the commands are run at the specified intervals as closely as possible.

Whenever http://yourdomain.com/cron.php is accessed, cron will run: it queries the database for the jobs cron controls, and their periods in seconds. If a certain task wasn't executed in the last n seconds, where n is the period of that job, it will be executed. It then records the date in the database so it can know when to run it again. When all the executed commands terminate, cron is done.

@@ -108,18 +108,18 @@ function documentation() {

The maintenance of all databases is handled by surprisingly simple code. Access to to the database is done by facilities of drupal's database abstraction layer. The purpose of drupal's database abstraction layer is to make it possible to run a drupal site on top of different databases like MySQL, Oracle, Postgres and so on.

However, currently the only supported database is MySQL. In fact, we haven't even bothered or tried to migrate to another database so our database abstraction layer might even contain undiscovered flaws. Nevertless, moving to another database shouldn't be much of a problem.

Take a look at includes/database.inc to see what database functions are supported.

- +

Moderation, collaborative rating

We like to experiment with moderation, trust metrics and collaborative filtering. Why? To help individuals and communities address the challenges of information overload.

As each new piece of information competes for attention, people quickly tend to become overwhelmed and seek assistance in identifying the most interesting, worthwhile, valuable or entertaining items. Not to mention the fact that reader-contributed content and other levels of interactivity tend to become chaotic, bloated and disreputable.

Therefor, we decided to develop a public system powered by a community that aims to bring quality content to everyone's attention and to filter out all junk: to sort the wheat from the chaff. The output should be something clean and homogenized featuring quality content, and should slide down the gullet far more easily.

- +

Open submission queue

Anyone who visits and has some news or some thoughts they'd like to share, can submit new content for consideration. After someone has submitted something, their story is added to a queue. All registered users can access this list of pending stories, that is, stories that have been submitted, but do not yet appear on the public front page. Those registered users can vote whether they think the story should be posted or not. When enough people vote to post a story, the story is pushed over the threshold and up it goes on the public page. On the other hand, when too many people voted to drop a story, the story will get trashed.

Comment rating

- +

Anyone with a user account will be able to moderate comments. This lets people assign a score to a comment on how good they think the comment is or how visible they think it should be. When more than one person rates a comment, the overall rating is just a simple average of all ratings. Comments with high ratings are more visible than comments with a lower rating. That way, comments that gain the approval of participants will gradually move up through statistical effects and pointless comments will sink into oblivion.

Hence, the purpose of comment moderation is two-fold: