From 885eec3df0f68752c8208f982b23cde2c482b60b Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Sun, 3 Apr 2022 15:17:52 +0200 Subject: [PATCH] fixed warning and deprecated errors --- .../classes/cHTML5/class.chtml5.common.php | 3 +- conlite/classes/class.ui.php | 32 ++-- conlite/classes/class.user.php | 4 + conlite/classes/con2con/class.registry.php | 2 +- conlite/classes/contenido/class.layout.php | 4 +- conlite/classes/contenido/class.module.php | 2 +- conlite/includes/functions.con2.php | 25 ++- conlite/includes/functions.tpl.php | 37 ++-- conlite/includes/functions.upl.php | 4 +- conlite/includes/include.lang_left_top.php | 40 ++-- conlite/includes/include.rights_left_top.php | 94 ++++----- conlite/includes/include.rights_menu.php | 181 ++++++++---------- conlite/includes/include.rights_overview.php | 99 +++++----- .../includes/include.system_configuration.php | 4 +- conlite/includes/include.systemsettings.php | 1 + conlite/includes/include.tpl_edit_form.php | 64 ++++--- conlite/plugins/cl-mod-rewrite | 2 +- 17 files changed, 293 insertions(+), 305 deletions(-) diff --git a/conlite/classes/cHTML5/class.chtml5.common.php b/conlite/classes/cHTML5/class.chtml5.common.php index 6a58c10..f741852 100644 --- a/conlite/classes/cHTML5/class.chtml5.common.php +++ b/conlite/classes/cHTML5/class.chtml5.common.php @@ -525,7 +525,8 @@ abstract class cHTML5Common implements ArrayAccess * @return boolean Returns true on success or false on failure. * @link http://php.net/manual/en/arrayaccess.offsetexists.php */ - public function offsetExists(mixed $offset): bool + #[\ReturnTypeWillChange] + public function offsetExists($offset) { return isset($this->attributes[strtolower($offset)]); } diff --git a/conlite/classes/class.ui.php b/conlite/classes/class.ui.php index 0125de3..4139941 100644 --- a/conlite/classes/class.ui.php +++ b/conlite/classes/class.ui.php @@ -174,10 +174,10 @@ class UI_Menu { foreach ($this->link as $key => $value) { if ($value != NULL) { - if ($this->imagewidth[$key] != 0) { + if (!empty($this->imagewidth[$key]) && !empty ($this->image[$key])) { $value->setContent(''); $img = $value->render(); - } else { + } else if(!empty ($this->image[$key])) { $value->setContent(''); $img = $value->render(); } @@ -186,14 +186,12 @@ class UI_Menu { } else { $link = $this->title[$key]; - if ($this->image[$key] != "") { + if (!empty($this->image[$key])) { if ($this->imagewidth[$key] != 0) { $img = ''; } else { $img = ''; } - } else { - $img = " "; } } @@ -212,21 +210,24 @@ class UI_Menu { $bgColor = $cfg["color"]["table_light_active"]; } - if ($this->extra[$key] == 'id="marked" ') { + if (!empty($this->extra[$key]) && $this->extra[$key] == 'id="marked" ') { $bgColor = $cfg["color"]["table_light_active"]; } } $tpl->set('d', 'NAME', $link); - if ($this->image[$key] == "") { + if (empty($this->image[$key])) { $tpl->set('d', 'ICON', ''); } else { $tpl->set('d', 'ICON', $img); } - if ($this->extra[$key] != "" || $this->rowmark == true) { + if (!empty($this->extra[$key]) || $this->rowmark == true) { $extraadd = ""; + if(empty($this->extra[$key])) { + $this->extra[$key] = ''; + } if ($this->rowmark == true) { $extraadd = 'onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)"'; @@ -439,7 +440,7 @@ class UI_Table_Form { if (is_array($this->items)) { foreach ($this->items as $key => $value) { - if ($this->itemType[$key] == 'subheader') { + if (isset($this->itemType[$key]) && $this->itemType[$key] == 'subheader') { $subheader = ''; $subheader .= '' . $this->captions[$key] . ''; @@ -703,6 +704,7 @@ class UI_Page { class Link { + var $alt = ''; var $link; var $title; var $targetarea; @@ -770,7 +772,8 @@ class Link { function render() { global $sess, $cfg; - + $custom = ''; + $attributes = ''; if ($this->alt != "") { $alt = 'alt="' . $this->alt . '" title="' . $this->alt . '" '; } else { @@ -819,7 +822,7 @@ class Link { break; } - if ($this->images == '') { + if (empty($this->images)) { return ($link . $this->content . ""); } else { list($this->img_width, $this->img_height, $this->img_type, $this->img_attr) = getimagesize($cfg['path']['contenido'] . $this->images); @@ -910,6 +913,7 @@ class UI_List { $colcount = 0; if (is_array($this->cells)) { + $dark = true; foreach ($this->cells as $row => $cells) { $thefont = ''; $unne = ''; @@ -928,7 +932,7 @@ class UI_List { $bgColor = $cfg["color"]["table_light"]; } - if ($this->bgcolor[$row] != "") { + if (!empty($this->bgcolor[$row])) { $bgColor = $this->bgcolor[$row]; } @@ -936,7 +940,7 @@ class UI_List { $count = 0; foreach ($cells as $key => $value) { - $thefontDispl = $thefont . $this->extra[$row][$key]; + $thefontDispl = $thefont . (empty($this->extra[$row][$key]))?'':$this->extra[$row][$key]; $count++; $tpl2->reset(); @@ -966,7 +970,7 @@ class UI_List { $tpl2->set('s', 'ALIGN', 'left'); } - if ($this->cellvalignment[$row][$key] != "") { + if (!empty($this->cellvalignment[$row][$key])) { $tpl2->set('s', 'VALIGN', $this->cellvalignment[$row][$key]); } else { $tpl2->set('s', 'VALIGN', 'top'); diff --git a/conlite/classes/class.user.php b/conlite/classes/class.user.php index a124142..c88f247 100644 --- a/conlite/classes/class.user.php +++ b/conlite/classes/class.user.php @@ -377,6 +377,10 @@ class User { */ function getUserProperty($type, $name, $group = false) { global $cfg, $perm; + + if(empty($this->values)) { + return false; + } if (!is_object($perm)) { $perm = new Contenido_Perm(); diff --git a/conlite/classes/con2con/class.registry.php b/conlite/classes/con2con/class.registry.php index 02e59bb..4125956 100644 --- a/conlite/classes/con2con/class.registry.php +++ b/conlite/classes/con2con/class.registry.php @@ -58,7 +58,7 @@ class cRegistry { public static function getFrontendPath() { $cfgClient = self::getClientConfig(); $client = self::getClientId(); - return $cfgClient[$client]['path']['frontend']; + return (empty($cfgClient))?'':$cfgClient[$client]['path']['frontend']; } /** diff --git a/conlite/classes/contenido/class.layout.php b/conlite/classes/contenido/class.layout.php index 8126efe..46caf0d 100644 --- a/conlite/classes/contenido/class.layout.php +++ b/conlite/classes/contenido/class.layout.php @@ -69,7 +69,7 @@ class cApiLayout extends Item { * @param mixed $mId Specifies the ID of item to load */ public function __construct($mId = false) { - global $cfg; + $cfg = cRegistry::getConfig(); parent::__construct($cfg["tab"]["lay"], "idlay"); $this->setFilters(array(), array()); @@ -78,7 +78,7 @@ class cApiLayout extends Item { $this->_setLayPath(); } - $oClient = new cApiClient($client); + $oClient = new cApiClient(cRegistry::getClientId()); $aClientProp = $oClient->getPropertiesByType('layfileedit'); if(count($aClientProp) > 0) { $this->_aLayFileEditConf = array_merge($this->_aLayFileEditConf, $aClientProp); diff --git a/conlite/classes/contenido/class.module.php b/conlite/classes/contenido/class.module.php index 3084663..3e2cff4 100644 --- a/conlite/classes/contenido/class.module.php +++ b/conlite/classes/contenido/class.module.php @@ -912,7 +912,7 @@ class cApiModule extends Item { } private function _displayNoteFromFile($bIsOldPath = FALSE) { - if ($this->_bNoted === true) { + if (isset($this->_bNoted) && $this->_bNoted === true) { return; } global $frame, $area; diff --git a/conlite/includes/functions.con2.php b/conlite/includes/functions.con2.php index 69a14e4..647ae79 100644 --- a/conlite/includes/functions.con2.php +++ b/conlite/includes/functions.con2.php @@ -264,20 +264,19 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) { $template = $db->f("template"); - $a_c[$value] = preg_replace("/(&\$)/", "", $a_c[$value]); - - $tmp1 = preg_split("/&/", $a_c[$value]); - $varstring = array(); + if (!empty($a_c[$value])) { + $a_c[$value] = preg_replace("/(&\$)/", "", $a_c[$value]); + $tmp1 = preg_split("/&/", $a_c[$value]); - foreach ($tmp1 as $key1 => $value1) { + foreach ($tmp1 as $key1 => $value1) { - $tmp2 = explode("=", $value1); - foreach ($tmp2 as $key2 => $value2) { - $varstring["$tmp2[0]"] = $tmp2[1]; + $tmp2 = explode("=", $value1); + foreach ($tmp2 as $key2 => $value2) { + $varstring["$tmp2[0]"] = $tmp2[1]; + } } } - $CiCMS_Var = '$C' . $value . 'CMS_VALUE'; $CiCMS_VALUE = ''; @@ -305,7 +304,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) { $output = '' . $output . ''; } - if ($fedebug != "") { + if (!empty($fedebug)) { $output = addslashes('\'; ?' . '>' . "
") . $output; $output = $output . addslashes('function showmod' . $value . ' () { window.alert(\\\'\'. "' . addslashes($fedebug) . '".\'\\\');} \'; ?' . '>'); } @@ -471,7 +470,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) { } //add system meta tag if there is no user meta tag - if ($bExists == false && strlen($aAutValue['content']) > 0) { + if ($bExists == false && isset($aAutValue['content']) && strlen($aAutValue['content']) > 0) { array_push($metatags, $aAutValue); } } @@ -481,7 +480,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) { foreach ($metatags as $value) { if (getEffectiveSetting('generator', 'html5', "false") == "true") { - if ($value['name'] == 'date') + if (isset($value['name']) && $value['name'] == 'date') continue; } if (!empty($value['content'])) { @@ -497,7 +496,7 @@ function conGenerateCode($idcat, $idart, $lang, $client, $layout = false) { $oMetaTagGen->removeAttribute("id"); /* Check if metatag already exists */ - if (preg_match('/(]+)>\r?\n?)/i', $code, $aTmetatagfound)) { + if (isset($value["name"]) && preg_match('/(]+)>\r?\n?)/i', $code, $aTmetatagfound)) { $code = str_replace($aTmetatagfound[1], $oMetaTagGen->render() . "\n", $code); } else if (array_key_exists("charset", $value) && preg_match('/(]+)\r?\n?)/i', $code, $aTmetatagfound)) { diff --git a/conlite/includes/functions.tpl.php b/conlite/includes/functions.tpl.php index a859610..371afc6 100644 --- a/conlite/includes/functions.tpl.php +++ b/conlite/includes/functions.tpl.php @@ -208,12 +208,13 @@ function tplBrowseLayoutForContainers($idlay, $raw_code = NULL) { 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 (!empty($a_container)) { + 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; + } } } @@ -230,11 +231,13 @@ function tplBrowseLayoutForContainers($idlay, $raw_code = NULL) { $container[] = $value; } } - + asort($container); - if (is_array($container)) { + if (is_array($container) && !empty($container)) { $tmp_returnstring = implode("&", $container); + } else { + $tmp_returnstring = ""; } return $tmp_returnstring; } @@ -291,7 +294,7 @@ function tplGetContainerTypes($idlay, $container) { global $db; global $cfg; global $containerinf; - + $list = array(); if (is_array($containerinf[$idlay])) { @@ -359,16 +362,14 @@ function tplPreparseLayout($idlay, $raw_code = NULL) { if ($parser->iNodeName == "container" && $parser->iNodeType == NODE_TYPE_ELEMENT) { $idcontainer = $parser->iNodeAttributes["id"]; - $mode = $parser->iNodeAttributes["mode"]; - - if ($mode == "") { - $mode = "optional"; - } + $sMode = (isset($parser->iNodeAttributes["mode"]))?$parser->iNodeAttributes["mode"]:'optional'; + $sDefault = (isset($parser->iNodeAttributes["default"]))?$parser->iNodeAttributes["default"]:''; + $sTypes = (isset($parser->iNodeAttributes["types"]))?$parser->iNodeAttributes["types"]:''; $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]["mode"] = $sMode; + $containerinf[$idlay][$idcontainer]["default"] = $sDefault; + $containerinf[$idlay][$idcontainer]["types"] = $sTypes; $containerinf[$idlay][$idcontainer]["is_body"] = $bIsBody; } } @@ -726,7 +727,6 @@ function tplAutoFillModules($idtpl) { 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); @@ -760,7 +760,6 @@ function tplAutoFillModules($idtpl) { 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) . "'"; diff --git a/conlite/includes/functions.upl.php b/conlite/includes/functions.upl.php index 5badbd4..af85fbd 100644 --- a/conlite/includes/functions.upl.php +++ b/conlite/includes/functions.upl.php @@ -805,7 +805,7 @@ function uplCreateFriendlyName($filename, $spacer = "_") { $newfilename = ""; - if (!is_array($cfg['upl']['allow_additional_chars'])) { + if (!isset($cfg['upl']['allow_additional_chars']) || !is_array($cfg['upl']['allow_additional_chars'])) { $filename = str_replace(" ", $spacer, $filename); } elseif (in_array(' ', $cfg['upl']['allow_additional_chars']) === FALSE) { $filename = str_replace(" ", $spacer, $filename); @@ -826,7 +826,7 @@ function uplCreateFriendlyName($filename, $spacer = "_") { } #Check for additionally allowed charcaters in $cfg['upl']['allow_additional_chars'] (must be array of chars allowed) - if (is_array($cfg['upl']['allow_additional_chars']) && !$bFound) { + if (isset($cfg['upl']['allow_additional_chars']) && is_array($cfg['upl']['allow_additional_chars']) && !$bFound) { if (in_array($atom, $cfg['upl']['allow_additional_chars'])) { $newfilename .= $atom; } diff --git a/conlite/includes/include.lang_left_top.php b/conlite/includes/include.lang_left_top.php index 79e5228..7746e8b 100644 --- a/conlite/includes/include.lang_left_top.php +++ b/conlite/includes/include.lang_left_top.php @@ -1,4 +1,5 @@ set('s', 'CLASS', 'text_medium'); @@ -42,7 +42,6 @@ $tpl->set('s', 'SID', $sess->id); $clients = $classclient->getAccessibleClients(); - $tpl2 = new Template; $tpl2->set('s', 'ID', 'editclient'); $tpl2->set('s', 'NAME', 'editclient'); @@ -53,23 +52,20 @@ $iClientcount = count($clients); foreach ($clients as $key => $value) { - if ($client == $key) - { - $selected = "selected"; - } else { - $selected = ""; - } + if ($client == $key) { + $selected = "selected"; + } else { + $selected = ""; + } - if (strlen($value['name']) > 15) - { - $value['name'] = substr($value['name'],0,12). "..."; - } - - $tpl2->set('d', 'VALUE', $key); - $tpl2->set('d', 'CAPTION', $value['name']); - $tpl2->set('d', 'SELECTED', $selected); - $tpl2->next(); + if (strlen($value['name']) > 15) { + $value['name'] = substr($value['name'], 0, 12) . "..."; + } + $tpl2->set('d', 'VALUE', $key); + $tpl2->set('d', 'CAPTION', $value['name']); + $tpl2->set('d', 'SELECTED', $selected); + $tpl2->next(); } $select = $tpl2->generate($cfg["path"]["templates"] . $cfg['templates']['generic_select'], true); @@ -77,13 +73,11 @@ $select = $tpl2->generate($cfg["path"]["templates"] . $cfg['templates']['generic $tpl->set('s', 'CLIENTSELECT', $select); if ($perm->have_perm_area_action($area, "lang_newlanguage") && $iClientcount > 0) { - $tpl->set('s', 'NEWLANG', ''.i18n("Create language").''); + $tpl->set('s', 'NEWLANG', '' . i18n("Create language") . ''); } else if ($iClientcount == 0) { $tpl->set('s', 'NEWLANG', i18n('No Client selected')); } else { $tpl->set('s', 'NEWLANG', ''); } -$tpl->generate($cfg['path']['templates'] . $cfg['templates']['lang_left_top']); - -?> \ No newline at end of file +$tpl->generate($cfg['path']['templates'] . $cfg['templates']['lang_left_top']); \ No newline at end of file diff --git a/conlite/includes/include.rights_left_top.php b/conlite/includes/include.rights_left_top.php index 43675a4..1b04826 100644 --- a/conlite/includes/include.rights_left_top.php +++ b/conlite/includes/include.rights_left_top.php @@ -1,4 +1,5 @@ auth["uid"]); -if (!isset($elemperpage) || !is_numeric($elemperpage) || $elemperpage < 0) -{ - $elemperpage = $oUser->getProperty("itemsperpage", $area); +if (!isset($elemperpage) || !is_numeric($elemperpage) || $elemperpage < 0) { + $elemperpage = $oUser->getProperty("itemsperpage", $area); $_REQUEST['elemperpage'] = $elemperpage; if ((int) $elemperpage <= 0) { $oUser->setProperty("itemsperpage", $area, 25); @@ -66,31 +69,28 @@ $tpl->set('s', 'OPTIONS', ''); $tpl->set('s', 'SID', $sess->id); $tpl->set('s', 'SESSID', $sess->id); - $tpl2 = new Template; $tpl2->set('s', 'NAME', 'restrict'); $tpl2->set('s', 'CLASS', 'text_medium'); $tpl2->set('s', 'OPTIONS', 'onchange="userChangeRestriction()"'); $limit = array( - "2" => i18n("All"), - "1" => i18n("Frontend only"), - "3" => i18n("Backend only")); - + "2" => i18n("All"), + "1" => i18n("Frontend only"), + "3" => i18n("Backend only")); + foreach ($limit as $key => $value) { - if ($restrict == $key) - { - $selected = "selected"; - } else { - $selected = ""; - } - - $tpl2->set('d', 'VALUE', $key); - $tpl2->set('d', 'CAPTION', $value); - $tpl2->set('d', 'SELECTED', $selected); - $tpl2->next(); + if (!empty($restrict) && $restrict == $key) { + $selected = "selected"; + } else { + $selected = ""; + } + $tpl2->set('d', 'VALUE', $key); + $tpl2->set('d', 'CAPTION', $value); + $tpl2->set('d', 'SELECTED', $selected); + $tpl2->next(); } $select = $tpl2->generate($cfg["path"]["templates"] . $cfg['templates']['generic_select'], true); @@ -100,9 +100,9 @@ $tpl->set('s', 'ACTION', ''); $tmp_mstr = '
%s
'; $area = "user"; -$mstr = sprintf($tmp_mstr, 'right_bottom',$sess->url("main.php?area=user_create&frame=4"),i18n("Create user")); +$mstr = sprintf($tmp_mstr, 'right_bottom', $sess->url("main.php?area=user_create&frame=4"), i18n("Create user")); -if ($perm->have_perm_area_action('user_create', "user_createuser")) { +if ($perm->have_perm_area_action('user_create', "user_createuser")) { $tpl->set('s', 'NEWUSER', $mstr); } else { $tpl->set('s', 'NEWUSER', ''); @@ -112,15 +112,15 @@ $tpl->set('s', 'CAPTION', ''); ################# # List Options ################# -$aSortByOptions = array( "username" => i18n("User name"), - "realname" => i18n("Name")); - -$aSortOrderOptions = array( "asc" => i18n("Ascending"), - "desc" => i18n("Descending")); +$aSortByOptions = array("username" => i18n("User name"), + "realname" => i18n("Name")); -$listOptionId="listoption"; +$aSortOrderOptions = array("asc" => i18n("Ascending"), + "desc" => i18n("Descending")); + +$listOptionId = "listoption"; $tpl->set('s', 'LISTOPLINK', $listOptionId); -$oListOptionRow = new cFoldingRow( "5498dbba-ed4a-4618-8e49-3a3635396e22", i18n("List options"), $listOptionId); +$oListOptionRow = new cFoldingRow("5498dbba-ed4a-4618-8e49-3a3635396e22", i18n("List options"), $listOptionId); $oListOptionRow->setExpanded('true'); $oSelectItemsPerPage = new cHTMLSelectElement("elemperpage"); $oSelectItemsPerPage->autoFill(array(25 => 25, 50 => 50, 75 => 75, 100 => 100)); @@ -137,31 +137,31 @@ $oSelectSortOrder->setDefault($_REQUEST["sortorder"]); $oTextboxFilter = new cHTMLTextbox("filter", $_REQUEST["filter"], 20); $oTextboxFilter->setStyle('width:114px;'); -$content = '
'; -$content .= '
'; +$content = '
'; +$content .= ''; $content .= ''; -$content .= ''; +$content .= ''; $content .= ''; -$content .= ''; +$content .= ''; $content .= ''; -$content .= ''; -$content .= ''; +$content .= ''; +$content .= ''; $content .= ''; $content .= ''; -$content .= ''; -$content .= ''; +$content .= ''; +$content .= ''; $content .= ''; $content .= ''; -$content .= ''; -$content .= ''; +$content .= ''; +$content .= ''; $content .= ''; $content .= ''; -$content .= ''; -$content .= ''; +$content .= ''; +$content .= ''; $content .= ''; $content .= ''; $content .= ''; -$content .= ''; +$content .= ''; $content .= ''; $content .= '
'. i18n("Items / page").''.$oSelectItemsPerPage->render().'' . i18n("Items / page") . '' . $oSelectItemsPerPage->render() . '
'. i18n("Sort by").''.$oSelectSortBy->render().'' . i18n("Sort by") . '' . $oSelectSortBy->render() . '
'. i18n("Sort order").''.$oSelectSortOrder->render().'' . i18n("Sort order") . '' . $oSelectSortOrder->render() . '
'. i18n("Search for").''.$oTextboxFilter->render().'' . i18n("Search for") . '' . $oTextboxFilter->render() . '
 
'; $content .= ''; @@ -172,7 +172,7 @@ $tpl->set('s', 'LISTOPTIONS', $oListOptionRow->render()); ######### # Paging ######### -$cApiUserCollection = new cApiUserCollection; +$cApiUserCollection = new cApiUserCollection; $cApiUserCollection->query(); $iItemCount = $cApiUserCollection->count(); @@ -188,12 +188,12 @@ $oPagerLink->setCustom("area", $area); $oPagerLink->enableAutomaticParameterAppend(); $oPagerLink->setCustom("contenido", $sess->id); -$pagerID="pager"; +$pagerID = "pager"; +$page = (isset($page))?$page:1; $oPager = new cObjectPager("44b41691-0dd4-443c-a594-66a8164e25fd", $iItemCount, $elemperpage, $page, $oPagerLink, "page", $pagerID); $oPager->setExpanded('true'); $tpl->set('s', 'PAGINGLINK', $pagerID); $tpl->set('s', 'PAGING', $oPager->render()); - $tpl->generate($cfg['path']['templates'] . $cfg['templates']['rights_left_top']); ?> \ No newline at end of file diff --git a/conlite/includes/include.rights_menu.php b/conlite/includes/include.rights_menu.php index db5ea1d..2334720 100644 --- a/conlite/includes/include.rights_menu.php +++ b/conlite/includes/include.rights_menu.php @@ -1,4 +1,5 @@ query(); $iSumUsers = $cApiUserCollection->count(); -if (isset($_REQUEST["sortby"]) && $_REQUEST["sortby"] != "") -{ - $cApiUserCollection->setOrder($_REQUEST["sortby"]. " ". $_REQUEST["sortorder"]); -} else { - $cApiUserCollection->setOrder("username asc"); +if (empty($_REQUEST["sortby"])) { + $_REQUEST["sortby"] = 'username'; + $_REQUEST["sortorder"] = 'asc'; + $cApiUserCollection->setOrder("username asc"); } -if (isset($_REQUEST["filter"]) && $_REQUEST["filter"] != "") -{ - $cApiUserCollection->setWhereGroup("default", "username", "%".$_REQUEST["filter"]."%", "LIKE"); - $cApiUserCollection->setWhereGroup("default", "realname", "%".$_REQUEST["filter"]."%", "LIKE"); - $cApiUserCollection->setWhereGroup("default", "email", "%".$_REQUEST["filter"]."%", "LIKE"); - $cApiUserCollection->setWhereGroup("default", "telephone", "%".$_REQUEST["filter"]."%", "LIKE"); - $cApiUserCollection->setWhereGroup("default", "address_street", "%".$_REQUEST["filter"]."%", "LIKE"); - $cApiUserCollection->setWhereGroup("default", "address_zip", "%".$_REQUEST["filter"]."%", "LIKE"); - $cApiUserCollection->setWhereGroup("default", "address_city", "%".$_REQUEST["filter"]."%", "LIKE"); - $cApiUserCollection->setWhereGroup("default", "address_country", "%".$_REQUEST["filter"]."%", "LIKE"); - - $cApiUserCollection->setInnerGroupCondition("default", "OR"); +$cApiUserCollection->setOrder($_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]); + +if (!empty($_REQUEST["filter"])) { + $cApiUserCollection->setWhereGroup("default", "username", "%" . $_REQUEST["filter"] . "%", "LIKE"); + $cApiUserCollection->setWhereGroup("default", "realname", "%" . $_REQUEST["filter"] . "%", "LIKE"); + $cApiUserCollection->setWhereGroup("default", "email", "%" . $_REQUEST["filter"] . "%", "LIKE"); + $cApiUserCollection->setWhereGroup("default", "telephone", "%" . $_REQUEST["filter"] . "%", "LIKE"); + $cApiUserCollection->setWhereGroup("default", "address_street", "%" . $_REQUEST["filter"] . "%", "LIKE"); + $cApiUserCollection->setWhereGroup("default", "address_zip", "%" . $_REQUEST["filter"] . "%", "LIKE"); + $cApiUserCollection->setWhereGroup("default", "address_city", "%" . $_REQUEST["filter"] . "%", "LIKE"); + $cApiUserCollection->setWhereGroup("default", "address_country", "%" . $_REQUEST["filter"] . "%", "LIKE"); + + $cApiUserCollection->setInnerGroupCondition("default", "OR"); +} else { + $_REQUEST["filter"] = ''; } $cApiUserCollection->query(); @@ -67,108 +69,87 @@ $aCurrentUserAccessibleClients = $classclient->getAccessibleClients(); $iMenu = 0; $iItemCount = 0; -$mPage = $_REQUEST["page"]; +$mPage = (isset($_REQUEST["page"])) ? (int) $_REQUEST["page"] : 1; -if ($mPage == 0) -{ - $mPage = 1; -} - -$elemperpage = $_REQUEST["elemperpage"]; - -if ($elemperpage == 0) -{ - $elemperpage = 25; -} +$elemperpage = (isset($_REQUEST["elemperpage"])) ? (int) $_REQUEST["elemperpage"] : 25; $mlist = new UI_Menu; $sToday = date('Y-m-d'); - -if (($elemperpage*$mPage) >= $iSumUsers+$elemperpage && $mPage != 1) { +if (($elemperpage * $mPage) >= $iSumUsers + $elemperpage && $mPage != 1) { $_REQUEST["page"]--; $mPage--; } -while ($cApiUser = $cApiUserCollection->next()) -{ - $userid = $cApiUser->get("user_id"); - - $aUserPermissions = explode(',', $cApiUser->get('perms')); - - $bDisplayUser = false; +while ($cApiUser = $cApiUserCollection->next()) { + $userid = $cApiUser->get("user_id"); - if (in_array("sysadmin", $aCurrentUserPermissions)) - { + $aUserPermissions = explode(',', $cApiUser->get('perms')); + + $bDisplayUser = false; + + if (in_array("sysadmin", $aCurrentUserPermissions)) { $bDisplayUser = true; } - - foreach ($aCurrentUserAccessibleClients as $key => $value) - { - if (in_array("client[$key]", $aUserPermissions)) - { + + foreach ($aCurrentUserAccessibleClients as $key => $value) { + if (in_array("client[$key]", $aUserPermissions)) { $bDisplayUser = true; } } - - foreach ($aUserPermissions as $sLocalPermission) - { - if (in_array($sLocalPermission, $aCurrentUserPermissions)) - { + + foreach ($aUserPermissions as $sLocalPermission) { + if (in_array($sLocalPermission, $aCurrentUserPermissions)) { $bDisplayUser = true; } - } - + } + $link = new cHTMLLink; $link->setMultiLink("user", "", "user_overview", ""); $link->setCustom("userid", $cApiUser->get("user_id")); - - if ($bDisplayUser == true) - { - $iItemCount++; - if ($iItemCount > ($elemperpage * ($mPage - 1)) && $iItemCount < (($elemperpage * $mPage) + 1)) - { - if ($perm->have_perm_area_action('user',"user_delete") ) { - $message = sprintf(i18n("Do you really want to delete the user %s?"), $cApiUser->get("username")); - - $delTitle = i18n("Delete user"); - $deletebutton = ''.$delTitle.''; - - } else { - $deletebutton = ""; - } + if ($bDisplayUser == true) { + $iItemCount++; - $iMenu++; - - if (($sToday < $cApiUser->get("valid_from") - && $cApiUser->get("valid_from") != '0000-00-00' - && $cApiUser->get("valid_from") != '1000-01-01' + if ($iItemCount > ($elemperpage * ($mPage - 1)) && $iItemCount < (($elemperpage * $mPage) + 1)) { + if ($perm->have_perm_area_action('user', "user_delete")) { + $message = sprintf(i18n("Do you really want to delete the user %s?"), $cApiUser->get("username")); + + $delTitle = i18n("Delete user"); + $deletebutton = '' . $delTitle . ''; + } else { + $deletebutton = ""; + } + + $iMenu++; + + if (($sToday < $cApiUser->get("valid_from") + && $cApiUser->get("valid_from") != '0000-00-00' + && $cApiUser->get("valid_from") != '1000-01-01' && $cApiUser->get("valid_from") != '') - || ($sToday > $cApiUser->get("valid_to") - && $cApiUser->get("valid_to") != '0000-00-00' - && $cApiUser->get("valid_to") != '1000-01-01' - && $cApiUser->get("valid_from") != '')) { - $mlist->setTitle($iMenu, ''.$cApiUser->get("username")."
".$cApiUser->get("realname").'
'); - } else { - $mlist->setTitle($iMenu, $cApiUser->get("username")."
".$cApiUser->get("realname")); - } + || ($sToday > $cApiUser->get("valid_to") + && $cApiUser->get("valid_to") != '0000-00-00' + && $cApiUser->get("valid_to") != '1000-01-01' + && $cApiUser->get("valid_from") != '')) { + $mlist->setTitle($iMenu, '' . $cApiUser->get("username") . "
" . $cApiUser->get("realname") . '
'); + } else { + $mlist->setTitle($iMenu, $cApiUser->get("username") . "
" . $cApiUser->get("realname")); + } - $mlist->setLink($iMenu, $link); - $mlist->setActions($iMenu, "delete", $deletebutton); - - if ($_GET['userid'] == $cApiUser->get("user_id")) { + $mlist->setLink($iMenu, $link); + $mlist->setActions($iMenu, "delete", $deletebutton); + + if (!empty($_GET['userid']) && $_GET['userid'] == $cApiUser->get("user_id")) { $mlist->setExtra($iMenu, 'id="marked" '); } - } + } } - } $deleteScript = ''; - + $markActiveScript = ''; - // +// $oPage->setMargin(0); $oPage->addScript('rowMark.js', ''); $oPage->addScript('parameterCollector.js', ''); -$oPage->addScript('messagebox', ''); +$oPage->addScript('messagebox', ''); $oPage->addScript('delete', $deleteScript); -$oPage->setContent($mlist->render(false).$markActiveScript); +$oPage->setContent($mlist->render(false) . $markActiveScript); //generate current content for Object Pager $oPagerLink = new cHTMLLink; @@ -225,10 +206,10 @@ $oPagerLink->setCustom("area", $area); $oPagerLink->enableAutomaticParameterAppend(); $oPagerLink->setCustom("contenido", $sess->id); -$pagerID="pager"; +$pagerID = "pager"; +$page = (empty($page))?1:(int)$page; $oPager = new cObjectPager("44b41691-0dd4-443c-a594-66a8164e25fd", $iItemCount, $elemperpage, $page, $oPagerLink, "page", $pagerID); - //add slashes, to insert in javascript $sPagerContent = $oPager->render(1); $sPagerContent = str_replace('\\', '\\\\', $sPagerContent); @@ -237,7 +218,7 @@ $sPagerContent = str_replace('\'', '\\\'', $sPagerContent); //send new object pager to left_top $sRefreshPager = ' '; -$oPage->addScript('refreshpager', $sRefreshPager); +$oPage->addScript('refreshpager', $sRefreshPager); $oPage->render(); - -?> \ No newline at end of file diff --git a/conlite/includes/include.rights_overview.php b/conlite/includes/include.rights_overview.php index 71e83ea..d9fc8e5 100644 --- a/conlite/includes/include.rights_overview.php +++ b/conlite/includes/include.rights_overview.php @@ -1,4 +1,5 @@ have_perm_area_action($area, $action) || $perm->have_perm_area_action('user', $action))) { // access denied $notification->displayNotification("error", i18n("Permission denied")); @@ -55,8 +54,8 @@ if (!isset($userid)) { return; } -$aPerms = array(); -$bError = false; +$aPerms = array(); +$bError = false; $sNotification = ''; // delete user @@ -65,11 +64,11 @@ if ($action == 'user_delete') { $oUsers->deleteUserByID($userid); $sql = "DELETE FROM " . $cfg["tab"]["groupmembers"] - . " WHERE user_id = '" . Contenido_Security::escapeDB($userid, $db) . "'"; + . " WHERE user_id = '" . Contenido_Security::escapeDB($userid, $db) . "'"; $db->query($sql); $sql = "DELETE FROM " . $cfg["tab"]["rights"] - ." WHERE user_id = '" . Contenido_Security::escapeDB($userid, $db) . "'"; + . " WHERE user_id = '" . Contenido_Security::escapeDB($userid, $db) . "'"; $db->query($sql); $sNotification = $notification->displayNotification("info", i18n("User deleted")); @@ -87,7 +86,7 @@ if ($action == 'user_delete') { '; - + $tpl->reset(); $tpl->set('s', 'NOTIFICATION', $sNotification); $tpl->generate($sTemplate); @@ -158,13 +157,19 @@ $oUser = new User(); $oUser->loadUserByUserID(Contenido_Security::escapeDB($userid, $db)); // delete user property -if (is_string($del_userprop_type) && is_string($del_userprop_name)) { +if (!empty($del_userprop_type) + && !empty($del_userprop_name) + && is_string($del_userprop_type) + && is_string($del_userprop_name)) { $oUser->deleteUserProperty($del_userprop_type, $del_userprop_name); } // edit user property -if (is_string($userprop_type) && is_string($userprop_name) && is_string($userprop_value) - && !empty($userprop_type) && !empty($userprop_name)) { +if (!empty($userprop_type) + && !empty($userprop_name) + && is_string($userprop_type) + && is_string($userprop_name) + && is_string($userprop_value)) { $oUser->setUserProperty($userprop_type, $userprop_name, $userprop_value); } @@ -174,16 +179,16 @@ if (count($aPerms) == 0 || $action == '' || !isset($action)) { $tpl->reset(); -$tpl->set('s','SID', $sess->id); -$tpl->set('s','NOTIFICATION', $sNotification); +$tpl->set('s', 'SID', $sess->id); +$tpl->set('s', 'NOTIFICATION', $sNotification); -$form = '
- '.$sess->hidden_session(true).' - +$form = ' + ' . $sess->hidden_session(true) . ' + - - - '; + + + '; $tpl->set('s', 'FORM', $form); $tpl->set('s', 'GET_USERID', $userid); @@ -193,9 +198,8 @@ $tpl->set('s', 'SUBMITTEXT', i18n("Save changes")); $tpl->set('s', 'CANCELTEXT', i18n("Discard changes")); $tpl->set('s', 'CANCELLINK', $sess->url("main.php?area=$area&frame=4&userid=$userid")); - $tpl->set('d', 'CATNAME', i18n("Property")); -$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_header"]); +$tpl->set('d', 'BGCOLOR', $cfg["color"]["table_header"]); $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); $tpl->set('d', 'CATFIELD', i18n("Value")); $tpl->next(); @@ -203,7 +207,7 @@ $tpl->next(); $tpl->set('d', 'CATNAME', i18n("Username")); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]); $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); -$tpl->set('d', 'CATFIELD', $oUser->getField('username').''); +$tpl->set('d', 'CATFIELD', $oUser->getField('username') . ''); $tpl->next(); $tpl->set('d', 'CATNAME', i18n("Name")); @@ -213,7 +217,7 @@ $tpl->set('d', 'CATFIELD', formGenerateField("text", "realname", $oUser->getFiel $tpl->next(); // @since 2006-07-04 Display password fields only if not authenticated via LDAP/AD -if ($msysadmin || $oUser->getField('password') != 'active_directory_auth') { +if ((isset($msysadmin) && $msysadmin) || $oUser->getField('password') != 'active_directory_auth') { $tpl->set('d', 'CATNAME', i18n("New password")); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]); $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); @@ -280,14 +284,14 @@ $oClientsCollection = new cApiClientCollection(); $aClients = $oClientsCollection->getAvailableClients(); $sClientCheckboxes = ''; foreach ($aClients as $idclient => $item) { - if (in_array("admin[".$idclient."]", $aAuthPerms) || in_array('sysadmin', $aAuthPerms)){ - $sClientCheckboxes .= formGenerateCheckbox("madmin[".$idclient."]", $idclient, in_array("admin[".$idclient."]", $aPerms), $item['name']." (".$idclient.")")."
"; + if (in_array("admin[" . $idclient . "]", $aAuthPerms) || in_array('sysadmin', $aAuthPerms)) { + $sClientCheckboxes .= formGenerateCheckbox("madmin[" . $idclient . "]", $idclient, in_array("admin[" . $idclient . "]", $aPerms), $item['name'] . " (" . $idclient . ")") . "
"; } } if ($sClientCheckboxes !== '' && !in_array('sysadmin', $aPerms)) { $tpl->set('d', 'CATNAME', i18n("Administrator")); - $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); + $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]); $tpl->set('d', 'CATFIELD', $sClientCheckboxes); $tpl->next(); @@ -296,14 +300,14 @@ if ($sClientCheckboxes !== '' && !in_array('sysadmin', $aPerms)) { // clients perms $sClientCheckboxes = ''; foreach ($aClients as $idclient => $item) { - if ((in_array("client[".$idclient."]", $aAuthPerms) || in_array('sysadmin', $aAuthPerms) || in_array("admin[".$idclient."]", $aAuthPerms)) && !in_array("admin[".$idclient."]", $aPerms)) { - $sClientCheckboxes .= formGenerateCheckbox("mclient[".$idclient."]", $idclient, in_array("client[".$idclient."]", $aPerms), $item['name']." (". $idclient . ")")."
"; + if ((in_array("client[" . $idclient . "]", $aAuthPerms) || in_array('sysadmin', $aAuthPerms) || in_array("admin[" . $idclient . "]", $aAuthPerms)) && !in_array("admin[" . $idclient . "]", $aPerms)) { + $sClientCheckboxes .= formGenerateCheckbox("mclient[" . $idclient . "]", $idclient, in_array("client[" . $idclient . "]", $aPerms), $item['name'] . " (" . $idclient . ")") . "
"; } } if ($sClientCheckboxes !== '' && !in_array('sysadmin', $aPerms)) { $tpl->set('d', 'CATNAME', i18n("Access clients")); - $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); + $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]); $tpl->set('d', 'CATFIELD', $sClientCheckboxes); $tpl->next(); @@ -313,14 +317,14 @@ if ($sClientCheckboxes !== '' && !in_array('sysadmin', $aPerms)) { $aClientsLanguages = getAllClientsAndLanguages(); $sClientCheckboxes = ''; foreach ($aClientsLanguages as $item) { - if (($perm->have_perm_client("lang[".$item['idlang']."]") || $perm->have_perm_client("admin[".$item['idclient']."]")) && !in_array("admin[".$item['idclient']."]", $aPerms)) { - $sClientCheckboxes .= formGenerateCheckbox("mlang[".$item['idlang']."]", $item['idlang'], in_array("lang[".$item['idlang']."]", $aPerms), $item['langname']." (". $item['clientname'] .")") ."
"; + if (($perm->have_perm_client("lang[" . $item['idlang'] . "]") || $perm->have_perm_client("admin[" . $item['idclient'] . "]")) && !in_array("admin[" . $item['idclient'] . "]", $aPerms)) { + $sClientCheckboxes .= formGenerateCheckbox("mlang[" . $item['idlang'] . "]", $item['idlang'], in_array("lang[" . $item['idlang'] . "]", $aPerms), $item['langname'] . " (" . $item['clientname'] . ")") . "
"; } } if ($sClientCheckboxes != '' && !in_array('sysadmin', $aPerms)) { $tpl->set('d', 'CATNAME', i18n("Access languages")); - $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); + $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]); $tpl->set('d', 'CATFIELD', $sClientCheckboxes); $tpl->next(); @@ -329,11 +333,11 @@ if ($sClientCheckboxes != '' && !in_array('sysadmin', $aPerms)) { // user properties $aProperties = $oUser->getUserProperties(); -$sPropRows = ''; +$sPropRows = ''; foreach ($aProperties as $entry) { $type = $entry['type']; if ($type != 'system') { - $name = $entry['name']; + $name = $entry['name']; $value = $entry['value']; $sPropRows .= ' @@ -347,11 +351,11 @@ foreach ($aProperties as $entry) { } } $table = ' - - - - - +
'.i18n("Area/Type").''.i18n("Property").''.i18n("Value").'
+ + + + ' . $sPropRows . ' @@ -364,7 +368,7 @@ $table = '
' . i18n("Area/Type") . '' . i18n("Property") . '' . i18n("Value") . '  
'; $tpl->set('d', 'CATNAME', i18n("User-defined properties")); -$tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); +$tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]); $tpl->set('d', 'CATFIELD', $table); $tpl->next(); @@ -383,9 +387,9 @@ $sCurrentValueFrom = trim(str_replace('1000-01-01', '', $sCurrentValueFrom)); $sInputValidFrom = ' - + '; -$sInputValidFrom .= ' '; +$sInputValidFrom .= ' '; $sInputValidFrom .= ''; $tpl->set('d', 'CATNAME', i18n("Valid to")); -$tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); +$tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_light"]); $tpl->set('d', 'CATFIELD', $sInputValidTo); $tpl->next(); @@ -445,7 +449,7 @@ if (($sCurrentValueFrom > $sCurrentDate) || ($sCurrentValueTo < $sCurrentDate)) $tpl->set('d', 'CATNAME', ' '); $tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]); -$tpl->set('d', 'CATFIELD', ''.$sAccountState.''); +$tpl->set('d', 'CATFIELD', '' . $sAccountState . ''); $tpl->next(); // Show backend user's group memberships @@ -458,12 +462,11 @@ if (count($aGroups) > 0) { } $tpl->set('d', 'CATNAME', i18n("Group membership")); -$tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); +$tpl->set('d', 'BORDERCOLOR', $cfg["color"]["table_border"]); $tpl->set('d', 'BGCOLOR', $cfg["color"]["table_dark"]); $tpl->set('d', 'CATFIELD', $sGroups); $tpl->next(); // Generate template $tpl->generate($cfg['path']['templates'] . $cfg['templates']['rights_overview']); - ?> \ No newline at end of file diff --git a/conlite/includes/include.system_configuration.php b/conlite/includes/include.system_configuration.php index ee7943d..e975cad 100644 --- a/conlite/includes/include.system_configuration.php +++ b/conlite/includes/include.system_configuration.php @@ -111,6 +111,7 @@ $aManagedProperties = array( ); $aSettings = getSystemProperties(1); +$sNotification = ''; if (isset($_POST['action']) && $_POST['action'] == 'edit_sysconf' && $perm->have_perm_area_action($area, 'edit_sysconf')) { $bStored = false; @@ -192,5 +193,4 @@ if ($perm->have_perm_area_action($area, 'edit_sysconf')) { $oPage->setContent($notification->returnNotification("error", i18n('Access denied'), 1)); } $oPage->addScript('setMenu', $sJs); -$oPage->render(); -?> \ No newline at end of file +$oPage->render(); \ No newline at end of file diff --git a/conlite/includes/include.systemsettings.php b/conlite/includes/include.systemsettings.php index 3c86822..258a205 100644 --- a/conlite/includes/include.systemsettings.php +++ b/conlite/includes/include.systemsettings.php @@ -38,6 +38,7 @@ $aManagedValues = array('versioning_prune_limit', 'update_check', 'update_news_f 'system_mail_sender_name', 'pw_request_enable', 'maintenance_mode', 'edit_area_activated', 'backend_preferred_idclient', 'generator_basehref', 'generator_xhtml', 'imagemagick_available', 'system_insight_editing_activated'); +$sWarning = ''; if ($action == "systemsettings_save_item") { if (!in_array($systype . '_' . $sysname, $aManagedValues)) { diff --git a/conlite/includes/include.tpl_edit_form.php b/conlite/includes/include.tpl_edit_form.php index abe8f15..c19a7bf 100644 --- a/conlite/includes/include.tpl_edit_form.php +++ b/conlite/includes/include.tpl_edit_form.php @@ -44,14 +44,14 @@ if (($action == "tpl_new") && (!$perm->have_perm_area_action_anyitem($area, $act } $sql = "SELECT - a.idtpl, a.name as name, a.description, a.idlay, b.description as laydescription, a.defaulttemplate - FROM - " . $cfg['tab']['tpl'] . " AS a - LEFT JOIN - " . $cfg['tab']['lay'] . " AS b - ON a.idlay=b.idlay - WHERE a.idtpl='" . Contenido_Security::toInteger($idtpl) . "' - ORDER BY name"; + a.idtpl, a.name as name, a.description, a.idlay, b.description as laydescription, a.defaulttemplate + FROM + " . $cfg['tab']['tpl'] . " AS a + LEFT JOIN + " . $cfg['tab']['lay'] . " AS b + ON a.idlay=b.idlay + WHERE a.idtpl='" . Contenido_Security::toInteger($idtpl) . "' + ORDER BY name"; $db->query($sql); @@ -65,11 +65,11 @@ if (($action == "tpl_new") && (!$perm->have_perm_area_action_anyitem($area, $act } $sql = "SELECT - number, idmod - FROM - " . $cfg['tab']['container'] . " - WHERE - idtpl='" . Contenido_Security::toInteger($idtpl) . "'"; + number, idmod + FROM + " . $cfg['tab']['container'] . " + WHERE + idtpl='" . Contenido_Security::toInteger($idtpl) . "'"; $db->query($sql); while ($db->next_record()) { @@ -93,12 +93,12 @@ if (($action == "tpl_new") && (!$perm->have_perm_area_action_anyitem($area, $act $tpl2->next(); } $sql = "SELECT - idlay, name - FROM - " . $cfg['tab']['lay'] . " - WHERE - idclient='" . Contenido_Security::toInteger($client) . "' - ORDER BY name"; + idlay, name + FROM + " . $cfg['tab']['lay'] . " + WHERE + idclient='" . Contenido_Security::toInteger($client) . "' + ORDER BY name"; $db->query($sql); @@ -119,12 +119,12 @@ if (($action == "tpl_new") && (!$perm->have_perm_area_action_anyitem($area, $act $select = $tpl2->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true); $sql = "SELECT - idmod, name, type - FROM - " . $cfg['tab']['mod'] . " - WHERE - idclient='" . Contenido_Security::toInteger($client) . "' - ORDER BY name"; + idmod, name, type + FROM + " . $cfg['tab']['mod'] . " + WHERE + idclient='" . Contenido_Security::toInteger($client) . "' + ORDER BY name"; $db->query($sql); @@ -153,7 +153,6 @@ if (($action == "tpl_new") && (!$perm->have_perm_area_action_anyitem($area, $act $descr = new cHTMLTextarea("description", $description); $form->add(i18n("Description"), $descr->render()); - $standardcb = new cHTMLCheckbox("vdefault", 1, "", $vdefault); $form->add(i18n("Default"), $standardcb->toHTML(false)); @@ -165,7 +164,13 @@ if (($action == "tpl_new") && (!$perm->have_perm_area_action_anyitem($area, $act $raw_code = ($oLayout->virgin) ? "" : $oLayout->getLayout(); tplPreparseLayout($idlay, $raw_code); $tmp_returnstring = tplBrowseLayoutForContainers($idlay, $raw_code); - $a_container = explode("&", $tmp_returnstring); + var_dump($tmp_returnstring); + if(empty($tmp_returnstring)) { + $a_container = []; + } else { + $a_container = explode("&", $tmp_returnstring); + } + foreach ($a_container as $key => $value) { if ($value != 0) { // Loop through containers **************** @@ -212,7 +217,7 @@ if (($action == "tpl_new") && (!$perm->have_perm_area_action_anyitem($area, $act } $allowedtypes = tplGetContainerTypes($idlay, $value); - + foreach ($modules as $key => $val) { $option = new cHTMLOptionElement($val["name"], $key); @@ -250,5 +255,4 @@ if (($action == "tpl_new") && (!$perm->have_perm_area_action_anyitem($area, $act } $page->render(); -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/conlite/plugins/cl-mod-rewrite b/conlite/plugins/cl-mod-rewrite index 3217b73..06cc337 160000 --- a/conlite/plugins/cl-mod-rewrite +++ b/conlite/plugins/cl-mod-rewrite @@ -1 +1 @@ -Subproject commit 3217b73d08e1b76193f02d2d912134320ef40bfe +Subproject commit 06cc337092ed649df1ec738816ba6a3e59a8af0b