<?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                                 */
/************************************************************************/

	incoh();
    $newlinkshowdays = $db->XMFnum(trim($newlinkshowdays));
	menu(1);
	br('1');
	Max_OpenTable();
	echo "<center><font class=\"option\"><b>"._NEWLINKS."</b></font></center><br />";
	$counter = 0;
	$allweeklinks = 0;
	while ($counter <= 7-1){
		$newlinkdayRaw = (time()-(86400 * $counter));
		$newlinkday = date("d-M-Y", $newlinkdayRaw);
		$newlinkView = date("F d, Y", $newlinkdayRaw);
		$newlinkDB = Date("Y-m-d", $newlinkdayRaw);
		$totallinks = $db->sql_numrows($db->sql_query("SELECT * FROM ".TABLE_LINKS_LINKS." WHERE date LIKE '%$newlinkDB%'"));
		$counter++;
		$allweeklinks = $allweeklinks + $totallinks;
	}
	$counter = 0;
	while ($counter <=30-1){
		$newlinkdayRaw = (time()-(86400 * $counter));
		$newlinkDB = Date("Y-m-d", $newlinkdayRaw);
		$totallinks = $db->sql_numrows($db->sql_query("SELECT * FROM ".TABLE_LINKS_LINKS." WHERE date LIKE '%$newlinkDB%'"));
		$allmonthlinks = $allmonthlinks + $totallinks;
		$counter++;
	}
	echo "<center><b>"._TOTALNEWLINKS.":</b> "._LASTWEEK." - $allweeklinks \ "._LAST30DAYS." - $allmonthlinks<br />"
	.""._SHOW.": <a href=\"modules.php?name=$module_name&amp;l_op=NewLinks&amp;newlinkshowdays=7\">"._1WEEK."</a> - <a href=\"modules.php?name=$module_name&amp;l_op=NewLinks&amp;newlinkshowdays=14\">"._2WEEKS."</a> - <a href=\"modules.php?name=$module_name&amp;l_op=NewLinks&amp;newlinkshowdays=30\">"._30DAYS."</a>"
	."</center><br />";
	/* List Last VARIABLE Days of Links */
	if (!isset($newlinkshowdays)) {
		$newlinkshowdays = 7;
	}
	echo "<br /><center><b>"._TOTALFORLAST." $newlinkshowdays "._DAYS.":</b><br /><br />";
	$counter = 0;
	$allweeklinks = 0;
	while ($counter <= $newlinkshowdays-1) {
		$newlinkdayRaw = (time()-(86400 * $counter));
		$newlinkday = date("d-M-Y", $newlinkdayRaw);
		$newlinkView = date("F d, Y", $newlinkdayRaw);
		$newlinkDB = Date("Y-m-d", $newlinkdayRaw);
		$totallinks = $db->sql_numrows($db->sql_query("SELECT * FROM ".TABLE_LINKS_LINKS." WHERE date LIKE '%$newlinkDB%'"));
		$counter++;
		$allweeklinks = $allweeklinks + $totallinks;
		echo "<strong><big>&middot;</big></strong> <a href=\"modules.php?name=Web_Links&amp;l_op=NewLinksDate&amp;selectdate=$newlinkdayRaw\">$newlinkView</a>&nbsp;($totallinks)<br />";
	}
	$counter = 0;
	$allmonthlinks = 0;
	echo "</center>";
	Max_CloseTable();
	incof();