diff options
Diffstat (limited to 'lib/class')
-rw-r--r-- | lib/class/access.class.php | 9 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 32 | ||||
-rw-r--r-- | lib/class/update.class.php | 32 |
3 files changed, 55 insertions, 18 deletions
diff --git a/lib/class/access.class.php b/lib/class/access.class.php index b8a6c72c..5ad5a219 100644 --- a/lib/class/access.class.php +++ b/lib/class/access.class.php @@ -164,10 +164,17 @@ class Access { $level = sql_escape($level); switch ($type) { + /* This is here because we want to at least check IP before even creating the xml-rpc server + * however we don't have the key that was passed yet so we've got to do just ip + */ + case 'init-xml-rpc': + $sql = "SELECT id FROM access_list" . + " WHERE `start` <= '$ip' AND `end` >= '$ip' AND `type`='xml-rpc' AND `level` >= '$level'"; + break; case 'xml-rpc': $sql = "SELECT id FROM access_list" . " WHERE `start` <= '$ip' AND `end` >= '$ip'" . - " AND `key` = '$key' AND `level` >= '$level'"; + " AND `key` = '$key' AND `level` >= '$level' AND `type`='xml-rpc'"; break; case 'network': case 'interface': diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 9f782d46..55d45717 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -30,7 +30,7 @@ class Catalog { var $name; var $last_update; var $last_add; - var $id3_set_command; + var $key; var $rename_pattern; var $sort_pattern; var $catalog_type; @@ -64,7 +64,7 @@ class Catalog { $this->name = $info->name; $this->last_update = $info->last_update; $this->last_add = $info->last_add; - $this->id3_set_command = $info->id3_set_command; + $this->key = $info->key; $this->rename_pattern = $info->rename_pattern; $this->sort_pattern = $info->sort_pattern; $this->catalog_type = $info->catalog_type; @@ -725,11 +725,11 @@ class Catalog { $id = sql_escape($data['catalog_id']); $name = sql_escape($data['name']); - $id3cmd = sql_escape($data['id3cmd']); + $key = sql_escape($data['key']); $rename = sql_escape($data['rename_pattern']); $sort = sql_escape($data['sort_pattern']); - $sql = "UPDATE catalog SET name='$name', id3_set_command='$id3cmd', rename_pattern='$rename', " . + $sql = "UPDATE catalog SET name='$name', `key`='$key', rename_pattern='$rename', " . "sort_pattern='$sort' WHERE id = '$id'"; $db_results = mysql_query($sql, dbh()); @@ -745,7 +745,7 @@ class Catalog { * @param $path Root path to start from for catalog * @param $name Name of the new catalog */ - function new_catalog($path,$name, $id3cmd=0, $ren=0, $sort=0, $type=0,$gather_art=0,$parse_m3u=0,$art=array()) { + function new_catalog($path,$name, $key=0, $ren=0, $sort=0, $type=0,$gather_art=0,$parse_m3u=0,$art=array()) { /* Record the time.. time the catalog gen */ $start_time = time(); @@ -760,17 +760,17 @@ class Catalog { $catalog_id = $this->check_catalog($path); if (!$catalog_id) { - $catalog_id = $this->create_catalog_entry($path,$name,$id3cmd, $ren, $sort, $type); + $catalog_id = $this->create_catalog_entry($path,$name,$key, $ren, $sort, $type); } /* Setup the $this with the new information */ - $this->id = $catalog_id; - $this->path = $path; - $this->name = $name; - $this->id3_set_command = ($id3cmd)?$id3cmd:''; - $this->rename_pattern = ($ren)?$ren:''; - $this->sort_pattern = ($sort)?$sort:''; - $this->catalog_type = $type; + $this->id = $catalog_id; + $this->path = $path; + $this->name = $name; + $this->key = $key; + $this->rename_pattern = ($ren)?$ren:''; + $this->sort_pattern = ($sort)?$sort:''; + $this->catalog_type = $type; /* Fluf */ echo _('Starting Catalog Build') . " [$name]<br />\n"; @@ -1704,7 +1704,7 @@ class Catalog { @param $path The root path for this catalog @param $name The name of the new catalog */ - function create_catalog_entry($path,$name,$id3cmd=0,$ren=0,$sort=0, $type='local') { + function create_catalog_entry($path,$name,$key=0,$ren=0,$sort=0, $type='local') { // Current time $date = time(); @@ -1713,8 +1713,8 @@ class Catalog { $name = sql_escape($name); if($id3cmd && $ren && $sort) { - $sql = "INSERT INTO catalog (path,name,last_update,id3_set_command,rename_pattern,sort_pattern,catalog_type) " . - " VALUES ('$path','$name','$date', '$id3cmd', '$ren', '$sort','$type')"; + $sql = "INSERT INTO catalog (path,name,last_update,`key`,rename_pattern,sort_pattern,catalog_type) " . + " VALUES ('$path','$name','$date', '$key', '$ren', '$sort','$type')"; } else { $sql = "INSERT INTO catalog (path,name,last_update) VALUES ('$path','$name','$date')"; diff --git a/lib/class/update.class.php b/lib/class/update.class.php index e505ea87..fc13ef44 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -282,11 +282,16 @@ class Update { $update_string = '- Reworked All Indexes on tables, hopefully leading to performance improvements.<br />' . '- Added id int(11) UNSIGNED fields to a few tables missing it.<br />' . + '- Reworked Access Lists, adding type based ACL\'s and a key for xml-rpc communication.<br />' . '- Removed DB Based color/font preferences and Theme preferences catagory.<br />'; $version[] = array('version' => '332012','description' => $update_string); - $update_string = '- Added live_stream table for radio station support.<br />'; + $update_string = '- Added live_stream table for radio station support.<br />' . + '- Removed id3_set_command from catalog and added xml-rpc key for remote catalogs.<br />' . + '- Added stream/video to enum of object_count for future support.<br />'; + + $version[] = array('version' => '332013','description' => $update_string); return $version; @@ -1782,6 +1787,7 @@ class Update { */ function update_332013() { + /* Add Live Stream Table */ $sql = "CREATE TABLE `live_stream` (" . "`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ," . "`name` VARCHAR( 128 ) NOT NULL ," . @@ -1792,6 +1798,30 @@ class Update { "`frequency` VARCHAR( 32 ) NOT NULL ," . "`call_sign` VARCHAR( 32 ) NOT NULL" . ")"; + $db_results = mysql_query($sql, dbh()); + + /* Add Indexes for this new table */ + $sql = "ALTER TABLE `live_stream` ADD INDEX `catalog` (`catalog`)"; + $db_results = mysql_query($sql, dbh()); + + $sql = "ALTER TABLE `live_stream` ADD INDEX `genre` (`genre`)"; + $db_results = mysql_query($sql, dbh()); + + $sql = "ALTER TABLE `live_stream` ADD INDEX `name` (`name`)"; + $db_results = mysql_query($sql,dbh()); + + /* Drop id3 set command */ + $sql = "ALTER TABLE `catalog` DROP `id3_set_command`"; + $db_results = mysql_query($sql, dbh()); + + $sql = "ALTER TABLE `catalog` ADD `key` VARCHAR( 255 ) NOT NULL"; + $db_results = mysql_query($sql, dbh()); + + /* Prepare for Video and Stream (comming in next version) */ + $sql = "ALTER TABLE `ratings` CHANGE `object_type` `object_type` ENUM( 'artist', 'album', 'song', 'steam', 'video' ) NOT NULL DEFAULT 'artist'"; + $db_results = mysql_query($sql, dbh()); + + $this->set_version('db_version','332013'); } // update_332013 |