diff --git a/webtools/update/developers/createaccount.php b/webtools/update/developers/createaccount.php new file mode 100755 index 000000000000..7f2fe0846fca --- /dev/null +++ b/webtools/update/developers/createaccount.php @@ -0,0 +1,145 @@ + + + + +Mozilla Update :: Create An Account + + +
+
+
+ +

Create an Account

+Joining Mozilla Update is easy just fill out the form below and click the join button. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Your e-mail address is used as your username to login. You'll also receive confirmation e-mail to this address. In order for your account to be activated succesfully, you must specify a valid e-mail address.
E-Mail Address:
Confirm E-Mail:
How do you want to be known to visitors of Mozilla Update? This is your "author name" it will be shown with your extension/theme listings on the site.
Your Name
If you have a website, enter the URL here. (including the http:// ) Your website will be shown to site visitors on your author profile page. This field is optional, if you don't have a website or don't want it linked to from Mozilla Update, leave this box blank.
Your Website
Your desired password. This along with your e-mail will allow you to login, so make it something memorable but not easy to guess. Type it in both fields below, the two fields must match.
Password:
Confirm Password:
Review what you entered above, if everything's correct, click the "Join Mozilla Update" button. If you want to start over, click "Clear Form".
+ +
+ +
+
+

Already Have an Account?

+

If you already have signed-up for an account, you don't need to sign-up again. Just use your e-mail address and password and login.

+

If you don't remember the password for your acconut, you can recover a forgotten password.

+
+ +Processing New Account Request, Please Wait...\n"; +//Gather and Filter Data from the Submission Form +if ($_POST["email"]==$_POST["emailconfirm"]) {$email = $_POST["email"];} else { $errors="true"; $emailvalid="no";} +if ($_POST["password"]==$_POST["passwordconfirm"]) {$password = $_POST["password"];} else { $errors="true"; $passwordvalid="no"; } +if ($_POST["name"]) { $name = $_POST["name"]; } else { $errors="true"; $namevalid="no"; } +$website = $_POST["website"]; + +//Check e-mail address and see if its already in use. +if ($emailvalid !="no") { +$sql = "SELECT `UserEmail` from `t_userprofiles` WHERE `UserEmail`='$email' LIMIT 1"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if (mysql_num_rows($sql_result)>"0") {$errors="true"; $emailvalid="no"; } +} + +if ($errors == "true") { +echo"Errors have been found in your submission, please go back to the previous page and fix the errors and try again.
\n"; +if ($emailvalid=="no") {echo"     Your e-mail addresses didn't match, or your e-mail is already in use.
\n"; } +if ($passwordvalid=="no") {echo"     The passwords you entered did not match.
\n"; } +if ($namevalid=="no") {echo"     The name field cannot be left blank.
\n"; } + +include"$page_footer"; +echo"\n\n"; +exit; +} + +//We've got good data here, valid password & e-mail. + +//Generate Confirmation Code +$confirmationcode = md5(mt_rand()); +$password_plain = $password; +$password = md5($password); + +$sql = "INSERT INTO `t_userprofiles` (`UserName`,`UserEmail`,`UserWebsite`,`UserPass`,`UserMode`,`ConfirmationCode`) VALUES ('$name','$email','$website','$password','D','$confirmationcode');"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if ($sql_result) { + include"mail_newaccount.php"; + echo"Your account has been created successfully. An e-mail has been sent to you with instructions on how to activate your account so you can begin using it.
\n"; + echo"

«« Login to Mozilla Update's Developer Control Panel »»"; + } + +} else if ($function=="confirmaccount") { +?> +

Activate Your Mozilla Update Account

+
«« Login to Mozilla Update's Developer Control Panel »»"; + } + } else { + echo"Sorry, the e-mail and confirmation code do not match, please make sure you've copied the entire URL, if you copy/pasted it from your e-mail client, and try again."; + echo"

«« Back to Mozilla Update Developer Control Panel Home »»"; + + } + +?> + + + + + + + diff --git a/webtools/update/developers/index.php b/webtools/update/developers/index.php index 0834f698d7f2..93e930c6e7aa 100755 --- a/webtools/update/developers/index.php +++ b/webtools/update/developers/index.php @@ -46,6 +46,14 @@ include"$page_header"; +Forgot your password? + +

Create an Account

+

You need an account to access the features of the Developer Control Panel and add your extension or themes to Mozilla Update.

+ +Join Mozilla Update! + +
diff --git a/webtools/update/developers/mail_newaccount.php b/webtools/update/developers/mail_newaccount.php new file mode 100755 index 000000000000..415be46ea550 --- /dev/null +++ b/webtools/update/developers/mail_newaccount.php @@ -0,0 +1,34 @@ +\r\n"; +//$headers .= "Reply-To: ".$from_name." <".$from_address.">\r\n"; +$headers .= "X-Priority: 3\r\n"; +$headers .= "X-MSMail-Priority: Normal\r\n"; +$headers .= "X-Mailer: Mozilla Update Mail System 1.0"; + +$subject = "Activate your new Mozilla Update account\n"; + + $message = "Welcome to Mozilla Update.\n"; + $message .= "Before you can use your new account you must activate it, this ensures the e-mail address you used is valid and belongs to you.\n"; + $message .= "To activate your account, click the link below or copy and paste the whole thing into your browsers location bar:\n"; + $message .= "http://$_SERVER[HTTP_HOST]/developers/createaccount.php?function=confirmaccount&email=$email&confirmationcode=$confirmationcode\n\n"; + $message .= "Keep this e-mail in a safe-place for your records, below is your account details you used when registering for your account.\n\n"; + $message .= "E-Mail: $email\n"; + $message .= "Password: $password_plain\n\n"; + $message .= "Thanks for joining Mozilla Update\n"; + $message .= "-- Mozilla Update Staff\n"; + +mail($to_address, $subject, $message, $headers); + +?> \ No newline at end of file diff --git a/webtools/update/developers/mail_newpassword.php b/webtools/update/developers/mail_newpassword.php new file mode 100755 index 000000000000..df09ba6ceb2b --- /dev/null +++ b/webtools/update/developers/mail_newpassword.php @@ -0,0 +1,36 @@ +\r\n"; +//$headers .= "Reply-To: ".$from_name." <".$from_address.">\r\n"; +$headers .= "X-Priority: 3\r\n"; +$headers .= "X-MSMail-Priority: Normal\r\n"; +$headers .= "X-Mailer: Mozilla Update Mail System 1.0"; + +$subject = "Your New Mozilla Update Password\n"; + + $message = "Your New Mozilla Update Password\n"; + $message .= "Below is your new Mozilla Update password which has been either changed by you using the Change Password tool, or regenerated as requested by you using the Mozilla Update Forgotten Password tool or by an Mozilla Update Staff member per your request.\n"; + $message .= "To login to your account, click the link below or copy and paste the whole thing into your browsers location bar:\n"; + $message .= "http://$_SERVER[HTTP_HOST]/developers/\n\n"; + $message .= "Keep this e-mail in a safe-place for your records, below is your account details you used when registering for your account.\n\n"; + $message .= "E-Mail: $email\n"; + $message .= "Password: $password_plain\n\n"; + $message .= "Thanks,\n"; + $message .= "-- Mozilla Update Staff\n"; + +mail($to_address, $subject, $message, $headers); + +?> \ No newline at end of file diff --git a/webtools/update/developers/passwordreset.php b/webtools/update/developers/passwordreset.php new file mode 100755 index 000000000000..6b4b5a858a7d --- /dev/null +++ b/webtools/update/developers/passwordreset.php @@ -0,0 +1,70 @@ + + + + +Mozilla Update :: Password Reset + + +
+
+ +Resetting Your Password, Please Wait...\n"; +//Gather and Filter Data from the Submission Form +$email = $_POST["email"]; + +//Generate Confirmation Code +$confirmationcode = md5(mt_rand()); + +$newpassword = substr(md5(mt_rand()),0,14); +$password_plain = $newpassword; +$password = md5($newpassword); + +$sql = "SELECT `UserEmail` FROM `t_userprofiles` WHERE `UserEmail`='$email' LIMIT 1"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if (mysql_num_rows($sql_result)=="1") { + $sql = "UPDATE `t_userprofiles` SET `UserPass`='$password' WHERE `UserEmail`='$email' LIMIT 1"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if ($sql_result) { + include"mail_newpassword.php"; + echo"Your password has been reset successfully. An e-mail has been sent to you containing your new password..
\n"; + echo"

«« Login to Mozilla Update's Developer Control Panel »»"; + } + + } else { + echo"An error was encountered when trying to reset your password, verify the e-mail you entered is correct and try again.
\n"; + } + +include"$page_footer"; +echo"\n\n"; +exit; +} +?> + + +

Reset Your Password

+

Forgot the password to your Mozilla Update account? No problem. Just put your e-mail address in the form below, and a new password will +be generated and e-mailed to the e-mail address you have on file.

+ +
+ + + + + + + + +
E-Mail Address:
+ +
+ + + diff --git a/webtools/update/developers/usermanager.php b/webtools/update/developers/usermanager.php index 5661ab976a50..36e4d1cd815d 100755 --- a/webtools/update/developers/usermanager.php +++ b/webtools/update/developers/usermanager.php @@ -1,9 +1,10 @@ - - -MozUpdates :: Manage Users - - +Mozilla Update :: Developer Control Panel :: +MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if (mysql_num_rows($sql_result)=="0") { + echo"

Error Accessing Record

\n"; + echo"You do not appear to have permission to edit this record.
\n"; + echo"«« Go Back\n"; + include"$page_footer"; + echo"\n\n"; + exit; + } else { + $row = mysql_fetch_array($sql_result); + $userid = $row["UserID"]; + } + } else { + $userid = $_GET["userid"]; + } +} ?> - @@ -52,7 +57,7 @@ if (!$function) { -
+

Updating User List...

Your changes to the User List have been succesfully completed
"; +echo"Your changes to the User List have been succesfully completed
\n"; //Do Special Disable, Delete, Enable Account Operations if ($_POST["selected"] AND $_POST["submit"] !=="Update") { -//$selected = $_POST["selected"]; +$selecteduser = $_POST["selected"]; if ($_POST["submit"]=="Disable Selected") { -$sql = "UPDATE `t_userprofiles` SET `UserMode`= 'D' WHERE `UserID`='$_POST[selected]'"; +$sql = "UPDATE `t_userprofiles` SET `UserMode`= 'D' WHERE `UserID`='$selecteduser'"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); -echo"User Account for User Number $_POST[selected] Disabled
\n"; + if ($sql_result) { + echo"User Account for User Number $selecteduser Disabled
\n"; + } + + //Disabling an author, check their extension list and disable any item they're the solo author of. + $sql = "SELECT TM.ID, TM.Name from `t_main` TM INNER JOIN `t_authorxref` TAX ON TM.ID=TAX.ID WHERE TAX.UserID = '$selecteduser'"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + while ($row = mysql_fetch_array($sql_result)) { + $id = $row["ID"]; + $name = $row["Name"]; + $sql2 = "SELECT `ID` from `t_authorxref` WHERE `ID` = '$id'"; + $sql_result2 = mysql_query($sql2, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if (mysql_num_rows($sql_result2)<="1") { + $sql3 = "UPDATE `t_version` SET `approved`='DISABLED' WHERE `ID`='$id' and `approved` !='NO' "; + $sql_result3 = mysql_query($sql3, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if ($sql_result3) { + echo"$name disabled from public viewing...
\n"; + } + } + } } else if ($_POST["submit"]=="Delete Selected") { -$sql = "DELETE FROM `t_userprofiles` WHERE `UserID`='$_POST[selected]' LIMIT 1"; +$sql = "DELETE FROM `t_userprofiles` WHERE `UserID`='$selecteduser' LIMIT 1"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); -echo"User Account for User Number $_POST[selected] Deleted
\n"; + if ($sql_result) { + echo"User Account for User Number $selecteduser Deleted
\n"; + } } else if ($_POST["submit"]=="Enable Selected") { -$sql = "UPDATE `t_userprofiles` SET `UserMode`= 'U' WHERE `UserID`='$_POST[selected]'"; +$sql = "UPDATE `t_userprofiles` SET `UserMode`= 'U' WHERE `UserID`='$selecteduser'"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); -echo"User Account for User Number $_POST[selected] Enabled, User Mode set to User
\n"; + if ($sql_result) { + echo"User Account for User Number $selecteduser Enabled, User Mode set to User
\n"; + } + + //Disabling an author, check their extension list and disable any item they're the solo author of. + $sql = "SELECT TM.ID, TM.Name from `t_main` TM INNER JOIN `t_authorxref` TAX ON TM.ID=TAX.ID WHERE TAX.UserID = '$selecteduser'"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + while ($row = mysql_fetch_array($sql_result)) { + $id = $row["ID"]; + $name = $row["Name"]; + $sql2 = "SELECT `ID` from `t_authorxref` WHERE `ID` = '$id'"; + $sql_result2 = mysql_query($sql2, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if (mysql_num_rows($sql_result2)<="1") { + $sql3 = "UPDATE `t_version` SET `approved`='?' WHERE `ID`='$id' and `approved` !='NO'"; + $sql_result3 = mysql_query($sql3, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if ($sql_result3) { + echo"$name restored to public view pending approval...
\n"; + } + } + } + + + } } -echo"
\n"; } ?> - - - - - - +

Manage User list

+
Manage User List:
+ - - - + + + + + +$i\n"; echo"\n"; echo"\n"; - echo""; + echo""; + echo""; + echo""; if ($d=="TRUE") {echo"\n"; } - echo"\n"; echo"\n"; unset($a,$e,$t); @@ -162,15 +208,16 @@ echo"";
NameE-Mail AddressS E A TNameE-Mail AddressSEAT
  $username  $useremail"; - echo""; - echo""; - echo""; + echo"
-
+

Add New User

+
-New User - E-Mail: + E-Mail:
+ MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); - echo"
Your update to $_POST[username], has been submitted successfully...
"; +$userid = $_POST["userid"]; +$username = $_POST["username"]; +$useremail = $_POST["useremail"]; +$userwebsite = $_POST["userwebsite"]; +$useremailhide = $_POST["useremailhide"]; + $sql = "UPDATE `t_userprofiles` SET `UserName`= '$username', `UserEmail`='$useremail', `UserWebsite`='$userwebsite', `UserMode`='$mode', `UserTrusted`='$trusted', `UserEmailHide`='$useremailhide' WHERE `UserID`='$userid'"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if ($sql_result) { + echo"

Updating User Profile...

\n"; + echo"The User Profile for $username, has been successfully updated...
\n"; + } } else if ($_POST["submit"] == "Delete User") { if ($_SESSION["level"] !=="admin" && $_SESSION["uid"] !== $_POST["userid"]) {$_POST["userid"]=$_SESSION["uid"];} - $sql = "DELETE FROM `t_userprofiles` WHERE `UserID`='$_POST[userid]'"; +$userid = $_POST["userid"]; +$username = $_POST["username"]; + $sql = "DELETE FROM `t_userprofiles` WHERE `UserID`='$userid'"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); - echo"
You've successfully deleted $_POST[username]...
"; + if ($sql_result) { + echo"

Deleting User... Please wait...

\n"; + echo"You've successfully deleted the user profile for $username...
\n"; + include"$page_footer"; + echo"\n\n"; + exit; + } } if (!$userid) {$userid=$_POST["userid"];} @@ -220,10 +283,12 @@ if (!$userid) {$userid=$_POST["userid"];} $usermode = $row["UserMode"]; $trusted = $row["UserTrusted"]; $useremailhide = $row["UserEmailHide"]; + $userlastlogin = date("l, F, d, Y, g:i:sa", strtotime($row["UserLastLogin"])); ?> - - +

Edit User Profile for

+
Edit Profile for :
+\n"; @@ -268,9 +333,9 @@ if ($usermode=="A") {$a="TRUE"; $e="TRUE"; } echo"\n"; ?> - + - +
Last login:
    
    ?');">
«« Return to User Manager
@@ -279,12 +344,13 @@ if ($usermode=="A") {$a="TRUE"; $e="TRUE"; } else if ($function=="adduser") { if ($_POST["submit"]=="Create User") { +echo"

Adding User...

\n"; //Verify Users Password and md5 encode it for storage... if ($_POST[userpass]==$_POST[userpassconfirm]) { $_POST[userpass]=md5($_POST[userpass]); } else { $errors="true"; - echo"Your two passwords did not match, go back and try again..."; + echo"Your two passwords did not match, go back and try again...
\n"; } //Add User to MySQL Table @@ -304,26 +370,33 @@ if ($admin=="TRUE") { $mode="A"; if ($trusted !=="TRUE") {$trusted="FALSE"; } - - $sql = "INSERT INTO `t_userprofiles` (`UserName`, `UserEmail`, `UserWebsite`, `UserPass`, `UserMode`, `UserTrusted`, `UserEmailHide`) VALUES ('$_POST[username]', '$_POST[useremail]', '$_POST[userwebsite]', '$_POST[userpass]', '$mode', '$trusted', '$_POST[useremailhide]');"; - $result = mysql_query($sql) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); - //include"mail_sendaccountdetails.php"; - echo"
The user $_POST[username] has been Successfully Added...
"; +$username = $_POST[username]; +$useremail = $_POST[useremail]; +$userwebsite = $_POST[userwebsite]; +$userpass = $_POST[userpass]; +$useremailhide = $_POST[useremailhide]; + $sql = "INSERT INTO `t_userprofiles` (`UserName`, `UserEmail`, `UserWebsite`, `UserPass`, `UserMode`, `UserTrusted`, `UserEmailHide`) VALUES ('$username', '$useremail', '$userwebsite', '$userpass', '$mode', '$trusted', '$useremailhide');"; + $sql_result = mysql_query($sql) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if ($sql_result) { + include"mail_newaccount.php"; + echo"The user $username has been added successfully...
\n"; + echo"An E-Mail has been sent to the e-mail address specified with the login info they need to log in to their new account.
\n"; + } } } ?> - - +

Add New User

+
Add New User:
+ - @@ -335,34 +408,57 @@ if (!$userid) {$userid = $_GET["userid"]; } //Set Password Change if this is a POST. if ($_POST["submit"]=="Change Password") { - echo"
"; - $sql = "SELECT `UserPass` FROM `t_userprofiles` WHERE `UserID` = '$_POST[userid]' LIMIT 1"; + echo"

Changing Password, please wait...

\n"; + $userid = $_POST["userid"]; + $sql = "SELECT `UserPass`, `UserEmail` FROM `t_userprofiles` WHERE `UserID` = '$userid' LIMIT 1"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); $row = mysql_fetch_array($sql_result); $userpass = $row["UserPass"]; + $email = $row["UserEmail"]; $oldpass = md5($_POST[oldpass]); -if ($_SESSION["level"]=="admin") {$oldpass=$userpass; } //Bypass Old Password check for Admins only if ($userpass==$oldpass) { if ($_POST[newpass]==$_POST[newpass2]) { - $userpass = md5($_POST["newpass"]); - $sql = "UPDATE `t_userprofiles` SET `UserPass`='$userpass' WHERE `UserID`='$_POST[userid]'"; - //echo"$sql\n
"; + $newpassword = $_POST["newpass"]; + $password_plain = $newpassword; + $userpass = md5($newpassword); + + $sql = "UPDATE `t_userprofiles` SET `UserPass`='$userpass' WHERE `UserID`='$userid'"; $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); - echo"The password has been successfully reset.
"; - + if ($sql_result) { + include"mail_newpassword.php"; + echo"The password has been successfully changed, an e-mail has been sent confirming this action.
\n"; + } } else { - echo"The two passwords did not match, please go back and try again."; + echo"The two passwords did not match, please go back and try again.
\n"; } } else { - echo"Your Old password did not match the password on file, please try again."; + echo"Your Old password did not match the password on file, please try again.
\n"; } - echo"
\n"; +} else if ($_POST["submit"]=="Generate New Password") { + echo"

Generating New Password, please wait...

\n"; + $newpassword = substr(md5(mt_rand()),0,14); + $password_plain = $newpassword; + $userpass = md5($newpassword); + $userid = $_POST["userid"]; + + $sql = "SELECT `UserEmail` FROM `t_userprofiles` WHERE `UserID` = '$userid' LIMIT 1"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + $row = mysql_fetch_array($sql_result); + $email = $row["UserEmail"]; + + $sql = "UPDATE `t_userprofiles` SET `UserPass`='$userpass' WHERE `UserID`='$userid'"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if ($sql_result) { + include"mail_newpassword.php"; + echo"The password has been successfully reset. The user has been sent an e-mail notifying them of their new password.
\n"; + } + } if (!$userid) { $userid = $_POST["userid"]; } @@ -372,16 +468,18 @@ if (!$userid) { $userid = $_POST["userid"]; } $row = mysql_fetch_array($sql_result); $username = $row["UserName"]; ?> -
E-Mail:" SIZE=30 MAXLENGTH=100>
Show E-Mail:Hidden: Visible:
Name:
Website:
Password:
Confirm:  
Permissions:Editor: Admin: Trusted:
E-Mail Public:Hidden: Visible:
  
«« Return to User Manager
- - +

Change password for

+
Change password for :
+"> "> - + + + - - + - + +
Old Password:
New Password:
New Password:
Retype New Password:   
  
  
«« Return to User Manager