check_time_format() public static method

Check if a parset string matches with the following time-formatting: 20.08.2008-19:00:00.
public static check_time_format ( string $timestring ) : boolean
$timestring string
return boolean
Exemplo n.º 1
0
 $data['designation'] = $_REQUEST['designation'];
 $data['comment'] = isset($_REQUEST['comment']) && !empty($_REQUEST['comment']) ? $_REQUEST['comment'] : '';
 $data['commentType'] = $_REQUEST['commentType'];
 $data['refundable'] = getRequestBool('refundable');
 $data['multiplier'] = getRequestDecimal($_REQUEST['multiplier']);
 $data['value'] = getRequestDecimal($_REQUEST['edit_value']);
 $data['userID'] = $kga['user']['userID'];
 if (!is_numeric($data['multiplier']) || $data['multiplier'] <= 0) {
     $errors['multiplier'] = $kga['lang']['errorMessages']['multiplierNegative'];
 }
 // parse new day and time
 $edit_day = Kimai_Format::expand_date_shortcut($_REQUEST['edit_day']);
 $edit_time = Kimai_Format::expand_time_shortcut($_REQUEST['edit_time']);
 // validate day and time
 $new = "{$edit_day}-{$edit_time}";
 if (!Kimai_Format::check_time_format($new)) {
     $errors[''] = $kga['lang']['TimeDateInputError'];
 }
 // convert to internal time format
 $new_time = convert_time_strings($new, $new);
 $data['timestamp'] = $new_time['in'];
 expenseAccessAllowed($data, $action, $errors);
 if (count($errors) > 0) {
     echo json_encode(array('errors' => $errors));
     break;
 }
 $result = false;
 if ($id) {
     if (expense_edit($id, $data) === false) {
         $errors[''] = $kga['lang']['error'];
     }