fixes for php7
Dieser Commit ist enthalten in:
Ursprung
c92b578d39
Commit
8da8f2a18d
|
@ -1,15 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* CSV Handling class
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.0.4
|
||||
* @author Timo A. Hummel
|
||||
|
@ -19,57 +13,45 @@
|
|||
* @link http://www.contenido.org
|
||||
* @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 $:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
class CSV
|
||||
{
|
||||
class CSV {
|
||||
|
||||
var $_data = array();
|
||||
var $_delimiter;
|
||||
|
||||
function CSV ()
|
||||
{
|
||||
public function __construct() {
|
||||
$this->_delimiter = ";";
|
||||
}
|
||||
|
||||
function setRow ($row)
|
||||
{
|
||||
public function setRow($row) {
|
||||
$args = func_num_args();
|
||||
|
||||
for ($arg=1;$arg<$args;$arg++)
|
||||
{
|
||||
for ($arg = 1; $arg < $args; $arg++) {
|
||||
$ma = func_get_arg($arg);
|
||||
$this->setCell($row, $arg, $ma);
|
||||
}
|
||||
}
|
||||
|
||||
function setCell($row, $cell, $data)
|
||||
{
|
||||
public function setCell($row, $cell, $data) {
|
||||
$row = Contenido_Security::escapeDB($row);
|
||||
$cell = Contenido_Security::escapeDB($cell);
|
||||
$data = Contenido_Security::escapeDB($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;
|
||||
}
|
||||
|
||||
function make() {
|
||||
public function make() {
|
||||
$out = '';
|
||||
foreach ($this->_data as $row => $line) {
|
||||
$out .= implode($this->_delimiter, $line);
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Root Driver for GenericDB
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend classes
|
||||
* @version 1.3
|
||||
* @author Timo Hummel
|
||||
|
@ -18,16 +12,9 @@
|
|||
* @link http://www.4fb.de
|
||||
* @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 $
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -36,26 +23,24 @@ class gdbDriver {
|
|||
var $_sEncoding;
|
||||
var $_oItemClassInstance;
|
||||
|
||||
function gdbDriver() {
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
function setEncoding($sEncoding) {
|
||||
public function setEncoding($sEncoding) {
|
||||
$this->_sEncoding = $sEncoding;
|
||||
}
|
||||
|
||||
function setItemClassInstance($oInstance) {
|
||||
public function setItemClassInstance($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) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -27,8 +28,7 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -37,56 +37,48 @@ $properties = new PropertyCollection;
|
|||
|
||||
$db2 = new DB_ConLite;
|
||||
|
||||
if ($action == "client_new")
|
||||
{
|
||||
if ($action == "client_new") {
|
||||
$nextid = $db->nextid($cfg["tab"]["clients"]);
|
||||
$idclient = $nextid;
|
||||
$new = true;
|
||||
}
|
||||
if(!$perm->have_perm_area_action($area))
|
||||
{
|
||||
if (!$perm->have_perm_area_action($area)) {
|
||||
$notification->displayNotification("error", i18n("Permission denied"));
|
||||
} else {
|
||||
if ( !isset($idclient) )
|
||||
{
|
||||
if (!isset($idclient)) {
|
||||
$notification->displayNotification("error", i18n("No client ID passed"));
|
||||
} else {
|
||||
if (($action == "client_edit") && ($perm->have_perm_area_action($area, $action)))
|
||||
{
|
||||
if (($action == "client_edit") && ($perm->have_perm_area_action($area, $action))) {
|
||||
$sNewNotification = '';
|
||||
if ($active != "1")
|
||||
{
|
||||
if ($active != "1") {
|
||||
$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.');
|
||||
$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'));";
|
||||
$sLangNotificationLink = sprintf(i18n('Please click %shere%s to create a new language.'), '<a href="javascript://" onclick="'.$sJsLink.'">', '</a>');
|
||||
$sNewNotification = '<br>'.$sLangNotification.'<br>'.$sLangNotificationLink;
|
||||
if (substr($frontendpath, strlen($frontendpath)-1) != "/")
|
||||
{
|
||||
$sLangNotificationLink = sprintf(i18n('Please click %shere%s to create a new language.'), '<a href="javascript://" onclick="' . $sJsLink . '">', '</a>');
|
||||
$sNewNotification = '<br>' . $sLangNotification . '<br>' . $sLangNotificationLink;
|
||||
if (substr($frontendpath, strlen($frontendpath) - 1) != "/") {
|
||||
$frontendpath .= "/";
|
||||
}
|
||||
|
||||
if (substr($htmlpath, strlen($htmlpath)-1) != "/")
|
||||
{
|
||||
if (substr($htmlpath, strlen($htmlpath) - 1) != "/") {
|
||||
$htmlpath .= "/";
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO
|
||||
".$cfg["tab"]["clients"]."
|
||||
" . $cfg["tab"]["clients"] . "
|
||||
SET
|
||||
name = '".Contenido_Security::escapeDB($clientname, $db)."',
|
||||
frontendpath = '".Contenido_Security::escapeDB($frontendpath, $db)."',
|
||||
htmlpath = '".Contenido_Security::escapeDB($htmlpath, $db)."',
|
||||
errsite_cat = '".Contenido_Security::toInteger($errsite_cat)."',
|
||||
errsite_art = '".Contenido_Security::toInteger($errsite_art)."',
|
||||
idclient = '".Contenido_Security::toInteger($idclient)."'";
|
||||
name = '" . Contenido_Security::escapeDB($clientname, $db) . "',
|
||||
frontendpath = '" . Contenido_Security::escapeDB($frontendpath, $db) . "',
|
||||
htmlpath = '" . Contenido_Security::escapeDB($htmlpath, $db) . "',
|
||||
errsite_cat = '" . Contenido_Security::toInteger($errsite_cat) . "',
|
||||
errsite_art = '" . Contenido_Security::toInteger($errsite_art) . "',
|
||||
idclient = '" . Contenido_Security::toInteger($idclient) . "'";
|
||||
|
||||
$properties->setValue("idclient", $idclient, "backend", "clientimage", $clientlogo);
|
||||
|
||||
|
@ -94,69 +86,65 @@ if(!$perm->have_perm_area_action($area))
|
|||
$destPath = $frontendpath;
|
||||
$sourcePath = $cfg['path']['contenido'] . $cfg['path']['frontendtemplate'];
|
||||
|
||||
if($copytemplate) {
|
||||
if(!file_exists($destPath)) {
|
||||
if(recursive_copy($sourcePath, $destPath)) {
|
||||
$res = fopen($destPath."config.php","rb+");
|
||||
$res2 = fopen($destPath."config.php.new", "ab+");
|
||||
if($res && $res2) {
|
||||
while(!feof($res)) {
|
||||
if ($copytemplate) {
|
||||
if (!file_exists($destPath)) {
|
||||
if (recursive_copy($sourcePath, $destPath)) {
|
||||
$res = fopen($destPath . "config.php", "rb+");
|
||||
$res2 = fopen($destPath . "config.php.new", "ab+");
|
||||
if ($res && $res2) {
|
||||
while (!feof($res)) {
|
||||
$buffer = fgets($res, 4096);
|
||||
$buffer = str_replace("!CLIENT!", $idclient, $buffer);
|
||||
$buffer = str_replace("!PATH!", $cfg["path"]["contenido"], $buffer);
|
||||
fwrite($res2, $buffer);
|
||||
}
|
||||
} 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($res2);
|
||||
|
||||
unlink($destPath."config.php");
|
||||
rename($destPath."config.php.new", $destPath."config.php");
|
||||
$message = sprintf(i18n("Succesfully copied client-template to %s."),$destPath);
|
||||
unlink($destPath . "config.php");
|
||||
rename($destPath . "config.php.new", $destPath . "config.php");
|
||||
$message = sprintf(i18n("Succesfully copied client-template to %s."), $destPath);
|
||||
$notification->displayNotification("info", $message);
|
||||
} 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);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
} else {
|
||||
$message = sprintf(i18n("Client '%s' created."),$clientname);
|
||||
$message = sprintf(i18n("Client '%s' created."), $clientname);
|
||||
$notification->displayNotification("info", $message);
|
||||
}
|
||||
rereadClients();
|
||||
} else {
|
||||
} else {
|
||||
$pathwithoutslash = $frontendpath;
|
||||
if (substr($frontendpath, strlen($frontendpath)-1) != "/")
|
||||
{
|
||||
if (substr($frontendpath, strlen($frontendpath) - 1) != "/") {
|
||||
$frontendpath .= "/";
|
||||
}
|
||||
|
||||
if (substr($htmlpath, strlen($htmlpath)-1) != "/")
|
||||
{
|
||||
if (substr($htmlpath, strlen($htmlpath) - 1) != "/") {
|
||||
$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"));
|
||||
|
||||
}
|
||||
$sql = "UPDATE
|
||||
".$cfg["tab"]["clients"]."
|
||||
" . $cfg["tab"]["clients"] . "
|
||||
SET
|
||||
name = '".Contenido_Security::escapeDB($clientname, $db)."',
|
||||
frontendpath = '".Contenido_Security::escapeDB($frontendpath, $db)."',
|
||||
htmlpath = '".Contenido_Security::escapeDB($htmlpath, $db)."',
|
||||
errsite_cat = '".Contenido_Security::toInteger($errsite_cat)."',
|
||||
errsite_art = '".Contenido_Security::toInteger($errsite_art)."'
|
||||
name = '" . Contenido_Security::escapeDB($clientname, $db) . "',
|
||||
frontendpath = '" . Contenido_Security::escapeDB($frontendpath, $db) . "',
|
||||
htmlpath = '" . Contenido_Security::escapeDB($htmlpath, $db) . "',
|
||||
errsite_cat = '" . Contenido_Security::toInteger($errsite_cat) . "',
|
||||
errsite_art = '" . Contenido_Security::toInteger($errsite_art) . "'
|
||||
WHERE
|
||||
idclient = '".Contenido_Security::toInteger($idclient)."'";
|
||||
idclient = '" . Contenido_Security::toInteger($idclient) . "'";
|
||||
}
|
||||
|
||||
$db->query($sql);
|
||||
|
@ -166,16 +154,16 @@ if(!$perm->have_perm_area_action($area))
|
|||
$properties->setValue("idclient", $idclient, "backend", "clientimage", $clientlogo);
|
||||
|
||||
/* 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);
|
||||
|
||||
$notification->displayNotification("info", i18n("Changes saved").$sNewNotification);
|
||||
$notification->displayNotification("info", i18n("Changes saved") . $sNewNotification);
|
||||
|
||||
$cApiClient = new cApiClient;
|
||||
$cApiClient->loadByPrimaryKey($idclient);
|
||||
|
||||
if(isset($_REQUEST["generate_xhtml"])) {
|
||||
switch($_REQUEST["generate_xhtml"]) {
|
||||
if (isset($_REQUEST["generate_xhtml"])) {
|
||||
switch ($_REQUEST["generate_xhtml"]) {
|
||||
case "html":
|
||||
$cApiClient->setProperty("generator", "xhtml", "false");
|
||||
$cApiClient->setProperty("generator", "html5", "false");
|
||||
|
@ -203,22 +191,22 @@ if(!$perm->have_perm_area_action($area))
|
|||
$sql = "SELECT
|
||||
idclient, name, frontendpath, htmlpath, errsite_cat, errsite_art
|
||||
FROM
|
||||
".$cfg["tab"]["clients"]."
|
||||
" . $cfg["tab"]["clients"] . "
|
||||
WHERE
|
||||
idclient = '".Contenido_Security::toInteger($idclient)."'";
|
||||
idclient = '" . Contenido_Security::toInteger($idclient) . "'";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
$db->next_record();
|
||||
|
||||
$form = '<form name="client_properties" method="post" action="'.$sess->url("main.php?").'">
|
||||
'.$sess->hidden_session().'
|
||||
<input type="hidden" name="area" value="'.$area.'">
|
||||
$form = '<form name="client_properties" method="post" action="' . $sess->url("main.php?") . '">
|
||||
' . $sess->hidden_session() . '
|
||||
<input type="hidden" name="area" value="' . $area . '">
|
||||
<input type="hidden" name="action" value="client_edit">
|
||||
<input type="hidden" name="frame" value="'.$frame.'">
|
||||
<input type="hidden" name="new" value="'.$new.'">
|
||||
<input type="hidden" name="oldpath" value="'.$db->f("frontendpath").'">
|
||||
<input type="hidden" name="idclient" value="'.$idclient.'">';
|
||||
<input type="hidden" name="frame" value="' . $frame . '">
|
||||
<input type="hidden" name="new" value="' . $new . '">
|
||||
<input type="hidden" name="oldpath" value="' . $db->f("frontendpath") . '">
|
||||
<input type="hidden" name="idclient" value="' . $idclient . '">';
|
||||
|
||||
$tpl->set('s', 'JAVASCRIPT', $javascript);
|
||||
$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', 'CANCELLINK', $sess->url("main.php?area=$area&frame=4&idclient=$idclient"));
|
||||
|
||||
if ($error)
|
||||
{
|
||||
if ($error) {
|
||||
echo $error;
|
||||
}
|
||||
|
||||
|
@ -245,7 +232,7 @@ if(!$perm->have_perm_area_action($area))
|
|||
$tpl->set('d', 'CATNAME', i18n("Client name"));
|
||||
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
|
||||
$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', 'BRDRB', 1);
|
||||
$tpl->set('d', 'FONT', 'text_medium');
|
||||
|
@ -253,15 +240,14 @@ if(!$perm->have_perm_area_action($area))
|
|||
|
||||
$serverpath = $db->f("frontendpath");
|
||||
|
||||
if ($serverpath == "")
|
||||
{
|
||||
if ($serverpath == "") {
|
||||
$serverpath = $cfg['path']['frontend'];
|
||||
}
|
||||
|
||||
$tpl->set('d', 'CATNAME', i18n("Server path"));
|
||||
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
|
||||
$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', 'BRDRB', 1);
|
||||
$tpl->set('d', 'FONT', 'text_medium');
|
||||
|
@ -269,15 +255,14 @@ if(!$perm->have_perm_area_action($area))
|
|||
|
||||
$htmlpath = $db->f("htmlpath");
|
||||
|
||||
if ($htmlpath == "")
|
||||
{
|
||||
if ($htmlpath == "") {
|
||||
$htmlpath = "http://";
|
||||
}
|
||||
|
||||
$tpl->set('d', 'CATNAME', i18n("Web address"));
|
||||
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]);
|
||||
$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', 'BRDRB', 1);
|
||||
$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', 'BGCOLOR', $cfg["color"]["table_light"]);
|
||||
$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', 'BRDRB', 1);
|
||||
$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', 'BGCOLOR', $cfg["color"]["table_dark"]);
|
||||
$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', 'BRDRB', 1);
|
||||
$tpl->set('d', 'FONT', 'text_medium');
|
||||
$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', 'BGCOLOR', $cfg["color"]["table_dark"]);
|
||||
$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', 'BRDRB', 1);
|
||||
$tpl->set('d', 'FONT', 'text_medium');
|
||||
|
@ -319,9 +304,10 @@ if(!$perm->have_perm_area_action($area))
|
|||
|
||||
$cApiClient = new cApiClient;
|
||||
$cApiClient->loadByPrimaryKey($idclient);
|
||||
if ($cApiClient->getProperty("generator", "xhtml") == "true") {
|
||||
var_dump($cApiClient->getProperty("generator", "xhtml"));
|
||||
if ($cApiClient->getProperty("generator", "xhtml") === TRUE) {
|
||||
$oXHTMLSelect->setDefault("xhtml");
|
||||
} else if ($cApiClient->getProperty("generator", "html5") == "true") {
|
||||
} else if ($cApiClient->getProperty("generator", "html5") === TRUE) {
|
||||
$oXHTMLSelect->setDefault("html5");
|
||||
} else {
|
||||
$oXHTMLSelect->setDefault("html");
|
||||
|
@ -336,12 +322,11 @@ if(!$perm->have_perm_area_action($area))
|
|||
$tpl->set('d', 'FONT', 'text_medium');
|
||||
$tpl->next();
|
||||
|
||||
if ($new == true)
|
||||
{
|
||||
if ($new == true) {
|
||||
$tpl->set('d', 'CATNAME', i18n("Copy frontend template"));
|
||||
$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]);
|
||||
$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();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -31,8 +32,7 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -49,14 +49,13 @@ class pApiContentAllocation {
|
|||
var $table = null;
|
||||
var $lang = null;
|
||||
var $client = null;
|
||||
|
||||
var $treeObj = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @modified 27.10.2005 new class variable $this->bDebug (if true print debug information)
|
||||
*/
|
||||
function pApiContentAllocation () {
|
||||
public function __construct() {
|
||||
global $db, $cfg, $lang, $client;
|
||||
|
||||
$this->db = new DB_ConLite;
|
||||
|
@ -71,30 +70,30 @@ class pApiContentAllocation {
|
|||
$this->treeObj = new pApiTree('f31a4384-e5c1-4ede-b1bb-f43657ec73a5');
|
||||
}
|
||||
|
||||
function storeAllocations ($idartlang, $allocations) {
|
||||
function storeAllocations($idartlang, $allocations) {
|
||||
// empty before insert
|
||||
$this->deleteAllocationsByIdartlang($idartlang);
|
||||
|
||||
if (is_array($allocations)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deleteAllocations ($idpica_alloc) {
|
||||
$sql = "DELETE FROM ".$this->table['pica_alloc_con']." WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
function deleteAllocations($idpica_alloc) {
|
||||
$sql = "DELETE FROM " . $this->table['pica_alloc_con'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function deleteAllocationsByIdartlang ($idartlang) {
|
||||
$sql = "DELETE FROM ".$this->table['pica_alloc_con']." WHERE idartlang = " . Contenido_Security::toInteger($idartlang);
|
||||
function deleteAllocationsByIdartlang($idartlang) {
|
||||
$sql = "DELETE FROM " . $this->table['pica_alloc_con'] . " WHERE idartlang = " . Contenido_Security::toInteger($idartlang);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function loadAllocations ($idartlang) {
|
||||
$sql = "SELECT idpica_alloc FROM ".$this->table['pica_alloc_con']." WHERE idartlang = " . Contenido_Security::toInteger($idartlang);
|
||||
function loadAllocations($idartlang) {
|
||||
$sql = "SELECT idpica_alloc FROM " . $this->table['pica_alloc_con'] . " WHERE idartlang = " . Contenido_Security::toInteger($idartlang);
|
||||
$this->db->query($sql);
|
||||
|
||||
$items = array();
|
||||
|
@ -105,15 +104,15 @@ class pApiContentAllocation {
|
|||
return $items;
|
||||
}
|
||||
|
||||
function loadAllocationsWithNames ($idartlang, $parent, $firstonly = false) {
|
||||
function loadAllocationsWithNames($idartlang, $parent, $firstonly = false) {
|
||||
|
||||
global $cfg;
|
||||
|
||||
$sql = "SELECT ".$cfg['tab']['pica_alloc'].".idpica_alloc FROM ".$cfg['tab']['pica_alloc']."
|
||||
INNER JOIN ".$cfg['tab']['pica_alloc_con']." ON
|
||||
".$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).")
|
||||
ORDER BY ".$cfg['tab']['pica_alloc'].".sortorder";
|
||||
$sql = "SELECT " . $cfg['tab']['pica_alloc'] . ".idpica_alloc FROM " . $cfg['tab']['pica_alloc'] . "
|
||||
INNER JOIN " . $cfg['tab']['pica_alloc_con'] . " ON
|
||||
" . $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) . ")
|
||||
ORDER BY " . $cfg['tab']['pica_alloc'] . ".sortorder";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
|
@ -123,7 +122,6 @@ class pApiContentAllocation {
|
|||
if ($firstonly) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
|
@ -135,9 +133,10 @@ class pApiContentAllocation {
|
|||
* @return string SQL
|
||||
* @modified 17.11.2005 by Willi Man
|
||||
*/
|
||||
function findMatchingContent ($restrictions = null, $max = 0)
|
||||
{
|
||||
if (!is_array($restrictions)) { return false; }
|
||||
function findMatchingContent($restrictions = null, $max = 0) {
|
||||
if (!is_array($restrictions)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
global $aCategoriesToExclude; # @see config.local.php!
|
||||
$sql = $this->_buildQuery($restrictions, $aCategoriesToExclude, $max);
|
||||
|
@ -150,7 +149,7 @@ class pApiContentAllocation {
|
|||
* @param array $restrictions
|
||||
* @return string SQL
|
||||
*/
|
||||
function _buildQuery ($restrictions, $aCategoriesToExclude, $max) {
|
||||
function _buildQuery($restrictions, $aCategoriesToExclude, $max) {
|
||||
|
||||
global $cfg;
|
||||
|
||||
|
@ -169,12 +168,11 @@ class pApiContentAllocation {
|
|||
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
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 {
|
||||
$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];
|
||||
}
|
||||
}
|
||||
|
@ -183,15 +181,14 @@ class pApiContentAllocation {
|
|||
$where[] = 'cal.online = 1';
|
||||
|
||||
# fetch only articles which are not in following categories
|
||||
if (count($aCategoriesToExclude) > 0)
|
||||
{
|
||||
$where[] = "cat.idcat NOT IN (".implode(',', $aCategoriesToExclude).")";
|
||||
if (count($aCategoriesToExclude) > 0) {
|
||||
$where[] = "cat.idcat NOT IN (" . implode(',', $aCategoriesToExclude) . ")";
|
||||
}
|
||||
|
||||
// join art_lang for idart
|
||||
$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']." as cat USING (idcat)";
|
||||
$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'] . " as cat USING (idcat)";
|
||||
|
||||
$tables = implode('', $tables);
|
||||
$where = implode(' AND ', $where);
|
||||
|
@ -205,7 +202,11 @@ class pApiContentAllocation {
|
|||
$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;
|
||||
}
|
||||
|
@ -217,22 +218,19 @@ class pApiContentAllocation {
|
|||
*
|
||||
* @return array of articles
|
||||
*/
|
||||
function findMatchingContentByContentAllocationByCategories ($aContentAllocation, $aCategories = array(), $iOffset = 0, $iNumOfRows = 0)
|
||||
{
|
||||
if (!is_array($aContentAllocation)) { return array(); }
|
||||
function findMatchingContentByContentAllocationByCategories($aContentAllocation, $aCategories = array(), $iOffset = 0, $iNumOfRows = 0) {
|
||||
if (!is_array($aContentAllocation)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($aContentAllocation); $i++)
|
||||
{
|
||||
if (!is_int((int)$aContentAllocation[$i]) OR !$aContentAllocation[$i] > 0)
|
||||
{
|
||||
for ($i = 0; $i < count($aContentAllocation); $i++) {
|
||||
if (!is_int((int) $aContentAllocation[$i]) OR ! $aContentAllocation[$i] > 0) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($aCategories); $i++)
|
||||
{
|
||||
if (!is_int((int)$aCategories[$i]) OR !$aCategories[$i] > 0)
|
||||
{
|
||||
for ($i = 0; $i < count($aCategories); $i++) {
|
||||
if (!is_int((int) $aCategories[$i]) OR ! $aCategories[$i] > 0) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
@ -242,19 +240,17 @@ class pApiContentAllocation {
|
|||
$this->db->query($sql);
|
||||
|
||||
$aResult = array();
|
||||
while($oRow = $this->db->getResultObject())
|
||||
{
|
||||
while ($oRow = $this->db->getResultObject()) {
|
||||
$aResult[] = $oRow;
|
||||
}
|
||||
return $aResult;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
|
@ -267,16 +263,13 @@ class pApiContentAllocation {
|
|||
$tables = array();
|
||||
$where = array();
|
||||
|
||||
for ($i = 0; $i < $size; $i++)
|
||||
{
|
||||
if ($i == 0)
|
||||
{ // first
|
||||
$tables[] = " ".$cfg['tab']['pica_alloc_con']." AS " . $sql_concat[$i];
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
if ($i == 0) { // first
|
||||
$tables[] = " " . $cfg['tab']['pica_alloc_con'] . " AS " . $sql_concat[$i];
|
||||
} 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];
|
||||
}
|
||||
}
|
||||
|
@ -285,15 +278,14 @@ class pApiContentAllocation {
|
|||
$where[] = 'cal.online = 1';
|
||||
|
||||
# fetch only articles in following categories
|
||||
if (count($aCategories) > 0)
|
||||
{
|
||||
$where[] = "cat.idcat IN (".implode(',', $aCategories).")";
|
||||
if (count($aCategories) > 0) {
|
||||
$where[] = "cat.idcat IN (" . implode(',', $aCategories) . ")";
|
||||
}
|
||||
|
||||
// join art_lang for idart
|
||||
$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']." as cat USING (idcat)";
|
||||
$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'] . " as cat USING (idcat)";
|
||||
|
||||
$tables = implode('', $tables);
|
||||
$where = implode(' AND ', $where);
|
||||
|
@ -303,12 +295,15 @@ class pApiContentAllocation {
|
|||
|
||||
$sql .= " ORDER BY cal.published DESC";
|
||||
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0)
|
||||
{
|
||||
$sql .= " LIMIT ". $iOffset .", ".$iNumOfRows;
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0) {
|
||||
$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;
|
||||
}
|
||||
|
@ -322,13 +317,10 @@ class pApiContentAllocation {
|
|||
*
|
||||
* @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++)
|
||||
{
|
||||
if (!is_int((int)$aCategories[$i]) OR !$aCategories[$i] > 0)
|
||||
{
|
||||
for ($i = 0; $i < count($aCategories); $i++) {
|
||||
if (!is_int((int) $aCategories[$i]) OR ! $aCategories[$i] > 0) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
@ -339,39 +331,30 @@ class pApiContentAllocation {
|
|||
|
||||
$aResult = array();
|
||||
|
||||
while($oRow = $this->db->getResultObject())
|
||||
{
|
||||
if ($sResultType == 'article_language_id')
|
||||
{
|
||||
while ($oRow = $this->db->getResultObject()) {
|
||||
if ($sResultType == 'article_language_id') {
|
||||
$aResult[] = $oRow->idartlang;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
$aResult[] = $oRow;
|
||||
}
|
||||
}
|
||||
return $aResult;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* build SQL query to find articles by catgories
|
||||
*
|
||||
*/
|
||||
function _buildQuery_MatchingContentByCategories ($aCategories, $iOffset, $iNumOfRows)
|
||||
{
|
||||
function _buildQuery_MatchingContentByCategories($aCategories, $iOffset, $iNumOfRows) {
|
||||
|
||||
if (count($aCategories) > 0)
|
||||
{
|
||||
$sWHERE_Category_IN = " c.idcat IN (".implode(',', $aCategories).") AND ";
|
||||
}else
|
||||
{
|
||||
if (count($aCategories) > 0) {
|
||||
$sWHERE_Category_IN = " c.idcat IN (" . implode(',', $aCategories) . ") AND ";
|
||||
} else {
|
||||
$sWHERE_Category_IN = '';
|
||||
}
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0)
|
||||
{
|
||||
$sLimit = " LIMIT ". Contenido_Security::toInteger($iOffset) .", " . Contenido_Security::toInteger($iNumOfRows);
|
||||
}else
|
||||
{
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0) {
|
||||
$sLimit = " LIMIT " . Contenido_Security::toInteger($iOffset) . ", " . Contenido_Security::toInteger($iNumOfRows);
|
||||
} else {
|
||||
$sLimit = '';
|
||||
}
|
||||
|
||||
|
@ -379,22 +362,26 @@ class pApiContentAllocation {
|
|||
SELECT
|
||||
a.idart, a.online, a.idartlang, c.idcat
|
||||
FROM
|
||||
'.$this->table['art_lang'].' AS a,
|
||||
'.$this->table['art'].' AS b,
|
||||
'.$this->table['cat_art'].' AS c,
|
||||
'.$this->table['cat_lang'].' AS d
|
||||
' . $this->table['art_lang'] . ' AS a,
|
||||
' . $this->table['art'] . ' AS b,
|
||||
' . $this->table['cat_art'] . ' AS c,
|
||||
' . $this->table['cat_lang'] . ' AS d
|
||||
WHERE
|
||||
'.$sWHERE_Category_IN.'
|
||||
b.idclient = '.Contenido_Security::toInteger($this->client).' AND
|
||||
a.idlang = '.Contenido_Security::toInteger($this->lang).' AND
|
||||
' . $sWHERE_Category_IN . '
|
||||
b.idclient = ' . Contenido_Security::toInteger($this->client) . ' AND
|
||||
a.idlang = ' . Contenido_Security::toInteger($this->lang) . ' AND
|
||||
a.idartlang != d.startidartlang AND
|
||||
a.online = 1 AND
|
||||
c.idcat = d.idcat AND
|
||||
b.idart = c.idart AND
|
||||
a.idart = b.idart
|
||||
'.$sLimit.' ';
|
||||
' . $sLimit . ' ';
|
||||
|
||||
if ($this->bDebug) {print "<!-- "; print $sql; print " -->";}
|
||||
if ($this->bDebug) {
|
||||
print "<!-- ";
|
||||
print $sql;
|
||||
print " -->";
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -27,8 +28,7 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,9 @@ class pApiContentAllocationArticle extends pApiTree {
|
|||
|
||||
var $tpl = null;
|
||||
var $template = '';
|
||||
|
||||
var $load = array();
|
||||
|
||||
function pApiContentAllocationArticle ($uuid) {
|
||||
public function __construct($uuid) {
|
||||
global $cfg;
|
||||
|
||||
parent::pApiTree($uuid);
|
||||
|
@ -47,7 +46,7 @@ class pApiContentAllocationArticle extends pApiTree {
|
|||
$this->template = $cfg['pica']['treetemplate_article'];
|
||||
}
|
||||
|
||||
function _buildRenderTree ($tree) {
|
||||
function _buildRenderTree($tree) {
|
||||
global $action, $frame, $area, $sess, $idart;
|
||||
|
||||
$result = array();
|
||||
|
@ -55,7 +54,7 @@ class pApiContentAllocationArticle extends pApiTree {
|
|||
$item = array();
|
||||
|
||||
$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'];
|
||||
|
||||
|
@ -66,7 +65,7 @@ class pApiContentAllocationArticle extends pApiTree {
|
|||
if (in_array($item_tmp['idpica_alloc'], $this->load)) {
|
||||
$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);
|
||||
|
||||
|
@ -83,7 +82,7 @@ class pApiContentAllocationArticle extends pApiTree {
|
|||
$this->load = $load;
|
||||
}
|
||||
|
||||
function renderTree ($return = true) {
|
||||
function renderTree($return = true) {
|
||||
$this->tpl->reset();
|
||||
|
||||
$tree = $this->fetchTree();
|
||||
|
@ -112,6 +111,7 @@ class pApiContentAllocationArticle extends pApiTree {
|
|||
$this->tpl->generate($this->template);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -27,8 +28,7 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,12 @@ class pApiContentAllocationComplexList extends pApiTree {
|
|||
var $idSetter = true;
|
||||
var $load = array();
|
||||
|
||||
function pApiContentAllocationComplexList ($uuid) {
|
||||
public function __construct($uuid) {
|
||||
global $cfg;
|
||||
parent::pApiTree($uuid);
|
||||
}
|
||||
|
||||
function _buildRenderTree ($tree) {
|
||||
public function _buildRenderTree($tree) {
|
||||
global $action, $frame, $area, $sess, $idart;
|
||||
|
||||
$oldIdSetter = $this->idSetter;
|
||||
|
@ -73,8 +73,8 @@ class pApiContentAllocationComplexList extends pApiTree {
|
|||
// for wrapping purposes
|
||||
$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'].'" />';
|
||||
$item = "\n<li style=\"border-bottom: 1px solid #B3B3B3\" baseClass=\"" . $bgcolor . "\" ".$li_closeElm.">" . $checkbox . " " . $item_tmp['name'];
|
||||
$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'];
|
||||
|
||||
$result .= $item;
|
||||
|
||||
|
@ -93,11 +93,11 @@ class pApiContentAllocationComplexList extends pApiTree {
|
|||
}
|
||||
}
|
||||
|
||||
function setChecked($load) {
|
||||
public function setChecked($load) {
|
||||
$this->load = $load;
|
||||
}
|
||||
|
||||
function renderTree ($return = true) {
|
||||
public function renderTree($return = true) {
|
||||
$tree = $this->fetchTree();
|
||||
if ($tree === false) {
|
||||
return false;
|
||||
|
@ -109,5 +109,4 @@ class pApiContentAllocationComplexList extends pApiTree {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,15 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
*
|
||||
* Description:
|
||||
* Render selectbox witzh complete content allocation tree
|
||||
*
|
||||
* Requirements:
|
||||
* @con_php_req 5.0
|
||||
*
|
||||
*
|
||||
* @package Contenido Backend plugins
|
||||
* @version 0.2.1
|
||||
* @author Marco Jahn
|
||||
|
@ -19,16 +13,9 @@
|
|||
* @link http://www.contenido.org
|
||||
* @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 $:
|
||||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -37,13 +24,13 @@ class pApiContentAllocationSelectBox extends pApiTree {
|
|||
var $idSetter = true;
|
||||
var $load = array();
|
||||
|
||||
function pApiContentAllocationComplexList ($uuid) {
|
||||
public function __construct($uuid) {
|
||||
global $cfg;
|
||||
|
||||
parent::pApiTree($uuid);
|
||||
}
|
||||
|
||||
function _buildRenderTree ($tree) {
|
||||
public function _buildRenderTree($tree) {
|
||||
global $action, $frame, $area, $sess, $idart;
|
||||
|
||||
$oldIdSetter = $this->idSetter;
|
||||
|
@ -59,7 +46,7 @@ class pApiContentAllocationSelectBox extends pApiTree {
|
|||
$spacer = '|-';
|
||||
$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']) {
|
||||
$children = $this->_buildRenderTree($item_tmp['children']);
|
||||
|
@ -70,7 +57,7 @@ class pApiContentAllocationSelectBox extends pApiTree {
|
|||
return $result;
|
||||
}
|
||||
|
||||
function setChecked($load) {
|
||||
public function setChecked($load) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -78,7 +65,7 @@ class pApiContentAllocationSelectBox extends pApiTree {
|
|||
*
|
||||
* @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);
|
||||
|
||||
|
@ -94,6 +81,7 @@ class pApiContentAllocationSelectBox extends pApiTree {
|
|||
echo $tree;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -27,8 +28,7 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ class pApiTree {
|
|||
*/
|
||||
var $_arrOutFilters = array('stripslashes', 'htmldecode', 'urldecode');
|
||||
|
||||
function pApiTree ($uuid) {
|
||||
public function __construct($uuid) {
|
||||
global $db, $cfg, $lang, $client, $auth;
|
||||
|
||||
$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)
|
||||
* @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
|
||||
$sql = "SELECT
|
||||
|
@ -140,15 +140,13 @@ class pApiTree {
|
|||
|
||||
$itemStatus = 'expanded';
|
||||
|
||||
if ($bUseTreeStatus) # modified 27.10.2005
|
||||
{
|
||||
if (is_array($this->treeStatus) && array_key_exists($this->db->f('idpica_alloc'), $this->treeStatus))
|
||||
{
|
||||
if ($bUseTreeStatus) { # modified 27.10.2005
|
||||
if (is_array($this->treeStatus) && array_key_exists($this->db->f('idpica_alloc'), $this->treeStatus)) {
|
||||
$itemStatus = 'collapsed';
|
||||
}
|
||||
}
|
||||
|
||||
$rs = array (
|
||||
$rs = array(
|
||||
'idpica_alloc' => $this->db->f('idpica_alloc'),
|
||||
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
|
||||
'sortorder' => $this->db->f('sortorder'),
|
||||
|
@ -172,8 +170,7 @@ class pApiTree {
|
|||
array_push($result, $rs);
|
||||
}
|
||||
return $result;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +185,7 @@ class pApiTree {
|
|||
* @param int $level
|
||||
* @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
|
||||
$sql = "SELECT
|
||||
|
@ -204,20 +201,26 @@ class pApiTree {
|
|||
|
||||
$sql .= " ORDER BY sortorder ASC";
|
||||
|
||||
if ($this->bDebug) {print "<!-- "; print $sql; print " -->";}
|
||||
if ($this->bDebug) {
|
||||
print "<!-- ";
|
||||
print $sql;
|
||||
print " -->";
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$result_tmp = array(); // tmp result array
|
||||
while ($this->db->next_record()) { // walk resultset
|
||||
|
||||
$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)
|
||||
{
|
||||
$rs = array (
|
||||
if ($showOffline OR $item['online'] == 1) {
|
||||
$rs = array(
|
||||
'idpica_alloc' => $this->db->f('idpica_alloc')
|
||||
);
|
||||
|
||||
|
@ -235,8 +238,7 @@ class pApiTree {
|
|||
array_push($result, $rs);
|
||||
}
|
||||
return $result;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -250,15 +252,15 @@ class pApiTree {
|
|||
$this->user->setProperty("expandstate", $this->_uuid, serialize($this->treeStatus));
|
||||
}
|
||||
|
||||
function loadTreeStatus () {
|
||||
function loadTreeStatus() {
|
||||
$status = $this->user->getProperty("expandstate", $this->_uuid);
|
||||
if ($status !== false) {
|
||||
$this->treeStatus = unserialize($status);
|
||||
}
|
||||
}
|
||||
|
||||
function fetchParent ($idpica_alloc) {
|
||||
$sql = "SELECT idpica_alloc FROM ".$this->table['pica_alloc']." WHERE parentId = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
function fetchParent($idpica_alloc) {
|
||||
$sql = "SELECT idpica_alloc FROM " . $this->table['pica_alloc'] . " WHERE parentId = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
$this->db->query($sql);
|
||||
|
||||
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
|
||||
$sql = "SELECT
|
||||
tree.idpica_alloc, tree.parentid, tree.sortorder
|
||||
FROM
|
||||
" . $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
|
||||
$sql .= " WHERE tree.parentid IS NULL";
|
||||
|
@ -301,7 +305,7 @@ class pApiTree {
|
|||
$itemStatus = 'collapsed';
|
||||
}
|
||||
|
||||
$rs = array (
|
||||
$rs = array(
|
||||
'idpica_alloc' => $this->db->f('idpica_alloc'),
|
||||
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
|
||||
'sortorder' => $this->db->f('sortorder'),
|
||||
|
@ -318,7 +322,7 @@ class pApiTree {
|
|||
return $result_tmp;
|
||||
}
|
||||
|
||||
function storeItem ($treeItem) {
|
||||
function storeItem($treeItem) {
|
||||
|
||||
if (!$treeItem['idpica_alloc']) { // insert
|
||||
$treeItem['idpica_alloc'] = $this->db->nextid($this->table['pica_alloc']);
|
||||
|
@ -341,7 +345,6 @@ class pApiTree {
|
|||
VALUES
|
||||
(" . Contenido_Security::toInteger($treeItem['idpica_alloc']) . ", " . Contenido_Security::toInteger($this->lang) . ", '" . Contenido_Security::escapeDB($treeItem['name'], $this->db) . "')";
|
||||
$this->db->query($sql);
|
||||
|
||||
} else { // update
|
||||
$treeItem['name'] = $this->_inFilter($treeItem['name']);
|
||||
|
||||
|
@ -364,8 +367,8 @@ class pApiTree {
|
|||
}
|
||||
|
||||
#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).",
|
||||
'".Contenido_Security::escapeDB($treeItem['name'], $this->db)."', ".Contenido_Security::toInteger($online_status).")";
|
||||
$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) . ")";
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
|
@ -374,24 +377,24 @@ class pApiTree {
|
|||
return $treeItem;
|
||||
}
|
||||
|
||||
function setOnline ($idpica_alloc) {
|
||||
function setOnline($idpica_alloc) {
|
||||
$this->_switchOnOffline($idpica_alloc, 1);
|
||||
}
|
||||
|
||||
function setOffline ($idpica_alloc) {
|
||||
function setOffline($idpica_alloc) {
|
||||
$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) . "
|
||||
AND idlang = " . Contenido_Security::toInteger($this->lang);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function itemMoveUp ($idpica_alloc) {
|
||||
function itemMoveUp($idpica_alloc) {
|
||||
$treeItem = $this->fetchItem($idpica_alloc);
|
||||
$treeItem_old = $treeItem;
|
||||
$treeItem['sortorder']--;
|
||||
$treeItem['sortorder'] --;
|
||||
|
||||
if ($treeItem['sortorder'] < $treeItem_old['sortorder']) {
|
||||
if ($treeItem['sortorder'] >= 1) {
|
||||
|
@ -406,9 +409,11 @@ class pApiTree {
|
|||
$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);
|
||||
$this->db->query($sql);
|
||||
|
||||
|
@ -419,14 +424,14 @@ class pApiTree {
|
|||
$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;
|
||||
$this->db->query($sql);
|
||||
|
||||
$item = $this->_fetchItemNameLang($idpica_alloc);
|
||||
|
||||
if ($this->db->next_record()) {
|
||||
$row = array (
|
||||
$row = array(
|
||||
'idpica_alloc' => $idpica_alloc,
|
||||
'parentid' => ($this->db->f('parentid') == NULL) ? false : $this->db->f('parentid'),
|
||||
'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
|
||||
|
||||
$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();
|
||||
if ($oDB->next_record()) { // item found for this language
|
||||
|
||||
$aResult['name'] = $this->_outFilter($oDB->f('name'));
|
||||
$aResult['idlang'] = $oDB->f('idlang');
|
||||
$aResult['online'] = $oDB->f('online');
|
||||
|
||||
} else { // no item in this language found
|
||||
// fetch alternative language name
|
||||
// HerrB, 2008-04-21: Get all translations, try to use defaultLang translation, use
|
||||
// first available, otherwise. Only using defaultLang results in "ghost" elements, if
|
||||
// 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";
|
||||
$oDB->query($sSQL);
|
||||
|
||||
|
@ -480,13 +482,13 @@ class pApiTree {
|
|||
$aResult = reset($aNames);
|
||||
}
|
||||
}
|
||||
unset ($oDB);
|
||||
unset ($aNames);
|
||||
unset($oDB);
|
||||
unset($aNames);
|
||||
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
function _fetchMaxOrder ($parentId = false) {
|
||||
function _fetchMaxOrder($parentId = false) {
|
||||
|
||||
if ($parentId == 'root') {
|
||||
$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);
|
||||
if ($parentId === false) {
|
||||
$sql .= " AND parentid IS NULL";
|
||||
|
@ -516,7 +518,7 @@ class pApiTree {
|
|||
$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);
|
||||
if ($parentId === false) {
|
||||
$sql .= " AND parentid IS NULL";
|
||||
|
@ -526,18 +528,14 @@ class pApiTree {
|
|||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function setFilters($arrInFilters = array(), $arrOutFilters = array())
|
||||
{
|
||||
function setFilters($arrInFilters = array(), $arrOutFilters = array()) {
|
||||
$this->_arrInFilters = $arrInFilters;
|
||||
$this->_arrOutFilters = $arrOutFilters;
|
||||
}
|
||||
|
||||
function _inFilter($data)
|
||||
{
|
||||
foreach ($this->_arrInFilters as $_function)
|
||||
{
|
||||
if (function_exists($_function))
|
||||
{
|
||||
function _inFilter($data) {
|
||||
foreach ($this->_arrInFilters as $_function) {
|
||||
if (function_exists($_function)) {
|
||||
$data = $_function($data);
|
||||
}
|
||||
}
|
||||
|
@ -545,18 +543,16 @@ class pApiTree {
|
|||
return $data;
|
||||
}
|
||||
|
||||
function _outFilter($data)
|
||||
{
|
||||
foreach ($this->_arrOutFilters as $_function)
|
||||
{
|
||||
if (function_exists($_function))
|
||||
{
|
||||
function _outFilter($data) {
|
||||
foreach ($this->_arrOutFilters as $_function) {
|
||||
if (function_exists($_function)) {
|
||||
$data = $_function($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -28,8 +29,7 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
* - generalize this and papitree !!!!
|
||||
* - Comments!
|
||||
*/
|
||||
|
||||
class pApiContentAllocationTreeView extends pApiTree {
|
||||
|
||||
/**
|
||||
|
@ -54,7 +53,7 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
function pApiContentAllocationTreeView ($uuid) {
|
||||
public function __construct($uuid) {
|
||||
global $cfg;
|
||||
|
||||
parent::pApiTree($uuid);
|
||||
|
@ -65,7 +64,7 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
function _buildRenderTree ($tree) {
|
||||
function _buildRenderTree($tree) {
|
||||
global $action, $frame, $area, $sess;
|
||||
$result = array();
|
||||
foreach ($tree as $item_tmp) {
|
||||
|
@ -78,16 +77,16 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
$item['ITEMNAME'] = '
|
||||
<table cellspacing="0" cellpaddin="0" border="0">
|
||||
<form name="rename" action="main.php" method="POST" onsubmit="return fieldCheck();">
|
||||
<input type="hidden" name="action" value="'.$action.'" />
|
||||
<input type="hidden" name="frame" value="'.$frame.'" />
|
||||
<input type="hidden" name="contenido" value="'.$sess->id.'" />
|
||||
<input type="hidden" name="area" value="'.$area.'" />
|
||||
<input type="hidden" name="action" value="' . $action . '" />
|
||||
<input type="hidden" name="frame" value="' . $frame . '" />
|
||||
<input type="hidden" name="contenido" value="' . $sess->id . '" />
|
||||
<input type="hidden" name="area" value="' . $area . '" />
|
||||
<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>
|
||||
<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>
|
||||
<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" />
|
||||
</td></tr>
|
||||
</form>
|
||||
|
@ -97,7 +96,7 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
controller.focus();
|
||||
function fieldCheck() {
|
||||
if (controller.value == "") {
|
||||
alert("'.i18n("Please enter a category name").'");
|
||||
alert("' . i18n("Please enter a category name") . '");
|
||||
controller.focus();
|
||||
return false;
|
||||
}
|
||||
|
@ -107,37 +106,37 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
} else {
|
||||
if ($item_tmp['children'] || $item_tmp['status'] == 'collapsed') {
|
||||
$expandCollapseImg = 'images/close_all.gif';
|
||||
if ($item_tmp['status'] == 'collapsed' ) {
|
||||
if ($item_tmp['status'] == 'collapsed') {
|
||||
$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 {
|
||||
$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['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_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_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_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'] = '';
|
||||
|
||||
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 {
|
||||
$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']) {
|
||||
$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 {
|
||||
$item['ACTION_DELETE'] = '<a href="javascript://" onclick="box.confirm("'.i18n("Delete category").'", "'.i18n("Are you sure to delete the following category").':<br><br><b>'.str_replace("'", "\'", $item_tmp['name']).'</b>","deleteCategory('.$item_tmp['idpica_alloc'].')");"><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("' . i18n("Delete category") . '", "' . i18n("Are you sure to delete the following category") . ':<br><br><b>' . str_replace("'", "\'", $item_tmp['name']) . '</b>","deleteCategory(' . $item_tmp['idpica_alloc'] . ')");"><img src="images/delete.gif" border="0" alt="' . i18n("Delete category") . '" title="' . i18n("Delete category") . '"></a>';
|
||||
}
|
||||
|
||||
array_push($result, $item);
|
||||
|
@ -154,16 +153,16 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
$item['ITEMNAME'] = '
|
||||
<table cellspacing="0" cellpaddin="0" border="0">
|
||||
<form name="create" action="main.php" method="POST" onsubmit="return fieldCheck();">
|
||||
<input type="hidden" name="action" value="'.$action.'" />
|
||||
<input type="hidden" name="frame" value="'.$frame.'" />
|
||||
<input type="hidden" name="contenido" value="'.$sess->id.'" />
|
||||
<input type="hidden" name="area" value="'.$area.'" />
|
||||
<input type="hidden" name="action" value="' . $action . '" />
|
||||
<input type="hidden" name="frame" value="' . $frame . '" />
|
||||
<input type="hidden" name="contenido" value="' . $sess->id . '" />
|
||||
<input type="hidden" name="area" value="' . $area . '" />
|
||||
<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>
|
||||
<td class="text_medium"><input id="itemname" class="text_medium" type="text" name="treeItemPost[name]" value=""></td>
|
||||
<td>
|
||||
<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" />
|
||||
</td></tr>
|
||||
</form>
|
||||
|
@ -173,7 +172,7 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
controller.focus();
|
||||
function fieldCheck() {
|
||||
if (controller.value == "") {
|
||||
alert("'.i18n("Please enter a category name").'");
|
||||
alert("' . i18n("Please enter a category name") . '");
|
||||
controller.focus();
|
||||
return false;
|
||||
}
|
||||
|
@ -198,7 +197,7 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
function renderTree ($return = true) {
|
||||
function renderTree($return = true) {
|
||||
$this->tpl->reset();
|
||||
|
||||
$tree = $this->fetchTree(false, 0, true); # modified 27.10.2005
|
||||
|
@ -229,6 +228,7 @@ class pApiContentAllocationTreeView extends pApiTree {
|
|||
$this->tpl->generate($this->template);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* file FrontendNavigation.php
|
||||
*
|
||||
|
@ -8,14 +9,12 @@
|
|||
* @created 25.03.2005
|
||||
* @modified 22.11.2005
|
||||
*/
|
||||
class FrontendNavigation {
|
||||
|
||||
class FrontendNavigation
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function FrontendNavigation($db, $cfg, $cfgClient, $client, $lang)
|
||||
{
|
||||
public function __construct($db, $cfg, $cfgClient, $client, $lang) {
|
||||
$this->_bDebug = false;
|
||||
$this->db = &$db;
|
||||
$this->cfgClient = &$cfgClient;
|
||||
|
@ -27,37 +26,38 @@ class FrontendNavigation
|
|||
/**
|
||||
* Get child categories by given parent category
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
A.idcat
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat_tree"]." AS A,
|
||||
".$this->cfg["tab"]["cat"]." AS B,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS C
|
||||
" . $this->cfg["tab"]["cat_tree"] . " AS A,
|
||||
" . $this->cfg["tab"]["cat"] . " AS B,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS C
|
||||
WHERE
|
||||
A.idcat = B.idcat AND
|
||||
B.idcat = C.idcat AND
|
||||
B.idclient = ".$this->client." AND
|
||||
C.idlang = ".$this->lang." AND
|
||||
B.idclient = " . $this->client . " AND
|
||||
C.idlang = " . $this->lang . " AND
|
||||
C.visible = 1 AND
|
||||
C.public = 1 AND
|
||||
B.parentid = ".$iParentCategory."
|
||||
B.parentid = " . $iParentCategory . "
|
||||
ORDER BY
|
||||
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);
|
||||
|
||||
$navigation = array();
|
||||
while ( $this->db->next_record() )
|
||||
{
|
||||
while ($this->db->next_record()) {
|
||||
$navigation[] = $this->db->f("idcat");
|
||||
}# end while
|
||||
|
||||
|
@ -67,35 +67,35 @@ class FrontendNavigation
|
|||
/**
|
||||
* Check if child categories of a given parent category exist
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
B.idcat
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS B,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS C
|
||||
" . $this->cfg["tab"]["cat"] . " AS B,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS C
|
||||
WHERE
|
||||
B.idcat = C.idcat AND
|
||||
B.idclient = ".$this->client." AND
|
||||
C.idlang = ".$this->lang." AND
|
||||
B.idclient = " . $this->client . " AND
|
||||
C.idlang = " . $this->lang . " AND
|
||||
C.visible = 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);
|
||||
|
||||
if ( $this->db->next_record() )
|
||||
{
|
||||
if ($this->db->next_record()) {
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -105,36 +105,36 @@ class FrontendNavigation
|
|||
* Note: does not work if direct successor (with preid 0) is not visible
|
||||
* or not 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)
|
||||
{
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
B.idcat
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS B,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS C
|
||||
" . $this->cfg["tab"]["cat"] . " AS B,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS C
|
||||
WHERE
|
||||
B.idcat = C.idcat AND
|
||||
B.idclient = ".$this->client." AND
|
||||
C.idlang = ".$this->lang." AND
|
||||
B.idclient = " . $this->client . " AND
|
||||
C.idlang = " . $this->lang . " AND
|
||||
C.visible = 1 AND
|
||||
C.public = 1 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);
|
||||
|
||||
if ( $this->db->next_record() )
|
||||
{
|
||||
if ($this->db->next_record()) {
|
||||
return $this->db->f("idcat");
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -142,72 +142,71 @@ class FrontendNavigation
|
|||
/**
|
||||
* Check if a given category has a direct successor
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
B.idcat
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS B,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS C
|
||||
" . $this->cfg["tab"]["cat"] . " AS B,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS C
|
||||
WHERE
|
||||
B.idcat = C.idcat AND
|
||||
B.idclient = ".$this->client." AND
|
||||
C.idlang = ".$this->lang." AND
|
||||
B.idclient = " . $this->client . " AND
|
||||
C.idlang = " . $this->lang . " AND
|
||||
C.visible = 1 AND
|
||||
C.public = 1 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);
|
||||
|
||||
if ( $this->db->next_record() )
|
||||
{
|
||||
if ($this->db->next_record()) {
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get category name
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
B.name
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS A,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS B
|
||||
" . $this->cfg["tab"]["cat"] . " AS A,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS B
|
||||
WHERE
|
||||
A.idcat = B.idcat AND
|
||||
A.idcat = $cat_id AND
|
||||
A.idclient = ".$this->client." AND
|
||||
B.idlang = ".$this->lang."
|
||||
A.idclient = " . $this->client . " AND
|
||||
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);
|
||||
|
||||
if ($this->db->next_record())
|
||||
{
|
||||
if ($this->db->next_record()) {
|
||||
return $this->db->f("name");
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -215,34 +214,34 @@ class FrontendNavigation
|
|||
/**
|
||||
* Get category urlname
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
B.urlname
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS A,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS B
|
||||
" . $this->cfg["tab"]["cat"] . " AS A,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS B
|
||||
WHERE
|
||||
A.idcat = B.idcat AND
|
||||
A.idcat = $cat_id AND
|
||||
A.idclient = ".$this->client." AND
|
||||
B.idlang = ".$this->lang."
|
||||
A.idclient = " . $this->client . " AND
|
||||
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);
|
||||
|
||||
if ($this->db->next_record())
|
||||
{
|
||||
if ($this->db->next_record()) {
|
||||
return $this->db->f("urlname");
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -250,35 +249,35 @@ class FrontendNavigation
|
|||
/**
|
||||
* Check if category is visible
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
B.visible
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS A,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS B
|
||||
" . $this->cfg["tab"]["cat"] . " AS A,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS B
|
||||
WHERE
|
||||
A.idcat = B.idcat AND
|
||||
A.idcat = $cat_id AND
|
||||
A.idclient = ".$this->client." AND
|
||||
B.idlang = ".$this->lang."
|
||||
A.idclient = " . $this->client . " AND
|
||||
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->next_record();
|
||||
|
||||
if ($this->db->f("visible") == 1)
|
||||
{
|
||||
if ($this->db->f("visible") == 1) {
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -286,35 +285,35 @@ class FrontendNavigation
|
|||
/**
|
||||
* Check if category is public
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
B.public
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS A,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS B
|
||||
" . $this->cfg["tab"]["cat"] . " AS A,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS B
|
||||
WHERE
|
||||
A.idcat = B.idcat AND
|
||||
A.idcat = $cat_id AND
|
||||
A.idclient = ".$this->client." AND
|
||||
B.idlang = ".$this->lang."
|
||||
A.idclient = " . $this->client . " AND
|
||||
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->next_record();
|
||||
|
||||
if ($this->db->f("public") == 1)
|
||||
{
|
||||
if ($this->db->f("public") == 1) {
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -322,36 +321,36 @@ class FrontendNavigation
|
|||
/**
|
||||
* Return true if $parentid is parent of $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)
|
||||
{
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
a.parentid
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS a,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS b
|
||||
" . $this->cfg["tab"]["cat"] . " AS a,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS b
|
||||
WHERE
|
||||
a.idclient = ".$this->client." AND
|
||||
b.idlang = ".$this->lang." AND
|
||||
a.idclient = " . $this->client . " AND
|
||||
b.idlang = " . $this->lang . " AND
|
||||
a.idcat = b.idcat AND
|
||||
a.idcat = ".$catid." ";
|
||||
a.idcat = " . $catid . " ";
|
||||
|
||||
$this->db->query($sql);
|
||||
$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");
|
||||
|
||||
if($parentid == $pre)
|
||||
{
|
||||
if ($parentid == $pre) {
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -359,33 +358,33 @@ class FrontendNavigation
|
|||
/**
|
||||
* Get parent id of a category
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
a.parentid
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS a,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS b
|
||||
" . $this->cfg["tab"]["cat"] . " AS a,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS b
|
||||
WHERE
|
||||
a.idclient = ".$this->client." AND
|
||||
b.idlang = ".$this->lang." AND
|
||||
a.idclient = " . $this->client . " AND
|
||||
b.idlang = " . $this->lang . " AND
|
||||
a.idcat = b.idcat AND
|
||||
a.idcat = ".$preid." ";
|
||||
a.idcat = " . $preid . " ";
|
||||
|
||||
$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");
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -393,33 +392,33 @@ class FrontendNavigation
|
|||
/**
|
||||
* Check if a category has a parent
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
a.parentid
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat"]." AS a,
|
||||
".$this->cfg["tab"]["cat_lang"]." AS b
|
||||
" . $this->cfg["tab"]["cat"] . " AS a,
|
||||
" . $this->cfg["tab"]["cat_lang"] . " AS b
|
||||
WHERE
|
||||
a.idclient = ".$this->client." AND
|
||||
b.idlang = ".$this->lang." AND
|
||||
a.idclient = " . $this->client . " AND
|
||||
b.idlang = " . $this->lang . " AND
|
||||
a.idcat = b.idcat AND
|
||||
a.idcat = ".$preid." ";
|
||||
a.idcat = " . $preid . " ";
|
||||
|
||||
$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;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -427,29 +426,29 @@ class FrontendNavigation
|
|||
/**
|
||||
* Get level of a category
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
level
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat_tree"]."
|
||||
" . $this->cfg["tab"]["cat_tree"] . "
|
||||
WHERE
|
||||
idcat = ".$catid." ";
|
||||
idcat = " . $catid . " ";
|
||||
|
||||
$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");
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -465,31 +464,23 @@ class FrontendNavigation
|
|||
* @author Willi Man
|
||||
* @access public
|
||||
*/
|
||||
function getFrontContentUrl($iIdcat, $iIdart, $bAbsolute = true)
|
||||
{
|
||||
if (!is_int((int)$iIdcat) AND $iIdcat < 0)
|
||||
{
|
||||
function getFrontContentUrl($iIdcat, $iIdart, $bAbsolute = true) {
|
||||
if (!is_int((int) $iIdcat) AND $iIdcat < 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($bAbsolute === true)
|
||||
{
|
||||
if ($bAbsolute === true) {
|
||||
# add absolute web path to urlpath
|
||||
if (is_int((int)$iIdart) AND $iIdart > 0)
|
||||
{
|
||||
$sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat='.$iIdcat.'&idart='.$iIdart;
|
||||
}else
|
||||
{
|
||||
$sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat='.$iIdcat;
|
||||
if (is_int((int) $iIdart) AND $iIdart > 0) {
|
||||
$sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat=' . $iIdcat . '&idart=' . $iIdart;
|
||||
} else {
|
||||
$sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat=' . $iIdcat;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if (is_int((int)$iIdart) AND $iIdart > 0)
|
||||
{
|
||||
$sURL = 'front_content.php?idcat='.$iIdcat.'&idart='.$iIdart;
|
||||
}else
|
||||
{
|
||||
$sURL = 'front_content.php?idcat='.$iIdcat;
|
||||
} else {
|
||||
if (is_int((int) $iIdart) AND $iIdart > 0) {
|
||||
$sURL = 'front_content.php?idcat=' . $iIdcat . '&idart=' . $iIdart;
|
||||
} else {
|
||||
$sURL = 'front_content.php?idcat=' . $iIdcat;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,40 +501,31 @@ class FrontendNavigation
|
|||
* @modified by Willi Man
|
||||
* @access public
|
||||
*/
|
||||
function getUrlPath($iIdcat, $iIdart, $bAbsolute = true, $iLevel = 0, $sURL_SUFFIX = 'index.html')
|
||||
{
|
||||
if (!is_int((int)$iIdcat) AND $iIdcat < 0)
|
||||
{
|
||||
function getUrlPath($iIdcat, $iIdart, $bAbsolute = true, $iLevel = 0, $sURL_SUFFIX = 'index.html') {
|
||||
if (!is_int((int) $iIdcat) AND $iIdcat < 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$cat_str = '';
|
||||
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 '';
|
||||
}
|
||||
|
||||
if ($bAbsolute === true)
|
||||
{
|
||||
if ($bAbsolute === true) {
|
||||
# add absolute web path to urlpath
|
||||
if (is_int((int)$iIdart) AND $iIdart > 0)
|
||||
{
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-d-'.$iIdart.'.html';
|
||||
}else
|
||||
{
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/'.$sURL_SUFFIX;
|
||||
if (is_int((int) $iIdart) AND $iIdart > 0) {
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-d-' . $iIdart . '.html';
|
||||
} else {
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/' . $sURL_SUFFIX;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if (is_int((int)$iIdart) AND $iIdart > 0)
|
||||
{
|
||||
return $cat_str . '/index-d-'.$iIdart.'.html';
|
||||
}else
|
||||
{
|
||||
return $cat_str . '/'.$sURL_SUFFIX;
|
||||
} else {
|
||||
if (is_int((int) $iIdart) AND $iIdart > 0) {
|
||||
return $cat_str . '/index-d-' . $iIdart . '.html';
|
||||
} else {
|
||||
return $cat_str . '/' . $sURL_SUFFIX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -561,34 +543,27 @@ class FrontendNavigation
|
|||
*
|
||||
* @access public
|
||||
*/
|
||||
function getUrlPathGenParam($iIdcat, $iSelectedNumber, $bAbsolute = true, $iLevel = 0)
|
||||
{
|
||||
if (!is_int((int)$iIdcat) AND $iIdcat < 0)
|
||||
{
|
||||
function getUrlPathGenParam($iIdcat, $iSelectedNumber, $bAbsolute = true, $iLevel = 0) {
|
||||
if (!is_int((int) $iIdcat) AND $iIdcat < 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$cat_str = '';
|
||||
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 '';
|
||||
}
|
||||
|
||||
if ($bAbsolute === true)
|
||||
{
|
||||
if ($bAbsolute === true) {
|
||||
# add absolute web path to urlpath
|
||||
if (is_int((int)$iSelectedNumber))
|
||||
{
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-g-'.$iSelectedNumber.'.html';
|
||||
if (is_int((int) $iSelectedNumber)) {
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-g-' . $iSelectedNumber . '.html';
|
||||
}
|
||||
}else
|
||||
{
|
||||
if (is_int((int)$iSelectedNumber))
|
||||
{
|
||||
return $cat_str . '/index-g-'.$iSelectedNumber.'.html';
|
||||
} else {
|
||||
if (is_int((int) $iSelectedNumber)) {
|
||||
return $cat_str . '/index-g-' . $iSelectedNumber . '.html';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -604,17 +579,14 @@ class FrontendNavigation
|
|||
* @author Willi Man
|
||||
* @access public
|
||||
*/
|
||||
function getURL($iIdcat, $iIdart, $sType = '', $bAbsolute = true, $iLevel = 0)
|
||||
{
|
||||
if (!is_int((int)$iIdcat) AND $iIdcat < 0)
|
||||
{
|
||||
function getURL($iIdcat, $iIdart, $sType = '', $bAbsolute = true, $iLevel = 0) {
|
||||
if (!is_int((int) $iIdcat) AND $iIdcat < 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
#print "type ".$sType."<br>";
|
||||
|
||||
switch ($sType)
|
||||
{
|
||||
switch ($sType) {
|
||||
case 'urlpath':
|
||||
$sURL = $this->getUrlPath($iIdcat, $iIdart, $bAbsolute, $iLevel);
|
||||
break;
|
||||
|
@ -641,43 +613,44 @@ class FrontendNavigation
|
|||
* @param int $iArticleId
|
||||
* @return int category id
|
||||
*/
|
||||
function getCategoryOfArticle ($iArticleId)
|
||||
{
|
||||
function getCategoryOfArticle($iArticleId) {
|
||||
|
||||
# validate input
|
||||
if (!is_int((int)$iArticleId) OR $iArticleId <= 0) { return -1; }
|
||||
if (!is_int((int) $iArticleId) OR $iArticleId <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sqlString = '
|
||||
SELECT
|
||||
c.idcat
|
||||
FROM
|
||||
'.$this->cfg['tab']['art_lang'].' AS a,
|
||||
'.$this->cfg['tab']['art'].' AS b,
|
||||
'.$this->cfg['tab']['cat_art'].' AS c
|
||||
' . $this->cfg['tab']['art_lang'] . ' AS a,
|
||||
' . $this->cfg['tab']['art'] . ' AS b,
|
||||
' . $this->cfg['tab']['cat_art'] . ' AS c
|
||||
WHERE
|
||||
a.idart = '.$iArticleId.' AND
|
||||
b.idclient = '.$this->client.' AND
|
||||
a.idlang = '.$this->lang.' AND
|
||||
a.idart = ' . $iArticleId . ' AND
|
||||
b.idclient = ' . $this->client . ' AND
|
||||
a.idlang = ' . $this->lang . ' AND
|
||||
b.idart = c.idart AND
|
||||
a.idart = b.idart ';
|
||||
|
||||
if ($this->_bDebug) {echo "<pre>".$sqlString."</pre>";}
|
||||
if ($this->_bDebug) {
|
||||
echo "<pre>" . $sqlString . "</pre>";
|
||||
}
|
||||
|
||||
$this->db->query($sqlString);
|
||||
|
||||
# $this->db->Errno returns 0 (zero) if no error occurred.
|
||||
if ($this->db->Errno == 0)
|
||||
{
|
||||
if ($this->db->next_record())
|
||||
{
|
||||
if ($this->db->Errno == 0) {
|
||||
if ($this->db->next_record()) {
|
||||
return $this->db->f('idcat');
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if ($this->_bDebug) {echo "<pre>Mysql Error:".$this->db->Error."(".$this->db->Errno.")</pre>";}
|
||||
} else {
|
||||
if ($this->_bDebug) {
|
||||
echo "<pre>Mysql Error:" . $this->db->Error . "(" . $this->db->Errno . ")</pre>";
|
||||
}
|
||||
return -1; # error occurred.
|
||||
}
|
||||
}
|
||||
|
@ -685,10 +658,8 @@ class FrontendNavigation
|
|||
/**
|
||||
* Get path of a given category up to a certain level
|
||||
*/
|
||||
function getCategoryPath($cat_id, $level = 0, $reverse = true)
|
||||
{
|
||||
if (!is_int((int)$cat_id) AND $cat_id < 0)
|
||||
{
|
||||
function getCategoryPath($cat_id, $level = 0, $reverse = true) {
|
||||
if (!is_int((int) $cat_id) AND $cat_id < 0) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
@ -696,17 +667,14 @@ class FrontendNavigation
|
|||
array_push($root_path, $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);
|
||||
if ($parent_id >= 0)
|
||||
{
|
||||
if ($parent_id >= 0) {
|
||||
array_push($root_path, $parent_id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($reverse == true)
|
||||
{
|
||||
if ($reverse == true) {
|
||||
$root_path = array_reverse($root_path);
|
||||
}
|
||||
|
||||
|
@ -716,17 +684,14 @@ class FrontendNavigation
|
|||
/**
|
||||
* Get root category of a given category
|
||||
*/
|
||||
function getRoot($cat_id)
|
||||
{
|
||||
if (!is_int((int)$cat_id) AND $cat_id < 0)
|
||||
{
|
||||
function getRoot($cat_id) {
|
||||
if (!is_int((int) $cat_id) AND $cat_id < 0) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$parent_id = $cat_id;
|
||||
|
||||
while ($this->getLevel($parent_id) >= 0)
|
||||
{
|
||||
while ($this->getLevel($parent_id) >= 0) {
|
||||
$iRootCategory = $parent_id;
|
||||
$parent_id = $this->getParent($parent_id);
|
||||
}
|
||||
|
@ -742,55 +707,51 @@ class FrontendNavigation
|
|||
*
|
||||
* @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();
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
B.idcat, A.level
|
||||
FROM
|
||||
".$this->cfg["tab"]["cat_tree"]." AS A,
|
||||
".$this->cfg["tab"]["cat"]." AS B
|
||||
" . $this->cfg["tab"]["cat_tree"] . " AS A,
|
||||
" . $this->cfg["tab"]["cat"] . " AS B
|
||||
WHERE
|
||||
A.idcat = B.idcat AND
|
||||
idclient = ".$this->client."
|
||||
idclient = " . $this->client . "
|
||||
ORDER BY
|
||||
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);
|
||||
|
||||
$i = false;
|
||||
|
||||
while ( $this->db->next_record() )
|
||||
{
|
||||
if ($this->db->f("idcat") == $idcat_start)
|
||||
{
|
||||
while ($this->db->next_record()) {
|
||||
if ($this->db->f("idcat") == $idcat_start) {
|
||||
$curLevel = $this->db->f("level");
|
||||
$i = true;
|
||||
}else
|
||||
{
|
||||
if ($curLevel == $this->db->f("level"))
|
||||
{
|
||||
} else {
|
||||
if ($curLevel == $this->db->f("level")) {
|
||||
# ending part of tree
|
||||
$i = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($i == true)
|
||||
{
|
||||
if ($i == true) {
|
||||
$deeper_cats[] = $this->db->f("idcat");
|
||||
}
|
||||
}
|
||||
return $deeper_cats;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
Laden…
In neuem Issue referenzieren