diff -r c72d6d51f3d3 -r c255196bc447 inc/toolkit.inc.php
--- a/inc/toolkit.inc.php Wed Mar 12 20:45:56 2008 +0000
+++ b/inc/toolkit.inc.php Tue Mar 25 22:45:31 2008 +0000
@@ -22,7 +22,6 @@
session_start();
-
if(!@include_once("config.inc.php"))
{
error( _('You have to create a config.inc.php!') );
@@ -79,6 +78,9 @@
require_once("dns.inc.php");
require_once("record.inc.php");
+$db = dbConnect();
+doAuthenticate();
+
/*************
* Functions *
@@ -92,7 +94,7 @@
{
if ($amount > $rowamount) {
if (!isset($_GET["start"])) $_GET["start"]=1;
- echo _('Show page') . "
";
+ echo _('Show page') . ":
";
for ($i=1;$i<=ceil($amount / $rowamount);$i++) {
if ($_GET["start"] == $i) {
echo "[ ".$i." ] ";
@@ -111,7 +113,7 @@
function show_letters($letterstart,$userid=true)
{
- echo _('Show zones beginning with:') . "
";
+ echo _('Show zones beginning with') . ":
";
$letter = "[[:digit:]]";
if ($letterstart == "1")
@@ -148,68 +150,42 @@
{
global $db;
global $sql_regexp;
- $sqlq = "SELECT domains.id AS domain_id,
- zones.owner,
- records.id,
- domains.name AS domainname
- FROM domains
- LEFT JOIN zones ON domains.id=zones.domain_id
- LEFT JOIN records ON records.domain_id=domains.id
- WHERE 1=1";
- if((!level(5) || !$userid) && !level(10) && !level(5))
- {
- // First select the zones for which we have ownership on one or more records.
- $query = 'SELECT records.domain_id FROM records, record_owners WHERE user_id = '.$db->quote($_SESSION['userid']).' AND records.id = record_owners.record_id';
- $result = $db->query($query);
- $zones = array();
- if (!PEAR::isError($result)) {
- $zones = $result->fetchCol();
- }
-
- $sqlq .= " AND (zones.owner=".$db->quote($_SESSION["userid"]);
- if (count($zones) > 0) {
- $sqlq .= ' OR zones.domain_id IN ('.implode(',', $zones).') ';
-
- }
- $sqlq .= ')';
- }
- $sqlq .= " AND substring(domains.name,1,1) ".$sql_regexp." ".$db->quote("^".$letter);
- $db->setLimit(1);
- $result = $db->query($sqlq);
+ $query = "SELECT
+ domains.id AS domain_id,
+ zones.owner,
+ records.id,
+ domains.name AS domainname
+ FROM domains
+ LEFT JOIN zones ON domains.id=zones.domain_id
+ LEFT JOIN records ON records.domain_id=domains.id
+ AND substring(domains.name,1,1) ".$sql_regexp." ".$db->quote("^".$letter);
+ $db->setLimit(1);
+ $result = $db->query($query);
$numrows = $result->numRows();
- if ( $numrows == "1" )
- {
+ if ( $numrows == "1" ) {
return 1;
- }
- else
- {
+ } else {
return 0;
}
}
-/*
- * Print a nice useraimed error.
- */
-function error($msg)
-{
- // General function for printing critical errors.
- if ($msg)
- {
- include_once("header.inc.php");
- ?>
-
\n"; + print_r($array); + echo "\n"; +} + ?>