View file template/calendar.php

File size: 1.52Kb
<?php
// mod by Golem http://veplog.ru

if (!defined("BASEDIR")) { header("Location:../index.php"); exit; }

$nfile=file(BASEDIR."local/news.dat");
$nfile=array_reverse($nfile);
for($ni=0;$ni<31;$ni++){
$ndata=explode('|',$nfile[$ni]);
if($ndata[2]!==""){
	
if(substr($ndata[2], 0, 1)=="0"){$ndata[2]=substr($ndata[2],1); }
$array_news[]=$ndata[2];
$array_komm[$ndata[2]]=$ndata[5];
}
}

$now=getdate();
$cal=makeCal ($now['year'], $now['mon']);

echo '<table>
<tr>
<td>Пн</td>
<td>Вт</td>
<td>Ср</td>
<td>Чт</td>
<td>Пт</td>
<td style="color:#FF0000">Сб</td>
<td style="color:#FF0000">Вс</td>
</tr>';

foreach ($cal as $row) {
echo '<tr>';
foreach ($row as $i=>$v) {

if($i==5 || $i==6){	
$tdcal='<td align="center" style="padding: 3px; background-color:#f4efef; color:#FF0000;">';
}else{
$tdcal='<td align="center" style="padding: 3px; background-color:#f4efef; color:#666666;">';}

if($v!=""){
$cal_date=$v.'.'.date("m",$sitetime).'.'.date("y",$sitetime);
$cal_den=date("j",$sitetime);

if($cal_den==$v){
$tdcal='<td align="center" style="padding: 3px; background-color:#ffcccc; color:#FF0000;">';}

if(in_array($cal_date,$array_news)){
$tdcal='<td align="center" style="padding: 3px; background-color:#e7dfdf; color:#FF0000;">'; 

echo $tdcal.'<b><a href="'.BASEDIR.'news/komm.php?id='.$array_komm[$cal_date].'&amp;'.SID.'"><font color="#FF0000">'.$v.'</font></a></b></td>';

}else{echo $tdcal.$v.'</td>';}

}else{echo $tdcal.'&nbsp;</td>';}

}
echo '</tr>';
}
echo '</table>';

?>