summaryrefslogtreecommitdiffstats
path: root/register.php
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 03:00:32 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 03:38:46 -0500
commitef4d3660605efc7f1328d4533b0f4bfb6c1107e2 (patch)
treee4377fb129a899e65aaaf421f8c97098aecaedd5 /register.php
parent8a750c3e875d590d351c3042570a134fcdf03e5d (diff)
downloadampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.tar.gz
ampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.tar.bz2
ampache-ef4d3660605efc7f1328d4533b0f4bfb6c1107e2.zip
Cosmetics: death to tabs
The refactoring I've been doing has reminded me of my strong preference for spaces, and I feel inclined to impose my will on the tree.
Diffstat (limited to 'register.php')
-rw-r--r--register.php268
1 files changed, 134 insertions, 134 deletions
diff --git a/register.php b/register.php
index f96affed..68f0c065 100644
--- a/register.php
+++ b/register.php
@@ -1,5 +1,5 @@
<?php
-/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
+/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
@@ -25,9 +25,9 @@ require_once 'lib/init.php';
/* Check Perms */
if (!Config::get('allow_public_registration') || Config::get('demo_mode')) {
- debug_event('DENIED','Error Attempted registration','1');
- UI::access_denied();
- exit();
+ debug_event('DENIED','Error Attempted registration','1');
+ UI::access_denied();
+ exit();
}
/**
@@ -39,140 +39,140 @@ require_once Config::get('prefix') . '/modules/validatemail/validateEmail.php';
/* Don't even include it if we aren't going to use it */
if (Config::get('captcha_public_reg')) {
- define ("CAPTCHA_INVERSE", 1);
- require_once Config::get('prefix') . '/modules/captcha/captcha.php';
+ define ("CAPTCHA_INVERSE", 1);
+ require_once Config::get('prefix') . '/modules/captcha/captcha.php';
}
/* Start switch based on action passed */
switch ($_REQUEST['action']) {
- case 'validate':
- $username = scrub_in($_GET['username']);
- $validation = scrub_in($_GET['auth']);
- require_once Config::get('prefix') . '/templates/show_user_activate.inc.php';
- break;
- case 'add_user':
- /**
- * User information has been entered
- * we need to check the database for possible existing username first
- * if username exists, error and say "Please choose a different name."
- * if username does not exist, insert user information into database
- * then allow the user to 'click here to login'
- * possibly by logging them in right then and there with their current info
- * and 'click here to login' would just be a link back to index.php
- */
- $fullname = scrub_in($_POST['fullname']);
- $username = scrub_in($_POST['username']);
- $email = scrub_in($_POST['email']);
- $pass1 = scrub_in($_POST['password_1']);
- $pass2 = scrub_in($_POST['password_2']);
-
- /* If we're using the captcha stuff */
- if (Config::get('captcha_public_reg')) {
- $captcha = captcha::solved();
- if(!isset ($captcha)) {
- Error::add('captcha', T_('Error Captcha Required'));
- }
- if (isset ($captcha)) {
- if ($captcha) {
- $msg="SUCCESS";
- }
- else {
- Error::add('captcha', T_('Error Captcha Failed'));
- }
- } // end if we've got captcha
- } // end if it's enabled
-
- if (Config::get('user_agreement')) {
- if (!$_POST['accept_agreement']) {
- Error::add('user_agreement', T_("You <U>must</U> accept the user agreement"));
- }
- } // if they have to agree to something
-
- if (!$_POST['username']) {
- Error::add('username', T_("You did not enter a username"));
- }
-
- if(!$fullname) {
- Error::add('fullname', T_("Please fill in your full name (Firstname Lastname)"));
- }
-
- /* Check the mail for correct address formation. */
- $attempt = 0;
- $max_attempts = 3;
- $response_code = "";
-
- while ( $response_code == "" || strstr( $response_code, "fsockopen error" )) {
- $validate_results = validateEmail( $email );
- $response_code = $validate_results[1];
- if($attempt == $max_attempts) {
- break;
- }
- $attempt++;
- }
-
- if ($validate_results[0] OR strstr($validate_results[1],"greylist")) {
- $mmsg = "MAILOK";
- }
- else {
- Error::add('email', T_("Error Email address not confirmed")
- . "<br />$validate_results[1]");
- }
- /* End of mailcheck */
-
- if (!$pass1) {
- Error::add('password', T_("You must enter a password"));
- }
-
- if ( $pass1 != $pass2 ) {
- Error::add('password', T_("Your passwords do not match"));
- }
-
- if (!User::check_username($username)) {
- Error::add('duplicate_user', T_("Error Username already exists"));
- }
-
- // If we've hit an error anywhere up there break!
- if (Error::occurred()) {
- require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
- break;
- }
-
- /* Attempt to create the new user */
- $access = '5';
- switch (Config::get('auto_user')) {
- case 'admin':
- $access = '100';
- break;
- case 'user':
- $access = '25';
- break;
- default:
- case 'guest':
- $access = '5';
- break;
- } // auto-user level
-
-
- $new_user = User::create($username, $fullname, $email, $pass1,
- $access, Config::get('admin_enable_required'));
-
- if (!$new_user) {
- Error::add('duplicate_user', T_("Error: Insert Failed"));
- require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
- break;
- }
-
- $client = new User($new_user);
- $validation = md5(uniqid(rand(), true));
- $client->update_validation($validation);
-
- Registration::send_confirmation($username, $fullname, $email, $pass1, $validation);
- require_once Config::get('prefix') . '/templates/show_registration_confirmation.inc.php';
- break;
- case 'show_add_user':
- default:
- require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
- break;
+ case 'validate':
+ $username = scrub_in($_GET['username']);
+ $validation = scrub_in($_GET['auth']);
+ require_once Config::get('prefix') . '/templates/show_user_activate.inc.php';
+ break;
+ case 'add_user':
+ /**
+ * User information has been entered
+ * we need to check the database for possible existing username first
+ * if username exists, error and say "Please choose a different name."
+ * if username does not exist, insert user information into database
+ * then allow the user to 'click here to login'
+ * possibly by logging them in right then and there with their current info
+ * and 'click here to login' would just be a link back to index.php
+ */
+ $fullname = scrub_in($_POST['fullname']);
+ $username = scrub_in($_POST['username']);
+ $email = scrub_in($_POST['email']);
+ $pass1 = scrub_in($_POST['password_1']);
+ $pass2 = scrub_in($_POST['password_2']);
+
+ /* If we're using the captcha stuff */
+ if (Config::get('captcha_public_reg')) {
+ $captcha = captcha::solved();
+ if(!isset ($captcha)) {
+ Error::add('captcha', T_('Error Captcha Required'));
+ }
+ if (isset ($captcha)) {
+ if ($captcha) {
+ $msg="SUCCESS";
+ }
+ else {
+ Error::add('captcha', T_('Error Captcha Failed'));
+ }
+ } // end if we've got captcha
+ } // end if it's enabled
+
+ if (Config::get('user_agreement')) {
+ if (!$_POST['accept_agreement']) {
+ Error::add('user_agreement', T_("You <U>must</U> accept the user agreement"));
+ }
+ } // if they have to agree to something
+
+ if (!$_POST['username']) {
+ Error::add('username', T_("You did not enter a username"));
+ }
+
+ if(!$fullname) {
+ Error::add('fullname', T_("Please fill in your full name (Firstname Lastname)"));
+ }
+
+ /* Check the mail for correct address formation. */
+ $attempt = 0;
+ $max_attempts = 3;
+ $response_code = "";
+
+ while ( $response_code == "" || strstr( $response_code, "fsockopen error" )) {
+ $validate_results = validateEmail( $email );
+ $response_code = $validate_results[1];
+ if($attempt == $max_attempts) {
+ break;
+ }
+ $attempt++;
+ }
+
+ if ($validate_results[0] OR strstr($validate_results[1],"greylist")) {
+ $mmsg = "MAILOK";
+ }
+ else {
+ Error::add('email', T_("Error Email address not confirmed")
+ . "<br />$validate_results[1]");
+ }
+ /* End of mailcheck */
+
+ if (!$pass1) {
+ Error::add('password', T_("You must enter a password"));
+ }
+
+ if ( $pass1 != $pass2 ) {
+ Error::add('password', T_("Your passwords do not match"));
+ }
+
+ if (!User::check_username($username)) {
+ Error::add('duplicate_user', T_("Error Username already exists"));
+ }
+
+ // If we've hit an error anywhere up there break!
+ if (Error::occurred()) {
+ require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
+ break;
+ }
+
+ /* Attempt to create the new user */
+ $access = '5';
+ switch (Config::get('auto_user')) {
+ case 'admin':
+ $access = '100';
+ break;
+ case 'user':
+ $access = '25';
+ break;
+ default:
+ case 'guest':
+ $access = '5';
+ break;
+ } // auto-user level
+
+
+ $new_user = User::create($username, $fullname, $email, $pass1,
+ $access, Config::get('admin_enable_required'));
+
+ if (!$new_user) {
+ Error::add('duplicate_user', T_("Error: Insert Failed"));
+ require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
+ break;
+ }
+
+ $client = new User($new_user);
+ $validation = md5(uniqid(rand(), true));
+ $client->update_validation($validation);
+
+ Registration::send_confirmation($username, $fullname, $email, $pass1, $validation);
+ require_once Config::get('prefix') . '/templates/show_registration_confirmation.inc.php';
+ break;
+ case 'show_add_user':
+ default:
+ require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
+ break;
} // end switch on action
?>