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