Tagging version 2.1.0

Dieser Commit ist enthalten in:
Oldperl 2019-12-28 11:21:12 +00:00
Ursprung a0ea0e7255
Commit ad75f4b3fc
2 geänderte Dateien mit 318 neuen und 270 gelöschten Zeilen

Datei anzeigen

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -18,12 +17,15 @@
* *
* $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();
@ -50,7 +52,8 @@ 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;
@ -86,6 +89,7 @@ function createNavigationArray($start_id, $db) {
return $navigation; return $navigation;
} }
/** /**
* Return target of a given category id * Return target of a given category id
* *
@ -120,6 +124,7 @@ 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) {
@ -141,9 +146,12 @@ 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;
} }
} }
@ -166,14 +174,18 @@ 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
@ -186,13 +198,17 @@ 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
*/ */
@ -203,47 +219,63 @@ 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 ($mod_rewrite == true) { if (!$fullweblink)
{
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>';
} }
} }
@ -254,6 +286,7 @@ function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sT
return $sLocation; return $sLocation;
} }
/** /**
* *
* get subtree by a given id * get subtree by a given id
@ -263,7 +296,9 @@ 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
@ -282,11 +317,14 @@ 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;
} }
@ -297,7 +335,8 @@ 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
@ -320,10 +359,12 @@ 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;
} }
@ -343,7 +384,9 @@ 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
@ -368,10 +411,12 @@ 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;
} }
@ -382,9 +427,12 @@ 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;
@ -404,15 +452,17 @@ 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) {
@ -444,12 +494,13 @@ 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) {
@ -480,26 +531,25 @@ 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_ConLite(); $oDB = new DB_Contenido;
$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']);
@ -519,3 +569,4 @@ function checkCatPermission($idcatlang, $public) {
return $visible; return $visible;
} }
?>

Datei anzeigen

@ -43,7 +43,6 @@ INSERT INTO !PREFIX!_area VALUES('47', 'lang', 'lang_edit', '1', '1', '0');
INSERT INTO !PREFIX!_area VALUES('48', 'client', 'client_edit', '1', '1', '0'); INSERT INTO !PREFIX!_area VALUES('48', 'client', 'client_edit', '1', '1', '0');
INSERT INTO !PREFIX!_area VALUES('49', '0', 'logs', '1', '1', '1'); INSERT INTO !PREFIX!_area VALUES('49', '0', 'logs', '1', '1', '1');
INSERT INTO !PREFIX!_area VALUES('50', '0', 'recipients', '1', '1', '0'); INSERT INTO !PREFIX!_area VALUES('50', '0', 'recipients', '1', '1', '0');
INSERT INTO !PREFIX!_area VALUES('51', '0', 'myArea', '1', '1', '1');
INSERT INTO !PREFIX!_area VALUES('52', '0', 'info', '0', '1', '1'); INSERT INTO !PREFIX!_area VALUES('52', '0', 'info', '0', '1', '1');
INSERT INTO !PREFIX!_area VALUES('53', '0', 'symbolhelp', '0', '1', '1'); INSERT INTO !PREFIX!_area VALUES('53', '0', 'symbolhelp', '0', '1', '1');
INSERT INTO !PREFIX!_area VALUES('54', '0', 'groups', '1', '1', '0'); INSERT INTO !PREFIX!_area VALUES('54', '0', 'groups', '1', '1', '0');
@ -85,8 +84,6 @@ INSERT INTO !PREFIX!_area VALUES('91', 'recipients', 'recipients_import', '1', '
INSERT INTO !PREFIX!_area VALUES('92', 'mod', 'mod_package', '1', '1', '0'); INSERT INTO !PREFIX!_area VALUES('92', 'mod', 'mod_package', '1', '1', '0');
INSERT INTO !PREFIX!_area VALUES('93', 'mod', 'mod_sync', '1', '1', '0'); INSERT INTO !PREFIX!_area VALUES('93', 'mod', 'mod_sync', '1', '1', '0');
INSERT INTO !PREFIX!_area VALUES('96', '0', 'cl_sample_plugin', '1', '1', '1'); INSERT INTO !PREFIX!_area VALUES('96', '0', 'cl_sample_plugin', '1', '1', '1');
INSERT INTO !PREFIX!_area VALUES('97', '0', 'myArea', '1', '1', '1');
INSERT INTO !PREFIX!_area VALUES('98', '0', 'myArea', '1', '1', '1');
INSERT INTO !PREFIX!_area VALUES('400', 'lay', 'lay_history', '1', '1', '0'); INSERT INTO !PREFIX!_area VALUES('400', 'lay', 'lay_history', '1', '1', '0');
INSERT INTO !PREFIX!_area VALUES('401', 'style', 'style_history', '1', '1', '0'); INSERT INTO !PREFIX!_area VALUES('401', 'style', 'style_history', '1', '1', '0');
INSERT INTO !PREFIX!_area VALUES('402', 'js', 'js_history', '1', '1', '0'); INSERT INTO !PREFIX!_area VALUES('402', 'js', 'js_history', '1', '1', '0');