Feature #11867 » bug_11867_v2.diff
classes/class.tx_linkvalidator_processing.php (working copy) | ||
---|---|---|
$record['linktitle'] = $entryValue['linktitle'];
|
||
$record['field'] = $entryValue['field'];
|
||
$record['lastcheck'] = time();
|
||
$record['matchstring'] = $entryValue['matchString'];
|
||
$url = $entryValue['substr']['tokenValue'];
|
||
$this->linkCounts[$table]++;
|
||
$checkURL = $hookObj->checkLink($url, $entryValue, $this);
|
||
... | ... | |
if ($spKey == 'typolink_tag') {
|
||
$linkTags = $htmlParser->splitIntoBlock('link', $resultArray['content']);
|
||
}
|
||
foreach ($resultArray['elements'] as $element) {
|
||
$r = $element['subst'];
|
||
... | ... | |
foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
|
||
$type = $hookObj->fetchType($r, $type, $keyArr);
|
||
}
|
||
}
|
||
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["substr"] = $r;
|
||
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["matchString"] = $element['matchString'];
|
||
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["row"] = $record;
|
||
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["table"] = $table;
|
||
$results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["field"] = $field;
|
classes/linktypes/class.tx_linkvalidator_linktypes_internal.php (working copy) | ||
---|---|---|
const DELETED = 'deleted';
|
||
const HIDDEN = 'hidden';
|
||
const NO_TYPE_NUM = 'noTypeNum';
|
||
const NOT_EXISTING = 'notExisting';
|
||
/**
|
||
* Checks a given URL + /path/filename.ext for validity
|
||
... | ... | |
* @return string TRUE on success or FALSE on error
|
||
*/
|
||
public function checkLink($url, $softRefEntry, $reference) {
|
||
$linkParams = t3lib_div::trimExplode(',',$softRefEntry['matchString']);
|
||
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
'uid, title, deleted, hidden, starttime, endtime',
|
||
'pages',
|
||
'uid = ' . intval($url)
|
||
);
|
||
$this->id = intval($url);
|
||
$response = TRUE;
|
||
$errorParams = array();
|
||
$urlParams = t3lib_div::explodeUrl2Array($linkParams[2]);
|
||
if(intval($linkParams[1])) {
|
||
$typeNum = intval($linkParams[1]);
|
||
}
|
||
if(intval($urlParams['type'])) {
|
||
$typeNum = $urlParams['type'];
|
||
}
|
||
if(intval($typeNum)) {
|
||
$response = $this->chekTypNum($typeNum);
|
||
if(!$response) {
|
||
$errorParams['errorType'] = NO_TYPE_NUM;
|
||
$errorParams['typeNum'] = $typeNum;
|
||
$errorParams['title'] = $rows[0]['title'];
|
||
$errorParams['uid'] = $rows[0]['uid'];
|
||
}
|
||
}
|
||
|
||
if ($rows[0]) {
|
||
if ($rows[0]['deleted'] == '1') {
|
||
$errorParams['errorType'] = DELETED;
|
||
... | ... | |
$response = FALSE;
|
||
}
|
||
} else {
|
||
$errorParams['errorType'] = 'notExisting';
|
||
$errorParams['uid'] = intval($url);
|
||
$errorParams['errorType'] = NOT_EXISTING;
|
||
$errorParams['uid'] = intval($linkParams[0]);
|
||
$response = FALSE;
|
||
}
|
||
... | ... | |
return $response;
|
||
}
|
||
|
||
function chekTypNum($typeNum) {
|
||
$response = TRUE;
|
||
$befunc = t3lib_div::makeInstance('t3lib_BEfunc');
|
||
$this->rootline =$befunc->BEgetRootLine($linkParams[0]);
|
||
if(is_array($this->rootline) && !empty($this->rootline)){
|
||
$this->tmpl = t3lib_div::makeInstance('t3lib_TStemplate');
|
||
$this->tmpl->tt_track = FALSE;
|
||
$this->tmpl->init();
|
||
$this->tmpl->start($this->rootline);
|
||
}
|
||
$this->sPre = $this->tmpl->setup['types.'][$linkParams[1]];
|
||
$this->pSetup = $this->tmpl->setup[$this->sPre.'.'];
|
||
if (!is_array($this->pSetup)) {
|
||
$response = FALSE;
|
||
}
|
||
return $response;
|
||
}
|
||
|
||
/**
|
||
* Generate the localized error message from the error params saved from the parsing.
|
||
*
|
||
... | ... | |
public function getErrorMessage($errorParams) {
|
||
$errorType = $errorParams['errorType'];
|
||
switch ($errorType) {
|
||
case NO_TYPE_NUM:
|
||
$response = $GLOBALS['LANG']->getLL('list.report.notypenum');
|
||
$response = str_replace('###title###', $errorParams['title'], $response);
|
||
$response = str_replace('###uid###', $errorParams['uid'], $response);
|
||
$response = str_replace('###typeNum###', $errorParams['typeNum'], $response);
|
||
break;
|
||
case DELETED:
|
||
$response = $GLOBALS['LANG']->getLL('list.report.pagedeleted');
|
||
$response = str_replace('###title###', $errorParams['title'], $response);
|
||
... | ... | |
* @return string parsed broken url
|
||
*/
|
||
public function getBrokenUrl($row) {
|
||
$params = '';
|
||
$domain = t3lib_BEfunc::getViewDomain($row['pid']);
|
||
return $domain . '/index.php?id=' . $row['url'];
|
||
$linkParams = t3lib_div::trimExplode(',',$row['matchstring']);
|
||
$urlParams = t3lib_div::explodeUrl2Array($linkParams[2]);
|
||
if(intval($linkParams[1])) {
|
||
$typeNum = intval($linkParams[1]);
|
||
}
|
||
if(intval($urlParams['type'])) {
|
||
$typeNum = $urlParams['type'];
|
||
}
|
||
if(intval($typeNum)) {
|
||
$params = '&type=' . intval($typeNum);
|
||
}
|
||
return $domain . '/index.php?id=' . $row['url'] . $params;
|
||
}
|
||
}
|
||
ext_tables.sql (working copy) | ||
---|---|---|
linktitle text,
|
||
url text,
|
||
urlresponse text,
|
||
matchstring text,
|
||
lastcheck int(11) DEFAULT '0' NOT NULL,
|
||
typelinks varchar(50) DEFAULT '' NOT NULL,
|
||
modfunc1/locallang.xml (working copy) | ||
---|---|---|
<label index="list.tableHead.lastCheck">Last check</label>
|
||
<label index="list.edit">Edit element containing this broken link</label>
|
||
<label index="list.field">(Field: %s)</label>
|
||
<label index="list.no.headline"><i>(no headline)</i></label>
|
||
<label index="list.no.headline"><i>(no headline)</i></label>
|
||
<label index="list.report.notypenum">The page '###title###' (###uid###) is not configured! [type= ###typeNum###]</label>
|
||
<label index="list.report.pagedeleted">Page '###title###' (###uid###) is deleted.</label>
|
||
<label index="list.report.pagenotexisting">Page (###uid###) does not exist.</label>
|
||
<label index="list.report.pagenotvisible">Page '###title###' (###uid###) is not visible.</label>
|