updates for PHP 7.3
Dieser Commit ist enthalten in:
Ursprung
e3ace87155
Commit
a0ea0e7255
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project:
|
* Project:
|
||||||
* Contenido Content Management System
|
* Contenido Content Management System
|
||||||
|
@ -17,15 +18,12 @@
|
||||||
*
|
*
|
||||||
* $Id$:
|
* $Id$:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('CON_FRAMEWORK')) {
|
if (!defined('CON_FRAMEWORK')) {
|
||||||
die('Illegal call');
|
die('Illegal call');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// create Navigation array for one level
|
// create Navigation array for one level
|
||||||
function createNavigationArray($start_id, $db)
|
function createNavigationArray($start_id, $db) {
|
||||||
{
|
|
||||||
global $user, $cfg, $client, $lang, $auth;
|
global $user, $cfg, $client, $lang, $auth;
|
||||||
|
|
||||||
$navigation = array();
|
$navigation = array();
|
||||||
|
@ -52,8 +50,7 @@ function createNavigationArray($start_id, $db)
|
||||||
A.idtree";
|
A.idtree";
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
|
|
||||||
while($db->next_record())
|
while ($db->next_record()) {
|
||||||
{
|
|
||||||
$cat_id = $db->f("idcat");
|
$cat_id = $db->f("idcat");
|
||||||
$cat_idlang = $db->f("idcatlang");
|
$cat_idlang = $db->f("idcatlang");
|
||||||
$visible = false;
|
$visible = false;
|
||||||
|
@ -89,7 +86,6 @@ function createNavigationArray($start_id, $db)
|
||||||
return $navigation;
|
return $navigation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return target of a given category id
|
* Return target of a given category id
|
||||||
*
|
*
|
||||||
|
@ -124,7 +120,6 @@ function getTarget($cat_id, $db) {
|
||||||
/**
|
/**
|
||||||
* Return true if $parentid is parent of $catid
|
* Return true if $parentid is parent of $catid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isParent($parentid, $catid, $db) {
|
function isParent($parentid, $catid, $db) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,12 +141,9 @@ function isParent($parentid, $catid, $db) {
|
||||||
|
|
||||||
$pre = $db->f("parentid");
|
$pre = $db->f("parentid");
|
||||||
|
|
||||||
if($parentid == $pre)
|
if ($parentid == $pre) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,18 +166,14 @@ function getParent($preid, &$db) {
|
||||||
|
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
|
|
||||||
if ($db->next_record())
|
if ($db->next_record()) {
|
||||||
{
|
|
||||||
return $db->f("parentid");
|
return $db->f("parentid");
|
||||||
}else
|
} else {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLevel($catid, &$db)
|
function getLevel($catid, &$db) {
|
||||||
{
|
|
||||||
global $cfg, $client, $lang;
|
global $cfg, $client, $lang;
|
||||||
|
|
||||||
// SECURITY-FIX
|
// SECURITY-FIX
|
||||||
|
@ -198,17 +186,13 @@ function getLevel($catid, &$db)
|
||||||
|
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
|
|
||||||
if ($db->next_record())
|
if ($db->next_record()) {
|
||||||
{
|
|
||||||
return $db->f("level");
|
return $db->f("level");
|
||||||
}else
|
} else {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return path of a given category up to a certain level
|
* Return path of a given category up to a certain level
|
||||||
*/
|
*/
|
||||||
|
@ -219,63 +203,47 @@ function getCategoryPath($cat_id, $level, $reverse = true, &$db) {
|
||||||
|
|
||||||
$parent_id = $cat_id;
|
$parent_id = $cat_id;
|
||||||
|
|
||||||
while (getLevel($parent_id, $db) != false AND getLevel($parent_id, $db) > $level AND getLevel($parent_id, $db) >= 0)
|
while (getLevel($parent_id, $db) != false AND getLevel($parent_id, $db) > $level AND getLevel($parent_id, $db) >= 0) {
|
||||||
{
|
|
||||||
|
|
||||||
$parent_id = getParent($parent_id, $db);
|
$parent_id = getParent($parent_id, $db);
|
||||||
if ($parent_id != false)
|
if ($parent_id != false) {
|
||||||
{
|
|
||||||
array_push($root_path, $parent_id);
|
array_push($root_path, $parent_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reverse == true)
|
if ($reverse == true) {
|
||||||
{
|
|
||||||
$root_path = array_reverse($root_path);
|
$root_path = array_reverse($root_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $root_path;
|
return $root_path;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return location string of a given category
|
* Return location string of a given category
|
||||||
*/
|
*/
|
||||||
function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sTextStyleClass, $fullweblink = false, $reverse = true, $mod_rewrite = true, $db)
|
function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sTextStyleClass, $fullweblink = false, $reverse = true, $mod_rewrite = true, $db) {
|
||||||
{
|
|
||||||
global $sess, $cfgClient, $client;
|
global $sess, $cfgClient, $client;
|
||||||
|
|
||||||
$aCatPath = getCategoryPath($iStartCat, $level, $reverse, $db);
|
$aCatPath = getCategoryPath($iStartCat, $level, $reverse, $db);
|
||||||
|
|
||||||
if(is_array($aCatPath) AND count($aCatPath) > 0)
|
if (is_array($aCatPath) AND count($aCatPath) > 0) {
|
||||||
{
|
|
||||||
$aLocation = array();
|
$aLocation = array();
|
||||||
foreach($aCatPath as $value)
|
foreach ($aCatPath as $value) {
|
||||||
{
|
if (!$fullweblink) {
|
||||||
if (!$fullweblink)
|
if ($mod_rewrite == true) {
|
||||||
{
|
|
||||||
if ($mod_rewrite == true)
|
|
||||||
{
|
|
||||||
$linkUrl = $sess->url("index-a-$value.html");
|
$linkUrl = $sess->url("index-a-$value.html");
|
||||||
}else
|
} else {
|
||||||
{
|
|
||||||
$linkUrl = $sess->url("front_content.php?idcat=$value");
|
$linkUrl = $sess->url("front_content.php?idcat=$value");
|
||||||
}
|
}
|
||||||
}else
|
} else {
|
||||||
{
|
if ($mod_rewrite == true) {
|
||||||
if ($mod_rewrite == true)
|
|
||||||
{
|
|
||||||
$linkUrl = $sess->url($cfgClient[$client]["path"]["htmlpath"] . "index-a-$value.html");
|
$linkUrl = $sess->url($cfgClient[$client]["path"]["htmlpath"] . "index-a-$value.html");
|
||||||
}else
|
} else {
|
||||||
{
|
|
||||||
$linkUrl = $sess->url($cfgClient[$client]["path"]["htmlpath"] . "front_content.php?idcat=$value");
|
$linkUrl = $sess->url($cfgClient[$client]["path"]["htmlpath"] . "front_content.php?idcat=$value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$name = getCategoryName($value, $db);
|
$name = getCategoryName($value, $db);
|
||||||
$aLocation[] = '<a href="' . $linkUrl . '" class="' . $sLinkStyleClass . '"><nobr>' . $name . '</nobr></a>';
|
$aLocation[] = '<a href="' . $linkUrl . '" class="' . $sLinkStyleClass . '"><nobr>' . $name . '</nobr></a>';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +254,6 @@ function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sT
|
||||||
return $sLocation;
|
return $sLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* get subtree by a given id
|
* get subtree by a given id
|
||||||
|
@ -296,9 +263,7 @@ function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sT
|
||||||
*
|
*
|
||||||
* @copyright four for business AG <www.4fb.de>
|
* @copyright four for business AG <www.4fb.de>
|
||||||
*/
|
*/
|
||||||
|
function getSubTree($idcat_start, $db) {
|
||||||
function getSubTree($idcat_start, $db)
|
|
||||||
{
|
|
||||||
global $client, $cfg;
|
global $client, $cfg;
|
||||||
|
|
||||||
// SECURITY-FIX
|
// SECURITY-FIX
|
||||||
|
@ -317,14 +282,11 @@ function getSubTree($idcat_start, $db)
|
||||||
|
|
||||||
$subCats = false;
|
$subCats = false;
|
||||||
$curLevel = 0;
|
$curLevel = 0;
|
||||||
while ($db->next_record())
|
while ($db->next_record()) {
|
||||||
{
|
if ($db->f("idcat") == $idcat_start) {
|
||||||
if ($db->f("idcat") == $idcat_start)
|
|
||||||
{
|
|
||||||
$curLevel = $db->f("level");
|
$curLevel = $db->f("level");
|
||||||
$subCats = true;
|
$subCats = true;
|
||||||
} else if ($db->f("level") <= $curLevel) // ending part of tree
|
} else if ($db->f("level") <= $curLevel) { // ending part of tree
|
||||||
{
|
|
||||||
$subCats = false;
|
$subCats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,8 +297,7 @@ function getSubTree($idcat_start, $db)
|
||||||
return $deeper_cats;
|
return $deeper_cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTeaserDeeperCategories($iIdcat, $db)
|
function getTeaserDeeperCategories($iIdcat, $db) {
|
||||||
{
|
|
||||||
global $client, $cfg, $lang;
|
global $client, $cfg, $lang;
|
||||||
|
|
||||||
// SECURITY-FIX
|
// SECURITY-FIX
|
||||||
|
@ -359,12 +320,10 @@ function getTeaserDeeperCategories($iIdcat, $db)
|
||||||
$subCats = false;
|
$subCats = false;
|
||||||
$curLevel = 0;
|
$curLevel = 0;
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
if ($db->f("idcat") == $iIdcat)
|
if ($db->f("idcat") == $iIdcat) {
|
||||||
{
|
|
||||||
$curLevel = $db->f("level");
|
$curLevel = $db->f("level");
|
||||||
$subCats = true;
|
$subCats = true;
|
||||||
} else if ($curLevel == $db->f("level")) // ending part of tree
|
} else if ($curLevel == $db->f("level")) { // ending part of tree
|
||||||
{
|
|
||||||
$subCats = false;
|
$subCats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,9 +343,7 @@ function getTeaserDeeperCategories($iIdcat, $db)
|
||||||
*
|
*
|
||||||
* @copyright four for business AG <www.4fb.de>
|
* @copyright four for business AG <www.4fb.de>
|
||||||
*/
|
*/
|
||||||
|
function getProtectedSubTree($idcat_start, $db) {
|
||||||
function getProtectedSubTree($idcat_start, $db)
|
|
||||||
{
|
|
||||||
global $client, $cfg, $lang;
|
global $client, $cfg, $lang;
|
||||||
|
|
||||||
// SECURITY-FIX
|
// SECURITY-FIX
|
||||||
|
@ -411,12 +368,10 @@ function getProtectedSubTree($idcat_start, $db)
|
||||||
$subCats = false;
|
$subCats = false;
|
||||||
$curLevel = 0;
|
$curLevel = 0;
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
if ($db->f("idcat") == $idcat_start)
|
if ($db->f("idcat") == $idcat_start) {
|
||||||
{
|
|
||||||
$curLevel = $db->f("level");
|
$curLevel = $db->f("level");
|
||||||
$subCats = true;
|
$subCats = true;
|
||||||
} else if ($curLevel == $db->f("level")) // ending part of tree
|
} else if ($curLevel == $db->f("level")) { // ending part of tree
|
||||||
{
|
|
||||||
$subCats = false;
|
$subCats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,12 +382,9 @@ function getProtectedSubTree($idcat_start, $db)
|
||||||
return $deeper_cats;
|
return $deeper_cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return category name
|
* Return category name
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getCategoryName($cat_id, &$db) {
|
function getCategoryName($cat_id, &$db) {
|
||||||
|
|
||||||
global $cfg, $client, $lang;
|
global $cfg, $client, $lang;
|
||||||
|
@ -452,17 +404,15 @@ function getCategoryName($cat_id, &$db) {
|
||||||
|
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
|
|
||||||
if ($db->next_record())
|
if ($db->next_record()) {
|
||||||
{
|
|
||||||
$cat_name = $db->f("name");
|
$cat_name = $db->f("name");
|
||||||
return $cat_name;
|
return $cat_name;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // end function
|
// end function
|
||||||
|
|
||||||
// get direct subcategories of a given category
|
// get direct subcategories of a given category
|
||||||
function getSubCategories($parent_id, $db) {
|
function getSubCategories($parent_id, $db) {
|
||||||
|
@ -494,13 +444,12 @@ function getSubCategories($parent_id, $db) {
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
|
|
||||||
$subcategories[] = $db->f("idcat");
|
$subcategories[] = $db->f("idcat");
|
||||||
|
|
||||||
} // end while
|
} // end while
|
||||||
|
|
||||||
return $subcategories;
|
return $subcategories;
|
||||||
|
}
|
||||||
|
|
||||||
} // end function
|
// end function
|
||||||
|
|
||||||
|
|
||||||
// get direct subcategories with protected categories
|
// get direct subcategories with protected categories
|
||||||
function getProtectedSubCategories($parent_id, $db) {
|
function getProtectedSubCategories($parent_id, $db) {
|
||||||
|
@ -531,25 +480,26 @@ function getProtectedSubCategories($parent_id, $db) {
|
||||||
while ($db->next_record()) {
|
while ($db->next_record()) {
|
||||||
|
|
||||||
$subcategories[] = $db->f("idcat");
|
$subcategories[] = $db->f("idcat");
|
||||||
|
|
||||||
} // end while
|
} // end while
|
||||||
|
|
||||||
return $subcategories;
|
return $subcategories;
|
||||||
|
}
|
||||||
|
|
||||||
} // end function
|
// end function
|
||||||
|
|
||||||
function checkCatPermission($idcatlang, $public) {
|
function checkCatPermission($idcatlang, $public) {
|
||||||
#Check if current user has permissions to access cat
|
#Check if current user has permissions to access cat
|
||||||
|
|
||||||
global $auth;
|
global $auth;
|
||||||
|
|
||||||
$oDB = new DB_Contenido;
|
$oDB = new DB_ConLite();
|
||||||
|
|
||||||
$FrontendPermissionCollection = new FrontendPermissionCollection;
|
$FrontendPermissionCollection = new FrontendPermissionCollection;
|
||||||
$visible = false;
|
$visible = false;
|
||||||
|
|
||||||
if ($public != 0) {
|
if ($public != 0) {
|
||||||
$visible = true;
|
$visible = true;
|
||||||
|
$groups = array();
|
||||||
} elseif (($auth->auth['uid'] != '') && ($auth->auth['uid'] != 'nobody')) {
|
} elseif (($auth->auth['uid'] != '') && ($auth->auth['uid'] != 'nobody')) {
|
||||||
$FrontendGroupMemberCollection = new FrontendGroupMemberCollection;
|
$FrontendGroupMemberCollection = new FrontendGroupMemberCollection;
|
||||||
$FrontendGroupMemberCollection->setWhere("idfrontenduser", $auth->auth['uid']);
|
$FrontendGroupMemberCollection->setWhere("idfrontenduser", $auth->auth['uid']);
|
||||||
|
@ -569,4 +519,3 @@ function checkCatPermission($idcatlang, $public) {
|
||||||
|
|
||||||
return $visible;
|
return $visible;
|
||||||
}
|
}
|
||||||
?>
|
|
Laden…
In neuem Issue referenzieren