summaryrefslogtreecommitdiffstats
path: root/lib
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
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')
-rw-r--r--lib/class/plugin.class.php14
-rw-r--r--lib/class/preference.class.php31
-rw-r--r--lib/debug.lib.php13
-rw-r--r--lib/general.lib.php2
-rw-r--r--lib/init.php2
-rw-r--r--lib/install.php2
-rw-r--r--lib/preferences.php2
7 files changed, 40 insertions, 26 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();
diff --git a/lib/debug.lib.php b/lib/debug.lib.php
index d0685b24..60195054 100644
--- a/lib/debug.lib.php
+++ b/lib/debug.lib.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2007 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -236,15 +236,14 @@ function generate_config($current) {
$value = $matches[2];
/* Put in the current value */
- if (isset($current[$key]) AND $key != 'config_version') {
+ if ($key == 'config_version') {
+ $line = $key . ' = ' . $value;
+ }
+ elseif (isset($current[$key])) {
$line = $key . ' = "' . $current[$key] . '"';
unset($current[$key]);
} // if set
-
- elseif (isset($array_value[$key])) {
- $line = '';
- }
-
+
} // if key
$final .= $line . "\n";
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 382f5716..e98e4037 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2008 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
diff --git a/lib/init.php b/lib/init.php
index f53b81ec..7771d95f 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -82,7 +82,7 @@ if (!count($results)) {
/** This is the version.... fluf nothing more... **/
$results['version'] = '3.4-RC1';
-$results['int_config_version'] = '6';
+$results['int_config_version'] = '7';
$results['raw_web_path'] = $results['web_path'];
$results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path'];
diff --git a/lib/install.php b/lib/install.php
index ae873a46..e0c19ae9 100644
--- a/lib/install.php
+++ b/lib/install.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2008 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
diff --git a/lib/preferences.php b/lib/preferences.php
index deb21dde..786e9a38 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -33,7 +33,7 @@ function update_preferences($pref_id=0) {
$sql = "SELECT `id`,`name`,`type` FROM `preference`";
/* If it isn't the System Account's preferences */
- if ($pref_id != '-1') { $sql .= " WHERE `type` != 'system'"; }
+ if ($pref_id != '-1') { $sql .= " WHERE `catagory` != 'system'"; }
$db_results = Dba::query($sql);