diff --git a/conlite/classes/class.htmlparser.php b/conlite/classes/class.htmlparser.php
index 96e7140..862f80f 100644
--- a/conlite/classes/class.htmlparser.php
+++ b/conlite/classes/class.htmlparser.php
@@ -1,34 +1,7 @@
iHtmlText = $aHtmlText;
$this->iHtmlTextLength = strlen($aHtmlText);
}
@@ -124,20 +95,19 @@ class HtmlParser {
$this->iNodeType = NODE_TYPE_DONE;
return false;
}
- $this->skipInTag ("<");
+ $this->skipInTag("<");
$this->clearAttributes();
$name = $this->skipToBlanksInTag();
$pos = strpos($name, "/");
if ($pos === 0) {
$this->iNodeType = NODE_TYPE_ENDELEMENT;
- $this->iNodeName = substr ($name, 1);
+ $this->iNodeName = substr($name, 1);
$this->iNodeValue = "";
- }
- else {
- if (!$this->isValidTagIdentifier ($name)) {
+ } else {
+ if (!$this->isValidTagIdentifier($name)) {
$comment = false;
if ($name == "!--") {
- $rest = $this->skipToStringInTag ("-->");
+ $rest = $this->skipToStringInTag("-->");
if ($rest != "") {
$this->iNodeType = NODE_TYPE_COMMENT;
$this->iNodeName = "Comment";
@@ -151,18 +121,16 @@ class HtmlParser {
$this->iNodeValue = "<" . $name;
}
return true;
- }
- else {
+ } else {
$this->iNodeType = NODE_TYPE_ELEMENT;
$this->iNodeValue = "";
$nameLength = strlen($name);
- if ($nameLength > 0 && substr($name, $nameLength - 1, 1) == "/") {
+ if ($nameLength > 0 && substr($name, $nameLength - 1, 1) == "/") {
$this->iNodeName = substr($name, 0, $nameLength - 1);
- }
- else {
+ } else {
$this->iNodeName = $name;
}
- }
+ }
}
while ($this->skipBlanksInTag()) {
$attrName = $this->skipToBlanksOrEqualsInTag();
@@ -173,50 +141,47 @@ class HtmlParser {
$this->skipBlanksInTag();
$value = $this->readValueInTag();
$this->iNodeAttributes[strtolower($attrName)] = $value;
- }
- else {
+ } else {
$this->iNodeAttributes[strtolower($attrName)] = "";
}
}
}
$this->skipEndOfTag();
- return true;
+ return true;
}
- function isValidTagIdentifier ($name) {
+ function isValidTagIdentifier($name) {
return preg_match('/[A-Za-z0-9]+/', $name);
}
-
+
function skipBlanksInTag() {
- return "" != ($this->skipInTag (array (" ", "\t", "\r", "\n" )));
+ return "" != ($this->skipInTag(array(" ", "\t", "\r", "\n")));
}
function skipToBlanksOrEqualsInTag() {
- return $this->skipToInTag (array (" ", "\t", "\r", "\n", "=" ));
+ return $this->skipToInTag(array(" ", "\t", "\r", "\n", "="));
}
function skipToBlanksInTag() {
- return $this->skipToInTag (array (" ", "\t", "\r", "\n" ));
+ return $this->skipToInTag(array(" ", "\t", "\r", "\n"));
}
function skipEqualsInTag() {
- return $this->skipInTag (array ( "=" ));
+ return $this->skipInTag(array("="));
}
function readValueInTag() {
$ch = $this->currentChar();
$value = "";
if ($ch == "\"") {
- $this->skipInTag (array ( "\"" ));
- $value = $this->skipToInTag (array ( "\"" ));
- $this->skipInTag (array ( "\"" ));
- }
- else if ($ch == "\'") {
- $this->skipInTag (array ( "\'" ));
- $value = $this->skipToInTag (array ( "\'" ));
- $this->skipInTag (array ( "\'" ));
- }
- else {
+ $this->skipInTag(array("\""));
+ $value = $this->skipToInTag(array("\""));
+ $this->skipInTag(array("\""));
+ } else if ($ch == "\'") {
+ $this->skipInTag(array("\'"));
+ $value = $this->skipToInTag(array("\'"));
+ $this->skipInTag(array("\'"));
+ } else {
$value = $this->skipToBlanksInTag();
}
return $value;
@@ -233,8 +198,7 @@ class HtmlParser {
if ($this->iHtmlTextIndex < $this->iHtmlTextLength) {
$this->iHtmlTextIndex++;
return true;
- }
- else {
+ } else {
return false;
}
}
@@ -252,14 +216,19 @@ class HtmlParser {
return $sb;
}
- function skipInTag ($chars) {
+ function skipInTag($chars) {
$sb = "";
while (($ch = $this->currentChar()) !== -1) {
if ($ch == ">") {
return $sb;
} else {
$match = false;
- for ($idx = 0; $idx < count($chars); $idx++) {
+ if(is_countable($chars)) {
+ $int_cnt_chars = count($chars);
+ } else {
+ $int_cnt_chars = strlen($chars);
+ }
+ for ($idx = 0; $idx < $int_cnt_chars; $idx++) {
if ($ch == $chars[$idx]) {
$match = true;
break;
@@ -275,12 +244,17 @@ class HtmlParser {
return $sb;
}
- function skipToInTag ($chars) {
+ function skipToInTag($chars) {
$sb = "";
while (($ch = $this->currentChar()) !== -1) {
$match = $ch == ">";
if (!$match) {
- for ($idx = 0; $idx < count($chars); $idx++) {
+ if(is_countable($chars)) {
+ $int_cnt_chars = count($chars);
+ } else {
+ $int_cnt_chars = strlen($chars);
+ }
+ for ($idx = 0; $idx < $int_cnt_chars; $idx++) {
if ($ch == $chars[$idx]) {
$match = true;
break;
@@ -305,7 +279,7 @@ class HtmlParser {
$sb .= $ch;
$this->moveNext();
}
- return $sb;
+ return $sb;
}
/**
@@ -314,16 +288,15 @@ class HtmlParser {
* after the location of $needle, or not moved at all
* if nothing is found.
*/
- function skipToStringInTag ($needle) {
- $pos = strpos ($this->iHtmlText, $needle, $this->iHtmlTextIndex);
+ function skipToStringInTag($needle) {
+ $pos = strpos($this->iHtmlText, $needle, $this->iHtmlTextIndex);
if ($pos === false) {
return "";
}
$top = $pos + strlen($needle);
- $retvalue = substr ($this->iHtmlText, $this->iHtmlTextIndex, $top - $this->iHtmlTextIndex);
+ $retvalue = substr($this->iHtmlText, $this->iHtmlTextIndex, $top - $this->iHtmlTextIndex);
$this->iHtmlTextIndex = $top;
return $retvalue;
}
-}
-?>
\ No newline at end of file
+}
diff --git a/conlite/classes/class.properties.php b/conlite/classes/class.properties.php
index 218aa5e..2238b14 100644
--- a/conlite/classes/class.properties.php
+++ b/conlite/classes/class.properties.php
@@ -328,7 +328,9 @@ class PropertyCollection extends ItemCollection
public function getAllValues($field, $fieldValue, $auth=NULL)
{
$authString = '';
- if (!is_null($auth) && sizeof($auth) > 0) {
+ if (!is_null($auth)
+ && is_countable($auth)
+ && sizeof($auth) > 0) {
$authString .= " AND author = '" . $auth->auth["uid"] . "'";
}
diff --git a/conlite/external/wysiwyg/tinymce3/editorclass.php b/conlite/external/wysiwyg/tinymce3/editorclass.php
index 4a08424..d490389 100644
--- a/conlite/external/wysiwyg/tinymce3/editorclass.php
+++ b/conlite/external/wysiwyg/tinymce3/editorclass.php
@@ -56,7 +56,7 @@ class cTinyMCEEditor extends cWYSIWYGEditor {
*/
var $_bUseGZIP = false;
- function cTinyMCEEditor($sEditorName, $sEditorContent) {
+ public function __construct($sEditorName, $sEditorContent) {
global $belang, $cfg, $cfgClient, $client, $lang, $idart;
parent::__construct($sEditorName, $sEditorContent);
diff --git a/conlite/includes/functions.php73.php b/conlite/includes/functions.php73.php
index 672d016..f40d910 100644
--- a/conlite/includes/functions.php73.php
+++ b/conlite/includes/functions.php73.php
@@ -1,6 +1,38 @@
+ * @copyright (c) 2019, conlite.org
+ * @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
+ * @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
+ * @link http://www.conlite.org ConLite.org
+ *
+ * $Id$
+ */
+// security check
+defined('CON_FRAMEWORK') or die('Illegal call');
+
+
if (!function_exists('is_countable')) {
+
+ /**
+ * Verify that the contents of a variable is a countable value
+ *
Verify that the contents of a variable is an array
or an object implementing Countable
+ * @param mixed $var The value to check
+ * @return bool Returns TRUE
if var
is countable, FALSE
otherwise.
+ * @link http://php.net/manual/en/function.is-countable.php
+ *
+ * @param Countable $var
+ * @return boolean
+ */
function is_countable($var) {
return (is_array($var) || $var instanceof Countable);
}
+
}
\ No newline at end of file
diff --git a/conlite/includes/functions.tpl.php b/conlite/includes/functions.tpl.php
index 2229297..f172ad4 100644
--- a/conlite/includes/functions.tpl.php
+++ b/conlite/includes/functions.tpl.php
@@ -1,4 +1,5 @@
* @copyright four for business AG
*/
-function tplEditTemplate($changelayout, $idtpl, $name, $description, $idlay, $c, $default)
-{
+function tplEditTemplate($changelayout, $idtpl, $name, $description, $idlay, $c, $default) {
- global $db;
- global $sess;
- global $auth;
- global $client;
- global $cfg;
- global $area_tree;
- global $perm;
-
- $db2= new DB_ConLite;
+ global $db;
+ global $sess;
+ global $auth;
+ global $client;
+ global $cfg;
+ global $area_tree;
+ global $perm;
- $date = date("YmdHis");
- $author = "".$auth->auth["uname"]."";
+ $db2 = new DB_ConLite;
- //******** entry in 'tpl'-table ***************
- set_magic_quotes_gpc($name);
- set_magic_quotes_gpc($description);
+ $date = date("YmdHis");
+ $author = "" . $auth->auth["uname"] . "";
- if (!$idtpl) {
+ //******** entry in 'tpl'-table ***************
+ set_magic_quotes_gpc($name);
+ set_magic_quotes_gpc($description);
- $idtpl = $db->nextid($cfg["tab"]["tpl"]);
- $idtplcfg = $db->nextid($cfg["tab"]["tpl_conf"]);
+ if (!$idtpl) {
- /* Insert new entry in the
- Template Conf table */
- $sql = "INSERT INTO ".$cfg["tab"]["tpl_conf"]."
+ $idtpl = $db->nextid($cfg["tab"]["tpl"]);
+ $idtplcfg = $db->nextid($cfg["tab"]["tpl_conf"]);
+
+ /* Insert new entry in the
+ Template Conf table */
+ $sql = "INSERT INTO " . $cfg["tab"]["tpl_conf"] . "
(idtplcfg, idtpl, author) VALUES
- ('".Contenido_Security::toInteger($idtplcfg)."', '".Contenido_Security::toInteger($idtpl)."', '".Contenido_Security::escapeDB($auth->auth["uname"], $db)."')";
+ ('" . Contenido_Security::toInteger($idtplcfg) . "', '" . Contenido_Security::toInteger($idtpl) . "', '" . Contenido_Security::escapeDB($auth->auth["uname"], $db) . "')";
- $db->query($sql);
+ $db->query($sql);
- /* Insert new entry in the
- Template table */
- $sql = "INSERT INTO ".$cfg["tab"]["tpl"]."
+ /* Insert new entry in the
+ Template table */
+ $sql = "INSERT INTO " . $cfg["tab"]["tpl"] . "
(idtpl, idtplcfg, name, description, deletable, idlay, idclient, author, created, lastmodified) VALUES
- ('".Contenido_Security::toInteger($idtpl)."', '".Contenido_Security::toInteger($idtplcfg)."', '".Contenido_Security::escapeDB($name, $db)."', '".Contenido_Security::escapeDB($description, $db)."',
- '1', '".Contenido_Security::toInteger($idlay)."', '".Contenido_Security::toInteger($client)."', '".Contenido_Security::escapeDB($author, $db)."', '".Contenido_Security::escapeDB($date, $db)."',
- '".Contenido_Security::escapeDB($date, $db)."')";
+ ('" . Contenido_Security::toInteger($idtpl) . "', '" . Contenido_Security::toInteger($idtplcfg) . "', '" . Contenido_Security::escapeDB($name, $db) . "', '" . Contenido_Security::escapeDB($description, $db) . "',
+ '1', '" . Contenido_Security::toInteger($idlay) . "', '" . Contenido_Security::toInteger($client) . "', '" . Contenido_Security::escapeDB($author, $db) . "', '" . Contenido_Security::escapeDB($date, $db) . "',
+ '" . Contenido_Security::escapeDB($date, $db) . "')";
+ $db->query($sql);
+
+ // set correct rights for element
+ cInclude("includes", "functions.rights.php");
+ createRightsForElement("tpl", $idtpl);
+ } else {
+
+ /* Update */
+ $sql = "UPDATE " . $cfg["tab"]["tpl"] . " SET name='" . Contenido_Security::escapeDB($name, $db) . "', description='" . Contenido_Security::escapeDB($description, $db) . "', idlay='" . Contenido_Security::toInteger($idlay) . "',
+ author='" . Contenido_Security::escapeDB($author, $db) . "', lastmodified='" . Contenido_Security::escapeDB($date, $db) . "' WHERE idtpl='" . Contenido_Security::toInteger($idtpl) . "'";
+ $db->query($sql);
+
+ if (is_array($c)) {
+
+ /* Delete all container assigned to this template */
+ $sql = "DELETE FROM " . $cfg["tab"]["container"] . " WHERE idtpl='" . Contenido_Security::toInteger($idtpl, $db) . "'";
$db->query($sql);
- // set correct rights for element
- cInclude ("includes", "functions.rights.php");
- createRightsForElement("tpl", $idtpl);
+ foreach ($c as $idcontainer => $dummyval) {
- } else {
-
- /* Update */
- $sql = "UPDATE ".$cfg["tab"]["tpl"]." SET name='".Contenido_Security::escapeDB($name, $db)."', description='".Contenido_Security::escapeDB($description, $db)."', idlay='".Contenido_Security::toInteger($idlay)."',
- author='".Contenido_Security::escapeDB($author, $db)."', lastmodified='".Contenido_Security::escapeDB($date, $db)."' WHERE idtpl='".Contenido_Security::toInteger($idtpl)."'";
- $db->query($sql);
-
- if (is_array($c)) {
-
- /* Delete all container assigned to this template */
- $sql = "DELETE FROM ".$cfg["tab"]["container"]." WHERE idtpl='".Contenido_Security::toInteger($idtpl, $db)."'";
- $db->query($sql);
-
- foreach($c as $idcontainer => $dummyval) {
-
- $sql = "INSERT INTO ".$cfg["tab"]["container"]." (idcontainer, idtpl, number, idmod) VALUES ";
- $sql .= "(";
- $sql .= "'".Contenido_Security::toInteger($db->nextid($cfg["tab"]["container"]))."', ";
- $sql .= "'".Contenido_Security::toInteger($idtpl)."', ";
- $sql .= "'".Contenido_Security::toInteger($idcontainer)."', ";
- $sql .= "'".Contenido_Security::toInteger($c[$idcontainer])."'";
- $sql .= ") ";
- $db->query($sql);
-
- }
+ $sql = "INSERT INTO " . $cfg["tab"]["container"] . " (idcontainer, idtpl, number, idmod) VALUES ";
+ $sql .= "(";
+ $sql .= "'" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["container"])) . "', ";
+ $sql .= "'" . Contenido_Security::toInteger($idtpl) . "', ";
+ $sql .= "'" . Contenido_Security::toInteger($idcontainer) . "', ";
+ $sql .= "'" . Contenido_Security::toInteger($c[$idcontainer]) . "'";
+ $sql .= ") ";
+ $db->query($sql);
}
-
- /* Generate code */
- conGenerateCodeForAllartsUsingTemplate($idtpl);
-
}
- if ($default == 1)
- {
- $sql = "UPDATE ".$cfg["tab"]["tpl"]." SET defaulttemplate = '0' WHERE idclient = '".Contenido_Security::toInteger($client)."'";
- $db->query($sql);
+ /* Generate code */
+ conGenerateCodeForAllartsUsingTemplate($idtpl);
+ }
- $sql = "UPDATE ".$cfg["tab"]["tpl"]." SET defaulttemplate = '1' WHERE idtpl = '".Contenido_Security::toInteger($idtpl)."' AND idclient = '".Contenido_Security::toInteger($client)."'";
- $db->query($sql);
- } else {
- $sql = "UPDATE ".$cfg["tab"]["tpl"]." SET defaulttemplate = '0' WHERE idtpl = '".Contenido_Security::toInteger($idtpl)."' AND idclient = '".Contenido_Security::toInteger($client)."'";
- $db->query($sql);
- }
-
-
- //******** if layout is changed stay at 'tpl_edit' otherwise go to 'tpl'
- if ($changelayout != 1) {
- $url = $sess->url("main.php?area=tpl_edit&idtpl=$idtpl&frame=4");
- header("location: $url");
- }
+ if ($default == 1) {
+ $sql = "UPDATE " . $cfg["tab"]["tpl"] . " SET defaulttemplate = '0' WHERE idclient = '" . Contenido_Security::toInteger($client) . "'";
+ $db->query($sql);
- return $idtpl;
+ $sql = "UPDATE " . $cfg["tab"]["tpl"] . " SET defaulttemplate = '1' WHERE idtpl = '" . Contenido_Security::toInteger($idtpl) . "' AND idclient = '" . Contenido_Security::toInteger($client) . "'";
+ $db->query($sql);
+ } else {
+ $sql = "UPDATE " . $cfg["tab"]["tpl"] . " SET defaulttemplate = '0' WHERE idtpl = '" . Contenido_Security::toInteger($idtpl) . "' AND idclient = '" . Contenido_Security::toInteger($client) . "'";
+ $db->query($sql);
+ }
+
+ //******** if layout is changed stay at 'tpl_edit' otherwise go to 'tpl'
+ if ($changelayout != 1) {
+ $url = $sess->url("main.php?area=tpl_edit&idtpl=$idtpl&frame=4");
+ header("location: $url");
+ }
+
+ return $idtpl;
}
/**
@@ -157,39 +151,36 @@ function tplEditTemplate($changelayout, $idtpl, $name, $description, $idlay, $c,
*/
function tplDeleteTemplate($idtpl) {
- global $db, $client, $lang, $cfg, $area_tree, $perm;
+ global $db, $client, $lang, $cfg, $area_tree, $perm;
- $sql = "DELETE FROM ".$cfg["tab"]["tpl"]." WHERE idtpl='".Contenido_Security::toInteger($idtpl)."'";
+ $sql = "DELETE FROM " . $cfg["tab"]["tpl"] . " WHERE idtpl='" . Contenido_Security::toInteger($idtpl) . "'";
+ $db->query($sql);
+
+ /* JL 160603 : Delete all unnecessary entries */
+
+ $sql = "DELETE FROM " . $cfg["tab"]["container"] . " WHERE idtpl = '" . Contenido_Security::toInteger($idtpl) . "'";
+ $db->query($sql);
+
+ $idsToDelete = array();
+ $sql = "SELECT idtplcfg FROM " . $cfg["tab"]["tpl_conf"] . " WHERE idtpl = '" . Contenido_Security::toInteger($idtpl) . "'";
+ $db->query($sql);
+ while ($db->next_record()) {
+ $idsToDelete[] = $db->f("idtplcfg");
+ }
+
+ foreach ($idsToDelete as $id) {
+
+ $sql = "DELETE FROM " . $cfg["tab"]["tpl_conf"] . " WHERE idtplcfg = '" . Contenido_Security::toInteger($id) . "'";
$db->query($sql);
- /* JL 160603 : Delete all unnecessary entries */
-
- $sql = "DELETE FROM ".$cfg["tab"]["container"]." WHERE idtpl = '".Contenido_Security::toInteger($idtpl)."'";
+ $sql = "DELETE FROM " . $cfg["tab"]["container_conf"] . " WHERE idtplcfg = '" . Contenido_Security::toInteger($id) . "'";
$db->query($sql);
+ }
- $idsToDelete = array();
- $sql = "SELECT idtplcfg FROM ".$cfg["tab"]["tpl_conf"]." WHERE idtpl = '".Contenido_Security::toInteger($idtpl)."'";
- $db->query($sql);
- while ( $db->next_record() ) {
- $idsToDelete[] = $db->f("idtplcfg");
- }
-
- foreach ( $idsToDelete as $id ) {
-
- $sql = "DELETE FROM ".$cfg["tab"]["tpl_conf"]." WHERE idtplcfg = '".Contenido_Security::toInteger($id)."'";
- $db->query($sql);
-
- $sql = "DELETE FROM ".$cfg["tab"]["container_conf"]." WHERE idtplcfg = '".Contenido_Security::toInteger($id)."'";
- $db->query($sql);
-
- }
-
- cInclude ("includes", "functions.rights.php");
- deleteRightsForElement("tpl", $idtpl);
-
+ cInclude("includes", "functions.rights.php");
+ deleteRightsForElement("tpl", $idtpl);
}
-
/**
* Browse a specific layout for containers
*
@@ -201,12 +192,12 @@ function tplDeleteTemplate($idtpl) {
* @copyright four for business AG
*/
function tplBrowseLayoutForContainers($idlay, $raw_code = NULL) {
- global $db;
- global $cfg;
- global $containerinf;
-
- if(is_null($raw_code) || empty($raw_code)) {
- $sql = "SELECT code FROM ".$cfg["tab"]["lay"]." WHERE idlay='".Contenido_Security::toInteger($idlay)."'";
+ global $db;
+ global $cfg;
+ global $containerinf;
+
+ if (is_null($raw_code) || empty($raw_code)) {
+ $sql = "SELECT code FROM " . $cfg["tab"]["lay"] . " WHERE idlay='" . Contenido_Security::toInteger($idlay) . "'";
$db->query($sql);
$db->next_record();
$code = $db->f("code");
@@ -214,38 +205,38 @@ function tplBrowseLayoutForContainers($idlay, $raw_code = NULL) {
$code = $raw_code;
}
- preg_match_all ("/CMS_CONTAINER\[([0-9]*)\]/", $code, $a_container);
- $iPosBody = stripos($code, '');
- $sCodeBeforeHeader = substr($code, 0, $iPosBody);
-
- foreach ($a_container[1] as $value) {
- if (preg_match("/CMS_CONTAINER\[$value\]/", $sCodeBeforeHeader)) {
- $containerinf[$idlay][$value]["is_body"] = false;
- } else {
- $containerinf[$idlay][$value]["is_body"] = true;
- }
- }
-
+ preg_match_all("/CMS_CONTAINER\[([0-9]*)\]/", $code, $a_container);
+ $iPosBody = stripos($code, '');
+ $sCodeBeforeHeader = substr($code, 0, $iPosBody);
+
+ foreach ($a_container[1] as $value) {
+ if (preg_match("/CMS_CONTAINER\[$value\]/", $sCodeBeforeHeader)) {
+ $containerinf[$idlay][$value]["is_body"] = false;
+ } else {
+ $containerinf[$idlay][$value]["is_body"] = true;
+ }
+ }
+
if (is_array($containerinf[$idlay])) {
foreach ($containerinf[$idlay] as $key => $value) {
- $a_container[1][] = $key;
- }
- }
+ $a_container[1][] = $key;
+ }
+ }
+
+ $container = Array();
- $container = Array();
-
foreach ($a_container[1] as $value) {
if (!in_array($value, $container)) {
- $container[] = $value;
- }
- }
-
- asort($container);
-
- if (is_array($container)) {
- $tmp_returnstring = implode("&",$container);
+ $container[] = $value;
}
- return $tmp_returnstring;
+ }
+
+ asort($container);
+
+ if (is_array($container)) {
+ $tmp_returnstring = implode("&", $container);
+ }
+ return $tmp_returnstring;
}
/**
@@ -256,19 +247,16 @@ function tplBrowseLayoutForContainers($idlay, $raw_code = NULL) {
*
* @return string Container name
*/
-function tplGetContainerName($idlay, $container)
-{
- global $db;
- global $cfg;
- global $containerinf;
-
- if (is_array($containerinf[$idlay]))
- {
- if (array_key_exists($container, $containerinf[$idlay]))
- {
- return $containerinf[$idlay][$container]["name"];
- }
- }
+function tplGetContainerName($idlay, $container) {
+ global $db;
+ global $cfg;
+ global $containerinf;
+
+ if (is_array($containerinf[$idlay])) {
+ if (array_key_exists($container, $containerinf[$idlay])) {
+ return $containerinf[$idlay][$container]["name"];
+ }
+ }
}
/**
@@ -279,19 +267,16 @@ function tplGetContainerName($idlay, $container)
*
* @return string Container name
*/
-function tplGetContainerMode($idlay, $container)
-{
- global $db;
- global $cfg;
- global $containerinf;
-
- if (is_array($containerinf[$idlay]))
- {
- if (array_key_exists($container, $containerinf[$idlay]))
- {
- return $containerinf[$idlay][$container]["mode"];
- }
- }
+function tplGetContainerMode($idlay, $container) {
+ global $db;
+ global $cfg;
+ global $containerinf;
+
+ if (is_array($containerinf[$idlay])) {
+ if (array_key_exists($container, $containerinf[$idlay])) {
+ return $containerinf[$idlay][$container]["mode"];
+ }
+ }
}
/**
@@ -302,28 +287,23 @@ function tplGetContainerMode($idlay, $container)
*
* @return array Allowed container types
*/
-function tplGetContainerTypes($idlay, $container)
-{
- global $db;
- global $cfg;
- global $containerinf;
-
- if (is_array($containerinf[$idlay]))
- {
- if (array_key_exists($container, $containerinf[$idlay]))
- {
- if ($containerinf[$idlay][$container]["types"] != "")
- {
- $list = explode(",",$containerinf[$idlay][$container]["types"]);
-
- foreach ($list as $key => $value)
- {
- $list[$key] = trim($value);
- }
- return $list;
- }
- }
- }
+function tplGetContainerTypes($idlay, $container) {
+ global $db;
+ global $cfg;
+ global $containerinf;
+
+ if (is_array($containerinf[$idlay])) {
+ if (array_key_exists($container, $containerinf[$idlay])) {
+ if ($containerinf[$idlay][$container]["types"] != "") {
+ $list = explode(",", $containerinf[$idlay][$container]["types"]);
+
+ foreach ($list as $key => $value) {
+ $list[$key] = trim($value);
+ }
+ return $list;
+ }
+ }
+ }
}
/**
@@ -334,19 +314,16 @@ function tplGetContainerTypes($idlay, $container)
*
* @return array Allowed container types
*/
-function tplGetContainerDefault($idlay, $container)
-{
- global $db;
- global $cfg;
- global $containerinf;
-
- if (is_array($containerinf[$idlay]))
- {
- if (array_key_exists($container, $containerinf[$idlay]))
- {
- return $containerinf[$idlay][$container]["default"];
- }
- }
+function tplGetContainerDefault($idlay, $container) {
+ global $db;
+ global $cfg;
+ global $containerinf;
+
+ if (is_array($containerinf[$idlay])) {
+ if (array_key_exists($container, $containerinf[$idlay])) {
+ return $containerinf[$idlay][$container]["default"];
+ }
+ }
}
/**
@@ -356,46 +333,43 @@ function tplGetContainerDefault($idlay, $container)
*
* @return none
*/
-function tplPreparseLayout ($idlay, $raw_code = NULL) {
+function tplPreparseLayout($idlay, $raw_code = NULL) {
global $containerinf;
global $db;
global $cfg;
-
- if(is_null($raw_code) || empty($raw_code)) {
- $sql = "SELECT code FROM ".$cfg["tab"]["lay"]." WHERE idlay='".Contenido_Security::toInteger($idlay)."'";
+
+ if (is_null($raw_code) || empty($raw_code)) {
+ $sql = "SELECT code FROM " . $cfg["tab"]["lay"] . " WHERE idlay='" . Contenido_Security::toInteger($idlay) . "'";
$db->query($sql);
$db->next_record();
$code = $db->f("code");
} else {
$code = $raw_code;
}
-
+
$parser = new HtmlParser($code);
$bIsBody = false;
- while ($parser->parse())
- {
- if (strtolower($parser->iNodeName) == 'body') {
- $bIsBody = true;
- }
+ while ($parser->parse()) {
+ if (strtolower($parser->iNodeName) == 'body') {
+ $bIsBody = true;
+ }
- if ($parser->iNodeName == "container" && $parser->iNodeType == NODE_TYPE_ELEMENT)
- {
- $idcontainer = $parser->iNodeAttributes["id"];
-
- $mode = $parser->iNodeAttributes["mode"];
-
- if ($mode == "")
- {
- $mode = "optional";
- }
-
- $containerinf[$idlay][$idcontainer]["name"] = $parser->iNodeAttributes["name"];
- $containerinf[$idlay][$idcontainer]["mode"] = $mode;
- $containerinf[$idlay][$idcontainer]["default"] = $parser->iNodeAttributes["default"];
- $containerinf[$idlay][$idcontainer]["types"] = $parser->iNodeAttributes["types"];
- $containerinf[$idlay][$idcontainer]["is_body"] = $bIsBody;
- }
- }
+ if ($parser->iNodeName == "container" && $parser->iNodeType == NODE_TYPE_ELEMENT) {
+ $idcontainer = $parser->iNodeAttributes["id"];
+
+ $mode = $parser->iNodeAttributes["mode"];
+
+ if ($mode == "") {
+ $mode = "optional";
+ }
+
+ $containerinf[$idlay][$idcontainer]["name"] = $parser->iNodeAttributes["name"];
+ $containerinf[$idlay][$idcontainer]["mode"] = $mode;
+ $containerinf[$idlay][$idcontainer]["default"] = $parser->iNodeAttributes["default"];
+ $containerinf[$idlay][$idcontainer]["types"] = $parser->iNodeAttributes["types"];
+ $containerinf[$idlay][$idcontainer]["is_body"] = $bIsBody;
+ }
+ }
}
/**
@@ -417,35 +391,35 @@ function tplDuplicateTemplate($idtpl) {
$sql = "SELECT
*
FROM
- ".$cfg["tab"]["tpl"]."
+ " . $cfg["tab"]["tpl"] . "
WHERE
- idtpl = '".Contenido_Security::toInteger($idtpl)."'";
+ idtpl = '" . Contenido_Security::toInteger($idtpl) . "'";
$db->query($sql);
$db->next_record();
- $idclient = $db->f("idclient");
- $idlay = $db->f("idlay");
- $new_idtpl = $db->nextid($cfg["tab"]["tpl"]);
- //modified (added) 2008-06-30 timo.trautmann added fix module settings were also copied
- $idtpl_conf = $db->f("idtplcfg");
- if($idtpl_conf) {
- $new_idtpl_conf = $db->nextid($cfg["tab"]["tpl_conf"]);
+ $idclient = $db->f("idclient");
+ $idlay = $db->f("idlay");
+ $new_idtpl = $db->nextid($cfg["tab"]["tpl"]);
+ //modified (added) 2008-06-30 timo.trautmann added fix module settings were also copied
+ $idtpl_conf = $db->f("idtplcfg");
+ if ($idtpl_conf) {
+ $new_idtpl_conf = $db->nextid($cfg["tab"]["tpl_conf"]);
}
- //modified (added) 2008-06-30 end
- $name = sprintf(i18n("%s (Copy)"), $db->f("name"));
- $descr = $db->f("description");
- $author = $auth->auth["uname"];
- $created = time();
- $lastmod = time();
+ //modified (added) 2008-06-30 end
+ $name = sprintf(i18n("%s (Copy)"), $db->f("name"));
+ $descr = $db->f("description");
+ $author = $auth->auth["uname"];
+ $created = time();
+ $lastmod = time();
- //modified (added) 2008-06-30 : idtplcfg -> $new_idtpl
+ //modified (added) 2008-06-30 : idtplcfg -> $new_idtpl
$sql = "INSERT INTO
- ".$cfg["tab"]["tpl"]."
- (idclient, idlay, idtpl, ".($idtpl_conf?'idtplcfg,':'')." name, description, deletable,author, created, lastmodified)
+ " . $cfg["tab"]["tpl"] . "
+ (idclient, idlay, idtpl, " . ($idtpl_conf ? 'idtplcfg,' : '') . " name, description, deletable,author, created, lastmodified)
VALUES
- ('".Contenido_Security::toInteger($idclient)."', '".Contenido_Security::toInteger($idlay)."', '".Contenido_Security::toInteger($new_idtpl)."', ".($idtpl_conf?"'".Contenido_Security::toInteger($new_idtpl_conf)."', ":'')." '".Contenido_Security::escapeDB($name, $db)."',
- '".Contenido_Security::escapeDB($descr, $db)."', '1', '".Contenido_Security::escapeDB($author, $db)."', '".Contenido_Security::escapeDB($created, $db)."', '".Contenido_Security::escapeDB($lastmod, $db)."')";
+ ('" . Contenido_Security::toInteger($idclient) . "', '" . Contenido_Security::toInteger($idlay) . "', '" . Contenido_Security::toInteger($new_idtpl) . "', " . ($idtpl_conf ? "'" . Contenido_Security::toInteger($new_idtpl_conf) . "', " : '') . " '" . Contenido_Security::escapeDB($name, $db) . "',
+ '" . Contenido_Security::escapeDB($descr, $db) . "', '1', '" . Contenido_Security::escapeDB($author, $db) . "', '" . Contenido_Security::escapeDB($created, $db) . "', '" . Contenido_Security::escapeDB($lastmod, $db) . "')";
$db->query($sql);
$a_containers = array();
@@ -453,9 +427,9 @@ function tplDuplicateTemplate($idtpl) {
$sql = "SELECT
*
FROM
- ".$cfg["tab"]["container"]."
+ " . $cfg["tab"]["container"] . "
WHERE
- idtpl = '".Contenido_Security::toInteger($idtpl)."'
+ idtpl = '" . Contenido_Security::toInteger($idtpl) . "'
ORDER BY
number";
@@ -469,49 +443,46 @@ function tplDuplicateTemplate($idtpl) {
$nextid = $db->nextid($cfg["tab"]["container"]);
- $sql = "INSERT INTO ".$cfg["tab"]["container"]."
- (idcontainer, idtpl, number, idmod) VALUES ('".Contenido_Security::toInteger($nextid)."', '".Contenido_Security::toInteger($new_idtpl)."', '".Contenido_Security::toInteger($key)."', '".Contenido_Security::toInteger($value)."')";
+ $sql = "INSERT INTO " . $cfg["tab"]["container"] . "
+ (idcontainer, idtpl, number, idmod) VALUES ('" . Contenido_Security::toInteger($nextid) . "', '" . Contenido_Security::toInteger($new_idtpl) . "', '" . Contenido_Security::toInteger($key) . "', '" . Contenido_Security::toInteger($value) . "')";
$db->query($sql);
-
}
-
- //modified (added) 2008-06-30 timo.trautmann added fix module settings were also copied
- if($idtpl_conf) {
+
+ //modified (added) 2008-06-30 timo.trautmann added fix module settings were also copied
+ if ($idtpl_conf) {
$a_container_cfg = array();
$sql = "SELECT
*
FROM
- ".$cfg["tab"]["container_conf"]."
+ " . $cfg["tab"]["container_conf"] . "
WHERE
- idtplcfg = '".Contenido_Security::toInteger($idtpl_conf)."'
+ idtplcfg = '" . Contenido_Security::toInteger($idtpl_conf) . "'
ORDER BY
number";
-
+
$db->query($sql);
-
+
while ($db->next_record()) {
- $a_container_cfg[$db->f("number")] = $db->f("container");
+ $a_container_cfg[$db->f("number")] = $db->f("container");
}
-
+
foreach ($a_container_cfg as $key => $value) {
-
- $nextid = $db->nextid($cfg["tab"]["container_conf"]);
- $sql = "INSERT INTO ".$cfg["tab"]["container_conf"]."
- (idcontainerc, idtplcfg, number, container) VALUES ('".Contenido_Security::toInteger($nextid)."', '".Contenido_Security::toInteger($new_idtpl_conf)."', '".Contenido_Security::escapeDB($key, $db)."', '".Contenido_Security::escapeDB($value, $db)."')";
+ $nextid = $db->nextid($cfg["tab"]["container_conf"]);
- $db->query($sql);
-
+ $sql = "INSERT INTO " . $cfg["tab"]["container_conf"] . "
+ (idcontainerc, idtplcfg, number, container) VALUES ('" . Contenido_Security::toInteger($nextid) . "', '" . Contenido_Security::toInteger($new_idtpl_conf) . "', '" . Contenido_Security::escapeDB($key, $db) . "', '" . Contenido_Security::escapeDB($value, $db) . "')";
+
+ $db->query($sql);
}
- }
- //modified (added) 2008-06-30 end
+ }
+ //modified (added) 2008-06-30 end
- cInclude ("includes", "functions.rights.php");
+ cInclude("includes", "functions.rights.php");
copyRightsForElement("tpl", $idtpl, $new_idtpl);
-
- return $new_idtpl;
+ return $new_idtpl;
}
/**
@@ -535,38 +506,37 @@ function tplIsTemplateInUse($idtpl) {
$sql = "SELECT
b.idcatlang, b.name, b.idlang, b.idcat
FROM
- ".$cfg["tab"]["cat"]." AS a,
- ".$cfg["tab"]["cat_lang"]." AS b
+ " . $cfg["tab"]["cat"] . " AS a,
+ " . $cfg["tab"]["cat_lang"] . " AS b
WHERE
- a.idclient = '".Contenido_Security::toInteger($client)."' AND
+ a.idclient = '" . Contenido_Security::toInteger($client) . "' AND
a.idcat = b.idcat AND
- b.idtplcfg IN (SELECT idtplcfg FROM ".$cfg["tab"]["tpl_conf"]." WHERE idtpl = '".$idtpl."')
+ b.idtplcfg IN (SELECT idtplcfg FROM " . $cfg["tab"]["tpl_conf"] . " WHERE idtpl = '" . $idtpl . "')
ORDER BY b.idlang ASC, b.name ASC ";
$db->query($sql);
if ($db->Errno == '' && $db->num_rows() > 0) {
- return true;
+ return true;
}
// Check articles
$sql = "SELECT
b.idartlang, b.title, b.idlang, b.idart
FROM
- ".$cfg["tab"]["art"]." AS a,
- ".$cfg["tab"]["art_lang"]." AS b
+ " . $cfg["tab"]["art"] . " AS a,
+ " . $cfg["tab"]["art_lang"] . " AS b
WHERE
- a.idclient = '".Contenido_Security::toInteger($client)."' AND
+ a.idclient = '" . Contenido_Security::toInteger($client) . "' AND
a.idart = b.idart AND
- b.idtplcfg IN (SELECT idtplcfg FROM ".$cfg["tab"]["tpl_conf"]." WHERE idtpl = '".$idtpl."')
+ b.idtplcfg IN (SELECT idtplcfg FROM " . $cfg["tab"]["tpl_conf"] . " WHERE idtpl = '" . $idtpl . "')
ORDER BY b.idlang ASC, b.title ASC ";
$db->query($sql);
if ($db->Errno == '' && $db->num_rows() > 0) {
- return true;
+ return true;
}
-
- return false;
+ return false;
}
/**
@@ -584,57 +554,56 @@ function tplGetInUsedData($idtpl) {
global $cfg, $client, $lang;
$db = new DB_ConLite;
-
+
$aUsedData = array();
// Check categorys
$sql = "SELECT
b.idcatlang, b.name, b.idlang, b.idcat
FROM
- ".$cfg["tab"]["cat"]." AS a,
- ".$cfg["tab"]["cat_lang"]." AS b
+ " . $cfg["tab"]["cat"] . " AS a,
+ " . $cfg["tab"]["cat_lang"] . " AS b
WHERE
- a.idclient = '".Contenido_Security::toInteger($client)."' AND
+ a.idclient = '" . Contenido_Security::toInteger($client) . "' AND
a.idcat = b.idcat AND
- b.idtplcfg IN (SELECT idtplcfg FROM ".$cfg["tab"]["tpl_conf"]." WHERE idtpl = '".$idtpl."')
+ b.idtplcfg IN (SELECT idtplcfg FROM " . $cfg["tab"]["tpl_conf"] . " WHERE idtpl = '" . $idtpl . "')
ORDER BY b.idlang ASC, b.name ASC ";
$db->query($sql);
if ($db->Errno == 0 && $db->num_rows() > 0) {
- while ($db->next_record()) {
- $aUsedData['cat'][] = array(
- 'name' => $db->f('name'),
- 'lang' => $db->f('idlang'),
- 'idcat' => $db->f('idcat'),
- );
- }
+ while ($db->next_record()) {
+ $aUsedData['cat'][] = array(
+ 'name' => $db->f('name'),
+ 'lang' => $db->f('idlang'),
+ 'idcat' => $db->f('idcat'),
+ );
+ }
}
// Check articles
$sql = "SELECT
b.idartlang, b.title, b.idlang, b.idart
FROM
- ".$cfg["tab"]["art"]." AS a,
- ".$cfg["tab"]["art_lang"]." AS b
+ " . $cfg["tab"]["art"] . " AS a,
+ " . $cfg["tab"]["art_lang"] . " AS b
WHERE
- a.idclient = '".Contenido_Security::toInteger($client)."' AND
+ a.idclient = '" . Contenido_Security::toInteger($client) . "' AND
a.idart = b.idart AND
- b.idtplcfg IN (SELECT idtplcfg FROM ".$cfg["tab"]["tpl_conf"]." WHERE idtpl = '".$idtpl."')
+ b.idtplcfg IN (SELECT idtplcfg FROM " . $cfg["tab"]["tpl_conf"] . " WHERE idtpl = '" . $idtpl . "')
ORDER BY b.idlang ASC, b.title ASC ";
$db->query($sql);
if ($db->Errno == '' && $db->num_rows() > 0) {
- while ($db->next_record()) {
- $aUsedData['art'][] = array(
- 'title' => $db->f('title'),
- 'lang' => $db->f('idlang'),
- 'idart' => $db->f('idart'),
- );
- }
+ while ($db->next_record()) {
+ $aUsedData['art'][] = array(
+ 'title' => $db->f('title'),
+ 'lang' => $db->f('idlang'),
+ 'idart' => $db->f('idart'),
+ );
+ }
}
return $aUsedData;
-
}
/**
@@ -645,66 +614,62 @@ function tplGetInUsedData($idtpl) {
* @return int new template configuration ID
*
*/
-function tplcfgDuplicate ($idtplcfg)
-{
- global $cfg;
-
- $db = new DB_ConLite;
- $db2 = new DB_ConLite;
-
- $sql = "SELECT
+function tplcfgDuplicate($idtplcfg) {
+ global $cfg;
+
+ $db = new DB_ConLite;
+ $db2 = new DB_ConLite;
+
+ $sql = "SELECT
idtpl, status, author, created, lastmodified
FROM
- ".$cfg["tab"]["tpl_conf"]."
+ " . $cfg["tab"]["tpl_conf"] . "
WHERE
- idtplcfg = '".Contenido_Security::toInteger($idtplcfg)."'";
-
- $db->query($sql);
-
- if ($db->next_record())
- {
- $newidtplcfg = $db2->nextid($cfg["tab"]["tpl_conf"]);
- $idtpl = $db->f("idtpl");
- $status = $db->f("status");
- $author = $db->f("author");
- $created = $db->f("created");
- $lastmodified = $db->f("lastmodified");
-
- $sql = "INSERT INTO
- ".$cfg["tab"]["tpl_conf"]."
+ idtplcfg = '" . Contenido_Security::toInteger($idtplcfg) . "'";
+
+ $db->query($sql);
+
+ if ($db->next_record()) {
+ $newidtplcfg = $db2->nextid($cfg["tab"]["tpl_conf"]);
+ $idtpl = $db->f("idtpl");
+ $status = $db->f("status");
+ $author = $db->f("author");
+ $created = $db->f("created");
+ $lastmodified = $db->f("lastmodified");
+
+ $sql = "INSERT INTO
+ " . $cfg["tab"]["tpl_conf"] . "
(idtplcfg, idtpl, status, author, created, lastmodified)
VALUES
- ('".Contenido_Security::toInteger($newidtplcfg)."', '".Contenido_Security::toInteger($idtpl)."', '".Contenido_Security::toInteger($status)."', '".Contenido_Security::escapeDB($author, $db2)."',
- '".Contenido_Security::escapeDB($created, $db2)."', '".Contenido_Security::escapeDB($lastmodified, $db2)."')";
-
- $db2->query($sql);
-
- /* Copy container configuration */
- $sql = "SELECT
+ ('" . Contenido_Security::toInteger($newidtplcfg) . "', '" . Contenido_Security::toInteger($idtpl) . "', '" . Contenido_Security::toInteger($status) . "', '" . Contenido_Security::escapeDB($author, $db2) . "',
+ '" . Contenido_Security::escapeDB($created, $db2) . "', '" . Contenido_Security::escapeDB($lastmodified, $db2) . "')";
+
+ $db2->query($sql);
+
+ /* Copy container configuration */
+ $sql = "SELECT
number, container
FROM
- ".$cfg["tab"]["container_conf"]."
- WHERE idtplcfg = '".Contenido_Security::toInteger($idtplcfg)."'";
-
- $db->query($sql);
-
- while ($db->next_record())
- {
- $newidcontainerc = $db2->nextid($cfg["tab"]["container_conf"]);
- $number = $db->f("number");
- $container = $db->f("container");
-
- $sql = "INSERT INTO
- ".$cfg["tab"]["container_conf"]."
+ " . $cfg["tab"]["container_conf"] . "
+ WHERE idtplcfg = '" . Contenido_Security::toInteger($idtplcfg) . "'";
+
+ $db->query($sql);
+
+ while ($db->next_record()) {
+ $newidcontainerc = $db2->nextid($cfg["tab"]["container_conf"]);
+ $number = $db->f("number");
+ $container = $db->f("container");
+
+ $sql = "INSERT INTO
+ " . $cfg["tab"]["container_conf"] . "
(idcontainerc, idtplcfg, number, container)
VALUES
- ('".Contenido_Security::toInteger($newidcontainerc)."', '".Contenido_Security::toInteger($newidtplcfg)."', '".Contenido_Security::toInteger($number)."', '".Contenido_Security::escapeDB($container, $db2)."')";
- $db2->query($sql);
- }
- }
-
- return ($newidtplcfg);
-
+ ('" . Contenido_Security::toInteger($newidcontainerc) . "', '" . Contenido_Security::toInteger($newidtplcfg) . "', '" . Contenido_Security::toInteger($number) . "', '" . Contenido_Security::escapeDB($container, $db2) . "')";
+ $db2->query($sql);
+ }
+ }
+
+ return ($newidtplcfg);
}
/*
@@ -719,112 +684,99 @@ function tplcfgDuplicate ($idtplcfg)
* is empty. We need a better logic for handling "changes".
*/
-function tplAutoFillModules ($idtpl)
-{
- global $cfg;
- global $db_autofill;
- global $containerinf;
- global $_autoFillcontainerCache;
+function tplAutoFillModules($idtpl) {
+ global $cfg;
+ global $db_autofill;
+ global $containerinf;
+ global $_autoFillcontainerCache;
- if (!is_object($db_autofill))
- {
- $db_autofill = new DB_ConLite;
- }
-
- $sql = "SELECT idlay FROM ".$cfg["tab"]["tpl"]." WHERE idtpl = '".Contenido_Security::toInteger($idtpl)."'";
- $db_autofill->query($sql);
-
- if (!$db_autofill->next_record())
- {
- return false;
- }
+ if (!is_object($db_autofill)) {
+ $db_autofill = new DB_ConLite;
+ }
- $idlay = $db_autofill->f("idlay");
-
- if (!(is_array($containerinf) && array_key_exists($idlay, $containerinf) && array_key_exists($idlay, $_autoFillcontainerCache)))
- {
- tplPreparseLayout($idlay);
- $_autoFillcontainerCache[$idlay] = tplBrowseLayoutForContainers($idlay);
- }
-
- $a_container = explode("&",$_autoFillcontainerCache[$idlay]);
+ $sql = "SELECT idlay FROM " . $cfg["tab"]["tpl"] . " WHERE idtpl = '" . Contenido_Security::toInteger($idtpl) . "'";
+ $db_autofill->query($sql);
- foreach ($a_container as $container)
- {
- switch ($containerinf[$idlay][$container]["mode"])
- {
- /* Fixed mode */
- case "fixed":
- if ($containerinf[$idlay][$container]["default"] != "")
- {
- $sql = "SELECT idmod FROM ".$cfg["tab"]["mod"]
- ." WHERE name = '".
- Contenido_Security::escapeDB($containerinf[$idlay][$container]["default"], $db_autofill)."'";
-
- $db_autofill->query($sql);
-
- if ($db_autofill->next_record())
- {
- $idmod = $db_autofill->f("idmod");
-
-
- $sql = "SELECT idcontainer FROM ".$cfg["tab"]["container"]." WHERE idtpl = '".Contenido_Security::toInteger($idtpl)."' AND number = '".Contenido_Security::toInteger($container)."'";
-
- $db_autofill->query($sql);
-
- if ($db_autofill->next_record())
- {
- $sql = "UPDATE ".$cfg["tab"]["container"].
- " SET idmod = '".Contenido_Security::toInteger($idmod)."' WHERE idtpl = '".Contenido_Security::toInteger($idtpl)."'".
- " AND number = '".Contenido_Security::toInteger($container)."' AND ".
- " idcontainer = '".Contenido_Security::toInteger($db_autofill->f("idcontainer"))."'";
- $db_autofill->query($sql);
- } else {
- $sql = "INSERT INTO ".$cfg["tab"]["container"].
- " (idcontainer, idtpl, number, idmod) ".
- " VALUES ('".$db_autofill->nextid($cfg["tab"]["container"])."', ".
- " '$idtpl', '$container', '$idmod')";
- $db_autofill->query($sql);
- }
- }
- }
-
-
- case "mandatory":
-
- if ($containerinf[$idlay][$container]["default"] != "")
- {
- $sql = "SELECT idmod FROM ".$cfg["tab"]["mod"]
- ." WHERE name = '".
- Contenido_Security::escapeDB($containerinf[$idlay][$container]["default"], $db)."'";
-
- $db_autofill->query($sql);
-
- if ($db_autofill->next_record())
- {
- $idmod = $db_autofill->f("idmod");
-
-
- $sql = "SELECT idcontainer, idmod FROM ".$cfg["tab"]["container"]
- ." WHERE idtpl = '".Contenido_Security::toInteger($idtpl)."' AND number = '".Contenido_Security::toInteger($container)."'";
-
- $db_autofill->query($sql);
-
- if ($db_autofill->next_record())
- {
-
- } else {
- $sql = "INSERT INTO ".$cfg["tab"]["container"].
- " (idcontainer, idtpl, number, idmod) ".
- " VALUES ('".Contenido_Security::toInteger($db_autofill->nextid($cfg["tab"]["container"]))."', ".
- " '".Contenido_Security::toInteger($idtpl)."', '".Contenido_Security::toInteger($container)."', '".Contenido_Security::toInteger($idmod)."')";
- $db_autofill->query($sql);
- }
- }
- }
- }
- }
+ if (!$db_autofill->next_record()) {
+ return false;
+ }
+ $idlay = $db_autofill->f("idlay");
+
+ if (!(is_array($containerinf) && array_key_exists($idlay, $containerinf) && array_key_exists($idlay, $_autoFillcontainerCache))) {
+ tplPreparseLayout($idlay);
+ $_autoFillcontainerCache[$idlay] = tplBrowseLayoutForContainers($idlay);
+ }
+
+ $a_container = explode("&", $_autoFillcontainerCache[$idlay]);
+
+ foreach ($a_container as $container) {
+ switch ($containerinf[$idlay][$container]["mode"]) {
+ /* Fixed mode */
+ case "fixed":
+ if ($containerinf[$idlay][$container]["default"] != "") {
+ $sql = "SELECT idmod FROM " . $cfg["tab"]["mod"]
+ . " WHERE name = '" .
+ Contenido_Security::escapeDB($containerinf[$idlay][$container]["default"], $db_autofill) . "'";
+
+ $db_autofill->query($sql);
+
+ if ($db_autofill->next_record()) {
+ $idmod = $db_autofill->f("idmod");
+
+
+ $sql = "SELECT idcontainer FROM " . $cfg["tab"]["container"] . " WHERE idtpl = '" . Contenido_Security::toInteger($idtpl) . "' AND number = '" . Contenido_Security::toInteger($container) . "'";
+
+ $db_autofill->query($sql);
+
+ if ($db_autofill->next_record()) {
+ $sql = "UPDATE " . $cfg["tab"]["container"] .
+ " SET idmod = '" . Contenido_Security::toInteger($idmod) . "' WHERE idtpl = '" . Contenido_Security::toInteger($idtpl) . "'" .
+ " AND number = '" . Contenido_Security::toInteger($container) . "' AND " .
+ " idcontainer = '" . Contenido_Security::toInteger($db_autofill->f("idcontainer")) . "'";
+ $db_autofill->query($sql);
+ } else {
+ $sql = "INSERT INTO " . $cfg["tab"]["container"] .
+ " (idcontainer, idtpl, number, idmod) " .
+ " VALUES ('" . $db_autofill->nextid($cfg["tab"]["container"]) . "', " .
+ " '$idtpl', '$container', '$idmod')";
+ $db_autofill->query($sql);
+ }
+ }
+ }
+
+
+ case "mandatory":
+
+ if ($containerinf[$idlay][$container]["default"] != "") {
+ $sql = "SELECT idmod FROM " . $cfg["tab"]["mod"]
+ . " WHERE name = '" .
+ Contenido_Security::escapeDB($containerinf[$idlay][$container]["default"], $db) . "'";
+
+ $db_autofill->query($sql);
+
+ if ($db_autofill->next_record()) {
+ $idmod = $db_autofill->f("idmod");
+
+
+ $sql = "SELECT idcontainer, idmod FROM " . $cfg["tab"]["container"]
+ . " WHERE idtpl = '" . Contenido_Security::toInteger($idtpl) . "' AND number = '" . Contenido_Security::toInteger($container) . "'";
+
+ $db_autofill->query($sql);
+
+ if ($db_autofill->next_record()) {
+
+ } else {
+ $sql = "INSERT INTO " . $cfg["tab"]["container"] .
+ " (idcontainer, idtpl, number, idmod) " .
+ " VALUES ('" . Contenido_Security::toInteger($db_autofill->nextid($cfg["tab"]["container"])) . "', " .
+ " '" . Contenido_Security::toInteger($idtpl) . "', '" . Contenido_Security::toInteger($container) . "', '" . Contenido_Security::toInteger($idmod) . "')";
+ $db_autofill->query($sql);
+ }
+ }
+ }
+ }
+ }
}
?>
\ No newline at end of file
diff --git a/conlite/plugins/chains/createmetatags/classes/class.metatag.creator.html5.php b/conlite/plugins/chains/createmetatags/classes/class.metatag.creator.html5.php
index 43b3891..373c403 100644
--- a/conlite/plugins/chains/createmetatags/classes/class.metatag.creator.html5.php
+++ b/conlite/plugins/chains/createmetatags/classes/class.metatag.creator.html5.php
@@ -347,7 +347,7 @@ class MetaTagCreatorHtml5 {
*/
protected function _checkCacheFile() {
if(file_exists($this->_sCacheFile)) {
- $iDiff = mktime() - filemtime($this->_sCacheFile);
+ $iDiff = time() - filemtime($this->_sCacheFile);
if($iDiff < $this->_aConfig['cachetime']) {
return true;
}