Beispiel #1
0
function upevent($id, $title, $description, $email, $url, $cat, $bday, $bmonth, $byear, $starttimehr, $starttimemin, $endtimehr, $endtimemin, $startperiod, $endperiod)
{
    global $EVENTS_TB, $timezone, $notimeentry, $time12hour, $popupevent, $useFCKEditor, $mth, $mailevent, $userlogin, $emailrcpt, $CAT_TB;
    $title = addslashes($title);
    if ($useFCKEditor) {
        $description = addslashes($description);
    } else {
        $description = addslashes(nl2br($description));
    }
    echo $stime = '';
    echo $etime = '';
    if ($notimeentry == 0) {
        if ($starttimehr != "--") {
            if ($time12hour == 1) {
                $stime = convert12to24($starttimehr, $startperiod) . ":" . $starttimemin;
            } else {
                $stime = $starttimehr . ":" . $starttimemin;
            }
        }
        if ($endtimehr != "--") {
            if ($time12hour == 1) {
                $etime = convert12to24($endtimehr, $endperiod) . ":" . $endtimemin;
            } else {
                $etime = $endtimehr . ":" . $endtimemin;
            }
        }
    }
    // get the correct timezone offset for timestamping of event entries
    $timestamp = date("YmdHis", mktime(date("G") + $timezone, date("i"), date("s"), date("n"), date("j"), date("Y")));
    if (date("G") + $timezone > 24) {
        $timestamp = date("YmdHis", mktime(date("G") + $timezone - 24, date("i"), date("s"), date("n"), date("j") + 1, date("Y")));
    }
    if (date("G") + $timezone < 0) {
        $timestamp = date("YmdHis", mktime(date("G") + $timezone + 24, date("i"), date("s"), date("n"), date("j") - 1, date("Y")));
    }
    $timestamp = strval($timestamp);
    $query = "update " . $EVENTS_TB . " set timestamp='{$timestamp}',title='{$title}',description='{$description}',url='{$url}',email='{$email}',cat='{$cat}',day='{$bday}',month='{$bmonth}',year='{$byear}' ";
    if ($notimeentry == 0) {
        if ($starttimehr != "--") {
            if ($time12hour == 1) {
                $query = $query . ",starttime='" . convert12to24($starttimehr, $startperiod) . ":" . $starttimemin . "' ";
            } else {
                $query = $query . ",starttime='" . $starttimehr . ":" . $starttimemin . "' ";
            }
        } else {
            $query = $query . ",starttime='' ";
        }
        if ($endtimehr != "--") {
            if ($time12hour == 1) {
                $query = $query . ",endtime='" . convert12to24($endtimehr, $endperiod) . ":" . $endtimemin . "' ";
            } else {
                $query = $query . ",endtime='" . $endtimehr . ":" . $endtimemin . "' ";
            }
        } else {
            $query = $query . ",endtime='' ";
        }
    } else {
        $query = $query . ",starttime='' " . ",endtime='' ";
    }
    $query = $query . " where id='{$id}'";
    $result = mysql_query($query);
    echo "<script language=\"JavaScript\">\n";
    echo "<!--\n";
    if ($popupevent == 1) {
        echo "self.window.close();top.opener.window.location.href=\"cal_popup.php?reload=y&op=view&id={$id}\";\n";
    } else {
        echo "self.window.close();top.opener.window.location.reload();\n";
    }
    echo "</script>\n";
    // Mail portion
    if ($mailevent == 1) {
        $nobody = $emailrcpt;
        if ($userlogin == 1) {
            if (isset($_SESSION["login"])) {
                $nobody = $_SESSION["login"];
            }
        }
        $catquery = "select cat_name from " . $CAT_TB . " where cat_id={$cat}";
        $catresult = mysql_query($catquery);
        $catrow = mysql_fetch_object($catresult);
        $mailhead = translate("Date") . ": " . $bday . " " . $mth[$bmonth] . " " . $byear;
        $mailhead = $mailhead . "\r\n" . translate("From") . ": ";
        if ($time12hour == 1) {
            $mailhead = $mailhead . show12hour($stime);
        } else {
            $mailhead = $mailhead . $stime;
        }
        $mailhead = $mailhead . "     " . translate("To") . ": ";
        if ($time12hour == 1) {
            $mailhead = $mailhead . show12hour($etime);
        } else {
            $mailhead = $mailhead . $etime;
        }
        $mailhead = $mailhead . "\r\n" . translate("Category") . ": " . stripslashes($catrow->cat_name);
        $mailhead = $mailhead . "\r\n" . translate("Event Title") . ": " . stripslashes(stripslashes($title));
        $mailhead = $mailhead . "\r\n" . translate("Event Description") . ": \r\n\r\n";
        $maildesc = "\r\n\r\n" . translate("Email") . ": " . $email;
        $maildesc = $maildesc . "\r\n" . translate("More info") . ": " . $url;
        //	echo "<h3>".$mailhead."</h3>";
        mail($emailrcpt, "Event updated - " . stripslashes(stripslashes($title)) . " (" . $bday . " " . $mth[$bmonth] . " " . $byear . ") ", $mailhead . stripslashes(stripslashes(str_replace("<br />", "", $description))) . $maildesc, "From: " . $nobody . "\r\n" . "Reply-To: " . $nobody . "\r\n");
    }
}
Beispiel #2
0
function showtime($atime, $btime, $orientation)
{
    global $time12hour;
    if ($orientation == 0) {
        echo "<b>";
        if ($time12hour == 1) {
            echo show12hour($atime);
        } else {
            echo $atime;
        }
        if ($btime != '') {
            echo "&nbsp;-&nbsp;";
            if ($time12hour == 1) {
                echo show12hour($btime);
            } else {
                echo $btime;
            }
            echo " &nbsp; &nbsp; </b>";
        } else {
            echo " &nbsp; &nbsp; </b>";
        }
    } else {
        if ($orientation == 1) {
            if ($time12hour == 1) {
                echo show12hour($atime);
            } else {
                echo $atime;
            }
            if ($btime != '') {
                echo "<br/>";
                if ($time12hour == 1) {
                    echo show12hour($btime);
                } else {
                    echo $btime;
                }
            }
        } else {
            if ($orientation == 2) {
                if ($atime != "") {
                    echo "&nbsp; &nbsp; &nbsp; <b>" . translate("From") . " : </b>";
                    if ($time12hour == 1) {
                        echo show12hour($atime);
                    } else {
                        echo $atime;
                    }
                    echo "\n";
                    if ($btime != "") {
                        echo "&nbsp;&nbsp;<b>" . translate("To") . " : </b>";
                        if ($time12hour == 1) {
                            echo show12hour($btime);
                        } else {
                            echo $btime;
                        }
                        echo "\n";
                    }
                }
            }
        }
    }
}