Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/includes/blocks/weblinks.php
<?php
// File: $Id: weblinks.php,v 1.8 2001/11/24 01:46:26 proca 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: Patrick Kellum
// Purpose of file: Display the recent links added to the WEb Links module
// ----------------------------------------------------------------------

$blocks_modules['weblinks'] = array (
    'func_display' => 'blocks_weblinks_display',
    'func_add' => 'blocks_weblinks_add',
    'func_update' => 'blocks_weblinks_update',
    'func_edit' => 'blocks_weblinks_edit',
    'text_type' => 'Weblinks',
    'text_type_long' => 'Latest Web Links',
    'allow_multiple' => true,
    'form_content' => false,
    'form_refresh' => false,
    'show_preview' => true
);
function blocks_weblinks_display($row)
{
    global $pntable, $dbconn;
    $url = explode('|', $row['url']);
    if (!$url[0])
    {
        $row['content'] = 'You forgot to set the module name!';
        themesideblock($row);
        return;
    }
    if (!$url[1])
    {
        $url[1] = 10;
    }
    $row['content'] = '<span class=\"pn-sub\">';
    $links_col = &$pntable['links_links_column'];
    $cats_col = &$pntable['links_categories_column'];
    $sql = "SELECT $links_col[lid] as lid, $links_col[title] as title, $links_col[description] as description, $links_col[hits] as hits, IF($links_col[cat_id], CONCAT('/', $cats_col[title]), $cats_col[title]) AS cattitle
               FROM $pntable[links_links]
               LEFT JOIN $pntable[links_categories]
               ON $cats_col[cat_id]=$links_col[cat_id]
               ORDER BY $links_col[date] DESC";
			   
    $result = $dbconn->SelectLimit($sql,$url[1]);

    while(!$result->EOF) {
        $lrow = $result->GetRowAssoc(false);
        $lrow['title'] = htmlspecialchars(stripslashes($lrow['title']));
        $lrow['description'] = htmlspecialchars(stripslashes($lrow['description']));
        $lrow['catitle'] = htmlspecialchars(stripslashes($lrow['catitle']));
        $row['content'] .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"modules.php?op=modload&name=$url[0]&file=index&req=visit&lid=$lrow[lid]\" target=\"_blank\" title=\"$lrow[cattitle]:\n$lrow[description]\" class=\"pn-sub\">$lrow[title]</a> ($lrow[hits])<br>\n";
        $result->MoveNext();
    }
    $row['content'] .= '</span>';
    themesideblock($row);
}
function blocks_weblinks_add($row)
{
    $row['url'] = 'Web_Links|10';
    return $row;
}
function blocks_weblinks_update($vars)
{
    $vars['url'] = "$vars[weblinks_modname]|$vars[weblinks_total]";
    return $vars;
}
function blocks_weblinks_edit($row)
{
    $url = explode('|', $row['url']);
    $output = '<tr><td valign="top" class="pn-normal">Module Name:</td><td>'
        ."<input type=\"text\" name=\"weblinks_modname\" size=\"30\" maxlength=\"255\" value=\"$url[0]\" class=\"pn-normal\">"
        ."</td></tr>\n"
    ;
    $output .= '<tr><td valign="top" class="pn-normal">Total Links:</td><td>'
        ."<input type=\"text\" name=\"weblinks_total\" size=\"30\" maxlength=\"255\" value=\"$url[1]\" class=\"pn-normal\">"
        ."</td></tr>\n"
    ;
    return $output;
}
?>
Return current item: ProNuke. Postnuke To Oracle