Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/modules/Web_Links/wl-navigation.php
<?php
// File: $Id: wl-navigation.php,v 1.2 2001/12/04 00:50:30 gregorrothfuss Exp $ $Name:  $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file:
// ----------------------------------------------------------------------
// 11-30-2001:ahumphr - created file as part of modularistation

/**
 * index
 * Display the main links categories
 */
function index() {
    global $pntable, $dbconn, $ModName;
    global $modurl;

    include("header.php");
    $mainlink = 0;
    menu($mainlink);
    echo "<br>";
    OpenTable();

    echo "<center><font class=\"pn-title\">"._LINKSMAINCAT."</font></center><br>";
    echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>";

    $column = &$pntable['links_categories_column'];
    $result=$dbconn->Execute("select $column[cat_id], $column[title], $column[cdescription] from $pntable[links_categories] WHERE $column[parent_id]=0 ORDER BY $column[title]");
    if (!$result) {
        PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
        die();
    }

    $count = 0;

//FTO Check EOF and database ERROR

    while(!$result->EOF)
    {
        list($cat_id, $title, $cdescription) = $result->fields;
        $result->MoveNext();
        $cnumrows = CountSubLinks($cat_id);

        echo "<td valign=\"top\">"
           ."<font class=\"pn-title\">&middot;</font> <font class=\"pn-normal\">"
               ."<a class=\"pn-title\" href=\"${modurl}&amp;req=viewlink&amp;cid=$cat_id\"><b>$title</b></a>"
               ." ($cnumrows)"
           ."</font>";
        categorynewlinkgraphic($cat_id);

        if ($cdescription) {
            echo "<font class=\"pn-normal\">$cdescription</font><br>";
        } else {
            echo "<br>";
        }

        $column = &$pntable['links_categories_column'];
        $result2 = $dbconn->Execute("SELECT $column[cat_id], $column[title] FROM $pntable[links_categories] WHERE $column[parent_id]=$cat_id ORDER BY $column[title]");

        //FTO Check db error and EOF
        if (!$result) {
          PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
          die();
        }
        
        $space = 0;
        while(!$result2->EOF) {
            list($scat_id, $stitle) = $result2->fields;
            $result2->MoveNext();
            if ($space>0) {
                echo "<br>";
            }
            echo "<font class=\"pn-normal\">"
                    ."<a class=\"pn-normal\" href=\"${modurl}&amp;req=viewlink&amp;cid=$scat_id\">$stitle</a>"
                ."</font>";

            subcategorynewlinkgraphic($scat_id);
            $space++;
        }

        if ($count<1) {
             echo "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td>";
             $dum = 1;
        }
        $count++;

        if ($count==2) {
            echo "</td></tr><tr>";
            $count = 0;
            $dum = 0;
        }
    } //While
    if ($dum == 1) {
        echo "</tr></table>";
    } elseif ($dum == 0) {
        echo "<td></td></tr></table>";
    }

     $result=$dbconn->Execute("SELECT COUNT(*) FROM $pntable[links_links]");
    list($numrows) = $result->fields;

    $result=$dbconn->Execute("SELECT COUNT(*) FROM $pntable[links_categories]");
    list($catnum) = $result->fields;

    echo "<br><br><center><font class=\"pn-sub\">"._THEREARE." <b>$numrows</b> "._LINKS." "._AND." <b>$catnum</b> "._CATEGORIES." "._INDB."</font></center>";
    CloseTable();
    include("footer.php");
}

/**
 * menu
 * builds the standard navigation menu
 * @param mainlink  integer switch. 1 means show _LINKSMAIN, 0 not.
 */
function menu($mainlink) {
    global $ModName, $sitename, $modurl;

    OpenTable();

    //FTO Remove warning
    if (!isset($query)) $query="";
    
    echo "<br><center><a class=\"pn-logo\"  href=\"${modurl}\">$sitename -- "._LINKPAGETITLE."</a><br><br>";
    echo "<form action=\"${modurl}&amp;req=search&amp;query=$query\" method=\"post\">"
      ."<font class=\"pn-normal\"><input type=\"text\" size=\"25\" name=\"query\"> "
        ."<input type=\"submit\" value=\""._SEARCH."\">"
      ."</font>"
    ."</form>";
    echo "<font class=\"pn-normal\">[ ";
    if ($mainlink>0) {
      echo "<a class=\"pn-normal\"  href=\"${modurl}\">"._LINKSMAIN."</a> | ";
    }
    if (authorised(0, 'Web links::Category', '::', ACCESS_COMMENT)) {
        echo "<a class=\"pn-normal\" href=\"${modurl}&amp;req=AddLink\">"._ADDLINK."</a>";
    }
    echo " | <a class=\"pn-normal\" href=\"${modurl}&amp;req=NewLinks\">"._NEW."</a>"
    ." | <a class=\"pn-normal\" href=\"${modurl}&amp;req=MostPopular\">"._POPULAR."</a>"
    ." | <a class=\"pn-normal\" href=\"${modurl}&amp;req=TopRated\">"._TOPRATED."</a>"
    ." | <a class=\"pn-normal\" href=\"${modurl}&amp;req=RandomLink\" target=\"new\">"._RANDOM."</a> ]"
    ."</font></center>";
    CloseTable();
}

?>
Return current item: ProNuke. Postnuke To Oracle