# HG changeset patch # User rejo # Date 1182977151 0 # Node ID e1c60f72d494a3c31a62a2e34bd079a18603f417 # Parent a73ac0ba0401ffaa9e073cf4510352bf0bc2637a [feladat @ 76] Changed some of the functions that are used for the listing of (all) zones. Instead of getting all zones from the database, it now only requests exactlty what it needs. Considerable perfomance improvement. diff -r a73ac0ba0401 -r e1c60f72d494 credits.php --- a/credits.php Mon Jun 25 22:37:06 2007 +0000 +++ b/credits.php Wed Jun 27 20:45:51 2007 +0000 @@ -6,7 +6,7 @@

This version is an adaption of the original Poweradmin, version 1.2.7-patched. Poweradmin was written by Sjeemz and Trancer. The Poweradmin code includes patches by Wim Mostrey and Dennis Roos. This version has been patched by Rejo Zenger and includes many additional features like multi-language support, an update of the database abstraction layer, support for slave zones, support for supermasters, basic support for skins and a number of bug fixes.

-

Thanks to Koert Buijzer, Peter Beernink, John Morris and Balazs Petrikovics for bug reports, patches and good ideas.

+

Thanks to Peter Beernink, Koert Buijzer, John Morris and Balazs Petrikovics for bug reports, patches and good ideas.

"; + + $letter = "[[:digit:]]"; + if ($letterstart == "0") + { + echo "[ 0-9 ] "; + } + elseif (zone_letter_start($letter,$userid)) + { + echo "[ 0-9 ] "; + } + else + { + echo "[ 0-9 ] "; + } - echo _('Show zones beginning with:') . "
"; - if ($letterstart == 1) { - echo "[ 0-9 ] "; - } elseif ($letter_taken["0"] != 1) { - echo "[ 0-9 ] "; - } else { - echo "[ 0-9 ] "; - } - - foreach (range('a','z') as $letter) { - if ($letterstart === $letter) { - echo "[ ".$letter." ] "; - } elseif ($letter_taken[$letter] != 1) { - echo "[ ".$letter." ] "; - } else { - echo "[ ".$letter." ] "; - } - } + foreach (range('a','z') as $letter) + { + if ($letter == $letterstart) + { + echo "[ ".$letter." ] "; + } + elseif (zone_letter_start($letter,$userid)) + { + echo "[ ".$letter." ] "; + } + else + { + echo "[ ".$letter." ] "; + } + } +} + +function zone_letter_start($letter,$userid=true) +{ + global $db; + $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"; + if((!level(5) || !$userid) && !level(10) && !level(5)) + { + $sqlq .= " AND zones.owner=".$_SESSION["userid"]; + } + $sqlq .= " AND substring(domains.name,1,1) REGEXP '^".$letter."' LIMIT 1"; + $result = $db->query($sqlq); + $numrows = $result->numRows(); + if ( $numrows == "1" ) + { + return 1; + } + else + { + return 0; + } } /* diff -r a73ac0ba0401 -r e1c60f72d494 list_zones.php --- a/list_zones.php Mon Jun 25 22:37:06 2007 +0000 +++ b/list_zones.php Wed Jun 27 20:45:51 2007 +0000 @@ -3,21 +3,20 @@ require_once("inc/toolkit.inc.php"); include_once("inc/header.inc.php"); -$all_doms = get_domains(0); -$num_all_domains = ($all_doms == -1) ? 0 : count($all_doms); -$doms = get_domains(0,LETTERSTART); +$num_all_domains = zone_count(0); +$doms = zone_count(0, LETTERSTART); ?>

"; - show_pages(count($doms),ROWAMOUNT); - echo ""; + echo "
"; + show_pages($doms,ROWAMOUNT); + echo "
"; -if ($num_all_domains > ROWAMOUNT) +if ($num_all_domains > ROWAMOUNT) { - echo "
"; - show_letters(LETTERSTART,$all_doms); - echo "
"; + echo "
"; + show_letters(LETTERSTART); + echo "
"; } ?>