Beispiel #1
0
 static function validateDateTime($day, $month, $year, $hour, $minute, $second = 0)
 {
     $check = checkdate($month, $day, $year);
     $datetime = mktime($hour, $minute, $second, $month, $day, $year);
     if (!$check or $year < 1970 or $datetime === false or eZDateTimeValidator::validateTime($hour, $minute) == eZInputValidator::STATE_INVALID) {
         return eZInputValidator::STATE_INVALID;
     }
     return eZInputValidator::STATE_ACCEPTED;
 }
Beispiel #2
0
 function validateTimeHTTPInput($hours, $minute, $second, $contentObjectAttribute)
 {
     $state = eZDateTimeValidator::validateTime($hours, $minute, $second);
     if ($state == eZInputValidator::STATE_INVALID) {
         $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'Invalid time.'));
         return eZInputValidator::STATE_INVALID;
     }
     return $state;
 }
 function validateDateTimeHTTPInput($day, $month, $year, $contentObjectAttribute)
 {
     $state = eZDateTimeValidator::validateDate($day, $month, $year);
     if ($state == eZInputValidator::STATE_INVALID) {
         $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'Date is not valid.'));
         return eZInputValidator::STATE_INVALID;
     }
     return $state;
 }
Beispiel #4
0
 // TODO check if $node is a cjw_newsletter_edition object
 $attributeEdition = $editionDataMap['newsletter_edition'];
 $attributeEditionContent = $attributeEdition->attribute('content');
 if ($attributeEditionContent->attribute('is_process')) {
     $message_warning = ezi18n('cjw_newsletter/datatype/cjwnewsletteredition', "The current edition is already in sending process - to create a new version please stop it first", null, array());
 } elseif ($attributeEditionContent->attribute('is_archive')) {
     $message_warning = ezi18n('cjw_newsletter/datatype/cjwnewsletteredition', "The current edition was already send and is in archive!", null, array());
 } else {
     $sendNewsletterOutConfirm = false;
     $sendNewsletterOutDatetime = null;
     if ($module->hasActionParameter('SendOutConfirmation')) {
         // validate schedule datetime
         $theFormData = array('year' => $_POST['CJWNL_datetime_year_noid'], 'month' => $_POST['CJWNL_datetime_month_noid'], 'day' => $_POST['CJWNL_datetime_day_noid'], 'hour' => $_POST['CJWNL_datetime_hour_noid'], 'minute' => $_POST['CJWNL_datetime_minute_noid']);
         $theFormData = array_map('intval', $theFormData);
         $theDateIsValid = eZDateTimeValidator::validateDate($theFormData['day'], $theFormData['month'], $theFormData['year']) != eZInputValidator::STATE_INVALID;
         $theTimeIsValid = eZDateTimeValidator::validateTime($theFormData['hour'], $theFormData['minute']) != eZInputValidator::STATE_INVALID;
         if ($theDateIsValid && $theTimeIsValid) {
             $sendNewsletterOutDatetime = mktime($theFormData['hour'], $theFormData['minute'], 0, $theFormData['month'], $theFormData['day'], $theFormData['year']);
         } else {
             $message_warning = ezi18n('cjw_newsletter/datatype/cjwnewsletteredition', "The schedule date or time is invalid!", null, array());
         }
         $sendNewsletterOutConfirm = true;
     }
     // to we send out the newsletter
     if ($sendNewsletterOutDatetime && $sendNewsletterOutConfirm === true) {
         $createResult = $attributeEditionContent->createNewsletterSendObject($sendNewsletterOutDatetime);
         // redirect to current url   newsletter/send/ nodeId to loose the post variables
         // return $module->redirectCurrent();
         $redirectUri = "/content/view/full/{$nodeId}";
         return $module->redirectTo($redirectUri);
     }