<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
defined('MAXIMUS') or Header("Location: index.php");

if (defined('ADMIN_ALLOW')) {
	$supporters_ret       = CACHE_ASUPPORTERS;
	$name_supporters      = "Supporters";
	$supporters_extension = "php";
} else {
	$supporters_ret       = CACHE_VSUPPORTERS;
	$name_supporters      = "Supporters";
	$supporters_extension = "html";
}

incoh( "".$name_supporters."", "".$supporters_extension."",  "".$supporters_ret."", '2');

    $pagetitle = _SUPPORTERS;
    $sqlidx    = "SELECT * from `".TABLE_NSNSP_CONFIG."`";
    if ( !($result = $GLOBALS['db']->sql_query($sqlidx)) )
{ query_die(GENERAL_ERROR, 'Could not obtain nsnsp_config modules', '', __LINE__, __FILE__, $sqlidx);}
    $supporteridx = $GLOBALS['db']->sql_fetchrow($resultidx);
   // incoh();

    title(_SUPPORTERS);
    Max_OpenTable();
    echo "<center>";
    if (defined('ADMIN_ALLOW')) { echo "[ <a href='$admin_file.php?op=Supporters'>"._GOTOADMIN."</a> ]\n"; }
    if ($supporteridx['require_user'] == 0 || is_user($user)) { echo "[ <a href='modules.php?name=$module_name&amp;file=submit'>"._BESUPPORTER."</a> ]\n"; }
    echo "</center>";
    br('1');
    $a = 0;
    $sql = "SELECT `site_id`, `site_name`, `site_url`, `site_image`, `site_date`, `site_description`, `site_hits` FROM `".TABLE_NSNSP_SITES."` WHERE `site_status`='1' ORDER BY `site_name`";
    if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain nsnsp_sites modules', '', __LINE__, __FILE__, $sql);}
    $numrows = $GLOBALS['db']->sql_numrows($result);
    if ($numrows > 0) {
        echo "<table border='0' cellpadding='2' cellspacing='5' width='100%'>";
        while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
	$site_id          = $GLOBALS['db']->XMFnum($row['site_id']);
	$site_name        = stripslashes($row['site_name']);
	$site_url         = stripslashes($row['site_url']);
	$site_image       = stripslashes($row['site_image']);
	$site_date        = stripslashes($row['site_date']);
	$site_description = stripslashes($row['site_description']);
	$site_hits        = $GLOBALS['db']->XMFnum($row['site_hits']);
            if ($a == 0) { echo "<tr>"; }
            echo "<td width='50%' valign='top'>";
            Max_OpenTable();
            echo "<table border='0' width='100%'>";
            echo "<tr><td width='25%' align='center' valign='top' rowspan='3'>";
            echo "<a href='modules.php?name=$module_name&amp;op=go&amp;site_id=$site_id' target='_blank'><img src='$site_image' border='0' alt='$site_name' title='$site_name' height='31' width='88' /></a>";
            if (defined('ADMIN_ALLOW')) {
                echo " <a href='$admin_file.php?op=Supportersdeactivate&amp;site_id=$site_id'><img src='modules/$module_name/images/deactivate.gif' border='0' alt='"._DEACTIVATE."' title='"._DEACTIVATE."' /></a>";
                echo " <a href='$admin_file.php?op=Supportersedit&amp;site_id=$site_id'><img src='modules/$module_name/images/edit.gif' border='0' alt='"._EDIT."' title='"._EDIT."' /></a>";
                echo " <a href='$admin_file.php?op=Supportersdelete&amp;site_id=$site_id'><img src='modules/$module_name/images/delete.gif' border='0' alt='"._DELETE."' title='"._DELETE."' /></a>";
            }
            echo "</td>\n<td width='75%' valign='top'><b>"._SUPPORTERDATE.":</b> $site_date</td></tr>";
            echo "<tr><td valign='top'><b>"._SITEDESCRIPTION."</b>: $site_description</td></tr>";
            echo "<tr><td valign='top'><b>"._SITEHITS."</b>: $site_hits</td></tr>";
            echo "</table>";
            Max_CloseTable();
            echo "</td>";
            $a++;
            if ($a == 2) { echo "</tr>"; $a = 0; }
        }
        if ($a ==1) { echo "<td width='50%'>&nbsp;</td></tr></table>"; } else { echo "</table>"; }
    }
    Max_CloseTable();
    $GLOBALS['db']->sql_freeresult($result);
incof( "".$name_supporters."", "".$supporters_extension."",  "".$supporters_ret."", '2');