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.]

<?php

// +--------------------------------------------------------------------+
// | PowerAdmin								|
// +--------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PowerAdmin Team			|
// +--------------------------------------------------------------------+
// | This source file is subject to the license carried by the overal	|
// | program PowerAdmin as found on http://poweradmin.sf.net		|
// | The PowerAdmin program falls under the QPL License:		|
// | http://www.trolltech.com/developer/licensing/qpl.html		|
// +--------------------------------------------------------------------+
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
// |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
// +--------------------------------------------------------------------+

// Filename: test_setup.php
// Description: tests your PowerAdmin install.
// Adding tables? Increase the total count to (2^numberoftables)-1
// Substract its binary value and put it in the last failure close.
// Yes this is binary, why? Because thats cool! Squeeky geeky stuff!
//
// $Id: test_setup.php,v 1.4 2003/01/08 00:40:08 azurazu Exp $
//

include_once("inc/header.inc.php");
require_once("inc/config.inc.php");
require_once("inc/database.inc.php");

// Initialize variables
global $db;
$bad_array = array();
$check_tables = array('zones', 'users', 'records', 'domains');

function error()
{
	return true;
}

PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error');

foreach($check_tables as $table)
{
	if(DB::isError($db->query("select * from $table")))
	{
		$bad_array[] = $table;
	}
}

$bad = (count($bad_array) == 0) ? false : true;

// Start error or message output

echo "<P>";

if($bad)
{
	?><TABLE CLASS="error"><TR><TD CLASS="error"><H2><? echo _('Not all tables are ok!'); ?></H2><?
}
else
{
	?><TABLE CLASS="messagetable"><TR><TD CLASS="message"><H2><? echo _('Successful!'); ?></H2><?
}
?>
<BR>
<FONT STYLE="font-weight: Bold">
<?
if($bad)
{
	echo _('Sorry, but there are error(s) found in the following table(s):'); 
	foreach($bad_array as $table)
	{
		echo " '$table'";
		}
		?>.</P><P><? echo _('Please fix these errors and run the script again.'); ?></P><?
	}
	else
	{
		echo _('Successful! Everything is set up ok, you can rumble!');
	}
?>
<BR></TD></TR></TABLE></P>
<?
	include_once("inc/footer.inc.php");
?>