test_setup.php
author rejo
Tue, 10 Jul 2007 21:24:06 +0000
changeset 37 b785e54690ce
parent 3 64525a2eb098
child 47 ae140472d97c
permissions -rw-r--r--
[feladat @ 84] Bugfix. The function zone_count() now also counts zones an owner has only partial access to, not just those zones the owner has full access to. This fixes just the count, the zones a user has partial access to are not (yet!) shown in the "list zones" page. Bugfix. In the zone listing the "edit" button is now show for users with access level 1. Untill now they were presented an overview of the zones they could change, but there was no link for them to actually edit the zone. Bugfix. Some of the buttons in the "edit zone" interface that are of no use to a user with access level 1 have been hidden. Bugfix. Make sure a user with access level 1 with only partial access to a zone cannot add new records to that zone. Only the zone owner should be able to add new record. Bugfix. If a user with access level 1 edits a record in a zone he has only partial access to, an error was shown because of call to a non- existing function in the PEAR:MDB2. This bug was most likely introduced while migrating from PEAR:DB to PEAR:MDB2. Bugfix. A user with access level 1 was able to delete all records of a zone he has only partial access to. Some additional checks have been added. Bugfix. If a user with accees level 1 has partial access to one or more zones starting with a certain character, but did not own at least one entire zone starting with the same character, the character wasn't clickable in the "list zone" page. Interface. If no record or zone id is given for delete_record.php or delete_domain.php, don't just die but echo a nice message. The i18n files have not yet been updated to reflect this change. Interface. If no master IP is given in delete_supermaster.php, don't just die but echo a nice message. The i18n files have not yet been updated to reflect this change. [All fixes by Peter Beernink.]
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
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     3
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     4
// | PowerAdmin								|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     5
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     6
// | Copyright (c) 1997-2002 The PowerAdmin Team			|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     7
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     8
// | This source file is subject to the license carried by the overal	|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     9
// | program PowerAdmin as found on http://poweradmin.sf.net		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    10
// | The PowerAdmin program falls under the QPL License:		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    11
// | http://www.trolltech.com/developer/licensing/qpl.html		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    12
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    13
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    14
// |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    15
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    16
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    17
// Filename: test_setup.php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    18
// Description: tests your PowerAdmin install.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    19
// Adding tables? Increase the total count to (2^numberoftables)-1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    20
// Substract its binary value and put it in the last failure close.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
// Yes this is binary, why? Because thats cool! Squeeky geeky stuff!
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
// $Id: test_setup.php,v 1.4 2003/01/08 00:40:08 azurazu Exp $
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
include_once("inc/header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
require_once("inc/config.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
require_once("inc/database.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
// Initialize variables
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
global $db;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    32
$bad_array = array();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
$check_tables = array('zones', 'users', 'records', 'domains');
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
function error()
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
	return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error');
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    41
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
foreach($check_tables as $table)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    44
	if(DB::isError($db->query("select * from $table")))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    45
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    46
		$bad_array[] = $table;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    47
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    48
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    49
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
$bad = (count($bad_array) == 0) ? false : true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    51
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
// Start error or message output
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    53
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    54
echo "<P>";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    55
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
if($bad)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    58
	?><TABLE CLASS="error"><TR><TD CLASS="error"><H2><? echo _('Not all tables are ok!'); ?></H2><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    59
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    60
else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    61
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    62
	?><TABLE CLASS="messagetable"><TR><TD CLASS="message"><H2><? echo _('Successful!'); ?></H2><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    63
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    64
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    65
<BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    66
<FONT STYLE="font-weight: Bold">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    67
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    68
if($bad)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    69
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    70
	echo _('Sorry, but there are error(s) found in the following table(s):'); 
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    71
	foreach($bad_array as $table)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    72
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    73
		echo " '$table'";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    74
		}
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    75
		?>.</P><P><? echo _('Please fix these errors and run the script again.'); ?></P><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    76
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    77
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    78
	{
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    79
		echo _('Successful! Everything is set up ok, you can rumble!');
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    80
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    82
<BR></TD></TR></TABLE></P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    83
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    84
	include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    85
?>