diff options
author | Dries Buytaert <dries@buytaert.net> | 2000-10-21 13:59:27 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2000-10-21 13:59:27 +0000 |
commit | ef43f485756937627f657664a2a7c7f5364e8a53 (patch) | |
tree | c700e0cac24f461c45a447a714f0a8d6d20ce888 | |
parent | da9675ef0bd18acd7e393460e197b30959ba5735 (diff) | |
download | brdo-ef43f485756937627f657664a2a7c7f5364e8a53.tar.gz brdo-ef43f485756937627f657664a2a7c7f5364e8a53.tar.bz2 |
A bunch of internal changes:
- better organisation of include files
- renamed a few function to make more sense
- small bugfix in the user account registration
- ...
-rw-r--r-- | account.php | 10 | ||||
-rw-r--r-- | admin.php | 4 | ||||
-rw-r--r-- | discussion.php | 2 | ||||
-rw-r--r-- | includes/function.inc | 5 | ||||
-rw-r--r-- | includes/template.inc | 6 | ||||
-rw-r--r-- | includes/theme.inc | 3 |
6 files changed, 15 insertions, 15 deletions
diff --git a/account.php b/account.php index bfc9ffd7c..4041c62f1 100644 --- a/account.php +++ b/account.php @@ -176,7 +176,7 @@ function account_user($uname) { $output .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TD ALIGN=\"right\"><B>User ID:</B></TD><TD>$user->userid</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>Name:</B></TD><TD>". format_data($user->name) ."</TD></TR>\n"; - $output .= " <TR><TD ALIGN=\"right\"><B>E-mail:</B></TD><TD>". format_email_address($user->fake_email) ."</A></TD></TR>\n"; + $output .= " <TR><TD ALIGN=\"right\"><B>E-mail:</B></TD><TD>". format_email($user->fake_email) ."</A></TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>URL:</B></TD><TD>". format_url($user->url) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Bio:</B></TD><TD>". format_data($user->bio) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Signature:</B></TD><TD>". format_data($user->signature) ."</TD></TR>\n"; @@ -190,7 +190,7 @@ function account_user($uname) { elseif ($uname && $account = account_get_user($uname)) { $box1 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n"; $box1 .= " <TR><TD ALIGN=\"right\"><B>Username:</B></TD><TD>$account->userid</TD></TR>\n"; - $box1 .= " <TR><TD ALIGN=\"right\"><B>E-mail:</B></TD><TD>". format_email_address($account->fake_email) ."</TD></TR>\n"; + $box1 .= " <TR><TD ALIGN=\"right\"><B>E-mail:</B></TD><TD>". format_email($account->fake_email) ."</TD></TR>\n"; $box1 .= " <TR><TD ALIGN=\"right\"><B>URL:</B></TD><TD>". format_url($account->url) ."</TD></TR>\n"; $box1 .= " <TR><TD ALIGN=\"right\"><B>Bio:</B></TD><TD>". format_data($account->bio) ."</TD></TR>\n"; $box1 .= "</TABLE>\n"; @@ -288,9 +288,9 @@ function account_register_submit($new) { user_save($new); $link = "http://". getenv("HOSTNAME") ."/account.php?op=confirm&name=$new[userid]&hash=$new[hash]"; - $message = "$new[userid],\n\n\nsomeone signed up for a user account on $sitename and supplied this email address as their contact. If it wasn't you, don't get your panties in a knot and simply ignore this mail.\n\nIf this was you, you have to activate your account first before you can login. You can activate your account by visiting the URL below:\n\n $link\n\nVisiting this URL will automatically activate your account. Once activated you can login using the following information:\n\n username: $new[userid]\n password: $new[passwd]\n\n\n-- $sitename crew\n"; - // mail($new[real_email], "Account details for $sitename", $message, "From: noreply@$sitename"); - print "<PRE>$message</PRE>\n"; + $message = "$new[userid],\n\n\nsomeone signed up for a user account on $sitename and supplied this email address as their contact. If it wasn't you, don't get your panties in a knot and simply ignore this mail.\n\nIf this was you, you have to activate your account first before you can login. You can do so simply by visiting the URL below:\n\n $link\n\nVisiting this URL will automatically activate your account. Once activated you can login using the following information:\n\n username: $new[userid]\n password: $new[passwd]\n\n\n-- $sitename crew\n"; + + mail($new[real_email], "Account details for $sitename", $message, "From: noreply@$sitename"); watchdog(1, "new user `$new[userid]' <$new[real_email]>"); @@ -40,7 +40,7 @@ function account_display($order = "username") { foreach ($show as $key=>$value) { switch($value) { case "real_email": - $output .= " <TD>". format_email_address($account[$value]) ."</TD>\n"; + $output .= " <TD>". format_email($account[$value]) ."</TD>\n"; break; case "last_access": $output .= " <TD>". format_date($account[$value]) ."</TD>\n"; @@ -91,7 +91,7 @@ function account_view($name) { $output .= " <TR><TD ALIGN=\"right\"><B>ID:</B></TD><TD>$account->id</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>Username:</B></TD><TD>$account->userid</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>Real name:</B></TD><TD>". format_data($account->name) ."</TD></TR>\n"; - $output .= " <TR><TD ALIGN=\"right\"><B>Real e-mail address:</B></TD><TD>". format_email_address($account->real_email) ."</TD></TR>\n"; + $output .= " <TR><TD ALIGN=\"right\"><B>Real e-mail address:</B></TD><TD>". format_email($account->real_email) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>Fake e-mail address:</B></TD><TD>". format_data($account->fake_email) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>URL of homepage:</B></TD><TD>". format_url($account->url) ."</TD></TR>\n"; $output .= " <TR><TD ALIGN=\"right\"><B>Last access:</B></TD><TD>". format_date($account->last_access) ." from $account->last_host</TD></TR>\n"; diff --git a/discussion.php b/discussion.php index a6097b4d8..18238a49f 100644 --- a/discussion.php +++ b/discussion.php @@ -287,7 +287,7 @@ function comment_post($pid, $sid, $subject, $comment) { $subject = ($subject) ? $subject : substr($comment, 0, 29); ### Add comment to database: - db_insert("INSERT INTO comments (pid, sid, author, subject, comment, hostname, timestamp) VALUES ($pid, $sid, $user->id, '". addslashes($subject) ."', '". addslashes($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')"); + db_insert("INSERT INTO comments (pid, sid, author, subject, comment, hostname, timestamp) VALUES ($pid, $sid, '$user->id', '". addslashes($subject) ."', '". addslashes($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')"); ### Compose header: header("Location: discussion.php?id=$sid"); diff --git a/includes/function.inc b/includes/function.inc index 5c1a3615a..ec3ad0a90 100644 --- a/includes/function.inc +++ b/includes/function.inc @@ -1,8 +1,5 @@ <? -include "includes/database.inc"; -include "includes/watchdog.inc"; - function id2story($id) { ### Perform query: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = $id"); @@ -69,7 +66,7 @@ function format_username($username, $admin = 0) { else { global $anonymous; return $anonymous; } } -function format_email_address($address) { +function format_email($address) { return ($address) ? "<A HREF=\"mailto:$address\">$address</A>" : format_data($address); } diff --git a/includes/template.inc b/includes/template.inc index 5cb6c84d1..0190d4293 100644 --- a/includes/template.inc +++ b/includes/template.inc @@ -1,5 +1,4 @@ <? -include "includes/user.inc"; function display_morelink($theme, $story) { return ($story->article) ? "[ <A HREF=\"discussion.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\"><B>read more</B></FONT></A> | ". strlen($story->article) ." bytes | <A HREF=\"discussion.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]" : "[ <A HREF=\"discussion.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]"; @@ -61,7 +60,7 @@ function display_old_headlines($theme, $num = 10) { function display_comment_moderation($id, $author, $score, $votes) { global $user, $comment_votes; - if ($user->userid && $user->userid != $author && !user_getHistory($user->history, "c$id")) { + if ($user->id && $user->userid != $author && !user_getHistory($user->history, "c$id")) { $output .= "<SELECT NAME=\"moderate[$id]\">\n"; foreach ($comment_votes as $key=>$value) $output .= " <OPTION VALUE=\"$value\">$key</OPTION>\n"; $output .= "</SELECT>\n"; @@ -106,7 +105,8 @@ function display_calendar($theme, $date) { function display_account($theme) { global $user; - if ($user && $user->userid) { + if ($user->id) { + function submission_number() { $result = db_query("SELECT COUNT(id) FROM stories WHERE status = 1"); return ($result) ? db_result($result, 0) : 0; diff --git a/includes/theme.inc b/includes/theme.inc index 93c6b62ff..0251f3d81 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1,8 +1,11 @@ <? include "includes/config.inc"; +include "includes/database.inc"; +include "includes/watchdog.inc"; include "includes/function.inc"; include "includes/template.inc"; +include "includes/user.inc"; global $user; |