fixes for php7
Dieser Commit ist enthalten in:
Ursprung
f529857955
Commit
9738b3442e
|
@ -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,43 +13,32 @@
|
|||
* @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')) {
|
||||
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);
|
||||
|
@ -64,12 +47,11 @@ class CSV
|
|||
$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,15 +12,8 @@
|
|||
* @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')) {
|
||||
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,7 +28,6 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
@ -37,30 +37,24 @@ $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');
|
||||
|
@ -68,13 +62,11 @@ if(!$perm->have_perm_area_action($area))
|
|||
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) != "/")
|
||||
{
|
||||
if (substr($frontendpath, strlen($frontendpath) - 1) != "/") {
|
||||
$frontendpath .= "/";
|
||||
}
|
||||
|
||||
if (substr($htmlpath, strlen($htmlpath)-1) != "/")
|
||||
{
|
||||
if (substr($htmlpath, strlen($htmlpath) - 1) != "/") {
|
||||
$htmlpath .= "/";
|
||||
}
|
||||
|
||||
|
@ -132,20 +124,16 @@ if(!$perm->have_perm_area_action($area))
|
|||
rereadClients();
|
||||
} 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"] . "
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -253,8 +240,7 @@ if(!$perm->have_perm_area_action($area))
|
|||
|
||||
$serverpath = $db->f("frontendpath");
|
||||
|
||||
if ($serverpath == "")
|
||||
{
|
||||
if ($serverpath == "") {
|
||||
$serverpath = $cfg['path']['frontend'];
|
||||
}
|
||||
|
||||
|
@ -269,8 +255,7 @@ if(!$perm->have_perm_area_action($area))
|
|||
|
||||
$htmlpath = $db->f("htmlpath");
|
||||
|
||||
if ($htmlpath == "")
|
||||
{
|
||||
if ($htmlpath == "") {
|
||||
$htmlpath = "http://";
|
||||
}
|
||||
|
||||
|
@ -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,8 +322,7 @@ 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"]);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -31,7 +32,6 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
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;
|
||||
|
@ -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);
|
||||
|
@ -173,8 +172,7 @@ class pApiContentAllocation {
|
|||
} else {
|
||||
$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,8 +181,7 @@ class pApiContentAllocation {
|
|||
$where[] = 'cal.online = 1';
|
||||
|
||||
# fetch only articles which are not in following categories
|
||||
if (count($aCategoriesToExclude) > 0)
|
||||
{
|
||||
if (count($aCategoriesToExclude) > 0) {
|
||||
$where[] = "cat.idcat NOT IN (" . implode(',', $aCategoriesToExclude) . ")";
|
||||
}
|
||||
|
||||
|
@ -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,12 +240,10 @@ class pApiContentAllocation {
|
|||
$this->db->query($sql);
|
||||
|
||||
$aResult = array();
|
||||
while($oRow = $this->db->getResultObject())
|
||||
{
|
||||
while ($oRow = $this->db->getResultObject()) {
|
||||
$aResult[] = $oRow;
|
||||
}
|
||||
return $aResult;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,16 +263,13 @@ class pApiContentAllocation {
|
|||
$tables = array();
|
||||
$where = array();
|
||||
|
||||
for ($i = 0; $i < $size; $i++)
|
||||
{
|
||||
if ($i == 0)
|
||||
{ // first
|
||||
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)";
|
||||
}
|
||||
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,8 +278,7 @@ class pApiContentAllocation {
|
|||
$where[] = 'cal.online = 1';
|
||||
|
||||
# fetch only articles in following categories
|
||||
if (count($aCategories) > 0)
|
||||
{
|
||||
if (count($aCategories) > 0) {
|
||||
$where[] = "cat.idcat IN (" . implode(',', $aCategories) . ")";
|
||||
}
|
||||
|
||||
|
@ -303,12 +295,15 @@ class pApiContentAllocation {
|
|||
|
||||
$sql .= " ORDER BY cal.published DESC";
|
||||
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (count($aCategories) > 0) {
|
||||
$sWHERE_Category_IN = " c.idcat IN (" . implode(',', $aCategories) . ") AND ";
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
$sWHERE_Category_IN = '';
|
||||
}
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0)
|
||||
{
|
||||
if (is_integer($iNumOfRows) AND $iNumOfRows > 0) {
|
||||
$sLimit = " LIMIT " . Contenido_Security::toInteger($iOffset) . ", " . Contenido_Security::toInteger($iNumOfRows);
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
$sLimit = '';
|
||||
}
|
||||
|
||||
|
@ -394,7 +377,11 @@ class pApiContentAllocation {
|
|||
a.idart = b.idart
|
||||
' . $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,7 +28,6 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
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);
|
||||
|
@ -112,6 +111,7 @@ class pApiContentAllocationArticle extends pApiTree {
|
|||
$this->tpl->generate($this->template);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -27,7 +28,6 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
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;
|
||||
|
@ -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,15 +13,8 @@
|
|||
* @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')) {
|
||||
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;
|
||||
|
@ -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,7 +28,6 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
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;
|
||||
|
@ -140,10 +140,8 @@ 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';
|
||||
}
|
||||
}
|
||||
|
@ -172,8 +170,7 @@ class pApiTree {
|
|||
array_push($result, $rs);
|
||||
}
|
||||
return $result;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -204,19 +201,25 @@ 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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +270,9 @@ class pApiTree {
|
|||
}
|
||||
}
|
||||
|
||||
function fetchParents () {}
|
||||
function fetchParents() {
|
||||
|
||||
}
|
||||
|
||||
function fetchLevel($parentId = false, $showOffline = false) {
|
||||
// fetch current lang category
|
||||
|
@ -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']);
|
||||
|
||||
|
@ -406,7 +409,9 @@ class pApiTree {
|
|||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function itemMoveDown () {}
|
||||
function itemMoveDown() {
|
||||
|
||||
}
|
||||
|
||||
function deleteItem($idpica_alloc) {
|
||||
$sql = "DELETE FROM " . $this->table['pica_alloc'] . " WHERE idpica_alloc = " . Contenido_Security::toInteger($idpica_alloc);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,7 +29,6 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
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);
|
||||
|
@ -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,10 +26,8 @@ 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();
|
||||
}
|
||||
|
||||
|
@ -51,13 +48,16 @@ class FrontendNavigation
|
|||
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,10 +67,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -87,15 +85,17 @@ class FrontendNavigation
|
|||
C.public = 1 AND
|
||||
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,10 +105,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -126,15 +124,17 @@ class FrontendNavigation
|
|||
B.preid = 0 AND
|
||||
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,10 +142,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -163,27 +161,26 @@ class FrontendNavigation
|
|||
B.preid = 0 AND
|
||||
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 '';
|
||||
}
|
||||
|
||||
|
@ -199,15 +196,17 @@ class FrontendNavigation
|
|||
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,10 +214,8 @@ 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 '';
|
||||
}
|
||||
|
||||
|
@ -234,15 +231,17 @@ class FrontendNavigation
|
|||
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,10 +249,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -269,16 +266,18 @@ class FrontendNavigation
|
|||
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,10 +285,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -305,16 +302,18 @@ class FrontendNavigation
|
|||
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,10 +321,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -343,15 +340,17 @@ class FrontendNavigation
|
|||
$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,10 +358,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -379,13 +376,15 @@ class FrontendNavigation
|
|||
|
||||
$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,10 +392,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -413,13 +410,15 @@ class FrontendNavigation
|
|||
|
||||
$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,10 +426,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -443,13 +440,15 @@ class FrontendNavigation
|
|||
|
||||
$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,30 +464,22 @@ 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)
|
||||
{
|
||||
if (is_int((int) $iIdart) AND $iIdart > 0) {
|
||||
$sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat=' . $iIdcat . '&idart=' . $iIdart;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
$sURL = $this->cfgClient[$this->client]['path']['htmlpath'] . 'front_content.php?idcat=' . $iIdcat;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if (is_int((int)$iIdart) AND $iIdart > 0)
|
||||
{
|
||||
} else {
|
||||
if (is_int((int) $iIdart) AND $iIdart > 0) {
|
||||
$sURL = 'front_content.php?idcat=' . $iIdcat . '&idart=' . $iIdart;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
$sURL = 'front_content.php?idcat=' . $iIdcat;
|
||||
}
|
||||
}
|
||||
|
@ -510,39 +501,30 @@ 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)
|
||||
{
|
||||
if (is_int((int) $iIdart) AND $iIdart > 0) {
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-d-' . $iIdart . '.html';
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/' . $sURL_SUFFIX;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if (is_int((int)$iIdart) AND $iIdart > 0)
|
||||
{
|
||||
} else {
|
||||
if (is_int((int) $iIdart) AND $iIdart > 0) {
|
||||
return $cat_str . '/index-d-' . $iIdart . '.html';
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
return $cat_str . '/' . $sURL_SUFFIX;
|
||||
}
|
||||
}
|
||||
|
@ -561,33 +543,26 @@ 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))
|
||||
{
|
||||
if (is_int((int) $iSelectedNumber)) {
|
||||
return $this->cfgClient[$this->client]['path']['htmlpath'] . $cat_str . '/index-g-' . $iSelectedNumber . '.html';
|
||||
}
|
||||
}else
|
||||
{
|
||||
if (is_int((int)$iSelectedNumber))
|
||||
{
|
||||
} 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,11 +613,12 @@ 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
|
||||
|
@ -661,23 +634,23 @@ class FrontendNavigation
|
|||
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,11 +707,9 @@ 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();
|
||||
}
|
||||
|
||||
|
@ -761,36 +724,34 @@ class FrontendNavigation
|
|||
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