summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-02-21 01:42:10 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-02-21 01:42:10 +0000
commit917c8198ae353ab6fd2b5d981c310e0e3974ab90 (patch)
tree2bcba02cebeebf23c1d37b1f7427891520d9757c
parenta0975517e17913cf2a72901144aad8966c37ad86 (diff)
downloadampache-917c8198ae353ab6fd2b5d981c310e0e3974ab90.tar.gz
ampache-917c8198ae353ab6fd2b5d981c310e0e3974ab90.tar.bz2
ampache-917c8198ae353ab6fd2b5d981c310e0e3974ab90.zip
* Add mpeg to list of _parse_avi valid file types
* Fixed clear playlist, however it reveled a problem with the get items * Removed a stupid extra check on database build
-rw-r--r--admin/system.php2
-rw-r--r--lib/class/catalog.class.php2
-rw-r--r--lib/class/democratic.class.php38
-rw-r--r--lib/class/vainfo.class.php1
4 files changed, 31 insertions, 12 deletions
diff --git a/admin/system.php b/admin/system.php
index 0a54aa8c..17d443aa 100644
--- a/admin/system.php
+++ b/admin/system.php
@@ -23,7 +23,7 @@ require '../lib/init.php';
require_once Config::get('prefix') . '/lib/debug.lib.php';
require_once Config::get('prefix') . '/modules/horde/Browser.php';
-if (!Access::check('interface',100)) {
+if (!Access::check('interface',100) OR Config::get('demo_mode')) {
access_denied();
exit();
}
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index 68f6b22d..a3478bd9 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -441,7 +441,7 @@ class Catalog extends database_object {
while ( false !== ( $file = readdir($handle) ) ) {
/* Skip to next if we've got . or .. */
- if (substr($file,0,1) == '.' || $file == '..') { continue; }
+ if (substr($file,0,1) == '.') { continue; }
debug_event('read',"Starting work on $file inside $path",'5','ampache-catalog');
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php
index 6468f88d..df34ec5f 100644
--- a/lib/class/democratic.class.php
+++ b/lib/class/democratic.class.php
@@ -511,11 +511,11 @@ class Democratic extends tmpPlaylist {
public static function prune_tracks() {
// This deletes data without votes, if it's a voting democratic playlist
- $sql = "DELETE FROM tmp_playlist_data USING tmp_playlist_data " .
- "LEFT JOIN user_vote ON tmp_playlist_data.id=user_vote.object_id " .
- "LEFT JOIN tmp_playlist ON tmp_playlist.id=tmp_playlist.tmp_playlist " .
- "WHERE user_vote.object_id IS NULL AND tmp_playlist.type = 'vote'";
- $db_results = Dba::query($sql);
+ $sql = "DELETE FROM `tmp_playlist_data` USING `tmp_playlist_data` " .
+ "LEFT JOIN `user_vote` ON `tmp_playlist_data`.`id`=`user_vote`.`object_id` " .
+ "LEFT JOIN `tmp_playlist` ON `tmp_playlist`.`id`=`tmp_playlist_data`.`tmp_playlist` " .
+ "WHERE `user_vote`.`object_id` IS NULL AND `tmp_playlist`.`type` = 'vote'";
+ $db_results = Dba::write($sql);
return true;
@@ -528,21 +528,39 @@ class Democratic extends tmpPlaylist {
*/
public function clear() {
- $tmp_id = Dba::escape($this->id);
+ $tmp_id = Dba::escape($this->tmp_playlist);
/* Clear all votes then prune */
- $sql = "DELETE FROM user_vote USING user_vote " .
- "LEFT JOIN tmp_playlist_data ON user_vote.object_id = tmp_playlist_data.id " .
- "WHERE tmp_playlist_data.tmp_playlist='$tmp_id'";
- $db_results = Dba::query($sql);
+ $sql = "DELETE FROM `user_vote` USING `user_vote` " .
+ "LEFT JOIN `tmp_playlist_data` ON `user_vote`.`object_id` = `tmp_playlist_data`.`id` " .
+ "WHERE `tmp_playlist_data`.`tmp_playlist`='$tmp_id'";
+ $db_results = Dba::write($sql);
// Prune!
self::prune_tracks();
+ // Clean the votes
+ self::clean_votes();
+
+
return true;
} // clear_playlist
+ /**
+ * clean_votes
+ * This removes in left over garbage in the votes table
+ */
+ public function clear_votes() {
+
+ $sql = "DELETE FROM `user_vote` USING `user_vote` " .
+ "LEFT JOIN `tmp_playlist_data` ON `user_vote`.`object_id`=`tmp_playlist_data`.`id` " .
+ "WHERE `tmp_playlist_data`.`id` IS NULL";
+ $db_results = Dba::write($sql);
+
+ return true;
+
+ } // clear_votes
} // Democratic class
?>
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php
index f17db0a3..12ad3f1e 100644
--- a/lib/class/vainfo.class.php
+++ b/lib/class/vainfo.class.php
@@ -364,6 +364,7 @@ class vainfo {
case 'flv':
$results[$key] = $this->_parse_flv($this->_raw2);
break;
+ case 'mpeg':
case 'avi':
$results[$key] = $this->_parse_avi($this->_raw2);
break;