Commit 988707a6 authored by Dries's avatar Dries
Browse files

Here we go again with a rather large commit:
fixed a lot of annoying bugs and boxed whatever there was left to be boxed.

 * user.class.php: renamed $user->update() to $user->rehash().
 * user.class.php: fixed a typical quote-bug in $user->rehash().
 * functions.inc: fixed bug in displayOldHeadlines().
 * functions.inc: improved several functions.
 * account.php: fixed major bug in showUser().
 * account.php: added some extra words to the human-readable
                password-generator(tm).
 * account.php: boxed ALL functions! Fieuw!
 * submit.php: add some general information and guidlines on how to
               post submissions.
 * config.inc: re-thought the categories to be more generic.
 * submission.php: minor changes
 * search.pph: fixed minor bug with the author's names.

Woops.  I have an exam within 4 hours: back to my books. ;-)

--------------------------------------------------------------------

 * Anyone could check sumbit.php, sumbission.php and faq.php for
   typoes?
 * Anyone could adjust calendar.class.php to fit IE?  *huh*huh*
 * Don't be scared to hack along (see below)!  I'll be working on
   the submissions and comments.

--------------------------------------------------------------------

Status of drop v0.10:
(make the system erational' and release it.)

  - submissions:
      submission queue         (75% complete)
      submission moderation    (75% complete)
  - comments:
      comment moderation       ( 0% complete)
      comment administration   ( 0% complete)
      fixup timestamp mess     ( 0% complete)
  - user system:
      mail password            ( 0% complete)
      user administation       (50% complete)
      patch admin.php          ( 0% complete)
      account confirmation     ( 0% complete)
      e-mail confimation upon modification of e-mail address
                               ( 0% complete)
  - proper handling of forms: text2html, html2text
      html2txt, txt2html       (10% complete)
      bad-word filter          (80% complete)
      automatic link detection ( 0% complete)
      allowed HTML-tag checker ( 0% complete)
  - FAQ:
      cleanup, disclaimer      (50% complete)
  - theme:
      box everything          (100% complete)
parent 6fec4168
This diff is collapsed.
......@@ -9,7 +9,7 @@
if ($save) {
mysql_query("UPDATE users SET umode='$mode', uorder='$order', thold='$thold' where id='$user->id'");
$user->update();
$user->rehash();
}
if($op == "reply") Header("Location: comments.php?op=reply&pid=0&sid=$sid&mode=$mode&order=$order&thold=$thold");
......
......@@ -49,8 +49,7 @@
#
# Categories:
#
$categories = array('Announcements', 'Coding', 'Geeking', 'Drop.org', 'Gaming', 'Girls', 'Graphics', 'Hardware', 'Humor', 'Internet', 'Music', 'Movies', 'Politics', 'Science', 'Software', 'Space', 'Webdesign', 'Quickies');
$categories = array('Announcements', 'Arts & Humanities', 'Business & Economy', 'Coding & Webdesign', 'Computers & Internet', 'Drop.org', 'Entertainment', 'Freedom', 'Government', 'News & Media', 'Science', 'Society & Culture');
#
# Allowed HTML tags:
......
......@@ -91,11 +91,11 @@ function displayRelatedLinks($theme, $sid = 0) {
}
}
function displayOldHeadlines($theme) {
function displayOldHeadlines($theme, $num = 10) {
global $user;
if ($user->storynum) $result = db_query("SELECT sid, subject, time FROM stories ORDER BY time DESC LIMIT $user->storynum, 10");
else $result = db_query("SELECT sid, subject, time FROM stories ORDER BY time DESC LIMIT 10, 10");
if ($user->storynum) $result = db_query("SELECT sid, subject, time FROM stories WHERE status = 1 ORDER BY time DESC LIMIT $user->storynum, $num");
else $result = db_query("SELECT sid, subject, time FROM stories WHERE status = 1 ORDER BY time DESC LIMIT $num, $num");
while ($story = db_fetch_object($result)) {
......@@ -124,7 +124,7 @@ function displayNewHeadlines($theme, $num = 10) {
global $user;
$content = "";
$result = db_query("SELECT sid, subject FROM stories ORDER BY time DESC LIMIT $num");
$result = db_query("SELECT sid, subject FROM stories WHERE status = 1 ORDER BY sid DESC LIMIT $num");
while(list($sid, $subject) = mysql_fetch_row($result)) {
if ($user) {
$content .= "<LI><A HREF=\"article.php?sid=$sid";
......
......@@ -53,7 +53,7 @@
$output .= " <TD>";
### Compose query:
$query = "SELECT DISTINCT s.sid, s.aid, s.subject, s.time FROM stories s, authors a WHERE s.sid != 0 ";
$query = "SELECT DISTINCT s.sid, s.aid, s.informant, s.subject, s.time FROM stories s, authors a WHERE s.sid != 0 ";
// Note: s.sid is a dummy clause used to enforce the WHERE-tag.
if ($terms != "") $query .= "AND (s.subject LIKE '%$terms%' OR s.abstract LIKE '%$terms%' OR s.comments LIKE '%$terms%') ";
if ($author != "") $query .= "AND s.aid = '$author' ";
......@@ -66,7 +66,7 @@
### Display search results:
$output .= "<HR>";
while (list($sid, $aid, $subject, $time) = mysql_fetch_row($result)) {
while (list($sid, $aid, $informant, $subject, $time) = mysql_fetch_row($result)) {
$num++;
if ($user) {
......@@ -80,7 +80,7 @@
$link = "<A HREF=\"article.php?sid=$sid&mode=threaded&order=1&thold=0\">$subject</A>";
}
$output .= "<P>$num) <B>$link</B><BR><SMALL>by <B><A HREF=\"account.php?op=userinfo&uname=$aid\">$aid</A></B>, posted on ". date("l, F d, Y - H:i A", $time) .".</SMALL></P>\n";
$output .= "<P>$num) <B>$link</B><BR><SMALL>by <B><A HREF=\"account.php?op=userinfo&uname=$informant\">$informant</A></B>, posted on ". date("l, F d, Y - H:i A", $time) .".</SMALL></P>\n";
}
if ($num == 0) $output .= "<P>Your search did <B>not</B> match any articles in our database: <UL><LI>Try using fewer words.</LI><LI>Try using more general keywords.</LI><LI>Try using different keywords.</LI></UL></P>";
......
......@@ -10,7 +10,7 @@ function submission_displayMain() {
### Perform query:
$result = db_query("SELECT * FROM submissions WHERE status = 1");
$content .= "<P>Anyone who happens by, and has some news or some thoughts they'd like to share, can <A HREF=\"submit.php\">submit</A> 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 be trashed.</P><P>Basically, this means that you, the community, are truly the editors of this site as you have the final decision on the content of this site. It's you judging the overall quality of a story. But remember, vote on whether the story is interesting, not on whether you agree with it or not. If the story goes up, you can disagree all you want, but don't vote 'no' because you think the ideas expressed are wrong. Instead, vote 'no' when you think the story is plain boring.</P>";
$content .= "<P>Anyone who happens by, and has some news or some thoughts they'd like to share, can <A HREF=\"submit.php\">submit</A> 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.</P><P>Basically, this means that you, the community, are truly the editors of this site as you have the final decision on the content of this site. It's you judging the overall quality of a story. But remember, vote on whether the story is interesting, not on whether you agree with it or not. If the story goes up, you can disagree all you want, but don't vote `no' because you think the ideas expressed are wrong. Instead, vote `no' when you think the story is plain boring.</P>";
$content .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n";
$content .= " <TR BGCOLOR=\"$bgcolor1\"><TH>Subject</TH><TH>Category</TH><TH>Date</TH><TH>Author</TH><TH>Score</TH></TR>\n";
......@@ -21,7 +21,7 @@ function submission_displayMain() {
$content .= "</TABLE>\n";
$theme->header();
$theme->box("Pending stories", $content);
$theme->box("Submission queue - Pending stories", $content);
$theme->footer();
}
......
......@@ -6,6 +6,12 @@ function submit_enter() {
global $user;
### Guidlines:
$output .= "<P>Got some news or some thoughts you would like to share? Fill out this form and they will automatically get whisked away to our submission queue where our moderators will frown at it, poke at it and hopefully post it. Every registered user is automatically a moderator and can vote whether or not your sumbission should be carried to the front page for discussion.</P>\n";
$output .= "<P>Note that we do not revamp or extend your submission so it is totally up to you to make sure it is well-written: if you don't care enough to be clear and complete, your submission is likely to be moderated down by our army of moderators. Try to be complete, aim for clarity, organize and structure your text, and try to carry out your statements with examples. It is also encouraged to extend your submission with arguments that flow from your unique intellectual capability and experience: offer some insight or explanation as to why you think your submission is interesting. Make sure your submission has some meat on it!</P>\n";
$output .= "<P>However, if you have bugs to report, complaints, personal questions or anything besides a public submission, we would prefer you to mail us instead, or your message is likely to get lost.</P><BR>\n";
### Submission form:
$output .= "<FORM ACTION=\"submit.php\" METHOD=\"post\">\n";
$output .= "<P>\n <B>Your name:</B><BR>\n";
......@@ -44,10 +50,6 @@ function submit_enter() {
$output .= "<P>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\"> (You must preview at least once before you can submit.)\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <SMALL><B>Important:</B> remember to include the exact URL of your <U>source</U> in case you refer to a story found on another website or your submission might be rejected!</SMALL>\n";
$output .= "</P>\n";
$output .= "</FORM>\n";
......@@ -102,10 +104,6 @@ function submit_preview($name, $address, $subject, $abstract, $story, $category)
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Submit submission\">\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <SMALL><B>Important:</B> remember to include the exact URL of your <U>source</U> in case you refer to a story found on another website or your submission might be rejected!</SMALL>\n";
$output .= "</P>\n";
$output .= "</FORM>\n";
$theme->header();
......@@ -138,7 +136,7 @@ function submit_submit($name, $address, $subject, $abstract, $article, $category
db_query("INSERT INTO submissions (uid, uname, subject, article, timestamp, category, abstract, score, votes) VALUES ('$uid', '$name', '$subject', '$article', '". time() ."', '$category', '$abstract', '0', '0')");
### Send notification mail (if required):
### Send e-mail notification (if enabled):
if ($notify) {
$message = "New submission:\n\nsubject...: $subject\nauthor....: $name\ncategory..: $category\nabstract..:\n$abstract\n\narticle...:\n$article";
mail($notify_email, "$notify_subject $subject", $message, "From: $notify_from\nX-Mailer: PHP/" . phpversion());
......
......@@ -19,16 +19,16 @@ function save() {
### Perform query:
mysql_query($query);
}
function update() {
function rehash() {
dbconnect();
$result = mysql_query("SELECT * FROM users WHERE id=$this->id") or die(sprintf("Critical error at line %d in %s: %s", __LINE__, __FILE__, mysql_error()));
if (mysql_num_rows($result) == 1) {
foreach (mysql_fetch_array($result) as $key=>$value) { $this->$key = $value; }
foreach (mysql_fetch_array($result) as $key=>$value) { $this->$key = stripslashes($value); }
}
}
function valid($access=0) {
if (!empty($this->userid)) {
$this->update(); // synchronisation purpose
$this->rehash(); // synchronisation purpose
$this->last_access = time();
$this->last_host = (!empty($GLOBALS[REMOTE_HOST]) ? $GLOBALS[REMOTE_HOST] : $GLOBALS[REMOTE_ADDR] );
dbconnect();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment