From 65bfeccfd49a9bf2fb728aa6313fbb854b583191 Mon Sep 17 00:00:00 2001 From: Oldperl <44996956+oldperl@users.noreply.github.com> Date: Mon, 29 Jul 2019 12:43:27 +0000 Subject: [PATCH] formating and svn-admin --- conlite/includes/functions.str.php | 571 ++++++++++++------------- data/config/production/config.misc.php | 4 +- 2 files changed, 273 insertions(+), 302 deletions(-) diff --git a/conlite/includes/functions.str.php b/conlite/includes/functions.str.php index b521816..29af7d9 100644 --- a/conlite/includes/functions.str.php +++ b/conlite/includes/functions.str.php @@ -1,4 +1,5 @@ have_perm_area_action("str_tplcfg", "str_tplcfg")) { $iIdtplcfg = (int) $iIdtplcfg; - } else { + } else { $iIdtplcfg = 0; } $bVisible = (int) $bVisible; - if (! (($bVisible == 0 || $bVisible == 1) && $perm->have_perm_area_action('str', "str_makevisible")) ) { + if (!(($bVisible == 0 || $bVisible == 1) && $perm->have_perm_area_action('str', "str_makevisible"))) { $bVisible = 0; } $bPublic = (int) $bPublic; - if (! (($bPublic == 0 || $bPublic == 1) && $perm->have_perm_area_action('str', "str_makepublic")) ) { + if (!(($bPublic == 0 || $bPublic == 1) && $perm->have_perm_area_action('str', "str_makepublic"))) { $bPublic = 1; } - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE parentid='0' AND postid='0' AND idclient='".Contenido_Security::toInteger($client)."'"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE parentid='0' AND postid='0' AND idclient='" . Contenido_Security::toInteger($client) . "'"; $db->query($sql); $db->next_record(); $tmp_id = $db->f("idcat"); @@ -150,65 +149,64 @@ function strNewTree($catname, $catalias = '', $bVisible = 0, $bPublic = 1, $iIdt if (!$tmp_id) { //********** Entry in 'cat'-table ************ - $sql = "INSERT INTO ".$cfg["tab"]["cat"]." (idcat, preid, postid, idclient, author, created, lastmodified) VALUES('".Contenido_Security::toInteger($tmp_newid)."', '0', '0', - '".Contenido_Security::toInteger($client)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat"] . " (idcat, preid, postid, idclient, author, created, lastmodified) VALUES('" . Contenido_Security::toInteger($tmp_newid) . "', '0', '0', + '" . Contenido_Security::toInteger($client) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); //********* enter name of cat in 'cat_lang'-table ****** foreach ($a_languages as $tmp_lang) { if ($tmp_lang == $lang) { - $sql = "INSERT INTO ".$cfg["tab"]["cat_lang"]." (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) - VALUES('".Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"]))."', '".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_lang)."', - '".clHtmlSpecialChars($catname, ENT_QUOTES)."', '".Contenido_Security::toInteger($bVisible)."', '".Contenido_Security::toInteger($bPublic)."', '0', - '".clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) + VALUES('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"])) . "', '" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_lang) . "', + '" . clHtmlSpecialChars($catname, ENT_QUOTES) . "', '" . Contenido_Security::toInteger($bVisible) . "', '" . Contenido_Security::toInteger($bPublic) . "', '0', + '" . clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); } else { - $sql = "INSERT INTO ".$cfg["tab"]["cat_lang"]." (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) - VALUES('".Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"]))."', '".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_lang)."', - '".clHtmlSpecialChars($catname, ENT_QUOTES)."', '".Contenido_Security::toInteger($bVisible)."', '".Contenido_Security::toInteger($bPublic)."', '0', - '".clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) + VALUES('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"])) . "', '" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_lang) . "', + '" . clHtmlSpecialChars($catname, ENT_QUOTES) . "', '" . Contenido_Security::toInteger($bVisible) . "', '" . Contenido_Security::toInteger($bPublic) . "', '0', + '" . clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); } } } else { //********** Entry in 'cat'-table ************ - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET postid='$tmp_newid' WHERE idcat='".Contenido_Security::toInteger($tmp_id)."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET postid='$tmp_newid' WHERE idcat='" . Contenido_Security::toInteger($tmp_id) . "'"; $db->query($sql); //********** Entry in 'cat'-table ************ - $sql = "INSERT INTO ".$cfg["tab"]["cat"]." (idcat, preid, postid, idclient, author, created, lastmodified) VALUES('".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_id)."', - '0', '".Contenido_Security::toInteger($client)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat"] . " (idcat, preid, postid, idclient, author, created, lastmodified) VALUES('" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_id) . "', + '0', '" . Contenido_Security::toInteger($client) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); //********* enter name of cat in 'cat_lang'-table ****** foreach ($a_languages as $tmp_lang) { if ($tmp_lang == $lang) { - $sql = "INSERT INTO ".$cfg["tab"]["cat_lang"]." (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) - VALUES('".Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"]))."', '".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_lang)."', - '".clHtmlSpecialChars($catname, ENT_QUOTES)."', '".Contenido_Security::toInteger($bVisible)."', '".Contenido_Security::toInteger($bPublic)."', '0', - '".clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) + VALUES('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"])) . "', '" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_lang) . "', + '" . clHtmlSpecialChars($catname, ENT_QUOTES) . "', '" . Contenido_Security::toInteger($bVisible) . "', '" . Contenido_Security::toInteger($bPublic) . "', '0', + '" . clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); } else { - $sql = "INSERT INTO ".$cfg["tab"]["cat_lang"]." (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) - VALUES('".Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"]))."', '".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_lang)."', - '".clHtmlSpecialChars($catname, ENT_QUOTES)."', '".Contenido_Security::toInteger($bVisible)."', '".Contenido_Security::toInteger($bPublic)."', '0', - '".clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) + VALUES('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"])) . "', '" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_lang) . "', + '" . clHtmlSpecialChars($catname, ENT_QUOTES) . "', '" . Contenido_Security::toInteger($bVisible) . "', '" . Contenido_Security::toInteger($bPublic) . "', '0', + '" . clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); } } } // set correct rights for element - cInclude ("includes", "functions.rights.php"); + cInclude("includes", "functions.rights.php"); foreach ($a_languages as $tmp_lang) { createRightsForElement("str", $tmp_newid, $tmp_lang); createRightsForElement("con", $tmp_newid, $tmp_lang); } - } /* Search for default template */ - $templateCollection = new cApiTemplateCollection("defaulttemplate = '1' AND idclient = '".Contenido_Security::toInteger($client)."'"); + $templateCollection = new cApiTemplateCollection("defaulttemplate = '1' AND idclient = '" . Contenido_Security::toInteger($client) . "'"); if ($template = $templateCollection->next()) { $idtpl = $template->get("idtpl"); @@ -217,29 +215,27 @@ function strNewTree($catname, $catalias = '', $bVisible = 0, $bPublic = 1, $iIdt } /* Assign template, if default template exists */ - $catCollection = new cApiCategoryLanguageCollection("idcat = '".Contenido_Security::toInteger($tmp_newid)."'"); + $catCollection = new cApiCategoryLanguageCollection("idcat = '" . Contenido_Security::toInteger($tmp_newid) . "'"); while ($cat = $catCollection->next()) { $cat->assignTemplate($idtpl); } - } else { - //2008-06-25 timo.trautmann also set default template if it is selcted by user and there is no default template - if ($iIdtplcfg > 0) { - $idtpl = $iIdtplcfg; + //2008-06-25 timo.trautmann also set default template if it is selcted by user and there is no default template + if ($iIdtplcfg > 0) { + $idtpl = $iIdtplcfg; - $catCollection = new cApiCategoryLanguageCollection("idcat = '$tmp_newid'"); + $catCollection = new cApiCategoryLanguageCollection("idcat = '$tmp_newid'"); - while ($cat = $catCollection->next()) { - $cat->assignTemplate($idtpl); - } - } + while ($cat = $catCollection->next()) { + $cat->assignTemplate($idtpl); + } + } } return ($tmp_newid); } - /** * Creates a new category. * @@ -265,7 +261,7 @@ function strNewCategory($tmp_parentid, $catname, $remakeTree = true, $catalias = global $auth; global $tmp_area; - $db2= new DB_ConLite; + $db2 = new DB_ConLite; if (trim($catname) == "") { return; @@ -278,17 +274,17 @@ function strNewCategory($tmp_parentid, $catname, $remakeTree = true, $catalias = if ($perm->have_perm_area_action("str_tplcfg", "str_tplcfg")) { $iIdtplcfg = (int) $iIdtplcfg; - } else { + } else { $iIdtplcfg = 0; } $bVisible = (int) $bVisible; - if (! (($bVisible == 0 || $bVisible == 1) && $perm->have_perm_area_action('str', "str_makevisible")) ) { + if (!(($bVisible == 0 || $bVisible == 1) && $perm->have_perm_area_action('str', "str_makevisible"))) { $bVisible = 0; } $bPublic = (int) $bPublic; - if (! (($bPublic == 0 || $bPublic == 1) && $perm->have_perm_area_action('str', "str_makepublic")) ) { + if (!(($bPublic == 0 || $bPublic == 1) && $perm->have_perm_area_action('str', "str_makepublic"))) { $bPublic = 1; } @@ -300,16 +296,16 @@ function strNewCategory($tmp_parentid, $catname, $remakeTree = true, $catalias = $remakeCatTable = true; $remakeStrTable = true; - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE parentid='".Contenido_Security::toInteger($tmp_parentid)."' AND postid=0"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE parentid='" . Contenido_Security::toInteger($tmp_parentid) . "' AND postid=0"; $db->query($sql); $db->next_record(); $tmp_id = $db->f("idcat"); if (!$tmp_id) { //********** Entry in 'cat'-table ************ - $sql = "INSERT INTO ".$cfg["tab"]["cat"]." (idcat, parentid, preid, postid, idclient, author, created, lastmodified) VALUES('".Contenido_Security::toInteger($tmp_newid)."', - '".Contenido_Security::toInteger($tmp_parentid)."', '0', '0', '".Contenido_Security::toInteger($client)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', - '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat"] . " (idcat, parentid, preid, postid, idclient, author, created, lastmodified) VALUES('" . Contenido_Security::toInteger($tmp_newid) . "', + '" . Contenido_Security::toInteger($tmp_parentid) . "', '0', '0', '" . Contenido_Security::toInteger($client) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', + '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); //********* enter name of cat in 'cat_lang'-table ****** @@ -317,52 +313,51 @@ function strNewCategory($tmp_parentid, $catname, $remakeTree = true, $catalias = foreach ($a_languages as $tmp_lang) { if ($tmp_lang == $lang) { - $sql = "INSERT INTO ".$cfg["tab"]["cat_lang"]." (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) - VALUES('".Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"]))."', '".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_lang)."', - '".clHtmlSpecialChars($catname, ENT_QUOTES)."', '".Contenido_Security::toInteger($bVisible)."', '".Contenido_Security::toInteger($bPublic)."', '0', - '".clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) + VALUES('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"])) . "', '" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_lang) . "', + '" . clHtmlSpecialChars($catname, ENT_QUOTES) . "', '" . Contenido_Security::toInteger($bVisible) . "', '" . Contenido_Security::toInteger($bPublic) . "', '0', + '" . clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); } else { - $sql = "INSERT INTO ".$cfg["tab"]["cat_lang"]." (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) - VALUES('".Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"]))."', '".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_lang)."', - '".clHtmlSpecialChars($catname, ENT_QUOTES)."', '".Contenido_Security::toInteger($bVisible)."', '".Contenido_Security::toInteger($bPublic)."', '0', - '".clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) + VALUES('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"])) . "', '" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_lang) . "', + '" . clHtmlSpecialChars($catname, ENT_QUOTES) . "', '" . Contenido_Security::toInteger($bVisible) . "', '" . Contenido_Security::toInteger($bPublic) . "', '0', + '" . clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); } } } else { //********** Entry in 'cat'-table ************ - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET postid='$tmp_newid', lastmodified = '".date("Y-m-d H:i:s")."' WHERE idcat='".Contenido_Security::toInteger($tmp_id)."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET postid='$tmp_newid', lastmodified = '" . date("Y-m-d H:i:s") . "' WHERE idcat='" . Contenido_Security::toInteger($tmp_id) . "'"; $db->query($sql); //********** Entry in 'cat'-table ************ - $sql = "INSERT INTO ".$cfg["tab"]["cat"]." (idcat, parentid, preid, postid, idclient, author, created, lastmodified) VALUES('".Contenido_Security::toInteger($tmp_newid)."', - '".Contenido_Security::toInteger($tmp_parentid)."', '".Contenido_Security::toInteger($tmp_id)."', '0', '".Contenido_Security::toInteger($client)."', - '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat"] . " (idcat, parentid, preid, postid, idclient, author, created, lastmodified) VALUES('" . Contenido_Security::toInteger($tmp_newid) . "', + '" . Contenido_Security::toInteger($tmp_parentid) . "', '" . Contenido_Security::toInteger($tmp_id) . "', '0', '" . Contenido_Security::toInteger($client) . "', + '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); //********* enter name of cat in 'cat_lang'-table ****** $a_languages[] = $lang; foreach ($a_languages as $tmp_lang) { if ($tmp_lang == $lang) { - $sql = "INSERT INTO ".$cfg["tab"]["cat_lang"]." (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) - VALUES('".Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"]))."', '".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_lang)."', - '".clHtmlSpecialChars($catname, ENT_QUOTES)."', '".Contenido_Security::toInteger($bVisible)."', '".Contenido_Security::toInteger($bPublic)."', '0', - '".clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) + VALUES('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"])) . "', '" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_lang) . "', + '" . clHtmlSpecialChars($catname, ENT_QUOTES) . "', '" . Contenido_Security::toInteger($bVisible) . "', '" . Contenido_Security::toInteger($bPublic) . "', '0', + '" . clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); } else { - $sql = "INSERT INTO ".$cfg["tab"]["cat_lang"]." (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) - VALUES('".Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"]))."', '".Contenido_Security::toInteger($tmp_newid)."', '".Contenido_Security::toInteger($tmp_lang)."', - '".clHtmlSpecialChars($catname, ENT_QUOTES)."', '".Contenido_Security::toInteger($bVisible)."', '".Contenido_Security::toInteger($bPublic)."', '0', - '".clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES)."', '".Contenido_Security::escapeDB($auth->auth['uname'], $db)."', '".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, name, visible, public, idtplcfg, urlname, author, created, lastmodified) + VALUES('" . Contenido_Security::toInteger($db->nextid($cfg["tab"]["cat_lang"])) . "', '" . Contenido_Security::toInteger($tmp_newid) . "', '" . Contenido_Security::toInteger($tmp_lang) . "', + '" . clHtmlSpecialChars($catname, ENT_QUOTES) . "', '" . Contenido_Security::toInteger($bVisible) . "', '" . Contenido_Security::toInteger($bPublic) . "', '0', + '" . clHtmlSpecialChars(capiStrCleanURLCharacters($catalias), ENT_QUOTES) . "', '" . Contenido_Security::escapeDB($auth->auth['uname'], $db) . "', '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $db->query($sql); } } - } // set correct rights for element - cInclude ("includes", "functions.rights.php"); + cInclude("includes", "functions.rights.php"); foreach ($a_languages as $tmp_lang) { copyRightsForElement("str", $tmp_parentid, $tmp_newid, $tmp_lang); copyRightsForElement("con", $tmp_parentid, $tmp_newid, $tmp_lang); @@ -382,47 +377,45 @@ function strNewCategory($tmp_parentid, $catname, $remakeTree = true, $catalias = } /* Assign template, if default template exists */ - $catCollection = new cApiCategoryLanguageCollection("idcat = '".Contenido_Security::toInteger($tmp_newid)."'"); + $catCollection = new cApiCategoryLanguageCollection("idcat = '" . Contenido_Security::toInteger($tmp_newid) . "'"); while ($cat = $catCollection->next()) { $cat->assignTemplate($idtpl); } } else { - //2008-06-25 timo.trautmann also set default template if it is selcted by user and there is no default template - if ($iIdtplcfg > 0) { - $idtpl = $iIdtplcfg; + //2008-06-25 timo.trautmann also set default template if it is selcted by user and there is no default template + if ($iIdtplcfg > 0) { + $idtpl = $iIdtplcfg; - $catCollection = new cApiCategoryLanguageCollection("idcat = '".Contenido_Security::toInteger($tmp_newid)."'"); + $catCollection = new cApiCategoryLanguageCollection("idcat = '" . Contenido_Security::toInteger($tmp_newid) . "'"); - while ($cat = $catCollection->next()) { + while ($cat = $catCollection->next()) { $cat->assignTemplate($idtpl); - } - } + } + } } return($tmp_newid); } - function strOrderedPostTreeList($idcat, $poststring) { global $db; global $client; global $lang; global $cfg; - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE parentid=0 AND preid='".Contenido_Security::toInteger($idcat)."' AND idcat!=0"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE parentid=0 AND preid='" . Contenido_Security::toInteger($idcat) . "' AND idcat!=0"; $db->query($sql); if ($db->next_record()) { $tmp_idcat = $db->f("idcat"); - $poststring = $poststring.",".$tmp_idcat; + $poststring = $poststring . "," . $tmp_idcat; $poststring = strOrderedPostTreeList($tmp_idcat, $poststring); } return $poststring; } - /** * Remakes the category tree structure in category tree table. * @@ -440,68 +433,67 @@ function strRemakeTreeTable() { $remakeStrTable = true; $poststring = ""; - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE idclient = '".$client."'"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE idclient = '" . $client . "'"; $db->query($sql); $idcats = array(); while ($db->next_record()) { $idcats[] = $db->f("idcat"); } - - $sql = "DELETE FROM ".$cfg["tab"]["cat_tree"]." WHERE idcat IN ('".implode("', '",$idcats)."')"; // empty 'cat_tree'-table + + $sql = "DELETE FROM " . $cfg["tab"]["cat_tree"] . " WHERE idcat IN ('" . implode("', '", $idcats) . "')"; // empty 'cat_tree'-table $db->query($sql); - $sql = "DELETE FROM ".$cfg["tab"]["cat"]." WHERE idcat='0'"; + $sql = "DELETE FROM " . $cfg["tab"]["cat"] . " WHERE idcat='0'"; $db->query($sql); - $sql = "DELETE FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='0'"; + $sql = "DELETE FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='0'"; $db->query($sql); - $sql = "SELECT idcat, parentid, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idclient = '".$client."' ORDER BY parentid ASC, preid ASC, postid ASC"; - - $db->query($sql); - - // build cat_tree + $sql = "SELECT idcat, parentid, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idclient = '" . $client . "' ORDER BY parentid ASC, preid ASC, postid ASC"; + + $db->query($sql); + + // build cat_tree $aCategories = array(); - while($db->next_record()) { - - if ($db->f('parentid') == 0) { + while ($db->next_record()) { + + if ($db->f('parentid') == 0) { $aCategories[0][$db->f('idcat')] = array( - 'idcat' => $db->f('idcat'), - 'parentid' => $db->f('parentid'), - 'preid' => $db->f('preid'), - 'postid' => $db->f('postid') - ); - } else { - $aCategories[$db->f('parentid')][$db->f('idcat')] = array( - 'idcat' => $db->f('idcat'), - 'parentid' => $db->f('parentid'), - 'preid' => $db->f('preid'), - 'postid' => $db->f('postid') - ); - } - + 'idcat' => $db->f('idcat'), + 'parentid' => $db->f('parentid'), + 'preid' => $db->f('preid'), + 'postid' => $db->f('postid') + ); + } else { + $aCategories[$db->f('parentid')][$db->f('idcat')] = array( + 'idcat' => $db->f('idcat'), + 'parentid' => $db->f('parentid'), + 'preid' => $db->f('preid'), + 'postid' => $db->f('postid') + ); + } } - + $iNextTreeId = $db->nextid($cfg["tab"]["cat_tree"]); - + // build INSERT statement - $sInsertQuery = "INSERT INTO ".$cfg["tab"]["cat_tree"]." (idtree, idcat, level) VALUES "; + $sInsertQuery = "INSERT INTO " . $cfg["tab"]["cat_tree"] . " (idtree, idcat, level) VALUES "; $sInsertQuery = recCats($aCategories[0], $sInsertQuery, $iNextTreeId, $aCategories); - $sInsertQuery = rtrim($sInsertQuery, " ,"); - - // lock db table and execute INSERT query + $sInsertQuery = rtrim($sInsertQuery, " ,"); + + // lock db table and execute INSERT query $db->lock($cfg["tab"]["cat_tree"]); $db->query($sInsertQuery); $db->nextid('cat_tree'); dbUpdateSequence($cfg["tab"]["sequence"], $cfg["tab"]["cat_tree"], $db); $db->unlock($cfg["tab"]["cat_tree"]); - } function sort_pre_post($arr) { $firstElement = null; foreach ($arr as $row) { - if ($row['preid'] == 0) $firstElement = $row['idcat']; + if ($row['preid'] == 0) + $firstElement = $row['idcat']; } $curId = $firstElement; @@ -514,27 +506,25 @@ function sort_pre_post($arr) { return $array; } - -function recCats ($aCats, $sInsertQuery, &$iNextTreeId, &$aAllCats, $iLevel = 0) { - if (is_array($aCats)) { - $aCats = sort_pre_post($aCats); - foreach ($aCats as $aCat) { - $sInsertQuery .= "(" . (int) $iNextTreeId . ", ".(int) $aCat['idcat'].", ". (int) $iLevel ."), "; - $iNextTreeId++; - if (is_array($aAllCats[$aCat['idcat']])) { - $iSubLevel = $iLevel + 1; - $sInsertQuery = recCats($aAllCats[$aCat['idcat']], $sInsertQuery, $iNextTreeId, $aAllCats, $iSubLevel); - } - } - } - return $sInsertQuery; +function recCats($aCats, $sInsertQuery, &$iNextTreeId, &$aAllCats, $iLevel = 0) { + if (is_array($aCats)) { + $aCats = sort_pre_post($aCats); + foreach ($aCats as $aCat) { + $sInsertQuery .= "(" . (int) $iNextTreeId . ", " . (int) $aCat['idcat'] . ", " . (int) $iLevel . "), "; + $iNextTreeId++; + if (is_array($aAllCats[$aCat['idcat']])) { + $iSubLevel = $iLevel + 1; + $sInsertQuery = recCats($aAllCats[$aCat['idcat']], $sInsertQuery, $iNextTreeId, $aAllCats, $iSubLevel); + } + } + } + return $sInsertQuery; } - function strNextDeeper($tmp_idcat, $ignore_lang = false) { global $cfg, $db_str, $lang; - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE parentid='".Contenido_Security::toInteger($tmp_idcat)."' AND preid='0'"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE parentid='" . Contenido_Security::toInteger($tmp_idcat) . "' AND preid='0'"; $db_str->query($sql); if ($db_str->next_record()) { $midcat = $db_str->f("idcat"); @@ -545,7 +535,7 @@ function strNextDeeper($tmp_idcat, $ignore_lang = false) { //******deeper element exists /* Check for language dependent part */ - $sql = "SELECT idcatlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($midcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($midcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db_str->query($sql); if ($db_str->next_record()) { return $midcat; @@ -558,7 +548,6 @@ function strNextDeeper($tmp_idcat, $ignore_lang = false) { } } - /** * Checks, if passed category cotains any articles * @@ -570,10 +559,10 @@ function strHasArticles($tmp_idcat) { global $lang; $sql = "SELECT b.idartlang AS idartlang FROM - ".$cfg["tab"]["cat_art"]." AS a, - ".$cfg["tab"]["art_lang"]." AS b - WHERE a.idcat='".Contenido_Security::toInteger($tmp_idcat)."' AND - a.idart = b.idart AND b.idlang = '".Contenido_Security::toInteger($lang)."'"; + " . $cfg["tab"]["cat_art"] . " AS a, + " . $cfg["tab"]["art_lang"] . " AS b + WHERE a.idcat='" . Contenido_Security::toInteger($tmp_idcat) . "' AND + a.idart = b.idart AND b.idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db_str->query($sql); @@ -584,16 +573,15 @@ function strHasArticles($tmp_idcat) { } } - function strNextPost($tmp_idcat) { global $db; global $cfg; - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE preid='".Contenido_Security::toInteger($tmp_idcat)."'"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE preid='" . Contenido_Security::toInteger($tmp_idcat) . "'"; $db->query($sql); if ($db->next_record()) { //******post element exists $tmp_idcat = $db->f("idcat"); - $sql = "SELECT parentid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($tmp_idcat)."'"; + $sql = "SELECT parentid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($tmp_idcat) . "'"; $db->query($sql); if ($db->next_record()) { //******parent from post must not be 0 $tmp_parentid = $db->f("parentid"); @@ -614,16 +602,16 @@ function strNextBackwards($tmp_idcat) { global $db; global $cfg; - $sql = "SELECT parentid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($tmp_idcat)."'"; + $sql = "SELECT parentid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($tmp_idcat) . "'"; $db->query($sql); if ($db->next_record()) { //******parent exists $tmp_idcat = $db->f("parentid"); if ($tmp_idcat != 0) { - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE preid='".Contenido_Security::toInteger($tmp_idcat)."'"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE preid='" . Contenido_Security::toInteger($tmp_idcat) . "'"; $db->query($sql); if ($db->next_record()) { //******parent has post $tmp_idcat = $db->f("idcat"); - $sql = "SELECT parentid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($tmp_idcat)."'"; + $sql = "SELECT parentid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($tmp_idcat) . "'"; $db->query($sql); if ($db->next_record()) { //******parent from post must not be 0 $tmp_parentid = $db->f("parentid"); @@ -649,38 +637,36 @@ function strNextBackwards($tmp_idcat) { /** * Hotfix recursive call more than 200 times exit script on hosteurope Timo.Trautmann (strRemakeTreeTableFindNext) * @deprecated - **/ -function strRemakeTreeTableFindNext($tmp_idcat,$tmp_level) { + * */ +function strRemakeTreeTableFindNext($tmp_idcat, $tmp_level) { global $db; global $cfg; //************* Insert Element in 'cat_tree'-table ************** - $sql = "INSERT INTO ".$cfg["tab"]["cat_tree"]." (idtree, idcat, level) VALUES ('".$db->nextid($cfg["tab"]["cat_tree"])."', '".Contenido_Security::toInteger($tmp_idcat)."', '".Contenido_Security::toInteger($tmp_level)."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_tree"] . " (idtree, idcat, level) VALUES ('" . $db->nextid($cfg["tab"]["cat_tree"]) . "', '" . Contenido_Security::toInteger($tmp_idcat) . "', '" . Contenido_Security::toInteger($tmp_level) . "')"; $db->query($sql); //************* dig deeper, if possible ****** $tmp = strNextDeeperAll($tmp_idcat, true); foreach ($tmp as $iCurIdCat) { - if (count(strNextDeeperAll($iCurIdCat, true)) > 0 ) { - strRemakeTreeTableFindNext($iCurIdCat, ($tmp_level+1)); + if (count(strNextDeeperAll($iCurIdCat, true)) > 0) { + strRemakeTreeTableFindNext($iCurIdCat, ($tmp_level + 1)); } else { - $sql = "INSERT INTO ".$cfg["tab"]["cat_tree"]." (idtree, idcat, level) VALUES ('".$db->nextid($cfg["tab"]["cat_tree"])."', '".Contenido_Security::toInteger($iCurIdCat)."', '".Contenido_Security::toInteger($tmp_level+1)."')"; + $sql = "INSERT INTO " . $cfg["tab"]["cat_tree"] . " (idtree, idcat, level) VALUES ('" . $db->nextid($cfg["tab"]["cat_tree"]) . "', '" . Contenido_Security::toInteger($iCurIdCat) . "', '" . Contenido_Security::toInteger($tmp_level + 1) . "')"; $db->query($sql); } } } - - /** - Hotfix recursive call more than 200 times exit script on hosteurope Timo.Trautmann -**/ + Hotfix recursive call more than 200 times exit script on hosteurope Timo.Trautmann + * */ function strNextDeeperAll($tmp_idcat, $ignore_lang = false) { global $cfg, $db_str, $db_str2, $lang; $aCats = array(); $bLoop = true; - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE parentid='".Contenido_Security::toInteger($tmp_idcat)."' and preid = 0"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE parentid='" . Contenido_Security::toInteger($tmp_idcat) . "' and preid = 0"; #echo $sql.'
'; $db_str->query($sql); @@ -693,7 +679,7 @@ function strNextDeeperAll($tmp_idcat, $ignore_lang = false) { } else { //******deeper element exists /* Check for language dependent part */ - $sql = "SELECT idcatlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($midcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($midcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db_str2->query($sql); if ($db_str2->next_record()) { @@ -701,7 +687,7 @@ function strNextDeeperAll($tmp_idcat, $ignore_lang = false) { } } - $sql = "SELECT preid, postid, idcat FROM ".$cfg["tab"]["cat"]." WHERE parentid='".Contenido_Security::toInteger($tmp_idcat)."' and preid = ".Contenido_Security::toInteger($midcat).""; + $sql = "SELECT preid, postid, idcat FROM " . $cfg["tab"]["cat"] . " WHERE parentid='" . Contenido_Security::toInteger($tmp_idcat) . "' and preid = " . Contenido_Security::toInteger($midcat) . ""; $db_str->query($sql); if (!$db_str->next_record()) { $bLoop = false; @@ -711,7 +697,6 @@ function strNextDeeperAll($tmp_idcat, $ignore_lang = false) { return $aCats; } - /** * Renders the category tree a HTML table * @@ -727,23 +712,22 @@ function strShowTreeTable() { global $lngStr; echo "
"; - $sql = "SELECT * FROM ".$cfg["tab"]["cat_tree"]." AS A, ".$cfg["tab"]["cat"]." AS B, ".$cfg["tab"]["cat_lang"]." AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND C.idlang='".Contenido_Security::toInteger($lang)."' - AND B.idclient='".Contenido_Security::toInteger($client)."' ORDER BY A.idtree"; + $sql = "SELECT * FROM " . $cfg["tab"]["cat_tree"] . " AS A, " . $cfg["tab"]["cat"] . " AS B, " . $cfg["tab"]["cat_lang"] . " AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND C.idlang='" . Contenido_Security::toInteger($lang) . "' + AND B.idclient='" . Contenido_Security::toInteger($client) . "' ORDER BY A.idtree"; $db->query($sql); while ($db->next_record()) { - $tmp_id = $db->f("idcat"); - $tmp_name = $db->f("name"); + $tmp_id = $db->f("idcat"); + $tmp_name = $db->f("name"); $tmp_level = $db->f("level"); - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; echo ""; } echo "
".$tmp_id." | ".$tmp_name." | ".$tmp_level."url("main.php?action=20&idcat=$tmp_id")."\">".$lngStr["actions"]["20"]."url("main.php?action=30&idcat=$tmp_id")."\">".$lngStr["actions"]["30"]."
" . $tmp_id . " | " . $tmp_name . " | " . $tmp_level . "url("main.php?action=20&idcat=$tmp_id") . "\">" . $lngStr["actions"]["20"] . "url("main.php?action=30&idcat=$tmp_id") . "\">" . $lngStr["actions"]["30"] . "
"; } - /** * Renames a category * @@ -770,7 +754,7 @@ function strRenameCategory($idcat, $lang, $newcategoryname, $newcategoryalias) { $sName = clHtmlSpecialChars($newcategoryname, ENT_QUOTES); if (trim($newcategoryalias) != "") { - $sql = "SELECT urlname, name FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT urlname, name FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $sUrlnameNew = clHtmlSpecialChars(capiStrCleanURLCharacters($newcategoryalias), ENT_QUOTES); if ($db->next_record()) { @@ -781,16 +765,15 @@ function strRenameCategory($idcat, $lang, $newcategoryname, $newcategoryalias) { $sUrlname = $sUrlnameNew; } - @unlink($cfgClient[$client]["path"]["frontend"]."cache/locationstring-url-cache-$lang.txt"); + @unlink($cfgClient[$client]["path"]["frontend"] . "cache/locationstring-url-cache-$lang.txt"); } - $sql = "UPDATE ".$cfg["tab"]["cat_lang"]." SET urlname='".Contenido_Security::escapeDB($sUrlname, $db)."', name='".Contenido_Security::escapeDB($sName, $db)."', lastmodified = '".date("Y-m-d H:i:s")."' - WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + $sql = "UPDATE " . $cfg["tab"]["cat_lang"] . " SET urlname='" . Contenido_Security::escapeDB($sUrlname, $db) . "', name='" . Contenido_Security::escapeDB($sName, $db) . "', lastmodified = '" . date("Y-m-d H:i:s") . "' + WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); } } - /** * Sets the visible status of the category and its childs * @@ -799,7 +782,7 @@ function strRenameCategory($idcat, $lang, $newcategoryname, $newcategoryalias) { * @param int $visible Visible status * @return void */ -function strMakeVisible ($idcat, $lang, $visible) { +function strMakeVisible($idcat, $lang, $visible) { global $db; global $cfg; // Flag to rebuild the category table @@ -810,19 +793,18 @@ function strMakeVisible ($idcat, $lang, $visible) { $a_catstring = strDeeperCategoriesArray($idcat); foreach ($a_catstring as $value) { - $sql = "UPDATE ".$cfg["tab"]["cat_lang"]." SET visible='".Contenido_Security::toInteger($visible)."', lastmodified ='".date("Y-m-d H:i:s")."' - WHERE idcat='".Contenido_Security::toInteger($value)."' AND idlang='".Contenido_Security::toInteger($lang)."' "; + $sql = "UPDATE " . $cfg["tab"]["cat_lang"] . " SET visible='" . Contenido_Security::toInteger($visible) . "', lastmodified ='" . date("Y-m-d H:i:s") . "' + WHERE idcat='" . Contenido_Security::toInteger($value) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "' "; $db->query($sql); } if ($cfg["pathresolve_heapcache"] == true && $visible = 0) { - $pathresolve_tablename = $cfg["sql"]["sqlprefix"]."_pathresolve_cache"; + $pathresolve_tablename = $cfg["sql"]["sqlprefix"] . "_pathresolve_cache"; $sql = "DELETE FROM %s WHERE idlang = '%s' AND idcat = '%s'"; $db->query(sprintf($sql, Contenido_Security::escapeDB($pathresolve_tablename, $db), Contenido_Security::toInteger($lang), $idcat)); } } - /** * Sets the public status of the category and its childs * @@ -842,19 +824,18 @@ function strMakePublic($idcat, $lang, $public) { $a_catstring = strDeeperCategoriesArray($idcat); foreach ($a_catstring as $value) { - $sql = "UPDATE ".$cfg["tab"]["cat_lang"]." SET public='$public', lastmodified = '".date("Y-m-d H:i:s")."' - WHERE idcat='".Contenido_Security::toInteger($value)."' AND idlang='".Contenido_Security::toInteger($lang)."' "; + $sql = "UPDATE " . $cfg["tab"]["cat_lang"] . " SET public='$public', lastmodified = '" . date("Y-m-d H:i:s") . "' + WHERE idcat='" . Contenido_Security::toInteger($value) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "' "; $db->query($sql); } } - function strDeeperCategoriesArray($idcat_start) { global $db; global $client; global $cfg; - $sql = "SELECT * FROM ".$cfg["tab"]["cat_tree"]." AS A, ".$cfg["tab"]["cat"]." AS B WHERE A.idcat=B.idcat AND idclient='".Contenido_Security::toInteger($client)."' ORDER BY idtree"; + $sql = "SELECT * FROM " . $cfg["tab"]["cat_tree"] . " AS A, " . $cfg["tab"]["cat"] . " AS B WHERE A.idcat=B.idcat AND idclient='" . Contenido_Security::toInteger($client) . "' ORDER BY idtree"; $db->query($sql); $i = 0; while ($db->next_record()) { @@ -872,7 +853,6 @@ function strDeeperCategoriesArray($idcat_start) { return $catstring; } - /** * Deletes the category and its template configurations. * @@ -903,87 +883,86 @@ function strDeleteCategory($idcat) { if (strHasArticles($idcat)) { return "0202"; // category has arts } else { - $sql = "SELECT idtplcfg FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT idtplcfg FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); while ($db->next_record()) { ////// delete entry in 'tpl_conf'-table - $sql = "DELETE FROM ".$cfg["tab"]["tpl_conf"]." WHERE idtplcfg='".Contenido_Security::toInteger($db->f("idtplcfg"))."'"; + $sql = "DELETE FROM " . $cfg["tab"]["tpl_conf"] . " WHERE idtplcfg='" . Contenido_Security::toInteger($db->f("idtplcfg")) . "'"; $db2->query($sql); - $sql = "DELETE FROM ".$cfg["tab"]["container_conf"]." WHERE idtplcfg = '".Contenido_Security::toInteger($db->f("idtplcfg"))."'"; + $sql = "DELETE FROM " . $cfg["tab"]["container_conf"] . " WHERE idtplcfg = '" . Contenido_Security::toInteger($db->f("idtplcfg")) . "'"; $db2->query($sql); } /* Delete language dependend part */ - $sql = "DELETE FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + $sql = "DELETE FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); /* Are there any additional languages? */ - $sql = "SELECT idcatlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."'"; + $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); if ($db->num_rows() > 0) { // more languages found... // delete rights for element - cInclude ("includes", "functions.rights.php"); + cInclude("includes", "functions.rights.php"); deleteRightsForElement("str", $idcat, $lang); deleteRightsForElement("con", $idcat, $lang); return; } - $sql = "SELECT * FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."'"; + $sql = "SELECT * FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); $db->next_record(); - $tmp_preid = $db->f("preid"); + $tmp_preid = $db->f("preid"); $tmp_postid = $db->f("postid"); ////// update pre cat set new postid if ($tmp_preid != 0) { - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET postid='".Contenido_Security::toInteger($tmp_postid)."' WHERE idcat='".Contenido_Security::toInteger($tmp_preid)."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET postid='" . Contenido_Security::toInteger($tmp_postid) . "' WHERE idcat='" . Contenido_Security::toInteger($tmp_preid) . "'"; $db->query($sql); } ////// update post cat set new preid if ($tmp_postid != 0) { - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='".Contenido_Security::toInteger($tmp_preid)."' WHERE idcat='".Contenido_Security::toInteger($tmp_postid)."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . Contenido_Security::toInteger($tmp_preid) . "' WHERE idcat='" . Contenido_Security::toInteger($tmp_postid) . "'"; $db->query($sql); } ////// delete entry in 'cat'-table - $sql = "DELETE FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."'"; + $sql = "DELETE FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); - $sql = "SELECT idtplcfg FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."'"; + $sql = "SELECT idtplcfg FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); while ($db->next_record()) { ////// delete entry in 'tpl_conf'-table - $sql = "DELETE FROM ".$cfg["tab"]["tpl_conf"]." WHERE idtplcfg='".Contenido_Security::toInteger($db->f("idtplcfg"))."'"; + $sql = "DELETE FROM " . $cfg["tab"]["tpl_conf"] . " WHERE idtplcfg='" . Contenido_Security::toInteger($db->f("idtplcfg")) . "'"; $db2->query($sql); - $sql = "DELETE FROM ".$cfg["tab"]["container_conf"]." WHERE idtplcfg = '".Contenido_Security::toInteger($db->f("idtplcfg"))."'"; + $sql = "DELETE FROM " . $cfg["tab"]["container_conf"] . " WHERE idtplcfg = '" . Contenido_Security::toInteger($db->f("idtplcfg")) . "'"; echo $sql; $db2->query($sql); } ////// delete entry in 'cat_lang'-table - $sql = "DELETE FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."'"; + $sql = "DELETE FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); ////// delete entry in 'cat_tree'-table - $sql = "DELETE FROM ".$cfg["tab"]["cat_tree"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."'"; + $sql = "DELETE FROM " . $cfg["tab"]["cat_tree"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); } // delete rights for element - cInclude ("includes", "functions.rights.php"); + cInclude("includes", "functions.rights.php"); deleteRightsForElement("str", $idcat); deleteRightsForElement("con", $idcat); } } - /** * Moves a category upwards. * @@ -1001,50 +980,49 @@ function strMoveUpCategory($idcat) { $remakeCatTable = true; $remakeStrTable = true; - $sql = "SELECT idcat, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."'"; + $sql = "SELECT idcat, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); $db->next_record(); - $tmp_idcat = $db->f("idcat"); - $tmp_preid = $db->f("preid"); + $tmp_idcat = $db->f("idcat"); + $tmp_preid = $db->f("preid"); $tmp_postid = $db->f("postid"); if ($tmp_preid != 0) { - $sql = "SELECT idcat, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($tmp_preid)."'"; + $sql = "SELECT idcat, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($tmp_preid) . "'"; $db->query($sql); $db->next_record(); - $tmp_idcat_pre = $db->f("idcat"); - $tmp_preid_pre = $db->f("preid"); + $tmp_idcat_pre = $db->f("idcat"); + $tmp_preid_pre = $db->f("preid"); $tmp_postid_pre = $db->f("postid"); - $sql = "SELECT idcat, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($tmp_preid_pre)."'"; + $sql = "SELECT idcat, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($tmp_preid_pre) . "'"; $db->query($sql); $db->next_record(); - $tmp_idcat_pre_pre = $db->f("idcat"); - $tmp_preid_pre_pre = $db->f("preid"); + $tmp_idcat_pre_pre = $db->f("idcat"); + $tmp_preid_pre_pre = $db->f("preid"); $tmp_postid_pre_pre = $db->f("postid"); - $sql = "SELECT idcat, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($tmp_postid)."'"; + $sql = "SELECT idcat, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($tmp_postid) . "'"; $db->query($sql); $db->next_record(); - $tmp_idcat_post = $db->f("idcat"); - $tmp_preid_post = $db->f("preid"); + $tmp_idcat_post = $db->f("idcat"); + $tmp_preid_post = $db->f("preid"); $tmp_postid_post = $db->f("postid"); - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET postid='".Contenido_Security::toInteger($tmp_idcat)."' WHERE idcat='".Contenido_Security::toInteger($tmp_preid_pre)."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET postid='" . Contenido_Security::toInteger($tmp_idcat) . "' WHERE idcat='" . Contenido_Security::toInteger($tmp_preid_pre) . "'"; $db->query($sql); - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='".Contenido_Security::toInteger($tmp_idcat)."', postid='".Contenido_Security::toInteger($tmp_postid)."' WHERE idcat='".Contenido_Security::toInteger($tmp_preid)."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . Contenido_Security::toInteger($tmp_idcat) . "', postid='" . Contenido_Security::toInteger($tmp_postid) . "' WHERE idcat='" . Contenido_Security::toInteger($tmp_preid) . "'"; $db->query($sql); - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='".Contenido_Security::toInteger($tmp_preid_pre)."', postid='".Contenido_Security::toInteger($tmp_preid)."' WHERE idcat='$tmp_idcat'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . Contenido_Security::toInteger($tmp_preid_pre) . "', postid='" . Contenido_Security::toInteger($tmp_preid) . "' WHERE idcat='$tmp_idcat'"; $db->query($sql); - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='".Contenido_Security::toInteger($tmp_idcat_pre)."' WHERE idcat='$tmp_postid'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . Contenido_Security::toInteger($tmp_idcat_pre) . "' WHERE idcat='$tmp_postid'"; $db->query($sql); } } - /** * Moves a category downwards. * @@ -1064,14 +1042,14 @@ function strMoveDownCategory($idcat) { $arrLinks = array(); - $sql = "SELECT idcat, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."'"; + $sql = "SELECT idcat, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); $db->next_record(); $arrLinks['cur']['idcat'] = $db->f("idcat"); $arrLinks['cur']['pre'] = $db->f("preid"); $arrLinks['cur']['post'] = $db->f("postid"); - $sql = "SELECT idcat, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($arrLinks['cur']['pre'])."'"; + $sql = "SELECT idcat, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($arrLinks['cur']['pre']) . "'"; $db->query($sql); if ($db->next_record()) { $arrLinks['pre']['idcat'] = $db->f("idcat"); @@ -1083,7 +1061,7 @@ function strMoveDownCategory($idcat) { $arrLinks['pre']['post'] = 0; } - $sql = "SELECT idcat, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idcat='".Contenido_Security::toInteger($arrLinks['cur']['post'])."'"; + $sql = "SELECT idcat, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . Contenido_Security::toInteger($arrLinks['cur']['post']) . "'"; $db->query($sql); if ($db->next_record()) { $arrLinks['post']['idcat'] = $db->f("idcat"); @@ -1097,29 +1075,28 @@ function strMoveDownCategory($idcat) { if ($arrLinks['cur']['post'] != 0) { if ($arrLinks['pre']['idcat'] != 0) { - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET postid='".Contenido_Security::toInteger($arrLinks['post']['idcat'])."' WHERE idcat='".Contenido_Security::toInteger($arrLinks['pre']['idcat'])."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET postid='" . Contenido_Security::toInteger($arrLinks['post']['idcat']) . "' WHERE idcat='" . Contenido_Security::toInteger($arrLinks['pre']['idcat']) . "'"; $db->query($sql); } else { - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='".Contenido_Security::toInteger($arrLinks['pre']['idcat'])."' WHERE idcat='".Contenido_Security::toInteger($arrLinks['post']['idcat'])."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . Contenido_Security::toInteger($arrLinks['pre']['idcat']) . "' WHERE idcat='" . Contenido_Security::toInteger($arrLinks['post']['idcat']) . "'"; $db->query($sql); } - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='".Contenido_Security::toInteger($arrLinks['cur']['post'])."', postid='".Contenido_Security::toInteger($arrLinks['post']['post'])."' - WHERE idcat='".Contenido_Security::toInteger($arrLinks['cur']['idcat'])."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . Contenido_Security::toInteger($arrLinks['cur']['post']) . "', postid='" . Contenido_Security::toInteger($arrLinks['post']['post']) . "' + WHERE idcat='" . Contenido_Security::toInteger($arrLinks['cur']['idcat']) . "'"; $db->query($sql); - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='".Contenido_Security::toInteger($arrLinks['pre']['idcat'])."', postid='".Contenido_Security::toInteger($arrLinks['cur']['idcat'])."' - WHERE idcat='".Contenido_Security::toInteger($arrLinks['post']['idcat'])."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . Contenido_Security::toInteger($arrLinks['pre']['idcat']) . "', postid='" . Contenido_Security::toInteger($arrLinks['cur']['idcat']) . "' + WHERE idcat='" . Contenido_Security::toInteger($arrLinks['post']['idcat']) . "'"; $db->query($sql); } if ($arrLinks['post']['post'] != 0) { - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='".Contenido_Security::toInteger($arrLinks['cur']['idcat'])."' WHERE idcat='".Contenido_Security::toInteger($arrLinks['post']['post'])."'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . Contenido_Security::toInteger($arrLinks['cur']['idcat']) . "' WHERE idcat='" . Contenido_Security::toInteger($arrLinks['post']['post']) . "'"; $db->query($sql); } } - /** * Moves a subtree to another destination. * @@ -1132,49 +1109,49 @@ function strMoveSubtree($idcat, $parentid_new) { $remakeCatTable = true; $remakeStrTable = true; - $idcat = Contenido_Security::toInteger( $idcat ); - $iNewParentId = Contenido_Security::toInteger( $parentid_new ); + $idcat = Contenido_Security::toInteger($idcat); + $iNewParentId = Contenido_Security::toInteger($parentid_new); // Check if iNewParentId is 0 and the unescaped value is not null - if ( $iNewParentId == 0 && !is_null( $parentid_new ) ) { + if ($iNewParentId == 0 && !is_null($parentid_new)) { $movesubtreeidcat = 0; - } else if ( $iNewParentId != 0 ) { - $sql = "SELECT idcat, preid, postid FROM ".$cfg["tab"]["cat"]." WHERE idcat='" . $idcat . "'"; + } else if ($iNewParentId != 0) { + $sql = "SELECT idcat, preid, postid FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . $idcat . "'"; $db->query($sql); $db->next_record(); - $tmp_idcat = $db->f("idcat"); - $tmp_preid = $db->f("preid"); + $tmp_idcat = $db->f("idcat"); + $tmp_preid = $db->f("preid"); $tmp_postid = $db->f("postid"); //****************** update predecessor (pre)********************** if ($tmp_preid != 0) { - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET postid='" . $tmp_postid . "' WHERE idcat='" . $tmp_preid . "'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET postid='" . $tmp_postid . "' WHERE idcat='" . $tmp_preid . "'"; $db->query($sql); } //****************** update follower (post)********************** if ($tmp_postid != 0) { - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET preid='" . $tmp_preid . "' WHERE idcat='" . $tmp_postid . "'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET preid='" . $tmp_preid . "' WHERE idcat='" . $tmp_postid . "'"; $db->query($sql); } //****************** find new pre ******************** - $sql = "SELECT idcat, preid FROM ".$cfg["tab"]["cat"]." WHERE parentid='" . $iNewParentId . "' AND postid='0'"; + $sql = "SELECT idcat, preid FROM " . $cfg["tab"]["cat"] . " WHERE parentid='" . $iNewParentId . "' AND postid='0'"; $db->query($sql); if ($db->next_record()) { $tmp_new_preid = $db->f("idcat"); - $tmp_preid_2 = $db->f("preid"); + $tmp_preid_2 = $db->f("preid"); if ($tmp_new_preid != $idcat) { //******************** update new pre: set post ********************** - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET postid='" . $idcat . "' WHERE idcat='" . $tmp_new_preid . "'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET postid='" . $idcat . "' WHERE idcat='" . $tmp_new_preid . "'"; $db->query($sql); } else { - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE idcat='" . $tmp_preid_2 . "'"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE idcat='" . $tmp_preid_2 . "'"; $db->query($sql); if ($db->next_record()) { $tmp_new_preid = $db->f("idcat"); //******************** update new pre: set post ********************** - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET postid='" . $idcat . "' WHERE idcat='" . $tmp_new_preid . "'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET postid='" . $idcat . "' WHERE idcat='" . $tmp_new_preid . "'"; $db->query($sql); } else { $tmp_new_preid = 0; @@ -1185,14 +1162,13 @@ function strMoveSubtree($idcat, $parentid_new) { } //*************** update idcat ******************** - $sql = "UPDATE ".$cfg["tab"]["cat"]." SET parentid='" . $iNewParentId . "', preid='" . $tmp_new_preid . "', postid='0' WHERE idcat='" . $idcat . "'"; + $sql = "UPDATE " . $cfg["tab"]["cat"] . " SET parentid='" . $iNewParentId . "', preid='" . $tmp_new_preid . "', postid='0' WHERE idcat='" . $idcat . "'"; $db->query($sql); $movesubtreeidcat = 0; } else { // We recoded this function to prevent crashing the cat tree // when a user copies a tree and forget to set the target category - // Copy transaction now is only performed by setting the target $movesubtreeidcat = $idcat; } @@ -1201,7 +1177,6 @@ function strMoveSubtree($idcat, $parentid_new) { $sess->freeze(); } - /** * Checks if category is movable. * @@ -1217,7 +1192,6 @@ function strMoveCatTargetallowed($idcat, $source) { } } - /** * Synchronizes a category from one language to another language. * @@ -1246,9 +1220,9 @@ function strSyncCategory($idcatParam, $sourcelang, $targetlang, $bMultiple = fal visible, public, status, author, created, lastmodified FROM - ".$cfg["tab"]["cat_lang"]." + " . $cfg["tab"]["cat_lang"] . " WHERE - idcat = '".Contenido_Security::toInteger($idcat)."' AND idlang = '".Contenido_Security::toInteger($targetlang)."'"; + idcat = '" . Contenido_Security::toInteger($idcat) . "' AND idlang = '" . Contenido_Security::toInteger($targetlang) . "'"; $tmpdb->query($sql); @@ -1260,9 +1234,9 @@ function strSyncCategory($idcatParam, $sourcelang, $targetlang, $bMultiple = fal visible, public, status, author, created, lastmodified, urlname FROM - ".$cfg["tab"]["cat_lang"]." + " . $cfg["tab"]["cat_lang"] . " WHERE - idcat = '".Contenido_Security::toInteger($idcat)."' AND idlang = '".Contenido_Security::toInteger($sourcelang)."'"; + idcat = '" . Contenido_Security::toInteger($idcat) . "' AND idlang = '" . Contenido_Security::toInteger($sourcelang) . "'"; $tmpdb->query($sql); @@ -1288,41 +1262,40 @@ function strSyncCategory($idcatParam, $sourcelang, $targetlang, $bMultiple = fal $lastmodified = $tmpdb->f("lastmodified"); $sql = "INSERT INTO - ".$cfg["tab"]["cat_lang"]." + " . $cfg["tab"]["cat_lang"] . " (idcatlang, idcat, idlang, idtplcfg, name, visible, public, status, author, created, lastmodified, urlname) VALUES - ('".Contenido_Security::toInteger($newidcatlang)."', - '".Contenido_Security::toInteger($idcat)."', - '".Contenido_Security::toInteger($idlang)."', - '".Contenido_Security::toInteger($idtplcfg)."', - '".Contenido_Security::escapeDB($name, $tmpdb)."', - '".Contenido_Security::toInteger($visible)."', - '".Contenido_Security::toInteger($public)."', - '".Contenido_Security::toInteger($status)."', - '".Contenido_Security::escapeDB($author, $tmpdb)."', - '".Contenido_Security::escapeDB($created, $tmpdb)."', - '".Contenido_Security::escapeDB($lastmodified, $tmpdb)."', - '".Contenido_Security::escapeDB($urlname, $tmpdb)."')"; + ('" . Contenido_Security::toInteger($newidcatlang) . "', + '" . Contenido_Security::toInteger($idcat) . "', + '" . Contenido_Security::toInteger($idlang) . "', + '" . Contenido_Security::toInteger($idtplcfg) . "', + '" . Contenido_Security::escapeDB($name, $tmpdb) . "', + '" . Contenido_Security::toInteger($visible) . "', + '" . Contenido_Security::toInteger($public) . "', + '" . Contenido_Security::toInteger($status) . "', + '" . Contenido_Security::escapeDB($author, $tmpdb) . "', + '" . Contenido_Security::escapeDB($created, $tmpdb) . "', + '" . Contenido_Security::escapeDB($lastmodified, $tmpdb) . "', + '" . Contenido_Security::escapeDB($urlname, $tmpdb) . "')"; $tmpdb->query($sql); // execute CEC hook $param = $tmpdb->Record; - $param['idlang'] = $idlang; + $param['idlang'] = $idlang; $param['idtplcfg'] = $idtplcfg; - $param['visible'] = $visible; + $param['visible'] = $visible; CEC_Hook::execute('Contenido.Category.strSyncCategory_Loop', $param); // set correct rights for element - cInclude ("includes", "functions.rights.php"); + cInclude("includes", "functions.rights.php"); createRightsForElement("str", $idcat, $targetlang); createRightsForElement("con", $idcat, $targetlang); } } } - /** * Checks if category has a start article * @@ -1334,9 +1307,9 @@ function strHasStartArticle($idcat, $idlang) { global $cfg, $db_str; if ($cfg["is_start_compatible"] == false) { - $sql = "SELECT startidartlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat = '".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($idlang)."' AND startidartlang != 0"; + $sql = "SELECT startidartlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat = '" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($idlang) . "' AND startidartlang != 0"; } else { - $sql = "SELECT is_start FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = '".Contenido_Security::toInteger($idcat)."' AND is_start = 1"; + $sql = "SELECT is_start FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat = '" . Contenido_Security::toInteger($idcat) . "' AND is_start = 1"; } $db_str->query($sql); if ($db_str->next_record()) { @@ -1345,7 +1318,6 @@ function strHasStartArticle($idcat, $idlang) { return false; } - /** * Copies the category and it's existing articles into another category. * @@ -1395,8 +1367,8 @@ function strCopyCategory($idcat, $destidcat, $remakeTree = true, $bUseCopyLabel // execute cec hook CEC_Hook::execute('Contenido.Category.strCopyCategory', array( - 'oldcat' => $oldcat, - 'newcat' => $newcat, + 'oldcat' => $oldcat, + 'newcat' => $newcat, 'newcatlang' => $newcatlang )); @@ -1408,7 +1380,7 @@ function strCopyCategory($idcat, $destidcat, $remakeTree = true, $bUseCopyLabel /* Copy the container configuration */ $c_cconf = new cApiContainerConfigurationCollection; $m_cconf = new cApiContainerConfigurationCollection; - $c_cconf->select("idtplcfg = '".$oldcatlang->get("idtplcfg")."'"); + $c_cconf->select("idtplcfg = '" . $oldcatlang->get("idtplcfg") . "'"); while ($i_cconf = $c_cconf->next()) { $m_cconf->create($newcatlang->get("idtplcfg"), $i_cconf->get("number"), $i_cconf->get("container")); @@ -1419,13 +1391,13 @@ function strCopyCategory($idcat, $destidcat, $remakeTree = true, $bUseCopyLabel $db2 = new DB_ConLite; /* Copy all articles */ - $sql = "SELECT A.idart, B.idartlang FROM ".$cfg["tab"]["cat_art"]." AS A, ".$cfg["tab"]["art_lang"]." AS B WHERE A.idcat = '".Contenido_Security::toInteger($idcat)."' AND B.idart = A.idart AND B.idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT A.idart, B.idartlang FROM " . $cfg["tab"]["cat_art"] . " AS A, " . $cfg["tab"]["art_lang"] . " AS B WHERE A.idcat = '" . Contenido_Security::toInteger($idcat) . "' AND B.idart = A.idart AND B.idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); while ($db->next_record()) { $newidart = conCopyArticle($db->f("idart"), $newidcat, "", $bUseCopyLabel); if ($db->f("idartlang") == $oldcatlang->get("startidartlang")) { - $sql = "SELECT idcatart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = '".Contenido_Security::toInteger($newidcat)."' AND idart = '".Contenido_Security::toInteger($newidart)."'"; + $sql = "SELECT idcatart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat = '" . Contenido_Security::toInteger($newidcat) . "' AND idart = '" . Contenido_Security::toInteger($newidart) . "'"; $db2->query($sql); if ($db2->next_record()) { conMakeStart($db2->f("idcatart"), 1); @@ -1436,7 +1408,6 @@ function strCopyCategory($idcat, $destidcat, $remakeTree = true, $bUseCopyLabel return ($newidcat); } - /** * Copies the categorytree (category and its childs) to an another category. * @@ -1452,7 +1423,7 @@ function strCopyTree($idcat, $destcat, $remakeTree = true, $bUseCopyLabel = true $newidcat = strCopyCategory($idcat, $destcat, false, $bUseCopyLabel); $db = new DB_ConLite; - $db->query("SELECT idcat FROM ".$cfg["tab"]["cat"]." WHERE parentid = '".Contenido_Security::toInteger($idcat)."'"); + $db->query("SELECT idcat FROM " . $cfg["tab"]["cat"] . " WHERE parentid = '" . Contenido_Security::toInteger($idcat) . "'"); while ($db->next_record()) { strCopyTree($db->f("idcat"), $newidcat, false, $bUseCopyLabel); } diff --git a/data/config/production/config.misc.php b/data/config/production/config.misc.php index 1f6f425..4f176d9 100644 --- a/data/config/production/config.misc.php +++ b/data/config/production/config.misc.php @@ -139,7 +139,7 @@ $cfg['native_i18n'] = false; */ /* Don't display errors */ -@ini_set("display_errors", false); +@ini_set("display_errors", true); /* Log errors to a file */ @ini_set("log_errors", true); @@ -148,7 +148,7 @@ $cfg['native_i18n'] = false; @ini_set("error_log", $cfg['path']['conlite_logs'] . "errorlog.txt"); /* Report all errors except warnings */ -if ($cfg["develop"]["show_errors"] && $_SERVER['SERVER_NAME'] == "localhost") { +if ($cfg["develop"]["show_errors"] && $_SERVER['SERVER_NAME'] == "local.dceserver.de") { error_reporting(E_ALL); } else { if ($cfg["develop"]["show_deprecated"]) {