<?php // $Id: index.php,v 1.17.2.1 2002/03/23 11:56:36 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 - 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
// ----------------------------------------------------------------------
// Filename: modules/NS-Polls/index.php
// Original Author: Till Gerken (tig@skv.org)
// Purpose: Voting system
// ----------------------------------------------------------------------

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

$ModName = $GLOBALS['name'];
modules_get_language();

include_once 'includes/blocks/poll.php';

global $mode, $order, $thold;

// Don't delete this strings in 0.71 _LVOTES _NUMVOTES _ONEPERDAY _OTHERPOLLS
// _PASTSURVEYS _PCOMMENTS _POLLS _RESULTS _TOTALVOTES _VOTE _VOTING he-he

if (!isset($req)) {
    $req = '';
}
if (!isset($voteID)) {
    $voteID = '';
}

if(!isset($pollID)) {
 
    include ('header.php');
    pollList();
    include ('footer.php');

} elseif(isset($forwarder)) {

    pollCollector($pollID, $voteID, $forwarder);
    return true;
} elseif($req == "results" && $pollID > 0) {
    include ("header.php");
    OpenTable();
    print '<center><font class="pn-title">'._CURRENTPOLLRESULTS.'</font></center>';
    CloseTable();

    OpenTable2();
    pollResults($pollID);
    CloseTable2();
    if (pnConfigGetVar('pollcomm') && ($mode != "nocomments")) {
        print '<br><br>';
        include("modules/$ModName/comments.php");
    }
    include ("footer.php");
} elseif($voteID > 0) {
    pollCollector($pollID, $voteID);
    return true;
} elseif($pollID != pollLatest()) {
    include ('header.php');
    OpenTable();
    print '<center><font class="pn-title">'._POLL.'</font></center>';
    CloseTable();

    print '<table border="0" align="center"><tr><td>';
    $row = '';
    pollMain($pollID, $row);
    print '</td></tr></table>';
    
    include ('footer.php');
} else {

    include ('header.php');
    OpenTable();
    print '<center><font class="pn-title">'._CURRENTPOLL.'</font></center>';
    CloseTable();

    print '<table border="0" align="center"><tr><td>';
    pollNewest();
    print '</td></tr></table>';
    include ('footer.php');
}

?>