1) & !$current_category["name"]){ mysql_close(); header("Location: {$dir}"); exit(); }; if (!$current_category["name"]) $current_category["name"] = "Free PHP Directory Script"; if (!$current_category["description"]) $current_category["description"] = $current_category["name"]." ".$current_category["title"]; $replace = array("[CATEGORY_NAME]" => $current_category["name"], "[CATEGORY_TITLE]" => $current_category["title"], "[CATEGORY_DESCRIPTION]" => $current_category["description"]); echo strtr($TEMPLATE["HEADING"],$replace); flush(); $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"]; }; }; echo $TEMPLATE["PATH"]["HEADING"]; for ($x = $n_parent_categories-1; $x >= 0; $x--){ if ($x != $n_parent_categories-1) echo $TEMPLATE["PATH"]["SEPARATOR"]; if ($x == 0){ $replace = array("[CATEGORY_NAME]" => $parent_categories[$x]["name"]); echo strtr($TEMPLATE["PATH"]["CURRENT_CATEGORY"],$replace); }else{ if ($parent_categories[$x]["id"] > 1){ $category_url = $dir.parse_navi($parent_categories[$x]["name"]) .'-'. $parent_categories[$x]["id"].'.htm'; }else{ $category_url = $dir; }; $replace = array("[CATEGORY_NAME]" => $parent_categories[$x]["name"], "[CATEGORY_URL]" => $category_url); echo strtr($TEMPLATE["PATH"]["CATEGORY"],$replace); }; }; echo $TEMPLATE["PATH"]["FOOTER"]; flush(); $sql = mysql_query("SELECT {$prefix}categories.id, {$prefix}categories.name 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); }; if ($n_subcategories > 0){ $replace = array("[NUMBER_CATEGORIES]" => $n_subcategories, "[CATEGORY_NAME]" => $current_category["name"]); echo strtr($TEMPLATE["SUBCATEGORIES"]["HEADING"],$replace); echo $TEMPLATE["SUBCATEGORIES"]["BEFORE_COLUMNS"]; for ($x = 0; $x < ceil($n_subcategories/2); $x++){ $replace = array("[CATEGORY_NAME]" => $subcategories[$x]["name"], "[CATEGORY_URL]" => $dir.parse_navi($subcategories[$x]["name"]). '-' .$subcategories[$x]["id"].'.htm'); echo strtr($TEMPLATE["SUBCATEGORIES"]["CATEGORY"],$replace); }; echo $TEMPLATE["SUBCATEGORIES"]["BETWEEN_COLUMNS"]; for ($x = ceil($n_subcategories/2); $x < $n_subcategories; $x++){ $replace = array("[CATEGORY_NAME]" => $subcategories[$x]["name"], "[CATEGORY_URL]" => $dir.parse_navi($subcategories[$x]["name"]). '-' .$subcategories[$x]["id"].'.htm'); echo strtr($TEMPLATE["SUBCATEGORIES"]["CATEGORY"],$replace); }; echo $TEMPLATE["SUBCATEGORIES"]["AFTER_COLUMNS"]; echo $TEMPLATE["SUBCATEGORIES"]["FOOTER"]; }else{ $replace = array("[CATEGORY_NAME]" => $current_category["name"]); echo strtr($TEMPLATE["SUBCATEGORIES"]["NO_CATEGORIES"],$replace); }; if ($current_category["pages"] == "y"){ $replace = array("[CATEGORY_NAME]" => $current_category["name"], "[SUBMISSION_URL]" => $dir.$c.'-add.htm'); echo strtr($TEMPLATE["SUBMISSION_LINK"],$replace); flush(); 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); }; }; if ($show_additional_results){ flush(); require_once("include_ppc.php"); $ppc_results = ppc_results($current_category["name"]); if ($s > $total_pages){ $s2 = $s - $total_pages; }else{ $s2 = 1; }; $e2 = $s2 + min($s + $n - $total_pages - 1, count($ppc_results) - $s2 + 1); $total_pages += count($ppc_results); for ($x = $s2; $x < $e2; $x++){ $n_pages += 1; $e += 1; $pages[$n_pages-1] = $ppc_results[$x]; }; }; $e = min($s + $n - 1, $s + $n_pages - 1); if ($n_pages > 0){ $replace = array("[STARTING_PAGE_NUMBER]" => $s, "[ENDING_PAGE_NUMBER]" => $e, "[TOTAL_PAGES]" => $total_pages, "[CATEGORY_NAME]" => $current_category["name"]); echo strtr($TEMPLATE["PAGES"]["HEADING"],$replace); for ($x = 0; $x < $n_pages; $x++){ if ($pages[$x]["domain"]){ $replace = array("[PAGE_NUMBER]" => $x, "[PAGE_TITLE]" => $pages[$x]["title"], "[PAGE_DESCRIPTION]" => $pages[$x]["description"], "[PAGE_URL]" => $pages[$x]["url"], "[PAGE_DOMAIN]" => $pages[$x]["domain"]); echo strtr($TEMPLATE["PAGES"]["FEED_PAGE"],$replace); }else{ $replace = array("[PAGE_NUMBER]" => $x, "[PAGE_TITLE]" => $pages[$x]["title"], "[PAGE_DESCRIPTION]" => $pages[$x]["description"], "[PAGE_URL]" => $pages[$x]["url"], "[PAGE_DOMAIN]" => $pages[$x]["domain"]); echo strtr($TEMPLATE["PAGES"]["PAGE"],$replace); }; }; if ($s != 1 || $e != $total_pages){ function pagination($s){ global $c, $dir, $current_category; if ($c != 1) { $query = parse_navi($current_category["name"]) .'-'. $c.'.htm'; }; if (($c != 1) & $s != 1){ $query = parse_navi($current_category["name"]) .'-'. $c.'-'.$s.'.htm'; }elseif ($s != 1){ $query = parse_navi($current_category["name"]) .'-'. $c.'-'.$s.'.htm'; }; return $dir.$query; }; echo $TEMPLATE["PAGES"]["PAGINATION"]["HEADING"]; if ($s != 1){ $previous = $s - $n; $replace = array("[PAGINATION_URL]" => pagination($previous)); echo strtr($TEMPLATE["PAGES"]["PAGINATION"]["PREVIOUS"],$replace); }; for ($x = 1; $x <= ceil($total_pages/$n); $x++){ $current = ($x-1) * $n + 1; if ($current == $s){ $replace = array("[PAGINATION_NUMBER]" => $x); echo strtr($TEMPLATE["PAGES"]["PAGINATION"]["CURRENT_NUMBER"],$replace); }else{ $replace = array("[PAGINATION_NUMBER]" => $x, "[PAGINATION_URL]" => pagination($current)); echo strtr($TEMPLATE["PAGES"]["PAGINATION"]["NUMBER"],$replace); }; }; if ($e < $total_pages){ $next = $s + $n; $replace = array("[PAGINATION_URL]" => pagination($next)); echo strtr($TEMPLATE["PAGES"]["PAGINATION"]["NEXT"],$replace); }; echo $TEMPLATE["PAGES"]["PAGINATION"]["FOOTER"]; }; echo $TEMPLATE["PAGES"]["FOOTER"]; }else{ $replace = array("[CATEGORY_NAME]" => $current_category["name"]); echo strtr($TEMPLATE["PAGES"]["NO_PAGES"],$replace); }; }; echo $TEMPLATE["FOOTER"]; $seiten = mysql_num_rows(mysql_query("SELECT `id` FROM `not_pages` WHERE `accepted` ='y'")); $wartend = mysql_num_rows(mysql_query("SELECT `id` FROM `not_pages` WHERE `accepted` ='n'")); $kategorien = mysql_num_rows(mysql_query("SELECT `id` FROM `not_categories`")); echo $seiten.' Einträge | '.$kategorien.' Kategorien | '.$wartend.' wartend'; ?>