/**
  * This method checks any additional data that is relevant to the specific task
  * If the task class is not relevant, the method is expected to return true
  *
  * @param array $submittedData: reference to the array containing the data submitted by the user
  * @param tx_scheduler_Module $parentObject: reference to the calling object (Scheduler's BE module)
  * @return boolean True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject)
 {
     $limit = intval($submittedData['limit']);
     if ($limit < 1) {
         $parentObject->addMessage(sprintf($GLOBALS['LANG']->sL('Limit has to be more than zero'), '<strong>' . $limit . '</strong>'), t3lib_FlashMessage::INFO);
     }
     return TRUE;
 }
 /**
  * Validates the additional fields' values
  *
  * @param	array	$submittedData An array containing the data submitted by the add/edit task form
  * @param	tx_scheduler_Module	$schedulerModule Reference to the scheduler backend module
  * @return	boolean	True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
 {
     $validInput = TRUE;
     $submittedData[$this->fieldPrefix . 'NotificationEmail'] = trim($submittedData[$this->fieldPrefix . 'NotificationEmail']);
     if (empty($submittedData[$this->fieldPrefix . 'NotificationEmail']) || !filter_var($submittedData[$this->fieldPrefix . 'NotificationEmail'], FILTER_VALIDATE_EMAIL)) {
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:reports/reports/locallang.xml:status_updateTaskField_notificationEmail_invalid'), t3lib_FlashMessage::ERROR);
         $validInput = FALSE;
     }
     return $validInput;
 }
 /**
  * This method checks any additional data that is relevant to the specific task
  * If the task class is not relevant, the method is expected to return true
  *
  * @param	array					$submittedData: reference to the array containing the data submitted by the user
  * @param \tx_scheduler_Module $schedulerModule
  * @internal param \tx_scheduler_module1 $parentObject : reference to the calling object (Scheduler's BE module)
  * @return	boolean					True if validation was ok (or selected class is not relevant), false otherwise
  * @author Michael Klapper <*****@*****.**>
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
 {
     $isValid = false;
     if (tx_crawler_api::convertToPositiveInteger($submittedData['timeOut']) > 0) {
         $isValid = true;
     } else {
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidTimeOut'), t3lib_FlashMessage::ERROR);
     }
     return $isValid;
 }
 /**
  * This method checks any additional data that is relevant to the specific task
  * If the task class is not relevant, the method is expected to return true
  *
  * @param	array					$submittedData: reference to the array containing the data submitted by the user
  * @param	tx_scheduler_Module		$parentObject: reference to the calling object (Scheduler's BE module)
  * @return	boolean					True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject)
 {
     $submittedData['email'] = trim($submittedData['email']);
     if (empty($submittedData['email'])) {
         $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:msg.noEmail'), t3lib_FlashMessage::ERROR);
         $result = false;
     } else {
         $result = true;
     }
     return $result;
 }
 /**
  * Checks any additional data that is relevant to this task. If the task
  * class is not relevant, the method is expected to return TRUE
  *
  * @param	array					$submittedData: reference to the array containing the data submitted by the user
  * @param	tx_scheduler_module1	$parentObject: reference to the calling object (Scheduler's BE module)
  * @return	boolean					True if validation was ok (or selected class is not relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
 {
     $result = FALSE;
     $submittedData['solrPort'] = intval($submittedData['solrPort']);
     if ($submittedData['solrPort'] < 0) {
         $schedulerModule->addMessage('Invalid Port given', 3);
     } else {
         $result = TRUE;
     }
     return $result;
 }
 /**
  * This method checks any additional data that is relevant to the specific task
  * If the task class is not relevant, the method is expected to return true
  *
  * @param	array					$submittedData: reference to the array containing the data submitted by the user
  * @param	tx_scheduler_Module		$parentObject: reference to the calling object (Scheduler's BE module)
  * @return	boolean					True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject)
 {
     $submittedData['update_node_id'] = trim($submittedData['update_node_id']);
     if (empty($submittedData['update_node_id'])) {
         $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:caretaker/locallang.xml:scheduler_update_node_required'), t3lib_FlashMessage::ERROR);
         $result = false;
     } else {
         $result = true;
     }
     return $result;
 }
 /**
  * This method checks any additional data that is relevant to the specific task.
  * If the task class is not relevant, the method is expected to return TRUE.
  *
  * @param array $submittedData : reference to the array containing the data
  *    submitted by the user
  * @param \tx_scheduler_Module $schedulerModule :
  *    reference to the calling object (BE module of the Scheduler)
  *
  * @return boolean True if validation was ok (or selected class is not
  *    relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
 {
     $isValid = TRUE;
     if (is_array($submittedData['deletedTables'])) {
         $tables = Tx_Tablecleaner_Utility_Base::getTablesWithDeletedAndTstamp();
         foreach ($submittedData['deletedTables'] as $table) {
             if (!in_array($table, $tables)) {
                 $isValid = FALSE;
                 $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:tablecleaner/Resources/Private/Language/locallang.xml:tasks.general.invalidTables'), t3lib_FlashMessage::ERROR);
             }
         }
     } else {
         $isValid = FALSE;
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:tablecleaner/Resources/Private/Language/locallang.xml:tasks.general.noTables'), t3lib_FlashMessage::ERROR);
     }
     if ($submittedData['deletedDayLimit'] <= 0) {
         $isValid = FALSE;
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:tablecleaner/Resources/Private/Language/locallang.xml:tasks.general.invalidNumberOfDays'), t3lib_FlashMessage::ERROR);
     }
     return $isValid;
 }
 /**
  * This method checks any additional data that is relevant to the specific task
  * If the task class is not relevant, the method is expected to return true
  *
  * @param	array					$submittedData: reference to the array containing the data submitted by the user
  * @param	tx_scheduler_Module		$parentObject: reference to the calling object (Scheduler's BE module)
  * @return	boolean					True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject)
 {
     $bError = false;
     foreach ($this->getAdditionalFieldConfig() as $sKey => $aOptions) {
         $mValue =& $submittedData[$sKey];
         // bei einer checkbox ist der value immer 'on'!
         if ($aOptions['type'] && $mValue === 'on') {
             $mValue = 1;
         }
         $bMessage = false;
         // Die Einzelnen validatoren anwenden.
         if (!$bMessage) {
             foreach (t3lib_div::trimExplode(',', $aOptions['eval']) as $sEval) {
                 $sLabelKey = ($aOptions['label'] ? $aOptions['label'] : $sKey) . '_eval_' . $sEval;
                 switch ($sEval) {
                     case 'required':
                         $bMessage = empty($mValue);
                         break;
                     case 'trim':
                         $mValue = trim($mValue);
                         break;
                     case 'int':
                         $bMessage = !is_numeric($mValue);
                         if (!$bMessage) {
                             $mValue = intval($mValue);
                         }
                         break;
                     case 'date':
                         $mValue = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $mValue);
                         break;
                     case 'email':
                         //wir unterstützen kommaseparierte listen von email andressen
                         if (!empty($mValue)) {
                             $aEmails = explode(',', $mValue);
                             $bMessage = false;
                             foreach ($aEmails as $sEmail) {
                                 if (!t3lib_div::validEmail($sEmail)) {
                                     $bMessage = true;
                                 }
                             }
                         }
                         break;
                     case 'folder':
                         tx_rnbase::load('tx_mklib_util_File');
                         $sPath = tx_mklib_util_File::getServerPath($mValue);
                         $bMessage = !@is_dir($sPath);
                         if (!$bMessage) {
                             $mValue = $sPath;
                         }
                         break;
                     case 'file':
                         tx_rnbase::load('tx_mklib_util_File');
                         $sPath = tx_mklib_util_File::getServerPath($mValue);
                         $bMessage = !@file_exists($sPath);
                         if (!$bMessage) {
                             $mValue = $sPath;
                         }
                         break;
                     case 'url':
                         $bMessage = !t3lib_div::isValidUrl($mValue);
                         break;
                     default:
                         // wir prüfen auf eine eigene validator methode in der Kindklasse.
                         // in eval muss validateLifetime stehen, damit folgende methode aufgerufen wird.
                         // protected function validateLifetime($mValue){ return true; }
                         // @TODO: clasname::method prüfen!?
                         if (method_exists($this, $sEval)) {
                             $ret = $this->{$sEval}($mValue, $submittedData);
                             if (is_string($ret)) {
                                 $bMessage = $sMessage = $ret;
                             }
                         }
                 }
                 // wir generieren nur eine meldung pro feld!
                 if ($bMessage) {
                     break;
                 }
             }
         }
         // wurde eine fehlermeldung erzeugt?
         if ($bMessage) {
             $sMessage = $sMessage ? $sMessage : $GLOBALS['LANG']->sL($sLabelKey);
             $sMessage = $sMessage ? $sMessage : ucfirst($sKey) . ' has to eval ' . $sEval . '.';
             $parentObject->addMessage($sMessage, t3lib_FlashMessage::ERROR);
             $bError = true;
             continue;
         }
     }
     return !$bError;
 }
Example #9
0
 /**
  * Validates the additional fields' values
  *
  * @param	array					An array containing the data submitted by the add/edit task form
  * @param	tx_scheduler_Module		Reference to the scheduler backend module
  * @return	boolean					True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
 {
     if (empty($submittedData['tx_czsimplecal_minindexage'])) {
         $submittedData['tx_czsimplecal_minindexage'] = null;
     } elseif (!is_string($submittedData['tx_czsimplecal_minindexage'])) {
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:cz_simple_cal/Resources/Private/Language/locallang_mod.xml:tx_czsimplecal_scheduler_index.minindexage.nostring'), t3lib_FlashMessage::ERROR);
         return false;
     } else {
         if (Tx_CzSimpleCal_Utility_StrToTime::strtotime($submittedData['tx_czsimplecal_minindexage']) === false) {
             $schedulerModule->addMessage(sprintf($GLOBALS['LANG']->sL('LLL:EXT:cz_simple_cal/Resources/Private/Language/locallang_mod.xml:tx_czsimplecal_scheduler_index.minindexage.parseerror'), $submittedData['tx_czsimplecal_minindexage']), t3lib_FlashMessage::ERROR);
             return false;
         }
     }
     return true;
 }
 /**
  * This method checks any additional data that is relevant to the specific task
  * If the task class is not relevant, the method is expected to return true
  *
  * @param	array					$submittedData: reference to the array containing the data submitted by the user
  * @param tx_scheduler_Module $schedulerModule
  *
  * @internal param \tx_scheduler_module1 $parentObject : reference to the calling object (Scheduler's BE module)
  * @return	boolean					True if validation was ok (or selected class is not relevant), false otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
 {
     $isValid = false;
     //!TODO add validation to validate the $submittedData['configuration'] wich is normally a comma seperated string
     if (is_array($submittedData['configuration'])) {
         $isValid = true;
     } else {
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidConfiguration'), t3lib_FlashMessage::ERROR);
     }
     if ($submittedData['depth'] < 0) {
         $isValid = false;
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidDepth'), t3lib_FlashMessage::ERROR);
     }
     if (!tx_crawler_api::canBeInterpretedAsInteger($submittedData['startPage']) || $submittedData['startPage'] < 0) {
         $isValid = false;
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidStartPage'), t3lib_FlashMessage::ERROR);
     }
     return $isValid;
 }
 /**
  * Validate the fields
  *
  * @param array               $submittedData
  * @param tx_scheduler_Module $parentObject
  * @return bool
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject)
 {
     $result = TRUE;
     if (empty($submittedData['post_post']) === TRUE) {
         $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:solradmin/tasks/locallang.xml:errorfields'), t3lib_FlashMessage::ERROR);
         $result = FALSE;
     }
     return $result;
 }
 /**
  * Checks if the given value is an integer
  *
  * @param array $submittedData Reference to the array containing the data submitted by the user
  * @param tx_scheduler_Module $parentObject Reference to the calling object (Scheduler's BE module)
  * @return boolean TRUE if validation was ok (or selected class is not relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject)
 {
     $result = true;
     // Check if number of days is indeed a number and greater than 0
     // If not, fail validation and issue error message
     if (!is_numeric($submittedData['l10nmgr_fileGarbageCollection_age']) || (int) $submittedData['l10nmgr_fileGarbageCollection_age'] <= 0) {
         $result = false;
         $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:l10nmgr/tasks/locallang.xml:fileGarbageCollection.invalidAge'), FlashMessage::ERROR);
     }
     return $result;
 }
 /**
  * This method checks any additional data that is relevant to the specific task.
  * If the task class is not relevant, the method is expected to return TRUE.
  *
  * @param	array		$submittedData: reference to the array containing the data submitted by the user
  * @param	tx_scheduler_module1		$parentObject: reference to the calling object (BE module of the Scheduler)
  * @return	boolean		True if validation was ok (or selected class is not relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule)
 {
     $isValid = TRUE;
     //!TODO add validation to validate the $submittedData['configuration'] wich is normally a comma seperated string
     if (!empty($submittedData['linkvalidator']['email'])) {
         $emailList = t3lib_div::trimExplode(',', $submittedData['linkvalidator']['email']);
         foreach ($emailList as $emailAdd) {
             if (!t3lib_div::validEmail($emailAdd)) {
                 $isValid = FALSE;
                 $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidEmail'), t3lib_FlashMessage::ERROR);
             }
         }
     }
     if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid = ' . $submittedData['linkvalidator']['page'])) {
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) == 0 && $submittedData['linkvalidator']['page'] > 0) {
             $isValid = FALSE;
             $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'), t3lib_FlashMessage::ERROR);
         }
     } else {
         $isValid = FALSE;
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'), t3lib_FlashMessage::ERROR);
     }
     if ($submittedData['linkvalidator']['depth'] < 0) {
         $isValid = FALSE;
         $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidDepth'), t3lib_FlashMessage::ERROR);
     }
     return $isValid;
 }