$result = false; error(_s('"%s" must be between 1970.01.01 and 2038.01.18.', _('Till'))); } if ($result) { $new_service_time['ts_from'] = mktime($_REQUEST['new_service_time_from_hour'], $_REQUEST['new_service_time_from_minute'], 0, $_REQUEST['new_service_time_from_month'], $_REQUEST['new_service_time_from_day'], $_REQUEST['new_service_time_from_year']); $new_service_time['ts_to'] = mktime($_REQUEST['new_service_time_to_hour'], $_REQUEST['new_service_time_to_minute'], 0, $_REQUEST['new_service_time_to_month'], $_REQUEST['new_service_time_to_day'], $_REQUEST['new_service_time_to_year']); $new_service_time['note'] = $_REQUEST['new_service_time']['note']; } } else { $new_service_time['ts_from'] = dowHrMinToSec($_REQUEST['new_service_time']['from_week'], $_REQUEST['new_service_time']['from_hour'], $_REQUEST['new_service_time']['from_minute']); $new_service_time['ts_to'] = dowHrMinToSec($_REQUEST['new_service_time']['to_week'], $_REQUEST['new_service_time']['to_hour'], $_REQUEST['new_service_time']['to_minute']); $new_service_time['note'] = $_REQUEST['new_service_time']['note']; } if ($result) { try { checkServiceTime($new_service_time); // if this time is not already there, adding it for inserting if (!str_in_array($_REQUEST['times'], $new_service_time)) { array_push($_REQUEST['times'], $new_service_time); unset($_REQUEST['new_service_time']['from_week']); unset($_REQUEST['new_service_time']['to_week']); unset($_REQUEST['new_service_time']['from_hour']); unset($_REQUEST['new_service_time']['to_hour']); unset($_REQUEST['new_service_time']['from_minute']); unset($_REQUEST['new_service_time']['to_minute']); } } catch (APIException $e) { error($e->getMessage()); } } show_messages();
/** * Checks that the given service time is valid. * * @throws APIException if the service time is invalid * * @param array $serviceTime * * @return void */ protected function checkTime(array $serviceTime) { if (empty($serviceTime['serviceid'])) { self::exception(ZBX_API_ERROR_PARAMETERS, _('Invalid method parameters.')); } checkServiceTime($serviceTime); }