Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_modules / articles / pnblocks [ view in CVS ]


Deprecated: Function gmstrftime() is deprecated in /home/mikespub/www/list.php on line 509
Date Directory [filter] File(s) [view] Author [filter]
05 Aug 2002 23:18:44postnuke_modules/articles/pnblocksrelated.php,NONE,1.1Mike
 related info v0.001

Update of /home/cvsroot/postnuke_modules/articles/pnblocks
In directory ns7.hostnuke.net:/tmp/cvs-serv5515

Added Files:
	related.php 
Log Message:
related info v0.001


--- NEW FILE: related.php ---
<?php // $Id: related.php,v 1.1 2002/08/05 23:18:42 mikespub Exp $
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// PostNuke Content Management System
// Copyright (C) 2002 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// 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: Jim McDonald
// Purpose of file:  Articles administration display functions
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Original Author of file: Jim McDonald
// Purpose of file: Articles Block
// ----------------------------------------------------------------------

/**
 * initialise block
 */
function articles_relatedblock_init()
{
    // Security
    pnSecAddSchema('Articles:Relatedblock:', 'Block title::');
}

/**
 * get information on block
 */
function articles_relatedblock_info()
{
    // Values
    return array('text_type' => 'Related',
                 'module' => 'articles',
                 'text_type_long' => 'Show related categories and author links',
                 'allow_multiple' => true,
                 'form_content' => false,
                 'form_refresh' => false,
                 'show_preview' => true);
}

/**
 * display block
 */
function articles_relatedblock_display($blockinfo)
{
    // Security check
    if (!pnSecAuthAction(0,
                         'Articles:Relatedblock:',
                         "$blockinfo[title]::",
                         ACCESS_READ)) {
        return;
    }

    // Get variables from content block
    $vars = unserialize($blockinfo['content']);

    // Defaults
    if (empty($vars['numitems'])) {
        $vars['numitems'] = 5;
    }
/*
    // Database information
    pnModDBInfoLoad('articles');
    list($dbconn) = pnDBGetConn();
    $pntable =pnDBGetTables();
    $articlestable = $pntable['articles'];

    // Query
    $sql = "SELECT pn_tid,
                   pn_name
            FROM $articlestable
            ORDER by pn_name";
    $result = $dbconn->SelectLimit($sql, $vars['numitems']);

    if ($dbconn->ErrorNo() != 0) {
        return;
    }

    if ($result->EOF) {
        return;
    }
    // Create output object
    $output = new pnHTML();

    // Display each item, permissions permitting
    for (; !$result->EOF; $result->MoveNext()) {
        list($tid, $name) = $result->fields;

        if (pnSecAuthAction(0,
                            'Articles::',
                            "$name::$tid",
                            ACCESS_OVERVIEW)) {
            if (pnSecAuthAction(0,
                                'Articles::',
                                "$name::$tid",
                                ACCESS_READ)) {
                $output->URL(pnModURL('articles',
                                      'user',
                                      'display',
                                      array('tid' => $tid)),
                             $name);
            } else {
                $output->Text($name);
            }
            $output->Linebreak();
        }

    }
*/

// TODO: shouldn't this stuff be BL-able too ??
// Besides the fact that title & content are placed according to some
// master block articles, why can't we create content via BL ?

// Trick : work with cached variables here (set by the module function)

    // Check if we've been through articles display
    if (!pnVarIsCached('Blocks.articles','aid')) {
        return;
    }

    // Load articles user API
    if (!pnModAPILoad('articles','user')) {
        return;
    }
    $pubtypes = pnModAPIFunc('articles','user','getpubtypes');

    // Create output object
    $output = new pnHTML();

    $links = 0;
    // Show publication type (for now)
    if (pnVarIsCached('Blocks.articles','ptid')) {
        $ptid = pnVarGetCached('Blocks.articles','ptid');
        if (!empty($ptid) && isset($pubtypes[$ptid]['descr'])) {
            $output->URL(pnModURL('articles',
                                  'user',
                                  'view',
                                  array('ptid' => $ptid)),
                         pnML('More about ') .
                             pnVarPrepForDisplay($pubtypes[$ptid]['descr']));
            $output->Linebreak();
            $links++;
        }
    }
    // Show categories (for now)
    if (pnVarIsCached('Blocks.articles','cids')) {
        $cids = pnVarGetCached('Blocks.articles','cids');
// TODO: add related links
    }
    // Show author (for now)
    if (pnVarIsCached('Blocks.articles','authorid') &&
        pnVarIsCached('Blocks.articles','author')) {
        $authorid = pnVarGetCached('Blocks.articles','authorid');
        $author = pnVarGetCached('Blocks.articles','author');
        if (!empty($authorid) && !empty($author)) {
            $output->URL(pnModURL('articles',
                                  'user',
                                  'view',
                                  array('authorid' => $authorid)),
                         pnML('Articles by ') .
                             pnVarPrepForDisplay($author));
            $output->Linebreak();
            $links++;
        }
    }

    // Populate block info and pass to theme
    if ($links > 0) {
        $blockinfo['content'] = $output->GetOutput();
        return $blockinfo;
    }
}


/**
 * modify block settings
 */
function articles_relatedblock_modify($blockinfo)
{
    // Create output object
    $output = new pnHTML();

    // Get current content
    $vars = unserialize($blockinfo['content']);

    // Defaults
    if (empty($vars['numitems'])) {
        $vars['numitems'] = 5;
    }

    // Create row
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(_NUMITEMS);
    $row[] = $output->FormText('numitems',
                               pnVarPrepForDisplay($vars['numitems']),
                               5,
                               5);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);

    // Add row
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddRow($row, 'left');
    $output->SetInputMode(_PNH_PARSEINPUT);

    // Return output
    return $output->GetOutput();
}

/**
 * update block settings
 */
function articles_relatedblock_update($blockinfo)
{
    $vars['numitems'] = pnVarCleanFromInput('numitems');

    $blockinfo['content'] = serialize($vars);

    return $blockinfo;
}

/**
 * built-in block help/information system.
 */
function articles_relatedblock_help()
{
    $output = new pnHTML();

    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text('Any related block info should be placed in your modname_blocknameblock_help() function.');
    $output->LineBreak(2);
    $output->Text('More information.');
    $output->SetInputMode(_PNH_PARSEINPUT);

    return $output->GetOutput();
}

/*
Reminder of what this block used to do :-)

// ----------------------------------------------------------------------
// Original Author of file: Patrick Kellum
// Purpose of file: Display releated stories.  Only displayed when reading articles.
// ----------------------------------------------------------------------

$blocks_modules['related'] = array(
    'func_display' => 'blocks_related_block',
    'text_type' => 'Related',
    'text_type_long' => 'Story Related Links',
    'allow_multiple' => false,
    'form_content' => false,
    'form_refresh' => false,
    'show_preview' => false
);

// Security
pnSecAddSchema('Relatedblock::', 'Block title::');

function blocks_related_block($row)
{
    global $sid,
           $story // set by advarticle.php
           ;

    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();

    if (!pnSecAuthAction(0, 'Relatedblock::', "$row[title]::", ACCESS_READ)) {
        return;
    }

    if($story['topic']) {
        $row['content'] = '<font class="pn-normal">';
        $column = &$pntable['stories_column'];
        $sql = "SELECT $column[sid] as sid, $column[title] as title FROM $pntable[stories] WHERE $column[topic]=".pnVarPrepForStore($story['topic'])." ORDER BY $column[counter] DESC";
        $result = $dbconn->SelectLimit($sql,1);
        $mrow = $result->GetRowAssoc(false);
        $result->MoveNext();
        $column = &$pntable['related_column'];
        $result = $dbconn->Execute("SELECT $column[name] as name, $column[url] as url FROM $pntable[related] WHERE $column[tid]=".pnVarPrepForStore($story['topic'])."");
        while(!$result->EOF) {
            $lrow = $result->GetRowAssoc(false);
            $result->MoveNext();
            $row['content'] .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"$lrow[url]\" target=\"_blank\">".pnVarPrepForDisplay($lrow['name'])."</a><br>\n";
        }
        $row['content'] .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"advtopics.php?topic=$story[topic]\">"._MOREABOUT." ".pnVarPrepForDisplay($story['topicname'])."</a><br>\n"
            ."<strong><big>&middot;</big></strong>&nbsp;<a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=Search&amp;file=index&amp;action=search&amp;overview=1&amp;active_stories=1&amp;stories_author=$story[aid]\">"._NEWSBY." ".pnVarPrepForDisplay($story['aid'])."</a><br>\n"
            .'</font><br><hr noshade width="95%" size="1"><b>'._MOSTREAD." ".pnVarPrepForDisplay($story['topicname']).":</b><br>\n"
            ."<center><a href=\"advarticle.php?sid=$mrow[sid]\">".pnVarPrepForDisplay($mrow['title'])."</a></center><br><br>\n"
            .'<div align="right">'
            ."<a href=\"print.php?sid=$mrow[sid]\"><img src=\"images/global/print.gif\" border=\"0\" alt=\""._PRINTER."\"></a>&nbsp;&nbsp;"
            ."<a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=Recommend_Us&amp;file=index&amp;req=FriendSend&amp;sid=$sid\"><img src=\"images/global/friend.gif\" border=\"0\" Alt=\""._FRIEND."\"></a>\n"
            .'</div>'
        ;
        return themesideblock($row);
    }
}
*/

?>


Directory filter : [ all ] / postnuke_modules / articles / pnblocks [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3