Beispiel #1
0
 /**
  * Checks a given URL for validity
  *
  * @param string $url Url to check
  * @param array $softRefEntry The soft reference entry which builds the context of that url
  * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance
  * @return bool TRUE on success or FALSE on error
  */
 public function checkLink($url, $softRefEntry, $reference)
 {
     $response = TRUE;
     $errorType = '';
     $errorParams = array();
     $parts = explode(':', $url);
     if (count($parts) !== 3) {
         return $response;
     }
     list(, $tableName, $rowid) = $parts;
     $rowid = (int) $rowid;
     $row = NULL;
     $tsConfig = $reference->getTSConfig();
     $reportHiddenRecords = (bool) $tsConfig['linkhandler.']['reportHiddenRecords'];
     // First check, if we find a non disabled record if the check
     // for hidden records is enabled.
     if ($reportHiddenRecords) {
         $row = $this->getRecordRow($tableName, $rowid, 'disabled');
         if ($row === NULL) {
             $response = FALSE;
             $errorType = self::DISABLED;
         }
     }
     // If no enabled record was found or we did not check that see
     // if we can find a non deleted record.
     if ($row === NULL) {
         $row = $this->getRecordRow($tableName, $rowid, 'deleted');
         if ($row === NULL) {
             $response = FALSE;
             $errorType = self::DELETED;
         }
     }
     // If we did not find a non deleted record, check if we find a
     // deleted one.
     if ($row === NULL) {
         $row = $this->getRecordRow($tableName, $rowid, 'all');
         if ($row === NULL) {
             $response = FALSE;
             $errorType = '';
         }
     }
     if (!$response) {
         $errorParams['errorType'] = $errorType;
         $errorParams['tablename'] = $tableName;
         $errorParams['uid'] = $rowid;
         $this->setErrorParams($errorParams);
     }
     return $response;
 }
 /**
  * Checks a given URL for validity
  *
  * @param string $url Url to check
  * @param array $softRefEntry The soft reference entry which builds the context of that url
  * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance
  * @return boolean TRUE on success or FALSE on error
  */
 public function checkLink($url, $softRefEntry, $reference)
 {
     $response = TRUE;
     $errorType = '';
     $errorParams = array();
     $this->initializeRequiredClasses();
     $linkInfo = $this->tabHandlerFactory->getLinkInfoArrayFromMatchingHandler($url);
     if (empty($linkInfo)) {
         return TRUE;
     }
     $tableName = $linkInfo['recordTable'];
     $rowid = $linkInfo['recordUid'];
     $row = NULL;
     $tsConfig = $reference->getTSConfig();
     $this->reportHiddenRecords = (bool) $tsConfig['tx_linkhandler.']['reportHiddenRecords'];
     // First check, if we find a non disabled record if the check
     // for hidden records is enabled.
     if ($this->reportHiddenRecords) {
         $row = $this->getRecordRow($tableName, $rowid, 'disabled');
         if ($row === NULL) {
             $response = FALSE;
             $errorType = self::ERROR_TYPE_DISABLED;
         }
     }
     // If no enabled record was found or we did not check that see
     // if we can find a non deleted record.
     if ($row === NULL) {
         $row = $this->getRecordRow($tableName, $rowid, 'deleted');
         if ($row === NULL) {
             $response = FALSE;
             $errorType = self::ERROR_TYPE_DELETED;
         }
     }
     // If we did not find a non deleted record, check if we find a
     // deleted one.
     if ($row === NULL) {
         $row = $this->getRecordRow($tableName, $rowid, 'all');
         if ($row === NULL) {
             $response = FALSE;
             $errorType = '';
         }
     }
     if (!$response) {
         $errorParams['errorType'] = $errorType;
         $errorParams['tablename'] = $tableName;
         $errorParams['uid'] = $rowid;
         $this->setErrorParams($errorParams);
     }
     return $response;
 }