1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 02:09:23 +02:00

Replaced almost every dba::query to dba::read or dba::write.

This commit is contained in:
dipsol 2009-12-14 08:06:20 +00:00
parent 9b3232ba29
commit a7838e2a13
20 changed files with 2463 additions and 2463 deletions

View file

@ -58,7 +58,7 @@ if ($where) $where = "($where) AND catalog_type='local'";
else $where = "catalog_type='local'";
$sql = "SELECT id FROM catalog";
if ($where) $sql .= " WHERE $where";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
ob_start("ob_html_strip",'4096',true);

View file

@ -38,7 +38,7 @@ if ($debug) { echo _("DEBUG ENABLED WILL NOT DELETE FILES!"); echo "\n"; }
/* Get a list of filenames */
$sql = "SELECT `id`,`file` FROM song WHERE enabled='0'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
if ($debug) {
@ -50,7 +50,7 @@ while ($row = Dba::fetch_assoc($db_results)) {
echo "\n";
unlink($row['file']);
$sql = "DELETE FROM `song` WHERE `id`='" . Dba::escape($row['id']) . "'";
$del_results = Dba::query($sql);
$del_results = Dba::write($sql);
}
} // end while

View file

@ -63,7 +63,7 @@ printf (_('Using %s as source character set'), $source_encoding);
echo "\n";
$sql = "SELECT * FROM `catalog` WHERE `catalog_type`='local'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {

View file

@ -56,7 +56,7 @@ print "\n";
/* Attempt to figure out what catalog it comes from */
$sql = "SELECT `catalog`.`id` FROM `song` INNER JOIN `catalog` ON `song`.`catalog`=`catalog`.`id` WHERE `song`.`file` LIKE '%" . Dba::escape($filename) . "'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = Dba::fetch_assoc($db_results);
$catalog = new Catalog($results['id']);

View file

@ -47,7 +47,7 @@ ob_end_clean();
/* First Clean the catalog to we don't try to write anything we shouldn't */
$sql = "SELECT `id` FROM `catalog` WHERE `catalog_type`='local'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$catalogs = array();
@ -295,7 +295,7 @@ function sort_move_file($song,$fullname) {
/* Update the catalog */
$sql = "UPDATE song SET file='" . Dba::escape($fullname) . "' WHERE id='" . Dba::escape($song->id) . "'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
} // end else

View file

@ -64,7 +64,7 @@ class AmpacheMail {
break;
} // end filter switch
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = array();

View file

@ -48,7 +48,7 @@ abstract class database_object {
}
$sql = "SELECT * FROM `$table_name` WHERE `id`='$id'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
if (!$db_results) { return array(); }

View file

@ -1,21 +1,21 @@
<?php
/*
Copyright (c) Ampache.org
All rights reserved.
Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License v2
as published by the Free Software Foundation.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License v2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Make sure they aren't directly accessing it */
@ -252,7 +252,7 @@ class Dba {
if (Config::get('sql_profiling')) {
print '<br/>Profiling data: <br/>';
$res = Dba::query('show profiles');
$res = Dba::read('show profiles');
print '<table>';
while ($r = Dba::fetch_row($res)) {
print '<tr><td>' . implode('</td><td>', $r) . '</td></tr>';
@ -407,25 +407,25 @@ class Dba {
// Alter the charset for the entire database
$sql = "ALTER DATABASE `" . Config::get('database_name') . "` DEFAULT CHARACTER SET $target_charset COLLATE $target_collation";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "SHOW TABLES";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
// Go through the tables!
while ($row = Dba::fetch_row($db_results)) {
$sql = "DESCRIBE `" . $row['0'] . "`";
$describe_results = Dba::query($sql);
$describe_results = Dba::read($sql);
// Change the tables default charset and colliation
$sql = "ALTER TABLE `" . $row['0'] . "` DEFAULT CHARACTER SET $target_charset COLLATE $target_collation";
$alter_table = Dba::query($sql);
$alter_table = Dba::write($sql);
// Itterate through the columns of the table
while ($table = Dba::fetch_assoc($describe_results)) {
if (strstr($table['Type'],'varchar') OR strstr($table['Type'],'enum') OR strstr($table['Table'],'text')) {
$sql = "ALTER TABLE `" . $row['0'] . "` MODIFY `" . $table['Field'] . "` " . $table['Type'] . " CHARACTER SET " . $target_charset;
$charset_results = Dba::query($sql);
$charset_results = Dba::write($sql);
if (!$charset_results) {
debug_event('CHARSET','Unable to update the charset of ' . $table['Field'] . '.' . $table['Type'] . ' to ' . $target_charset,'3');
} // if it fails

View file

@ -550,7 +550,7 @@ class Query {
// First we need to get the SQL statement we are going to run
// This has to run against any possible filters (dependent on type)
$sql = self::get_sql();
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = array();
while ($data = Dba::fetch_assoc($db_results)) {

View file

@ -466,11 +466,11 @@ class Update {
// Alter the user table so that you can't have an ID beyond the
// range of the other tables which have to allow for -1
$sql = "ALTER TABLE `user` CHANGE `id` `id` INT ( 11 ) NOT NULL AUTO_INCREMENT";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now pull the access list users, alter table and then re-insert
$sql = "SELECT DISTINCT(`user`) FROM `access_list`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
// Build the new SQL
@ -479,17 +479,17 @@ class Update {
$username = Dba::escape($username);
$sql = "UPDATE `access_list` SET `user`='$user_id' WHERE `user`='$username'";
$update_results = Dba::query($sql);
$update_results = Dba::write($sql);
} // end while access_list
// Alter the table
$sql = "ALTER TABLE `access_list` CHANGE `user` `user` INT ( 11 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now pull flagged users, update and alter
$sql = "SELECT DISTINCT(`user`) FROM `flagged`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$username = $r['user'];
@ -497,18 +497,18 @@ class Update {
$username = Dba::escape($username);
$sql = "UPDATE `flagged` SET `user`='$user_id' WHERE `user`='$username'";
$update_results = Dba::query($sql);
$update_results = Dba::write($sql);
} // end while
// Alter the table
$sql = "ALTER TABLE `flagged` CHANGE `user` `user` INT ( 11 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now fix up the ip history
$sql = "SELECT DISTINCT(`user`) FROM `ip_history`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$username = $r['user'];
@ -516,17 +516,17 @@ class Update {
$username = Dba::escape($username);
$sql = "UPDATE `ip_history` SET `user`='$user_id' WHERE `user`='$username'";
$update_results = Dba::query($sql);
$update_results = Dba::write($sql);
} // end while
// Alter the table
$sql = "ALTER TABLE `ip_history` CHANGE `user` `user` INT ( 11 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now fix now playing
$sql = "SELECT DISTINCT(`user`) FROM `now_playing`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$username = $r['user'];
@ -534,17 +534,17 @@ class Update {
$username = Dba::escape($username);
$sql = "UPDATE `now_playing` SET `user`='$user_id' WHERE `user`='$username'";
$update_results = Dba::query($sql);
$update_results = Dba::write($sql);
} // end while
// Alter the table
$sql = "ALTER TABLE `now_playing` CHANGE `user` `user` INT ( 11 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now fix the playlist table
$sql = "SELECT DISTINCT(`user`) FROM `playlist`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$username = $r['user'];
@ -552,21 +552,21 @@ class Update {
$username = Dba::escape($username);
$sql = "UPDATE `playlist` SET `user`='$user_id' WHERE `user`='$username'";
$update_results = Dba::query($sql);
$update_results = Dba::write($sql);
} // end while
// Alter the table
$sql = "ALTER TABLE `playlist` CHANGE `user` `user` INT ( 11 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Drop unused table
$sql = "DROP TABLE `playlist_permission`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now fix the ratings table
$sql = "SELECT DISTINCT(`user`) FROM `ratings`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$username = $r['user'];
@ -574,20 +574,20 @@ class Update {
$username = Dba::escape($username);
$sql = "UPDATE `ratings` SET `user`='$user_id' WHERE `user`='$username'";
$update_results = Dba::query($sql);
$update_results = Dba::write($sql);
} // end while
$sql = "ALTER TABLE `ratings` CHANGE `user` `user` INT ( 11 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now work on the tag_map
$sql = "ALTER TABLE `tag_map` CHANGE `user_id` `user` INT ( 11 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now fix user preferences
$sql = "SELECT DISTINCT(`user`) FROM `user_preference`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$username = $r['user'];
@ -595,64 +595,64 @@ class Update {
$username = Dba::escape($username);
$sql = "UPDATE `user_preference` SET `user`='$user_id' WHERE `user`='$username'";
$update_results = Dba::query($sql);
$update_results = Dba::write($sql);
} // end while
// Alter the table
$sql = "ALTER TABLE `user_preference` CHANGE `user` `user` INT ( 11 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Add a date to the user_vote
$sql = "ALTER TABLE `user_vote` ADD `date` INT( 11 ) UNSIGNED NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Add the index for said field
$sql = "ALTER TABLE `user_vote` ADD INDEX(`date`)";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Add the thumb fields to album
$sql = "ALTER TABLE `album` ADD `thumb` TINYBLOB NULL ,ADD `thumb_mime` VARCHAR( 128 ) NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now add in the min_object_count preference and the random_method
$sql = "INSERT INTO `preferences` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES('min_object_count','1','Min Element Count','5','integer','interface')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "INSERT INTO `preferences` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES('random_method','default','Random Method','5','string','interface')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Delete old preference
$sql = "DELETE FROM `preferences` WHERE `name`='min_album_size'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Make Hash a non-required field and smaller
$sql = "ALTER TABLE `song` CHANGE `hash` `hash` VARCHAR ( 64 ) NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Make user access an int, nothing else
$sql = "UPDATE `user` SET `access`='100' WHERE `access`='admin'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `user` SET `access`='25' WHERE `access`='user'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `user` SET `access`='5' WHERE `access`='guest'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Alter the table
$sql = "ALTER TABLE `user` CHANGE `access` `access` TINYINT ( 4 ) UNSIGNED NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Add in Label and Catalog # and language
$sql = "ALTER TABLE `song_ext_data` ADD `label` VARCHAR ( 128 ) NULL, ADD `catalog_number` VARCHAR ( 128 ) NULL, ADD `language` VARCHAR ( 128 ) NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
/* Fix every users preferences */
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -676,7 +676,7 @@ class Update {
/* Add the offset_limit preference and remove it from the user table */
$sql = "INSERT INTO `preferences` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('offset_limit','50','Offset Limit','5','integer','interface')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','340002');
@ -694,22 +694,22 @@ class Update {
public static function update_340003() {
$sql = "ALTER TABLE `song` CHANGE `mode` `mode` ENUM( 'abr', 'vbr', 'cbr' ) NULL DEFAULT 'cbr'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `song` CHANGE `time` `time` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '0'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `song` CHANGE `rate` `rate` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `song` CHANGE `bitrate` `bitrate` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `song` CHANGE `track` `track` SMALLINT( 5 ) UNSIGNED NULL DEFAULT NULL ";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `user` CHANGE `disabled` `disabled` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "CREATE TABLE `album_data` (" .
"`album_id` INT( 11 ) UNSIGNED NOT NULL , " .
@ -719,11 +719,11 @@ class Update {
"`thumb_mime` VARCHAR( 64 ) NULL , " .
"UNIQUE ( `album_id` )" .
") ENGINE = MYISAM";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
/* Foreach the Albums and move the data into the new album_data table */
$sql = "SELECT * FROM album";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
while ($data = Dba::fetch_assoc($db_results)) {
$id = $data['id'];
@ -733,48 +733,48 @@ class Update {
$thumb_mime = Dba::escape($data['thumb_mime']);
$sql = "INSERT INTO `album_data` (`album_id`,`art`,`art_mime`,`thumb`,`thumb_mime`)" .
" VALUES ('$id','$art','$art_mime','$thumb','$thumb_mime')";
$insert_results = Dba::query($sql);
$insert_results = Dba::write($sql);
} // end while
$sql = "RENAME TABLE `song_ext_data` TO `song_data`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "RENAME TABLE `preferences` TO `preference`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "RENAME TABLE `ratings` TO `rating`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Go ahead and drop the art/thumb stuff
$sql = "ALTER TABLE `album` DROP `art`, DROP `art_mime`, DROP `thumb`, DROP `thumb_mime`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// We need to fix the user_vote table
$sql = "ALTER TABLE `user_vote` CHANGE `user` `user` INT( 11 ) UNSIGNED NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Remove offset limit from the user
$sql = "ALTER TABLE `user` DROP `offset_limit`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `rating` CHANGE `user_rating` `rating` ENUM( '-1', '0', '1', '2', '3', '4', '5' ) NOT NULL DEFAULT '0'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
/* Add the rate_limit preference */
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('rate_limit','8192','Rate Limit','100','integer','streaming')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
/* Add the playlist_method preference and remove it from the user table */
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('playlist_method','normal','Playlist Method','5','string','streaming')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `update_info` ADD UNIQUE (`key`)";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -797,21 +797,21 @@ class Update {
/* Alter the session.id so that it's 64 */
$sql = "ALTER TABLE `session` CHANGE `id` `id` VARCHAR( 64 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
/* Add Playlist Related Preferences */
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('playlist_add','append','Add Behavior','5','string','playlist')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Switch the existing preferences over to this new catagory
$sql = "UPDATE `preference` SET `catagory`='playlist' WHERE `name`='playlist_method' " .
" OR `name`='playlist_type'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Change the default value for playlist_method
$sql = "UPDATE `preference` SET `value`='normal' WHERE `name`='playlist_method'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Add in the shoutbox
$sql = "CREATE TABLE `user_shout` (`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , " .
@ -822,25 +822,25 @@ class Update {
"`object_id` INT( 11 ) UNSIGNED NOT NULL , " .
"`object_type` VARCHAR( 32 ) NOT NULL " .
") ENGINE = MYISAM";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `user_shout` ADD INDEX ( `sticky` )";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `user_shout` ADD INDEX ( `date` )";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `user_shout` ADD INDEX ( `user` )";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `now_playing` CHANGE `start_time` `expire` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "OPTIMIZE TABLE `album`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -863,31 +863,31 @@ class Update {
// Turn user_rating into a tinyint and call it score
$sql = "ALTER TABLE `rating` CHANGE `user_rating` `score` TINYINT( 4 ) UNSIGNED NOT NULL DEFAULT '0'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `preference` SET `catagory`='playlist' WHERE `name`='random_method'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('transcode','default','Transcoding','25','string','streaming')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
/* We need to check for playlist_method here because I fubar'd an earlier update */
$sql = "SELECT * FROM `preference` WHERE `name`='playlist_method'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
if (!Dba::num_rows($db_results)) {
/* Add the playlist_method preference and remove it from the user table */
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('playlist_method','default','Playlist Method','5','string','playlist')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
}
// Add in the object_type to the tmpplaylist data table so that we can have non-songs in there
$sql = "ALTER TABLE `tmp_playlist_data` ADD `object_type` VARCHAR( 32 ) NULL AFTER `tmp_playlist`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -909,7 +909,7 @@ class Update {
public static function update_340006() {
$sql = "DESCRIBE `album_data`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
if ($row['Field'] == 'art' AND $row['Type'] == 'blob') {
@ -918,15 +918,15 @@ class Update {
} // end while
if ($blob_needed) {
$sql = "ALTER TABLE `album_data` CHANGE `art` `art` MEDIUMBLOB NULL DEFAULT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
}
// No matter what remove that random method preference
$sql = "DELETE FROM `preference` WHERE `name`='random_method'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -950,7 +950,7 @@ class Update {
// Tweak the session table to handle larger session vars for my page-a-nation hotness
$sql = "ALTER TABLE `session` CHANGE `value` `value` LONGTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Create the new stream table where we will store stream SIDs
$sql = "CREATE TABLE `session_stream` ( " .
@ -961,15 +961,15 @@ class Update {
"`ip` INT( 11 ) UNSIGNED NULL , " .
"PRIMARY KEY ( `id` ) " .
") ENGINE = MYISAM";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Change the now playing to use stream session ids for its ID
$sql = "ALTER TABLE `now_playing` CHANGE `id` `id` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Now longer needed because of the new hotness
$sql = "ALTER TABLE `now_playing` DROP `session`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','340007');
@ -985,36 +985,36 @@ class Update {
public static function update_340008() {
$sql = "ALTER TABLE `playlist_data` CHANGE `song` `object_id` INT( 11 ) UNSIGNED NULL DEFAULT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `playlist_data` CHANGE `dyn_song` `dynamic_song` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `playlist_data` ADD `object_type` VARCHAR( 32 ) NOT NULL DEFAULT 'song' AFTER `object_id`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `playlist` ADD `genre` INT( 11 ) UNSIGNED NOT NULL AFTER `type`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "DELETE FROM `preference` WHERE `name`='allow_downsample_playback'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `preference` SET `description`='Transcode Bitrate' WHERE `name`='sample_rate'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Check for old tables and drop if found, seems like there was a glitch that caused them
// not to get droped.. *shrug*
$sql = "DROP TABLE IF EXISTS `preferences`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "DROP TABLE IF EXISTS `song_ext_data`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "DROP TABLE IF EXISTS `ratings`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -1035,13 +1035,13 @@ class Update {
public static function update_340009() {
$sql = "ALTER TABLE `album` ADD `disk` smallint(5) UNSIGNED DEFAULT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `album` ADD INDEX (`disk`)";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `access_list` ADD `dns` VARCHAR( 255 ) NOT NULL AFTER `end`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "CREATE TABLE `artist_data` (" .
"`artist_id` INT( 11 ) UNSIGNED NOT NULL ," .
@ -1051,7 +1051,7 @@ class Update {
"`thumb_mime` VARCHAR( 32 ) NOT NULL ," .
"`bio` TEXT NOT NULL , " .
"UNIQUE (`artist_id`) ) ENGINE = MYISAM";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','340009');
@ -1066,23 +1066,23 @@ class Update {
public static function update_340010() {
$sql = "UPDATE `preference` SET `catagory`='options' WHERE `name` LIKE 'localplay_%'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "DELETE FROM `preference` WHERE `name`='playlist_add'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `preference` SET `catagory`='plugins' WHERE (`name` LIKE 'mystrands_%' OR `name` LIKE 'lastfm_%') AND `catagory`='options'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `preference` SET `value`='default' WHERE `name`='playlist_method'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `preference` SET `description`='Localplay Config' WHERE `name`='localplay_level'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
/* Fix every users preferences */
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -1114,7 +1114,7 @@ class Update {
"`ip` INT( 11 ) UNSIGNED NULL , " .
"PRIMARY KEY ( `id` ) " .
") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','340011');
@ -1130,7 +1130,7 @@ class Update {
public static function update_340012() {
$sql = "ALTER TABLE `catalog` ADD `add_path` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER `path`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "CREATE TABLE `democratic` (`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ," .
"`name` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ," .
@ -1139,13 +1139,13 @@ class Update {
"`user` INT( 11 ) NOT NULL ," .
"`primary` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0'" .
") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `democratic` ADD INDEX (`primary`)";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `democratic` ADD INDEX (`level`)";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','340012');
@ -1162,16 +1162,16 @@ class Update {
$sql = "DELETE FROM `preference` WHERE `name`='localplay_mpd_hostname' OR `name`='localplay_mpd_port' " .
"OR `name`='direct_link' OR `name`='localplay_mpd_password' OR `name`='catalog_echo_count'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `preference` SET `description`='Localplay Access' WHERE `name`='localplay_level'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "UPDATE `access_list` SET `type`='rpc' WHERE `type`='xml-rpc'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -1195,16 +1195,16 @@ class Update {
public static function update_340014() {
$sql = "DROP TABLE `session_api`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `session` CHANGE `type` `type` ENUM ('mysql','ldap','http','api','xml-rpc') NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `session` ADD `agent` VARCHAR ( 255 ) NOT NULL AFTER `type`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `session` ADD INDEX (`type`)";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','340014');
@ -1221,14 +1221,14 @@ class Update {
public static function update_340015() {
$sql = "ALTER TABLE `playlist` DROP `date`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `playlist` ADD `date` INT ( 11 ) UNSIGNED NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Pull all of the rating information
$sql = "SELECT `id`,`rating` FROM `rating`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = array();
@ -1237,16 +1237,16 @@ class Update {
}
$sql = "ALTER TABLE `rating` DROP `rating`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `rating` ADD `rating` TINYINT ( 4 ) NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
foreach ($results as $row) {
$rating = Dba::escape($row['rating']);
$id = Dba::escape($row['id']);
$sql = "UPDATE `rating` SET `rating`='$rating' WHERE `id`='$id'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
}
self::set_version('db_version','340015');
@ -1263,7 +1263,7 @@ class Update {
public static function update_340016() {
$sql = "ALTER TABLE `democratic` ADD `base_playlist` INT ( 11 ) UNSIGNED NOT NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','340016');
@ -1279,16 +1279,16 @@ class Update {
public static function update_340017() {
$sql = "ALTER TABLE `democratic` ADD `base_playlist` INT( 11 ) UNSIGNED NOT NULL AFTER `name`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `tmp_playlist` DROP `base_playlist`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "DELETE FROM `tmp_playlist` WHERE `session`='-1'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "TRUNCATE `democratic`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','340017');
@ -1350,25 +1350,25 @@ class Update {
// Alter the charset for the entire database
$sql = "ALTER DATABASE `" . Config::get('database_name') . "` DEFAULT CHARACTER SET $target_charset COLLATE $target_collation";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "SHOW TABLES";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
// Go through the tables!
while ($row = Dba::fetch_row($db_results)) {
$sql = "DESCRIBE `" . $row['0'] . "`";
$describe_results = Dba::query($sql);
$describe_results = Dba::read($sql);
// Change the tables default charset and colliation
$sql = "ALTER TABLE `" . $row['0'] . "` DEFAULT CHARACTER SET $target_charset COLLATE $target_collation";
$alter_table = Dba::query($sql);
$alter_table = Dba::write($sql);
// Itterate through the columns of the table
while ($table = Dba::fetch_assoc($describe_results)) {
if (strstr($table['Type'],'varchar') OR strstr($table['Type'],'enum') OR strstr($table['Table'],'text')) {
$sql = "ALTER TABLE `" . $row['0'] . "` MODIFY `" . $table['Field'] . "` " . $table['Type'] . " CHARACTER SET " . $target_charset;
$charset_results = Dba::query($sql);
$charset_results = Dba::write($sql);
if (!$charset_results) {
debug_event('CHARSET','Unable to update the charset of ' . $table['Field'] . '.' . $table['Type'] . ' to ' . $target_charset,'3');
} // if it fails
@ -1391,19 +1391,19 @@ class Update {
public static function update_350001() {
$sql = "ALTER TABLE `tag_map` ADD `tag_id` INT ( 11 ) UNSIGNED NOT NULL AFTER `id`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "RENAME TABLE `tags` TO `tag`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `tag` CHANGE `map_id` `id` INT ( 11 ) UNSIGNED NOT NULL auto_increment";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `album` CHANGE `prefix` `prefix` VARCHAR ( 32 ) NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `artist` CHANGE `prefix` `prefix` VARCHAR ( 32 ) NULL";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
self::set_version('db_version','350001');
@ -1633,7 +1633,7 @@ class Update {
$db_results = Dba::write($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');
@ -1785,7 +1785,7 @@ class Update {
$db_results = Dba::write($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
User::fix_preferences('-1');

View file

@ -834,7 +834,7 @@ class User extends database_object {
/* Get All Preferences for the current user */
$sql = "SELECT * FROM `user_preference` WHERE `user`='$user_id'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = array();
@ -871,7 +871,7 @@ class User extends database_object {
if ($user_id != '-1') {
$sql .= " WHERE catagory !='system'";
}
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {

View file

@ -97,7 +97,7 @@ class vauth {
$expire = isset($_COOKIE[Config::get('session_name') . '_remember']) ? time() + Config::get('remember_length') : time() + Config::get('session_length');
$sql = "UPDATE `session` SET `value`='$value', `expire`='$expire' WHERE `id`='$key'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
debug_event('SESSION','Writing to ' . $key . ' with expire ' . $expire . ' ' . Dba::error(),'6');
@ -117,7 +117,7 @@ class vauth {
// Remove anything and EVERYTHING
$sql = "DELETE FROM `session` WHERE `id`='$key'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
debug_event('SESSION','Deleting Session with key:' . $key,'6');
@ -198,7 +198,7 @@ class vauth {
$key = Dba::escape($key);
$sql = "SELECT * FROM `session` WHERE `id`='$key' AND `expire` > '" . time() . "'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = Dba::fetch_assoc($db_results);
@ -285,7 +285,7 @@ class vauth {
/* Insert the row */
$sql = "INSERT INTO `session` (`id`,`username`,`ip`,`type`,`agent`,`value`,`expire`) " .
" VALUES ('$key','$username','$ip','$type','$agent','$value','$expire')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
if (!$db_results) {
debug_event('SESSION',"Session Creation Failed with Query: $sql and " . Dba::error(),'1');
@ -370,7 +370,7 @@ class vauth {
$ip = Dba::escape(inet_pton($data['ip']));
$agent = Dba::escape($data['agent']);
$sql = "SELECT * FROM `session_stream` WHERE `id`='$key' AND `expire` > '$time' AND `ip`='$ip' AND `agent`='$agent'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
if (Dba::num_rows($db_results)) {
return true;
@ -398,7 +398,7 @@ class vauth {
$expire = isset($_COOKIE[Config::get('session_name') . '_remember']) ? time() + Config::get('remember_length') : time() + Config::get('session_length');
$sql = "UPDATE `session` SET `expire`='$expire' WHERE `id`='$sid'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
debug_event('SESSION','Session:' . $sid . ' Has been Extended to ' . $expire,'6');
@ -526,11 +526,11 @@ class vauth {
// This has to still be here because lots of people use old_password in their config file
$sql = "SELECT `password` FROM `user` WHERE `username`='$username'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$row = Dba::fetch_assoc($db_results);
$sql = "SELECT version()";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$version = Dba::fetch_row($db_results);
$mysql_version = substr(preg_replace("/(\d+)\.(\d+)\.(\d+).*/","$1$2$3",$version[0]),0,3);
@ -539,7 +539,7 @@ class vauth {
}
$sql = "SELECT `username`,`id` FROM `user` WHERE `username`='$username' AND `password`=$password_check_sql";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = Dba::fetch_assoc($db_results);

View file

@ -52,7 +52,7 @@ class xmlRpcServer {
$sql = "SELECT `catalog`.`name`,COUNT(`song`.`id`) AS `count`,`catalog`.`id` AS `catalog_id` FROM `catalog` ".
"LEFT JOIN `song` ON `catalog`.`id`=`song`.`catalog` WHERE `catalog`.`catalog_type`='local' " .
"GROUP BY `catalog`.`id`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$results[] = $row;
@ -97,7 +97,7 @@ class xmlRpcServer {
// Get Catalogs first
$sql = "SELECT `catalog`.`id` FROM `catalog` WHERE `catalog`.`catalog_type`='local'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$where_sql .= "`song`.`catalog`='" . $row['id'] . "' OR";
@ -106,7 +106,7 @@ class xmlRpcServer {
$where_sql = rtrim($where_sql,'OR');
$sql = "SELECT `song`.`id` FROM `song` WHERE `song`.`enabled`='1' AND ($where_sql) LIMIT $start,$end";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$song = new Song($row['id']);
@ -146,7 +146,7 @@ class xmlRpcServer {
// Get Albums first
$sql = "SELECT `album`.`id` FROM `album` ";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
// Load the current album
@ -245,7 +245,7 @@ class xmlRpcServer {
// Run the query and return the key's for ACLs of type RPC that would match this IP
$sql = "SELECT * FROM `access_list` WHERE `type`='rpc' AND `start` <= '$ip' AND `end` >= '$ip'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {

View file

@ -54,7 +54,7 @@ function check_database($host,$username,$pass) {
function check_database_inserted($dbh,$db_name) {
$sql = "DESCRIBE session";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
if (!$db_results) {
return false;

View file

@ -29,7 +29,7 @@ function session_exists($sid,$xml_rpc=0) {
$found = true;
$sql = "SELECT * FROM `session` WHERE `id` = '$sid'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
if (!Dba::num_rows($db_results)) {
$found = false;
@ -81,7 +81,7 @@ function extend_session($sid) {
if ($_COOKIE['amp_longsess'] == '1') { $new_time = time() + 86400*364; }
$sql = "UPDATE `session` SET `expire`='$new_time' WHERE `id`='$sid'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
} // extend_session

View file

@ -35,7 +35,7 @@ function update_preferences($pref_id=0) {
/* If it isn't the System Account's preferences */
if ($pref_id != '-1') { $sql .= " WHERE `catagory` != 'system'"; }
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
// Collect the current possible keys
while ($r = Dba::fetch_assoc($db_results)) {
@ -105,7 +105,7 @@ function update_preference($user_id,$name,$pref_id,$value) {
/* Else make sure that the current users has the right to do this */
if (Preference::has_access($name)) {
$sql = "UPDATE `user_preference` SET `value`='$value' WHERE `preference`='$pref_id' AND `user`='$user_id'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return true;
}

View file

@ -447,7 +447,7 @@ function show_album_select($name='album',$album_id=0,$allow_add=0,$song_id=0) {
echo "<select name=\"$name\" id=\"$key\">\n";
$sql = "SELECT `id`, `name`, `prefix` FROM `album` ORDER BY `name`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
@ -485,7 +485,7 @@ function show_artist_select($name='artist', $artist_id=0, $allow_add=0, $song_id
echo "<select name=\"$name\" id=\"$key\">\n";
$sql = "SELECT `id`, `name`, `prefix` FROM `artist` ORDER BY `name`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
@ -516,7 +516,7 @@ function show_catalog_select($name='catalog',$catalog_id=0,$style='') {
echo "<select name=\"$name\" style=\"$style\">\n";
$sql = "SELECT `id`, `name` FROM `catalog` ORDER BY `name`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
@ -543,7 +543,7 @@ function show_user_select($name,$selected='',$style='') {
echo "\t<option value=\"\">" . _('All') . "</option>\n";
$sql = "SELECT `id`,`username`,`fullname` FROM `user` ORDER BY `fullname`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$select_txt = '';
@ -571,7 +571,7 @@ function show_playlist_select($name,$selected='',$style='') {
echo "\t<option value=\"\">" . _('None') . "</option>\n";
$sql = "SELECT `id`,`name` FROM `playlist` ORDER BY `name`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$select_txt = '';

View file

@ -73,7 +73,7 @@ class AmpacheHttpq extends localplay_controller {
public function is_installed() {
$sql = "DESCRIBE `localplay_httpq`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
return Dba::num_rows($db_results);
@ -94,7 +94,7 @@ class AmpacheHttpq extends localplay_controller {
"`password` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " .
"`access` SMALLINT( 4 ) UNSIGNED NOT NULL DEFAULT '0'" .
") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Add an internal preference for the users current active instance
Preference::insert('httpq_active','HTTPQ Active Instance','0','25','integer','internal');
@ -111,7 +111,7 @@ class AmpacheHttpq extends localplay_controller {
public function uninstall() {
$sql = "DROP TABLE `localplay_httpq`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Remove the pref we added for this
Preference::delete('httpq_active');
@ -145,7 +145,7 @@ class AmpacheHttpq extends localplay_controller {
$sql = "INSERT INTO `localplay_httpq` (`name`,`host`,`port`,`password`,`owner`) " .
"VALUES ('$name','$host','$port','$password','$user_id')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return $db_results;
@ -161,7 +161,7 @@ class AmpacheHttpq extends localplay_controller {
$uid = Dba::escape($uid);
$sql = "DELETE FROM `localplay_httpq` WHERE `id`='$uid'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return true;
@ -175,7 +175,7 @@ class AmpacheHttpq extends localplay_controller {
public function get_instances() {
$sql = "SELECT * FROM `localplay_httpq` ORDER BY `name`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = array();
@ -200,7 +200,7 @@ class AmpacheHttpq extends localplay_controller {
$pass = Dba::escape($data['password']);
$sql = "UPDATE `localplay_httpq` SET `host`='$host', `port`='$port', `name`='$name', `password`='$pass' WHERE `id`='$uid'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return true;
@ -232,7 +232,7 @@ class AmpacheHttpq extends localplay_controller {
$instance = Dba::escape($instance);
$sql = "SELECT * FROM `localplay_httpq` WHERE `id`='$instance'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$row = Dba::fetch_assoc($db_results);

View file

@ -72,7 +72,7 @@ class AmpacheMpd extends localplay_controller {
public function is_installed() {
$sql = "DESCRIBE `localplay_mpd`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
return Dba::num_rows($db_results);
@ -93,7 +93,7 @@ class AmpacheMpd extends localplay_controller {
"`password` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " .
"`access` SMALLINT( 4 ) UNSIGNED NOT NULL DEFAULT '0'" .
") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Add an internal preference for the users current active instance
Preference::insert('mpd_active','MPD Active Instance','0','25','integer','internal');
@ -110,7 +110,7 @@ class AmpacheMpd extends localplay_controller {
public function uninstall() {
$sql = "DROP TABLE `localplay_mpd`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
Preference::delete('mpd_active');
@ -142,7 +142,7 @@ class AmpacheMpd extends localplay_controller {
$sql = "INSERT INTO `localplay_mpd` (`name`,`host`,`port`,`password`,`owner`) " .
"VALUES ('$name','$host','$port','$password','$user_id')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return $db_results;
@ -158,7 +158,7 @@ class AmpacheMpd extends localplay_controller {
// Go ahead and delete this mofo!
$sql = "DELETE FROM `localplay_mpd` WHERE `id`='$uid'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return true;
@ -172,7 +172,7 @@ class AmpacheMpd extends localplay_controller {
public function get_instances() {
$sql = "SELECT * FROM `localplay_mpd` ORDER BY `name`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = array();
@ -195,7 +195,7 @@ class AmpacheMpd extends localplay_controller {
$instance = Dba::escape($instance);
$sql = "SELECT * FROM `localplay_mpd` WHERE `id`='$instance'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$row = Dba::fetch_assoc($db_results);
@ -216,7 +216,7 @@ class AmpacheMpd extends localplay_controller {
$pass = Dba::escape($data['password']);
$sql = "UPDATE `localplay_mpd` SET `host`='$host', `port`='$port', `name`='$name', `password`='$pass' WHERE `id`='$uid'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return true;

View file

@ -77,7 +77,7 @@ class AmpacheShoutCast extends localplay_controller {
public function is_installed() {
$sql = "DESCRIBE `localplay_shoutcast`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
return Dba::num_rows($db_results);
@ -98,7 +98,7 @@ class AmpacheShoutCast extends localplay_controller {
"`local_root` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL , " .
"`access` SMALLINT( 4 ) UNSIGNED NOT NULL DEFAULT '0'" .
") ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
// Add an internal preference for the users current active instance
Preference::insert('shoutcast_active','Shoutcast Active Instance','0','25','integer','internal');
@ -115,7 +115,7 @@ class AmpacheShoutCast extends localplay_controller {
public function uninstall() {
$sql = "DROP TABLE `localplay_shoutcast`";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
Preference::delete('shoutcast_active');
@ -147,7 +147,7 @@ class AmpacheShoutCast extends localplay_controller {
$sql = "INSERT INTO `localplay_shoutcast` (`name`,`pid`,`playlist`,`local_root`,`owner`) " .
"VALUES ('$name','$pid','$playlist','$local_root','$user_id')";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return $db_results;
@ -163,7 +163,7 @@ class AmpacheShoutCast extends localplay_controller {
// Go ahead and delete this mofo!
$sql = "DELETE FROM `localplay_shoutcast` WHERE `id`='$uid'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return true;
@ -177,7 +177,7 @@ class AmpacheShoutCast extends localplay_controller {
public function get_instances() {
$sql = "SELECT * FROM `localplay_shoutcast` ORDER BY `name`";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$results = array();
@ -200,7 +200,7 @@ class AmpacheShoutCast extends localplay_controller {
$instance = Dba::escape($instance);
$sql = "SELECT * FROM `localplay_shoutcast` WHERE `id`='$instance'";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
$row = Dba::fetch_assoc($db_results);
@ -221,7 +221,7 @@ class AmpacheShoutCast extends localplay_controller {
$local_root = Dba::escape($data['local_root']);
$sql = "UPDATE `localplay_shoutcast` SET `pid`='$pid', `playlist`='$playlist', `name`='$name', `local_root`='$local_root' WHERE `id`='$uid'";
$db_results = Dba::query($sql);
$db_results = Dba::write($sql);
return true;