Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/modules/News/article.php
<?php
// File: $Id: article.php,v 1.20 2001/12/04 13:07:50 jgm 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
// Copyright (C) 2001 by Francisco Burzi (hide@address.com)
// http://www.phpnuke.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 this file: Francisco Burzi
// Purpose of this file: 
// ----------------------------------------------------------------------

if (!defined("LOADED_AS_MODULE")) {
         die ("You can't access this file directly...");
     }

if (empty($sid) && empty($tid)) {
    exit();
}

$ModName = $GLOBALS['name'];

modules_get_language();

global $pntable, $save, $op;

include 'mainfile.php';
pninclude_once("modules/$ModName/funcs.php");
$page = "modules/News/article.php";

//FTO Remove warning
if (!isset($mode)) $mode='';


 // Security fix credit to Magnus Skjegstad <hide@address.com> and Karateka  if ($save) { 
 if (($save) &&  (is_user($user))) { 
    cookiedecode($user);
    $column = &$pntable['users_column'];
    $dbconn->Execute("UPDATE $pntable[users] SET $column[umode]='$mode', $column[uorder]=$order, $column[thold]=$thold WHERE $column[uid]=$cookie[0]");
    getusrinfo($user);
    $info = base64_encode("$userinfo[uid]:$userinfo[uname]:$userinfo[pass]:$userinfo[storynum]:$userinfo[umode]:$userinfo[uorder]:$userinfo[thold]:$userinfo[noscore]");
    setcookie("user","$info",time()+$cookieusrtime);
}

if ($op == "Reply") {
    pnRedirect('modules.php?op=modload&amp;name=NS-Comments&amp;file=index'
                      .'&amp;req=Reply&amp;pid=0&amp;sid='.$sid.'&amp;mode='
                      .$mode.'&amp;order='.$order.'&amp;thold='.$thold);
}

// Get the article we're looking at
$results = getArticles("{$pntable['stories_column']['sid']}=$sid", "", "");
$info = genArticleInfo($results[0]);
if (!authorised(0, 'Stories::', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_READ)) {
   include "header.php";
   echo "Not authorised to view story \"$info[title]\"";
   include "footer.php";
   exit;
}
$links = genArticleLinks($info);
$preformat = genArticlePreformat($info, $links);

$column = &$pntable['stories_column'];
$dbconn->Execute("UPDATE $pntable[stories] SET $column[counter]=$column[counter]+1 WHERE $column[sid]=$sid");

// set theme overrides prior to header
$themeOverrideCategory = $info['catthemeoverride'];
$themeOverrideStory = $info['themeoverride'];

$artpage = 1;
include ("header.php");
$artpage = 0;

// Backwards compatibility
formatTimestamp(GetUserTime($info['time']));
$notes = $info['notes'];

echo "<table width=\"100%\" border=\"0\"><tr><td valign=\"top\" width=\"85%\">\n";

if ($postnuke_theme) {
    themearticle($info['aid'], $info['informant'], $info['time'], $info['catandtitle'], $preformat['maintext'], $info['topic'], $info['topicname'], $info['topicimage'], $info['topictext'], $info, $links, $preformat);
} else {
    themearticle($info['aid'], $info['informant'], $info['time'], $info['catandtitle'], $preformat['maintext'], $info['topic'], $info['topicname'], $info['topicimage'], $info['topictext']);
}


if($nobox == 0) {
    echo "</td><td>&nbsp;</td><td valign=\"top\">\n";

    $column = &$pntable['blocks_column'];
    $myquery = buildSimpleQuery ('blocks', array ('active', 'position', 'weight'), "$column[bkey]='login'");
    $result = $dbconn->Execute($myquery);
//FTO . Test EOF and database error
    if (!$result) {
        PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
        die();
    }
    while(!$result->EOF) {
        list($active, $position, $weight) = $result->fields;
        $result->MoveNext();
        if($active == '1' & $position == 'r'){
            $row = array();
            blocks_login_block($row);
        }
    }

    // Only do topic things if the story had a topic
    if (!empty($info['tid'])) {
        $boxtitle = "<font class=\"pn-title\">"._RELATED."</font>";
        $boxstuff = "<font class=\"pn-normal\">";

        $column = &$pntable['related_column'];
        $myquery = buildSimpleQuery ('related', array ('name', 'url'), "$column[tid]=$info[tid]");
        $result = $dbconn->Execute($myquery);
// FTO Check EOF and databse error
        if (!$result) {
               PN_DBMsgError($dbconn, __FILE__, __LINE__, "An error ocurred");
               die();
            }
        while(!$result->EOF) {

            list($name, $url) = $result->fields;

            $result->MoveNext();
            $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<a class=\"pn-normal\" href=\"$url\" target=\"new\">$name</a><br>\n";
        }

        $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<a class=\"pn-normal\" ";
        $boxstuff .= "href=\"modules.php?op=modload&amp;name=Search&amp;file=index&amp;";
        $boxstuff .= "action=search&amp;overview=1&amp;active_stories=1&amp;";
        $boxstuff .= "stories_topics[0]=$info[tid]\"";
        $boxstuff .= ">"._MOREABOUT." $info[topictext]</a><br>\n";

        $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<a class=\"pn-normal\" ";
        $boxstuff .= "href=\"modules.php?op=modload&amp;name=Search&amp;file=index&amp;";
        $boxstuff .= "action=search&amp;overview=1&amp;active_stories=1&amp;";
        $boxstuff .= "stories_author=$info[informant]\"";
        $boxstuff .= ">"._NEWSBY." $info[informant]</a><br>\n";

        if ( $autolinkpref > 0) { 
            // let the link list build by AutoLink
            $boxstuff .= $boxlink;
        } else {
        }

        $boxstuff .= "</font><br><hr noshade width=\"95%\" size=\"1\"><center><font class=\"pn-normal\">"._MOSTREAD." $info[topictext]:<br>\n";

        // Last story on this topic
        $column = &$pntable['stories_column'];
        $results = getArticles("$column[topic]=$info[tid]", "$column[counter] DESC", 1);
        $row = $results[0];
        $info = genArticleInfo($row);
        $links = genArticleLinks($info);
        $preformat = genArticlePreformat($info, $links);

        $boxstuff .= "$preformat[title]</font></center><br>";
        $boxstuff .= "<table border=\"0\" width=\"100%\"><tr><td align=\"left\">\n";
        $boxstuff .= "</td><td align=\"right\">\n";
        $boxstuff .= "</td></tr></table>\n";

        $tbl = 180;
        $box['title'] = $boxtitle;
        $box['content'] = $boxstuff;
        themesideblock($box);
    }
}

$tbl = 0;
echo "</td></tr></table>\n";
cookiedecode($user);

if ($info['withcomm'] == 0) {
    if ($mode != "nocomments") {
        include("modules/NS-Comments/index.php");
    }
}

include ("footer.php");
?>
Return current item: ProNuke. Postnuke To Oracle