[TASK] Merge changes from 4.5 upstream to master
authorPhilipp Gampe <forge.typo3.org@philippgampe.info>
Fri, 15 Jul 2011 14:10:14 +0000 (16:10 +0200)
committerPhilipp Gampe <forge.typo3.org@philippgampe.info>
Sun, 17 Jul 2011 14:04:13 +0000 (16:04 +0200)
During integration of linkvalidator for 4.5, more changes were
done. Merge those with master branch.

Change-Id: Ibcee327e7f9d39b6a576fc4698510b857894a2a1
Resolves: #28241

typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php
typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_external.php
typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validator.php
typo3/sysext/linkvalidator/modfuncreport/class.tx_linkvalidator_modfuncreport.php

index 1c675c4..a9ebf05 100644 (file)
@@ -106,7 +106,7 @@ class tx_linkvalidator_Processor {
        public function init($searchField, $pid) {
                $this->searchFields = $searchField;
                $this->pidList = $pid;
-               
+
                foreach ($searchField as $tableName => $table) {
                        t3lib_div::loadTCA($tableName);
                }
@@ -402,7 +402,7 @@ class tx_linkvalidator_Processor {
                                'pages',
                                'pid=' . $id . ' AND deleted=0 AND ' . $permsClause
                        );
-                       
+
                        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                if ($begin <= 0 && ($row['hidden']==0 || $considerHidden == 1)) {
                                        $theList .= $row['uid'] . ',';
@@ -418,17 +418,16 @@ class tx_linkvalidator_Processor {
 
        public function getRootLineIsHidden($pageInfo){
                $hidden = FALSE;
-               if($pageInfo['extendToSubpages'] == 1 && $pageInfo['hidden'] == 1){
+               if ($pageInfo['extendToSubpages'] == 1 && $pageInfo['hidden'] == 1){
                        $hidden = TRUE;
-               }
-               else{
-                       if($pageInfo['pid'] > 0) {
+               } else {
+                       if ($pageInfo['pid'] > 0) {
                                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                        'uid,title,hidden,extendToSubpages',
                                        'pages',
-                                       'uid=' . $pageInfo['pid'] 
+                                       'uid=' . $pageInfo['pid']
                                );
-                       
+
                                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                        $hidden = $this->getRootLineIsHidden($row);
                                }
@@ -438,7 +437,7 @@ class tx_linkvalidator_Processor {
                        }
                }
                return $hidden;
-                       
+
        }
 
 }
index 46d0517..acd22dd 100644 (file)
@@ -81,7 +81,7 @@ class tx_linkvalidator_linktype_External extends tx_linkvalidator_linktype_Abstr
                        $url = substr($url, 0, strrpos($url, '#'));
                }
 
-                       // try to fetch the content of the URL 
+                       // try to fetch the content of the URL
                $content = t3lib_div::getURL($url, 1, $additionalHeaders, $report);
 
                $tries = 0;
@@ -90,7 +90,7 @@ class tx_linkvalidator_linktype_External extends tx_linkvalidator_linktype_Abstr
                                || $report['http_code'] == 303 || $report['http_code'] == 307)
                           && ($tries < 5)) {
 
-                               // split header into lines and find Location: 
+                               // split header into lines and find Location:
                        $responseHeaders = t3lib_div::trimExplode(chr(10), $content, TRUE);
                        foreach ($responseHeaders as $line) {
                                        // construct new URL
@@ -104,13 +104,16 @@ class tx_linkvalidator_linktype_External extends tx_linkvalidator_linktype_Abstr
                                                                $parsedUrl['user'] . (isset($parsedUrl['pass']) ? ':' . $parsedUrl['pass'] : '')
                                                                : '') . $parsedUrl['host'] . (
                                                        isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '') . $location[1];
-                                               }
-                                               else {
+                                               } else {
                                                        $newUrl = $location[1];
                                                }
 
-                                               if ($lastUrl === $newUrl) break 2;
-                                       } else break 2;
+                                               if ($lastUrl === $newUrl) {
+                                                       break 2;
+                                               }
+                                       } else {
+                                               break 2;
+                                       }
                                }
                        }
 
@@ -119,8 +122,8 @@ class tx_linkvalidator_linktype_External extends tx_linkvalidator_linktype_Abstr
                        $lastUrl = $newUrl;
                        $tries++;
                }
-               
-               
+
+
                $response = TRUE;
 
                        // analyze the response
index 3b97fa5..51f92c4 100644 (file)
@@ -285,25 +285,17 @@ class tx_linkvalidator_tasks_Validator extends tx_scheduler_Task {
                $processor = t3lib_div::makeInstance('tx_linkvalidator_Processor');
                $pageRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'pages', 'uid=' . $page);
                $rootLineHidden = $processor->getRootLineIsHidden($pageRow);
-               if(!$rootLineHidden || $modTS['checkhidden']==1) {
+               if (!$rootLineHidden || $modTS['checkhidden'] == 1) {
                        $pageIds = $processor->extGetTreeList($page, $this->depth, 0, '1=1', $modTS['checkhidden']);
-                       if($pageRow['hidden'] == 0 || $modTS['checkhidden']==1){
+                       if ($pageRow['hidden'] == 0 || $modTS['checkhidden'] == 1) {
                                $pageIds .= $page;
                        }
-               
+
                        $processor->init($searchFields, $pageIds);
                        if (!empty($this->email)) {
                                $oldLinkCounts = $processor->getLinkCounts($page);
                                $this->oldTotalBrokenLink += $oldLinkCounts['brokenlinkCount'];
                        }
-       
-                       $processor->getLinkStatistics($array, $modTS['checkhidden']);
-       
-                       if (!empty($this->email)) {
-                               $linkCounts = $processor->getLinkCounts($page);
-                               $this->totalBrokenLink += $linkCounts['brokenlinkCount'];
-                               $pageSections = $this->buildMail($page, $pageIds, $linkCounts, $oldLinkCounts);
-                       }
                }
 
                $processor->getLinkStatistics($linkTypes, $modTS['checkhidden']);
index a50027d..ebe5e9c 100644 (file)
@@ -249,7 +249,7 @@ class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
                        items : [
                        {
                                autoHeight: true,
-                       title: TYPO3.lang.Report,
+                               title: TYPO3.lang.Report,
                                html: ' . json_encode($this->flush(TRUE)) . '
                        },
                        ' . $panelCheck . '
@@ -331,7 +331,7 @@ class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
                        }
                }
                $rootLineHidden = $this->processor->getRootLineIsHidden($this->pObj->pageinfo);
-               if(!$rootLineHidden || $this->modTS['checkhidden']==1) {
+               if (!$rootLineHidden || $this->modTS['checkhidden'] == 1) {
                                // get children pages
                        $pageList = $this->processor->extGetTreeList(
                                $this->pObj->id,
@@ -340,18 +340,18 @@ class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
                                $GLOBALS['BE_USER']->getPagePermsClause(1),
                                $this->modTS['checkhidden']
                        );
-       
-       
-                       if($this->pObj->pageinfo['hidden'] == 0 || $this->modTS['checkhidden']==1){
+
+
+                       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']);
                        }
@@ -434,7 +434,7 @@ class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
                        $keyOpt = array_keys($this->checkOpt);
                }
                $rootLineHidden = $this->processor->getRootLineIsHidden($this->pObj->pageinfo);
-               if(!$rootLineHidden || $this->modTS['checkhidden']==1) {
+               if (!$rootLineHidden || $this->modTS['checkhidden'] == 1) {
                        $pageList = $this->processor->extGetTreeList(
                                $this->pObj->id,
                                $this->searchLevel,
@@ -442,10 +442,10 @@ class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
                                $GLOBALS['BE_USER']->getPagePermsClause(1),
                                $this->modTS['checkhidden']
                        );
-                       if($this->pObj->pageinfo['hidden'] == 0 || $this->modTS['checkhidden']==1){
+                       if ($this->pObj->pageinfo['hidden'] == 0 || $this->modTS['checkhidden'] == 1){
                                $pageList .= $this->pObj->id;
                        }
-               
+
                        if (($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                '*',
                                'tx_linkvalidator_link',
@@ -456,26 +456,25 @@ class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
                                // 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))) {
                                                $items[] = $this->renderTableRow($row['table_name'], $row, $brokenLinksItemTemplate);
-                                       }                                       
+                                       }
                                        $brokenLinkItems = implode(chr(10), $items);
-       
+
                                        // Display note that there are no broken links to display
                                } else {
                                        $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
                                }
                        }
-               }
-               else{
-                       
+               } else {
+
                        $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
                }
                $brokenLinksTemplate = t3lib_parsehtml::substituteMarkerArray($brokenLinksTemplate, $brokenLinksMarker, '###|###', TRUE);
@@ -484,7 +483,7 @@ class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
                return $content;
        }
 
-       protected  function getNoBrokenLinkMessage($brokenLinksMarker){ 
+       protected  function getNoBrokenLinkMessage($brokenLinksMarker){
                $brokenLinksMarker['LIST_HEADER'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('list.header'));
                $message = t3lib_div::makeInstance(
                        't3lib_FlashMessage',
@@ -493,7 +492,7 @@ class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
                        t3lib_FlashMessage::OK
                );
                $brokenLinksMarker['NO_BROKEN_LINKS'] = $message->render();
-               
+
                return $brokenLinksMarker;
        }