work
Dieser Commit ist enthalten in:
Ursprung
dcc1f7f323
Commit
dc11334aaf
1 geänderte Dateien mit 165 neuen und 192 gelöschten Zeilen
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -31,8 +32,7 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -41,16 +41,14 @@ function checkLinks() {
|
|||
global $auth, $cfgClient, $client, $cfg, $cronjob, $db, $aErrors, $lang, $langart, $whitelist;
|
||||
global $aSearchIDInfosArt, $aSearchIDInfosCat, $aSearchIDInfosCatArt, $aSearchIDInfosNonID;
|
||||
|
||||
if(count($aSearchIDInfosArt) > 0) { // Checks idarts
|
||||
if (count($aSearchIDInfosArt) > 0) { // Checks idarts
|
||||
for ($i = 0; $i < count($aSearchIDInfosArt); $i++) {
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosArt); $i++) {
|
||||
|
||||
if($i == 0) {
|
||||
if ($i == 0) {
|
||||
$sSearch = Contenido_Security::toInteger($aSearchIDInfosArt[$i]['id']);
|
||||
} else {
|
||||
$sSearch .= ", " . Contenido_Security::toInteger($aSearchIDInfosArt[$i]['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check articles
|
||||
|
@ -58,38 +56,34 @@ function checkLinks() {
|
|||
$sql = "SELECT idart, online FROM " . $cfg['tab']['art_lang'] . " WHERE idart IN (" . $sSearch . ")";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
while ($db->next_record()) {
|
||||
$aFind[$db->f("idart")] = array("online" => $db->f("online"));
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosArt); $i++) {
|
||||
for ($i = 0; $i < count($aSearchIDInfosArt); $i++) {
|
||||
|
||||
if(isset($aFind[$aSearchIDInfosArt[$i]['id']]) && $aFind[$aSearchIDInfosArt[$i]['id']]['online'] == 0) {
|
||||
if (isset($aFind[$aSearchIDInfosArt[$i]['id']]) && $aFind[$aSearchIDInfosArt[$i]['id']]['online'] == 0) {
|
||||
$aErrors['art'][] = array_merge($aSearchIDInfosArt[$i], array("error_type" => "offline"));
|
||||
} elseif(!isset($aFind[$aSearchIDInfosArt[$i]['id']])) {
|
||||
} elseif (!isset($aFind[$aSearchIDInfosArt[$i]['id']])) {
|
||||
$aErrors['art'][] = array_merge($aSearchIDInfosArt[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$int_cnt_aSearchIDInfosCat = 0;
|
||||
|
||||
if(is_countable($aSearchIDInfosCat)) {
|
||||
if (is_countable($aSearchIDInfosCat)) {
|
||||
$int_cnt_aSearchIDInfosCat = count($aSearchIDInfosCat);
|
||||
}
|
||||
|
||||
if($int_cnt_aSearchIDInfosCat > 0) { // Checks idcats
|
||||
if ($int_cnt_aSearchIDInfosCat > 0) { // Checks idcats
|
||||
for ($i = 0; $i < $int_cnt_aSearchIDInfosCat; $i++) {
|
||||
|
||||
for($i = 0; $i < $int_cnt_aSearchIDInfosCat; $i++) {
|
||||
|
||||
if($i == 0) {
|
||||
if ($i == 0) {
|
||||
$sSearch = $aSearchIDInfosCat[$i]['id'];
|
||||
} else {
|
||||
$sSearch .= ", " . $aSearchIDInfosCat[$i]['id'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check categorys
|
||||
|
@ -97,45 +91,40 @@ function checkLinks() {
|
|||
$sql = "SELECT idcat, startidartlang, visible FROM " . $cfg['tab']['cat_lang'] . " WHERE idcat IN (" . $sSearch . ") AND idlang = '" . Contenido_Security::toInteger($lang) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
while ($db->next_record()) {
|
||||
$aFind[$db->f("idcat")] = array("online" => $db->f("visible"), "startidart" => $db->f("startidartlang"));
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosCat); $i++) {
|
||||
for ($i = 0; $i < count($aSearchIDInfosCat); $i++) {
|
||||
|
||||
if(is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['startidart'] == 0) {
|
||||
if (is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['startidart'] == 0) {
|
||||
$aErrors['cat'][] = array_merge($aSearchIDInfosCat[$i], array("error_type" => "startart"));
|
||||
} elseif(is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['online'] == 0) {
|
||||
} elseif (is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['online'] == 0) {
|
||||
$aErrors['cat'][] = array_merge($aSearchIDInfosCat[$i], array("error_type" => "offline"));
|
||||
} elseif(!is_array($aFind[$aSearchIDInfosCat[$i]['id']])) {
|
||||
} elseif (!is_array($aFind[$aSearchIDInfosCat[$i]['id']])) {
|
||||
$aErrors['cat'][] = array_merge($aSearchIDInfosCat[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
if(is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['startidart'] != 0) {
|
||||
if (is_array($aFind[$aSearchIDInfosCat[$i]['id']]) && $aFind[$aSearchIDInfosCat[$i]['id']]['startidart'] != 0) {
|
||||
|
||||
$sql = "SELECT idart FROM " . $cfg['tab']['art_lang'] . " WHERE idartlang = '" . $aFind[$aSearchIDInfosCat[$i]['id']]['startidart'] . "' AND online = '1'";
|
||||
$db->query($sql);
|
||||
|
||||
if($db->num_rows() == 0) {
|
||||
if ($db->num_rows() == 0) {
|
||||
$aErrors['cat'][] = array_merge($aSearchIDInfosCat[$i], array("error_type" => "startart"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (count($aSearchIDInfosCatArt) > 0) { // Checks idcatarts
|
||||
for ($i = 0; $i < count($aSearchIDInfosCatArt); $i++) {
|
||||
|
||||
}
|
||||
|
||||
if(count($aSearchIDInfosCatArt) > 0) { // Checks idcatarts
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosCatArt); $i++) {
|
||||
|
||||
if($i == 0) {
|
||||
if ($i == 0) {
|
||||
$sSearch = Contenido_Security::toInteger($aSearchIDInfosCatArt[$i]['id']);
|
||||
} else {
|
||||
$sSearch .= ", " . Contenido_Security::toInteger($aSearchIDInfosCatArt[$i]['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check articles
|
||||
|
@ -143,59 +132,53 @@ function checkLinks() {
|
|||
$sql = "SELECT idcatart FROM " . $cfg['tab']['cat_art'] . " WHERE idcatart IN (" . $sSearch . ")";
|
||||
$db->query($sql);
|
||||
|
||||
while($db->next_record()) {
|
||||
while ($db->next_record()) {
|
||||
$aFind[] = $db->f("idcatart");
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosCatArt); $i++) {
|
||||
for ($i = 0; $i < count($aSearchIDInfosCatArt); $i++) {
|
||||
|
||||
if(!in_array($aSearchIDInfosCatArt[$i]['id'], $aFind)) {
|
||||
if (!in_array($aSearchIDInfosCatArt[$i]['id'], $aFind)) {
|
||||
$aErrors['art'][] = array_merge($aSearchIDInfosCatArt[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(count($aSearchIDInfosNonID) != 0) { // Checks other links (e. g. http, www, dfbs)
|
||||
|
||||
if (count($aSearchIDInfosNonID) != 0) { // Checks other links (e. g. http, www, dfbs)
|
||||
// Select userrights (is the user admin or sysadmin?)
|
||||
$sql = "SELECT username FROM " . $cfg['tab']['phplib_auth_user_md5'] . " WHERE user_id='" . Contenido_Security::escapeDB($auth->auth['uid'], $db) . "' AND perms LIKE '%admin%'";
|
||||
$db->query($sql);
|
||||
|
||||
if($db->num_rows() > 0 || $cronjob == true) { // User is admin when he is or when he run the cronjob
|
||||
if ($db->num_rows() > 0 || $cronjob == true) { // User is admin when he is or when he run the cronjob
|
||||
$iAdmin = true;
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($aSearchIDInfosNonID); $i++) {
|
||||
for ($i = 0; $i < count($aSearchIDInfosNonID); $i++) {
|
||||
|
||||
if(url_is_uri($aSearchIDInfosNonID[$i]['url'])) {
|
||||
if (url_is_uri($aSearchIDInfosNonID[$i]['url'])) {
|
||||
|
||||
if(substr($aSearchIDInfosNonID[$i]['url'], 0, strlen($aSearchIDInfosNonID[$i]['url'])) == $cfgClient[$client]['path']['htmlpath']) {
|
||||
if (substr($aSearchIDInfosNonID[$i]['url'], 0, strlen($aSearchIDInfosNonID[$i]['url'])) == $cfgClient[$client]['path']['htmlpath']) {
|
||||
$iPing = @file_exists(str_replace($cfgClient[$client]['path']['htmlpath'], $cfgClient[$client]['path']['frontend'], $aSearchIDInfosNonID[$i]['url']));
|
||||
} else {
|
||||
$iPing = @fopen($aSearchIDInfosNonID[$i]['url'], 'r');
|
||||
}
|
||||
|
||||
if(!$iPing) {
|
||||
if (!$iPing) {
|
||||
|
||||
if(url_is_image($aSearchIDInfosNonID[$i]['url'])) {
|
||||
if (url_is_image($aSearchIDInfosNonID[$i]['url'])) {
|
||||
$aErrors['docimages'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
} else {
|
||||
$aErrors['others'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif(substr($aSearchIDInfosNonID[$i]['url'], strlen($aSearchIDInfosNonID[$i]['url'])-5, 5) == ".html") {
|
||||
} elseif (substr($aSearchIDInfosNonID[$i]['url'], strlen($aSearchIDInfosNonID[$i]['url']) - 5, 5) == ".html") {
|
||||
|
||||
$iPing = @file_exists($cfgClient[$client]['path']['htmlpath'] . $aSearchIDInfosNonID[$i]['url']);
|
||||
|
||||
if(!$iPing) {
|
||||
if (!$iPing) {
|
||||
$aErrors['art'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
} elseif(substr($aSearchIDInfosNonID[$i]['url'], 0, 20) == "dbfs.php?file=dbfs:/") {
|
||||
} elseif (substr($aSearchIDInfosNonID[$i]['url'], 0, 20) == "dbfs.php?file=dbfs:/") {
|
||||
|
||||
$sDBurl = substr($aSearchIDInfosNonID[$i]['url'], 20, strlen($aSearchIDInfosNonID[$i]['url']));
|
||||
|
||||
|
@ -207,30 +190,24 @@ function checkLinks() {
|
|||
$sql = "SELECT iddbfs FROM " . $cfg['tab']['dbfs'] . " WHERE dirname IN('" . $sDirname . "', '" . clHtmlEntityDecode($sDirname) . "', '" . urldecode($sDirname) . "') AND filename = '" . $sFilename . "'";
|
||||
$db->query($sql);
|
||||
|
||||
if($db->num_rows() == 0) {
|
||||
if ($db->num_rows() == 0) {
|
||||
$aErrors['docimages'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "dbfs"));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(!file_exists($cfgClient[$client]['path']['frontend'] . $aSearchIDInfosNonID[$i]['url'])) {
|
||||
if (!file_exists($cfgClient[$client]['path']['frontend'] . $aSearchIDInfosNonID[$i]['url'])) {
|
||||
|
||||
if(url_is_image($aSearchIDInfosNonID[$i]['url'])) {
|
||||
if (url_is_image($aSearchIDInfosNonID[$i]['url'])) {
|
||||
$aErrors['docimages'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
} else {
|
||||
$aErrors['others'][] = array_merge($aSearchIDInfosNonID[$i], array("error_type" => "unknown"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $aErrors;
|
||||
|
||||
}
|
||||
|
||||
// Searchs front_content.php-links
|
||||
|
@ -279,20 +256,18 @@ function searchLinks($sValue, $iArt, $sArt, $iCat, $sCat, $iLang, $sFromtype = "
|
|||
global $aUrl, $aSearchIDInfosNonID, $aWhitelist;
|
||||
|
||||
// Extern URL
|
||||
if(preg_match_all('~(?:(?:action|data|href|src)=["\']((?:file|ftp|http|ww)[^\s]*)["\'])~i', $sValue, $aMatches) && $_GET['mode'] != 1) {
|
||||
if (preg_match_all('~(?:(?:action|data|href|src)=["\']((?:file|ftp|http|ww)[^\s]*)["\'])~i', $sValue, $aMatches) && $_GET['mode'] != 1) {
|
||||
|
||||
for($i = 0; $i < count($aMatches[1]); $i++) {
|
||||
for ($i = 0; $i < count($aMatches[1]); $i++) {
|
||||
|
||||
if(!in_array($aMatches[1][$i], $aWhitelist)) {
|
||||
if (!in_array($aMatches[1][$i], $aWhitelist)) {
|
||||
$aSearchIDInfosNonID[] = array("url" => $aMatches[1][$i], "idart" => $iArt, "nameart" => $sArt, "idcat" => $iCat, "namecat" => $sCat, "lang" => $iLang, "urltype" => "extern");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Redirect
|
||||
if($sFromtype == "Redirect" && (preg_match('!(' . preg_quote($aUrl['cms']) . '[^\s]*)!i', $sValue, $aMatches)
|
||||
if ($sFromtype == "Redirect" && (preg_match('!(' . preg_quote($aUrl['cms']) . '[^\s]*)!i', $sValue, $aMatches)
|
||||
|| (preg_match('~(?:file|ftp|http|ww)[^\s]*~i', $sValue, $aMatches) && $_GET['mode'] != 1))
|
||||
&& (stripos($sValue, 'front_content.php') === false)
|
||||
&& !in_array($aMatches[0], $aWhitelist)) {
|
||||
|
@ -300,17 +275,15 @@ function searchLinks($sValue, $iArt, $sArt, $iCat, $sCat, $iLang, $sFromtype = "
|
|||
}
|
||||
|
||||
// Intern URL
|
||||
if(preg_match_all('~(?:(?:action|data|href|src)=["\'])(?!file://)(?!ftp://)(?!http://)(?!https://)(?!ww)(?!mailto)(?!\#)(?!/\#)([^"\']+)(?:["\'])~i', $sValue, $aMatches) && $_GET['mode'] != 2) {
|
||||
if (preg_match_all('~(?:(?:action|data|href|src)=["\'])(?!file://)(?!ftp://)(?!http://)(?!https://)(?!ww)(?!mailto)(?!\#)(?!/\#)([^"\']+)(?:["\'])~i', $sValue, $aMatches) && $_GET['mode'] != 2) {
|
||||
|
||||
for($i = 0; $i < count($aMatches[1]); $i++) {
|
||||
for ($i = 0; $i < count($aMatches[1]); $i++) {
|
||||
|
||||
if(strpos($aMatches[1][$i], "front_content.php") === false && !in_array($aMatches[1][$i], $aWhitelist)) {
|
||||
if (strpos($aMatches[1][$i], "front_content.php") === false && !in_array($aMatches[1][$i], $aWhitelist)) {
|
||||
$aSearchIDInfosNonID[] = array("url" => $aMatches[1][$i], "idart" => $iArt, "nameart" => $sArt, "idcat" => $iCat, "namecat" => $sCat, "lang" => $iLang, "urltype" => "intern");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Laden …
In neuem Issue referenzieren