Esempio n. 1
0
/**
 * Test date and time for proper format
 *
 * @access	public
 * @param	string	date as string value
 * @param	string	format of date to test against
 * @param	string	delimiter of date value given for testing 
 * @return	boolean
 */
function valid_date_time($date, $format = "ymd", $delimiter = "-")
{
    return valid_date($date, $format, $delimiter) && valid_time($date);
}
Esempio n. 2
0
function valid_timestamp($timestamp)
{
    list($date, $time) = explode(" ", $timestamp, 2);
    return valid_date($date) && valid_time($time);
}
Esempio n. 3
0
 case 'correct_schedule':
     $no_time_errors = true;
     if ('' === $_POST['action']) {
         $_ERRORS['action'] = __('Musisz tytuł wykonywanego zadania.');
     }
     if ('' === $_POST['start']) {
         $_ERRORS['start'] = __('Musisz podać godzinę rozpoczęcia.');
         $no_time_errors = false;
     } elseif (!valid_time($_POST['start'], $start)) {
         $_ERRORS['start'] = __('Podaj godzinę w formacie hh:mm.');
         $no_time_errors = false;
     }
     if ('' === $_POST['finish']) {
         $_ERRORS['finish'] = __('Musisz podać godzinę zakończenia.');
         $no_time_errors = false;
     } elseif (!valid_time($_POST['finish'], $finish)) {
         $_ERRORS['finish'] = __('Podaj godzinę w formacie hh:mm.');
         $no_time_errors = false;
     }
     if ($no_time_errors === true) {
         $start_sec = $start[0] * 3600 + $start[1] * 60;
         $finish_sec = $finish[0] * 3600 + $finish[1] * 60;
         if ($start_sec > $finish_sec) {
             $_ERRORS['finish'] = __('Godzina zakończenia musi być późniejsza niż godzina rozpoczęcia.');
         } else {
             $this_schedule = DB::instance()->query('SELECT week_day FROM schedule WHERE id = "' . $_GET['id'] . '"')->fetchAll();
             $schedules = DB::instance()->query('SELECT id, start, finish, action FROM schedule WHERE week_day="' . $this_schedule[0]['week_day'] . '" AND id != "' . $_GET['id'] . '" ORDER BY start');
             $schedules_array = $schedules->fetchAll();
             $in_time_interval = false;
             for ($i = 0; $i <= 86400; $i += 60) {
                 if ($finish_sec == $i && $in_time_interval) {
Esempio n. 4
0
            $cur = strtotime($interval, $cur);
        }
    } else {
        if ($type == 'other') {
            $eventNo = createEvent($_POST['name'], 'other', $call, $done, $_POST['location'], $_POST['points'], $_POST['semester'], $_POST['comments'], 0, 1);
        } else {
            $eventNo = createRehearsal($_POST['name'], $type, $call, $done, $_POST['location'], $_POST['points'], $_POST['semester'], $_POST['comments'], $type == 'rehearsal' ? 0 : $_POST['section']);
        }
    }
} else {
    if ($type == 'volunteer' || $type == 'tutti') {
        $perftime = $_POST['perftime'];
        if ($perftime == '') {
            $perftime = $_POST['calltime'];
        }
        if (!valid_time($perftime)) {
            die("Bad performance time");
        }
        $unixperform = strtotime($perftime . ' ' . $_POST['calldate']);
        $perform = date('Y-m-d H:i:s', $unixperform);
        if ($unixperform < $unixcall || $unixperform > $unixdone) {
            die("Performance time not between start and end");
        }
        $eventNo = createGig($_POST['name'], $type == 'tutti' ? true : false, $call, $perform, $done, $_POST['location'], $_POST['points'], $_POST['semester'], $_POST['comments'], $_POST['uniform'], $_POST['cname'], $_POST['cemail'], $_POST['cphone'], $_POST['price'], isset($_POST['gigcount']), isset($_POST['public']), $_POST['summary'], $_POST['description']);
    } else {
        die("Bad event type");
    }
}
if ($eventNo < 0) {
    die("Error {$eventNo}");
}