summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-10 06:03:47 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-10 06:03:47 +0000
commit46ffeca144b7ef44572a5805061da246c8be5f3c (patch)
tree2b338376bb6e4a77839607131c22f20e6a59cb8d /lib
parent0d2c89e90d7c64eba058ae375760a350d336578b (diff)
downloadampache-46ffeca144b7ef44572a5805061da246c8be5f3c.tar.gz
ampache-46ffeca144b7ef44572a5805061da246c8be5f3c.tar.bz2
ampache-46ffeca144b7ef44572a5805061da246c8be5f3c.zip
database update, cleaned up some stuff
Diffstat (limited to 'lib')
-rw-r--r--lib/class/update.class.php13
-rw-r--r--lib/general.lib.php13
-rw-r--r--lib/preferences.php127
3 files changed, 25 insertions, 128 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 0d5bacfe..c34cd012 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -247,10 +247,12 @@ class Update {
$version[] = array('version' => '340012','description'=>$update_string);
- $update_string = '- Removed Unused Preferneces<br />' .
- '- Changed all XML-RPC acls to RPC to reflect inclusion of new API<br />';
+ $update_string = '- Removed Unused Preferneces.<br />' .
+ '- Changed Localplay Config to Localplay Access.<br />' .
+ '- Changed all XML-RPC acls to RPC to reflect inclusion of new API.<br />';
-// $version[] = array('version' => '340013','description'=>$update_string)
+ $version[] = array('version' => '340013','description'=>$update_string);
+
return $version;
@@ -1055,7 +1057,10 @@ class Update {
public static function update_340013() {
$sql = "DELETE FROM `preference` WHERE `name`='localplay_mpd_hostname' OR `name`='localplay_mpd_port' " .
- "OR `name`='direct_link' OR `name`='localplay_level' OR `name`='localplay_mpd_password'";
+ "OR `name`='direct_link' OR `name`='localplay_mpd_password' OR `name`='catalog_echo_count'";
+ $db_results = Dba::query($sql);
+
+ $sql = "UPDATE `preference` SET `description`='Localplay Access' WHERE `name`='localplay_level'";
$db_results = Dba::query($sql);
$sql = "UPDATE `access_list` SET `type`='rpc' WHERE `type`='xml-rpc'";
diff --git a/lib/general.lib.php b/lib/general.lib.php
index eab84a73..60a461d0 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -521,11 +521,22 @@ function get_languages() {
*/
function logout() {
+ // Do a quick check to see if this is an AJAX'd logout request
+ // if so use the iframe to redirect
+ if (AJAX_INCLUDE == '1') {
+ $_SESSION['iframe']['target'] = Config::get('web_path') . '/login.php';
+ $results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>';
+ echo xml_from_array($results);
+ }
+
/* First destory their session */
vauth_logout(session_id());
+
/* Redirect them to the login page */
- header ('Location: ' . Config::get('web_path') . '/login.php');
+ if (AJAX_INCLUDE != '1') {
+ header ('Location: ' . Config::get('web_path') . '/login.php');
+ }
return true;
diff --git a/lib/preferences.php b/lib/preferences.php
index c81a3360..793b1db4 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -19,49 +19,6 @@
*/
-/*!
- @function get_site_preferences
- @discussion gets all of the preferences for this Ampache site
-*/
-function get_site_preferences() {
-
- $results = array();
-
- $sql = "SELECT preferences.name, preferences.type, user_preference.value, preferences.description FROM preferences,user_preference " .
- " WHERE preferences.id=user_preference.preference AND user_preference.user = '-1' ORDER BY `type`,`name`";
- $db_results = mysql_query($sql, dbh());
-
- while ($r = mysql_fetch_object($db_results)) {
- $results[] = $r;
- }
-
- return $results;
-
-} // get_site_preferences
-
-/*!
- @function set_site_preferences
- @discussion sets the conf() function with the current site preferences from the db
-*/
-function set_site_preferences() {
-
- $results = array();
-
- $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user='-1' AND user_preference.preference=preferences.id";
- $db_results = mysql_query($sql, dbh());
-
- while ($r = mysql_fetch_object($db_results)) {
- $results[$r->name] = $r->value;
- } // db results
-
- if (strlen($results['theme_name']) > 0) {
- $results['theme_path'] = "/themes/" . $results['theme_name'];
- }
-
- conf($results,1);
-
-} // set_site_preferences
-
/**
* clean_preference_name
* s/_/ /g & upper case first
@@ -304,12 +261,12 @@ function create_preference_input($name,$value) {
echo "</select>\n";
break;
case 'localplay_level':
- if ($value == '2') { $is_full = 'selected="selected"'; }
- elseif ($value == '1') { $is_global = 'selected="selected"'; }
+ if ($value == '25') { $is_user = 'selected="selected"'; }
+ elseif ($value == '100') { $is_admin = 'selected="selected"'; }
echo "<select name=\"$name\">\n";
echo "<option value=\"0\">" . _('Disabled') . "</option>\n";
- echo "<option value=\"1\" $is_global>" . _('Server') . "</option>\n";
- echo "<option value=\"2\" $is_full>" . _('User') . "</option>\n";
+ echo "<option value=\"25\" $is_user>" . _('User') . "</option>\n";
+ echo "<option value=\"100\" $is_admin>" . _('Admin') . "</option>\n";
echo "</select>\n";
break;
case 'theme_name':
@@ -370,51 +327,6 @@ function get_preference_id($name) {
} // get_preference_id
/**
- * get_preference_name
- * This does the inverse of the above function and returns the preference name from the ID
- * This is usefull for doing... the opposite of above. Amazing isn't it.
- */
-function get_preference_name($id) {
-
- $id = sql_escape($id);
-
- $sql = "SELECT name FROM preferences WHERE id='$id'";
- $db_results = mysql_query($sql,dbh());
-
- $results = mysql_fetch_assoc($db_results);
-
- return $results['name'];
-
-} // get_preference_name
-
-/**
- * insert_preference
- * This creates a new preference record in the
- * preferences table this is used by the modules
- */
-function insert_preference($name,$description,$default,$level,$type,$catagory) {
-
- /* Clean the incomming variables */
- $name = sql_escape($name);
- $description = sql_escape($description);
- $default = sql_escape($default);
- $level = sql_escape($level);
- $type = sql_escape($type);
- $catagory = sql_escape($catagory);
-
-
- /* Form the sql statement */
- $sql = "INSERT INTO preferences (`name`,`description`,`value`,`type`,`level`,`catagory`) VALUES " .
- " ('$name','$description','$default','$type','$level','$catagory')";
- $db_results = mysql_query($sql, dbh());
-
- if ($db_results) { return true; }
-
- return false;
-
-} // insert_preference
-
-/**
* init_preferences
* Third times the charm, why rename a function once when you can do it three times :(
* This grabs the preferences and then loads them into conf it should be run on page load
@@ -463,37 +375,6 @@ function init_preferences() {
} // init_preferences
/**
- * show_import_playlist
- * This just shows the template for importing playlists
- * from something outside Ampache such as a m3u
- */
-function show_import_playlist() {
-
- require_once(conf('prefix') . '/templates/show_import_playlist.inc.php');
-
-} // show_import_playlist
-
-/**
- * get_preferences
- * This returns an array of all current preferences in the
- * preferences table, this isn't a users preferences
- */
-function get_preferences() {
-
- $sql = "SELECT * FROM preferences";
- $db_results = mysql_query($sql, dbh());
-
- $results = array();
-
- while ($r = mysql_fetch_assoc($db_results)) {
- $results[] = $r;
- }
-
- return $results;
-
-} // get_preferences
-
-/**
* update_preference_level
* This function updates the level field in the preferences table
* this has nothing to do with a users actuall preferences