- initial import of the preliminary translation code.
- added timer.inc for benchmarking purpose - bugfix for php-clean - bugfix for account.php - removed redundant format_data - ...3-00
parent
3ba9cb5d72
commit
db554e857d
215
account.php
215
account.php
|
@ -8,18 +8,18 @@ function account_get_user($uname) {
|
|||
}
|
||||
|
||||
function account_email() {
|
||||
$output .= "<P>Lost your password? Fill out your username and e-mail address, and your password will be mailed to you.</P>\n";
|
||||
$output .= "<P>". t("Lost your password? Fill out your username and e-mail address, and your password will be mailed to you.") ."</P>\n";
|
||||
$output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Username:</B><BR>\n";
|
||||
$output .= " <B>". t("Username") .":</B><BR>\n";
|
||||
$output .= " <INPUT NAME=\"userid\"><BR>\n";
|
||||
$output .= "</P>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>E-mail address:</B><BR>\n";
|
||||
$output .= " <B>". t("E-mail address") .":</B><BR>\n";
|
||||
$output .= " <INPUT NAME=\"email\"><BR>\n";
|
||||
$output .= "</P>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"E-mail password\">\n";
|
||||
$output .= " <INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"E-mail new password\">\n";
|
||||
$output .= "</P>\n";
|
||||
$output .= "</FORM>\n";
|
||||
|
||||
|
@ -30,22 +30,16 @@ function account_create($user = "", $error = "") {
|
|||
global $theme;
|
||||
|
||||
if ($error) $output .= "<B><FONT COLOR=\"red\">Failed to create account:</FONT>$error</B>\n";
|
||||
else $output .= "<P>Registering allows you to comment on stories, to moderate comments and pending stories, to customize the look and feel of the site and generally helps you interact with the site more efficiently.</P><P>To create an account, simply fill out this form an click the `Create account' button below. An e-mail will then be sent to you with instructions on how to validate your account.</P>\n";
|
||||
else $output .= "<P>". t("Registering allows you to comment on stories, to moderate comments and pending stories, to customize the look and feel of the site and generally helps you interact with the site more efficiently.") ."</P><P>". t("To create an account, simply fill out this form an click the 'Create account' button below. An e-mail will then be sent to you with instructions on how to validate your account.") ."</P>\n";
|
||||
|
||||
$output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Username:</B><BR>\n";
|
||||
$output .= " <INPUT NAME=\"userid\"><BR>\n";
|
||||
$output .= " <SMALL><I>Enter your desired username: only letters, numbers and common special characters are allowed.</I></SMALL><BR>\n";
|
||||
$output .= "</P>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>E-mail address:</B><BR>\n";
|
||||
$output .= " <INPUT NAME=\"email\"><BR>\n";
|
||||
$output .= " <SMALL><I>You will be sent instructions on how to validate your account via this e-mail address - please make sure it is accurate.</I></SMALL><BR>\n";
|
||||
$output .= "</P>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Create account\">\n";
|
||||
$output .= "</P>\n";
|
||||
$output .= "<B>". t("Username") .":</B><BR>\n";
|
||||
$output .= "<INPUT NAME=\"userid\"><BR>\n";
|
||||
$output .= "<SMALL><I>". t("Enter your desired username: only letters, numbers and common special characters are allowed.") ."</I></SMALL><P>\n";
|
||||
$output .= "<B>". t("E-mail address") .":</B><BR>\n";
|
||||
$output .= "<INPUT NAME=\"email\"><BR>\n";
|
||||
$output .= "<SMALL><I>". t("You will be sent instructions on how to validate your account via this e-mail address - please make sure it is accurate.") ."</I></SMALL><P>\n";
|
||||
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Create account\">\n";
|
||||
$output .= "</FORM>\n";
|
||||
|
||||
return $output;
|
||||
|
@ -78,42 +72,42 @@ function account_user_edit() {
|
|||
if ($user->id) {
|
||||
// Generate output/content:
|
||||
$output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n";
|
||||
$output .= "<B>Username:</B><BR>\n";
|
||||
$output .= "<B>". t("Username") .":</B><BR>\n";
|
||||
$output .= " $user->userid<P>\n";
|
||||
$output .= "<I>Required, unique, and can not be changed.</I><P>\n";
|
||||
$output .= "<B>Real name:</B><BR>\n";
|
||||
$output .= "<I>". t("Required, unique, and can not be changed.") ."</I><P>\n";
|
||||
$output .= "<B>". t("Real name") .":</B><BR>\n";
|
||||
$output .= "<INPUT NAME=\"edit[name]\" MAXLENGTH=\"55\" SIZE=\"30\" VALUE=\"$user->name\"><BR>\n";
|
||||
$output .= "<I>Optional.</I><P>\n";
|
||||
$output .= "<B>Real e-mail address:</B><BR>\n";
|
||||
$output .= "<I>". t("Optional.") ."</I><P>\n";
|
||||
$output .= "<B>". t("Real e-mail address") .":</B><BR>\n";
|
||||
$output .= " $user->real_email<P>\n";
|
||||
$output .= "<I>Required, unique, can not be changed and is never displayed publicly: only needed in case you lose your password.</I><P>\n";
|
||||
$output .= "<B>Fake e-mail address:</B><BR>\n";
|
||||
$output .= "<I>". t("Required, unique, can not be changed.") ." ". t("Your real e-mail address is never displayed publicly: only needed in case you lose your password.") ."</I><P>\n";
|
||||
$output .= "<B>". t("Fake e-mail address") .":</B><BR>\n";
|
||||
$output .= "<INPUT NAME=\"edit[fake_email]\" MAXLENGTH=\"55\" SIZE=\"30\" VALUE=\"$user->fake_email\"><BR>\n";
|
||||
$output .= "<I>Optional, and displayed publicly. You may spam proof your real e-mail address if you want.</I><P>\n";
|
||||
$output .= "<B>URL of homepage:</B><BR>\n";
|
||||
$output .= "<I>". t("Optional.") ." ". t("Displayed publicly so you may spam proof your real e-mail address if you want.") ."</I><P>\n";
|
||||
$output .= "<B>". t("Homepage") .":</B><BR>\n";
|
||||
$output .= "<INPUT NAME=\"edit[url]\" MAXLENGTH=\"55\" SIZE=\"30\" VALUE=\"$user->url\"><BR>\n";
|
||||
$output .= "<I>Optional, but make sure you enter fully qualified URLs only. That is, remember to include \"http://\".</I><P>\n";
|
||||
$output .= "<B>Bio:</B> (255 char. limit)<BR>\n";
|
||||
$output .= "<I>". t("Optional.") ." ". t("Make sure you enter fully qualified URLs only. That is, remember to include \"http://\".") ."</I><P>\n";
|
||||
$output .= "<B>". t("Bio") .":</B> (". t("maximal 255 characters") .")<BR>\n";
|
||||
$output .= "<TEXTAREA NAME=\"edit[bio]\" COLS=\"35\" ROWS=\"5\" WRAP=\"virtual\">$user->bio</TEXTAREA><BR>\n";
|
||||
$output .= "<I>Optional. This biographical information is publicly displayed on your user page.<BR>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I><P>\n";
|
||||
$output .= "<B>Signature:</B> (255 char. limit)<BR>\n";
|
||||
$output .= "<I>". t("Optional.") ." ". t("This biographical information is publicly displayed on your user page.") ."<BR>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I><P>\n";
|
||||
$output .= "<B>". t("Signature") .":</B> (". t("maximal 255 characters") .")<BR>\n";
|
||||
$output .= "<TEXTAREA NAME=\"edit[signature]\" COLS=\"35\" ROWS=\"5\" WRAP=\"virtual\">$user->signature</TEXTAREA><BR>\n";
|
||||
$output .= "<I>Optional. This information will be publicly displayed at the end of your comments.<BR>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I><P>\n";
|
||||
$output .= "<B>Password:</B><BR>\n";
|
||||
$output .= "<I>". t("Optional.") ." ". t("This information will be publicly displayed at the end of your comments.") ."<BR>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I><P>\n";
|
||||
$output .= "<B>". t("Password") .":</B><BR>\n";
|
||||
$output .= "<INPUT TYPE=\"password\" NAME=\"edit[pass1]\" SIZE=\"10\" MAXLENGTH=\"20\"> <INPUT TYPE=\"password\" NAME=\"edit[pass2]\" SIZE=\"10\" MAXLENGTH=\"20\"><BR>\n";
|
||||
$output .= "<I>Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.</I><P>\n";
|
||||
$output .= "<I>". t("Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.") ."</I><P>\n";
|
||||
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save user information\"><BR>\n";
|
||||
$output .= "</FORM>\n";
|
||||
|
||||
// Display output/content:
|
||||
$theme->header();
|
||||
$theme->box("Edit user information", $output);
|
||||
$theme->box(t("Edit user information"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
else {
|
||||
$theme->header();
|
||||
$theme->box("Create user account", account_create());
|
||||
$theme->box("E-mail password", account_email());
|
||||
$theme->box(t("Create user account"), account_create());
|
||||
$theme->box(t("E-mail new password"), account_email());
|
||||
$theme->footer();
|
||||
}
|
||||
}
|
||||
|
@ -139,52 +133,40 @@ function account_site_edit() {
|
|||
|
||||
if ($user->id) {
|
||||
$output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n";
|
||||
$output .= "<B>Theme:</B><BR>\n";
|
||||
foreach ($themes as $key=>$value) {
|
||||
$options1 .= " <OPTION VALUE=\"$key\"". (($user->theme == $key) ? " SELECTED" : "") .">$key - $value[1]</OPTION>\n";
|
||||
}
|
||||
$output .= "<B>". t("Theme" ) .":</B><BR>\n";
|
||||
foreach ($themes as $key=>$value) $options1 .= " <OPTION VALUE=\"$key\"". (($user->theme == $key) ? " SELECTED" : "") .">$key - $value[1]</OPTION>\n";
|
||||
$output .= "<SELECT NAME=\"edit[theme]\">\n$options1</SELECT><BR>\n";
|
||||
$output .= "<I>Selecting a different theme will change the look and feel of the site.</I><P>\n";
|
||||
$output .= "<B>Timezone:</B><BR>\n";
|
||||
$output .= "<I>". t("Selecting a different theme will change the look and feel of the site.") ."</I><P>\n";
|
||||
$output .= "<B>". t("Timezone") .":</B><BR>\n";
|
||||
$date = time() - date("Z");
|
||||
for ($zone = -43200; $zone <= 46800; $zone += 3600) {
|
||||
$options2 .= " <OPTION VALUE=\"$zone\"". (($user->timezone == $zone) ? " SELECTED" : "") .">". date("l, F dS, Y - h:i A", $date + $zone) ." (GMT ". $zone / 3600 .")</OPTION>\n";
|
||||
}
|
||||
for ($zone = -43200; $zone <= 46800; $zone += 3600) $options2 .= " <OPTION VALUE=\"$zone\"". (($user->timezone == $zone) ? " SELECTED" : "") .">". date("l, F dS, Y - h:i A", $date + $zone) ." (GMT ". $zone / 3600 .")</OPTION>\n";
|
||||
$output .= "<SELECT NAME=\"edit[timezone]\">\n$options2</SELECT><BR>\n";
|
||||
$output .= "<I>Select what time you currently have and your timezone settings will be set appropriate.</I><P>\n";
|
||||
$output .= "<B>Maximum number of stories:</B><BR>\n";
|
||||
for ($stories = 10; $stories <= 30; $stories += 5) {
|
||||
$options3 .= "<OPTION VALUE=\"$stories\"". (($user->stories == $stories) ? " SELECTED" : "") .">$stories</OPTION>\n";
|
||||
}
|
||||
$output .= "<I>". t("Select what time you currently have and your timezone settings will be set appropriate.") ."</I><P>\n";
|
||||
$output .= "<B>". t("Maximum number of stories to display") .":</B><BR>\n";
|
||||
for ($stories = 10; $stories <= 30; $stories += 5) $options3 .= "<OPTION VALUE=\"$stories\"". (($user->stories == $stories) ? " SELECTED" : "") .">$stories</OPTION>\n";
|
||||
$output .= "<SELECT NAME=\"edit[stories]\">\n$options3</SELECT><BR>\n";
|
||||
$output .= "<I>The maximum number of stories that will be displayed on the main page.</I><P>\n";
|
||||
foreach ($cmodes as $key=>$value) {
|
||||
$options4 .= "<OPTION VALUE=\"$key\"". ($user->mode == $key ? " SELECTED" : "") .">$value</OPTION>\n";
|
||||
}
|
||||
$output .= "<B>Comment display mode:</B><BR>\n";
|
||||
$output .= "<I>". t("The maximum number of stories that will be displayed on the main page.") ."</I><P>\n";
|
||||
foreach ($cmodes as $key=>$value) $options4 .= "<OPTION VALUE=\"$key\"". ($user->mode == $key ? " SELECTED" : "") .">$value</OPTION>\n";
|
||||
$output .= "<B>". t("Comment display mode") .":</B><BR>\n";
|
||||
$output .= "<SELECT NAME=\"edit[mode]\">$options4</SELECT><P>\n";
|
||||
foreach ($corder as $key=>$value) {
|
||||
$options5 .= "<OPTION VALUE=\"$key\"". ($user->sort == $key ? " SELECTED" : "") .">$value</OPTION>\n";
|
||||
}
|
||||
$output .= "<B>Comment sort order:</B><BR>\n";
|
||||
foreach ($corder as $key=>$value) $options5 .= "<OPTION VALUE=\"$key\"". ($user->sort == $key ? " SELECTED" : "") .">$value</OPTION>\n";
|
||||
$output .= "<B>". t("Comment sort order") .":</B><BR>\n";
|
||||
$output .= "<SELECT NAME=\"edit[sort]\">$options5</SELECT><P>\n";
|
||||
for ($i = -1; $i < 6; $i++) {
|
||||
$options6 .= " <OPTION VALUE=\"$i\"". ($user->threshold == $i ? " SELECTED" : "") .">Filter - $i</OPTION>";
|
||||
}
|
||||
$output .= "<B>Comment filter:</B><BR>\n";
|
||||
for ($i = -1; $i < 6; $i++) $options6 .= " <OPTION VALUE=\"$i\"". ($user->threshold == $i ? " SELECTED" : "") .">Filter - $i</OPTION>";
|
||||
$output .= "<B>". t("Comment filter") .":</B><BR>\n";
|
||||
$output .= "<SELECT NAME=\"edit[threshold]\">$options6</SELECT><BR>\n";
|
||||
$output .= "<I>Comments that scored less than this threshold setting will be ignored. Anonymous comments start at 0, comments of people logged on start at 1 and moderators can add and subtract points.</I><P>\n";
|
||||
$output .= "<I>". t("Comments that scored less than this threshold setting will be ignored. Anonymous comments start at 0, comments of people logged on start at 1 and moderators can add and subtract points.") ."</I><P>\n";
|
||||
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save site settings\"><BR>\n";
|
||||
$output .= "</FORM>\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Edit your preferences", $output);
|
||||
$theme->box(t("Edit your preferences"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
else {
|
||||
$theme->header();
|
||||
$theme->box("Create user account", account_create());
|
||||
$theme->box("E-mail password", account_email());
|
||||
$theme->box(t("Create user account"), account_create());
|
||||
$theme->box(t("E-mail new password"), account_email());
|
||||
$theme->footer();
|
||||
}
|
||||
}
|
||||
|
@ -208,27 +190,24 @@ function account_content_edit() {
|
|||
|
||||
if ($user->id) {
|
||||
$output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n";
|
||||
|
||||
$output .= "<B>Blocks in side bars:</B><BR>\n";
|
||||
|
||||
$output .= "<B>". t("Blocks in side bars") .":</B><BR>\n";
|
||||
$result = db_query("SELECT * FROM blocks WHERE status = 1 ORDER BY module");
|
||||
while ($block = db_fetch_object($result)) {
|
||||
$entry = db_fetch_object(db_query("SELECT * FROM layout WHERE block = '$block->name' AND user = '$user->id'"));
|
||||
$output .= "<INPUT TYPE=\"checkbox\" NAME=\"edit[$block->name]\"". ($entry->user ? " CHECKED" : "") ."> $block->name<BR>\n";
|
||||
$output .= "<INPUT TYPE=\"checkbox\" NAME=\"edit[$block->name]\"". ($entry->user ? " CHECKED" : "") ."> ". t($block->name) ."<BR>\n";
|
||||
}
|
||||
|
||||
$output .= "<P><I>Enable the blocks you would like to see displayed in the side bars.</I></P>\n";
|
||||
$output .= "<P><I>". t("Enable the blocks you would like to see displayed in the side bars.") ."</I></P>\n";
|
||||
$output .= "<P><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save content settings\"></P>\n";
|
||||
$output .= "</FORM>\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Edit your content", $output);
|
||||
$theme->box(t("Edit your content"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
else {
|
||||
$theme->header();
|
||||
$theme->box("Create user account", account_create());
|
||||
$theme->box("E-mail password", account_email());
|
||||
$theme->box(t("Create user account"), account_create());
|
||||
$theme->box(t("E-mail new password"), account_email());
|
||||
$theme->footer();
|
||||
}
|
||||
}
|
||||
|
@ -255,11 +234,11 @@ function account_user($uname) {
|
|||
|
||||
if ($user->id && $user->userid == $uname) {
|
||||
$output .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Username:</B></TD><TD>$user->userid</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>Homepage:</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";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Username") .":</B></TD><TD>$user->userid</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>". t("E-mail") .":</B></TD><TD>". format_email($user->fake_email) ."</A></TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Homepage") .":</B></TD><TD>". format_url($user->url) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>". t("Bio") .":</B></TD><TD>". check_output($user->bio) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>". t("Signature") .":</B></TD><TD>". check_output($user->signature) ."</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
|
||||
// Display account information:
|
||||
|
@ -269,18 +248,18 @@ function account_user($uname) {
|
|||
}
|
||||
elseif ($uname && $account = account_get_user($uname)) {
|
||||
$block1 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
|
||||
$block1 .= " <TR><TD ALIGN=\"right\"><B>Username:</B></TD><TD>$account->userid</TD></TR>\n";
|
||||
$block1 .= " <TR><TD ALIGN=\"right\"><B>E-mail:</B></TD><TD>". format_email($account->fake_email) ."</TD></TR>\n";
|
||||
$block1 .= " <TR><TD ALIGN=\"right\"><B>URL:</B></TD><TD>". format_url($account->url) ."</TD></TR>\n";
|
||||
$block1 .= " <TR><TD ALIGN=\"right\"><B>Bio:</B></TD><TD>". format_data($account->bio) ."</TD></TR>\n";
|
||||
$block1 .= " <TR><TD ALIGN=\"right\"><B>". t("Username") .":</B></TD><TD>$account->userid</TD></TR>\n";
|
||||
$block1 .= " <TR><TD ALIGN=\"right\"><B>". t("E-mail") .":</B></TD><TD>". format_email($account->fake_email) ."</TD></TR>\n";
|
||||
$block1 .= " <TR><TD ALIGN=\"right\"><B>". t("Homepage") .":</B></TD><TD>". format_url($account->url) ."</TD></TR>\n";
|
||||
$block1 .= " <TR><TD ALIGN=\"right\"><B>". t("Bio") .":</B></TD><TD>". check_output($account->bio) ."</TD></TR>\n";
|
||||
$block1 .= "</TABLE>\n";
|
||||
|
||||
$result = db_query("SELECT c.cid, c.pid, c.lid, c.subject, c.timestamp, s.subject AS story FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN stories s ON s.id = c.lid WHERE u.userid = '$uname' AND s.status = 2 AND c.link = 'story' AND s.timestamp > ". (time() - 1209600) ." ORDER BY cid DESC LIMIT 10");
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$block2 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
|
||||
$block2 .= " <TR><TD ALIGN=\"right\"><B>Comment:</B></TD><TD><A HREF=\"story.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD></TR>\n";
|
||||
$block2 .= " <TR><TD ALIGN=\"right\"><B>Date:</B></TD><TD>". format_date($comment->timestamp) ."</TD></TR>\n";
|
||||
$block2 .= " <TR><TD ALIGN=\"right\"><B>Story:</B></TD><TD><A HREF=\"story.php?id=$comment->lid\">". check_output($comment->story) ."</A></TD></TR>\n";
|
||||
$block2 .= " <TR><TD ALIGN=\"right\"><B>". t("Comment") .":</B></TD><TD><A HREF=\"story.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD></TR>\n";
|
||||
$block2 .= " <TR><TD ALIGN=\"right\"><B>". t("Date") .":</B></TD><TD>". format_date($comment->timestamp) ."</TD></TR>\n";
|
||||
$block2 .= " <TR><TD ALIGN=\"right\"><B>". t("Story") .":</B></TD><TD><A HREF=\"story.php?id=$comment->lid\">". check_output($comment->story) ."</A></TD></TR>\n";
|
||||
$block2 .= "</TABLE>\n";
|
||||
$block2 .= "<P>\n";
|
||||
$comments++;
|
||||
|
@ -288,16 +267,16 @@ function account_user($uname) {
|
|||
|
||||
// Display account information:
|
||||
$theme->header();
|
||||
if ($block1) $theme->box("User information for $uname", $block1);
|
||||
if ($block2) $theme->box("$uname has posted ". format_plural($comments, "comment", "comments") ." recently", $block2);
|
||||
if ($block1) $theme->box(strtr(t("%s's user information"), array("%s" => $uname)), $block1);
|
||||
if ($block2) $theme->box(strtr(t("%a has posted %b recently"), array("%a" => $uname, "%b" => format_plural($comments, "comment", "comments"))), $block2);
|
||||
module_iterate("module", $uname);
|
||||
$theme->footer();
|
||||
}
|
||||
else {
|
||||
// Display login form:
|
||||
$theme->header();
|
||||
$theme->box("Create user account", account_create());
|
||||
$theme->box("E-mail password", account_email());
|
||||
$theme->box(t("Create user account"), account_create());
|
||||
$theme->box(t("E-mail new password"), account_email());
|
||||
$theme->footer();
|
||||
}
|
||||
}
|
||||
|
@ -306,17 +285,17 @@ function account_validate($user) {
|
|||
global $type2index;
|
||||
|
||||
// Verify username and e-mail address:
|
||||
if (empty($user[real_email]) || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $user[real_email]))) $error .= "<LI>the specified e-mail address is not valid.</LI>\n";
|
||||
if (empty($user[userid]) || (ereg("[^a-zA-Z0-9_-]", $user[userid]))) $error .= "<LI>the specified username is not valid.</LI>\n";
|
||||
if (strlen($user[userid]) > 15) $error .= "<LI>the specified username is too long: it must be less than 15 characters.</LI>\n";
|
||||
if (empty($user[real_email]) || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $user[real_email]))) $error .= "<LI>". t("the specified e-mail address is not valid") .".</LI>\n";
|
||||
if (empty($user[userid]) || (ereg("[^a-zA-Z0-9_-]", $user[userid]))) $error .= "<LI>". t("the specified username is not valid") .".</LI>\n";
|
||||
if (strlen($user[userid]) > 15) $error .= "<LI>". t("the specified username is too long: it must be less than 15 characters") .".</LI>\n";
|
||||
|
||||
// Check to see whether the username or e-mail address are banned:
|
||||
if ($ban = ban_match($user[userid], $type2index[usernames])) $error .= "<LI>the specified username is banned for the following reason: <I>$ban->reason</I>.</LI>\n";
|
||||
if ($ban = ban_match($user[real_email], $type2index[addresses])) $error .= "<LI>the specified e-mail address is banned for the following reason: <I>$ban->reason</I>.</LI>\n";
|
||||
if ($ban = ban_match($user[userid], $type2index[usernames])) $error .= "<LI>". t("the specified username is banned for the following reason") .": <I>$ban->reason</I>.</LI>\n";
|
||||
if ($ban = ban_match($user[real_email], $type2index[addresses])) $error .= "<LI>". t("the specified e-mail address is banned for the following reason") .": <I>$ban->reason</I>.</LI>\n";
|
||||
|
||||
// Verify whether username and e-mail address are unique:
|
||||
if (db_num_rows(db_query("SELECT userid FROM users WHERE LOWER(userid) = LOWER('$user[userid]')")) > 0) $error .= "<LI>the specified username is already taken.</LI>\n";
|
||||
if (db_num_rows(db_query("SELECT real_email FROM users WHERE LOWER(real_email)=LOWER('$user[real_email]')")) > 0) $error .= "<LI>the specified e-mail address is already registered.</LI>\n";
|
||||
if (db_num_rows(db_query("SELECT userid FROM users WHERE LOWER(userid) = LOWER('$user[userid]')")) > 0) $error .= "<LI>". t("the specified username is already taken") .".</LI>\n";
|
||||
if (db_num_rows(db_query("SELECT real_email FROM users WHERE LOWER(real_email)=LOWER('$user[real_email]')")) > 0) $error .= "<LI>". t("the specified e-mail address is already registered") .".</LI>\n";
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
@ -328,8 +307,8 @@ function account_email_submit($userid, $email) {
|
|||
|
||||
if ($account = db_fetch_object($result)) {
|
||||
$passwd = account_password();
|
||||
$status = 1;
|
||||
$hash = substr(md5("$userid. ". time() .""), 0, 12);
|
||||
$status = 1;
|
||||
|
||||
db_query("UPDATE users SET passwd = PASSWORD('$passwd'), hash = '$hash', status = '$status' WHERE userid = '$userid'");
|
||||
|
||||
|
@ -344,11 +323,11 @@ function account_email_submit($userid, $email) {
|
|||
}
|
||||
else {
|
||||
watchdog("warning", "new password: '$userid' and <$email> do not match");
|
||||
$output = "Could not sent password: no match for the specified username and e-mail address.";
|
||||
$output = t("Could not sent password: no match for the specified username and e-mail address.");
|
||||
}
|
||||
|
||||
$theme->header();
|
||||
$theme->box("E-mail password", $output);
|
||||
$theme->box(t("E-mail new password"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -360,7 +339,7 @@ function account_create_submit($userid, $email) {
|
|||
|
||||
if ($error = account_validate($new)) {
|
||||
$theme->header();
|
||||
$theme->box("Create user account", account_create($new, $error));
|
||||
$theme->box(t("Create user account"), account_create($new, $error));
|
||||
$theme->footer();
|
||||
}
|
||||
else {
|
||||
|
@ -378,7 +357,7 @@ function account_create_submit($userid, $email) {
|
|||
mail($new[real_email], "Account details for $site_name", $message, "From: noreply");
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Create user account", "Congratulations! Your member account has been successfully created and further instructions on how to activate your account have been sent to your e-mail address.");
|
||||
$theme->box(t("Create user account"), t("Congratulations! Your member account has been successfully created and further instructions on how to activate your account have been sent to your e-mail address."));
|
||||
$theme->footer();
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +390,7 @@ function account_create_confirm($name, $hash) {
|
|||
}
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Account confirmation", $output);
|
||||
$theme->box(t("Create user account"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -428,20 +407,18 @@ function account_track_comments() {
|
|||
$sresult = db_query("SELECT s.id, s.subject, COUNT(s.id) as count FROM comments c LEFT JOIN stories s ON c.lid = s.id WHERE c.author = $user->id GROUP BY s.id DESC LIMIT 5");
|
||||
|
||||
while ($story = db_fetch_object($sresult)) {
|
||||
$output .= "<LI>". format_plural($story->count, comment, comments) ." attached to story `<A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A>`:</LI>\n";
|
||||
$output .= "<LI>". format_plural($story->count, "comment", "comments") ." ". t("attached to story") ." `<A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A>`:</LI>\n";
|
||||
$output .= " <UL>\n";
|
||||
|
||||
$cresult = db_query("SELECT * FROM comments WHERE author = $user->id AND lid = $story->id");
|
||||
while ($comment = db_fetch_object($cresult)) {
|
||||
$output .= " <LI><A HREF=\"story.php?id=$story->id&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A> - replies: ". comment_num_replies($comment->cid) ." - score: ". comment_score($comment) ."</LI>\n";
|
||||
$output .= " <LI><A HREF=\"story.php?id=$story->id&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A> - ". t("replies") .": ". comment_num_replies($comment->cid) ." - ". t("score") .": ". comment_score($comment) ."</LI>\n";
|
||||
}
|
||||
$output .= " </UL>\n";
|
||||
}
|
||||
|
||||
$output = ($output) ? "$output" : "$info <CENTER>You have not posted any comments recently.</CENTER>\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Track your comments", $output);
|
||||
$theme->box(t("Track your comments"), ($output ? $output : t("You have not posted any comments recently.")));
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -452,15 +429,15 @@ function account_track_stories() {
|
|||
|
||||
while ($story = db_fetch_object($result)) {
|
||||
$output .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Subject:</B></TD><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A> (". format_plural($story->count, "comment", "comments") .")</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Section:</B></TD><TD><A HREF=\"search.php?section=". urlencode($story->section) ."\">". check_output($story->section) ."</A></TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Date:</B></TD><TD>". format_date($story->timestamp) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Subject") .":</B></TD><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A> (". format_plural($story->count, "comment", "comments") .")</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Section") .":</B></TD><TD><A HREF=\"search.php?section=". urlencode($story->section) ."\">". check_output($story->section) ."</A></TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>". t("Date") .":</B></TD><TD>". format_date($story->timestamp) ."</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<P>\n";
|
||||
}
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Track your stories", ($output ? "$output" : "You have not posted any stories.\n"));
|
||||
$theme->box(t("Track your stories"), ($output ? $output : t("You have not posted any stories.")));
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -471,18 +448,18 @@ function account_track_site() {
|
|||
|
||||
$sresult = db_query("SELECT s.subject, s.id, COUNT(c.lid) AS count FROM comments c LEFT JOIN stories s ON c.lid = s.id WHERE s.status = 2 AND c.link = 'story' AND ". time() ." - c.timestamp < $period GROUP BY c.lid ORDER BY count DESC LIMIT 10");
|
||||
while ($story = db_fetch_object($sresult)) {
|
||||
$output .= "<LI>". format_plural($story->count, "new comment", "new comments") ." attached to story '<A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A>':</LI>";
|
||||
$output .= "<LI>". format_plural($story->count, "comment", "comments") ." ". t("attached to story") ." '<A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A>':</LI>";
|
||||
|
||||
$cresult = db_query("SELECT c.subject, c.cid, c.pid, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author WHERE c.lid = $story->id AND c.link = 'story' ORDER BY timestamp DESC LIMIT $story->count");
|
||||
$output .= "<UL>\n";
|
||||
while ($comment = db_fetch_object($cresult)) {
|
||||
$output .= " <LI>'<A HREF=\"story.php?id=$story->id&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A>' by ". format_username($comment->userid) ."</LI>\n";
|
||||
$output .= " <LI>'<A HREF=\"story.php?id=$story->id&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A>' ". t("by") ." ". format_username($comment->userid) ."</LI>\n";
|
||||
}
|
||||
$output .= "</UL>\n";
|
||||
}
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Track $site_name", $output);
|
||||
$theme->box(t("Track $site_name"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -497,7 +474,7 @@ switch ($op) {
|
|||
account_session_start($userid, $passwd);
|
||||
header("Location: account.php?op=info");
|
||||
break;
|
||||
case "E-mail password":
|
||||
case "E-mail new password":
|
||||
account_email_submit($userid, $email);
|
||||
break;
|
||||
case "Create account":
|
||||
|
|
|
@ -108,6 +108,12 @@ CREATE TABLE layout (
|
|||
block varchar(64) DEFAULT '' NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE locales (
|
||||
id int(11) DEFAULT '0' NOT NULL auto_increment,
|
||||
english TEXT DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE modules (
|
||||
name varchar(64) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (name)
|
||||
|
|
|
@ -205,7 +205,7 @@ function comment_moderation($comment) {
|
|||
$output .= "</SELECT>\n";
|
||||
}
|
||||
else {
|
||||
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"1\"><TR><TD>score:</TD><TD>". format_data($comment->score) ."</TD></TR><TR><TD>votes:</TD><TD>". format_data($comment->votes) ."</TR></TABLE>\n";
|
||||
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"1\"><TR><TD>score:</TD><TD>". check_output($comment->score) ."</TD></TR><TR><TD>votes:</TD><TD>". check_output($comment->votes) ."</TR></TABLE>\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?
|
||||
|
||||
$na = "<I>na</I>";
|
||||
|
||||
function check_textfield($message) {
|
||||
global $allowed_html;
|
||||
return strip_tags(str_replace("\"", """, stripslashes($message)), $allowed_html);
|
||||
|
@ -20,13 +22,16 @@ function check_code($message) {
|
|||
}
|
||||
|
||||
function check_output($message, $nl2br = 0) {
|
||||
global $allowed_html;
|
||||
if ($nl2br == 1) return nl2br(strip_tags(stripslashes($message), $allowed_html));
|
||||
else return strip_tags(stripslashes($message), $allowed_html);
|
||||
global $allowed_html, $na;
|
||||
if ($message) {
|
||||
if ($nl2br == 1) return nl2br(strip_tags(stripslashes($message), $allowed_html));
|
||||
else return strip_tags(stripslashes($message), $allowed_html);
|
||||
}
|
||||
else return $na;
|
||||
}
|
||||
|
||||
function format_plural($count, $singular, $plural) {
|
||||
return ($count == 1) ? "$count $singular" : "$count $plural";
|
||||
return ($count == 1) ? "$count ". t($singular) : "$count ". t($plural);
|
||||
}
|
||||
|
||||
function format_interval($timestamp) {
|
||||
|
@ -72,9 +77,6 @@ function format_date($timestamp, $type = "medium") {
|
|||
return $date;
|
||||
}
|
||||
|
||||
function format_data($field, $replacement = "<I>na</I>") {
|
||||
return ($field) ? $field : $replacement;
|
||||
}
|
||||
|
||||
function format_username($username) {
|
||||
global $user;
|
||||
|
@ -83,16 +85,14 @@ function format_username($username) {
|
|||
}
|
||||
|
||||
function format_email($address) {
|
||||
return ($address) ? "<A HREF=\"mailto:$address\">$address</A>" : format_data($address);
|
||||
global $na;
|
||||
return ($address) ? "<A HREF=\"mailto:$address\">$address</A>" : $na;
|
||||
}
|
||||
|
||||
function format_url($address, $description = "") {
|
||||
// POSSIBLE EXTENSIONS:
|
||||
// 1. add `http://' in case it's missing.
|
||||
// 2. add a trailing `/' in case it's missing.
|
||||
// 3. remove any parameters in the URI.
|
||||
global $na;
|
||||
$description = ($description) ? $description : $address;
|
||||
return ($address) ? "<A HREF=\"$address\">$description</A>" : format_data($address);
|
||||
return ($address) ? "<A HREF=\"$address\">$description</A>" : $na;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?
|
||||
|
||||
function t($string) {
|
||||
$result = db_query("SELECT id FROM locales WHERE english = '". addslashes($string) ."'");
|
||||
if (!db_fetch_object($result)) db_query("INSERT INTO locales (english) VALUES ('". addslashes($string) ."')");
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function search_data($keys, $type) {
|
|||
}
|
||||
|
||||
if (!$output) {
|
||||
$output .= "<P><SMALL>Your search yielded no results:</P><UL><LI>try using fewer words.</LI><LI>try using more general keywords.</LI><LI>try using different keywords.</LI></UL></SMALL>\n";
|
||||
$output .= t("Your search yielded no results.");
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
|
|
@ -30,15 +30,13 @@ function theme_account($theme) {
|
|||
module_iterate("menu");
|
||||
|
||||
// Display account settings:
|
||||
$content .= "<LI><A HREF=\"account.php?op=track&topic=comments\">track your comments</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=track&topic=stories\">track your stories</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=track&topic=site\">track $site_name</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=track&topic=comments\">". t("track your comments") ."</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=track&topic=stories\">". t("track your stories") ."</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=track&topic=site\">". t("track") ." $site_name</A></LI>\n";
|
||||
$content .= "<P>\n";
|
||||
$content .= "<LI><A HREF=\"submission.php\">submission queue</A> (<FONT COLOR=\"red\">". submission_number() ."</FONT>)</LI>\n";
|
||||
$content .= "<P>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=edit&topic=user\">edit your information</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=edit&topic=site\">edit your preferences</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=edit&topic=content\">edit your content</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=edit&topic=user\">". t("edit your information") ."</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=edit&topic=site\">". t("edit your preferences") ."</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=edit&topic=content\">". t("edit your content") ."</A></LI>\n";
|
||||
$content .= "<P>\n";
|
||||
|
||||
if (user_permission($user)) {
|
||||
|
@ -46,26 +44,29 @@ function theme_account($theme) {
|
|||
$content .= "<P>\n";
|
||||
}
|
||||
|
||||
$content .= "<LI><A HREF=\"submission.php\">". t("submission queue") ."</A> (<FONT COLOR=\"red\">". submission_number() ."</FONT>)</LI>\n";
|
||||
$content .= "<P>\n";
|
||||
|
||||
if ($menu && ksort($menu)) {
|
||||
foreach ($menu as $link=>$url) $content .= "<LI><A HREF=\"$url\">$link</A></LI>\n";
|
||||
foreach ($menu as $link=>$url) $content .= "<LI><A HREF=\"$url\">". t($link) ."</A></LI>\n";
|
||||
$content .= "<P>\n";
|
||||
}
|
||||
|
||||
$content .= "<LI><A HREF=\"account.php?op=logout\">logout</A></LI>\n";
|
||||
$content .= "<LI><A HREF=\"account.php?op=logout\">". t("logout") ."</A></LI>\n";
|
||||
|
||||
$theme->box("$user->userid's configuration", "$content");
|
||||
$theme->box(strtr(t("%s's configuration"), array("%s" => $user->userid)), "$content");
|
||||
}
|
||||
else {
|
||||
$output .= "<CENTER>\n";
|
||||
$output .= " <FORM ACTION=\"account.php?op=Login\" METHOD=\"post\">\n";
|
||||
$output .= " <P><B>Username:</B><BR><INPUT NAME=\"userid\" SIZE=\"15\"></P>\n";
|
||||
$output .= " <P><B>Password:</B><BR><INPUT NAME=\"passwd\" SIZE=\"15\" TYPE=\"password\"></P>\n";
|
||||
$output .= " <P><B>". t("Username") .":</B><BR><INPUT NAME=\"userid\" SIZE=\"15\"></P>\n";
|
||||
$output .= " <P><B>". t("Password") .":</B><BR><INPUT NAME=\"passwd\" SIZE=\"15\" TYPE=\"password\"></P>\n";
|
||||
$output .= " <P><INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Login\"></P>\n";
|
||||
$output .= " <P><A HREF=\"account.php\">REGISTER</A></P>\n";
|
||||
$output .= " <P><A HREF=\"account.php\">". t("REGISTER") ."</A></P>\n";
|
||||
$output .= " </FORM>\n";
|
||||
$output .= "</CENTER>\n";
|
||||
|
||||
$theme->box("Login", $output);
|
||||
$theme->box(t("Login"), $output);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +85,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(t($blocks[$block->offset]["subject"]), $blocks[$block->offset]["content"]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?
|
||||
|
||||
$timer = 0;
|
||||
|
||||
function timer_print() {
|
||||
global $timer;
|
||||
$stop = explode(" ", microtime());
|
||||
$diff = $timer[0] - $stop[0];
|
||||
print "<PRE>execution time: $diff ms</PRE>";
|
||||
}
|
||||
|
||||
function timer_start() {
|
||||
global $timer;
|
||||
$timer = explode(" ", microtime());
|
||||
}
|
||||
|
||||
?>
|
|
@ -10,6 +10,7 @@ $module = array("cron" => "account_cron",
|
|||
function account_cron_ratings() {
|
||||
$period = 5184000; // 60 days
|
||||
$number = 30; // 30 comments
|
||||
$offset = 5; // 5 comments
|
||||
|
||||
$r1 = db_query("SELECT id, userid FROM users");
|
||||
while ($account = db_fetch_object($r1)) {
|
||||
|
@ -27,7 +28,7 @@ function account_cron_ratings() {
|
|||
$votes += $weight * $comment->votes;
|
||||
}
|
||||
|
||||
if ($weight > 5 && $votes > 0) {
|
||||
if ($weight >= $offset && $votes > 0) {
|
||||
$value = ($score + $weight) / $votes + $bonus;
|
||||
db_query("UPDATE users SET rating = '$value' WHERE id = $account->id");
|
||||
}
|
||||
|
@ -121,7 +122,7 @@ function account_display($order = "username") {
|
|||
$output .= " <TD ALIGN=\"center\">". $perm[$account[$value]] ."</TD>\n";
|
||||
break;
|
||||
case "timezone":
|
||||
$output .= " <TD ALIGN=\"center\">". format_data($account[$value] / 3600) ."</TD>\n";
|
||||
$output .= " <TD ALIGN=\"center\">". check_output($account[$value] / 3600) ."</TD>\n";
|
||||
break;
|
||||
case "url":
|
||||
$output .= " <TD>". format_url($account[$value]) ."</TD>\n";
|
||||
|
@ -130,7 +131,7 @@ function account_display($order = "username") {
|
|||
$output .= " <TD>". format_username($account[$value]) ."</TD>\n";
|
||||
break;
|
||||
default:
|
||||
$output .= " <TD>". format_data($account[$value]) ."</TD>\n";
|
||||
$output .= " <TD>". check_output($account[$value]) ."</TD>\n";
|
||||
}
|
||||
}
|
||||
$output .= " <TD ALIGN=\"center\"><A HREF=\"admin.php?mod=account&op=view&name=$account[userid]\">view</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=account&op=edit&name=$account[userid]\">edit</A></TD>\n";
|
||||
|
@ -144,7 +145,7 @@ function account_display($order = "username") {
|
|||
function account_blocks($id) {
|
||||
$result = db_query("SELECT * FROM layout WHERE user = $id");
|
||||
while ($layout = db_fetch_object($result)) {
|
||||
$output .= "<LI>". check_output($layout->block) ."</LI>\n";
|
||||
$output .= "<LI>$layout->block</LI>\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
@ -152,7 +153,7 @@ function account_blocks($id) {
|
|||
function account_stories($id) {
|
||||
$result = db_query("SELECT * FROM stories WHERE author = $id ORDER BY timestamp DESC");
|
||||
while ($story = db_fetch_object($result)) {
|
||||
$output .= "<LI><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></LI>\n";
|
||||
$output .= "<LI><A HREF=\"story.php?id=$story->id\">$story->subject</A></LI>\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
@ -160,7 +161,7 @@ function account_stories($id) {
|
|||
function account_comments($id) {
|
||||
$result = db_query("SELECT * FROM comments WHERE link = 'story' AND author = $id ORDER BY timestamp DESC");
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= "<LI><A HREF=\"story.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></LI>\n";
|
||||
$output .= "<LI><A HREF=\"story.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">$comment->subject</A></LI>\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
@ -196,20 +197,20 @@ function account_edit($name) {
|
|||
$output .= " <TR><TD ALIGN=\"right\"><B>ID:</B></TD><TD>$account->id</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Status:</B></TD><TD>$stat</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 name:</B></TD><TD>". check_output($account->name) ."</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><INPUT NAME=\"edit[fake_email]\" SIZE=\"55\" VALUE=\"$account->fake_email\"></TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>URL of homepage:</B></TD><TD><INPUT NAME=\"edit[url]\" SIZE=\"55\" VALUE=\"$account->url\"></TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Permissions:</B></TD><TD>$perm</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Last access:</B></TD><TD>". format_date($account->last_access) ." from ". format_data($account->last_host) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>User rating:</B></TD><TD>". format_data($account->rating) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Last access:</B></TD><TD>". format_date($account->last_access) ." from ". check_output($account->last_host) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>User rating:</B></TD><TD>". check_output($account->rating) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Bio information:</B></TD><TD><TEXTAREA NAME=\"edit[bio]\" COLS=\"35\" ROWS=\"5\" WRAP=\"virtual\">$account->bio</TEXTAREA></TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Signature:</B></TD><TD><TEXTAREA NAME=\"edit[signature]\" COLS=\"35\" ROWS=\"5\" WRAP=\"virtual\">$account->signature</TEXTAREA></TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Theme:</B></TD><TD>". format_data($account->theme) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Timezone:</B></TD><TD>". format_data($account->timezone / 3600) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Selected blocks:</B></TD><TD>". format_data(account_blocks($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted stories:</B></TD><TD>". format_data(account_stories($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted comments:</B></TD><TD>". format_data(account_comments($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Theme:</B></TD><TD>". check_output($account->theme) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Timezone:</B></TD><TD>". check_output($account->timezone / 3600) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Selected blocks:</B></TD><TD>". check_output(account_blocks($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted stories:</B></TD><TD>". check_output(account_stories($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted comments:</B></TD><TD>". check_output(account_comments($account->id)) ."</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<INPUT NAME=\"name\" TYPE=\"hidden\" VALUE=\"$account->userid\">\n";
|
||||
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Save account\">\n";
|
||||
|
@ -229,20 +230,20 @@ function account_view($name) {
|
|||
$output .= " <TR><TD ALIGN=\"right\"><B>ID:</B></TD><TD><A HREF=\"admin.php?mod=account&op=edit&name=$account->userid\">$account->id</A></TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Status:</B></TD><TD>". $status[$account->status] ."</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 name:</B></TD><TD>". check_output($account->name) ."</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>Fake e-mail address:</B></TD><TD>". check_output($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>Permissions:</B></TD><TD>". $permissions[$account->permissions] ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Last access:</B></TD><TD>". format_date($account->last_access) ." from ". format_data($account->last_host) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>User rating:</B></TD><TD>". format_data($account->rating) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Bio information:</B></TD><TD>". format_data($account->bio) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Signature:</B></TD><TD>". format_data($account->signature) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Theme:</B></TD><TD>". format_data($account->theme) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Timezone:</B></TD><TD>". format_data($account->timezone / 3600) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Selected blocks:</B></TD><TD>". format_data(account_blocks($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted stories:</B></TD><TD>". format_data(account_stories($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted comments:</B></TD><TD>". format_data(account_comments($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Last access:</B></TD><TD>". format_date($account->last_access) ." from ". check_output($account->last_host) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>User rating:</B></TD><TD>". check_output($account->rating) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Bio information:</B></TD><TD>". check_output($account->bio) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Signature:</B></TD><TD>". check_output($account->signature) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Theme:</B></TD><TD>". check_output($account->theme) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\"><B>Timezone:</B></TD><TD>". check_output($account->timezone / 3600) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Selected blocks:</B></TD><TD>". check_output(account_blocks($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted stories:</B></TD><TD>". check_output(account_stories($account->id)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Submitted comments:</B></TD><TD>". check_output(account_comments($account->id)) ."</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
print "$output";
|
||||
}
|
||||
|
@ -254,7 +255,7 @@ function account_block() {
|
|||
$content .= "<TABLE CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
$content .= "<TR><TH>Username</TH><TH>Rating</TH></TR>\n";
|
||||
while ($account = db_fetch_object($result)) {
|
||||
$content .= "<TR><TD>". format_username($account->userid) ."</TD><TD>". format_data($account->rating) ."</TD></TR>";
|
||||
$content .= "<TR><TD>". format_username($account->userid) ."</TD><TD>". check_output($account->rating) ."</TD></TR>";
|
||||
}
|
||||
$content .= "</TABLE>\n";
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ function affiliate_admin_display() {
|
|||
$output .= " <TR><TH>name</TH><TH>link</TH><TH>contact</TH><TH>operations</TH></TR>\n";
|
||||
|
||||
while ($affiliate = db_fetch_object($result)) {
|
||||
$output .= " <TR><TD>$affiliate->name</TD><TD>". format_url($affiliate->link) ."</TD><TD>". format_email($affiliate->contact) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=affiliate-site&op=delete&id=$affiliate->id\">delete</A></TD></TR>\n";
|
||||
$output .= " <TR><TD>". check_output($affiliate->name) ."</TD><TD>". format_url($affiliate->link) ."</TD><TD>". format_email($affiliate->contact) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=affiliate-site&op=delete&id=$affiliate->id\">delete</A></TD></TR>\n";
|
||||
}
|
||||
|
||||
$output .= " <TR><TD><INPUT TYPE=\"text\" NAME=\"name\"></TD><TD><INPUT TYPE=\"text\" NAME=\"url\"></TD><TD><INPUT TYPE=\"text\" NAME=\"contact\"></TD><TD><INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Add affiliate site\"></TD></TR>\n";
|
||||
|
|
|
@ -55,10 +55,10 @@ function box_admin_display() {
|
|||
|
||||
while ($block = db_fetch_object($result)) {
|
||||
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
|
||||
$output .= " <TR><TH>Subject:</TH><TD>". format_data($block->subject) ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Subject:</TH><TD>". check_output($block->subject) ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Content:</TH><TD>". nl2br(htmlentities($block->content)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Type:</TH><TD>". $type[$block->type] ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Description:</TH><TD>". format_data($block->info) ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Description:</TH><TD>". check_output($block->info) ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Link:</TH><TD>". format_url($block->link) ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Operations:</TH><TD><A HREF=\"admin.php?mod=box&op=edit&id=$block->id\">edit</A>, <A HREF=\"admin.php?mod=box&op=delete&id=$block->id\">delete</A></TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
|
|
|
@ -33,23 +33,21 @@ function diary_page_overview($num = 20) {
|
|||
|
||||
$result = db_query("SELECT d.*, u.userid FROM diaries d LEFT JOIN users u ON d.author = u.id ORDER BY d.timestamp DESC LIMIT $num");
|
||||
|
||||
$output .= "<P>This part of the website is dedicated to provide easy-to-write and easy-to-read online diaries or journals filled with daily thoughts, poetry, boneless blabber, spiritual theories, intimate details, valuable experiences, cynical rants, semi-coherent comments, writing experiments, artistic babblings, critics on current facts, fresh insights, diverse dreams, chronicles and mumbling madness available for public consumption.</P>";
|
||||
|
||||
while ($diary = db_fetch_object($result)) {
|
||||
if ($time != date("F jS", $diary->timestamp)) {
|
||||
$output .= "<B>". date("l, F jS", $diary->timestamp) ."</B>\n";
|
||||
$time = date("F jS", $diary->timestamp);
|
||||
}
|
||||
$output .= "<DL>\n";
|
||||
$output .= " <DD><P><B>$diary->userid wrote:</B></P></DD>\n";
|
||||
$output .= " <DD><P><B>$diary->userid ". t("wrote") .":</B></P></DD>\n";
|
||||
$output .= " <DL>\n";
|
||||
$output .= " <DD><P>". check_output($diary->text, 1) ."</P><P>[ <A HREF=\"module.php?mod=diary&op=view&name=$diary->userid\">more</A> ]</P></DD>\n";
|
||||
$output .= " <DD><P>". check_output($diary->text, 1) ."</P><P>[ <A HREF=\"module.php?mod=diary&op=view&name=$diary->userid\">". t("more") ."</A> ]</P></DD>\n";
|
||||
$output .= " </DL>\n";
|
||||
$output .= "</DL>\n";
|
||||
}
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Online diary", $output);
|
||||
$theme->box(t("Online diary"), $output);
|
||||
$theme->footer();
|
||||
|
||||
}
|
||||
|
@ -58,7 +56,7 @@ function diary_page_entry($timestamp, $text, $id = 0) {
|
|||
if ($id) {
|
||||
$output .= "<DL>\n";
|
||||
$output .= " <DT><B>". date("l, F jS", $timestamp) .":</B> </DT>\n";
|
||||
$output .= " <DD><P>[ <A HREF=\"module.php?mod=diary&op=edit&id=$id\">edit</A> ]</P><P>". check_output($text, 1) ."</P></DD>\n";
|
||||
$output .= " <DD><P>[ <A HREF=\"module.php?mod=diary&op=edit&id=$id\">". t("edit") ."</A> ]</P><P>". check_output($text, 1) ."</P></DD>\n";
|
||||
$output .= "</DL>\n";
|
||||
}
|
||||
else {
|
||||
|
@ -82,12 +80,12 @@ function diary_page_display($username) {
|
|||
while ($diary = db_fetch_object($result)) $output .= diary_page_entry($diary->timestamp, $diary->text, $diary->id);
|
||||
}
|
||||
else {
|
||||
$output .= "<P>". format_username($username) ."'s diary:</P>\n";
|
||||
$output .= "<B>". t("Username") .":</B> ". format_username($username);
|
||||
while ($diary = db_fetch_object($result)) $output .= diary_page_entry($diary->timestamp, $diary->text);
|
||||
}
|
||||
|
||||
$theme->header();
|
||||
$theme->box("$username's online diary", $output);
|
||||
$theme->box(t("Online diary"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -97,9 +95,8 @@ function diary_page_add() {
|
|||
$output .= "<FORM ACTION=\"module.php?mod=diary\" METHOD=\"post\">\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Enter new diary entry:</B><BR>\n";
|
||||
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"text\" MAXLENGTH=\"20\"></TEXTAREA><BR>\n";
|
||||
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"text\"></TEXTAREA><BR>\n";
|
||||
$output .= " <SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
|
@ -109,7 +106,7 @@ function diary_page_add() {
|
|||
$output .= "</FORM>\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Edit your diary", $output);
|
||||
$theme->box(t("Edit your diary"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -122,23 +119,19 @@ function diary_page_edit($id) {
|
|||
$output .= diary_page_entry($diary->timestamp, $diary->text);
|
||||
|
||||
$output .= "<FORM ACTION=\"module.php?mod=diary\" METHOD=\"post\">\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Edit diary entry:</B><BR>\n";
|
||||
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"text\">". check_textarea($diary->text) ."</TEXTAREA><BR>\n";
|
||||
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= " <SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$diary->id\">\n";
|
||||
$output .= " <INPUT TYPE=\"hidden\" NAME=\"timestamp\" VALUE=\"$diary->timestamp\">\n";
|
||||
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview diary entry\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Submit diary entry\">\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "</FORM>\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Edit your diary", $output);
|
||||
$theme->box(t("Edit your diary"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -148,13 +141,10 @@ function diary_page_preview($text, $timestamp, $id = 0) {
|
|||
$output .= diary_page_entry($timestamp, $text);
|
||||
|
||||
$output .= "<FORM ACTION=\"module.php?mod=diary\" METHOD=\"post\">\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Preview diary entry:</B><BR>\n";
|
||||
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"text\">". check_textarea($text) ."</TEXTAREA><BR>\n";
|
||||
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= " <SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">\n";
|
||||
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview diary entry\">\n";
|
||||
|
@ -164,7 +154,7 @@ function diary_page_preview($text, $timestamp, $id = 0) {
|
|||
$output .= "</FORM>\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Edit your diary", $output);
|
||||
$theme->box(t("Edit your diary"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -229,7 +219,7 @@ function diary_user($username, $section, $operation) {
|
|||
$diaries++;
|
||||
}
|
||||
|
||||
$block["subject"] = "$username has posted ". format_plural($diaries, "diary entry", "diary entries") ." recently";
|
||||
$block["subject"] = strtr(t("%a has posted %b recently"), array("%a" => $username, "%b" => format_plural($diaries, "diary entry", "diary entries")));
|
||||
$block["content"] = $content;
|
||||
|
||||
return $block;
|
||||
|
|
|
@ -83,7 +83,7 @@ function faq_page() {
|
|||
</DL>";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Frequently Asked Questions", $output);
|
||||
$theme->box(t("Frequently Asked Questions"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?
|
||||
|
||||
$module = array("page" => "locale",
|
||||
"admin" => "locale");
|
||||
|
||||
function locale() {
|
||||
$result = db_query("SELECT * FROM locales ORDER BY english");
|
||||
while ($locale = db_fetch_object($result)) {
|
||||
print "<LI>". check_output($locale->english) ."</LI>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,13 @@
|
|||
<?
|
||||
|
||||
$module = array("page" => "locale",
|
||||
"admin" => "locale");
|
||||
|
||||
function locale() {
|
||||
$result = db_query("SELECT * FROM locales ORDER BY english");
|
||||
while ($locale = db_fetch_object($result)) {
|
||||
print "<LI>". check_output($locale->english) ."</LI>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -20,7 +20,7 @@ function section_help() {
|
|||
function section_block() {
|
||||
$result = db_query("SELECT se.name, COUNT(st.id) AS stories FROM sections se LEFT JOIN stories st ON se.name = st.section GROUP BY se.name");
|
||||
while ($_section = db_fetch_object($result)) {
|
||||
$content .= "<LI><A HREF=\"?section=". urlencode($_section->name) ."\">$_section->name</A> (". format_data($_section->stories, 0) .")</LI>\n";
|
||||
$content .= "<LI><A HREF=\"?section=". urlencode($_section->name) ."\">$_section->name</A> (". check_output($_section->stories, 0) .")</LI>\n";
|
||||
}
|
||||
|
||||
$block[0]["subject"] = "Sections";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
find . -name "*~" -type f | xargs rm -f
|
||||
find . -name "DEADJOE" -type f | xargs rm -f
|
||||
find . -name "*" -type f | grep -v ".gif" | grep -v ".jpg" | xargs perl -wi -pe 's/\s+$/\n/'
|
||||
find . -name "*" -type f | grep -v ".gif" | grep -v ".jpg" | xargs perl -wi -pe 's/\t/ /g'
|
||||
find . -name "*" -type f | grep -v ".gif" | grep -v ".jpg" | grep -v ".tgz" | xargs perl -wi -pe 's/\s+$/\n/'
|
||||
find . -name "*" -type f | grep -v ".gif" | grep -v ".jpg" | grep -v ".tgz" | xargs perl -wi -pe 's/\t/ /g'
|
||||
|
|
|
@ -18,8 +18,8 @@ $search .= "</FORM>\n";
|
|||
$output = search_data($keys, $type);
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Search", $search);
|
||||
$theme->box("Result", $output);
|
||||
$theme->box(t("Search"), $search);
|
||||
$theme->box(t("Result"), $output);
|
||||
$theme->footer();
|
||||
|
||||
?>
|
|
@ -9,17 +9,18 @@ function submission_display_main() {
|
|||
// Perform query:
|
||||
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.status = 1 ORDER BY s.id");
|
||||
|
||||
$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 .= "<P>". t("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>";
|
||||
$content .= "<P>". t("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=\"4\" CELLPADDING=\"4\">\n";
|
||||
$content .= " <TR BGCOLOR=\"$bgcolor1\"><TH>Subject</TH><TH>Section</TH><TH>Date</TH><TH>Author</TH><TH>Score</TH></TR>\n";
|
||||
$content .= " <TR BGCOLOR=\"$bgcolor1\"><TH>". t("Subject") ."</TH><TH>". t("Section") ."</TH><TH>". t("Date") ."</TH><TH>". t("Author") ."</TH><TH>". t("Score") ."</TH></TR>\n";
|
||||
while ($submission = db_fetch_object($result)) {
|
||||
if ($user->id == $submission->author || user_get_history($user->history, "s$submission->id")) $content .= " <TR><TD WIDTH=\"100%\"><A HREF=\"submission.php?op=view&id=$submission->id\">". check_output($submission->subject) ."</A></TD><TD>$submission->section</TD><TD ALIGN=\"center\">". date("Y-m-d", $submission->timestamp) ."<BR>". date("H:m:s", $submission->timestamp) ."</TD><TD ALIGN=\"center\">". format_username($submission->userid) ."</TD><TD ALIGN=\"center\">". submission_score($submission->id) ."</TD></TR>\n";
|
||||
else $content .= " <TR><TD WIDTH=\"100%\"><A HREF=\"submission.php?op=view&id=$submission->id\">". check_output($submission->subject) ."</A></TD><TD>$submission->section</TD><TD ALIGN=\"center\">". date("Y-m-d", $submission->timestamp) ."<BR>". date("H:m:s", $submission->timestamp) ."</TD><TD ALIGN=\"center\">". format_username($submission->userid) ."</TD><TD ALIGN=\"center\"><A HREF=\"submission.php?op=view&id=$submission->id\">vote</A></TD></TR>\n";
|
||||
else $content .= " <TR><TD WIDTH=\"100%\"><A HREF=\"submission.php?op=view&id=$submission->id\">". check_output($submission->subject) ."</A></TD><TD>$submission->section</TD><TD ALIGN=\"center\">". date("Y-m-d", $submission->timestamp) ."<BR>". date("H:m:s", $submission->timestamp) ."</TD><TD ALIGN=\"center\">". format_username($submission->userid) ."</TD><TD ALIGN=\"center\"><A HREF=\"submission.php?op=view&id=$submission->id\">". t("vote") ."</A></TD></TR>\n";
|
||||
}
|
||||
$content .= "</TABLE>\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Open submission queue - Pending stories", $content);
|
||||
$theme->box(t("Open submission queue - Pending stories"), $content);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
|
47
submit.php
47
submit.php
|
@ -4,50 +4,51 @@ function submit_enter() {
|
|||
global $anonymous, $allowed_html, $theme, $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 up to you to make sure your submission 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";
|
||||
$output .= "<P>". t("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>". t("Note that we do not revamp or extend your submission so it is up to you to make sure your submission 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>". t("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>\n";
|
||||
|
||||
// Submission form:
|
||||
$output .= "<FORM ACTION=\"submit.php\" METHOD=\"post\">\n";
|
||||
|
||||
$output .= "<P>\n <B>Your name:</B><BR>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>". t("Your name") .":</B><BR>\n";
|
||||
$output .= format_username($user->userid);
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Subject:</B><BR>\n";
|
||||
$output .= " <B>". t("Subject") .":</B><BR>\n";
|
||||
$output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\"><BR>\n";
|
||||
$output .= " <SMALL><I>Bad subjects are 'Check this out!' or 'An article'. Be descriptive, clear and simple!</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P><B>Section:</B><BR>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>". t("Section") .":</B><BR>\n";
|
||||
$output .= " <SELECT NAME=\"section\">\n";
|
||||
foreach ($sections = section_get() as $value) $output .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
|
||||
$output .= " </SELECT>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Abstract:</B><BR>\n";
|
||||
$output .= " <B>". t("Abstract") .":</B><BR>\n";
|
||||
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"abstract\" MAXLENGTH=\"20\"></TEXTAREA><BR>\n";
|
||||
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= " <SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Extended story:</B><BR>\n";
|
||||
$output .= " <B>". t("Extended story") .":</B><BR>\n";
|
||||
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"article\"></TEXTAREA><BR>\n";
|
||||
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= " <SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <SMALL><I>You must preview at least once before you can submit:</I></SMALL><BR>\n";
|
||||
$output .= " <SMALL><I>". t("You must preview at least once before you can submit") .":</I></SMALL><BR>\n";
|
||||
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\">\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "</FORM>\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box("Submit a story", $output);
|
||||
$theme->box(t("Submit a story"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
@ -59,45 +60,43 @@ function submit_preview($subject, $abstract, $article, $section) {
|
|||
$output .= "<FORM ACTION=\"submit.php\" METHOD=\"post\">\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Your name:</B><BR>\n";
|
||||
$output .= " <B>". t("Your name") .":</B><BR>\n";
|
||||
$output .= format_username($user->userid);
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Subject:</B><BR>\n";
|
||||
$output .= " <B>". t("Subject") .":</B><BR>\n";
|
||||
$output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\" VALUE=\"". check_output(check_textfield($subject)) ."\"><BR>\n";
|
||||
$output .= " <SMALL><I>Bad subjects are 'Check this out!' or 'An article'. Be descriptive, clear and simple!</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P><B>Section:</B><BR>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>". t("Section") .":</B><BR>\n";
|
||||
$output .= " <SELECT NAME=\"section\">\n";
|
||||
foreach ($sections = section_get() as $value) $output .= " <OPTION VALUE=\"$value\"". ($section == $value ? " SELECTED" : "") .">$value</OPTION>\n";
|
||||
$output .= "</SELECT>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= "<B>Abstract:</B><BR>\n";
|
||||
$output .= "<B>". t("Abstract") .":</B><BR>\n";
|
||||
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"abstract\">". check_textarea($abstract) ."</TEXTAREA><BR>\n";
|
||||
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
$output .= "<P>\n";
|
||||
$output .= " <B>Extended story:</B><BR>\n";
|
||||
$output .= " <B>". t("Extended story") .":</B><BR>\n";
|
||||
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"article\">". check_textarea($article) ."</TEXTAREA><BR>\n";
|
||||
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
|
||||
$output .= "</P>\n";
|
||||
|
||||
if (empty($subject)) {
|
||||
$output .= "<P>\n";
|
||||
$output .= " <FONT COLOR=\"red\"><B>Warning:</B></FONT> you did not supply a <U>subject</U>.\n";
|
||||
$outout .= "</P>\n";
|
||||
$output .= "<P><FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT></P>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\">\n";
|
||||
$output .= "</P>\n";
|
||||
}
|
||||
else if (empty($abstract)) {
|
||||
$output .= "<P>\n";
|
||||
$output .= " <FONT COLOR=\"red\"><B>Warning:</B></FONT> you did not supply an <U>abstract</U>.\n";
|
||||
$output .= " <FONT COLOR=\"red\">". t("Warning: you did not supply an abstract.") ."\n";
|
||||
$outout .= "</P>\n";
|
||||
$output .= "<P>\n";
|
||||
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\">\n";
|
||||
|
@ -113,7 +112,7 @@ function submit_preview($subject, $abstract, $article, $section) {
|
|||
|
||||
$theme->header();
|
||||
$theme->article(new Story($user->userid, $subject, $abstract, $article, $section, time()));
|
||||
$theme->box("Submit a story", $output);
|
||||
$theme->box(t("Submit a story"), $output);
|
||||
$theme->footer();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,3 +13,10 @@ alter table blocks add remove tinyint(1) DEFAULT '0' NOT NULL;
|
|||
|
||||
# 07/02/2001: value calculation
|
||||
alter table users add rating decimal(8,4) DEFAULT '0' NOT NULL;
|
||||
|
||||
# 12/02/2001: locale / internationalisation
|
||||
create table locales (
|
||||
id int(11) DEFAULT '0' NOT NULL auto_increment,
|
||||
english TEXT DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue