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