Dieser Commit ist enthalten in:
oldperl 2017-03-11 12:58:54 +00:00
Ursprung c92b578d39
Commit 8da8f2a18d
10 geänderte Dateien mit 2165 neuen und 2282 gelöschten Zeilen

Datei anzeigen

@ -1,15 +1,9 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
* *
* Description:
* CSV Handling class
*
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido Backend classes * @package Contenido Backend classes
* @version 1.0.4 * @version 1.0.4
* @author Timo A. Hummel * @author Timo A. Hummel
@ -19,57 +13,45 @@
* @link http://www.contenido.org * @link http://www.contenido.org
* @since file available since contenido release <= 4.6 * @since file available since contenido release <= 4.6
* *
* {@internal
* created unknown
* modified 2008-06-30, Dominik Ziegler, add security fix
*
* $Id: class.csv.php 214 2013-01-25 15:50:04Z oldperl $: * $Id: class.csv.php 214 2013-01-25 15:50:04Z oldperl $:
* }}
*
*/ */
if(!defined('CON_FRAMEWORK')) { if (!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
class CSV class CSV {
{
var $_data = array(); var $_data = array();
var $_delimiter; var $_delimiter;
function CSV () public function __construct() {
{
$this->_delimiter = ";"; $this->_delimiter = ";";
} }
function setRow ($row) public function setRow($row) {
{
$args = func_num_args(); $args = func_num_args();
for ($arg=1;$arg<$args;$arg++) for ($arg = 1; $arg < $args; $arg++) {
{
$ma = func_get_arg($arg); $ma = func_get_arg($arg);
$this->setCell($row, $arg, $ma); $this->setCell($row, $arg, $ma);
} }
} }
function setCell($row, $cell, $data) public function setCell($row, $cell, $data) {
{
$row = Contenido_Security::escapeDB($row); $row = Contenido_Security::escapeDB($row);
$cell = Contenido_Security::escapeDB($cell); $cell = Contenido_Security::escapeDB($cell);
$data = Contenido_Security::escapeDB($data); $data = Contenido_Security::escapeDB($data);
$data = str_replace('"', '""', $data); $data = str_replace('"', '""', $data);
$this->_data[$row][$cell] = '"'.$data.'"'; $this->_data[$row][$cell] = '"' . $data . '"';
} }
function setDelimiter ($delimiter) public function setDelimiter($delimiter) {
{
$this->_delimiter = $delimiter; $this->_delimiter = $delimiter;
} }
function make() { public function make() {
$out = ''; $out = '';
foreach ($this->_data as $row => $line) { foreach ($this->_data as $row => $line) {
$out .= implode($this->_delimiter, $line); $out .= implode($this->_delimiter, $line);

Datei anzeigen

@ -1,15 +1,9 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
* *
* Description:
* Root Driver for GenericDB
*
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido Backend classes * @package Contenido Backend classes
* @version 1.3 * @version 1.3
* @author Timo Hummel * @author Timo Hummel
@ -18,16 +12,9 @@
* @link http://www.4fb.de * @link http://www.4fb.de
* @link http://www.contenido.org * @link http://www.contenido.org
* *
* {@internal
* created 2005-08-29
* modified 2008-05-23 Added Debug_DevNull and Debug_VisibleAdv
*
* $Id: class.gdb.driver.php 2 2011-07-20 12:00:48Z oldperl $ * $Id: class.gdb.driver.php 2 2011-07-20 12:00:48Z oldperl $
* }}
*
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -36,26 +23,24 @@ class gdbDriver {
var $_sEncoding; var $_sEncoding;
var $_oItemClassInstance; var $_oItemClassInstance;
function gdbDriver() { public function __construct() {
} }
function setEncoding($sEncoding) { public function setEncoding($sEncoding) {
$this->_sEncoding = $sEncoding; $this->_sEncoding = $sEncoding;
} }
function setItemClassInstance($oInstance) { public function setItemClassInstance($oInstance) {
$this->_oItemClassInstance = $oInstance; $this->_oItemClassInstance = $oInstance;
} }
function buildJoinQuery($destinationTable, $destinationClass, $destinationPrimaryKey, $sourceClass, $primaryKey) { public function buildJoinQuery($destinationTable, $destinationClass, $destinationPrimaryKey, $sourceClass, $primaryKey) {
} }
function buildOperator($sField, $sOperator, $sRestriction) { public function buildOperator($sField, $sOperator, $sRestriction) {
} }
} }
?> ?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -27,8 +28,7 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -37,56 +37,48 @@ $properties = new PropertyCollection;
$db2 = new DB_ConLite; $db2 = new DB_ConLite;
if ($action == "client_new") if ($action == "client_new") {
{
$nextid = $db->nextid($cfg["tab"]["clients"]); $nextid = $db->nextid($cfg["tab"]["clients"]);
$idclient = $nextid; $idclient = $nextid;
$new = true; $new = true;
} }
if(!$perm->have_perm_area_action($area)) if (!$perm->have_perm_area_action($area)) {
{
$notification->displayNotification("error", i18n("Permission denied")); $notification->displayNotification("error", i18n("Permission denied"));
} else { } else {
if ( !isset($idclient) ) if (!isset($idclient)) {
{
$notification->displayNotification("error", i18n("No client ID passed")); $notification->displayNotification("error", i18n("No client ID passed"));
} else { } else {
if (($action == "client_edit") && ($perm->have_perm_area_action($area, $action))) if (($action == "client_edit") && ($perm->have_perm_area_action($area, $action))) {
{
$sNewNotification = ''; $sNewNotification = '';
if ($active != "1") if ($active != "1") {
{
$active = "0"; $active = "0";
} }
if ($new == true) if ($new == true) {
{
$sLangNotification = i18n('Notice: In order to use this client, you must create a new language for it.'); $sLangNotification = i18n('Notice: In order to use this client, you must create a new language for it.');
$sTarget = $sess->url('frameset.php?area=lang'); $sTarget = $sess->url('frameset.php?area=lang');
$sJsLink = "parent.parent.location.href='".$sTarget."'; $sJsLink = "parent.parent.location.href='" . $sTarget . "';
top.header.markActive(top.header.document.getElementById('sub_lang'));"; top.header.markActive(top.header.document.getElementById('sub_lang'));";
$sLangNotificationLink = sprintf(i18n('Please click %shere%s to create a new language.'), '<a href="javascript://" onclick="'.$sJsLink.'">', '</a>'); $sLangNotificationLink = sprintf(i18n('Please click %shere%s to create a new language.'), '<a href="javascript://" onclick="' . $sJsLink . '">', '</a>');
$sNewNotification = '<br>'.$sLangNotification.'<br>'.$sLangNotificationLink; $sNewNotification = '<br>' . $sLangNotification . '<br>' . $sLangNotificationLink;
if (substr($frontendpath, strlen($frontendpath)-1) != "/") if (substr($frontendpath, strlen($frontendpath) - 1) != "/") {
{
$frontendpath .= "/"; $frontendpath .= "/";
} }
if (substr($htmlpath, strlen($htmlpath)-1) != "/") if (substr($htmlpath, strlen($htmlpath) - 1) != "/") {
{
$htmlpath .= "/"; $htmlpath .= "/";
} }
$sql = "INSERT INTO $sql = "INSERT INTO
".$cfg["tab"]["clients"]." " . $cfg["tab"]["clients"] . "
SET SET
name = '".Contenido_Security::escapeDB($clientname, $db)."', name = '" . Contenido_Security::escapeDB($clientname, $db) . "',
frontendpath = '".Contenido_Security::escapeDB($frontendpath, $db)."', frontendpath = '" . Contenido_Security::escapeDB($frontendpath, $db) . "',
htmlpath = '".Contenido_Security::escapeDB($htmlpath, $db)."', htmlpath = '" . Contenido_Security::escapeDB($htmlpath, $db) . "',
errsite_cat = '".Contenido_Security::toInteger($errsite_cat)."', errsite_cat = '" . Contenido_Security::toInteger($errsite_cat) . "',
errsite_art = '".Contenido_Security::toInteger($errsite_art)."', errsite_art = '" . Contenido_Security::toInteger($errsite_art) . "',
idclient = '".Contenido_Security::toInteger($idclient)."'"; idclient = '" . Contenido_Security::toInteger($idclient) . "'";
$properties->setValue("idclient", $idclient, "backend", "clientimage", $clientlogo); $properties->setValue("idclient", $idclient, "backend", "clientimage", $clientlogo);
@ -94,69 +86,65 @@ if(!$perm->have_perm_area_action($area))
$destPath = $frontendpath; $destPath = $frontendpath;
$sourcePath = $cfg['path']['contenido'] . $cfg['path']['frontendtemplate']; $sourcePath = $cfg['path']['contenido'] . $cfg['path']['frontendtemplate'];
if($copytemplate) { if ($copytemplate) {
if(!file_exists($destPath)) { if (!file_exists($destPath)) {
if(recursive_copy($sourcePath, $destPath)) { if (recursive_copy($sourcePath, $destPath)) {
$res = fopen($destPath."config.php","rb+"); $res = fopen($destPath . "config.php", "rb+");
$res2 = fopen($destPath."config.php.new", "ab+"); $res2 = fopen($destPath . "config.php.new", "ab+");
if($res && $res2) { if ($res && $res2) {
while(!feof($res)) { while (!feof($res)) {
$buffer = fgets($res, 4096); $buffer = fgets($res, 4096);
$buffer = str_replace("!CLIENT!", $idclient, $buffer); $buffer = str_replace("!CLIENT!", $idclient, $buffer);
$buffer = str_replace("!PATH!", $cfg["path"]["contenido"], $buffer); $buffer = str_replace("!PATH!", $cfg["path"]["contenido"], $buffer);
fwrite($res2, $buffer); fwrite($res2, $buffer);
} }
} else { } else {
$notification->displayNotification("error",i18n("Couldn't write the file config.php.")); $notification->displayNotification("error", i18n("Couldn't write the file config.php."));
} }
fclose($res); fclose($res);
fclose($res2); fclose($res2);
unlink($destPath."config.php"); unlink($destPath . "config.php");
rename($destPath."config.php.new", $destPath."config.php"); rename($destPath . "config.php.new", $destPath . "config.php");
$message = sprintf(i18n("Succesfully copied client-template to %s."),$destPath); $message = sprintf(i18n("Succesfully copied client-template to %s."), $destPath);
$notification->displayNotification("info", $message); $notification->displayNotification("info", $message);
} else { } else {
$message = sprintf(i18n("Cannot create directory %s . The client was created, but you have to copy the frontend-template yourself"),$destPath); $message = sprintf(i18n("Cannot create directory %s . The client was created, but you have to copy the frontend-template yourself"), $destPath);
$notification->displayNotification("warning", $message); $notification->displayNotification("warning", $message);
} }
} else { } else {
$message = sprintf(i18n("The directory %s already exists. The client was created, but you have to copy the frontend-template yourself"),$destPath); $message = sprintf(i18n("The directory %s already exists. The client was created, but you have to copy the frontend-template yourself"), $destPath);
$notification->displayNotification("warning", $message); $notification->displayNotification("warning", $message);
} }
} else { } else {
$message = sprintf(i18n("Client '%s' created."),$clientname); $message = sprintf(i18n("Client '%s' created."), $clientname);
$notification->displayNotification("info", $message); $notification->displayNotification("info", $message);
} }
rereadClients(); rereadClients();
} else { } else {
$pathwithoutslash = $frontendpath; $pathwithoutslash = $frontendpath;
if (substr($frontendpath, strlen($frontendpath)-1) != "/") if (substr($frontendpath, strlen($frontendpath) - 1) != "/") {
{
$frontendpath .= "/"; $frontendpath .= "/";
} }
if (substr($htmlpath, strlen($htmlpath)-1) != "/") if (substr($htmlpath, strlen($htmlpath) - 1) != "/") {
{
$htmlpath .= "/"; $htmlpath .= "/";
} }
if (($oldpath != $frontendpath) && ($oldpath != $pathwithoutslash)) if (($oldpath != $frontendpath) && ($oldpath != $pathwithoutslash)) {
{
$notification->displayNotification("warning", i18n("You changed the client path. You might need to copy the frontend to the new location")); $notification->displayNotification("warning", i18n("You changed the client path. You might need to copy the frontend to the new location"));
} }
$sql = "UPDATE $sql = "UPDATE
".$cfg["tab"]["clients"]." " . $cfg["tab"]["clients"] . "
SET SET
name = '".Contenido_Security::escapeDB($clientname, $db)."', name = '" . Contenido_Security::escapeDB($clientname, $db) . "',
frontendpath = '".Contenido_Security::escapeDB($frontendpath, $db)."', frontendpath = '" . Contenido_Security::escapeDB($frontendpath, $db) . "',
htmlpath = '".Contenido_Security::escapeDB($htmlpath, $db)."', htmlpath = '" . Contenido_Security::escapeDB($htmlpath, $db) . "',
errsite_cat = '".Contenido_Security::toInteger($errsite_cat)."', errsite_cat = '" . Contenido_Security::toInteger($errsite_cat) . "',
errsite_art = '".Contenido_Security::toInteger($errsite_art)."' errsite_art = '" . Contenido_Security::toInteger($errsite_art) . "'
WHERE WHERE
idclient = '".Contenido_Security::toInteger($idclient)."'"; idclient = '" . Contenido_Security::toInteger($idclient) . "'";
} }
$db->query($sql); $db->query($sql);
@ -166,16 +154,16 @@ if(!$perm->have_perm_area_action($area))
$properties->setValue("idclient", $idclient, "backend", "clientimage", $clientlogo); $properties->setValue("idclient", $idclient, "backend", "clientimage", $clientlogo);
/* Clear the con_code table */ /* Clear the con_code table */
$sql = "DELETE FROM ".$cfg["tab"]["code"]." WHERE idclient = '".Contenido_Security::toInteger($idclient)."'"; $sql = "DELETE FROM " . $cfg["tab"]["code"] . " WHERE idclient = '" . Contenido_Security::toInteger($idclient) . "'";
$db->query($sql); $db->query($sql);
$notification->displayNotification("info", i18n("Changes saved").$sNewNotification); $notification->displayNotification("info", i18n("Changes saved") . $sNewNotification);
$cApiClient = new cApiClient; $cApiClient = new cApiClient;
$cApiClient->loadByPrimaryKey($idclient); $cApiClient->loadByPrimaryKey($idclient);
if(isset($_REQUEST["generate_xhtml"])) { if (isset($_REQUEST["generate_xhtml"])) {
switch($_REQUEST["generate_xhtml"]) { switch ($_REQUEST["generate_xhtml"]) {
case "html": case "html":
$cApiClient->setProperty("generator", "xhtml", "false"); $cApiClient->setProperty("generator", "xhtml", "false");
$cApiClient->setProperty("generator", "html5", "false"); $cApiClient->setProperty("generator", "html5", "false");
@ -203,22 +191,22 @@ if(!$perm->have_perm_area_action($area))
$sql = "SELECT $sql = "SELECT
idclient, name, frontendpath, htmlpath, errsite_cat, errsite_art idclient, name, frontendpath, htmlpath, errsite_cat, errsite_art
FROM FROM
".$cfg["tab"]["clients"]." " . $cfg["tab"]["clients"] . "
WHERE WHERE
idclient = '".Contenido_Security::toInteger($idclient)."'"; idclient = '" . Contenido_Security::toInteger($idclient) . "'";
$db->query($sql); $db->query($sql);
$db->next_record(); $db->next_record();
$form = '<form name="client_properties" method="post" action="'.$sess->url("main.php?").'"> $form = '<form name="client_properties" method="post" action="' . $sess->url("main.php?") . '">
'.$sess->hidden_session().' ' . $sess->hidden_session() . '
<input type="hidden" name="area" value="'.$area.'"> <input type="hidden" name="area" value="' . $area . '">
<input type="hidden" name="action" value="client_edit"> <input type="hidden" name="action" value="client_edit">
<input type="hidden" name="frame" value="'.$frame.'"> <input type="hidden" name="frame" value="' . $frame . '">
<input type="hidden" name="new" value="'.$new.'"> <input type="hidden" name="new" value="' . $new . '">
<input type="hidden" name="oldpath" value="'.$db->f("frontendpath").'"> <input type="hidden" name="oldpath" value="' . $db->f("frontendpath") . '">
<input type="hidden" name="idclient" value="'.$idclient.'">'; <input type="hidden" name="idclient" value="' . $idclient . '">';
$tpl->set('s', 'JAVASCRIPT', $javascript); $tpl->set('s', 'JAVASCRIPT', $javascript);
$tpl->set('s', 'FORM', $form); $tpl->set('s', 'FORM', $form);
@ -228,8 +216,7 @@ if(!$perm->have_perm_area_action($area))
$tpl->set('s', 'CANCELTEXT', i18n("Discard changes")); $tpl->set('s', 'CANCELTEXT', i18n("Discard changes"));
$tpl->set('s', 'CANCELLINK', $sess->url("main.php?area=$area&frame=4&idclient=$idclient")); $tpl->set('s', 'CANCELLINK', $sess->url("main.php?area=$area&frame=4&idclient=$idclient"));
if ($error) if ($error) {
{
echo $error; echo $error;
} }
@ -245,7 +232,7 @@ if(!$perm->have_perm_area_action($area))
$tpl->set('d', 'CATNAME', i18n("Client name")); $tpl->set('d', 'CATNAME', i18n("Client name"));
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]); $tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "clientname", clHtmlSpecialChars($db->f("name")), 50, 255)); $tpl->set('d', 'CATFIELD', formGenerateField("text", "clientname", clHtmlSpecialChars($db->f("name")), 50, 255));
$tpl->set('d', 'BRDRT', 0); $tpl->set('d', 'BRDRT', 0);
$tpl->set('d', 'BRDRB', 1); $tpl->set('d', 'BRDRB', 1);
$tpl->set('d', 'FONT', 'text_medium'); $tpl->set('d', 'FONT', 'text_medium');
@ -253,15 +240,14 @@ if(!$perm->have_perm_area_action($area))
$serverpath = $db->f("frontendpath"); $serverpath = $db->f("frontendpath");
if ($serverpath == "") if ($serverpath == "") {
{
$serverpath = $cfg['path']['frontend']; $serverpath = $cfg['path']['frontend'];
} }
$tpl->set('d', 'CATNAME', i18n("Server path")); $tpl->set('d', 'CATNAME', i18n("Server path"));
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]); $tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "frontendpath", clHtmlSpecialChars($serverpath), 50, 255)); $tpl->set('d', 'CATFIELD', formGenerateField("text", "frontendpath", clHtmlSpecialChars($serverpath), 50, 255));
$tpl->set('d', 'BRDRT', 0); $tpl->set('d', 'BRDRT', 0);
$tpl->set('d', 'BRDRB', 1); $tpl->set('d', 'BRDRB', 1);
$tpl->set('d', 'FONT', 'text_medium'); $tpl->set('d', 'FONT', 'text_medium');
@ -269,15 +255,14 @@ if(!$perm->have_perm_area_action($area))
$htmlpath = $db->f("htmlpath"); $htmlpath = $db->f("htmlpath");
if ($htmlpath == "") if ($htmlpath == "") {
{
$htmlpath = "http://"; $htmlpath = "http://";
} }
$tpl->set('d', 'CATNAME', i18n("Web address")); $tpl->set('d', 'CATNAME', i18n("Web address"));
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]); $tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "htmlpath", clHtmlSpecialChars($htmlpath), 50, 255)); $tpl->set('d', 'CATFIELD', formGenerateField("text", "htmlpath", clHtmlSpecialChars($htmlpath), 50, 255));
$tpl->set('d', 'BRDRT', 0); $tpl->set('d', 'BRDRT', 0);
$tpl->set('d', 'BRDRB', 1); $tpl->set('d', 'BRDRB', 1);
$tpl->set('d', 'FONT', 'text_medium'); $tpl->set('d', 'FONT', 'text_medium');
@ -286,7 +271,7 @@ if(!$perm->have_perm_area_action($area))
$tpl->set('d', 'CATNAME', i18n("Error page category")); $tpl->set('d', 'CATNAME', i18n("Error page category"));
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]); $tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "errsite_cat", $db->f("errsite_cat"), 10, 10)); $tpl->set('d', 'CATFIELD', formGenerateField("text", "errsite_cat", $db->f("errsite_cat"), 10, 10));
$tpl->set('d', 'BRDRT', 0); $tpl->set('d', 'BRDRT', 0);
$tpl->set('d', 'BRDRB', 1); $tpl->set('d', 'BRDRB', 1);
$tpl->set('d', 'FONT', 'text_medium'); $tpl->set('d', 'FONT', 'text_medium');
@ -295,18 +280,18 @@ if(!$perm->have_perm_area_action($area))
$tpl->set('d', 'CATNAME', i18n("Error page article")); $tpl->set('d', 'CATNAME', i18n("Error page article"));
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]); $tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "errsite_art", $db->f("errsite_art"), 10, 10)); $tpl->set('d', 'CATFIELD', formGenerateField("text", "errsite_art", $db->f("errsite_art"), 10, 10));
$tpl->set('d', 'BRDRT', 0); $tpl->set('d', 'BRDRT', 0);
$tpl->set('d', 'BRDRB', 1); $tpl->set('d', 'BRDRB', 1);
$tpl->set('d', 'FONT', 'text_medium'); $tpl->set('d', 'FONT', 'text_medium');
$tpl->next(); $tpl->next();
$clientLogo = $properties->getValue ("idclient", $idclient, "backend", "clientimage"); $clientLogo = $properties->getValue("idclient", $idclient, "backend", "clientimage");
$tpl->set('d', 'CATNAME', i18n("Client logo")); $tpl->set('d', 'CATNAME', i18n("Client logo"));
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]); $tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateField ("text", "clientlogo", $clientLogo, 50, 255)); $tpl->set('d', 'CATFIELD', formGenerateField("text", "clientlogo", $clientLogo, 50, 255));
$tpl->set('d', 'BRDRT', 0); $tpl->set('d', 'BRDRT', 0);
$tpl->set('d', 'BRDRB', 1); $tpl->set('d', 'BRDRB', 1);
$tpl->set('d', 'FONT', 'text_medium'); $tpl->set('d', 'FONT', 'text_medium');
@ -319,9 +304,10 @@ if(!$perm->have_perm_area_action($area))
$cApiClient = new cApiClient; $cApiClient = new cApiClient;
$cApiClient->loadByPrimaryKey($idclient); $cApiClient->loadByPrimaryKey($idclient);
if ($cApiClient->getProperty("generator", "xhtml") == "true") { var_dump($cApiClient->getProperty("generator", "xhtml"));
if ($cApiClient->getProperty("generator", "xhtml") === TRUE) {
$oXHTMLSelect->setDefault("xhtml"); $oXHTMLSelect->setDefault("xhtml");
} else if ($cApiClient->getProperty("generator", "html5") == "true") { } else if ($cApiClient->getProperty("generator", "html5") === TRUE) {
$oXHTMLSelect->setDefault("html5"); $oXHTMLSelect->setDefault("html5");
} else { } else {
$oXHTMLSelect->setDefault("html"); $oXHTMLSelect->setDefault("html");
@ -336,12 +322,11 @@ if(!$perm->have_perm_area_action($area))
$tpl->set('d', 'FONT', 'text_medium'); $tpl->set('d', 'FONT', 'text_medium');
$tpl->next(); $tpl->next();
if ($new == true) if ($new == true) {
{
$tpl->set('d', 'CATNAME', i18n("Copy frontend template")); $tpl->set('d', 'CATNAME', i18n("Copy frontend template"));
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
$tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]); $tpl->set('d', "BORDERCOLOR", $cfg["color"]["table_border"]);
$tpl->set('d', 'CATFIELD', formGenerateCheckbox ("copytemplate", "checked", 1)); $tpl->set('d', 'CATFIELD', formGenerateCheckbox("copytemplate", "checked", 1));
$tpl->next(); $tpl->next();
} }

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -31,8 +32,7 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -49,14 +49,13 @@ class pApiContentAllocation {
var $table = null; var $table = null;
var $lang = null; var $lang = null;
var $client = null; var $client = null;
var $treeObj = null; var $treeObj = null;
/** /**
* *
* @modified 27.10.2005 new class variable $this->bDebug (if true print debug information) * @modified 27.10.2005 new class variable $this->bDebug (if true print debug information)
*/ */
function pApiContentAllocation () { public function __construct() {
global $db, $cfg, $lang, $client; global $db, $cfg, $lang, $client;
$this->db = new DB_ConLite; $this->db = new DB_ConLite;
@ -71,30 +70,30 @@ class pApiContentAllocation {
$this->treeObj = new pApiTree('f31a4384-e5c1-4ede-b1bb-f43657ec73a5'); $this->treeObj = new pApiTree('f31a4384-e5c1-4ede-b1bb-f43657ec73a5');
} }
function storeAllocations ($idartlang, $allocations) { function storeAllocations($idartlang, $allocations) {
// empty before insert // empty before insert
$this->deleteAllocationsByIdartlang($idartlang); $this->deleteAllocationsByIdartlang($idartlang);
if (is_array($allocations)) { if (is_array($allocations)) {
foreach ($allocations as $value) { foreach ($allocations as $value) {
$sql = "INSERT INTO ".$this->table['pica_alloc_con']." (idpica_alloc, idartlang) VALUES (".Contenido_Security::toInteger($value).", ".Contenido_Security::toInteger($idartlang).")"; $sql = "INSERT INTO " . $this->table['pica_alloc_con'] . " (idpica_alloc, idartlang) VALUES (" . Contenido_Security::toInteger($value) . ", " . Contenido_Security::toInteger($idartlang) . ")";
$this->db->query($sql); $this->db->query($sql);
} }
} }
} }
function deleteAllocations ($idpica_alloc) { function deleteAllocations($idpica_alloc) {
$sql = "DELETE FROM ".$this->table['pica_alloc_con']." WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc); $sql = "DELETE FROM " . $this->table['pica_alloc_con'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
$this->db->query($sql); $this->db->query($sql);
} }
function deleteAllocationsByIdartlang ($idartlang) { function deleteAllocationsByIdartlang($idartlang) {
$sql = "DELETE FROM ".$this->table['pica_alloc_con']." WHERE idartlang = " . Contenido_Security::toInteger($idartlang); $sql = "DELETE FROM " . $this->table['pica_alloc_con'] . " WHERE idartlang = " . Contenido_Security::toInteger($idartlang);
$this->db->query($sql); $this->db->query($sql);
} }
function loadAllocations ($idartlang) { function loadAllocations($idartlang) {
$sql = "SELECT idpica_alloc FROM ".$this->table['pica_alloc_con']." WHERE idartlang = " . Contenido_Security::toInteger($idartlang); $sql = "SELECT idpica_alloc FROM " . $this->table['pica_alloc_con'] . " WHERE idartlang = " . Contenido_Security::toInteger($idartlang);
$this->db->query($sql); $this->db->query($sql);
$items = array(); $items = array();
@ -105,15 +104,15 @@ class pApiContentAllocation {
return $items; return $items;
} }
function loadAllocationsWithNames ($idartlang, $parent, $firstonly = false) { function loadAllocationsWithNames($idartlang, $parent, $firstonly = false) {
global $cfg; global $cfg;
$sql = "SELECT ".$cfg['tab']['pica_alloc'].".idpica_alloc FROM ".$cfg['tab']['pica_alloc']." $sql = "SELECT " . $cfg['tab']['pica_alloc'] . ".idpica_alloc FROM " . $cfg['tab']['pica_alloc'] . "
INNER JOIN ".$cfg['tab']['pica_alloc_con']." ON INNER JOIN " . $cfg['tab']['pica_alloc_con'] . " ON
".$cfg['tab']['pica_alloc'].".idpica_alloc = ".$cfg['tab']['pica_alloc_con'].".idpica_alloc " . $cfg['tab']['pica_alloc'] . ".idpica_alloc = " . $cfg['tab']['pica_alloc_con'] . ".idpica_alloc
WHERE (".$cfg['tab']['pica_alloc'].".parentid = ".Contenido_Security::toInteger($parent).") AND (".$cfg['tab']['pica_alloc_con'].".idartlang=".Contenido_Security::toInteger($idartlang).") WHERE (" . $cfg['tab']['pica_alloc'] . ".parentid = " . Contenido_Security::toInteger($parent) . ") AND (" . $cfg['tab']['pica_alloc_con'] . ".idartlang=" . Contenido_Security::toInteger($idartlang) . ")
ORDER BY ".$cfg['tab']['pica_alloc'].".sortorder"; ORDER BY " . $cfg['tab']['pica_alloc'] . ".sortorder";
$this->db->query($sql); $this->db->query($sql);
@ -123,7 +122,6 @@ class pApiContentAllocation {
if ($firstonly) { if ($firstonly) {
break; break;
} }
} }
return $tmp; return $tmp;
@ -135,9 +133,10 @@ class pApiContentAllocation {
* @return string SQL * @return string SQL
* @modified 17.11.2005 by Willi Man * @modified 17.11.2005 by Willi Man
*/ */
function findMatchingContent ($restrictions = null, $max = 0) function findMatchingContent($restrictions = null, $max = 0) {
{ if (!is_array($restrictions)) {
if (!is_array($restrictions)) { return false; } return false;
}
global $aCategoriesToExclude; # @see config.local.php! global $aCategoriesToExclude; # @see config.local.php!
$sql = $this->_buildQuery($restrictions, $aCategoriesToExclude, $max); $sql = $this->_buildQuery($restrictions, $aCategoriesToExclude, $max);
@ -150,7 +149,7 @@ class pApiContentAllocation {
* @param array $restrictions * @param array $restrictions
* @return string SQL * @return string SQL
*/ */
function _buildQuery ($restrictions, $aCategoriesToExclude, $max) { function _buildQuery($restrictions, $aCategoriesToExclude, $max) {
global $cfg; global $cfg;
@ -169,12 +168,11 @@ class pApiContentAllocation {
for ($i = 0; $i < $size; $i++) { for ($i = 0; $i < $size; $i++) {
if ($i == 0) { // first if ($i == 0) { // first
$tables[] = " ".$cfg['tab']['pica_alloc_con']." AS " . $sql_concat[$i]; $tables[] = " " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i];
} else { } else {
$tables[] = " LEFT JOIN ".$cfg['tab']['pica_alloc_con']." AS " . $sql_concat[$i] . " USING (idartlang)"; $tables[] = " LEFT JOIN " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i] . " USING (idartlang)";
} }
if (is_int((int)$restrictions[$i]) AND $restrictions[$i] > 0) if (is_int((int) $restrictions[$i]) AND $restrictions[$i] > 0) {
{
$where[] = $sql_concat[$i] . ".idpica_alloc = " . $restrictions[$i]; $where[] = $sql_concat[$i] . ".idpica_alloc = " . $restrictions[$i];
} }
} }
@ -183,15 +181,14 @@ class pApiContentAllocation {
$where[] = 'cal.online = 1'; $where[] = 'cal.online = 1';
# fetch only articles which are not in following categories # fetch only articles which are not in following categories
if (count($aCategoriesToExclude) > 0) if (count($aCategoriesToExclude) > 0) {
{ $where[] = "cat.idcat NOT IN (" . implode(',', $aCategoriesToExclude) . ")";
$where[] = "cat.idcat NOT IN (".implode(',', $aCategoriesToExclude).")";
} }
// join art_lang for idart // join art_lang for idart
$tables[] = " LEFT JOIN ".$this->table['art_lang']." AS cal USING (idartlang)"; $tables[] = " LEFT JOIN " . $this->table['art_lang'] . " AS cal USING (idartlang)";
$tables[] = " LEFT JOIN ".$this->table['cat_art']." AS cart USING (idart)"; $tables[] = " LEFT JOIN " . $this->table['cat_art'] . " AS cart USING (idart)";
$tables[] = " LEFT JOIN ".$this->table['cat']." as cat USING (idcat)"; $tables[] = " LEFT JOIN " . $this->table['cat'] . " as cat USING (idcat)";
$tables = implode('', $tables); $tables = implode('', $tables);
$where = implode(' AND ', $where); $where = implode(' AND ', $where);
@ -205,7 +202,11 @@ class pApiContentAllocation {
$sql .= " LIMIT " . $max; $sql .= " LIMIT " . $max;
} }
if ($this->bDebug) {print "<!-- "; print $sql; print " -->";} # @modified 27.10.2005 if ($this->bDebug) {
print "<!-- ";
print $sql;
print " -->";
} # @modified 27.10.2005
return $sql; return $sql;
} }
@ -217,22 +218,19 @@ class pApiContentAllocation {
* *
* @return array of articles * @return array of articles
*/ */
function findMatchingContentByContentAllocationByCategories ($aContentAllocation, $aCategories = array(), $iOffset = 0, $iNumOfRows = 0) function findMatchingContentByContentAllocationByCategories($aContentAllocation, $aCategories = array(), $iOffset = 0, $iNumOfRows = 0) {
{ if (!is_array($aContentAllocation)) {
if (!is_array($aContentAllocation)) { return array(); } return array();
}
for ($i = 0; $i < count($aContentAllocation); $i++) for ($i = 0; $i < count($aContentAllocation); $i++) {
{ if (!is_int((int) $aContentAllocation[$i]) OR ! $aContentAllocation[$i] > 0) {
if (!is_int((int)$aContentAllocation[$i]) OR !$aContentAllocation[$i] > 0)
{
return array(); return array();
} }
} }
for ($i = 0; $i < count($aCategories); $i++) for ($i = 0; $i < count($aCategories); $i++) {
{ if (!is_int((int) $aCategories[$i]) OR ! $aCategories[$i] > 0) {
if (!is_int((int)$aCategories[$i]) OR !$aCategories[$i] > 0)
{
return array(); return array();
} }
} }
@ -242,19 +240,17 @@ class pApiContentAllocation {
$this->db->query($sql); $this->db->query($sql);
$aResult = array(); $aResult = array();
while($oRow = $this->db->getResultObject()) while ($oRow = $this->db->getResultObject()) {
{
$aResult[] = $oRow; $aResult[] = $oRow;
} }
return $aResult; return $aResult;
} }
/** /**
* build SQL query to find articles by content allocation and catgories * build SQL query to find articles by content allocation and catgories
* *
*/ */
function _buildQuery_MatchingContentByContentAllocationByCategories ($aContentAllocation, $aCategories, $iOffset, $iNumOfRows) { function _buildQuery_MatchingContentByContentAllocationByCategories($aContentAllocation, $aCategories, $iOffset, $iNumOfRows) {
global $cfg; global $cfg;
@ -267,16 +263,13 @@ class pApiContentAllocation {
$tables = array(); $tables = array();
$where = array(); $where = array();
for ($i = 0; $i < $size; $i++) for ($i = 0; $i < $size; $i++) {
{ if ($i == 0) { // first
if ($i == 0) $tables[] = " " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i];
{ // first
$tables[] = " ".$cfg['tab']['pica_alloc_con']." AS " . $sql_concat[$i];
} else { } else {
$tables[] = " LEFT JOIN ".$cfg['tab']['pica_alloc_con']." AS " . $sql_concat[$i] . " USING (idartlang)"; $tables[] = " LEFT JOIN " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i] . " USING (idartlang)";
} }
if (is_int((int)$aContentAllocation[$i]) AND $aContentAllocation[$i] > 0) if (is_int((int) $aContentAllocation[$i]) AND $aContentAllocation[$i] > 0) {
{
$where[] = $sql_concat[$i] . ".idpica_alloc = " . $aContentAllocation[$i]; $where[] = $sql_concat[$i] . ".idpica_alloc = " . $aContentAllocation[$i];
} }
} }
@ -285,15 +278,14 @@ class pApiContentAllocation {
$where[] = 'cal.online = 1'; $where[] = 'cal.online = 1';
# fetch only articles in following categories # fetch only articles in following categories
if (count($aCategories) > 0) if (count($aCategories) > 0) {
{ $where[] = "cat.idcat IN (" . implode(',', $aCategories) . ")";
$where[] = "cat.idcat IN (".implode(',', $aCategories).")";
} }
// join art_lang for idart // join art_lang for idart
$tables[] = " LEFT JOIN ".$this->table['art_lang']." AS cal USING (idartlang)"; $tables[] = " LEFT JOIN " . $this->table['art_lang'] . " AS cal USING (idartlang)";
$tables[] = " LEFT JOIN ".$this->table['cat_art']." AS cart USING (idart)"; $tables[] = " LEFT JOIN " . $this->table['cat_art'] . " AS cart USING (idart)";
$tables[] = " LEFT JOIN ".$this->table['cat']." as cat USING (idcat)"; $tables[] = " LEFT JOIN " . $this->table['cat'] . " as cat USING (idcat)";
$tables = implode('', $tables); $tables = implode('', $tables);
$where = implode(' AND ', $where); $where = implode(' AND ', $where);
@ -303,12 +295,15 @@ class pApiContentAllocation {
$sql .= " ORDER BY cal.published DESC"; $sql .= " ORDER BY cal.published DESC";
if (is_integer($iNumOfRows) AND $iNumOfRows > 0) if (is_integer($iNumOfRows) AND $iNumOfRows > 0) {
{ $sql .= " LIMIT " . $iOffset . ", " . $iNumOfRows;
$sql .= " LIMIT ". $iOffset .", ".$iNumOfRows;
} }
if ($this->bDebug) {print "<!-- "; print $sql; print " -->";} # @modified 27.10.2005 if ($this->bDebug) {
print "<!-- ";
print $sql;
print " -->";
} # @modified 27.10.2005
return $sql; return $sql;
} }
@ -322,13 +317,10 @@ class pApiContentAllocation {
* *
* @return array of articles * @return array of articles
*/ */
function findMatchingContentByCategories ($aCategories = array(), $iOffset = 0, $iNumOfRows = 0, $sResultType = '') function findMatchingContentByCategories($aCategories = array(), $iOffset = 0, $iNumOfRows = 0, $sResultType = '') {
{
for ($i = 0; $i < count($aCategories); $i++) for ($i = 0; $i < count($aCategories); $i++) {
{ if (!is_int((int) $aCategories[$i]) OR ! $aCategories[$i] > 0) {
if (!is_int((int)$aCategories[$i]) OR !$aCategories[$i] > 0)
{
return array(); return array();
} }
} }
@ -339,39 +331,30 @@ class pApiContentAllocation {
$aResult = array(); $aResult = array();
while($oRow = $this->db->getResultObject()) while ($oRow = $this->db->getResultObject()) {
{ if ($sResultType == 'article_language_id') {
if ($sResultType == 'article_language_id')
{
$aResult[] = $oRow->idartlang; $aResult[] = $oRow->idartlang;
}else } else {
{
$aResult[] = $oRow; $aResult[] = $oRow;
} }
} }
return $aResult; return $aResult;
} }
/** /**
* build SQL query to find articles by catgories * build SQL query to find articles by catgories
* *
*/ */
function _buildQuery_MatchingContentByCategories ($aCategories, $iOffset, $iNumOfRows) function _buildQuery_MatchingContentByCategories($aCategories, $iOffset, $iNumOfRows) {
{
if (count($aCategories) > 0) if (count($aCategories) > 0) {
{ $sWHERE_Category_IN = " c.idcat IN (" . implode(',', $aCategories) . ") AND ";
$sWHERE_Category_IN = " c.idcat IN (".implode(',', $aCategories).") AND "; } else {
}else
{
$sWHERE_Category_IN = ''; $sWHERE_Category_IN = '';
} }
if (is_integer($iNumOfRows) AND $iNumOfRows > 0) if (is_integer($iNumOfRows) AND $iNumOfRows > 0) {
{ $sLimit = " LIMIT " . Contenido_Security::toInteger($iOffset) . ", " . Contenido_Security::toInteger($iNumOfRows);
$sLimit = " LIMIT ". Contenido_Security::toInteger($iOffset) .", " . Contenido_Security::toInteger($iNumOfRows); } else {
}else
{
$sLimit = ''; $sLimit = '';
} }
@ -379,22 +362,26 @@ class pApiContentAllocation {
SELECT SELECT
a.idart, a.online, a.idartlang, c.idcat a.idart, a.online, a.idartlang, c.idcat
FROM FROM
'.$this->table['art_lang'].' AS a, ' . $this->table['art_lang'] . ' AS a,
'.$this->table['art'].' AS b, ' . $this->table['art'] . ' AS b,
'.$this->table['cat_art'].' AS c, ' . $this->table['cat_art'] . ' AS c,
'.$this->table['cat_lang'].' AS d ' . $this->table['cat_lang'] . ' AS d
WHERE WHERE
'.$sWHERE_Category_IN.' ' . $sWHERE_Category_IN . '
b.idclient = '.Contenido_Security::toInteger($this->client).' AND b.idclient = ' . Contenido_Security::toInteger($this->client) . ' AND
a.idlang = '.Contenido_Security::toInteger($this->lang).' AND a.idlang = ' . Contenido_Security::toInteger($this->lang) . ' AND
a.idartlang != d.startidartlang AND a.idartlang != d.startidartlang AND
a.online = 1 AND a.online = 1 AND
c.idcat = d.idcat AND c.idcat = d.idcat AND
b.idart = c.idart AND b.idart = c.idart AND
a.idart = b.idart a.idart = b.idart
'.$sLimit.' '; ' . $sLimit . ' ';
if ($this->bDebug) {print "<!-- "; print $sql; print " -->";} if ($this->bDebug) {
print "<!-- ";
print $sql;
print " -->";
}
return $sql; return $sql;
} }

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -27,8 +28,7 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -36,10 +36,9 @@ class pApiContentAllocationArticle extends pApiTree {
var $tpl = null; var $tpl = null;
var $template = ''; var $template = '';
var $load = array(); var $load = array();
function pApiContentAllocationArticle ($uuid) { public function __construct($uuid) {
global $cfg; global $cfg;
parent::pApiTree($uuid); parent::pApiTree($uuid);
@ -47,7 +46,7 @@ class pApiContentAllocationArticle extends pApiTree {
$this->template = $cfg['pica']['treetemplate_article']; $this->template = $cfg['pica']['treetemplate_article'];
} }
function _buildRenderTree ($tree) { function _buildRenderTree($tree) {
global $action, $frame, $area, $sess, $idart; global $action, $frame, $area, $sess, $idart;
$result = array(); $result = array();
@ -55,7 +54,7 @@ class pApiContentAllocationArticle extends pApiTree {
$item = array(); $item = array();
$expandCollapseImg = 'images/spacer.gif'; $expandCollapseImg = 'images/spacer.gif';
$expandCollapse = '<img src="'.$expandCollapseImg.'" border="0" style="vertical-align: middle;" width="11" height="11">'; $expandCollapse = '<img src="' . $expandCollapseImg . '" border="0" style="vertical-align: middle;" width="11" height="11">';
$item['ITEMNAME'] = $expandCollapse . ' ' . $item_tmp['name']; $item['ITEMNAME'] = $expandCollapse . ' ' . $item_tmp['name'];
@ -66,7 +65,7 @@ class pApiContentAllocationArticle extends pApiTree {
if (in_array($item_tmp['idpica_alloc'], $this->load)) { if (in_array($item_tmp['idpica_alloc'], $this->load)) {
$checked = ' checked="checked"'; $checked = ' checked="checked"';
} }
$item['CHECKBOX'] = '<input type="checkbox" name="allocation[]" value="'.$item_tmp['idpica_alloc'].'" '.$checked.' />'; $item['CHECKBOX'] = '<input type="checkbox" name="allocation[]" value="' . $item_tmp['idpica_alloc'] . '" ' . $checked . ' />';
array_push($result, $item); array_push($result, $item);
@ -83,7 +82,7 @@ class pApiContentAllocationArticle extends pApiTree {
$this->load = $load; $this->load = $load;
} }
function renderTree ($return = true) { function renderTree($return = true) {
$this->tpl->reset(); $this->tpl->reset();
$tree = $this->fetchTree(); $tree = $this->fetchTree();
@ -112,6 +111,7 @@ class pApiContentAllocationArticle extends pApiTree {
$this->tpl->generate($this->template); $this->tpl->generate($this->template);
} }
} }
} }
?> ?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -27,8 +28,7 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -37,12 +37,12 @@ class pApiContentAllocationComplexList extends pApiTree {
var $idSetter = true; var $idSetter = true;
var $load = array(); var $load = array();
function pApiContentAllocationComplexList ($uuid) { public function __construct($uuid) {
global $cfg; global $cfg;
parent::pApiTree($uuid); parent::pApiTree($uuid);
} }
function _buildRenderTree ($tree) { public function _buildRenderTree($tree) {
global $action, $frame, $area, $sess, $idart; global $action, $frame, $area, $sess, $idart;
$oldIdSetter = $this->idSetter; $oldIdSetter = $this->idSetter;
@ -73,8 +73,8 @@ class pApiContentAllocationComplexList extends pApiTree {
// for wrapping purposes // for wrapping purposes
$item_tmp['name'] = str_replace('-', '- ', $item_tmp['name']); $item_tmp['name'] = str_replace('-', '- ', $item_tmp['name']);
$checkbox = '<input type="checkbox" name="allocation[]" onClick="addToList(this);" ' . $checked . '" id="e'.$item_tmp['idpica_alloc'].'" value="'.$item_tmp['idpica_alloc'].'" />'; $checkbox = '<input type="checkbox" name="allocation[]" onClick="addToList(this);" ' . $checked . '" id="e' . $item_tmp['idpica_alloc'] . '" value="' . $item_tmp['idpica_alloc'] . '" />';
$item = "\n<li style=\"border-bottom: 1px solid #B3B3B3\" baseClass=\"" . $bgcolor . "\" ".$li_closeElm.">" . $checkbox . " " . $item_tmp['name']; $item = "\n<li style=\"border-bottom: 1px solid #B3B3B3\" baseClass=\"" . $bgcolor . "\" " . $li_closeElm . ">" . $checkbox . " " . $item_tmp['name'];
$result .= $item; $result .= $item;
@ -93,11 +93,11 @@ class pApiContentAllocationComplexList extends pApiTree {
} }
} }
function setChecked($load) { public function setChecked($load) {
$this->load = $load; $this->load = $load;
} }
function renderTree ($return = true) { public function renderTree($return = true) {
$tree = $this->fetchTree(); $tree = $this->fetchTree();
if ($tree === false) { if ($tree === false) {
return false; return false;
@ -109,5 +109,4 @@ class pApiContentAllocationComplexList extends pApiTree {
} }
} }
} }
?> ?>

Datei anzeigen

@ -1,15 +1,9 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
* *
* Description:
* Render selectbox witzh complete content allocation tree
*
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido Backend plugins * @package Contenido Backend plugins
* @version 0.2.1 * @version 0.2.1
* @author Marco Jahn * @author Marco Jahn
@ -19,16 +13,9 @@
* @link http://www.contenido.org * @link http://www.contenido.org
* @since file available since contenido release <= 4.6 * @since file available since contenido release <= 4.6
* *
* {@internal
* created unknown
* modified 2008-07-02, Frederic Schneider, add security fix
*
* $Id: class.content_allocation_selectbox.php 2 2011-07-20 12:00:48Z oldperl $: * $Id: class.content_allocation_selectbox.php 2 2011-07-20 12:00:48Z oldperl $:
* }}
*
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -37,13 +24,13 @@ class pApiContentAllocationSelectBox extends pApiTree {
var $idSetter = true; var $idSetter = true;
var $load = array(); var $load = array();
function pApiContentAllocationComplexList ($uuid) { public function __construct($uuid) {
global $cfg; global $cfg;
parent::pApiTree($uuid); parent::pApiTree($uuid);
} }
function _buildRenderTree ($tree) { public function _buildRenderTree($tree) {
global $action, $frame, $area, $sess, $idart; global $action, $frame, $area, $sess, $idart;
$oldIdSetter = $this->idSetter; $oldIdSetter = $this->idSetter;
@ -59,7 +46,7 @@ class pApiContentAllocationSelectBox extends pApiTree {
$spacer = '|-'; $spacer = '|-';
$spacer = str_pad($spacer, (($item_tmp['level'] + 1) * 2), "--", STR_PAD_RIGHT); $spacer = str_pad($spacer, (($item_tmp['level'] + 1) * 2), "--", STR_PAD_RIGHT);
$result .= '<option value="'.$item_tmp['idpica_alloc'].'_'.$item_tmp['level'].'">'.$spacer . $item_tmp['name'].'</option>'; $result .= '<option value="' . $item_tmp['idpica_alloc'] . '_' . $item_tmp['level'] . '">' . $spacer . $item_tmp['name'] . '</option>';
if ($item_tmp['children']) { if ($item_tmp['children']) {
$children = $this->_buildRenderTree($item_tmp['children']); $children = $this->_buildRenderTree($item_tmp['children']);
@ -70,7 +57,7 @@ class pApiContentAllocationSelectBox extends pApiTree {
return $result; return $result;
} }
function setChecked($load) { public function setChecked($load) {
return false; return false;
} }
@ -78,7 +65,7 @@ class pApiContentAllocationSelectBox extends pApiTree {
* *
* @modified 27.10.2005 $bUseTreeStatus = false (content allocation tree in selectbox is always expanded) * @modified 27.10.2005 $bUseTreeStatus = false (content allocation tree in selectbox is always expanded)
*/ */
function renderTree ($return = true, $parentId = false, $bUseTreeStatus = false) { public function renderTree($return = true, $parentId = false, $bUseTreeStatus = false) {
$tree = $this->fetchTree($parentId, 0, $bUseTreeStatus); $tree = $this->fetchTree($parentId, 0, $bUseTreeStatus);
@ -94,6 +81,7 @@ class pApiContentAllocationSelectBox extends pApiTree {
echo $tree; echo $tree;
} }
} }
} }
?> ?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -27,8 +28,7 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -94,7 +94,7 @@ class pApiTree {
*/ */
var $_arrOutFilters = array('stripslashes', 'htmldecode', 'urldecode'); var $_arrOutFilters = array('stripslashes', 'htmldecode', 'urldecode');
function pApiTree ($uuid) { public function __construct($uuid) {
global $db, $cfg, $lang, $client, $auth; global $db, $cfg, $lang, $client, $auth;
$this->db = new DB_ConLite; $this->db = new DB_ConLite;
@ -116,7 +116,7 @@ class pApiTree {
* @param boolean $bUseTreeStatus (if true use expand/collapsed status of the tree, otherwise not) * @param boolean $bUseTreeStatus (if true use expand/collapsed status of the tree, otherwise not)
* @modified 27.10.2005 Willi Man * @modified 27.10.2005 Willi Man
*/ */
function fetchTree ($parentId = false, $level = 0, $bUseTreeStatus = true) { function fetchTree($parentId = false, $level = 0, $bUseTreeStatus = true) {
// fetch current lang category // fetch current lang category
$sql = "SELECT $sql = "SELECT
@ -140,15 +140,13 @@ class pApiTree {
$itemStatus = 'expanded'; $itemStatus = 'expanded';
if ($bUseTreeStatus) # modified 27.10.2005 if ($bUseTreeStatus) { # modified 27.10.2005
{ if (is_array($this->treeStatus) && array_key_exists($this->db->f('idpica_alloc'), $this->treeStatus)) {
if (is_array($this->treeStatus) && array_key_exists($this->db->f('idpica_alloc'), $this->treeStatus))
{
$itemStatus = 'collapsed'; $itemStatus = 'collapsed';
} }
} }
$rs = array ( $rs = array(
'idpica_alloc' => $this->db->f('idpica_alloc'), 'idpica_alloc' => $this->db->f('idpica_alloc'),
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'), 'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
'sortorder' => $this->db->f('sortorder'), 'sortorder' => $this->db->f('sortorder'),
@ -172,8 +170,7 @@ class pApiTree {
array_push($result, $rs); array_push($result, $rs);
} }
return $result; return $result;
} else } else {
{
return false; return false;
} }
} }
@ -188,7 +185,7 @@ class pApiTree {
* @param int $level * @param int $level
* @return array with content allocation id's * @return array with content allocation id's
*/ */
function fetchTreeIds ($parentId = false, $level = 0, $showOffline = false) { function fetchTreeIds($parentId = false, $level = 0, $showOffline = false) {
// fetch current lang category // fetch current lang category
$sql = "SELECT $sql = "SELECT
@ -204,20 +201,26 @@ class pApiTree {
$sql .= " ORDER BY sortorder ASC"; $sql .= " ORDER BY sortorder ASC";
if ($this->bDebug) {print "<!-- "; print $sql; print " -->";} if ($this->bDebug) {
print "<!-- ";
print $sql;
print " -->";
}
$this->db->query($sql); $this->db->query($sql);
$result_tmp = array(); // tmp result array $result_tmp = array(); // tmp result array
while ($this->db->next_record()) { // walk resultset while ($this->db->next_record()) { // walk resultset
$item = $this->_fetchItemNameLang($this->db->f('idpica_alloc')); $item = $this->_fetchItemNameLang($this->db->f('idpica_alloc'));
if ($this->bDebug) {print "<!-- "; print_r($item); print " -->";} if ($this->bDebug) {
print "<!-- ";
print_r($item);
print " -->";
}
if ($showOffline OR $item['online'] == 1) if ($showOffline OR $item['online'] == 1) {
{ $rs = array(
$rs = array (
'idpica_alloc' => $this->db->f('idpica_alloc') 'idpica_alloc' => $this->db->f('idpica_alloc')
); );
@ -235,8 +238,7 @@ class pApiTree {
array_push($result, $rs); array_push($result, $rs);
} }
return $result; return $result;
} else } else {
{
return false; return false;
} }
} }
@ -250,15 +252,15 @@ class pApiTree {
$this->user->setProperty("expandstate", $this->_uuid, serialize($this->treeStatus)); $this->user->setProperty("expandstate", $this->_uuid, serialize($this->treeStatus));
} }
function loadTreeStatus () { function loadTreeStatus() {
$status = $this->user->getProperty("expandstate", $this->_uuid); $status = $this->user->getProperty("expandstate", $this->_uuid);
if ($status !== false) { if ($status !== false) {
$this->treeStatus = unserialize($status); $this->treeStatus = unserialize($status);
} }
} }
function fetchParent ($idpica_alloc) { function fetchParent($idpica_alloc) {
$sql = "SELECT idpica_alloc FROM ".$this->table['pica_alloc']." WHERE parentId = " . Contenido_Security::toInteger($idpica_alloc); $sql = "SELECT idpica_alloc FROM " . $this->table['pica_alloc'] . " WHERE parentId = " . Contenido_Security::toInteger($idpica_alloc);
$this->db->query($sql); $this->db->query($sql);
if ($this->db->next_record()) { if ($this->db->next_record()) {
@ -268,15 +270,17 @@ class pApiTree {
} }
} }
function fetchParents () {} function fetchParents() {
function fetchLevel ($parentId = false, $showOffline = false) { }
function fetchLevel($parentId = false, $showOffline = false) {
// fetch current lang category // fetch current lang category
$sql = "SELECT $sql = "SELECT
tree.idpica_alloc, tree.parentid, tree.sortorder tree.idpica_alloc, tree.parentid, tree.sortorder
FROM FROM
" . $this->table['pica_alloc'] . " as tree " . $this->table['pica_alloc'] . " as tree
LEFT JOIN ".$this->table['pica_lang']." as treelang USING (idpica_alloc)"; LEFT JOIN " . $this->table['pica_lang'] . " as treelang USING (idpica_alloc)";
if ($parentId === false) { // fetch from root node if ($parentId === false) { // fetch from root node
$sql .= " WHERE tree.parentid IS NULL"; $sql .= " WHERE tree.parentid IS NULL";
@ -301,7 +305,7 @@ class pApiTree {
$itemStatus = 'collapsed'; $itemStatus = 'collapsed';
} }
$rs = array ( $rs = array(
'idpica_alloc' => $this->db->f('idpica_alloc'), 'idpica_alloc' => $this->db->f('idpica_alloc'),
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'), 'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
'sortorder' => $this->db->f('sortorder'), 'sortorder' => $this->db->f('sortorder'),
@ -318,7 +322,7 @@ class pApiTree {
return $result_tmp; return $result_tmp;
} }
function storeItem ($treeItem) { function storeItem($treeItem) {
if (!$treeItem['idpica_alloc']) { // insert if (!$treeItem['idpica_alloc']) { // insert
$treeItem['idpica_alloc'] = $this->db->nextid($this->table['pica_alloc']); $treeItem['idpica_alloc'] = $this->db->nextid($this->table['pica_alloc']);
@ -341,7 +345,6 @@ class pApiTree {
VALUES VALUES
(" . Contenido_Security::toInteger($treeItem['idpica_alloc']) . ", " . Contenido_Security::toInteger($this->lang) . ", '" . Contenido_Security::escapeDB($treeItem['name'], $this->db) . "')"; (" . Contenido_Security::toInteger($treeItem['idpica_alloc']) . ", " . Contenido_Security::toInteger($this->lang) . ", '" . Contenido_Security::escapeDB($treeItem['name'], $this->db) . "')";
$this->db->query($sql); $this->db->query($sql);
} else { // update } else { // update
$treeItem['name'] = $this->_inFilter($treeItem['name']); $treeItem['name'] = $this->_inFilter($treeItem['name']);
@ -364,8 +367,8 @@ class pApiTree {
} }
#Insert new translation #Insert new translation
$sql = "INSERT INTO " . $this->table['pica_lang'] . "(idpica_alloc, idlang, name, online) VALUES ( ".Contenido_Security::toInteger($treeItem['idpica_alloc']).", ".Contenido_Security::toInteger($this->lang).", $sql = "INSERT INTO " . $this->table['pica_lang'] . "(idpica_alloc, idlang, name, online) VALUES ( " . Contenido_Security::toInteger($treeItem['idpica_alloc']) . ", " . Contenido_Security::toInteger($this->lang) . ",
'".Contenido_Security::escapeDB($treeItem['name'], $this->db)."', ".Contenido_Security::toInteger($online_status).")"; '" . Contenido_Security::escapeDB($treeItem['name'], $this->db) . "', " . Contenido_Security::toInteger($online_status) . ")";
} }
$this->db->query($sql); $this->db->query($sql);
@ -374,24 +377,24 @@ class pApiTree {
return $treeItem; return $treeItem;
} }
function setOnline ($idpica_alloc) { function setOnline($idpica_alloc) {
$this->_switchOnOffline($idpica_alloc, 1); $this->_switchOnOffline($idpica_alloc, 1);
} }
function setOffline ($idpica_alloc) { function setOffline($idpica_alloc) {
$this->_switchOnOffline($idpica_alloc, 0); $this->_switchOnOffline($idpica_alloc, 0);
} }
function _switchOnOffline ($idpica_alloc, $status) { function _switchOnOffline($idpica_alloc, $status) {
$sql = "UPDATE " . $this->table['pica_lang'] . " SET online = " . Contenido_Security::toInteger($status) . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . " $sql = "UPDATE " . $this->table['pica_lang'] . " SET online = " . Contenido_Security::toInteger($status) . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . "
AND idlang = " . Contenido_Security::toInteger($this->lang); AND idlang = " . Contenido_Security::toInteger($this->lang);
$this->db->query($sql); $this->db->query($sql);
} }
function itemMoveUp ($idpica_alloc) { function itemMoveUp($idpica_alloc) {
$treeItem = $this->fetchItem($idpica_alloc); $treeItem = $this->fetchItem($idpica_alloc);
$treeItem_old = $treeItem; $treeItem_old = $treeItem;
$treeItem['sortorder']--; $treeItem['sortorder'] --;
if ($treeItem['sortorder'] < $treeItem_old['sortorder']) { if ($treeItem['sortorder'] < $treeItem_old['sortorder']) {
if ($treeItem['sortorder'] >= 1) { if ($treeItem['sortorder'] >= 1) {
@ -406,9 +409,11 @@ class pApiTree {
$this->db->query($sql); $this->db->query($sql);
} }
function itemMoveDown () {} function itemMoveDown() {
function deleteItem ($idpica_alloc) { }
function deleteItem($idpica_alloc) {
$sql = "DELETE FROM " . $this->table['pica_alloc'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc); $sql = "DELETE FROM " . $this->table['pica_alloc'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
$this->db->query($sql); $this->db->query($sql);
@ -419,14 +424,14 @@ class pApiTree {
$this->db->query($sql); $this->db->query($sql);
} }
function fetchItem ($idpica_alloc) { function fetchItem($idpica_alloc) {
$sql = "SELECT parentid, sortorder FROM " . $this->table['pica_alloc'] . " WHERE idpica_alloc = " . $idpica_alloc; $sql = "SELECT parentid, sortorder FROM " . $this->table['pica_alloc'] . " WHERE idpica_alloc = " . $idpica_alloc;
$this->db->query($sql); $this->db->query($sql);
$item = $this->_fetchItemNameLang($idpica_alloc); $item = $this->_fetchItemNameLang($idpica_alloc);
if ($this->db->next_record()) { if ($this->db->next_record()) {
$row = array ( $row = array(
'idpica_alloc' => $idpica_alloc, 'idpica_alloc' => $idpica_alloc,
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'), 'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
'sortorder' => $this->db->f('sortorder'), 'sortorder' => $this->db->f('sortorder'),
@ -440,7 +445,7 @@ class pApiTree {
} }
} }
function _fetchItemNameLang ($idpica_alloc) { function _fetchItemNameLang($idpica_alloc) {
$oDB = new DB_ConLite; // temp instance $oDB = new DB_ConLite; // temp instance
$sSQL = "SELECT name, idlang, online FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . " AND idlang = " . Contenido_Security::toInteger($this->lang); $sSQL = "SELECT name, idlang, online FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . " AND idlang = " . Contenido_Security::toInteger($this->lang);
@ -448,17 +453,14 @@ class pApiTree {
$aResult = array(); $aResult = array();
if ($oDB->next_record()) { // item found for this language if ($oDB->next_record()) { // item found for this language
$aResult['name'] = $this->_outFilter($oDB->f('name')); $aResult['name'] = $this->_outFilter($oDB->f('name'));
$aResult['idlang'] = $oDB->f('idlang'); $aResult['idlang'] = $oDB->f('idlang');
$aResult['online'] = $oDB->f('online'); $aResult['online'] = $oDB->f('online');
} else { // no item in this language found } else { // no item in this language found
// fetch alternative language name // fetch alternative language name
// HerrB, 2008-04-21: Get all translations, try to use defaultLang translation, use // HerrB, 2008-04-21: Get all translations, try to use defaultLang translation, use
// first available, otherwise. Only using defaultLang results in "ghost" elements, if // first available, otherwise. Only using defaultLang results in "ghost" elements, if
// created in a non-default language. See CON-110 for details. // created in a non-default language. See CON-110 for details.
$sSQL = "SELECT name, idlang, online FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . " ORDER BY idlang"; $sSQL = "SELECT name, idlang, online FROM " . $this->table['pica_lang'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc) . " ORDER BY idlang";
$oDB->query($sSQL); $oDB->query($sSQL);
@ -480,13 +482,13 @@ class pApiTree {
$aResult = reset($aNames); $aResult = reset($aNames);
} }
} }
unset ($oDB); unset($oDB);
unset ($aNames); unset($aNames);
return $aResult; return $aResult;
} }
function _fetchMaxOrder ($parentId = false) { function _fetchMaxOrder($parentId = false) {
if ($parentId == 'root') { if ($parentId == 'root') {
$parentId = false; $parentId = false;
@ -506,7 +508,7 @@ class pApiTree {
} }
} }
function _decreaseOrder ($parentId = false, $fromOrder) { function _decreaseOrder($parentId = false, $fromOrder) {
$sql = "UPDATE " . $this->table['pica_alloc'] . " SET sortorder = sortorder - 1 WHERE sortorder >= " . Contenido_Security::toInteger($fromOrder); $sql = "UPDATE " . $this->table['pica_alloc'] . " SET sortorder = sortorder - 1 WHERE sortorder >= " . Contenido_Security::toInteger($fromOrder);
if ($parentId === false) { if ($parentId === false) {
$sql .= " AND parentid IS NULL"; $sql .= " AND parentid IS NULL";
@ -516,7 +518,7 @@ class pApiTree {
$this->db->query($sql); $this->db->query($sql);
} }
function _increaseOrder ($parentId = false, $fromOrder) { function _increaseOrder($parentId = false, $fromOrder) {
$sql = "UPDATE " . $this->table['pica_alloc'] . " SET sortorder = sortorder + 1 WHERE sortorder >= " . Contenido_Security::toInteger($fromOrder); $sql = "UPDATE " . $this->table['pica_alloc'] . " SET sortorder = sortorder + 1 WHERE sortorder >= " . Contenido_Security::toInteger($fromOrder);
if ($parentId === false) { if ($parentId === false) {
$sql .= " AND parentid IS NULL"; $sql .= " AND parentid IS NULL";
@ -526,18 +528,14 @@ class pApiTree {
$this->db->query($sql); $this->db->query($sql);
} }
function setFilters($arrInFilters = array(), $arrOutFilters = array()) function setFilters($arrInFilters = array(), $arrOutFilters = array()) {
{
$this->_arrInFilters = $arrInFilters; $this->_arrInFilters = $arrInFilters;
$this->_arrOutFilters = $arrOutFilters; $this->_arrOutFilters = $arrOutFilters;
} }
function _inFilter($data) function _inFilter($data) {
{ foreach ($this->_arrInFilters as $_function) {
foreach ($this->_arrInFilters as $_function) if (function_exists($_function)) {
{
if (function_exists($_function))
{
$data = $_function($data); $data = $_function($data);
} }
} }
@ -545,18 +543,16 @@ class pApiTree {
return $data; return $data;
} }
function _outFilter($data) function _outFilter($data) {
{ foreach ($this->_arrOutFilters as $_function) {
foreach ($this->_arrOutFilters as $_function) if (function_exists($_function)) {
{
if (function_exists($_function))
{
$data = $_function($data); $data = $_function($data);
} }
} }
return $data; return $data;
} }
} }
?> ?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -28,8 +29,7 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -38,7 +38,6 @@ if(!defined('CON_FRAMEWORK')) {
* - generalize this and papitree !!!! * - generalize this and papitree !!!!
* - Comments! * - Comments!
*/ */
class pApiContentAllocationTreeView extends pApiTree { class pApiContentAllocationTreeView extends pApiTree {
/** /**
@ -54,7 +53,7 @@ class pApiContentAllocationTreeView extends pApiTree {
/** /**
* *
*/ */
function pApiContentAllocationTreeView ($uuid) { public function __construct($uuid) {
global $cfg; global $cfg;
parent::pApiTree($uuid); parent::pApiTree($uuid);
@ -65,7 +64,7 @@ class pApiContentAllocationTreeView extends pApiTree {
/** /**
* *
*/ */
function _buildRenderTree ($tree) { function _buildRenderTree($tree) {
global $action, $frame, $area, $sess; global $action, $frame, $area, $sess;
$result = array(); $result = array();
foreach ($tree as $item_tmp) { foreach ($tree as $item_tmp) {
@ -78,16 +77,16 @@ class pApiContentAllocationTreeView extends pApiTree {
$item['ITEMNAME'] = ' $item['ITEMNAME'] = '
<table cellspacing="0" cellpaddin="0" border="0"> <table cellspacing="0" cellpaddin="0" border="0">
<form name="rename" action="main.php" method="POST" onsubmit="return fieldCheck();"> <form name="rename" action="main.php" method="POST" onsubmit="return fieldCheck();">
<input type="hidden" name="action" value="'.$action.'" /> <input type="hidden" name="action" value="' . $action . '" />
<input type="hidden" name="frame" value="'.$frame.'" /> <input type="hidden" name="frame" value="' . $frame . '" />
<input type="hidden" name="contenido" value="'.$sess->id.'" /> <input type="hidden" name="contenido" value="' . $sess->id . '" />
<input type="hidden" name="area" value="'.$area.'" /> <input type="hidden" name="area" value="' . $area . '" />
<input type="hidden" name="step" value="storeRename" /> <input type="hidden" name="step" value="storeRename" />
<input type="hidden" name="treeItemPost[idpica_alloc]" value="'.$item_tmp['idpica_alloc'].'" /> <input type="hidden" name="treeItemPost[idpica_alloc]" value="' . $item_tmp['idpica_alloc'] . '" />
<tr> <tr>
<td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value="'.$item_tmp['name'].'"></td> <td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value="' . $item_tmp['name'] . '"></td>
<td>&nbsp; <td>&nbsp;
<a href="main.php?action='.$action.'&frame='.$frame.'&area='.$area.'&contenido='.$sess->id.'"><img src="images/but_cancel.gif" border="0" /></a> <a href="main.php?action=' . $action . '&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img src="images/but_cancel.gif" border="0" /></a>
<input type="image" src="images/but_ok.gif" /> <input type="image" src="images/but_ok.gif" />
</td></tr> </td></tr>
</form> </form>
@ -97,7 +96,7 @@ class pApiContentAllocationTreeView extends pApiTree {
controller.focus(); controller.focus();
function fieldCheck() { function fieldCheck() {
if (controller.value == "") { if (controller.value == "") {
alert("'.i18n("Please enter a category name").'"); alert("' . i18n("Please enter a category name") . '");
controller.focus(); controller.focus();
return false; return false;
} }
@ -107,37 +106,37 @@ class pApiContentAllocationTreeView extends pApiTree {
} else { } else {
if ($item_tmp['children'] || $item_tmp['status'] == 'collapsed') { if ($item_tmp['children'] || $item_tmp['status'] == 'collapsed') {
$expandCollapseImg = 'images/close_all.gif'; $expandCollapseImg = 'images/close_all.gif';
if ($item_tmp['status'] == 'collapsed' ) { if ($item_tmp['status'] == 'collapsed') {
$expandCollapseImg = 'images/open_all.gif'; $expandCollapseImg = 'images/open_all.gif';
} }
$expandCollapse = '<a href="main.php?contenido='.$sess->id.'&idart='.$idart.'&action='.$action.'&frame='.$frame.'&area='.$area.'&step=collapse&idpica_alloc='.$item_tmp['idpica_alloc'].'"><img src="'.$expandCollapseImg.'" border="0" style="vertical-align: middle; padding:4px;" width="7" height="7"></a>'; $expandCollapse = '<a href="main.php?contenido=' . $sess->id . '&idart=' . $idart . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=collapse&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="' . $expandCollapseImg . '" border="0" style="vertical-align: middle; padding:4px;" width="7" height="7"></a>';
} else { } else {
$expandCollapseImg = 'images/spacer.gif'; $expandCollapseImg = 'images/spacer.gif';
$expandCollapse = '<img src="'.$expandCollapseImg.'" border="0" style="vertical-align: middle;" width="11" height="11">'; $expandCollapse = '<img src="' . $expandCollapseImg . '" border="0" style="vertical-align: middle;" width="11" height="11">';
} }
$item['ITEMNAME'] = $expandCollapse . ' ' . $item_tmp['name']; $item['ITEMNAME'] = $expandCollapse . ' ' . $item_tmp['name'];
} }
$item['ITEMINDENT'] = $item_tmp['level'] * 15 + 3; $item['ITEMINDENT'] = $item_tmp['level'] * 15 + 3;
$item['ACTION_CREATE'] = '<a href="main.php?contenido='.$sess->id.'&action='.$action.'&frame='.$frame.'&area='.$area.'&step=add&parentid='.$item_tmp['idpica_alloc'].'"><img src="images/folder_new.gif" border="0" title="'.i18n("New category").'" alt="'.i18n("New category").'" /></a>'; $item['ACTION_CREATE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=add&parentid=' . $item_tmp['idpica_alloc'] . '"><img src="images/folder_new.gif" border="0" title="' . i18n("New category") . '" alt="' . i18n("New category") . '" /></a>';
$item['ACTION_RENAME'] = '<a href="main.php?contenido='.$sess->id.'&action='.$action.'&frame='.$frame.'&area='.$area.'&step=rename&idpica_alloc='.$item_tmp['idpica_alloc'].'"><img src="images/but_todo.gif" width="16" height="16" border="0" alt="'.i18n("Rename category").'" title="'.i18n("Rename category").'" /></a>'; $item['ACTION_RENAME'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=rename&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="images/but_todo.gif" width="16" height="16" border="0" alt="' . i18n("Rename category") . '" title="' . i18n("Rename category") . '" /></a>';
$item['ACTION_MOVE_UP'] = (count($result) >= 1) ? '<a href="main.php?contenido='.$sess->id.'&action='.$action.'&frame='.$frame.'&area='.$area.'&step=moveup&idpica_alloc='.$item_tmp['idpica_alloc'].'"><img src="images/folder_moveup.gif" border="0" alt="'.i18n("Move category up").'" title="'.i18n("Move category up").'" /></a>' : '<img src="images/spacer.gif" width="16" height="16" /></a>'; $item['ACTION_MOVE_UP'] = (count($result) >= 1) ? '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=moveup&idpica_alloc=' . $item_tmp['idpica_alloc'] . '"><img src="images/folder_moveup.gif" border="0" alt="' . i18n("Move category up") . '" title="' . i18n("Move category up") . '" /></a>' : '<img src="images/spacer.gif" width="16" height="16" /></a>';
$item['ACTION_MOVE_DOWN'] = (count($result) >= 1) ? '<img src="images/folder_movedown.gif" border="0" alt="'.i18n("Move category down").'" title="'.i18n("Move category down").'" />' : '<img src="images/spacer.gif" width="16" height="16" />'; $item['ACTION_MOVE_DOWN'] = (count($result) >= 1) ? '<img src="images/folder_movedown.gif" border="0" alt="' . i18n("Move category down") . '" title="' . i18n("Move category down") . '" />' : '<img src="images/spacer.gif" width="16" height="16" />';
$item['ACTION_MOVE_DOWN'] = ''; $item['ACTION_MOVE_DOWN'] = '';
if ($item_tmp['online'] == 1) { // set offline if ($item_tmp['online'] == 1) { // set offline
$item['ACTION_ONOFFLINE'] = '<a href="main.php?contenido='.$sess->id.'&action='.$action.'&frame='.$frame.'&area='.$area.'&step=offline&idpica_alloc='.$item_tmp['idpica_alloc'].'""><img src="images/online.gif" alt="'.i18n("Set category offline").'" title="'.i18n("Set category offline").'"></a>'; $item['ACTION_ONOFFLINE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=offline&idpica_alloc=' . $item_tmp['idpica_alloc'] . '""><img src="images/online.gif" alt="' . i18n("Set category offline") . '" title="' . i18n("Set category offline") . '"></a>';
} else { } else {
$item['ACTION_ONOFFLINE'] = '<a href="main.php?contenido='.$sess->id.'&action='.$action.'&frame='.$frame.'&area='.$area.'&step=online&idpica_alloc='.$item_tmp['idpica_alloc'].'""><img src="images/offline.gif" alt="'.i18n("Set category online").'" title="'.i18n("Set category online").'"></a>'; $item['ACTION_ONOFFLINE'] = '<a href="main.php?contenido=' . $sess->id . '&action=' . $action . '&frame=' . $frame . '&area=' . $area . '&step=online&idpica_alloc=' . $item_tmp['idpica_alloc'] . '""><img src="images/offline.gif" alt="' . i18n("Set category online") . '" title="' . i18n("Set category online") . '"></a>';
} }
if ($item_tmp['children']) { if ($item_tmp['children']) {
$item['ACTION_DELETE'] = '<img src="images/delete_inact.gif" border="0" alt="'.i18n("One or more subcategories exist, unable to delete").'" title="'.i18n("One or more subcategories exist, unable to delete").'">'; $item['ACTION_DELETE'] = '<img src="images/delete_inact.gif" border="0" alt="' . i18n("One or more subcategories exist, unable to delete") . '" title="' . i18n("One or more subcategories exist, unable to delete") . '">';
} else { } else {
$item['ACTION_DELETE'] = '<a href="javascript://" onclick="box.confirm(&quot;'.i18n("Delete category").'&quot;, &quot;'.i18n("Are you sure to delete the following category").':<br><br><b>'.str_replace("'", "\'", $item_tmp['name']).'</b>&quot;,&quot;deleteCategory('.$item_tmp['idpica_alloc'].')&quot;);"><img src="images/delete.gif" border="0" alt="'.i18n("Delete category").'" title="'.i18n("Delete category").'"></a>'; $item['ACTION_DELETE'] = '<a href="javascript://" onclick="box.confirm(&quot;' . i18n("Delete category") . '&quot;, &quot;' . i18n("Are you sure to delete the following category") . ':<br><br><b>' . str_replace("'", "\'", $item_tmp['name']) . '</b>&quot;,&quot;deleteCategory(' . $item_tmp['idpica_alloc'] . ')&quot;);"><img src="images/delete.gif" border="0" alt="' . i18n("Delete category") . '" title="' . i18n("Delete category") . '"></a>';
} }
array_push($result, $item); array_push($result, $item);
@ -154,16 +153,16 @@ class pApiContentAllocationTreeView extends pApiTree {
$item['ITEMNAME'] = ' $item['ITEMNAME'] = '
<table cellspacing="0" cellpaddin="0" border="0"> <table cellspacing="0" cellpaddin="0" border="0">
<form name="create" action="main.php" method="POST" onsubmit="return fieldCheck();"> <form name="create" action="main.php" method="POST" onsubmit="return fieldCheck();">
<input type="hidden" name="action" value="'.$action.'" /> <input type="hidden" name="action" value="' . $action . '" />
<input type="hidden" name="frame" value="'.$frame.'" /> <input type="hidden" name="frame" value="' . $frame . '" />
<input type="hidden" name="contenido" value="'.$sess->id.'" /> <input type="hidden" name="contenido" value="' . $sess->id . '" />
<input type="hidden" name="area" value="'.$area.'" /> <input type="hidden" name="area" value="' . $area . '" />
<input type="hidden" name="step" value="store" /> <input type="hidden" name="step" value="store" />
<input type="hidden" name="treeItemPost[parentid]" value="'.$_GET['parentid'].'" /> <input type="hidden" name="treeItemPost[parentid]" value="' . $_GET['parentid'] . '" />
<tr> <tr>
<td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value=""></td> <td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value=""></td>
<td>&nbsp; <td>&nbsp;
<a href="main.php?action='.$action.'&frame='.$frame.'&area='.$area.'&contenido='.$sess->id.'"><img src="images/but_cancel.gif" border="0" /></a> <a href="main.php?action=' . $action . '&frame=' . $frame . '&area=' . $area . '&contenido=' . $sess->id . '"><img src="images/but_cancel.gif" border="0" /></a>
<input type="image" src="images/but_ok.gif" /> <input type="image" src="images/but_ok.gif" />
</td></tr> </td></tr>
</form> </form>
@ -173,7 +172,7 @@ class pApiContentAllocationTreeView extends pApiTree {
controller.focus(); controller.focus();
function fieldCheck() { function fieldCheck() {
if (controller.value == "") { if (controller.value == "") {
alert("'.i18n("Please enter a category name").'"); alert("' . i18n("Please enter a category name") . '");
controller.focus(); controller.focus();
return false; return false;
} }
@ -198,7 +197,7 @@ class pApiContentAllocationTreeView extends pApiTree {
/** /**
* *
*/ */
function renderTree ($return = true) { function renderTree($return = true) {
$this->tpl->reset(); $this->tpl->reset();
$tree = $this->fetchTree(false, 0, true); # modified 27.10.2005 $tree = $this->fetchTree(false, 0, true); # modified 27.10.2005
@ -229,6 +228,7 @@ class pApiContentAllocationTreeView extends pApiTree {
$this->tpl->generate($this->template); $this->tpl->generate($this->template);
} }
} }
} }
?> ?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* file FrontendNavigation.php * file FrontendNavigation.php
* *
@ -8,14 +9,12 @@
* @created 25.03.2005 * @created 25.03.2005
* @modified 22.11.2005 * @modified 22.11.2005
*/ */
class FrontendNavigation {
class FrontendNavigation
{
/** /**
* Constructor * Constructor
*/ */
function FrontendNavigation($db, $cfg, $cfgClient, $client, $lang) public function __construct($db, $cfg, $cfgClient, $client, $lang) {
{
$this->_bDebug = false; $this->_bDebug = false;
$this->db = &$db; $this->db = &$db;
$this->cfgClient = &$cfgClient; $this->cfgClient = &$cfgClient;
@ -27,37 +26,38 @@ class FrontendNavigation
/** /**
* Get child categories by given parent category * Get child categories by given parent category
*/ */
function getSubCategories($iParentCategory) public function getSubCategories($iParentCategory) {
{ if (!is_int((int) $iParentCategory) AND $iParentCategory < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$iParentCategory) AND $iParentCategory < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return array(); return array();
} }
$sql = "SELECT $sql = "SELECT
A.idcat A.idcat
FROM FROM
".$this->cfg["tab"]["cat_tree"]." AS A, " . $this->cfg["tab"]["cat_tree"] . " AS A,
".$this->cfg["tab"]["cat"]." AS B, " . $this->cfg["tab"]["cat"] . " AS B,
".$this->cfg["tab"]["cat_lang"]." AS C " . $this->cfg["tab"]["cat_lang"] . " AS C
WHERE WHERE
A.idcat = B.idcat AND A.idcat = B.idcat AND
B.idcat = C.idcat AND B.idcat = C.idcat AND
B.idclient = ".$this->client." AND B.idclient = " . $this->client . " AND
C.idlang = ".$this->lang." AND C.idlang = " . $this->lang . " AND
C.visible = 1 AND C.visible = 1 AND
C.public = 1 AND C.public = 1 AND
B.parentid = ".$iParentCategory." B.parentid = " . $iParentCategory . "
ORDER BY ORDER BY
A.idtree "; A.idtree ";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
$navigation = array(); $navigation = array();
while ( $this->db->next_record() ) while ($this->db->next_record()) {
{
$navigation[] = $this->db->f("idcat"); $navigation[] = $this->db->f("idcat");
}# end while }# end while
@ -67,35 +67,35 @@ class FrontendNavigation
/** /**
* Check if child categories of a given parent category exist * Check if child categories of a given parent category exist
*/ */
function hasChildren($iParentCategory) public function hasChildren($iParentCategory) {
{ if (!is_int((int) $iParentCategory) AND $iParentCategory < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$iParentCategory) AND $iParentCategory < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return false; return false;
} }
$sql = "SELECT $sql = "SELECT
B.idcat B.idcat
FROM FROM
".$this->cfg["tab"]["cat"]." AS B, " . $this->cfg["tab"]["cat"] . " AS B,
".$this->cfg["tab"]["cat_lang"]." AS C " . $this->cfg["tab"]["cat_lang"] . " AS C
WHERE WHERE
B.idcat = C.idcat AND B.idcat = C.idcat AND
B.idclient = ".$this->client." AND B.idclient = " . $this->client . " AND
C.idlang = ".$this->lang." AND C.idlang = " . $this->lang . " AND
C.visible = 1 AND C.visible = 1 AND
C.public = 1 AND C.public = 1 AND
B.parentid = ".$iParentCategory." "; B.parentid = " . $iParentCategory . " ";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
if ( $this->db->next_record() ) if ($this->db->next_record()) {
{
return true; return true;
}else } else {
{
return false; return false;
} }
} }
@ -105,36 +105,36 @@ class FrontendNavigation
* Note: does not work if direct successor (with preid 0) is not visible * Note: does not work if direct successor (with preid 0) is not visible
* or not public * or not public
*/ */
function getSuccessor($iCategory) public function getSuccessor($iCategory) {
{ if (!is_int((int) $iCategory) AND $iCategory < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$iCategory) AND $iCategory < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return -1; return -1;
} }
$sql = "SELECT $sql = "SELECT
B.idcat B.idcat
FROM FROM
".$this->cfg["tab"]["cat"]." AS B, " . $this->cfg["tab"]["cat"] . " AS B,
".$this->cfg["tab"]["cat_lang"]." AS C " . $this->cfg["tab"]["cat_lang"] . " AS C
WHERE WHERE
B.idcat = C.idcat AND B.idcat = C.idcat AND
B.idclient = ".$this->client." AND B.idclient = " . $this->client . " AND
C.idlang = ".$this->lang." AND C.idlang = " . $this->lang . " AND
C.visible = 1 AND C.visible = 1 AND
C.public = 1 AND C.public = 1 AND
B.preid = 0 AND B.preid = 0 AND
B.parentid = ".$iCategory." "; B.parentid = " . $iCategory . " ";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
if ( $this->db->next_record() ) if ($this->db->next_record()) {
{
return $this->db->f("idcat"); return $this->db->f("idcat");
}else } else {
{
return -1; return -1;
} }
} }
@ -142,72 +142,71 @@ class FrontendNavigation
/** /**
* Check if a given category has a direct successor * Check if a given category has a direct successor
*/ */
function hasSuccessor($iCategory) function hasSuccessor($iCategory) {
{ if (!is_int((int) $iCategory) AND $iCategory < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$iCategory) AND $iCategory < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return false; return false;
} }
$sql = "SELECT $sql = "SELECT
B.idcat B.idcat
FROM FROM
".$this->cfg["tab"]["cat"]." AS B, " . $this->cfg["tab"]["cat"] . " AS B,
".$this->cfg["tab"]["cat_lang"]." AS C " . $this->cfg["tab"]["cat_lang"] . " AS C
WHERE WHERE
B.idcat = C.idcat AND B.idcat = C.idcat AND
B.idclient = ".$this->client." AND B.idclient = " . $this->client . " AND
C.idlang = ".$this->lang." AND C.idlang = " . $this->lang . " AND
C.visible = 1 AND C.visible = 1 AND
C.public = 1 AND C.public = 1 AND
B.preid = 0 AND B.preid = 0 AND
B.parentid = ".$iCategory." "; B.parentid = " . $iCategory . " ";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
if ( $this->db->next_record() ) if ($this->db->next_record()) {
{
return true; return true;
}else } else {
{
return false; return false;
} }
} }
/** /**
* Get category name * Get category name
*/ */
function getCategoryName($cat_id) function getCategoryName($cat_id) {
{ if (!is_int((int) $cat_id) AND $cat_id < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$cat_id) AND $cat_id < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return ''; return '';
} }
$sql = "SELECT $sql = "SELECT
B.name B.name
FROM FROM
".$this->cfg["tab"]["cat"]." AS A, " . $this->cfg["tab"]["cat"] . " AS A,
".$this->cfg["tab"]["cat_lang"]." AS B " . $this->cfg["tab"]["cat_lang"] . " AS B
WHERE WHERE
A.idcat = B.idcat AND A.idcat = B.idcat AND
A.idcat = $cat_id AND A.idcat = $cat_id AND
A.idclient = ".$this->client." AND A.idclient = " . $this->client . " AND
B.idlang = ".$this->lang." B.idlang = " . $this->lang . "
"; ";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
if ($this->db->next_record()) if ($this->db->next_record()) {
{
return $this->db->f("name"); return $this->db->f("name");
}else } else {
{
return ''; return '';
} }
} }
@ -215,34 +214,34 @@ class FrontendNavigation
/** /**
* Get category urlname * Get category urlname
*/ */
function getCategoryURLName($cat_id) function getCategoryURLName($cat_id) {
{ if (!is_int((int) $cat_id) AND $cat_id < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$cat_id) AND $cat_id < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return ''; return '';
} }
$sql = "SELECT $sql = "SELECT
B.urlname B.urlname
FROM FROM
".$this->cfg["tab"]["cat"]." AS A, " . $this->cfg["tab"]["cat"] . " AS A,
".$this->cfg["tab"]["cat_lang"]." AS B " . $this->cfg["tab"]["cat_lang"] . " AS B
WHERE WHERE
A.idcat = B.idcat AND A.idcat = B.idcat AND
A.idcat = $cat_id AND A.idcat = $cat_id AND
A.idclient = ".$this->client." AND A.idclient = " . $this->client . " AND
B.idlang = ".$this->lang." B.idlang = " . $this->lang . "
"; ";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
if ($this->db->next_record()) if ($this->db->next_record()) {
{
return $this->db->f("urlname"); return $this->db->f("urlname");
}else } else {
{
return ''; return '';
} }
} }
@ -250,35 +249,35 @@ class FrontendNavigation
/** /**
* Check if category is visible * Check if category is visible
*/ */
function isVisible($cat_id) function isVisible($cat_id) {
{ if (!is_int((int) $cat_id) AND $cat_id < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$cat_id) AND $cat_id < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return false; return false;
} }
$sql = "SELECT $sql = "SELECT
B.visible B.visible
FROM FROM
".$this->cfg["tab"]["cat"]." AS A, " . $this->cfg["tab"]["cat"] . " AS A,
".$this->cfg["tab"]["cat_lang"]." AS B " . $this->cfg["tab"]["cat_lang"] . " AS B
WHERE WHERE
A.idcat = B.idcat AND A.idcat = B.idcat AND
A.idcat = $cat_id AND A.idcat = $cat_id AND
A.idclient = ".$this->client." AND A.idclient = " . $this->client . " AND
B.idlang = ".$this->lang." B.idlang = " . $this->lang . "
"; ";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
$this->db->next_record(); $this->db->next_record();
if ($this->db->f("visible") == 1) if ($this->db->f("visible") == 1) {
{
return true; return true;
}else } else {
{
return false; return false;
} }
} }
@ -286,35 +285,35 @@ class FrontendNavigation
/** /**
* Check if category is public * Check if category is public
*/ */
function isPublic($cat_id) function isPublic($cat_id) {
{ if (!is_int((int) $cat_id) AND $cat_id < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$cat_id) AND $cat_id < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return false; return false;
} }
$sql = "SELECT $sql = "SELECT
B.public B.public
FROM FROM
".$this->cfg["tab"]["cat"]." AS A, " . $this->cfg["tab"]["cat"] . " AS A,
".$this->cfg["tab"]["cat_lang"]." AS B " . $this->cfg["tab"]["cat_lang"] . " AS B
WHERE WHERE
A.idcat = B.idcat AND A.idcat = B.idcat AND
A.idcat = $cat_id AND A.idcat = $cat_id AND
A.idclient = ".$this->client." AND A.idclient = " . $this->client . " AND
B.idlang = ".$this->lang." B.idlang = " . $this->lang . "
"; ";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
$this->db->next_record(); $this->db->next_record();
if ($this->db->f("public") == 1) if ($this->db->f("public") == 1) {
{
return true; return true;
}else } else {
{
return false; return false;
} }
} }
@ -322,36 +321,36 @@ class FrontendNavigation
/** /**
* Return true if $parentid is parent of $catid * Return true if $parentid is parent of $catid
*/ */
function isParent($parentid, $catid) function isParent($parentid, $catid) {
{ if (!is_int((int) $parentid) AND $parentid < 0 AND ! is_int((int) $catid) AND $catid < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$parentid) AND $parentid < 0 AND !is_int((int)$catid) AND $catid < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return false; return false;
} }
$sql = "SELECT $sql = "SELECT
a.parentid a.parentid
FROM FROM
".$this->cfg["tab"]["cat"]." AS a, " . $this->cfg["tab"]["cat"] . " AS a,
".$this->cfg["tab"]["cat_lang"]." AS b " . $this->cfg["tab"]["cat_lang"] . " AS b
WHERE WHERE
a.idclient = ".$this->client." AND a.idclient = " . $this->client . " AND
b.idlang = ".$this->lang." AND b.idlang = " . $this->lang . " AND
a.idcat = b.idcat AND a.idcat = b.idcat AND
a.idcat = ".$catid." "; a.idcat = " . $catid . " ";
$this->db->query($sql); $this->db->query($sql);
$this->db->next_record(); $this->db->next_record();
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$pre = $this->db->f("parentid"); $pre = $this->db->f("parentid");
if($parentid == $pre) if ($parentid == $pre) {
{
return true; return true;
}else } else {
{
return false; return false;
} }
} }
@ -359,33 +358,33 @@ class FrontendNavigation
/** /**
* Get parent id of a category * Get parent id of a category
*/ */
function getParent($preid) function getParent($preid) {
{ if (!is_int((int) $preid) AND $preid < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$preid) AND $preid < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return -1; return -1;
} }
$sql = "SELECT $sql = "SELECT
a.parentid a.parentid
FROM FROM
".$this->cfg["tab"]["cat"]." AS a, " . $this->cfg["tab"]["cat"] . " AS a,
".$this->cfg["tab"]["cat_lang"]." AS b " . $this->cfg["tab"]["cat_lang"] . " AS b
WHERE WHERE
a.idclient = ".$this->client." AND a.idclient = " . $this->client . " AND
b.idlang = ".$this->lang." AND b.idlang = " . $this->lang . " AND
a.idcat = b.idcat AND a.idcat = b.idcat AND
a.idcat = ".$preid." "; a.idcat = " . $preid . " ";
$this->db->query($sql); $this->db->query($sql);
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
if ($this->db->next_record()) if ($this->db->next_record()) {
{
return $this->db->f("parentid"); return $this->db->f("parentid");
}else } else {
{
return -1; return -1;
} }
} }
@ -393,33 +392,33 @@ class FrontendNavigation
/** /**
* Check if a category has a parent * Check if a category has a parent
*/ */
function hasParent($preid) function hasParent($preid) {
{ if (!is_int((int) $preid) AND $preid < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$preid) AND $preid < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return false; return false;
} }
$sql = "SELECT $sql = "SELECT
a.parentid a.parentid
FROM FROM
".$this->cfg["tab"]["cat"]." AS a, " . $this->cfg["tab"]["cat"] . " AS a,
".$this->cfg["tab"]["cat_lang"]." AS b " . $this->cfg["tab"]["cat_lang"] . " AS b
WHERE WHERE
a.idclient = ".$this->client." AND a.idclient = " . $this->client . " AND
b.idlang = ".$this->lang." AND b.idlang = " . $this->lang . " AND
a.idcat = b.idcat AND a.idcat = b.idcat AND
a.idcat = ".$preid." "; a.idcat = " . $preid . " ";
$this->db->query($sql); $this->db->query($sql);
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
if ($this->db->next_record()) if ($this->db->next_record()) {
{
return true; return true;
}else } else {
{
return false; return false;
} }
} }
@ -427,29 +426,29 @@ class FrontendNavigation
/** /**
* Get level of a category * Get level of a category
*/ */
function getLevel($catid) function getLevel($catid) {
{ if (!is_int((int) $catid) AND $catid < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
if (!is_int((int)$catid) AND $catid < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0)
{
return -1; return -1;
} }
$sql = "SELECT $sql = "SELECT
level level
FROM FROM
".$this->cfg["tab"]["cat_tree"]." " . $this->cfg["tab"]["cat_tree"] . "
WHERE WHERE
idcat = ".$catid." "; idcat = " . $catid . " ";
$this->db->query($sql); $this->db->query($sql);
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
if ($this->db->next_record()) if ($this->db->next_record()) {
{
return $this->db->f("level"); return $this->db->f("level");
}else } else {
{
return -1; return -1;
} }
} }
@ -465,31 +464,23 @@ class FrontendNavigation
* @author Willi Man * @author Willi Man
* @access public * @access public
*/ */
function getFrontContentUrl($iIdcat, $iIdart, $bAbsolute = true) function getFrontContentUrl($iIdcat, $iIdart, $bAbsolute = true) {
{ if (!is_int((int) $iIdcat) AND $iIdcat < 0) {
if (!is_int((int)$iIdcat) AND $iIdcat < 0)
{
return ''; return '';
} }
if ($bAbsolute === true) if ($bAbsolute === true) {
{
# add absolute web path to urlpath # add absolute web path to urlpath
if (is_int((int)$iIdart) AND $iIdart > 0) if (is_int((int) $iIdart) AND $iIdart > 0) {
{ $sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat=' . $iIdcat . '&idart=' . $iIdart;
$sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat='.$iIdcat.'&idart='.$iIdart; } else {
}else $sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat=' . $iIdcat;
{
$sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat='.$iIdcat;
} }
}else } else {
{ if (is_int((int) $iIdart) AND $iIdart > 0) {
if (is_int((int)$iIdart) AND $iIdart > 0) $sURL = 'front_content.php?idcat=' . $iIdcat . '&idart=' . $iIdart;
{ } else {
$sURL = 'front_content.php?idcat='.$iIdcat.'&idart='.$iIdart; $sURL = 'front_content.php?idcat=' . $iIdcat;
}else
{
$sURL = 'front_content.php?idcat='.$iIdcat;
} }
} }
@ -510,40 +501,31 @@ class FrontendNavigation
* @modified by Willi Man * @modified by Willi Man
* @access public * @access public
*/ */
function getUrlPath($iIdcat, $iIdart, $bAbsolute = true, $iLevel = 0, $sURL_SUFFIX = 'index.html') function getUrlPath($iIdcat, $iIdart, $bAbsolute = true, $iLevel = 0, $sURL_SUFFIX = 'index.html') {
{ if (!is_int((int) $iIdcat) AND $iIdcat < 0) {
if (!is_int((int)$iIdcat) AND $iIdcat < 0)
{
return ''; return '';
} }
$cat_str = ''; $cat_str = '';
prCreateURLNameLocationString($iIdcat, "/", $cat_str, false, "", $iLevel, $this->lang, true, false); prCreateURLNameLocationString($iIdcat, "/", $cat_str, false, "", $iLevel, $this->lang, true, false);
if (strlen($cat_str) <= 1) if (strlen($cat_str) <= 1) {
{
# return empty string if no url location is available # return empty string if no url location is available
return ''; return '';
} }
if ($bAbsolute === true) if ($bAbsolute === true) {
{
# add absolute web path to urlpath # add absolute web path to urlpath
if (is_int((int)$iIdart) AND $iIdart > 0) if (is_int((int) $iIdart) AND $iIdart > 0) {
{ return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-d-' . $iIdart . '.html';
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-d-'.$iIdart.'.html'; } else {
}else return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/' . $sURL_SUFFIX;
{
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/'.$sURL_SUFFIX;
} }
}else } else {
{ if (is_int((int) $iIdart) AND $iIdart > 0) {
if (is_int((int)$iIdart) AND $iIdart > 0) return $cat_str . '/index-d-' . $iIdart . '.html';
{ } else {
return $cat_str . '/index-d-'.$iIdart.'.html'; return $cat_str . '/' . $sURL_SUFFIX;
}else
{
return $cat_str . '/'.$sURL_SUFFIX;
} }
} }
} }
@ -561,34 +543,27 @@ class FrontendNavigation
* *
* @access public * @access public
*/ */
function getUrlPathGenParam($iIdcat, $iSelectedNumber, $bAbsolute = true, $iLevel = 0) function getUrlPathGenParam($iIdcat, $iSelectedNumber, $bAbsolute = true, $iLevel = 0) {
{ if (!is_int((int) $iIdcat) AND $iIdcat < 0) {
if (!is_int((int)$iIdcat) AND $iIdcat < 0)
{
return ''; return '';
} }
$cat_str = ''; $cat_str = '';
prCreateURLNameLocationString($iIdcat, "/", $cat_str, false, "", $iLevel, $this->lang, true, false); prCreateURLNameLocationString($iIdcat, "/", $cat_str, false, "", $iLevel, $this->lang, true, false);
if (strlen($cat_str) <= 1) if (strlen($cat_str) <= 1) {
{
# return empty string if no url location is available # return empty string if no url location is available
return ''; return '';
} }
if ($bAbsolute === true) if ($bAbsolute === true) {
{
# add absolute web path to urlpath # add absolute web path to urlpath
if (is_int((int)$iSelectedNumber)) if (is_int((int) $iSelectedNumber)) {
{ return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-g-' . $iSelectedNumber . '.html';
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-g-'.$iSelectedNumber.'.html';
} }
}else } else {
{ if (is_int((int) $iSelectedNumber)) {
if (is_int((int)$iSelectedNumber)) return $cat_str . '/index-g-' . $iSelectedNumber . '.html';
{
return $cat_str . '/index-g-'.$iSelectedNumber.'.html';
} }
} }
} }
@ -604,17 +579,14 @@ class FrontendNavigation
* @author Willi Man * @author Willi Man
* @access public * @access public
*/ */
function getURL($iIdcat, $iIdart, $sType = '', $bAbsolute = true, $iLevel = 0) function getURL($iIdcat, $iIdart, $sType = '', $bAbsolute = true, $iLevel = 0) {
{ if (!is_int((int) $iIdcat) AND $iIdcat < 0) {
if (!is_int((int)$iIdcat) AND $iIdcat < 0)
{
return ''; return '';
} }
#print "type ".$sType."<br>"; #print "type ".$sType."<br>";
switch ($sType) switch ($sType) {
{
case 'urlpath': case 'urlpath':
$sURL = $this->getUrlPath($iIdcat, $iIdart, $bAbsolute, $iLevel); $sURL = $this->getUrlPath($iIdcat, $iIdart, $bAbsolute, $iLevel);
break; break;
@ -641,43 +613,44 @@ class FrontendNavigation
* @param int $iArticleId * @param int $iArticleId
* @return int category id * @return int category id
*/ */
function getCategoryOfArticle ($iArticleId) function getCategoryOfArticle($iArticleId) {
{
# validate input # validate input
if (!is_int((int)$iArticleId) OR $iArticleId <= 0) { return -1; } if (!is_int((int) $iArticleId) OR $iArticleId <= 0) {
return -1;
}
$sqlString = ' $sqlString = '
SELECT SELECT
c.idcat c.idcat
FROM FROM
'.$this->cfg['tab']['art_lang'].' AS a, ' . $this->cfg['tab']['art_lang'] . ' AS a,
'.$this->cfg['tab']['art'].' AS b, ' . $this->cfg['tab']['art'] . ' AS b,
'.$this->cfg['tab']['cat_art'].' AS c ' . $this->cfg['tab']['cat_art'] . ' AS c
WHERE WHERE
a.idart = '.$iArticleId.' AND a.idart = ' . $iArticleId . ' AND
b.idclient = '.$this->client.' AND b.idclient = ' . $this->client . ' AND
a.idlang = '.$this->lang.' AND a.idlang = ' . $this->lang . ' AND
b.idart = c.idart AND b.idart = c.idart AND
a.idart = b.idart '; a.idart = b.idart ';
if ($this->_bDebug) {echo "<pre>".$sqlString."</pre>";} if ($this->_bDebug) {
echo "<pre>" . $sqlString . "</pre>";
}
$this->db->query($sqlString); $this->db->query($sqlString);
# $this->db->Errno returns 0 (zero) if no error occurred. # $this->db->Errno returns 0 (zero) if no error occurred.
if ($this->db->Errno == 0) if ($this->db->Errno == 0) {
{ if ($this->db->next_record()) {
if ($this->db->next_record())
{
return $this->db->f('idcat'); return $this->db->f('idcat');
}else } else {
{
return -1; return -1;
} }
}else } else {
{ if ($this->_bDebug) {
if ($this->_bDebug) {echo "<pre>Mysql Error:".$this->db->Error."(".$this->db->Errno.")</pre>";} echo "<pre>Mysql Error:" . $this->db->Error . "(" . $this->db->Errno . ")</pre>";
}
return -1; # error occurred. return -1; # error occurred.
} }
} }
@ -685,10 +658,8 @@ class FrontendNavigation
/** /**
* Get path of a given category up to a certain level * Get path of a given category up to a certain level
*/ */
function getCategoryPath($cat_id, $level = 0, $reverse = true) function getCategoryPath($cat_id, $level = 0, $reverse = true) {
{ if (!is_int((int) $cat_id) AND $cat_id < 0) {
if (!is_int((int)$cat_id) AND $cat_id < 0)
{
return array(); return array();
} }
@ -696,17 +667,14 @@ class FrontendNavigation
array_push($root_path, $cat_id); array_push($root_path, $cat_id);
$parent_id = $cat_id; $parent_id = $cat_id;
while ($this->getLevel($parent_id) >= 0 AND $this->getLevel($parent_id) > $level) while ($this->getLevel($parent_id) >= 0 AND $this->getLevel($parent_id) > $level) {
{
$parent_id = $this->getParent($parent_id); $parent_id = $this->getParent($parent_id);
if ($parent_id >= 0) if ($parent_id >= 0) {
{
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);
} }
@ -716,17 +684,14 @@ class FrontendNavigation
/** /**
* Get root category of a given category * Get root category of a given category
*/ */
function getRoot($cat_id) function getRoot($cat_id) {
{ if (!is_int((int) $cat_id) AND $cat_id < 0) {
if (!is_int((int)$cat_id) AND $cat_id < 0)
{
return array(); return array();
} }
$parent_id = $cat_id; $parent_id = $cat_id;
while ($this->getLevel($parent_id) >= 0) while ($this->getLevel($parent_id) >= 0) {
{
$iRootCategory = $parent_id; $iRootCategory = $parent_id;
$parent_id = $this->getParent($parent_id); $parent_id = $this->getParent($parent_id);
} }
@ -742,55 +707,51 @@ class FrontendNavigation
* *
* @copyright four for business AG <www.4fb.de> * @copyright four for business AG <www.4fb.de>
*/ */
function getSubTree($idcat_start) function getSubTree($idcat_start) {
{
if (!is_int((int)$idcat_start) AND $idcat_start < 0 AND !is_array($this->cfg) AND !isset($this->cfg['tab']) AND !is_int((int)$this->client) AND $this->client < 0 AND !is_int((int)$this->lang) AND $this->lang < 0) if (!is_int((int) $idcat_start) AND $idcat_start < 0 AND ! is_array($this->cfg) AND ! isset($this->cfg['tab']) AND ! is_int((int) $this->client) AND $this->client < 0 AND ! is_int((int) $this->lang) AND $this->lang < 0) {
{
return array(); return array();
} }
$sql = "SELECT $sql = "SELECT
B.idcat, A.level B.idcat, A.level
FROM FROM
".$this->cfg["tab"]["cat_tree"]." AS A, " . $this->cfg["tab"]["cat_tree"] . " AS A,
".$this->cfg["tab"]["cat"]." AS B " . $this->cfg["tab"]["cat"] . " AS B
WHERE WHERE
A.idcat = B.idcat AND A.idcat = B.idcat AND
idclient = ".$this->client." idclient = " . $this->client . "
ORDER BY ORDER BY
idtree"; idtree";
if ($this->_bDebug) {echo "<pre>"; print_r($sql); echo "</pre>";} if ($this->_bDebug) {
echo "<pre>";
print_r($sql);
echo "</pre>";
}
$this->db->query($sql); $this->db->query($sql);
$i = false; $i = false;
while ( $this->db->next_record() ) while ($this->db->next_record()) {
{ if ($this->db->f("idcat") == $idcat_start) {
if ($this->db->f("idcat") == $idcat_start)
{
$curLevel = $this->db->f("level"); $curLevel = $this->db->f("level");
$i = true; $i = true;
}else } else {
{ if ($curLevel == $this->db->f("level")) {
if ($curLevel == $this->db->f("level"))
{
# ending part of tree # ending part of tree
$i = false; $i = false;
} }
} }
if ($i == true) if ($i == true) {
{
$deeper_cats[] = $this->db->f("idcat"); $deeper_cats[] = $this->db->f("idcat");
} }
} }
return $deeper_cats; return $deeper_cats;
} }
} }
?> ?>