Commit 52a1d1bb authored by Dries's avatar Dries

- More updates on the translation support
parent e7f043c3
......@@ -10,17 +10,11 @@ function account_get_user($uname) {
function account_email() {
$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>". t("Username") .":</B><BR>\n";
$output .= " <INPUT NAME=\"userid\"><BR>\n";
$output .= "</P>\n";
$output .= "<P>\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 new password\">\n";
$output .= "</P>\n";
$output .= "<B>". t("Username") .":</B><BR>\n";
$output .= "<INPUT NAME=\"userid\"><P>\n";
$output .= "<B>". t("E-mail address") .":</B><BR>\n";
$output .= "<INPUT NAME=\"email\"><P>\n";
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"". t("E-mail new password") ."\">\n";
$output .= "</FORM>\n";
return $output;
......@@ -29,7 +23,7 @@ function account_email() {
function account_create($user = "", $error = "") {
global $theme;
if ($error) $output .= "<B><FONT COLOR=\"red\">Failed to create account:</FONT>$error</B>\n";
if ($error) $output .= "<P><FONT COLOR=\"red\">". t("Failed to create account: $error.") ."</FONT></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";
......@@ -39,7 +33,7 @@ function account_create($user = "", $error = "") {
$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: make sure it is accurate.") ."</I></SMALL><P>\n";
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Create account\">\n";
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"". t("Create account") ."\">\n";
$output .= "</FORM>\n";
return $output;
......@@ -72,31 +66,40 @@ function account_user_edit() {
if ($user->id) {
// Generate output/content:
$output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n";
$output .= "<B>". t("Username") .":</B><BR>\n";
$output .= "&nbsp; $user->userid<P>\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>". t("Optional.") ."</I><P>\n";
$output .= "<I>". t("Optional") .".</I><P>\n";
$output .= "<B>". t("Real e-mail address") .":</B><BR>\n";
$output .= "&nbsp; $user->real_email<P>\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>". t("Optional.") ." ". t("Displayed publicly so you may spam proof your real e-mail address if you want.") ."</I><P>\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>". t("Optional.") ." ". t("Make sure you enter fully qualified URLs only. That is, remember to include \"http://\".") ."</I><P>\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>". 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 .= "<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>". 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 .= "<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>". 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 .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Save user information") ."\"><BR>\n";
$output .= "</FORM>\n";
// Display output/content:
......@@ -129,34 +132,46 @@ function account_user_save($edit) {
}
function account_site_edit() {
global $cmodes, $corder, $theme, $themes, $user;
global $cmodes, $corder, $theme, $themes, $languages, $user;
if ($user->id) {
$output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\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>". 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";
$output .= "<SELECT NAME=\"edit[timezone]\">\n$options2</SELECT><BR>\n";
$output .= "<I>". t("Select what time you currently have and your timezone settings will be set appropriate.") ."</I><P>\n";
$output .= "<B>". t("Language" ) .":</B><BR>\n";
foreach ($languages as $key=>$value) $options3 .= " <OPTION VALUE=\"$key\"". (($user->language == $key) ? " SELECTED" : "") .">$value - $key</OPTION>\n";
$output .= "<SELECT NAME=\"edit[language]\">\n$options3</SELECT><BR>\n";
$output .= "<I>". t("Selecting a different language will change the language the site.") ."</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";
for ($stories = 10; $stories <= 30; $stories += 5) $options4 .= "<OPTION VALUE=\"$stories\"". (($user->stories == $stories) ? " SELECTED" : "") .">$stories</OPTION>\n";
$output .= "<SELECT NAME=\"edit[stories]\">\n$options4</SELECT><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";
foreach ($cmodes as $key=>$value) $options5 .= "<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 .= "<SELECT NAME=\"edit[mode]\">$options5</SELECT><P>\n";
foreach ($corder as $key=>$value) $options6 .= "<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 .= "<SELECT NAME=\"edit[sort]\">$options6</SELECT><P>\n";
for ($i = -1; $i < 6; $i++) $options7 .= " <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 .= "<SELECT NAME=\"edit[threshold]\">$options7</SELECT><BR>\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 .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Save site settings") ."\"><BR>\n";
$output .= "</FORM>\n";
$theme->header();
......@@ -177,6 +192,7 @@ function account_site_save($edit) {
if ($user->id) {
$data[theme] = $edit[theme];
$data[timezone] = $edit[timezone];
$data[language] = $edit[language];
$data[stories] = $edit[stories];
$data[mode] = $edit[mode];
$data[sort] = $edit[sort];
......@@ -197,7 +213,7 @@ function account_content_edit() {
$output .= "<INPUT TYPE=\"checkbox\" NAME=\"edit[$block->name]\"". ($entry->user ? " CHECKED" : "") ."> ". t($block->name) ."<BR>\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 .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Save content settings") ."\">\n";
$output .= "</FORM>\n";
$theme->header();
......@@ -243,7 +259,7 @@ function module($name, $module, $username) {
// Display account information:
$theme->header();
$theme->box("Personal information", $output);
$theme->box(t("Personal information"), $output);
$theme->footer();
}
elseif ($uname && $account = account_get_user($uname)) {
......@@ -285,17 +301,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>". 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";
if (empty($user[real_email]) || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $user[real_email]))) $error = t("the specified e-mail address is not valid");
if (empty($user[userid]) || (ereg("[^a-zA-Z0-9_-]", $user[userid]))) $error = t("the specified username is not valid");
if (strlen($user[userid]) > 15) $error = t("the specified username is too long: it must be less than 15 characters");
// Check to see whether the username or e-mail address are banned:
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";
if ($ban = ban_match($user[userid], $type2index[usernames])) $error = t("the specified username is banned") .": <I>$ban->reason</I>";
if ($ban = ban_match($user[real_email], $type2index[addresses])) $error = t("the specified e-mail address is banned") .": <I>$ban->reason</I>.";
// 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>". 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";
if (db_num_rows(db_query("SELECT userid FROM users WHERE LOWER(userid) = LOWER('$user[userid]')")) > 0) $error = t("the specified username is already taken");
if (db_num_rows(db_query("SELECT real_email FROM users WHERE LOWER(real_email)=LOWER('$user[real_email]')")) > 0) $error = t("the specified e-mail address is already used for another account");
return $error;
}
......@@ -463,7 +479,7 @@ function account_track_site() {
}
$theme->header();
$theme->box(t("Track $site_name"), $output);
$theme->box(strtr(t("Track %a"), array("%a" => $site_name)), ($output ? $output : t("No comments or stories posted recently.")));
$theme->footer();
}
......@@ -474,31 +490,31 @@ function account_track_site() {
}
switch ($op) {
case "Login":
account_session_start($userid, $passwd);
header("Location: account.php?op=info");
break;
case "E-mail new password":
case t("E-mail new password"):
account_email_submit($userid, $email);
break;
case "Create account":
case t("Create account"):
account_create_submit($userid, $email);
break;
case "confirm":
account_create_confirm($name, $hash);
break;
case "Save user information":
case t("Save user information"):
account_user_save($edit);
account_user($user->userid);
break;
case "Save site settings":
case t("Save site settings"):
account_site_save($edit);
header("Location: account.php?op=info");
break;
case "Save content settings":
case t("Save content settings"):
account_content_save($edit);
account_user($user->userid);
break;
case "confirm":
account_create_confirm($name, $hash);
break;
case "login":
account_session_start($userid, $passwd);
header("Location: account.php?op=info");
break;
case "logout":
account_session_close();
header("Location: account.php?op=info");
......@@ -540,4 +556,4 @@ function account_track_site() {
account_user($user->userid);
}
?>
?>
\ No newline at end of file
......@@ -110,8 +110,16 @@ CREATE TABLE layout (
CREATE TABLE locales (
id int(11) DEFAULT '0' NOT NULL auto_increment,
english TEXT DEFAULT '' NOT NULL,
location varchar(128) DEFAULT '' NOT NULL,
string TEXT DEFAULT '' NOT NULL,
da TEXT DEFAULT '' NOT NULL,
fi TEXT DEFAULT '' NOT NULL,
fr TEXT DEFAULT '' NOT NULL,
en TEXT DEFAULT '' NOT NULL,
es TEXT DEFAULT '' NOT NULL,
nl TEXT DEFAULT '' NOT NULL,
no TEXT DEFAULT '' NOT NULL,
sw TEXT DEFAULT '' NOT NULL,
PRIMARY KEY (id)
);
......@@ -168,6 +176,7 @@ CREATE TABLE users (
hash varchar(12) DEFAULT '' NOT NULL,
rating decimal(8,4) DEFAULT '0' NOT NULL,
timezone varchar(8) DEFAULT '0' NOT NULL,
language varchar(2) DEFAULT '0' NOT NULL,
PRIMARY KEY (id)
);
......
......@@ -56,7 +56,6 @@ function comment_settings($mode, $order, $threshold) {
function comment_reply($pid, $id) {
global $allowed_html, $link, $REQUEST_URI, $theme, $user;
// Extract parent-information/data:
if ($pid) {
$item = db_fetch_object(db_query("SELECT comments.*, users.userid FROM comments LEFT JOIN users ON comments.author = users.id WHERE comments.cid = $pid"));
$theme->comment(new Comment($item->userid, $item->subject, $item->comment, $item->timestamp, $item->url, $item->fake_email, comment_score($comment), $comment->votes, $item->cid, $item->lid), "reply to this comment");
......@@ -73,31 +72,23 @@ function comment_reply($pid, $id) {
$output .= "<FORM ACTION=\"$REQUEST_URI\" METHOD=\"post\">\n";
// Name field:
$output .= "<P>\n";
$output .= " <B>Your name:</B><BR>\n";
$output .= format_username($user->userid);
$output .= "</P>\n";
$output .= "<B>". t("Your name") .":</B><BR>\n";
$output .= format_username($user->userid) ."<P>\n";
// Subject field:
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\">\n";
$output .= "</P>\n";
$output .= "<B>". t("Subject") .":</B><BR>\n";
$output .= "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\"><P>\n";
// Comment field:
$output .= "<P>\n";
$output .= " <B>Comment:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_textarea($user->signature) ."</TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<B>".t("Comment") .":</B><BR>\n";
$output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_textarea($user->signature) ."</TEXTAREA><BR>\n";
$output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n";
// Preview button:
$output .= "<P>\n";
$output .= " <SMALL><I>You must preview at least once before you can submit:</I></SMALL><BR>\n";
$output .= " <INPUT TYPE=\"hidden\" NAME=\"pid\" VALUE=\"$pid\">\n";
$output .= " <INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview comment\"><BR>\n";
$output .= "</P>\n";
$output .= "<SMALL><I>". t("You must preview at least once before you can submit") .":</I></SMALL><BR>\n";
$output .= "<INPUT TYPE=\"hidden\" NAME=\"pid\" VALUE=\"$pid\">\n";
$output .= "<INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview comment") ."\"><BR>\n";
$output .= "</FORM>\n";
......@@ -114,42 +105,32 @@ function comment_preview($pid, $id, $subject, $comment) {
$output .= "<FORM ACTION=\"$REQUEST_URI\" METHOD=\"post\">\n";
// Name field:
$output .= "<P>\n";
$output .= " <B>Your name:</B><BR>\n";
$output .= format_username($user->userid);
$output .= "</P>\n";
$output .= "<B>". t("Your name") .":</B><BR>\n";
$output .= format_username($user->userid) ."<P>\n";
// Subject field:
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\" VALUE=\"". check_textfield($subject) ."\">\n";
$output .= "</P>\n";
$output .= "<B>". t("Subject") .":</B><BR>\n";
$output .= "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\" VALUE=\"". check_textfield($subject) ."\"><P>\n";
// Comment field:
$output .= "<P>\n";
$output .= " <B>Comment:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_textarea($comment) ."</TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<B>". t("Comment") .":</B><BR>\n";
$output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_textarea($comment) ."</TEXTAREA><BR>\n";
$output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n";
// Hidden fields:
$output .= "<INPUT TYPE=\"hidden\" NAME=\"pid\" VALUE=\"$pid\">\n";
$output .= "<INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">\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 .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT><P>\n";
}
// Preview and submit button:
$output .= "<P>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview comment\">\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Post comment\">\n";
$output .= " </FORM>\n";
$output .= "</P>\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview comment") ."\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Post comment") ."\">\n";
$output .= "</FORM>\n";
$theme->box("Reply", $output);
$theme->box(t("Reply"), $output);
}
function comment_post($pid, $id, $subject, $comment) {
......@@ -205,7 +186,7 @@ function comment_moderation($comment) {
$output .= "</SELECT>\n";
}
else {
$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";
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"1\"><TR><TD>". t("score") .":</TD><TD>". check_output($comment->score) ."</TD></TR><TR><TD>". t("votes") .":</TD><TD>". check_output($comment->votes) ."</TR></TABLE>\n";
}
return $output;
......@@ -218,8 +199,8 @@ function comment_controls($threshold = 1, $mode = 3, $order = 1) {
$output .= comment_mode(($user->id ? $user->mode : $mode));
$output .= comment_order(($user->id ? $user->sort : $order));
$output .= comment_threshold(($user->id ? $user->threshold : $threshold));
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update settings\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Add comment\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Update settings") ."\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Add comment") ."\">\n";
$output .= "</FORM>\n";
$output .= "</FONT>\n";
return $output;
......@@ -228,7 +209,7 @@ function comment_controls($threshold = 1, $mode = 3, $order = 1) {
function comment_threshold($threshold) {
$output .= "<SELECT NAME=\"threshold\">\n";
for ($i = -1; $i < 6; $i++) {
$output .= " <OPTION VALUE=\"$i\"". ($threshold == $i ? " SELECTED" : "") .">Filter - $i</OPTION>";
$output .= " <OPTION VALUE=\"$i\"". ($threshold == $i ? " SELECTED" : "") .">". t("Filter") ." - $i</OPTION>";
}
$output .= "</SELECT>\n";
return $output;
......@@ -313,9 +294,8 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) {
$theme->comment($comment, comment_link($comment, 0));
}
else {
print "<P>";
comment_comment($comment);
print "</P>";
print "<P>";
}
comment_thread_max($comment->cid, $mode, $threshold, $level + 1, $dummy + 1);
}
......@@ -385,7 +365,7 @@ function comment_render($lid, $cid) {
if ($user->id) {
// Print moderation form:
print " <INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$lid\">\n";
print " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Moderate comments\">\n";
print " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Moderate comments") ."\">\n";
print "</FORM>\n";
}
}
......
......@@ -15,14 +15,14 @@ function conf_load() {
include_once "includes/database.inc";
include_once "includes/watchdog.inc";
include_once "includes/function.inc";
include_once "includes/search.inc";
include_once "includes/locale.inc";
include_once "includes/module.inc";
include_once "includes/locale.inc";
include_once "includes/search.inc";
include_once "includes/theme.inc";
include_once "includes/user.inc";
user_load();
$locale = locale_load();
$theme = theme_load();
?>
\ No newline at end of file
......@@ -3,8 +3,7 @@
$na = "<I>na</I>";
function check_textfield($message) {
global $allowed_html;
return strip_tags(str_replace("\"", "&quot;", stripslashes($message)), $allowed_html);
return strip_tags(str_replace("\"", "&quot;", stripslashes($message)));
}
function check_textarea($message) {
......@@ -60,19 +59,16 @@ function format_date($timestamp, $type = "medium") {
switch ($type) {
case "small":
$date = date("D, m/d/y - H:i", $timestamp);
$date = date("m/d/y - H:i", $timestamp);
break;
case "medium":
$date = date("l, m/d/Y - H:i", $timestamp);
$date = t(date("l", $timestamp)) .", ". date("m/d/Y - H:i", $timestamp);
break;
case "large":
$date = date("D, M d, Y - H:i", $timestamp);
break;
case "extra large":
$date = date("l, F dS, Y - H:i", $timestamp);
$date = t(date("l", $timestamp)) .", ". t(date("F", $timestamp)) ." ". date("d, Y - H:i", $timestamp);
break;
default:
$date = date("D, M d, Y - H:i", $timestamp);
$date = t(date("l", $timestamp)) .", ". date("m/d/Y - H:i", $timestamp);
}
return $date;
}
......
......@@ -54,6 +54,15 @@ $themes = array("UnConeD" => array(
"themes/marvin/marvin.theme",
"classic theme, white, basic design with a fresh look"));
#
# Languages / translation / internationalization:
# the first language listed in this associative array will
# automatically become the default language. You can add
# a lanaguage but make sure your SQL table, called locales
# is updated appropriatly.
#
$languages = array("en" => "English");
#
# Submission moderation votes:
# the keys of this associative array are displayed in each
......
<?
function locale_load() {
global $languages, $user;
return ($user->language) ? $user->language : key($languages);
}
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, location) VALUES ('". addslashes($string) ."', '". check_input(getenv("REQUEST_URI")) ."')");
return $string;
return locale($string);
}
?>
\ No newline at end of file
......@@ -32,7 +32,7 @@ function menu($name, $module) {
// Display account settings:
$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 .= "<LI><A HREF=\"account.php?op=track&topic=site\">". strtr(t("track %a"), array("%a" => $site_name)) ."</A></LI>\n";
$content .= "<P>\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";
......@@ -54,15 +54,15 @@ function menu($name, $module) {
$content .= "<LI><A HREF=\"account.php?op=logout\">". t("logout") ."</A></LI>\n";
$theme->box(strtr(t("%s's configuration"), array("%s" => $user->userid)), "$content");
$theme->box(strtr(t("%a's configuration"), array("%a" => $user->userid)), "$content");
}
else {
$output .= "<CENTER>\n";
$output .= " <FORM ACTION=\"account.php?op=Login\" METHOD=\"post\">\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\">". t("REGISTER") ."</A></P>\n";
$output .= " <FORM ACTION=\"account.php?op=login\" METHOD=\"post\">\n";
$output .= " <B>". t("Username") .":</B><BR><INPUT NAME=\"userid\" SIZE=\"15\"><P>\n";
$output .= " <B>". t("Password") .":</B><BR><INPUT NAME=\"passwd\" SIZE=\"15\" TYPE=\"password\"><BR>\n";
$output .= " <INPUT TYPE=\"submit\" VALUE=\"". t("Login") ."\"><BR>\n";
$output .= " <A HREF=\"account.php\">". t("REGISTER") ."</A>\n";
$output .= " </FORM>\n";
$output .= "</CENTER>\n";
......@@ -92,7 +92,7 @@ function theme_blocks($region, $theme) {
}
function theme_morelink($theme, $story) {
return ($story->article) ? "[ <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\"><B>read more</B></FONT></A> | ". strlen($story->article) ." bytes | <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]" : "[ <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]";
return ($story->article) ? "[ <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\"><B>". t("read more") ."</B></FONT></A> | ". sizeof(explode(" ", $story->article)) ." ". t("words") ." | <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]" : "[ <A HREF=\"story.php?id=$story->id\"><FONT COLOR=\"$theme->link\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]";
}
function theme_moderation_results($theme, $story) {
......
......@@ -35,7 +35,7 @@ function diary_page_overview($num = 20) {
while ($diary = db_fetch_object($result)) {
if ($time != date("F jS", $diary->timestamp)) {
$output .= "<B>". date("l, F jS", $diary->timestamp) ."</B>\n";
$output .= "<B>". $date = t(date("l", $timestamp)) .", ". t(date("F", $timestamp)) ." ". date("j", $diary->timestamp) ."</B>\n";
$time = date("F jS", $diary->timestamp);
}
$output .= "<DL>\n";
......@@ -55,13 +55,13 @@ function diary_page_overview($num = 20) {
function diary_page_entry($timestamp, $text, $id = 0) {
if ($id) {
$output .= "<DL>\n";