$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() {
functionaccount_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.="<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.="<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.="<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.="<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.="<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) {
$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() {
@@ -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":
caset("E-mail new password"):
account_email_submit($userid,$email);
break;
case"Create account":
caset("Create account"):
account_create_submit($userid,$email);
break;
case"confirm":
account_create_confirm($name,$hash);
break;
case"Save user information":
caset("Save user information"):
account_user_save($edit);
account_user($user->userid);
break;
case"Save site settings":
caset("Save site settings"):
account_site_save($edit);
header("Location: account.php?op=info");
break;
case"Save content settings":
caset("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() {
$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(newComment($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) {