From dcc1f7f32387bf684903ea05f20324371b81b767 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Fri, 24 Jul 2020 19:30:36 +0200 Subject: [PATCH] work --- cl_plugin.xml | 19 +- includes/config.plugin.php | 2 +- includes/include.checkperms.php | 80 ++-- includes/include.linkchecker.php | 429 +++++++++--------- .../{linkchecker.pot => cl-linkchecker.pot} | 0 .../{linkchecker.mo => cl-linkchecker.mo} | Bin .../{linkchecker.po => cl-linkchecker.po} | 0 .../template.linkchecker_noerrors.html | 69 +-- .../standard/template.linkchecker_test.html | 362 +++++++-------- .../template.linkchecker_whitelist.html | 73 +-- 10 files changed, 520 insertions(+), 514 deletions(-) rename locale/{linkchecker.pot => cl-linkchecker.pot} (100%) rename locale/de_DE/LC_MESSAGES/{linkchecker.mo => cl-linkchecker.mo} (100%) rename locale/de_DE/LC_MESSAGES/{linkchecker.po => cl-linkchecker.po} (100%) diff --git a/cl_plugin.xml b/cl_plugin.xml index 7176811..cfdefb6 100644 --- a/cl_plugin.xml +++ b/cl_plugin.xml @@ -15,6 +15,23 @@ - + + linkchecker + lc_whitelist + + + linkchecker + whitelist_view + + + + + + + + + + + \ No newline at end of file diff --git a/includes/config.plugin.php b/includes/config.plugin.php index 0d50bc4..baf656c 100644 --- a/includes/config.plugin.php +++ b/includes/config.plugin.php @@ -33,7 +33,7 @@ if(!defined('CON_FRAMEWORK')) { } $plugin_name = "linkchecker"; -$cfg['plugins']['linkchecker'] = $cfg['path']['conlite'] . "plugins/" . $plugin_name . "/"; +$cfg['plugins']['linkchecker'] = $cfg['path']['conlite'] . "plugins/" . 'cl-'.$plugin_name . "/"; $cfg['tab']['whitelist'] = $cfg['sql']['sqlprefix'] . '_pi_linkchecker_whitelist'; // Templates diff --git a/includes/include.checkperms.php b/includes/include.checkperms.php index 18488ab..bbdbd32 100644 --- a/includes/include.checkperms.php +++ b/includes/include.checkperms.php @@ -1,4 +1,5 @@ auth['perm'], 'admin') !== FALSE) { - return true; - } - - if (is_null($db) || !is_object($db)) { - $db = new DB_ConLite; - } + if (strpos($auth->auth['perm'], 'admin') !== FALSE) { + return true; + } - $group_ids = getGroupIDs($db); - $group_ids[] = Contenido_Security::escapeDB($auth->auth['uid'], $db); + if (is_null($db) || !is_object($db)) { + $db = new DB_ConLite; + } - if (!is_array($_arrCatIDs_cCP)) { - $_arrCatIDs_cCP = array(); + $group_ids = getGroupIDs($db); + $group_ids[] = Contenido_Security::escapeDB($auth->auth['uid'], $db); - $sql_inc = " user_id='"; - $sql_inc .= implode("' OR user_id='", $group_ids) . "' "; - $sql = "SELECT idcat FROM ".$cfg['tab']['rights']." + if (!is_array($_arrCatIDs_cCP)) { + $_arrCatIDs_cCP = array(); + + $sql_inc = " user_id='"; + $sql_inc .= implode("' OR user_id='", $group_ids) . "' "; + $sql = "SELECT idcat FROM " . $cfg['tab']['rights'] . " WHERE idarea=6 AND idaction=359 AND ($sql_inc)"; - $db->query($sql); - - while ($db->next_record()) { - $_arrCatIDs_cCP[$db->f('idcat')] = ''; - } - } - - return array_key_exists($widcat, $_arrCatIDs_cCP); + $db->query($sql); + + while ($db->next_record()) { + $_arrCatIDs_cCP[$db->f('idcat')] = ''; + } + } + + return array_key_exists($widcat, $_arrCatIDs_cCP); } -function getGroupIDs(&$db) -{ - global $cfg, $sess, $auth, $group_id, $_arrGroupIDs_gGI; +function getGroupIDs(&$db) { + global $cfg, $sess, $auth, $group_id, $_arrGroupIDs_gGI; - if (is_array($_arrGroupIDs_gGI)) { - return $_arrGroupIDs_gGI; - } - - $sql = "SELECT group_id FROM ".$cfg["tab"]["groupmembers"]." WHERE user_id='".Contenido_Security::escapeDB($auth->auth["uid"], $db)."'"; - $db->query($sql); + if (is_array($_arrGroupIDs_gGI)) { + return $_arrGroupIDs_gGI; + } - $_arrGroupIDs_gGI = array(); + $sql = "SELECT group_id FROM " . $cfg["tab"]["groupmembers"] . " WHERE user_id='" . Contenido_Security::escapeDB($auth->auth["uid"], $db) . "'"; + $db->query($sql); - while ($db->next_record()) - $_arrGroupIDs_gGI[] = $db->f('group_id'); + $_arrGroupIDs_gGI = array(); - return $_arrGroupIDs_gGI; + while ($db->next_record()) + $_arrGroupIDs_gGI[] = $db->f('group_id'); + + return $_arrGroupIDs_gGI; } ?> \ No newline at end of file diff --git a/includes/include.linkchecker.php b/includes/include.linkchecker.php index 95ea6b6..1215883 100644 --- a/includes/include.linkchecker.php +++ b/includes/include.linkchecker.php @@ -1,4 +1,5 @@ have_perm_area_action($plugin_name, $plugin_name) && $cronjob != true) { - exit; +if (!$perm->have_perm_area_action($plugin_name, $plugin_name) && $cronjob != true) { + exit; } -if((int) $client == 0 && $cronjob != true) { - $notification->displayNotification("error", i18n("No Client selected")); - exit; +if ((int) $client == 0 && $cronjob != true) { + $notification->displayNotification("error", i18n("No Client selected")); + exit; } // If no mode defined, use mode three -if(empty($_GET['mode'])) { - $_GET['mode'] = 3; +if (empty($_GET['mode'])) { + $_GET['mode'] = 3; } // If no action definied -if(empty($_GET['action'])) { - $_GET['action'] = 'linkchecker'; - $action = "linkchecker"; +if (empty($_GET['action'])) { + $_GET['action'] = 'linkchecker'; + $action = "linkchecker"; } plugin_include('linkchecker', 'includes/config.plugin.php'); @@ -75,16 +75,15 @@ $aSearchIDInfosArt = array(); $aSearchIDInfosCatArt = array(); $aSearchIDInfosNonID = array(); $iWhitelist_timeout = 2592000; // 30 days - // Var initialization $aUrl = array('cms' => $cfgClient[$client]['path']['htmlpath'], 'contenido' => $cfg['path']['contenido_fullhtml']); // Template- and languagevars -if($cronjob != true) { - $tpl->set('s', 'FULLHTML', $aUrl['contenido']); - $tpl->set('s', 'MODE', intval($_GET['mode'])); - $tpl->set('s', 'URL', $aUrl['contenido']); - $tpl->set('s', 'SID', $sess->id); +if ($cronjob != true) { + $tpl->set('s', 'FULLHTML', $aUrl['contenido']); + $tpl->set('s', 'MODE', intval($_GET['mode'])); + $tpl->set('s', 'URL', $aUrl['contenido']); + $tpl->set('s', 'SID', $sess->id); } // Fill Subnav I @@ -105,80 +104,74 @@ $tpl->set('s', 'UPDATE_HREF', $sLink . intval($_GET['mode']) . '&live=1'); $aCacheName = array('errors' => $sess->id, 'errorscount' => $aCacheName['errors'] . "ErrorsCountChecked"); $oCache = new Cache_Lite(array('cacheDir' => $cfgClient[$client]['path']['frontend'] . "cache/", 'caching' => true, 'lifeTime' => 1209600, 'automaticCleaningFactor' => 1)); -/* ********* -Program code -********* */ +/* * ******** + Program code + * ******** */ /* function linksort */ + function linksort($sErrors) { - if($_GET['sort'] == "nameart") { + if ($_GET['sort'] == "nameart") { - foreach($sErrors as $key => $aRow) { - $aNameart[$key] = $aRow['nameart']; - } + foreach ($sErrors as $key => $aRow) { + $aNameart[$key] = $aRow['nameart']; + } - array_multisort($sErrors, SORT_ASC, SORT_STRING, $aNameart); + array_multisort($sErrors, SORT_ASC, SORT_STRING, $aNameart); + } elseif ($_GET['sort'] == "namecat") { - } elseif($_GET['sort'] == "namecat") { + foreach ($sErrors as $key => $aRow) { + $aNamecat[$key] = $aRow['namecat']; + } - foreach($sErrors as $key => $aRow) { - $aNamecat[$key] = $aRow['namecat']; - } + array_multisort($sErrors, SORT_ASC, SORT_STRING, $aNamecat); + } elseif ($_GET['sort'] == "wronglink") { - array_multisort($sErrors, SORT_ASC, SORT_STRING, $aNamecat); + foreach ($sErrors as $key => $aRow) { + $aWronglink[$key] = $aRow['url']; + } - } elseif($_GET['sort'] == "wronglink") { + array_multisort($sErrors, SORT_ASC, SORT_STRING, $aWronglink); + } elseif ($_GET['sort'] == "error_type") { - foreach($sErrors as $key => $aRow) { - $aWronglink[$key] = $aRow['url']; - } + foreach ($sErrors as $key => $aRow) { + $aError_type[$key] = $aRow['error_type']; + } - array_multisort($sErrors, SORT_ASC, SORT_STRING, $aWronglink); - - } elseif($_GET['sort'] == "error_type") { - - foreach($sErrors as $key => $aRow) { - $aError_type[$key] = $aRow['error_type']; - } - - array_multisort($sErrors, SORT_ASC, SORT_STRING, $aError_type); - - } - - return $sErrors; + array_multisort($sErrors, SORT_ASC, SORT_STRING, $aError_type); + } + return $sErrors; } // function url_is_image function url_is_image($sUrl) { - if(substr($sUrl, -3, 3) == "gif" - || substr($sUrl, -3, 3) == "jpg" - || substr($sUrl, -4, 4) == "jpeg" - || substr($sUrl, -3, 3) == "png" - || substr($sUrl, -3, 3) == "tif" - || substr($sUrl, -3, 3) == "psd" - || substr($sUrl, -3, 3) == "bmp") { - return true; - } else { - return false; - } - + if (substr($sUrl, -3, 3) == "gif" + || substr($sUrl, -3, 3) == "jpg" + || substr($sUrl, -4, 4) == "jpeg" + || substr($sUrl, -3, 3) == "png" + || substr($sUrl, -3, 3) == "tif" + || substr($sUrl, -3, 3) == "psd" + || substr($sUrl, -3, 3) == "bmp") { + return true; + } else { + return false; + } } // function url_is_uri function url_is_uri($sUrl) { - if(substr($sUrl, 0, 4) == "file" - || substr($sUrl, 0, 3) == "ftp" - || substr($sUrl, 0, 4) == "http" - || substr($sUrl, 0, 2) == "ww") { - return true; - } else { - return false; - } - + if (substr($sUrl, 0, 4) == "file" + || substr($sUrl, 0, 3) == "ftp" + || substr($sUrl, 0, 4) == "http" + || substr($sUrl, 0, 2) == "ww") { + return true; + } else { + return false; + } } /* Check: Changes after last check? */ @@ -187,9 +180,9 @@ $sql = "SELECT lastmodified FROM " . $cfg['tab']['content'] . " content WHERE art.online = '1'"; /* Whitelist: Add */ -if(!empty($_GET['whitelist'])) { - $sql = "INSERT INTO " . $cfg['tab']['whitelist'] . " VALUES ('" . Contenido_Security::escapeDB(base64_decode($_GET['whitelist']), $db) . "', '" . time() . "')"; - $db->query($sql); +if (!empty($_GET['whitelist'])) { + $sql = "INSERT INTO " . $cfg['tab']['whitelist'] . " VALUES ('" . Contenido_Security::escapeDB(base64_decode($_GET['whitelist']), $db) . "', '" . time() . "')"; + $db->query($sql); } /* Whitelist: Get */ @@ -198,8 +191,8 @@ $sql = "SELECT url FROM " . $cfg['tab']['whitelist'] . " WHERE lastview < " . (t $db->query($sql); $aWhitelist = array(); -while($db->next_record()) { - $aWhitelist[] = $db->f("url"); +while ($db->next_record()) { + $aWhitelist[] = $db->f("url"); } /* Get all links */ @@ -207,207 +200,197 @@ while($db->next_record()) { $sCache_errors = $oCache->get($aCacheName['errors'], intval($_GET['mode'])); // Search if cache doesn't exist or we're in live mode -if($sCache_errors && $_GET['live'] != 1) { - $aErrors = unserialize($sCache_errors); +if ($sCache_errors && $_GET['live'] != 1) { + $aErrors = unserialize($sCache_errors); } else { // If no cache exists + // Select all categorys + $sql = "SELECT idcat FROM " . $cfg['tab']['cat'] . " GROUP BY idcat"; + $db->query($sql); - // Select all categorys - $sql = "SELECT idcat FROM " . $cfg['tab']['cat'] . " GROUP BY idcat"; - $db->query($sql); + while ($db->next_record()) { - while($db->next_record()) { + if ($cronjob != true) { // Check userrights, if no cronjob + $iCheck = cCatPerm($db->f("idcat"), $db2); - if($cronjob != true) { // Check userrights, if no cronjob + if ($iCheck == true) { + $aCats[] = Contenido_Security::toInteger($db->f("idcat")); + } + } else { + $aCats[] = Contenido_Security::toInteger($db->f("idcat")); + } + } - $iCheck = cCatPerm($db->f("idcat"), $db2); - - if($iCheck == true) { - $aCats[] = Contenido_Security::toInteger($db->f("idcat")); - } - - } else { - $aCats[] = Contenido_Security::toInteger($db->f("idcat")); - } - - } - - // Use SQL-WHERE if lang is not zero - if($langart != 0) { - $sLang_where = "AND art.idlang = '" . Contenido_Security::toInteger($langart) . "' AND catName.idlang = '" . Contenido_Security::toInteger($langart) . "'"; - } elseif(!isset($langart)) { - $sLang_where = "AND art.idlang = '" . Contenido_Security::toInteger($lang) . "' AND catName.idlang = '" . Contenido_Security::toInteger($lang) . "'"; - } -if(!empty($aCats)) { - // How many articles exists? [Text] - $sql = "SELECT art.title, art.idlang, cat.idart, cat.idcat, catName.name AS namecat, con.value FROM " . $cfg['tab']['cat_art'] . " cat + // Use SQL-WHERE if lang is not zero + if ($langart != 0) { + $sLang_where = "AND art.idlang = '" . Contenido_Security::toInteger($langart) . "' AND catName.idlang = '" . Contenido_Security::toInteger($langart) . "'"; + } elseif (!isset($langart)) { + $sLang_where = "AND art.idlang = '" . Contenido_Security::toInteger($lang) . "' AND catName.idlang = '" . Contenido_Security::toInteger($lang) . "'"; + } + if (!empty($aCats)) { + // How many articles exists? [Text] + $sql = "SELECT art.title, art.idlang, cat.idart, cat.idcat, catName.name AS namecat, con.value FROM " . $cfg['tab']['cat_art'] . " cat LEFT JOIN " . $cfg['tab']['art_lang'] . " art ON (art.idart = cat.idart) LEFT JOIN " . $cfg['tab']['cat_lang'] . " catName ON (catName.idcat = cat.idcat) LEFT JOIN " . $cfg['tab']['content'] . " con ON (con.idartlang = art.idartlang) WHERE (con.value LIKE '%action%' OR con.value LIKE '%data%' OR con.value LIKE '%href%' OR con.value LIKE '%src%') AND cat.idcat IN (0, " . join(", ", $aCats) . ") AND cat.idcat != '0' " . $sLang_where . " AND art.online = '1' AND art.redirect = '0'"; - $db->query($sql); + $db->query($sql); - while($db->next_record()) { + while ($db->next_record()) { - // Text decode - $value = urldecode($db->f("value")); + // Text decode + $value = urldecode($db->f("value")); - // Search the text - searchLinks($value, $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"), $db->f("idlang")); + // Search the text + searchLinks($value, $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"), $db->f("idlang")); - // Search front_content.php-links - if($_GET['mode'] != 2) { - searchFrontContentLinks($value, $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat")); - } + // Search front_content.php-links + if ($_GET['mode'] != 2) { + searchFrontContentLinks($value, $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat")); + } + } - } - - // How many articles exists? [Redirects] - $sql = "SELECT art.title, art.redirect_url, art.idlang, cat.idart, cat.idcat, catName.name AS namecat FROM " . $cfg['tab']['cat_art'] . " cat + // How many articles exists? [Redirects] + $sql = "SELECT art.title, art.redirect_url, art.idlang, cat.idart, cat.idcat, catName.name AS namecat FROM " . $cfg['tab']['cat_art'] . " cat LEFT JOIN " . $cfg['tab']['art_lang'] . " art ON (art.idart = cat.idart) LEFT JOIN " . $cfg['tab']['cat_lang'] . " catName ON (catName.idcat = cat.idcat) WHERE cat.idcat IN (0, " . join(", ", $aCats) . ") AND cat.idcat != '0' " . $sLang_where . " AND art.online = '1' AND art.redirect = '1'"; - $db->query($sql); + $db->query($sql); - while($db->next_record()) { + while ($db->next_record()) { - // Search links - searchLinks($db->f("redirect_url"), $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"), $db->f("idlang"), "Redirect"); + // Search links + searchLinks($db->f("redirect_url"), $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat"), $db->f("idlang"), "Redirect"); - // Search front_content.php-links - if($_GET['mode'] != 2) { - searchFrontContentLinks($db->f("redirect_url"), $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat")); - } + // Search front_content.php-links + if ($_GET['mode'] != 2) { + searchFrontContentLinks($db->f("redirect_url"), $db->f("idart"), $db->f("title"), $db->f("idcat"), $db->f("namecat")); + } + } - } - - // Check the links - checkLinks(); + // Check the links + checkLinks(); } } /* Analysis of the errors */ // Templateset -if($cronjob != true) { - $tpl->set('s', 'TITLE', i18n('Link analysis from ', $plugin_name) . strftime(i18n('%Y-%m-%d', $plugin_name), time())); +if ($cronjob != true) { + $tpl->set('s', 'TITLE', i18n('Link analysis from ', $plugin_name) . strftime(i18n('%Y-%m-%d', $plugin_name), time())); } // If no errors found, say that -if(empty($aErrors) && $cronjob != true) { - $tpl->set('s', 'NO_ERRORS', i18n("No errors were found.", $plugin_name)); - $tpl->generate($cfg['templates']['linkchecker_noerrors']); -} elseif(!empty($aErrors) && $cronjob != true) { +if (empty($aErrors) && $cronjob != true) { + $tpl->set('s', 'NO_ERRORS', i18n("No errors were found.", $plugin_name)); + $tpl->generate($cfg['templates']['linkchecker_noerrors']); +} elseif (!empty($aErrors) && $cronjob != true) { - $tpl->set('s', 'ERRORS_HEADLINE', i18n("Total checked links", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_ARTID', i18n("idart", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_ARTICLE', i18n("Article", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_CATID', i18n("idcat", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_CATNAME', i18n("Category", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_DESCRIPTION', i18n("Description", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_LINK', i18n("Linkerror", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_LINKS_ARTICLES', i18n("Links to articles", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_LINKS_CATEGORYS', i18n("Links to categories", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_LINKS_DOCIMAGES', i18n("Links to documents and images", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_OTHERS', i18n("Links to extern sites and not defined links", $plugin_name)); - $tpl->set('s', 'ERRORS_HEADLINE_WHITELIST', "Whitelist"); - $tpl->set('s', 'ERRORS_HELP_ERRORS', i18n("Wrong links", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE', i18n("Total checked links", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_ARTID', i18n("idart", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_ARTICLE', i18n("Article", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_CATID', i18n("idcat", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_CATNAME', i18n("Category", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_DESCRIPTION', i18n("Description", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_LINK', i18n("Linkerror", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_LINKS_ARTICLES', i18n("Links to articles", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_LINKS_CATEGORYS', i18n("Links to categories", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_LINKS_DOCIMAGES', i18n("Links to documents and images", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_OTHERS', i18n("Links to extern sites and not defined links", $plugin_name)); + $tpl->set('s', 'ERRORS_HEADLINE_WHITELIST', "Whitelist"); + $tpl->set('s', 'ERRORS_HELP_ERRORS', i18n("Wrong links", $plugin_name)); - // error_output initialization - $aError_output = array('art' => '', 'cat' => '', 'docimages' => '', 'others' => ''); + // error_output initialization + $aError_output = array('art' => '', 'cat' => '', 'docimages' => '', 'others' => ''); - foreach($aErrors as $sKey => $aRow) { + foreach ($aErrors as $sKey => $aRow) { - $aRow = linksort($aRow); + $aRow = linksort($aRow); - for($i = 0; $i < count($aRow); $i++) { + for ($i = 0; $i < count($aRow); $i++) { - $tpl2 = new Template; - $tpl2->reset(); + $tpl2 = new Template; + $tpl2->reset(); - $tpl2->set('s', 'ERRORS_ERROR_TYPE', $aRow[$i]['error_type']); - $tpl2->set('s', 'ERRORS_ARTID', $aRow[$i]['idart']); - $tpl2->set('s', 'ERRORS_ARTICLE', $aRow[$i]['nameart']); - $tpl2->set('s', 'ERRORS_ARTICLE_SHORT', substr($aRow[$i]['nameart'], 0, 20) . ((strlen($aRow[$i]['nameart']) > 20) ? ' ...' : '')); - $tpl2->set('s', 'ERRORS_CATID', $aRow[$i]['idcat']); - $tpl2->set('s', 'ERRORS_LINK', $aRow[$i]['url']); - $tpl2->set('s', 'ERRORS_LINK_ENCODE', base64_encode($aRow[$i]['url'])); - $tpl2->set('s', 'ERRORS_LINK_SHORT', substr($aRow[$i]['url'], 0, 55) . ((strlen($aRow[$i]['url']) > 55) ? ' ...' : '')); - $tpl2->set('s', 'ERRORS_CATNAME', $aRow[$i]['namecat']); - $tpl2->set('s', 'ERRORS_CATNAME_SHORT', substr($aRow[$i]['namecat'], 0, 20) . ((strlen($aRow[$i]['namecat']) > 20) ? ' ...' : '')); - $tpl2->set('s', 'MODE', $_GET['mode']); - $tpl2->set('s', 'URL', $aUrl['contenido']); - $tpl2->set('s', 'SID', $sess->id); + $tpl2->set('s', 'ERRORS_ERROR_TYPE', $aRow[$i]['error_type']); + $tpl2->set('s', 'ERRORS_ARTID', $aRow[$i]['idart']); + $tpl2->set('s', 'ERRORS_ARTICLE', $aRow[$i]['nameart']); + $tpl2->set('s', 'ERRORS_ARTICLE_SHORT', substr($aRow[$i]['nameart'], 0, 20) . ((strlen($aRow[$i]['nameart']) > 20) ? ' ...' : '')); + $tpl2->set('s', 'ERRORS_CATID', $aRow[$i]['idcat']); + $tpl2->set('s', 'ERRORS_LINK', $aRow[$i]['url']); + $tpl2->set('s', 'ERRORS_LINK_ENCODE', base64_encode($aRow[$i]['url'])); + $tpl2->set('s', 'ERRORS_LINK_SHORT', substr($aRow[$i]['url'], 0, 55) . ((strlen($aRow[$i]['url']) > 55) ? ' ...' : '')); + $tpl2->set('s', 'ERRORS_CATNAME', $aRow[$i]['namecat']); + $tpl2->set('s', 'ERRORS_CATNAME_SHORT', substr($aRow[$i]['namecat'], 0, 20) . ((strlen($aRow[$i]['namecat']) > 20) ? ' ...' : '')); + $tpl2->set('s', 'MODE', $_GET['mode']); + $tpl2->set('s', 'URL', $aUrl['contenido']); + $tpl2->set('s', 'SID', $sess->id); - if($aRow[$i]['error_type'] == "unknown") { - $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Unknown: articles, documents etc. do not exist.", $plugin_name)); - } elseif($aRow[$i]['error_type'] == "offline") { - $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name)); - } elseif($aRow[$i]['error_type'] == "startart") { - $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name)); - } elseif($aRow[$i]['error_type'] == "dbfs") { - $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("dbfs: no matches found in the dbfs database.", $plugin_name)); - } + if ($aRow[$i]['error_type'] == "unknown") { + $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Unknown: articles, documents etc. do not exist.", $plugin_name)); + } elseif ($aRow[$i]['error_type'] == "offline") { + $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name)); + } elseif ($aRow[$i]['error_type'] == "startart") { + $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name)); + } elseif ($aRow[$i]['error_type'] == "dbfs") { + $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("dbfs: no matches found in the dbfs database.", $plugin_name)); + } - if($sKey != "cat") { - $aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors'], 1); - } else { - $aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors_cat'], 1); // special template for idcats - } + if ($sKey != "cat") { + $aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors'], 1); + } else { + $aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors_cat'], 1); // special template for idcats + } + } + } - } + /* Counter */ + if ($iCounter = $oCache->get($aCacheName['errorscount'], intval($_GET['mode']))) { // Cache exists? + $iErrors_count_checked = $iCounter; + } else { // Count searched links: idarts + idcats + idcatarts + others + $iErrors_count_checked = count($aSearchIDInfosArt) + count($aSearchIDInfosCat) + count($aSearchIDInfosCatArt) + count($aSearchIDInfosNonID); + } - } + // Count errors + foreach ($aErrors as $sKey => $aRow) { + $iErrors_counted += count($aErrors[$sKey]); + } - /* Counter */ - if($iCounter = $oCache->get($aCacheName['errorscount'], intval($_GET['mode']))) { // Cache exists? - $iErrors_count_checked = $iCounter; - } else { // Count searched links: idarts + idcats + idcatarts + others - $iErrors_count_checked = count($aSearchIDInfosArt) + count($aSearchIDInfosCat) + count($aSearchIDInfosCatArt) + count($aSearchIDInfosNonID); - } + $tpl->set('s', 'ERRORS_COUNT_CHECKED', $iErrors_count_checked); + $tpl->set('s', 'ERRORS_COUNT_ERRORS', $iErrors_counted); + $tpl->set('s', 'ERRORS_COUNT_ERRORS_PERCENT', round(($iErrors_counted * 100) / $iErrors_count_checked, 2)); - // Count errors - foreach($aErrors as $sKey => $aRow) { - $iErrors_counted += count($aErrors[$sKey]); - } + /* Template output */ + foreach ($aError_output as $sKey => $sValue) { - $tpl->set('s', 'ERRORS_COUNT_CHECKED', $iErrors_count_checked); - $tpl->set('s', 'ERRORS_COUNT_ERRORS', $iErrors_counted); - $tpl->set('s', 'ERRORS_COUNT_ERRORS_PERCENT', round(($iErrors_counted * 100) / $iErrors_count_checked, 2)); + if (empty($aError_output[$sKey])) { // Errors for this type? + $tpl2->set('s', 'ERRORS_NOTHING', i18n("No errors for this type.", $plugin_name)); + $aError_output[$sKey] = $tpl2->generate($cfg['templates']['linkchecker_test_nothing'], 1); + } - /* Template output */ - foreach($aError_output as $sKey => $sValue) { + $tpl->set('s', 'ERRORS_SHOW_' . strtoupper($sKey), $aError_output[$sKey]); - if(empty($aError_output[$sKey])) { // Errors for this type? - $tpl2->set('s', 'ERRORS_NOTHING', i18n("No errors for this type.", $plugin_name)); - $aError_output[$sKey] = $tpl2->generate($cfg['templates']['linkchecker_test_nothing'], 1); - } + if (count($aErrors[$sKey]) > 0) { + $tpl->set('s', 'ERRORS_COUNT_ERRORS_' . strtoupper($sKey), '' . count($aErrors[$sKey]) . ''); + } else { + $tpl->set('s', 'ERRORS_COUNT_ERRORS_' . strtoupper($sKey), count($aErrors[$key])); + } + } - $tpl->set('s', 'ERRORS_SHOW_' . strtoupper($sKey), $aError_output[$sKey]); + $tpl->generate($cfg['templates']['linkchecker_test']); - if(count($aErrors[$sKey]) > 0) { - $tpl->set('s', 'ERRORS_COUNT_ERRORS_' . strtoupper($sKey), '' . count($aErrors[$sKey]) . ''); - } else { - $tpl->set('s', 'ERRORS_COUNT_ERRORS_' . strtoupper($sKey), count($aErrors[$key])); - } - - } - - $tpl->generate($cfg['templates']['linkchecker_test']); - - /* Cache */ - // Remove older cache - $oCache->remove($aCacheName['errors'], intval($_GET['mode'])); - - // Build new cache - $oCache->save(serialize($aErrors), $aCacheName['errors'], intval($_GET['mode'])); - $oCache->save($iErrors_count_checked, $aCacheName['errorscount'], intval($_GET['mode'])); + /* Cache */ + // Remove older cache + $oCache->remove($aCacheName['errors'], intval($_GET['mode'])); + // Build new cache + $oCache->save(serialize($aErrors), $aCacheName['errors'], intval($_GET['mode'])); + $oCache->save($iErrors_count_checked, $aCacheName['errorscount'], intval($_GET['mode'])); } // Log -if($cronjob != true) { - $backend->log(0, 0, $client, $lang, $action); +if ($cronjob != true) { + $backend->log(0, 0, $client, $lang, $action); } ?> \ No newline at end of file diff --git a/locale/linkchecker.pot b/locale/cl-linkchecker.pot similarity index 100% rename from locale/linkchecker.pot rename to locale/cl-linkchecker.pot diff --git a/locale/de_DE/LC_MESSAGES/linkchecker.mo b/locale/de_DE/LC_MESSAGES/cl-linkchecker.mo similarity index 100% rename from locale/de_DE/LC_MESSAGES/linkchecker.mo rename to locale/de_DE/LC_MESSAGES/cl-linkchecker.mo diff --git a/locale/de_DE/LC_MESSAGES/linkchecker.po b/locale/de_DE/LC_MESSAGES/cl-linkchecker.po similarity index 100% rename from locale/de_DE/LC_MESSAGES/linkchecker.po rename to locale/de_DE/LC_MESSAGES/cl-linkchecker.po diff --git a/templates/standard/template.linkchecker_noerrors.html b/templates/standard/template.linkchecker_noerrors.html index 82f29dc..e5c8cd0 100644 --- a/templates/standard/template.linkchecker_noerrors.html +++ b/templates/standard/template.linkchecker_noerrors.html @@ -1,36 +1,43 @@ + + + Linkchecker + + - -Linkchecker - - + - + + + + +
+ + {INTERNS_LABEL} + + + {EXTERNS_LABEL} + + + {INTERNS_EXTERNS_LABEL} + +
- - - - -
- {INTERNS_LABEL} - {EXTERNS_LABEL} - {INTERNS_EXTERNS_LABEL} -
+
-
- - - - - - - - - - - -

{TITLE}

- i18n('Refresh') - i18n('Refresh') -
{NO_ERRORS}
- \ No newline at end of file + + + + + + + + + + +

{TITLE}

+ i18n('Refresh') + i18n('Refresh') +
{NO_ERRORS}
+ + \ No newline at end of file diff --git a/templates/standard/template.linkchecker_test.html b/templates/standard/template.linkchecker_test.html index c34d0d8..dc0c81e 100644 --- a/templates/standard/template.linkchecker_test.html +++ b/templates/standard/template.linkchecker_test.html @@ -1,202 +1,202 @@ + - - Linkchecker - - - - - - - - - + + + + - var collapseButton = 'images/close_all.gif'; - var expandButton = 'images/open_all.gif'; - var curTable = document.getElementById(tableId); - var curButton = document.getElementById(tableId+'_img'); + - + var collapseButton = 'images/close_all.gif'; + var expandButton = 'images/open_all.gif'; + var curTable = document.getElementById(tableId); + var curButton = document.getElementById(tableId + '_img'); - + if (curTable.style.display == "inline" || curTable.style.display == "") + { + curTable.style.display = "none"; + curButton.src = expandButton; + } else if (curTable.style.display == "none") + { + curTable.style.display = "inline"; + curButton.src = collapseButton; + } + } + + - - + - + + - - - - -
- {INTERNS_LABEL} - {EXTERNS_LABEL} - {INTERNS_EXTERNS_LABEL} -
+ -
+ + + + +
+ + {INTERNS_LABEL} + + + {EXTERNS_LABEL} + + + {INTERNS_EXTERNS_LABEL} + +
- - - - - - - -

{TITLE}

- i18n('Refresh') - i18n('Refresh') -
+
- - - - - -
{ERRORS_HEADLINE}:{ERRORS_COUNT_CHECKED} - {ERRORS_HELP_ERRORS}: {ERRORS_COUNT_ERRORS} ({ERRORS_COUNT_ERRORS_PERCENT} %)
+ + + + + + + +

{TITLE}

+ i18n('Refresh') + i18n('Refresh') +
+ + + + + + +
{ERRORS_HEADLINE}:{ERRORS_COUNT_CHECKED} + {ERRORS_HELP_ERRORS}: {ERRORS_COUNT_ERRORS} ({ERRORS_COUNT_ERRORS_PERCENT} %)
+
+ + + + + + + + +
{ERRORS_HEADLINE_ARTICLE} (ID){ERRORS_HEADLINE_CATNAME} (ID){ERRORS_HEADLINE_LINK}{ERRORS_HEADLINE_DESCRIPTION}{ERRORS_HEADLINE_WHITELIST}
+
+ + + + +
+ + + + + + +
+ {ERRORS_HEADLINE_LINKS_ARTICLES} ({ERRORS_COUNT_ERRORS_ART}) + + +
+ + +
-
+ + + +
+ + + + + + +
+ {ERRORS_HEADLINE_LINKS_DOCIMAGES} ({ERRORS_COUNT_ERRORS_DOCIMAGES}) + + +
+ + +
- - - - - - - - -
{ERRORS_HEADLINE_ARTICLE} (ID){ERRORS_HEADLINE_CATNAME} (ID){ERRORS_HEADLINE_LINK}{ERRORS_HEADLINE_DESCRIPTION}{ERRORS_HEADLINE_WHITELIST}
+ + + +
+ + + + + + +
+ {ERRORS_HEADLINE_OTHERS} ({ERRORS_COUNT_ERRORS_OTHERS}) + + +
+ + +
-
+ + + + + + + + +
{ERRORS_HEADLINE_CATNAME} (ID){ERRORS_HEADLINE_ARTICLE} (ID){ERRORS_HEADLINE_LINK}{ERRORS_HEADLINE_DESCRIPTION}{ERRORS_HEADLINE_WHITELIST}
- - - -
- - - - - - -
- {ERRORS_HEADLINE_LINKS_ARTICLES} ({ERRORS_COUNT_ERRORS_ART}) - - -
- - -
+ + + +
+ + + + + + +
+ {ERRORS_HEADLINE_LINKS_CATEGORYS} ({ERRORS_COUNT_ERRORS_CAT}) + + +
+ + +
+ + - - - -
- - - - - - -
- {ERRORS_HEADLINE_LINKS_DOCIMAGES} ({ERRORS_COUNT_ERRORS_DOCIMAGES}) - - -
- - -
- - - - - -
- - - - - - -
- {ERRORS_HEADLINE_OTHERS} ({ERRORS_COUNT_ERRORS_OTHERS}) - - -
- - -
- - - - - - - - - - -
{ERRORS_HEADLINE_CATNAME} (ID){ERRORS_HEADLINE_ARTICLE} (ID){ERRORS_HEADLINE_LINK}{ERRORS_HEADLINE_DESCRIPTION}{ERRORS_HEADLINE_WHITELIST}
- - - - - -
- - - - - - -
- {ERRORS_HEADLINE_LINKS_CATEGORYS} ({ERRORS_COUNT_ERRORS_CAT}) - - -
- - -
- - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/templates/standard/template.linkchecker_whitelist.html b/templates/standard/template.linkchecker_whitelist.html index 5709541..206464a 100644 --- a/templates/standard/template.linkchecker_whitelist.html +++ b/templates/standard/template.linkchecker_whitelist.html @@ -1,51 +1,52 @@ + - - Linkchecker - - - - + + Linkchecker + + + + - + - + - - - - - - - -

{TITLE}

{HELP}
+ + + + + + + +

{TITLE}

{HELP}
-
+
- +
- - - - - + + + + + -
{HEADLINE_URLS} ({WHITELIST_COUNT}){HEADLINE_ENTRY}{HEADLINE_DELETE}
{HEADLINE_URLS} ({WHITELIST_COUNT}){HEADLINE_ENTRY}{HEADLINE_DELETE}
+ -
+
- +
- {WHITELIST} - -
+ {WHITELIST} -
+ - - - - -
+
- \ No newline at end of file + + + + +
+ + \ No newline at end of file