summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-06-13 08:11:09 +0000
committerPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-06-13 08:11:09 +0000
commit4b5756ba9d8ee9e83c1ba4624b461b4746e49e82 (patch)
tree2e46772da9d25197fd847b273ca1f9b882ad3e34
parent93f4a26ab07207e1f9a8e716a82c5d8812d5344c (diff)
downloadampache-4b5756ba9d8ee9e83c1ba4624b461b4746e49e82.tar.gz
ampache-4b5756ba9d8ee9e83c1ba4624b461b4746e49e82.tar.bz2
ampache-4b5756ba9d8ee9e83c1ba4624b461b4746e49e82.zip
Miscellaneous cleanup.
-rw-r--r--image.php2
-rw-r--r--index.php2
-rw-r--r--lib/batch.lib.php9
-rw-r--r--lib/class/access.class.php8
-rw-r--r--lib/class/ajax.class.php15
-rw-r--r--lib/class/album.class.php34
-rw-r--r--lib/class/art.class.php13
-rw-r--r--lib/class/artist.class.php2
-rw-r--r--lib/class/browse.class.php1
-rw-r--r--lib/class/catalog.class.php7
-rw-r--r--lib/class/dba.class.php5
-rw-r--r--lib/class/query.class.php5
-rw-r--r--lib/class/rating.class.php30
-rw-r--r--lib/class/song.class.php26
-rw-r--r--lib/class/stream.class.php11
-rw-r--r--lib/class/tag.class.php20
-rw-r--r--lib/class/update.class.php5
-rw-r--r--lib/class/vainfo.class.php2
-rw-r--r--lib/class/vauth.class.php8
-rw-r--r--lib/debug.lib.php60
-rw-r--r--lib/gettext.php14
-rw-r--r--lib/init.php47
-rw-r--r--lib/install.php3
-rw-r--r--play/index.php3
-rw-r--r--server/ajax.server.php4
-rw-r--r--server/browse.ajax.php4
-rw-r--r--server/democratic.ajax.php4
-rw-r--r--server/flag.ajax.php4
-rw-r--r--server/index.ajax.php4
-rw-r--r--server/localplay.ajax.php4
-rw-r--r--server/playlist.ajax.php4
-rw-r--r--server/random.ajax.php4
-rw-r--r--server/song.ajax.php4
-rw-r--r--server/stats.ajax.php4
-rw-r--r--server/stream.ajax.php4
-rw-r--r--server/tag.ajax.php4
-rw-r--r--stream.php4
-rw-r--r--templates/footer.inc.php2
-rw-r--r--templates/rightbar.inc.php4
-rw-r--r--templates/show_album.inc.php7
-rw-r--r--templates/show_install.inc.php2
-rw-r--r--templates/show_install_account.inc.php2
-rw-r--r--templates/show_install_config.inc.php2
-rw-r--r--templates/show_install_lang.inc.php2
-rw-r--r--templates/sidebar_home.inc.php6
45 files changed, 231 insertions, 180 deletions
diff --git a/image.php b/image.php
index dfa581b7..19dd2959 100644
--- a/image.php
+++ b/image.php
@@ -41,7 +41,7 @@ if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')]) AN
if (!Config::get('resize_images')) { unset($_GET['thumb']); }
// FIXME: Legacy stuff - should be removed after a version or so
-if (!$_GET['object_type']) {
+if (!isset($_GET['object_type'])) {
$_GET['object_type'] = 'album';
}
diff --git a/index.php b/index.php
index d6cb7f7d..bbdcf727 100644
--- a/index.php
+++ b/index.php
@@ -24,7 +24,7 @@ require_once 'lib/init.php';
show_header();
-$action = scrub_in($_REQUEST['action']);
+$action = isset($_REQUEST['action']) ? scrub_in($_REQUEST['action']) : null;
/**
* Check for the refresh mojo, if it's there then require the
diff --git a/lib/batch.lib.php b/lib/batch.lib.php
index e79a55d0..088055fa 100644
--- a/lib/batch.lib.php
+++ b/lib/batch.lib.php
@@ -23,8 +23,7 @@
/**
* get_song_files
- * tmakes array of song ids and returns
- * array of path to actual files
+ * Takes an array of song ids and returns an array of the actual filenames
*/
function get_song_files($media_ids) {
@@ -57,13 +56,13 @@ function get_song_files($media_ids) {
*/
function send_zip( $name, $song_files ) {
- // Check if they want to save it to a file, if so then make sure they've got
- // a defined path as well and that it's writeable
+ // Check if they want to save it to a file, if so then make sure they've
+ // got a defined path as well and that it's writable.
if (Config::get('file_zip_download') && Config::get('file_zip_path')) {
// Check writeable
if (!is_writable(Config::get('file_zip_path'))) {
$in_memory = '1';
- debug_event('Error','File Zip Path:' . Config::get('file_zip_path') . ' is not writeable','1');
+ debug_event('Error','File Zip Path:' . Config::get('file_zip_path') . ' is not writable','1');
}
else {
$in_memory = '0';
diff --git a/lib/class/access.class.php b/lib/class/access.class.php
index 7f986fef..93bfbfd6 100644
--- a/lib/class/access.class.php
+++ b/lib/class/access.class.php
@@ -312,13 +312,15 @@ class Access {
/**
* check_access
- * This is the global 'has_access' function it can check for any 'type' of object
- * everything uses the global 0,5,25,50,75,100 stuff. GLOBALS['user'] is always used
+ * This is the global 'has_access' function it can check for any 'type'
+ * of object.
+ * Everything uses the global 0,5,25,50,75,100 stuff. GLOBALS['user'] is
+ * always used.
*/
public static function check($type,$level) {
if (Config::get('demo_mode')) { return true; }
- if (INSTALL == '1') { return true; }
+ if (defined('INSTALL')) { return true; }
$level = intval($level);
diff --git a/lib/class/ajax.class.php b/lib/class/ajax.class.php
index 38c451a9..b1e9997a 100644
--- a/lib/class/ajax.class.php
+++ b/lib/class/ajax.class.php
@@ -108,15 +108,14 @@ class Ajax {
// If they passed a span class
if ($class) {
- $class_txt = ' class="' . $class . '"';
+ $class = ' class="' . $class . '"';
}
-
$string = get_user_icon($icon,$alt);
// Generate a <a> so that it's more compliant with older browsers
// (ie :hover actions) and also to unify linkbuttons (w/o ajax) display
- $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class_txt>".$string."</a>\n";
+ $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class>".$string."</a>\n";
$string .= self::observe($source,'click',$ajax_string);
@@ -126,7 +125,7 @@ class Ajax {
/**
* text
- * This prints out the specified text as a link and setups the required
+ * This prints out the specified text as a link and sets up the required
* ajax for the link so it works correctly
*/
public static function text($action,$text,$source,$post='',$class='') {
@@ -136,11 +135,11 @@ class Ajax {
// If they passed a span class
if ($class) {
- $class_txt = ' class="' . $class . '"';
+ $class = ' class="' . $class . '"';
}
// If we pass a source put it in the ID
- $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class_txt>$text</a>\n";
+ $string = "<a href=\"javascript:void(0);\" id=\"$source\" $class>$text</a>\n";
$string .= self::observe($source,'click',$ajax_string);
@@ -177,7 +176,7 @@ class Ajax {
*/
public static function start_container($name) {
- if (AJAX_INCLUDE == '1' AND !self::$include_override) { return true; }
+ if (defined('AJAX_INCLUDE') && !self::$include_override) { return true; }
echo '<div id="' . scrub_out($name) . '">';
@@ -189,7 +188,7 @@ class Ajax {
*/
public static function end_container() {
- if (AJAX_INCLUDE == '1' AND !self::$include_override) { return true; }
+ if (defined('AJAX_INCLUDE') && !self::$include_override) { return true; }
echo "</div>";
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index cf00b309..b033bde4 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -30,12 +30,13 @@ class Album extends database_object {
/* Variables from DB */
public $id;
public $name;
- public $full_name; // Prefix + Name, genereated by format();
public $disk;
public $year;
public $prefix;
public $mbid; // MusicBrainz ID
+ public $full_name; // Prefix + Name, generated
+
// cached information
public $_songs=array();
@@ -58,7 +59,7 @@ class Album extends database_object {
$this->$key = $value;
}
- // Little bit of formating here
+ // Little bit of formatting here
$this->full_name = trim(trim($info['prefix']) . ' ' . trim($info['name']));
return true;
@@ -140,11 +141,16 @@ class Album extends database_object {
return parent::get_from_cache('album_extra',$this->id);
}
- $sql = "SELECT COUNT(DISTINCT(song.artist)) as artist_count,COUNT(song.id) AS song_count,artist.name AS artist_name" .
- ",artist.prefix AS artist_prefix, artist.id AS artist_id ".
- "FROM `song` " .
- "INNER JOIN `artist` ON `artist`.`id`=`song`.`artist` " .
- "WHERE `song`.`album`='$this->id' GROUP BY `song`.`album`";
+ $sql = "SELECT " .
+ "COUNT(DISTINCT(`song`.`artist`)) AS `artist_count`, " .
+ "COUNT(`song`.`id`) AS `song_count`, " .
+ "`artist`.`name` AS `artist_name`, " .
+ "`artist`.`prefix` AS `artist_prefix`, " .
+ "`artist`.`id` AS `artist_id` " .
+ "FROM `song` INNER JOIN `artist` " .
+ "ON `artist`.`id`=`song`.`artist` " .
+ "WHERE `song`.`album`='$this->id' " .
+ "GROUP BY `song`.`album`";
$db_results = Dba::read($sql);
$results = Dba::fetch_assoc($db_results);
@@ -170,12 +176,16 @@ class Album extends database_object {
$results = array();
+ $artist = Dba::escape($artist);
+
+ $sql = "SELECT `id` FROM `song` WHERE `album`='$this->id' ";
if ($artist) {
- $artist_sql = "AND `artist`='" . Dba::escape($artist) . "'";
+ $sql .= "AND `artist`='$artist'";
+ }
+ $sql .= "ORDER BY `track`, `title`";
+ if ($limit) {
+ $sql .= " LIMIT $limit";
}
-
- $sql = "SELECT `id` FROM `song` WHERE `album`='$this->id' $artist_sql ORDER BY `track`, `title`";
- if ($limit) { $sql .= " LIMIT $limit"; }
$db_results = Dba::read($sql);
while ($r = Dba::fetch_assoc($db_results)) {
@@ -228,7 +238,7 @@ class Album extends database_object {
$this->f_name_link .="</a>";
$this->f_link = $this->f_name_link;
- $this->f_title = $full_name;
+ $this->f_title = $this->full_name; // FIXME: Legacy?
if ($this->artist_count == '1') {
$artist = trim(trim($this->artist_prefix) . ' ' . trim($this->artist_name));
$this->f_artist_name = $artist;
diff --git a/lib/class/art.class.php b/lib/class/art.class.php
index ddb74539..6bf3a65b 100644
--- a/lib/class/art.class.php
+++ b/lib/class/art.class.php
@@ -55,7 +55,12 @@ class Art extends database_object {
* Called on creation of the class
*/
public static function _auto_init() {
- self::$enabled = make_bool($_SESSION['art_enabled']);
+ if (!isset($_SESSION['art_enabled'])) {
+ $_SESSION['art_enabled'] = (Config::get('bandwidth') > 25);
+ }
+ else {
+ self::$enabled = make_bool($_SESSION['art_enabled']);
+ }
}
/**
@@ -63,7 +68,7 @@ class Art extends database_object {
* Checks whether the user currently wants art
*/
public static function is_enabled() {
- if (self::$enabled || (Config::get('bandwidth') > 25)) {
+ if (self::$enabled) {
return true;
}
@@ -718,7 +723,7 @@ class Art extends database_object {
$arurl = $ar->getTargetId();
debug_event('mbz-gatherart', "Found URL AR: " . $arurl , '5');
foreach ($coverartsites as $casite) {
- if (strstr($arurl, $casite['domain'])) {
+ if (strpos($arurl, $casite['domain']) !== false) {
debug_event('mbz-gatherart', "Matched coverart site: " . $casite['name'], '5');
if (preg_match($casite['regexp'], $arurl, $matches) == 1) {
$num_found++;
@@ -1085,7 +1090,7 @@ class Art extends database_object {
$url = $coverart[$key];
// We need to check the URL for the /noimage/ stuff
- if (strstr($url,"/noimage/")) {
+ if (strpos($url,"/noimage/") !== false) {
debug_event('LastFM','Detected as noimage, skipped ' . $url,'3');
continue;
}
diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php
index 2520346c..f7638b94 100644
--- a/lib/class/artist.class.php
+++ b/lib/class/artist.class.php
@@ -227,7 +227,7 @@ class Artist extends database_object {
// If this is a fake object, we're done here
if ($this->_fake) { return true; }
- $this->f_name_link = "<a href=\"" . Config::get('web_path') . "/artists.php?action=show&amp;artist=" . $this->id . "\" title=\"" . $this->full_name . "\">" . $name . "</a>";
+ $this->f_name_link = "<a href=\"" . Config::get('web_path') . "/artists.php?action=show&amp;artist=" . $this->id . "\" title=\"" . $this->f_full_name . "\">" . $name . "</a>";
$this->f_link = Config::get('web_path') . '/artists.php?action=show&amp;artist=' . $this->id;
// Get the counts
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index 7b8a75d9..5feaefde 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -103,6 +103,7 @@ class Browse extends Query {
${$class_name} = new $class_name($id);
}
+ $match = '';
// Format any matches we have so we can show them to the masses
if ($filter_value = $this->get_filter('alpha_match')) {
$match = ' (' . $filter_value . ')';
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index ab147749..2b6577b3 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -459,7 +459,7 @@ class Catalog extends database_object {
}
// Correctly detect the slash we need to use here
- if (strstr($path,"/")) {
+ if (strpos($path,"/") !== false) {
$slash_type = '/';
}
else {
@@ -952,7 +952,10 @@ class Catalog extends database_object {
// Try the preferred filename, if that fails use folder.???
$preferred_filename = Config::get('album_art_preferred_filename');
- if (!$preferred_filename || strstr($preferred_filename,"%")) { $preferred_filename = "folder.$extension"; }
+ if (!$preferred_filename ||
+ strpos($preferred_filename, '%') !== false) {
+ $preferred_filename = "folder.$extension";
+ }
$file = "$dir/$preferred_filename";
if ($file_handle = fopen($file,"w")) {
diff --git a/lib/class/dba.class.php b/lib/class/dba.class.php
index dc19b7f0..4072f4b8 100644
--- a/lib/class/dba.class.php
+++ b/lib/class/dba.class.php
@@ -424,7 +424,10 @@ class Dba {
// 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')) {
+ if (
+ (strpos($table['Type'], 'varchar') !== false) ||
+ (strpos($table['Type'], 'enum') !== false) ||
+ (strpos($table['Table'],'text') !== false)) {
$sql = "ALTER TABLE `" . $row['0'] . "` MODIFY `" . $table['Field'] . "` " . $table['Type'] . " CHARACTER SET " . $target_charset;
$charset_results = Dba::write($sql);
if (!$charset_results) {
diff --git a/lib/class/query.class.php b/lib/class/query.class.php
index 8555b4a6..15af3cdd 100644
--- a/lib/class/query.class.php
+++ b/lib/class/query.class.php
@@ -145,6 +145,7 @@ class Query {
$this->reset_join();
$this->reset_select();
$this->reset_having();
+ $this->set_static_content(false);
$this->set_is_simple(false);
$this->set_start(0);
$this->set_offset(Config::get('offset_limit') ? Config::get('offset_limit') : '25');
@@ -219,7 +220,9 @@ class Query {
// Simple enough, but if we ever move this crap
// If we ever move this crap what?
- return $this->_state['filter'][$key];
+ return isset($this->_state['filter'][$key])
+ ? $this->_state['filter'][$key]
+ : false;
} // get_filter
diff --git a/lib/class/rating.class.php b/lib/class/rating.class.php
index 59efd43d..be0ee2f2 100644
--- a/lib/class/rating.class.php
+++ b/lib/class/rating.class.php
@@ -65,6 +65,8 @@ class Rating extends database_object {
if (!is_array($ids) OR !count($ids)) { return false; }
$user_id = intval($GLOBALS['user']->id);
+ $ratings = array();
+ $user_ratings = array();
$idlist = '(' . implode(',', $ids) . ')';
$sql = "SELECT `rating`, `object_id` FROM `rating` " .
@@ -73,7 +75,7 @@ class Rating extends database_object {
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
- $user[$row['object_id']] = $row['rating'];
+ $user_ratings[$row['object_id']] = $row['rating'];
}
$sql = "SELECT AVG(`rating`) as `rating`, `object_id` FROM " .
@@ -82,19 +84,26 @@ class Rating extends database_object {
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
- $rating[$row['object_id']] = $row['rating'];
+ $ratings[$row['object_id']] = $row['rating'];
}
foreach ($ids as $id) {
- parent::add_to_cache('rating_' . $type . '_user' . $user_id, $id, intval($user[$id]));
-
- if (!isset($rating[$id])) {
+ // First store the user-specific rating
+ if (!isset($user_ratings[$id])) {
$rating = 0;
}
else {
- $rating = round($rating[$id]['rating'], 1);
+ $rating = intval($user_ratings[$id]);
}
+ parent::add_to_cache('rating_' . $type . '_user' . $user_id, $id, $rating);
+ // Then store the average
+ if (!isset($ratings[$id])) {
+ $rating = 0;
+ }
+ else {
+ $rating = round($ratings[$id]['rating'], 1);
+ }
parent::add_to_cache('rating_' . $type . '_all', $id, $rating);
}
@@ -125,11 +134,14 @@ class Rating extends database_object {
"AND `object_id`='$id' AND `object_type`='$type'";
$db_results = Dba::read($sql);
- $results = Dba::fetch_assoc($db_results);
+ $rating = 0;
- parent::add_to_cache($key, $id, $results['rating']);
+ if ($results = Dba::fetch_assoc($db_results)) {
+ $rating = $results['rating'];
+ }
- return $results['rating'];
+ parent::add_to_cache($key, $id, $rating);
+ return $rating;
} // get_user_rating
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index ccc9ec4a..48ddd451 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -875,15 +875,16 @@ class Song extends database_object implements media {
$user_id = $GLOBALS['user']->id ? scrub_out($GLOBALS['user']->id) : '-1';
$type = $song->type;
- // Required for some versions of winamp that won't work if the stream doesn't end in
- // .ogg This will not break any properly working player, don't report this as a bug!
+ // Required for some versions of winamp that won't work if the
+ // stream doesn't end in .ogg This will not break any properly
+ // working player, don't report this as a bug!
if ($song->type == 'flac') { $type = 'ogg'; }
$song->format();
$song_name = rawurlencode($song->f_artist_full . " - " . $song->title . "." . $type);
- $url = Stream::get_base_url() . "oid=$song->id&uid=$user_id$session_string$ds_string&name=/$song_name";
+ $url = Stream::get_base_url() . "oid=$song->id&uid=$user_id&name=/$song_name";
return $url;
@@ -921,15 +922,14 @@ class Song extends database_object implements media {
*/
public static function get_recently_played($user_id='') {
+ $user_id = Dba::escape($user_id);
+
+ $sql = "SELECT `object_id`, `user`, `object_type`, `date` " .
+ "FROM `object_count` WHERE `object_type`='song' ";
if ($user_id) {
- $user_limit = " AND `object_count`.`user`='" . Dba::escape($user_id) . "'";
+ $sql .= "AND `user`='$user_id' ";
}
-
- $sql = "SELECT `object_count`.`object_id`,`object_count`.`user`,`object_count`.`object_type`, " .
- "`object_count`.`date` " .
- "FROM `object_count` " .
- "WHERE `object_type`='song'$user_limit " .
- "ORDER BY `object_count`.`date` DESC ";
+ $sql .= "ORDER BY `date` DESC ";
$db_results = Dba::read($sql);
$results = array();
@@ -946,17 +946,17 @@ class Song extends database_object implements media {
/**
* native_stream
- * This returns true/false if this can be nativly streamed
+ * This returns true/false if this can be natively streamed
*/
public function native_stream() {
- if ($this->_transcode) { return false; }
+ if ($this->_transcoded) { return false; }
$conf_var = 'transcode_' . $this->type;
$conf_type = 'transcode_' . $this->type . '_target';
if (Config::get($conf_var)) {
- $this->_transcode = true;
+ $this->_transcoded = true;
debug_event('auto_transcode','Transcoding to ' . $this->type,'5');
return false;
}
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 5deee98e..35f0f4a3 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -186,7 +186,7 @@ class Stream {
$db_results = Dba::write($sql);
foreach ($append_array as $append_agent) {
- if (strstr(strtoupper($agent),$append_agent)) {
+ if (strpos(strtoupper($agent), $append_agent) !== false) {
// We're done here jump ship!
return true;
}
@@ -828,14 +828,15 @@ class Stream {
/**
* run_playlist_method
- * This takes care of the different types of 'playlist methods' the reason this is here
- * is because it deals with streaming rather then playlist mojo. If something needs to happen
- * this will echo the javascript required to cause a reload of the iframe.
+ * This takes care of the different types of 'playlist methods'. The
+ * reason this is here is because it deals with streaming rather than
+ * playlist mojo. If something needs to happen this will echo the
+ * javascript required to cause a reload of the iframe.
*/
public static function run_playlist_method() {
// If this wasn't ajax included run away
- if (AJAX_INCLUDE != '1') { return false; }
+ if (!defined('AJAX_INCLUDE')) { return false; }
// If we're doin the flash magic then run away as well
if (Config::get('play_type') == 'xspf_player') { return false; }
diff --git a/lib/class/tag.class.php b/lib/class/tag.class.php
index 83548e36..52c6f539 100644
--- a/lib/class/tag.class.php
+++ b/lib/class/tag.class.php
@@ -99,8 +99,9 @@ class Tag extends database_object {
/**
* set_object
- * This assoicates the tag with a specified object, we try to get the data
- * from the map cache, otherwise I guess we'll just have to look it up
+ * This associates the tag with a specified object, we try to get the
+ * data from the map cache, otherwise I guess we'll just have to look it
+ * up.
*/
public function set_object($type,$object_id) {
@@ -114,7 +115,7 @@ class Tag extends database_object {
// If nothing is found, then go ahead and return false
if (!is_array($data) OR !count($data)) { return false; }
- $this->weight = $data[$this->id]['count'];
+ $this->weight = count($data[$this->id]['users']);
if (in_array($GLOBALS['user']->id,$data[$this->id]['users'])) {
$this->owner = $GLOBALS['user']->id;
@@ -164,14 +165,18 @@ class Tag extends database_object {
while ($row = Dba::fetch_assoc($db_results)) {
$tags[$row['object_id']][$row['tag_id']]['users'][] = $row['user'];
- $tags[$row['object_id']][$row['tag_id']]['count']++;
$tag_map[$row['object_id']] = array('id'=>$row['id'],'tag_id'=>$row['tag_id'],'user'=>$row['user'],'object_type'=>$type,'object_id'=>$row['object_id']);
}
- // Run through our origional ids as we want to cache NULL results
+ // Run through our original ids as we also want to cache NULL
+ // results
foreach ($ids as $id) {
- parent::add_to_cache('tag_top_' . $type,$id,$tags[$id]);
- parent::add_to_cache('tag_map_' . $type,$id,$tag_map[$id]);
+ if (!isset($tags[$id])) {
+ $tags[$id] = null;
+ $tag_map[$id] = null;
+ }
+ parent::add_to_cache('tag_top_' . $type, $id, $tags[$id]);
+ parent::add_to_cache('tag_map_' . $type, $id, $tag_map[$id]);
}
return true;
@@ -338,7 +343,6 @@ class Tag extends database_object {
while ($row = Dba::fetch_assoc($db_results)) {
$results[$row['tag_id']]['users'][] = $row['user'];
- $results[$row['tag_id']]['count']++;
}
parent::add_to_cache('tag_top_' . $type,$object_id,$results);
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index e86c20ef..2c24935e 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -1384,7 +1384,10 @@ class Update {
// 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')) {
+ if (
+ (strpos($table['Type'], 'varchar') !== false) ||
+ (strpos($table['Type'], 'enum') !== false) ||
+ strpos($table['Table'],'text') !== false) {
$sql = "ALTER TABLE `" . $row['0'] . "` MODIFY `" . $table['Field'] . "` " . $table['Type'] . " CHARACTER SET " . $target_charset;
$charset_results = Dba::write($sql);
if (!$charset_results) {
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php
index b93fad08..5e5b32c2 100644
--- a/lib/class/vainfo.class.php
+++ b/lib/class/vainfo.class.php
@@ -937,7 +937,7 @@ class vainfo {
$results = array();
// Correctly detect the slash we need to use here
- if (strstr($filename,"/")) {
+ if (strpos($filename, '/') !== false) {
$slash_type = '/';
}
else {
diff --git a/lib/class/vauth.class.php b/lib/class/vauth.class.php
index 0568026b..d69078b0 100644
--- a/lib/class/vauth.class.php
+++ b/lib/class/vauth.class.php
@@ -84,7 +84,7 @@ class vauth {
*/
public static function write($key, $value) {
- if (NO_SESSION_UPDATE == '1') { return true; }
+ if (defined('NO_SESSION_UPDATE')) { return true; }
$length = Config::get('session_length');
$value = Dba::escape($value);
@@ -168,7 +168,7 @@ class vauth {
// Do a quick check to see if this is an AJAXed logout request
// if so use the iframe to redirect
- if (AJAX_INCLUDE == '1') {
+ if (defined('AJAX_INCLUDE')) {
ob_end_clean();
ob_start();
@@ -455,7 +455,9 @@ class vauth {
public static function ungimp_ie() {
// If no https, no ungimpage required
- if ($_SERVER['HTTPS'] != 'on') { return true; }
+ if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'on') {
+ return true;
+ }
// Try to detect IE
$agent = trim($_SERVER['HTTP_USER_AGENT']);
diff --git a/lib/debug.lib.php b/lib/debug.lib.php
index 9347fed2..4464447e 100644
--- a/lib/debug.lib.php
+++ b/lib/debug.lib.php
@@ -163,20 +163,20 @@ function check_php_pcre() {
function check_config_values($conf) {
if (!$conf['database_hostname']) {
- return false;
- }
- if (!$conf['database_name']) {
- return false;
- }
- if (!$conf['database_username']) {
- return false;
- }
- if (!$conf['database_password']) {
- return false;
- }
- if (!$conf['session_length']) {
- return false;
- }
+ return false;
+ }
+ if (!$conf['database_name']) {
+ return false;
+ }
+ if (!$conf['database_username']) {
+ return false;
+ }
+ if (!$conf['database_password']) {
+ return false;
+ }
+ if (!$conf['session_length']) {
+ return false;
+ }
if (!$conf['session_name']) {
return false;
}
@@ -192,7 +192,7 @@ function check_config_values($conf) {
}
}
- return true;
+ return true;
} // check_config_values
@@ -311,35 +311,35 @@ function generate_config($current) {
/* Start building the new config file */
$distfile = Config::get('prefix') . '/config/ampache.cfg.php.dist';
- $handle = fopen($distfile,'r');
- $dist = fread($handle,filesize($distfile));
- fclose($handle);
+ $handle = fopen($distfile,'r');
+ $dist = fread($handle,filesize($distfile));
+ fclose($handle);
- $data = explode("\n",$dist);
+ $data = explode("\n",$dist);
- /* Run throught the lines and set our settings */
- foreach ($data as $line) {
+ /* Run throught the lines and set our settings */
+ foreach ($data as $line) {
- /* Attempt to pull out Key */
- if (preg_match("/^;?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$line,$matches)
+ /* Attempt to pull out Key */
+ if (preg_match("/^;?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$line,$matches)
|| preg_match("/^;?([\w\d]+)\s+=\s+[\']{1}(.*?)[\']{1}$/", $line, $matches)
- || preg_match("/^;?([\w\d]+)\s+=\s+[\'\"]{0}(.*)[\'\"]{0}$/",$line,$matches)) {
+ || preg_match("/^;?([\w\d]+)\s+=\s+[\'\"]{0}(.*)[\'\"]{0}$/",$line,$matches)) {
$key = $matches[1];
- $value = $matches[2];
+ $value = $matches[2];
- /* Put in the current value */
+ /* Put in the current value */
if ($key == 'config_version') {
$line = $key . ' = ' . $value;
}
- elseif (isset($current[$key])) {
- $line = $key . ' = "' . $current[$key] . '"';
- unset($current[$key]);
+ elseif (isset($current[$key])) {
+ $line = $key . ' = "' . $current[$key] . '"';
+ unset($current[$key]);
} // if set
} // if key
- $final .= $line . "\n";
+ $final .= $line . "\n";
} // end foreach line
diff --git a/lib/gettext.php b/lib/gettext.php
index 6c88b057..c73ad501 100644
--- a/lib/gettext.php
+++ b/lib/gettext.php
@@ -20,10 +20,10 @@
*/
-/*!
- @function load_gettext
- @discussion sets the local
-*/
+/**
+ * load_gettext
+ * Sets up our local gettext settings.
+ */
function load_gettext() {
/* If we have gettext */
if (function_exists('bindtextdomain')) {
@@ -57,9 +57,9 @@ function load_gettext() {
*/
function __($string,$subject,$replace) {
- $translated = _($string);
- $result = str_replace($subject,$replace,$translated);
- return $result;
+ $translated = _($string);
+ $result = str_replace($subject,$replace,$translated);
+ return $result;
} // __
diff --git a/lib/init.php b/lib/init.php
index 6b3fef8a..59f1ba4f 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -33,10 +33,8 @@ if (floatval(phpversion()) < 5) {
exit;
}
-error_reporting(E_ERROR); // Only show fatal errors in production
+error_reporting(E_ERROR); // Only show fatal errors in production
-// This makes this file nolonger need customization
-// the config file is in the same dir as this (init.php) file.
$ampache_path = dirname(__FILE__);
$prefix = realpath($ampache_path . "/../");
$configfile = "$prefix/config/ampache.cfg.php";
@@ -52,7 +50,7 @@ if (!function_exists('gettext')) {
Config::set('prefix',$prefix);
/*
- Check to see if this is Http or https
+ Check to see if this is http or https
*/
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$http_type = "https://";
@@ -62,18 +60,18 @@ else {
}
/*
- See if the Config File Exists if it doesn't
- then go ahead and move them over to the install
- script
+ Check to make sure the config file exists. If it doesn't then go ahead and send
+ them over to the install script.
*/
if (!file_exists($configfile)) {
- $path = preg_replace("/(.*)\/(\w+\.php)$/","\${1}", $_SERVER['PHP_SELF']);
+ $path = preg_replace("/(.*)\/(\w+\.php)$/","\${1}", $_SERVER['PHP_SELF']);
$link = $http_type . $_SERVER['HTTP_HOST'] . $path . "/install.php";
header ("Location: $link");
exit();
}
-// Use the built in PHP function, supress errors here so we can handle it properly
+// Use the built in PHP function, suppress errors here so we can handle it
+// properly below
$results = @parse_ini_file($configfile);
if (!count($results)) {
@@ -83,7 +81,7 @@ if (!count($results)) {
exit();
}
-/** Verify a few commonly removed PHP functions exist and re-direct to /test if not **/
+/** Verify a few commonly disabled PHP functions exist and re-direct to /test if not **/
if (!function_exists('hash') OR !function_exists('inet_pton') OR (strtoupper(substr(PHP_OS,0,3)) == 'WIN' AND floatval(phpversion()) < 5.3)) {
$path = preg_replace("/(.*)\/(\w+\.php)$/","\${1}", $_SERVER['PHP_SELF']);
$link = $http_type . $_SERVER['HTTP_HOST'] . $path . "/test.php";
@@ -153,9 +151,8 @@ $results = Preference::fix_preferences($results);
Config::set_by_array($results,1);
-// Modules (These are conditionaly included depending upon config values)
+// Modules (These are conditionally included depending upon config values)
if (Config::get('ratings')) {
- require_once $prefix . '/lib/class/rating.class.php';
require_once $prefix . '/lib/rating.lib.php';
}
@@ -169,20 +166,20 @@ if (substr($post_size,strlen($post_size)-1,strlen($post_size)) != 'M') {
ini_set('post_max_size','8M');
}
-if ($results['memory_limit'] < 24) {
+// In case the local setting is 0
+ini_set('session.gc_probability','5');
+
+if (! isset($results['memory_limit']) || $results['memory_limit'] < 24) {
$results['memory_limit'] = 24;
}
-// Incase the local setting is 0
-ini_set('session.gc_probability','5');
-
set_memory_limit($results['memory_limit']);
/**** END Set PHP Vars ****/
// If we want a session
-if (NO_SESSION != '1' AND Config::get('use_auth')) {
- /* Verify Their session */
+if (!defined('NO_SESSION') && Config::get('use_auth')) {
+ /* Verify their session */
if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')])) { vauth::logout($_COOKIE[Config::get('session_name')]); exit; }
// This actually is starting the session
@@ -191,7 +188,7 @@ if (NO_SESSION != '1' AND Config::get('use_auth')) {
/* Create the new user */
$GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']);
- /* If they user ID doesn't exist deny them */
+ /* If the user ID doesn't exist deny them */
if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; }
vauth::session_extend(session_id());
@@ -223,9 +220,9 @@ elseif (!Config::get('use_auth')) {
else {
$GLOBALS['user'] = new User($auth['username']);
$GLOBALS['user']->id = '-1';
- $GLOBALS['user']->username = $auth['username'];
- $GLOBALS['user']->fullname = $auth['fullname'];
- $GLOBALS['user']->access = $auth['access'];
+ $GLOBALS['user']->username = $auth['username'];
+ $GLOBALS['user']->fullname = $auth['fullname'];
+ $GLOBALS['user']->access = $auth['access'];
}
if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) { vauth::logout(session_id()); exit; }
$GLOBALS['user']->update_last_seen();
@@ -266,7 +263,7 @@ header ("Content-Type: text/html; charset=" . Config::get('site_charset'));
unset($array);
unset($results);
-/* Setup the flip class */
+/* Set up the flip class */
flip_class(array('odd','even'));
/* Check to see if we need to perform an update */
@@ -284,7 +281,7 @@ if (Config::get('debug')) {
error_reporting(E_ALL);
}
-// Merge GET then POST into REQUEST effectivly striping COOKIE without depending on
-// a PHP setting change to take affect
+// Merge GET then POST into REQUEST effectively stripping COOKIE without
+// depending on a PHP setting change for the effect
$_REQUEST = array_merge($_GET,$_POST);
?>
diff --git a/lib/install.php b/lib/install.php
index 655bb25d..5ba4d0d3 100644
--- a/lib/install.php
+++ b/lib/install.php
@@ -22,8 +22,7 @@
/**
* split_sql
- * splits up a standard SQL dump file into distinct
- * sql queryies
+ * splits up a standard SQL dump file into distinct sql queries
*/
function split_sql($sql) {
$sql = trim($sql);
diff --git a/play/index.php b/play/index.php
index 88e02b84..eb1b2d5a 100644
--- a/play/index.php
+++ b/play/index.php
@@ -304,7 +304,8 @@ if (Config::get('downsample_remote')) {
} // if downsample remote is enabled
// If they are downsampling, or if the song is not a native stream or it's non-local
-if ((Config::get('transcode') == 'always' || !$media->native_stream() || $not_local) && Config::get('transcode') != 'never') {
+if ((Config::get('transcode') == 'always' || !$media->native_stream() ||
+ isset($not_local)) && Config::get('transcode') != 'never') {
debug_event('Downsample','Starting Downsample {Transcode:' . Config::get('transcode') . '} {Native Stream:' . $media->native_stream() .'} {Not Local:' . $not_local . '}','5');
$fp = Stream::start_downsample($media,$lastid,$media_name,$start);
$media_name = $media->f_artist_full . " - " . $media->title . "." . $media->type;
diff --git a/server/ajax.server.php b/server/ajax.server.php
index ecba7026..631ca628 100644
--- a/server/ajax.server.php
+++ b/server/ajax.server.php
@@ -37,7 +37,9 @@ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
-switch ($_REQUEST['page']) {
+$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : null;
+
+switch ($page) {
case 'flag':
require_once Config::get('prefix') . '/server/flag.ajax.php';
exit;
diff --git a/server/browse.ajax.php b/server/browse.ajax.php
index f512329c..db8b002d 100644
--- a/server/browse.ajax.php
+++ b/server/browse.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
if (isset($_REQUEST['browse_id'])) {
$browse_id = $_REQUEST['browse_id'];
diff --git a/server/democratic.ajax.php b/server/democratic.ajax.php
index 1e257d5a..48fc6fd0 100644
--- a/server/democratic.ajax.php
+++ b/server/democratic.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
$democratic = Democratic::get_current_playlist();
$democratic->set_parent();
diff --git a/server/flag.ajax.php b/server/flag.ajax.php
index 4daccb5c..6573ebd4 100644
--- a/server/flag.ajax.php
+++ b/server/flag.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
case 'reject':
diff --git a/server/index.ajax.php b/server/index.ajax.php
index e84e5bf5..e1cbedff 100644
--- a/server/index.ajax.php
+++ b/server/index.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
case 'random_albums':
diff --git a/server/localplay.ajax.php b/server/localplay.ajax.php
index 8f289d72..c056539b 100644
--- a/server/localplay.ajax.php
+++ b/server/localplay.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
case 'set_instance':
diff --git a/server/playlist.ajax.php b/server/playlist.ajax.php
index 289e7f46..f22d9d0b 100644
--- a/server/playlist.ajax.php
+++ b/server/playlist.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
case 'delete_track':
diff --git a/server/random.ajax.php b/server/random.ajax.php
index 0bf340d5..180ae757 100644
--- a/server/random.ajax.php
+++ b/server/random.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
case 'album':
diff --git a/server/song.ajax.php b/server/song.ajax.php
index 14f354d2..00015954 100644
--- a/server/song.ajax.php
+++ b/server/song.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
case 'flip_state':
diff --git a/server/stats.ajax.php b/server/stats.ajax.php
index 3b824c5f..fdf8cf8a 100644
--- a/server/stats.ajax.php
+++ b/server/stats.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
default:
diff --git a/server/stream.ajax.php b/server/stream.ajax.php
index 01d6396f..c49d79d4 100644
--- a/server/stream.ajax.php
+++ b/server/stream.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
case 'set_play_type':
diff --git a/server/tag.ajax.php b/server/tag.ajax.php
index 7fd3febd..e7242dde 100644
--- a/server/tag.ajax.php
+++ b/server/tag.ajax.php
@@ -21,9 +21,9 @@
*/
/**
- * Sub-Ajax page, requires AJAX_INCLUDE as one
+ * Sub-Ajax page, requires AJAX_INCLUDE
*/
-if (AJAX_INCLUDE != '1') { exit; }
+if (!defined('AJAX_INCLUDE')) { exit; }
switch ($_REQUEST['action']) {
case 'show_add_tag':
diff --git a/stream.php b/stream.php
index 7e0ab8b3..193e69ba 100644
--- a/stream.php
+++ b/stream.php
@@ -164,7 +164,9 @@ switch ($_REQUEST['method']) {
/* Start the Stream */
debug_event('stream.php' , 'Stream Type: '.$stream_type.' Media IDs: '.$media_ids, '5');
$stream = new Stream($stream_type,$media_ids);
- $stream->add_urls($urls);
+ if (isset($urls)) {
+ $stream->add_urls($urls);
+ }
$stream->start();
} // end method switch
diff --git a/templates/footer.inc.php b/templates/footer.inc.php
index 8a0ac738..1c051cd3 100644
--- a/templates/footer.inc.php
+++ b/templates/footer.inc.php
@@ -22,7 +22,7 @@
*/
?>
<div style="clear:both;"></div>
-<?php if ($_SESSION['userdata']['password'] == 'old') {?>
+<?php if (isset($_SESSION['userdata']['password'])) {?>
<span class="fatalerror"><?php echo _('Using Old Password Encryption, Please Reset your Password'); ?></span>
<?php } ?>
</div> <!-- end id="content"-->
diff --git a/templates/rightbar.inc.php b/templates/rightbar.inc.php
index 55fcf26f..51f8d978 100644
--- a/templates/rightbar.inc.php
+++ b/templates/rightbar.inc.php
@@ -79,7 +79,7 @@
$objects = array();
//FIXME :: this is kludgy
- if (NO_SONGS != '1') {
+ if (!defined('NO_SONGS')) {
$objects = $GLOBALS['user']->playlist->get_items();
}
@@ -108,7 +108,7 @@
<?php } if (!count($objects)) { ?>
<li class="error"><?php echo _('Not Enough Data'); ?></li>
<?php } ?>
-<?php if ($truncated) { ?>
+<?php if (isset($truncated)) { ?>
<li class="<?php echo flip_class(); ?>">
<?php echo $truncated . ' ' . _('More'); ?>...
</li>
diff --git a/templates/show_album.inc.php b/templates/show_album.inc.php
index 928ffbb3..3c49a3d1 100644
--- a/templates/show_album.inc.php
+++ b/templates/show_album.inc.php
@@ -24,15 +24,16 @@ $web_path = Config::get('web_path');
$ajax_url = Config::get('ajax_url');
// Title for this album
+$title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')';
if ($album->disk) {
- $disk = "<span class=\"discnb disc" .$album->disk. "\">, " . _('Disk') . " " . $album->disk . "</span>";
+ $title .= "<span class=\"discnb disc" . $album->disk . "\">, " . _('Disk') . " " . $album->disk . "</span>";
}
-$title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')' . $disk .'&nbsp;-&nbsp;' . $album->f_artist_link;
+$title .= '&nbsp;-&nbsp;' . $album->f_artist_link;
?>
<?php show_box_top($title,'info-box'); ?>
<div class="album_art">
<?php
- if ($album_name != _('Unknown (Orphaned)')) {
+ if ($album->name != _('Unknown (Orphaned)')) {
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
$aa_url = $web_path . "/image.php?id=" . $album->id . "&amp;type=popup&amp;sid=" . session_id();
diff --git a/templates/show_install.inc.php b/templates/show_install.inc.php
index 250219f3..963267cc 100644
--- a/templates/show_install.inc.php
+++ b/templates/show_install.inc.php
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-if (INSTALL != '1') { exit; }
+if (!defined('INSTALL')) { exit; }
$prefix = realpath(dirname(__FILE__). "/../");
$dir = is_rtl($htmllang) ? 'rtl' : 'ltr';
?>
diff --git a/templates/show_install_account.inc.php b/templates/show_install_account.inc.php
index ef1a9676..826c88bd 100644
--- a/templates/show_install_account.inc.php
+++ b/templates/show_install_account.inc.php
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-if (INSTALL != '1') { exit; }
+if (!defined('INSTALL')) { exit; }
$prefix = realpath(dirname(__FILE__). "/../");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
diff --git a/templates/show_install_config.inc.php b/templates/show_install_config.inc.php
index ba4dd9af..bbf38e34 100644
--- a/templates/show_install_config.inc.php
+++ b/templates/show_install_config.inc.php
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-if (INSTALL != '1') { exit; }
+if (!defined('INSTALL')) { exit; }
$prefix = realpath(dirname(__FILE__). "/../");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
diff --git a/templates/show_install_lang.inc.php b/templates/show_install_lang.inc.php
index 581af634..803c41ac 100644
--- a/templates/show_install_lang.inc.php
+++ b/templates/show_install_lang.inc.php
@@ -21,7 +21,7 @@
*/
$prefix = realpath(dirname(__FILE__). "/../");
?>
-<?php if (INSTALL != '1') { exit; } ?>
+<?php if (!defined('INSTALL')) { exit; } ?>
<?php $results = 0; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $htmllang; ?>" lang="<?php echo $htmllang; ?>">
diff --git a/templates/sidebar_home.inc.php b/templates/sidebar_home.inc.php
index 3593fb50..b4fd1ec8 100644
--- a/templates/sidebar_home.inc.php
+++ b/templates/sidebar_home.inc.php
@@ -25,8 +25,10 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path');
<li><h4><?php echo _('Browse'); ?></h4>
<?php
// Build the selected dealie
- $text = scrub_in($_REQUEST['action']) . '_ac';
- ${$text} = ' selected="selected"';
+ if (isset($_REQUEST['action'])) {
+ $text = scrub_in($_REQUEST['action']) . '_ac';
+ ${$text} = ' selected="selected"';
+ }
?>
<ul class="sb3" id="sb_browse_bb">
<li id="sb_browse_bb_SongTitle"><a href="<?php echo $web_path; ?>/browse.php?action=song"><?php echo _('Song Titles'); ?></a></li>