1) & !$current_category["name"]){ header("Location: {$dir}index.php"); }; if (!$current_category["name"]) { $current_category["name"] = "Directory Search"; }; if (!$current_category["title"]) { $current_category["title"] = $current_category["name"]; }; if (!$current_category["description"]) { $current_category["description"] = $current_category["name"]." ".$current_category["title"]; }; $last_category = false; $ref = $c; while(!$last_category){ $n_parent_categories += 1; $sql = mysql_query("SELECT id, name, ref FROM {$prefix}categories WHERE id = $ref"); $parent_categories[$n_parent_categories-1] = mysql_fetch_array($sql, MYSQL_ASSOC); if ($parent_categories[$n_parent_categories-1]["ref"] == 0){ $last_category = true; }else{ $ref = $parent_categories[$n_parent_categories-1]["ref"]; }; }; $sql = mysql_query("SELECT {$prefix}categories.id, {$prefix}categories.name, COUNT({$prefix}pages.id) AS pages FROM {$prefix}categories LEFT JOIN {$prefix}pages ON {$prefix}pages.category = {$prefix}categories.id AND {$prefix}pages.accepted = 'y' WHERE ref = $c GROUP BY {$prefix}categories.id ORDER BY {$prefix}categories.name"); $n_subcategories = mysql_num_rows($sql); for ($x = 0; $x < $n_subcategories; $x++){ $subcategories[$x] = mysql_fetch_array($sql, MYSQL_ASSOC); }; $sql = mysql_query("SELECT {$prefix}categories.id, {$prefix}categories.name, COUNT({$prefix}subcategories.id) AS subcategories FROM {$prefix}categories LEFT JOIN {$prefix}categories AS {$prefix}subcategories ON {$prefix}subcategories.ref = {$prefix}categories.id WHERE {$prefix}categories.ref = $c GROUP BY {$prefix}categories.id ORDER BY {$prefix}categories.name"); for ($x = 0; $x < $n_subcategories; $x++){ $subcategories[$x]["subcategories"] = mysql_result($sql, $x, "subcategories"); }; if ($current_category["pages"] == "y"){ if ($s == 0) { $s = 1; }; $n = 10; $sql = mysql_query("SELECT COUNT(*) AS total_pages FROM {$prefix}pages WHERE category = $c AND accepted = 'y'"); $total_pages = mysql_result($sql,0,"total_pages"); if ($total_pages > 0){ $sql = mysql_query("SELECT id, url, title, description FROM {$prefix}pages WHERE category = $c AND accepted = 'y' ORDER BY title LIMIT ".($s-1).",$n"); $n_pages = mysql_num_rows($sql); for ($x = 0; $x < $n_pages; $x++){ $pages[$x] = mysql_fetch_array($sql, MYSQL_ASSOC); }; }; }; $e = min($s + $n - 1, $s + $n_pages - 1); ?> <? echo $current_category["name"]; if ($current_category["title"] != $current_category["name"]){ echo " - ".$current_category["title"]; };?> "> ">

'."\r\n"; for ($x = $n_parent_categories-1; $x >= 1; $x--){ if ($x != $n_parent_categories-1) { echo " > "; }; if ($parent_categories[$x]["id"] == 1){ echo ''.$parent_categories[$x]["name"].''; }else{ echo ''.$parent_categories[$x]["name"].''; }; }; echo ' > '.$current_category["name"]; echo "
\r\n"; }; ?>
\r\n"; }; ?> 0){ echo '
'."\r\n"; echo '
'.$t01.' "'.$current_category["name"].'":
'."\r\n"; $t = ceil($n_subcategories/2); echo '
'."\r\n"; echo '
'."\r\n"; for ($x = 0; $x < $t; $x++){ echo '
» ('.$subcategories[$x]["subcategories"].'/'.$subcategories[$x]["pages"].')
'."\r\n"; }; echo "
\r\n"; echo '
'."\r\n"; if ($n_subcategories > 1){ for ($x = $t; $x < $n_subcategories; $x++){ echo '
» ('.$subcategories[$x]["subcategories"].'/'.$subcategories[$x]["pages"].')
'."\r\n"; }; }else{ echo " \r\n"; }; echo "
\r\n"; echo "
\r\n"; echo "
\r\n"; }; if ($current_category["pages"] == "y"){ if ($n_pages > 0){ echo '
'."\r\n"; echo '
'.$t05a.' '.$s.' - '.$e.' '.$t05b.' '.$total_pages.' '.$t05c.' "'.$current_category["name"].'":
'."\r\n"; for ($x = 0; $x < $n_pages; $x++){ echo '
'."\r\n"; echo ''."\r\n"; echo '
'.$pages[$x]["description"].'
'."\r\n"; echo '
'.$pages[$x]["url"].'
'."\r\n"; echo "
\r\n"; }; echo "
\r\n"; }else{ echo '
'."\r\n"; echo '
'.$t06.' "'.$current_category["name"].'"
'."\r\n"; echo "
\r\n"; }; if ($s != 1 || $e != $total_pages){ function query($s){ global $c; if ($c != 1) { $query = "?c=$c"; }; if (($c != 1) & $s != 1){ $query .= "&s=$s"; }elseif ($s != 1){ $query = "?s=$s"; }; return $query; }; echo '
'."\r\n"; if ($s != 1){ $previous = $s - $n; echo ''.$t07.''."\r\n"; }; for ($x = 1; $x <= ceil($total_pages/$n); $x++){ $current = ($x-1) * $n + 1; if ($current == $s){ echo $x."\r\n"; }else{ echo ''.$x.''."\r\n"; }; }; if ($e < $total_pages){ $next = $s + $n; echo ''.$t08.''."\r\n"; }; echo "
\r\n"; }; }; include ("links.php"); ?>