summaryrefslogtreecommitdiffstats
path: root/lib/class
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
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')
-rw-r--r--lib/class/plugin.class.php14
-rw-r--r--lib/class/preference.class.php31
2 files changed, 30 insertions, 15 deletions
diff --git a/lib/class/plugin.class.php b/lib/class/plugin.class.php
index 37f707da..1ae18250 100644
--- a/lib/class/plugin.class.php
+++ b/lib/class/plugin.class.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2006 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -163,11 +163,15 @@ class Plugin {
* at the end it inserts a row into the update_info table to indicate
* That it's installed
*/
- function install() {
+ public function install() {
- $this->_plugin->install();
+ $installed = $this->_plugin->install();
- $this->set_plugin_version($this->_plugin->version);
+ $version = $this->set_plugin_version($this->_plugin->version);
+
+ if (!$installed OR !$version) { return false; }
+
+ return true;
} // install
@@ -177,7 +181,7 @@ class Plugin {
* at the end it removes the row from the update_info table to indicate
* that it isn't installed
*/
- function uninstall() {
+ public function uninstall() {
$this->_plugin->uninstall();
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();