test_setup.php
author rejo
Wed, 26 Mar 2008 08:32:24 +0000
changeset 84 c8ebeadd438e
parent 71 e1b918eaf69a
permissions -rw-r--r--
[feladat @ 184] Fixed a typo in a description of one of the permission items.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     1
<?php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     2
47
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
     5
 *
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
     7
 *
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    11
 *  (at your option) any later version.
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    12
 *
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    16
 *  GNU General Public License for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    17
 *
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae140472d97c [feladat @ 94]
rejo
parents: 3
diff changeset
    20
 */
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
include_once("inc/header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
require_once("inc/config.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
require_once("inc/database.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
// Initialize variables
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
global $db;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
$bad_array = array();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
$check_tables = array('zones', 'users', 'records', 'domains');
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
function error()
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    32
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
	return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error');
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
foreach($check_tables as $table)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
	if(DB::isError($db->query("select * from $table")))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    41
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
		$bad_array[] = $table;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    44
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    45
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    46
$bad = (count($bad_array) == 0) ? false : true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    47
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    48
// Start error or message output
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    49
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
echo "<P>";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    51
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
if($bad)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    53
{
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    54
	?><TABLE CLASS="error"><TR><TD CLASS="error"><H2><?php echo _('Not all tables are ok!'); ?></H2><?php
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    55
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
{
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    58
	?><TABLE CLASS="messagetable"><TR><TD CLASS="message"><H2><?php echo _('Successful!'); ?></H2><?php
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    59
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    60
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    61
<BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    62
<FONT STYLE="font-weight: Bold">
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    63
<?php
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    64
if($bad)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    65
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    66
	echo _('Sorry, but there are error(s) found in the following table(s):'); 
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    67
	foreach($bad_array as $table)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    68
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    69
		echo " '$table'";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    70
		}
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    71
		?>.</P><P><?php echo _('Please fix these errors and run the script again.'); ?></P><?php
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    72
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    73
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    74
	{
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    75
		echo _('Successful! Everything is set up ok, you can rumble!');
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    76
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    77
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    78
<BR></TD></TR></TABLE></P>
71
e1b918eaf69a [feladat @ 118]
peter
parents: 47
diff changeset
    79
<?php
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    80
	include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
?>