diff --git a/conlite/classes/class.security.php b/conlite/classes/class.security.php index db01960..2586f3c 100644 --- a/conlite/classes/class.security.php +++ b/conlite/classes/class.security.php @@ -1,4 +1,5 @@ 0 && self::isInteger($sValue) == false ) { + if (strlen($sValue) > 0 && self::isInteger($sValue) == false) { throw new Contenido_Security_Exception('Invalid call', $sParamName); } } @@ -368,8 +352,7 @@ class Contenido_Security * @return bool|void True on success otherwhise nothing. * @throws Contenido_Security_Exception if contenido parameter in request don't matches the required format */ - public static function checkRequestSession() - { + public static function checkRequestSession() { if (isset($_REQUEST['contenido']) && !preg_match('/^[0-9a-f]{32}$/', $_REQUEST['contenido'])) { if ($_REQUEST['contenido'] != '') { throw new Contenido_Security_Exception('Invalid call', 'contenido'); @@ -387,8 +370,7 @@ class Contenido_Security * @deprecated Use checkRequestSession() instead due to better naming conventions * @TODO: Should be removed, but later in few years... */ - public static function checkSession() - { + public static function checkSession() { return self::checkRequestSession(); } @@ -405,15 +387,14 @@ class Contenido_Security * * @return void */ - public static function checkFrontendGlobals() - { + public static function checkFrontendGlobals() { global $tmpchangelang, $savedlang, $lang, $changelang, $load_lang, $changeclient, $client, $load_client; if (isset($tmpchangelang) && is_numeric($tmpchangelang) && $tmpchangelang > 0) { // savelang is needed to set language before closing the page, see // {frontend_clientdir}/front_content.php before page_close() $savedlang = $lang; - $lang = $tmpchangelang; + $lang = $tmpchangelang; } // Check basic incomming data @@ -431,7 +412,7 @@ class Contenido_Security } // Change client - if (isset($changeclient)){ + if (isset($changeclient)) { $client = $changeclient; unset($lang); unset($load_lang); @@ -458,8 +439,7 @@ class Contenido_Security * @param boolean $bUndoAddSlashes Flag for undo addslashes (optional, default: true) * @return string Converted string */ - public static function escapeDB($sString, $oDB = null, $bUndoAddSlashes = true) - { + public static function escapeDB($sString, $oDB = null, $bUndoAddSlashes = true) { if (!is_object($oDB)) { return self::escapeString($sString); } else { @@ -477,8 +457,7 @@ class Contenido_Security * @param string $sString Input string * @return string Converted string */ - public static function escapeString($sString) - { + public static function escapeString($sString) { $sString = (string) $sString; if (defined('CONTENIDO_STRIPSLASHES')) { $sString = stripslashes($sString); @@ -493,8 +472,7 @@ class Contenido_Security * @param string $sString Input string * @return string Converted string */ - public static function unescapeDB($sString) - { + public static function unescapeDB($sString) { return stripslashes($sString); } diff --git a/conlite/classes/class.ui.php b/conlite/classes/class.ui.php index d34cbd2..08363be 100644 --- a/conlite/classes/class.ui.php +++ b/conlite/classes/class.ui.php @@ -1,4 +1,5 @@ link = $link; - } + function setLink($link) { + $this->link = $link; + } - function setJS ($type, $script) - { - $this->javascripts[$type] = $script; - } + function setJS($type, $script) { + $this->javascripts[$type] = $script; + } - function render() - { - global $sess, $cfg; + function render() { + global $sess, $cfg; - $tpl = new Template; + $tpl = new Template; - $tpl->reset(); - $tpl->set('s', 'SESSID', $sess->id); + $tpl->reset(); + $tpl->set('s', 'SESSID', $sess->id); - $scripts = ""; + $scripts = ""; - if (is_array($this->javascripts)) - { - foreach ($this->javascripts as $script) - { - $scripts .= ''; - } - } + if (is_array($this->javascripts)) { + foreach ($this->javascripts as $script) { + $scripts .= ''; + } + } - if (is_object($this->link)) - { - $tpl->set('s', 'LINK', $this->link->render() . $this->additional); - } else { - $tpl->set('s', 'LINK', ''); - } + if (is_object($this->link)) { + $tpl->set('s', 'LINK', $this->link->render() . $this->additional); + } else { + $tpl->set('s', 'LINK', ''); + } - $tpl->set('s', 'JAVASCRIPTS', $scripts); - $tpl->set('s', 'CAPTION', $this->caption); - $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_left_top']); + $tpl->set('s', 'JAVASCRIPTS', $scripts); + $tpl->set('s', 'CAPTION', $this->caption); + $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_left_top']); + } - - } - - function setAdditionalContent ($content) - { - $this->additional = $content; - } + function setAdditionalContent($content) { + $this->additional = $content; + } } -class UI_Menu -{ - var $link; - var $title; - var $caption; - var $javascripts; - var $type; - var $image; - var $alt; - var $actions; - var $padding; - var $imagewidth; - var $extra; - var $border; - var $show; - var $bgColor; +class UI_Menu { - function UI_Menu () - { - $this->padding = 2; - $this->border = 0; - $this->rowmark = true; - } + var $link; + var $title; + var $caption; + var $javascripts; + var $type; + var $image; + var $alt; + var $actions; + var $padding; + var $imagewidth; + var $extra; + var $border; + var $show; + var $bgColor; - function setTitle ($item, $title) - { - $this->title[$item] = $title; - } + function UI_Menu() { + $this->padding = 2; + $this->border = 0; + $this->rowmark = true; + } - function setRowmark ($rowmark = true) - { - $this->rowmark = $rowmark; - } + function setTitle($item, $title) { + $this->title[$item] = $title; + } - function setImage ($item, $image, $maxwidth = 0) - { - $this->image[$item] = $image; - $this->imagewidth[$item] = $maxwidth; - $this->show[$item] = $show; - } + function setRowmark($rowmark = true) { + $this->rowmark = $rowmark; + } - function setExtra ($item, $extra) - { - $this->extra[$item] = $extra; - } + function setImage($item, $image, $maxwidth = 0) { + $this->image[$item] = $image; + $this->imagewidth[$item] = $maxwidth; + $this->show[$item] = $show; + } - function setLink ($item, $link) - { - $this->link[$item] = $link; - } + function setExtra($item, $extra) { + $this->extra[$item] = $extra; + } - function setActions ($item, $key, $action) - { - $this->actions[$item][$key] = $action; - } + function setLink($item, $link) { + $this->link[$item] = $link; + } - function setPadding ($padding) - { - $this->padding = $padding; - } + function setActions($item, $key, $action) { + $this->actions[$item][$key] = $action; + } - function setBorder ($border) - { - $this->border = $border; - } + function setPadding($padding) { + $this->padding = $padding; + } - function setBgColor($item, $bgColor) - { - $this->bgColor[$item] = $bgColor; + function setBorder($border) { + $this->border = $border; + } - } + function setBgColor($item, $bgColor) { + $this->bgColor[$item] = $bgColor; + } - function render($print = true) - { - global $sess, $cfg; + function render($print = true) { + global $sess, $cfg; - $tpl = new Template; + $tpl = new Template; - $tpl->reset(); - $tpl->set('s', 'SID', $sess->id); + $tpl->reset(); + $tpl->set('s', 'SID', $sess->id); - $scripts = ""; + $scripts = ""; - if (is_array($this->javascripts)) - { + if (is_array($this->javascripts)) { - foreach ($this->javascripts as $script) - { - $scripts .= ''; - } - } + foreach ($this->javascripts as $script) { + $scripts .= ''; + } + } - #echo '
Debug (B.A.): ' . $scripts; - $tpl->set('s', 'JSACTIONS', $scripts); - $tpl->set('s', 'CELLPADDING', $this->padding); - $tpl->set('s', 'BORDER', $this->border); - $tpl->set('s', 'BORDERCOLOR', $cfg['color']['table_border']); + #echo '
Debug (B.A.): ' . $scripts; + $tpl->set('s', 'JSACTIONS', $scripts); + $tpl->set('s', 'CELLPADDING', $this->padding); + $tpl->set('s', 'BORDER', $this->border); + $tpl->set('s', 'BORDERCOLOR', $cfg['color']['table_border']); - if (is_array($this->link)) { - - $dark = false; - - foreach ($this->link as $key => $value) { - if ($value != NULL) - { - if ($this->imagewidth[$key] != 0) - { - $value->setContent(''); - $img = $value->render(); - } - else - { - $value->setContent(''); - $img = $value->render(); - } - $value->setContent($this->title[$key]); - $link = $value->render(); - } else { - $link = $this->title[$key]; + if (is_array($this->link)) { - if ($this->image[$key] != "") - { - if ($this->imagewidth[$key] != 0) - { - $img = ''; - } else { - $img = ''; - } - } else { - $img = " "; - } - } + $dark = false; - if(isset($this->bgColor[$key])) { - $bgColor = $this->bgColor[$key]; - } else { - $dark = !$dark; - if ($dark) { - $bgColor = $cfg["color"]["table_dark"]; - } else { - $bgColor = $cfg["color"]["table_light"]; - } + foreach ($this->link as $key => $value) { + if ($value != NULL) { + if ($this->imagewidth[$key] != 0) { + $value->setContent(''); + $img = $value->render(); + } else { + $value->setContent(''); + $img = $value->render(); + } + $value->setContent($this->title[$key]); + $link = $value->render(); + } else { + $link = $this->title[$key]; - if (isset($_GET['idworkflow']) && $_GET['idworkflow'] == $value) { - //$mlist->setExtra($iMenu, 'id="marked" '); - $bgColor = $cfg["color"]["table_light_active"]; - } + if ($this->image[$key] != "") { + if ($this->imagewidth[$key] != 0) { + $img = ''; + } else { + $img = ''; + } + } else { + $img = " "; + } + } - if ($this->extra[$key] == 'id="marked" ') { - $bgColor = $cfg["color"]["table_light_active"]; - } - } + if (isset($this->bgColor[$key])) { + $bgColor = $this->bgColor[$key]; + } else { + $dark = !$dark; + if ($dark) { + $bgColor = $cfg["color"]["table_dark"]; + } else { + $bgColor = $cfg["color"]["table_light"]; + } - $tpl->set('d', 'NAME', $link); + if (isset($_GET['idworkflow']) && $_GET['idworkflow'] == $value) { + //$mlist->setExtra($iMenu, 'id="marked" '); + $bgColor = $cfg["color"]["table_light_active"]; + } - if ($this->image[$key] == "") - { - $tpl->set('d', 'ICON', ''); - } - else - { - $tpl->set('d', 'ICON', $img); + if ($this->extra[$key] == 'id="marked" ') { + $bgColor = $cfg["color"]["table_light_active"]; + } + } + + $tpl->set('d', 'NAME', $link); + + if ($this->image[$key] == "") { + $tpl->set('d', 'ICON', ''); + } else { + $tpl->set('d', 'ICON', $img); + } + + if ($this->extra[$key] != "" || $this->rowmark == true) { + $extraadd = ""; + + if ($this->rowmark == true) { + $extraadd = 'onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)"'; + #echo '
Debug(B.A): ' . $extraadd; + } + $tpl->set('d', 'EXTRA', $this->extra[$key] . $extraadd); + } else { + $tpl->set('d', 'EXTRA', ''); + } + + $fullactions = ""; + if (is_array($this->actions[$key])) { + + $fullactions = ''; + + foreach ($this->actions[$key] as $key => $singleaction) { + $fullactions .= ''; + } + + $fullactions .= '
' . $singleaction . '
'; + } + + $tpl->set('d', 'ACTIONS', $fullactions); + $tpl->set('d', 'BGCOLOR', $bgColor); + $tpl->next(); + } + } + $rendered = $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_menu'], true); + + if ($print == true) { + echo $rendered; + } else { + return $rendered; + } + } + +} + +class UI_Table_Form { + + var $items; + var $captions; + var $id; + var $rownames; + var $itemType; + var $formname; + var $formmethod; + var $formaction; + var $formvars; + var $tableid; + var $tablebordercolor; + var $header; + var $cancelLink; + var $submitjs; + var $accesskey; + var $width; + + function UI_Table_Form($name, $action = "", $method = "post") { + global $sess, $cfg; + + $this->formname = $name; + + if ($action == "") { + $this->formaction = "main.php"; + } else { + $this->formaction = $action; + } + + $this->formmethod = $method; + + $this->tableid = ""; + $this->tablebordercolor = $cfg['color']['table_border']; + $this->setAccessKey('s'); + $this->custom = array(); + + $this->setActionButton("submit", $cfg['path']['contenido_fullhtml'] . "images/but_ok.gif", i18n("Save changes"), "s"); + } + + function setWidth($width) { + $this->width = $width; + } + + function setVar($name, $value) { + $this->formvars[$name] = $value; + } + + function add($caption, $field, $rowname = "", $style = "") { + $n = ""; + + if (is_array($field)) { + + foreach ($field as $value) { + if (is_object($value) && method_exists($value, "render")) { + $n .= $value->render(); + } else { + $n .= $value; + } } - if ($this->extra[$key] != "" || $this->rowmark == true) - { - $extraadd = ""; + $field = $n; + } + if (is_object($field) && method_exists($field, "render")) { + $n = $field->render(); + $field = $n; + } + if ($field == "") { + $field = " "; + } - if ($this->rowmark == true) - { - $extraadd = 'onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)"'; - #echo '
Debug(B.A): ' . $extraadd; - } - $tpl->set('d', 'EXTRA', $this->extra[$key] . $extraadd); - } else { - $tpl->set('d', 'EXTRA', ''); - } + if ($caption == "") { + $caption = " "; + } - $fullactions = ""; - if (is_array($this->actions[$key])) - { + $this->id++; + $this->items[$this->id] = $field; + $this->captions[$this->id] = $caption; - $fullactions = ''; + if ($rowname == "") { + $rowname = $this->id; + } - foreach ($this->actions[$key] as $key => $singleaction) - { - $fullactions .= ''; - } + $this->rownames[$this->id] = $rowname; - $fullactions .= '
'.$singleaction.'
'; - } + $this->styles[$this->id] = $style; + } - $tpl->set('d', 'ACTIONS', $fullactions); - $tpl->set('d', 'BGCOLOR', $bgColor); - $tpl->next(); - } + function addCancel($link) { + $this->cancelLink = $link; + } - } - $rendered = $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_menu'],true); + function addHeader($header) { + $this->header = $header; + } - if ($print == true) - { - echo $rendered; - } else { - return $rendered; - } - } + function addSubHeader($header) { + $this->id++; + $this->items[$this->id] = ''; + $this->captions[$this->id] = $header; + $this->itemType[$this->id] = 'subheader'; + } -} + function setSubmitJS($js) { + $this->submitjs = $js; + } -class UI_Table_Form -{ - var $items; - var $captions; - var $id; - var $rownames; - var $itemType; + function setAccessKey($key) { + $this->accessKey = $key; + } - var $formname; - var $formmethod; - var $formaction; - var $formvars; + function setActionEvent($id, $event) { + $this->custom[$id]["event"] = $event; + } - var $tableid; - var $tablebordercolor; + function setActionButton($id, $image, $description = "", $accesskey = false, $action = false) { + $this->custom[$id]["image"] = $image; + $this->custom[$id]["type"] = "actionsetter"; + $this->custom[$id]["action"] = $action; + $this->custom[$id]["description"] = $description; + $this->custom[$id]["accesskey"] = $accesskey; + $this->custom[$id]["event"] = ""; + } - var $header; - var $cancelLink; - var $submitjs; + function setConfirm($id, $title, $description) { + $this->custom[$id]["confirmtitle"] = $title; + $this->custom[$id]["confirmdescription"] = $description; + } - var $accesskey; - var $width; + function unsetActionButton($id) { + unset($this->custom[$id]); + } + function render($return = true) { + global $sess, $cfg; - function UI_Table_Form ($name, $action = "", $method = "post") - { - global $sess, $cfg; + $tpl = new Template; - $this->formname = $name; + $extra = ""; - if ($action == "") - { - $this->formaction = "main.php"; - } else { - $this->formaction = $action; - } + if ($this->submitjs != "") { + $fextra = 'onsubmit="' . $this->submitjs . '"'; + } else { + $fextra = ""; + } - $this->formmethod = $method; + $form = '
' . "\n"; + $this->formvars[$sess->name] = $sess->id; - $this->tableid = ""; - $this->tablebordercolor = $cfg['color']['table_border']; - $this->setAccessKey('s'); - $this->custom = array(); + if (is_array($this->formvars)) { + foreach ($this->formvars as $key => $value) { + $form .= '' . "\n"; + } + } - $this->setActionButton("submit", $cfg['path']['contenido_fullhtml']."images/but_ok.gif", i18n("Save changes"), "s"); + if (!array_key_exists("action", $this->formvars)) { + $form .= ''; + } - } + $tpl->set('s', 'FORM', $form); + $tpl->set('s', 'ID', $this->tableid); + $tpl->set('s', 'BORDERCOLOR', $this->tablebordercolor); - function setWidth ($width) - { - $this->width = $width; - } + if ($this->header != "") { + $header = ''; + $header .= '' . $this->header . ''; + } - function setVar ($name, $value) - { - $this->formvars[$name] = $value; - } + $tpl->set('s', 'HEADER', $header); - function add ($caption, $field, $rowname = "", $style = "") - { - $n = ""; + $dark = false; - if (is_array($field)) - { + if (is_array($this->items)) { + foreach ($this->items as $key => $value) { + if ($this->itemType[$key] == 'subheader') { + $subheader = ''; + $subheader .= '' . $this->captions[$key] . ''; - foreach ($field as $value) - { - if (is_object($value) && method_exists($value, "render")) - { - $n .= $value->render(); - } else { - $n .= $value; - } - } - - $field = $n; - } - if (is_object($field) && method_exists($field, "render")) - { - $n = $field->render(); - $field = $n; - } - if ($field == "") - { - $field = " "; - } - - if ($caption == "") - { - $caption = " "; - } - - $this->id++; - $this->items[$this->id] = $field; - $this->captions[$this->id] = $caption; - - if ($rowname == "") - { - $rowname = $this->id; - } - - $this->rownames[$this->id] = $rowname; - - $this->styles[$this->id] = $style; - } - - function addCancel ($link) - { - $this->cancelLink = $link; - } - - function addHeader ($header) - { - $this->header = $header; - } - - function addSubHeader ($header) - { - $this->id++; - $this->items[$this->id] = ''; - $this->captions[$this->id] = $header; - $this->itemType[$this->id] = 'subheader'; - } - - function setSubmitJS ($js) - { - $this->submitjs = $js; - } - - function setAccessKey ($key) - { - $this->accessKey = $key; - } - - function setActionEvent ($id, $event) - { - $this->custom[$id]["event"] = $event; - } - - function setActionButton ($id, $image, $description = "", $accesskey = false, $action = false) - { - $this->custom[$id]["image"] = $image; - $this->custom[$id]["type"] = "actionsetter"; - $this->custom[$id]["action"] = $action; - $this->custom[$id]["description"] = $description; - $this->custom[$id]["accesskey"] = $accesskey; - $this->custom[$id]["event"] = ""; - } - - function setConfirm ($id, $title, $description) - { - $this->custom[$id]["confirmtitle"] = $title; - $this->custom[$id]["confirmdescription"] = $description; - } - - function unsetActionButton ($id) - { - unset($this->custom[$id]); - } - - function render ($return = true) - { - global $sess, $cfg; - - $tpl = new Template; - - $extra = ""; - - if ($this->submitjs != "") - { - $fextra = 'onsubmit="'.$this->submitjs.'"'; - } else { - $fextra = ""; - } - - $form = ''."\n"; - $this->formvars[$sess->name] = $sess->id; - - if (is_array($this->formvars)) - { - foreach ($this->formvars as $key => $value) - { - $form .= ''."\n"; - } - } - - if (!array_key_exists("action", $this->formvars)) - { - $form .= ''; - } - - $tpl->set('s', 'FORM', $form); - $tpl->set('s', 'ID', $this->tableid); - $tpl->set('s', 'BORDERCOLOR', $this->tablebordercolor); - - if ($this->header != "") - { - $header = ''; - $header .= ''.$this->header.''; - } - - $tpl->set('s', 'HEADER', $header); - - $dark = false; - - if (is_array($this->items)) - { - foreach ($this->items as $key => $value) - { - if ($this->itemType[$key] == 'subheader') - { - $subheader = ''; - $subheader .= ''.$this->captions[$key].''; - - $tpl->set('d', 'SUBHEADER', $subheader); - } else - { - $tpl->set('d', 'SUBHEADER', ''); - $tpl->set('d', 'CATNAME', $this->captions[$key]); - $tpl->set('d', 'CATFIELD', $value); - $tpl->set('d', 'ROWNAME', $this->rownames[$key]); - $tpl->set('d', 'STYLES', $this->styles[$key]); + $tpl->set('d', 'SUBHEADER', $subheader); + } else { + $tpl->set('d', 'SUBHEADER', ''); + $tpl->set('d', 'CATNAME', $this->captions[$key]); + $tpl->set('d', 'CATFIELD', $value); + $tpl->set('d', 'ROWNAME', $this->rownames[$key]); + $tpl->set('d', 'STYLES', $this->styles[$key]); $tpl->set('d', 'PADDING_LEFT', '0'); - $dark = !$dark; + $dark = !$dark; - if ($dark) - { - $bgColor = $cfg["color"]["table_dark"]; - } - else - { - $bgColor = $cfg["color"]["table_light"]; - } + if ($dark) { + $bgColor = $cfg["color"]["table_dark"]; + } else { + $bgColor = $cfg["color"]["table_light"]; + } - $tpl->set('d', 'BGCOLOR', $bgColor); - $tpl->set('d', 'BORDERCOLOR', $this->tablebordercolor); - $tpl->next(); - } - } - } + $tpl->set('d', 'BGCOLOR', $bgColor); + $tpl->set('d', 'BORDERCOLOR', $this->tablebordercolor); + $tpl->next(); + } + } + } - $tpl->set('s', 'CONTENIDOPATH',$cfg["path"]["contenido_fullhtml"]); + $tpl->set('s', 'CONTENIDOPATH', $cfg["path"]["contenido_fullhtml"]); - if ($this->cancelLink != "") - { - $img = ''; + if ($this->cancelLink != "") { + $img = ''; - $tpl->set('s', 'CANCELLINK', ''.$img.''); - } else { - $tpl->set('s', 'CANCELLINK',''); - } + $tpl->set('s', 'CANCELLINK', '' . $img . ''); + } else { + $tpl->set('s', 'CANCELLINK', ''); + } - if ($this->accesskey != "") - { - $tpl->set('s', 'KEY', $this->accesskey); - } else { - $tpl->set('s', 'KEY', ''); - } + if ($this->accesskey != "") { + $tpl->set('s', 'KEY', $this->accesskey); + } else { + $tpl->set('s', 'KEY', ''); + } - $tpl->set('s', 'EXTRA', $extra); + $tpl->set('s', 'EXTRA', $extra); - $custombuttons = ""; + $custombuttons = ""; - foreach ($this->custom as $key => $value) - { - if ($value["accesskey"] != "") - { - $accesskey = 'accesskey="'.$value["accesskey"].'"'; - } else { - $accesskey = ""; - } + foreach ($this->custom as $key => $value) { + if ($value["accesskey"] != "") { + $accesskey = 'accesskey="' . $value["accesskey"] . '"'; + } else { + $accesskey = ""; + } - $onclick = ""; - if ($value["action"] !== false) - { + $onclick = ""; + if ($value["action"] !== false) { - if ($value["confirmtitle"] != "") - { - $action = '[\''; - $action .= addslashes('document.forms[\''.$this->formname.'\'].elements[\'action\'].value = \''.$value["action"].'\'').'\',\''; - $action .= addslashes('document.forms[\''.$this->formname.'\'].submit()'); - $action .= '\']'; + if ($value["confirmtitle"] != "") { + $action = '[\''; + $action .= addslashes('document.forms[\'' . $this->formname . '\'].elements[\'action\'].value = \'' . $value["action"] . '\'') . '\',\''; + $action .= addslashes('document.forms[\'' . $this->formname . '\'].submit()'); + $action .= '\']'; - $onclick = 'box.confirm(\''.$value["confirmtitle"].'\', \''.$value["confirmdescription"].'\', '.$action.');return false;'; - } else { - $onclick = 'document.forms[\''.$this->formname.'\'].elements[\'action\'].value = \''.$value["action"].'\';'; - } - } + $onclick = 'box.confirm(\'' . $value["confirmtitle"] . '\', \'' . $value["confirmdescription"] . '\', ' . $action . ');return false;'; + } else { + $onclick = 'document.forms[\'' . $this->formname . '\'].elements[\'action\'].value = \'' . $value["action"] . '\';'; + } + } - if ($value["event"] != "") - { - $onclick .= $value["event"]; - } + if ($value["event"] != "") { + $onclick .= $value["event"]; + } - $custombuttons .= ''; - } + $custombuttons .= ''; + } - $tpl->set('s', 'EXTRABUTTONS', $custombuttons); + $tpl->set('s', 'EXTRABUTTONS', $custombuttons); - $extra = ""; + $extra = ""; - if ($this->width != 0) - { - $extra .= 'width="'.$this->width.'"'; - } + if ($this->width != 0) { + $extra .= 'width="' . $this->width . '"'; + } - $tpl->set('s', 'EXTRAB', $extra); + $tpl->set('s', 'EXTRAB', $extra); $tpl->set('s', 'PADDING_LEFT', '0'); $tpl->set('s', 'ROWNAME', $this->id); - $rendered = $tpl->generate($cfg["path"]["contenido"].$cfg['path']['templates'] . $cfg['templates']['generic_table_form'],true); + $rendered = $tpl->generate($cfg["path"]["contenido"] . $cfg['path']['templates'] . $cfg['templates']['generic_table_form'], true); + + if ($return == true) { + return ($rendered); + } else { + echo $rendered; + } + } - if ($return == true) - { - return ($rendered); - } else { - echo $rendered; - } - } } -class UI_Form -{ - var $items; - var $content; - var $id; - var $rownames; +class UI_Form { - var $formname; - var $formmethod; - var $formaction; - var $formvars; - var $formtarget; + var $items; + var $content; + var $id; + var $rownames; + var $formname; + var $formmethod; + var $formaction; + var $formvars; + var $formtarget; var $formevent; + var $tableid; + var $tablebordercolor; + var $header; - var $tableid; - var $tablebordercolor; + public function __construct($name, $action = "", $method = "post", $target = "") { + global $sess, $cfg; - var $header; + $this->formname = $name; - public function __construct($name, $action = "", $method = "post", $target = "") - { - global $sess, $cfg; + if ($action == "") { + $this->formaction = "main.php"; + } else { + $this->formaction = $action; + } - $this->formname = $name; + $this->formmethod = $method; - if ($action == "") - { - $this->formaction = "main.php"; - } else { - $this->formaction = $action; - } + $this->formtarget = $target; + } - $this->formmethod = $method; + function setVar($name, $value) { + $this->formvars[$name] = $value; + } - $this->formtarget = $target; + function setEvent($event, $jsCall) { + $this->formevent = " on$event=\"$jsCall\""; + } - } + function add($field, $content = "") { + $this->id++; + $this->items[$this->id] = $field; + $this->content[$this->id] = $content; + } - function setVar ($name, $value) - { - $this->formvars[$name] = $value; - } + function render($return = true) { + global $sess, $cfg; - function setEvent ($event, $jsCall) - { - $this->formevent = " on$event=\"$jsCall\""; - } + $content = ""; - function add ($field, $content = "") - { - $this->id++; - $this->items[$this->id] = $field; - $this->content[$this->id] = $content; - } + $tpl = new Template; - function render ($return = true) - { - global $sess, $cfg; + $form = 'formname . '"'; + $form .= ' method="' . $this->formmethod . '"'; + $form .= ' action="' . $this->formaction . '"'; + if (!empty($this->formtarget)) + $form .= ' target="' . $this->formtarget . '"'; + $form .= ' ' . $this->formevent; + $form .= '>' . "\n"; + $this->formvars[$sess->name] = $sess->id; - $content = ""; + if (is_array($this->formvars)) { + foreach ($this->formvars as $key => $value) { + $form .= '' . "\n"; + } + } - $tpl = new Template; + $tpl->set('s', 'FORM', $form); - $form = 'formname.'"'; - $form .= ' method="'.$this->formmethod.'"'; - $form .= ' action="'.$this->formaction.'"'; - if(!empty($this->formtarget)) $form .= ' target="'.$this->formtarget.'"'; - $form .= ' '.$this->formevent; - $form .= '>'."\n"; - $this->formvars[$sess->name] = $sess->id; + if (is_array($this->items)) { + foreach ($this->items as $key => $value) { + $content .= $this->content[$key]; + } + } - if (is_array($this->formvars)) - { - foreach ($this->formvars as $key => $value) - { - $form .= ''."\n"; - } - } + $tpl->set('s', 'CONTENT', $content); - $tpl->set('s', 'FORM', $form); + $rendered = $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_form'], true); - if (is_array($this->items)) - { - foreach ($this->items as $key => $value) - { - $content .= $this->content[$key]; - } - } + if ($return == true) { + return ($rendered); + } else { + echo $rendered; + } + } - $tpl->set('s', 'CONTENT', $content); - - $rendered = $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_form'],true); - - if ($return == true) - { - return ($rendered); - } else { - echo $rendered; - } - } } -class UI_Page -{ - var $scripts; - var $content; - var $margin; +class UI_Page { - function UI_Page () - { - $this->margin = 10; - } + var $scripts; + var $content; + var $margin; - function setMargin ($margin) - { - $this->margin = $margin; - } + function UI_Page() { + $this->margin = 10; + } - function addScript ($name, $script) - { - $this->scripts[$name] = $script; - } + function setMargin($margin) { + $this->margin = $margin; + } - function setReload () - { - $this->scripts["__reload"] = - '"; - } + function addScript($name, $script) { + $this->scripts[$name] = $script; + } - function setContent ($content) - { - $this->content = $content; - } + function setReload() { + $this->scripts["__reload"] = '"; + } - function setMessageBox () - { - global $sess; - $this->scripts["__msgbox"] = - ''. - '' . + ''; - } + } - function render ($print = true) - { - global $sess, $cfg; + function render($print = true) { + global $sess, $cfg; - $tpl = new Template; + $tpl = new Template; - $scripts = ""; + $scripts = ""; - if (is_array($this->scripts)) - { - foreach ($this->scripts as $key => $value) - { - $scripts .= $value; - } - } + if (is_array($this->scripts)) { + foreach ($this->scripts as $key => $value) { + $scripts .= $value; + } + } - $tpl->set('s', 'SCRIPTS', $scripts); - $tpl->set('s', 'CONTENT', $this->content); - $tpl->set('s', 'MARGIN', $this->margin); - $tpl->set('s', 'EXTRA', ''); + $tpl->set('s', 'SCRIPTS', $scripts); + $tpl->set('s', 'CONTENT', $this->content); + $tpl->set('s', 'MARGIN', $this->margin); + $tpl->set('s', 'EXTRA', ''); - $rendered = $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_page'],false); + $rendered = $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_page'], false); + + if ($print == true) { + echo $rendered; + } else { + return $rendered; + } + } - if ($print == true) - { - echo $rendered; - } else { - return $rendered; - } - } } -class Link -{ - var $link; - var $title; - var $targetarea; - var $targetframe; - var $targetaction; - var $targetarea2; - var $targetframe2; - var $targetaction2; - var $caption; - var $javascripts; - var $type; - var $custom; - var $content; - var $attributes; - var $img_width; - var $img_height; - var $img_type; - var $img_attr; +class Link { - function setLink ($link) - { - $this->link = $link; - $this->type = "link"; - } + var $link; + var $title; + var $targetarea; + var $targetframe; + var $targetaction; + var $targetarea2; + var $targetframe2; + var $targetaction2; + var $caption; + var $javascripts; + var $type; + var $custom; + var $content; + var $attributes; + var $img_width; + var $img_height; + var $img_type; + var $img_attr; - function setCLink ($targetarea, $targetframe, $targetaction) - { - $this->targetarea = $targetarea; - $this->targetframe = $targetframe; - $this->targetaction = $targetaction; - $this->type = "clink"; - } + function setLink($link) { + $this->link = $link; + $this->type = "link"; + } - function setMultiLink ($righttoparea, $righttopaction, $rightbottomarea, $rightbottomaction) - { - $this->targetarea = $righttoparea; - $this->targetframe = 3; - $this->targetaction = $righttopaction; - $this->targetarea2 = $rightbottomarea; - $this->targetframe2 = 4; - $this->targetaction2 = $rightbottomaction; - $this->type = "multilink"; - } + function setCLink($targetarea, $targetframe, $targetaction) { + $this->targetarea = $targetarea; + $this->targetframe = $targetframe; + $this->targetaction = $targetaction; + $this->type = "clink"; + } - function setAlt ($alt) - { - $this->alt = $alt; - } + function setMultiLink($righttoparea, $righttopaction, $rightbottomarea, $rightbottomaction) { + $this->targetarea = $righttoparea; + $this->targetframe = 3; + $this->targetaction = $righttopaction; + $this->targetarea2 = $rightbottomarea; + $this->targetframe2 = 4; + $this->targetaction2 = $rightbottomaction; + $this->type = "multilink"; + } - function setCustom ($key, $value) - { - $this->custom[$key] = $value; - } + function setAlt($alt) { + $this->alt = $alt; + } - function setImage ($image) - { - $this->images = $image; - } + function setCustom($key, $value) { + $this->custom[$key] = $value; + } - function setJavascript ($js) - { - $this->javascripts = $js; - } + function setImage($image) { + $this->images = $image; + } - function setContent ($content) - { - $this->content = $content; - } + function setJavascript($js) { + $this->javascripts = $js; + } - function updateAttributes ($attributes) - { - $this->attributes = $attributes; - } + function setContent($content) { + $this->content = $content; + } - function render () - { - global $sess, $cfg; + function updateAttributes($attributes) { + $this->attributes = $attributes; + } - if ($this->alt != "") - { - $alt = 'alt="'.$this->alt.'" title="'.$this->alt.'" '; - } else { - $alt = " "; - } + function render() { + global $sess, $cfg; - if (is_array($this->custom)) - { - foreach ($this->custom as $key => $value) - { - $custom .= "&$key=$value"; - } - } + if ($this->alt != "") { + $alt = 'alt="' . $this->alt . '" title="' . $this->alt . '" '; + } else { + $alt = " "; + } - if (is_array($this->attributes)) - { - foreach ($this->attributes as $key => $value) - { - $attributes .= " $key=\"$value\" "; - } - } + if (is_array($this->custom)) { + foreach ($this->custom as $key => $value) { + $custom .= "&$key=$value"; + } + } - switch ($this->targetframe) - { - case 1: $target = "left_top"; break; - case 2: $target = "left_bottom"; break; - case 3: $target = "right_top"; break; - case 4: $target = "right_bottom"; break; - default: $target = ""; - } + if (is_array($this->attributes)) { + foreach ($this->attributes as $key => $value) { + $attributes .= " $key=\"$value\" "; + } + } - switch ($this->type) - { - case "link": - $link = ''; - break; - case "clink": + switch ($this->targetframe) { + case 1: $target = "left_top"; + break; + case 2: $target = "left_bottom"; + break; + case 3: $target = "right_top"; + break; + case 4: $target = "right_bottom"; + break; + default: $target = ""; + } - $link = ''; - break; - case "multilink": - $tmp_mstr = ''; - $mstr = sprintf($tmp_mstr, 'right_top', - $sess->url("main.php?area=".$this->targetarea."&frame=".$this->targetframe."&action=".$this->targetaction.$custom), - 'right_bottom', - $sess->url("main.php?area=".$this->targetarea2."&frame=".$this->targetframe2."&action=".$this->targetaction2.$custom)); - $link = $mstr; - break; - } + switch ($this->type) { + case "link": + $link = ''; + break; + case "clink": - if ($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); + $link = ''; + break; + case "multilink": + $tmp_mstr = ''; + $mstr = sprintf($tmp_mstr, 'right_top', $sess->url("main.php?area=" . $this->targetarea . "&frame=" . $this->targetframe . "&action=" . $this->targetaction . $custom), 'right_bottom', $sess->url("main.php?area=" . $this->targetarea2 . "&frame=" . $this->targetframe2 . "&action=" . $this->targetaction2 . $custom)); + $link = $mstr; + break; + } + + if ($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); + + return ($link . ''); + } + } - return ($link.''); - } - } } -class UI_List -{ - var $link; - var $title; - var $caption; - var $javascripts; - var $type; - var $image; - var $alt; - var $actions; - var $padding; - var $imagewidth; - var $extra; - var $border; - var $bgcolor; - var $solid; - var $width; +class UI_List { - function UI_List () - { - $this->padding = 2; - $this->border = 0; - } + var $link; + var $title; + var $caption; + var $javascripts; + var $type; + var $image; + var $alt; + var $actions; + var $padding; + var $imagewidth; + var $extra; + var $border; + var $bgcolor; + var $solid; + var $width; - function setWidth ($width) - { - $this->width = $width; - } + function UI_List() { + $this->padding = 2; + $this->border = 0; + } - function setCellAlignment ($item, $cell, $alignment) - { - $this->cellalignment[$item][$cell] = $alignment; - } + function setWidth($width) { + $this->width = $width; + } - function setCellVAlignment ($item, $cell, $alignment) - { - $this->cellvalignment[$item][$cell] = $alignment; - } + function setCellAlignment($item, $cell, $alignment) { + $this->cellalignment[$item][$cell] = $alignment; + } - function setBgColor ($item, $color) - { - $this->bgcolor[$item] = $color; - } + function setCellVAlignment($item, $cell, $alignment) { + $this->cellvalignment[$item][$cell] = $alignment; + } - function setCell ($item, $cell, $value) - { - $this->cells[$item][$cell] = $value; - $this->cellalignment[$item][$cell] = ""; - } + function setBgColor($item, $color) { + $this->bgcolor[$item] = $color; + } - function setCellExtra ($item, $cell, $extra) - { - $this->extra[$item][$cell] = $extra; - } + function setCell($item, $cell, $value) { + $this->cells[$item][$cell] = $value; + $this->cellalignment[$item][$cell] = ""; + } - function setPadding ($padding) - { - $this->padding = $padding; - } + function setCellExtra($item, $cell, $extra) { + $this->extra[$item][$cell] = $extra; + } - function setBorder ($border) - { - $this->border = $border; - } + function setPadding($padding) { + $this->padding = $padding; + } - function setExtra ($item, $extra) - { - $this->extra[$item] = $extra; - } + function setBorder($border) { + $this->border = $border; + } - function setSolidBorder ($solid) - { - $this->solid = $solid; - } + function setExtra($item, $extra) { + $this->extra[$item] = $extra; + } - function render($print = false) - { - global $sess, $cfg; + function setSolidBorder($solid) { + $this->solid = $solid; + } - $tpl = new Template; - $tpl2 = new Template; + function render($print = false) { + global $sess, $cfg; - $tpl->reset(); - $tpl->set('s', 'SID', $sess->id); + $tpl = new Template; + $tpl2 = new Template; - $tpl->set('s', 'CELLPADDING', $this->padding); - $tpl->set('s', 'BORDER', $this->border); - $tpl->set('s', 'BORDERCOLOR', $cfg['color']['table_border']); + $tpl->reset(); + $tpl->set('s', 'SID', $sess->id); - $colcount = 0; + $tpl->set('s', 'CELLPADDING', $this->padding); + $tpl->set('s', 'BORDER', $this->border); + $tpl->set('s', 'BORDERCOLOR', $cfg['color']['table_border']); - if (is_array($this->cells)) - { - foreach ($this->cells as $row => $cells) - { - $thefont=''; - $unne=''; - - if($colcount == 0) - { - $thefont='color: #666666;font-weight: normal;'; - } + $colcount = 0; - $colcount++; + if (is_array($this->cells)) { + foreach ($this->cells as $row => $cells) { + $thefont = ''; + $unne = ''; - $dark = !$dark; + if ($colcount == 0) { + $thefont = 'color: #666666;font-weight: normal;'; + } - if ($dark) { - $bgColor = $cfg["color"]["table_dark"]; - } else { - $bgColor = $cfg["color"]["table_light"]; - } + $colcount++; - if ($this->bgcolor[$row] != "") - { - $bgColor = $this->bgcolor[$row]; - } + $dark = !$dark; - $content = ""; - $count = 0; + if ($dark) { + $bgColor = $cfg["color"]["table_dark"]; + } else { + $bgColor = $cfg["color"]["table_light"]; + } - foreach ($cells as $key => $value) - { - $thefontDispl = $thefont.$this->extra[$row][$key]; - $count++; - $tpl2->reset(); + if ($this->bgcolor[$row] != "") { + $bgColor = $this->bgcolor[$row]; + } - if ($this->solid) - { - if ($count < count($cells)) - { - if ($colcount < count($this->cells)) - { - $tpl2->set('s', 'EXTRA', $thefontDispl.'border: 0px; border-right: 1px; border-color: #B3B3B3; border-style: solid;'); - } else { - $tpl2->set('s', 'EXTRA', $thefontDispl.'border: 0px; border-right: 1px; border-color: #B3B3B3; border-style: solid;'); - } - } else { - if ($colcount < count($this->cells)) - { - $tpl2->set('s', 'EXTRA', $thefontDispl.'border: 0px;border-color: #B3B3B3; border-style: solid;'); - } else { - $tpl2->set('s', 'EXTRA', $thefontDispl); - } - } - } + $content = ""; + $count = 0; - if($colcount > 0) - { - $tpl2->set('s', 'BORDERS', ';border-bottom:1px solid #B3B3B3;'); - } + foreach ($cells as $key => $value) { + $thefontDispl = $thefont . $this->extra[$row][$key]; + $count++; + $tpl2->reset(); - if ($this->cellalignment[$row][$key] != "") - { - $tpl2->set('s', 'ALIGN', $this->cellalignment[$row][$key]); - } else { - $tpl2->set('s', 'ALIGN', 'left'); - } + if ($this->solid) { + if ($count < count($cells)) { + if ($colcount < count($this->cells)) { + $tpl2->set('s', 'EXTRA', $thefontDispl . 'border: 0px; border-right: 1px; border-color: #B3B3B3; border-style: solid;'); + } else { + $tpl2->set('s', 'EXTRA', $thefontDispl . 'border: 0px; border-right: 1px; border-color: #B3B3B3; border-style: solid;'); + } + } else { + if ($colcount < count($this->cells)) { + $tpl2->set('s', 'EXTRA', $thefontDispl . 'border: 0px;border-color: #B3B3B3; border-style: solid;'); + } else { + $tpl2->set('s', 'EXTRA', $thefontDispl); + } + } + } - if ($this->cellvalignment[$row][$key] != "") - { - $tpl2->set('s', 'VALIGN', $this->cellvalignment[$row][$key]); - } else { - $tpl2->set('s', 'VALIGN', 'top'); - } + if ($colcount > 0) { + $tpl2->set('s', 'BORDERS', ';border-bottom:1px solid #B3B3B3;'); + } - $tpl2->set('s', 'CONTENT', $value); - $content .= $tpl2->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_list_row'],true); - } + if ($this->cellalignment[$row][$key] != "") { + $tpl2->set('s', 'ALIGN', $this->cellalignment[$row][$key]); + } else { + $tpl2->set('s', 'ALIGN', 'left'); + } - $tpl->set('d', 'ROWS', $content); - $tpl->set('d', 'BGCOLOR', $bgColor); - $tpl->next(); - } - } + if ($this->cellvalignment[$row][$key] != "") { + $tpl2->set('s', 'VALIGN', $this->cellvalignment[$row][$key]); + } else { + $tpl2->set('s', 'VALIGN', 'top'); + } - if ($this->width) - { - $tpl->set('s', 'EXTRA', 'width: '.$this->width.';'); - } - $rendered = $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_list'],true); + $tpl2->set('s', 'CONTENT', $value); + $content .= $tpl2->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_list_row'], true); + } + + $tpl->set('d', 'ROWS', $content); + $tpl->set('d', 'BGCOLOR', $bgColor); + $tpl->next(); + } + } + + if ($this->width) { + $tpl->set('s', 'EXTRA', 'width: ' . $this->width . ';'); + } + $rendered = $tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_list'], true); + + if ($print == true) { + echo $rendered; + } else { + return $rendered; + } + } - if ($print == true) - { - echo $rendered; - } else { - return $rendered; - } - } } /** * Class ScrollableList * Class for scrollable backend lists */ -class cScrollList -{ - /** +class cScrollList { + + /** * Data container * @var array */ - var $data = Array(); + var $data = Array(); - /** + /** * Header container * @var array */ - var $header = Array(); + var $header = Array(); - /** + /** * Number of records displayed per page * @var string */ - var $resultsPerPage; + var $resultsPerPage; - /** + /** * Start page * @var string */ - var $listStart; + var $listStart; - /** + /** * sortable flag * @var string */ - var $sortable; + var $sortable; - /** + /** * sortlink * @var string */ - var $sortlink; + var $sortlink; - /** + /** * Table item * */ - var $objTable; + var $objTable; - /** + /** * Header row * */ - var $objHeaderRow; + var $objHeaderRow; - /** + /** * Header item * */ - var $objHeaderItem; + var $objHeaderItem; - /** + /** * Header item * */ - var $objRow; + var $objRow; - /** + /** * Header item * */ - var $objItem; + var $objItem; - /* TODO: Shouldn't $area and $frame be parameters instead of global variables? */ - /** + /* TODO: Shouldn't $area and $frame be parameters instead of global variables? */ + + /** * Creates a new FrontendList object. - * - * @param $defaultstyle boolean use the default style for object initializing? + * + * @param $defaultstyle boolean use the default style for object initializing? */ - function cScrollList ($defaultstyle = true, $action = "") - { - global $cfg, $area, $frame; + function cScrollList($defaultstyle = true, $action = "") { + global $cfg, $area, $frame; - $this->resultsPerPage = 0; - $this->listStart = 1; - $this->sortable = false; + $this->resultsPerPage = 0; + $this->listStart = 1; + $this->sortable = false; - $this->objTable = new cHTMLTable; - if ($defaultstyle == true) - { - $this->objTable->setStyle('border-collapse:collapse;border: 1px; border-style: solid; border-top:0px;border-color: '.$cfg["color"]["table_border"].';'); - $this->objTable->updateAttributes(array("cellspacing" => 0, "cellpadding" => 2)); - } + $this->objTable = new cHTMLTable; + if ($defaultstyle == true) { + $this->objTable->setStyle('border-collapse:collapse;border: 1px; border-style: solid; border-top:0px;border-color: ' . $cfg["color"]["table_border"] . ';'); + $this->objTable->updateAttributes(array("cellspacing" => 0, "cellpadding" => 2)); + } - $this->objHeaderRow = new cHTMLTableRow; - if ($defaultstyle == true) - { - $this->objHeaderRow->setClass("text_medium"); - $this->objHeaderRow->setStyle("background-color: #E2E2E2;white-space:nowrap;"); - } + $this->objHeaderRow = new cHTMLTableRow; + if ($defaultstyle == true) { + $this->objHeaderRow->setClass("text_medium"); + $this->objHeaderRow->setStyle("background-color: #E2E2E2;white-space:nowrap;"); + } - $this->objHeaderItem = new cHTMLTableHead; - if ($defaultstyle == true) - { - $this->objHeaderItem->setClass("textg_medium"); - $this->objHeaderItem->setStyle('white-space:nowrap; border: 1px; border-style: solid;border-bottom: 0px;border-color: '.$cfg["color"]["table_border"].';'); - $this->objHeaderItem->updateAttributes(array("align" => "left")); - } + $this->objHeaderItem = new cHTMLTableHead; + if ($defaultstyle == true) { + $this->objHeaderItem->setClass("textg_medium"); + $this->objHeaderItem->setStyle('white-space:nowrap; border: 1px; border-style: solid;border-bottom: 0px;border-color: ' . $cfg["color"]["table_border"] . ';'); + $this->objHeaderItem->updateAttributes(array("align" => "left")); + } - $this->objRow = new cHTMLTableRow; - if ($defaultstyle == true) - { - $this->objRow->setClass("text_medium"); - } + $this->objRow = new cHTMLTableRow; + if ($defaultstyle == true) { + $this->objRow->setClass("text_medium"); + } - $this->objItem = new cHTMLTableData; - if ($defaultstyle == true) - { - $this->objItem->setStyle('white-space:nowrap; border: 1px; border-style: solid;border-top:0px;border-color: '.$cfg["color"]["table_border"].';'); - } + $this->objItem = new cHTMLTableData; + if ($defaultstyle == true) { + $this->objItem->setStyle('white-space:nowrap; border: 1px; border-style: solid;border-top:0px;border-color: ' . $cfg["color"]["table_border"] . ';'); + } - $this->sortlink = new cHTMLLink; - $this->sortlink->setStyle("color: #666666;"); - $this->sortlink->setCLink($area, $frame, $action); - } - - /** - * Sets the sortable flag for a specific row. - * - * $obj->setSortable(true); - * - * @param $sortable boolean true or false - */ - function setSortable ($key, $sortable) - { - $this->sortable[$key] = $sortable; + $this->sortlink = new cHTMLLink; + $this->sortlink->setStyle("color: #666666;"); + $this->sortlink->setCLink($area, $frame, $action); } - /** + /** + * Sets the sortable flag for a specific row. + * + * $obj->setSortable(true); + * + * @param $sortable boolean true or false + */ + function setSortable($key, $sortable) { + $this->sortable[$key] = $sortable; + } + + /** * Sets the custom parameters for sortable links - * - * $obj->setCustom($key, $custom); - * + * + * $obj->setCustom($key, $custom); + * * @param $key Custom entry key * @param $custom Custom entry value */ - function setCustom ($key, $custom) - { - $this->sortlink->setCustom($key, $custom); + function setCustom($key, $custom) { + $this->sortlink->setCustom($key, $custom); } - /** + /** * Is called when a new row is rendered - * + * * @param $row The current row which is being rendered */ - function onRenderRow ($row) - { - global $cfg; + function onRenderRow($row) { + global $cfg; - if ($row % 2) - { - $col = $cfg["color"]["table_dark"]; - } else { - $col = $cfg["color"]["table_light"]; - } + if ($row % 2) { + $col = $cfg["color"]["table_dark"]; + } else { + $col = $cfg["color"]["table_light"]; + } - $this->objRow->setStyle("white-space:nowrap; background-color: $col;"); - } + $this->objRow->setStyle("white-space:nowrap; background-color: $col;"); + } - /** + /** * Is called when a new column is rendered - * + * * @param $row The current column which is being rendered */ - function onRenderColumn ($column) - { - } + function onRenderColumn($column) { + + } - /** + /** * Sets header data. - * - * Note: This function eats as many parameters as you specify. - * - * Example: - * $obj->setHeader("foo", "bar"); - * - * Make sure that the amount of parameters stays the same for all - * setData calls in a single object. - * + * + * Note: This function eats as many parameters as you specify. + * + * Example: + * $obj->setHeader("foo", "bar"); + * + * Make sure that the amount of parameters stays the same for all + * setData calls in a single object. + * * @param $index Numeric index - * @param ... Additional parameters (data) + * @param ... Additional parameters (data) */ - function setHeader () - { - $numargs = func_num_args(); + function setHeader() { + $numargs = func_num_args(); - for ($i=0;$i<$numargs;$i++) - { - $this->header[$i] = func_get_arg($i); - } - } + for ($i = 0; $i < $numargs; $i++) { + $this->header[$i] = func_get_arg($i); + } + } - /** + /** * Sets data. - * - * Note: This function eats as many parameters as you specify. - * - * Example: - * $obj->setData(0, "foo", "bar"); - * - * Make sure that the amount of parameters stays the same for all - * setData calls in a single object. Also make sure that your index - * starts from 0 and ends with the actual number - 1. - * + * + * Note: This function eats as many parameters as you specify. + * + * Example: + * $obj->setData(0, "foo", "bar"); + * + * Make sure that the amount of parameters stays the same for all + * setData calls in a single object. Also make sure that your index + * starts from 0 and ends with the actual number - 1. + * * @param $index Numeric index - * @param ... Additional parameters (data) + * @param ... Additional parameters (data) */ - function setData ($index) - { - $numargs = func_num_args(); + function setData($index) { + $numargs = func_num_args(); - for ($i=1;$i<$numargs;$i++) - { - $this->data[$index][$i] = func_get_arg($i); - } - } + for ($i = 1; $i < $numargs; $i++) { + $this->data[$index][$i] = func_get_arg($i); + } + } - /** + /** * Sets hidden data. - * - * Note: This function eats as many parameters as you specify. - * - * Example: - * $obj->setHiddenData(0, "foo", "bar"); - * - * Make sure that the amount of parameters stays the same for all - * setData calls in a single object. Also make sure that your index - * starts from 0 and ends with the actual number - 1. - * + * + * Note: This function eats as many parameters as you specify. + * + * Example: + * $obj->setHiddenData(0, "foo", "bar"); + * + * Make sure that the amount of parameters stays the same for all + * setData calls in a single object. Also make sure that your index + * starts from 0 and ends with the actual number - 1. + * * @param $index Numeric index - * @param ... Additional parameters (data) + * @param ... Additional parameters (data) */ - function setHiddenData ($index) - { - $numargs = func_num_args(); + function setHiddenData($index) { + $numargs = func_num_args(); - for ($i=1;$i<$numargs;$i++) - { - $this->data[$index]["hiddendata"][$i] = func_get_arg($i); - } - } + for ($i = 1; $i < $numargs; $i++) { + $this->data[$index]["hiddendata"][$i] = func_get_arg($i); + } + } - /** + /** * Sets the number of records per page. - * + * * @param $numresults Amount of records per page */ - function setResultsPerPage ($numresults) - { - $this->resultsPerPage = $numresults; - } + function setResultsPerPage($numresults) { + $this->resultsPerPage = $numresults; + } - /** + /** * Sets the starting page number. - * + * * @param $startpage Page number on which the list display starts */ - function setListStart ($startpage) - { - $this->listStart = $startpage; - } + function setListStart($startpage) { + $this->listStart = $startpage; + } - /** + /** * Returns the current page. - * + * * @param $none - * @returns Current page number + * @returns Current page number */ - function getCurrentPage () - { - if ($this->resultsPerPage == 0) - { - return 1; - } + function getCurrentPage() { + if ($this->resultsPerPage == 0) { + return 1; + } - return ($this->listStart); - } + return ($this->listStart); + } - /** + /** * Returns the amount of pages. - * + * * @param $none - * @returns Amount of pages + * @returns Amount of pages */ - function getNumPages () - { - return (ceil(count($this->data) / $this->resultsPerPage)); - } + function getNumPages() { + return (ceil(count($this->data) / $this->resultsPerPage)); + } - /** + /** * Sorts the list by a given field and a given order. - * + * * @param $field Field index - * @param $order Sort order (see php's sort documentation) + * @param $order Sort order (see php's sort documentation) */ - function sort ($field, $order) - { - if ($order == "") - { - $order = SORT_ASC; - } + function sort($field, $order) { + if ($order == "") { + $order = SORT_ASC; + } - if ($order == "ASC") - { - $order = SORT_ASC; - } + if ($order == "ASC") { + $order = SORT_ASC; + } - if ($order == "DESC") - { - $order = SORT_DESC; - } + if ($order == "DESC") { + $order = SORT_DESC; + } - $this->sortkey = $field; - $this->sortmode = $order; + $this->sortkey = $field; + $this->sortmode = $order; - $field = $field + 1; - $this->data = array_csort($this->data, "$field", $order); + $field = $field + 1; + $this->data = array_csort($this->data, "$field", $order); + } - } - - /** + /** * Field converting facility. - * Needs to be overridden in the child class to work properbly. - * + * Needs to be overridden in the child class to work properbly. + * * @param $field Field index - * @param $value Field value + * @param $value Field value */ - function convert ($field, $value, $hiddendata) - { - return $value; - } + function convert($field, $value, $hiddendata) { + return $value; + } - /** + /** * Outputs or optionally returns - * + * * @param $return If true, returns the list */ - function render ($return = true) - { - global $cfg; + function render($return = true) { + + $currentpage = $this->getCurrentPage(); - $currentpage = $this->getCurrentPage(); + $itemstart = (($currentpage - 1) * $this->resultsPerPage) + 1; - $itemstart = (($currentpage-1)*$this->resultsPerPage)+1; + $headeroutput = ""; + $output = ""; - $headeroutput = ""; - $output = ""; + /* Render header */ + foreach ($this->header as $key => $value) { + if (is_array($this->sortable)) { + if (array_key_exists($key, $this->sortable) && $this->sortable[$key] == true) { + $this->sortlink->setContent($value); + $this->sortlink->setCustom("sortby", $key); - /* Render header */ - foreach ($this->header as $key => $value) - { - if (is_array($this->sortable)) - { - if (array_key_exists($key, $this->sortable) && $this->sortable[$key] == true) - { - $this->sortlink->setContent($value); - $this->sortlink->setCustom("sortby", $key); + if ($this->sortkey == $key && $this->sortmode == SORT_ASC) { + $this->sortlink->setCustom("sortmode", "DESC"); + } else { + $this->sortlink->setCustom("sortmode", "ASC"); + } - if ($this->sortkey == $key && $this->sortmode == SORT_ASC) - { - $this->sortlink->setCustom("sortmode", "DESC"); - } else { - $this->sortlink->setCustom("sortmode", "ASC"); - } + $this->objHeaderItem->setContent($this->sortlink->render()); + $headeroutput .= $this->objHeaderItem->render(); + } else { + $this->objHeaderItem->setContent($value); + $headeroutput .= $this->objHeaderItem->render(); + } + } else { + $this->objHeaderItem->setContent($value); + $headeroutput .= $this->objHeaderItem->render(); + } + $this->objHeaderItem->advanceID(); + } - $this->objHeaderItem->setContent($this->sortlink->render()); - $headeroutput .= $this->objHeaderItem->render(); - } else { - $this->objHeaderItem->setContent($value); - $headeroutput .= $this->objHeaderItem->render(); - } - } else { - $this->objHeaderItem->setContent($value); - $headeroutput .= $this->objHeaderItem->render(); - } - $this->objHeaderItem->advanceID(); - } + $this->objHeaderRow->setContent($headeroutput); - $this->objHeaderRow->setContent($headeroutput); + $headeroutput = $this->objHeaderRow->render(); - $headeroutput = $this->objHeaderRow->render(); + if ($this->resultsPerPage == 0) { + $itemend = count($this->data) - ($itemstart - 1); + } else { + $itemend = $currentpage * $this->resultsPerPage; + } - if ($this->resultsPerPage == 0) - { - $itemend = count($this->data) - ($itemstart-1); - } else { - $itemend = $currentpage*$this->resultsPerPage; - } + if ($itemend > count($this->data)) { + $itemend = count($this->data); + } - if ($itemend > count($this->data)) - { - $itemend = count($this->data); - } + for ($i = $itemstart; $i < $itemend + 1; $i++) { + $items = ""; - for ($i=$itemstart;$i<$itemend+1;$i++) - { - $items = ""; + $this->onRenderRow($i); - $this->onRenderRow($i); + foreach ($this->data[$i - 1] as $key => $value) { + $this->onRenderColumn($key); - foreach ($this->data[$i-1] as $key => $value) - { - $this->onRenderColumn($key); + if ($key != "hiddendata") { + $hiddendata = $this->data[$i - 1]["hiddendata"]; - if ($key != "hiddendata") - { - $hiddendata = $this->data[$i-1]["hiddendata"]; + $this->objItem->setContent($this->convert($key, $value, $hiddendata)); + $items .= $this->objItem->render(); + } + $this->objItem->advanceID(); + } - $this->objItem->setContent($this->convert($key, $value, $hiddendata)); - $items .= $this->objItem->render(); - } - $this->objItem->advanceID(); - } + $this->objRow->setContent($items); + $items = ""; - $this->objRow->setContent($items); - $items = ""; + $output .= $this->objRow->render(); + $this->objRow->advanceID(); + } - $output .= $this->objRow->render(); - $this->objRow->advanceID(); - } + $this->objTable->setContent($headeroutput . $output); - $this->objTable->setContent($headeroutput.$output); + $output = $this->objTable->render(); - $output = stripslashes($this->objTable->render()); - - if ($return == true) - { - return $output; - } else { - echo $output; - } - } + if ($return == true) { + return $output; + } else { + echo $output; + } + } } ?> \ No newline at end of file diff --git a/conlite/classes/widgets/class.widgets.page.php b/conlite/classes/widgets/class.widgets.page.php index 85914ea..ae6d464 100644 --- a/conlite/classes/widgets/class.widgets.page.php +++ b/conlite/classes/widgets/class.widgets.page.php @@ -128,17 +128,6 @@ class cPage extends cHTML { } } - /** - * old constructor - * - * @deprecated since version 2.0.0 - * @param obj $object - */ - public function cPage($object = false) { - cDeprecated(__FILE__, __LINE__, "Deprecated method call, use __construct()"); - self::__construct($object); - } - /** * use HTML5 for page output */ diff --git a/conlite/includes/functions.general.php b/conlite/includes/functions.general.php index 5610ce2..de82584 100644 --- a/conlite/includes/functions.general.php +++ b/conlite/includes/functions.general.php @@ -787,8 +787,7 @@ function setSystemProperty($type, $name, $value, $idsystemprop = 0) { } $idsystemprop = Contenido_Security::toInteger($idsystemprop); - - $db_systemprop = new DB_ConLite; + $db_systemprop = new DB_ConLite(); if ($idsystemprop == 0) { $sql = "SELECT idsystemprop FROM " . $cfg["tab"]["system_prop"] . " WHERE type='" . Contenido_Security::escapeDB($type, $db_systemprop) . "' AND name='" . Contenido_Security::escapeDB($name, $db_systemprop) . "'"; diff --git a/conlite/includes/include.clientsettings.php b/conlite/includes/include.clientsettings.php index 82b9a6e..07af3c6 100644 --- a/conlite/includes/include.clientsettings.php +++ b/conlite/includes/include.clientsettings.php @@ -1,4 +1,5 @@ setVar('area',$area); +$oFrmRange->setVar('area', $area); $oFrmRange->setVar('frame', $frame); $oFrmRange->setVar('idclient', $idclient); $oFrmRange->addHeader(i18n('Select range')); -$oSelRange = new cHTMLSelectElement ('idclientslang'); -$oOption = new cHTMLOptionElement(i18n("Language independent"), 0); +$oSelRange = new cHTMLSelectElement('idclientslang'); +$oOption = new cHTMLOptionElement(i18n("Language independent"), 0); $oSelRange->addOptionElement(0, $oOption); $sSQL = "SELECT A.name AS name, A.idlang AS idlang, B.idclientslang AS idclientslang FROM - ".$cfg["tab"]["lang"]." AS A, - ".$cfg["tab"]["clients_lang"]." AS B + " . $cfg["tab"]["lang"] . " AS A, + " . $cfg["tab"]["clients_lang"] . " AS B WHERE A.idlang=B.idlang AND - B.idclient='".Contenido_Security::toInteger($idclient)."' + B.idclient='" . Contenido_Security::toInteger($idclient) . "' ORDER BY A.idlang"; - + $db->query($sSQL); while ($db->next_record()) { - $iID = $db->f("idclientslang"); - $oOption = new cHTMLOptionElement($db->f("name")." (".$db->f("idlang").")", $iID); - $oSelRange->addOptionElement($iID, $oOption); + $iID = $db->f("idclientslang"); + $oOption = new cHTMLOptionElement($db->f("name") . " (" . $db->f("idlang") . ")", $iID); + $oSelRange->addOptionElement($iID, $oOption); } if (is_numeric($_REQUEST["idclientslang"])) { - $oSelRange->setDefault($_REQUEST["idclientslang"]); + $oSelRange->setDefault($_REQUEST["idclientslang"]); } $oSelRange->setStyle('border:1px;border-style:solid;border-color:black;'); $oSelRange->setEvent("onchange", "document.forms.range.submit();"); -$oFrmRange->add(i18n('Range'),$oSelRange->render()); +$oFrmRange->add(i18n('Range'), $oSelRange->render()); if (!is_numeric($_REQUEST["idclientslang"]) || $_REQUEST["idclientslang"] == 0) { - $oClient = new cApiClient($idclient); + $oClient = new cApiClient($idclient); } else { - $oClient = new cApiClientLanguage(); - $oClient->loadByPrimaryKey($_REQUEST["idclientslang"]); + $oClient = new cApiClientLanguage(); + $oClient->loadByPrimaryKey($_REQUEST["idclientslang"]); } -if ($_POST['action'] == 'clientsettings_save_item') -{ - $oClient->setProperty($_POST['cstype'], $_POST['csname'], $_POST['csvalue'], $_POST['csidproperty']); +if ($_POST['action'] == 'clientsettings_save_item') { + $oClient->setProperty(trim($_POST['cstype']), trim($_POST['csname']), trim($_POST['csvalue']), trim($_POST['csidproperty'])); } -if ($_GET['action'] == 'clientsettings_delete_item') -{ - $oClient->deletePropertyById($_GET['idprop']); +if ($_GET['action'] == 'clientsettings_delete_item') { + $oClient->deletePropertyById($_GET['idprop']); } $oList->setHeader(i18n('Type'), i18n('Name'), i18n('Value'), ' '); @@ -101,108 +98,108 @@ $oList->objRow->updateAttributes(array('valign' => 'top')); $aItems = $oClient->getProperties(); -if ($aItems !== false) -{ +if ($aItems !== false) { $oLnkDelete = new Link; $oLnkDelete->setCLink($area, $frame, "clientsettings_delete_item"); - $oLnkDelete->setContent(''.i18n('); + $oLnkDelete->setContent('' . i18n('); $oLnkDelete->setCustom("idclient", $idclient); $oLnkDelete->setCustom("idclientslang", $_REQUEST["idclientslang"]); - - $oLnkEdit = new Link; - $oLnkEdit->setCLink($area, $frame, "clientsettings_edit_item"); - $oLnkEdit->setContent(''.i18n('); - $oLnkEdit->setCustom("idclient", $idclient); - $oLnkEdit->setCustom("idclientslang", $_REQUEST["idclientslang"]); - - $iCounter = 0; - foreach($aItems as $iKey => $aValue) - { - $oLnkDelete->setCustom("idprop", $iKey); - $oLnkEdit->setCustom("idprop", $iKey); - - if (($_GET['action'] == "clientsettings_edit_item") && ($_GET['idprop'] == $iKey)) - { - $oForm = new UI_Form("clientsettings"); - $oForm->setVar("area",$area); - $oForm->setVar("frame", $frame); - $oForm->setVar("action", "clientsettings_save_item"); - $oForm->setVar("idclient", $idclient); - $oForm->setVar("idclientslang", $_REQUEST["idclientslang"]); - - $oInputboxValue = new cHTMLTextbox ("csvalue", $aValue['value']); - $oInputboxValue->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); - - $oInputboxName = new cHTMLTextbox ("csname", $aValue['name']); - $oInputboxName->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); - - $oInputboxType = new cHTMLTextbox ("cstype", $aValue['type']); - $oInputboxType->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); - - $hidden = ''; - $sSubmit = ' '; - $oList->setData($iCounter, $oInputboxType->render(), $oInputboxName->render(), $oInputboxValue->render().$hidden.$sSubmit, $oLnkEdit->render() . '   ' . $oLnkDelete->render()); - } else - { + $oLnkEdit = new Link; + $oLnkEdit->setCLink($area, $frame, "clientsettings_edit_item"); + $oLnkEdit->setContent('' . i18n('); + $oLnkEdit->setCustom("idclient", $idclient); + $oLnkEdit->setCustom("idclientslang", $_REQUEST["idclientslang"]); + + $iCounter = 0; + foreach ($aItems as $iKey => $aValue) { + $oLnkDelete->setCustom("idprop", $iKey); + $oLnkEdit->setCustom("idprop", $iKey); + + if (($_GET['action'] == "clientsettings_edit_item") && ($_GET['idprop'] == $iKey)) { + $oForm = new UI_Form("clientsettings"); + $oForm->setVar("area", $area); + $oForm->setVar("frame", $frame); + $oForm->setVar("action", "clientsettings_save_item"); + $oForm->setVar("idclient", $idclient); + $oForm->setVar("idclientslang", $_REQUEST["idclientslang"]); + + $oInputboxValue = new cHTMLTextbox("csvalue", cSecurity::escapeString(clHtmlSpecialChars($aValue['value']))); + $oInputboxValue->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); + + $oInputboxName = new cHTMLTextbox("csname", cSecurity::escapeString(clHtmlSpecialChars($aValue['name']))); + $oInputboxName->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); + + $oInputboxType = new cHTMLTextbox("cstype", cSecurity::escapeString(clHtmlSpecialChars($aValue['type']))); + $oInputboxType->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); + + $hidden = ''; + $sSubmit = ' '; + + $oList->setData($iCounter, $oInputboxType->render(), $oInputboxName->render(), $oInputboxValue->render() . $hidden . $sSubmit, $oLnkEdit->render() . '   ' . $oLnkDelete->render()); + } else { $sMouseoverTemplate = '%s'; - + if (strlen($aValue['type']) > 35) { $sShort = clHtmlSpecialChars(capiStrTrimHard($aValue['type'], 35)); - $aValue['type'] = sprintf($sMouseoverTemplate, clHtmlSpecialChars(addslashes($aValue['type']), ENT_QUOTES), $sShort); + $aValue['type'] = sprintf($sMouseoverTemplate, cSecurity::escapeString(clHtmlSpecialChars($aValue['type'])), cSecurity::escapeString($sShort)); + } else { + $aValue['type'] = clHtmlEntities($aValue['type']); } - - if (strlen($aValue['value']) > 35) { - $sShort = clHtmlSpecialChars(capiStrTrimHard($aValue['value'], 35)); - $aValue['value'] = sprintf($sMouseoverTemplate, clHtmlSpecialChars(addslashes($aValue['value']), ENT_QUOTES), $sShort); - } - + if (strlen($aValue['name']) > 35) { $sShort = clHtmlSpecialChars(capiStrTrimHard($aValue['name'], 35)); - $aValue['name'] = sprintf($sMouseoverTemplate, clHtmlSpecialChars(addslashes($aValue['name']), ENT_QUOTES), $sShort); + $aValue['name'] = sprintf($sMouseoverTemplate, cSecurity::escapeString(clHtmlSpecialChars($aValue['name'])), cSecurity::escapeString($sShort)); + } else { + $aValue['name'] = clHtmlEntities($aValue['name']); } - - $oList->setData($iCounter, $aValue['type'], $aValue['name'], $aValue['value'], $oLnkEdit->render() . '   ' . $oLnkDelete->render()); - } - $iCounter++; + + if (strlen($aValue['value']) > 35) { + $sShort = clHtmlSpecialChars(capiStrTrimHard($aValue['value'], 35)); + $aValue['value'] = sprintf($sMouseoverTemplate, cSecurity::escapeString(clHtmlSpecialChars($aValue['value'])), cSecurity::escapeString($sShort)); + } else { + $aValue['value'] = clHtmlEntities($aValue['value']); + } + + $oList->setData($iCounter, $aValue['type'], $aValue['name'], $aValue['value'], $oLnkEdit->render() . '   ' . $oLnkDelete->render()); + } + $iCounter++; } -} else -{ - $oList->objItem->updateAttributes(array('colspan' => 4)); - $oList->setData(0, i18n("No defined properties")); +} else { + $oList->objItem->updateAttributes(array('colspan' => 4)); + $oList->setData(0, i18n("No defined properties")); } $oForm = new UI_Table_Form('clientsettings'); -$oForm->setVar('area',$area); +$oForm->setVar('area', $area); $oForm->setVar('frame', $frame); $oForm->setVar('action', 'clientsettings_save_item'); $oForm->setVar('idclient', $idclient); $oForm->setVar('idclientslang', $_REQUEST["idclientslang"]); $oForm->addHeader(i18n('Add new variable')); -$oInputbox = new cHTMLTextbox ('cstype'); +$oInputbox = new cHTMLTextbox('cstype'); $oInputbox->setStyle('border:1px;border-style:solid;border-color:black;'); -$oForm->add(i18n('Type'),$oInputbox->render()); +$oForm->add(i18n('Type'), $oInputbox->render()); -$oInputbox = new cHTMLTextbox ('csname'); +$oInputbox = new cHTMLTextbox('csname'); $oInputbox->setStyle('border:1px;border-style:solid;border-color:black;'); -$oForm->add(i18n('Name'),$oInputbox->render()); +$oForm->add(i18n('Name'), $oInputbox->render()); -$oInputbox = new cHTMLTextbox ('csvalue'); +$oInputbox = new cHTMLTextbox('csvalue'); $oInputbox->setStyle('border:1px;border-style:solid;border-color:black;'); -$oForm->add(i18n('Value'),$oInputbox->render()); +$oForm->add(i18n('Value'), $oInputbox->render()); -if (($_GET['action'] == "clientsettings_edit_item")) -{ +if (($_GET['action'] == "clientsettings_edit_item")) { $oForm2 = new UI_Form("clientsettings"); - $oForm2->setVar("area",$area); + $oForm2->setVar("area", $area); $oForm2->setVar("frame", $frame); $oForm2->setVar("action", "clientsettings_save_item"); $oForm2->setVar("idclient", $idclient); $oForm2->setVar("idclientslang", $_REQUEST["idclientslang"]); - + $oForm2->add('list', $oList->render()); - $sSettingsList = $oForm2->render(); + $sSettingsList = $oForm2->render(); } else { $sSettingsList = $oList->render(); } @@ -211,6 +208,6 @@ $sTooltippScript = ''; $oPage->addScript('tooltippstyle', ''); -$oPage->setContent($sTooltippScript."\n".$oFrmRange->render() . '
' . $sSettingsList . '
' . $oForm->render()); +$oPage->setContent($sTooltippScript . "\n" . $oFrmRange->render() . '
' . $sSettingsList . '
' . $oForm->render()); $oPage->render(); ?> \ No newline at end of file diff --git a/conlite/includes/include.systemsettings.php b/conlite/includes/include.systemsettings.php index 67be896..42a0a83 100644 --- a/conlite/includes/include.systemsettings.php +++ b/conlite/includes/include.systemsettings.php @@ -1,4 +1,5 @@ returnNotification("warning", i18n('Please set this property in systemsettings directly'), 1).'
'; + $sWarning = $notification->returnNotification("warning", i18n('Please set this property in systemsettings directly'), 1) . '
'; } } -if ($action == "systemsettings_delete_item") -{ - deleteSystemProperty($systype, $sysname); +if ($action == "systemsettings_delete_item") { + deleteSystemProperty($systype, $sysname); } $settings = getSystemProperties(1); $list = new UI_List; $list->setSolidBorder(true); -$list->setCell(1,1, i18n("Type")); -$list->setCell(1,2, i18n("Name")); -$list->setCell(1,3, i18n("Value")); -$list->setCell(1,4, " "); -$list->setBgColor(1,$cfg['color']['table_header']); +$list->setCell(1, 1, i18n("Type")); +$list->setCell(1, 2, i18n("Name")); +$list->setCell(1, 3, i18n("Value")); +$list->setCell(1, 4, " "); +$list->setBgColor(1, $cfg['color']['table_header']); $list->setBorder(1); $count = 2; $oLinkEdit = new Link; $oLinkEdit->setCLink($area, $frame, "systemsettings_edit_item"); -$oLinkEdit->setContent(''.i18n('); +$oLinkEdit->setContent('' . i18n('); $oLinkForward = new Link; $oLinkForward->setCLink('system_configuration', $frame, ""); -$oLinkForward->setContent(''.i18n('); +$oLinkForward->setContent('' . i18n('); $oLinkDelete = new Link; $oLinkDelete->setCLink($area, $frame, "systemsettings_delete_item"); -$oLinkDelete->setContent(''.i18n('); +$oLinkDelete->setContent('' . i18n('); -$oLinkDeleteForward = ''.i18n('; +$oLinkDeleteForward = '' . i18n('; $spacer = new cHTMLImage; $spacer->setWidth(5); -if (is_array($settings)) -{ - foreach ($settings as $key => $types) - { - foreach ($types as $type => $value) - { - $oLinkEdit->setCustom("sysname", urlencode($type)); - $oLinkEdit->setCustom("systype", urlencode($key)); - - $oLinkDelete->setCustom("sysname", urlencode($type)); - $oLinkDelete->setCustom("systype", urlencode($key)); +if (is_array($settings)) { + foreach ($settings as $key => $types) { + foreach ($types as $type => $value) { + $oLinkEdit->setCustom("sysname", urlencode($type)); + $oLinkEdit->setCustom("systype", urlencode($key)); + + $oLinkDelete->setCustom("sysname", urlencode($type)); + $oLinkDelete->setCustom("systype", urlencode($key)); $link = $oLinkEdit; $dlink = $oLinkDelete->render(); - if (in_array($key.'_'.$type, $aManagedValues)) { + if (in_array($key . '_' . $type, $aManagedValues)) { #ignore record - } else if (($action == "systemsettings_edit_item") && (stripslashes($systype) == $key) && (stripslashes($sysname) == $type)) { - $oInputboxValue = new cHTMLTextbox ("sysvalue", $value['value']); - $oInputboxValue->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); - - $oInputboxName = new cHTMLTextbox ("sysname", $type); - $oInputboxName->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); - - $oInputboxType = new cHTMLTextbox ("systype", $key); - $oInputboxType->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); - - $hidden = ''; - $sSubmit = ''; - - $list->setCell($count,1, $oInputboxType->render(true)); - $list->setCell($count,2, $oInputboxName->render(true)); - $list->setCell($count,3, $oInputboxValue->render(true).$hidden.$sSubmit); - - } else { + $oInputboxValue = new cHTMLTextbox("sysvalue", $value['value']); + $oInputboxValue->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); + + $oInputboxName = new cHTMLTextbox("sysname", $type); + $oInputboxName->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); + + $oInputboxType = new cHTMLTextbox("systype", $key); + $oInputboxType->setStyle("border:1px;border-style:solid;border-color:black;width:200px;"); + + $hidden = ''; + $sSubmit = ''; + + $list->setCell($count, 1, $oInputboxType->render(true)); + $list->setCell($count, 2, $oInputboxName->render(true)); + $list->setCell($count, 3, $oInputboxValue->render(true) . $hidden . $sSubmit); + } else { $sMouseoverTemplate = '%s'; - + + if (strlen($key) > 35) { + $sShort = htmlspecialchars(capiStrTrimHard($key, 35)); + $key = sprintf($sMouseoverTemplate, clHtmlSpecialChars(addslashes($key), ENT_QUOTES), $sShort); + } else { + $key = cSecurity::escapeString($key); + } if (strlen($type) > 35) { $sShort = clHtmlSpecialChars(capiStrTrimHard($type, 35)); $type = sprintf($sMouseoverTemplate, clHtmlSpecialChars(addslashes($type), ENT_QUOTES), $sShort); + } else { + $type = cSecurity::escapeString($type); } - + if (strlen($value['value']) > 35) { $sShort = clHtmlSpecialChars(capiStrTrimHard($value['value'], 35)); - $value['value'] = sprintf($sMouseoverTemplate, clHtmlSpecialChars(addslashes($value['value']), ENT_QUOTES), $sShort); + $value['value'] = sprintf($sMouseoverTemplate, clHtmlEntities(addslashes($value['value'])), $sShort); + } else { + $value['value'] = clHtmlEntities($value['value']); } - - if (strlen($key) > 35) { - $sShort = clHtmlSpecialChars(capiStrTrimHard($key, 35)); - $key = sprintf($sMouseoverTemplate, clHtmlSpecialChars(addslashes($key), ENT_QUOTES), $sShort); - } - - !strlen(trim($value['value'])) ? $sValue = ' ' : $sValue = $value['value']; - - $list->setCell($count,1, $key); - $list->setCell($count,2, $type); - $list->setCell($count,3, $sValue); - } - - if (!in_array($key.'_'.$type, $aManagedValues)) { - $list->setCell($count,4, $spacer->render().$link->render().$spacer->render().$dlink.$spacer->render()); + !strlen(trim($value['value'])) ? $sValue = ' ' : $sValue = $value['value']; + + $list->setCell($count, 1, $key); + $list->setCell($count, 2, $type); + $list->setCell($count, 3, $sValue); + } + + if (!in_array($key . '_' . $type, $aManagedValues)) { + $list->setCell($count, 4, $spacer->render() . $link->render() . $spacer->render() . $dlink . $spacer->render()); $count++; } - } + } } } -if ($count == 2) -{ - $list->setCell($count, 4, ""); - $list->setCell($count, 1, i18n("No defined properties")); - $list->setCell($count, 2, ""); - $list->setCell($count, 3, ""); +if ($count == 2) { + $list->setCell($count, 4, ""); + $list->setCell($count, 1, i18n("No defined properties")); + $list->setCell($count, 2, ""); + $list->setCell($count, 3, ""); } unset($form); $form = new UI_Table_Form("systemsettings"); -$form->setVar("area",$area); +$form->setVar("area", $area); $form->setVar("frame", $frame); $form->setVar("action", "systemsettings_save_item"); $form->addHeader(i18n("Add new variable")); -$inputbox = new cHTMLTextbox ("systype"); +$inputbox = new cHTMLTextbox("systype"); $inputbox->setStyle("border:1px;border-style:solid;border-color:black;"); -$form->add(i18n("Type"),$inputbox->render()); +$form->add(i18n("Type"), $inputbox->render()); -$inputbox = new cHTMLTextbox ("sysname"); +$inputbox = new cHTMLTextbox("sysname"); $inputbox->setStyle("border:1px;border-style:solid;border-color:black;"); -$form->add(i18n("Name"),$inputbox->render()); +$form->add(i18n("Name"), $inputbox->render()); -$inputbox = new cHTMLTextbox ("sysvalue"); +$inputbox = new cHTMLTextbox("sysvalue"); $inputbox->setStyle("border:1px;border-style:solid;border-color:black;"); -$form->add(i18n("Value"),$inputbox->render()); +$form->add(i18n("Value"), $inputbox->render()); -if ($action == "systemsettings_edit_item") -{ +if ($action == "systemsettings_edit_item") { $form2 = new UI_Form("systemsettings"); - $form2->setVar("area",$area); + $form2->setVar("area", $area); $form2->setVar("frame", $frame); $form2->setVar("action", "systemsettings_save_item"); $form2->add('list', $list->render()); @@ -194,7 +189,6 @@ $sTooltippScript = ''; $page->addScript('tooltippstyle', ''); -$page->setContent($sWarning.$sTooltippScript."\n".$sListstring."
".$form->render()); +$page->setContent($sWarning . $sTooltippScript . "\n" . $sListstring . "
" . $form->render()); $page->render(); - ?> \ No newline at end of file diff --git a/data/config/production/config.autoloader.php b/data/config/production/config.autoloader.php index 6629a23..c9d6373 100644 --- a/data/config/production/config.autoloader.php +++ b/data/config/production/config.autoloader.php @@ -31,7 +31,7 @@ * @since file available since Contenido release >= 4.8.15 * * {@internal - * created 2017-03-09 + * created 2017-06-09 * }} */