[TASK] Namespace classes
authorThomas Maroschik <tmaroschik@dfau.de>
Wed, 17 Oct 2012 20:18:23 +0000 (22:18 +0200)
committerThomas Maroschik <tmaroschik@dfau.de>
Wed, 17 Oct 2012 20:18:23 +0000 (22:18 +0200)
Change-Id: I0dd7b71d2a3c2910d842e38e7058c19a3e9f6b69

43 files changed:
typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/AbstractLinktype.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/InternalLinktype.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_abstract.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_external.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_file.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_interface.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_internal.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_linkhandler.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/class.tx_linkvalidator_processor.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/tasks/class.tx_linkvalidator_tasks_validator.php [new file with mode: 0644]
typo3/sysext/linkvalidator/Classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/LinkAnalyzer.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/AbstractLinktype.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/ExternalLinktype.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/FileLinktype.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/InternalLinktype.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/LinkHandler.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/LinktypeInterface.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_abstract.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_external.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_file.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_interface.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_internal.php [deleted file]
typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_linkhandler.php [deleted file]
typo3/sysext/linkvalidator/classes/Report/LinkValidatorReport.php [deleted file]
typo3/sysext/linkvalidator/classes/Task/ValidatorTask.php [deleted file]
typo3/sysext/linkvalidator/classes/Task/ValidatorTaskAdditionalFieldProvider.php [deleted file]
typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php [deleted file]
typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validator.php [deleted file]
typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php [deleted file]
typo3/sysext/linkvalidator/ext_autoload.php
typo3/sysext/linkvalidator/ext_emconf.php
typo3/sysext/linkvalidator/ext_localconf.php
typo3/sysext/linkvalidator/ext_tables.php
typo3/sysext/linkvalidator/modfuncreport/class.tx_linkvalidator_modfuncreport.php [new file with mode: 0644]

diff --git a/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php b/typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php
new file mode 100644 (file)
index 0000000..14588bc
--- /dev/null
@@ -0,0 +1,411 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator;
+
+/**
+ * This class provides Processing plugin implementation
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @author Jochen Rieger <j.rieger@connecta.ag>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class LinkAnalyzer {
+
+       /**
+        * Array of tables and fields to search for broken links
+        *
+        * @var array
+        */
+       protected $searchFields = array();
+
+       /**
+        * List of comma separated page uids (rootline downwards)
+        *
+        * @var string
+        */
+       protected $pidList = '';
+
+       /**
+        * Array of tables and the number of external links they contain
+        *
+        * @var array
+        */
+       protected $linkCounts = array();
+
+       /**
+        * Array of tables and the number of broken external links they contain
+        *
+        * @var array
+        */
+       protected $brokenLinkCounts = array();
+
+       /**
+        * Array of tables and records containing broken links
+        *
+        * @var array
+        */
+       protected $recordsWithBrokenLinks = array();
+
+       /**
+        * Array for hooks for own checks
+        *
+        * @var tx_linkvalidator_linktype_Abstract[]
+        */
+       protected $hookObjectsArr = array();
+
+       /**
+        * Array with information about the current page
+        *
+        * @var array
+        */
+       protected $extPageInTreeInfo = array();
+
+       /**
+        * Reference to the current element with table:uid, e.g. pages:85
+        *
+        * @var string
+        */
+       protected $recordReference = '';
+
+       /**
+        * Linked page together with a possible anchor, e.g. 85#c105
+        *
+        * @var string
+        */
+       protected $pageWithAnchor = '';
+
+       /**
+        * Fill hookObjectsArr with different link types and possible XClasses.
+        */
+       public function __construct() {
+               // Hook to handle own checks
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $key => $classRef) {
+                               $this->hookObjectsArr[$key] = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
+                       }
+               }
+       }
+
+       /**
+        * Store all the needed configuration values in class variables
+        *
+        * @param array $searchField List of fields in which to search for links
+        * @param string $pid List of comma separated page uids in which to search for links
+        * @return      void
+        */
+       public function init(array $searchField, $pid) {
+               $this->searchFields = $searchField;
+               $this->pidList = $pid;
+               foreach ($searchField as $tableName => $table) {
+                       \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($tableName);
+               }
+       }
+
+       /**
+        * Find all supported broken links and store them in tx_linkvalidator_link
+        *
+        * @param array $checkOptions List of hook object to activate
+        * @param boolean $considerHidden Defines whether to look into hidden fields or not
+        * @return void
+        */
+       public function getLinkStatistics($checkOptions = array(), $considerHidden = FALSE) {
+               $results = array();
+               if (count($checkOptions) > 0) {
+                       $checkKeys = array_keys($checkOptions);
+                       $checkLinkTypeCondition = (' and link_type in (\'' . implode('\',\'', $checkKeys)) . '\')';
+                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_linkvalidator_link', ((((('(record_pid in (' . $this->pidList) . ')') . ' or ( record_uid IN (') . $this->pidList) . ') and table_name like \'pages\')) ') . $checkLinkTypeCondition);
+                       // Traverse all configured tables
+                       foreach ($this->searchFields as $table => $fields) {
+                               if ($table === 'pages') {
+                                       $where = ('deleted = 0 AND uid IN (' . $this->pidList) . ')';
+                               } else {
+                                       $where = ('deleted = 0 AND pid IN (' . $this->pidList) . ')';
+                               }
+                               if (!$considerHidden) {
+                                       $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
+                               }
+                               // If table is not configured, assume the extension is not installed and therefore no need to check it
+                               if (!is_array($GLOBALS['TCA'][$table])) {
+                                       continue;
+                               }
+                               // Re-init selectFields for table
+                               $selectFields = 'uid, pid';
+                               $selectFields .= ((', ' . $GLOBALS['TCA'][$table]['ctrl']['label']) . ', ') . implode(', ', $fields);
+                               // TODO: only select rows that have content in at least one of the relevant fields (via OR)
+                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $table, $where);
+                               // Get record rows of table
+                               while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
+                                       // Analyse each record
+                                       $this->analyzeRecord($results, $table, $fields, $row);
+                               }
+                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
+                       }
+                       foreach ($this->hookObjectsArr as $key => $hookObj) {
+                               if (is_array($results[$key]) && empty($checkOptions) || is_array($results[$key]) && $checkOptions[$key]) {
+                                       //  Check them
+                                       foreach ($results[$key] as $entryKey => $entryValue) {
+                                               $table = $entryValue['table'];
+                                               $record = array();
+                                               $record['headline'] = $entryValue['row'][$GLOBALS['TCA'][$table]['ctrl']['label']];
+                                               $record['record_pid'] = $entryValue['row']['pid'];
+                                               $record['record_uid'] = $entryValue['uid'];
+                                               $record['table_name'] = $table;
+                                               $record['link_title'] = $entryValue['link_title'];
+                                               $record['field'] = $entryValue['field'];
+                                               $record['last_check'] = time();
+                                               $this->recordReference = $entryValue['substr']['recordRef'];
+                                               $this->pageWithAnchor = $entryValue['pageAndAnchor'];
+                                               if (!empty($this->pageWithAnchor)) {
+                                                       // Page with anchor, e.g. 18#1580
+                                                       $url = $this->pageWithAnchor;
+                                               } else {
+                                                       $url = $entryValue['substr']['tokenValue'];
+                                               }
+                                               $this->linkCounts[$table]++;
+                                               $checkURL = $hookObj->checkLink($url, $entryValue, $this);
+                                               // Broken link found
+                                               if (!$checkURL) {
+                                                       $response = array();
+                                                       $response['valid'] = FALSE;
+                                                       $response['errorParams'] = $hookObj->getErrorParams();
+                                                       $this->brokenLinkCounts[$table]++;
+                                                       $record['link_type'] = $key;
+                                                       $record['url'] = $url;
+                                                       $record['url_response'] = serialize($response);
+                                                       $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_linkvalidator_link', $record);
+                                               } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('showalllinks')) {
+                                                       $response = array();
+                                                       $response['valid'] = TRUE;
+                                                       $this->brokenLinkCounts[$table]++;
+                                                       $record['url'] = $url;
+                                                       $record['link_type'] = $key;
+                                                       $record['url_response'] = serialize($response);
+                                                       $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_linkvalidator_link', $record);
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Find all supported broken links for a specific record
+        *
+        * @param array $results Array of broken links
+        * @param string $table Table name of the record
+        * @param array $fields Array of fields to analyze
+        * @param array $record Record to analyse
+        * @return void
+        */
+       public function analyzeRecord(array &$results, $table, array $fields, array $record) {
+               // Put together content of all relevant fields
+               $haystack = '';
+               /** @var \TYPO3\CMS\Core\Html\HtmlParser $htmlParser */
+               $htmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\HtmlParser');
+               $idRecord = $record['uid'];
+               // Get all references
+               foreach ($fields as $field) {
+                       $haystack .= $record[$field] . ' --- ';
+                       $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
+                       $valueField = $record[$field];
+                       // Check if a TCA configured field has soft references defined (see TYPO3 Core API document)
+                       if ($conf['softref'] && strlen($valueField)) {
+                               // Explode the list of soft references/parameters
+                               $softRefs = \TYPO3\CMS\Backend\Utility\BackendUtility::explodeSoftRefParserList($conf['softref']);
+                               // Traverse soft references
+                               foreach ($softRefs as $spKey => $spParams) {
+                                       /** @var \TYPO3\CMS\Core\Database\SoftReferenceIndex $softRefObj Create or get the soft reference object */
+                                       $softRefObj =& \TYPO3\CMS\Backend\Utility\BackendUtility::softRefParserObj($spKey);
+                                       // If there is an object returned...
+                                       if (is_object($softRefObj)) {
+                                               // Do processing
+                                               $resultArray = $softRefObj->findRef($table, $field, $idRecord, $valueField, $spKey, $spParams);
+                                               if (!empty($resultArray['elements'])) {
+                                                       if ($spKey == 'typolink_tag') {
+                                                               $this->analyseTypoLinks($resultArray, $results, $htmlParser, $record, $field, $table);
+                                                       } else {
+                                                               $this->analyseLinks($resultArray, $results, $record, $field, $table);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Find all supported broken links for a specific link list
+        *
+        * @param array $resultArray findRef parsed records
+        * @param array $results Array of broken links
+        * @param array $record UID of the current record
+        * @param string $field The current field
+        * @param string $table The current table
+        * @return      void
+        */
+       protected function analyseLinks(array $resultArray, array &$results, array $record, $field, $table) {
+               foreach ($resultArray['elements'] as $element) {
+                       $r = $element['subst'];
+                       $type = '';
+                       $idRecord = $record['uid'];
+                       if (!empty($r)) {
+                               /** @var \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype $hookObj */
+                               foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
+                                       $type = $hookObj->fetchType($r, $type, $keyArr);
+                                       // Store the type that was found
+                                       // This prevents overriding by internal validator
+                                       if (!empty($type)) {
+                                               $r['type'] = $type;
+                                       }
+                               }
+                               $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $r['tokenID']]['substr'] = $r;
+                               $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;
+                               $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $r['tokenID']]['uid'] = $idRecord;
+                       }
+               }
+       }
+
+       /**
+        * Find all supported broken links for a specific typoLink
+        *
+        * @param array $resultArray findRef parsed records
+        * @param array $results Array of broken links
+        * @param \TYPO3\CMS\Core\Html\HtmlParser $htmlParser Instance of html parser
+        * @param array $record The current record
+        * @param string $field The current field
+        * @param string $table The current table
+        * @return void
+        */
+       protected function analyseTypoLinks(array $resultArray, array &$results, $htmlParser, array $record, $field, $table) {
+               $currentR = array();
+               $linkTags = $htmlParser->splitIntoBlock('link', $resultArray['content']);
+               $idRecord = $record['uid'];
+               $type = '';
+               $title = '';
+               for ($i = 1; $i < count($linkTags); $i += 2) {
+                       $referencedRecordType = '';
+                       foreach ($resultArray['elements'] as $element) {
+                               $type = '';
+                               $r = $element['subst'];
+                               if (!empty($r['tokenID'])) {
+                                       if (substr_count($linkTags[$i], $r['tokenID'])) {
+                                               // Type of referenced record
+                                               if (strpos($r['recordRef'], 'pages') !== FALSE) {
+                                                       $currentR = $r;
+                                                       // Contains number of the page
+                                                       $referencedRecordType = $r['tokenValue'];
+                                                       $wasPage = TRUE;
+                                               } elseif (strpos($r['recordRef'], 'tt_content') !== FALSE && (isset($wasPage) && $wasPage === TRUE)) {
+                                                       $referencedRecordType = ($referencedRecordType . '#c') . $r['tokenValue'];
+                                                       $wasPage = FALSE;
+                                               } else {
+                                                       $currentR = $r;
+                                               }
+                                               $title = strip_tags($linkTags[$i]);
+                                       }
+                               }
+                       }
+                       /** @var \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype $hookObj */
+                       foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
+                               $type = $hookObj->fetchType($currentR, $type, $keyArr);
+                               // Store the type that was found
+                               // This prevents overriding by internal validator
+                               if (!empty($type)) {
+                                       $currentR['type'] = $type;
+                               }
+                       }
+                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['substr'] = $currentR;
+                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['row'] = $record;
+                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['table'] = $table;
+                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['field'] = $field;
+                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['uid'] = $idRecord;
+                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['link_title'] = $title;
+                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['pageAndAnchor'] = $referencedRecordType;
+               }
+       }
+
+       /**
+        * Fill a marker array with the number of links found in a list of pages
+        *
+        * @param string $curPage Comma separated list of page uids
+        * @return array Marker array with the number of links found
+        */
+       public function getLinkCounts($curPage) {
+               $markerArray = array();
+               if (empty($this->pidList)) {
+                       $this->pidList = $curPage;
+               }
+               if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(uid) as nbBrokenLinks,link_type', 'tx_linkvalidator_link', ('record_pid in (' . $this->pidList) . ')', 'link_type')) {
+                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
+                               $markerArray[$row['link_type']] = $row['nbBrokenLinks'];
+                               $markerArray['brokenlinkCount'] += $row['nbBrokenLinks'];
+                       }
+               }
+               $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               return $markerArray;
+       }
+
+       /**
+        * Calls t3lib_tsfeBeUserAuth::extGetTreeList.
+        * Although this duplicates the function t3lib_tsfeBeUserAuth::extGetTreeList
+        * this is necessary to create the object that is used recursively by the original function.
+        *
+        * Generates a list of page uids from $id. List does not include $id itself.
+        * The only pages excluded from the list are deleted pages.
+        *
+        * @param integer $id Start page id
+        * @param integer $depth Depth to traverse down the page tree.
+        * @param integer $begin is an optional integer that determines at which
+        * @param string $permsClause Perms clause
+        * @param boolean $considerHidden Whether to consider hidden pages or not
+        * @return string Returns the list with a comma in the end (if any pages selected!)
+        */
+       public function extGetTreeList($id, $depth, $begin = 0, $permsClause, $considerHidden = FALSE) {
+               $depth = intval($depth);
+               $begin = intval($begin);
+               $id = intval($id);
+               $theList = '';
+               if ($depth > 0) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,hidden,extendToSubpages', 'pages', (('pid=' . $id) . ' AND deleted=0 AND ') . $permsClause);
+                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
+                               if ($begin <= 0 && ($row['hidden'] == 0 || $considerHidden == 1)) {
+                                       $theList .= $row['uid'] . ',';
+                                       $this->extPageInTreeInfo[] = array($row['uid'], htmlspecialchars($row['title'], $depth));
+                               }
+                               if ($depth > 1 && (!($row['hidden'] == 1 && $row['extendToSubpages'] == 1) || $considerHidden == 1)) {
+                                       $theList .= $this->extGetTreeList($row['uid'], $depth - 1, $begin - 1, $permsClause, $considerHidden);
+                               }
+                       }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               }
+               return $theList;
+       }
+
+       /**
+        * @param array $pageInfo Array with uid, title, hidden, extendToSubpages from pages table
+        * @return boolean TRUE if rootline contains a hidden page, FALSE if not
+        */
+       public function getRootLineIsHidden(array $pageInfo) {
+               $hidden = FALSE;
+               if ($pageInfo['extendToSubpages'] == 1 && $pageInfo['hidden'] == 1) {
+                       $hidden = TRUE;
+               } else {
+                       if ($pageInfo['pid'] > 0) {
+                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,hidden,extendToSubpages', 'pages', 'uid=' . $pageInfo['pid']);
+                               while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
+                                       $hidden = $this->getRootLineIsHidden($row);
+                               }
+                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
+                       } else {
+                               $hidden = FALSE;
+                       }
+               }
+               return $hidden;
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/AbstractLinktype.php b/typo3/sysext/linkvalidator/Classes/Linktype/AbstractLinktype.php
new file mode 100644 (file)
index 0000000..4836daa
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Linktype;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check Base plugin implementation
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+abstract class AbstractLinktype implements \TYPO3\CMS\Linkvalidator\Linktype\LinktypeInterface {
+
+       /**
+        * Contains parameters needed for the rendering of the error message
+        *
+        * @var array
+        */
+       protected $errorParams = array();
+
+       /**
+        * Base type fetching method, based on the type that softRefParserObj returns
+        *
+        * @param array $value Reference properties
+        * @param string $type Current type
+        * @param string $key Validator hook name
+        * @return string Fetched type
+        */
+       public function fetchType($value, $type, $key) {
+               if ($value['type'] == $key) {
+                       $type = $value['type'];
+               }
+               return $type;
+       }
+
+       /**
+        * Set the value of the protected property errorParams
+        *
+        * @param array $value All parameters needed for the rendering of the error message
+        * @return void
+        */
+       protected function setErrorParams($value) {
+               $this->errorParams = $value;
+       }
+
+       /**
+        * Get the value of the private property errorParams
+        *
+        * @return array All parameters needed for the rendering of the error message
+        */
+       public function getErrorParams() {
+               return $this->errorParams;
+       }
+
+       /**
+        * Construct a valid Url for browser output
+        *
+        * @param array $row Broken link record
+        * @return string Parsed broken url
+        */
+       public function getBrokenUrl($row) {
+               return $row['url'];
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php b/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php
new file mode 100644 (file)
index 0000000..764525c
--- /dev/null
@@ -0,0 +1,177 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Linktype;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2009 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check External Links plugin implementation
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @author Philipp Gampe <typo3.dev@philippgampe.info>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class ExternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
+
+       /**
+        * Cached list of the URLs, which were already checked for the current processing
+        *
+        * @var array $urlReports
+        */
+       protected $urlReports = array();
+
+       /**
+        * Cached list of all error parameters of the URLs, which were already checked for the current processing
+        *
+        * @var array $urlErrorParams
+        */
+       protected $urlErrorParams = array();
+
+       /**
+        * List of headers to be used for matching an URL for the current processing
+        *
+        * @var array $additionalHeaders
+        */
+       protected $additionalHeaders = array();
+
+       /**
+        * Checks a given URL for validity
+        *
+        * @param string $url The 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 of tx_linkvalidator_Processor
+        * @return boolean TRUE on success or FALSE on error
+        */
+       public function checkLink($url, $softRefEntry, $reference) {
+               $errorParams = array();
+               $isValidUrl = TRUE;
+               if (isset($this->urlReports[$url])) {
+                       if (!$this->urlReports[$url]) {
+                               if (is_array($this->urlErrorParams[$url])) {
+                                       $this->setErrorParams($this->urlErrorParams[$url]);
+                               }
+                       }
+                       return $this->urlReports[$url];
+               }
+               $config = array(
+                       'follow_redirects' => TRUE,
+                       'strict_redirects' => TRUE
+               );
+               /** @var t3lib_http_Request|HTTP_Request2 $request */
+               $request = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Http\\HttpRequest', $url, 'HEAD', $config);
+               // Observe cookies
+               $request->setCookieJar(TRUE);
+               try {
+                       /** @var HTTP_Request2_Response $response */
+                       $response = $request->send();
+                       // HEAD was not allowed, now trying GET
+                       if (isset($response) && $response->getStatus() === 405) {
+                               $request->setMethod('GET');
+                               $request->setHeader('Range', 'bytes = 0 - 4048');
+                               /** @var HTTP_Request2_Response $response */
+                               $response = $request->send();
+                       }
+               } catch (\Exception $e) {
+                       $isValidUrl = FALSE;
+                       // A redirect loop occurred
+                       if ($e->getCode() === 40) {
+                               // Parse the exception for more information
+                               $trace = $e->getTrace();
+                               $traceUrl = $trace[0]['args'][0]->getUrl()->getUrl();
+                               $traceCode = $trace[0]['args'][1]->getStatus();
+                               $errorParams['errorType'] = 'loop';
+                               $errorParams['location'] = $traceUrl;
+                               $errorParams['errorCode'] = $traceCode;
+                       } else {
+                               $errorParams['errorType'] = 'exception';
+                       }
+                       $errorParams['message'] = $e->getMessage();
+               }
+               if (isset($response) && $response->getStatus() >= 300) {
+                       $isValidUrl = FALSE;
+                       $errorParams['errorType'] = $response->getStatus();
+                       $errorParams['message'] = $response->getReasonPhrase();
+               }
+               if (!$isValidUrl) {
+                       $this->setErrorParams($errorParams);
+               }
+               $this->urlReports[$url] = $isValidUrl;
+               $this->urlErrorParams[$url] = $errorParams;
+               return $isValidUrl;
+       }
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing
+        *
+        * @param array $errorParams All parameters needed for the rendering of the error message
+        * @return string Validation error message
+        */
+       public function getErrorMessage($errorParams) {
+               $errorType = $errorParams['errorType'];
+               switch ($errorType) {
+               case 300:
+                       $response = sprintf($GLOBALS['LANG']->getLL('list.report.externalerror'), $errorType);
+                       break;
+               case 403:
+                       $response = $GLOBALS['LANG']->getLL('list.report.pageforbidden403');
+                       break;
+               case 404:
+                       $response = $GLOBALS['LANG']->getLL('list.report.pagenotfound404');
+                       break;
+               case 500:
+                       $response = $GLOBALS['LANG']->getLL('list.report.internalerror500');
+                       break;
+               case 'loop':
+                       $response = sprintf($GLOBALS['LANG']->getLL('list.report.redirectloop'), $errorParams['errorCode'], $errorParams['location']);
+                       break;
+               case 'exception':
+                       $response = sprintf($GLOBALS['LANG']->getLL('list.report.httpexception'), $errorParams['message']);
+                       break;
+               default:
+                       $response = sprintf($GLOBALS['LANG']->getLL('list.report.otherhttpcode'), $errorType, $errorParams['message']);
+               }
+               return $response;
+       }
+
+       /**
+        * Get the external type from the softRefParserObj result
+        *
+        * @param array $value Reference properties
+        * @param string $type Current type
+        * @param string $key Validator hook name
+        * @return string Fetched type
+        */
+       public function fetchType($value, $type, $key) {
+               preg_match_all('/((?:http|https))(?::\\/\\/)(?:[^\\s<>]+)/i', $value['tokenValue'], $urls, PREG_PATTERN_ORDER);
+               if (!empty($urls[0][0])) {
+                       $type = 'external';
+               }
+               return $type;
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php b/typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php
new file mode 100644 (file)
index 0000000..3072968
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Linktype;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check File Links plugin implementation
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class FileLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
+
+       /**
+        * Checks a given URL + /path/filename.ext 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 of tx_linkvalidator_Processor
+        * @return boolean TRUE on success or FALSE on error
+        */
+       public function checkLink($url, $softRefEntry, $reference) {
+               if (!@file_exists((PATH_site . rawurldecode($url)))) {
+                       return FALSE;
+               }
+               return TRUE;
+       }
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing
+        *
+        * @param array $errorParams All parameters needed for the rendering of the error message
+        * @return string Validation error message
+        */
+       public function getErrorMessage($errorParams) {
+               $response = $GLOBALS['LANG']->getLL('list.report.filenotexisting');
+               return $response;
+       }
+
+       /**
+        * Construct a valid Url for browser output
+        *
+        * @param array $row Broken link record
+        * @return string Parsed broken url
+        */
+       public function getBrokenUrl($row) {
+               $brokenUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $row['url'];
+               return $brokenUrl;
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/InternalLinktype.php b/typo3/sysext/linkvalidator/Classes/Linktype/InternalLinktype.php
new file mode 100644 (file)
index 0000000..964a06c
--- /dev/null
@@ -0,0 +1,265 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Linktype;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check Internal Links plugin implementation
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class InternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
+
+       const DELETED = 'deleted';
+       const HIDDEN = 'hidden';
+       const MOVED = 'moved';
+       const NOTEXISTING = 'notExisting';
+       /**
+        * All parameters needed for rendering the error message
+        *
+        * @var array
+        */
+       protected $errorParams = array();
+
+       /**
+        * Result of the check, if the current page uid is valid or not
+        *
+        * @var boolean
+        */
+       protected $responsePage = TRUE;
+
+       /**
+        * Result of the check, if the current content uid is valid or not
+        *
+        * @var boolean
+        */
+       protected $responseContent = TRUE;
+
+       /**
+        * Checks a given URL + /path/filename.ext for validity
+        *
+        * @param string $url Url to check as page-id or page-id#anchor (if anchor is present)
+        * @param array $softRefEntry: The soft reference entry which builds the context of that url
+        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
+        * @return boolean TRUE on success or FALSE on error
+        */
+       public function checkLink($url, $softRefEntry, $reference) {
+               $anchor = '';
+               $this->responseContent = TRUE;
+               // Might already contain values - empty it
+               unset($this->errorParams);
+               // defines the linked page and anchor (if any).
+               if (strpos($url, '#c') !== FALSE) {
+                       $parts = explode('#c', $url);
+                       $page = $parts[0];
+                       $anchor = $parts[1];
+               } else {
+                       $page = $url;
+               }
+               // Check if the linked page is OK
+               $this->responsePage = $this->checkPage($page, $softRefEntry, $reference);
+               // Check if the linked content element is OK
+               if ($anchor) {
+                       // Check if the content element is OK
+                       $this->responseContent = $this->checkContent($page, $anchor, $softRefEntry, $reference);
+               }
+               if (is_array($this->errorParams['page']) && !$this->responsePage || is_array($this->errorParams['content']) && !$this->responseContent) {
+                       $this->setErrorParams($this->errorParams);
+               }
+               if ($this->responsePage === TRUE && $this->responseContent === TRUE) {
+                       $response = TRUE;
+               } else {
+                       $response = FALSE;
+               }
+               return $response;
+       }
+
+       /**
+        * Checks a given page uid for validity
+        *
+        * @param string $page Page uid to check
+        * @param array $softRefEntry The soft reference entry which builds the context of that url
+        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
+        * @return boolean TRUE on success or FALSE on error
+        */
+       protected function checkPage($page, $softRefEntry, $reference) {
+               $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, title, deleted, hidden, starttime, endtime', 'pages', 'uid = ' . intval($page));
+               $this->responsePage = TRUE;
+               if ($row) {
+                       if ($row['deleted'] == '1') {
+                               $this->errorParams['errorType']['page'] = self::DELETED;
+                               $this->errorParams['page']['title'] = $row['title'];
+                               $this->errorParams['page']['uid'] = $row['uid'];
+                               $this->responsePage = FALSE;
+                       } elseif (($row['hidden'] == '1' || $GLOBALS['EXEC_TIME'] < intval($row['starttime'])) || $row['endtime'] && intval($row['endtime']) < $GLOBALS['EXEC_TIME']) {
+                               $this->errorParams['errorType']['page'] = self::HIDDEN;
+                               $this->errorParams['page']['title'] = $row['title'];
+                               $this->errorParams['page']['uid'] = $row['uid'];
+                               $this->responsePage = FALSE;
+                       }
+               } else {
+                       $this->errorParams['errorType']['page'] = self::NOTEXISTING;
+                       $this->errorParams['page']['uid'] = intval($page);
+                       $this->responsePage = FALSE;
+               }
+               return $this->responsePage;
+       }
+
+       /**
+        * Checks a given content uid for validity
+        *
+        * @param string $page Uid of the page to which the link is pointing
+        * @param string $anchor Uid of the content element to check
+        * @param array $softRefEntry The soft reference entry which builds the context of that url
+        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
+        * @return boolean TRUE on success or FALSE on error
+        */
+       protected function checkContent($page, $anchor, $softRefEntry, $reference) {
+               // Get page ID on which the content element in fact is located
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, pid, header, deleted, hidden, starttime, endtime', 'tt_content', 'uid = ' . intval($anchor));
+               $this->responseContent = TRUE;
+               // this content element exists
+               if ($res) {
+                       // page ID on which this CE is in fact located.
+                       $correctPageID = $res['pid'];
+                       // Check if the element is on the linked page
+                       // (The element might have been moved to another page)
+                       if (!($correctPageID === $page)) {
+                               $this->errorParams['errorType']['content'] = self::MOVED;
+                               $this->errorParams['content']['uid'] = intval($anchor);
+                               $this->errorParams['content']['wrongPage'] = intval($page);
+                               $this->errorParams['content']['rightPage'] = intval($correctPageID);
+                               $this->responseContent = FALSE;
+                       } else {
+                               // The element is located on the page to which the link is pointing
+                               if ($res['deleted'] == '1') {
+                                       $this->errorParams['errorType']['content'] = self::DELETED;
+                                       $this->errorParams['content']['title'] = $res['header'];
+                                       $this->errorParams['content']['uid'] = $res['uid'];
+                                       $this->responseContent = FALSE;
+                               } elseif (($res['hidden'] == '1' || $GLOBALS['EXEC_TIME'] < intval($res['starttime'])) || $res['endtime'] && intval($res['endtime']) < $GLOBALS['EXEC_TIME']) {
+                                       $this->errorParams['errorType']['content'] = self::HIDDEN;
+                                       $this->errorParams['content']['title'] = $res['header'];
+                                       $this->errorParams['content']['uid'] = $res['uid'];
+                                       $this->responseContent = FALSE;
+                               }
+                       }
+               } else {
+                       // The content element does not exist
+                       $this->errorParams['errorType']['content'] = self::NOTEXISTING;
+                       $this->errorParams['content']['uid'] = intval($anchor);
+                       $this->responseContent = FALSE;
+               }
+               return $this->responseContent;
+       }
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing
+        *
+        * @param array $errorParams All parameters needed for the rendering of the error message
+        * @return string Validation error message
+        */
+       public function getErrorMessage($errorParams) {
+               $errorType = $errorParams['errorType'];
+               if (is_array($errorParams['page'])) {
+                       switch ($errorType['page']) {
+                       case self::DELETED:
+                               $errorPage = $GLOBALS['LANG']->getLL('list.report.pagedeleted');
+                               $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
+                               $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                               break;
+                       case self::HIDDEN:
+                               $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotvisible');
+                               $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
+                               $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                               break;
+                       default:
+                               $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotexisting');
+                               $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                       }
+               }
+               if (is_array($errorParams['content'])) {
+                       switch ($errorType['content']) {
+                       case self::DELETED:
+                               $errorContent = $GLOBALS['LANG']->getLL('list.report.contentdeleted');
+                               $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
+                               $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                               break;
+                       case self::HIDDEN:
+                               $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotvisible');
+                               $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
+                               $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                               break;
+                       case self::MOVED:
+                               $errorContent = $GLOBALS['LANG']->getLL('list.report.contentmoved');
+                               $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
+                               $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                               $errorContent = str_replace('###wrongpage###', $errorParams['content']['wrongPage'], $errorContent);
+                               $errorContent = str_replace('###rightpage###', $errorParams['content']['rightPage'], $errorContent);
+                               break;
+                       default:
+                               $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotexisting');
+                               $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                       }
+               }
+               if (isset($errorPage) && isset($errorContent)) {
+                       $response = ($errorPage . '<br />') . $errorContent;
+               } elseif (isset($errorPage)) {
+                       $response = $errorPage;
+               } elseif (isset($errorContent)) {
+                       $response = $errorContent;
+               } else {
+                       // This should not happen
+                       $response = $GLOBALS['LANG']->getLL('list.report.noinformation');
+               }
+               return $response;
+       }
+
+       /**
+        * Construct a valid Url for browser output
+        *
+        * @param array $row Broken link record
+        * @return string Parsed broken url
+        */
+       public function getBrokenUrl($row) {
+               $domain = rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), '/');
+               $rootLine = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($row['record_pid']);
+               // checks alternate domains
+               if (count($rootLine) > 0) {
+                       $protocol = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
+                       $domainRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::firstDomainRecord($rootLine);
+                       if (!empty($domainRecord)) {
+                               $domain = $protocol . $domainRecord;
+                       }
+               }
+               return ($domain . '/index.php?id=') . $row['url'];
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php b/typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php
new file mode 100644 (file)
index 0000000..c609b10
--- /dev/null
@@ -0,0 +1,134 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Linktype;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check Link Handler plugin implementation
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class LinkHandler extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
+
+       const DELETED = 'deleted';
+       /**
+        * TSconfig of the module tx_linkhandler
+        *
+        * @var array
+        */
+       protected $tsconfig;
+
+       /**
+        * Get TSconfig when loading the class
+        *
+        * @todo Define visibility
+        */
+       public function __construct() {
+               $this->tsconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig(1, 'mod.tx_linkhandler');
+       }
+
+       /**
+        * 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 of tx_linkvalidator_Processor
+        * @return boolean TRUE on success or FALSE on error
+        */
+       public function checkLink($url, $softRefEntry, $reference) {
+               $response = TRUE;
+               $errorParams = array();
+               $parts = explode(':', $url);
+               if (count($parts) == 3) {
+                       $tableName = htmlspecialchars($parts[1]);
+                       $rowid = intval($parts[2]);
+                       $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', $tableName, 'uid = ' . intval($rowid));
+                       if ($row) {
+                               if ($row['deleted'] == '1') {
+                                       $errorParams['errorType'] = self::DELETED;
+                                       $errorParams['tablename'] = $tableName;
+                                       $errorParams['uid'] = $rowid;
+                                       $response = FALSE;
+                               }
+                       } else {
+                               $errorParams['tablename'] = $tableName;
+                               $errorParams['uid'] = $rowid;
+                               $response = FALSE;
+                       }
+               }
+               if (!$response) {
+                       $this->setErrorParams();
+               }
+               return $response;
+       }
+
+       /**
+        * Type fetching method, based on the type that softRefParserObj returns
+        *
+        * @param array $value Reference properties
+        * @param string $type Current type
+        * @param string $key Validator hook name
+        * @return string fetched type
+        */
+       public function fetchType($value, $type, $key) {
+               if ($type == 'string' && strtolower(substr($value['tokenValue'], 0, 7)) == 'record:') {
+                       $type = 'linkhandler';
+               }
+               return $type;
+       }
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing
+        *
+        * @param array $errorParams All parameters needed for the rendering of the error message
+        * @return string Validation error message
+        */
+       public function getErrorMessage($errorParams) {
+               $errorType = $errorParams['errorType'];
+               $tableName = $errorParams['tablename'];
+               $title = $GLOBALS['LANG']->getLL('list.report.rowdeleted.default.title');
+               if ($this->tsconfig['properties'][$tableName . '.']) {
+                       $title = $this->tsconfig['properties'][$tableName . '.']['label'];
+               }
+               switch ($errorType) {
+               case self::DELETED:
+                       $response = $GLOBALS['LANG']->getLL('list.report.rowdeleted');
+                       $response = str_replace('###title###', $title, $response);
+                       $response = str_replace('###uid###', $errorParams['uid'], $response);
+                       break;
+               default:
+                       $response = $GLOBALS['LANG']->getLL('list.report.rownotexisting');
+                       $response = str_replace('###uid###', $errorParams['uid'], $response);
+                       break;
+               }
+               return $response;
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php b/typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php
new file mode 100644 (file)
index 0000000..77f79e4
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Linktype;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides interface implementation.
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+interface LinktypeInterface
+{
+       /**
+        * Checks a given link 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 of tx_linkvalidator_Processor
+        * @return string Validation error message or success code
+        */
+       public function checkLink($url, $softRefEntry, $reference);
+
+       /**
+        * Base type fetching method, based on the type that softRefParserObj returns.
+        *
+        * @param array $value Reference properties
+        * @param string $type Current type
+        * @param string $key Validator hook name
+        * @return string Fetched type
+        */
+       public function fetchType($value, $type, $key);
+
+       /**
+        * Get the value of the private property errorParams.
+        *
+        * @return array All parameters needed for the rendering of the error message
+        */
+       public function getErrorParams();
+
+       /**
+        * Construct a valid Url for browser output
+        *
+        * @param array $row Broken link record
+        * @return string Parsed broken url
+        */
+       public function getBrokenUrl($row);
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing
+        *
+        * @param array $errorParams All parameters needed for the rendering of the error message
+        * @return string Validation error message
+        */
+       public function getErrorMessage($errorParams);
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_abstract.php b/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_abstract.php
new file mode 100644 (file)
index 0000000..46918fe
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_linktype_Abstract and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Linktype/AbstractLinktype.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Linktype/AbstractLinktype.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_external.php b/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_external.php
new file mode 100644 (file)
index 0000000..5b090f0
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_linktype_External and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Linktype/ExternalLinktype.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_file.php b/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_file.php
new file mode 100644 (file)
index 0000000..57be46a
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_linktype_File and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Linktype/FileLinktype.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_interface.php b/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_interface.php
new file mode 100644 (file)
index 0000000..2dab0f0
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_linktype_Interface and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Linktype/LinktypeInterface.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_internal.php b/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_internal.php
new file mode 100644 (file)
index 0000000..02d1de8
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_linktype_Internal and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Linktype/InternalLinktype.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Linktype/InternalLinktype.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_linkhandler.php b/typo3/sysext/linkvalidator/Classes/Linktype/class.tx_linkvalidator_linktype_linkhandler.php
new file mode 100644 (file)
index 0000000..82f8f9f
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_linktype_LinkHandler and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Linktype/LinkHandler.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php b/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php
new file mode 100644 (file)
index 0000000..724de5d
--- /dev/null
@@ -0,0 +1,668 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Report;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Module 'Linkvalidator' for the 'linkvalidator' extension
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @author Jochen Rieger <j.rieger@connecta.ag>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
+
+       /**
+        * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
+        */
+       public $doc;
+
+       /**
+        * @var string
+        */
+       protected $relativePath;
+
+       /**
+        * Information about the current page record
+        *
+        * @var array
+        */
+       protected $pageRecord = array();
+
+       /**
+        * Information, if the module is accessible for the current user or not
+        *
+        * @var boolean
+        */
+       protected $isAccessibleForCurrentUser = FALSE;
+
+       /**
+        * Depth for the recursive traversal of pages for the link validation
+        *
+        * @var integer
+        */
+       protected $searchLevel;
+
+       /**
+        * Link validation class
+        *
+        * @var \TYPO3\CMS\Linkvalidator\LinkAnalyzer
+        */
+       protected $processor;
+
+       /**
+        * TSconfig of the current module
+        *
+        * @var array
+        */
+       protected $modTS = array();
+
+       /**
+        * List of available link types to check defined in the TSconfig
+        *
+        * @var array
+        */
+       protected $availableOptions = array();
+
+       /**
+        * List of link types currently chosen in the statistics table
+        * Used to show broken links of these types only
+        *
+        * @var array
+        */
+       protected $checkOpt = array();
+
+       /**
+        * Html for the button "Check Links"
+        *
+        * @var string
+        */
+       protected $updateListHtml;
+
+       /**
+        * Html for the button "Refresh Display"
+        *
+        * @var string
+        */
+       protected $refreshListHtml;
+
+       /**
+        * Html for the statistics table with the checkboxes of the link types
+        * and the numbers of broken links for report tab
+        *
+        * @var string
+        */
+       protected $checkOptHtml;
+
+       /**
+        * Html for the statistics table with the checkboxes of the link types
+        * and the numbers of broken links for check links tab
+        *
+        * @var string
+        */
+       protected $checkOptHtmlCheck;
+
+       /**
+        * Complete content (html) to be displayed
+        *
+        * @var string
+        */
+       protected $content;
+
+       /**
+        * @var t3lib_pageRenderer $pageRenderer
+        */
+       protected $pageRenderer;
+
+       /**
+        * @var string $resPath Path to "linkvalidator/res/" to be used in pageRenderer
+        */
+       protected $resPath = '';
+
+       /**
+        * @var tx_linkvalidator_linktype_Interface[] $hookObjectsArr
+        */
+       protected $hookObjectsArr = array();
+
+       /**
+        * @var string $checkAllHtml
+        */
+       protected $checkAllHtml = '';
+
+       /**
+        * Main method of modfuncreport
+        *
+        * @return string Module content
+        */
+       public function main() {
+               $GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/modfuncreport/locallang.xml');
+               $this->searchLevel = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('search_levels');
+               if (isset($this->pObj->id)) {
+                       $this->modTS = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->pObj->id, 'mod.linkvalidator');
+                       $this->modTS = $this->modTS['properties'];
+               }
+               $update = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('updateLinkList');
+               $prefix = '';
+               if (!empty($update)) {
+                       $prefix = 'check';
+               }
+               $set = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($prefix . 'SET');
+               $this->pObj->handleExternalFunctionValue();
+               if (isset($this->searchLevel)) {
+                       $this->pObj->MOD_SETTINGS['searchlevel'] = $this->searchLevel;
+               } else {
+                       $this->searchLevel = $this->pObj->MOD_SETTINGS['searchlevel'];
+               }
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) {
+                               // Compile list of all available types. Used for checking with button "Check Links".
+                               if (strpos($this->modTS['linktypes'], $linkType) !== FALSE) {
+                                       $this->availableOptions[$linkType] = 1;
+                               }
+                               // Compile list of types currently selected by the checkboxes
+                               if ($this->pObj->MOD_SETTINGS[$linkType] && empty($set) || $set[$linkType]) {
+                                       $this->checkOpt[$linkType] = 1;
+                                       $this->pObj->MOD_SETTINGS[$linkType] = 1;
+                               } else {
+                                       $this->pObj->MOD_SETTINGS[$linkType] = 0;
+                                       unset($this->checkOpt[$linkType]);
+                               }
+                       }
+               }
+               $GLOBALS['BE_USER']->pushModuleData('web_info', $this->pObj->MOD_SETTINGS);
+               $this->initialize();
+               // Setting up the context sensitive menu
+               $this->resPath = ($this->doc->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('linkvalidator')) . 'res/';
+               $this->pageRenderer = $this->doc->getPageRenderer();
+               // Localization
+               $this->pageRenderer->addInlineLanguageLabelFile(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator', 'modfuncreport/locallang.xml'));
+               $this->pageRenderer->addJsInlineCode('linkvalidator', 'function toggleActionButton(prefix) {
+                       var buttonDisable = true;
+                       Ext.select(\'.\' + prefix ,false).each(function(checkBox,i){
+                       checkDom = checkBox.dom;
+                       if (checkDom.checked){
+                               buttonDisable = false;
+                       }
+
+                       });
+                       if (prefix == \'check\'){
+                               checkSub = document.getElementById(\'updateLinkList\');
+                       } else {
+                               checkSub = document.getElementById(\'refreshLinkList\');
+                       }
+                       checkSub.disabled = buttonDisable;
+               }');
+               // Add JS
+               $this->pageRenderer->addJsFile($this->doc->backPath . '../t3lib/js/extjs/ux/Ext.ux.FitToParent.js');
+               $this->pageRenderer->addJsFile($this->doc->backPath . '../t3lib/js/extjs/ux/flashmessages.js');
+               $this->pageRenderer->addJsFile($this->doc->backPath . 'js/extjs/iframepanel.js');
+               if ($this->modTS['showCheckLinkTab'] == 1) {
+                       $this->updateListHtml = ('<input type="submit" name="updateLinkList" id="updateLinkList" value="' . $GLOBALS['LANG']->getLL('label_update')) . '"/>';
+               }
+               $this->refreshListHtml = ('<input type="submit" name="refreshLinkList" id="refreshLinkList"  value="' . $GLOBALS['LANG']->getLL('label_refresh')) . '"/>';
+               $this->processor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Linkvalidator\\LinkAnalyzer');
+               $this->updateBrokenLinks();
+               $brokenLinkOverView = $this->processor->getLinkCounts($this->pObj->id);
+               $this->checkOptHtml = $this->getCheckOptions($brokenLinkOverView);
+               $this->checkOptHtmlCheck = $this->getCheckOptions($brokenLinkOverView, 'check');
+               $this->createTabs();
+               return '<div id="linkvalidator-modfuncreport"></div>';
+       }
+
+       /**
+        * Create TabPanel to split the report and the checkLink functions
+        *
+        * @return void
+        */
+       protected function createTabs() {
+               $panelCheck = '';
+               if ($this->modTS['showCheckLinkTab'] == 1) {
+                       $panelCheck = ('{
+                               title: TYPO3.l10n.localize(\'CheckLink\'),
+                               html: ' . json_encode($this->flush())) . ',
+                       }';
+               }
+               $this->render();
+               $js = ((('var panel = new Ext.TabPanel( {
+                       renderTo: \'linkvalidator-modfuncreport\',
+                       id: \'linkvalidator-main\',
+                       plain: true,
+                       activeTab: 0,
+                       bodyStyle: \'padding:10px;\',
+                       items : [
+                       {
+                               autoHeight: true,
+                               title: TYPO3.l10n.localize(\'Report\'),
+                               html: ' . json_encode($this->flush(TRUE))) . '
+                       },
+                       ') . $panelCheck) . '
+                       ]
+
+               });
+               ';
+               $this->pageRenderer->addExtOnReadyCode($js);
+       }
+
+       /**
+        * Initializes the menu array internally
+        *
+        * @return array Module menu
+        */
+       public function modMenu() {
+               $modMenu = array(
+                       'checkAllLink' => 0
+               );
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) {
+                               $modMenu[$linkType] = 1;
+                       }
+               }
+               return $modMenu;
+       }
+
+       /**
+        * Initializes the Module
+        *
+        * @return void
+        */
+       protected function initialize() {
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $classRef) {
+                               $this->hookObjectsArr[$linkType] = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
+                       }
+               }
+               $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
+               $this->doc->backPath = $GLOBALS['BACK_PATH'];
+               $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'modfuncreport/mod_template.html');
+               $this->relativePath = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('linkvalidator');
+               $this->pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->pObj->id, $GLOBALS['BE_USER']->getPagePermsClause(1));
+               $this->isAccessibleForCurrentUser = FALSE;
+               if ($this->pObj->id && is_array($this->pageRecord) || !$this->pObj->id && $this->isCurrentUserAdmin()) {
+                       $this->isAccessibleForCurrentUser = TRUE;
+               }
+               $this->loadHeaderData();
+               // Don't access in workspace
+               if ($GLOBALS['BE_USER']->workspace !== 0) {
+                       $this->isAccessibleForCurrentUser = FALSE;
+               }
+       }
+
+       /**
+        * Updates the table of stored broken links
+        *
+        * @return void
+        */
+       protected function updateBrokenLinks() {
+               $searchFields = array();
+               // Get the searchFields from TypoScript
+               foreach ($this->modTS['searchFields.'] as $table => $fieldList) {
+                       $fields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fieldList);
+                       foreach ($fields as $field) {
+                               if ((!$searchFields || !is_array($searchFields[$table])) || array_search($field, $searchFields[$table]) == FALSE) {
+                                       $searchFields[$table][] = $field;
+                               }
+                       }
+               }
+               $rootLineHidden = $this->processor->getRootLineIsHidden($this->pObj->pageinfo);
+               if (!$rootLineHidden || $this->modTS['checkhidden'] == 1) {
+                       // Get children pages
+                       $pageList = $this->processor->extGetTreeList($this->pObj->id, $this->searchLevel, 0, $GLOBALS['BE_USER']->getPagePermsClause(1), $this->modTS['checkhidden']);
+                       if ($this->pObj->pageinfo['hidden'] == 0 || $this->modTS['checkhidden'] == 1) {
+                               $pageList .= $this->pObj->id;
+                       }
+                       $this->processor->init($searchFields, $pageList);
+                       // Check if button press
+                       $update = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('updateLinkList');
+                       if (!empty($update)) {
+                               $this->processor->getLinkStatistics($this->checkOpt, $this->modTS['checkhidden']);
+                       }
+               }
+       }
+
+       /**
+        * Renders the content of the module
+        *
+        * @return void
+        */
+       protected function render() {
+               if ($this->isAccessibleForCurrentUser) {
+                       $this->content = $this->renderBrokenLinksTable();
+               } else {
+                       // If no access or if ID == zero
+                       /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $message */
+                       $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('no.access'), $GLOBALS['LANG']->getLL('no.access.title'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                       $this->content .= $message->render();
+               }
+       }
+
+       /**
+        * Flushes the rendered content to the browser
+        *
+        * @param boolean $form
+        * @return string $content
+        */
+       protected function flush($form = FALSE) {
+               $content = $this->doc->moduleBody($this->pageRecord, $this->getDocHeaderButtons(), $form ? $this->getTemplateMarkers() : $this->getTemplateMarkersCheck());
+               return $content;
+       }
+
+       /**
+        * Builds the selector for the level of pages to search
+        *
+        * @return string Html code of that selector
+        */
+       protected function getLevelSelector() {
+               // Build level selector
+               $opt = array();
+               $parts = array(
+                       0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'),
+                       1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'),
+                       2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
+                       3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
+                       999 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi')
+               );
+               foreach ($parts as $kv => $label) {
+                       $opt[] = ((((('<option value="' . $kv) . '"') . ($kv == intval($this->searchLevel) ? ' selected="selected"' : '')) . '>') . htmlspecialchars($label)) . '</option>';
+               }
+               $lMenu = ('<select name="search_levels">' . implode('', $opt)) . '</select>';
+               return $lMenu;
+       }
+
+       /**
+        * Displays the table of broken links or a note if there were no broken links
+        *
+        * @return string Content of the table or of the note
+        */
+       protected function renderBrokenLinksTable() {
+               $items = ($brokenLinksMarker = array());
+               $brokenLinkItems = '';
+               $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->doc->moduleTemplate, '###NOBROKENLINKS_CONTENT###');
+               $keyOpt = array();
+               if (is_array($this->checkOpt)) {
+                       $keyOpt = array_keys($this->checkOpt);
+               }
+               $rootLineHidden = $this->processor->getRootLineIsHidden($this->pObj->pageinfo);
+               if (!$rootLineHidden || $this->modTS['checkhidden'] == 1) {
+                       $pageList = $this->processor->extGetTreeList($this->pObj->id, $this->searchLevel, 0, $GLOBALS['BE_USER']->getPagePermsClause(1), $this->modTS['checkhidden']);
+                       // Always add the current page, because we are just displaying the results
+                       $pageList .= $this->pObj->id;
+                       if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_linkvalidator_link', ((('record_pid in (' . $pageList) . ') and link_type in (\'') . implode('\',\'', $keyOpt)) . '\')', '', 'record_uid ASC, uid ASC')) {
+                               // Display table with broken links
+                               if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
+                                       $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_CONTENT###');
+                                       $brokenLinksItemTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_ITEM###');
+                                       // Table header
+                                       $brokenLinksMarker = $this->startTable();
+                                       // Table rows containing the broken links
+                                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
+                                               $items[] = $this->renderTableRow($row['table_name'], $row, $brokenLinksItemTemplate);
+                                       }
+                                       $brokenLinkItems = implode(chr(10), $items);
+                               } else {
+                                       $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
+                               }
+                       }
+               } else {
+                       $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
+               }
+               $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($brokenLinksTemplate, $brokenLinksMarker, '###|###', TRUE);
+               $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($brokenLinksTemplate, '###BROKENLINKS_ITEM', $brokenLinkItems);
+               return $content;
+       }
+
+       /**
+        * Replace $brokenLinksMarker['NO_BROKEN_LINKS] with localized flashmessage
+        *
+        * @param array $brokenLinksMarker
+        * @return array $brokenLinksMarker['NO_BROKEN_LINKS] replaced with flashmessage
+        */
+       protected function getNoBrokenLinkMessage(array $brokenLinksMarker) {
+               $brokenLinksMarker['LIST_HEADER'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('list.header'));
+               /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $message */
+               $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('list.no.broken.links'), $GLOBALS['LANG']->getLL('list.no.broken.links.title'), \TYPO3\CMS\Core\Messaging\FlashMessage::OK);
+               $brokenLinksMarker['NO_BROKEN_LINKS'] = $message->render();
+               return $brokenLinksMarker;
+       }
+
+       /**
+        * Displays the table header of the table with the broken links
+        *
+        * @return string Code of content
+        */
+       protected function startTable() {
+               // Listing head
+               $makerTableHead = array();
+               $makerTableHead['tablehead_path'] = $GLOBALS['LANG']->getLL('list.tableHead.path');
+               $makerTableHead['tablehead_element'] = $GLOBALS['LANG']->getLL('list.tableHead.element');
+               $makerTableHead['tablehead_headlink'] = $GLOBALS['LANG']->getLL('list.tableHead.headlink');
+               $makerTableHead['tablehead_linktarget'] = $GLOBALS['LANG']->getLL('list.tableHead.linktarget');
+               $makerTableHead['tablehead_linkmessage'] = $GLOBALS['LANG']->getLL('list.tableHead.linkmessage');
+               $makerTableHead['tablehead_lastcheck'] = $GLOBALS['LANG']->getLL('list.tableHead.lastCheck');
+               // Add CSH to the header of each column
+               foreach ($makerTableHead as $column => $label) {
+                       $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $column, $label);
+                       $makerTableHead[$column] = $label;
+               }
+               // Add section header
+               $makerTableHead['list_header'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('list.header'));
+               return $makerTableHead;
+       }
+
+       /**
+        * Displays one line of the broken links table
+        *
+        * @param string $table Name of database table
+        * @param array $row Record row to be processed
+        * @param array $brokenLinksItemTemplate Markup of the template to be used
+        * @return string HTML of the rendered row
+        */
+       protected function renderTableRow($table, array $row, $brokenLinksItemTemplate) {
+               $markerArray = array();
+               $fieldName = '';
+               // Restore the linktype object
+               $hookObj = $this->hookObjectsArr[$row['link_type']];
+               $brokenUrl = $hookObj->getBrokenUrl($row);
+               $params = ((('&edit[' . $table) . '][') . $row['record_uid']) . ']=edit';
+               $actionLinks = (((((('<a href="#" onclick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], ((((\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') . '?id=') . $this->pObj->id) . '&search_levels=') . $this->searchLevel))) . '"') . ' title="') . $GLOBALS['LANG']->getLL('list.edit')) . '">') . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open')) . '</a>';
+               $elementHeadline = $row['headline'];
+               if (empty($elementHeadline)) {
+                       $elementHeadline = ('<i>' . $GLOBALS['LANG']->getLL('list.no.headline')) . '</i>';
+               }
+               // Get the language label for the field from TCA
+               if ($GLOBALS['TCA'][$table]['columns'][$row['field']]['label']) {
+                       $fieldName = $GLOBALS['TCA'][$table]['columns'][$row['field']]['label'];
+                       $fieldName = $GLOBALS['LANG']->sL($fieldName);
+                       // Crop colon from end if present
+                       if (substr($fieldName, '-1', '1') === ':') {
+                               $fieldName = substr($fieldName, '0', strlen($fieldName) - 1);
+                       }
+               }
+               // Fallback, if there is no label
+               $fieldName = !empty($fieldName) ? $fieldName : $row['field'];
+               // column "Element"
+               $element = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $row, array('title' => ($table . ':') . $row['record_uid']));
+               $element .= $elementHeadline;
+               $element .= ' ' . sprintf($GLOBALS['LANG']->getLL('list.field'), $fieldName);
+               $markerArray['actionlink'] = $actionLinks;
+               $markerArray['path'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($row['record_pid'], '', 0, 0);
+               $markerArray['element'] = $element;
+               $markerArray['headlink'] = $row['link_title'];
+               $markerArray['linktarget'] = $brokenUrl;
+               $response = unserialize($row['url_response']);
+               if ($response['valid']) {
+                       $linkMessage = ('<span style="color: green;">' . $GLOBALS['LANG']->getLL('list.msg.ok')) . '</span>';
+               } else {
+                       $linkMessage = ('<span style="color: red;">' . $hookObj->getErrorMessage($response['errorParams'])) . '</span>';
+               }
+               $markerArray['linkmessage'] = $linkMessage;
+               $lastRunDate = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $row['last_check']);
+               $lastRunTime = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row['last_check']);
+               $message = sprintf($GLOBALS['LANG']->getLL('list.msg.lastRun'), $lastRunDate, $lastRunTime);
+               $markerArray['lastcheck'] = $message;
+               // Return the table html code as string
+               return \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($brokenLinksItemTemplate, $markerArray, '###|###', TRUE, TRUE);
+       }
+
+       /**
+        * Builds the checkboxes out of the hooks array
+        *
+        * @param array $brokenLinkOverView Array of broken links information
+        * @param string $prefix
+        * @return string code content
+        */
+       protected function getCheckOptions(array $brokenLinkOverView, $prefix = '') {
+               $markerArray = array();
+               $additionalAttr = '';
+               if (!empty($prefix)) {
+                       $additionalAttr = (((' onclick="toggleActionButton(\'' . $prefix) . '\');" class="') . $prefix) . '" ';
+               } else {
+                       $additionalAttr = ' onclick="toggleActionButton(\'refresh\');" class="refresh" ';
+               }
+               $checkOptionsTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->doc->moduleTemplate, '###CHECKOPTIONS_SECTION###');
+               $hookSectionTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($checkOptionsTemplate, '###HOOK_SECTION###');
+               $markerArray['statistics_header'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('report.statistics.header'));
+               $totalCountLabel = $GLOBALS['LANG']->getLL('overviews.nbtotal');
+               $totalCountLabel = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', 'checkboxes', $totalCountLabel);
+               $markerArray['total_count_label'] = $totalCountLabel;
+               if (empty($brokenLinkOverView['brokenlinkCount'])) {
+                       $markerArray['total_count'] = '0';
+               } else {
+                       $markerArray['total_count'] = $brokenLinkOverView['brokenlinkCount'];
+               }
+               $linktypes = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->modTS['linktypes'], 1);
+               $hookSectionContent = '';
+               if (is_array($linktypes)) {
+                       if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
+                               foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
+                                       if (in_array($type, $linktypes)) {
+                                               $hookSectionMarker = array();
+                                               if (empty($brokenLinkOverView[$type])) {
+                                                       $hookSectionMarker['count'] = '0';
+                                               } else {
+                                                       $hookSectionMarker['count'] = $brokenLinkOverView[$type];
+                                               }
+                                               $translation = $GLOBALS['LANG']->getLL('hooks.' . $type);
+                                               $translation = $translation ? $translation : $type;
+                                               $option = (((((((((((((((((('<input type="checkbox" ' . $additionalAttr) . '  id="') . $prefix) . 'SET_') . $type) . '" name="') . $prefix) . 'SET[') . $type) . ']" value="1"') . ($this->pObj->MOD_SETTINGS[$type] ? ' checked="checked"' : '')) . '/>') . '<label for="') . $prefix) . 'SET[') . $type) . ']">') . htmlspecialchars($translation)) . '</label>';
+                                               $hookSectionMarker['option'] = $option;
+                                               $hookSectionContent .= \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($hookSectionTemplate, $hookSectionMarker, '###|###', TRUE, TRUE);
+                                       }
+                               }
+                       }
+               }
+               $checkOptionsTemplate = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($checkOptionsTemplate, '###HOOK_SECTION###', $hookSectionContent);
+               return \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($checkOptionsTemplate, $markerArray, '###|###', TRUE, TRUE);
+       }
+
+       /**
+        * Loads data in the HTML head section (e.g. JavaScript or stylesheet information)
+        *
+        * @return void
+        */
+       protected function loadHeaderData() {
+               $this->doc->addStyleSheet('linkvalidator', $this->relativePath . 'res/linkvalidator.css', 'linkvalidator');
+               $this->doc->getPageRenderer()->addJsFile($this->doc->backPath . '../t3lib/js/extjs/ux/Ext.ux.FitToParent.js');
+       }
+
+       /**
+        * Gets the buttons that shall be rendered in the docHeader
+        *
+        * @return array Available buttons for the docHeader
+        */
+       protected function getDocHeaderButtons() {
+               $buttons = array(
+                       'csh' => \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']),
+                       'shortcut' => $this->getShortcutButton(),
+                       'save' => ''
+               );
+               return $buttons;
+       }
+
+       /**
+        * Gets the button to set a new shortcut in the backend (if current user is allowed to).
+        *
+        * @return string HTML representation of the shortcut button
+        */
+       protected function getShortcutButton() {
+               $result = '';
+               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
+                       $result = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
+               }
+               return $result;
+       }
+
+       /**
+        * Gets the filled markers that are used in the HTML template
+        *
+        * @return array The filled marker array
+        */
+       protected function getTemplateMarkers() {
+               $markers = array(
+                       'FUNC_TITLE' => $GLOBALS['LANG']->getLL('report.func.title'),
+                       'CHECKOPTIONS_TITLE' => $GLOBALS['LANG']->getLL('report.statistics.header'),
+                       'FUNC_MENU' => $this->getLevelSelector(),
+                       'CONTENT' => $this->content,
+                       'CHECKALLLINK' => $this->checkAllHtml,
+                       'CHECKOPTIONS' => $this->checkOptHtml,
+                       'ID' => ('<input type="hidden" name="id" value="' . $this->pObj->id) . '" />',
+                       'REFRESH' => $this->refreshListHtml,
+                       'UPDATE' => ''
+               );
+               return $markers;
+       }
+
+       /**
+        * Gets the filled markers that are used in the HTML template
+        *
+        * @return array The filled marker array
+        */
+       protected function getTemplateMarkersCheck() {
+               $markers = array(
+                       'FUNC_TITLE' => $GLOBALS['LANG']->getLL('checklinks.func.title'),
+                       'CHECKOPTIONS_TITLE' => $GLOBALS['LANG']->getLL('checklinks.statistics.header'),
+                       'FUNC_MENU' => $this->getLevelSelector(),
+                       'CONTENT' => '',
+                       'CHECKALLLINK' => $this->checkAllHtml,
+                       'CHECKOPTIONS' => $this->checkOptHtmlCheck,
+                       'ID' => ('<input type="hidden" name="id" value="' . $this->pObj->id) . '" />',
+                       'REFRESH' => '',
+                       'UPDATE' => $this->updateListHtml
+               );
+               return $markers;
+       }
+
+       /**
+        * Determines whether the current user is an admin
+        *
+        * @return boolean Whether the current user is admin
+        */
+       protected function isCurrentUserAdmin() {
+               return (bool) $GLOBALS['BE_USER']->user['admin'];
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php b/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
new file mode 100644 (file)
index 0000000..86b7450
--- /dev/null
@@ -0,0 +1,521 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Task;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Scheduler plugin implementation
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
+
+       /**
+        * @var integer
+        */
+       protected $sleepTime;
+
+       /**
+        * @var integer
+        */
+       protected $sleepAfterFinish;
+
+       /**
+        * @var integer
+        */
+       protected $countInARun;
+
+       /**
+        * Total number of broken links
+        *
+        * @var integer
+        */
+       protected $totalBrokenLink = 0;
+
+       /**
+        * Total number of broken links from the last run
+        *
+        * @var integer
+        */
+       protected $oldTotalBrokenLink = 0;
+
+       /**
+        * Mail template fetched from the given template file
+        *
+        * @var string
+        */
+       protected $templateMail;
+
+       /**
+        * specific TSconfig for this task.
+        *
+        * @var array
+        */
+       protected $configuration = array();
+
+       /**
+        * Shows if number of result was different from the result of the last check or not
+        *
+        * @var boolean
+        */
+       protected $dif;
+
+       /**
+        * Template to be used for the email
+        *
+        * @var string
+        */
+       protected $emailTemplateFile;
+
+       /**
+        * Level of pages the task should check
+        *
+        * @var integer
+        */
+       protected $depth;
+
+       /**
+        * UID of the start page for this task
+        *
+        * @var integer
+        */
+       protected $page;
+
+       /**
+        * Email address to which an email report is sent
+        *
+        * @var string
+        */
+       protected $email;
+
+       /**
+        * Only send an email, if new broken links were found
+        *
+        * @var boolean
+        */
+       protected $emailOnBrokenLinkOnly;
+
+       /**
+        * Get the value of the protected property email
+        *
+        * @return string Email address to which an email report is sent
+        */
+       public function getEmail() {
+               return $this->email;
+       }
+
+       /**
+        * Set the value of the private property email.
+        *
+        * @param string $email Email address to which an email report is sent
+        * @return void
+        */
+       public function setEmail($email) {
+               $this->email = $email;
+       }
+
+       /**
+        * Get the value of the protected property emailOnBrokenLinkOnly
+        *
+        * @return boolean Whether to send an email, if new broken links were found
+        */
+       public function getEmailOnBrokenLinkOnly() {
+               return $this->emailOnBrokenLinkOnly;
+       }
+
+       /**
+        * Set the value of the private property emailOnBrokenLinkOnly
+        *
+        * @param boolean $emailOnBrokenLinkOnly Only send an email, if new broken links were found
+        * @return void
+        */
+       public function setEmailOnBrokenLinkOnly($emailOnBrokenLinkOnly) {
+               $this->emailOnBrokenLinkOnly = $emailOnBrokenLinkOnly;
+       }
+
+       /**
+        * Get the value of the protected property page
+        *
+        * @return integer UID of the start page for this task
+        */
+       public function getPage() {
+               return $this->page;
+       }
+
+       /**
+        * Set the value of the private property page
+        *
+        * @param integer $page UID of the start page for this task.
+        * @return void
+        */
+       public function setPage($page) {
+               $this->page = $page;
+       }
+
+       /**
+        * Get the value of the protected property depth
+        *
+        * @return integer Level of pages the task should check
+        */
+       public function getDepth() {
+               return $this->depth;
+       }
+
+       /**
+        * Set the value of the private property depth
+        *
+        * @param integer $depth Level of pages the task should check
+        * @return void
+        */
+       public function setDepth($depth) {
+               $this->depth = $depth;
+       }
+
+       /**
+        * Get the value of the protected property emailTemplateFile
+        *
+        * @return string Template to be used for the email
+        */
+       public function getEmailTemplateFile() {
+               return $this->emailTemplateFile;
+       }
+
+       /**
+        * Set the value of the private property emailTemplateFile
+        *
+        * @param string $emailTemplateFile Template to be used for the email
+        * @return void
+        */
+       public function setEmailTemplateFile($emailTemplateFile) {
+               $this->emailTemplateFile = $emailTemplateFile;
+       }
+
+       /**
+        * Get the value of the protected property configuration
+        *
+        * @return array specific TSconfig for this task
+        */
+       public function getConfiguration() {
+               return $this->configuration;
+       }
+
+       /**
+        * Set the value of the private property configuration
+        *
+        * @param array $configuration specific TSconfig for this task
+        * @return void
+        */
+       public function setConfiguration($configuration) {
+               $this->configuration = $configuration;
+       }
+
+       /**
+        * Function execute from the Scheduler
+        *
+        * @return boolean TRUE on successful execution, FALSE on error
+        */
+       public function execute() {
+               $this->setCliArguments();
+               $successfullyExecuted = TRUE;
+               if (!file_exists(($file = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->emailTemplateFile))) && !empty($this->email)) {
+                       throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidEmailTemplateFile'), '1295476972');
+               }
+               $htmlFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getURL($file);
+               $this->templateMail = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($htmlFile, '###REPORT_TEMPLATE###');
+               // The array to put the content into
+               $html = array();
+               $pageSections = '';
+               $this->dif = FALSE;
+               $pageList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->page, 1);
+               $modTS = $this->loadModTSconfig($this->page);
+               if (is_array($pageList)) {
+                       foreach ($pageList as $page) {
+                               $pageSections .= $this->checkPageLinks($page);
+                       }
+               }
+               if ($this->totalBrokenLink != $this->oldTotalBrokenLink) {
+                       $this->dif = TRUE;
+               }
+               if (($this->totalBrokenLink > 0 && (!$this->emailOnBrokenLinkOnly || $this->dif)) && !empty($this->email)) {
+                       $successfullyExecuted = $this->reportEmail($pageSections, $modTS);
+               }
+               return $successfullyExecuted;
+       }
+
+       /**
+        * Validate all links for a page based on the task configuration
+        *
+        * @param integer $page Uid of the page to parse
+        * @return string $pageSections Content of page section
+        */
+       protected function checkPageLinks($page) {
+               $page = intval($page);
+               $pageSections = '';
+               $pageIds = '';
+               $oldLinkCounts = array();
+               $modTS = $this->loadModTSconfig($page);
+               $searchFields = $this->getSearchField($modTS);
+               $linkTypes = $this->getLinkTypes($modTS);
+               /** @var tx_linkvalidator_processor $processor */
+               $processor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Linkvalidator\\LinkAnalyzer');
+               if ($page === 0) {
+                       $rootLineHidden = FALSE;
+               } else {
+                       $pageRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'pages', 'uid=' . $page);
+                       $rootLineHidden = $processor->getRootLineIsHidden($pageRow);
+               }
+               if (!$rootLineHidden || $modTS['checkhidden'] == 1) {
+                       $pageIds = $processor->extGetTreeList($page, $this->depth, 0, '1=1', $modTS['checkhidden']);
+                       if ($pageRow['hidden'] == 0 || $modTS['checkhidden'] == 1) {
+                               // tx_linkvalidator_Processor::extGetTreeList always adds trailing comma:
+                               $pageIds .= $page;
+                       }
+               }
+               if (!empty($pageIds)) {
+                       $processor->init($searchFields, $pageIds);
+                       if (!empty($this->email)) {
+                               $oldLinkCounts = $processor->getLinkCounts($page);
+                               $this->oldTotalBrokenLink += $oldLinkCounts['brokenlinkCount'];
+                       }
+                       $processor->getLinkStatistics($linkTypes, $modTS['checkhidden']);
+                       if (!empty($this->email)) {
+                               $linkCounts = $processor->getLinkCounts($page);
+                               $this->totalBrokenLink += $linkCounts['brokenlinkCount'];
+                               $pageSections = $this->buildMail($page, $pageIds, $linkCounts, $oldLinkCounts);
+                       }
+               }
+               return $pageSections;
+       }
+
+       /**
+        * Get the linkvalidator modTSconfig for a page
+        *
+        * @param integer $page Uid of the page
+        * @return array $modTS mod.linkvalidator TSconfig array
+        */
+       protected function loadModTSconfig($page) {
+               $modTS = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page, 'mod.linkvalidator');
+               $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
+               $parseObj->parse($this->configuration);
+               if (count($parseObj->errors) > 0) {
+                       $parseErrorMessage = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidTSconfig') . '<br />';
+                       foreach ($parseObj->errors as $errorInfo) {
+                               $parseErrorMessage .= $errorInfo[0] . '<br />';
+                       }
+                       throw new \Exception($parseErrorMessage, '1295476989');
+               }
+               $TSconfig = $parseObj->setup;
+               $modTS = $modTS['properties'];
+               $overrideTs = $TSconfig['mod.']['tx_linkvalidator.'];
+               if (is_array($overrideTs)) {
+                       $modTS = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($modTS, $overrideTs);
+               }
+               return $modTS;
+       }
+
+       /**
+        * Get the list of fields to parse in modTSconfig
+        *
+        * @param array $modTS mod.linkvalidator TSconfig array
+        * @return array $searchFields List of fields
+        */
+       protected function getSearchField(array $modTS) {
+               // Get the searchFields from TypoScript
+               foreach ($modTS['searchFields.'] as $table => $fieldList) {
+                       $fields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fieldList);
+                       foreach ($fields as $field) {
+                               $searchFields[$table][] = $field;
+                       }
+               }
+               return isset($searchFields) ? $searchFields : array();
+       }
+
+       /**
+        * Get the list of linkTypes to parse in modTSconfig
+        *
+        * @param array $modTS mod.linkvalidator TSconfig array
+        * @return array $linkTypes list of link types
+        */
+       protected function getLinkTypes(array $modTS) {
+               $linkTypes = array();
+               $typesTmp = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $modTS['linktypes'], 1);
+               if (is_array($typesTmp)) {
+                       if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
+                               foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
+                                       if (in_array($type, $typesTmp)) {
+                                               $linkTypes[$type] = 1;
+                                       }
+                               }
+                       }
+               }
+               return $linkTypes;
+       }
+
+       /**
+        * Build and send warning email when new broken links were found
+        *
+        * @param string $pageSections Content of page section
+        * @param array $modTS TSconfig array
+        * @return boolean TRUE if mail was sent, FALSE if or not
+        */
+       protected function reportEmail($pageSections, array $modTS) {
+               $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->templateMail, '###PAGE_SECTION###', $pageSections);
+               /** @var array $markerArray */
+               $markerArray = array();
+               /** @var array $validEmailList */
+               $validEmailList = array();
+               /** @var boolean $sendEmail */
+               $sendEmail = TRUE;
+               $markerArray['totalBrokenLink'] = $this->totalBrokenLink;
+               $markerArray['totalBrokenLink_old'] = $this->oldTotalBrokenLink;
+               // Hook
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'] as $userFunc) {
+                               $params = array(
+                                       'pObj' => &$this,
+                                       'markerArray' => $markerArray
+                               );
+                               $newMarkers = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($userFunc, $params, $this);
+                               if (is_array($newMarkers)) {
+                                       $markerArray = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($markerArray, $newMarkers);
+                               }
+                               unset($params);
+                       }
+               }
+               $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($content, $markerArray, '###|###', TRUE, TRUE);
+               /** @var \TYPO3\CMS\Core\Mail\MailMessage $mail */
+               $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
+               if (empty($modTS['mail.']['fromemail'])) {
+                       $modTS['mail.']['fromemail'] = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress();
+               }
+               if (empty($modTS['mail.']['fromname'])) {
+                       $modTS['mail.']['fromname'] = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromName();
+               }
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($modTS['mail.']['fromemail'])) {
+                       $mail->setFrom(array($modTS['mail.']['fromemail'] => $modTS['mail.']['fromname']));
+               } else {
+                       throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidFromEmail'), '1295476760');
+               }
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($modTS['mail.']['replytoemail'])) {
+                       $mail->setReplyTo(array($modTS['mail.']['replytoemail'] => $modTS['mail.']['replytoname']));
+               }
+               if (!empty($modTS['mail.']['subject'])) {
+                       $mail->setSubject($modTS['mail.']['subject']);
+               } else {
+                       throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.noSubject'), '1295476808');
+               }
+               if (!empty($this->email)) {
+                       $emailList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->email);
+                       foreach ($emailList as $emailAdd) {
+                               if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($emailAdd)) {
+                                       throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidToEmail'), '1295476821');
+                               } else {
+                                       $validEmailList[] = $emailAdd;
+                               }
+                       }
+               }
+               if (is_array($validEmailList) && !empty($validEmailList)) {
+                       $mail->setTo($this->email);
+               } else {
+                       $sendEmail = FALSE;
+               }
+               if ($sendEmail) {
+                       $mail->setBody($content, 'text/html');
+                       $mail->send();
+               }
+               return $sendEmail;
+       }
+
+       /**
+        * Build the mail content
+        *
+        * @param int $curPage Id of the current page
+        * @param string $pageList List of pages id
+        * @param array $markerArray Array of markers
+        * @param array $oldBrokenLink Marker array with the number of link found
+        * @return string Content of the mail
+        */
+       protected function buildMail($curPage, $pageList, array $markerArray, array $oldBrokenLink) {
+               $pageSectionHTML = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->templateMail, '###PAGE_SECTION###');
+               // Hook
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['buildMailMarkers'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['buildMailMarkers'] as $userFunc) {
+                               $params = array(
+                                       'curPage' => $curPage,
+                                       'pageList' => $pageList,
+                                       'markerArray' => $markerArray,
+                                       'oldBrokenLink' => $oldBrokenLink,
+                                       'pObj' => &$this
+                               );
+                               $newMarkers = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($userFunc, $params, $this);
+                               if (is_array($newMarkers)) {
+                                       $markerArray = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($markerArray, $newMarkers);
+                               }
+                               unset($params);
+                       }
+               }
+               if (is_array($markerArray)) {
+                       foreach ($markerArray as $markerKey => $markerValue) {
+                               if (empty($oldBrokenLink[$markerKey])) {
+                                       $oldBrokenLink[$markerKey] = 0;
+                               }
+                               if ($markerValue != $oldBrokenLink[$markerKey]) {
+                                       $this->dif = TRUE;
+                               }
+                               $markerArray[$markerKey . '_old'] = $oldBrokenLink[$markerKey];
+                       }
+               }
+               $markerArray['title'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $curPage));
+               $content = '';
+               if ($markerArray['brokenlinkCount'] > 0) {
+                       $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($pageSectionHTML, $markerArray, '###|###', TRUE, TRUE);
+               }
+               return $content;
+       }
+
+       /**
+        * Simulate cli call with setting the required options to the $_SERVER['argv']
+        *
+        * @return void
+        */
+       protected function setCliArguments() {
+               $_SERVER['argv'] = array(
+                       $_SERVER['argv'][0],
+                       'tx_link_scheduler_link',
+                       '0',
+                       '-ss',
+                       '--sleepTime',
+                       $this->sleepTime,
+                       '--sleepAfterFinish',
+                       $this->sleepAfterFinish,
+                       '--countInARun',
+                       $this->countInARun
+               );
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php b/typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php
new file mode 100644 (file)
index 0000000..86966a6
--- /dev/null
@@ -0,0 +1,243 @@
+<?php
+namespace TYPO3\CMS\Linkvalidator\Task;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Scheduler Additional Field plugin implementation
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class ValidatorTaskAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface {
+
+       /**
+        * Render additional information fields within the scheduler backend.
+        *
+        * @param array $taskInfo Array information of task to return
+        * @param task $task Task object
+        * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the calling object (BE module of the Scheduler)
+        * @return array Additional fields
+        * @see interfaces/tx_scheduler_AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule)
+        */
+       public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule) {
+               $additionalFields = array();
+               if (empty($taskInfo['configuration'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['configuration'] = '';
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['configuration'] = $task->getConfiguration();
+                       } else {
+                               $taskInfo['configuration'] = $task->getConfiguration();
+                       }
+               }
+               if (empty($taskInfo['depth'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['depth'] = array();
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['depth'] = $task->getDepth();
+                       } else {
+                               $taskInfo['depth'] = $task->getDepth();
+                       }
+               }
+               if (empty($taskInfo['page'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['page'] = '';
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['page'] = $task->getPage();
+                       } else {
+                               $taskInfo['page'] = $task->getPage();
+                       }
+               }
+               if (empty($taskInfo['email'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['email'] = '';
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['email'] = $task->getEmail();
+                       } else {
+                               $taskInfo['email'] = $task->getEmail();
+                       }
+               }
+               if (empty($taskInfo['emailOnBrokenLinkOnly'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['emailOnBrokenLinkOnly'] = 1;
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
+                       } else {
+                               $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
+                       }
+               }
+               if (empty($taskInfo['emailTemplateFile'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['emailTemplateFile'] = 'EXT:linkvalidator/res/mailtemplate.html';
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
+                       } else {
+                               $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
+                       }
+               }
+               $fieldID = 'task_page';
+               $fieldCode = ((('<input type="text" name="tx_scheduler[linkvalidator][page]"  id="' . $fieldID) . '" value="') . htmlspecialchars($taskInfo['page'])) . '"/>';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.page');
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
+               $additionalFields[$fieldID] = array(
+                       'code' => $fieldCode,
+                       'label' => $label
+               );
+               // input for depth
+               $fieldID = 'task_depth';
+               $fieldValueArray = array(
+                       '0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'),
+                       '1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'),
+                       '2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
+                       '3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
+                       '4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_4'),
+                       '999' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi')
+               );
+               $fieldCode = ('<select name="tx_scheduler[linkvalidator][depth]" id="' . $fieldID) . '">';
+               foreach ($fieldValueArray as $depth => $label) {
+                       $fieldCode .= (((((('   ' . '<option value="') . htmlspecialchars($depth)) . '"') . ($depth == $taskInfo['depth'] ? ' selected="selected"' : '')) . '>') . $label) . '</option>';
+               }
+               $fieldCode .= '</select>';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.depth');
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
+               $additionalFields[$fieldID] = array(
+                       'code' => $fieldCode,
+                       'label' => $label
+               );
+               $fieldID = 'task_configuration';
+               $fieldCode = ((('<textarea  name="tx_scheduler[linkvalidator][configuration]" id="' . $fieldID) . '" >') . htmlspecialchars($taskInfo['configuration'])) . '</textarea>';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.conf');
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
+               $additionalFields[$fieldID] = array(
+                       'code' => $fieldCode,
+                       'label' => $label
+               );
+               $fieldID = 'task_email';
+               $fieldCode = ((('<input type="text"  name="tx_scheduler[linkvalidator][email]" id="' . $fieldID) . '" value="') . htmlspecialchars($taskInfo['email'])) . '" />';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.email');
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
+               $additionalFields[$fieldID] = array(
+                       'code' => $fieldCode,
+                       'label' => $label
+               );
+               $fieldID = 'task_emailOnBrokenLinkOnly';
+               $fieldCode = ((('<input type="checkbox"  name="tx_scheduler[linkvalidator][emailOnBrokenLinkOnly]" id="' . $fieldID) . '" ') . (htmlspecialchars($taskInfo['emailOnBrokenLinkOnly']) ? 'checked="checked"' : '')) . ' />';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailOnBrokenLinkOnly');
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
+               $additionalFields[$fieldID] = array(
+                       'code' => $fieldCode,
+                       'label' => $label
+               );
+               $fieldID = 'task_emailTemplateFile';
+               $fieldCode = ((('<input type="text"  name="tx_scheduler[linkvalidator][emailTemplateFile]" id="' . $fieldID) . '" value="') . htmlspecialchars($taskInfo['emailTemplateFile'])) . '" />';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailTemplateFile');
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
+               $additionalFields[$fieldID] = array(
+                       'code' => $fieldCode,
+                       'label' => $label
+               );
+               return $additionalFields;
+       }
+
+       /**
+        * Mark current value as selected by returning the "selected" attribute
+        *
+        * @param array $configurationArray Array of configuration
+        * @param string $currentValue Value of selector object
+        * @return string Html fragment for a selected option or empty
+        */
+       protected function getSelectedState(array $configurationArray, $currentValue) {
+               $selected = '';
+               for ($i = 0; $i < count($configurationArray); $i++) {
+                       if (strcmp($configurationArray[$i], $currentValue) === 0) {
+                               $selected = 'selected="selected" ';
+                       }
+               }
+               return $selected;
+       }
+
+       /**
+        * 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 \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $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, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule) {
+               $isValid = TRUE;
+               //TODO add validation to validate the $submittedData['configuration'] which is normally a comma separated string
+               if (!empty($submittedData['linkvalidator']['email'])) {
+                       $emailList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $submittedData['linkvalidator']['email']);
+                       foreach ($emailList as $emailAdd) {
+                               if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($emailAdd)) {
+                                       $isValid = FALSE;
+                                       $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidEmail'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                               }
+                       }
+               }
+               if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid = ' . intval($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'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                       }
+                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
+               } else {
+                       $isValid = FALSE;
+                       $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+               }
+               if ($submittedData['linkvalidator']['depth'] < 0) {
+                       $isValid = FALSE;
+                       $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidDepth'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+               }
+               return $isValid;
+       }
+
+       /**
+        * This method is used to save any additional input into the current task object
+        * if the task class matches.
+        *
+        * @param array $submittedData Array containing the data submitted by the user
+        * @param \TYPO3\CMS\Scheduler\Task $task Reference to the current task object
+        * @return void
+        */
+       public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task $task) {
+               $task->setDepth($submittedData['linkvalidator']['depth']);
+               $task->setPage($submittedData['linkvalidator']['page']);
+               $task->setEmail($submittedData['linkvalidator']['email']);
+               if ($submittedData['linkvalidator']['emailOnBrokenLinkOnly']) {
+                       $task->setEmailOnBrokenLinkOnly(1);
+               } else {
+                       $task->setEmailOnBrokenLinkOnly(0);
+               }
+               $task->setConfiguration($submittedData['linkvalidator']['configuration']);
+               $task->setEmailTemplateFile($submittedData['linkvalidator']['emailTemplateFile']);
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/class.tx_linkvalidator_processor.php b/typo3/sysext/linkvalidator/Classes/class.tx_linkvalidator_processor.php
new file mode 100644 (file)
index 0000000..c31b103
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+$GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/modfuncreport/locallang.xml');
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_Processor and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/LinkAnalyzer.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/tasks/class.tx_linkvalidator_tasks_validator.php b/typo3/sysext/linkvalidator/Classes/tasks/class.tx_linkvalidator_tasks_validator.php
new file mode 100644 (file)
index 0000000..e8d3c78
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_tasks_Validator and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Task/ValidatorTask.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/Classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php b/typo3/sysext/linkvalidator/Classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php
new file mode 100644 (file)
index 0000000..f6cee1c
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_tasks_ValidatorAdditionalFieldProvider and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Task/ValidatorTaskAdditionalFieldProvider.php';
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/LinkAnalyzer.php b/typo3/sysext/linkvalidator/classes/LinkAnalyzer.php
deleted file mode 100644 (file)
index e051bd7..0000000
+++ /dev/null
@@ -1,408 +0,0 @@
-<?php
-/**
- * This class provides Processing plugin implementation
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @author Jochen Rieger <j.rieger@connecta.ag>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_Processor {
-
-       /**
-        * Array of tables and fields to search for broken links
-        *
-        * @var array
-        */
-       protected $searchFields = array();
-
-       /**
-        * List of comma separated page uids (rootline downwards)
-        *
-        * @var string
-        */
-       protected $pidList = '';
-
-       /**
-        * Array of tables and the number of external links they contain
-        *
-        * @var array
-        */
-       protected $linkCounts = array();
-
-       /**
-        * Array of tables and the number of broken external links they contain
-        *
-        * @var array
-        */
-       protected $brokenLinkCounts = array();
-
-       /**
-        * Array of tables and records containing broken links
-        *
-        * @var array
-        */
-       protected $recordsWithBrokenLinks = array();
-
-       /**
-        * Array for hooks for own checks
-        *
-        * @var tx_linkvalidator_linktype_Abstract[]
-        */
-       protected $hookObjectsArr = array();
-
-       /**
-        * Array with information about the current page
-        *
-        * @var array
-        */
-       protected $extPageInTreeInfo = array();
-
-       /**
-        * Reference to the current element with table:uid, e.g. pages:85
-        *
-        * @var string
-        */
-       protected $recordReference = '';
-
-       /**
-        * Linked page together with a possible anchor, e.g. 85#c105
-        *
-        * @var string
-        */
-       protected $pageWithAnchor = '';
-
-       /**
-        * Fill hookObjectsArr with different link types and possible XClasses.
-        */
-       public function __construct() {
-               // Hook to handle own checks
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $key => $classRef) {
-                               $this->hookObjectsArr[$key] = t3lib_div::getUserObj($classRef);
-                       }
-               }
-       }
-
-       /**
-        * Store all the needed configuration values in class variables
-        *
-        * @param array $searchField List of fields in which to search for links
-        * @param string $pid List of comma separated page uids in which to search for links
-        * @return      void
-        */
-       public function init(array $searchField, $pid) {
-               $this->searchFields = $searchField;
-               $this->pidList = $pid;
-               foreach ($searchField as $tableName => $table) {
-                       t3lib_div::loadTCA($tableName);
-               }
-       }
-
-       /**
-        * Find all supported broken links and store them in tx_linkvalidator_link
-        *
-        * @param array $checkOptions List of hook object to activate
-        * @param boolean $considerHidden Defines whether to look into hidden fields or not
-        * @return void
-        */
-       public function getLinkStatistics($checkOptions = array(), $considerHidden = FALSE) {
-               $results = array();
-               if (count($checkOptions) > 0) {
-                       $checkKeys = array_keys($checkOptions);
-                       $checkLinkTypeCondition = (' and link_type in (\'' . implode('\',\'', $checkKeys)) . '\')';
-                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_linkvalidator_link', ((((('(record_pid in (' . $this->pidList) . ')') . ' or ( record_uid IN (') . $this->pidList) . ') and table_name like \'pages\')) ') . $checkLinkTypeCondition);
-                       // Traverse all configured tables
-                       foreach ($this->searchFields as $table => $fields) {
-                               if ($table === 'pages') {
-                                       $where = ('deleted = 0 AND uid IN (' . $this->pidList) . ')';
-                               } else {
-                                       $where = ('deleted = 0 AND pid IN (' . $this->pidList) . ')';
-                               }
-                               if (!$considerHidden) {
-                                       $where .= t3lib_BEfunc::BEenableFields($table);
-                               }
-                               // If table is not configured, assume the extension is not installed and therefore no need to check it
-                               if (!is_array($GLOBALS['TCA'][$table])) {
-                                       continue;
-                               }
-                               // Re-init selectFields for table
-                               $selectFields = 'uid, pid';
-                               $selectFields .= ((', ' . $GLOBALS['TCA'][$table]['ctrl']['label']) . ', ') . implode(', ', $fields);
-                               // TODO: only select rows that have content in at least one of the relevant fields (via OR)
-                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $table, $where);
-                               // Get record rows of table
-                               while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
-                                       // Analyse each record
-                                       $this->analyzeRecord($results, $table, $fields, $row);
-                               }
-                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
-                       }
-                       foreach ($this->hookObjectsArr as $key => $hookObj) {
-                               if (is_array($results[$key]) && empty($checkOptions) || is_array($results[$key]) && $checkOptions[$key]) {
-                                       //  Check them
-                                       foreach ($results[$key] as $entryKey => $entryValue) {
-                                               $table = $entryValue['table'];
-                                               $record = array();
-                                               $record['headline'] = $entryValue['row'][$GLOBALS['TCA'][$table]['ctrl']['label']];
-                                               $record['record_pid'] = $entryValue['row']['pid'];
-                                               $record['record_uid'] = $entryValue['uid'];
-                                               $record['table_name'] = $table;
-                                               $record['link_title'] = $entryValue['link_title'];
-                                               $record['field'] = $entryValue['field'];
-                                               $record['last_check'] = time();
-                                               $this->recordReference = $entryValue['substr']['recordRef'];
-                                               $this->pageWithAnchor = $entryValue['pageAndAnchor'];
-                                               if (!empty($this->pageWithAnchor)) {
-                                                       // Page with anchor, e.g. 18#1580
-                                                       $url = $this->pageWithAnchor;
-                                               } else {
-                                                       $url = $entryValue['substr']['tokenValue'];
-                                               }
-                                               $this->linkCounts[$table]++;
-                                               $checkURL = $hookObj->checkLink($url, $entryValue, $this);
-                                               // Broken link found
-                                               if (!$checkURL) {
-                                                       $response = array();
-                                                       $response['valid'] = FALSE;
-                                                       $response['errorParams'] = $hookObj->getErrorParams();
-                                                       $this->brokenLinkCounts[$table]++;
-                                                       $record['link_type'] = $key;
-                                                       $record['url'] = $url;
-                                                       $record['url_response'] = serialize($response);
-                                                       $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_linkvalidator_link', $record);
-                                               } elseif (t3lib_div::_GP('showalllinks')) {
-                                                       $response = array();
-                                                       $response['valid'] = TRUE;
-                                                       $this->brokenLinkCounts[$table]++;
-                                                       $record['url'] = $url;
-                                                       $record['link_type'] = $key;
-                                                       $record['url_response'] = serialize($response);
-                                                       $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_linkvalidator_link', $record);
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Find all supported broken links for a specific record
-        *
-        * @param array $results Array of broken links
-        * @param string $table Table name of the record
-        * @param array $fields Array of fields to analyze
-        * @param array $record Record to analyse
-        * @return void
-        */
-       public function analyzeRecord(array &$results, $table, array $fields, array $record) {
-               // Put together content of all relevant fields
-               $haystack = '';
-               /** @var t3lib_parsehtml $htmlParser */
-               $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
-               $idRecord = $record['uid'];
-               // Get all references
-               foreach ($fields as $field) {
-                       $haystack .= $record[$field] . ' --- ';
-                       $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
-                       $valueField = $record[$field];
-                       // Check if a TCA configured field has soft references defined (see TYPO3 Core API document)
-                       if ($conf['softref'] && strlen($valueField)) {
-                               // Explode the list of soft references/parameters
-                               $softRefs = t3lib_BEfunc::explodeSoftRefParserList($conf['softref']);
-                               // Traverse soft references
-                               foreach ($softRefs as $spKey => $spParams) {
-                                       /** @var t3lib_softrefproc $softRefObj Create or get the soft reference object */
-                                       $softRefObj =& t3lib_BEfunc::softRefParserObj($spKey);
-                                       // If there is an object returned...
-                                       if (is_object($softRefObj)) {
-                                               // Do processing
-                                               $resultArray = $softRefObj->findRef($table, $field, $idRecord, $valueField, $spKey, $spParams);
-                                               if (!empty($resultArray['elements'])) {
-                                                       if ($spKey == 'typolink_tag') {
-                                                               $this->analyseTypoLinks($resultArray, $results, $htmlParser, $record, $field, $table);
-                                                       } else {
-                                                               $this->analyseLinks($resultArray, $results, $record, $field, $table);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Find all supported broken links for a specific link list
-        *
-        * @param array $resultArray findRef parsed records
-        * @param array $results Array of broken links
-        * @param array $record UID of the current record
-        * @param string $field The current field
-        * @param string $table The current table
-        * @return      void
-        */
-       protected function analyseLinks(array $resultArray, array &$results, array $record, $field, $table) {
-               foreach ($resultArray['elements'] as $element) {
-                       $r = $element['subst'];
-                       $type = '';
-                       $idRecord = $record['uid'];
-                       if (!empty($r)) {
-                               /** @var tx_linkvalidator_linktype_Abstract $hookObj */
-                               foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
-                                       $type = $hookObj->fetchType($r, $type, $keyArr);
-                                       // Store the type that was found
-                                       // This prevents overriding by internal validator
-                                       if (!empty($type)) {
-                                               $r['type'] = $type;
-                                       }
-                               }
-                               $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $r['tokenID']]['substr'] = $r;
-                               $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;
-                               $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $r['tokenID']]['uid'] = $idRecord;
-                       }
-               }
-       }
-
-       /**
-        * Find all supported broken links for a specific typoLink
-        *
-        * @param array $resultArray findRef parsed records
-        * @param array $results Array of broken links
-        * @param t3lib_parsehtml $htmlParser Instance of html parser
-        * @param array $record The current record
-        * @param string $field The current field
-        * @param string $table The current table
-        * @return void
-        */
-       protected function analyseTypoLinks(array $resultArray, array &$results, $htmlParser, array $record, $field, $table) {
-               $currentR = array();
-               $linkTags = $htmlParser->splitIntoBlock('link', $resultArray['content']);
-               $idRecord = $record['uid'];
-               $type = '';
-               $title = '';
-               for ($i = 1; $i < count($linkTags); $i += 2) {
-                       $referencedRecordType = '';
-                       foreach ($resultArray['elements'] as $element) {
-                               $type = '';
-                               $r = $element['subst'];
-                               if (!empty($r['tokenID'])) {
-                                       if (substr_count($linkTags[$i], $r['tokenID'])) {
-                                               // Type of referenced record
-                                               if (strpos($r['recordRef'], 'pages') !== FALSE) {
-                                                       $currentR = $r;
-                                                       // Contains number of the page
-                                                       $referencedRecordType = $r['tokenValue'];
-                                                       $wasPage = TRUE;
-                                               } elseif (strpos($r['recordRef'], 'tt_content') !== FALSE && (isset($wasPage) && $wasPage === TRUE)) {
-                                                       $referencedRecordType = ($referencedRecordType . '#c') . $r['tokenValue'];
-                                                       $wasPage = FALSE;
-                                               } else {
-                                                       $currentR = $r;
-                                               }
-                                               $title = strip_tags($linkTags[$i]);
-                                       }
-                               }
-                       }
-                       /** @var tx_linkvalidator_linktype_Abstract $hookObj */
-                       foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
-                               $type = $hookObj->fetchType($currentR, $type, $keyArr);
-                               // Store the type that was found
-                               // This prevents overriding by internal validator
-                               if (!empty($type)) {
-                                       $currentR['type'] = $type;
-                               }
-                       }
-                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['substr'] = $currentR;
-                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['row'] = $record;
-                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['table'] = $table;
-                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['field'] = $field;
-                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['uid'] = $idRecord;
-                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['link_title'] = $title;
-                       $results[$type][((((($table . ':') . $field) . ':') . $idRecord) . ':') . $currentR['tokenID']]['pageAndAnchor'] = $referencedRecordType;
-               }
-       }
-
-       /**
-        * Fill a marker array with the number of links found in a list of pages
-        *
-        * @param string $curPage Comma separated list of page uids
-        * @return array Marker array with the number of links found
-        */
-       public function getLinkCounts($curPage) {
-               $markerArray = array();
-               if (empty($this->pidList)) {
-                       $this->pidList = $curPage;
-               }
-               if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(uid) as nbBrokenLinks,link_type', 'tx_linkvalidator_link', ('record_pid in (' . $this->pidList) . ')', 'link_type')) {
-                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
-                               $markerArray[$row['link_type']] = $row['nbBrokenLinks'];
-                               $markerArray['brokenlinkCount'] += $row['nbBrokenLinks'];
-                       }
-               }
-               $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               return $markerArray;
-       }
-
-       /**
-        * Calls t3lib_tsfeBeUserAuth::extGetTreeList.
-        * Although this duplicates the function t3lib_tsfeBeUserAuth::extGetTreeList
-        * this is necessary to create the object that is used recursively by the original function.
-        *
-        * Generates a list of page uids from $id. List does not include $id itself.
-        * The only pages excluded from the list are deleted pages.
-        *
-        * @param integer $id Start page id
-        * @param integer $depth Depth to traverse down the page tree.
-        * @param integer $begin is an optional integer that determines at which
-        * @param string $permsClause Perms clause
-        * @param boolean $considerHidden Whether to consider hidden pages or not
-        * @return string Returns the list with a comma in the end (if any pages selected!)
-        */
-       public function extGetTreeList($id, $depth, $begin = 0, $permsClause, $considerHidden = FALSE) {
-               $depth = intval($depth);
-               $begin = intval($begin);
-               $id = intval($id);
-               $theList = '';
-               if ($depth > 0) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,hidden,extendToSubpages', 'pages', (('pid=' . $id) . ' AND deleted=0 AND ') . $permsClause);
-                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
-                               if ($begin <= 0 && ($row['hidden'] == 0 || $considerHidden == 1)) {
-                                       $theList .= $row['uid'] . ',';
-                                       $this->extPageInTreeInfo[] = array($row['uid'], htmlspecialchars($row['title'], $depth));
-                               }
-                               if ($depth > 1 && (!($row['hidden'] == 1 && $row['extendToSubpages'] == 1) || $considerHidden == 1)) {
-                                       $theList .= $this->extGetTreeList($row['uid'], $depth - 1, $begin - 1, $permsClause, $considerHidden);
-                               }
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               }
-               return $theList;
-       }
-
-       /**
-        * @param array $pageInfo Array with uid, title, hidden, extendToSubpages from pages table
-        * @return boolean TRUE if rootline contains a hidden page, FALSE if not
-        */
-       public function getRootLineIsHidden(array $pageInfo) {
-               $hidden = FALSE;
-               if ($pageInfo['extendToSubpages'] == 1 && $pageInfo['hidden'] == 1) {
-                       $hidden = TRUE;
-               } else {
-                       if ($pageInfo['pid'] > 0) {
-                               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,hidden,extendToSubpages', 'pages', 'uid=' . $pageInfo['pid']);
-                               while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
-                                       $hidden = $this->getRootLineIsHidden($row);
-                               }
-                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
-                       } else {
-                               $hidden = FALSE;
-                       }
-               }
-               return $hidden;
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/AbstractLinktype.php b/typo3/sysext/linkvalidator/classes/Linktype/AbstractLinktype.php
deleted file mode 100644 (file)
index 4a6a8cf..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check Base plugin implementation
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-abstract class tx_linkvalidator_linktype_Abstract implements tx_linkvalidator_linktype_Interface {
-
-       /**
-        * Contains parameters needed for the rendering of the error message
-        *
-        * @var array
-        */
-       protected $errorParams = array();
-
-       /**
-        * Base type fetching method, based on the type that softRefParserObj returns
-        *
-        * @param array $value Reference properties
-        * @param string $type Current type
-        * @param string $key Validator hook name
-        * @return string Fetched type
-        */
-       public function fetchType($value, $type, $key) {
-               if ($value['type'] == $key) {
-                       $type = $value['type'];
-               }
-               return $type;
-       }
-
-       /**
-        * Set the value of the protected property errorParams
-        *
-        * @param array $value All parameters needed for the rendering of the error message
-        * @return void
-        */
-       protected function setErrorParams($value) {
-               $this->errorParams = $value;
-       }
-
-       /**
-        * Get the value of the private property errorParams
-        *
-        * @return array All parameters needed for the rendering of the error message
-        */
-       public function getErrorParams() {
-               return $this->errorParams;
-       }
-
-       /**
-        * Construct a valid Url for browser output
-        *
-        * @param array $row Broken link record
-        * @return string Parsed broken url
-        */
-       public function getBrokenUrl($row) {
-               return $row['url'];
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/ExternalLinktype.php b/typo3/sysext/linkvalidator/classes/Linktype/ExternalLinktype.php
deleted file mode 100644 (file)
index 4b54cdc..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2009 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check External Links plugin implementation
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @author Philipp Gampe <typo3.dev@philippgampe.info>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_linktype_External extends tx_linkvalidator_linktype_Abstract {
-
-       /**
-        * Cached list of the URLs, which were already checked for the current processing
-        *
-        * @var array $urlReports
-        */
-       protected $urlReports = array();
-
-       /**
-        * Cached list of all error parameters of the URLs, which were already checked for the current processing
-        *
-        * @var array $urlErrorParams
-        */
-       protected $urlErrorParams = array();
-
-       /**
-        * List of headers to be used for matching an URL for the current processing
-        *
-        * @var array $additionalHeaders
-        */
-       protected $additionalHeaders = array();
-
-       /**
-        * Checks a given URL for validity
-        *
-        * @param string $url The URL to check
-        * @param array $softRefEntry The soft reference entry which builds the context of that URL
-        * @param tx_linkvalidator_Processor $reference Parent instance of tx_linkvalidator_Processor
-        * @return boolean TRUE on success or FALSE on error
-        */
-       public function checkLink($url, $softRefEntry, $reference) {
-               $errorParams = array();
-               $isValidUrl = TRUE;
-               if (isset($this->urlReports[$url])) {
-                       if (!$this->urlReports[$url]) {
-                               if (is_array($this->urlErrorParams[$url])) {
-                                       $this->setErrorParams($this->urlErrorParams[$url]);
-                               }
-                       }
-                       return $this->urlReports[$url];
-               }
-               $config = array(
-                       'follow_redirects' => TRUE,
-                       'strict_redirects' => TRUE
-               );
-               /** @var t3lib_http_Request|HTTP_Request2 $request */
-               $request = t3lib_div::makeInstance('t3lib_http_Request', $url, 'HEAD', $config);
-               // Observe cookies
-               $request->setCookieJar(TRUE);
-               try {
-                       /** @var HTTP_Request2_Response $response */
-                       $response = $request->send();
-                       // HEAD was not allowed, now trying GET
-                       if (isset($response) && $response->getStatus() === 405) {
-                               $request->setMethod('GET');
-                               $request->setHeader('Range', 'bytes = 0 - 4048');
-                               /** @var HTTP_Request2_Response $response */
-                               $response = $request->send();
-                       }
-               } catch (Exception $e) {
-                       $isValidUrl = FALSE;
-                       // A redirect loop occurred
-                       if ($e->getCode() === 40) {
-                               // Parse the exception for more information
-                               $trace = $e->getTrace();
-                               $traceUrl = $trace[0]['args'][0]->getUrl()->getUrl();
-                               $traceCode = $trace[0]['args'][1]->getStatus();
-                               $errorParams['errorType'] = 'loop';
-                               $errorParams['location'] = $traceUrl;
-                               $errorParams['errorCode'] = $traceCode;
-                       } else {
-                               $errorParams['errorType'] = 'exception';
-                       }
-                       $errorParams['message'] = $e->getMessage();
-               }
-               if (isset($response) && $response->getStatus() >= 300) {
-                       $isValidUrl = FALSE;
-                       $errorParams['errorType'] = $response->getStatus();
-                       $errorParams['message'] = $response->getReasonPhrase();
-               }
-               if (!$isValidUrl) {
-                       $this->setErrorParams($errorParams);
-               }
-               $this->urlReports[$url] = $isValidUrl;
-               $this->urlErrorParams[$url] = $errorParams;
-               return $isValidUrl;
-       }
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing
-        *
-        * @param array $errorParams All parameters needed for the rendering of the error message
-        * @return string Validation error message
-        */
-       public function getErrorMessage($errorParams) {
-               $errorType = $errorParams['errorType'];
-               switch ($errorType) {
-               case 300:
-                       $response = sprintf($GLOBALS['LANG']->getLL('list.report.externalerror'), $errorType);
-                       break;
-               case 403:
-                       $response = $GLOBALS['LANG']->getLL('list.report.pageforbidden403');
-                       break;
-               case 404:
-                       $response = $GLOBALS['LANG']->getLL('list.report.pagenotfound404');
-                       break;
-               case 500:
-                       $response = $GLOBALS['LANG']->getLL('list.report.internalerror500');
-                       break;
-               case 'loop':
-                       $response = sprintf($GLOBALS['LANG']->getLL('list.report.redirectloop'), $errorParams['errorCode'], $errorParams['location']);
-                       break;
-               case 'exception':
-                       $response = sprintf($GLOBALS['LANG']->getLL('list.report.httpexception'), $errorParams['message']);
-                       break;
-               default:
-                       $response = sprintf($GLOBALS['LANG']->getLL('list.report.otherhttpcode'), $errorType, $errorParams['message']);
-               }
-               return $response;
-       }
-
-       /**
-        * Get the external type from the softRefParserObj result
-        *
-        * @param array $value Reference properties
-        * @param string $type Current type
-        * @param string $key Validator hook name
-        * @return string Fetched type
-        */
-       public function fetchType($value, $type, $key) {
-               preg_match_all('/((?:http|https))(?::\\/\\/)(?:[^\\s<>]+)/i', $value['tokenValue'], $urls, PREG_PATTERN_ORDER);
-               if (!empty($urls[0][0])) {
-                       $type = 'external';
-               }
-               return $type;
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/FileLinktype.php b/typo3/sysext/linkvalidator/classes/Linktype/FileLinktype.php
deleted file mode 100644 (file)
index 5d93cb5..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check File Links plugin implementation
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_linktype_File extends tx_linkvalidator_linktype_Abstract {
-
-       /**
-        * Checks a given URL + /path/filename.ext for validity
-        *
-        * @param string $url Url to check
-        * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param tx_linkvalidator_Processor $reference Parent instance of tx_linkvalidator_Processor
-        * @return boolean TRUE on success or FALSE on error
-        */
-       public function checkLink($url, $softRefEntry, $reference) {
-               if (!@file_exists((PATH_site . rawurldecode($url)))) {
-                       return FALSE;
-               }
-               return TRUE;
-       }
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing
-        *
-        * @param array $errorParams All parameters needed for the rendering of the error message
-        * @return string Validation error message
-        */
-       public function getErrorMessage($errorParams) {
-               $response = $GLOBALS['LANG']->getLL('list.report.filenotexisting');
-               return $response;
-       }
-
-       /**
-        * Construct a valid Url for browser output
-        *
-        * @param array $row Broken link record
-        * @return string Parsed broken url
-        */
-       public function getBrokenUrl($row) {
-               $brokenUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['url'];
-               return $brokenUrl;
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/InternalLinktype.php b/typo3/sysext/linkvalidator/classes/Linktype/InternalLinktype.php
deleted file mode 100644 (file)
index eff6f3a..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check Internal Links plugin implementation
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_linktype_Internal extends tx_linkvalidator_linktype_Abstract {
-
-       const DELETED = 'deleted';
-       const HIDDEN = 'hidden';
-       const MOVED = 'moved';
-       const NOTEXISTING = 'notExisting';
-       /**
-        * All parameters needed for rendering the error message
-        *
-        * @var array
-        */
-       protected $errorParams = array();
-
-       /**
-        * Result of the check, if the current page uid is valid or not
-        *
-        * @var boolean
-        */
-       protected $responsePage = TRUE;
-
-       /**
-        * Result of the check, if the current content uid is valid or not
-        *
-        * @var boolean
-        */
-       protected $responseContent = TRUE;
-
-       /**
-        * Checks a given URL + /path/filename.ext for validity
-        *
-        * @param string $url Url to check as page-id or page-id#anchor (if anchor is present)
-        * @param array $softRefEntry: The soft reference entry which builds the context of that url
-        * @param tx_linkvalidator_Processor $reference Parent instance of tx_linkvalidator_Processor
-        * @return boolean TRUE on success or FALSE on error
-        */
-       public function checkLink($url, $softRefEntry, $reference) {
-               $anchor = '';
-               $this->responseContent = TRUE;
-               // Might already contain values - empty it
-               unset($this->errorParams);
-               // defines the linked page and anchor (if any).
-               if (strpos($url, '#c') !== FALSE) {
-                       $parts = explode('#c', $url);
-                       $page = $parts[0];
-                       $anchor = $parts[1];
-               } else {
-                       $page = $url;
-               }
-               // Check if the linked page is OK
-               $this->responsePage = $this->checkPage($page, $softRefEntry, $reference);
-               // Check if the linked content element is OK
-               if ($anchor) {
-                       // Check if the content element is OK
-                       $this->responseContent = $this->checkContent($page, $anchor, $softRefEntry, $reference);
-               }
-               if (is_array($this->errorParams['page']) && !$this->responsePage || is_array($this->errorParams['content']) && !$this->responseContent) {
-                       $this->setErrorParams($this->errorParams);
-               }
-               if ($this->responsePage === TRUE && $this->responseContent === TRUE) {
-                       $response = TRUE;
-               } else {
-                       $response = FALSE;
-               }
-               return $response;
-       }
-
-       /**
-        * Checks a given page uid for validity
-        *
-        * @param string $page Page uid to check
-        * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param tx_linkvalidator_Processor $reference Parent instance of tx_linkvalidator_Processor
-        * @return boolean TRUE on success or FALSE on error
-        */
-       protected function checkPage($page, $softRefEntry, $reference) {
-               $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, title, deleted, hidden, starttime, endtime', 'pages', 'uid = ' . intval($page));
-               $this->responsePage = TRUE;
-               if ($row) {
-                       if ($row['deleted'] == '1') {
-                               $this->errorParams['errorType']['page'] = self::DELETED;
-                               $this->errorParams['page']['title'] = $row['title'];
-                               $this->errorParams['page']['uid'] = $row['uid'];
-                               $this->responsePage = FALSE;
-                       } elseif (($row['hidden'] == '1' || $GLOBALS['EXEC_TIME'] < intval($row['starttime'])) || $row['endtime'] && intval($row['endtime']) < $GLOBALS['EXEC_TIME']) {
-                               $this->errorParams['errorType']['page'] = self::HIDDEN;
-                               $this->errorParams['page']['title'] = $row['title'];
-                               $this->errorParams['page']['uid'] = $row['uid'];
-                               $this->responsePage = FALSE;
-                       }
-               } else {
-                       $this->errorParams['errorType']['page'] = self::NOTEXISTING;
-                       $this->errorParams['page']['uid'] = intval($page);
-                       $this->responsePage = FALSE;
-               }
-               return $this->responsePage;
-       }
-
-       /**
-        * Checks a given content uid for validity
-        *
-        * @param string $page Uid of the page to which the link is pointing
-        * @param string $anchor Uid of the content element to check
-        * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param tx_linkvalidator_Processor $reference Parent instance of tx_linkvalidator_Processor
-        * @return boolean TRUE on success or FALSE on error
-        */
-       protected function checkContent($page, $anchor, $softRefEntry, $reference) {
-               // Get page ID on which the content element in fact is located
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, pid, header, deleted, hidden, starttime, endtime', 'tt_content', 'uid = ' . intval($anchor));
-               $this->responseContent = TRUE;
-               // this content element exists
-               if ($res) {
-                       // page ID on which this CE is in fact located.
-                       $correctPageID = $res['pid'];
-                       // Check if the element is on the linked page
-                       // (The element might have been moved to another page)
-                       if (!($correctPageID === $page)) {
-                               $this->errorParams['errorType']['content'] = self::MOVED;
-                               $this->errorParams['content']['uid'] = intval($anchor);
-                               $this->errorParams['content']['wrongPage'] = intval($page);
-                               $this->errorParams['content']['rightPage'] = intval($correctPageID);
-                               $this->responseContent = FALSE;
-                       } else {
-                               // The element is located on the page to which the link is pointing
-                               if ($res['deleted'] == '1') {
-                                       $this->errorParams['errorType']['content'] = self::DELETED;
-                                       $this->errorParams['content']['title'] = $res['header'];
-                                       $this->errorParams['content']['uid'] = $res['uid'];
-                                       $this->responseContent = FALSE;
-                               } elseif (($res['hidden'] == '1' || $GLOBALS['EXEC_TIME'] < intval($res['starttime'])) || $res['endtime'] && intval($res['endtime']) < $GLOBALS['EXEC_TIME']) {
-                                       $this->errorParams['errorType']['content'] = self::HIDDEN;
-                                       $this->errorParams['content']['title'] = $res['header'];
-                                       $this->errorParams['content']['uid'] = $res['uid'];
-                                       $this->responseContent = FALSE;
-                               }
-                       }
-               } else {
-                       // The content element does not exist
-                       $this->errorParams['errorType']['content'] = self::NOTEXISTING;
-                       $this->errorParams['content']['uid'] = intval($anchor);
-                       $this->responseContent = FALSE;
-               }
-               return $this->responseContent;
-       }
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing
-        *
-        * @param array $errorParams All parameters needed for the rendering of the error message
-        * @return string Validation error message
-        */
-       public function getErrorMessage($errorParams) {
-               $errorType = $errorParams['errorType'];
-               if (is_array($errorParams['page'])) {
-                       switch ($errorType['page']) {
-                       case self::DELETED:
-                               $errorPage = $GLOBALS['LANG']->getLL('list.report.pagedeleted');
-                               $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
-                               $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
-                               break;
-                       case self::HIDDEN:
-                               $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotvisible');
-                               $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
-                               $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
-                               break;
-                       default:
-                               $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotexisting');
-                               $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
-                       }
-               }
-               if (is_array($errorParams['content'])) {
-                       switch ($errorType['content']) {
-                       case self::DELETED:
-                               $errorContent = $GLOBALS['LANG']->getLL('list.report.contentdeleted');
-                               $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                               $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                               break;
-                       case self::HIDDEN:
-                               $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotvisible');
-                               $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                               $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                               break;
-                       case self::MOVED:
-                               $errorContent = $GLOBALS['LANG']->getLL('list.report.contentmoved');
-                               $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                               $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                               $errorContent = str_replace('###wrongpage###', $errorParams['content']['wrongPage'], $errorContent);
-                               $errorContent = str_replace('###rightpage###', $errorParams['content']['rightPage'], $errorContent);
-                               break;
-                       default:
-                               $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotexisting');
-                               $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                       }
-               }
-               if (isset($errorPage) && isset($errorContent)) {
-                       $response = ($errorPage . '<br />') . $errorContent;
-               } elseif (isset($errorPage)) {
-                       $response = $errorPage;
-               } elseif (isset($errorContent)) {
-                       $response = $errorContent;
-               } else {
-                       // This should not happen
-                       $response = $GLOBALS['LANG']->getLL('list.report.noinformation');
-               }
-               return $response;
-       }
-
-       /**
-        * Construct a valid Url for browser output
-        *
-        * @param array $row Broken link record
-        * @return string Parsed broken url
-        */
-       public function getBrokenUrl($row) {
-               $domain = rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '/');
-               $rootLine = t3lib_BEfunc::BEgetRootLine($row['record_pid']);
-               // checks alternate domains
-               if (count($rootLine) > 0) {
-                       $protocol = t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
-                       $domainRecord = t3lib_BEfunc::firstDomainRecord($rootLine);
-                       if (!empty($domainRecord)) {
-                               $domain = $protocol . $domainRecord;
-                       }
-               }
-               return ($domain . '/index.php?id=') . $row['url'];
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/LinkHandler.php b/typo3/sysext/linkvalidator/classes/Linktype/LinkHandler.php
deleted file mode 100644 (file)
index 8230dd7..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check Link Handler plugin implementation
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_linktype_LinkHandler extends tx_linkvalidator_linktype_Abstract {
-
-       const DELETED = 'deleted';
-       /**
-        * TSconfig of the module tx_linkhandler
-        *
-        * @var array
-        */
-       protected $tsconfig;
-
-       /**
-        * Get TSconfig when loading the class
-        *
-        * @todo Define visibility
-        */
-       public function __construct() {
-               $this->tsconfig = t3lib_BEfunc::getModTSconfig(1, 'mod.tx_linkhandler');
-       }
-
-       /**
-        * 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 tx_linkvalidator_Processor $reference Parent instance of tx_linkvalidator_Processor
-        * @return boolean TRUE on success or FALSE on error
-        */
-       public function checkLink($url, $softRefEntry, $reference) {
-               $response = TRUE;
-               $errorParams = array();
-               $parts = explode(':', $url);
-               if (count($parts) == 3) {
-                       $tableName = htmlspecialchars($parts[1]);
-                       $rowid = intval($parts[2]);
-                       $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', $tableName, 'uid = ' . intval($rowid));
-                       if ($row) {
-                               if ($row['deleted'] == '1') {
-                                       $errorParams['errorType'] = self::DELETED;
-                                       $errorParams['tablename'] = $tableName;
-                                       $errorParams['uid'] = $rowid;
-                                       $response = FALSE;
-                               }
-                       } else {
-                               $errorParams['tablename'] = $tableName;
-                               $errorParams['uid'] = $rowid;
-                               $response = FALSE;
-                       }
-               }
-               if (!$response) {
-                       $this->setErrorParams();
-               }
-               return $response;
-       }
-
-       /**
-        * Type fetching method, based on the type that softRefParserObj returns
-        *
-        * @param array $value Reference properties
-        * @param string $type Current type
-        * @param string $key Validator hook name
-        * @return string fetched type
-        */
-       public function fetchType($value, $type, $key) {
-               if ($type == 'string' && strtolower(substr($value['tokenValue'], 0, 7)) == 'record:') {
-                       $type = 'linkhandler';
-               }
-               return $type;
-       }
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing
-        *
-        * @param array $errorParams All parameters needed for the rendering of the error message
-        * @return string Validation error message
-        */
-       public function getErrorMessage($errorParams) {
-               $errorType = $errorParams['errorType'];
-               $tableName = $errorParams['tablename'];
-               $title = $GLOBALS['LANG']->getLL('list.report.rowdeleted.default.title');
-               if ($this->tsconfig['properties'][$tableName . '.']) {
-                       $title = $this->tsconfig['properties'][$tableName . '.']['label'];
-               }
-               switch ($errorType) {
-               case self::DELETED:
-                       $response = $GLOBALS['LANG']->getLL('list.report.rowdeleted');
-                       $response = str_replace('###title###', $title, $response);
-                       $response = str_replace('###uid###', $errorParams['uid'], $response);
-                       break;
-               default:
-                       $response = $GLOBALS['LANG']->getLL('list.report.rownotexisting');
-                       $response = str_replace('###uid###', $errorParams['uid'], $response);
-                       break;
-               }
-               return $response;
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/LinktypeInterface.php b/typo3/sysext/linkvalidator/classes/Linktype/LinktypeInterface.php
deleted file mode 100644 (file)
index 66666fe..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides interface implementation.
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-interface tx_linkvalidator_linktype_Interface
-{
-       /**
-        * Checks a given link for validity
-        *
-        * @param string $url Url to check
-        * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param tx_linkvalidator_Processor $reference Parent instance of tx_linkvalidator_Processor
-        * @return string Validation error message or success code
-        */
-       public function checkLink($url, $softRefEntry, $reference);
-
-       /**
-        * Base type fetching method, based on the type that softRefParserObj returns.
-        *
-        * @param array $value Reference properties
-        * @param string $type Current type
-        * @param string $key Validator hook name
-        * @return string Fetched type
-        */
-       public function fetchType($value, $type, $key);
-
-       /**
-        * Get the value of the private property errorParams.
-        *
-        * @return array All parameters needed for the rendering of the error message
-        */
-       public function getErrorParams();
-
-       /**
-        * Construct a valid Url for browser output
-        *
-        * @param array $row Broken link record
-        * @return string Parsed broken url
-        */
-       public function getBrokenUrl($row);
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing
-        *
-        * @param array $errorParams All parameters needed for the rendering of the error message
-        * @return string Validation error message
-        */
-       public function getErrorMessage($errorParams);
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_abstract.php b/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_abstract.php
deleted file mode 100644 (file)
index 6fb6640..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_linktype_Abstract and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/Linktype/AbstractLinktype.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/Linktype/AbstractLinktype.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_external.php b/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_external.php
deleted file mode 100644 (file)
index 48db8c3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_linktype_External and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/Linktype/ExternalLinktype.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_file.php b/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_file.php
deleted file mode 100644 (file)
index 53b10d9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_linktype_File and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/Linktype/FileLinktype.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_interface.php b/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_interface.php
deleted file mode 100644 (file)
index 3d098b8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_linktype_Interface and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/Linktype/LinktypeInterface.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_internal.php b/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_internal.php
deleted file mode 100644 (file)
index 5ad3cea..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_linktype_Internal and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/Linktype/InternalLinktype.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/Linktype/InternalLinktype.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_linkhandler.php b/typo3/sysext/linkvalidator/classes/Linktype/class.tx_linkvalidator_linktype_linkhandler.php
deleted file mode 100644 (file)
index a1940d6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_linktype_LinkHandler and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/Linktype/LinkHandler.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Report/LinkValidatorReport.php b/typo3/sysext/linkvalidator/classes/Report/LinkValidatorReport.php
deleted file mode 100644 (file)
index b49dfd6..0000000
+++ /dev/null
@@ -1,665 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Module 'Linkvalidator' for the 'linkvalidator' extension
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @author Jochen Rieger <j.rieger@connecta.ag>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
-
-       /**
-        * @var template
-        */
-       public $doc;
-
-       /**
-        * @var string
-        */
-       protected $relativePath;
-
-       /**
-        * Information about the current page record
-        *
-        * @var array
-        */
-       protected $pageRecord = array();
-
-       /**
-        * Information, if the module is accessible for the current user or not
-        *
-        * @var boolean
-        */
-       protected $isAccessibleForCurrentUser = FALSE;
-
-       /**
-        * Depth for the recursive traversal of pages for the link validation
-        *
-        * @var integer
-        */
-       protected $searchLevel;
-
-       /**
-        * Link validation class
-        *
-        * @var tx_linkvalidator_Processor
-        */
-       protected $processor;
-
-       /**
-        * TSconfig of the current module
-        *
-        * @var array
-        */
-       protected $modTS = array();
-
-       /**
-        * List of available link types to check defined in the TSconfig
-        *
-        * @var array
-        */
-       protected $availableOptions = array();
-
-       /**
-        * List of link types currently chosen in the statistics table
-        * Used to show broken links of these types only
-        *
-        * @var array
-        */
-       protected $checkOpt = array();
-
-       /**
-        * Html for the button "Check Links"
-        *
-        * @var string
-        */
-       protected $updateListHtml;
-
-       /**
-        * Html for the button "Refresh Display"
-        *
-        * @var string
-        */
-       protected $refreshListHtml;
-
-       /**
-        * Html for the statistics table with the checkboxes of the link types
-        * and the numbers of broken links for report tab
-        *
-        * @var string
-        */
-       protected $checkOptHtml;
-
-       /**
-        * Html for the statistics table with the checkboxes of the link types
-        * and the numbers of broken links for check links tab
-        *
-        * @var string
-        */
-       protected $checkOptHtmlCheck;
-
-       /**
-        * Complete content (html) to be displayed
-        *
-        * @var string
-        */
-       protected $content;
-
-       /**
-        * @var t3lib_pageRenderer $pageRenderer
-        */
-       protected $pageRenderer;
-
-       /**
-        * @var string $resPath Path to "linkvalidator/res/" to be used in pageRenderer
-        */
-       protected $resPath = '';
-
-       /**
-        * @var tx_linkvalidator_linktype_Interface[] $hookObjectsArr
-        */
-       protected $hookObjectsArr = array();
-
-       /**
-        * @var string $checkAllHtml
-        */
-       protected $checkAllHtml = '';
-
-       /**
-        * Main method of modfuncreport
-        *
-        * @return string Module content
-        */
-       public function main() {
-               $GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/modfuncreport/locallang.xml');
-               $this->searchLevel = t3lib_div::_GP('search_levels');
-               if (isset($this->pObj->id)) {
-                       $this->modTS = t3lib_BEfunc::getModTSconfig($this->pObj->id, 'mod.linkvalidator');
-                       $this->modTS = $this->modTS['properties'];
-               }
-               $update = t3lib_div::_GP('updateLinkList');
-               $prefix = '';
-               if (!empty($update)) {
-                       $prefix = 'check';
-               }
-               $set = t3lib_div::_GP($prefix . 'SET');
-               $this->pObj->handleExternalFunctionValue();
-               if (isset($this->searchLevel)) {
-                       $this->pObj->MOD_SETTINGS['searchlevel'] = $this->searchLevel;
-               } else {
-                       $this->searchLevel = $this->pObj->MOD_SETTINGS['searchlevel'];
-               }
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) {
-                               // Compile list of all available types. Used for checking with button "Check Links".
-                               if (strpos($this->modTS['linktypes'], $linkType) !== FALSE) {
-                                       $this->availableOptions[$linkType] = 1;
-                               }
-                               // Compile list of types currently selected by the checkboxes
-                               if ($this->pObj->MOD_SETTINGS[$linkType] && empty($set) || $set[$linkType]) {
-                                       $this->checkOpt[$linkType] = 1;
-                                       $this->pObj->MOD_SETTINGS[$linkType] = 1;
-                               } else {
-                                       $this->pObj->MOD_SETTINGS[$linkType] = 0;
-                                       unset($this->checkOpt[$linkType]);
-                               }
-                       }
-               }
-               $GLOBALS['BE_USER']->pushModuleData('web_info', $this->pObj->MOD_SETTINGS);
-               $this->initialize();
-               // Setting up the context sensitive menu
-               $this->resPath = ($this->doc->backPath . t3lib_extMgm::extRelPath('linkvalidator')) . 'res/';
-               $this->pageRenderer = $this->doc->getPageRenderer();
-               // Localization
-               $this->pageRenderer->addInlineLanguageLabelFile(t3lib_extMgm::extPath('linkvalidator', 'modfuncreport/locallang.xml'));
-               $this->pageRenderer->addJsInlineCode('linkvalidator', 'function toggleActionButton(prefix) {
-                       var buttonDisable = true;
-                       Ext.select(\'.\' + prefix ,false).each(function(checkBox,i){
-                       checkDom = checkBox.dom;
-                       if (checkDom.checked){
-                               buttonDisable = false;
-                       }
-
-                       });
-                       if (prefix == \'check\'){
-                               checkSub = document.getElementById(\'updateLinkList\');
-                       } else {
-                               checkSub = document.getElementById(\'refreshLinkList\');
-                       }
-                       checkSub.disabled = buttonDisable;
-               }');
-               // Add JS
-               $this->pageRenderer->addJsFile($this->doc->backPath . '../t3lib/js/extjs/ux/Ext.ux.FitToParent.js');
-               $this->pageRenderer->addJsFile($this->doc->backPath . '../t3lib/js/extjs/ux/flashmessages.js');
-               $this->pageRenderer->addJsFile($this->doc->backPath . 'js/extjs/iframepanel.js');
-               if ($this->modTS['showCheckLinkTab'] == 1) {
-                       $this->updateListHtml = ('<input type="submit" name="updateLinkList" id="updateLinkList" value="' . $GLOBALS['LANG']->getLL('label_update')) . '"/>';
-               }
-               $this->refreshListHtml = ('<input type="submit" name="refreshLinkList" id="refreshLinkList"  value="' . $GLOBALS['LANG']->getLL('label_refresh')) . '"/>';
-               $this->processor = t3lib_div::makeInstance('tx_linkvalidator_Processor');
-               $this->updateBrokenLinks();
-               $brokenLinkOverView = $this->processor->getLinkCounts($this->pObj->id);
-               $this->checkOptHtml = $this->getCheckOptions($brokenLinkOverView);
-               $this->checkOptHtmlCheck = $this->getCheckOptions($brokenLinkOverView, 'check');
-               $this->createTabs();
-               return '<div id="linkvalidator-modfuncreport"></div>';
-       }
-
-       /**
-        * Create TabPanel to split the report and the checkLink functions
-        *
-        * @return void
-        */
-       protected function createTabs() {
-               $panelCheck = '';
-               if ($this->modTS['showCheckLinkTab'] == 1) {
-                       $panelCheck = ('{
-                               title: TYPO3.l10n.localize(\'CheckLink\'),
-                               html: ' . json_encode($this->flush())) . ',
-                       }';
-               }
-               $this->render();
-               $js = ((('var panel = new Ext.TabPanel( {
-                       renderTo: \'linkvalidator-modfuncreport\',
-                       id: \'linkvalidator-main\',
-                       plain: true,
-                       activeTab: 0,
-                       bodyStyle: \'padding:10px;\',
-                       items : [
-                       {
-                               autoHeight: true,
-                               title: TYPO3.l10n.localize(\'Report\'),
-                               html: ' . json_encode($this->flush(TRUE))) . '
-                       },
-                       ') . $panelCheck) . '
-                       ]
-
-               });
-               ';
-               $this->pageRenderer->addExtOnReadyCode($js);
-       }
-
-       /**
-        * Initializes the menu array internally
-        *
-        * @return array Module menu
-        */
-       public function modMenu() {
-               $modMenu = array(
-                       'checkAllLink' => 0
-               );
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) {
-                               $modMenu[$linkType] = 1;
-                       }
-               }
-               return $modMenu;
-       }
-
-       /**
-        * Initializes the Module
-        *
-        * @return void
-        */
-       protected function initialize() {
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $classRef) {
-                               $this->hookObjectsArr[$linkType] = t3lib_div::getUserObj($classRef);
-                       }
-               }
-               $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->doc->setModuleTemplate(t3lib_extMgm::extPath('linkvalidator') . 'modfuncreport/mod_template.html');
-               $this->relativePath = t3lib_extMgm::extRelPath('linkvalidator');
-               $this->pageRecord = t3lib_BEfunc::readPageAccess($this->pObj->id, $GLOBALS['BE_USER']->getPagePermsClause(1));
-               $this->isAccessibleForCurrentUser = FALSE;
-               if ($this->pObj->id && is_array($this->pageRecord) || !$this->pObj->id && $this->isCurrentUserAdmin()) {
-                       $this->isAccessibleForCurrentUser = TRUE;
-               }
-               $this->loadHeaderData();
-               // Don't access in workspace
-               if ($GLOBALS['BE_USER']->workspace !== 0) {
-                       $this->isAccessibleForCurrentUser = FALSE;
-               }
-       }
-
-       /**
-        * Updates the table of stored broken links
-        *
-        * @return void
-        */
-       protected function updateBrokenLinks() {
-               $searchFields = array();
-               // Get the searchFields from TypoScript
-               foreach ($this->modTS['searchFields.'] as $table => $fieldList) {
-                       $fields = t3lib_div::trimExplode(',', $fieldList);
-                       foreach ($fields as $field) {
-                               if ((!$searchFields || !is_array($searchFields[$table])) || array_search($field, $searchFields[$table]) == FALSE) {
-                                       $searchFields[$table][] = $field;
-                               }
-                       }
-               }
-               $rootLineHidden = $this->processor->getRootLineIsHidden($this->pObj->pageinfo);
-               if (!$rootLineHidden || $this->modTS['checkhidden'] == 1) {
-                       // Get children pages
-                       $pageList = $this->processor->extGetTreeList($this->pObj->id, $this->searchLevel, 0, $GLOBALS['BE_USER']->getPagePermsClause(1), $this->modTS['checkhidden']);
-                       if ($this->pObj->pageinfo['hidden'] == 0 || $this->modTS['checkhidden'] == 1) {
-                               $pageList .= $this->pObj->id;
-                       }
-                       $this->processor->init($searchFields, $pageList);
-                       // Check if button press
-                       $update = t3lib_div::_GP('updateLinkList');
-                       if (!empty($update)) {
-                               $this->processor->getLinkStatistics($this->checkOpt, $this->modTS['checkhidden']);
-                       }
-               }
-       }
-
-       /**
-        * Renders the content of the module
-        *
-        * @return void
-        */
-       protected function render() {
-               if ($this->isAccessibleForCurrentUser) {
-                       $this->content = $this->renderBrokenLinksTable();
-               } else {
-                       // If no access or if ID == zero
-                       /** @var t3lib_FlashMessage $message */
-                       $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('no.access'), $GLOBALS['LANG']->getLL('no.access.title'), t3lib_FlashMessage::ERROR);
-                       $this->content .= $message->render();
-               }
-       }
-
-       /**
-        * Flushes the rendered content to the browser
-        *
-        * @param boolean $form
-        * @return string $content
-        */
-       protected function flush($form = FALSE) {
-               $content = $this->doc->moduleBody($this->pageRecord, $this->getDocHeaderButtons(), $form ? $this->getTemplateMarkers() : $this->getTemplateMarkersCheck());
-               return $content;
-       }
-
-       /**
-        * Builds the selector for the level of pages to search
-        *
-        * @return string Html code of that selector
-        */
-       protected function getLevelSelector() {
-               // Build level selector
-               $opt = array();
-               $parts = array(
-                       0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'),
-                       1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'),
-                       2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
-                       3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
-                       999 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi')
-               );
-               foreach ($parts as $kv => $label) {
-                       $opt[] = ((((('<option value="' . $kv) . '"') . ($kv == intval($this->searchLevel) ? ' selected="selected"' : '')) . '>') . htmlspecialchars($label)) . '</option>';
-               }
-               $lMenu = ('<select name="search_levels">' . implode('', $opt)) . '</select>';
-               return $lMenu;
-       }
-
-       /**
-        * Displays the table of broken links or a note if there were no broken links
-        *
-        * @return string Content of the table or of the note
-        */
-       protected function renderBrokenLinksTable() {
-               $items = ($brokenLinksMarker = array());
-               $brokenLinkItems = '';
-               $brokenLinksTemplate = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, '###NOBROKENLINKS_CONTENT###');
-               $keyOpt = array();
-               if (is_array($this->checkOpt)) {
-                       $keyOpt = array_keys($this->checkOpt);
-               }
-               $rootLineHidden = $this->processor->getRootLineIsHidden($this->pObj->pageinfo);
-               if (!$rootLineHidden || $this->modTS['checkhidden'] == 1) {
-                       $pageList = $this->processor->extGetTreeList($this->pObj->id, $this->searchLevel, 0, $GLOBALS['BE_USER']->getPagePermsClause(1), $this->modTS['checkhidden']);
-                       // Always add the current page, because we are just displaying the results
-                       $pageList .= $this->pObj->id;
-                       if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_linkvalidator_link', ((('record_pid in (' . $pageList) . ') and link_type in (\'') . implode('\',\'', $keyOpt)) . '\')', '', 'record_uid ASC, uid ASC')) {
-                               // Display table with broken links
-                               if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
-                                       $brokenLinksTemplate = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_CONTENT###');
-                                       $brokenLinksItemTemplate = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_ITEM###');
-                                       // Table header
-                                       $brokenLinksMarker = $this->startTable();
-                                       // Table rows containing the broken links
-                                       while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
-                                               $items[] = $this->renderTableRow($row['table_name'], $row, $brokenLinksItemTemplate);
-                                       }
-                                       $brokenLinkItems = implode(chr(10), $items);
-                               } else {
-                                       $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
-                               }
-                       }
-               } else {
-                       $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
-               }
-               $brokenLinksTemplate = t3lib_parsehtml::substituteMarkerArray($brokenLinksTemplate, $brokenLinksMarker, '###|###', TRUE);
-               $content = t3lib_parsehtml::substituteSubpart($brokenLinksTemplate, '###BROKENLINKS_ITEM', $brokenLinkItems);
-               return $content;
-       }
-
-       /**
-        * Replace $brokenLinksMarker['NO_BROKEN_LINKS] with localized flashmessage
-        *
-        * @param array $brokenLinksMarker
-        * @return array $brokenLinksMarker['NO_BROKEN_LINKS] replaced with flashmessage
-        */
-       protected function getNoBrokenLinkMessage(array $brokenLinksMarker) {
-               $brokenLinksMarker['LIST_HEADER'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('list.header'));
-               /** @var t3lib_FlashMessage $message */
-               $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('list.no.broken.links'), $GLOBALS['LANG']->getLL('list.no.broken.links.title'), t3lib_FlashMessage::OK);
-               $brokenLinksMarker['NO_BROKEN_LINKS'] = $message->render();
-               return $brokenLinksMarker;
-       }
-
-       /**
-        * Displays the table header of the table with the broken links
-        *
-        * @return string Code of content
-        */
-       protected function startTable() {
-               // Listing head
-               $makerTableHead = array();
-               $makerTableHead['tablehead_path'] = $GLOBALS['LANG']->getLL('list.tableHead.path');
-               $makerTableHead['tablehead_element'] = $GLOBALS['LANG']->getLL('list.tableHead.element');
-               $makerTableHead['tablehead_headlink'] = $GLOBALS['LANG']->getLL('list.tableHead.headlink');
-               $makerTableHead['tablehead_linktarget'] = $GLOBALS['LANG']->getLL('list.tableHead.linktarget');
-               $makerTableHead['tablehead_linkmessage'] = $GLOBALS['LANG']->getLL('list.tableHead.linkmessage');
-               $makerTableHead['tablehead_lastcheck'] = $GLOBALS['LANG']->getLL('list.tableHead.lastCheck');
-               // Add CSH to the header of each column
-               foreach ($makerTableHead as $column => $label) {
-                       $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $column, $label);
-                       $makerTableHead[$column] = $label;
-               }
-               // Add section header
-               $makerTableHead['list_header'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('list.header'));
-               return $makerTableHead;
-       }
-
-       /**
-        * Displays one line of the broken links table
-        *
-        * @param string $table Name of database table
-        * @param array $row Record row to be processed
-        * @param array $brokenLinksItemTemplate Markup of the template to be used
-        * @return string HTML of the rendered row
-        */
-       protected function renderTableRow($table, array $row, $brokenLinksItemTemplate) {
-               $markerArray = array();
-               $fieldName = '';
-               // Restore the linktype object
-               $hookObj = $this->hookObjectsArr[$row['link_type']];
-               $brokenUrl = $hookObj->getBrokenUrl($row);
-               $params = ((('&edit[' . $table) . '][') . $row['record_uid']) . ']=edit';
-               $actionLinks = (((((('<a href="#" onclick="' . t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], ((((t3lib_div::getIndpEnv('REQUEST_URI') . '?id=') . $this->pObj->id) . '&search_levels=') . $this->searchLevel))) . '"') . ' title="') . $GLOBALS['LANG']->getLL('list.edit')) . '">') . t3lib_iconWorks::getSpriteIcon('actions-document-open')) . '</a>';
-               $elementHeadline = $row['headline'];
-               if (empty($elementHeadline)) {
-                       $elementHeadline = ('<i>' . $GLOBALS['LANG']->getLL('list.no.headline')) . '</i>';
-               }
-               // Get the language label for the field from TCA
-               if ($GLOBALS['TCA'][$table]['columns'][$row['field']]['label']) {
-                       $fieldName = $GLOBALS['TCA'][$table]['columns'][$row['field']]['label'];
-                       $fieldName = $GLOBALS['LANG']->sL($fieldName);
-                       // Crop colon from end if present
-                       if (substr($fieldName, '-1', '1') === ':') {
-                               $fieldName = substr($fieldName, '0', strlen($fieldName) - 1);
-                       }
-               }
-               // Fallback, if there is no label
-               $fieldName = !empty($fieldName) ? $fieldName : $row['field'];
-               // column "Element"
-               $element = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => ($table . ':') . $row['record_uid']));
-               $element .= $elementHeadline;
-               $element .= ' ' . sprintf($GLOBALS['LANG']->getLL('list.field'), $fieldName);
-               $markerArray['actionlink'] = $actionLinks;
-               $markerArray['path'] = t3lib_BEfunc::getRecordPath($row['record_pid'], '', 0, 0);
-               $markerArray['element'] = $element;
-               $markerArray['headlink'] = $row['link_title'];
-               $markerArray['linktarget'] = $brokenUrl;
-               $response = unserialize($row['url_response']);
-               if ($response['valid']) {
-                       $linkMessage = ('<span style="color: green;">' . $GLOBALS['LANG']->getLL('list.msg.ok')) . '</span>';
-               } else {
-                       $linkMessage = ('<span style="color: red;">' . $hookObj->getErrorMessage($response['errorParams'])) . '</span>';
-               }
-               $markerArray['linkmessage'] = $linkMessage;
-               $lastRunDate = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $row['last_check']);
-               $lastRunTime = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row['last_check']);
-               $message = sprintf($GLOBALS['LANG']->getLL('list.msg.lastRun'), $lastRunDate, $lastRunTime);
-               $markerArray['lastcheck'] = $message;
-               // Return the table html code as string
-               return t3lib_parsehtml::substituteMarkerArray($brokenLinksItemTemplate, $markerArray, '###|###', TRUE, TRUE);
-       }
-
-       /**
-        * Builds the checkboxes out of the hooks array
-        *
-        * @param array $brokenLinkOverView Array of broken links information
-        * @param string $prefix
-        * @return string code content
-        */
-       protected function getCheckOptions(array $brokenLinkOverView, $prefix = '') {
-               $markerArray = array();
-               $additionalAttr = '';
-               if (!empty($prefix)) {
-                       $additionalAttr = (((' onclick="toggleActionButton(\'' . $prefix) . '\');" class="') . $prefix) . '" ';
-               } else {
-                       $additionalAttr = ' onclick="toggleActionButton(\'refresh\');" class="refresh" ';
-               }
-               $checkOptionsTemplate = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, '###CHECKOPTIONS_SECTION###');
-               $hookSectionTemplate = t3lib_parsehtml::getSubpart($checkOptionsTemplate, '###HOOK_SECTION###');
-               $markerArray['statistics_header'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('report.statistics.header'));
-               $totalCountLabel = $GLOBALS['LANG']->getLL('overviews.nbtotal');
-               $totalCountLabel = t3lib_BEfunc::wrapInHelp('linkvalidator', 'checkboxes', $totalCountLabel);
-               $markerArray['total_count_label'] = $totalCountLabel;
-               if (empty($brokenLinkOverView['brokenlinkCount'])) {
-                       $markerArray['total_count'] = '0';
-               } else {
-                       $markerArray['total_count'] = $brokenLinkOverView['brokenlinkCount'];
-               }
-               $linktypes = t3lib_div::trimExplode(',', $this->modTS['linktypes'], 1);
-               $hookSectionContent = '';
-               if (is_array($linktypes)) {
-                       if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
-                               foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
-                                       if (in_array($type, $linktypes)) {
-                                               $hookSectionMarker = array();
-                                               if (empty($brokenLinkOverView[$type])) {
-                                                       $hookSectionMarker['count'] = '0';
-                                               } else {
-                                                       $hookSectionMarker['count'] = $brokenLinkOverView[$type];
-                                               }
-                                               $translation = $GLOBALS['LANG']->getLL('hooks.' . $type);
-                                               $translation = $translation ? $translation : $type;
-                                               $option = (((((((((((((((((('<input type="checkbox" ' . $additionalAttr) . '  id="') . $prefix) . 'SET_') . $type) . '" name="') . $prefix) . 'SET[') . $type) . ']" value="1"') . ($this->pObj->MOD_SETTINGS[$type] ? ' checked="checked"' : '')) . '/>') . '<label for="') . $prefix) . 'SET[') . $type) . ']">') . htmlspecialchars($translation)) . '</label>';
-                                               $hookSectionMarker['option'] = $option;
-                                               $hookSectionContent .= t3lib_parsehtml::substituteMarkerArray($hookSectionTemplate, $hookSectionMarker, '###|###', TRUE, TRUE);
-                                       }
-                               }
-                       }
-               }
-               $checkOptionsTemplate = t3lib_parsehtml::substituteSubpart($checkOptionsTemplate, '###HOOK_SECTION###', $hookSectionContent);
-               return t3lib_parsehtml::substituteMarkerArray($checkOptionsTemplate, $markerArray, '###|###', TRUE, TRUE);
-       }
-
-       /**
-        * Loads data in the HTML head section (e.g. JavaScript or stylesheet information)
-        *
-        * @return void
-        */
-       protected function loadHeaderData() {
-               $this->doc->addStyleSheet('linkvalidator', $this->relativePath . 'res/linkvalidator.css', 'linkvalidator');
-               $this->doc->getPageRenderer()->addJsFile($this->doc->backPath . '../t3lib/js/extjs/ux/Ext.ux.FitToParent.js');
-       }
-
-       /**
-        * Gets the buttons that shall be rendered in the docHeader
-        *
-        * @return array Available buttons for the docHeader
-        */
-       protected function getDocHeaderButtons() {
-               $buttons = array(
-                       'csh' => t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']),
-                       'shortcut' => $this->getShortcutButton(),
-                       'save' => ''
-               );
-               return $buttons;
-       }
-
-       /**
-        * Gets the button to set a new shortcut in the backend (if current user is allowed to).
-        *
-        * @return string HTML representation of the shortcut button
-        */
-       protected function getShortcutButton() {
-               $result = '';
-               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
-                       $result = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
-               }
-               return $result;
-       }
-
-       /**
-        * Gets the filled markers that are used in the HTML template
-        *
-        * @return array The filled marker array
-        */
-       protected function getTemplateMarkers() {
-               $markers = array(
-                       'FUNC_TITLE' => $GLOBALS['LANG']->getLL('report.func.title'),
-                       'CHECKOPTIONS_TITLE' => $GLOBALS['LANG']->getLL('report.statistics.header'),
-                       'FUNC_MENU' => $this->getLevelSelector(),
-                       'CONTENT' => $this->content,
-                       'CHECKALLLINK' => $this->checkAllHtml,
-                       'CHECKOPTIONS' => $this->checkOptHtml,
-                       'ID' => ('<input type="hidden" name="id" value="' . $this->pObj->id) . '" />',
-                       'REFRESH' => $this->refreshListHtml,
-                       'UPDATE' => ''
-               );
-               return $markers;
-       }
-
-       /**
-        * Gets the filled markers that are used in the HTML template
-        *
-        * @return array The filled marker array
-        */
-       protected function getTemplateMarkersCheck() {
-               $markers = array(
-                       'FUNC_TITLE' => $GLOBALS['LANG']->getLL('checklinks.func.title'),
-                       'CHECKOPTIONS_TITLE' => $GLOBALS['LANG']->getLL('checklinks.statistics.header'),
-                       'FUNC_MENU' => $this->getLevelSelector(),
-                       'CONTENT' => '',
-                       'CHECKALLLINK' => $this->checkAllHtml,
-                       'CHECKOPTIONS' => $this->checkOptHtmlCheck,
-                       'ID' => ('<input type="hidden" name="id" value="' . $this->pObj->id) . '" />',
-                       'REFRESH' => '',
-                       'UPDATE' => $this->updateListHtml
-               );
-               return $markers;
-       }
-
-       /**
-        * Determines whether the current user is an admin
-        *
-        * @return boolean Whether the current user is admin
-        */
-       protected function isCurrentUserAdmin() {
-               return (bool) $GLOBALS['BE_USER']->user['admin'];
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Task/ValidatorTask.php b/typo3/sysext/linkvalidator/classes/Task/ValidatorTask.php
deleted file mode 100644 (file)
index 937b20c..0000000
+++ /dev/null
@@ -1,518 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Scheduler plugin implementation
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_tasks_Validator extends tx_scheduler_Task {
-
-       /**
-        * @var integer
-        */
-       protected $sleepTime;
-
-       /**
-        * @var integer
-        */
-       protected $sleepAfterFinish;
-
-       /**
-        * @var integer
-        */
-       protected $countInARun;
-
-       /**
-        * Total number of broken links
-        *
-        * @var integer
-        */
-       protected $totalBrokenLink = 0;
-
-       /**
-        * Total number of broken links from the last run
-        *
-        * @var integer
-        */
-       protected $oldTotalBrokenLink = 0;
-
-       /**
-        * Mail template fetched from the given template file
-        *
-        * @var string
-        */
-       protected $templateMail;
-
-       /**
-        * specific TSconfig for this task.
-        *
-        * @var array
-        */
-       protected $configuration = array();
-
-       /**
-        * Shows if number of result was different from the result of the last check or not
-        *
-        * @var boolean
-        */
-       protected $dif;
-
-       /**
-        * Template to be used for the email
-        *
-        * @var string
-        */
-       protected $emailTemplateFile;
-
-       /**
-        * Level of pages the task should check
-        *
-        * @var integer
-        */
-       protected $depth;
-
-       /**
-        * UID of the start page for this task
-        *
-        * @var integer
-        */
-       protected $page;
-
-       /**
-        * Email address to which an email report is sent
-        *
-        * @var string
-        */
-       protected $email;
-
-       /**
-        * Only send an email, if new broken links were found
-        *
-        * @var boolean
-        */
-       protected $emailOnBrokenLinkOnly;
-
-       /**
-        * Get the value of the protected property email
-        *
-        * @return string Email address to which an email report is sent
-        */
-       public function getEmail() {
-               return $this->email;
-       }
-
-       /**
-        * Set the value of the private property email.
-        *
-        * @param string $email Email address to which an email report is sent
-        * @return void
-        */
-       public function setEmail($email) {
-               $this->email = $email;
-       }
-
-       /**
-        * Get the value of the protected property emailOnBrokenLinkOnly
-        *
-        * @return boolean Whether to send an email, if new broken links were found
-        */
-       public function getEmailOnBrokenLinkOnly() {
-               return $this->emailOnBrokenLinkOnly;
-       }
-
-       /**
-        * Set the value of the private property emailOnBrokenLinkOnly
-        *
-        * @param boolean $emailOnBrokenLinkOnly Only send an email, if new broken links were found
-        * @return void
-        */
-       public function setEmailOnBrokenLinkOnly($emailOnBrokenLinkOnly) {
-               $this->emailOnBrokenLinkOnly = $emailOnBrokenLinkOnly;
-       }
-
-       /**
-        * Get the value of the protected property page
-        *
-        * @return integer UID of the start page for this task
-        */
-       public function getPage() {
-               return $this->page;
-       }
-
-       /**
-        * Set the value of the private property page
-        *
-        * @param integer $page UID of the start page for this task.
-        * @return void
-        */
-       public function setPage($page) {
-               $this->page = $page;
-       }
-
-       /**
-        * Get the value of the protected property depth
-        *
-        * @return integer Level of pages the task should check
-        */
-       public function getDepth() {
-               return $this->depth;
-       }
-
-       /**
-        * Set the value of the private property depth
-        *
-        * @param integer $depth Level of pages the task should check
-        * @return void
-        */
-       public function setDepth($depth) {
-               $this->depth = $depth;
-       }
-
-       /**
-        * Get the value of the protected property emailTemplateFile
-        *
-        * @return string Template to be used for the email
-        */
-       public function getEmailTemplateFile() {
-               return $this->emailTemplateFile;
-       }
-
-       /**
-        * Set the value of the private property emailTemplateFile
-        *
-        * @param string $emailTemplateFile Template to be used for the email
-        * @return void
-        */
-       public function setEmailTemplateFile($emailTemplateFile) {
-               $this->emailTemplateFile = $emailTemplateFile;
-       }
-
-       /**
-        * Get the value of the protected property configuration
-        *
-        * @return array specific TSconfig for this task
-        */
-       public function getConfiguration() {
-               return $this->configuration;
-       }
-
-       /**
-        * Set the value of the private property configuration
-        *
-        * @param array $configuration specific TSconfig for this task
-        * @return void
-        */
-       public function setConfiguration($configuration) {
-               $this->configuration = $configuration;
-       }
-
-       /**
-        * Function execute from the Scheduler
-        *
-        * @return boolean TRUE on successful execution, FALSE on error
-        */
-       public function execute() {
-               $this->setCliArguments();
-               $successfullyExecuted = TRUE;
-               if (!file_exists(($file = t3lib_div::getFileAbsFileName($this->emailTemplateFile))) && !empty($this->email)) {
-                       throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidEmailTemplateFile'), '1295476972');
-               }
-               $htmlFile = t3lib_div::getURL($file);
-               $this->templateMail = t3lib_parsehtml::getSubpart($htmlFile, '###REPORT_TEMPLATE###');
-               // The array to put the content into
-               $html = array();
-               $pageSections = '';
-               $this->dif = FALSE;
-               $pageList = t3lib_div::trimExplode(',', $this->page, 1);
-               $modTS = $this->loadModTSconfig($this->page);
-               if (is_array($pageList)) {
-                       foreach ($pageList as $page) {
-                               $pageSections .= $this->checkPageLinks($page);
-                       }
-               }
-               if ($this->totalBrokenLink != $this->oldTotalBrokenLink) {
-                       $this->dif = TRUE;
-               }
-               if (($this->totalBrokenLink > 0 && (!$this->emailOnBrokenLinkOnly || $this->dif)) && !empty($this->email)) {
-                       $successfullyExecuted = $this->reportEmail($pageSections, $modTS);
-               }
-               return $successfullyExecuted;
-       }
-
-       /**
-        * Validate all links for a page based on the task configuration
-        *
-        * @param integer $page Uid of the page to parse
-        * @return string $pageSections Content of page section
-        */
-       protected function checkPageLinks($page) {
-               $page = intval($page);
-               $pageSections = '';
-               $pageIds = '';
-               $oldLinkCounts = array();
-               $modTS = $this->loadModTSconfig($page);
-               $searchFields = $this->getSearchField($modTS);
-               $linkTypes = $this->getLinkTypes($modTS);
-               /** @var tx_linkvalidator_processor $processor */
-               $processor = t3lib_div::makeInstance('tx_linkvalidator_Processor');
-               if ($page === 0) {
-                       $rootLineHidden = FALSE;
-               } else {
-                       $pageRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'pages', 'uid=' . $page);
-                       $rootLineHidden = $processor->getRootLineIsHidden($pageRow);
-               }
-               if (!$rootLineHidden || $modTS['checkhidden'] == 1) {
-                       $pageIds = $processor->extGetTreeList($page, $this->depth, 0, '1=1', $modTS['checkhidden']);
-                       if ($pageRow['hidden'] == 0 || $modTS['checkhidden'] == 1) {
-                               // tx_linkvalidator_Processor::extGetTreeList always adds trailing comma:
-                               $pageIds .= $page;
-                       }
-               }
-               if (!empty($pageIds)) {
-                       $processor->init($searchFields, $pageIds);
-                       if (!empty($this->email)) {
-                               $oldLinkCounts = $processor->getLinkCounts($page);
-                               $this->oldTotalBrokenLink += $oldLinkCounts['brokenlinkCount'];
-                       }
-                       $processor->getLinkStatistics($linkTypes, $modTS['checkhidden']);
-                       if (!empty($this->email)) {
-                               $linkCounts = $processor->getLinkCounts($page);
-                               $this->totalBrokenLink += $linkCounts['brokenlinkCount'];
-                               $pageSections = $this->buildMail($page, $pageIds, $linkCounts, $oldLinkCounts);
-                       }
-               }
-               return $pageSections;
-       }
-
-       /**
-        * Get the linkvalidator modTSconfig for a page
-        *
-        * @param integer $page Uid of the page
-        * @return array $modTS mod.linkvalidator TSconfig array
-        */
-       protected function loadModTSconfig($page) {
-               $modTS = t3lib_BEfunc::getModTSconfig($page, 'mod.linkvalidator');
-               $parseObj = t3lib_div::makeInstance('t3lib_TSparser');
-               $parseObj->parse($this->configuration);
-               if (count($parseObj->errors) > 0) {
-                       $parseErrorMessage = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidTSconfig') . '<br />';
-                       foreach ($parseObj->errors as $errorInfo) {
-                               $parseErrorMessage .= $errorInfo[0] . '<br />';
-                       }
-                       throw new Exception($parseErrorMessage, '1295476989');
-               }
-               $TSconfig = $parseObj->setup;
-               $modTS = $modTS['properties'];
-               $overrideTs = $TSconfig['mod.']['tx_linkvalidator.'];
-               if (is_array($overrideTs)) {
-                       $modTS = t3lib_div::array_merge_recursive_overrule($modTS, $overrideTs);
-               }
-               return $modTS;
-       }
-
-       /**
-        * Get the list of fields to parse in modTSconfig
-        *
-        * @param array $modTS mod.linkvalidator TSconfig array
-        * @return array $searchFields List of fields
-        */
-       protected function getSearchField(array $modTS) {
-               // Get the searchFields from TypoScript
-               foreach ($modTS['searchFields.'] as $table => $fieldList) {
-                       $fields = t3lib_div::trimExplode(',', $fieldList);
-                       foreach ($fields as $field) {
-                               $searchFields[$table][] = $field;
-                       }
-               }
-               return isset($searchFields) ? $searchFields : array();
-       }
-
-       /**
-        * Get the list of linkTypes to parse in modTSconfig
-        *
-        * @param array $modTS mod.linkvalidator TSconfig array
-        * @return array $linkTypes list of link types
-        */
-       protected function getLinkTypes(array $modTS) {
-               $linkTypes = array();
-               $typesTmp = t3lib_div::trimExplode(',', $modTS['linktypes'], 1);
-               if (is_array($typesTmp)) {
-                       if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
-                               foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
-                                       if (in_array($type, $typesTmp)) {
-                                               $linkTypes[$type] = 1;
-                                       }
-                               }
-                       }
-               }
-               return $linkTypes;
-       }
-
-       /**
-        * Build and send warning email when new broken links were found
-        *
-        * @param string $pageSections Content of page section
-        * @param array $modTS TSconfig array
-        * @return boolean TRUE if mail was sent, FALSE if or not
-        */
-       protected function reportEmail($pageSections, array $modTS) {
-               $content = t3lib_parsehtml::substituteSubpart($this->templateMail, '###PAGE_SECTION###', $pageSections);
-               /** @var array $markerArray */
-               $markerArray = array();
-               /** @var array $validEmailList */
-               $validEmailList = array();
-               /** @var boolean $sendEmail */
-               $sendEmail = TRUE;
-               $markerArray['totalBrokenLink'] = $this->totalBrokenLink;
-               $markerArray['totalBrokenLink_old'] = $this->oldTotalBrokenLink;
-               // Hook
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'])) {
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'] as $userFunc) {
-                               $params = array(
-                                       'pObj' => &$this,
-                                       'markerArray' => $markerArray
-                               );
-                               $newMarkers = t3lib_div::callUserFunction($userFunc, $params, $this);
-                               if (is_array($newMarkers)) {
-                                       $markerArray = t3lib_div::array_merge($markerArray, $newMarkers);
-                               }
-                               unset($params);
-                       }
-               }
-               $content = t3lib_parsehtml::substituteMarkerArray($content, $markerArray, '###|###', TRUE, TRUE);
-               /** @var t3lib_mail_Message $mail */
-               $mail = t3lib_div::makeInstance('t3lib_mail_Message');
-               if (empty($modTS['mail.']['fromemail'])) {
-                       $modTS['mail.']['fromemail'] = t3lib_utility_Mail::getSystemFromAddress();
-               }
-               if (empty($modTS['mail.']['fromname'])) {
-                       $modTS['mail.']['fromname'] = t3lib_utility_Mail::getSystemFromName();
-               }
-               if (t3lib_div::validEmail($modTS['mail.']['fromemail'])) {
-                       $mail->setFrom(array($modTS['mail.']['fromemail'] => $modTS['mail.']['fromname']));
-               } else {
-                       throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidFromEmail'), '1295476760');
-               }
-               if (t3lib_div::validEmail($modTS['mail.']['replytoemail'])) {
-                       $mail->setReplyTo(array($modTS['mail.']['replytoemail'] => $modTS['mail.']['replytoname']));
-               }
-               if (!empty($modTS['mail.']['subject'])) {
-                       $mail->setSubject($modTS['mail.']['subject']);
-               } else {
-                       throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.noSubject'), '1295476808');
-               }
-               if (!empty($this->email)) {
-                       $emailList = t3lib_div::trimExplode(',', $this->email);
-                       foreach ($emailList as $emailAdd) {
-                               if (!t3lib_div::validEmail($emailAdd)) {
-                                       throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidToEmail'), '1295476821');
-                               } else {
-                                       $validEmailList[] = $emailAdd;
-                               }
-                       }
-               }
-               if (is_array($validEmailList) && !empty($validEmailList)) {
-                       $mail->setTo($this->email);
-               } else {
-                       $sendEmail = FALSE;
-               }
-               if ($sendEmail) {
-                       $mail->setBody($content, 'text/html');
-                       $mail->send();
-               }
-               return $sendEmail;
-       }
-
-       /**
-        * Build the mail content
-        *
-        * @param int $curPage Id of the current page
-        * @param string $pageList List of pages id
-        * @param array $markerArray Array of markers
-        * @param array $oldBrokenLink Marker array with the number of link found
-        * @return string Content of the mail
-        */
-       protected function buildMail($curPage, $pageList, array $markerArray, array $oldBrokenLink) {
-               $pageSectionHTML = t3lib_parsehtml::getSubpart($this->templateMail, '###PAGE_SECTION###');
-               // Hook
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['buildMailMarkers'])) {
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['buildMailMarkers'] as $userFunc) {
-                               $params = array(
-                                       'curPage' => $curPage,
-                                       'pageList' => $pageList,
-                                       'markerArray' => $markerArray,
-                                       'oldBrokenLink' => $oldBrokenLink,
-                                       'pObj' => &$this
-                               );
-                               $newMarkers = t3lib_div::callUserFunction($userFunc, $params, $this);
-                               if (is_array($newMarkers)) {
-                                       $markerArray = t3lib_div::array_merge($markerArray, $newMarkers);
-                               }
-                               unset($params);
-                       }
-               }
-               if (is_array($markerArray)) {
-                       foreach ($markerArray as $markerKey => $markerValue) {
-                               if (empty($oldBrokenLink[$markerKey])) {
-                                       $oldBrokenLink[$markerKey] = 0;
-                               }
-                               if ($markerValue != $oldBrokenLink[$markerKey]) {
-                                       $this->dif = TRUE;
-                               }
-                               $markerArray[$markerKey . '_old'] = $oldBrokenLink[$markerKey];
-                       }
-               }
-               $markerArray['title'] = t3lib_BEfunc::getRecordTitle('pages', t3lib_BEfunc::getRecord('pages', $curPage));
-               $content = '';
-               if ($markerArray['brokenlinkCount'] > 0) {
-                       $content = t3lib_parsehtml::substituteMarkerArray($pageSectionHTML, $markerArray, '###|###', TRUE, TRUE);
-               }
-               return $content;
-       }
-
-       /**
-        * Simulate cli call with setting the required options to the $_SERVER['argv']
-        *
-        * @return void
-        */
-       protected function setCliArguments() {
-               $_SERVER['argv'] = array(
-                       $_SERVER['argv'][0],
-                       'tx_link_scheduler_link',
-                       '0',
-                       '-ss',
-                       '--sleepTime',
-                       $this->sleepTime,
-                       '--sleepAfterFinish',
-                       $this->sleepAfterFinish,
-                       '--countInARun',
-                       $this->countInARun
-               );
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/Task/ValidatorTaskAdditionalFieldProvider.php b/typo3/sysext/linkvalidator/classes/Task/ValidatorTaskAdditionalFieldProvider.php
deleted file mode 100644 (file)
index ca21125..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Scheduler Additional Field plugin implementation
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_tasks_ValidatorAdditionalFieldProvider implements tx_scheduler_AdditionalFieldProvider {
-
-       /**
-        * Render additional information fields within the scheduler backend.
-        *
-        * @param array $taskInfo Array information of task to return
-        * @param task $task Task object
-        * @param tx_scheduler_Module $schedulerModule Reference to the calling object (BE module of the Scheduler)
-        * @return array Additional fields
-        * @see interfaces/tx_scheduler_AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule)
-        */
-       public function getAdditionalFields(array &$taskInfo, $task, tx_scheduler_Module $schedulerModule) {
-               $additionalFields = array();
-               if (empty($taskInfo['configuration'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['configuration'] = '';
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['configuration'] = $task->getConfiguration();
-                       } else {
-                               $taskInfo['configuration'] = $task->getConfiguration();
-                       }
-               }
-               if (empty($taskInfo['depth'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['depth'] = array();
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['depth'] = $task->getDepth();
-                       } else {
-                               $taskInfo['depth'] = $task->getDepth();
-                       }
-               }
-               if (empty($taskInfo['page'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['page'] = '';
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['page'] = $task->getPage();
-                       } else {
-                               $taskInfo['page'] = $task->getPage();
-                       }
-               }
-               if (empty($taskInfo['email'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['email'] = '';
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['email'] = $task->getEmail();
-                       } else {
-                               $taskInfo['email'] = $task->getEmail();
-                       }
-               }
-               if (empty($taskInfo['emailOnBrokenLinkOnly'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['emailOnBrokenLinkOnly'] = 1;
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
-                       } else {
-                               $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
-                       }
-               }
-               if (empty($taskInfo['emailTemplateFile'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['emailTemplateFile'] = 'EXT:linkvalidator/res/mailtemplate.html';
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
-                       } else {
-                               $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
-                       }
-               }
-               $fieldID = 'task_page';
-               $fieldCode = ((('<input type="text" name="tx_scheduler[linkvalidator][page]"  id="' . $fieldID) . '" value="') . htmlspecialchars($taskInfo['page'])) . '"/>';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.page');
-               $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
-                       'code' => $fieldCode,
-                       'label' => $label
-               );
-               // input for depth
-               $fieldID = 'task_depth';
-               $fieldValueArray = array(
-                       '0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'),
-                       '1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'),
-                       '2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
-                       '3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
-                       '4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_4'),
-                       '999' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi')
-               );
-               $fieldCode = ('<select name="tx_scheduler[linkvalidator][depth]" id="' . $fieldID) . '">';
-               foreach ($fieldValueArray as $depth => $label) {
-                       $fieldCode .= (((((('   ' . '<option value="') . htmlspecialchars($depth)) . '"') . ($depth == $taskInfo['depth'] ? ' selected="selected"' : '')) . '>') . $label) . '</option>';
-               }
-               $fieldCode .= '</select>';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.depth');
-               $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
-                       'code' => $fieldCode,
-                       'label' => $label
-               );
-               $fieldID = 'task_configuration';
-               $fieldCode = ((('<textarea  name="tx_scheduler[linkvalidator][configuration]" id="' . $fieldID) . '" >') . htmlspecialchars($taskInfo['configuration'])) . '</textarea>';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.conf');
-               $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
-                       'code' => $fieldCode,
-                       'label' => $label
-               );
-               $fieldID = 'task_email';
-               $fieldCode = ((('<input type="text"  name="tx_scheduler[linkvalidator][email]" id="' . $fieldID) . '" value="') . htmlspecialchars($taskInfo['email'])) . '" />';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.email');
-               $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
-                       'code' => $fieldCode,
-                       'label' => $label
-               );
-               $fieldID = 'task_emailOnBrokenLinkOnly';
-               $fieldCode = ((('<input type="checkbox"  name="tx_scheduler[linkvalidator][emailOnBrokenLinkOnly]" id="' . $fieldID) . '" ') . (htmlspecialchars($taskInfo['emailOnBrokenLinkOnly']) ? 'checked="checked"' : '')) . ' />';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailOnBrokenLinkOnly');
-               $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
-                       'code' => $fieldCode,
-                       'label' => $label
-               );
-               $fieldID = 'task_emailTemplateFile';
-               $fieldCode = ((('<input type="text"  name="tx_scheduler[linkvalidator][emailTemplateFile]" id="' . $fieldID) . '" value="') . htmlspecialchars($taskInfo['emailTemplateFile'])) . '" />';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailTemplateFile');
-               $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
-                       'code' => $fieldCode,
-                       'label' => $label
-               );
-               return $additionalFields;
-       }
-
-       /**
-        * Mark current value as selected by returning the "selected" attribute
-        *
-        * @param array $configurationArray Array of configuration
-        * @param string $currentValue Value of selector object
-        * @return string Html fragment for a selected option or empty
-        */
-       protected function getSelectedState(array $configurationArray, $currentValue) {
-               $selected = '';
-               for ($i = 0; $i < count($configurationArray); $i++) {
-                       if (strcmp($configurationArray[$i], $currentValue) === 0) {
-                               $selected = 'selected="selected" ';
-                       }
-               }
-               return $selected;
-       }
-
-       /**
-        * 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;
-               //TODO add validation to validate the $submittedData['configuration'] which is normally a comma separated 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 = ' . intval($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);
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               } 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;
-       }
-
-       /**
-        * This method is used to save any additional input into the current task object
-        * if the task class matches.
-        *
-        * @param array $submittedData Array containing the data submitted by the user
-        * @param tx_scheduler_Task $task Reference to the current task object
-        * @return void
-        */
-       public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) {
-               $task->setDepth($submittedData['linkvalidator']['depth']);
-               $task->setPage($submittedData['linkvalidator']['page']);
-               $task->setEmail($submittedData['linkvalidator']['email']);
-               if ($submittedData['linkvalidator']['emailOnBrokenLinkOnly']) {
-                       $task->setEmailOnBrokenLinkOnly(1);
-               } else {
-                       $task->setEmailOnBrokenLinkOnly(0);
-               }
-               $task->setConfiguration($submittedData['linkvalidator']['configuration']);
-               $task->setEmailTemplateFile($submittedData['linkvalidator']['emailTemplateFile']);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php b/typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php
deleted file mode 100644 (file)
index 8d1bea8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-$GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/modfuncreport/locallang.xml');
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_Processor and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/LinkAnalyzer.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validator.php b/typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validator.php
deleted file mode 100644 (file)
index 1f49e5d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_tasks_Validator and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/Task/ValidatorTask.php';
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php b/typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php
deleted file mode 100644 (file)
index efcc65b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/*
- * @deprecated since 6.0, the classname tx_linkvalidator_tasks_ValidatorAdditionalFieldProvider and this file is obsolete
- * and will be removed by 7.0. The class was renamed and is now located at:
- * typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php
- */
-require_once t3lib_extMgm::extPath('linkvalidator') . 'Classes/Task/ValidatorTaskAdditionalFieldProvider.php';
-?>
\ No newline at end of file
index b2b96b4..5c559d8 100644 (file)
@@ -1,6 +1,5 @@
 <?php
-$extensionPath = t3lib_extMgm::extPath('linkvalidator');
-
+$extensionPath = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator');
 return array(
        'tx_linkvalidator_linktype_abstract' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_abstract.php',
        'tx_linkvalidator_linktype_interface' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_interface.php',
@@ -8,10 +7,8 @@ return array(
        'tx_linkvalidator_linktype_file' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_file.php',
        'tx_linkvalidator_linktype_internal' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_internal.php',
        'tx_linkvalidator_linktype_linkhandler' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_linkhandler.php',
-
        'tx_linkvalidator_processor' => $extensionPath . 'classes/class.tx_linkvalidator_processor.php',
-
-       'tx_linkvalidator_tasks_validator'  => $extensionPath . 'classes/tasks/class.tx_linkvalidator_tasks_validator.php',
-       'tx_linkvalidator_tasks_validatoradditionalfieldprovider' => $extensionPath . 'classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php',
+       'tx_linkvalidator_tasks_validator' => $extensionPath . 'classes/tasks/class.tx_linkvalidator_tasks_validator.php',
+       'tx_linkvalidator_tasks_validatoradditionalfieldprovider' => $extensionPath . 'classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php'
 );
 ?>
\ No newline at end of file
index a6dd262..002e4bd 100644 (file)
@@ -1,15 +1,13 @@
 <?php
-
 /***************************************************************
-* Extension Manager/Repository config file for ext "linkvalidator".
-*
-* Auto generated 23-10-2011 17:09
-*
-* Manual updates:
-* Only the data in the array - everything else is removed by next
-* writing. "version" and "dependencies" must not be touched!
-***************************************************************/
-
+ * Extension Manager/Repository config file for ext "linkvalidator".
+ *
+ * Auto generated 23-10-2011 17:09
+ *
+ * Manual updates:
+ * Only the data in the array - everything else is removed by next
+ * writing. "version" and "dependencies" must not be touched!
+ ***************************************************************/
 $EM_CONF[$_EXTKEY] = array(
        'title' => 'Linkvalidator',
        'description' => 'Linkvalidator checks the links in your website for validity. It can validate all kinds of links: internal, external and file links. Scheduler is supported to run Linkvalidator via Cron including the option to send status mails, if broken links were detected.',
@@ -35,16 +33,12 @@ $EM_CONF[$_EXTKEY] = array(
                'depends' => array(
                        'php' => '5.3.0-0.0.0',
                        'typo3' => '4.6.0-0.0.0',
-                       'info' => '1.1.0-0.0.0',
-               ),
-               'conflicts' => array(
-               ),
-               'suggests' => array(
+                       'info' => '1.1.0-0.0.0'
                ),
+               'conflicts' => array(),
+               'suggests' => array()
        ),
        '_md5_values_when_last_written' => 'a:26:{s:9:"ChangeLog";s:4:"a390";s:16:"ext_autoload.php";s:4:"4efa";s:12:"ext_icon.gif";s:4:"838b";s:17:"ext_localconf.php";s:4:"5e6f";s:14:"ext_tables.php";s:4:"e7a3";s:14:"ext_tables.sql";s:4:"2489";s:13:"locallang.xlf";s:4:"ff7a";s:44:"classes/class.tx_linkvalidator_processor.php";s:4:"f8f6";s:61:"classes/linktype/class.tx_linkvalidator_linktype_abstract.php";s:4:"1186";s:61:"classes/linktype/class.tx_linkvalidator_linktype_external.php";s:4:"f1b8";s:57:"classes/linktype/class.tx_linkvalidator_linktype_file.php";s:4:"917a";s:62:"classes/linktype/class.tx_linkvalidator_linktype_interface.php";s:4:"3eec";s:61:"classes/linktype/class.tx_linkvalidator_linktype_internal.php";s:4:"9d5f";s:64:"classes/linktype/class.tx_linkvalidator_linktype_linkhandler.php";s:4:"d5d2";s:56:"classes/tasks/class.tx_linkvalidator_tasks_validator.php";s:4:"36d6";s:79:"classes/tasks/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php";s:4:"375c";s:14:"doc/manual.sxw";s:4:"996f";s:14:"doc/manual.txt";s:4:"6872";s:54:"modfuncreport/class.tx_linkvalidator_modfuncreport.php";s:4:"3f9f";s:27:"modfuncreport/locallang.xlf";s:4:"95cb";s:31:"modfuncreport/locallang_csh.xlf";s:4:"6541";s:31:"modfuncreport/locallang_mod.xlf";s:4:"5156";s:31:"modfuncreport/mod_template.html";s:4:"4c0f";s:21:"res/linkvalidator.css";s:4:"77b4";s:21:"res/mailtemplate.html";s:4:"c425";s:20:"res/pagetsconfig.txt";s:4:"93e0";}',
-       'suggests' => array(
-       ),
+       'suggests' => array()
 );
-
 ?>
\ No newline at end of file
index 7502495..9417edf 100644 (file)
@@ -1,24 +1,19 @@
 <?php
-if (!defined ('TYPO3_MODE')) {
-       die ('Access denied.');
+if (!defined('TYPO3_MODE')) {
+       die('Access denied.');
 }
-
-t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:linkvalidator/res/pagetsconfig.txt">');
-
+\TYPO3\CMS\Core\Extension\ExtensionManager::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:linkvalidator/res/pagetsconfig.txt">');
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_linkvalidator_tasks_Validator'] = array(
-       'extension'        => $_EXTKEY,
-       'title'            => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tasks.validate.name',
-       'description'      => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tasks.validate.description',
-       'additionalFields' => 'tx_linkvalidator_tasks_ValidatorAdditionalFieldProvider'
+       'extension' => $_EXTKEY,
+       'title' => ('LLL:EXT:' . $_EXTKEY) . '/locallang.xml:tasks.validate.name',
+       'description' => ('LLL:EXT:' . $_EXTKEY) . '/locallang.xml:tasks.validate.description',
+       'additionalFields' => 'TYPO3\\CMS\\Linkvalidator\\Task\\ValidatorTaskAdditionalFieldProvider'
 );
-
 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
        $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] = array();
 }
-
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['db'] = 'tx_linkvalidator_linktype_Internal';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['file'] = 'tx_linkvalidator_linktype_File';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['external'] = 'tx_linkvalidator_linktype_External';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['linkhandler'] = 'tx_linkvalidator_linktype_LinkHandler';
-
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['db'] = 'TYPO3\\CMS\\Linkvalidator\\Linktype\\InternalLinktype';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['file'] = 'TYPO3\\CMS\\Linkvalidator\\Linktype\\FileLinktype';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['external'] = 'TYPO3\\CMS\\Linkvalidator\\Linktype\\ExternalLinktype';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['linkhandler'] = 'TYPO3\\CMS\\Linkvalidator\\Linktype\\LinkHandler';
 ?>
\ No newline at end of file
index 8ab5afe..b294843 100644 (file)
@@ -1,19 +1,11 @@
 <?php
-if (!defined ('TYPO3_MODE')) {
-       die ('Access denied.');
+if (!defined('TYPO3_MODE')) {
+       die('Access denied.');
 }
-
 if (TYPO3_MODE == 'BE') {
-               // Add module
-       t3lib_extMgm::insertModuleFunction(
-               'web_info',
-               'tx_linkvalidator_ModFuncReport',
-               t3lib_extMgm::extPath('linkvalidator') . 'modfuncreport/class.tx_linkvalidator_modfuncreport.php',
-               'LLL:EXT:linkvalidator/locallang.xml:mod_linkvalidator'
-       );
+       // Add module
+       \TYPO3\CMS\Core\Extension\ExtensionManager::insertModuleFunction('web_info', 'TYPO3\\CMS\\Linkvalidator\\Report\\LinkValidatorReport', \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'modfuncreport/class.tx_linkvalidator_modfuncreport.php', 'LLL:EXT:linkvalidator/locallang.xml:mod_linkvalidator');
 }
-
-       // Initialize Context Sensitive Help (CSH)
-t3lib_extMgm::addLLrefForTCAdescr('linkvalidator', 'EXT:linkvalidator/modfuncreport/locallang_csh.xml');
-
+// Initialize Context Sensitive Help (CSH)
+\TYPO3\CMS\Core\Extension\ExtensionManager::addLLrefForTCAdescr('linkvalidator', 'EXT:linkvalidator/modfuncreport/locallang_csh.xml');
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/modfuncreport/class.tx_linkvalidator_modfuncreport.php b/typo3/sysext/linkvalidator/modfuncreport/class.tx_linkvalidator_modfuncreport.php
new file mode 100644 (file)
index 0000000..08c78ac
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+/*
+ * @deprecated since 6.0, the classname tx_linkvalidator_ModFuncReport and this file is obsolete
+ * and will be removed by 7.0. The class was renamed and is now located at:
+ * typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php
+ */
+require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('linkvalidator') . 'Classes/Report/LinkValidatorReport.php';
+?>
\ No newline at end of file