<?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");

incoh( 'Archives', 'html',  "".CACHE_VARCHIVES."", '1' );

	title(""._STORIESARCHIVE."");
	Max_OpenTable();
	echo "<center><font class=\"content\">"._SELECTMONTH2VIEW."</font><br /><br /></center>";
	br('2');
	$sql = "SELECT `time` from `".TABLE_STORIES."` order by `time` DESC";
	if ( !($result = $db->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain stories', '', __LINE__, __FILE__, $sql);}
	echo "<ul>";
	while($row = $db->sql_fetchrow($result)) {
		$time = stripslashes($row['time']);
		ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $getdate);
		if ($getdate[2] == "01") { $month = _JANUARY; } elseif ($getdate[2] == "02") { $month = _FEBRUARY; } elseif ($getdate[2] == "03") { $month = _MARCH; } elseif ($getdate[2] == "04") { $month = _APRIL; } elseif ($getdate[2] == "05") { $month = _MAY; } elseif ($getdate[2] == "06") { $month = _JUNE; } elseif ($getdate[2] == "07") { $month = _JULY; } elseif ($getdate[2] == "08") { $month = _AUGUST; } elseif ($getdate[2] == "09") { $month = _SEPTEMBER; } elseif ($getdate[2] == "10") { $month = _OCTOBER; } elseif ($getdate[2] == "11") { $month = _NOVEMBER; } elseif ($getdate[2] == "12") { $month = _DECEMBER; }
		if ($month != $thismonth) {
			$year = $getdate[1];
			echo "<li><a href=\"modules.php?name=$module_name&amp;sa=show_month&amp;year=$year&amp;month=$getdate[2]&amp;month_l=$month\">$month, $year</a>";
			$thismonth = $month;
		}
	}
	echo "</ul>";
	br('3');
	echo "<center>"
	."<form action=\"modules.php?name=Search\" method=\"post\">"
	."<input type=\"text\" name=\"query\" size=\"30\" />&nbsp;"
	."<input type=\"submit\" value=\""._SEARCH."\" />"
	."</form>";
	br('2');
	echo "[ <a href=\"modules.php?name=$module_name&amp;sa=show_all\">"._SHOWALLSTORIES."</a> ]</center>";
	$db->sql_freeresult($result);
	Max_CloseTable();

incof( 'Archives', 'html',  "".CACHE_VARCHIVES."", '1' );