summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/quarantine_migration.php.inc5
-rwxr-xr-xdocs/CHANGELOG4
-rw-r--r--lib/class/user.class.php54
-rw-r--r--lib/general.lib.php20
-rw-r--r--lib/rss.php12
-rw-r--r--rss.php2
6 files changed, 62 insertions, 35 deletions
diff --git a/bin/quarantine_migration.php.inc b/bin/quarantine_migration.php.inc
index cb428a56..df81f290 100644
--- a/bin/quarantine_migration.php.inc
+++ b/bin/quarantine_migration.php.inc
@@ -47,6 +47,11 @@ while ($results = mysql_fetch_assoc($db_results)) {
/* Make sure we have write access to the upload dir */
$upload_dir = conf('upload_dir');
+if (!$upload_dir) {
+ echo "\nError: No Upload Directory Defined\n";
+ exit;
+}
+
if (!@is_writeable($upload_dir)) {
echo "\n" . _('Error: Unable to write to') . " $upload_dir ". "\n";
exit;
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index b321b683..535094c7 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,7 +4,9 @@
--------------------------------------------------------------------------
v.3.3.3-Alpha1
- - Added LDAP auth support (Thx Rubin & pb1dft for the modification to support Microsoft AD)
+ - Added <image> tag for album art and ability to filter rss feed
+ by user by adding ?username=<username> to rss link.
+ - Added LDAP/Active Directory auth support (Thx Rubin & pb1dft)
- Added ajax support to ratings, no longer requires a refresh,
hello instant gratification.
- Tweaked Kajax, now accepts an array of elements to replace
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 01617595..ba5c6af9 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -39,7 +39,13 @@ class User {
var $last_seen;
var $create_date;
var $validation;
-
+
+ /**
+ * Constructor
+ * This function is the constructor object for the user
+ * class, it currently takes a username
+ * //FIXME take UID
+ */
function User($username=0) {
if (!$username) {
@@ -47,8 +53,8 @@ class User {
}
$this->username = sql_escape($username);
+ $info = $this->_get_info();
$this->id = $this->username;
- $info = $this->get_info();
$this->username = $info->username;
$this->fullname = $info->fullname;
$this->access = $info->access;
@@ -65,20 +71,25 @@ class User {
} // User
+ /**
+ * _get_info
+ * This function returns the information for this object
+ */
+ function _get_info() {
- /*!
- @function get_info
- @dicussion gets the info!
- */
- function get_info() {
-
- $sql = "SELECT * FROM user WHERE username='$this->username'";
+ /* Hack during transition back to UID for user creation */
+ if (is_numeric($this->username)) {
+ $sql = "SELECT * FROM user WHERE id='" . $this->username . "'";
+ }
+ else {
+ $sql = "SELECT * FROM user WHERE username='$this->username'";
+ }
$db_results = mysql_query($sql, dbh());
return mysql_fetch_object($db_results);
- } // get_info
+ } // _get_info
/**
* get_preferences
@@ -197,25 +208,6 @@ class User {
} // get_favorites
/*!
- @function is_xmlrpc
- @discussion checks to see if this is a valid
- xmlrpc user
- */
- function is_xmlrpc() {
-
- /* If we aren't using XML-RPC return true */
- if (!conf('xml_rpc')) {
- return false;
- }
-
- //FIXME: Ok really what we will do is check the MD5 of the HTTP_REFERER
- //FIXME: combined with the song title to make sure that the REFERER
- //FIXME: is in the access list with full rights
- return true;
-
- } // is_xmlrpc
-
- /*!
@function is_logged_in
@discussion checks to see if $this user is logged in
*/
@@ -524,6 +516,7 @@ class User {
$username = sql_escape($username);
$fullname = sql_escape($fullname);
$email = sql_escape($email);
+ $access = sql_escape($access);
/* Now Insert this new user */
$sql = "INSERT INTO user (username, fullname, email, password, access, create_date) VALUES" .
@@ -885,7 +878,8 @@ class User {
$db_results = mysql_query($sql, dbh());
} // activate_user
+
-} //end class
+} //end user class
?>
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 7923a96d..f933ef94 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -969,4 +969,24 @@ function invert_boolean($value) {
} // invert_boolean
+/**
+ * get_user_from_username
+ * As we are moving away from user from username to user from
+ * unique ID (smaller/faster/more powerful!) this can be used
+ * to return a user object if all you've got is the username
+ */
+function get_user_from_username($username) {
+
+ $sql = "SELECT id FROM user WHERE username='" . sql_escape($username) . "'";
+ $db_results = mysql_query($sql, dbh());
+
+ $results = mysql_fetch_assoc($db_results);
+
+ $user = new User($results['id']);
+
+ return $user;
+
+} // get_user_from_username
+
+
?>
diff --git a/lib/rss.php b/lib/rss.php
index 27e84324..f4973f29 100644
--- a/lib/rss.php
+++ b/lib/rss.php
@@ -24,7 +24,7 @@
@discussion creates a RSS fead for the now
playing information
*/
-function show_now_playingRSS () {
+function show_now_playingRSS ($username=0) {
header ("Content-Type: application/xml");
@@ -36,9 +36,14 @@ header ("Content-Type: application/xml");
$rss_main_language = conf('rss_main_language');
$rss_description = conf('rss_song_description');
- $sql = "SELECT * FROM now_playing ORDER BY start_time DESC";
+ if ($username) {
+ $user = get_user_from_username($username);
+ $constraint = " WHERE user='" . sql_escape($user->username) . "' ";
+ }
- $db_result = mysql_query($sql, $dbh);
+ $sql = "SELECT * FROM now_playing $constraint ORDER BY start_time DESC";
+
+ $db_result = mysql_query($sql, $dbh);
$today = date("d-m-Y");
$rss_song_description = $rss_description;
echo "<rss version=\"2.0\">";
@@ -57,6 +62,7 @@ header ("Content-Type: application/xml");
$text = "$artist - $song->f_title played by $r->user";
echo "<item> \n";
echo " <title><![CDATA[$text]]></title> \n";
+ echo " <image>$web_path/albumart.php?id=$song->album</image>\n";
echo " <link>$web_path/albums.php?action=show&amp;album=$song->album</link>\n";
echo " <description><![CDATA[$song->f_title @ $album is played by $r->user]]></description>\n";
echo " <pubDate>$today</pubDate>\n";
diff --git a/rss.php b/rss.php
index b7274a50..aea52a34 100644
--- a/rss.php
+++ b/rss.php
@@ -28,6 +28,6 @@ if (!conf('use_rss') || conf('demo_mode')) {
access_denied();
}
+show_now_playingRSS($_REQUEST['username']);
-show_now_playingRSS();
?>