summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-16 00:55:50 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-16 00:55:50 +0000
commit3a71b821a3e1c603d839ac467a13f51d98d588e8 (patch)
tree5b8d881254ce0958db8aec8983aca05cb314288e
parenta3362e3d3f7b31f27bcccb8b2384cfa9c0d219ac (diff)
downloadampache-3a71b821a3e1c603d839ac467a13f51d98d588e8.tar.gz
ampache-3a71b821a3e1c603d839ac467a13f51d98d588e8.tar.bz2
ampache-3a71b821a3e1c603d839ac467a13f51d98d588e8.zip
fixed amazon and fixed the test page to account for new read config
-rw-r--r--albums.php7
-rw-r--r--config/ampache.cfg.php.dist15
-rwxr-xr-xdocs/CHANGELOG5
-rw-r--r--lib/class/album.class.php45
-rw-r--r--lib/debug.php87
-rw-r--r--lib/general.lib.php7
-rw-r--r--modules/amazon/AmazonSearchEngine.class.php3
-rw-r--r--templates/show_album_art.inc.php2
-rw-r--r--templates/show_test.inc52
9 files changed, 80 insertions, 143 deletions
diff --git a/albums.php b/albums.php
index 4ea46dfc..5c1a6b4a 100644
--- a/albums.php
+++ b/albums.php
@@ -61,7 +61,7 @@ elseif (isset($album)) {
// Finds the Album art from amazon
elseif ($_REQUEST['action'] === 'find_art') {
- if (!$user->has_access('25')) { access_denied(); }
+ if (!$GLOBALS['user']->has_access('25')) { access_denied(); }
// csammis: In response to https://ampache.bountysource.com/Task.View?task_id=86,
// adding retry to album art searching. I hope my PHP style doesn't make vollmer cry,
@@ -70,7 +70,8 @@ elseif ($_REQUEST['action'] === 'find_art') {
// *NOTE* I knocked it up a notch with some more horrible code :S - Vollmer
/* Echo notice if no amazon token is found, but it's enabled */
- if (in_array('amazon',conf('album_art_order')) AND !conf('amazon_developer_key')) {
+
+ if (!conf('amazon_developer_key')) {
echo "<br /><div class=\"fatalerror\">" . _("Error") . ": " . _("No Amazon Developer Key set, amazon album art searching will not work") . "</div>";
}
@@ -101,7 +102,7 @@ elseif ($_REQUEST['action'] === 'find_art') {
include(conf('prefix') . '/templates/show_album_art.inc.php');
}
else {
- show_confirmation(_("Album Art Not Located"),_("Album Art could not be located at this time. This may be due to Amazon being busy, or the album not being present in their collection."),"/albums.php?action=show&amp;album=" . $album->id);
+ show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to Amazon being busy, or the album not being present in their collection.'),"/albums.php?action=show&amp;album=" . $album->id);
}
$albumname = $album->name;
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist
index d5344405..9635e530 100644
--- a/config/ampache.cfg.php.dist
+++ b/config/ampache.cfg.php.dist
@@ -47,8 +47,6 @@ local_length = 900
# This is the DOMAIN for the cookie that stores your session key
# this must be set to the domain of your host or you will not be
# able to log in make sure you including the leading .
-# This is not needed unless you are using libglue for more than one
-# website, and you are using SSO
# DEFAULT: ""
#sess_domain = .yourwebsite.com
@@ -65,19 +63,6 @@ sess_cookielife = 0
# DEFAULT: 0
sess_cookiesecure = 0
-# Path your copy of libglue (Included with Ampache)
-# Uncomment this if you have moved libglue to a non-standard location
-# DEFAULT: /libglue
-#libglue_path = "/libglue"
-
-# Pre-Defined Error messages
-# you should not need to edit these
-empty_field = "You left one or more fields empty. Please enter both your username and password to log in."
-bad_auth_cred = "Unable to authenticate using this service: This is most likely a configuration mistake by the site administrator."
-user_not_found = "Username not found."
-login_failed = "Bad username or password."
-connect_error = "Could not connect to authentication server."
-
####################
# The conf vars! #
####################
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index a1cfabb7..c80a1395 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,11 @@
--------------------------------------------------------------------------
v.3.3.2-Beta2
+ - Fixed lack of default amazon web url which prevented searching
+ from working at all if you had not updated yoru config
+ file
+ - Fixed read_config so that it loads faster, removed ~1500
+ preg_match calls per page (Thx XGizzmo)
- Rewrote entire Flag method, this includes the edit functionality
- Fixed play selected on playlists, it no longer always plays
everything.
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index 22abcfda..f6bb6c43 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -422,34 +422,35 @@ class Album {
// No coverurl specified search amazon
if (empty($coverurl)) {
- if (empty($keywords)) {
-
- $keywords = $this->name;
- /* If this isn't a various album combine with artist name */
- if ($this->artist_count == '1') { $keywords .= ' ' . $this->artist; }
- }
- /* Create Base Vars */
- $amazon_base_urls = array();
-
- /* Attempt to retrive the album art order */
- $config_value = conf('amazon_base_urls');
-
- /* If it's not set */
- if (empty($config_value)) {
- /* do nothing for now */
- }
- elseif (!is_array($config_value)) {
- array_push($amazon_base_urls,$config_value);
- }
- else {
- $amazon_base_urls = array_merge($amazon_base_urls, conf('amazon_base_urls'));
- }
+ if (empty($keywords)) {
+ $keywords = $this->name;
+ /* If this isn't a various album combine with artist name */
+ if ($this->artist_count == '1') { $keywords .= ' ' . $this->artist; }
+ }
+
+ /* Create Base Vars */
+ $amazon_base_urls = array();
+
+ /* Attempt to retrive the album art order */
+ $config_value = conf('amazon_base_urls');
+
+ /* If it's not set */
+ if (empty($config_value)) {
+ $amazon_base_urls = array('http://webservices.amazon.com');
+ }
+ elseif (!is_array($config_value)) {
+ array_push($amazon_base_urls,$config_value);
+ }
+ else {
+ $amazon_base_urls = array_merge($amazon_base_urls, conf('amazon_base_urls'));
+ }
/* Foreach through the base urls that we should check */
foreach ($amazon_base_urls AS $amazon_base) {
// Create the Search Object
$amazon = new AmazonSearch(conf('amazon_developer_key'), $amazon_base);
+ $search_results = array();
/* Setup the needed variables */
$max_pages_to_search = max(conf('max_amazon_results_pages'),$amazon->_default_results_pages);
diff --git a/lib/debug.php b/lib/debug.php
index 8d24d54d..45531457 100644
--- a/lib/debug.php
+++ b/lib/debug.php
@@ -170,21 +170,30 @@ function check_php_iconv() {
*/
function check_config_values($conf) {
- if (!$conf['libglue']['local_host']) {
+ if (!$conf['local_host']) {
return false;
}
- if (!$conf['libglue']['local_db']) {
+ if (!$conf['local_db']) {
return false;
}
- if (!$conf['libglue']['local_username']) {
+ if (!$conf['local_username']) {
return false;
}
- if (!$conf['libglue']['local_pass']) {
+ if (!$conf['local_pass']) {
return false;
}
- if (!$conf['libglue']['local_length']) {
+ if (!$conf['local_length']) {
return false;
}
+ if (!$conf['sess_name']) {
+ return false;
+ }
+ if (!isset($conf['sess_cookielife'])) {
+ return false;
+ }
+ if (!isset($conf['sess_cookiesecure'])) {
+ return false;
+ }
return true;
@@ -197,7 +206,6 @@ function check_config_values($conf) {
*/
function show_compare_config($prefix) {
-
// Live Config File
$live_config = $prefix . "/config/ampache.cfg.php";
@@ -225,58 +233,17 @@ function debug_read_config($config_file,$debug) {
$data = explode("\n",$file_data);
if($debug) echo "<pre>";
$count = 0;
+
+ $results = array();
foreach($data as $value) {
$count++;
$value = trim($value);
-
- if (preg_match("/^\[([A-Za-z]+)\]$/",$value,$matches)) {
- // If we have previous data put it into $results...
- if (isset($config_name) && isset(${$config_name}) && count(${$config_name})) {
- $results[$config_name] = ${$config_name};
- }
-
- $config_name = $matches[1];
-
- } // if it is a [section] name
+
+ if (substr($value,0,1) == '#') { continue; }
-
- elseif (isset($config_name)) {
-
- // if it's not a comment
- if (preg_match("/^#?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$value,$matches)
- || preg_match("/^#?([\w\d]+)\s+=\s+[\']{1}(.*?)[\']{1}$/", $value, $matches)
- || preg_match("/^#?([\w\d]+)\s+=\s+[\'\"]{0}(.*)[\'\"]{0}$/",$value,$matches)) {
-
- if (isset(${$config_name}[$matches[1]]) && is_array(${$config_name}[$matches[1]]) && isset($matches[2]) ) {
- if($debug) echo "Adding value <strong>$matches[2]</strong> to existing key <strong>$matches[1]</strong>\n";
- array_push(${$config_name}[$matches[1]], $matches[2]);
- }
-
- elseif (isset(${$config_name}[$matches[1]]) && isset($matches[2]) ) {
- if($debug) echo "Adding value <strong>$matches[2]</strong> to existing key $matches[1]</strong>\n";
- ${$config_name}[$matches[1]] = array(${$config_name}[$matches[1]],$matches[2]);
- }
-
- elseif ($matches[2] !== "") {
- if($debug) echo "Adding value <strong>$matches[2]</strong> for key <strong>$matches[1]</strong>\n";
- ${$config_name}[$matches[1]] = $matches[2];
- }
-
- // if there is something there and it's not a comment
- elseif ($value{0} !== "#" AND strlen(trim($value)) > 0 AND !$test AND strlen($matches[2]) > 0) {
- echo "Error Invalid Config Entry --> Line:$count"; return false;
- } // elseif it's not a comment and there is something there
-
- else {
- if($debug) echo "Key <strong>$matches[1]</strong> defined, but no value set\n";
- }
- } // end if it's not a comment
-
- } // elseif no config_name
-
- elseif (preg_match("/^#?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$value,$matches)
+ if (preg_match("/^#?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$value,$matches)
|| preg_match("/^#?([\w\d]+)\s+=\s+[\']{1}(.*?)[\']{1}$/", $value, $matches)
|| preg_match("/^#?([\w\d]+)\s+=\s+[\'\"]{0}(.*)[\'\"]{0}$/",$value,$matches)) {
@@ -334,25 +301,15 @@ function debug_compare_configs($config,$dist_config) {
$dist_results = debug_read_config($dist_config,0);
$missing = array();
- if (!count($dist_results['conf'])) { $dist_results['conf'] = array(); }
- if (!count($dist_results['libglue'])) { $dist_results['libglue'] = array(); }
- foreach ($dist_results['conf'] as $key=>$value) {
+ foreach ($dist_results as $key=>$value) {
- if (!isset($results['conf'][$key])) {
- $missing['conf'][$key] = $value;
+ if (!isset($results[$key])) {
+ $missing[$key] = $value;
}
} // end foreach conf
- foreach ($dist_results['libglue'] as $key=>$value) {
-
- if (!isset($results['libglue'][$key])) {
- $missing['libglue'][$key] = $value;
- }
-
- } // end foreach libglue
-
return $missing;
} // debug_compare_configs
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 7eae2960..42419bce 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -151,15 +151,10 @@ function read_config($config_file, $debug=0, $test=0) {
} // foreach
- if (isset($config_name) && isset(${$config_name}) && count(${$config_name})) {
- $results[$config_name] = ${$config_name};
- }
-
- if($debug) echo "</pre>";
+ if ($debug) { echo "</pre>\n"; }
return $results;
-
} // read_config
/*
diff --git a/modules/amazon/AmazonSearchEngine.class.php b/modules/amazon/AmazonSearchEngine.class.php
index a7701555..476468c2 100644
--- a/modules/amazon/AmazonSearchEngine.class.php
+++ b/modules/amazon/AmazonSearchEngine.class.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2005 Ampache.org
+ Copyright (c) 2001 - 2006 Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -47,7 +47,6 @@ class AmazonSearch {
var $_default_results_pages=1;
function AmazonSearch($token, $base_url_param = '', $associates_id = 'none') {
- // log_event($GLOBALS['user']->username,'amazon-search-results',"base_url_param='$base_url_param'");
if($base_url_param != ''){$this->base_url = $base_url_param . $this->url_suffix;
if (conf('debug')) {
diff --git a/templates/show_album_art.inc.php b/templates/show_album_art.inc.php
index e65339a6..c950ebdc 100644
--- a/templates/show_album_art.inc.php
+++ b/templates/show_album_art.inc.php
@@ -41,7 +41,7 @@ while ($i <= $rows) {
<img src="<?php echo scrub_out($images[$key]['url']); ?>" border="0" height="175" width="175" /><br />
</a>
<p align="center">
- [<a href="<?php echo conf('web_path'); ?>/albums.php?action=select_art&amp;image=<?php echo $i; ?>&amp;album_id=<?php echo urlencode($_REQUEST['album_id']); ?>">Select</a>]
+ [<a href="<?php echo conf('web_path'); ?>/albums.php?action=select_art&amp;image=<?php echo $key; ?>&amp;album_id=<?php echo urlencode($_REQUEST['album_id']); ?>">Select</a>]
</p>
</td>
<?php
diff --git a/templates/show_test.inc b/templates/show_test.inc
index 569dcc35..e1f08610 100644
--- a/templates/show_test.inc
+++ b/templates/show_test.inc
@@ -29,19 +29,19 @@ $row_classes = array('even','odd');
<title>Ampache -- Debug Page</title>
</head>
<body bgcolor="#f0f0f0">
-<h2><?php echo _("Ampache Debug"); ?></h2>
-<p><?php echo _("You've reached this page because a configuration error has occured. Debug Information below"); ?></p>
+<h2><?php echo _('Ampache Debug'); ?></h2>
+<p><?php echo _('You\'ve reached this page because a configuration error has occured. Debug Information below'); ?></p>
<table border="0" cellpadding="3" cellspacing="0">
<tr>
- <td><font size="+1"><?php echo _("CHECK"); ?></font></td>
+ <td><font size="+1"><?php echo _('CHECK'); ?></font></td>
<td>
- <font size="+1"><?php echo _("STATUS"); ?></font>
+ <font size="+1"><?php echo _('STATUS'); ?></font>
</td>
- <td><font size="+1"><?php echo _("DESCRIPTION"); ?></font></td>
+ <td><font size="+1"><?php echo _('DESCRIPTION'); ?></font></td>
</tr>
<tr>
- <td valign="top"><?php echo _("PHP Version"); ?></td>
+ <td valign="top"><?php echo _('PHP Version'); ?></td>
<td valign="top">[
<?
if (!check_php_ver()) {
@@ -56,11 +56,11 @@ $row_classes = array('even','odd');
]
</td>
<td>
- <?php echo _("This tests to make sure that you are running a version of PHP that is known to work with Ampache."); ?>
+ <?php echo _('This tests to make sure that you are running a version of PHP that is known to work with Ampache.'); ?>
</td>
</tr>
<tr>
- <td valign="top"><?php echo _("Mysql for PHP"); ?></td>
+ <td valign="top"><?php echo _('Mysql for PHP'); ?></td>
<td valign="top">[
<?
if (!check_php_mysql()) {
@@ -75,11 +75,11 @@ $row_classes = array('even','odd');
]
</td>
<td>
- <?php echo _("This test checks to see if you have the mysql extensions loaded for PHP. These are required for Ampache to work."); ?>
+ <?php echo _('This test checks to see if you have the mysql extensions loaded for PHP. These are required for Ampache to work.'); ?>
</td>
</tr>
<tr>
- <td valign="top"><?php echo _("PHP Session Support"); ?></td>
+ <td valign="top"><?php echo _('PHP Session Support'); ?></td>
<td valign="top">[
<?
if (!check_php_session()) {
@@ -94,12 +94,12 @@ $row_classes = array('even','odd');
]
</td>
<td>
- <?php echo _("This test checks to make sure that you have PHP session support enabled. Sessions are required for Ampache to work."); ?>
+ <?php echo _('This test checks to make sure that you have PHP session support enabled. Sessions are required for Ampache to work.'); ?>
</td>
</tr>
<tr>
- <td valing="top"><?php echo _("PHP ICONV Support"); ?></td>
- <td valing="top">[
+ <td valign="top"><?php echo _('PHP ICONV Support'); ?></td>
+ <td valign="top">[
<?
if (!check_php_iconv()) {
$status['iconv_php'] = 'false';
@@ -112,11 +112,11 @@ $row_classes = array('even','odd');
?>]
</td>
<td>
- <?php echo _("This test checks to make sure you have Iconv support installed. Iconv support is not required for Ampache, but it is highly recommended"); ?>
+ <?php echo _('This test checks to make sure you have Iconv support installed. Iconv support is not required for Ampache, but it is highly recommended'); ?>
</td>
</tr>
<tr>
- <td valign="top"><?php echo _("Ampache.cfg.php Exists"); ?></td>
+ <td valign="top"><?php echo _('Ampache.cfg.php Exists'); ?></td>
<td valign="top">[
<?
if (!read_config_file($configfile)) {
@@ -131,13 +131,13 @@ $row_classes = array('even','odd');
]
</td>
<td width="350px">
- <?php echo _("This attempts to read /config/ampache.cfg.php If this fails either the ampache.cfg.php is not in the correct locations or
- it is not currently readable by your webserver."); ?>
+ <?php echo _('This attempts to read /config/ampache.cfg.php If this fails either the ampache.cfg.php is not in the correct locations or
+ it is not currently readable by your webserver.'); ?>
</td>
</tr>
<tr>
<td valign="top">
- <?php echo _("Ampache.cfg.php Configured?"); ?>
+ <?php echo _('Ampache.cfg.php Configured?'); ?>
</td>
<td valign="top">[
<?
@@ -178,15 +178,9 @@ $row_classes = array('even','odd');
</td>
<td>
<?php if (count($difference)) {
- if (!count($difference['conf'])) { $difference['conf'] = array(); }
- if (!count($difference['libglue'])) { $difference['libglue'] = array(); }
- echo _("Ampache.cfg.php is missing the following:");
- echo "<br />" . _("Under CONF") . "<br /><dl>\n";
- foreach ($difference['conf'] as $key=>$value) {
- echo "\t<dd>$key = \"$value\"</dd>\n";
- }
- echo "</dl>\n<br />" . _("Under LIBGLUE") . "<br /><dl>\n";
- foreach ($difference['libglue'] as $key=>$value) {
+ echo _('Ampache.cfg.php is missing the following:');
+ echo "<br /><dl>\n";
+ foreach ($difference as $key=>$value) {
echo "\t<dd>$key = \"$value\"</dd>\n";
}
echo "</dl><br />\n";
@@ -199,7 +193,7 @@ $row_classes = array('even','odd');
<td valign="top"><?php echo _("DB Connection"); ?></td>
<td valign="top">[
<?
- $db = check_database($results['libglue']['local_host'], $results['libglue']['local_username'], $results['libglue']['local_pass'],$results['libglue']['local_db']);
+ $db = check_database($results['local_host'], $results['local_username'], $results['local_pass'],$results['local_db']);
if (!$db) {
$status['check_db'] = 'false';
echo " <font color=\"red\">ERROR</font> ";
@@ -219,7 +213,7 @@ $row_classes = array('even','odd');
<td valign="top">DB Inserted</td>
<td valign="top">[
<?
- $db_inserted = check_database_inserted($db,$results['libglue']['local_db']);
+ $db_inserted = check_database_inserted($db,$results['local_db']);
if (!$db_inserted) {
$status['check_db_insert'] = 'false';
echo " <font color=\"red\">ERROR</font> ";