summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-12 05:30:30 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-12 05:30:30 +0000
commit7be9eb4ea1e868fa0725334697057e1b7b994460 (patch)
tree5d4c634f2d64f2202cad95b4ce74c87838655e3d /lib
parent12f679cf51ed9440c44cdc0cb178687f0ad17c3b (diff)
downloadampache-7be9eb4ea1e868fa0725334697057e1b7b994460.tar.gz
ampache-7be9eb4ea1e868fa0725334697057e1b7b994460.tar.bz2
ampache-7be9eb4ea1e868fa0725334697057e1b7b994460.zip
re-added ability to delete catalogs, fixed exception error with id3 library
Diffstat (limited to 'lib')
-rw-r--r--lib/class/catalog.class.php14
-rwxr-xr-xlib/class/vainfo.class.php7
-rw-r--r--lib/ui.lib.php23
3 files changed, 37 insertions, 7 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index c25d9c3f..7e598e00 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -105,7 +105,7 @@ class Catalog {
public static function get_catalog_ids() {
$sql = "SELECT `id` FROM `catalog`";
- $db_results = Dba::qery($sql);
+ $db_results = Dba::query($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$results[] = $r['id'];
@@ -2061,20 +2061,22 @@ class Catalog {
/**
* delete
* Deletes the catalog and everything assoicated with it
- * assumes $this
+ * it takes the catalog id
*/
- public static function delete() {
+ public static function delete($catalog_id) {
+
+ $catalog_id = Dba::escape($catalog_id);
// First remove the songs in this catalog
- $sql = "DELETE FROM `song` WHERE `catalog` = '$this->id'";
+ $sql = "DELETE FROM `song` WHERE `catalog` = '$catalog_id'";
$db_results = Dba::query($sql);
// Next Remove the Catalog Entry it's self
- $sql = "DELETE FROM `catalog` WHERE `id` = '$this->id'";
+ $sql = "DELETE FROM `catalog` WHERE `id` = '$catalog_id'";
$db_results = Dba::query($sql);
// Run the Aritst/Album Cleaners...
- self::clean($this->id);
+ self::clean($catalog_id);
} // delete
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php
index e2212838..85b12659 100755
--- a/lib/class/vainfo.class.php
+++ b/lib/class/vainfo.class.php
@@ -88,7 +88,12 @@ class vainfo {
function get_info() {
/* Get the Raw file information */
- $this->_raw = $this->_getID3->analyze($this->filename);
+ try {
+ $this->_raw = $this->_getID3->analyze($this->filename);
+ }
+ catch (Exception $error) {
+ debug_event('getid3',$e->message,'1');
+ }
/* Figure out what type of file we are dealing with */
$this->type = $this->_get_type();
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index a1283841..aa407adf 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -1424,4 +1424,27 @@ function ajax_include($include) {
} // ajax_include
+/**
+ * ajax_button
+ * This is a generic function that generates the on(whateva) URL for ajaxie hotness
+ * it takes a action url, icon name, alt tag and form_id (option)
+ */
+function ajax_button($action,$icon,$alt,$post_id='') {
+
+ $url = Config::get('ajax_url') . $action;
+ $icon_url = Config::get('web_path') . '/images/icons/' . $icon . '.png';
+
+ if ($post) {
+ $ajax_string = "ajaxPost('$url','$post');";
+ }
+ else {
+ $ajax_string = "ajaxPut('$url');";
+ }
+
+ $string = "<span onclick=\"$ajax_string;return true\">\n\t<img src=\"$icon_url\" border=\"0\" style=\"cursor:pointer;\" alt=\"$alt\" />\n</span>\n";
+
+ return $string;
+
+} // ajax_button
+
?>