summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-02 01:48:15 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-02 01:48:15 +0000
commit66e0b8ea9dd675a778a5c5777cce547887b2720c (patch)
tree6a64838f552b37481d92f75bc6979d11b83bc13a
parent0f4a9e4823d6aa92c3974c33f560a4897140dfbd (diff)
downloadampache-66e0b8ea9dd675a778a5c5777cce547887b2720c.tar.gz
ampache-66e0b8ea9dd675a778a5c5777cce547887b2720c.tar.bz2
ampache-66e0b8ea9dd675a778a5c5777cce547887b2720c.zip
fixed public registration, added ADD button to the recently played stuff
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/user.class.php8
-rw-r--r--modules/validatemail/validateEmail.php9
-rw-r--r--register.php69
-rw-r--r--templates/show_recently_played.inc.php5
5 files changed, 53 insertions, 39 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 51a02275..90132369 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4-Alpha4
+ - Added 'Add' button to recently played
- Limited Rightbar to only 100 items, adds last row indicating any
additional items on playlist. Prevents Firefox crash if you
add many thousands of items to a single active playlist
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 4708d1c2..3870f910 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -459,12 +459,12 @@ class User {
* Use this function to update the validation key
* NOTE: crap this doesn't have update_item the humanity of it all
*/
- function update_validation($new_validation) {
+ public function update_validation($new_validation) {
- $new_validation = sql_escape($new_validation);
- $sql = "UPDATE user SET validation='$new_validation',disabled='1' WHERE `id`='$this->id'";
+ $new_validation = Dba::escape($new_validation);
+ $sql = "UPDATE `user` SET `validation`='$new_validation', `disabled`='1' WHERE `id`='" . Dba::escape($this->id) . "'";
+ $db_results = Dba::query($sql);
$this->validation = $new_validation;
- $db_results = mysql_query($sql, dbh());
return $db_results;
diff --git a/modules/validatemail/validateEmail.php b/modules/validatemail/validateEmail.php
index e8cc037a..f6337806 100644
--- a/modules/validatemail/validateEmail.php
+++ b/modules/validatemail/validateEmail.php
@@ -148,10 +148,11 @@ function validateEmail ( $email, $verbose=0 ) {
// Leave blank to use $SERVER_NAME.
// Note that most modern MTAs will ignore (but require) whatever you say here ...
// the server will determine your domain via other means.
- if (conf('mail_domain')){
- $serverName = conf('mail_domain');
- } else {
- $serverName = "domain.tld";
+ if (Config::get('mail_domain')) {
+ $serverName = Config::get('mail_domain');
+ }
+ else {
+ $serverName = "domain.tld";
}
// MAIL FROM -- who's asking?
// Good values: nobody, postmaster, info, buckwheat, gumby
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. ' .
diff --git a/templates/show_recently_played.inc.php b/templates/show_recently_played.inc.php
index ed67bab3..f35f64cf 100644
--- a/templates/show_recently_played.inc.php
+++ b/templates/show_recently_played.inc.php
@@ -25,6 +25,7 @@ $time_unit = array('',_('seconds ago'),_('minutes ago'),_('hours ago'),_('days a
?>
<table class="tabledata" cellpadding="0" cellspacing="0">
<colgroup>
+ <col id="col_add" />
<col id="col_username" />
<col id="col_song" />
<col id="col_album" />
@@ -32,6 +33,7 @@ $time_unit = array('',_('seconds ago'),_('minutes ago'),_('hours ago'),_('days a
<col id="col_lastplayed" />
</colgroup>
<tr class="th-top">
+ <th class="cel_add"><?php echo _('Add'); ?></th>
<th class="cel_song"><?php echo _('Song'); ?></th>
<th class="cel_album"><?php echo _('Album'); ?></th>
<th class="cel_artist"><?php echo _('Artist'); ?></th>
@@ -69,6 +71,9 @@ $time_unit = array('',_('seconds ago'),_('minutes ago'),_('hours ago'),_('days a
$song->format();
?>
<tr class="<?php echo flip_class(); ?>">
+ <td class="cel_add">
+ <?php echo Ajax::button('?action=basket&type=song&id=' . $song->id,'add',_('Add'),'add_' . $song->id); ?>
+ </td>
<td class="cel_song"><?php echo $song->f_link; ?></td>
<td class="cel_album"><?php echo $song->f_album_link; ?></td>
<td class="cel_artist"><?php echo $song->f_artist_link; ?></td>