From 71f0c05034660f97f92b07f3c39295c861427a47 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Thu, 21 Jun 2007 07:33:35 +0000 Subject: fixed the debug page --- lib/debug.lib.php | 57 +++++----- templates/show_test.inc | 269 ------------------------------------------- templates/show_test.inc.php | 271 ++++++++++++++++++++++++++++++++++++++++++++ test.php | 7 +- 4 files changed, 305 insertions(+), 299 deletions(-) delete mode 100644 templates/show_test.inc create mode 100644 templates/show_test.inc.php diff --git a/lib/debug.lib.php b/lib/debug.lib.php index 9f7f1c59..b2969815 100644 --- a/lib/debug.lib.php +++ b/lib/debug.lib.php @@ -47,22 +47,21 @@ function check_database($host,$username,$pass) { } // check_database -/*! - @function check_database_inserted - @discussion checks to make sure that you - have inserted the database and that the user - you are using has access to it -*/ +/** + * check_database_inserted + * checks to make sure that you have inserted the database + * and that the user you are using has access to it + */ function check_database_inserted($dbh,$db_name) { + $sql = "DESCRIBE session"; + $db_results = Dba::query($sql); - if (!@mysql_select_db($db_name,$dbh)) { - return false; - } + if (!$db_results) { + return false; + } - $sql = "DESCRIBE session"; - $db_results = @mysql_query($sql, $dbh); - if (!@mysql_num_rows($db_results)) { + if (!Dba::num_rows($db_results)) { return false; } @@ -70,11 +69,11 @@ function check_database_inserted($dbh,$db_name) { } // check_database_inserted -/*! - @function check_php_ver - @discussion checks the php version and makes - sure that it's good enough -*/ +/** + * check_php_ver + * checks the php version and makes + * sure that it's good enough + */ function check_php_ver($level=0) { if (strcmp('5.0.0',phpversion()) > 0) { @@ -85,10 +84,10 @@ function check_php_ver($level=0) { } // check_php_ver -/*! - @function check_php_mysql - @discussion checks for mysql support -*/ +/** + * check_php_mysql + * checks for mysql support by looking for the mysql_query function + */ function check_php_mysql() { if (!function_exists('mysql_query')) { @@ -99,10 +98,10 @@ function check_php_mysql() { } // check_php_mysql -/*! - @function check_php_session - @discussion checks to make sure the needed functions - for sessions exist +/** + * check_php_session + * checks to make sure the needed functions + * for sessions exist */ function check_php_session() { @@ -114,10 +113,10 @@ function check_php_session() { } // check_php_session -/*! - @function check_php_iconv - @discussion checks to see if you have iconv installed -*/ +/** + * check_php_iconv + * checks to see if you have iconv installed + */ function check_php_iconv() { if (!function_exists('iconv')) { diff --git a/templates/show_test.inc b/templates/show_test.inc deleted file mode 100644 index 2ae2d10e..00000000 --- a/templates/show_test.inc +++ /dev/null @@ -1,269 +0,0 @@ - - - - - -Ampache -- Debug Page - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
[ - ERROR "; - } - else { - $status['php_ver'] = 'true'; - echo "    OK     "; - } - ?> - ] - - -
[ - ERROR "; - } - else { - $status['mysql_php'] = 'true'; - echo "    OK     "; - } - ?> - ] - - -
[ - ERROR "; - } - else { - $status['session_php'] = 'true'; - echo "    OK     "; - } - ?> - ] - - -
[ - ERROR "; - } - else { - $status['iconv_php'] = 'true'; - echo "   OK     "; - } - ?>] - - -
[ - ERROR "; - } - else { - echo "   OK     "; - } - ?>] - - -
[ - ERROR "; - } - else { - echo "   OK     "; - } - ?>] - - -
[ - ERROR "; - } - else { - echo "    OK     "; - } - ?> - ] - - -
- - [ - ERROR "; - } - else { - echo "    OK     "; - } - ?> - ] - - -
[ - ERROR "; - } - else { - $status['check_db'] = 'true'; - echo "    OK     "; - } - ?> - ] - - -
DB Inserted[ - ERROR "; - } - else { - $status['check_db_insert'] = 'true'; - echo "    OK     "; - } - ?> - ] - - This checks a few key tables to make sure that you have successfully inserted the ampache database and - that the user has access to the database -
Web Path[ - "; - } - else { - $status['check_webpath'] = false; - echo "ERROR"; - } - - ?> - ] - - This test makes sure that your web_path variable is set correctly and that we are able to get to the index page. If you do not see the ampache - logo here then your web_path is not set correctly. -
- -
-

Ampache Debug.
-For the love of Music.

-
- - diff --git a/templates/show_test.inc.php b/templates/show_test.inc.php new file mode 100644 index 00000000..d7ddefe7 --- /dev/null +++ b/templates/show_test.inc.php @@ -0,0 +1,271 @@ + + + + + +Ampache -- Debug Page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
[ + ERROR "; + } + else { + $status['php_ver'] = 'true'; + echo "    OK     "; + } + ?> + ] + + +
[ + ERROR "; + } + else { + $status['mysql_php'] = 'true'; + echo "    OK     "; + } + ?> + ] + + +
[ + ERROR "; + } + else { + $status['session_php'] = 'true'; + echo "    OK     "; + } + ?> + ] + + +
[ + ERROR "; + } + else { + $status['iconv_php'] = 'true'; + echo "   OK     "; + } + ?>] + + +
[ + ERROR "; + } + else { + echo "   OK     "; + } + ?>] + + +
[ + ERROR "; + } + else { + echo "   OK     "; + } + ?>] + + +
[ + ERROR "; + } + else { + echo "    OK     "; + } + ?> + ] + + +
+ + [ + ERROR "; + } + else { + $status['parse_config'] = true; + echo "    OK     "; + } + ?> + ] + + +
[ + ERROR "; + } + else { + $status['check_db'] = 'true'; + echo "    OK     "; + } + ?> + ] + + +
DB Inserted[ + ERROR "; + } + else { + $status['check_db_insert'] = 'true'; + echo "    OK     "; + } + ?> + ] + + This checks a few key tables to make sure that you have successfully inserted the ampache database and + that the user has access to the database +
Web Path[ + "; + } + else { + $status['check_webpath'] = false; + echo "ERROR"; + } + + ?> + ] + + This test makes sure that your web_path variable is set correctly and that we are able to get to the index page. If you do not see the ampache + logo here then your web_path is not set correctly. +
+ +
+

Ampache Debug.
+For the love of Music.

+
+ + diff --git a/test.php b/test.php index 0f5a9fc3..6cda42b3 100644 --- a/test.php +++ b/test.php @@ -27,17 +27,22 @@ $prefix = dirname(__FILE__); $configfile = "$prefix/config/ampache.cfg.php"; $row_classes = array('even','odd'); +define('INIT_LOADED','1'); require_once $prefix . '/lib/general.lib.php'; +require_once $prefix . '/lib/log.lib.php'; +require_once $prefix . '/lib/class/config.class.php'; +require_once $prefix . '/lib/class/dba.class.php'; require_once $prefix . '/lib/ui.lib.php'; require_once $prefix . '/lib/class/error.class.php'; require_once $prefix . '/lib/class/config.class.php'; require_once $prefix . '/lib/debug.lib.php'; +Dba::_auto_init(); switch ($_REQUEST['action']) { default: - require_once $prefix . '/templates/show_test.inc'; + require_once $prefix . '/templates/show_test.inc.php'; break; } // end switch on action -- cgit