Просмотр файла includes/calendar.php

Размер файла: 2.13Kb
<?php
#-----------------------------------------------------#
#          ********* ROTORCMS *********               #
#             Made by   :  VANTUZ                     #
#               E-mail  :  [email protected]         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#        для его дальнейшего распространения          #
#-----------------------------------------------------#
if (!defined('BASEDIR')) {
	header('Location:../index.php');
	exit;
} 

$cal_den = date_fixed(SITETIME, "j");
$cal_mon = date_fixed(SITETIME, "m");
$cal_year = date_fixed(SITETIME, "Y");

$array_news = array();
$array_komm = array();

$querynews = DB::run() -> query("SELECT `news_id`, `news_time` FROM `news` WHERE EXTRACT(YEAR_MONTH FROM FROM_UNIXTIME(`news_time`))=EXTRACT(YEAR_MONTH FROM NOW());");

while ($data = $querynews -> fetch()) {
	$arrday = date_fixed($data['news_time'], 'j');
	$array_news[] = $arrday;
	$array_komm[$arrday] = $data['news_id'];
} 

$calend = make_calendar($cal_mon, $cal_year);

echo '<table><caption><b>'.date_fixed(SITETIME, 'j F Y').'</b></caption>';

echo '<thead><tr>';
echo '<th>Пн</th><th>Вт</th><th>Ср</th><th>Чт</th><th>Пт</th><th><span style="color:#ff6666">Сб</span></th><th><span style="color:#ff6666">Вс</span></th>';
echo '</tr></thead><tbody>';

foreach ($calend as $valned) {
	echo '<tr>';
	foreach ($valned as $keyday => $valday) {
		if ($cal_den == $valday) {
			echo '<td><b><span style="color:#ff0000">'.$valday.'</span></b></td>';
			continue;
		} 

		if (in_array($valday, $array_news)) {
			echo '<td><a href="'.BASEDIR.'news/index.php?act=read&amp;id='.$array_komm[$valday].'&amp;'.SID.'"><span style="color:#ff0000">'.$valday.'</span></a></td>';
			continue;
		} 

		if ($keyday == 5 || $keyday == 6) {
			echo '<td><span style="color:#ff6666">'.$valday.'</span></td>';
			continue;
		} 

		echo '<td>'.$valday.'</td>';
	} 
	echo '</tr>';
} 
echo '</tbody></table>';

?>