diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-02 01:48:15 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-02 01:48:15 +0000 |
commit | 66e0b8ea9dd675a778a5c5777cce547887b2720c (patch) | |
tree | 6a64838f552b37481d92f75bc6979d11b83bc13a /register.php | |
parent | 0f4a9e4823d6aa92c3974c33f560a4897140dfbd (diff) | |
download | ampache-66e0b8ea9dd675a778a5c5777cce547887b2720c.tar.gz ampache-66e0b8ea9dd675a778a5c5777cce547887b2720c.tar.bz2 ampache-66e0b8ea9dd675a778a5c5777cce547887b2720c.zip |
fixed public registration, added ADD button to the recently played stuff
Diffstat (limited to 'register.php')
-rw-r--r-- | register.php | 69 |
1 files changed, 38 insertions, 31 deletions
diff --git a/register.php b/register.php index 8b19e686..d280a9fc 100644 --- a/register.php +++ b/register.php @@ -43,10 +43,8 @@ if (Config::get('captcha_public_reg')) { } -$action = scrub_in($_REQUEST['action']); - /* Start switch based on action passed */ -switch ($action) { +switch ($_REQUEST['action']) { case 'add_user': /** * User information has been entered @@ -57,7 +55,6 @@ switch ($action) { * 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 */ - $accept_agreement = scrub_in($_REQUEST['accept_agreement']); $fullname = scrub_in($_REQUEST['fullname']); $username = scrub_in($_REQUEST['username']); $email = scrub_in($_REQUEST['email']); @@ -65,33 +62,33 @@ switch ($action) { $pass2 = scrub_in($_REQUEST['password_2']); /* If we're using the captcha stuff */ - if (conf('captcha_public_reg')) { + if (Config::get('captcha_public_reg')) { $captcha = captcha::check(); if(!isset ($captcha)) { - $GLOBALS['error']->add_error('captcha',_('Error Captcha Required')); + Error::add('captcha',_('Error Captcha Required')); } if (isset ($captcha)) { if ($captcha) { $msg="SUCCESS"; } else { - $GLOBALS['error']->add_error('captcha',_('Error Captcha Failed')); + Error::add('captcha',_('Error Captcha Failed')); } } // end if we've got captcha } // end if it's enabled - if(conf('user_agreement')) { - if(!$accept_agreement) { - $GLOBALS['error']->add_error('user_agreement',_("You <U>must</U> accept the user agreement")); + if (Config::get('user_agreement')) { + if (!$_POST['accept_agreement']) { + Error::add('user_agreement',_("You <U>must</U> accept the user agreement")); } } // if they have to agree to something - if(!$username) { - $GLOBALS['error']->add_error('username',_("You did not enter a username")); + if (!$_POST['username']) { + Error::add('username',_("You did not enter a username")); } if(!$fullname) { - $GLOBALS['error']->add_error('fullname',_("Please fill in your full name (Firstname Lastname)")); + Error::add('fullname',_("Please fill in your full name (Firstname Lastname)")); } /* Check the mail for correct address formation. */ @@ -112,45 +109,55 @@ switch ($action) { $mmsg = "MAILOK"; } else { - $GLOBALS['error']->add_error('email',_("Error Email address not confirmed<br />$validate_results[1]")); + Error::add('email',_("Error Email address not confirmed<br />$validate_results[1]")); } /* End of mailcheck */ - if(!$pass1){ - $GLOBALS['error']->add_error('password',_("You must enter a password")); + if (!$pass1) { + Error::add('password',_("You must enter a password")); } if ( $pass1 != $pass2 ) { - $GLOBALS['error']->add_error('password',_("Your passwords do not match")); + Error::add('password',_("Your passwords do not match")); } - if (!check_username($username)) { - $GLOBALS['error']->add_error('duplicate_user',_("Error Username already exists")); + if (!User::check_username($username)) { + Error::add('duplicate_user',_("Error Username already exists")); } - if($GLOBALS['error']->error_state){ - show_user_registration($values); + // If we've hit an error anywhere up there break! + if (Error::$state) { + require_once Config::get('prefix') . '/templates/show_user_registration.inc.php'; break; } /* Attempt to create the new user */ $access = '5'; - if (conf('auto_user')) { - if (conf('auto_user') == "guest"){$access = "5";} - elseif (conf('auto_user') == "user"){$access = "25";} - elseif (conf('auto_user') == "admin"){$access = "100";} - } - $new_user = $GLOBALS['user']->create($username,$fullname,$email,$pass1,$access); + 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); if (!$new_user) { - $GLOBALS['error']->add_error('duplicate_user',_("Error: Insert Failed")); - show_user_registration($values); + Error::add('duplicate_user',_("Error: Insert Failed")); + require_once Config::get('prefix') . '/templates/show_user_registration.inc.php'; break; } - $user_object = new User($new_user); + $client = new User($new_user); $validation = str_rand(20); - $user_object->update_validation($validation); + $client->update_validation($validation); $message = 'Your account has been created. However, this application requires account activation.' . ' An activation key has been sent to the e-mail address you provided. ' . |