Beispiel #1
0
function date_i18n($dateformatstring, $unixtimestamp)
{
    $i = $unixtimestamp;
    $month = get_month_names('long');
    $month_abbrev = get_month_names('short');
    $weekday = get_day_names('long');
    $weekday_abbrev = get_day_names('short');
    if (!empty($month) && !empty($weekday)) {
        $datemonth = $month[intVal(date('m', $i))];
        $datemonth_abbrev = $month_abbrev[intVal(date('m', $i))];
        $dateweekday = $weekday[intVal(date('w', $i))];
        $dateweekday_abbrev = $weekday_abbrev[intVal(date('m', $i))];
        $dateformatstring = ' ' . $dateformatstring;
        $dateformatstring = preg_replace("/([^\\\\])D/", "\\1" . backslashit($dateweekday_abbrev), $dateformatstring);
        $dateformatstring = preg_replace("/([^\\\\])F/", "\\1" . backslashit($datemonth), $dateformatstring);
        $dateformatstring = preg_replace("/([^\\\\])l/", "\\1" . backslashit($dateweekday), $dateformatstring);
        $dateformatstring = preg_replace("/([^\\\\])M/", "\\1" . backslashit($datemonth_abbrev), $dateformatstring);
        $dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring) - 1);
    }
    $j = @date($dateformatstring, $i);
    return $j;
}
function process_set_times($post, $day)
{
    $venue = $_GET['venue'];
    $times = explode("-", $_GET['shift']);
    $start = $times[0];
    $end = $times[1];
    $shift_name = $post['shift_name'];
    if ($shift_name === "") {
        $shift_name = ucfirst($venue) . " Shift";
    }
    if ($post['new_end'] != 0) {
        $end = $post['new_end'];
    }
    if (!array_key_exists('_submit_change_times', $post)) {
        return false;
    }
    $entry = new MasterScheduleEntry($venue, $day, $start, $end, 0, "", $shift_name);
    if (!insert_nonoverlapping($entry)) {
        $error = "Can't insert a new shift into an overlapping time slot.<br><br>";
    }
    if (isset($error)) {
        echo $error;
        return false;
    } else {
        $day_name[] = [];
        $day_name = get_day_names($day_name, $day);
        echo "Added a new " . ucfirst($venue) . " shift for " . $day_name[1] . " which starts at " . explode(" to ", do_name($_GET['shift']))[0] . "<br><br>";
        add_log_entry('<a href=\\"personEdit.php?id=' . $_SESSION['_id'] . '\\">' . $_SESSION['f_name'] . ' ' . $_SESSION['l_name'] . '</a> added a new master schedule shift: <a href=\\"editMasterSchedule.php?' . "day=" . $day . "&shift=" . $post['shift_name'] . "&venue=" . $_GET['venue'] . '\\">' . " " . $day . $post['shift_name'] . '</a>.');
        return true;
    }
}