diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-16 00:55:50 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-16 00:55:50 +0000 |
commit | 3a71b821a3e1c603d839ac467a13f51d98d588e8 (patch) | |
tree | 5b8d881254ce0958db8aec8983aca05cb314288e /lib | |
parent | a3362e3d3f7b31f27bcccb8b2384cfa9c0d219ac (diff) | |
download | ampache-3a71b821a3e1c603d839ac467a13f51d98d588e8.tar.gz ampache-3a71b821a3e1c603d839ac467a13f51d98d588e8.tar.bz2 ampache-3a71b821a3e1c603d839ac467a13f51d98d588e8.zip |
fixed amazon and fixed the test page to account for new read config
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/album.class.php | 45 | ||||
-rw-r--r-- | lib/debug.php | 87 | ||||
-rw-r--r-- | lib/general.lib.php | 7 |
3 files changed, 46 insertions, 93 deletions
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 /* |