/**
  *
  * @param 	array 	$options
  * @return 	string
  */
 protected function executeTask(array $aOptions, array &$aDevLog)
 {
     $sDirectory = $aOptions['folder'];
     $iCount = tx_mklib_util_File::cleanupFiles($sDirectory, $aOptions, $unlinkedFiles);
     $aDevLog[tx_rnbase_util_Logger::LOGLEVEL_INFO] = array('dataVar' => $unlinkedFiles);
     return sprintf($iCount ? '%d files removed.' : 'No files found for cleanup.', $iCount);
 }
 /**
  * Befüllt den Record Pfaden
  *
  * @param string $sPath
  * @return tx_mklib_model_Dam
  */
 public function fillPath($sPath = false)
 {
     // Pathname immer setzen!
     if (!$this->hasFilePath()) {
         if (tx_rnbase_util_TYPO3::isTYPO60OrHigher()) {
             $this->setFilePathName($this->getUrl());
         } else {
             $this->setFilePathName($this->getFilePath() . $this->getFileName());
         }
     }
     tx_rnbase::load('tx_mklib_util_File');
     // webpath setzen
     if ((!$sPath || $sPath == 'webpath') && !$this->hasFileWebpath()) {
         $this->setFileWebpath(tx_mklib_util_File::getWebPath($this->getFilePathName()));
     }
     // serverpath setzen
     if ((!$sPath || $sPath == 'serverpath') && !$this->hasFileServerpath()) {
         $this->setFileServerpath(tx_mklib_util_File::getServerPath($this->getFilePathName()));
     }
     // relpath setzen
     if ((!$sPath || $sPath == 'relpath') && !$this->hasFileRelpath()) {
         $this->setFileRelpath(tx_mklib_util_File::getRelPath($this->getFilePathName()));
     }
     return $this;
 }
 /**
  * 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;
 }
 /**
  * Send the HTTP request and return an HTTP response object
  *
  * @param string $method
  * @return tx_mklib_util_httprequest_Responce
  */
 public function request($method = NULL)
 {
     if (empty($this->uri)) {
         throw new Exception('No valid URI has been passed to the client');
     }
     if ($method) {
         $this->setMethod($method);
     }
     $response = NULL;
     // Make sure the adapter is loaded
     if (!$this->adapter instanceof tx_mklib_util_httprequest_adapter_Interface) {
         $this->setAdapter($this->config['adapter']);
     }
     // Clone the URI and add the additional GET parameters to it
     $uri = parse_url($this->uri);
     if (!empty($this->parameters) && $this->method == self::METHOD_GET) {
         $query = http_build_query($this->parameters, NULL, '&');
         if ($this->config['rfc3986_strict']) {
             $query = str_replace('+', '%20', $query);
         }
         $uri['query'] = empty($uri['query']) ? '' : $uri['query'] . '&';
         $uri['query'] .= $query;
     }
     $body = $this->prepareBody();
     $headers = $this->prepareHeaders();
     // Open the connection, send the request and read the response
     $this->adapter->connect($uri['host'], $uri['port'], $uri['scheme'] == 'https' ? true : false);
     tx_rnbase::load('tx_mklib_util_File');
     $this->adapter->write($this->method, tx_mklib_util_File::parseUrlFromParts($uri), $headers, $body);
     $response = $this->adapter->read();
     if (!$response) {
         throw new Exception('Unable to read response, or response is empty');
     }
     tx_rnbase::load('tx_mklib_util_httprequest_Responce');
     $response = tx_mklib_util_httprequest_Responce::fromString($response);
     // @TODO: redirect prüfen.
     //$response->isRedirect()
     return $response;
 }
 /**
  * Liefert den Absoluten Server Pfad zum Root.
  * @return 	string
  */
 public static function getDocumentRoot($slashPath = true)
 {
     //		return PATH_site;
     if (self::$documentRoot === false) {
         self::$documentRoot = t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT');
     }
     if ($slashPath) {
         return self::slashPath(self::$documentRoot, false);
     }
     return self::$documentRoot;
 }
 /**
  *
  * @return multitype:multitype:string  multitype:Ambigous <string, string, unknown>
  */
 public function getFiles()
 {
     return array(array(tx_mklib_util_File::getServerPath(''), FALSE), array(tx_mklib_util_File::getServerPath('EXT:mklib/tests'), FALSE), array(tx_mklib_util_File::getServerPath('EXT:mklib/tests/phpunit.xml'), TRUE));
 }