summaryrefslogtreecommitdiffstats
path: root/lib/class/preference.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-05-10 11:00:57 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-05-10 11:00:57 +0000
commit08598b34a8621838ce64f4b8a3f2164072c3be1b (patch)
tree825a9083a413fa5da3491b6da735c6ad3cdb2c41 /lib/class/preference.class.php
parent2f5c09b55c9f0f4149d2ae3ff41678807dab322a (diff)
downloadampache-08598b34a8621838ce64f4b8a3f2164072c3be1b.tar.gz
ampache-08598b34a8621838ce64f4b8a3f2164072c3be1b.tar.bz2
ampache-08598b34a8621838ce64f4b8a3f2164072c3be1b.zip
some rather major bug fixes, corrected a preference setting issue, as well as a preference update issue, fixed infinite plugin installing for fun and profit, also fixed updating the config file not regenerating the version correctly and the user creation allowing users with blank password, which does not work at the login
Diffstat (limited to 'lib/class/preference.class.php')
-rw-r--r--lib/class/preference.class.php31
1 files changed, 21 insertions, 10 deletions
diff --git a/lib/class/preference.class.php b/lib/class/preference.class.php
index 1c299a35..265a2cf4 100644
--- a/lib/class/preference.class.php
+++ b/lib/class/preference.class.php
@@ -116,6 +116,21 @@ class Preference {
} // update_all
/**
+ * exists
+ * This just checks to see if a preference currently exists
+ */
+ public static function exists($preference) {
+
+ // We assume it's the name
+ $name = Dba::escape($preference);
+ $sql = "SELECT * FROM `preference` WHERE `name`='$name'";
+ $db_results = Dba::query($sql);
+
+ return Dba::num_rows($db_results);
+
+ } // exists
+
+ /**
* has_access
* This checks to see if the current user has access to modify this preference
* as defined by the preference name
@@ -238,8 +253,8 @@ class Preference {
$type = Dba::escape($type);
$catagory = Dba::escape($catagory);
- $sql = "INSERT INTO `preference` (`name`,`description`,`value`,`level`,`catagory`) " .
- "VALUES ('$name','$description','$default','$level','$catagory')";
+ $sql = "INSERT INTO `preference` (`name`,`description`,`value`,`level`,`type`,`catagory`) " .
+ "VALUES ('$name','$description','$default','$level','$type','$catagory')";
$db_results = Dba::query($sql);
if (!$db_results) { return false; }
@@ -256,18 +271,14 @@ class Preference {
// First prepare
if (!is_numeric($preference)) {
- $id = self::id_from_name($preference);
- $name = $preference;
+ $name = Dba::escape($preference);
+ $sql = "DELETE FROM `preference` WHERE `name`='$name'";
}
else {
- $name = self::name_from_id($preference);
- $id = $preference;
+ $id = Dba::escape($preference);
+ $sql = "DELETE FROM `preference` WHERE `id`='$id'";
}
- $id = Dba::escape($id);
-
- // Remove the preference, then the user records of it
- $sql = "DELETE FROM `preference` WHERE `id`='$id'";
$db_results = Dba::query($sql);
self::rebuild_preferences();