diff options
-rwxr-xr-x | docs/CHANGELOG | 2 | ||||
-rw-r--r-- | lib/class/tmp_playlist.class.php | 10 | ||||
-rw-r--r-- | lib/class/update.class.php | 2 | ||||
-rw-r--r-- | lib/class/user.class.php | 15 | ||||
-rw-r--r-- | lib/general.lib.php | 25 | ||||
-rw-r--r-- | login.php | 2 | ||||
-rw-r--r-- | server/ajax.server.php | 1 | ||||
-rw-r--r-- | templates/show_login_form.inc | 2 |
8 files changed, 18 insertions, 41 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index c0e9e2b6..c917a33d 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.4-Alpha1 + - Fixed Democratic Play newest votes of same total count first + (Order by vote time) - Fixed a problem where config re-gen wouldn't update the current version - Changed database to fix some user tracking issues diff --git a/lib/class/tmp_playlist.class.php b/lib/class/tmp_playlist.class.php index b024c454..08e1d30f 100644 --- a/lib/class/tmp_playlist.class.php +++ b/lib/class/tmp_playlist.class.php @@ -86,7 +86,7 @@ class tmpPlaylist { $order = 'ORDER BY id ASC'; if ($this->type == 'vote') { - $order = "GROUP BY tmp_playlist_data.id ORDER BY `count` DESC"; + $order = "GROUP BY tmp_playlist_data.id ORDER BY `count` ,user_vote.date DESC"; $vote_select = ", COUNT(user_vote.user) AS `count`"; $vote_join = "LEFT JOIN user_vote ON user_vote.object_id=tmp_playlist_data.id"; } @@ -94,6 +94,7 @@ class tmpPlaylist { /* Select all objects from this playlist */ $sql = "SELECT tmp_playlist_data.id, tmp_playlist_data.object_id $vote_select FROM tmp_playlist_data $vote_join " . "WHERE tmp_playlist_data.tmp_playlist='" . sql_escape($this->id) . "' $order"; + debug_event('foo',$sql,'1'); $db_results = mysql_query($sql, dbh()); /* Define the array */ @@ -123,7 +124,7 @@ class tmpPlaylist { if ($this->type == 'vote') { /* Add conditions for voting */ $vote_select = ", COUNT(user_vote.user) AS `count`"; - $order = " GROUP BY tmp_playlist_data.id ORDER BY `count` DESC"; + $order = " GROUP BY tmp_playlist_data.id ORDER BY `count`, user_vote.date DESC"; $vote_join = "LEFT JOIN user_vote ON user_vote.object_id=tmp_playlist_data.id"; } @@ -326,8 +327,9 @@ class tmpPlaylist { } /* Vote! */ - $sql = "INSERT INTO user_vote (`user`,`object_id`) " . - "VALUES ('" . sql_escape($GLOBALS['user']->id) . "','" . $results['id'] . "')"; + $time = time(); + $sql = "INSERT INTO user_vote (`user`,`object_id`,`date`) " . + "VALUES ('" . sql_escape($GLOBALS['user']->id) . "','" . $results['id'] . "','$time')"; $db_results = mysql_query($sql, dbh()); return true; diff --git a/lib/class/update.class.php b/lib/class/update.class.php index c2dd6c5f..9471eb71 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -2218,7 +2218,7 @@ class Update { $db_results = mysql_query($sql,dbh()); // Now pull the access list users, alter table and then re-insert - $sql = "SELETE DISTINCT(`user`) FROM `access_list`"; + $sql = "SELECT DISTINCT(`user`) FROM `access_list`"; $db_results = mysql_query($sql,dbh()); while ($r = mysql_fetch_assoc($db_results)) { diff --git a/lib/class/user.class.php b/lib/class/user.class.php index 32c1e3d7..c03a3969 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -303,32 +303,31 @@ class User { /** * update_preference - * //FIXME: Unused at this point, should be removed or used * updates a single preference if the query fails * it attempts to insert the preference instead * @package User * @catagory Class * @todo Do a has_preference_access check */ - function update_preference($preference_id, $value, $username=0) { + function update_preference($preference_id, $value, $user_id=0) { if (!has_preference_access(get_preference_name($preference_id))) { return false; } - if (!$username) { - $username = $this->username; + if (!$user_id) { + $user_id = $this->id; } - if (!conf('use_auth')) { $username = '-1'; } + if (!conf('use_auth')) { $user_id = '-1'; } $value = sql_escape($value); $preference_id = sql_escape($preference_id); - $username = sql_escape($username); + $user_id = sql_escape($user_id); - $sql = "UPDATE user_preference SET value='$value' WHERE user='$username' AND preference='$preference_id'"; + $sql = "UPDATE user_preference SET value='$value' WHERE user='$user_id' AND preference='$preference_id'"; - $db_results = @mysql_query($sql, dbh()); + $db_results = mysql_query($sql, dbh()); } // update_preference diff --git a/lib/general.lib.php b/lib/general.lib.php index e0070839..deb8e176 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -190,31 +190,6 @@ function conf($param,$clobber=0) } } //conf -function libglue_param($param,$clobber=0) -{ - static $params = array(); - if(is_array($param)) - //meaning we are setting values - { - foreach ($param as $key=>$val) - { - if(!$clobber && isset($params[$key])) - { - echo "Error: attempting to clobber $key = $val\n"; - exit(); - } - $params[$key] = $val; - } - return true; - } - else - //meaning we are trying to retrieve a parameter - { - if(isset($params[$param])) return $params[$param]; - else return false; - } -} - function error_results($param,$clobber=0) { static $params = array(); @@ -132,7 +132,7 @@ if ($auth['success']) { /* Make sure they are actually trying to get to this site and don't try to redirect them back into * an admin section **/ - if (strstr($_POST['referrer'], conf('web_path')) AND + if (substr($_POST['referrer'],0,strlen(conf('web_path'))) == conf('web_path') AND !strstr($_POST['referrer'],"install.php") AND !strstr($_POST['referrer'],"login.php") AND !strstr($_POST['referrer'],"update.php") AND diff --git a/server/ajax.server.php b/server/ajax.server.php index 80c64d79..40282e35 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -79,7 +79,6 @@ switch ($action) { break; /* For changing the current play type FIXME:: need to allow select of any type */ case 'change_play_type': - $_SESSION['data']['old_play_type'] = conf('play_type'); $pref_id = get_preference_id('play_type'); $GLOBALS['user']->update_preference($pref_id,$_GET['type']); diff --git a/templates/show_login_form.inc b/templates/show_login_form.inc index 453a665a..7ff9bbe3 100644 --- a/templates/show_login_form.inc +++ b/templates/show_login_form.inc @@ -40,7 +40,7 @@ if (conf('local_length') >= conf('remember_length')) { <?php echo conf('login_message'); ; ?> <?php $GLOBALS['error']->print_error('general'); ?> <p><input class="button" type="submit" value="<?php echo _('Login'); ?>" /></p> - <input type="hidden" name="referrer" value="<?php echo $referrer; ?>" /> + <input type="hidden" name="referrer" value="<?php echo scrub_out($_SERVER['HTTP_REFERRER']); ?>" /> <input type="hidden" name="action" value="login" /> </form> <?php if (conf('allow_public_registration')) { ?> |