Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cLinkcheckerSearchLinks
  • LinkcheckerRepair

Functions

  • cCatPerm
  • checkLinks
  • getGroupIDs
  • linksort
  • searchFrontContentLinks
  • url_is_image
  • url_is_uri
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This is the main backend page for the linkchecker plugin.
  4:  *
  5:  * @package Plugin
  6:  * @subpackage Linkchecker
  7:  * @author Frederic Schneider
  8:  * @copyright four for business AG <www.4fb.de>
  9:  * @license http://www.contenido.org/license/LIZENZ.txt
 10:  * @link http://www.4fb.de
 11:  * @link http://www.contenido.org
 12:  */
 13: 
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: $plugin_name = "linkchecker";
 17: $cfg = cRegistry::getConfig();
 18: 
 19: if (!$cronjob) {
 20: 
 21:     // Check permissions for linkchecker action
 22:     if (!$perm->have_perm_area_action($plugin_name, "linkchecker") && $cronjob != true) {
 23:         cRegistry::addErrorMessage(i18n("No permissions"));
 24:         $page = new cGuiPage('generic_page');
 25:         $page->abortRendering();
 26:         $page->render();
 27:         exit();
 28:     }
 29: 
 30:     if (cRegistry::getClientId() == 0 && $cronjob != true) {
 31:         $notification->displayNotification("error", i18n("No Client selected"));
 32:         exit();
 33:     }
 34: }
 35: 
 36: // If no mode defined, use mode three
 37: if (empty($_GET['mode'])) {
 38:     $_GET['mode'] = 3;
 39: }
 40: 
 41: // If no action definied
 42: if (empty($_GET['action'])) {
 43:     $_GET['action'] = 'linkchecker';
 44:     $action = "linkchecker";
 45: }
 46: 
 47: plugin_include('linkchecker', 'includes/config.plugin.php');
 48: plugin_include('linkchecker', 'includes/include.checkperms.php');
 49: plugin_include('linkchecker', 'includes/include.linkchecker_tests.php');
 50: 
 51: // Initialization
 52: $aCats = array();
 53: $aSearchIDInfosArt = array();
 54: $aSearchIDInfosCatArt = array();
 55: $aSearchIDInfosNonID = array();
 56: 
 57: // Var initialization
 58: $aUrl = array(
 59:     'cms' => cRegistry::getFrontendUrl(),
 60:     'contenido' => cRegistry::getBackendUrl()
 61: );
 62: 
 63: // Template- and languagevars
 64: if ($cronjob != true) {
 65:     $tpl->set('s', 'MODE', cSecurity::toInteger($_GET['mode']));
 66: }
 67: 
 68: // Fill Subnav I
 69: if (!$cronjob) {
 70:     $sLink = $sess->url("main.php?area=linkchecker&frame=4&action=linkchecker") . '&mode=';
 71: 
 72:     // Fill Subnav II
 73:     $tpl->set('s', 'INTERNS_HREF', $sLink . '1');
 74:     $tpl->set('s', 'INTERNS_LABEL', i18n("Interns", $plugin_name));
 75:     $tpl->set('s', 'EXTERNS_HREF', $sLink . '2');
 76:     $tpl->set('s', 'EXTERNS_LABEL', i18n("Externs", $plugin_name));
 77:     $tpl->set('s', 'INTERNS_EXTERNS_HREF', $sLink . '3');
 78:     $tpl->set('s', 'INTERNS_EXTERNS_LABEL', i18n("Intern/extern Links", $plugin_name));
 79: 
 80:     // Fill Subnav III
 81:     $tpl->set('s', 'UPDATE_HREF', $sLink . cSecurity::toInteger($_GET['mode']) . '&live=1');
 82: }
 83: 
 84: // Cache options
 85: $aCacheName = array(
 86:     'errors' => $sess->id,
 87:     'errorscount' => $aCacheName['errors'] . "ErrorsCountChecked"
 88: );
 89: $oCache = new cFileCache(array(
 90:     'cacheDir' => $cfgClient[$client]['cache']['path'],
 91:     'lifeTime' => $iCacheLifeTime
 92: ));
 93: 
 94: /*
 95:  * ******** Program code ********
 96:  */
 97: 
 98: // function linksort
 99: function linksort($sErrors) {
100:     if ($_GET['sort'] == "nameart") {
101: 
102:         foreach ($sErrors as $key => $aRow) {
103:             $aNameart[$key] = $aRow['nameart'];
104:         }
105: 
106:         array_multisort($sErrors, SORT_ASC, SORT_STRING, $aNameart);
107:     } elseif ($_GET['sort'] == "namecat") {
108: 
109:         foreach ($sErrors as $key => $aRow) {
110:             $aNamecat[$key] = $aRow['namecat'];
111:         }
112: 
113:         array_multisort($sErrors, SORT_ASC, SORT_STRING, $aNamecat);
114:     } elseif ($_GET['sort'] == "wronglink") {
115: 
116:         foreach ($sErrors as $key => $aRow) {
117:             $aWronglink[$key] = $aRow['url'];
118:         }
119: 
120:         array_multisort($sErrors, SORT_ASC, SORT_STRING, $aWronglink);
121:     } elseif ($_GET['sort'] == "error_type") {
122: 
123:         foreach ($sErrors as $key => $aRow) {
124:             $aError_type[$key] = $aRow['error_type'];
125:         }
126: 
127:         array_multisort($sErrors, SORT_ASC, SORT_STRING, $aError_type);
128:     }
129: 
130:     return $sErrors;
131: }
132: 
133: // function url_is_image
134: function url_is_image($sUrl) {
135:     if (cString::getPartOfString($sUrl, -3, 3) == "gif" || cString::getPartOfString($sUrl, -3, 3) == "jpg" || cString::getPartOfString($sUrl, -4, 4) == "jpeg" || cString::getPartOfString($sUrl, -3, 3) == "png" || cString::getPartOfString($sUrl, -3, 3) == "tif" || cString::getPartOfString($sUrl, -3, 3) == "psd" || cString::getPartOfString($sUrl, -3, 3) == "bmp") {
136:         return true;
137:     } else {
138:         return false;
139:     }
140: }
141: 
142: // function url_is_uri
143: function url_is_uri($sUrl) {
144:     if (cString::getPartOfString($sUrl, 0, 4) == "file" || cString::getPartOfString($sUrl, 0, 3) == "ftp" || cString::getPartOfString($sUrl, 0, 4) == "http" || cString::getPartOfString($sUrl, 0, 2) == "ww") {
145:         return true;
146:     } else {
147:         return false;
148:     }
149: }
150: 
151: /* Repaire some selected link */
152: if (!empty($_GET['idcontent']) && !empty($_GET['idartlang']) && !empty($_GET['oldlink']) && !empty($_GET['repairedlink'])) {
153: 
154:     if ($_GET['redirect'] == true) { // Update redirect
155:         $sql = "UPDATE " . $cfg['tab']['art_lang'] . " SET redirect_url = '" . $db->escape(base64_decode($_GET['repairedlink'])) . "' WHERE idartlang = '" . cSecurity::toInteger($_GET['idartlang']) . "'";
156:         $db->query($sql);
157:     } else { // Update content
158: 
159:         // Get old value
160:         $sql = "SELECT value FROM " . $cfg['tab']['content'] . " WHERE idcontent = '" . cSecurity::toInteger($_GET['idcontent']) . "' AND idartlang = '" . cSecurity::toInteger($_GET['idartlang']) . "'";
161:         $db->query($sql);
162:         $db->next_record();
163: 
164:         // Generate new value
165:         $newvalue = str_replace($db->escape(base64_decode($_GET['oldlink'])), $db->escape(base64_decode($_GET['repairedlink'])), $db->f("value"));
166: 
167:         // Update database table with new value
168:         $sql = "UPDATE " . $cfg['tab']['content'] . " SET value = '" . $newvalue . "' WHERE idcontent = '" . cSecurity::toInteger($_GET['idcontent']) . "' AND idartlang = '" . cSecurity::toInteger($_GET['idartlang']) . "'";
169:         $db->query($sql);
170:     }
171: 
172:     // Reset cache
173:     $oCache->remove($aCacheName['errors'], cSecurity::toInteger($_GET['mode']));
174: }
175: 
176: /* Whitelist: Add */
177: if (!empty($_GET['whitelist'])) {
178:     $sql = "REPLACE INTO " . $cfg['tab']['whitelist'] . " VALUES ('" . $db->escape(base64_decode($_GET['whitelist'])) . "', '" . time() . "')";
179:     $db->query($sql);
180: 
181:     $oCache->remove($aCacheName['errors'], cSecurity::toInteger($_GET['mode']));
182: }
183: 
184: /* Whitelist: Get */
185: $sql = "SELECT url FROM " . $cfg['tab']['whitelist'] . " WHERE lastview < " . (time() + $iWhitelistTimeout) . "
186:         AND lastview > " . (time() - $iWhitelistTimeout);
187: $db->query($sql);
188: 
189: $aWhitelist = array();
190: while ($db->nextRecord()) {
191:     $aWhitelist[] = $db->f("url");
192: }
193: 
194: /* Get all links */
195: // Cache errors
196: $sCache_errors = $oCache->get($aCacheName['errors'], cSecurity::toInteger($_GET['mode']));
197: 
198: // Search if cache doesn't exist or we're in live mode
199: if ($sCache_errors && $_GET['live'] != 1) {
200:     $aErrors = unserialize($sCache_errors);
201: } else { // If no cache exists
202: 
203:     // Initializing cLinkCheckerSearchLinks class
204:     $searchLinks = new cLinkcheckerSearchLinks();
205: 
206:     // Select all categorys
207:     $sql = "SELECT idcat FROM " . $cfg['tab']['cat'] . " GROUP BY idcat";
208:     $db->query($sql);
209: 
210:     while ($db->nextRecord()) {
211:         if ($cronjob != true) { // Check userrights, if no cronjob
212:             $iCheck = cCatPerm($db->f("idcat"), $db2);
213: 
214:             if ($iCheck == true) {
215:                 $aCats[] = cSecurity::toInteger($db->f("idcat"));
216:             }
217:         } else {
218:             $aCats[] = cSecurity::toInteger($db->f("idcat"));
219:         }
220:     }
221: 
222:     // Build $aCats-Statement
223:     if (count($aCats) == 0) {
224:         $aCats_Sql = "";
225:     } else {
226:         $aCats_Sql = "AND cat.idcat IN (0, " . join(", ", $aCats) . ")";
227:     }
228: 
229:     // Get languageId
230:     $languageId = cRegistry::getLanguageId();
231: 
232:     // How many articles exist? [Text]
233:     $sql = "SELECT art.title, art.idartlang, art.idlang, cat.idart, cat.idcat, catName.name AS namecat, con.idcontent, con.value FROM " . $cfg['tab']['cat_art'] . " cat
234:             LEFT JOIN " . $cfg['tab']['art_lang'] . " art ON (art.idart = cat.idart)
235:             LEFT JOIN " . $cfg['tab']['cat_lang'] . " catName ON (catName.idcat = cat.idcat)
236:             LEFT JOIN " . $cfg['tab']['content'] . " con ON (con.idartlang = art.idartlang)
237:             WHERE (con.value LIKE '%action%' OR con.value LIKE '%data%' OR con.value LIKE '%href%' OR con.value LIKE '%src%')
238:             " . $aCats_Sql . " AND cat.idcat != '0'
239:             AND art.idlang = '" . cSecurity::toInteger($languageId) . "' AND catName.idlang = '" . cSecurity::toInteger($languageId) . "'
240:             AND art.online = '1' AND art.redirect = '0'";
241:     $db->query($sql);
242: 
243:     while ($db->nextRecord()) {
244:         // Text decode
245:         $value = $db->f("value");
246: 
247:         // Search the text
248:         $aSearchIDInfosNonID = $searchLinks->search($value, $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"), $db->f("idlang"), $db->f("idartlang"), $db->f("idcontent"));
249: 
250:         // Search front_content.php-links
251:         if ($_GET['mode'] != 2) {
252:             searchFrontContentLinks($value, $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"));
253:         }
254:     }
255: 
256:     // How many articles exist? [Redirects]
257:     $sql = "SELECT art.title, art.redirect_url, art.idartlang, art.idlang, cat.idart, cat.idcat, catName.name AS namecat FROM " . $cfg['tab']['cat_art'] . " cat
258:             LEFT JOIN " . $cfg['tab']['art_lang'] . " art ON (art.idart = cat.idart)
259:             LEFT JOIN " . $cfg['tab']['cat_lang'] . " catName ON (catName.idcat = cat.idcat)
260:             WHERE art.online = '1' AND art.redirect = '1' " . $aCats_Sql . "
261:             AND art.idlang = '" . cSecurity::toInteger($languageId) . "' AND catName.idlang = '" . cSecurity::toInteger($languageId) . "'
262:             AND cat.idcat != '0'";
263:     $db->query($sql);
264: 
265:     // Set mode to "redirect"
266:     $searchLinks->setMode("redirect");
267: 
268:     while ($db->nextRecord()) {
269: 
270:         // Search the text
271:         $aSearchIDInfosNonID = $searchLinks->search($db->f("redirect_url"), $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"), $db->f("idlang"), $db->f("idartlang"));
272: 
273:         // Search front_content.php-links
274:         if ($_GET['mode'] != 2) {
275:             searchFrontContentLinks($db->f("redirect_url"), $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"));
276:         }
277:     }
278: 
279:     // Check the links
280:     checkLinks();
281: }
282: 
283: /* Analysis of the errors */
284: // Templateset
285: if ($cronjob != true) {
286:     $tpl->set('s', 'TITLE', i18n('Link analysis from ', $plugin_name) . strftime(i18n('%Y-%m-%d', $plugin_name), time()));
287: }
288: 
289: // If no errors found, say that
290: if (empty($aErrors) && $cronjob != true) {
291:     // Reset cache
292:     $oCache->remove($aCacheName['errors'], cSecurity::toInteger($_GET['mode']));
293: 
294:     $tpl->set('s', 'NO_ERRORS', i18n("<strong>No errors</strong> were found.", $plugin_name));
295:     $tpl->generate($cfg['templates']['linkchecker_noerrors']);
296: } elseif (!empty($aErrors) && $cronjob != true) {
297: 
298:     $tpl->set('s', 'ERRORS_HEADLINE', i18n("Total checked links", $plugin_name));
299:     $tpl->set('s', 'ERRORS_HEADLINE_ARTID', i18n("idart", $plugin_name));
300:     $tpl->set('s', 'ERRORS_HEADLINE_ARTICLE', i18n("Article", $plugin_name));
301:     $tpl->set('s', 'ERRORS_HEADLINE_CATID', i18n("idcat", $plugin_name));
302:     $tpl->set('s', 'ERRORS_HEADLINE_CATNAME', i18n("Category", $plugin_name));
303:     $tpl->set('s', 'ERRORS_HEADLINE_DESCRIPTION', i18n("Description", $plugin_name));
304:     $tpl->set('s', 'ERRORS_HEADLINE_REPAIRED', i18n("Repair", $plugin_name));
305:     $tpl->set('s', 'ERRORS_HEADLINE_LINK', i18n("Linkerror", $plugin_name));
306:     $tpl->set('s', 'ERRORS_HEADLINE_LINKS_ARTICLES', i18n("Links to articles", $plugin_name));
307:     $tpl->set('s', 'ERRORS_HEADLINE_LINKS_CATEGORYS', i18n("Links to categories", $plugin_name));
308:     $tpl->set('s', 'ERRORS_HEADLINE_LINKS_DOCIMAGES', i18n("Links to documents and images", $plugin_name));
309:     $tpl->set('s', 'ERRORS_HEADLINE_OTHERS', i18n("Links to extern sites and not defined links", $plugin_name));
310:     $tpl->set('s', 'ERRORS_HEADLINE_WHITELIST', "Whitelist");
311:     $tpl->set('s', 'ERRORS_HELP_ERRORS', i18n("Wrong links", $plugin_name));
312: 
313:     // error_output initialization
314:     $aError_output = array(
315:         'art' => '',
316:         'cat' => '',
317:         'docimages' => '',
318:         'others' => ''
319:     );
320: 
321:     // Initializing repair class
322:     $repair = new LinkcheckerRepair();
323: 
324:     foreach ($aErrors as $sKey => $aRow) {
325: 
326:         $aRow = linksort($aRow);
327: 
328:         for ($i = 0; $i < count($aRow); $i++) {
329: 
330:             $tpl2 = new cTemplate();
331:             $tpl2->reset();
332: 
333:             // html entities for artname and catname
334:             $aRow[$i]['nameart'] = conHtmlentities($aRow[$i]['nameart']);
335:             $aRow[$i]['namecat'] = conHtmlentities($aRow[$i]['namecat']);
336: 
337:             // set template variables
338:             $tpl2->set('s', 'ERRORS_ARTID', cSecurity::toInteger($aRow[$i]['idart']));
339:             $tpl2->set('s', 'ERRORS_ARTICLE', cSecurity::escapeString($aRow[$i]['nameart']));
340:             $tpl2->set('s', 'ERRORS_ARTICLE_SHORT', cString::getPartOfString($aRow[$i]['nameart'], 0, 20) . ((cString::getStringLength($aRow[$i]['nameart']) > 20) ? ' ...' : ''));
341:             $tpl2->set('s', 'ERRORS_CATID', cSecurity::toInteger($aRow[$i]['idcat']));
342:             $tpl2->set('s', 'ERRORS_LANGARTID', cSecurity::toInteger($aRow[$i]['idartlang']));
343:             $tpl2->set('s', 'ERRORS_LINK', cSecurity::escapeString($aRow[$i]['url']));
344:             $tpl2->set('s', 'ERRORS_LINK_ENCODE', base64_encode($aRow[$i]['url']));
345:             $tpl2->set('s', 'ERRORS_LINK_SHORT', cString::getPartOfString($aRow[$i]['url'], 0, 45) . ((cString::getStringLength($aRow[$i]['url']) > 45) ? ' ...' : ''));
346:             $tpl2->set('s', 'ERRORS_CATNAME', cSecurity::escapeString($aRow[$i]['namecat']));
347:             $tpl2->set('s', 'ERRORS_CATNAME_SHORT', cString::getPartOfString($aRow[$i]['namecat'], 0, 20) . ((cString::getStringLength($aRow[$i]['namecat']) > 20) ? ' ...' : ''));
348:             $tpl2->set('s', 'MODE', cSecurity::toInteger($_GET['mode']));
349:             $tpl2->set('s', 'URL_FRONTEND', $aUrl['cms']);
350: 
351:             if ($aRow[$i]['error_type'] == "unknown") {
352:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE', i18n("Unknown", $plugin_name));
353:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Unknown: articles, documents etc. do not exist.", $plugin_name));
354:             } elseif ($aRow[$i]['error_type'] == "offline") {
355:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE', i18n("Offline", $plugin_name));
356:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name));
357:             } elseif ($aRow[$i]['error_type'] == "startart") {
358:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE', i18n("Offline startarticle", $plugin_name));
359:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name));
360:             } elseif ($aRow[$i]['error_type'] == "dbfs") {
361:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE', i18n("Filemanager", $plugin_name));
362:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("dbfs: no matches found in the dbfs database.", $plugin_name));
363:             } elseif ($aRow[$i]['error_type'] == "invalidurl") {
364:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE', i18n("Invalid url", $plugin_name));
365:                 $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Invalid url, i. e. syntax error.", $plugin_name));
366: 
367:                 // Try to repair this link misstage
368:                 $repaired_link = $repair->checkLink($aRow[$i]['url']);
369:             }
370: 
371:             // Generate repaired link variables
372:             if ($aRow[$i]['error_type'] != "invalidurl") { // No invalid url
373:                                                            // case
374:                 $tpl2->set('s', 'ERRORS_REPAIRED_LINK', '-');
375:             } elseif ($repaired_link == false) { // Linkchecker can not repaire
376:                                                  // this link
377:                 $tpl2->set('s', 'ERRORS_REPAIRED_LINK', i18n("No repaired link", $plugin_name));
378:             } else { // Yeah, we have an repaired link!
379: 
380:                 // Repaired question
381:                 $repaired_question = i18n("Linkchecker has found a way to repair your wrong link. Do you want to automatically repair the link to the URL below?", $plugin_name);
382: 
383:                 $tpl2->set('s', 'ERRORS_REPAIRED_LINK', '<a href="javascript:void(0)" onclick="javascript:Con.showConfirmation(\'' . $repaired_question . '<br /><br /><strong>' . $repaired_link . '</strong>\', function() { window.location.href=\'' . $aUrl['contenido'] . 'main.php?area=linkchecker&frame=4&contenido=' . $sess->id . '&action=linkchecker&mode=' . $_GET['mode'] . '&idcontent=' . $aRow[$i]['idcontent'] . '&idartlang=' . $aRow[$i]['idartlang'] . '&oldlink=' . base64_encode($aRow[$i]['url']) . '&repairedlink=' . base64_encode($repaired_link) . '&redirect=' . $aRow[$i]['redirect'] . '\';})"><img src="' . $aUrl['contenido'] . 'images/but_editlink.gif" alt="" border="0"></a>');
384:             }
385: 
386:             if ($sKey != "cat") {
387:                 $aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors'], 1);
388:             } else {
389:                 // special template for idcats
390:                 $aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors_cat'], 1);
391:             }
392:         }
393:     }
394: 
395:     // Counter
396:     if ($iCounter = $oCache->get($aCacheName['errorscount'], cSecurity::toInteger($_GET['mode']))) {
397:         // Cache exists?
398:         $iErrorsCountChecked = $iCounter;
399:     } else {
400:         // Count searched links: idarts + idcats + idcatarts + others
401:         $iErrorsCountChecked = count($aSearchIDInfosArt) + count($aSearchIDInfosCat) + count($aSearchIDInfosCatArt) + count($aSearchIDInfosNonID);
402:     }
403: 
404:     // Count errors
405:     foreach ($aErrors as $sKey => $aRow) {
406:         $iErrorsCounted += count($aErrors[$sKey]);
407:     }
408: 
409:     $tpl->set('s', 'ERRORS_COUNT_CHECKED', $iErrorsCountChecked);
410:     $tpl->set('s', 'ERRORS_COUNT_ERRORS', $iErrorsCounted);
411:     $tpl->set('s', 'ERRORS_COUNT_ERRORS_PERCENT', round(($iErrorsCounted * 100) / $iErrorsCountChecked, 2));
412: 
413:     /* Template output */
414:     foreach ($aError_output as $sKey => $sValue) {
415: 
416:         if (empty($aError_output[$sKey])) { // Errors for this type?
417:             $tpl2->set('s', 'ERRORS_NOTHING', i18n("No errors for this type.", $plugin_name));
418:             $aError_output[$sKey] = $tpl2->generate($cfg['templates']['linkchecker_test_nothing'], 1);
419:         }
420: 
421:         $tpl->set('s', 'ERRORS_SHOW_' . cString::toUpperCase($sKey), $aError_output[$sKey]);
422: 
423:         if (count($aErrors[$sKey]) > 0) {
424:             $tpl->set('s', 'ERRORS_COUNT_ERRORS_' . cString::toUpperCase($sKey), '<span class="settingWrong">' . count($aErrors[$sKey]) . '</span>');
425:         } else {
426:             $tpl->set('s', 'ERRORS_COUNT_ERRORS_' . cString::toUpperCase($sKey), count($aErrors[$key]));
427:         }
428:     }
429: 
430:     $tpl->generate($cfg['templates']['linkchecker_test']);
431: 
432:     /* Cache */
433:     // Reset cache
434:     $oCache->remove($aCacheName['errors'], cSecurity::toInteger($_GET['mode']));
435: 
436:     // Build new cache
437:     $oCache->save(serialize($aErrors), $aCacheName['errors'], cSecurity::toInteger($_GET['mode']));
438:     $oCache->save($iErrorsCountChecked, $aCacheName['errorscount'], cSecurity::toInteger($_GET['mode']));
439: }
440: 
441: // Log
442: if ($cronjob != true) {
443:     $backend->log(0, 0, cRegistry::getClientId(), cRegistry::getLanguageId(), $action);
444: }
445: 
446: ?>
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0