Example #1
0
<?php

if (!alcr_can_view($userdata['user_id'])) {
    redirect(START_PAGE);
}
require_once INCLUDES . "bbcode_include.php";
opentable($locale['alcr25'] . date('d.m.Y', strtotime(trim(stripinput($_GET['date'])))));
$result = dbquery("SELECT ev.*,u.user_name FROM " . DB_AL_CALENDAR_EVENTS . " ev LEFT JOIN " . DB_USERS . " u ON u.user_id=ev.alcr_event_user WHERE alcr_event_date='" . trim(stripinput($_GET['date'])) . "' ORDER BY alcr_event_time ASC");
if (dbrows($result)) {
    while ($data = dbarray($result)) {
        echo "<h3>" . $data['alcr_event_date'] . " " . $data['alcr_event_time'] . " - " . $data['alcr_event_title'] . " " . (alcr_can_admin($userdata['user_id']) ? "<a href='" . FUSION_SELF . "?p=manage_event&edit=" . $data['alcr_event_id'] . "'><img src='" . IMAGES . "edit.png' /></a> <a href='" . FUSION_SELF . "?p=manage_event&delete=" . $data['alcr_event_id'] . "'><img src='" . IMAGES . "no.png' /></a>" : "") . " <span class='small'>" . ($data['alcr_event_confirm'] == 1 ? $locale['alcr36'] : $locale['alcr37']) . "</span></h3>";
        echo "";
        echo "<div>" . parsesmileys(parseubb(nl2br($data['alcr_event_desc']))) . "</div>";
    }
} else {
    echo $locale['alcr26'];
}
closetable();
    $dof_class = $i > 5 ? "dof-tbl-v" : "dof-tbl-b";
    echo "<td class='" . $dof_class . "' width='" . round(100 / 7, 2) . "%'>" . $locale['alcr_dof_' . $i] . "</td>";
}
echo "</tr>";
foreach ($weeks as $week) {
    echo "<tr valign='top'>";
    $i = 1;
    foreach ($week as $day) {
        $day_class_event = '';
        if ($day != '') {
            $day_class = $i > 5 ? "dof-tbl1-v" : "dof-tbl1-b";
            if (isset($events[$day])) {
                $day_class_event = $i > 5 ? " dof-tbl1-event-v" : " dof-tbl1-event-b";
            }
        } else {
            $day_class = "dof-tbl-none";
        }
        echo "<td class='" . $day_class . $day_class_event . (date('Y-m-j') == $year . "-" . $month . "-" . $day ? " dof-current" : "") . "'>" . ($day != '' ? "<a href='" . FUSION_SELF . "?p=day&date=" . $year . "-" . $month . "-" . $day . "' class='td-link'>" : "") . "<div style='width:" . $cell_width . ";' class='ellipsis'><span class='day-num " . ($i > 5 ? "v" : "b") . "'>" . $day . "</span>" . ($day != '' && alcr_can_admin($userdata['user_id']) ? " <img src='" . IMAGES . "plus.png' width='16' class='add-event-icon' data-url='" . FUSION_SELF . "?p=manage_event&date=" . $year . "-" . $month . "-" . $day . "' />" : "") . "<br />";
        if (isset($events[$day])) {
            foreach ($events[$day] as $event) {
                echo "<span class='" . ($event['alcr_event_confirm'] == 1 ? "event-confirmed" : "event-non-confirmed") . "'>" . substr($event['alcr_event_time'], 0, 5) . " " . $event['alcr_event_title'] . "</span><br />";
            }
        }
        echo "</div>" . ($day != '' ? "</a>" : "") . "</td>";
        $i++;
    }
    echo "</tr>";
}
echo "</table>";
echo "<script>\r\n    \$(document).ready(function(){\r\n        var stock_url = '" . FUSION_SELF . "?p=index&';\r\n        \$('select[name=change_month]').change(function(){\r\n            location.href = stock_url + 'month=' + \$(this).val() + '&year=" . $year . "';\r\n        });\r\n        \$('select[name=change_year]').change(function(){\r\n            location.href = stock_url + 'month=" . $month . "&year=' + \$(this).val();\r\n        });\r\n        \$('.add-event-icon').click(function(event){\r\n            event.preventDefault();\r\n            location.href = \$(this).attr('data-url');\r\n        });\r\n    });\r\n</script>";
//echo showdate("forumdate",strtotime("2013-02-14 12:00:00"));
<?php

if (!alcr_can_admin($userdata['user_id'])) {
    redirect(START_PAGE);
}
require_once INCLUDES . "bbcode_include.php";
if (isset($_POST['save'])) {
    $title = trim(stripinput($_POST['title']));
    $desc = trim(stripinput($_POST['desc']));
    $date = array('year' => $_POST['date']['year'], 'month' => $_POST['date']['month'], 'day' => $_POST['date']['day'], 'hour' => $_POST['date']['hour'], 'minute' => $_POST['date']['minute']);
    $confirm = $_POST['confirm'];
    if (isset($_POST['event_id']) && isnum($_POST['event_id'])) {
        $result = dbquery("UPDATE " . DB_AL_CALENDAR_EVENTS . " SET alcr_event_date='" . $date['year'] . "-" . $date['month'] . "-" . $date['day'] . "',alcr_event_time='" . $date['hour'] . ":" . $date['minute'] . ":00',alcr_event_user='******'user_id'] . "',alcr_event_title='" . $title . "',alcr_event_desc='" . $desc . "',alcr_event_confirm='" . $confirm . "' WHERE alcr_event_id='" . $_POST['event_id'] . "'");
    } else {
        $result = dbquery("INSERT INTO " . DB_AL_CALENDAR_EVENTS . " (alcr_event_date,alcr_event_time,alcr_event_user,alcr_event_title,alcr_event_desc,alcr_event_confirm) VALUES ('" . $date['year'] . "-" . $date['month'] . "-" . $date['day'] . "','" . $date['hour'] . ":" . $date['minute'] . ":00','" . $userdata['user_id'] . "','" . $title . "','" . $desc . "','" . $confirm . "')");
    }
    redirect(FUSION_SELF . "?p=day&date=" . $date['year'] . "-" . $date['month'] . "-" . $date['day']);
} else {
    if (isset($_GET['delete']) && isnum($_GET['delete'])) {
        $result = dbquery("SELECT * FROM " . DB_AL_CALENDAR_EVENTS . " WHERE alcr_event_id='" . $_GET['delete'] . "'");
        if (dbrows($result)) {
            $result = dbquery("DELETE FROM " . DB_AL_CALENDAR_EVENTS . " WHERE alcr_event_id='" . $_GET['delete'] . "'");
        }
        redirect(FUSION_SELF);
    } else {
        if (isset($_GET['edit']) && isnum($_GET['edit'])) {
            $result = dbquery("SELECT * FROM " . DB_AL_CALENDAR_EVENTS . " WHERE alcr_event_id='" . $_GET['edit'] . "'");
            if (dbrows($result)) {
                $data = dbarray($result);
                $is_edit = true;
                $event_id = $data['alcr_event_id'];