summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-05-07 06:23:39 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-05-07 06:23:39 +0000
commite9f54c8d72bdd6944c87805c87548ff7947b864c (patch)
tree8414e1284829ccad685029276536f665441ee4fd
parent1c85db030e548e6bf7434e86070e4ba05917a325 (diff)
downloadampache-e9f54c8d72bdd6944c87805c87548ff7947b864c.tar.gz
ampache-e9f54c8d72bdd6944c87805c87548ff7947b864c.tar.bz2
ampache-e9f54c8d72bdd6944c87805c87548ff7947b864c.zip
initial debug work
-rw-r--r--admin/index.php4
-rw-r--r--admin/system.php16
-rw-r--r--lib/class/config.class.php59
-rw-r--r--templates/show_debug.inc.php57
-rw-r--r--templates/show_test.inc.php6
-rw-r--r--templates/sidebar_admin.inc.php3
6 files changed, 102 insertions, 43 deletions
diff --git a/admin/index.php b/admin/index.php
index ea2d7e14..ee66a291 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2007 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@
require '../lib/init.php';
-if (!$GLOBALS['user']->has_access(100)) {
+if (!Access::check('interface',100)) {
access_denied();
exit();
}
diff --git a/admin/system.php b/admin/system.php
index a2ca3012..3b338346 100644
--- a/admin/system.php
+++ b/admin/system.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2006 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@ require '../lib/init.php';
require_once Config::get('prefix') . '/lib/debug.lib.php';
require_once Config::get('prefix') . '/modules/horde/Browser.php';
-if (!$GLOBALS['user']->has_access(100)) {
+if (!Access::check('interface',100)) {
access_denied();
exit();
}
@@ -42,6 +42,18 @@ switch ($_REQUEST['action']) {
echo $final;
break;
+ case 'show_debug':
+ show_header();
+ $configuration = Config::get_all();
+ require_once Config::get('prefix') . '/templates/show_debug.inc.php';
+ show_footer();
+ break;
+ case 'check_php_settings':
+
+ break;
+ case 'check_iconv':
+
+ break;
/* Check this version against ampache.org's record */
case 'check_version':
diff --git a/lib/class/config.class.php b/lib/class/config.class.php
index dbb75f41..d846f225 100644
--- a/lib/class/config.class.php
+++ b/lib/class/config.class.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2007 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -47,63 +47,52 @@ class Config {
} // constructor
/**
+ * get
* This checks to see if this is an instance or procedure
* call, procedure == global, instance == local
*/
public static function get($name) {
- if (is_object($this)) {
- return $this->_local[$name];
- }
- else {
- return self::$_global[$name];
- }
+ return self::$_global[$name];
} // get
+
+ /**
+ * get_all
+ * This returns all of the current config variables as an array
+ */
+ public static function get_all() {
+
+ return self::$_global;
+
+ } // get_all
/**
+ * set
* This checks to see if this is an instance or procedure calls
* and then sets the correct variable based on that
*/
public static function set($name, $value, $clobber = 0) {
- if (isset($this)) {
- if (isset($this->_local[$name]) && !$clobber) {
- Error::add('Config Instance',"Trying to clobber '$name' without setting clobber");
- return;
- }
- else {
- $this->_local[$name] = $value;
- }
- } // if object
+ if (isset(self::$_global[$name]) && !$clobber) {
+ Error::add('Config Global',"Trying to clobber'$name' without setting clobber");
+ return;
+ }
else {
- if (isset(self::$_global[$name]) && !$clobber) {
- Error::add('Config Global',"Trying to clobber'$name' without setting clobber");
- return;
- }
- else {
- self::$_global[$name] = $value;
- }
- } // else not object, procedure call
+ self::$_global[$name] = $value;
+ }
} // set
/**
+ * set_by_array
* This is the same as the set function except it takes an array as input
*/
-
public static function set_by_array($array, $clobber = 0) {
- if (isset($this)) {
- foreach ($array as $name => $value) {
- $this->set($name, $value, $clobber);
- } // end foreach
- } // if this is an object
- else {
- foreach ($array as $name => $value) {
- self::set($name,$value,$clobber);
- }
- } // end if procedural call
+ foreach ($array as $name => $value) {
+ self::set($name,$value,$clobber);
+ }
} // set_by_array
diff --git a/templates/show_debug.inc.php b/templates/show_debug.inc.php
new file mode 100644
index 00000000..f6dbf7c3
--- /dev/null
+++ b/templates/show_debug.inc.php
@@ -0,0 +1,57 @@
+<?php
+/*
+
+ 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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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.
+
+*/
+?>
+<?php show_box_top(_('Debug Tools')); ?>
+<ul>
+ <li><a href="<?php echo Config::get('web_path'); ?>/system.php?action=generate_config"><?php echo _('Generate Configuration'); ?></a></li>
+ <li><a href="<?php echo Config::get('web_path'); ?>/system.php?action=check_php_settings"><?php echo _('Check PHP Settings'); ?></a></li>
+ <li><a href="<?php echo Config::get('web_path'); ?>/system.php?action=check_iconv"><?php echo _('Check Iconv'); ?></a></li>
+</ul>
+<?php show_box_bottom(); ?>
+
+<?php show_box_top(_('Current Configuration')); ?>
+<table class="tabledata" cellpadding="0" cellspacing="0">
+<colgroup>
+ <col id="col_configuration">
+ <col id="col_value">
+</colgroup>
+<tr class="th-top">
+ <th class="cel_configuration"><?php echo _('Preference'); ?></th>
+ <th class="cel_value"><?php echo _('Value'); ?></th>
+</tr>
+<?php foreach ($configuration as $key=>$value) {
+ if ($key == 'database_password' || $key == 'mysql_password') { $value = '*********'; }
+ if (is_array($value)) {
+ $string = '';
+ foreach ($value as $setting) {
+ $string .= $setting . '<br />';
+ }
+ $value = $string;
+ }
+?>
+<tr class="<?php echo flip_class(); ?>">
+ <td valign="top"><strong><?php echo $key; ?></strong></td>
+ <td><?php echo $value; ?></td>
+</tr>
+<?php } ?>
+</table>
+<?php show_box_bottom(); ?>
diff --git a/templates/show_test.inc.php b/templates/show_test.inc.php
index 6fbfc45e..4fa81cf3 100644
--- a/templates/show_test.inc.php
+++ b/templates/show_test.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2008 Ampache.org
+ Copyright (c) Ampache.org
All Rights Reserved
this program is free software; you can redistribute it and/or
@@ -210,7 +210,7 @@
</td>
</tr>
<tr>
- <td valign="top">DB Inserted</td>
+ <td valign="top"><?php echo _('DB Inserted'); ?></td>
<td valign="top">[
<?php
$db_inserted = check_database_inserted($db,$results['local_db']);
@@ -232,7 +232,7 @@
</tr>
<tr>
- <td valign="top">Web Path</td>
+ <td valign="top"><?php echo _('Web Path'); ?></td>
<td valign="top">[
<?php
/*
diff --git a/templates/sidebar_admin.inc.php b/templates/sidebar_admin.inc.php
index d5f25803..e6d27f43 100644
--- a/templates/sidebar_admin.inc.php
+++ b/templates/sidebar_admin.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2007 Ampache.org
+ Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -42,6 +42,7 @@
</li>
<li><h4><?php echo _('Other Tools'); ?></h4>
<ul class="sb3" id="sb_admin_ot">
+ <li id="sb_admin_ot_Debug"><a href="<?php echo $web_path; ?>/admin/system.php?action=show_debug"><?php echo _('Ampache Debug'); ?></a></li>
<li id="sb_admin_ot_Duplicates"><a href="<?php echo $web_path; ?>/admin/duplicates.php"><?php echo _('Find Duplicates'); ?></a></li>
<li id="sb_admin_ot_Mail"><a href="<?php echo $web_path; ?>/admin/mail.php"><?php echo _('Mail Users'); ?></a></li>
<li id="sb_admin_ot_ClearNowPlaying"><a href="<?php echo $web_path; ?>/admin/catalog.php?action=clear_now_playing"><?php echo _('Clear Now Playing'); ?></a></li>