<?
include ('template.inc');
include ('variable.inc');
/*
------------------------------------------------------------------------
* Nanou Morgan Web http://www.vmedia.com.au
* NoticeBoard version 1.1 Personal Web http://www.nanou.com.au
* January 2001 Email: nanou@nanou.com.au
________________________________________________________________________
*/
//$Categ=$Category;
$CategoryN = strtr($Category, "_", " ");
$title ="$CategoryN";
$today = date("Ymd");
if(!isset($ID)){
$content .="<P><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>$title</b></font><br><ul>";
$database = fopen ($noticeB_file, "r");
flock($database,1);
while (!(feof($database) ) ) {
$buffer = fgets($database, 4096);
//clean old entries out
$entry = explode("\t" , $buffer);
for ($k=0; $k<count($entry); $k++) {
$AN =substr("$entry[0]",0,4);
$MOIS =substr("$entry[0]",4,2);
$JOUR =substr("$entry[0]",6,2);
$Duration =$entry[0] + $entry[12];
$digit =substr("$Duration",4,2);
if($digit >12){ $YEAR = substr("$Duration",0,4) +1;
$MONTH= $digit -12;
$EndTime = "$YEAR"."0"."$MONTH".substr("$Duration",6,2);
}
else{$EndTime =$Duration;}
if ($today > $EndTime){
$SAVE_NEW="YES";
if($entry[8]){ unlink($path_pix."$entry[8]");}
unset($entry);
}
else{
$cat = explode("," , $entry[2]);
for ($i=0; $i<count($cat); $i++) {
if ($cat[$i] == "$Category"){
$VERIFY ="YES";
$entry[6]=stripslashes($entry[6]);
$content.= "<font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><li><a href=\"list.html?Category=$Category&ID=$entry[1]\">$entry[6]</a> - <i>(Posted on : $JOUR-$MOIS-$AN)</i></li></font></font><br>";
}
}
}
if(!isset($entry[0])){$NewContent .="";}else
{$NewContent .= ("$entry[0]\t$entry[1]\t$entry[2]\t$entry[3]\t$entry[4]\t$entry[5]\t$entry[6]\t$entry[7]\t$entry[8]\t$entry[9]\t$entry[10]\t$entry[11]\t$entry[12]\r");}
break;}
}
fclose($database);
$content .="</ul><p><center><FORM><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1)\"></FORM></center></p>";
if ($VERIFY !="YES"){$content.= "There are no entry under this category- <br>";}
if($SAVE_NEW =="YES"){
//Dummy initial filehandle to obtain lock via
$fd = fopen($noticeB_file,"w");
$locked = flock($fd,2); #Exclusive blocking lock
if (!$locked) {
print "Error: timeout obtaining lock"; exit;
}
//Second (actually used) filehandle
$database = fopen($noticeB_file ,"w");
if (!($database)){
print ("Error:\n");
print ("File '$database' could not be opened\n");
exit;
}
$NewEntries = explode("\r" , $NewContent);
for ($x=0; $x<count($NewEntries); $x++) {
fputs($database, "$NewEntries[$x]");
}
//fputs($database, "\n");
fclose($database);
fclose($fd);
}
}
if(isset($ID)){
$database = fopen ($noticeB_file, "r");
flock($database,1);
while (!(feof($database) ) ) {
$buffer = fgets($database, 4096);
$entry = explode("\t" , $buffer);
for ($k=0; $k<count($entry); $k++) {
if ($entry[1] == "$ID"){
$content .="<center><table border=2 cellpadding=5 cellspacing=3 width=100% background=\"/images/l2_left_menus.gif\"><tr><td><center><table border=0 cellpadding=4 cellspacing=0 width=100% background=\"/images/BBcream.gif\">
<tr><td colspan=2> <font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>Category:<font color=\"#993333\"> $title </font>";
if ( $entry[8]) {$content .="</b></font></td><td rowspan=6><img src=\"$view_pix/$entry[8]\" width=\"$entry[9]\" height=\"$entry[10]\" align=\"right\"></td></tr>";
} else {$content .="</b></font></td></tr>";}
$content .="
<tr><td colspan=2><center><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>";
$content .= stripslashes($entry[6]);
$content .="</b></font></center></td></tr>
<tr><td colspan=2 valign=\"top\"><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\">";
$content .= stripslashes($entry[7]);
if ( $entry[11]) {$content .="</font>
<br><br><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>Web Page for more informations:</b></font><br>
<font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><a href=\"http://$entry[11]\" target=\"New\">$entry[11]</a></font></td></tr>
";
} else {$content .="</font></td></tr>";}
$content .="
<tr><td valign=\"top\" align=\"right\"><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>Name:</b></font></td><td valign=\"top\"><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\">$entry[3]</font></td></tr>
<tr><td valign=\"top\" align=\"right\"><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>Email:</b></font></td><td valign=\"top\"><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><a href=\"mailto:$entry[4]\">$entry[4]</a></font></td></tr>
<tr><td valign=\"top\" align=\"right\"><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\"><b>Contact:</b></font></td><td valign=\"top\"><font face=\"Helvetica,Arial,Geneva\"><font size=\"2\">$entry[5] </font></td></tr>
</table></center></td></tr></table>
";break;
}
}
}
fclose($database);
$content .="<p><FORM><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1)\"></FORM></center>";
}
/* parse to template */
$t = new Template( $path);
// create a template object named $t
$t->set_file( "MyFileHandle", "$template");
// set MyFileHandle = our template file
$t->set_var(array( "TITLE" => $title,
"FOOTER" => $bot,
"CONTENT" => $content));
// set template variable
$t->parse( "MyOutput", "MyFileHandle");
// set template variable MyOutput = parsed file
$t->p( "MyOutput"); // output the value of MyOutput (our parsed data)
?>
|