function newEvent($date,$title,$text,$operation) {
global $dblink,$siteConfig,$visitorInfo,$tzNOW,$user,$admin;
if (isAdmin($admin)) {
$row = $dblink->get_row("SELECT email FROM memht_utenti WHERE user='$user'");
$dbuser = $user;
$dbemail = outCode($row['email']);
switch($operation) {
case "add":
@session_start();
if ((isset($_POST['post_code_page']) AND isset($_SESSION['chk_calendar']) AND strtolower($_POST['post_code_page'])==strtolower($_SESSION['chk_calendar'])) OR !(extension_loaded('gd') AND $siteConfig['graphic_check']==1)) {
$save = true;
if (!eregi("^([0-9]{4}-[0-9]{2}-[0-9]{2})$",$date)) { $save = false; $msg = "<b>"._EMPTY_."/"._SYNTAX_ERROR_."</b>: "._DATE_; }
if ($title=="") { $save = false; $msg = "<b>"._EMPTY_."</b>: "._TITLE_; }
if ($text=="") { $save = false; $msg = "<b>"._EMPTY_."</b>: "._TEXT_; }
if ($save) {
$dblink->query("INSERT INTO memht_calendar_events (id,date,title,text,autoDato,author,ip)
VALUES (null,'$date','$title','$text','$tzNOW','$user','".$visitorInfo['ip']."')");
$date = explode("-",$date);
$year = $date[0];
$month = $date[1];
$day = $date[2];
echo "<meta http-equiv='refresh' content='0;URL=index.php?page=calendar&op=events&year=$year&month=$month&day=$day'>";
} else {
echo "<div align='center' id='errorText' class='box'><b>"._FIELDINVALID_."</b><br>$msg</div>";
}
} else {
echo "<div align='center' id='errorText' class='box'><b>"._WRONGSECCODE_."</b></div>";
}
break; |