From ebcabff316e74335ca9c853e527a1e70b653c28c Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Thu, 16 Dec 2021 14:32:07 +0100 Subject: [PATCH 01/25] fix phpversion check set new phpversion limits --- setup/lib/defines.php | 4 ++-- setup/lib/startup.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/setup/lib/defines.php b/setup/lib/defines.php index 78702f9..eec6cc1 100644 --- a/setup/lib/defines.php +++ b/setup/lib/defines.php @@ -38,5 +38,5 @@ define('C_SETUP_STEPFILE_ACTIVE', 'images/steps/s%da.png'); define('C_SETUP_STEPWIDTH', 28); define('C_SETUP_STEPHEIGHT', 28); define('C_SETUP_MIN_PHP_VERSION', '7.2.0'); -define('C_SETUP_MAX_PHP_VERSION', '8.0.3'); -define('C_SETUP_VERSION', '2.1.2'); \ No newline at end of file +define('C_SETUP_MAX_PHP_VERSION', '8.1.0'); +define('C_SETUP_VERSION', '2.2.0 beta'); \ No newline at end of file diff --git a/setup/lib/startup.php b/setup/lib/startup.php index 3bb96bd..49c3708 100644 --- a/setup/lib/startup.php +++ b/setup/lib/startup.php @@ -33,9 +33,10 @@ ini_set("error_log", "../data/logs/setup_errorlog.txt"); header('Content-Type: text/html; charset=UTF-8'); // Check php version -if (version_compare(PHP_VERSION, C_SETUP_MIN_PHP_VERSION, '<') - || version_compare(PHP_VERSION, C_SETUP_MAX_PHP_VERSION, '>')) { +if (version_compare(PHP_VERSION, C_SETUP_MIN_PHP_VERSION, '<')) { die("You need PHP >= " . C_SETUP_MIN_PHP_VERSION . " to install ConLite " . C_SETUP_VERSION . ". Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); +} else if (version_compare(PHP_VERSION, C_SETUP_MAX_PHP_VERSION, '>=')) { + die("You need PHP < " . C_SETUP_MAX_PHP_VERSION . " to install ConLite " . C_SETUP_VERSION . ". Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n"); } From 4b8c93b9ee10c684b8354542e2b0d13fb53c044e Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Thu, 16 Dec 2021 18:49:55 +0100 Subject: [PATCH 02/25] change CL version to 2.2.0 beta --- README.md | 4 +++- conlite/includes/startup.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0bc44e6..a9b7443 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ---------------------------------------------------------------------------------------------------- -This is the readme file for ConLite 2.1.2 +This is the readme file for ConLite 2.2.0 beta Any help you need you may find by visiting the following links. @@ -56,6 +56,8 @@ FS#25 - Collision with pre-installed AMR after Migration ** History / Changelog ** +ConLite 2.2.0 beta + ConLite 2.1.3 ConLite 2.1.2 ConLite 2.1.1 diff --git a/conlite/includes/startup.php b/conlite/includes/startup.php index 5e128b9..323a941 100755 --- a/conlite/includes/startup.php +++ b/conlite/includes/startup.php @@ -71,7 +71,7 @@ if (!defined('CL_ENVIRONMENT')) { */ if (!defined('CL_VERSION')) { -define('CL_VERSION', '2.1.2'); +define('CL_VERSION', '2.2.0 beta'); } From 4ff23df02e47149b1fd118571b247bcbbb11314a Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Thu, 27 Jan 2022 17:54:20 +0100 Subject: [PATCH 03/25] fixing PHP 8.1 errors --- .gitignore | 1 + conlib/db_mysqli.inc | 6 +++--- conlite/includes/startup.php | 0 nbproject/project.properties | 2 +- pear/HTML/Common2.php | 6 +++++- setup/lib/defines.php | 4 ++-- setup/steps/forms/setupsummary.php | 2 ++ 7 files changed, 14 insertions(+), 7 deletions(-) mode change 100755 => 100644 conlite/includes/startup.php diff --git a/.gitignore b/.gitignore index c7dbf93..50ed16c 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ /cms/dflip/ /cms/js/firstlevel/ /conlite/external/**/.git +/dievino/ diff --git a/conlib/db_mysqli.inc b/conlib/db_mysqli.inc index 91c5ef6..efff09b 100644 --- a/conlib/db_mysqli.inc +++ b/conlib/db_mysqli.inc @@ -134,10 +134,10 @@ class DB_Sql extends DB_Sql_Abstract { ); - if (isset($aCon['charset'])) { - @mysqli_set_charset($dbh, $aCon['charset']); + if (!empty($aCon['charset'])) { + mysqli_set_charset($dbh, $aCon['charset']); } else { - @mysqli_set_charset($dbh, 'utf8'); + mysqli_set_charset($dbh, 'utf8'); } //echo mysqli_character_set_name($dbh); diff --git a/conlite/includes/startup.php b/conlite/includes/startup.php old mode 100755 new mode 100644 diff --git a/nbproject/project.properties b/nbproject/project.properties index 18fa718..43d66d2 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,6 +1,6 @@ auxiliary.org-netbeans-modules-php-smarty.smarty-framework=true include.path=${php.global.include.path} -php.version=PHP_73 +php.version=PHP_80 source.encoding=UTF-8 src.dir=. tags.asp=false diff --git a/pear/HTML/Common2.php b/pear/HTML/Common2.php index 05f0d92..aeeb5fb 100644 --- a/pear/HTML/Common2.php +++ b/pear/HTML/Common2.php @@ -513,7 +513,8 @@ abstract class HTML_Common2 implements ArrayAccess * @return boolean Returns true on success or false on failure. * @link http://php.net/manual/en/arrayaccess.offsetexists.php */ - public function offsetExists($offset) + #[ReturnTypeWillChange] + public function offsetExists($offset) { return isset($this->attributes[strtolower($offset)]); } @@ -527,6 +528,7 @@ abstract class HTML_Common2 implements ArrayAccess * @link http://php.net/manual/en/arrayaccess.offsetget.php * @see getAttribute() */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->getAttribute($offset); @@ -542,6 +544,7 @@ abstract class HTML_Common2 implements ArrayAccess * @link http://php.net/manual/en/arrayaccess.offsetset.php * @see setAttribute() */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { if (null !== $offset) { @@ -561,6 +564,7 @@ abstract class HTML_Common2 implements ArrayAccess * @link http://php.net/manual/en/arrayaccess.offsetunset.php * @see removeAttribute */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { $this->removeAttribute($offset); diff --git a/setup/lib/defines.php b/setup/lib/defines.php index eec6cc1..aec9db6 100644 --- a/setup/lib/defines.php +++ b/setup/lib/defines.php @@ -37,6 +37,6 @@ define('C_SETUP_STEPFILE', 'images/steps/s%d.png'); define('C_SETUP_STEPFILE_ACTIVE', 'images/steps/s%da.png'); define('C_SETUP_STEPWIDTH', 28); define('C_SETUP_STEPHEIGHT', 28); -define('C_SETUP_MIN_PHP_VERSION', '7.2.0'); -define('C_SETUP_MAX_PHP_VERSION', '8.1.0'); +define('C_SETUP_MIN_PHP_VERSION', '7.4.0'); +define('C_SETUP_MAX_PHP_VERSION', '8.2.0'); define('C_SETUP_VERSION', '2.2.0 beta'); \ No newline at end of file diff --git a/setup/steps/forms/setupsummary.php b/setup/steps/forms/setupsummary.php index 41f25f1..3b911a4 100644 --- a/setup/steps/forms/setupsummary.php +++ b/setup/steps/forms/setupsummary.php @@ -31,6 +31,8 @@ if (!defined('CON_FRAMEWORK')) { die('Illegal call'); } +//print_r($_SESSION); + class cSetupSetupSummary extends cSetupMask { public function __construct($step, $previous, $next) { From 56013aa61028957e452dcdca18a9ad709840d46d Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 27 Jan 2022 19:46:05 +0100 Subject: [PATCH 04/25] fixes PHP 8.1 --- .htaccess | 4 +-- conlib/db_mysqli.inc | 58 +++++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.htaccess b/.htaccess index 6762b78..7864d7c 100644 --- a/.htaccess +++ b/.htaccess @@ -33,7 +33,7 @@ RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} ftp://.*$ [NC,OR] RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC] - RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana + RewriteRule ^.* - [F,L,DPI] # all matching conditions from above will end in nirvana # Rewrite request to root to front_content.php RewriteRule ^$ front_content.php [QSA,L] @@ -44,7 +44,7 @@ RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d - RewriteRule ^.*$ - [NC,L] + RewriteRule ^.*$ - [NC,L,DPI] # Pass other requests to front_content.php RewriteRule ^.*$ front_content.php [QSA,NC,L] diff --git a/conlib/db_mysqli.inc b/conlib/db_mysqli.inc index efff09b..f183533 100644 --- a/conlib/db_mysqli.inc +++ b/conlib/db_mysqli.inc @@ -92,6 +92,10 @@ class DB_Sql extends DB_Sql_Abstract { return null; } + // PHP 8.1 fix + $driver = new mysqli_driver(); + $driver->report_mode = MYSQLI_REPORT_OFF; + $dbh = mysqli_init(); //print_r($dbh); if (!$dbh) { @@ -123,7 +127,7 @@ class DB_Sql extends DB_Sql_Abstract { $aCon['socket'] = null; } if (!isset($aCon['flags'])) { - $aCon['flags'] = null; + $aCon['flags'] = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT; } if (!isset($aCon['database'])) { $aCon['database'] = null; @@ -326,30 +330,30 @@ class DB_Sql extends DB_Sql_Abstract { } /** - * @see DB_Sql_Abstract::_metaData() - * * Due to compatibility problems with Table we changed the behavior - * of metadata(); - * depending on $full, metadata returns the following values: - * - * - full is false (default): - * $result[]: - * [0]["table"] table name - * [0]["name"] field name - * [0]["type"] field type - * [0]["len"] field length - * [0]["flags"] field flags - * - * - full is true - * $result[]: - * ["num_fields"] number of metadata records - * [0]["table"] table name - * [0]["name"] field name - * [0]["type"] field type - * [0]["len"] field length - * [0]["flags"] field flags - * ["meta"][field name] index of field named "field name" - * This last one could be used if you have a field name, but no index. - * Test: if (isset($result['meta']['myfield'])) { ... + * @see DB_Sql_Abstract::_metaData() + * * Due to compatibility problems with Table we changed the behavior + * of metadata(); + * depending on $full, metadata returns the following values: + * + * - full is false (default): + * $result[]: + * [0]["table"] table name + * [0]["name"] field name + * [0]["type"] field type + * [0]["len"] field length + * [0]["flags"] field flags + * + * - full is true + * $result[]: + * ["num_fields"] number of metadata records + * [0]["table"] table name + * [0]["name"] field name + * [0]["type"] field type + * [0]["len"] field length + * [0]["flags"] field flags + * ["meta"][field name] index of field named "field name" + * This last one could be used if you have a field name, but no index. + * Test: if (isset($result['meta']['myfield'])) { ... */ protected function _metaData($table = '', $full = false) { $count = 0; @@ -392,7 +396,7 @@ class DB_Sql extends DB_Sql_Abstract { $count = 0; while ($finfo = $id->fetch_field()) { - //rint_r($finfo); + //rint_r($finfo); $res[$count]['table'] = $finfo->table; $res[$count]['name'] = $finfo->name; $res[$count]['type'] = $this->_aDataTypes[$finfo->type]; @@ -440,7 +444,7 @@ class DB_Sql extends DB_Sql_Abstract { $return[$i]['table_name'] = $info[0]; $return[$i]['tablespace_name'] = $this->Database; $return[$i]['database'] = $this->Database; - $i ++; + $i++; } mysqli_free_result($h); From f6f95929ddb8aa93c64a54539bcbc6e94d3ef029 Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 27 Jan 2022 20:30:44 +0100 Subject: [PATCH 05/25] remove error control operator --- data/config/production/config.misc.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/data/config/production/config.misc.php b/data/config/production/config.misc.php index d06dce2..8cba9fa 100644 --- a/data/config/production/config.misc.php +++ b/data/config/production/config.misc.php @@ -139,16 +139,21 @@ $cfg['native_i18n'] = false; */ /* Don't display errors */ -@ini_set("display_errors", false); +ini_set("display_errors", false); /* Log errors to a file */ -@ini_set("log_errors", true); +ini_set("log_errors", true); /* The file in which we write the error log */ -@ini_set("error_log", $cfg['path']['conlite_logs'] . "errorlog.txt"); +ini_set("error_log", $cfg['path']['conlite_logs'] . "errorlog.txt"); -/* Report all errors except warnings */ -if ($cfg["develop"]["show_errors"] && $_SERVER['SERVER_NAME'] == "local.dceserver.de") { +/** + * Report all errors except warnings + * @todo change first if to use a local config var for servername + * + **/ +if ($cfg["develop"]["show_errors"] + && filter_input(INPUT_SERVER, 'SERVER_NAME', FILTER_SANITIZE_STRING) == "local.dceserver.de") { error_reporting(E_ALL); } else { if ($cfg["develop"]["show_deprecated"]) { @@ -321,5 +326,4 @@ $cfg['password']['numbers_mandatory'] = 3; * Content Type Settings */ // Define here all content types which includes special module translations (dont forget the prefix "CMS_"!) -$cfg['translatable_content_types'] = array('CMS_TEASER', 'CMS_FILELIST'); -?> +$cfg['translatable_content_types'] = array('CMS_TEASER', 'CMS_FILELIST'); \ No newline at end of file From 04741dd66fa93187fd15e38231f25a5b17c17bb9 Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 27 Jan 2022 21:22:55 +0100 Subject: [PATCH 06/25] fix 'Array Offset on value of type int' PHP 8 --- conlite/includes/functions.system.php | 872 ++++++++++++-------------- 1 file changed, 406 insertions(+), 466 deletions(-) diff --git a/conlite/includes/functions.system.php b/conlite/includes/functions.system.php index 57c4e5d..341dd7e 100644 --- a/conlite/includes/functions.system.php +++ b/conlite/includes/functions.system.php @@ -1,4 +1,5 @@ returnNotification("error", i18n("Can't clear install error log : Access is denied!")); } - + $errorLogHandle = fopen($sDelFile, "wb+"); fclose($errorLogHandle); return $notification->returnNotification("info", i18n("error log successfully cleared")); @@ -68,15 +68,14 @@ function emptyLogFile() { * @return string returns phpinfo() HTML output * @author Marco Jahn */ -function phpInfoToHtml() -{ - /* get output */ - ob_start(); - phpinfo(); - $phpInfoToHtml = ob_get_contents(); - ob_end_clean(); +function phpInfoToHtml() { + /* get output */ + ob_start(); + phpinfo(); + $phpInfoToHtml = ob_get_contents(); + ob_end_clean(); - return $phpInfoToHtml; + return $phpInfoToHtml; } /** @@ -89,48 +88,39 @@ function phpInfoToHtml() * @return boolean wether user has access or not * @author Marco Jahn */ -function system_have_perm($client) -{ - global $auth; +function system_have_perm($client) { + global $auth; - if (!isset ($auth->perm['perm'])) - { - $auth->perm['perm'] = ''; - } + if (!isset($auth->perm['perm'])) { + $auth->perm['perm'] = ''; + } - $userPerm = explode(',', $auth->auth['perm']); + $userPerm = explode(',', $auth->auth['perm']); - if (in_array('sysadmin', $userPerm)) - { // is user sysadmin ? - return true; - } - elseif (in_array('admin['.$client.']', $userPerm)) - { // is user admin for this client ? - return true; - } - elseif (in_array('client['.$client.']', $userPerm)) - { // has user access to this client ? - return true; - } - return false; + if (in_array('sysadmin', $userPerm)) { // is user sysadmin ? + return true; + } elseif (in_array('admin[' . $client . ']', $userPerm)) { // is user admin for this client ? + return true; + } elseif (in_array('client[' . $client . ']', $userPerm)) { // has user access to this client ? + return true; + } + return false; } /** -* check for valid ip adress -* -* @param string ip adress -* -* @return boolean if string is a valid ip or not -*/ -function isIPv4($strHostAdress) -{ - // ip pattern needed for validation - $ipPattern = "([0-9]|1?\d\d|2[0-4]\d|25[0-5])"; - if (preg_match("/^$ipPattern\.$ipPattern\.$ipPattern\.$ipPattern?$/", $strHostAdress)) - { // ip is valid - return true; - } - return false; + * check for valid ip adress + * + * @param string ip adress + * + * @return boolean if string is a valid ip or not + */ +function isIPv4($strHostAdress) { + // ip pattern needed for validation + $ipPattern = "([0-9]|1?\d\d|2[0-4]\d|25[0-5])"; + if (preg_match("/^$ipPattern\.$ipPattern\.$ipPattern\.$ipPattern?$/", $strHostAdress)) { // ip is valid + return true; + } + return false; } /** @@ -139,70 +129,56 @@ function isIPv4($strHostAdress) * @param string $strBrowserUrl current browser string * @return boolean|string status of path comparement or false */ -function checkPathInformation($strConUrl, $strBrowserUrl) -{ - // parse url - $arrConUrl = parse_url($strConUrl); - $arrBrowserUrl = parse_url($strBrowserUrl); - - if($arrConUrl === FALSE || $arrBrowserUrl === FALSE) { - return false; +function checkPathInformation($strConUrl, $strBrowserUrl) { + // parse url + $arrConUrl = parse_url($strConUrl); + $arrBrowserUrl = parse_url($strBrowserUrl); + + if ($arrConUrl === FALSE || $arrBrowserUrl === FALSE) { + return false; + } + + if (isIPv4($arrConUrl['host'])) { // is + if (isIPv4($arrBrowserUrl['host'])) { // is + if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) { + return '1'; + } + + return '2'; + } else { // isn't + $arrBrowserUrl['host'] = gethostbyname($arrBrowserUrl['host']); + if (!isIPv4($arrBrowserUrl['host'])) { + return '3'; + } + + if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) { + return '1'; + } + + return '2'; } + } else { // isn't + if (isIPv4($arrBrowserUrl['host'])) { //is + $tmpAddr = gethostbyaddr($arrBrowserUrl['host']); + $arrBrowserUrl['host'] = str_replace('-', '.', substr($tmpAddr, 0, strpos($tmpAddr, "."))); - if (isIPv4($arrConUrl['host'])) - { // is - if (isIPv4($arrBrowserUrl['host'])) - { // is - if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) - { - return '1'; - } + if (isIPv4($arrBrowserUrl['host'])) { + return '3'; + } - return '2'; - } else - { // isn't - $arrBrowserUrl['host'] = gethostbyname($arrBrowserUrl['host']); - if (!isIPv4($arrBrowserUrl['host'])) - { - return '3'; - } + if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) { + return '1'; + } - if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) - { - return '1'; - } + return '2'; + } else { // isn't + if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) { + return '1'; + } - return '2'; - } - } else - { // isn't - if (isIPv4($arrBrowserUrl['host'])) - { //is - $tmpAddr = gethostbyaddr($arrBrowserUrl['host']); - $arrBrowserUrl['host'] = str_replace('-', '.', substr($tmpAddr, 0, strpos($tmpAddr, "."))); - - if (isIPv4($arrBrowserUrl['host'])) - { - return '3'; - } - - if (compareUrlStrings($arrConUrl, $arrBrowserUrl, true)) - { - return '1'; - } - - return '2'; - - } else - { // isn't - if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) - { - return '1'; - } - - return '2'; - } - } + return '2'; + } + } } /** @@ -210,28 +186,36 @@ function checkPathInformation($strConUrl, $strBrowserUrl) * * @param array $arrConUrl * @param array $arrBrowserUrl - * @param boolean $isIP not used, don' t know if needed * @return boolean */ -function compareUrlStrings($arrConUrl, $arrBrowserUrl, $isIP = false) -{ - // && $isIP == false +function compareUrlStrings($arrConUrl, $arrBrowserUrl) { - // remove 'www.' if needed - if (strpos($arrConUrl['host'], 'www.') == 0 || strpos($arrBrowserUrl['host'], 'www.') == 0) - { - $arrConUrl['host'] = str_replace('www.', '', $arrConUrl); - $arrBrowserUrl['host'] = str_replace('www.', '', $arrBrowserUrl); - } + // remove 'www.' if needed + if (strpos($arrConUrl['host'], 'www.') == 0 || strpos($arrBrowserUrl['host'], 'www.') == 0) { + $arrConUrl['host'] = str_replace('www.', '', $arrConUrl); + $arrBrowserUrl['host'] = str_replace('www.', '', $arrBrowserUrl); + } - $strConUrl = $arrConUrl['scheme'].'://'.$arrConUrl['host'].$arrConUrl['path']; - $strBrowserUrl = $arrBrowserUrl['scheme'].'://'.$arrBrowserUrl['host'].$arrBrowserUrl['path']; + $strConUrl = unparse_url($arrConUrl); + $strBrowserUrl = unparse_url($arrBrowserUrl); - if (strcmp($strConUrl, $strBrowserUrl) != 0) - { - return false; - } - return true; + if (strcmp($strConUrl, $strBrowserUrl) != 0) { + return false; + } + return true; +} + +function unparse_url($parsed_url) { + $scheme = isset($parsed_url['scheme']) && is_string($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; + $host = isset($parsed_url['host']) && is_string($parsed_url['host']) ? $parsed_url['host'] : ''; + $port = isset($parsed_url['port']) && is_string($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; + $user = isset($parsed_url['user']) && is_string($parsed_url['user']) ? $parsed_url['user'] : ''; + $pass = isset($parsed_url['pass']) && is_string($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; + $pass = ($user || $pass) ? "$pass@" : ''; + $path = isset($parsed_url['path']) && is_string($parsed_url['path']) ? $parsed_url['path'] : ''; + $query = isset($parsed_url['query']) && is_string($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; + $fragment = isset($parsed_url['fragment']) && is_string($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; + return "$scheme$user$pass$host$port$path$query$fragment"; } /** @@ -242,272 +226,251 @@ function compareUrlStrings($arrConUrl, $arrBrowserUrl, $isIP = false) * @return string returns a string containing several server and Contenido settings * @author Marco Jahn */ -function writeSystemValuesOutput($usage) -{ +function writeSystemValuesOutput($usage) { - global $db, $_SERVER, $cfg, $i18n, $tpl; + global $db, $_SERVER, $cfg, $i18n, $tpl; - /* variables to proof against each other*/ + /* variables to proof against each other */ - $contenidoFullHtml = $cfg['path']['contenido_fullhtml']; - $browserPath = $_SERVER['SERVER_PORT'] == '443' ? 'https' : 'http'; - $browserPath .= "://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; - $browserPath = substr($browserPath, 0, strrpos($browserPath, "/") + 1); + $contenidoFullHtml = $cfg['path']['contenido_fullhtml']; + $browserPath = $_SERVER['SERVER_PORT'] == '443' ? 'https' : 'http'; + $browserPath .= "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $browserPath = substr($browserPath, 0, strrpos($browserPath, "/") + 1); - $status = checkPathInformation($contenidoFullHtml, $browserPath); + $status = checkPathInformation($contenidoFullHtml, $browserPath); - if ($status == 1) - { // green - $contenidoFullHtml = "".$contenidoFullHtml."
"; - $browserPath = "".$browserPath.""; + if ($status == 1) { // green + $contenidoFullHtml = "" . $contenidoFullHtml . "
"; + $browserPath = "" . $browserPath . ""; + } elseif ($status == 2) { // red + $contenidoFullHtml = "" . $contenidoFullHtml . "
"; + $browserPath = "" . $browserPath . ""; + } elseif ($status == 3) { //orange + $contenidoFullHtml = "" . $contenidoFullHtml . "
"; + $browserPath = "" . $browserPath . ""; + } - } - elseif ($status == 2) - { // red - $contenidoFullHtml = "".$contenidoFullHtml."
"; - $browserPath = "".$browserPath.""; + /* generate sysvalue output */ + $i = 0; // array start value + // current Contenido version + $sysvalues[$i]['variable'] = i18n('Contenido version'); + $sysvalues[$i++]['value'] = $cfg['version']; + // paths from config.php + $sysvalues[$i]['variable'] = i18n('Contenido path'); + $sysvalues[$i++]['value'] = $cfg['path']['contenido']; + $sysvalues[$i]['variable'] = i18n('Contenido HTML path'); + $sysvalues[$i++]['value'] = $cfg['path']['contenido_html']; + $sysvalues[$i]['variable'] = i18n('Contenido full HTML path'); + $sysvalues[$i++]['value'] = $contenidoFullHtml; + $sysvalues[$i]['variable'] = i18n('Contenido frontend path'); + $sysvalues[$i++]['value'] = $cfg['path']['frontend']; + $sysvalues[$i]['variable'] = i18n('Contenido PHPLIB path'); + $sysvalues[$i++]['value'] = $cfg['path']['phplib']; + $sysvalues[$i]['variable'] = i18n('Contenido wysiwyg path'); + $sysvalues[$i++]['value'] = $cfg['path']['wysiwyg']; + $sysvalues[$i]['variable'] = i18n('Contenido wysiwyg HTML path'); + $sysvalues[$i++]['value'] = $cfg['path']['wysiwyg_html']; + // host name + $sysvalues[$i]['variable'] = i18n('Host name'); + $sysvalues[$i++]['value'] = $_SERVER['HTTP_HOST']; + // Contenido browser path + $sysvalues[$i]['variable'] = i18n('Browser path'); + /* cut of file information */ + $sysvalues[$i++]['value'] = $browserPath; + // get number of clients + $sql = "SELECT count(name) clientcount FROM " . $cfg["tab"]["clients"]; + $db->query($sql); + $db->next_record(); + $clientcount = $db->f("clientcount"); - } - elseif ($status == 3) - { //orange - $contenidoFullHtml = "".$contenidoFullHtml."
"; - $browserPath = "".$browserPath.""; - - } - - /* generate sysvalue output */ - $i = 0; // array start value - // current Contenido version - $sysvalues[$i]['variable'] = i18n('Contenido version'); - $sysvalues[$i ++]['value'] = $cfg['version']; - // paths from config.php - $sysvalues[$i]['variable'] = i18n('Contenido path'); - $sysvalues[$i ++]['value'] = $cfg['path']['contenido']; - $sysvalues[$i]['variable'] = i18n('Contenido HTML path'); - $sysvalues[$i ++]['value'] = $cfg['path']['contenido_html']; - $sysvalues[$i]['variable'] = i18n('Contenido full HTML path'); - $sysvalues[$i ++]['value'] = $contenidoFullHtml; - $sysvalues[$i]['variable'] = i18n('Contenido frontend path'); - $sysvalues[$i ++]['value'] = $cfg['path']['frontend']; - $sysvalues[$i]['variable'] = i18n('Contenido PHPLIB path'); - $sysvalues[$i ++]['value'] = $cfg['path']['phplib']; - $sysvalues[$i]['variable'] = i18n('Contenido wysiwyg path'); - $sysvalues[$i ++]['value'] = $cfg['path']['wysiwyg']; - $sysvalues[$i]['variable'] = i18n('Contenido wysiwyg HTML path'); - $sysvalues[$i ++]['value'] = $cfg['path']['wysiwyg_html']; - // host name - $sysvalues[$i]['variable'] = i18n('Host name'); - $sysvalues[$i ++]['value'] = $_SERVER['HTTP_HOST']; - // Contenido browser path - $sysvalues[$i]['variable'] = i18n('Browser path'); - /* cut of file information */ - $sysvalues[$i ++]['value'] = $browserPath; - // get number of clients - $sql = "SELECT count(name) clientcount FROM ".$cfg["tab"]["clients"]; - $db->query($sql); - $db->next_record(); - $clientcount = $db->f("clientcount"); - - // get all clients and their language - $sql = "SELECT count(a.name) clientcount, + // get all clients and their language + $sql = "SELECT count(a.name) clientcount, a.name clientname, a.idclient FROM - ".$cfg["tab"]["clients"]." a + " . $cfg["tab"]["clients"] . " a GROUP BY a.name, a.idclient"; - $db->query($sql); + $db->query($sql); - // create 'value' output - $db2 = new DB_ConLite; - $clientInformation = " + // create 'value' output + $db2 = new DB_ConLite; + $clientInformation = "
- - + + "; - $clientPermCount = 0; - while ($db->next_record()) - { - if (system_have_perm($db->f("idclient"))) - { - $clientlang = ""; + $clientPermCount = 0; + while ($db->next_record()) { + if (system_have_perm($db->f("idclient"))) { + $clientlang = ""; - // get client name - $clientName = urldecode($db->f("clientname")); - $clientInformation .= " + // get client name + $clientName = urldecode($db->f("clientname")); + $clientInformation .= ""; - $clientlang = ""; - // select languages belong to a client - $sql = "SELECT c.name clientlang - FROM ".$cfg["tab"]["clients"]." a - LEFT JOIN ".$cfg["tab"]["clients_lang"]." b ON a.idclient = b.idclient - LEFT JOIN ".$cfg["tab"]["lang"]." c ON b.idlang = c.idlang - WHERE a.idclient=".Contenido_Security::toInteger($db->f("idclient"))." AND c.name IS NOT NULL"; - $db2->query($sql); - while ($db2->next_record()) - { - $clientlang .= $db2->f("clientlang").", "; - } - // cut off last "," - $clientlang = substr($clientlang, 0, strlen($clientlang) - 2); + $clientlang = ""; + // select languages belong to a client + $sql = "SELECT c.name clientlang + FROM " . $cfg["tab"]["clients"] . " a + LEFT JOIN " . $cfg["tab"]["clients_lang"] . " b ON a.idclient = b.idclient + LEFT JOIN " . $cfg["tab"]["lang"] . " c ON b.idlang = c.idlang + WHERE a.idclient=" . Contenido_Security::toInteger($db->f("idclient")) . " AND c.name IS NOT NULL"; + $db2->query($sql); + while ($db2->next_record()) { + $clientlang .= $db2->f("clientlang") . ", "; + } + // cut off last "," + $clientlang = substr($clientlang, 0, strlen($clientlang) - 2); - $clientInformation .= " - + $clientInformation .= " + "; - $sql = "SELECT frontendpath, htmlpath FROM ".$cfg["tab"]["clients"]." WHERE idclient='".Contenido_Security::toInteger($db->f("idclient"))."'"; - $db2->query($sql); - while ($db2->next_record()) - { - $clientInformation .= " - - + $sql = "SELECT frontendpath, htmlpath FROM " . $cfg["tab"]["clients"] . " WHERE idclient='" . Contenido_Security::toInteger($db->f("idclient")) . "'"; + $db2->query($sql); + while ($db2->next_record()) { + $clientInformation .= " + + "; - $clientInformation .= " - - + $clientInformation .= " + + "; - } - $clientPermCount ++; - } + } + $clientPermCount++; + } + } - } - - if ($clientPermCount == 0) - { - $clientInformation .= " - + if ($clientPermCount == 0) { + $clientInformation .= " + "; - } + } - $clientInformation .= '
".i18n("client settings")."".i18n("values")."" . i18n("client settings") . "" . i18n("values") . "
$clientName
".i18n("language(s)")."
" . i18n("language(s)") . " $clientlang 
".i18n("htmlpath")."".$db2->f("htmlpath")." 
" . i18n("htmlpath") . "" . $db2->f("htmlpath") . " 
".i18n("frontendpath")."".$db2->f("frontendpath")." 
" . i18n("frontendpath") . "" . $db2->f("frontendpath") . " 
".i18n("No permissions!")."
" . i18n("No permissions!") . "
'; + $clientInformation .= ''; - $clientdata = i18n('Number of installed clients: ').$clientcount."
".$clientInformation; + $clientdata = i18n('Number of installed clients: ') . $clientcount . "
" . $clientInformation; - // client quantity and their assigned language and are they online - $sysvalues[$i]['variable'] = i18n('Client informations'); - $sysvalues[$i ++]['value'] = "$clientdata"; - // get number of users installed - $sql = "SELECT count(user_id) usercount FROM ".$cfg["tab"]["phplib_auth_user_md5"]; - $db->query($sql); - $db->next_record(); - // number of users - $sysvalues[$i]['variable'] = i18n('Number of users'); - $sysvalues[$i ++]['value'] = $db->f("usercount"); - //get number of articles - $sql = "SELECT count(idart) articlecount FROM ".$cfg["tab"]["art"]; - $db->query($sql); - $db->next_record(); - // number of articles - $sysvalues[$i]['variable'] = i18n('Number of articles'); - $sysvalues[$i ++]['value'] = $db->f("articlecount"); - // server operating system - $sysvalues[$i]['variable'] = i18n('Server operating system'); - $sysvalues[$i ++]['value'] = $_SERVER['SERVER_SOFTWARE']; - // SQL version - $sql_server_info = $db->server_info(); - $sysvalues[$i]['variable'] = i18n('PHP database extension'); - $sysvalues[$i ++]['value'] = $cfg["database_extension"]; - $sysvalues[$i]['variable'] = i18n('Database server version'); - $sysvalues[$i ++]['value'] = $sql_server_info['description']; - // php version - $sysvalues[$i]['variable'] = i18n('Installed PHP version'); - $sysvalues[$i ++]['value'] = phpversion(); - // php config values - // config values - // php safe_mode - (ini_get('safe_mode') == 1) ? $safe_mode = "".i18n('activated')."" : $safe_mode = "".i18n('deactivated').""; - $sysvalues[$i]['variable'] = "safe_mode"; - $sysvalues[$i ++]['value'] = $safe_mode; - // magig quotes GPC - (ini_get('magic_quotes_gpc') == 1) ? $magic_quotes_gpc = i18n('activated') : $magic_quotes_gpc = i18n('deactivated'); - $sysvalues[$i]['variable'] = "magic_quotes_gpc"; - $sysvalues[$i ++]['value'] = $magic_quotes_gpc; - // magic quotes runtime - (ini_get('magic_quotes_runtime') == 1) ? $magic_quotes_runtime = i18n('activated') : $magic_quotes_runtime = i18n('deactivated'); - $sysvalues[$i]['variable'] = "magic_quotes_runtime"; - $sysvalues[$i ++]['value'] = $magic_quotes_runtime; - // GPC order - $sysvalues[$i]['variable'] = "gpc_order"; - $sysvalues[$i ++]['value'] = ini_get('gpc_order'); - // memory limit - $sysvalues[$i]['variable'] = "memory_limit"; - $sysvalues[$i ++]['value'] = ini_get('memory_limit'); - // max execution time - $sysvalues[$i]['variable'] = "max_execution_time"; - $sysvalues[$i ++]['value'] = ini_get('max_execution_time'); - // disabled functions - (strlen(ini_get('disable_functions')) > 0) ? $disable_functions = "". str_replace(",", ", ", ini_get('disable_functions'))."" : $disable_functions = "".i18n('nothing disabled').""; - $sysvalues[$i]['variable'] = i18n('Disabled functions'); - $sysvalues[$i ++]['value'] = $disable_functions; - // gettext loaded - (extension_loaded('gettext') == true) ? $gettext = "".i18n('loaded')."" : $gettext = "".i18n('not loaded').""; - $sysvalues[$i]['variable'] = i18n('Gettext extension'); - $sysvalues[$i ++]['value'] = $gettext; - // sql.safe_mode - (ini_get('sql.safe_mode') == 1) ? $sql_safe_mode = "".i18n('activated')."" : $sql_safe_mode = "".i18n('deactivated').""; - $sysvalues[$i]['variable'] = "sql.safe_mode"; - $sysvalues[$i ++]['value'] = $sql_safe_mode; - // gdlib with installed features - $gdLib = array(); - $gdLib = getPhpModuleInfo($moduleName = 'gd'); - $gdLibFeatures = " + // client quantity and their assigned language and are they online + $sysvalues[$i]['variable'] = i18n('Client informations'); + $sysvalues[$i++]['value'] = "$clientdata"; + // get number of users installed + $sql = "SELECT count(user_id) usercount FROM " . $cfg["tab"]["phplib_auth_user_md5"]; + $db->query($sql); + $db->next_record(); + // number of users + $sysvalues[$i]['variable'] = i18n('Number of users'); + $sysvalues[$i++]['value'] = $db->f("usercount"); + //get number of articles + $sql = "SELECT count(idart) articlecount FROM " . $cfg["tab"]["art"]; + $db->query($sql); + $db->next_record(); + // number of articles + $sysvalues[$i]['variable'] = i18n('Number of articles'); + $sysvalues[$i++]['value'] = $db->f("articlecount"); + // server operating system + $sysvalues[$i]['variable'] = i18n('Server operating system'); + $sysvalues[$i++]['value'] = $_SERVER['SERVER_SOFTWARE']; + // SQL version + $sql_server_info = $db->server_info(); + $sysvalues[$i]['variable'] = i18n('PHP database extension'); + $sysvalues[$i++]['value'] = $cfg["database_extension"]; + $sysvalues[$i]['variable'] = i18n('Database server version'); + $sysvalues[$i++]['value'] = $sql_server_info['description']; + // php version + $sysvalues[$i]['variable'] = i18n('Installed PHP version'); + $sysvalues[$i++]['value'] = phpversion(); + // php config values + // config values + // php safe_mode + (ini_get('safe_mode') == 1) ? $safe_mode = "" . i18n('activated') . "" : $safe_mode = "" . i18n('deactivated') . ""; + $sysvalues[$i]['variable'] = "safe_mode"; + $sysvalues[$i++]['value'] = $safe_mode; + // magig quotes GPC + (ini_get('magic_quotes_gpc') == 1) ? $magic_quotes_gpc = i18n('activated') : $magic_quotes_gpc = i18n('deactivated'); + $sysvalues[$i]['variable'] = "magic_quotes_gpc"; + $sysvalues[$i++]['value'] = $magic_quotes_gpc; + // magic quotes runtime + (ini_get('magic_quotes_runtime') == 1) ? $magic_quotes_runtime = i18n('activated') : $magic_quotes_runtime = i18n('deactivated'); + $sysvalues[$i]['variable'] = "magic_quotes_runtime"; + $sysvalues[$i++]['value'] = $magic_quotes_runtime; + // GPC order + $sysvalues[$i]['variable'] = "gpc_order"; + $sysvalues[$i++]['value'] = ini_get('gpc_order'); + // memory limit + $sysvalues[$i]['variable'] = "memory_limit"; + $sysvalues[$i++]['value'] = ini_get('memory_limit'); + // max execution time + $sysvalues[$i]['variable'] = "max_execution_time"; + $sysvalues[$i++]['value'] = ini_get('max_execution_time'); + // disabled functions + (strlen(ini_get('disable_functions')) > 0) ? $disable_functions = "" . str_replace(",", ", ", ini_get('disable_functions')) . "" : $disable_functions = "" . i18n('nothing disabled') . ""; + $sysvalues[$i]['variable'] = i18n('Disabled functions'); + $sysvalues[$i++]['value'] = $disable_functions; + // gettext loaded + (extension_loaded('gettext') == true) ? $gettext = "" . i18n('loaded') . "" : $gettext = "" . i18n('not loaded') . ""; + $sysvalues[$i]['variable'] = i18n('Gettext extension'); + $sysvalues[$i++]['value'] = $gettext; + // sql.safe_mode + (ini_get('sql.safe_mode') == 1) ? $sql_safe_mode = "" . i18n('activated') . "" : $sql_safe_mode = "" . i18n('deactivated') . ""; + $sysvalues[$i]['variable'] = "sql.safe_mode"; + $sysvalues[$i++]['value'] = $sql_safe_mode; + // gdlib with installed features + $gdLib = array(); + $gdLib = getPhpModuleInfo($moduleName = 'gd'); + $gdLibFeatures = "
- - + + "; - foreach ($sysvalues as $key => $value) { - if (trim ($value['value']) == '') { - $sysvalues[$key]['value'] = ' '; - } - } + foreach ($sysvalues as $key => $value) { + if (trim($value['value']) == '') { + $sysvalues[$key]['value'] = ' '; + } + } - foreach ($gdLib as $setting => $value) - { - $gdLibFeatures .= " - - + foreach ($gdLib as $setting => $value) { + $gdLibFeatures .= " + + "; - } - $gdLibFeatures .= '
".i18n("Settings")."".i18n("Values")."" . i18n("Settings") . "" . i18n("Values") . "
".$setting."".$value[0]."
" . $setting . "" . $value[0] . "
'; - $sysvalues[$i]['variable'] = i18n('GD library'); - $sysvalues[$i ++]['value'] = $gdLibFeatures; + } + $gdLibFeatures .= ''; + $sysvalues[$i]['variable'] = i18n('GD library'); + $sysvalues[$i++]['value'] = $gdLibFeatures; - // include path settings - $sysvalues[$i]['variable'] = "include_path"; - $sysvalues[$i ++]['value'] = ini_get('include_path'); + // include path settings + $sysvalues[$i]['variable'] = "include_path"; + $sysvalues[$i++]['value'] = ini_get('include_path'); -$iRowId = 1; -$sRowBgColor2 = $sRowBgColor1 = "#fff"; + $iRowId = 1; + $sRowBgColor2 = $sRowBgColor1 = "#fff"; //loop array for every parameter - foreach ($sysvalues AS $sysvalue) - { - $tpl->set('d', 'VARIABLE', $sysvalue['variable']); - $tpl->set('d', 'LOCALVALUE', $sysvalue['value']); - $tpl->set('d', 'ROWID', 'sysrow_'.$iRowId); - if($iRowId % 2) { - $tpl->set('d', 'BGCOLOR', $sRowBgColor1); - } else { - $tpl->set('d', 'BGCOLOR', $sRowBgColor2); - } - $tpl->next(); - $iRowId++; - } - - /* irgendwas sinnvolles :) */ - if ($usage == 'mail') - { - return $tpl->generate($cfg['path']['templates'].$cfg['templates']['systam_variables_mailattach'], true); - } - elseif ($usage == 'output') - { - // do nothing - } + foreach ($sysvalues AS $sysvalue) { + $tpl->set('d', 'VARIABLE', $sysvalue['variable']); + $tpl->set('d', 'LOCALVALUE', $sysvalue['value']); + $tpl->set('d', 'ROWID', 'sysrow_' . $iRowId); + if ($iRowId % 2) { + $tpl->set('d', 'BGCOLOR', $sRowBgColor1); + } else { + $tpl->set('d', 'BGCOLOR', $sRowBgColor2); + } + $tpl->next(); + $iRowId++; + } + /* irgendwas sinnvolles :) */ + if ($usage == 'mail') { + return $tpl->generate($cfg['path']['templates'] . $cfg['templates']['systam_variables_mailattach'], true); + } elseif ($usage == 'output') { + // do nothing + } } /** @@ -535,127 +498,104 @@ $sRowBgColor2 = $sRowBgColor1 = "#fff"; * @return string returns several server and Contenido settings * @author Marco Jahn */ -function sendBugReport() -{ - global $_POST, $notification, $cfg; +function sendBugReport() { + global $_POST, $notification, $cfg; - /* will be set to another value than 0 if an error attempts */ - $mailSendError = 0; + /* will be set to another value than 0 if an error attempts */ + $mailSendError = 0; - /* check if email is filled out */ - if (strlen($_POST['sender']) == 0) - { - $mailSendError = 1; - } + /* check if email is filled out */ + if (strlen($_POST['sender']) == 0) { + $mailSendError = 1; + } - /* check if forename is filled out */ - if (strlen($_POST['forename']) == 0) - { - $mailSendError = 1; - } + /* check if forename is filled out */ + if (strlen($_POST['forename']) == 0) { + $mailSendError = 1; + } - /* check if surname is filled out */ - if (strlen($_POST['surname']) == 0) - { - $mailSendError = 1; - } + /* check if surname is filled out */ + if (strlen($_POST['surname']) == 0) { + $mailSendError = 1; + } - /* check if bugreport is filled out */ - if (strlen($_POST['bugreport']) == 0) - { - $mailSendError = 1; - } + /* check if bugreport is filled out */ + if (strlen($_POST['bugreport']) == 0) { + $mailSendError = 1; + } - /* check if email adress is valid */ - if (isValidMail($_POST['sender']) == false) - { - $mailSendError = 2; - } + /* check if email adress is valid */ + if (isValidMail($_POST['sender']) == false) { + $mailSendError = 2; + } - /* user has not agreed */ - if ($_POST['agreement'] != 'on') - { - $mailSendError = 3; - } + /* user has not agreed */ + if ($_POST['agreement'] != 'on') { + $mailSendError = 3; + } - if ($mailSendError == 0) - { - /* send mail */ + if ($mailSendError == 0) { + /* send mail */ - /* initialize mail class */ - $mail = new PHPMailer(); + /* initialize mail class */ + $mail = new PHPMailer(); - /* set sender information */ - $mail->From = strip_tags($_POST['sender']); - $mail->FromName = strip_tags($_POST['forename']." ".$_POST['surname']); + /* set sender information */ + $mail->From = strip_tags($_POST['sender']); + $mail->FromName = strip_tags($_POST['forename'] . " " . $_POST['surname']); - /* set recipient */ - $mail->AddAddress($cfg['bugreport']['targetemail'], "Bugreport recipient"); + /* set recipient */ + $mail->AddAddress($cfg['bugreport']['targetemail'], "Bugreport recipient"); - /* set mail function to use */ - $mail->Mailer = "mail"; //use php mail function + /* set mail function to use */ + $mail->Mailer = "mail"; //use php mail function - /* generate subject & body */ - $mail->Subject = "Bugreport"; - $mail->Body = "Fehlerbereich: ".$_POST['selectarea']."

".nl2br(strip_tags($_POST['bugreport'])); - $mail->AltBody = "Fehlerbereich: ".$_POST['selectarea']."\n\n".strip_tags($_POST['bugreport']); + /* generate subject & body */ + $mail->Subject = "Bugreport"; + $mail->Body = "Fehlerbereich: " . $_POST['selectarea'] . "

" . nl2br(strip_tags($_POST['bugreport'])); + $mail->AltBody = "Fehlerbereich: " . $_POST['selectarea'] . "\n\n" . strip_tags($_POST['bugreport']); - /* add attachements */ - if ($_POST['errorlog'] == 'on') - { - if (filesize($cfg['path']['contenido']."logs/errorlog.txt") > 0) - { //filesize > 0 send alternative attachement - $mail->AddAttachment($cfg['path']['contenido']."logs/errorlog.txt", "errorlog.txt"); - } else - { - $mail->AddStringAttachment("No error log entries found\n", "errorlog.txt"); - } - } + /* add attachements */ + if ($_POST['errorlog'] == 'on') { + if (filesize($cfg['path']['contenido'] . "logs/errorlog.txt") > 0) { //filesize > 0 send alternative attachement + $mail->AddAttachment($cfg['path']['contenido'] . "logs/errorlog.txt", "errorlog.txt"); + } else { + $mail->AddStringAttachment("No error log entries found\n", "errorlog.txt"); + } + } - if ($_POST['upgradeerrorlog'] == 'on') - { - if (filesize($cfg['path']['contenido']."logs/install.log.txt") > 0) - { //filesize > 0 send alternative attachement - $mail->AddAttachment($cfg['path']['contenido']."logs/install.log.txt", "install.log.txt"); - } else - { - $mail->AddStringAttachment("No install error log entries found\n", "install.log.txt"); - } - } + if ($_POST['upgradeerrorlog'] == 'on') { + if (filesize($cfg['path']['contenido'] . "logs/install.log.txt") > 0) { //filesize > 0 send alternative attachement + $mail->AddAttachment($cfg['path']['contenido'] . "logs/install.log.txt", "install.log.txt"); + } else { + $mail->AddStringAttachment("No install error log entries found\n", "install.log.txt"); + } + } - if ($_POST['sysvalues'] == 'on') - { - //send sysvalue output - $mail->AddStringAttachment(writeSystemValuesOutput($usage = 'mail'), "systemvariables.html"); - } + if ($_POST['sysvalues'] == 'on') { + //send sysvalue output + $mail->AddStringAttachment(writeSystemValuesOutput($usage = 'mail'), "systemvariables.html"); + } - if ($_POST['phpinfo'] == 'on') - { - //send phpinfo output - $mail->AddStringAttachment(phpInfoToHtml(), "phpinfo.html"); - } + if ($_POST['phpinfo'] == 'on') { + //send phpinfo output + $mail->AddStringAttachment(phpInfoToHtml(), "phpinfo.html"); + } - if (!$mail->Send()) - { - $tmp_notification = $notification->returnNotification("error", i18n("an error occured while sending your bug report! Please try again")); - } else - { - $tmp_notification = $notification->returnNotification("info", i18n("bug report forwarded")); - } - } - elseif ($mailSendError == 1) - { - /* user should fill all fields */ - $tmp_notification = $notification->returnNotification("warning", i18n("please fill out all mandatory fields")); - } - elseif ($mailSendError == 2) - { /* email adress is not valid */ - $tmp_notification = $notification->returnNotification("warning", i18n("please enter a valid E-Mail adress")); - } - elseif ($mailSendError == 3) - { /* user hasn't agreed to the declaration of consent */ - $tmp_notification = $notification->returnNotification("warning", i18n("you must agree the declaration of consent")); - } - return $mailSendError."||".$tmp_notification; + if (!$mail->Send()) { + $tmp_notification = $notification->returnNotification("error", i18n("an error occured while sending your bug report! Please try again")); + } else { + $tmp_notification = $notification->returnNotification("info", i18n("bug report forwarded")); + } + } elseif ($mailSendError == 1) { + /* user should fill all fields */ + $tmp_notification = $notification->returnNotification("warning", i18n("please fill out all mandatory fields")); + } elseif ($mailSendError == 2) { /* email adress is not valid */ + $tmp_notification = $notification->returnNotification("warning", i18n("please enter a valid E-Mail adress")); + } elseif ($mailSendError == 3) { /* user hasn't agreed to the declaration of consent */ + $tmp_notification = $notification->returnNotification("warning", i18n("you must agree the declaration of consent")); + } + return $mailSendError . "||" . $tmp_notification; } + ?> From a122b67aa40f7efd0078ea7c61ba80a5a9ea3354 Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 27 Jan 2022 21:25:30 +0100 Subject: [PATCH 07/25] add doc tags --- conlite/includes/functions.system.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conlite/includes/functions.system.php b/conlite/includes/functions.system.php index 341dd7e..fc80e04 100644 --- a/conlite/includes/functions.system.php +++ b/conlite/includes/functions.system.php @@ -205,6 +205,12 @@ function compareUrlStrings($arrConUrl, $arrBrowserUrl) { return true; } +/** + * Convert parse_url array to string + * + * @param array $parsed_url + * @return string URL + */ function unparse_url($parsed_url) { $scheme = isset($parsed_url['scheme']) && is_string($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; $host = isset($parsed_url['host']) && is_string($parsed_url['host']) ? $parsed_url['host'] : ''; From 7b5301b75cd932fe4df527e64bace583cbc5c84f Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 27 Jan 2022 21:58:47 +0100 Subject: [PATCH 08/25] fixes PHP 8.1 --- conlite/classes/class.autoload.php | 8 ++++---- conlite/includes/pseudo-cron.inc.php | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/conlite/classes/class.autoload.php b/conlite/classes/class.autoload.php index 7522a26..d29ac55 100644 --- a/conlite/classes/class.autoload.php +++ b/conlite/classes/class.autoload.php @@ -238,7 +238,7 @@ class cAutoload { * @return (string|null) Path and filename or null */ private static function _getContenidoClassFile($className) { - $file = isset(self::$_includeFiles[$className]) ? self::$_conRootPath . self::$_includeFiles[$className] : null; + $file = isset(self::$_includeFiles[$className]) ? self::$_conRootPath . self::$_includeFiles[$className] : ''; return self::_validateClassAndFile($className, $file); } @@ -247,7 +247,7 @@ class cAutoload { * * @param string $className * @param string $filePathName - * @return (string|null) The file if validation was successfull, otherwhise null + * @return (string) The file if validation was successfull, otherwhise empty */ private static function _validateClassAndFile($className, $filePathName) { if (class_exists($className)) { @@ -256,14 +256,14 @@ class cAutoload { 'file' => str_replace(self::$_conRootPath, '', $filePathName), 'error' => self::ERROR_CLASS_EXISTS ); - return null; + return ''; } elseif (!is_file($filePathName)) { self::$_errors[] = array( 'class' => $className, 'file' => str_replace(self::$_conRootPath, '', $filePathName), 'error' => self::ERROR_FILE_NOT_FOUND ); - return null; + return ''; } return $filePathName; diff --git a/conlite/includes/pseudo-cron.inc.php b/conlite/includes/pseudo-cron.inc.php index c0a0b3b..ac701fe 100644 --- a/conlite/includes/pseudo-cron.inc.php +++ b/conlite/includes/pseudo-cron.inc.php @@ -194,9 +194,15 @@ function logMessage($msg, $PC_writeDir, $PC_useLog, $PC_debug) { } function lTrimZeros($number) { + + /* while ($number[0] == '0') { $number = substr($number, 1); } + * + */ + + $number = intval(ltrim($number, '0')); return (is_numeric($number))?$number:0; } From 52153f11995c0a694f70e5b587ef9e76b56ee1cd Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Fri, 4 Mar 2022 16:22:59 +0100 Subject: [PATCH 09/25] fixes PHP 8.1 --- conlib/db_mysqli.inc | 5 +- conlite/classes/cApi/class.upload.php | 2 +- conlite/classes/cHTML5/class.chtml.php | 7 +- .../classes/cHTML5/class.chtml5.common.php | 583 ++++++++++++++++++ conlite/classes/class.genericdb.php | 7 +- conlite/classes/class.htmlelements.php | 2 +- conlite/classes/class.string.php | 15 + conlite/classes/class.ui.php | 14 +- .../includes/api/functions.frontend.list.php | 4 +- conlite/includes/functions.general.php | 3 + conlite/includes/functions.upl.php | 35 +- conlite/includes/include.lay_edit_form.php | 6 +- conlite/includes/include.lay_overview.php | 4 +- .../includes/include.upl_dirs_overview.php | 4 + .../includes/include.upl_files_overview.php | 12 +- data/config/production/config.autoloader.php | 1 + 16 files changed, 665 insertions(+), 39 deletions(-) create mode 100644 conlite/classes/cHTML5/class.chtml5.common.php diff --git a/conlib/db_mysqli.inc b/conlib/db_mysqli.inc index f183533..5cfd720 100644 --- a/conlib/db_mysqli.inc +++ b/conlib/db_mysqli.inc @@ -424,10 +424,13 @@ class DB_Sql extends DB_Sql_Abstract { * @see DB_Sql_Abstract::escape() */ public function escape($sString) { + if(is_null($sString)) { + $sString = ''; + } $sResult = ''; if (is_resource($this->Link_ID) || $this->connect()) { $sResult = mysqli_real_escape_string($this->Link_ID, $sString); - }; + } return $sResult; } diff --git a/conlite/classes/cApi/class.upload.php b/conlite/classes/cApi/class.upload.php index 308781b..c9dbfba 100644 --- a/conlite/classes/cApi/class.upload.php +++ b/conlite/classes/cApi/class.upload.php @@ -36,7 +36,7 @@ class cApiUploadCollection extends ItemCollection { public function sync($dir, $file) { global $client; - if (strstr(strtolower($_ENV["OS"]), 'windows') === FALSE) { + if (!empty($_ENV["OS"]) && strstr(strtolower($_ENV["OS"]), 'windows') === FALSE) { #Unix style OS distinguish between lower and uppercase file names, i.e. test.gif is not the same as Test.gif $this->select("dirname = BINARY '$dir' AND filename = BINARY '$file' AND idclient = '$client'"); } else { diff --git a/conlite/classes/cHTML5/class.chtml.php b/conlite/classes/cHTML5/class.chtml.php index 26a6c38..1448d46 100644 --- a/conlite/classes/cHTML5/class.chtml.php +++ b/conlite/classes/cHTML5/class.chtml.php @@ -17,13 +17,14 @@ * @link http://www.conlite.org ConLite.org */ + // security check defined('CON_FRAMEWORK') or die('Illegal call'); - +/* if (!class_exists("HTML_Common2")) { cInclude("pear", "HTML/Common2.php"); } - +*/ /* Global ID counter */ $cHTMLIDCount = 0; @@ -32,7 +33,7 @@ $cHTMLIDCount = 0; * * @author Ortwin Pinke */ -class cHTML extends HTML_Common2 { +class cHTML extends cHTML5Common { /** * Storage of the open SGML tag template diff --git a/conlite/classes/cHTML5/class.chtml5.common.php b/conlite/classes/cHTML5/class.chtml5.common.php new file mode 100644 index 0000000..6a58c10 --- /dev/null +++ b/conlite/classes/cHTML5/class.chtml5.common.php @@ -0,0 +1,583 @@ + + * @copyright (c) 2022, conlite.org + * @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version) + * @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version) + * @link http://www.conlite.org ConLite.org + */ + +/* + * HTML_Common2: port of HTML_Common package to PHP5 + * + * PHP version 5 + * + * LICENSE: + * + * Copyright (c) 2004-2012, Alexey Borzov + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * The names of the authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @category HTML + * @package HTML_Common2 + * @author Alexey Borzov + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @version SVN: $Id$ + * @link http://pear.php.net/package/HTML_Common2 + */ + +/* + * Base class for HTML classes + * + * Implements methods for working with HTML attributes, parsing and generating + * attribute strings. Port of HTML_Common class for PHP4 originally written by + * Adam Daniel with contributions from numerous other developers. + * + * @category HTML + * @package HTML_Common2 + * @author Alexey Borzov + * @license http://opensource.org/licenses/bsd-license.php New BSD License + * @version Release: 2.1.0 + * @link http://pear.php.net/package/HTML_Common2 + */ +abstract class cHTML5Common implements ArrayAccess +{ + /** + * Associative array of attributes + * @var array + */ + protected $attributes = array(); + + /** + * Changes to attributes in this list will be announced via onAttributeChange() + * method rather than performed by HTML_Common2 class itself + * @var array + * @see onAttributeChange() + */ + protected $watchedAttributes = array(); + + /** + * Indentation level of the element + * @var int + */ + private $_indentLevel = 0; + + /** + * Comment associated with the element + * @var string + */ + private $_comment = null; + + /** + * Global options for all elements generated by subclasses of HTML_Common2 + * + * Preset options are + * - 'charset': charset parameter used in htmlspecialchars() calls, + * defaults to 'ISO-8859-1' + * - 'indent': string used to indent HTML elements, defaults to "\11" + * - 'linebreak': string used to indicate linebreak, defaults to "\12" + * + * @var array + */ + private static $_options = array( + 'charset' => 'ISO-8859-1', + 'indent' => "\11", + 'linebreak' => "\12" + ); + + /** + * Sets global option(s) + * + * @param string|array $nameOrOptions Option name or array ('option name' => 'option value') + * @param mixed $value Option value, if first argument is not an array + */ + public static function setOption($nameOrOptions, $value = null) + { + if (is_array($nameOrOptions)) { + foreach ($nameOrOptions as $k => $v) { + self::setOption($k, $v); + } + } else { + $linebreaks = array('win' => "\15\12", 'unix' => "\12", 'mac' => "\15"); + if ('linebreak' == $nameOrOptions && isset($linebreaks[$value])) { + $value = $linebreaks[$value]; + } + self::$_options[$nameOrOptions] = $value; + } + } + + /** + * Returns global option(s) + * + * @param string $name Option name + * + * @return mixed Option value, null if option does not exist, + * array of all options if $name is not given + */ + public static function getOption($name = null) + { + if (null === $name) { + return self::$_options; + } else { + return isset(self::$_options[$name])? self::$_options[$name]: null; + } + } + + /** + * Parses the HTML attributes given as string + * + * @param string $attrString HTML attribute string + * + * @return array An associative array of attributes + */ + protected static function parseAttributes($attrString) + { + $attributes = array(); + if (preg_match_all( + "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" . + "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/", + $attrString, + $regs + )) { + for ($i = 0; $i < count($regs[1]); $i++) { + $name = trim($regs[1][$i]); + $check = trim($regs[0][$i]); + $value = trim($regs[7][$i]); + if ($name == $check) { + $attributes[strtolower($name)] = strtolower($name); + } else { + if (!empty($value) && ($value[0] == '\'' || $value[0] == '"')) { + $value = substr($value, 1, -1); + } + $attributes[strtolower($name)] = $value; + } + } + } + return $attributes; + } + + /** + * Creates a valid attribute array from either a string or an array + * + * @param string|array $attributes Array of attributes or HTML attribute string + * + * @return array An associative array of attributes + */ + protected static function prepareAttributes($attributes) + { + $prepared = array(); + if (is_string($attributes)) { + return self::parseAttributes($attributes); + + } elseif (is_array($attributes)) { + foreach ($attributes as $key => $value) { + if (is_int($key)) { + $key = strtolower($value); + $prepared[$key] = $key; + } else { + $prepared[strtolower($key)] = (string)$value; + } + } + } + return $prepared; + } + + /** + * Removes an attribute from an attribute array + * + * @param array &$attributes Attribute array + * @param string $name Name of attribute to remove + */ + protected static function removeAttributeArray(array &$attributes, $name) + { + unset($attributes[strtolower($name)]); + } + + /** + * Creates HTML attribute string from array + * + * @param array $attributes Attribute array + * + * @return string Attribute string + */ + protected static function getAttributesString(array $attributes) + { + $str = ''; + $charset = self::getOption('charset'); + foreach ($attributes as $key => $value) { + $str .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES, $charset) . '"'; + } + return $str; + } + + /** + * Class constructor, sets default attributes + * + * @param array|string $attributes Array of attribute 'name' => 'value' pairs + * or HTML attribute string + */ + public function __construct($attributes = null) + { + $this->mergeAttributes($attributes); + } + + /** + * Sets the value of the attribute + * + * @param string $name Attribute name + * @param string $value Attribute value (will be set to $name if omitted) + * + * @return HTML_Common2 + */ + public function setAttribute($name, $value = null) + { + $name = strtolower($name); + if (is_null($value)) { + $value = $name; + } + if (in_array($name, $this->watchedAttributes)) { + $this->onAttributeChange($name, $value); + } else { + $this->attributes[$name] = (string)$value; + } + return $this; + } + + /** + * Returns the value of an attribute + * + * @param string $name Attribute name + * + * @return string|null Attribute value, null if attribute does not exist + */ + public function getAttribute($name) + { + $name = strtolower($name); + return isset($this->attributes[$name])? $this->attributes[$name]: ''; + } + + /** + * Sets the attributes + * + * @param string|array $attributes Array of attribute 'name' => 'value' pairs + * or HTML attribute string + * + * @return HTML_Common2 + */ + public function setAttributes($attributes) + { + $attributes = self::prepareAttributes($attributes); + $watched = array(); + foreach ($this->watchedAttributes as $watchedKey) { + if (isset($attributes[$watchedKey])) { + $this->setAttribute($watchedKey, $attributes[$watchedKey]); + unset($attributes[$watchedKey]); + } else { + $this->removeAttribute($watchedKey); + } + if (isset($this->attributes[$watchedKey])) { + $watched[$watchedKey] = $this->attributes[$watchedKey]; + } + } + $this->attributes = array_merge($watched, $attributes); + return $this; + } + + /** + * Returns the attribute array or string + * + * @param bool $asString Whether to return attributes as string + * + * @return array|string + */ + public function getAttributes($asString = false) + { + if ($asString) { + return self::getAttributesString($this->attributes); + } else { + return $this->attributes; + } + } + + /** + * Merges the existing attributes with the new ones + * + * @param array|string $attributes Array of attribute 'name' => 'value' pairs + * or HTML attribute string + * + * @return HTML_Common2 + */ + public function mergeAttributes($attributes) + { + $attributes = self::prepareAttributes($attributes); + foreach ($this->watchedAttributes as $watchedKey) { + if (isset($attributes[$watchedKey])) { + $this->onAttributeChange($watchedKey, $attributes[$watchedKey]); + unset($attributes[$watchedKey]); + } + } + $this->attributes = array_merge($this->attributes, $attributes); + return $this; + } + + /** + * Removes an attribute + * + * @param string $attribute Name of attribute to remove + * + * @return HTML_Common2 + */ + public function removeAttribute($attribute) + { + if (in_array(strtolower($attribute), $this->watchedAttributes)) { + $this->onAttributeChange(strtolower($attribute), null); + } else { + self::removeAttributeArray($this->attributes, $attribute); + } + return $this; + } + + /** + * Sets the indentation level + * + * @param int $level Indentation level + * + * @return HTML_Common2 + */ + public function setIndentLevel($level) + { + $level = intval($level); + if (0 <= $level) { + $this->_indentLevel = $level; + } + return $this; + } + + /** + * Gets the indentation level + * + * @return int + */ + public function getIndentLevel() + { + return $this->_indentLevel; + } + + /** + * Returns the string to indent the element + * + * @return string + */ + protected function getIndent() + { + return str_repeat(self::getOption('indent'), $this->getIndentLevel()); + } + + /** + * Sets the comment for the element + * + * @param string $comment String to output as HTML comment + * + * @return HTML_Common2 + */ + public function setComment($comment) + { + $this->_comment = $comment; + return $this; + } + + /** + * Returns the comment associated with the element + * + * @return string + */ + public function getComment() + { + return $this->_comment; + } + + /** + * Checks whether the element has given CSS class + * + * @param string $class CSS Class name + * + * @return bool + */ + public function hasClass($class) + { + $regex = '/(^|\s)' . preg_quote($class, '/') . '(\s|$)/'; + return (bool)preg_match($regex, $this->getAttribute('class')); + } + + /** + * Adds the given CSS class(es) to the element + * + * @param string|array $class Class name, multiple class names separated by + * whitespace, array of class names + * + * @return HTML_Common2 + */ + public function addClass($class) + { + if (!is_array($class)) { + $class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY); + } + $curClass = preg_split( + '/\s+/', $this->getAttribute('class'), null, PREG_SPLIT_NO_EMPTY + ); + foreach ($class as $c) { + if (!in_array($c, $curClass)) { + $curClass[] = $c; + } + } + $this->setAttribute('class', implode(' ', $curClass)); + + return $this; + } + + /** + * Removes the given CSS class(es) from the element + * + * @param string|array $class Class name, multiple class names separated by + * whitespace, array of class names + * + * @return HTML_Common2 + */ + public function removeClass($class) + { + if (!is_array($class)) { + $class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY); + } + $curClass = array_diff( + preg_split( + '/\s+/', $this->getAttribute('class'), null, PREG_SPLIT_NO_EMPTY + ), + $class + ); + if (0 == count($curClass)) { + $this->removeAttribute('class'); + } else { + $this->setAttribute('class', implode(' ', $curClass)); + } + return $this; + } + + /** + * Returns the HTML representation of the element + * + * This magic method allows using the instances of HTML_Common2 in string + * contexts + * + * @return string + */ + abstract public function __toString(); + + /** + * Called if trying to change an attribute with name in $watchedAttributes + * + * This method is called for each attribute whose name is in the + * $watchedAttributes array and which is being changed by setAttribute(), + * setAttributes() or mergeAttributes() or removed via removeAttribute(). + * Note that the operation for the attribute is not carried on after calling + * this method, it is the responsibility of this method to change or remove + * (or not) the attribute. + * + * @param string $name Attribute name + * @param string $value Attribute value, null if attribute is being removed + */ + protected function onAttributeChange($name, $value = null) + { + } + + /** + * Whether or not an offset (HTML attribute) exists + * + * @param string $offset An offset to check for. + * + * @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 + { + return isset($this->attributes[strtolower($offset)]); + } + + /** + * Returns the value at specified offset (i.e. attribute name) + * + * @param string $offset The offset to retrieve. + * + * @return string|null + * @link http://php.net/manual/en/arrayaccess.offsetget.php + * @see getAttribute() + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->getAttribute($offset); + } + + /** + * Assigns a value to the specified offset (i.e. attribute name) + * + * @param string $offset The offset to assign the value to + * @param string $value The value to set + * + * @return void + * @link http://php.net/manual/en/arrayaccess.offsetset.php + * @see setAttribute() + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (null !== $offset) { + $this->setAttribute($offset, $value); + } else { + // handles $foo[] = 'disabled'; + $this->setAttribute($value); + } + } + + /** + * Unsets an offset (i.e. removes an attribute) + * + * @param string $offset The offset to unset + * + * @return void + * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * @see removeAttribute + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + $this->removeAttribute($offset); + } +} \ No newline at end of file diff --git a/conlite/classes/class.genericdb.php b/conlite/classes/class.genericdb.php index 5225cff..ee774fd 100644 --- a/conlite/classes/class.genericdb.php +++ b/conlite/classes/class.genericdb.php @@ -1712,8 +1712,13 @@ abstract class Item extends cItemBaseAbstract { * @return mixed Filtered data */ public function _inFilter($mData) { - if (is_numeric($mData) || is_array($mData)) + if (is_numeric($mData) || is_array($mData)) { return $mData; + } + + if(is_null($mData)) { + $mData = ''; + } foreach ($this->_arrInFilters as $_function) { if (function_exists($_function)) { diff --git a/conlite/classes/class.htmlelements.php b/conlite/classes/class.htmlelements.php index 7828136..4c9830a 100644 --- a/conlite/classes/class.htmlelements.php +++ b/conlite/classes/class.htmlelements.php @@ -672,7 +672,7 @@ class cHTMLSelectElement extends cHTMLFormElement { */ function setDefault($lvalue) { $bSet = false; - + $lvalue = cString::nullToString($lvalue); if (is_array($this->_options)) { foreach ($this->_options as $key => $value) { if (strcmp($value->getAttribute("value"), $lvalue) == 0) { diff --git a/conlite/classes/class.string.php b/conlite/classes/class.string.php index 3f371a1..32b8ec2 100644 --- a/conlite/classes/class.string.php +++ b/conlite/classes/class.string.php @@ -715,4 +715,19 @@ class cString extends cStringMultiByteWrapper { return $string; } + + /** + * Convert null string to empty string + * + * @param string $string + * @return string + */ + public static function nullToString($string) { + //var_dump($string); + if(empty($string) || is_null($string)) { + $string = ''; + } + //var_dump($string); + return $string; + } } \ No newline at end of file diff --git a/conlite/classes/class.ui.php b/conlite/classes/class.ui.php index b8a84c9..0125de3 100644 --- a/conlite/classes/class.ui.php +++ b/conlite/classes/class.ui.php @@ -1027,10 +1027,10 @@ class cScrollList { var $listStart; /** - * sortable flag - * @var string + * sortable array + * @var array */ - var $sortable; + protected $_aSortable; /** * sortlink @@ -1080,7 +1080,7 @@ class cScrollList { $this->resultsPerPage = 0; $this->listStart = 1; - $this->sortable = false; + $this->_aSortable = []; $this->objTable = new cHTMLTable(); if ($defaultstyle == true) { @@ -1126,7 +1126,7 @@ class cScrollList { * @param $sortable boolean true or false */ function setSortable($key, $sortable) { - $this->sortable[$key] = $sortable; + $this->_aSortable[$key] = $sortable; } /** @@ -1330,8 +1330,8 @@ class cScrollList { /* Render header */ foreach ($this->header as $key => $value) { - if (is_array($this->sortable)) { - if (array_key_exists($key, $this->sortable) && $this->sortable[$key] == true) { + if (is_array($this->_aSortable)) { + if (array_key_exists($key, $this->_aSortable) && $this->_aSortable[$key] == true) { $this->sortlink->setContent($value); $this->sortlink->setCustom("sortby", $key); diff --git a/conlite/includes/api/functions.frontend.list.php b/conlite/includes/api/functions.frontend.list.php index 220078e..3b70740 100644 --- a/conlite/includes/api/functions.frontend.list.php +++ b/conlite/includes/api/functions.frontend.list.php @@ -89,12 +89,12 @@ class FrontendList * @param $endwrap Wrap for the list end * @param $itemwrap Wrap for a single item */ - function FrontendList ($startwrap, $endwrap, $itemwrap) + function __construct($startwrap, $endwrap, $itemwrap) { $this->resultsPerPage = 0; $this->listStart = 1; - $this->itemwrap = $itemwrap; + $this->itemwrap = (is_null($itemwrap))?'':$itemwrap; $this->startwrap = $startwrap; $this->endwrap = $endwrap; } diff --git a/conlite/includes/functions.general.php b/conlite/includes/functions.general.php index 31b5906..ff3ccce 100644 --- a/conlite/includes/functions.general.php +++ b/conlite/includes/functions.general.php @@ -1732,6 +1732,9 @@ function sendPostRequest($host, $path, $data, $referer = "", $port = 80) { } function is_dbfs($file) { + if(is_null($file)) { + $file = ''; + } if (substr($file, 0, 5) == "dbfs:") { return true; } diff --git a/conlite/includes/functions.upl.php b/conlite/includes/functions.upl.php index df022f3..5badbd4 100644 --- a/conlite/includes/functions.upl.php +++ b/conlite/includes/functions.upl.php @@ -46,9 +46,13 @@ if (!defined('CON_FRAMEWORK')) { * string is shorter there will be no tooltipp * @return string - string, which contains short path name and tooltipp if neccessary */ -function generateDisplayFilePath($sDisplayPath, $iLimit) { - $sDisplayPath = (string) trim($sDisplayPath); - $iLimit = (int) $iLimit; +function generateDisplayFilePath($mDisplayPath, $mLimit) { + if(is_null($mDisplayPath)) { + $sDisplayPath = ''; + } else { + $sDisplayPath = (string) trim($mDisplayPath); + } + $iLimit = intval($mLimit); if (strlen($sDisplayPath) > $iLimit) { $sDisplayPathShort = capiStrTrimHard($sDisplayPath, $iLimit); @@ -58,18 +62,18 @@ function generateDisplayFilePath($sDisplayPath, $iLimit) { $aPathFragments = explode('/', $sDisplayPath); foreach ($aPathFragments as $sFragment) { - if ($sFragment != '') { - if (strlen($sFragment) > ($iLimit - 5)) { - $sFragment = capiStrTrimHard($sFragment, $iLimit); - } + if (empty($sFragment)) { + continue; + } - if ($iCharcount + strlen($sFragment) + 1 > $iLimit) { - $sTooltippString .= '
' . $sFragment . '/'; - $iCharcount = strlen($sFragment); - } else { - $iCharcount = $iCharcount + 1 + strlen($sFragment); - $sTooltippString .= $sFragment . '/'; - } + if (strlen($sFragment) > ($iLimit - 5)) { + $sFragment = capiStrTrimHard($sFragment, $iLimit); + } else if ($iCharcount + strlen($sFragment) + 1 > $iLimit) { + $sTooltippString .= '
' . $sFragment . '/'; + $iCharcount = strlen($sFragment); + } else { + $iCharcount = $iCharcount + 1 + strlen($sFragment); + $sTooltippString .= $sFragment . '/'; } } @@ -111,8 +115,7 @@ function uplDirectoryListRecursive($currentdir, $startdir = NULL, $files = array foreach ($sorted_files as $file) { if ($file != ".." && $file != ".") { - if ((filetype(getcwd() . "/" . $file) == "dir") && - (opendir(getcwd() . "/" . $file) !== false)) { + if ((filetype(getcwd() . "/" . $file) == "dir") && (opendir(getcwd() . "/" . $file) !== false)) { $a_file['name'] = $file; $a_file['depth'] = $depth; $a_file['pathstring'] = $pathstring . $file . '/'; diff --git a/conlite/includes/include.lay_edit_form.php b/conlite/includes/include.lay_edit_form.php index 6e5e35f..208ce06 100644 --- a/conlite/includes/include.lay_edit_form.php +++ b/conlite/includes/include.lay_edit_form.php @@ -107,7 +107,11 @@ if (!$layout->virgin) { } $types = array_unique($types); - $layout->setProperty("layout", "used-types", implode($types, ";")); + if (version_compare(PHP_VERSION, '8.0.0', '>=')) { + $layout->setProperty("layout", "used-types", implode(";", $types)); + } else { + $layout->setProperty("layout", "used-types", implode($types, ";")); + } $msg = ""; diff --git a/conlite/includes/include.lay_overview.php b/conlite/includes/include.lay_overview.php index 46cda1e..457fff2 100644 --- a/conlite/includes/include.lay_overview.php +++ b/conlite/includes/include.lay_overview.php @@ -49,7 +49,7 @@ while ($layout = $oLayouts->next()) { } $name = $layout->get('name'); - $descr = $layout->get('description'); + $descr = cString::nullToString($layout->get('description')); $idlay = $layout->get('idlay'); if (strlen($descr) > 64) { @@ -102,7 +102,7 @@ while ($layout = $oLayouts->next()) { $tpl->set('d', 'TODO', $todo->render()); - if (stripslashes($_REQUEST['idlay']) == $idlay) { + if (filter_var($_REQUEST['idlay'], FILTER_SANITIZE_NUMBER_INT) == $idlay) { $tpl->set('d', 'ID', 'marked'); } else { $tpl->set('d', 'ID', ''); diff --git a/conlite/includes/include.upl_dirs_overview.php b/conlite/includes/include.upl_dirs_overview.php index d9535ee..99f52bb 100644 --- a/conlite/includes/include.upl_dirs_overview.php +++ b/conlite/includes/include.upl_dirs_overview.php @@ -73,6 +73,10 @@ if (!isset($path) && $sess->is_registered("upl_last_path")) { $path = $upl_last_path; } +if(is_null($path)) { + $path = ''; +} + $appendparameters = $_REQUEST["appendparameters"]; if (!isset($action)) diff --git a/conlite/includes/include.upl_files_overview.php b/conlite/includes/include.upl_files_overview.php index f21dd57..0758835 100644 --- a/conlite/includes/include.upl_files_overview.php +++ b/conlite/includes/include.upl_files_overview.php @@ -347,7 +347,7 @@ class UploadList extends FrontendList { case "xbm": case "wbmp": $sCacheThumbnail = uplGetThumbnail($data, 150); - $sCacheName = substr($sCacheThumbnail, strrpos($sCacheThumbnail, "/") + 1, strlen($sCacheThumbnail) - (strrchr($sCacheThumbnail, '/') + 1)); + $sCacheName = substr($sCacheThumbnail, strrpos($sCacheThumbnail, "/") + 1, strlen($sCacheThumbnail) - (strlen(strrchr($sCacheThumbnail, '/')) + 1)); $sFullPath = $cfgClient[$client]['path']['frontend'] . 'cache/' . $sCacheName; if (file_exists($sFullPath)) { $aDimensions = getimagesize($sFullPath); @@ -430,17 +430,21 @@ class UploadList extends FrontendList { * @param type $sErrorMessage * @return type */ -function uplRender($path, $sortby, $sortmode, $startpage = 1, $thumbnailmode, $sErrorMessage) { +function uplRender($path, $sortby, $sortmode, $startpage, $thumbnailmode, $sErrorMessage) { global $cfg, $client, $cfgClient, $area, $frame, $sess, $browserparameters, $appendparameters, $perm, $auth, $sReloadScript, $notification, $bDirectoryIsWritable; - if ($sortby == "") { + if(empty($sortby)) { $sortby = 3; $sortmode = "ASC"; } - if ($startpage == "") { + if(empty($startpage)) { $startpage = 1; } + + if(is_null($path)) { + $path = ''; + } $thisfile = $sess->url("main.php?idarea=$area&frame=$frame&path=$path&thumbnailmode=$thumbnailmode&appendparameters=$appendparameters"); $scrollthisfile = $thisfile . "&sortmode=$sortmode&sortby=$sortby&appendparameters=$appendparameters"; diff --git a/data/config/production/config.autoloader.php b/data/config/production/config.autoloader.php index 3948e17..c144032 100644 --- a/data/config/production/config.autoloader.php +++ b/data/config/production/config.autoloader.php @@ -174,6 +174,7 @@ return array( 'cHTML5Button' => 'conlite/classes/cHTML5/class.chtml5.button.php', 'cHTML5Meta' => 'conlite/classes/cHTML5/class.chtml5.meta.php', 'cHTML' => 'conlite/classes/cHTML5/class.chtml.php', + 'cHTML5Common' => 'conlite/classes/cHTML5/class.chtml5.common.php', 'cHTML5List' => 'conlite/classes/cHTML5/class.chtml5.list.php', 'XML_doc' => 'conlite/classes/class.xml.php', 'Contenido_FrontendNavigation_Breadcrumb' => 'conlite/classes/Contenido_FrontendNavigation/Contenido_FrontendNavigation_Breadcrumb.class.php', From d4a59c7504c6b7635f32978a72850f4f82785768 Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Fri, 4 Mar 2022 16:26:44 +0100 Subject: [PATCH 10/25] fixes PHP 8.1 --- .../classes/setup/class.pim.setup.plugin.install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conlite/plugins/pluginmanager/classes/setup/class.pim.setup.plugin.install.php b/conlite/plugins/pluginmanager/classes/setup/class.pim.setup.plugin.install.php index 64db36b..bd6bc31 100644 --- a/conlite/plugins/pluginmanager/classes/setup/class.pim.setup.plugin.install.php +++ b/conlite/plugins/pluginmanager/classes/setup/class.pim.setup.plugin.install.php @@ -212,7 +212,7 @@ class pimSetupPluginInstall extends pimSetupBase { private function _addNavMain() { $aAttributes = array(); - $iCountNavMain = count(self::$XmlNavMain->nav); + $iCountNavMain = (is_countable(self::$XmlNavMain->nav))?count(self::$XmlNavMain->nav):0; if ($iCountNavMain > 0) { $oNavMainColl = new cApiNavMainCollection(); From 0233aead87e7d85480671215e8de46089062d43a Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Fri, 4 Mar 2022 18:17:39 +0100 Subject: [PATCH 11/25] htaccess env --- .htaccess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index 6762b78..ed0c28e 100644 --- a/.htaccess +++ b/.htaccess @@ -14,7 +14,7 @@ # $Id: htaccess_simple.txt 145 2019-10-25 16:00:47Z oldperl $ ################################################################################ -#SetEnv CONLITE_ENVIRONMENT development +#SetEnv CONLITE_ENVIRONMENT dievino From f0aaecbded8d7f7e8d7e03932e0f8ee47ee91e81 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Fri, 11 Mar 2022 18:32:43 +0100 Subject: [PATCH 12/25] change settings for error_reporting --- data/config/production/config.misc.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/data/config/production/config.misc.php b/data/config/production/config.misc.php index 8cba9fa..8f4054d 100644 --- a/data/config/production/config.misc.php +++ b/data/config/production/config.misc.php @@ -159,12 +159,8 @@ if ($cfg["develop"]["show_errors"] if ($cfg["develop"]["show_deprecated"]) { error_reporting(E_ALL ^ E_NOTICE); } else { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { // remove unknown deprecated for PHP < 5.3 - error_reporting(E_ALL ^ E_NOTICE); - } else if (version_compare(PHP_VERSION, '7.0.0', '>=')) { + if (version_compare(PHP_VERSION, '7.4.0', '>=')) { error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_USER_DEPRECATED ^ E_WARNING); - } else if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_USER_DEPRECATED ^ E_STRICT); } else { error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_USER_DEPRECATED); } From 885eec3df0f68752c8208f982b23cde2c482b60b Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Sun, 3 Apr 2022 15:17:52 +0200 Subject: [PATCH 13/25] 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 = ''; $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 From 4fd28abfb2fc95f2dc46f23fbe28cc7269fdfeec Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Sun, 3 Apr 2022 15:18:45 +0200 Subject: [PATCH 14/25] fixed warning and deprecated errors --- cms/front_content.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cms/front_content.php b/cms/front_content.php index 9e847bd..79e3a2c 100644 --- a/cms/front_content.php +++ b/cms/front_content.php @@ -93,7 +93,7 @@ if ($cfg["use_pseudocron"] == true) { * PHPLIB application development toolkit * @see http://sourceforge.net/projects/phplib */ -if ($contenido) { +if (!empty($contenido)) { //Backend page_open(array('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang); @@ -128,7 +128,7 @@ if ($cfgClient["set"] != "set") { } # Check if this request is for a compressed file -if ($_GET['action'] == 'get_compressed') { +if (isset($_GET['action']) && $_GET['action'] == 'get_compressed') { # Get the calling parameters $sFilename = ((isset($_GET['f'])) ? $_GET['f'] : $_GET['amp;f']); $sContentType = ((isset($_GET['c'])) ? $_GET['c'] : $_GET['amp;c']); @@ -264,9 +264,9 @@ if ($idart && !$idcat && !$idcatart) { unset($code); unset($markscript); -if (!$idcatart) { - if (!$idart) { - if (!$idcat) { +if (empty($idcatart)) { + if (empty($idart)) { + if (empty($idcat)) { # Note: In earlier Contenido versions the information if an article is startarticle of a category has been stored # in relation con_cat_art. if ($cfg["is_start_compatible"] == true) { @@ -313,7 +313,7 @@ if (!$idcatart) { $idart = $db->f("idart"); $idcat = $db->f("idcat"); } else { - if ($contenido) { + if (!empty($contenido)) { cInclude("includes", "functions.i18n.php"); die(i18n("No start article for this category")); } else { @@ -525,7 +525,7 @@ if ($contenido) { /* If mode is 'edit' and user has permission to edit articles in the current category */ -if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) { +if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) { cInclude("includes", "functions.tpl.php"); cInclude("includes", "functions.con.php"); include ($cfg["path"]["contenido"] . $cfg["path"]["includes"] . "include.con_editcontent.php"); @@ -606,10 +606,12 @@ if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_ar } /* Add mark Script to code if user is in the backend */ - $code = preg_replace("/<\/head>/i", "$markscript\n", $code, 1); + if(!empty($markscript)) { + $code = preg_replace("/<\/head>/i", "$markscript\n", $code, 1); + } /* If article is in use, display notification */ - if ($sHtmlInUseCss && $sHtmlInUseMessage) { + if (!empty($sHtmlInUseCss) && !empty($sHtmlInUseMessage)) { $code = preg_replace("/<\/head>/i", "$sHtmlInUseCss\n", $code, 1); $code = preg_replace("/(]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1); } From bbad0ba0ab3661b67409c7ffb08478aba6460989 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Sun, 3 Apr 2022 15:21:26 +0200 Subject: [PATCH 15/25] git admin --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 50ed16c..1596dd6 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ /cms/js/firstlevel/ /conlite/external/**/.git /dievino/ +/conlite/logs/debug.log From 47e3333a906ddaff9cc779a3d290d1e48f40abe7 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Sun, 3 Apr 2022 15:22:10 +0200 Subject: [PATCH 16/25] deleted --- conlite/logs/deprecated.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 conlite/logs/deprecated.txt diff --git a/conlite/logs/deprecated.txt b/conlite/logs/deprecated.txt deleted file mode 100644 index e69de29..0000000 From f46d4fea202f1b73aa1f0d6d39e68a93c1f5a12b Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Sun, 3 Apr 2022 15:25:54 +0200 Subject: [PATCH 17/25] git admin --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 1596dd6..9ddeb8a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ /conlite/external/**/.git /dievino/ /conlite/logs/debug.log +/cms/data/config/production/config.mod_rewrite.php +/cms/data/config/production/config.local.php From b2f7798eeedc5756230058ef18ccf62a662f830d Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Sun, 3 Apr 2022 15:33:21 +0200 Subject: [PATCH 18/25] fixed warning and deprecated errors --- cms/front_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/front_content.php b/cms/front_content.php index 79e3a2c..d9686b8 100644 --- a/cms/front_content.php +++ b/cms/front_content.php @@ -123,7 +123,7 @@ $sess->register("errsite_idcat"); $sess->register("errsite_idart"); $sess->register("encoding"); -if ($cfgClient["set"] != "set") { +if (empty($cfgClient["set"]) || $cfgClient["set"] != "set") { rereadClients(); } From 100c60cc23c598d5806bf619bfb50ffe9324a2c1 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Sun, 3 Apr 2022 15:33:34 +0200 Subject: [PATCH 19/25] fixed warning and deprecated errors --- conlite/classes/class.article.php | 4 ++-- .../createmetatags/classes/class.metatag.creator.html5.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conlite/classes/class.article.php b/conlite/classes/class.article.php index bee4669..b4fc1cc 100644 --- a/conlite/classes/class.article.php +++ b/conlite/classes/class.article.php @@ -283,7 +283,7 @@ class Article extends Item */ public function getContent($type, $id = NULL) { - if ($type == '') { + if (empty($type)) { return 'Class ' . get_class($this) . ': content-type must be specified!'; } @@ -295,7 +295,7 @@ class Article extends Item if (is_null($id)) { // return Array - return $this->content[$type]; + return (empty($this->content[$type]))?'':$this->content[$type]; } // return String diff --git a/conlite/plugins/chains/createmetatags/classes/class.metatag.creator.html5.php b/conlite/plugins/chains/createmetatags/classes/class.metatag.creator.html5.php index 373c403..b28338d 100644 --- a/conlite/plugins/chains/createmetatags/classes/class.metatag.creator.html5.php +++ b/conlite/plugins/chains/createmetatags/classes/class.metatag.creator.html5.php @@ -225,7 +225,7 @@ class MetaTagCreatorHtml5 { * @return boolean */ protected function _addFacebookMetaTags() { - if(!$this->_aConfig['add_facebook_meta']) return; + if(empty($this->_aConfig['add_facebook_meta'])) return; // add always article data, cause they needed for fb-meta if($this->_aConfig['add_article_meta'] === false) { $this->_aConfig['add_article_meta'] = true; From 10380f8a9e8618d2465499b0db5c939fc236bd2b Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Mon, 16 May 2022 18:33:26 +0200 Subject: [PATCH 20/25] hint for ConLite environment settings in htaccess --- .htaccess | 6 +++++- conlite/plugins/cl-mod-rewrite | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.htaccess b/.htaccess index eeb264a..a4a8c5f 100644 --- a/.htaccess +++ b/.htaccess @@ -14,7 +14,11 @@ # $Id: htaccess_simple.txt 145 2019-10-25 16:00:47Z oldperl $ ################################################################################ -#SetEnv CONLITE_ENVIRONMENT dievino +# easily set this enviroment variable to the config you want to use +# add a config folder with the same name in data/config and cms/data/config +# and use your custom config for development + +#SetEnv CONLITE_ENVIRONMENT develop diff --git a/conlite/plugins/cl-mod-rewrite b/conlite/plugins/cl-mod-rewrite index 06cc337..91b0fd8 160000 --- a/conlite/plugins/cl-mod-rewrite +++ b/conlite/plugins/cl-mod-rewrite @@ -1 +1 @@ -Subproject commit 06cc337092ed649df1ec738816ba6a3e59a8af0b +Subproject commit 91b0fd8c15cdf1b5e9704c8720a40f959e7eb4fe From 59cb72faef4ea2f8659d31462c7bb873671e68f2 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Tue, 17 May 2022 13:40:34 +0200 Subject: [PATCH 21/25] fix missing subnav --- conlite/templates/standard/template.info.html | 4 ++-- setup/data/base/base_files1.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conlite/templates/standard/template.info.html b/conlite/templates/standard/template.info.html index d784eba..de3b066 100644 --- a/conlite/templates/standard/template.info.html +++ b/conlite/templates/standard/template.info.html @@ -18,10 +18,10 @@
Current version:
- Carsten Peters, Markus Hübner, Ortwin Pinke, René Mansveld, Steffen Reddig, Thomas Dubbert + Carsten Peters, Markus Hübner, Ortwin Pinke, Lars Lämmerhirt

Special thanks to all contributors of the former releases and bugreporters.
- - + René Mansveld, Steffen Reddig, Thomas Dubbert

Special thanks to all contributors of Contenido up to 4.8.15, which ConLite is based upon.
Andreas Kummer, Andreas Lindner, Bilal Arslan, Björn Behrens, Christa Tabara, Christian End, Conrad Leu, Dominik Ziegler, Frederic Schneider, Harald Wirths, Holger Librenz, Ingo van Peeren, Jonas Vogel, Kristina Birkenbeul, Marco Prey, Martin Horwath, Murat Purç, Oliver Lohkemper, Rudi Bieller, Timo Trautmann, Thorsten Granz, Thomas Schäfer-Tertilt, Tobias Klonk, Daniel Rothmaler, Guido, i-fekt, Helen Schäfer, Jan Lengowski, John van Aerle, Maria Martha Sanchez-Straub, Marco Jahn, Martin Hahn, Marion Fischer, Olaf Niemann, Robert Herbert, Stefan Jelner, Timo A. Hummel, Willi Man diff --git a/setup/data/base/base_files1.sql b/setup/data/base/base_files1.sql index 821c511..ca4e58c 100644 --- a/setup/data/base/base_files1.sql +++ b/setup/data/base/base_files1.sql @@ -180,7 +180,7 @@ INSERT INTO !PREFIX!_files VALUES('402', '402', 'include.js_history.php', 'main' INSERT INTO !PREFIX!_files VALUES('403', '403', 'include.html_tpl_history.php', 'main'); INSERT INTO !PREFIX!_files VALUES('415', '415', 'include.system_configuration.php', 'main'); INSERT INTO !PREFIX!_files VALUES('503', '52', 'include.subnav.php', 'main'); -INSERT INTO !PREFIX!_files VALUES('700', '52', 'include.subnav_blank.php', 'main'); +INSERT INTO !PREFIX!_files VALUES('700', '52', 'include.subnav.php', 'main'); INSERT INTO !PREFIX!_files VALUES('813', '811', 'include.system_purge.php', 'main'); INSERT INTO !PREFIX!_files VALUES('814', '812', 'include.system_db_backup.php', 'main'); INSERT INTO !PREFIX!_files VALUES('990', '990', 'pluginmanager/includes/include.right_bottom.php', 'main'); \ No newline at end of file From 1c01dca90af291544ad44e7e24e613746677dc77 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Tue, 17 May 2022 15:57:15 +0200 Subject: [PATCH 22/25] fixes while checking backend on php 7.4 --- cms/cache/.gitignore | 4 - cms/css/basic-style.css | 1044 ++++++++--------- cms/front_content.php | 22 +- cms/templates/cms_filelist_style_default.html | 34 +- .../external/backendedit/front_content.php | 609 ++++------ conlite/includes/functions.file.php | 6 +- .../includes/include.frontend.group_edit.php | 2 +- .../include.frontend.group_rights.php | 153 ++- .../includes/include.frontend.user_edit.php | 2 +- conlite/includes/include.lay_edit_form.php | 2 +- 10 files changed, 857 insertions(+), 1021 deletions(-) delete mode 100644 cms/cache/.gitignore diff --git a/cms/cache/.gitignore b/cms/cache/.gitignore deleted file mode 100644 index 86d0cb2..0000000 --- a/cms/cache/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/cms/css/basic-style.css b/cms/css/basic-style.css index a2c9e8b..9bd8a1f 100644 --- a/cms/css/basic-style.css +++ b/cms/css/basic-style.css @@ -1,523 +1,523 @@ -/* -Simple Responsive Template v 1.2 - - -primary styles - Author: www.prowebdesign.ro - Add your own styles to customize the project. - - - -BASE (MOBILE) SIZE - These are the mobile styles. It's what people see on their phones. - Remember, keep it light: Speed is Important. -*/ - -/* typography */ -body{ - color:#666; - font-family:'Ubuntu', Arial, Helvetica, sans-serif; - font-size:1em; - line-height:1.4em; - font-weight:normal; -} -h1, h2, h3, h4, h5, h6{ - font-weight:normal; - font-family:'Droid Serif', Arial, Helvetica, sans-serif; - line-height:1.5em; - margin:.45em 0; - padding:0; -} - - -/* links */ -a, -a:visited, -a:active, -a:hover{color:#0099ff;} -a:hover{ text-decoration:none;} - - -/* Box sizing. Awesome thing. Read about it here: http://www.w3schools.com/cssref/css3_pr_box-sizing.asp */ -*{ box-sizing:border-box; - -moz-box-sizing:border-box;} - - -/* structure */ -.wrapper{ - width: 92%; - margin: 0 auto; -} -header{ - padding:15px 0; -} -#banner{ - text-align:center; -} - -#hero, -#page-header{ - background:#f3f3f3; - border-top:1px solid #e2e2e2; - border-bottom:1px solid #e2e2e2; - padding:20px 0; -} -#hero h1{ - line-height:1.2em; - margin-top:0px; - margin-bottom:10px;} - -.flexslider{ - display:none; -} - -#content { - margin:40px 0; -} - -aside { - margin:40px 0; -} - -p{ margin:0 0 1.5em;} - - -/* RESPONSIVE IMAGES */ -img{ max-width:100%; height:auto;} - - -/*MAIN MENU*/ -.menu-toggle{ - display:block; - padding:10px; - margin:20px 0 0; - background:#666; - color:#fff; - cursor:pointer; - text-transform:uppercase; - font-size:20px; -} -.menu-toggle.toggled-on{ - background:#0099ff; -} -.srt-menu{ - display:none; -} -.srt-menu.toggled-on{ - display:block; - position:relative; - z-index:10; -} - -.srt-menu{ - clear:both; - margin-bottom:60px; - -} -.srt-menu li a { - background:#dadada; - display:block; - margin:1px 0; - padding:10px; - text-decoration:none; -} -.srt-menu li a:hover{ - background:#0099ff; - color:#fff; -} -.srt-menu li li a { - background:#e8e8e8; - padding-left:40px; -} -.srt-menu li li li a { - background:#efefef; - padding-left:80px; -} - -/*SECONDARY MENU*/ -#secondary-navigation{ - margin-bottom:60px; -} -#secondary-navigation ul{ - margin:0; - padding:0; -} -#secondary-navigation ul li a{ - background:#E6E6E6; - display:block; - margin:5px 0; - padding:10px; - text-decoration:none; -} -#secondary-navigation ul li a:hover, -#secondary-navigation ul li.active a{ - background:#0099ff; - color:#fff; -} - -/*SPACE GRID ELEMENTS VERTICALLY, SINCE THEY ARE ONE UNDER ANOTHER SO FAR*/ -.grid_1, -.grid_2, -.grid_3, -.grid_4, -.grid_5, -.grid_6, -.grid_7, -.grid_8, -.grid_9, -.grid_10, -.grid_11, -.grid_12 { - margin-bottom:40px; - /*positioning and padding*/ - position: relative; - min-height: 1px; - padding-left: 15px; - padding-right: 15px; -} - -/*FOOTER*/ -footer{ - clear:both; - font-size:80%; - padding:20px 0; -} -footer ul{ - margin:0; - padding:0; -} - -/*colors and backgrounds*/ -body{ - background:#fff; -} -h1, h2, h3, h4, h5, h6{ - color:#333; -} - -footer{ - background:#333; - color:#ccc; -} -footer h1, footer h2, footer h3, footer h4{ - color:#CCC; - margin-bottom:10px; -} -footer ul{ - margin:0 0 0 8%; -} - -a.buttonlink{ - background:#0099ff; - border-radius:7px; - color:#fff; - display:block; - float:left; - margin:10px 15px 10px 0; - padding:10px; - text-decoration:none; -} -a.buttonlink:hover{ - background:#8dbc01; -} -.greenelement{ - background:#5ec79e; - color:#fff; -} -.violetelement{ - background:#887dc2; - color:#fff; -} - - - -/* Contain floats*/ -.clearfix:before, -.clearfix:after, -.row:before, -.row:after { - content: " "; - display: table; -} -.clearfix:after, -.container:after, -.row:after{ - clear: both; -} - - -/* -LARGER MOBILE DEVICES -This is for mobile devices with a bit larger screens. -*/ -@media only screen and (min-width: 481px) { -#banner{ - float:left; - text-align:left; - margin-bottom:-20px;/*this depends on the height of the logo*/ -} -.menu-toggle{/*make menu float right, instead of sitting under the logo*/ - margin-top:10px; /*this depends on the height of the logo*/ - float:right; -} - -} - -/* -TABLET & SMALLER LAPTOPS -The average viewing window and preferred media query for those is 768px. -But I think that some more breathing space is good:) -*/ -@media only screen and (min-width: 920px) { - -.wrapper{ - max-width: 1200px; - margin: .75em auto; -} - -#banner{ - float:left; - text-align:left; - margin-bottom:0px; -} -header{ - padding:0; -} -#content { - float:left; - width:65%; -} -#content.wide-content{ - float:none; - width:100%; -} - -.flexslider{ -display:block; -/*demo 1 slider theme*/ -margin: 0 0 60px; -background: #fff; -border: 4px solid #fff; --webkit-border-radius: 4px; --moz-border-radius: 4px; --o-border-radius: 4px; -border-radius: 4px; -box-shadow: 0 1px 4px rgba(0,0,0,.2); --webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2); --moz-box-shadow: 0 1px 4px rgba(0,0,0,.2); --o-box-shadow: 0 1px 4px rgba(0,0,0,.2); -} - - -aside { - float:right; - width:30%; -} - -/*** MAIN MENU - ESSENTIAL STYLES ***/ -.menu-toggle{display:none;} -#menu-main-navigation{display:block;} - -.srt-menu, .srt-menu * { - margin: 0; - padding: 0; - list-style: none; -} -.srt-menu ul { - position: absolute; - display:none; - width: 12em; /* left offset of submenus need to match (see below) */ -} -.srt-menu ul li { - width: 100%; -} -.srt-menu li:hover { - visibility: inherit; /* fixes IE7 'sticky bug' */ -} -.srt-menu li { - float: left; - position: relative; - margin-left:1px; -} -.srt-menu li li { - margin-left:0px; -} -.srt-menu a { - display: block; - position: relative; -} -.srt-menu li:hover ul, -.srt-menu li.sfHover ul { - display:block; - left: 0; - top: 45px; /* match top ul list item height */ - z-index: 99; - -webkit-box-shadow: 2px 3px 2px 0px rgba(00, 00, 00, .3); - box-shadow: 2px 3px 2px 0px rgba(00, 00, 00, .3); -} -ul.srt-menu li:hover li ul, -ul.srt-menu li.sfHover li ul { - top: -999em; -} -ul.srt-menu li li:hover ul, -ul.srt-menu li li.sfHover ul { - left: 12em; /* match ul width */ - top: 0; -} -ul.srt-menu li li:hover li ul, -ul.srt-menu li li.sfHover li ul { - top: -999em; -} -ul.srt-menu li li li:hover ul, -ul.srt-menu li li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; -} - -/*** DEMO1 SKIN ***/ -#topnav, .srt-menu { - float:right; - margin: .35em 0 0 0; -} -.srt-menu a { - text-decoration:none; -} -.srt-menu li a { - background:#fff; - margin:0; - padding:10px 20px; - height:45px; -} -.srt-menu a, .srt-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/ - color: #0099ff; -} -.srt-menu li li a { - border-top: 1px solid rgba(255,255,255,.2); - background: #333; /*fallback for old IE*/ - background:rgba(0,0,0,.6); - color: #fff; - padding-left:20px; - height:auto; -} -.srt-menu li li a:visited{color:#fff;} -.srt-menu li li li a, -.srt-menu li.active * li a{ - padding-left:20px; - background:rgba(0,0,0,.6); -} - -.srt-menu li:hover > a, -.srt-menu li.active a{ - color:#fff; - background:#0099ff; -} -.srt-menu li li:hover > a{ - color:#fff; - background:#0099ff; -} - - - -/*GRID*/ -/* - & Columns : 12 - - */ - .row{ - margin-left: -15px; - margin-right: -15px; -} - -.grid_1 { width: 8.33333333%; } -.grid_2 { width: 16.66666667%; } -.grid_3 { width: 25%; } -.grid_4 { width: 33.33333333%; } -.grid_5 { width: 41.66666667%; } -.grid_6 { width: 50%; } -.grid_7 { width: 58.33333333%; } -.grid_8 { width: 66.66666667%; } -.grid_9 { width: 75%; } -.grid_10 { width: 83.33333333%; } -.grid_11 { width: 91.66666667%; } -.grid_12 { width: 100%; } - -.grid_1, -.grid_2, -.grid_3, -.grid_4, -.grid_5, -.grid_6, -.grid_7, -.grid_8, -.grid_9, -.grid_10, -.grid_11, -.grid_12 { - float: left; - display: block; -} - -.rightfloat{float:right;} -/* @notation inspired by tinyGrid, .row and percentage by Twitter Bootstrap - */ - -#hero [class*="grid_"] { margin-bottom:-20px;} - -} - -/* -DESKTOP -This is the average viewing window. So Desktops, Laptops, and -in general anyone not viewing on a mobile device. Here's where -you can add resource intensive styles. -*/ -@media only screen and (min-width: 1030px) { - -} - -/* -LARGE VIEWING SIZE -This is for the larger monitors and possibly full screen viewers. -*/ -@media only screen and (min-width: 1240px) { - -} - -/* -RETINA (2x RESOLUTION DEVICES) -This applies to the retina iPhone (4s) and iPad (2,3) along with -other displays with a 2x resolution. -*/ -@media only screen and (-webkit-min-device-pixel-ratio: 1.5), - only screen and (min--moz-device-pixel-ratio: 1.5), - only screen and (min-device-pixel-ratio: 1.5) { - - -} - -/* -iPHONE 5 MEDIA QUERY -iPhone 5 or iPod Touch 5th generation styles (you can include your own file if you want) -*/ -@media (device-height: 568px) and (-webkit-min-device-pixel-ratio: 2) { - - -} - -/* -PRINT STYLESHEET -*/ -@media print { - * { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */ - a, a:visited { text-decoration: underline; } - a[href]:after { content: " (" attr(href) ")"; } - abbr[title]:after { content: " (" attr(title) ")"; } - .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */ - pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } - thead { display: table-header-group; } /* h5bp.com/t */ - tr, img { page-break-inside: avoid; } - img { max-width: 100% !important; } - @page { margin: 0.5cm; } - p, h2, h3 { orphans: 3; widows: 3; } - h2, h3 { page-break-after: avoid; } +/* +Simple Responsive Template v 1.2 test + + +primary styles + Author: www.prowebdesign.ro + Add your own styles to customize the project. + + + +BASE (MOBILE) SIZE + These are the mobile styles. It's what people see on their phones. + Remember, keep it light: Speed is Important. +*/ + +/* typography */ +body{ + color:#666; + font-family:'Ubuntu', Arial, Helvetica, sans-serif; + font-size:1em; + line-height:1.4em; + font-weight:normal; +} +h1, h2, h3, h4, h5, h6{ + font-weight:normal; + font-family:'Droid Serif', Arial, Helvetica, sans-serif; + line-height:1.5em; + margin:.45em 0; + padding:0; +} + + +/* links */ +a, +a:visited, +a:active, +a:hover{color:#0099ff;} +a:hover{ text-decoration:none;} + + +/* Box sizing. Awesome thing. Read about it here: http://www.w3schools.com/cssref/css3_pr_box-sizing.asp */ +*{ box-sizing:border-box; + -moz-box-sizing:border-box;} + + +/* structure */ +.wrapper{ + width: 92%; + margin: 0 auto; +} +header{ + padding:15px 0; +} +#banner{ + text-align:center; +} + +#hero, +#page-header{ + background:#f3f3f3; + border-top:1px solid #e2e2e2; + border-bottom:1px solid #e2e2e2; + padding:20px 0; +} +#hero h1{ + line-height:1.2em; + margin-top:0px; + margin-bottom:10px;} + +.flexslider{ + display:none; +} + +#content { + margin:40px 0; +} + +aside { + margin:40px 0; +} + +p{ margin:0 0 1.5em;} + + +/* RESPONSIVE IMAGES */ +img{ max-width:100%; height:auto;} + + +/*MAIN MENU*/ +.menu-toggle{ + display:block; + padding:10px; + margin:20px 0 0; + background:#666; + color:#fff; + cursor:pointer; + text-transform:uppercase; + font-size:20px; +} +.menu-toggle.toggled-on{ + background:#0099ff; +} +.srt-menu{ + display:none; +} +.srt-menu.toggled-on{ + display:block; + position:relative; + z-index:10; +} + +.srt-menu{ + clear:both; + margin-bottom:60px; + +} +.srt-menu li a { + background:#dadada; + display:block; + margin:1px 0; + padding:10px; + text-decoration:none; +} +.srt-menu li a:hover{ + background:#0099ff; + color:#fff; +} +.srt-menu li li a { + background:#e8e8e8; + padding-left:40px; +} +.srt-menu li li li a { + background:#efefef; + padding-left:80px; +} + +/*SECONDARY MENU*/ +#secondary-navigation{ + margin-bottom:60px; +} +#secondary-navigation ul{ + margin:0; + padding:0; +} +#secondary-navigation ul li a{ + background:#E6E6E6; + display:block; + margin:5px 0; + padding:10px; + text-decoration:none; +} +#secondary-navigation ul li a:hover, +#secondary-navigation ul li.active a{ + background:#0099ff; + color:#fff; +} + +/*SPACE GRID ELEMENTS VERTICALLY, SINCE THEY ARE ONE UNDER ANOTHER SO FAR*/ +.grid_1, +.grid_2, +.grid_3, +.grid_4, +.grid_5, +.grid_6, +.grid_7, +.grid_8, +.grid_9, +.grid_10, +.grid_11, +.grid_12 { + margin-bottom:40px; + /*positioning and padding*/ + position: relative; + min-height: 1px; + padding-left: 15px; + padding-right: 15px; +} + +/*FOOTER*/ +footer{ + clear:both; + font-size:80%; + padding:20px 0; +} +footer ul{ + margin:0; + padding:0; +} + +/*colors and backgrounds*/ +body{ + background:#fff; +} +h1, h2, h3, h4, h5, h6{ + color:#333; +} + +footer{ + background:#333; + color:#ccc; +} +footer h1, footer h2, footer h3, footer h4{ + color:#CCC; + margin-bottom:10px; +} +footer ul{ + margin:0 0 0 8%; +} + +a.buttonlink{ + background:#0099ff; + border-radius:7px; + color:#fff; + display:block; + float:left; + margin:10px 15px 10px 0; + padding:10px; + text-decoration:none; +} +a.buttonlink:hover{ + background:#8dbc01; +} +.greenelement{ + background:#5ec79e; + color:#fff; +} +.violetelement{ + background:#887dc2; + color:#fff; +} + + + +/* Contain floats*/ +.clearfix:before, +.clearfix:after, +.row:before, +.row:after { + content: " "; + display: table; +} +.clearfix:after, +.container:after, +.row:after{ + clear: both; +} + + +/* +LARGER MOBILE DEVICES +This is for mobile devices with a bit larger screens. +*/ +@media only screen and (min-width: 481px) { +#banner{ + float:left; + text-align:left; + margin-bottom:-20px;/*this depends on the height of the logo*/ +} +.menu-toggle{/*make menu float right, instead of sitting under the logo*/ + margin-top:10px; /*this depends on the height of the logo*/ + float:right; +} + +} + +/* +TABLET & SMALLER LAPTOPS +The average viewing window and preferred media query for those is 768px. +But I think that some more breathing space is good:) +*/ +@media only screen and (min-width: 920px) { + +.wrapper{ + max-width: 1200px; + margin: .75em auto; +} + +#banner{ + float:left; + text-align:left; + margin-bottom:0px; +} +header{ + padding:0; +} +#content { + float:left; + width:65%; +} +#content.wide-content{ + float:none; + width:100%; +} + +.flexslider{ +display:block; +/*demo 1 slider theme*/ +margin: 0 0 60px; +background: #fff; +border: 4px solid #fff; +-webkit-border-radius: 4px; +-moz-border-radius: 4px; +-o-border-radius: 4px; +border-radius: 4px; +box-shadow: 0 1px 4px rgba(0,0,0,.2); +-webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2); +-moz-box-shadow: 0 1px 4px rgba(0,0,0,.2); +-o-box-shadow: 0 1px 4px rgba(0,0,0,.2); +} + + +aside { + float:right; + width:30%; +} + +/*** MAIN MENU - ESSENTIAL STYLES ***/ +.menu-toggle{display:none;} +#menu-main-navigation{display:block;} + +.srt-menu, .srt-menu * { + margin: 0; + padding: 0; + list-style: none; +} +.srt-menu ul { + position: absolute; + display:none; + width: 12em; /* left offset of submenus need to match (see below) */ +} +.srt-menu ul li { + width: 100%; +} +.srt-menu li:hover { + visibility: inherit; /* fixes IE7 'sticky bug' */ +} +.srt-menu li { + float: left; + position: relative; + margin-left:1px; +} +.srt-menu li li { + margin-left:0px; +} +.srt-menu a { + display: block; + position: relative; +} +.srt-menu li:hover ul, +.srt-menu li.sfHover ul { + display:block; + left: 0; + top: 45px; /* match top ul list item height */ + z-index: 99; + -webkit-box-shadow: 2px 3px 2px 0px rgba(00, 00, 00, .3); + box-shadow: 2px 3px 2px 0px rgba(00, 00, 00, .3); +} +ul.srt-menu li:hover li ul, +ul.srt-menu li.sfHover li ul { + top: -999em; +} +ul.srt-menu li li:hover ul, +ul.srt-menu li li.sfHover ul { + left: 12em; /* match ul width */ + top: 0; +} +ul.srt-menu li li:hover li ul, +ul.srt-menu li li.sfHover li ul { + top: -999em; +} +ul.srt-menu li li li:hover ul, +ul.srt-menu li li li.sfHover ul { + left: 10em; /* match ul width */ + top: 0; +} + +/*** DEMO1 SKIN ***/ +#topnav, .srt-menu { + float:right; + margin: .35em 0 0 0; +} +.srt-menu a { + text-decoration:none; +} +.srt-menu li a { + background:#fff; + margin:0; + padding:10px 20px; + height:45px; +} +.srt-menu a, .srt-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/ + color: #0099ff; +} +.srt-menu li li a { + border-top: 1px solid rgba(255,255,255,.2); + background: #333; /*fallback for old IE*/ + background:rgba(0,0,0,.6); + color: #fff; + padding-left:20px; + height:auto; +} +.srt-menu li li a:visited{color:#fff;} +.srt-menu li li li a, +.srt-menu li.active * li a{ + padding-left:20px; + background:rgba(0,0,0,.6); +} + +.srt-menu li:hover > a, +.srt-menu li.active a{ + color:#fff; + background:#0099ff; +} +.srt-menu li li:hover > a{ + color:#fff; + background:#0099ff; +} + + + +/*GRID*/ +/* + & Columns : 12 + + */ + .row{ + margin-left: -15px; + margin-right: -15px; +} + +.grid_1 { width: 8.33333333%; } +.grid_2 { width: 16.66666667%; } +.grid_3 { width: 25%; } +.grid_4 { width: 33.33333333%; } +.grid_5 { width: 41.66666667%; } +.grid_6 { width: 50%; } +.grid_7 { width: 58.33333333%; } +.grid_8 { width: 66.66666667%; } +.grid_9 { width: 75%; } +.grid_10 { width: 83.33333333%; } +.grid_11 { width: 91.66666667%; } +.grid_12 { width: 100%; } + +.grid_1, +.grid_2, +.grid_3, +.grid_4, +.grid_5, +.grid_6, +.grid_7, +.grid_8, +.grid_9, +.grid_10, +.grid_11, +.grid_12 { + float: left; + display: block; +} + +.rightfloat{float:right;} +/* @notation inspired by tinyGrid, .row and percentage by Twitter Bootstrap + */ + +#hero [class*="grid_"] { margin-bottom:-20px;} + +} + +/* +DESKTOP +This is the average viewing window. So Desktops, Laptops, and +in general anyone not viewing on a mobile device. Here's where +you can add resource intensive styles. +*/ +@media only screen and (min-width: 1030px) { + +} + +/* +LARGE VIEWING SIZE +This is for the larger monitors and possibly full screen viewers. +*/ +@media only screen and (min-width: 1240px) { + +} + +/* +RETINA (2x RESOLUTION DEVICES) +This applies to the retina iPhone (4s) and iPad (2,3) along with +other displays with a 2x resolution. +*/ +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), + only screen and (min--moz-device-pixel-ratio: 1.5), + only screen and (min-device-pixel-ratio: 1.5) { + + +} + +/* +iPHONE 5 MEDIA QUERY +iPhone 5 or iPod Touch 5th generation styles (you can include your own file if you want) +*/ +@media (device-height: 568px) and (-webkit-min-device-pixel-ratio: 2) { + + +} + +/* +PRINT STYLESHEET +*/ +@media print { + * { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */ + a, a:visited { text-decoration: underline; } + a[href]:after { content: " (" attr(href) ")"; } + abbr[title]:after { content: " (" attr(title) ")"; } + .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */ + pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } + thead { display: table-header-group; } /* h5bp.com/t */ + tr, img { page-break-inside: avoid; } + img { max-width: 100% !important; } + @page { margin: 0.5cm; } + p, h2, h3 { orphans: 3; widows: 3; } + h2, h3 { page-break-after: avoid; } } \ No newline at end of file diff --git a/cms/front_content.php b/cms/front_content.php index d9686b8..5056912 100644 --- a/cms/front_content.php +++ b/cms/front_content.php @@ -102,21 +102,12 @@ if (!empty($contenido)) { page_open(array('sess' => 'Contenido_Frontend_Session', 'auth' => 'Contenido_Frontend_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); } -/** - * Bugfix - * @see http://contenido.org/forum/viewtopic.php?t=18291 - * - * added by H. Librenz (2007-12-07) - */ -//includePluginConf(); -/** - * fixed bugfix - using functions brokes variable scopes! - * - * added by H. Librenz (2007-12-21) based on an idea of A. Lindner - */ require_once $cfg['path']['contenido'] . $cfg['path']['includes'] . 'functions.includePluginConf.php'; -$db = new DB_Contenido; +// Call hook after plugins are loaded, added by Murat Purc, 2008-09-07 +CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins'); + +$db = new DB_ConLite(); $sess->register("cfgClient"); $sess->register("errsite_idcat"); @@ -654,7 +645,7 @@ if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($p WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '" . Contenido_Security::escapeDB($user_id, $db2) . "' AND A.idcat = '" . Contenido_Security::toInteger($idcat) . "' AND A.idarea = C.idarea AND B.idaction = A.idaction"; - $db2 = new DB_Contenido; + $db2 = new DB_ConLite(); $db2->query($sql); if ($db2->num_rows() > 0) { @@ -854,5 +845,4 @@ if (isset($savedlang)) { } $db->disconnect(); -page_close(); -?> \ No newline at end of file +page_close(); \ No newline at end of file diff --git a/cms/templates/cms_filelist_style_default.html b/cms/templates/cms_filelist_style_default.html index 010eeeb..3949b8f 100644 --- a/cms/templates/cms_filelist_style_default.html +++ b/cms/templates/cms_filelist_style_default.html @@ -1,18 +1,18 @@ - -

{TITLE}

- - -
- {FILENAME} ({FILEEXTENSION})
- {LABEL_FILESIZE} {FILESIZE} {FILESIZE_UNIT}
- {LABEL_UPLOAD_DATE} {FILECREATIONDATE}
- {FILEMETA_DESCRIPTION} -
- + +

{TITLE}

+ + +
+ {FILENAME} ({FILEEXTENSION})
+ {LABEL_FILESIZE} {FILESIZE} {FILESIZE_UNIT}
+ {LABEL_UPLOAD_DATE} {FILECREATIONDATE}
+ {FILEMETA_DESCRIPTION} +
+
\ No newline at end of file diff --git a/conlite/external/backendedit/front_content.php b/conlite/external/backendedit/front_content.php index dd8d55c..4555113 100644 --- a/conlite/external/backendedit/front_content.php +++ b/conlite/external/backendedit/front_content.php @@ -1,4 +1,5 @@ * @license http://www.contenido.org/license/LIZENZ.txt * @link http://www.4fb.de * @link http://www.contenido.org * @since file available since contenido release <= 4.6 - * - * {@internal - * created 2003-01-21 - * modified 2008-07-02, Frederic Schneider, add security fix and include class_security - * modified 2008-08-29, Murat Purc, synchronised with /cms/front_content.php - * modified 2008-11-18, Timo Trautmann: in backendeditmode also check if logged in backenduser has permission to view preview of page - * modified 2009-04-16, OliverL, check return from Contenido.Frontend.HTMLCodeOutput - * modified 2009-10-23, Murat Purc, removed deprecated function (PHP 5.3 ready) - * modified 2009-12-31, Murat Purc, fixed/modified CEC_Hook, see [#CON-256] - * modified 2010-05-20, Murat Purc, moved security checks into startup process, see [#CON-307] - * modified 2010-09-23, Murat Purc, fixed $encoding handling, see [#CON-305] - * modified 2011-02-07, Dominik Ziegler, added exit after redirections to force their execution - * modified 2011-02-10, Dominik Ziegler, moved function declaration of IP_match out of front_content.php - * - * $Id$: - * }} - * */ - if (!defined("CON_FRAMEWORK")) { define("CON_FRAMEWORK", true); } -# Contenido startup process -include_once ('../../includes/startup.php'); +$contenido_path = dirname(__FILE__, 3) . DIRECTORY_SEPARATOR; +if (!is_file($contenido_path . 'includes/startup.php')) { + die("

Fatal Error


Couldn't include ConLite startup."); +} +include_once($contenido_path . 'includes/startup.php'); rereadClients(); +$frontend_path = cRegistry::getClientConfig(cRegistry::getClientId())['path']['frontend']; -# include the config file of the frontend to init the Client and Language Id -include_once ($cfgClient[$client]["path"]["frontend"]."config.php"); -chdir($cfgClient[$client]["path"]["frontend"]); +// Include the environment definer file +include_once($frontend_path . 'environment.php'); + +if (defined('CL_ENVIRONMENT')) { + include_once($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.php'); + + if (file_exists($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.local.php')) { + @include($frontend_path . 'data/config/' . CL_ENVIRONMENT . '/config.local.php'); + } +} else { + if (file_exists($frontend_path . 'config.php')) { + include_once($frontend_path . 'config.php'); + } + if (file_exists($frontend_path . 'config.local.php')) { + include_once($frontend_path . 'config.local.php'); + } +} cInclude("includes", "functions.con.php"); cInclude("includes", "functions.con2.php"); cInclude("includes", "functions.api.php"); cInclude("includes", "functions.pathresolver.php"); -if ($cfg["use_pseudocron"] == true) -{ +if ($cfg["use_pseudocron"] == true) { /* Include cronjob-Emulator */ $oldpwd = getcwd(); - chdir($cfg["path"]["contenido"].$cfg["path"]["cronjobs"]); + chdir($cfg["path"]["contenido"] . $cfg["path"]["cronjobs"]); cInclude("includes", "pseudo-cron.inc.php"); chdir($oldpwd); } @@ -92,49 +92,48 @@ if ($cfg["use_pseudocron"] == true) * PHPLIB application development toolkit * @see http://sourceforge.net/projects/phplib */ -if ($contenido) -{ +if (!empty($contenido)) { //Backend - page_open(array ('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); - i18nInit($cfg["path"]["contenido"].$cfg["path"]["locale"], $belang); -} -else -{ + page_open(array('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); + i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang); +} else { //Frontend - page_open(array ('sess' => 'Contenido_Frontend_Session', 'auth' => 'Contenido_Frontend_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); + page_open(array('sess' => 'Contenido_Frontend_Session', 'auth' => 'Contenido_Frontend_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); } -/** - * Bugfix - * @see http://contenido.org/forum/viewtopic.php?t=18291 - * - * added by H. Librenz (2007-12-07) - */ -//includePluginConf(); -/** - * fixed bugfix - using functions brokes variable scopes! - * - * added by H. Librenz (2007-12-21) based on an idea of A. Lindner - */ require_once $cfg['path']['contenido'] . $cfg['path']['includes'] . 'functions.includePluginConf.php'; // Call hook after plugins are loaded, added by Murat Purc, 2008-09-07 CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins'); -$db = new DB_ConLite; +$db = new DB_ConLite(); $sess->register("cfgClient"); $sess->register("errsite_idcat"); $sess->register("errsite_idart"); $sess->register("encoding"); -if ($cfgClient["set"] != "set") -{ +if (empty($cfgClient["set"]) || $cfgClient["set"] != "set") { rereadClients(); } -if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) -{ +# Check if this request is for a compressed file +if (isset($_GET['action']) && $_GET['action'] == 'get_compressed') { + # Get the calling parameters + $sFilename = ((isset($_GET['f'])) ? $_GET['f'] : $_GET['amp;f']); + $sContentType = ((isset($_GET['c'])) ? $_GET['c'] : $_GET['amp;c']); + + # Output the file using the class output() function + Output_Compressor::output($cfgClient[$client]['path']['frontend'] . 'cache/', $sFilename, $sContentType); + + # Don't do anything else + exit(); +} + +// Call hook after plugins are loaded, added by Murat Purc, 2008-09-07 +CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins'); + +if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) { // get encodings of all languages $encoding = array(); $sql = "SELECT idlang, encoding FROM " . $cfg["tab"]["lang"]; @@ -149,27 +148,25 @@ if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) // @TODO: Should be outsourced into startup process but requires a better detection (frontend or backend) Contenido_Security::checkFrontendGlobals(); - // update urlbuilder set http base path Contenido_Url::getInstance()->getUrlBuilder()->setHttpBasePath($cfgClient[$client]['htmlpath']['frontend']); - // Initialize language if (!isset($lang)) { // if there is an entry load_lang in frontend/config.php use it, else use the first language of this client - if(isset($load_lang)){ + if (isset($load_lang)) { // load_client is set in frontend/config.php $lang = $load_lang; - }else{ + } else { $sql = "SELECT B.idlang FROM - ".$cfg["tab"]["clients_lang"]." AS A, - ".$cfg["tab"]["lang"]." AS B + " . $cfg["tab"]["clients_lang"] . " AS A, + " . $cfg["tab"]["lang"] . " AS B WHERE - A.idclient='".Contenido_Security::toInteger($client)."' AND + A.idclient='" . Contenido_Security::toInteger($client) . "' AND A.idlang = B.idlang LIMIT 0,1"; @@ -181,11 +178,12 @@ if (!isset($lang)) { } } -if (!$sess->is_registered("lang") ) $sess->register("lang"); -if (!$sess->is_registered("client") ) $sess->register("client"); +if (!$sess->is_registered("lang")) + $sess->register("lang"); +if (!$sess->is_registered("client")) + $sess->register("client"); -if (isset ($username)) -{ +if (isset($username)) { $auth->login_if(true); } @@ -198,8 +196,7 @@ header("Content-Type: text/html; charset={$encoding[$lang]}"); * if http global logout is set e.g. front_content.php?logout=true * log out the current user. */ -if (isset ($logout)) -{ +if (isset($logout)) { $auth->logout(true); $auth->unauth(true); $auth->auth["uname"] = "nobody"; @@ -208,8 +205,7 @@ if (isset ($logout)) /* * local configuration */ -if (file_exists("config.local.php")) -{ +if (file_exists("config.local.php")) { @ include ("config.local.php"); } @@ -217,156 +213,124 @@ if (file_exists("config.local.php")) * If the path variable was passed, try to resolve it to a Category Id * e.g. front_content.php?path=/company/products/ */ -if (isset($path) && strlen($path) > 1) -{ +if (isset($path) && strlen($path) > 1) { /* Which resolve method is configured? */ - if ($cfg["urlpathresolve"] == true) - { + if ($cfg["urlpathresolve"] == true) { $iLangCheck = 0; $idcat = prResolvePathViaURLNames($path, $iLangCheck); - - } - else - { + } else { $iLangCheck = 0; $idcat = prResolvePathViaCategoryNames($path, $iLangCheck); - if(($lang != $iLangCheck) && ((int)$iLangCheck != 0)){ + if (($lang != $iLangCheck) && ((int) $iLangCheck != 0)) { $lang = $iLangCheck; } - } } // error page -$aParams = array ( - 'client' => $client, 'idcat' => $errsite_idcat[$client], 'idart' => $errsite_idart[$client], - 'lang' => $lang, 'error'=> '1' +$aParams = array( + 'client' => $client, 'idcat' => $errsite_idcat[$client], 'idart' => $errsite_idart[$client], + 'lang' => $lang, 'error' => '1' ); $errsite = 'Location: ' . Contenido_Url::getInstance()->buildRedirect($aParams); - /* * Try to initialize variables $idcat, $idart, $idcatart, $idartlang * Note: These variables can be set via http globals e.g. front_content.php?idcat=41&idart=34&idcatart=35&idartlang=42 * If not the values will be computed. */ -if ($idart && !$idcat && !$idcatart) -{ +if ($idart && !$idcat && !$idcatart) { /* Try to fetch the first idcat */ - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat_art"]." WHERE idart = '".Contenido_Security::toInteger($idart)."'"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "'"; $db->query($sql); - if ($db->next_record()) - { + if ($db->next_record()) { $idcat = $db->f("idcat"); } } -unset ($code); -unset ($markscript); +unset($code); +unset($markscript); -if (!$idcatart) -{ - if (!$idart) - { - if (!$idcat) - { +if (empty($idcatart)) { + if (empty($idart)) { + if (empty($idcat)) { # Note: In earlier Contenido versions the information if an article is startarticle of a category has been stored # in relation con_cat_art. - if ($cfg["is_start_compatible"] == true) - { + if ($cfg["is_start_compatible"] == true) { $sql = "SELECT idart, B.idcat FROM - ".$cfg["tab"]["cat_art"]." AS A, - ".$cfg["tab"]["cat_tree"]." AS B, - ".$cfg["tab"]["cat"]." AS C + " . $cfg["tab"]["cat_art"] . " AS A, + " . $cfg["tab"]["cat_tree"] . " AS B, + " . $cfg["tab"]["cat"] . " AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND is_start='1' AND - idclient='".Contenido_Security::toInteger($client)."' + idclient='" . Contenido_Security::toInteger($client) . "' ORDER BY idtree ASC"; - } - else - { + } else { # Note: Now the information if an article is startarticle of a category is stored in relation con_cat_lang. $sql = "SELECT A.idart, B.idcat FROM - ".$cfg["tab"]["cat_art"]." AS A, - ".$cfg["tab"]["cat_tree"]." AS B, - ".$cfg["tab"]["cat"]." AS C, - ".$cfg["tab"]["cat_lang"]." AS D, - ".$cfg["tab"]["art_lang"]." AS E + " . $cfg["tab"]["cat_art"] . " AS A, + " . $cfg["tab"]["cat_tree"] . " AS B, + " . $cfg["tab"]["cat"] . " AS C, + " . $cfg["tab"]["cat_lang"] . " AS D, + " . $cfg["tab"]["art_lang"] . " AS E WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND D.startidartlang = E.idartlang AND - D.idlang='".Contenido_Security::toInteger($lang)."' AND + D.idlang='" . Contenido_Security::toInteger($lang) . "' AND E.idart=A.idart AND - E.idlang='".Contenido_Security::toInteger($lang)."' AND - idclient='".Contenido_Security::toInteger($client)."' + E.idlang='" . Contenido_Security::toInteger($lang) . "' AND + idclient='" . Contenido_Security::toInteger($client) . "' ORDER BY idtree ASC"; } $db->query($sql); - if ($db->next_record()) - { + if ($db->next_record()) { $idart = $db->f("idart"); $idcat = $db->f("idcat"); - } - else - { - if ($contenido) - { + } else { + if (!empty($contenido)) { cInclude("includes", "functions.i18n.php"); die(i18n("No start article for this category")); - } - else - { - if ($error == 1) - { - echo "Fatal error: Could not display error page. Error to display was: 'No start article in this category'"; - } - else - { + } else { + if ($error == 1) { + die("Fatal error: Could not display error page. Error to display was: 'No start article in this category'"); + } else { header($errsite); - exit; + exit; } } } - } - else - { + } else { $idart = -1; - if ($cfg["is_start_compatible"] == true) - { - $sql = "SELECT idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND is_start='1'"; + if ($cfg["is_start_compatible"] == true) { + $sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND is_start='1'"; $db->query($sql); - if ($db->next_record()) - { + if ($db->next_record()) { $idart = $db->f("idart"); } - } - else - { - $sql = "SELECT startidartlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + } else { + $sql = "SELECT startidartlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); - if ($db->next_record()) - { - if ($db->f("startidartlang") != 0) - { - $sql = "SELECT idart FROM ".$cfg["tab"]["art_lang"]." WHERE idartlang='".Contenido_Security::toInteger($db->f("startidartlang"))."'"; + if ($db->next_record()) { + if ($db->f("startidartlang") != 0) { + $sql = "SELECT idart FROM " . $cfg["tab"]["art_lang"] . " WHERE idartlang='" . Contenido_Security::toInteger($db->f("startidartlang")) . "'"; $db->query($sql); $db->next_record(); $idart = $db->f("idart"); @@ -374,36 +338,26 @@ if (!$idcatart) } } - if ($idart != -1) - { - } - else - { + if ($idart != -1) { + + } else { // error message in backend - if ($contenido) - { + if ($contenido) { cInclude("includes", "functions.i18n.php"); die(i18n("No start article for this category")); - } - else - { - if ($error == 1) - { + } else { + if ($error == 1) { echo "Fatal error: Could not display error page. Error to display was: 'No start article in this category'"; - } - else - { + } else { header($errsite); - exit; + exit; } } } } } -} -else -{ - $sql = "SELECT idcat, idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcatart='".Contenido_Security::toInteger($idcatart)."'"; +} else { + $sql = "SELECT idcat, idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "'"; $db->query($sql); $db->next_record(); @@ -413,9 +367,8 @@ else } /* Get idcatart */ -if (0 != $idart && 0 != $idcat) -{ - $sql = "SELECT idcatart FROM ".$cfg["tab"]["cat_art"]." WHERE idart = '".Contenido_Security::toInteger($idart)."' AND idcat = '".Contenido_Security::toInteger($idcat)."'"; +if (0 != $idart && 0 != $idcat) { + $sql = "SELECT idcatart FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "' AND idcat = '" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); $db->next_record(); @@ -425,10 +378,9 @@ if (0 != $idart && 0 != $idcat) $idartlang = getArtLang($idart, $lang); -if ($idartlang === false) -{ +if ($idartlang === false) { header($errsite); - exit; + exit; } /* @@ -444,8 +396,6 @@ if ($cfg["cache"]["disable"] != '1') { $oCacheHandler->start($iStartTime); // $iStartTime ist optional und ist die startzeit des scriptes, z. b. am anfang von fron_content.php } // END: concache - - ############################################## # BACKEND / FRONTEND EDITING ############################################## @@ -460,44 +410,39 @@ if ($cfg["cache"]["disable"] != '1') { * The reason is to avoid cross-site scripting errors in the backend, if the backend domain differs from * the frontend domain. */ -if ($contenido) -{ +if ($contenido) { $perm->load_permissions(); /* Change mode edit / view */ - if (isset ($changeview)) - { + if (isset($changeview)) { $sess->register("view"); $view = $changeview; } $col = new InUseCollection; - if ($overrideid != "" && $overridetype != "") - { + if ($overrideid != "" && $overridetype != "") { $col->removeItemMarks($overridetype, $overrideid); } /* Remove all own marks */ $col->removeSessionMarks($sess->id); /* If the override flag is set, override a specific InUseItem */ - list ($inUse, $message) = $col->checkAndMark("article", $idartlang, true, i18n("Article is in use by %s (%s)"), true, $cfg['path']['contenido_fullhtml']."external/backendedit/front_content.php?changeview=edit&action=con_editart&idartlang=$idartlang&type=$type&typenr=$typenr&idart=$idart&idcat=$idcat&idcatart=$idcatart&client=$client&lang=$lang"); + list ($inUse, $message) = $col->checkAndMark("article", $idartlang, true, i18n("Article is in use by %s (%s)"), true, $cfg['path']['contenido_fullhtml'] . "external/backendedit/front_content.php?changeview=edit&action=con_editart&idartlang=$idartlang&type=$type&typenr=$typenr&idart=$idart&idcat=$idcat&idcatart=$idcatart&client=$client&lang=$lang"); $sHtmlInUse = ''; $sHtmlInUseMessage = ''; - if ($inUse == true) - { + if ($inUse == true) { $disabled = 'disabled="disabled"'; - $sHtmlInUseCss = ''; + $sHtmlInUseCss = ''; $sHtmlInUseMessage = $message; } - $sql = "SELECT locked FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT locked FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); $locked = $db->f("locked"); - if ($locked == 1) - { + if ($locked == 1) { $inUse = true; $disabled = 'disabled="disabled"'; } @@ -505,47 +450,40 @@ if ($contenido) // CEC to check if the user has permission to edit articles in this category CEC_Hook::setBreakCondition(false, true); // break at "false", default value "true" $allow = CEC_Hook::executeWhileBreakCondition( - 'Contenido.Frontend.AllowEdit', $lang, $idcat, $idart, $auth->auth['uid'] + 'Contenido.Frontend.AllowEdit', $lang, $idcat, $idart, $auth->auth['uid'] ); - if ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat) && $inUse == false && $allow == true) - { + if ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat) && $inUse == false && $allow == true) { /* Create buttons for editing */ $edit_preview = ''; - if ($view == "edit") - { + if ($view == "edit") { $edit_preview = ''; - } - else - { + } else { $edit_preview = ''; } /* Display articles */ - if ($cfg["is_start_compatible"] == true) - { - $sql = "SELECT idart, is_start FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' ORDER BY idart"; + if ($cfg["is_start_compatible"] == true) { + $sql = "SELECT idart, is_start FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' ORDER BY idart"; $db->query($sql); - } - else - { - $sql = "SELECT idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' ORDER BY idart"; + } else { + $sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' ORDER BY idart"; $db->query($sql); } @@ -554,53 +492,41 @@ if ($contenido) $edit_preview .= '
- Preview + Preview - Preview + Preview
- Preview + Preview - Edit + Edit
Articles in category:
'; - while ($db->next_record() && ($db->affected_rows() != 1)) - { + while ($db->next_record() && ($db->affected_rows() != 1)) { $class = "font-family:'Verdana'; font-size:10; color:#000000; text-decoration: underline; font-weight:normal"; - if (!isset ($idart)) - { - if (isStartArticle(getArtLang($idart, $lang), $idcat, $lang)) - { + if (!isset($idart)) { + if (isStartArticle(getArtLang($idart, $lang), $idcat, $lang)) { $class = "font-family: verdana; font-size:10; color:#000000; text-decoration: underline ;font-weight:bold"; } - } - else - { - if ($idart == $db->f("idart")) - { + } else { + if ($idart == $db->f("idart")) { $class = "font-family: verdana; font-size:10; color:#000000; text-decoration: underline; font-weight:bold"; } } - $edit_preview .= "url("front_content.php?idart=".$db->f("idart")."&idcat=$idcat")."\">$a "; - $a ++; + $edit_preview .= "url("front_content.php?idart=" . $db->f("idart") . "&idcat=$idcat") . "\">$a "; + $a++; } $edit_preview .= '
'; - } - } // end if $contenido /* If mode is 'edit' and user has permission to edit articles in the current category */ -if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) -{ +if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) { cInclude("includes", "functions.tpl.php"); cInclude("includes", "functions.con.php"); - include ($cfg["path"]["contenido"].$cfg["path"]["includes"]."include.con_editcontent.php"); -} -else -{ + include ($cfg["path"]["contenido"] . $cfg["path"]["includes"] . "include.con_editcontent.php"); +} else { ############################################## # FRONTEND VIEW ############################################## /* Mark submenuitem 'Preview' in the Contenido Backend (Area: Contenido --> Articles --> Preview) */ - if ($contenido) - { + if ($contenido) { $markscript = markSubMenuItem(4, true); } @@ -610,10 +536,10 @@ else $sql = "SELECT createcode FROM - ".$cfg["tab"]["cat_art"]." + " . $cfg["tab"]["cat_art"] . " WHERE - idcat = '".Contenido_Security::toInteger($idcat)."' AND - idart = '".Contenido_Security::toInteger($idart)."'"; + idcat = '" . Contenido_Security::toInteger($idcat) . "' AND + idart = '" . Contenido_Security::toInteger($idart) . "'"; $db->query($sql); $db->next_record(); @@ -623,47 +549,36 @@ else ############################################## /* Check if code is expired, create new code if needed */ - if ($db->f("createcode") == 0 && $force == 0) - { - $sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + if ($db->f("createcode") == 0 && $force == 0 && $cfg['dceModEdit']['use'] !== true && $cfg['dceLayEdit']['use'] !== true) { + $sql = "SELECT code FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); - if ($db->num_rows() == 0) - { + if ($db->num_rows() == 0) { /* Include here for performance reasons */ cInclude("includes", "functions.tpl.php"); conGenerateCode($idcat, $idart, $lang, $client); - $sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT code FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); } - if ($db->next_record()) - { + if ($db->next_record()) { $code = stripslashes($db->f("code")); - } - else - { + } else { if ($contenido) $code = "echo \"No code available.\";"; - else - { - if ($error == 1) - { + else { + if ($error == 1) { echo "Fatal error: Could not display error page. Error to display was: 'No code available'"; - } - else - { + } else { header($errsite); - exit; + exit; } } } - } - else - { - $sql = "DELETE FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."'"; + } else { + $sql = "DELETE FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "'"; $db->query($sql); cInclude("includes", "functions.con.php"); @@ -672,7 +587,7 @@ else conGenerateCode($idcat, $idart, $lang, $client); - $sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT code FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); @@ -681,16 +596,18 @@ else } /* Add mark Script to code if user is in the backend */ + if(!empty($markscript)) { $code = preg_replace("/<\/head>/i", "$markscript\n", $code, 1); + } /* If article is in use, display notification */ - if ($sHtmlInUseCss && $sHtmlInUseMessage) { + if (!empty($sHtmlInUseCss) && !empty($sHtmlInUseMessage)) { $code = preg_replace("/<\/head>/i", "$sHtmlInUseCss\n", $code, 1); $code = preg_replace("/(]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1); } /* Check if category is public */ - $sql = "SELECT public FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT public FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); @@ -700,80 +617,68 @@ else ############################################## # protected categories ############################################## - if ($public == 0) - { - if ($auth->auth["uid"] == "nobody") - { - $sql = "SELECT user_id, value FROM ".$cfg["tab"]["user_prop"]." WHERE type='frontend' and name='allowed_ip'"; + if ($public == 0) { + if ($auth->auth["uid"] == "nobody") { + $sql = "SELECT user_id, value FROM " . $cfg["tab"]["user_prop"] . " WHERE type='frontend' and name='allowed_ip'"; $db->query($sql); - while ($db->next_record()) - { + while ($db->next_record()) { $user_id = $db->f("user_id"); $range = urldecode($db->f("value")); $slash = strpos($range, "/"); - if ($slash == false) - { + if ($slash == false) { $netmask = "255.255.255.255"; $network = $range; - } - else - { + } else { $network = substr($range, 0, $slash); - $netmask = substr($range, $slash +1, strlen($range) - $slash -1); + $netmask = substr($range, $slash + 1, strlen($range) - $slash - 1); } - if (IP_match($network, $netmask, $_SERVER["REMOTE_ADDR"])) - { + if (IP_match($network, $netmask, $_SERVER["REMOTE_ADDR"])) { $sql = "SELECT idright - FROM ".$cfg["tab"]["rights"]." AS A, - ".$cfg["tab"]["actions"]." AS B, - ".$cfg["tab"]["area"]." AS C - WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '".Contenido_Security::escapeDB($user_id, $db2)."' AND A.idcat = '".Contenido_Security::toInteger($idcat)."' + FROM " . $cfg["tab"]["rights"] . " AS A, + " . $cfg["tab"]["actions"] . " AS B, + " . $cfg["tab"]["area"] . " AS C + WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '" . Contenido_Security::escapeDB($user_id, $db2) . "' AND A.idcat = '" . Contenido_Security::toInteger($idcat) . "' AND A.idarea = C.idarea AND B.idaction = A.idaction"; $db2 = new DB_ConLite; $db2->query($sql); - if ($db2->num_rows() > 0) - { + if ($db2->num_rows() > 0) { $auth->auth["uid"] = $user_id; $validated = 1; } } } - if ($validated != 1) - { + if ($validated != 1) { // CEC to check category access CEC_Hook::setBreakCondition(true, false); // break at "true", default value "false" $allow = CEC_Hook::executeWhileBreakCondition( - 'Contenido.Frontend.CategoryAccess', $lang, $idcat, $auth->auth['uid'] + 'Contenido.Frontend.CategoryAccess', $lang, $idcat, $auth->auth['uid'] ); $auth->login_if(!$allow); } - } - else - { + } else { // CEC to check category access CEC_Hook::setBreakCondition(true, false); // break at "true", default value "false" $allow = CEC_Hook::executeWhileBreakCondition( - 'Contenido.Frontend.CategoryAccess', $lang, $idcat, $auth->auth['uid'] + 'Contenido.Frontend.CategoryAccess', $lang, $idcat, $auth->auth['uid'] ); /* - added 2008-11-18 Timo Trautmann - in backendeditmode also check if logged in backenduser has permission to view preview of page - */ + added 2008-11-18 Timo Trautmann + in backendeditmode also check if logged in backenduser has permission to view preview of page + */ if ($allow == false && $contenido && $perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat)) { $allow = true; } - if (!$allow) - { + if (!$allow) { header($errsite); - exit; + exit; } } } @@ -781,47 +686,24 @@ else ############################################## # statistic ############################################## - /* Sanity: If the statistic table doesn't contain an entry, create one */ - $sql = "SELECT idcatart FROM ".$cfg["tab"]["stat"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; - $db->query($sql); - - if ($db->next_record()) - { - /* Update the statistics. */ - $sql = "UPDATE ".$cfg["tab"]["stat"]." SET visited = visited + 1 WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idclient = '".Contenido_Security::toInteger($client)."' - AND idlang = '".Contenido_Security::toInteger($lang)."'"; - $db->query($sql); - } - else - { - /* Insert new record */ - $next = $db->nextid($cfg["tab"]["stat"]); - $sql = "INSERT INTO ".$cfg["tab"]["stat"]." (visited, idcatart, idlang, idstat, idclient) VALUES ('1', '".Contenido_Security::toInteger($idcatart)."', '".Contenido_Security::toInteger($lang)."', - '".Contenido_Security::toInteger($next)."', '".Contenido_Security::toInteger($client)."')"; - $db->query($sql); - } + $oStatCol = new cApiStatCollection(); + $oStatCol->trackView($idcatart); /* * Check if an article is start article of the category */ - if ($cfg["is_start_compatible"] == true) - { - $sql = "SELECT is_start FROM ".$cfg["tab"]["cat_art"]." WHERE idcatart='".Contenido_Security::toInteger($idcatart)."'"; + if ($cfg["is_start_compatible"] == true) { + $sql = "SELECT is_start FROM " . $cfg["tab"]["cat_art"] . " WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "'"; $db->query($sql); $db->next_record(); $isstart = $db->f("is_start"); - } - else - { - $sql = "SELECT startidartlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + } else { + $sql = "SELECT startidartlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); - if ($db->f("idartlang") == $idartlang) - { + if ($db->f("idartlang") == $idartlang) { $isstart = 1; - } - else - { + } else { $isstart = 0; } } @@ -829,18 +711,15 @@ else ############################################## # time management ############################################## - $sql = "SELECT timemgmt FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT timemgmt FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); - if (($db->f("timemgmt") == "1") && ($isstart != 1)) - { - $sql = "SELECT online, redirect, redirect_url FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang = '".Contenido_Security::toInteger($lang)."' + if (($db->f("timemgmt") == "1") && ($isstart != 1)) { + $sql = "SELECT online, redirect, redirect_url FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "' AND NOW() > datestart AND NOW() < dateend"; - } - else - { - $sql = "SELECT online, redirect, redirect_url FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + } else { + $sql = "SELECT online, redirect, redirect_url FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; } $db->query($sql); @@ -850,15 +729,14 @@ else $redirect = $db->f("redirect"); $redirect_url = $db->f("redirect_url"); - @ eval ("\$"."redirect_url = \"$redirect_url\";"); // transform variables + @ eval("\$" . "redirect_url = \"$redirect_url\";"); // transform variables $insert_base = getEffectiveSetting('generator', 'basehref', "true"); /* * generate base url */ - if ($insert_base == "true") - { + if ($insert_base == "true") { $is_XHTML = getEffectiveSetting('generator', 'xhtml', "false"); $str_base_uri = $cfgClient[$client]["path"]["htmlpath"]; @@ -867,21 +745,19 @@ else $str_base_uri = CEC_Hook::executeAndReturn('Contenido.Frontend.BaseHrefGeneration', $str_base_uri); if ($is_XHTML == "true") { - $baseCode = ''; + $baseCode = ''; } else { - $baseCode = ''; + $baseCode = ''; } - $code = str_ireplace_once("", "\n".$baseCode, $code); + $code = str_ireplace_once("", "\n" . $baseCode, $code); } /* * Handle online (offline) articles */ - if ($online) - { - if ($redirect == '1' && $redirect_url != '') - { + if ($online) { + if ($redirect == '1' && $redirect_url != '') { page_close(); /* * Redirect to the URL defined in article properties @@ -897,12 +773,9 @@ else } header("Location: $redirect_url"); exit; - } - else - { - if ($cfg["debug"]["codeoutput"]) - { - echo ""; + } else { + if ($cfg["debug"]["codeoutput"]) { + echo ""; } /* @@ -913,40 +786,34 @@ else $aExclude = explode(',', getEffectiveSetting('frontend.no_outputbuffer', 'idart', '')); if (in_array(Contenido_Security::toInteger($idart), $aExclude)) { - eval ("?>\n".$code."\n\n" . $code . "\n\n".$code."\n\n" . $code . "\n\n".$code."\n\n" . $code . "\n +$db->disconnect(); +page_close(); \ No newline at end of file diff --git a/conlite/includes/functions.file.php b/conlite/includes/functions.file.php index 40877fe..85f2c18 100644 --- a/conlite/includes/functions.file.php +++ b/conlite/includes/functions.file.php @@ -210,7 +210,8 @@ function fileEdit($filename, $sCode, $path) { if (is_writable($path . $filename)) { if (strlen(stripslashes(trim($sCode))) > 0) { if (!empty($sCode)) { - $sCode = mb_convert_encoding($sCode, 'UTF-8', 'OLD-ENCODING'); + mb_detect_encoding($sCode); + $sCode = mb_convert_encoding($sCode, 'UTF-8',mb_detect_encoding($sCode)); } cFileHandler::write($path . $filename, $sCode); return true; @@ -235,7 +236,8 @@ function fileEdit($filename, $sCode, $path) { function getFileContent($filename, $path) { $sCode = cFileHandler::read($path . $filename); if (!empty($sCode)) { - $sCode = mb_convert_encoding($sCode, 'UTF-8', 'OLD-ENCODING'); + mb_detect_encoding($sCode); + $sCode = mb_convert_encoding($sCode, 'UTF-8', mb_detect_encoding($sCode)); } return $sCode; } diff --git a/conlite/includes/include.frontend.group_edit.php b/conlite/includes/include.frontend.group_edit.php index 8757fe8..6ca9801 100644 --- a/conlite/includes/include.frontend.group_edit.php +++ b/conlite/includes/include.frontend.group_edit.php @@ -158,7 +158,7 @@ if ($fegroup->virgin == false && $fegroup->get("idclient") == $client) $fegroup->store(); } - if (count($messages) > 0) + if (is_array($messages) && count($messages) > 0) { $notis = $notification->returnNotification("warning", implode("
", $messages)) . "
"; } diff --git a/conlite/includes/include.frontend.group_rights.php b/conlite/includes/include.frontend.group_rights.php index 45f93ef..e0e822a 100644 --- a/conlite/includes/include.frontend.group_rights.php +++ b/conlite/includes/include.frontend.group_rights.php @@ -1,4 +1,5 @@ setContent(i18n("Invalid plugin")); - +if (!in_array($useplugin, $cfg['plugins']['frontendlogic'])) { + $page->setContent(i18n("Invalid plugin")); } else { - cInclude("plugins", "frontendlogic/$useplugin/".$useplugin.".php"); + cInclude("plugins", "frontendlogic/$useplugin/" . $useplugin . ".php"); - $className = "frontendlogic_".$useplugin; - $class = new $className; - $perms = new FrontendPermissionCollection; + $className = "frontendlogic_" . $useplugin; + $class = new $className; + $perms = new FrontendPermissionCollection; + $rights = new UI_Table_Form("rights"); + $rights->setVar("area", $area); + $rights->setVar("frame", $frame); + $rights->setVar("useplugin", $useplugin); + $rights->setVar("idfrontendgroup", $idfrontendgroup); + $rights->setVar("action", "fegroups_save_perm"); - $rights = new UI_Table_Form("rights"); - $rights->setVar("area", $area); - $rights->setVar("frame", $frame); - $rights->setVar("useplugin", $useplugin); - $rights->setVar("idfrontendgroup", $idfrontendgroup); - $rights->setVar("action", "fegroups_save_perm"); + $actions = $class->listActions(); + $items = $class->listItems(); - $actions = $class->listActions(); - $items = $class->listItems(); + if ($action == "fegroups_save_perm") { + $myitems = $items; + $myitems["__GLOBAL__"] = "__GLOBAL__"; - if ($action == "fegroups_save_perm") - { - $myitems = $items; - $myitems["__GLOBAL__"] = "__GLOBAL__"; + foreach ($actions as $action => $text) { + foreach ($myitems as $item => $text) { - foreach ($actions as $action => $text) - { - foreach ($myitems as $item => $text) - { + if ($item === "__GLOBAL__") { + $varname = "action_$action"; + } else { + $varname = "item_" . $item . "_$action"; + } - if ($item === "__GLOBAL__") - { - $varname = "action_$action"; - } else { - $varname = "item_".$item."_$action"; - } - - if ($_POST[$varname] == 1) - { - $perms->setPerm($idfrontendgroup, $useplugin, $action, $item); - } else { - $perms->removePerm($idfrontendgroup, $useplugin, $action, $item); - } - } - } - - } - - $rights->addHeader(sprintf(i18n("Permissions for plugin '%s'"), $class->getFriendlyName())); - - foreach ($actions as $key => $action) - { - $check[$key] = new cHTMLCheckbox("action_$key", 1); - $check[$key]->setLabelText($action." ".i18n("(All)")); - - if ($perms->checkPerm($idfrontendgroup, $useplugin, $key, "__GLOBAL__")) - { - $check[$key]->setChecked(true); - } - } - - $rights->add(i18n("Global rights"), $check); - - foreach ($actions as $key => $action) - { - unset($check); - - if (count($items) > 0) - { - foreach ($items as $item => $value) - { - $check[$item] = new cHTMLCheckbox("item_".$item."_".$key, 1); - $check[$item]->setLabelText($value); - - if ($perms->checkPerm($idfrontendgroup, $useplugin, $key, $item)) - { - $check[$item]->setChecked(true); - } - - } - - $rights->add($action, $check); - } else { - $rights->add($action, i18n("No items found")); - } + if ($_POST[$varname] == 1) { + $perms->setPerm($idfrontendgroup, $useplugin, $action, $item); + } else { + $perms->removePerm($idfrontendgroup, $useplugin, $action, $item); + } + } + } } - $page->setContent($rights->render()); + $rights->addHeader(sprintf(i18n("Permissions for plugin '%s'"), $class->getFriendlyName())); + + foreach ($actions as $key => $action) { + $check[$key] = new cHTMLCheckbox("action_$key", 1); + $check[$key]->setLabelText($action . " " . i18n("(All)")); + + if ($perms->checkPerm($idfrontendgroup, $useplugin, $key, "__GLOBAL__")) { + $check[$key]->setChecked(true); + } + } + + $rights->add(i18n("Global rights"), $check); + + foreach ($actions as $key => $action) { + unset($check); + + if (is_array($items) && count($items) > 0) { + foreach ($items as $item => $value) { + $check[$item] = new cHTMLCheckbox("item_" . $item . "_" . $key, 1); + $check[$item]->setLabelText($value); + + if ($perms->checkPerm($idfrontendgroup, $useplugin, $key, $item)) { + $check[$item]->setChecked(true); + } + } + + $rights->add($action, $check); + } else { + $rights->add($action, i18n("No items found")); + } + } + + $page->setContent($rights->render()); } -$page->render(); -?> \ No newline at end of file +$page->render(); \ No newline at end of file diff --git a/conlite/includes/include.frontend.user_edit.php b/conlite/includes/include.frontend.user_edit.php index 468c52a..7381b9a 100644 --- a/conlite/includes/include.frontend.user_edit.php +++ b/conlite/includes/include.frontend.user_edit.php @@ -162,7 +162,7 @@ if ($oFeUser->virgin == false && $oFeUser->get("idclient") == $client) { if($bStore) $oFeUser->store(); } - if (count($messages) > 0) { + if (is_array($messages) && count($messages) > 0) { $notis = $notification->returnNotification("warning", implode("
", $messages)) . "
"; } diff --git a/conlite/includes/include.lay_edit_form.php b/conlite/includes/include.lay_edit_form.php index 208ce06..42c65cb 100644 --- a/conlite/includes/include.lay_edit_form.php +++ b/conlite/includes/include.lay_edit_form.php @@ -107,7 +107,7 @@ if (!$layout->virgin) { } $types = array_unique($types); - if (version_compare(PHP_VERSION, '8.0.0', '>=')) { + if (version_compare(PHP_VERSION, '7.4.0', '>=')) { $layout->setProperty("layout", "used-types", implode(";", $types)); } else { $layout->setProperty("layout", "used-types", implode($types, ";")); From 50553924d4f5fb17a51782d42916df999818298b Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Tue, 17 May 2022 20:00:37 +0200 Subject: [PATCH 23/25] fixing PHP 8.1 errors --- conlite/classes/class.ui.php | 3 +- conlite/classes/contenido/class.module.php | 2 + .../external/backendedit/front_content.php | 9 +- .../external/wysiwyg/tinymce3/editorclass.php | 2 +- conlite/includes/ajax/include.ajax.con.php | 2 + conlite/includes/include.con_art_overview.php | 2 +- conlite/includes/include.con_edit_form.php | 3 +- conlite/includes/include.con_left_top.php | 365 ++++++++-------- conlite/includes/include.tplcfg_edit_form.php | 2 +- conlite/includes/main.login.php | 253 ++++++----- conlite/scripts/contextMenu.remove.js | 106 ----- .../standard/template.con_edit_form.html | 400 +++++++++--------- setup/data/base/base_type1.sql | 36 +- 13 files changed, 536 insertions(+), 649 deletions(-) delete mode 100644 conlite/scripts/contextMenu.remove.js diff --git a/conlite/classes/class.ui.php b/conlite/classes/class.ui.php index 4139941..bb09faf 100644 --- a/conlite/classes/class.ui.php +++ b/conlite/classes/class.ui.php @@ -1302,8 +1302,7 @@ class cScrollList { $this->sortkey = $field; $this->sortmode = $order; - - $field = $field + 1; + $field = intval($field) + 1; $this->data = array_csort($this->data, "$field", $order); } diff --git a/conlite/classes/contenido/class.module.php b/conlite/classes/contenido/class.module.php index 3e2cff4..bc1b323 100644 --- a/conlite/classes/contenido/class.module.php +++ b/conlite/classes/contenido/class.module.php @@ -1052,6 +1052,8 @@ class cApiModule extends Item { class cApiModuleTranslationCollection extends ItemCollection { protected $_error; + + protected $f_obj; /** * Constructor Function diff --git a/conlite/external/backendedit/front_content.php b/conlite/external/backendedit/front_content.php index 4555113..aa37f37 100644 --- a/conlite/external/backendedit/front_content.php +++ b/conlite/external/backendedit/front_content.php @@ -421,12 +421,19 @@ if ($contenido) { $col = new InUseCollection; - if ($overrideid != "" && $overridetype != "") { + if (!empty($overrideid) && !empty($overridetype)) { $col->removeItemMarks($overridetype, $overrideid); } /* Remove all own marks */ $col->removeSessionMarks($sess->id); /* If the override flag is set, override a specific InUseItem */ + if(empty($type)) { + $type = ''; + } + if(empty($typenr)) { + $typenr = ''; + } + list ($inUse, $message) = $col->checkAndMark("article", $idartlang, true, i18n("Article is in use by %s (%s)"), true, $cfg['path']['contenido_fullhtml'] . "external/backendedit/front_content.php?changeview=edit&action=con_editart&idartlang=$idartlang&type=$type&typenr=$typenr&idart=$idart&idcat=$idcat&idcatart=$idcatart&client=$client&lang=$lang"); diff --git a/conlite/external/wysiwyg/tinymce3/editorclass.php b/conlite/external/wysiwyg/tinymce3/editorclass.php index d490389..ba47a5b 100644 --- a/conlite/external/wysiwyg/tinymce3/editorclass.php +++ b/conlite/external/wysiwyg/tinymce3/editorclass.php @@ -112,7 +112,7 @@ class cTinyMCEEditor extends cWYSIWYGEditor { } // GZIP - if ($this->_aSettings["contenido_gzip"] == "true") { + if (isset($this->_aSettings["contenido_gzip"]) && $this->_aSettings["contenido_gzip"] == "true") { $this->setGZIPMode(true); } else { $this->setGZIPMode(false); diff --git a/conlite/includes/ajax/include.ajax.con.php b/conlite/includes/ajax/include.ajax.con.php index 00c116f..db9e7bd 100644 --- a/conlite/includes/ajax/include.ajax.con.php +++ b/conlite/includes/ajax/include.ajax.con.php @@ -31,6 +31,8 @@ if (!defined('CON_FRAMEWORK')) { die('Illegal call'); } +$bDebug = false; + if (!$idcat) { $idcat = Contenido_Security::toInteger($_REQUEST['idcat']); } diff --git a/conlite/includes/include.con_art_overview.php b/conlite/includes/include.con_art_overview.php index e0e092d..047728a 100644 --- a/conlite/includes/include.con_art_overview.php +++ b/conlite/includes/include.con_art_overview.php @@ -475,7 +475,7 @@ if (is_numeric($idcat) && ($idcat >= 0)) { } $imgsrc .= '.gif'; - + $tmp_img = ''; if (($perm->have_perm_area_action("con", "con_makestart") || $perm->have_perm_area_action_item("con", "con_makestart", $idcat)) && $idcat != 0) { if ($is_start == false) { $tmp_link = '' . i18n('; diff --git a/conlite/includes/include.con_edit_form.php b/conlite/includes/include.con_edit_form.php index f4e8a5b..13fb349 100644 --- a/conlite/includes/include.con_edit_form.php +++ b/conlite/includes/include.con_edit_form.php @@ -596,7 +596,8 @@ if ($action == "con_newart" && $newart != true) { '; foreach ($availableTags as $key => $value) { - $tpl->set('d', 'METAINPUT', 'META' . $value); + // @todo seems to be unused, check if we can delete it (op 17.05.2022) + //$tpl->set('d', 'METAINPUT', 'META' . $value); switch ($value["fieldtype"]) { case "text": diff --git a/conlite/includes/include.con_left_top.php b/conlite/includes/include.con_left_top.php index 68aa207..dc1dd54 100644 --- a/conlite/includes/include.con_left_top.php +++ b/conlite/includes/include.con_left_top.php @@ -1,4 +1,5 @@ reset(); global $sess, $frame, $area; -$idcat = ( isset($_GET['idcat']) && is_numeric($_GET['idcat'])) ? $_GET['idcat'] : -1; +$idcat = ( isset($_GET['idcat']) && is_numeric($_GET['idcat'])) ? $_GET['idcat'] : -1; //Get sync options -if (isset($syncoptions)) -{ - $syncfrom = (int) $syncoptions; - $remakeCatTable = true; +if (isset($syncoptions)) { + $syncfrom = (int) $syncoptions; + $remakeCatTable = true; } -if (!isset($syncfrom)) -{ - $syncfrom = -1; +if (!isset($syncfrom)) { + $syncfrom = -1; } $syncoptions = $syncfrom; $oTpl->set('s', 'SYNC_LANG', $syncfrom); - ########################################## # Delete a saved search ########################################## $bShowArticleSearch = false; -if( isset($_GET['delsavedsearch']) ) -{ - if( isset($_GET['itemtype']) && sizeof($_GET['itemtype'])>0 && isset($_GET['itemid']) && sizeof($_GET['itemid'])>0 ) - { - $propertyCollection = new PropertyCollection; - $propertyCollection->deleteProperties($_GET['itemtype'], $_GET['itemid']); - $bShowArticleSearch = true; - } +if (isset($_GET['delsavedsearch'])) { + if (isset($_GET['itemtype']) && sizeof($_GET['itemtype']) > 0 && isset($_GET['itemid']) && sizeof($_GET['itemid']) > 0) { + $propertyCollection = new PropertyCollection; + $propertyCollection->deleteProperties($_GET['itemtype'], $_GET['itemid']); + $bShowArticleSearch = true; + } } -if( isset($_GET['save_search']) && $_GET['save_search'] == 'true') { - $bShowArticleSearch = true; +if (isset($_GET['save_search']) && $_GET['save_search'] == 'true') { + $bShowArticleSearch = true; } @@ -91,22 +86,22 @@ if( isset($_GET['save_search']) && $_GET['save_search'] == 'true') { # modified 20/04/2007 by H. Librenz for backend search $arrDays = array(); -for ($i = 0; $i < 32; $i ++) { - if ($i == 0) { - $arrDays[$i] = '--'; - } else { - $arrDays[$i] = $i; - } +for ($i = 0; $i < 32; $i++) { + if ($i == 0) { + $arrDays[$i] = '--'; + } else { + $arrDays[$i] = $i; + } } $arrMonths = array(); for ($i = 0; $i < 13; $i++) { - if ($i == 0) { - $arrMonths[$i] = '--'; - } else { - $arrMonths[$i] = $i; - } + if ($i == 0) { + $arrMonths[$i] = '--'; + } else { + $arrMonths[$i] = $i; + } } $arrYears = array(); @@ -114,20 +109,20 @@ $arrYears = array(); $arrYears[0] = '-----'; $sActualYear = (int) date("Y"); -for ($i = $sActualYear-10; $i < $sActualYear+30; $i++) { - $arrYears[$i] = $i; +for ($i = $sActualYear - 10; $i < $sActualYear + 30; $i++) { + $arrYears[$i] = $i; } $arrUsers = array(); -$query = "SELECT * FROM ".$cfg['tab']['phplib_auth_user_md5']." ORDER BY realname"; +$query = "SELECT * FROM " . $cfg['tab']['phplib_auth_user_md5'] . " ORDER BY realname"; $arrUsers['n/a'] = '-'; $db->query($query); while ($db->next_record()) { - $arrUsers[$db->f('username')] = $db->f('realname'); + $arrUsers[$db->f('username')] = $db->f('realname'); } $arrDateTypes = array(); @@ -137,16 +132,16 @@ $arrDateTypes['created'] = i18n('Date created'); $arrDateTypes['lastmodified'] = i18n('Date modified'); $arrDateTypes['published'] = i18n('Date published'); -$articleLink="editarticle"; +$articleLink = "editarticle"; $oListOptionRow = new cFoldingRow("3498dbba-ed4a-4618-8e49-3a3635396e22", i18n("Article Search"), $articleLink, $bShowArticleSearch); $oTpl->set('s', 'ARTICLELINK', $articleLink); #Textfeld -$oTextboxArtTitle = new cHTMLTextbox("bs_search_text", (isset($_REQUEST["bs_search_text"])?$_REQUEST["bs_search_text"]:''), 10); +$oTextboxArtTitle = new cHTMLTextbox("bs_search_text", (isset($_REQUEST["bs_search_text"]) ? $_REQUEST["bs_search_text"] : ''), 10); $oTextboxArtTitle->setStyle('width:135px;'); #Artikel_ID-Feld -$oTextboxArtID = new cHTMLTextbox("bs_search_id", (isset($_REQUEST["bs_search_id"])?$_REQUEST["bs_search_id"]:''), 10); +$oTextboxArtID = new cHTMLTextbox("bs_search_id", (isset($_REQUEST["bs_search_id"]) ? $_REQUEST["bs_search_id"] : ''), 10); $oTextboxArtID->setStyle('width:135px;'); #Date type @@ -155,10 +150,10 @@ $oSelectArtDateType->autoFill($arrDateTypes); $oSelectArtDateType->setStyle('width:135px;'); $oSelectArtDateType->setEvent("Change", "toggle_tr_visibility('tr_date_from');toggle_tr_visibility('tr_date_to');"); -if (isset($_REQUEST["bs_search_date_type"]) && $_REQUEST["bs_search_date_type"] !='') { - $oSelectArtDateType->setDefault($_REQUEST["bs_search_date_type"]); +if (isset($_REQUEST["bs_search_date_type"]) && $_REQUEST["bs_search_date_type"] != '') { + $oSelectArtDateType->setDefault($_REQUEST["bs_search_date_type"]); } else { - $oSelectArtDateType->setDefault('n/a'); + $oSelectArtDateType->setDefault('n/a'); } #DateFrom @@ -175,21 +170,21 @@ $oSelectArtDateFromYear->setStyle('width:55px;'); $oSelectArtDateFromYear->autoFill($arrYears); if (isset($_REQUEST["bs_search_date_from_day"]) && $_REQUEST["bs_search_date_from_day"] > 0) { - $oSelectArtDateFromDay->setDefault($_REQUEST["bs_search_date_from_day"]); + $oSelectArtDateFromDay->setDefault($_REQUEST["bs_search_date_from_day"]); } else { - $oSelectArtDateFromDay->setDefault(0); + $oSelectArtDateFromDay->setDefault(0); } if (isset($_REQUEST["bs_search_date_from_month"]) && $_REQUEST["bs_search_date_from_month"] > 0) { - $oSelectArtDateFromMonth->setDefault($_REQUEST["bs_search_date_from_month"]); + $oSelectArtDateFromMonth->setDefault($_REQUEST["bs_search_date_from_month"]); } else { - $oSelectArtDateFromMonth->setDefault(0); + $oSelectArtDateFromMonth->setDefault(0); } if (isset($_REQUEST["bs_search_date_from_year"]) && $_REQUEST["bs_search_date_from_year"] > 0) { - $oSelectArtDateFromYear->setDefault($_REQUEST["bs_search_date_from_year"]); + $oSelectArtDateFromYear->setDefault($_REQUEST["bs_search_date_from_year"]); } else { - $oSelectArtDateFromYear->setDefault(0); + $oSelectArtDateFromYear->setDefault(0); } #DateTo @@ -206,21 +201,21 @@ $oSelectArtDateToYear->setStyle('width:55px;'); $oSelectArtDateToYear->autoFill($arrYears); if (isset($_REQUEST["bs_search_date_to_day"]) && $_REQUEST["bs_search_date_to_day"] > 0) { - $oSelectArtDateToDay->setDefault($_REQUEST["bs_search_date_to_day"]); + $oSelectArtDateToDay->setDefault($_REQUEST["bs_search_date_to_day"]); } else { - $oSelectArtDateToDay->setDefault(0); + $oSelectArtDateToDay->setDefault(0); } if (isset($_REQUEST["bs_search_date_to_month"]) && $_REQUEST["bs_search_date_to_month"] > 0) { - $oSelectArtDateToMonth->setDefault($_REQUEST["bs_search_date_to_month"]); + $oSelectArtDateToMonth->setDefault($_REQUEST["bs_search_date_to_month"]); } else { - $oSelectArtDateToMonth->setDefault(0); + $oSelectArtDateToMonth->setDefault(0); } if (isset($_REQUEST["bs_search_date_to_year"]) && $_REQUEST["bs_search_date_to_year"] > 0) { - $oSelectArtDateToYear->setDefault($_REQUEST["bs_search_date_to_year"]); + $oSelectArtDateToYear->setDefault($_REQUEST["bs_search_date_to_year"]); } else { - $oSelectArtDateToYear->setDefault(0); + $oSelectArtDateToYear->setDefault(0); } #Author @@ -228,57 +223,56 @@ $oSelectArtAuthor = new cHTMLSelectElement("bs_search_author"); $oSelectArtAuthor->setStyle('width:135px;'); $oSelectArtAuthor->autoFill($arrUsers); -if (isset($_REQUEST["bs_search_author"]) && $_REQUEST["bs_search_author"] !='') { - $oSelectArtAuthor->setDefault($_REQUEST["bs_search_author"]); +if (isset($_REQUEST["bs_search_author"]) && $_REQUEST["bs_search_author"] != '') { + $oSelectArtAuthor->setDefault($_REQUEST["bs_search_author"]); } else { - $oSelectArtAuthor->setDefault('n/a'); + $oSelectArtAuthor->setDefault('n/a'); } $oSubmit = new cHTMLButton("submit", i18n("Search")); -$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 .= ''; +$content .= ''; +$content .= ''; $content .= ''; $content .= ''; -$content .= ''; -$content .= ''; +$content .= ''; +$content .= ''; $content .= ''; $content .= ''; $content .= ''; -$content .= ''; +$content .= ''; $content .= ''; $content .= '
'. i18n("Title/Content").''.$oTextboxArtTitle->render().'' . i18n("Title/Content") . '' . $oTextboxArtTitle->render() . '
'. i18n("Article ID").''.$oTextboxArtID->render().'' . i18n("Article ID") . '' . $oTextboxArtID->render() . '
'. i18n("Datum").''.$oSelectArtDateType->render().'' . i18n("Datum") . '' . $oSelectArtDateType->render() . '
'. i18n("Author").''.$oSelectArtAuthor->render().'' . i18n("Author") . '' . $oSelectArtAuthor->render() . '
 '.$oSubmit->render().'' . $oSubmit->render() . '
'; $content .= ''; @@ -288,7 +282,7 @@ $content .= ''; */ $content .= ''; @@ -351,38 +342,37 @@ $sql = "SELECT idtpl, name FROM - ".$cfg['tab']['tpl']." + " . $cfg['tab']['tpl'] . " WHERE - idclient = '".Contenido_Security::toInteger($client)."' + idclient = '" . Contenido_Security::toInteger($client) . "' ORDER BY name"; $db->query($sql); -$oTpl->set('s', 'ID', 'oTplSel'); -$oTpl->set('s', 'CLASS', 'text_medium'); -$oTpl->set('s', 'OPTIONS', ''); -$oTpl->set('s', 'SESSID', $sess->id); +$oTpl->set('s', 'ID', 'oTplSel'); +$oTpl->set('s', 'CLASS', 'text_medium'); +$oTpl->set('s', 'OPTIONS', ''); +$oTpl->set('s', 'SESSID', $sess->id); $oTpl->set('s', 'BELANG', $belang); -$oTpl->set('d', 'VALUE', '0'); -$oTpl->set('d', 'CAPTION', i18n("Choose template")); -$oTpl->set('d', 'SELECTED', ''); +$oTpl->set('d', 'VALUE', '0'); +$oTpl->set('d', 'CAPTION', i18n("Choose template")); +$oTpl->set('d', 'SELECTED', ''); $oTpl->next(); -$oTpl->set('d', 'VALUE', '0'); -$oTpl->set('d', 'CAPTION', '--- '. i18n("none"). ' ---'); -$oTpl->set('d', 'SELECTED', ''); +$oTpl->set('d', 'VALUE', '0'); +$oTpl->set('d', 'CAPTION', '--- ' . i18n("none") . ' ---'); +$oTpl->set('d', 'SELECTED', ''); $oTpl->next(); -$categoryLink="editcat"; +$categoryLink = "editcat"; $editCategory = new cFoldingRow("3498dbbb-ed4a-4618-8e49-3a3635396e22", i18n("Edit Category"), $categoryLink); while ($db->next_record()) { $oTplname = $db->f('name'); - if (strlen($oTplname) > 18) - { + if (strlen($oTplname) > 18) { $oTplname = substr($oTplname, 0, 15) . "..."; } $oTpl->set('d', 'VALUE', $db->f('idtpl')); @@ -391,25 +381,25 @@ while ($db->next_record()) { $oTpl->next(); } // Template Dropdown -$editCat = '
'; -$editCat .= i18n("Template:") . "
"; -$editCat .= '
'; -$editCat .= $oTpl->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true); -$editCat .='
'; -$editCat .= '
'; +$editCat = '
'; +$editCat .= i18n("Template:") . "
"; +$editCat .= '
'; +$editCat .= $oTpl->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true); +$editCat .= '
'; +$editCat .= '
'; // Category -$editCat .= '
'; -$oTpl->set('s', 'CAT_HREF', $sess->url("main.php?area=con_tplcfg&action=tplcfg_edit&frame=4&mode=art").'&idcat='); +$editCat .= '
'; +$oTpl->set('s', 'CAT_HREF', $sess->url("main.php?area=con_tplcfg&action=tplcfg_edit&frame=4&mode=art") . '&idcat='); $oTpl->set('s', 'IDCAT', $idcat); -$editCat .= ''; +$editCat .= ''; // Online / Offline -$editCat .= ''; +$editCat .= ''; // Lock / Unlock -$editCat .= '
'.i18n('; -$editCat .= ''.i18n("Lock / Unlock").'
'; -$editCat .= '
'; +$editCat .= ''; +$editCat .= '
'; $editCat .= '
'; $editCat .= '
'; @@ -418,95 +408,90 @@ $editCategory->setContentData($editCat); $oTpl->set('s', 'EDIT', $editCategory->render()); $oTpl->set('s', 'CATEGORYLINK', $categoryLink); - ##################################### # Collapse / Expand / Config Category ##################################### $selflink = "main.php"; $expandlink = $sess->url($selflink . "?area=$area&frame=2&expand=all"); $collapselink = $sess->url($selflink . "?area=$area&frame=2&collapse=all"); -$collapseimg = ' '.i18n("close all").''; -$expandimg = ' '.i18n("open all").''; +$collapseimg = ' ' . i18n("close all") . ''; +$expandimg = ' ' . i18n("open all") . ''; $oTpl->set('s', 'MINUS', $collapseimg); $oTpl->set('s', 'PLUS', $expandimg); -/**************/ +/* * *********** */ /* SYNCSTUFF */ -/**************/ +/* * *********** */ $languages = getLanguageNamesByClient($client); +$sListId = ''; if (count($languages) > 1 && $perm->have_perm_area_action($area, "con_synccat")) { - $sListId = 'sync'; - $oListOptionRow = new cFoldingRow("4808dbba-ed4a-4618-8e49-3a3635396e22", i18n("Synchronize from"), $sListId); - - if (($syncoptions > 0) && ($syncoptions != $lang)) { - $oListOptionRow->setExpanded (true); - } - + $sListId = 'sync'; + $oListOptionRow = new cFoldingRow("4808dbba-ed4a-4618-8e49-3a3635396e22", i18n("Synchronize from"), $sListId); + + if (($syncoptions > 0) && ($syncoptions != $lang)) { + $oListOptionRow->setExpanded(true); + } + #'dir="' . langGetTextDirection($lang) . '"'); $selectbox = new cHTMLSelectElement("syncoptions"); - - $option = new cHTMLOptionElement("--- ".i18n("None")." ---", -1); + + $option = new cHTMLOptionElement("--- " . i18n("None") . " ---", -1); $selectbox->addOptionElement(-1, $option); - - foreach ($languages as $languageid => $languagename) - { - if ($lang != $languageid && $perm->have_perm_client_lang($client, $languageid)) - { - $option = new cHTMLOptionElement($languagename . " (".$languageid.")",$languageid); - $selectbox->addOptionElement($languageid, $option); - } + + foreach ($languages as $languageid => $languagename) { + if ($lang != $languageid && $perm->have_perm_client_lang($client, $languageid)) { + $option = new cHTMLOptionElement($languagename . " (" . $languageid . ")", $languageid); + $selectbox->addOptionElement($languageid, $option); + } } - + $selectbox->setDefault($syncoptions); $form = new UI_Form("syncfrom"); - $form->setVar("area",$area); + $form->setVar("area", $area); $form->setVar("frame", $frame); $form->add("sel", $selectbox->render()); - $link = $sess->url("main.php?area=".$area."&frame=2").'&syncoptions='; - $sJsLink = 'conMultiLink(\'left_bottom\', \''.$link.'\'+document.getElementsByName(\'syncoptions\')[0].value+\'&refresh_syncoptions=true\');'; - $oTpl->set('s', 'UPDATE_SYNC_REFRESH_FRAMES', $sJsLink); - - $form->add("submit", ''); + $link = $sess->url("main.php?area=" . $area . "&frame=2") . '&syncoptions='; + $sJsLink = 'conMultiLink(\'left_bottom\', \'' . $link . '\'+document.getElementsByName(\'syncoptions\')[0].value+\'&refresh_syncoptions=true\');'; + $oTpl->set('s', 'UPDATE_SYNC_REFRESH_FRAMES', $sJsLink); - $sSyncButton = ''; - $sSyncButtonMultiple = ''; - - $content = ' + $form->add("submit", ''); + + $sSyncButton = ''; + $sSyncButtonMultiple = ''; + + $content = '
- + - + -
'.$form->render().'' . $form->render() . '
'.$sSyncButton.$sSyncButtonMultiple.'' . $sSyncButton . $sSyncButtonMultiple . '
'; + '; $oListOptionRow->setContentData($content); - $oTpl->set('s', 'SYNCRONIZATION',$oListOptionRow->render()); + $oTpl->set('s', 'SYNCRONIZATION', $oListOptionRow->render()); $oTpl->set('s', 'SYNCLINK', $sListId); - $sSyncLink = $sess->url($selflink . "?area=$area&frame=2&action=con_synccat"); - $oTpl->set('s', 'SYNC_HREF', $sSyncLink); - + $sSyncLink = $sess->url($selflink . "?area=$area&frame=2&action=con_synccat"); + $oTpl->set('s', 'SYNC_HREF', $sSyncLink); } else { - $oTpl->set('s', 'SYNCRONIZATION',''); - $oTpl->set('s', 'SYNCLINK',$sListId); - $oTpl->set('s', 'SYNC_HREF', ''); + $oTpl->set('s', 'SYNCRONIZATION', ''); + $oTpl->set('s', 'SYNCLINK', $sListId); + $oTpl->set('s', 'SYNC_HREF', ''); } /* * necessary for expanding/collapsing of navigation tree per javascript/AJAX (I. van Peeren) - */ + */ $oTpl->set('s', 'AREA', $area); $oTpl->set('s', 'SESSION', $contenido); -$oTpl->set('s', 'AJAXURL', $cfg['path']['contenido_fullhtml'].'ajaxmain.php'); +$oTpl->set('s', 'AJAXURL', $cfg['path']['contenido_fullhtml'] . 'ajaxmain.php'); ########################################## # Help ########################################## $oTpl->set('s', 'HELPSCRIPT', setHelpContext("con")); -$oTpl->generate($cfg['path']['templates'] . $cfg['templates']['con_left_top']); - -?> \ No newline at end of file +$oTpl->generate($cfg['path']['templates'] . $cfg['templates']['con_left_top']); \ No newline at end of file diff --git a/conlite/includes/include.tplcfg_edit_form.php b/conlite/includes/include.tplcfg_edit_form.php index 8b09a28..68578b6 100644 --- a/conlite/includes/include.tplcfg_edit_form.php +++ b/conlite/includes/include.tplcfg_edit_form.php @@ -278,7 +278,7 @@ $tpl->set('s', 'TEMPLATECAPTION', i18n("Template")); $tpl2 = new Template; $tpl2->set('s', 'NAME', 'idtpl'); $tpl2->set('s', 'CLASS', 'text_medium'); - +$disabled2 = ''; if (!$perm->have_perm_area_action_item("con", "con_changetemplate", $idcat)) { $disabled2 = 'disabled="disabled"'; } diff --git a/conlite/includes/main.login.php b/conlite/includes/main.login.php index ef73da7..8e5171a 100644 --- a/conlite/includes/main.login.php +++ b/conlite/includes/main.login.php @@ -1,4 +1,5 @@ reset(); if ($saveLoginTime == true) { - $sess->register("saveLoginTime"); - $saveLoginTime= 0; + $sess->register("saveLoginTime"); + $saveLoginTime = 0; - $vuser= new User(); + $vuser = new User(); - $vuser->loadUserByUserID($auth->auth["uid"]); - - $lastTime= $vuser->getUserProperty("system", "currentlogintime"); - $timestamp= date("Y-m-d H:i:s"); - $vuser->setUserProperty("system", "currentlogintime", $timestamp); - $vuser->setUserProperty("system", "lastlogintime", $lastTime); + $vuser->loadUserByUserID($auth->auth["uid"]); + $lastTime = $vuser->getUserProperty("system", "currentlogintime"); + $timestamp = date("Y-m-d H:i:s"); + $vuser->setUserProperty("system", "currentlogintime", $timestamp); + $vuser->setUserProperty("system", "lastlogintime", $lastTime); } -$vuser= new User(); +$vuser = new User(); $vuser->loadUserByUserID($auth->auth["uid"]); -$lastlogin= $vuser->getUserProperty("system", "lastlogintime"); +$lastlogin = $vuser->getUserProperty("system", "lastlogintime"); if ($lastlogin == "") { - $lastlogin= i18n("No Login Information available."); + $lastlogin = i18n("No Login Information available."); } $aNotifications = array(); // notification for requested password -if($vuser->getField('using_pw_request') == 1) { +if ($vuser->getField('using_pw_request') == 1) { //$sPwNoti = $notification->returnNotification("warning", i18n("You're logged in with a temporary password. Please change your password.")); $aNotifications[] = i18n("You're logged in with a temporary password. Please change your password."); } // Check, if setup folder is still available -if (file_exists(dirname(dirname(dirname(__FILE__)))."/setup")) { - $aNotifications[] = i18n("The setup directory still exists. Please remove the setup directory before you continue."); +if (file_exists(dirname(dirname(dirname(__FILE__))) . "/setup")) { + $aNotifications[] = i18n("The setup directory still exists. Please remove the setup directory before you continue."); } // Check, if sysadmin and/or admin accounts are still using well-known default passwords $sDate = date('Y-m-d'); -$sSQL = "SELECT * FROM ".$cfg["tab"]["phplib_auth_user_md5"]." +$sSQL = "SELECT * FROM " . $cfg["tab"]["phplib_auth_user_md5"] . " WHERE (username = 'sysadmin' AND password = '48a365b4ce1e322a55ae9017f3daf0c0' - AND (valid_from <= '".Contenido_Security::escapeDB($sDate, $db)."' OR valid_from = '0000-00-00' OR valid_from = '1000-01-01' OR valid_from is NULL) AND - (valid_to >= '".Contenido_Security::escapeDB($sDate, $db)."' OR valid_to = '0000-00-00' OR valid_to is NULL)) + AND (valid_from <= '" . Contenido_Security::escapeDB($sDate, $db) . "' OR valid_from = '0000-00-00' OR valid_from = '1000-01-01' OR valid_from is NULL) AND + (valid_to >= '" . Contenido_Security::escapeDB($sDate, $db) . "' OR valid_to = '0000-00-00' OR valid_to is NULL)) OR (username = 'admin' AND password = '21232f297a57a5a743894a0e4a801fc3' - AND (valid_from <= '".Contenido_Security::escapeDB($sDate, $db)."' OR valid_from = '0000-00-00' OR valid_from = '1000-01-01' OR valid_from is NULL) AND - (valid_to >= '".Contenido_Security::escapeDB($sDate, $db)."' OR valid_to = '0000-00-00' OR valid_to = '1000-01-01' OR valid_to is NULL)) + AND (valid_from <= '" . Contenido_Security::escapeDB($sDate, $db) . "' OR valid_from = '0000-00-00' OR valid_from = '1000-01-01' OR valid_from is NULL) AND + (valid_to >= '" . Contenido_Security::escapeDB($sDate, $db) . "' OR valid_to = '0000-00-00' OR valid_to = '1000-01-01' OR valid_to is NULL)) "; $db->query($sSQL); @@ -97,7 +96,7 @@ if ($db->num_rows() > 0) { if (count($aNotifications) > 0) { $oNotification = new Contenido_Notification(); - $sNotification = $oNotification->messageBox("warning", implode("
", $aNotifications), 1). "
"; + $sNotification = $oNotification->messageBox("warning", implode("
", $aNotifications), 1) . "
"; } else { $sNotification = ""; } @@ -109,128 +108,126 @@ $userid = $auth->auth["uid"]; $oTpl->set('s', 'WELCOME', "" . i18n("Welcome") . " " . $vuser->getRealname($userid, true) . "."); $oTpl->set('s', 'LASTLOGIN', i18n("Last login") . ": " . $lastlogin); -$clients= $classclient->getAccessibleClients(); +$clients = $classclient->getAccessibleClients(); -$cApiClient= new cApiClient; -$warnings= array (); +$cApiClient = new cApiClient; +$warnings = array(); if (count($clients) > 1) { - $clientform= '
'; - $select= new cHTMLSelectElement("changeclient"); - $choices= array (); - foreach ($clients as $key => $v_client) { - if ($perm->hasClientPermission($key)) { + $clientform = ''; + $select = new cHTMLSelectElement("changeclient"); + $choices = array(); + foreach ($clients as $key => $v_client) { + if ($perm->hasClientPermission($key)) { - $cApiClient->loadByPrimaryKey($key); - if ($cApiClient->hasLanguages()) { - $choices[$key]= $v_client['name'] . " (" . $key . ')'; - } else { - $warnings[]= sprintf(i18n("Client %s (%s) has no languages"), $v_client['name'], $key); - } - - } - } - - $select->autoFill($choices); - $select->setDefault($client); - - $clientselect= $select->render(); - - $oTpl->set('s', 'CLIENTFORM', $clientform); - $oTpl->set('s', 'CLIENTFORMCLOSE', "
"); - $oTpl->set('s', 'CLIENTSDROPDOWN', $clientselect); - - if ($perm->have_perm() && count($warnings) > 0) { - $oTpl->set('s', 'WARNINGS', "
" . $notification->messageBox("warning", implode("
", $warnings), 0)); - } else { - $oTpl->set('s', 'WARNINGS', ''); - } - $oTpl->set('s', 'OKBUTTON', ''); -} else { - $oTpl->set('s', 'OKBUTTON', ''); - $sClientForm = ''; - if ( count($clients) == 0 ) { - $sClientForm = i18n('No clients available!'); - } - $oTpl->set('s', 'CLIENTFORM', $sClientForm); - $oTpl->set('s', 'CLIENTFORMCLOSE', ''); - - - foreach ($clients as $key => $v_client) { - if ($perm->hasClientPermission($key)) { - $cApiClient->loadByPrimaryKey($key); - if ($cApiClient->hasLanguages()) { - $name= $v_client['name'] . " (" . $key . ')'; - } else { - $warnings[]= sprintf(i18n("Client %s (%s) has no languages"), $v_client['name'], $key); - } + $cApiClient->loadByPrimaryKey($key); + if ($cApiClient->hasLanguages()) { + $choices[$key] = $v_client['name'] . " (" . $key . ')'; + } else { + $warnings[] = sprintf(i18n("Client %s (%s) has no languages"), $v_client['name'], $key); } - } - + } + } + + $select->autoFill($choices); + $select->setDefault($client); + + $clientselect = $select->render(); + + $oTpl->set('s', 'CLIENTFORM', $clientform); + $oTpl->set('s', 'CLIENTFORMCLOSE', ""); + $oTpl->set('s', 'CLIENTSDROPDOWN', $clientselect); + if ($perm->have_perm() && count($warnings) > 0) { - $oTpl->set('s', 'WARNINGS', "
" . $notification->messageBox("warning", implode("
", $warnings), 0)); - } else { - $oTpl->set('s', 'WARNINGS', ''); - } - - $oTpl->set('s', 'CLIENTSDROPDOWN', $name); + $oTpl->set('s', 'WARNINGS', "
" . $notification->messageBox("warning", implode("
", $warnings), 0)); + } else { + $oTpl->set('s', 'WARNINGS', ''); + } + $oTpl->set('s', 'OKBUTTON', ''); +} else { + $oTpl->set('s', 'OKBUTTON', ''); + $sClientForm = ''; + if (count($clients) == 0) { + $sClientForm = i18n('No clients available!'); + } + $oTpl->set('s', 'CLIENTFORM', $sClientForm); + $oTpl->set('s', 'CLIENTFORMCLOSE', ''); + + foreach ($clients as $key => $v_client) { + if ($perm->hasClientPermission($key)) { + $cApiClient->loadByPrimaryKey($key); + if ($cApiClient->hasLanguages()) { + $name = $v_client['name'] . " (" . $key . ')'; + } else { + $warnings[] = sprintf(i18n("Client %s (%s) has no languages"), $v_client['name'], $key); + } + } + } + + if ($perm->have_perm() && count($warnings) > 0) { + $oTpl->set('s', 'WARNINGS', "
" . $notification->messageBox("warning", implode("
", $warnings), 0)); + } else { + $oTpl->set('s', 'WARNINGS', ''); + } + + $oTpl->set('s', 'CLIENTSDROPDOWN', $name); } -$props= new PropertyCollection; +$props = new PropertyCollection; $props->select("itemtype = 'idcommunication' AND idclient='$client' AND type = 'todo' AND name = 'status' AND value != 'done'"); -$todoitems= array (); +$aItemsTodo = []; -while ($prop= $props->next()) { - $todoitems[]= $prop->get("itemid"); +while ($prop = $props->next()) { + $aItemsTodo[] = $prop->get("itemid"); } -if (count($todoitems) > 0) { - $in= "idcommunication IN (" . implode(",", $todoitems) . ")"; +if (count($aItemsTodo) > 0) { + $in = "idcommunication IN (" . implode(",", $aItemsTodo) . ")"; } else { - $in= 1; + $in = 1; } -$todoitems= new TODOCollection; -$recipient= $auth->auth["uid"]; +$todoitems = new TODOCollection(); +$recipient = $auth->auth["uid"]; $todoitems->select("recipient = '$recipient' AND idclient='$client' AND $in"); -while ($todo= $todoitems->next()) { - if ($todo->getProperty("todo", "status") != "done") { - $todoitems++; - } +$iItemsTodoOpen = 0; +while ($todo = $todoitems->next()) { + if ($todo->getProperty("todo", "status") != "done") { + $iItemsTodoOpen++; + } } $sTaskTranslation = ''; -if ($todoitems->count() == 1) { - $sTaskTranslation = i18n("Reminder list: %d Task open"); +if ($iItemsTodoOpen == 1) { + $sTaskTranslation = i18n("Reminder list: %d Task open"); } else { - $sTaskTranslation = i18n("Reminder list: %d Tasks open"); + $sTaskTranslation = i18n("Reminder list: %d Tasks open"); } -$mycontenido_overview= '' . i18n("Overview") . ''; -$mycontenido_lastarticles= '' . i18n("Recently edited articles") . ''; -$mycontenido_tasks= '' . sprintf($sTaskTranslation, $todoitems->count()) . ''; -$mycontenido_settings= '' . i18n("Settings") . ''; +$mycontenido_overview = '' . i18n("Overview") . ''; +$mycontenido_lastarticles = '' . i18n("Recently edited articles") . ''; +$mycontenido_tasks = '' . sprintf($sTaskTranslation, $iItemsTodoOpen) . ''; +$mycontenido_settings = '' . i18n("Settings") . ''; $oTpl->set('s', 'MYCONTENIDO_OVERVIEW', $mycontenido_overview); $oTpl->set('s', 'MYCONTENIDO_LASTARTICLES', $mycontenido_lastarticles); $oTpl->set('s', 'MYCONTENIDO_TASKS', $mycontenido_tasks); $oTpl->set('s', 'MYCONTENIDO_SETTINGS', $mycontenido_settings); -$admins= $classuser->getSystemAdmins(true); +$admins = $classuser->getSystemAdmins(true); $sAdminTemplate = '
  • %s, %s
  • '; -$sAdminName= ""; +$sAdminName = ""; $sAdminEmail = ""; $sOutputAdmin = ""; - foreach ($admins as $key => $value) { - if ($value["email"] != "") { - $sAdminEmail= '' . $value["email"] . ''; - $sAdminName= $value['realname']; - $sOutputAdmin .= sprintf($sAdminTemplate, $sAdminName, $sAdminEmail); - } + if ($value["email"] != "") { + $sAdminEmail = '' . $value["email"] . ''; + $sAdminName = $value['realname']; + $sOutputAdmin .= sprintf($sAdminTemplate, $sAdminName, $sAdminEmail); + } } $oTpl->set('s', 'ADMIN_EMAIL', $sOutputAdmin); @@ -238,14 +235,14 @@ $oTpl->set('s', 'ADMIN_EMAIL', $sOutputAdmin); $oTpl->set('s', 'SYMBOLHELP', '' . i18n("Symbol help") . ''); if (isset($cfg["contenido"]["handbook_path"]) && file_exists($cfg["contenido"]["handbook_path"])) { - $oTpl->set('s', 'CONTENIDOMANUAL', '' . i18n("Contenido Manual") . ''); + $oTpl->set('s', 'CONTENIDOMANUAL', '' . i18n("Contenido Manual") . ''); } else { - $oTpl->set('s', 'CONTENIDOMANUAL', ''); + $oTpl->set('s', 'CONTENIDOMANUAL', ''); } // For display current online user in Contenido-Backend -$aMemberList= array (); -$oActiveUsers= new ActiveUsers($db, $cfg, $auth); +$aMemberList = array(); +$oActiveUsers = new ActiveUsers($db, $cfg, $auth); $iNumberOfUsers = 0; // Start() @@ -255,17 +252,17 @@ $oActiveUsers->startUsersTracking(); $iNumberOfUsers = $oActiveUsers->getNumberOfUsers(); // Find all User who is online -$aMemberList= $oActiveUsers->findAllUser(); +$aMemberList = $oActiveUsers->findAllUser(); // Template for display current user $sTemplate = ""; -$sOutput = ""; -$sTemplate= '
  • %s, %s
  • '; +$sOutput = ""; +$sTemplate = '
  • %s, %s
  • '; foreach ($aMemberList as $key) { - $sRealName= $key['realname']; - $aPerms['0']= $key['perms']; - $sOutput .= sprintf($sTemplate, $sRealName, $aPerms['0']); + $sRealName = $key['realname']; + $aPerms['0'] = $key['perms']; + $sOutput .= sprintf($sTemplate, $sRealName, $aPerms['0']); } // set template welcome @@ -273,12 +270,11 @@ $oTpl->set('s', 'USER_ONLINE', $sOutput); $oTpl->set('s', 'Anzahl', $iNumberOfUsers); // rss feed -if($perm->isSysadmin($vuser) && isset($cfg["backend"]["newsfeed"]) && $cfg["backend"]["newsfeed"] == true){ - $newsfeed = 'some news'; - $oTpl->set('s', 'CONTENIDO_NEWS', $newsfeed); -} -else{ - $oTpl->set('s', 'CONTENIDO_NEWS', ''); +if ($perm->isSysadmin($vuser) && isset($cfg["backend"]["newsfeed"]) && $cfg["backend"]["newsfeed"] == true) { + $newsfeed = 'some news'; + $oTpl->set('s', 'CONTENIDO_NEWS', $newsfeed); +} else { + $oTpl->set('s', 'CONTENIDO_NEWS', ''); } // check for new updates @@ -287,5 +283,4 @@ $sUpdateNotifierOutput = $oUpdateNotifier->displayOutput(); $oTpl->set('s', 'UPDATENOTIFICATION', $sUpdateNotifierOutput); $oTpl->generate($cfg["path"]["templates"] . $cfg["templates"]["welcome"]); - ?> \ No newline at end of file diff --git a/conlite/scripts/contextMenu.remove.js b/conlite/scripts/contextMenu.remove.js deleted file mode 100644 index 10e1cd5..0000000 --- a/conlite/scripts/contextMenu.remove.js +++ /dev/null @@ -1,106 +0,0 @@ -var display_url; - function createMenu (menuname, items, links) - { - document.writeln(''); - document.getElementById(menuname).style.display = ''; - } - -var ie5 = document.all && document.getElementById - var ns6 = document.getElementById && !document.all - if (ie5 || ns6) -//var menuobj=document.getElementById("ie5menu") - - function showmenuie5(e){ - - if (ie5) - { - menuobj = document.getElementById(window.event.srcElement.getAttribute("helpid")); - } else - { - menuobj = document.getElementById(e.target.getAttribute("helpid")); - } - - -//Find out how close the mouse is to the corner of the window - var rightedge = ie5? document.body.clientWidth - event.clientX : window.innerWidth - e.clientX - var bottomedge = ie5? document.body.clientHeight - event.clientY : window.innerHeight - e.clientY - -//if the horizontal distance isn't enough to accomodate the width of the context menu - if (rightedge < menuobj.offsetWidth) -//move the horizontal position of the menu to the left by it's width - menuobj.style.left = ie5? document.body.scrollLeft + event.clientX - menuobj.offsetWidth : window.pageXOffset + e.clientX - menuobj.offsetWidth - else -//position the horizontal position of the menu where the mouse was clicked - menuobj.style.left = ie5? document.body.scrollLeft + event.clientX : window.pageXOffset + e.clientX - -//same concept with the vertical position - if (bottomedge < menuobj.offsetHeight) - menuobj.style.top = ie5? document.body.scrollTop + event.clientY - menuobj.offsetHeight : window.pageYOffset + e.clientY - menuobj.offsetHeight - else - menuobj.style.top = ie5? document.body.scrollTop + event.clientY : window.pageYOffset + e.clientY - - menuobj.style.visibility = "visible" - - - return false; - - } - -function hidemenuie5(e){ -if (typeof menuobj == "object") -{ -menuobj.style.visibility = "hidden" -} -} - -function highlightie5(e){ -var firingobj = ie5? event.srcElement : e.target - if (firingobj.className == "menuitems" || ns6 && firingobj.parentNode.className == "menuitems"){ -if (ns6 && firingobj.parentNode.className == "menuitems") firingobj = firingobj.parentNode //up one node - firingobj.style.backgroundColor = "#F4F8BD" - firingobj.style.color = "black" - firingobj.style.cursor = "pointer" - if (display_url == 1) - window.status = event.srcElement.url -} -} - -function lowlightie5(e){ -var firingobj = ie5? event.srcElement : e.target - if (firingobj.className == "menuitems" || ns6 && firingobj.parentNode.className == "menuitems"){ -if (ns6 && firingobj.parentNode.className == "menuitems") firingobj = firingobj.parentNode //up one node - firingobj.style.backgroundColor = "" - firingobj.style.color = "black" - window.status = '' -} -} - -function jumptoie5(e){ -var firingobj = ie5? event.srcElement : e.target - if (firingobj.className == "menuitems" || ns6 && firingobj.parentNode.className == "menuitems"){ -if (ns6 && firingobj.parentNode.className == "menuitems") firingobj = firingobj.parentNode - if (firingobj.getAttribute("target")) - window.open(firingobj.getAttribute("url"), firingobj.getAttribute("target")) - else - window.location = firingobj.getAttribute("url") -} -} - -var menuobj; - if (ie5 || ns6){ -//menuobj.style.display='' -document.oncontextmenu = showmenuie5 - document.onclick = hidemenuie5 -} \ No newline at end of file diff --git a/conlite/templates/standard/template.con_edit_form.html b/conlite/templates/standard/template.con_edit_form.html index 6659d98..0076951 100644 --- a/conlite/templates/standard/template.con_edit_form.html +++ b/conlite/templates/standard/template.con_edit_form.html @@ -1,227 +1,229 @@ - - - - - - - - - - - - - - - + + + + + + - - + } + + + -
    {CATEGORY}
    +
    {CATEGORY}
    -
    + - - {HIDDENSESSION} - {HIDDENFIELDS} - - - - - - + + {HIDDENSESSION} + {HIDDENFIELDS} + + + + - {NOTIFICATION} +
    - - - - - - - - - - - + {NOTIFICATION} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - -
    {TITEL}{TITEL-FIELD}
    {URLNAME}{URLNAME-FIELD}
    {DIRECTLINKTEXT}{DIRECTLINK}
    {ARTIKELART}{ARTIKELARTSELECT}
    {ARTIKELID}{ARTID}{ZUORDNUNGSID}{ALLOCID}
    {ERSTELLT}{ERSTELLUNGS-DATUM}{AUTHOR_CREATOR}{AUTOR-ERSTELLUNGS-NAME}
    {LETZTE-AENDERUNG}{AENDERUNGS-DATUM}{AUTHOR_MODIFIER}{AUTOR-AENDERUNG-NAME}
    {PUBLISHING_DATE_LABEL}{PUBLISHING_DATE}{PUBLISHER}{PUBLISHER_NAME}
    {WEITERLEITUNG} - - - - - + + + -
    {CHECKBOX}{URL}{CHECKBOX-NEWWINDOW}
    {TITEL}{TITEL-FIELD}
    -
    i18n("Time control") - - - - - - - - - - -
     i18n("Start date"): - {CHOOSESTART}
     i18n("End date"): - {CHOOSEEND}
    {MOVETOCATEGORYSELECT}
    -
    {ONLINE}{ONLINE-CHECKBOX}{STARTARTIKEL}{STARTARTIKEL-CHECKBOX}
    {SORTIERUNG}{SORTIERUNG-FIELD}
    {URLNAME}{URLNAME-FIELD}
    {STRUKTUR}{STRUKTUR-FIELD}
    {DIRECTLINKTEXT}{DIRECTLINK}
    {SUMMARY}{SUMMARY-INPUT}
    i18n("Page title"){TITLE-INPUT}
    i18n("Meta tags") 
    {METATITLE}{METAFIELDTYPE}
    {ARTIKELART}{ARTIKELARTSELECT}
      
    + + {ARTIKELID} + {ARTID} + {ZUORDNUNGSID} + {ALLOCID} + -
    - - + + {PUBLISHING_DATE_LABEL} + {PUBLISHING_DATE} + {PUBLISHER} + {PUBLISHER_NAME} + + + + {WEITERLEITUNG} + + + + + + + +
    {CHECKBOX}{URL}{CHECKBOX-NEWWINDOW}
    + + + + + i18n("Time control") + + + + + + + + + + + + +
     i18n("Start date"): + {CHOOSESTART}
     i18n("End date"): + {CHOOSEEND}
    {MOVETOCATEGORYSELECT}
    + + + {ONLINE} + {ONLINE-CHECKBOX} + {STARTARTIKEL} + {STARTARTIKEL-CHECKBOX} + + + + {SORTIERUNG} + {SORTIERUNG-FIELD} + + + + + {STRUKTUR} + {STRUKTUR-FIELD} + + + + + {SUMMARY} + {SUMMARY-INPUT} + + + + + i18n("Page title") + {TITLE-INPUT} + + + + + i18n("Meta tags") +   + + + + + {METATITLE} + {METAFIELDTYPE} + + + + +   +   + + + + + + + + + + diff --git a/setup/data/base/base_type1.sql b/setup/data/base/base_type1.sql index 192cec8..dd00331 100644 --- a/setup/data/base/base_type1.sql +++ b/setup/data/base/base_type1.sql @@ -1,23 +1,23 @@ DELETE FROM !PREFIX!_type WHERE idtype < 10000; -INSERT INTO !PREFIX!_type VALUES('22', 'CMS_QRCODE', '/**\r\n * CMS_QRCODE\r\n */ \r\n$tmp = $a_content[''CMS_QRCODE''][$val];\r\n$tmp = urldecode($tmp); \r\n\r\n$tmp = AddSlashes(AddSlashes($tmp)); \r\n$tmp = str_replace("\\\\\\''", "''", $tmp); \r\n$tmp = str_replace("\\$", ''\\\\\\$'', $tmp); \r\n\r\n$q = array("", "L", "M", "Q", "H");\r\n$quality = intval(getEffectiveSetting("qrcode", "quality"));\r\nif ($quality == 0) {\r\n setSystemProperty("qrcode", "quality", 1);\r\n setSystemProperty("qrcode", "blocksize", 3);\r\n setSystemProperty("qrcode", "border", 2);\r\n $quality = 1;\r\n}\r\n$quality = $q[$quality];\r\n$blocksize = intval(getEffectiveSetting("qrcode", "blocksize", 3));\r\n$border = intval(getEffectiveSetting("qrcode", "border", 2));\r\n\r\nif ($edit) {\r\n # In editor we always generate a new image because of possible changes\r\n $tmp2 = "\r\necho ''QR Code
    (online only)
    '';\r\n@unlink(''" . $cfgClient[$client]["path"]["frontend"] . "cache/QR-Code-" . $idart . "-" . $val . ".png'');";\r\n \r\n # Edit anchor and image\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_QRCODE&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_QRCODE_'' . $val . ''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'', ''" . $editLink . "'');");\r\n # Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"] . $cfg["path"]["images"] . "but_edittext.gif");\r\n $editButton->setBorder(0);\r\n $editButton->setStyleDefinition("margin-right", "2px");\r\n \r\n $editAnchor->setContent($editButton);\r\n \r\n # Process for tmp2put with echo\r\n $finalEditButton = $editAnchor->render();\r\n \r\n $tmp2 .= "echo ''" . $finalEditButton . "'';";\r\n} else {\r\n # In frontend and preview we only generate a new image if it was deleted\r\n $tmp2 = "\r\nif (!is_file(''" . $cfgClient[$client][''path''][''frontend''] . "cache/QR-Code-" . $idart . "-" . $val . ".png'')) {\r\n define(''QR_CACHE_DIR'', ''" . $cfgClient[$client][''path''][''frontend''] . "cache/phpqrcode/'');\r\n if (!is_dir(QR_CACHE_DIR)) {\r\n mkdir(QR_CACHE_DIR);\r\n }";\r\n if (isStartArticle($idartlang, $idcat, $lang)) {\r\n $tmp2 .= "\r\n QRcode::png(''" . ((strlen($tmp)) ? $tmp : Contenido_Url::getInstance()->build(array(''idcat'' => $idcat, ''client'' => $client, ''lang'' => $lang), true)) . "'', ''" . $cfgClient[$client][''path''][''frontend''] . ''cache/QR-Code-'' . $idart . ''-'' . $val . ''.png'' . "'', ''" . $quality . "'', " . $blocksize . ", " . $border . ");";\r\n } else {\r\n $tmp2 .= "\r\n QRcode::png(''" . ((strlen($tmp)) ? $tmp : Contenido_Url::getInstance()->build(array(''idcat'' => $idcat, ''idart'' => $idart, ''client'' => $client, ''lang'' => $lang), true)) . "'', ''" . $cfgClient[$client][''path''][''frontend''] . ''cache/QR-Code-'' . $idart . ''-'' . $val . ''.png'' . "'', ''" . $quality . "'', " . $blocksize . ", " . $border . ");";\r\n }\r\n $tmp2 .= "\r\n}\r\necho ''\\"QR
    '';";\r\n}\r\n$tmp = $tmp2;', 'QR Code', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO !PREFIX!_type VALUES('18', 'CMS_EASYIMGEDIT', '/**\r\n * CMS_EASYIMGEDIT\r\n */\r\n$tmp = "";\r\nif ($edit) {\r\n\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_EASYIMG&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_EASYIMGEDIT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editimage.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', '', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('19', 'CMS_DATE', '$tmp = $a_content["CMS_DATE"][$val];\r\n\r\n$oCmsDate = new Cms_Date($tmp, $val, $idartlang, $editLink, $cfg, $db, count($a_content["CMS_DATE"]), $belang);\r\n\r\nif($edit){\r\n\r\n$tmp = $oCmsDate->getAllWidgetEdit();\r\n\r\n}else{\r\n\r\n$tmp = $oCmsDate->getAllWidgetView();\r\n\r\n}', 'Date', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO !PREFIX!_type VALUES('20', 'CMS_TEASER', '$tmp = $a_content["CMS_TEASER"][$val];\r\n\r\n$oCmsTeaser = new Cms_Teaser($tmp, $val, $idartlang, $editLink, $cfg, $db, $belang, $client, $lang, $cfgClient, $sess);\r\n\r\nif($edit){\r\n\r\n$tmp = $oCmsTeaser->getAllWidgetEdit();\r\n\r\n}else{\r\n\r\n$tmp = $oCmsTeaser->getAllWidgetView();\r\n\r\n}', 'Teaser', '0', '', '2009-04-20 13:12:14', '0000-00-00 00:00:00'); -INSERT INTO !PREFIX!_type VALUES('21', 'CMS_FILELIST', '$tmp = $a_content["CMS_FILELIST"][$val];\r\n\r\n$oCmsFileList = new Cms_FileList($tmp, $val, $idartlang, $editLink, $cfg, $db, $belang, $client, $lang, $cfgClient, $sess);\r\n\r\nif($edit){\r\n\r\n$tmp = $oCmsFileList->getAllWidgetEdit();\r\n\r\n}else{\r\n\r\n$tmp = $oCmsFileList->getAllWidgetView();\r\n\r\n}', '', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO !PREFIX!_type VALUES('17', 'CMS_HTMLTEXT', '/**\r\n * CMS_HTMLTEXT\r\n */\r\ncInclude("includes", "functions.lang.php");\r\n\r\n$content = $a_content[''CMS_HTMLTEXT''][$val];\r\n$content = urldecode($content);\r\n$content = htmldecode($content);\r\n$content = strip_tags($content);\r\n\r\n$content = str_replace(" ", " ", $content);\r\n\r\n$content = htmlspecialchars($content);\r\nif ($content == "")\r\n{\r\n $content = " ";\r\n}\r\n\r\n$content = nl2br($content);\r\n\r\nif ($edit) {\r\n\r\n $div = new cHTMLDiv;\r\n $div->setID("HTMLTEXT_".$db->f("idtype")."_".$val);\r\n $div->setEvent("focus", "this.style.border=''1px solid #bb5577''");\r\n $div->setEvent("blur", "this.style.border=''1px dashed #bfbfbf''");\r\n $div->setStyleDefinition("border", "1px dashed #bfbfbf");\r\n $div->updateAttributes(array("contentEditable" => "true"));\r\n $div->setStyleDefinition("direction", langGetTextDirection($lang));\r\n \r\n $editlink = new cHTMLLink;\r\n $editlink->setClass(''CMS_HTMLTEXT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editlink->setLink($sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTMLTEXT&typenr=$val&lang=$lang"));\r\n \r\n $editimg = new cHTMLImage;\r\n $editimg->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edittext.gif");\r\n \r\n $savelink = new cHTMLLink;\r\n $savelink->setClass(''CMS_HTMLTEXT_''.$val.''_SAVE CMS_LINK_SAVE'');\r\n $savelink->setLink("javascript:setcontent(''$idartlang'',''0'')");\r\n \r\n $saveimg = new cHTMLImage;\r\n $saveimg->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif");\r\n \r\n $savelink->setContent($saveimg);\r\n \r\n $editlink->setContent($editimg);\r\n \r\n $div->setContent($content);\r\n\r\n $tmp = implode("", array($div->render(), $editlink->render(), " ", $savelink->render()));\r\n $tmp = str_replace(''"'', ''\\"'', $tmp);\r\n} else {\r\n $tmp = $content;\r\n $tmp = str_replace(''"'', ''\\"'', $tmp);\r\n}\r\n\r\n\r\n$tmp = addslashes($tmp);\r\n$tmp = str_replace(''$'', ''\\\\\\$'', $tmp);', 'Text / Standard', '0', '', '2002-05-13 19:04:13', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('16', 'CMS_SIMPLELINKEDIT', '/**\r\n * CMS_LINKEDIT\r\n */\r\n$tmp = "";\r\nif ($edit) {\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_SIMPLELINK&typenr=$val");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_SIMPLELINKEDIT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editlink.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', '', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('14', 'CMS_IMGEDIT', '/**\r\n * CMS_IMGEDIT\r\n */\r\n$tmp = '''';\r\n\r\nif ($edit) {\r\n \r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_IMG&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_IMGEDIT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editimage.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Edit button for an image', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:58:44'); +INSERT INTO !PREFIX!_type VALUES('22', 'CMS_QRCODE', '/**\r\n * CMS_QRCODE\r\n */ \r\n$tmp = $a_content[''CMS_QRCODE''][$val];\r\n$tmp = urldecode($tmp); \r\n\r\n$tmp = AddSlashes(AddSlashes($tmp)); \r\n$tmp = str_replace("\\\\\\''", "''", $tmp); \r\n$tmp = str_replace("\\$", ''\\\\\\$'', $tmp); \r\n\r\n$q = array("", "L", "M", "Q", "H");\r\n$quality = intval(getEffectiveSetting("qrcode", "quality"));\r\nif ($quality == 0) {\r\n setSystemProperty("qrcode", "quality", 1);\r\n setSystemProperty("qrcode", "blocksize", 3);\r\n setSystemProperty("qrcode", "border", 2);\r\n $quality = 1;\r\n}\r\n$quality = $q[$quality];\r\n$blocksize = intval(getEffectiveSetting("qrcode", "blocksize", 3));\r\n$border = intval(getEffectiveSetting("qrcode", "border", 2));\r\n\r\nif (!empty($edit)) {\r\n # In editor we always generate a new image because of possible changes\r\n $tmp2 = "\r\necho ''QR Code
    (online only)
    '';\r\n@unlink(''" . $cfgClient[$client]["path"]["frontend"] . "cache/QR-Code-" . $idart . "-" . $val . ".png'');";\r\n \r\n # Edit anchor and image\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_QRCODE&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_QRCODE_'' . $val . ''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'', ''" . $editLink . "'');");\r\n # Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"] . $cfg["path"]["images"] . "but_edittext.gif");\r\n $editButton->setBorder(0);\r\n $editButton->setStyleDefinition("margin-right", "2px");\r\n \r\n $editAnchor->setContent($editButton);\r\n \r\n # Process for tmp2put with echo\r\n $finalEditButton = $editAnchor->render();\r\n \r\n $tmp2 .= "echo ''" . $finalEditButton . "'';";\r\n} else {\r\n # In frontend and preview we only generate a new image if it was deleted\r\n $tmp2 = "\r\nif (!is_file(''" . $cfgClient[$client][''path''][''frontend''] . "cache/QR-Code-" . $idart . "-" . $val . ".png'')) {\r\n define(''QR_CACHE_DIR'', ''" . $cfgClient[$client][''path''][''frontend''] . "cache/phpqrcode/'');\r\n if (!is_dir(QR_CACHE_DIR)) {\r\n mkdir(QR_CACHE_DIR);\r\n }";\r\n if (isStartArticle($idartlang, $idcat, $lang)) {\r\n $tmp2 .= "\r\n QRcode::png(''" . ((strlen($tmp)) ? $tmp : Contenido_Url::getInstance()->build(array(''idcat'' => $idcat, ''client'' => $client, ''lang'' => $lang), true)) . "'', ''" . $cfgClient[$client][''path''][''frontend''] . ''cache/QR-Code-'' . $idart . ''-'' . $val . ''.png'' . "'', ''" . $quality . "'', " . $blocksize . ", " . $border . ");";\r\n } else {\r\n $tmp2 .= "\r\n QRcode::png(''" . ((strlen($tmp)) ? $tmp : Contenido_Url::getInstance()->build(array(''idcat'' => $idcat, ''idart'' => $idart, ''client'' => $client, ''lang'' => $lang), true)) . "'', ''" . $cfgClient[$client][''path''][''frontend''] . ''cache/QR-Code-'' . $idart . ''-'' . $val . ''.png'' . "'', ''" . $quality . "'', " . $blocksize . ", " . $border . ");";\r\n }\r\n $tmp2 .= "\r\n}\r\necho ''\\"QR
    '';";\r\n}\r\n$tmp = $tmp2;', 'QR Code', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); +INSERT INTO !PREFIX!_type VALUES('18', 'CMS_EASYIMGEDIT', '/**\r\n * CMS_EASYIMGEDIT\r\n */\r\n$tmp = "";\r\nif (!empty($edit)) {\r\n\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_EASYIMG&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_EASYIMGEDIT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editimage.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', '', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('19', 'CMS_DATE', '$tmp = $a_content["CMS_DATE"][$val];\r\n\r\n$oCmsDate = new Cms_Date($tmp, $val, $idartlang, $editLink, $cfg, $db, count($a_content["CMS_DATE"]), $belang);\r\n\r\nif(!empty($edit)){\r\n\r\n$tmp = $oCmsDate->getAllWidgetEdit();\r\n\r\n}else{\r\n\r\n$tmp = $oCmsDate->getAllWidgetView();\r\n\r\n}', 'Date', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); +INSERT INTO !PREFIX!_type VALUES('20', 'CMS_TEASER', '$tmp = $a_content["CMS_TEASER"][$val];\r\n\r\n$oCmsTeaser = new Cms_Teaser($tmp, $val, $idartlang, $editLink, $cfg, $db, $belang, $client, $lang, $cfgClient, $sess);\r\n\r\nif(!empty($edit)){\r\n\r\n$tmp = $oCmsTeaser->getAllWidgetEdit();\r\n\r\n}else{\r\n\r\n$tmp = $oCmsTeaser->getAllWidgetView();\r\n\r\n}', 'Teaser', '0', '', '2009-04-20 13:12:14', '0000-00-00 00:00:00'); +INSERT INTO !PREFIX!_type VALUES('21', 'CMS_FILELIST', '$tmp = $a_content["CMS_FILELIST"][$val];\r\n\r\n$oCmsFileList = new Cms_FileList($tmp, $val, $idartlang, $editLink, $cfg, $db, $belang, $client, $lang, $cfgClient, $sess);\r\n\r\nif(!empty($edit)){\r\n\r\n$tmp = $oCmsFileList->getAllWidgetEdit();\r\n\r\n}else{\r\n\r\n$tmp = $oCmsFileList->getAllWidgetView();\r\n\r\n}', '', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); +INSERT INTO !PREFIX!_type VALUES('17', 'CMS_HTMLTEXT', '/**\r\n * CMS_HTMLTEXT\r\n */\r\ncInclude("includes", "functions.lang.php");\r\n\r\n$content = $a_content[''CMS_HTMLTEXT''][$val];\r\n$content = urldecode($content);\r\n$content = htmldecode($content);\r\n$content = strip_tags($content);\r\n\r\n$content = str_replace(" ", " ", $content);\r\n\r\n$content = htmlspecialchars($content);\r\nif ($content == "")\r\n{\r\n $content = " ";\r\n}\r\n\r\n$content = nl2br($content);\r\n\r\nif (!empty($edit)) {\r\n\r\n $div = new cHTMLDiv;\r\n $div->setID("HTMLTEXT_".$db->f("idtype")."_".$val);\r\n $div->setEvent("focus", "this.style.border=''1px solid #bb5577''");\r\n $div->setEvent("blur", "this.style.border=''1px dashed #bfbfbf''");\r\n $div->setStyleDefinition("border", "1px dashed #bfbfbf");\r\n $div->updateAttributes(array("contentEditable" => "true"));\r\n $div->setStyleDefinition("direction", langGetTextDirection($lang));\r\n \r\n $editlink = new cHTMLLink;\r\n $editlink->setClass(''CMS_HTMLTEXT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editlink->setLink($sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTMLTEXT&typenr=$val&lang=$lang"));\r\n \r\n $editimg = new cHTMLImage;\r\n $editimg->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edittext.gif");\r\n \r\n $savelink = new cHTMLLink;\r\n $savelink->setClass(''CMS_HTMLTEXT_''.$val.''_SAVE CMS_LINK_SAVE'');\r\n $savelink->setLink("javascript:setcontent(''$idartlang'',''0'')");\r\n \r\n $saveimg = new cHTMLImage;\r\n $saveimg->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif");\r\n \r\n $savelink->setContent($saveimg);\r\n \r\n $editlink->setContent($editimg);\r\n \r\n $div->setContent($content);\r\n\r\n $tmp = implode("", array($div->render(), $editlink->render(), " ", $savelink->render()));\r\n $tmp = str_replace(''"'', ''\\"'', $tmp);\r\n} else {\r\n $tmp = $content;\r\n $tmp = str_replace(''"'', ''\\"'', $tmp);\r\n}\r\n\r\n\r\n$tmp = addslashes($tmp);\r\n$tmp = str_replace(''$'', ''\\\\\\$'', $tmp);', 'Text / Standard', '0', '', '2002-05-13 19:04:13', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('16', 'CMS_SIMPLELINKEDIT', '/**\r\n * CMS_LINKEDIT\r\n */\r\n$tmp = "";\r\nif (!empty($edit)) {\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_SIMPLELINK&typenr=$val");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_SIMPLELINKEDIT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editlink.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', '', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('14', 'CMS_IMGEDIT', '/**\r\n * CMS_IMGEDIT\r\n */\r\n$tmp = '''';\r\n\r\nif (!empty($edit)) {\r\n \r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_IMG&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_IMGEDIT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editimage.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Edit button for an image', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:58:44'); INSERT INTO !PREFIX!_type VALUES('15', 'CMS_IMGTITLE', '/**\r\n * CMS_IMGTITLE\r\n */\r\n$tmp = $a_content["CMS_IMGDESCR"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = addslashes($tmp);', 'Title of an image', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO !PREFIX!_type VALUES('13', 'CMS_RAWLINK', '/**\r\n* CMS_RAWLINK\r\n*/\r\nglobal $cfgClient;\r\nglobal $client;\r\n\r\n$tmp = urldecode($a_content["CMS_LINK"][$val]);\r\n\r\n/* internal link */\r\nif ( is_numeric($tmp) ) {\r\n $tmp = "front_content.php?idcatart=". $tmp."&client=".$client."&lang=".$lang;\r\n if ($edit) $tmp = $sess->url("$tmp");\r\n\r\n}', 'Raw Link without transformation', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); +INSERT INTO !PREFIX!_type VALUES('13', 'CMS_RAWLINK', '/**\r\n* CMS_RAWLINK\r\n*/\r\nglobal $cfgClient;\r\nglobal $client;\r\n\r\n$tmp = urldecode($a_content["CMS_LINK"][$val]);\r\n\r\n/* internal link */\r\nif ( is_numeric($tmp) ) {\r\n $tmp = "front_content.php?idcatart=". $tmp."&client=".$client."&lang=".$lang;\r\n if (!empty($edit)) $tmp = $sess->url("$tmp");\r\n\r\n}', 'Raw Link without transformation', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); INSERT INTO !PREFIX!_type VALUES('11', 'CMS_LINKTITLE', '/**\r\n * CMS_LINKTITLE\r\n */\r\n$tmp = $a_content["CMS_LINKDESCR"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = addslashes($tmp);\r\n\r\n', 'Title of a Link', '0', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO !PREFIX!_type VALUES('12', 'CMS_LINKEDIT', '/**\r\n * CMS_LINKEDIT\r\n */\r\n$tmp = "";\r\n\r\nif ($edit) {\r\n \r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_LINK&typenr=$val");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_LINKEDIT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editlink.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $finalEditButton;\r\n \r\n}', 'Link edit button', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('9', 'CMS_HEAD', '/**\r\n * CMS_HEAD\r\n */\r\n$tmp = $a_content["CMS_HEAD"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = str_replace("''", "\\''", $tmp);\r\n$tmp = str_replace("\\$",''\\\\\\$'',$tmp); \r\n\r\nif ($edit) {\r\n\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HEAD&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_HEAD_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edithead.gif");\r\n $editButton->setBorder(0);\r\n $editButton->setStyleDefinition("margin-right", "2px");\r\n \r\n $editAnchor->setContent($editButton);\r\n \r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Headline / Standard', '0', '', '2002-05-13 19:02:34', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('10', 'CMS_SWF', '/**\r\n * CMS_SWF\r\n */\r\n\r\nif ( !is_object($db2) ) $db2 = new DB_Contenido;\r\n\r\n$tmp_id = $a_content[''CMS_SWF''][$val];\r\n\r\n$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient=''".$client."'' AND idupl=''".$tmp_id."'' AND filetype = ''swf''";\r\n\r\n$db2->query($sql);\r\n\r\nif ( $db2->next_record() ) {\r\n\r\n $tmp_swf = $cfgClient[$client]["upload"] . $db2->f("dirname") . $db2->f("filename");\r\n \r\n $aImgSize = @getimagesize($tmp_swf);\r\n\r\n $width = $aImgSize[0];\r\n $height = $aImgSize[1];\r\n\r\n $tmp = ''\r\n \r\n \r\n '';\r\n} else {\r\n $tmp = '''';\r\n}\r\n\r\n\r\nif( $edit ) {\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_SWF&typenr=$val");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_SWF_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editswf.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n \r\n $tmp = ''
    ''.$tmp.''
    ''.$finalEditButton.''
    '';\r\n}\r\n\r\n$tmp = addslashes( addslashes($tmp) ); \r\n$tmp = str_replace( "\\\\\\''", "''", $tmp ); ', 'Flash Movie', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('12', 'CMS_LINKEDIT', '/**\r\n * CMS_LINKEDIT\r\n */\r\n$tmp = "";\r\n\r\nif (!empty($edit)) {\r\n \r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_LINK&typenr=$val");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_LINKEDIT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editlink.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $finalEditButton;\r\n \r\n}', 'Link edit button', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('9', 'CMS_HEAD', '/**\r\n * CMS_HEAD\r\n */\r\n$tmp = $a_content["CMS_HEAD"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = str_replace("''", "\\''", $tmp);\r\n$tmp = str_replace("\\$",''\\\\\\$'',$tmp); \r\n\r\nif (!empty($edit)) {\r\n\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HEAD&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_HEAD_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edithead.gif");\r\n $editButton->setBorder(0);\r\n $editButton->setStyleDefinition("margin-right", "2px");\r\n \r\n $editAnchor->setContent($editButton);\r\n \r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Headline / Standard', '0', '', '2002-05-13 19:02:34', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('10', 'CMS_SWF', '/**\r\n * CMS_SWF\r\n */\r\n\r\nif ( !is_object($db2) ) $db2 = new DB_Contenido;\r\n\r\n$tmp_id = $a_content[''CMS_SWF''][$val];\r\n\r\n$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient=''".$client."'' AND idupl=''".$tmp_id."'' AND filetype = ''swf''";\r\n\r\n$db2->query($sql);\r\n\r\nif ( $db2->next_record() ) {\r\n\r\n $tmp_swf = $cfgClient[$client]["upload"] . $db2->f("dirname") . $db2->f("filename");\r\n \r\n $aImgSize = @getimagesize($tmp_swf);\r\n\r\n $width = $aImgSize[0];\r\n $height = $aImgSize[1];\r\n\r\n $tmp = ''\r\n \r\n \r\n '';\r\n} else {\r\n $tmp = '''';\r\n}\r\n\r\n\r\nif( !empty($edit) ) {\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_SWF&typenr=$val");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_SWF_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editswf.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n \r\n $tmp = ''
    ''.$tmp.''
    ''.$finalEditButton.''
    '';\r\n}\r\n\r\n$tmp = addslashes( addslashes($tmp) ); \r\n$tmp = str_replace( "\\\\\\''", "''", $tmp ); ', 'Flash Movie', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); INSERT INTO !PREFIX!_type VALUES('7', 'CMS_LINKTARGET', '/**\r\n * CMS_LINKTARGET\r\n */\r\n$tmp = $a_content["CMS_LINKTARGET"][$val];\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = str_replace("''", "\\''", $tmp);\r\n$tmp = urldecode($tmp);', 'Frame', '0', '', '2002-05-13 19:04:43', '2002-05-13 19:04:43'); -INSERT INTO !PREFIX!_type VALUES('8', 'CMS_LINKDESCR', '/**\r\n * CMS_LINKDESCR\r\n */\r\n$tmp = $a_content["CMS_LINKDESCR"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = str_replace("''", "\\''", $tmp);\r\nif ($edit) {\r\n\r\n\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_LINK&typenr=$val");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_LINKDESCR_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editlink.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Description', '0', '', '2002-05-13 19:05:00', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('6', 'CMS_LINK', '/**\r\n* CMS_LINK\r\n*/\r\n\r\n$tmp = urldecode($a_content["CMS_LINK"][$val]);\r\n\r\n/* internal link */\r\nif ( is_numeric($tmp) ) {\r\n $tmp = "front_content.php?idcatart=". $tmp."&client=".$client."&lang=".$lang;\r\n if ($edit) $tmp = $sess->url("$tmp");\r\n\r\n} else {\r\n\r\n if (!preg_match(''/^(http|https|ftp|telnet|gopher):\\/\\/((?:[a-zA-Z0-9_-]+\\.?)+):?(\\d*)/'', $tmp)) {\r\n // it''s a relative link, or an absolute link with unsupported protocol\r\n if (substr($tmp,0,4) == "www." || $tmp == "") { // only check if it could be a domainname\r\n $tmp = "http://".$tmp;\r\n }\r\n }\r\n\r\n}', 'Link', '0', '', '2002-05-13 19:04:36', '2002-05-13 19:04:36'); +INSERT INTO !PREFIX!_type VALUES('8', 'CMS_LINKDESCR', '/**\r\n * CMS_LINKDESCR\r\n */\r\n$tmp = $a_content["CMS_LINKDESCR"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = str_replace("''", "\\''", $tmp);\r\nif (!empty($edit)) {\r\n\r\n\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_LINK&typenr=$val");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_LINKDESCR_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editlink.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Description', '0', '', '2002-05-13 19:05:00', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('6', 'CMS_LINK', '/**\r\n* CMS_LINK\r\n*/\r\n\r\n$tmp = urldecode($a_content["CMS_LINK"][$val]);\r\n\r\n/* internal link */\r\nif ( is_numeric($tmp) ) {\r\n $tmp = "front_content.php?idcatart=". $tmp."&client=".$client."&lang=".$lang;\r\n if (!empty($edit)) $tmp = $sess->url("$tmp");\r\n\r\n} else {\r\n\r\n if (!preg_match(''/^(http|https|ftp|telnet|gopher):\\/\\/((?:[a-zA-Z0-9_-]+\\.?)+):?(\\d*)/'', $tmp)) {\r\n // it''s a relative link, or an absolute link with unsupported protocol\r\n if (substr($tmp,0,4) == "www." || $tmp == "") { // only check if it could be a domainname\r\n $tmp = "http://".$tmp;\r\n }\r\n }\r\n\r\n}', 'Link', '0', '', '2002-05-13 19:04:36', '2002-05-13 19:04:36'); INSERT INTO !PREFIX!_type VALUES('4', 'CMS_IMG', '/**\r\n * CMS_IMG\r\n */\r\n \r\n$tmp = $a_content["CMS_IMG"][$val];\r\n$tmp = urldecode($tmp);\r\nif($tmp==""||$tmp=="0"){\r\n$tmp="";\r\n\r\n}else{\r\n\r\nif (is_numeric($tmp))\r\n{\r\n$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient=''".$client."'' AND idupl=''".$tmp."''";\r\n\r\n$db2 = new DB_Contenido;\r\n$db2->query($sql);\r\n\r\nif ( $db2->next_record() ) {\r\n\r\n $tmp = $cfgClient[$client]["path"]["htmlpath"].$cfgClient[$client]["upload"].$db2->f("dirname").$db2->f("filename");\r\n }\r\n}\r\n\r\n $tmp = htmlspecialchars($tmp);\r\n$tmp = urldecode($tmp);\r\n $tmp = str_replace("''", "\\''", $tmp);\r\n}', 'Image', '0', '', '2002-05-13 19:04:21', '2002-05-13 19:04:21'); -INSERT INTO !PREFIX!_type VALUES('5', 'CMS_IMGDESCR', '/**\r\n * CMS_IMGDESCR\r\n */\r\n$tmp = $a_content["CMS_IMGDESCR"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlentities($tmp,ENT_QUOTES);\r\n\r\n\r\nif ($edit) {\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_IMG&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_IMGDESCR_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editimage.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Description', '0', '', '2002-05-13 19:04:28', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('3', 'CMS_TEXT', '/**\r\n * CMS_TEXT\r\n */\r\ncInclude("includes", "functions.lang.php");\r\n\r\n$tmp = $a_content["CMS_TEXT"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = nl2br($tmp);\r\n$tmp = str_replace("''", "\\''", $tmp);\r\n$tmp = str_replace("\\$",''\\\\\\$'',$tmp);\r\n\r\n$tmp = str_replace("
    ","
    ", $tmp);\r\nif ($edit) {\r\n\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_TEXT&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_TEXT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edittext.gif");\r\n $editButton->setBorder(0);\r\n $editButton->setStyleDefinition("margin-right", "2px");\r\n \r\n $editAnchor->setContent($editButton);\r\n \r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Text / Standard', '0', '', '2002-05-13 19:04:13', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('1', 'CMS_HTMLHEAD', '/**\r\n * CMS_HTMLHEAD\r\n */ \r\n$tmp = $a_content[''CMS_HTMLHEAD''][$val];\r\n$tmp = urldecode($tmp); \r\n\r\n$tmp = AddSlashes(AddSlashes($tmp)); \r\n$tmp = str_replace("\\\\\\''","''",$tmp); \r\n$tmp = str_replace("\\$",''\\\\\\$'',$tmp); \r\n\r\ncInclude("includes", "functions.lang.php"); \r\n\r\nif ($edit) {\r\n if ($tmp == "") { \r\n $tmp = " "; \r\n } \r\n $insiteEditingDIV = new cHTMLDiv; \r\n $insiteEditingDIV->setId("HTMLHEAD_".$db->f("idtype")."_".$val);\r\n $insiteEditingDIV->setEvent("Focus", "this.style.border=''1px solid #bb5577'';"); \r\n $insiteEditingDIV->setEvent("Blur", "this.style.border=''1px dashed #bfbfbf'';"); \r\n $insiteEditingDIV->setStyleDefinition("border", "1px dashed #bfbfbf"); \r\n $insiteEditingDIV->setStyleDefinition("direction", langGetTextDirection($lang)); \r\n \r\n $insiteEditingDIV->updateAttributes(array("contentEditable" => "true")); \r\n \r\n $insiteEditingDIV->setContent("_REPLACEMENT_"); \r\n \r\n\r\n /* Edit anchor and image */ \r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTMLHEAD&typenr=$val");\r\n $editAnchor = new cHTMLLink; \r\n $editAnchor->setClass(''CMS_HTMLHEAD_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''" . $editLink . "'');"); \r\n \r\n $editButton = new cHTMLImage; \r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edithead.gif");\r\n $editButton->setBorder(0); \r\n $editButton->setStyleDefinition("margin-right", "2px"); \r\n \r\n $editAnchor->setContent($editButton); \r\n \r\n \r\n /* Save anchor and image */ \r\n $saveAnchor = new cHTMLLink; \r\n $saveAnchor->setClass(''CMS_HTMLHEAD_''.$val.''_SAVE CMS_LINK_SAVE'');\r\n $saveAnchor->setLink("javascript:setcontent(''$idartlang'',''0'')"); \r\n \r\n $saveButton = new cHTMLImage; \r\n $saveButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif"); \r\n $saveButton->setBorder(0); \r\n \r\n $saveAnchor->setContent($saveButton); \r\n\r\n /* Process for output with echo */ \r\n $finalEditButton = $editAnchor->render(); \r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton)); \r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton); \r\n \r\n $finalEditingDiv = $insiteEditingDIV->render(); \r\n $finalEditingDiv = AddSlashes(AddSlashes($finalEditingDiv)); \r\n $finalEditingDiv = str_replace("\\\\\\''","''",$finalEditingDiv); \r\n \r\n $finalEditingDiv = str_replace("_REPLACEMENT_", $tmp, $finalEditingDiv); \r\n \r\n $finalSaveButton = $saveAnchor->render(); \r\n $finalSaveButton = AddSlashes(AddSlashes($finalSaveButton)); \r\n $finalSaveButton = str_replace("\\\\\\''","''",$finalSaveButton); \r\n \r\n $tmp = $finalEditingDiv . $finalEditButton . $finalSaveButton;\r\n}', 'Headline / HTML', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); -INSERT INTO !PREFIX!_type VALUES('2', 'CMS_HTML', '/** \r\n * CMS_HTML \r\n */ \r\n$tmp = $a_content[''CMS_HTML''][$val]; \r\n$tmp = urldecode($tmp); \r\n\r\n$tmp = AddSlashes(AddSlashes($tmp)); \r\n$tmp = str_replace("\\\\\\''","''",$tmp); \r\n$tmp = str_replace("\\$",''\\\\\\$'',$tmp); \r\n\r\ncInclude("includes", "functions.lang.php"); \r\n\r\nif ($edit) { \r\n if ($tmp == "") { \r\n $tmp = " "; \r\n } \r\n $insiteEditingDIV = new cHTMLDiv; \r\n $insiteEditingDIV->setId("HTML_".$db->f("idtype")."_".$val); \r\n $insiteEditingDIV->setEvent("Focus", "this.style.border=''1px solid #bb5577'';"); \r\n $insiteEditingDIV->setEvent("Blur", "this.style.border=''1px dashed #bfbfbf'';"); \r\n $insiteEditingDIV->setStyleDefinition("border", "1px dashed #bfbfbf"); \r\n $insiteEditingDIV->setStyleDefinition("direction", langGetTextDirection($lang)); \r\n \r\n $insiteEditingDIV->updateAttributes(array("contentEditable" => "true")); \r\n \r\n $insiteEditingDIV->setContent("_REPLACEMENT_"); \r\n \r\n\r\n /* Edit anchor and image */ \r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTML&typenr=$val"); \r\n $editAnchor = new cHTMLLink; \r\n $editAnchor->setClass(''CMS_HTML_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''" . $editLink . "'');"); \r\n \r\n $editButton = new cHTMLImage; \r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edithtml.gif"); \r\n $editButton->setBorder(0); \r\n $editButton->setStyleDefinition("margin-right", "2px"); \r\n \r\n $editAnchor->setContent($editButton); \r\n \r\n \r\n /* Save anchor and image */ \r\n $saveAnchor = new cHTMLLink; \r\n $saveAnchor->setClass(''CMS_HTML_''.$val.''_SAVE CMS_LINK_SAVE'');\r\n $saveAnchor->setLink("javascript:setcontent(''$idartlang'',''0'')"); \r\n \r\n $saveButton = new cHTMLImage; \r\n $saveButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif"); \r\n $saveButton->setBorder(0); \r\n \r\n $saveAnchor->setContent($saveButton); \r\n\r\n /* Process for output with echo */ \r\n $finalEditButton = $editAnchor->render(); \r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton)); \r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton); \r\n \r\n $finalEditingDiv = $insiteEditingDIV->render(); \r\n $finalEditingDiv = AddSlashes(AddSlashes($finalEditingDiv)); \r\n $finalEditingDiv = str_replace("\\\\\\''","''",$finalEditingDiv); \r\n \r\n $finalEditingDiv = str_replace("_REPLACEMENT_", $tmp, $finalEditingDiv); \r\n \r\n $finalSaveButton = $saveAnchor->render(); \r\n $finalSaveButton = AddSlashes(AddSlashes($finalSaveButton)); \r\n $finalSaveButton = str_replace("\\\\\\''","''",$finalSaveButton); \r\n \r\n $tmp = $finalEditingDiv . $finalEditButton . $finalSaveButton;\r\n}', 'Text / HTML', '0', '', '2002-05-13 19:04:13', '2009-04-14 13:56:58'); \ No newline at end of file +INSERT INTO !PREFIX!_type VALUES('5', 'CMS_IMGDESCR', '/**\r\n * CMS_IMGDESCR\r\n */\r\n$tmp = $a_content["CMS_IMGDESCR"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlentities($tmp,ENT_QUOTES);\r\n\r\n\r\nif (!empty($edit)) {\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_IMG&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_IMGDESCR_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_editimage.gif");\r\n $editButton->setBorder(0);\r\n \r\n $editAnchor->setContent($editButton);\r\n\r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Description', '0', '', '2002-05-13 19:04:28', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('3', 'CMS_TEXT', '/**\r\n * CMS_TEXT\r\n */\r\ncInclude("includes", "functions.lang.php");\r\n\r\n$tmp = $a_content["CMS_TEXT"][$val];\r\n$tmp = urldecode($tmp);\r\n$tmp = htmlspecialchars($tmp);\r\n$tmp = nl2br($tmp);\r\n$tmp = str_replace("''", "\\''", $tmp);\r\n$tmp = str_replace("\\$",''\\\\\\$'',$tmp);\r\n\r\n$tmp = str_replace("
    ","
    ", $tmp);\r\nif (!empty($edit)) {\r\n\r\n /* Edit anchor and image */\r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_TEXT&typenr=$val&lang=$lang");\r\n $editAnchor = new cHTMLLink;\r\n $editAnchor->setClass(''CMS_TEXT_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''".$editLink."'');");\r\n //Save all content\r\n \r\n $editButton = new cHTMLImage;\r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edittext.gif");\r\n $editButton->setBorder(0);\r\n $editButton->setStyleDefinition("margin-right", "2px");\r\n \r\n $editAnchor->setContent($editButton);\r\n \r\n /* Process for output with echo */\r\n $finalEditButton = $editAnchor->render();\r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton));\r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton);\r\n\r\n $tmp = $tmp.$finalEditButton;\r\n}', 'Text / Standard', '0', '', '2002-05-13 19:04:13', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('1', 'CMS_HTMLHEAD', '/**\r\n * CMS_HTMLHEAD\r\n */ \r\n$tmp = $a_content[''CMS_HTMLHEAD''][$val];\r\n$tmp = urldecode($tmp); \r\n\r\n$tmp = AddSlashes(AddSlashes($tmp)); \r\n$tmp = str_replace("\\\\\\''","''",$tmp); \r\n$tmp = str_replace("\\$",''\\\\\\$'',$tmp); \r\n\r\ncInclude("includes", "functions.lang.php"); \r\n\r\nif (!empty($edit)) {\r\n if ($tmp == "") { \r\n $tmp = " "; \r\n } \r\n $insiteEditingDIV = new cHTMLDiv; \r\n $insiteEditingDIV->setId("HTMLHEAD_".$db->f("idtype")."_".$val);\r\n $insiteEditingDIV->setEvent("Focus", "this.style.border=''1px solid #bb5577'';"); \r\n $insiteEditingDIV->setEvent("Blur", "this.style.border=''1px dashed #bfbfbf'';"); \r\n $insiteEditingDIV->setStyleDefinition("border", "1px dashed #bfbfbf"); \r\n $insiteEditingDIV->setStyleDefinition("direction", langGetTextDirection($lang)); \r\n \r\n $insiteEditingDIV->updateAttributes(array("contentEditable" => "true")); \r\n \r\n $insiteEditingDIV->setContent("_REPLACEMENT_"); \r\n \r\n\r\n /* Edit anchor and image */ \r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTMLHEAD&typenr=$val");\r\n $editAnchor = new cHTMLLink; \r\n $editAnchor->setClass(''CMS_HTMLHEAD_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''" . $editLink . "'');"); \r\n \r\n $editButton = new cHTMLImage; \r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edithead.gif");\r\n $editButton->setBorder(0); \r\n $editButton->setStyleDefinition("margin-right", "2px"); \r\n \r\n $editAnchor->setContent($editButton); \r\n \r\n \r\n /* Save anchor and image */ \r\n $saveAnchor = new cHTMLLink; \r\n $saveAnchor->setClass(''CMS_HTMLHEAD_''.$val.''_SAVE CMS_LINK_SAVE'');\r\n $saveAnchor->setLink("javascript:setcontent(''$idartlang'',''0'')"); \r\n \r\n $saveButton = new cHTMLImage; \r\n $saveButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif"); \r\n $saveButton->setBorder(0); \r\n \r\n $saveAnchor->setContent($saveButton); \r\n\r\n /* Process for output with echo */ \r\n $finalEditButton = $editAnchor->render(); \r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton)); \r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton); \r\n \r\n $finalEditingDiv = $insiteEditingDIV->render(); \r\n $finalEditingDiv = AddSlashes(AddSlashes($finalEditingDiv)); \r\n $finalEditingDiv = str_replace("\\\\\\''","''",$finalEditingDiv); \r\n \r\n $finalEditingDiv = str_replace("_REPLACEMENT_", $tmp, $finalEditingDiv); \r\n \r\n $finalSaveButton = $saveAnchor->render(); \r\n $finalSaveButton = AddSlashes(AddSlashes($finalSaveButton)); \r\n $finalSaveButton = str_replace("\\\\\\''","''",$finalSaveButton); \r\n \r\n $tmp = $finalEditingDiv . $finalEditButton . $finalSaveButton;\r\n}', 'Headline / HTML', '0', '', '0000-00-00 00:00:00', '2009-04-14 13:56:58'); +INSERT INTO !PREFIX!_type VALUES('2', 'CMS_HTML', '/** \r\n * CMS_HTML \r\n */ \r\n$tmp = $a_content[''CMS_HTML''][$val]; \r\n$tmp = urldecode($tmp); \r\n\r\n$tmp = AddSlashes(AddSlashes($tmp)); \r\n$tmp = str_replace("\\\\\\''","''",$tmp); \r\n$tmp = str_replace("\\$",''\\\\\\$'',$tmp); \r\n\r\ncInclude("includes", "functions.lang.php"); \r\n\r\nif (!empty($edit)) { \r\n if ($tmp == "") { \r\n $tmp = " "; \r\n } \r\n $insiteEditingDIV = new cHTMLDiv; \r\n $insiteEditingDIV->setId("HTML_".$db->f("idtype")."_".$val); \r\n $insiteEditingDIV->setEvent("Focus", "this.style.border=''1px solid #bb5577'';"); \r\n $insiteEditingDIV->setEvent("Blur", "this.style.border=''1px dashed #bfbfbf'';"); \r\n $insiteEditingDIV->setStyleDefinition("border", "1px dashed #bfbfbf"); \r\n $insiteEditingDIV->setStyleDefinition("direction", langGetTextDirection($lang)); \r\n \r\n $insiteEditingDIV->updateAttributes(array("contentEditable" => "true")); \r\n \r\n $insiteEditingDIV->setContent("_REPLACEMENT_"); \r\n \r\n\r\n /* Edit anchor and image */ \r\n $editLink = $sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTML&typenr=$val"); \r\n $editAnchor = new cHTMLLink; \r\n $editAnchor->setClass(''CMS_HTML_''.$val.''_EDIT CMS_LINK_EDIT'');\r\n $editAnchor->setLink("javascript:setcontent(''$idartlang'',''" . $editLink . "'');"); \r\n \r\n $editButton = new cHTMLImage; \r\n $editButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edithtml.gif"); \r\n $editButton->setBorder(0); \r\n $editButton->setStyleDefinition("margin-right", "2px"); \r\n \r\n $editAnchor->setContent($editButton); \r\n \r\n \r\n /* Save anchor and image */ \r\n $saveAnchor = new cHTMLLink; \r\n $saveAnchor->setClass(''CMS_HTML_''.$val.''_SAVE CMS_LINK_SAVE'');\r\n $saveAnchor->setLink("javascript:setcontent(''$idartlang'',''0'')"); \r\n \r\n $saveButton = new cHTMLImage; \r\n $saveButton->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif"); \r\n $saveButton->setBorder(0); \r\n \r\n $saveAnchor->setContent($saveButton); \r\n\r\n /* Process for output with echo */ \r\n $finalEditButton = $editAnchor->render(); \r\n $finalEditButton = AddSlashes(AddSlashes($finalEditButton)); \r\n $finalEditButton = str_replace("\\\\\\''","''",$finalEditButton); \r\n \r\n $finalEditingDiv = $insiteEditingDIV->render(); \r\n $finalEditingDiv = AddSlashes(AddSlashes($finalEditingDiv)); \r\n $finalEditingDiv = str_replace("\\\\\\''","''",$finalEditingDiv); \r\n \r\n $finalEditingDiv = str_replace("_REPLACEMENT_", $tmp, $finalEditingDiv); \r\n \r\n $finalSaveButton = $saveAnchor->render(); \r\n $finalSaveButton = AddSlashes(AddSlashes($finalSaveButton)); \r\n $finalSaveButton = str_replace("\\\\\\''","''",$finalSaveButton); \r\n \r\n $tmp = $finalEditingDiv . $finalEditButton . $finalSaveButton;\r\n}', 'Text / HTML', '0', '', '2002-05-13 19:04:13', '2009-04-14 13:56:58'); \ No newline at end of file From d482a362af7fe39ace4121b4a3943cf58b8e5dd0 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Mon, 23 May 2022 18:49:34 +0200 Subject: [PATCH 24/25] fixed #29 --- conlite/external/frontend/config.php | 53 - conlite/external/frontend/dbfs.php | 22 +- conlite/external/frontend/front_content.php | 588 +++++------ .../frontend/front_crcloginform.inc.php | 67 +- .../frontend/includes/class.input.helper.php | 917 +++++++++--------- nbproject/project.properties | 2 +- 6 files changed, 695 insertions(+), 954 deletions(-) delete mode 100644 conlite/external/frontend/config.php diff --git a/conlite/external/frontend/config.php b/conlite/external/frontend/config.php deleted file mode 100644 index 4714600..0000000 --- a/conlite/external/frontend/config.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * Requirements: - * @con_php_req 5 - * @con_template - * @con_notice - * - * - * @package ContenidoBackendArea - * @version - * @author - * @copyright four for business AG - * @license http://www.contenido.org/license/LIZENZ.txt - * @link http://www.4fb.de - * @link http://www.contenido.org - * - * - * - * {@internal - * created - * modified 2008-07-04, bilal arslan, added security fix - * - * $Id$: - * }} - * - */ - if(!defined('CON_FRAMEWORK')) { - die('Illegal call'); -} - -// Relative path to contenido directory, for all inclusions, in most cases: "../contenido/" -$contenido_path = "!PATH!"; - -// If language isn't specified, set this client and language (ID) -$load_lang = "!LANG!"; -$load_client = "!CLIENT!"; - -/* Various debugging options */ -$frontend_debug["container_display"] = false; -$frontend_debug["module_display"] = false; -$frontend_debug["module_timing"] = false; -$frontend_debug["module_timing_summary"] = false; - -/* Set to 1 to brute-force module regeneration */ -$force = 0; - -?> diff --git a/conlite/external/frontend/dbfs.php b/conlite/external/frontend/dbfs.php index 20566d8..6c8d42a 100644 --- a/conlite/external/frontend/dbfs.php +++ b/conlite/external/frontend/dbfs.php @@ -8,9 +8,11 @@ * * Requirements: * @con_php_req 5 + * @con_template + * @con_notice + * * * @package ContenidoBackendArea - * @version * @author unknown * @copyright four for business AG * @license http://www.contenido.org/license/LIZENZ.txt @@ -20,15 +22,17 @@ * * * {@internal - * created unknown - * modified 2008-06-16, H. Librenz - Hotfix: checking for potential unsecure calling - * modified 2008-07-04, bilal arslan, added security fix + * created unknown + * modified 2008-06-16, H. Librenz - Hotfix: checking for potential unsecure calling + * modified 2008-07-03, bilal arslan, added security fix + * modified 2010-05-20, Murat Purc, standardized Contenido startup and security check invocations, see [#CON-307] * * $Id$: * }} * */ - if (!defined("CON_FRAMEWORK")) { + +if (!defined("CON_FRAMEWORK")) { define("CON_FRAMEWORK", true); } @@ -36,12 +40,8 @@ $contenido_path = ''; # include the config file of the frontend to init the Client and Language Id include_once ("config.php"); -// include security class and check request variables -include_once ($contenido_path . 'classes/class.security.php'); -Contenido_Security::checkRequests(); - -include_once ($contenido_path . "includes/startup.php"); -cInclude("includes", "functions.general.php"); +// Contenido startup process +include_once ($contenido_path . 'includes/startup.php'); if ($contenido) { diff --git a/conlite/external/frontend/front_content.php b/conlite/external/frontend/front_content.php index 27fbc7f..5056912 100644 --- a/conlite/external/frontend/front_content.php +++ b/conlite/external/frontend/front_content.php @@ -1,4 +1,5 @@ Fatal Error
    Couldn't include ConLite startup."); +} +include_once($contenido_path . 'includes/startup.php'); cInclude("includes", "functions.con.php"); cInclude("includes", "functions.con2.php"); cInclude("includes", "functions.api.php"); cInclude("includes", "functions.pathresolver.php"); -if ($cfg["use_pseudocron"] == true) -{ +if ($cfg["use_pseudocron"] == true) { /* Include cronjob-Emulator */ $oldpwd = getcwd(); - chdir($cfg["path"]["contenido"].$cfg["path"]["cronjobs"]); + chdir($cfg["path"]["contenido"] . $cfg["path"]["cronjobs"]); cInclude("includes", "pseudo-cron.inc.php"); chdir($oldpwd); } @@ -100,53 +93,40 @@ if ($cfg["use_pseudocron"] == true) * PHPLIB application development toolkit * @see http://sourceforge.net/projects/phplib */ -if ($contenido) -{ +if (!empty($contenido)) { //Backend - page_open(array ('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); - i18nInit($cfg["path"]["contenido"].$cfg["path"]["locale"], $belang); -} -else -{ + page_open(array('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); + i18nInit($cfg["path"]["contenido"] . $cfg["path"]["locale"], $belang); +} else { //Frontend - page_open(array ('sess' => 'Contenido_Frontend_Session', 'auth' => 'Contenido_Frontend_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); + page_open(array('sess' => 'Contenido_Frontend_Session', 'auth' => 'Contenido_Frontend_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm')); } -/** - * Bugfix - * @see http://contenido.org/forum/viewtopic.php?t=18291 - * - * added by H. Librenz (2007-12-07) - */ -//includePluginConf(); -/** - * fixed bugfix - using functions brokes variable scopes! - * - * added by H. Librenz (2007-12-21) based on an idea of A. Lindner - */ require_once $cfg['path']['contenido'] . $cfg['path']['includes'] . 'functions.includePluginConf.php'; -$db = new DB_ConLite; +// Call hook after plugins are loaded, added by Murat Purc, 2008-09-07 +CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins'); + +$db = new DB_ConLite(); $sess->register("cfgClient"); $sess->register("errsite_idcat"); $sess->register("errsite_idart"); $sess->register("encoding"); -if ($cfgClient["set"] != "set") -{ +if (empty($cfgClient["set"]) || $cfgClient["set"] != "set") { rereadClients(); } # Check if this request is for a compressed file -if ($_GET['action'] == 'get_compressed') { +if (isset($_GET['action']) && $_GET['action'] == 'get_compressed') { # Get the calling parameters - $sFilename = ((isset($_GET['f'])) ? $_GET['f'] : $_GET['amp;f']); - $sContentType = ((isset($_GET['c'])) ? $_GET['c'] : $_GET['amp;c']); - + $sFilename = ((isset($_GET['f'])) ? $_GET['f'] : $_GET['amp;f']); + $sContentType = ((isset($_GET['c'])) ? $_GET['c'] : $_GET['amp;c']); + # Output the file using the class output() function Output_Compressor::output($cfgClient[$client]['path']['frontend'] . 'cache/', $sFilename, $sContentType); - + # Don't do anything else exit(); } @@ -154,8 +134,7 @@ if ($_GET['action'] == 'get_compressed') { // Call hook after plugins are loaded, added by Murat Purc, 2008-09-07 CEC_Hook::execute('Contenido.Frontend.AfterLoadPlugins'); -if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) -{ +if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) { // get encodings of all languages $encoding = array(); $sql = "SELECT idlang, encoding FROM " . $cfg["tab"]["lang"]; @@ -170,27 +149,25 @@ if (!isset($encoding) || !is_array($encoding) || count($encoding) == 0) // @TODO: Should be outsourced into startup process but requires a better detection (frontend or backend) Contenido_Security::checkFrontendGlobals(); - // update urlbuilder set http base path Contenido_Url::getInstance()->getUrlBuilder()->setHttpBasePath($cfgClient[$client]['htmlpath']['frontend']); - // Initialize language if (!isset($lang)) { // if there is an entry load_lang in frontend/config.php use it, else use the first language of this client - if(isset($load_lang)){ + if (isset($load_lang)) { // load_client is set in frontend/config.php $lang = $load_lang; - }else{ + } else { $sql = "SELECT B.idlang FROM - ".$cfg["tab"]["clients_lang"]." AS A, - ".$cfg["tab"]["lang"]." AS B + " . $cfg["tab"]["clients_lang"] . " AS A, + " . $cfg["tab"]["lang"] . " AS B WHERE - A.idclient='".Contenido_Security::toInteger($client)."' AND + A.idclient='" . Contenido_Security::toInteger($client) . "' AND A.idlang = B.idlang LIMIT 0,1"; @@ -202,11 +179,12 @@ if (!isset($lang)) { } } -if (!$sess->is_registered("lang") ) $sess->register("lang"); -if (!$sess->is_registered("client") ) $sess->register("client"); +if (!$sess->is_registered("lang")) + $sess->register("lang"); +if (!$sess->is_registered("client")) + $sess->register("client"); -if (isset ($username)) -{ +if (isset($username)) { $auth->login_if(true); } @@ -219,8 +197,7 @@ header("Content-Type: text/html; charset={$encoding[$lang]}"); * if http global logout is set e.g. front_content.php?logout=true * log out the current user. */ -if (isset ($logout)) -{ +if (isset($logout)) { $auth->logout(true); $auth->unauth(true); $auth->auth["uname"] = "nobody"; @@ -229,8 +206,7 @@ if (isset ($logout)) /* * local configuration */ -if (file_exists("config.local.php")) -{ +if (file_exists("config.local.php")) { @ include ("config.local.php"); } @@ -238,101 +214,86 @@ if (file_exists("config.local.php")) * If the path variable was passed, try to resolve it to a Category Id * e.g. front_content.php?path=/company/products/ */ -if (isset($path) && strlen($path) > 1) -{ +if (isset($path) && strlen($path) > 1) { /* Which resolve method is configured? */ - if ($cfg["urlpathresolve"] == true) - { + if ($cfg["urlpathresolve"] == true) { $iLangCheck = 0; $idcat = prResolvePathViaURLNames($path, $iLangCheck); - - } - else - { + } else { $iLangCheck = 0; $idcat = prResolvePathViaCategoryNames($path, $iLangCheck); - if(($lang != $iLangCheck) && ((int)$iLangCheck != 0)){ + if (($lang != $iLangCheck) && ((int) $iLangCheck != 0)) { $lang = $iLangCheck; } - } } // error page -$aParams = array ( - 'client' => $client, 'idcat' => $errsite_idcat[$client], 'idart' => $errsite_idart[$client], - 'lang' => $lang, 'error'=> '1' +$aParams = array( + 'client' => $client, 'idcat' => $errsite_idcat[$client], 'idart' => $errsite_idart[$client], + 'lang' => $lang, 'error' => '1' ); $errsite = 'Location: ' . Contenido_Url::getInstance()->buildRedirect($aParams); - /* * Try to initialize variables $idcat, $idart, $idcatart, $idartlang * Note: These variables can be set via http globals e.g. front_content.php?idcat=41&idart=34&idcatart=35&idartlang=42 * If not the values will be computed. */ -if ($idart && !$idcat && !$idcatart) -{ +if ($idart && !$idcat && !$idcatart) { /* Try to fetch the first idcat */ - $sql = "SELECT idcat FROM ".$cfg["tab"]["cat_art"]." WHERE idart = '".Contenido_Security::toInteger($idart)."'"; + $sql = "SELECT idcat FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "'"; $db->query($sql); - if ($db->next_record()) - { + if ($db->next_record()) { $idcat = $db->f("idcat"); } } -unset ($code); -unset ($markscript); +unset($code); +unset($markscript); -if (!$idcatart) -{ - if (!$idart) - { - if (!$idcat) - { +if (empty($idcatart)) { + if (empty($idart)) { + if (empty($idcat)) { # Note: In earlier Contenido versions the information if an article is startarticle of a category has been stored # in relation con_cat_art. - if ($cfg["is_start_compatible"] == true) - { + if ($cfg["is_start_compatible"] == true) { $sql = "SELECT idart, B.idcat FROM - ".$cfg["tab"]["cat_art"]." AS A, - ".$cfg["tab"]["cat_tree"]." AS B, - ".$cfg["tab"]["cat"]." AS C + " . $cfg["tab"]["cat_art"] . " AS A, + " . $cfg["tab"]["cat_tree"] . " AS B, + " . $cfg["tab"]["cat"] . " AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND is_start='1' AND - idclient='".Contenido_Security::toInteger($client)."' + idclient='" . Contenido_Security::toInteger($client) . "' ORDER BY idtree ASC"; - } - else - { + } else { # Note: Now the information if an article is startarticle of a category is stored in relation con_cat_lang. $sql = "SELECT A.idart, B.idcat FROM - ".$cfg["tab"]["cat_art"]." AS A, - ".$cfg["tab"]["cat_tree"]." AS B, - ".$cfg["tab"]["cat"]." AS C, - ".$cfg["tab"]["cat_lang"]." AS D, - ".$cfg["tab"]["art_lang"]." AS E + " . $cfg["tab"]["cat_art"] . " AS A, + " . $cfg["tab"]["cat_tree"] . " AS B, + " . $cfg["tab"]["cat"] . " AS C, + " . $cfg["tab"]["cat_lang"] . " AS D, + " . $cfg["tab"]["art_lang"] . " AS E WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND D.startidartlang = E.idartlang AND - D.idlang='".Contenido_Security::toInteger($lang)."' AND + D.idlang='" . Contenido_Security::toInteger($lang) . "' AND E.idart=A.idart AND - E.idlang='".Contenido_Security::toInteger($lang)."' AND - idclient='".Contenido_Security::toInteger($client)."' + E.idlang='" . Contenido_Security::toInteger($lang) . "' AND + idclient='" . Contenido_Security::toInteger($client) . "' ORDER BY idtree ASC"; } @@ -343,40 +304,34 @@ if (!$idcatart) $idart = $db->f("idart"); $idcat = $db->f("idcat"); } else { - if($contenido) { + if (!empty($contenido)) { cInclude("includes", "functions.i18n.php"); die(i18n("No start article for this category")); } else { - if($error == 1) { + if ($error == 1) { die("Fatal error: Could not display error page. Error to display was: 'No start article in this category'"); } else { header($errsite); - exit; + exit; } } } } else { $idart = -1; - if ($cfg["is_start_compatible"] == true) - { - $sql = "SELECT idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND is_start='1'"; + if ($cfg["is_start_compatible"] == true) { + $sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND is_start='1'"; $db->query($sql); - if ($db->next_record()) - { + if ($db->next_record()) { $idart = $db->f("idart"); } - } - else - { - $sql = "SELECT startidartlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + } else { + $sql = "SELECT startidartlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); - if ($db->next_record()) - { - if ($db->f("startidartlang") != 0) - { - $sql = "SELECT idart FROM ".$cfg["tab"]["art_lang"]." WHERE idartlang='".Contenido_Security::toInteger($db->f("startidartlang"))."'"; + if ($db->next_record()) { + if ($db->f("startidartlang") != 0) { + $sql = "SELECT idart FROM " . $cfg["tab"]["art_lang"] . " WHERE idartlang='" . Contenido_Security::toInteger($db->f("startidartlang")) . "'"; $db->query($sql); $db->next_record(); $idart = $db->f("idart"); @@ -384,36 +339,26 @@ if (!$idcatart) } } - if ($idart != -1) - { - } - else - { + if ($idart != -1) { + + } else { // error message in backend - if ($contenido) - { + if ($contenido) { cInclude("includes", "functions.i18n.php"); die(i18n("No start article for this category")); - } - else - { - if ($error == 1) - { + } else { + if ($error == 1) { echo "Fatal error: Could not display error page. Error to display was: 'No start article in this category'"; - } - else - { + } else { header($errsite); - exit; + exit; } } } } } -} -else -{ - $sql = "SELECT idcat, idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcatart='".Contenido_Security::toInteger($idcatart)."'"; +} else { + $sql = "SELECT idcat, idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "'"; $db->query($sql); $db->next_record(); @@ -423,9 +368,8 @@ else } /* Get idcatart */ -if (0 != $idart && 0 != $idcat) -{ - $sql = "SELECT idcatart FROM ".$cfg["tab"]["cat_art"]." WHERE idart = '".Contenido_Security::toInteger($idart)."' AND idcat = '".Contenido_Security::toInteger($idcat)."'"; +if (0 != $idart && 0 != $idcat) { + $sql = "SELECT idcatart FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "' AND idcat = '" . Contenido_Security::toInteger($idcat) . "'"; $db->query($sql); $db->next_record(); @@ -435,10 +379,9 @@ if (0 != $idart && 0 != $idcat) $idartlang = getArtLang($idart, $lang); -if ($idartlang === false) -{ +if ($idartlang === false) { header($errsite); - exit; + exit; } /* @@ -454,8 +397,6 @@ if ($cfg["cache"]["disable"] != '1') { $oCacheHandler->start($iStartTime); // $iStartTime ist optional und ist die startzeit des scriptes, z. b. am anfang von fron_content.php } // END: concache - - ############################################## # BACKEND / FRONTEND EDITING ############################################## @@ -470,44 +411,39 @@ if ($cfg["cache"]["disable"] != '1') { * The reason is to avoid cross-site scripting errors in the backend, if the backend domain differs from * the frontend domain. */ -if ($contenido) -{ +if ($contenido) { $perm->load_permissions(); /* Change mode edit / view */ - if (isset ($changeview)) - { + if (isset($changeview)) { $sess->register("view"); $view = $changeview; } $col = new InUseCollection; - if ($overrideid != "" && $overridetype != "") - { + if ($overrideid != "" && $overridetype != "") { $col->removeItemMarks($overridetype, $overrideid); } /* Remove all own marks */ $col->removeSessionMarks($sess->id); /* If the override flag is set, override a specific InUseItem */ - list ($inUse, $message) = $col->checkAndMark("article", $idartlang, true, i18n("Article is in use by %s (%s)"), true, $cfg['path']['contenido_fullhtml']."external/backendedit/front_content.php?changeview=edit&action=con_editart&idartlang=$idartlang&type=$type&typenr=$typenr&idart=$idart&idcat=$idcat&idcatart=$idcatart&client=$client&lang=$lang"); + list ($inUse, $message) = $col->checkAndMark("article", $idartlang, true, i18n("Article is in use by %s (%s)"), true, $cfg['path']['contenido_fullhtml'] . "external/backendedit/front_content.php?changeview=edit&action=con_editart&idartlang=$idartlang&type=$type&typenr=$typenr&idart=$idart&idcat=$idcat&idcatart=$idcatart&client=$client&lang=$lang"); $sHtmlInUse = ''; $sHtmlInUseMessage = ''; - if ($inUse == true) - { + if ($inUse == true) { $disabled = 'disabled="disabled"'; - $sHtmlInUseCss = ''; + $sHtmlInUseCss = ''; $sHtmlInUseMessage = $message; } - $sql = "SELECT locked FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT locked FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); $locked = $db->f("locked"); - if ($locked == 1) - { + if ($locked == 1) { $inUse = true; $disabled = 'disabled="disabled"'; } @@ -515,47 +451,40 @@ if ($contenido) // CEC to check if the user has permission to edit articles in this category CEC_Hook::setBreakCondition(false, true); // break at "false", default value "true" $allow = CEC_Hook::executeWhileBreakCondition( - 'Contenido.Frontend.AllowEdit', $lang, $idcat, $idart, $auth->auth['uid'] + 'Contenido.Frontend.AllowEdit', $lang, $idcat, $idart, $auth->auth['uid'] ); - if ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat) && $inUse == false && $allow == true) - { + if ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat) && $inUse == false && $allow == true) { /* Create buttons for editing */ $edit_preview = ''; - if ($view == "edit") - { + if ($view == "edit") { $edit_preview = ''; - } - else - { + } else { $edit_preview = ''; } /* Display articles */ - if ($cfg["is_start_compatible"] == true) - { - $sql = "SELECT idart, is_start FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' ORDER BY idart"; + if ($cfg["is_start_compatible"] == true) { + $sql = "SELECT idart, is_start FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' ORDER BY idart"; $db->query($sql); - } - else - { - $sql = "SELECT idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' ORDER BY idart"; + } else { + $sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' ORDER BY idart"; $db->query($sql); } @@ -564,53 +493,41 @@ if ($contenido) $edit_preview .= '
    - Preview + Preview - Preview + Preview
    - Preview + Preview - Edit + Edit
    Articles in category:
    '; - while ($db->next_record() && ($db->affected_rows() != 1)) - { + while ($db->next_record() && ($db->affected_rows() != 1)) { $class = "font-family:'Verdana'; font-size:10; color:#000000; text-decoration: underline; font-weight:normal"; - if (!isset ($idart)) - { - if (isStartArticle(getArtLang($idart, $lang), $idcat, $lang)) - { + if (!isset($idart)) { + if (isStartArticle(getArtLang($idart, $lang), $idcat, $lang)) { $class = "font-family: verdana; font-size:10; color:#000000; text-decoration: underline ;font-weight:bold"; } - } - else - { - if ($idart == $db->f("idart")) - { + } else { + if ($idart == $db->f("idart")) { $class = "font-family: verdana; font-size:10; color:#000000; text-decoration: underline; font-weight:bold"; } } - $edit_preview .= "url("front_content.php?idart=".$db->f("idart")."&idcat=$idcat")."\">$a "; - $a ++; + $edit_preview .= "url("front_content.php?idart=" . $db->f("idart") . "&idcat=$idcat") . "\">$a "; + $a++; } $edit_preview .= '
    '; - } - } // end if $contenido /* If mode is 'edit' and user has permission to edit articles in the current category */ -if ($inUse == false && $allow == true && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) -{ +if (empty($inUse) && (isset($allow) && $allow == true) && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat))) { cInclude("includes", "functions.tpl.php"); cInclude("includes", "functions.con.php"); - include ($cfg["path"]["contenido"].$cfg["path"]["includes"]."include.con_editcontent.php"); -} -else -{ + include ($cfg["path"]["contenido"] . $cfg["path"]["includes"] . "include.con_editcontent.php"); +} else { ############################################## # FRONTEND VIEW ############################################## /* Mark submenuitem 'Preview' in the Contenido Backend (Area: Contenido --> Articles --> Preview) */ - if ($contenido) - { + if ($contenido) { $markscript = markSubMenuItem(4, true); } @@ -620,10 +537,10 @@ else $sql = "SELECT createcode FROM - ".$cfg["tab"]["cat_art"]." + " . $cfg["tab"]["cat_art"] . " WHERE - idcat = '".Contenido_Security::toInteger($idcat)."' AND - idart = '".Contenido_Security::toInteger($idart)."'"; + idcat = '" . Contenido_Security::toInteger($idcat) . "' AND + idart = '" . Contenido_Security::toInteger($idart) . "'"; $db->query($sql); $db->next_record(); @@ -633,47 +550,36 @@ else ############################################## /* Check if code is expired, create new code if needed */ - if ($db->f("createcode") == 0 && $force == 0 && $cfg['dceModEdit']['use'] !== true) - { - $sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + if ($db->f("createcode") == 0 && $force == 0 && $cfg['dceModEdit']['use'] !== true && $cfg['dceLayEdit']['use'] !== true) { + $sql = "SELECT code FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); - if ($db->num_rows() == 0) - { + if ($db->num_rows() == 0) { /* Include here for performance reasons */ cInclude("includes", "functions.tpl.php"); conGenerateCode($idcat, $idart, $lang, $client); - $sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT code FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); } - if ($db->next_record()) - { + if ($db->next_record()) { $code = stripslashes($db->f("code")); - } - else - { + } else { if ($contenido) $code = "echo \"No code available.\";"; - else - { - if ($error == 1) - { + else { + if ($error == 1) { echo "Fatal error: Could not display error page. Error to display was: 'No code available'"; - } - else - { + } else { header($errsite); - exit; + exit; } } } - } - else - { - $sql = "DELETE FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."'"; + } else { + $sql = "DELETE FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "'"; $db->query($sql); cInclude("includes", "functions.con.php"); @@ -682,7 +588,7 @@ else conGenerateCode($idcat, $idart, $lang, $client); - $sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT code FROM " . $cfg["tab"]["code"] . " WHERE idcatart = '" . Contenido_Security::toInteger($idcatart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); @@ -691,16 +597,18 @@ else } /* Add mark Script to code if user is in the backend */ - $code = preg_replace("/<\/head>/i", "$markscript\n", $code, 1); + if(!empty($markscript)) { + $code = preg_replace("/<\/head>/i", "$markscript\n", $code, 1); + } /* If article is in use, display notification */ - if ($sHtmlInUseCss && $sHtmlInUseMessage) { + if (!empty($sHtmlInUseCss) && !empty($sHtmlInUseMessage)) { $code = preg_replace("/<\/head>/i", "$sHtmlInUseCss\n", $code, 1); $code = preg_replace("/(]*)>/i", "\${1}> \n $sHtmlInUseMessage", $code, 1); } /* Check if category is public */ - $sql = "SELECT public FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT public FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang='" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); @@ -710,80 +618,68 @@ else ############################################## # protected categories ############################################## - if ($public == 0) - { - if ($auth->auth["uid"] == "nobody") - { - $sql = "SELECT user_id, value FROM ".$cfg["tab"]["user_prop"]." WHERE type='frontend' and name='allowed_ip'"; + if ($public == 0) { + if ($auth->auth["uid"] == "nobody") { + $sql = "SELECT user_id, value FROM " . $cfg["tab"]["user_prop"] . " WHERE type='frontend' and name='allowed_ip'"; $db->query($sql); - while ($db->next_record()) - { + while ($db->next_record()) { $user_id = $db->f("user_id"); $range = urldecode($db->f("value")); $slash = strpos($range, "/"); - if ($slash == false) - { + if ($slash == false) { $netmask = "255.255.255.255"; $network = $range; - } - else - { + } else { $network = substr($range, 0, $slash); - $netmask = substr($range, $slash +1, strlen($range) - $slash -1); + $netmask = substr($range, $slash + 1, strlen($range) - $slash - 1); } - if (IP_match($network, $netmask, $_SERVER["REMOTE_ADDR"])) - { + if (IP_match($network, $netmask, $_SERVER["REMOTE_ADDR"])) { $sql = "SELECT idright - FROM ".$cfg["tab"]["rights"]." AS A, - ".$cfg["tab"]["actions"]." AS B, - ".$cfg["tab"]["area"]." AS C - WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '".Contenido_Security::escapeDB($user_id, $db2)."' AND A.idcat = '".Contenido_Security::toInteger($idcat)."' + FROM " . $cfg["tab"]["rights"] . " AS A, + " . $cfg["tab"]["actions"] . " AS B, + " . $cfg["tab"]["area"] . " AS C + WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '" . Contenido_Security::escapeDB($user_id, $db2) . "' AND A.idcat = '" . Contenido_Security::toInteger($idcat) . "' AND A.idarea = C.idarea AND B.idaction = A.idaction"; - $db2 = new DB_ConLite; + $db2 = new DB_ConLite(); $db2->query($sql); - if ($db2->num_rows() > 0) - { + if ($db2->num_rows() > 0) { $auth->auth["uid"] = $user_id; $validated = 1; } } } - if ($validated != 1) - { + if ($validated != 1) { // CEC to check category access CEC_Hook::setBreakCondition(true, false); // break at "true", default value "false" $allow = CEC_Hook::executeWhileBreakCondition( - 'Contenido.Frontend.CategoryAccess', $lang, $idcat, $auth->auth['uid'] + 'Contenido.Frontend.CategoryAccess', $lang, $idcat, $auth->auth['uid'] ); $auth->login_if(!$allow); } - } - else - { + } else { // CEC to check category access CEC_Hook::setBreakCondition(true, false); // break at "true", default value "false" $allow = CEC_Hook::executeWhileBreakCondition( - 'Contenido.Frontend.CategoryAccess', $lang, $idcat, $auth->auth['uid'] + 'Contenido.Frontend.CategoryAccess', $lang, $idcat, $auth->auth['uid'] ); /* - added 2008-11-18 Timo Trautmann - in backendeditmode also check if logged in backenduser has permission to view preview of page - */ + added 2008-11-18 Timo Trautmann + in backendeditmode also check if logged in backenduser has permission to view preview of page + */ if ($allow == false && $contenido && $perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat)) { $allow = true; } - if (!$allow) - { + if (!$allow) { header($errsite); - exit; + exit; } } } @@ -791,47 +687,24 @@ else ############################################## # statistic ############################################## - /* Sanity: If the statistic table doesn't contain an entry, create one */ - $sql = "SELECT idcatart FROM ".$cfg["tab"]["stat"]." WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idlang='".Contenido_Security::toInteger($lang)."'"; - $db->query($sql); - - if ($db->next_record()) - { - /* Update the statistics. */ - $sql = "UPDATE ".$cfg["tab"]["stat"]." SET visited = visited + 1 WHERE idcatart = '".Contenido_Security::toInteger($idcatart)."' AND idclient = '".Contenido_Security::toInteger($client)."' - AND idlang = '".Contenido_Security::toInteger($lang)."'"; - $db->query($sql); - } - else - { - /* Insert new record */ - $next = $db->nextid($cfg["tab"]["stat"]); - $sql = "INSERT INTO ".$cfg["tab"]["stat"]." (visited, idcatart, idlang, idstat, idclient) VALUES ('1', '".Contenido_Security::toInteger($idcatart)."', '".Contenido_Security::toInteger($lang)."', - '".Contenido_Security::toInteger($next)."', '".Contenido_Security::toInteger($client)."')"; - $db->query($sql); - } + $oStatCol = new cApiStatCollection(); + $oStatCol->trackView($idcatart); /* * Check if an article is start article of the category */ - if ($cfg["is_start_compatible"] == true) - { - $sql = "SELECT is_start FROM ".$cfg["tab"]["cat_art"]." WHERE idcatart='".Contenido_Security::toInteger($idcatart)."'"; + if ($cfg["is_start_compatible"] == true) { + $sql = "SELECT is_start FROM " . $cfg["tab"]["cat_art"] . " WHERE idcatart='" . Contenido_Security::toInteger($idcatart) . "'"; $db->query($sql); $db->next_record(); $isstart = $db->f("is_start"); - } - else - { - $sql = "SELECT startidartlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".Contenido_Security::toInteger($idcat)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + } else { + $sql = "SELECT startidartlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . Contenido_Security::toInteger($idcat) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); - if ($db->f("idartlang") == $idartlang) - { + if ($db->f("idartlang") == $idartlang) { $isstart = 1; - } - else - { + } else { $isstart = 0; } } @@ -839,18 +712,15 @@ else ############################################## # time management ############################################## - $sql = "SELECT timemgmt FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + $sql = "SELECT timemgmt FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; $db->query($sql); $db->next_record(); - if (($db->f("timemgmt") == "1") && ($isstart != 1)) - { - $sql = "SELECT online, redirect, redirect_url FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang = '".Contenido_Security::toInteger($lang)."' + if (($db->f("timemgmt") == "1") && ($isstart != 1)) { + $sql = "SELECT online, redirect, redirect_url FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "' AND NOW() > datestart AND NOW() < dateend"; - } - else - { - $sql = "SELECT online, redirect, redirect_url FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".Contenido_Security::toInteger($idart)."' AND idlang = '".Contenido_Security::toInteger($lang)."'"; + } else { + $sql = "SELECT online, redirect, redirect_url FROM " . $cfg["tab"]["art_lang"] . " WHERE idart='" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'"; } $db->query($sql); @@ -860,15 +730,14 @@ else $redirect = $db->f("redirect"); $redirect_url = $db->f("redirect_url"); - @ eval ("\$"."redirect_url = \"$redirect_url\";"); // transform variables + @ eval("\$" . "redirect_url = \"$redirect_url\";"); // transform variables $insert_base = getEffectiveSetting('generator', 'basehref', "true"); /* * generate base url */ - if ($insert_base == "true") - { + if ($insert_base == "true") { $is_XHTML = getEffectiveSetting('generator', 'xhtml', "false"); $str_base_uri = $cfgClient[$client]["path"]["htmlpath"]; @@ -877,21 +746,19 @@ else $str_base_uri = CEC_Hook::executeAndReturn('Contenido.Frontend.BaseHrefGeneration', $str_base_uri); if ($is_XHTML == "true") { - $baseCode = ''; + $baseCode = ''; } else { - $baseCode = ''; + $baseCode = ''; } - $code = str_ireplace_once("", "\n".$baseCode, $code); + $code = str_ireplace_once("", "\n" . $baseCode, $code); } /* * Handle online (offline) articles */ - if ($online) - { - if ($redirect == '1' && $redirect_url != '') - { + if ($online) { + if ($redirect == '1' && $redirect_url != '') { page_close(); /* * Redirect to the URL defined in article properties @@ -907,12 +774,9 @@ else } header("Location: $redirect_url"); exit; - } - else - { - if ($cfg["debug"]["codeoutput"]) - { - echo ""; + } else { + if ($cfg["debug"]["codeoutput"]) { + echo ""; } /* @@ -923,11 +787,11 @@ else $aExclude = explode(',', getEffectiveSetting('frontend.no_outputbuffer', 'idart', '')); if (in_array(Contenido_Security::toInteger($idart), $aExclude)) { - eval ("?>\n".$code."\n\n" . $code . "\n\n".$code."\n\n" . $code . "\n\n".$code."\n\n" . $code . "\ndisconnect(); -page_close(); -?> \ No newline at end of file +page_close(); \ No newline at end of file diff --git a/conlite/external/frontend/front_crcloginform.inc.php b/conlite/external/frontend/front_crcloginform.inc.php index 929dff0..663897c 100644 --- a/conlite/external/frontend/front_crcloginform.inc.php +++ b/conlite/external/frontend/front_crcloginform.inc.php @@ -1,40 +1,25 @@ - * - * Requirements: - * @con_php_req 5 - * @con_template - * @con_notice - * - * - * @package ContenidoBackendArea - * @version + * @package ConLite + * @subpackage Frontend + * @version $Rev$ + * @author Ortwin Pinke + * @copyright conrepo.org + * @link http://conlite.conrepo.org * @author Jan Lengowski * @copyright four for business AG * @license http://www.contenido.org/license/LIZENZ.txt * @link http://www.4fb.de * @link http://www.contenido.org - * - * - * - * {@internal - * created 2003-01-21 - * modified 2005-09-29, Andreas Lindner - * modified 2008-07-04, bilal arslan, added security fix - * modified 2008-11-18, Murat Purc, add usage of Contenido_Url to create urls to frontend pages and redesign of HTML markup - * modified 2009-01-03, Murat Purc, synchronized with cms/front_crcloginform.inc.php - * modified 2011-02-07, Dominik Ziegler, fixed check of but_ok.gif and changed input type button to submit * * $Id$: - * }} - * */ +/** + * security check + */ if(!defined('CON_FRAMEWORK')) { die('Illegal call'); } @@ -108,18 +93,17 @@ if ( file_exists($cfgClient[$client]['path']['frontend'] . 'images/but_ok.gif') } ?> - + - + :: :: :: :: Contenido Login - - + @@ -156,13 +140,14 @@ if ( file_exists($cfgClient[$client]['path']['frontend'] . 'images/but_ok.gif')
    - - + - + \ No newline at end of file diff --git a/conlite/external/frontend/includes/class.input.helper.php b/conlite/external/frontend/includes/class.input.helper.php index c19fcf2..bd0bc52 100644 --- a/conlite/external/frontend/includes/class.input.helper.php +++ b/conlite/external/frontend/includes/class.input.helper.php @@ -1,4 +1,5 @@ 0) - { - $sSQL = "SELECT tblArtLang.title AS title, tblArtLang.idartlang AS idartlang, tblCatArt.idcat AS idcat, "; - $sSQL .= "tblCatArt.idcatart AS idcatart, tblCatArt.is_start AS isstart, tblArtLang.online AS online, "; - $sSQL .= "tblCatLang.startidartlang as idstartartlang "; - $sSQL .= "FROM ".$cfg["tab"]["art_lang"]." AS tblArtLang, ".$cfg["tab"]["cat_art"]." AS tblCatArt, "; - $sSQL .= $cfg["tab"]["cat_lang"]." AS tblCatLang "; - $sSQL .= "WHERE tblCatArt.idcat = '".Contenido_Security::toInteger($iIDCat)."' AND tblCatLang.idcat = tblCatArt.idcat AND tblCatLang.idlang = tblArtLang.idlang AND "; + if (is_numeric($iIDCat) && $iIDCat > 0) { + $sSQL = "SELECT tblArtLang.title AS title, tblArtLang.idartlang AS idartlang, tblCatArt.idcat AS idcat, "; + $sSQL .= "tblCatArt.idcatart AS idcatart, tblCatArt.is_start AS isstart, tblArtLang.online AS online, "; + $sSQL .= "tblCatLang.startidartlang as idstartartlang "; + $sSQL .= "FROM " . $cfg["tab"]["art_lang"] . " AS tblArtLang, " . $cfg["tab"]["cat_art"] . " AS tblCatArt, "; + $sSQL .= $cfg["tab"]["cat_lang"] . " AS tblCatLang "; + $sSQL .= "WHERE tblCatArt.idcat = '" . Contenido_Security::toInteger($iIDCat) . "' AND tblCatLang.idcat = tblCatArt.idcat AND tblCatLang.idlang = tblArtLang.idlang AND "; - if ($bArtOnline) { - $sSQL .= "tblArtLang.online = '1' AND "; - } + if ($bArtOnline) { + $sSQL .= "tblArtLang.online = '1' AND "; + } - $sSQL .= "tblArtLang.idart = tblCatArt.idart AND tblArtLang.idlang = '".Contenido_Security::escapeDB($lang, $oDB)."' "; - if ($cfg["is_start_compatible"] == true) { - $sSQL .= "ORDER BY tblCatArt.is_start DESC, tblArtLang.title"; // Getting start article as first article - } else { - $sSQL .= "ORDER BY tblArtLang.title"; - } + $sSQL .= "tblArtLang.idart = tblCatArt.idart AND tblArtLang.idlang = '" . Contenido_Security::escapeDB($lang, $oDB) . "' "; + if ($cfg["is_start_compatible"] == true) { + $sSQL .= "ORDER BY tblCatArt.is_start DESC, tblArtLang.title"; // Getting start article as first article + } else { + $sSQL .= "ORDER BY tblArtLang.title"; + } - $oDB->query($sSQL); + $oDB->query($sSQL); - $iCount = $oDB->num_rows(); - if ($iCount == 0) { - return 0; - } else { - $iCounter = count($this->_options); - while ($oDB->next_record()) - { - // Generate new option element - $oOption = new cHTMLOptionElement($sSpaces."   ".substr(urldecode($oDB->f("title")), 0, 32), $oDB->f("idcatart")); + $iCount = $oDB->num_rows(); + if ($iCount == 0) { + return 0; + } else { + $iCounter = count($this->_options); + while ($oDB->next_record()) { + // Generate new option element + $oOption = new cHTMLOptionElement($sSpaces . "   " . substr(urldecode($oDB->f("title")), 0, 32), $oDB->f("idcatart")); - if ($bColored) - { - $bIsStartArticle = false; - if ($cfg["is_start_compatible"] == true && $oDB->f("isstart") == 1) { - // Compatible mode and "start article" flag is set - $bIsStartArticle = true; - } else if ($cfg["is_start_compatible"] != true && $oDB->f("idstartartlang") == $oDB->f("idartlang")) { - // No compatible mode and current article is start article (idstartartlang is the same for all records within a category) - $bIsStartArticle = true; - } + if ($bColored) { + $bIsStartArticle = false; + if ($cfg["is_start_compatible"] == true && $oDB->f("isstart") == 1) { + // Compatible mode and "start article" flag is set + $bIsStartArticle = true; + } else if ($cfg["is_start_compatible"] != true && $oDB->f("idstartartlang") == $oDB->f("idartlang")) { + // No compatible mode and current article is start article (idstartartlang is the same for all records within a category) + $bIsStartArticle = true; + } - if ($bIsStartArticle) - { - if ($oDB->f("online") == 0) { - // Start article, but offline -> red - $oOption->setStyle("color: #ff0000;"); - } else { - // Start article -> blue - $oOption->setStyle("color: #0000ff;"); - } - } else if ($oDB->f("online") == 0) { - // Offline article -> grey - $oOption->setStyle("color: #666666;"); - } - } + if ($bIsStartArticle) { + if ($oDB->f("online") == 0) { + // Start article, but offline -> red + $oOption->setStyle("color: #ff0000;"); + } else { + // Start article -> blue + $oOption->setStyle("color: #0000ff;"); + } + } else if ($oDB->f("online") == 0) { + // Offline article -> grey + $oOption->setStyle("color: #666666;"); + } + } - // Add option element to the list - $this->addOptionElement($iCounter, $oOption); - $iCounter++; - } - return $iCount; - } - } else { - return 0; - } - } + // Add option element to the list + $this->addOptionElement($iCounter, $oOption); + $iCounter++; + } + return $iCount; + } + } else { + return 0; + } + } - /** - * Function addCategories. Adds category elements (optionally including articles) to select box values. - * Note: Using "with articles" adds the articles also - but the categories will get a negative value! - * There is no way to distinguish between a category id and an article id... - * - * @param int $iMaxLevel Max. level shown (to be exact: except this level) - * @param bool $bColored Add color information to option elements - * @param bool $bCatVisible If true, only add idcat as value, if cat is visible - * @param bool $bCatPublic If true, only add idcat as value, if cat is public - * @param bool $bWithArt Add also articles per category - * @param bool $bArtOnline If true, show only online articles - * - * @return int Number of items added - **/ - function addCategories ($iMaxLevel = 0, $bColored = false, $bCatVisible = true, $bCatPublic = true, - $bWithArt = false, $bArtOnline = true) - { - global $cfg, $client, $lang; + /** + * Function addCategories. Adds category elements (optionally including articles) to select box values. + * Note: Using "with articles" adds the articles also - but the categories will get a negative value! + * There is no way to distinguish between a category id and an article id... + * + * @param int $iMaxLevel Max. level shown (to be exact: except this level) + * @param bool $bColored Add color information to option elements + * @param bool $bCatVisible If true, only add idcat as value, if cat is visible + * @param bool $bCatPublic If true, only add idcat as value, if cat is public + * @param bool $bWithArt Add also articles per category + * @param bool $bArtOnline If true, show only online articles + * + * @return int Number of items added + * */ + function addCategories($iMaxLevel = 0, $bColored = false, $bCatVisible = true, $bCatPublic = true, + $bWithArt = false, $bArtOnline = true) { + global $cfg, $client, $lang; - $oDB = new DB_ConLite; + $oDB = new DB_Contenido; - $sSQL = "SELECT tblCat.idcat AS idcat, tblCatLang.name AS name, "; - $sSQL .= "tblCatLang.visible AS visible, tblCatLang.public AS public, tblCatTree.level AS level "; - $sSQL .= "FROM ".$cfg["tab"]["cat"]." AS tblCat, ".$cfg["tab"]["cat_lang"]." AS tblCatLang, "; - $sSQL .= $cfg["tab"]["cat_tree"]." AS tblCatTree "; - $sSQL .= "WHERE tblCat.idclient = '".Contenido_Security::escapeDB($client, $oDB)."' AND tblCatLang.idlang = '".Contenido_Security::escapeDB($lang, $oDB)."' AND "; - $sSQL .= "tblCatLang.idcat = tblCat.idcat AND tblCatTree.idcat = tblCat.idcat "; + $sSQL = "SELECT tblCat.idcat AS idcat, tblCatLang.name AS name, "; + $sSQL .= "tblCatLang.visible AS visible, tblCatLang.public AS public, tblCatTree.level AS level "; + $sSQL .= "FROM " . $cfg["tab"]["cat"] . " AS tblCat, " . $cfg["tab"]["cat_lang"] . " AS tblCatLang, "; + $sSQL .= $cfg["tab"]["cat_tree"] . " AS tblCatTree "; + $sSQL .= "WHERE tblCat.idclient = '" . Contenido_Security::escapeDB($client, $oDB) . "' AND tblCatLang.idlang = '" . Contenido_Security::escapeDB($lang, $oDB) . "' AND "; + $sSQL .= "tblCatLang.idcat = tblCat.idcat AND tblCatTree.idcat = tblCat.idcat "; - if ($iMaxLevel > 0) { - $sSQL .= "AND tblCatTree.level < '".Contenido_Security::escapeDB($iMaxLevel, $oDB)."' "; - } - $sSQL .= "ORDER BY tblCatTree.idtree"; + if ($iMaxLevel > 0) { + $sSQL .= "AND tblCatTree.level < '" . Contenido_Security::escapeDB($iMaxLevel, $oDB) . "' "; + } + $sSQL .= "ORDER BY tblCatTree.idtree"; - $oDB->query($sSQL); + $oDB->query($sSQL); - $iCount = $oDB->num_rows(); - if ($iCount == 0) { - return false; - } else { - $iCounter = count($this->_options); - while ($oDB->next_record()) - { - $sSpaces = ""; - $sStyle = ""; - $iID = $oDB->f("idcat"); + $iCount = $oDB->num_rows(); + if ($iCount == 0) { + return false; + } else { + $iCounter = count($this->_options); + while ($oDB->next_record()) { + $sSpaces = ""; + $sStyle = ""; + $iID = $oDB->f("idcat"); - for ($i = 0; $i < $oDB->f("level"); $i++) { - $sSpaces .= "   "; - } + for ($i = 0; $i < $oDB->f("level"); $i++) { + $sSpaces .= "   "; + } - // Generate new option element - if (($bCatVisible && $oDB->f("visible") == 0) || - ($bCatPublic && $oDB->f("public") == 0)) { - // If category has to be visible or public and it isn't, don't add value - $sValue = ""; - } else if ($bWithArt) { - // If article will be added, set negative idcat as value - $sValue = "-".$iID; - } else { - // Show only categories - and everything is fine... - $sValue = $iID; - } - $oOption = new cHTMLOptionElement($sSpaces."> ".urldecode($oDB->f("name")), $sValue); + // Generate new option element + if (($bCatVisible && $oDB->f("visible") == 0) || ($bCatPublic && $oDB->f("public") == 0)) { + // If category has to be visible or public and it isn't, don't add value + $sValue = ""; + } else if ($bWithArt) { + // If article will be added, set negative idcat as value + $sValue = "-" . $iID; + } else { + // Show only categories - and everything is fine... + $sValue = $iID; + } + $oOption = new cHTMLOptionElement($sSpaces . "> " . urldecode($oDB->f("name")), $sValue); - // Coloring option element, restricted shows grey color - $oOption->setStyle("background-color: #EFEFEF"); - if ($bColored && ($oDB->f("visible") == 0 || $oDB->f("public") == 0)) { - $oOption->setStyle("color: #666666;"); - } + // Coloring option element, restricted shows grey color + $oOption->setStyle("background-color: #EFEFEF"); + if ($bColored && ($oDB->f("visible") == 0 || $oDB->f("public") == 0)) { + $oOption->setStyle("color: #666666;"); + } - // Add option element to the list - $this->addOptionElement($iCounter, $oOption); + // Add option element to the list + $this->addOptionElement($iCounter, $oOption); - if ($bWithArt) { - $iArticles = $this->addArticles($iID, $bColored, $bArtOnline, $sSpaces); - $iCount += $iArticles; - } - $iCounter = count($this->_options); - } - } - return $iCount; - } + if ($bWithArt) { + $iArticles = $this->addArticles($iID, $bColored, $bArtOnline, $sSpaces); + $iCount += $iArticles; + } + $iCounter = count($this->_options); + } + } + return $iCount; + } - /** - * Function addTypesFromArt. Adds types and type ids which are available for the specified article - * - * @param int $iIDCatArt Article id - * @param string $sTypeRange Komma separated list of Contenido type ids which may be in the resulting list (e.g. '1','17','28') - * - * @return int Number of items added - **/ - function addTypesFromArt ($iIDCatArt, $sTypeRange = "") - { - global $cfg, $lang; + /** + * Function addTypesFromArt. Adds types and type ids which are available for the specified article + * + * @param int $iIDCatArt Article id + * @param string $sTypeRange Komma separated list of Contenido type ids which may be in the resulting list (e.g. '1','17','28') + * + * @return int Number of items added + * */ + function addTypesFromArt($iIDCatArt, $sTypeRange = "") { + global $cfg, $lang; - $oDB = new DB_ConLite; + $oDB = new DB_Contenido; - if (is_numeric($iIDCatArt) && $iIDCatArt > 0) - { - $sSQL = "SELECT tblContent.typeid AS typeid, tblContent.idtype AS idtype, tblType.type AS type, tblType.description AS description, "; - $sSQL .= "tblContent.value AS value "; - $sSQL .= "FROM ".$cfg["tab"]["content"]." AS tblContent, ".$cfg["tab"]["art_lang"]." AS tblArtLang, "; - $sSQL .= $cfg["tab"]["cat_art"]." AS tblCatArt, ".$cfg["tab"]["type"]." AS tblType "; - $sSQL .= "WHERE tblContent.idtype = tblType.idtype AND tblContent.idartlang = tblArtLang.idartlang AND "; - $sSQL .= "tblArtLang.idart = tblCatArt.idart AND tblArtLang.idlang = '". Contenido_Security::escapeDB($lang, $oDB)."' AND tblCatArt.idcatart = '". Contenido_Security::toInteger($iIDCatArt)."' "; + if (is_numeric($iIDCatArt) && $iIDCatArt > 0) { + $sSQL = "SELECT tblContent.typeid AS typeid, tblContent.idtype AS idtype, tblType.type AS type, tblType.description AS description, "; + $sSQL .= "tblContent.value AS value "; + $sSQL .= "FROM " . $cfg["tab"]["content"] . " AS tblContent, " . $cfg["tab"]["art_lang"] . " AS tblArtLang, "; + $sSQL .= $cfg["tab"]["cat_art"] . " AS tblCatArt, " . $cfg["tab"]["type"] . " AS tblType "; + $sSQL .= "WHERE tblContent.idtype = tblType.idtype AND tblContent.idartlang = tblArtLang.idartlang AND "; + $sSQL .= "tblArtLang.idart = tblCatArt.idart AND tblArtLang.idlang = '" . Contenido_Security::escapeDB($lang, $oDB) . "' AND tblCatArt.idcatart = '" . Contenido_Security::toInteger($iIDCatArt) . "' "; - if ($sTypeRange != "") { - $sSQL .= "AND tblContent.idtype IN (". Contenido_Security::escapeDB($sTypeRange, $oDB).") "; - } + if ($sTypeRange != "") { + $sSQL .= "AND tblContent.idtype IN (" . Contenido_Security::escapeDB($sTypeRange, $oDB) . ") "; + } - $sql .= "ORDER BY tblContent.idtype, tblContent.typeid"; + $sql .= "ORDER BY tblContent.idtype, tblContent.typeid"; - $oDB->query($sSQL); + $oDB->query($sSQL); - $iCount = $oDB->num_rows(); - if ($iCount == 0) { - return false; - } else { - while ($oDB->next_record()) - { - $sTypeIdentifier = "tblData.idtype = '".$oDB->f('idtype')."' AND tblData.typeid = '".$oDB->f('typeid')."'"; + $iCount = $oDB->num_rows(); + if ($iCount == 0) { + return false; + } else { + while ($oDB->next_record()) { + $sTypeIdentifier = "tblData.idtype = '" . $oDB->f('idtype') . "' AND tblData.typeid = '" . $oDB->f('typeid') . "'"; - // Generate new option element - $oOption = new cHTMLOptionElement($oDB->f('type')."[".$oDB->f('typeid')."]: ".substr(strip_tags(urldecode($oDB->f("value"))), 0, 50), $sTypeIdentifier); + // Generate new option element + $oOption = new cHTMLOptionElement($oDB->f('type') . "[" . $oDB->f('typeid') . "]: " . substr(strip_tags(urldecode($oDB->f("value"))), 0, 50), $sTypeIdentifier); - // Add option element to the list - $this->addOptionElement($sTypeIdentifier, $oOption); - } - return $iCount; - } - } else { - return false; - } - } + // Add option element to the list + $this->addOptionElement($sTypeIdentifier, $oOption); + } + return $iCount; + } + } else { + return false; + } + } + + /** + * Selects specified elements as selected + * + * @param array $aElements Array with "values" of the cHTMLOptionElement to set + * + * @return none + */ + function setSelected($aElements) { + if (is_array($this->_options) && is_array($aElements)) { + foreach ($this->_options as $sKey => $oOption) { + if (in_array($oOption->getAttribute("value"), $aElements)) { + $oOption->setSelected(true); + $this->_options[$sKey] = $oOption; + } else { + $oOption->setSelected(false); + $this->_options[$sKey] = $oOption; + } + } + } + } - /** - * Selects specified elements as selected - * - * @param array $aElements Array with "values" of the cHTMLOptionElement to set - * - * @return none - */ - function setSelected($aElements) - { - if (is_array($this->_options) && is_array($aElements)) - { - foreach ($this->_options as $sKey => $oOption) - { - if (in_array($oOption->getAttribute("value"), $aElements)) - { - $oOption->setSelected(true); - $this->_options[$sKey] = $oOption; - } else { - $oOption->setSelected(false); - $this->_options[$sKey] = $oOption; - } - } - } - } } -class UI_Config_Table -{ - var $_sTplCellCode; - var $_sTplTableFile; - - var $_sWidth; - var $_sBorder; - var $_sBorderColor; - var $_bSolidBorder; - var $_sPadding; - var $_aCells; - var $_aCellAlignment; - var $_aCellVAlignment; - var $_aCellColSpan; - var $_aCellClass; - var $_aRowBgColor; - var $_aRowExtra; - var $_bAddMultiSelJS; - - var $_sColorLight; - var $_sColorDark; +class UI_Config_Table { - function UI_Config_Table() - { - global $cfg; + var $_sTplCellCode; + var $_sTplTableFile; + var $_sWidth; + var $_sBorder; + var $_sBorderColor; + var $_bSolidBorder; + var $_sPadding; + var $_aCells; + var $_aCellAlignment; + var $_aCellVAlignment; + var $_aCellColSpan; + var $_aCellClass; + var $_aRowBgColor; + var $_aRowExtra; + var $_bAddMultiSelJS; + var $_sColorLight; + var $_sColorDark; - $this->_sPadding = 2; - $this->_sBorder = 0; - $this->_sBorderColor = $cfg['color']['table_border']; - $this->_sTplCellCode = ' {CONTENT}'."\n"; - $this->_sTplTableFile = $cfg['path']['contenido'].$cfg['path']['templates'].$cfg['templates']['generic_list']; - $this->_sColorLight = $cfg['color']['table_light']; - $this->_sColorDark = $cfg['color']['table_dark']; - } + function __construct() { + global $cfg; - function setCellTemplate($sCode) - { - $this->_sTplCellCode = $sCode; - } + $this->_sPadding = 2; + $this->_sBorder = 0; + $this->_sBorderColor = $cfg['color']['table_border']; + $this->_sTplCellCode = ' {CONTENT}' . "\n"; + $this->_sTplTableFile = $cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['generic_list']; + $this->_sColorLight = $cfg['color']['table_light']; + $this->_sColorDark = $cfg['color']['table_dark']; + } + function setCellTemplate($sCode) { + $this->_sTplCellCode = $sCode; + } - function setTableTemplateFile($sPath) - { - $this->_sTplTableFile = $sPath; - } - - function setLightColor($sColor) - { - $this->_sColorLight = $sColor; - } - - function setDarkColor($sColor) - { - $this->_sColorDark = $sColor; - } + function setTableTemplateFile($sPath) { + $this->_sTplTableFile = $sPath; + } - function setAddMultiSelJS($bEnabled = true) - { - $this->_bAddMultiSelJS = (bool)$bEnabled; - } + function setLightColor($sColor) { + $this->_sColorLight = $sColor; + } - function setWidth ($sWidth) - { - $this->_sWidth = $sWidth; - } - - function setPadding ($sPadding) - { - $this->_sPadding = $sPadding; - } + function setDarkColor($sColor) { + $this->_sColorDark = $sColor; + } - function setBorder ($sBorder) - { - $this->_sBorder = $sBorder; - } + function setAddMultiSelJS($bEnabled = true) { + $this->_bAddMultiSelJS = (bool) $bEnabled; + } - function setBorderColor ($sBorderColor) - { - $this->_sBorderColor = $sBorderColor; - } - - function setSolidBorder ($bSolidBorder = true) - { - $this->_bSolidBorder = (bool)$bSolidBorder; - } + function setWidth($sWidth) { + $this->_sWidth = $sWidth; + } - function setCell ($sRow, $sCell, $sContent) - { - $this->_aCells[$sRow][$sCell] = $sContent; - $this->_aCellAlignment[$sRow][$sCell] = ""; - } + function setPadding($sPadding) { + $this->_sPadding = $sPadding; + } - function setCellAlignment ($sRow, $sCell, $sAlignment) - { - $this->_aCellAlignment[$sRow][$sCell] = $sAlignment; - } + function setBorder($sBorder) { + $this->_sBorder = $sBorder; + } - function setCellVAlignment ($sRow, $sCell, $sAlignment) - { - $this->_aCellVAlignment[$sRow][$sCell] = $sAlignment; - } + function setBorderColor($sBorderColor) { + $this->_sBorderColor = $sBorderColor; + } - function setCellColspan ($sRow, $sCell, $iColSpan) - { - $this->_aCellColSpan[$sRow][$sCell] = $iColSpan; - } + function setSolidBorder($bSolidBorder = true) { + $this->_bSolidBorder = (bool) $bSolidBorder; + } - function setCellClass ($sRow, $sCell, $sClass) - { - $this->_aCellClass[$sRow][$sCell] = $sClass; - } + function setCell($sRow, $sCell, $sContent) { + $this->_aCells[$sRow][$sCell] = $sContent; + $this->_aCellAlignment[$sRow][$sCell] = ""; + } - function setRowBgColor ($sRow, $sColor) - { - $this->_aRowBgColor[$sRow] = $sColor; - } - - function setRowExtra ($sRow, $sExtra) - { - $this->_aRowExtra[$sRow] = $sExtra; - } + function setCellAlignment($sRow, $sCell, $sAlignment) { + $this->_aCellAlignment[$sRow][$sCell] = $sAlignment; + } - function _addMultiSelJS() - { - // Trick: To save multiple selections in -Element, add some JS which saves the + // selection, comma separated in a hidden input field on change. + // Try ... catch prevents error messages, if function is added more than once + // if (!fncUpdateSel) in JS has not worked... - if ($this->_bSolidBorder) - { - if ($iCount < count($aCells)) - { - if ($iColCount < count($this->_aCells)) { - $sTplCell = str_replace('{EXTRA}', 'border: 0px; border-right: 1px; border-bottom: 1px; border-color: '.$this->_sBorderColor.'; border-style: solid;', $sTplCell); - } else { - $sTplCell = str_replace('{EXTRA}', 'border: 0px; border-right: 1px; border-color: '.$this->_sBorderColor.'; border-style: solid;', $sTplCell); - } - } else if ($iColCount < count($this->_aCells)) { - $sTplCell = str_replace('{EXTRA}', 'border: 0px; border-bottom: 1px; border-color: '.$this->_sBorderColor.'; border-style: solid;', $sTplCell); - } else { - $sTplCell = str_replace('{EXTRA}', '', $sTplCell); - } - } - - if ($this->_aCellAlignment[$sRow][$sCell] != "") { - $sTplCell = str_replace('{ALIGN}', $this->_aCellAlignment[$sRow][$sCell], $sTplCell); - } else { - $sTplCell = str_replace('{ALIGN}', 'left', $sTplCell); - } - - if ($this->_aCellVAlignment[$sRow][$sCell] != "") { - $sTplCell = str_replace('{VALIGN}', $this->_aCellVAlignment[$sRow][$sCell], $sTplCell); - } else { - $sTplCell = str_replace('{VALIGN}', 'top', $sTplCell); - } + $sSkript = ' ' . "\n"; - if ($this->_aCellColSpan[$sRow][$sCell] != "") { - $sTplCell = str_replace('{COLSPAN}', $this->_aCellColSpan[$sRow][$sCell], $sTplCell); - } else { - $sTplCell = str_replace('{COLSPAN}', '1', $sTplCell); - } + return $sSkript; + } - if ($this->_aCellClass[$sRow][$sCell] != "") { - $sTplCell = str_replace('{CLASS}', $this->_aCellClass[$sRow][$sCell], $sTplCell); - } else { - $sTplCell = str_replace('{CLASS}', 'text', $sTplCell); - } + function render($bPrint = false) { + $oTable = new Template; + $oTable->reset(); - // Multi selection javascript - if ($this->_bAddMultiSelJS) { - $sData = $this->_addMultiSelJS() . $sData; - $this->_bAddMultiSelJS = false; - } + $oTable->set('s', 'CELLPADDING', $this->_sPadding); + $oTable->set('s', 'BORDER', $this->_sBorder); + $oTable->set('s', 'BORDERCOLOR', $this->_sBorderColor); + + $iColCount = 0; + $bDark = false; + $sBgColor = ""; + $bMultiSelJSAdded = false; + if (is_array($this->_aCells)) { + foreach ($this->_aCells as $sRow => $aCells) { + $iColCount++; + //$bDark = !$bDark; + $sLine = ""; + $iCount = 0; + + foreach ($aCells as $sCell => $sData) { + $iCount++; + $sTplCell = $this->_sTplCellCode; + + if ($this->_bSolidBorder) { + if ($iCount < count($aCells)) { + if ($iColCount < count($this->_aCells)) { + $sTplCell = str_replace('{EXTRA}', 'border: 0px; border-right: 1px; border-bottom: 1px; border-color: ' . $this->_sBorderColor . '; border-style: solid;', $sTplCell); + } else { + $sTplCell = str_replace('{EXTRA}', 'border: 0px; border-right: 1px; border-color: ' . $this->_sBorderColor . '; border-style: solid;', $sTplCell); + } + } else if ($iColCount < count($this->_aCells)) { + $sTplCell = str_replace('{EXTRA}', 'border: 0px; border-bottom: 1px; border-color: ' . $this->_sBorderColor . '; border-style: solid;', $sTplCell); + } else { + $sTplCell = str_replace('{EXTRA}', '', $sTplCell); + } + } + + if ($this->_aCellAlignment[$sRow][$sCell] != "") { + $sTplCell = str_replace('{ALIGN}', $this->_aCellAlignment[$sRow][$sCell], $sTplCell); + } else { + $sTplCell = str_replace('{ALIGN}', 'left', $sTplCell); + } + + if ($this->_aCellVAlignment[$sRow][$sCell] != "") { + $sTplCell = str_replace('{VALIGN}', $this->_aCellVAlignment[$sRow][$sCell], $sTplCell); + } else { + $sTplCell = str_replace('{VALIGN}', 'top', $sTplCell); + } + + if ($this->_aCellColSpan[$sRow][$sCell] != "") { + $sTplCell = str_replace('{COLSPAN}', $this->_aCellColSpan[$sRow][$sCell], $sTplCell); + } else { + $sTplCell = str_replace('{COLSPAN}', '1', $sTplCell); + } + + if ($this->_aCellClass[$sRow][$sCell] != "") { + $sTplCell = str_replace('{CLASS}', $this->_aCellClass[$sRow][$sCell], $sTplCell); + } else { + $sTplCell = str_replace('{CLASS}', 'text', $sTplCell); + } + + // Multi selection javascript + if ($this->_bAddMultiSelJS) { + $sData = $this->_addMultiSelJS() . $sData; + $this->_bAddMultiSelJS = false; + } + + $sTplCell = str_replace('{CONTENT}', $sData, $sTplCell); + $sLine .= $sTplCell; + } + + // Row + $oTable->set('d', 'ROWS', $sLine); + + if ($this->_aRowBgColor[$sRow] != "") { + $sBgColor = $this->_aRowBgColor[$sRow]; + } else if ($sBgColor == $this->_sColorLight) { + $sBgColor = $this->_sColorDark; + } else { + $sBgColor = $this->_sColorLight; + } + $oTable->set('d', 'BGCOLOR', $sBgColor); + + if ($this->_aRowExtra[$sRow] != "") { + $oTable->set('d', 'EXTRA', $this->_aRowExtra[$sRow]); + } else { + $oTable->set('d', 'EXTRA', ''); + } + + $oTable->next(); + } + } + + if ($this->_sWidth) { + // Table: Width + $oTable->set('s', 'EXTRA', 'width: ' . $this->_sWidth . ';'); + } else { + $oTable->set('s', 'EXTRA', ''); + } + $sRendered = $oTable->generate($this->_sTplTableFile, true, false); + + if ($bPrint == true) { + echo $sRendered; + } else { + return $sRendered; + } + } - $sTplCell = str_replace('{CONTENT}', $sData, $sTplCell); - $sLine .= $sTplCell; - } - - // Row - $oTable->set('d', 'ROWS', $sLine); - - if ($this->_aRowBgColor[$sRow] != "") { - $sBgColor = $this->_aRowBgColor[$sRow]; - } else if ($sBgColor == $this->_sColorLight) { - $sBgColor = $this->_sColorDark; - } else { - $sBgColor = $this->_sColorLight; - } - $oTable->set('d', 'BGCOLOR', $sBgColor); - - if ($this->_aRowExtra[$sRow] != "") { - $oTable->set('d', 'EXTRA', $this->_aRowExtra[$sRow]); - } else { - $oTable->set('d', 'EXTRA', ''); - } - - $oTable->next(); - } - } - - if ($this->_sWidth) { - // Table: Width - $oTable->set('s', 'EXTRA', 'width: '.$this->_sWidth.';'); - } else { - $oTable->set('s', 'EXTRA', ''); - } - $sRendered = $oTable->generate($this->_sTplTableFile, true, false); - - if ($bPrint == true) { - echo $sRendered; - } else { - return $sRendered; - } - } } + ?> \ No newline at end of file diff --git a/nbproject/project.properties b/nbproject/project.properties index 43d66d2..efdf308 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,6 +1,6 @@ auxiliary.org-netbeans-modules-php-smarty.smarty-framework=true include.path=${php.global.include.path} -php.version=PHP_80 +php.version=PHP_81 source.encoding=UTF-8 src.dir=. tags.asp=false From ad3edca025c9e1cbc5b75449d44ab4f45d95a344 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Mon, 23 May 2022 19:07:57 +0200 Subject: [PATCH 25/25] fixed #29 --- .../external/frontend/data/config/.gitignore | 2 + .../frontend/data/config/production/.keep | 1 + .../data/config/production/config.php | 52 ++ conlite/external/frontend/environment.php | 19 + conlite/external/frontend/favicon.ico | Bin 0 -> 29038 bytes .../Modules/Contenido_NavMain_Util.class.php | 85 +++ .../Modules/Contenido_Sitemap_Util.class.php | 66 +++ .../frontend/includes/functions.include.php | 40 ++ .../includes/functions.navigation.php | 521 ++++++++++++++++++ .../external/frontend/includes/rss.inc.php | 59 ++ .../external/frontend/includes/rss_php.php | 160 ++++++ conlite/external/frontend/logs/deprecated.txt | 2 + 12 files changed, 1007 insertions(+) create mode 100644 conlite/external/frontend/data/config/.gitignore create mode 100644 conlite/external/frontend/data/config/production/.keep create mode 100644 conlite/external/frontend/data/config/production/config.php create mode 100644 conlite/external/frontend/environment.php create mode 100644 conlite/external/frontend/favicon.ico create mode 100644 conlite/external/frontend/includes/Util/Modules/Contenido_NavMain_Util.class.php create mode 100644 conlite/external/frontend/includes/Util/Modules/Contenido_Sitemap_Util.class.php create mode 100644 conlite/external/frontend/includes/functions.include.php create mode 100644 conlite/external/frontend/includes/functions.navigation.php create mode 100644 conlite/external/frontend/includes/rss.inc.php create mode 100644 conlite/external/frontend/includes/rss_php.php create mode 100644 conlite/external/frontend/logs/deprecated.txt diff --git a/conlite/external/frontend/data/config/.gitignore b/conlite/external/frontend/data/config/.gitignore new file mode 100644 index 0000000..5493b99 --- /dev/null +++ b/conlite/external/frontend/data/config/.gitignore @@ -0,0 +1,2 @@ +/local +/localhost diff --git a/conlite/external/frontend/data/config/production/.keep b/conlite/external/frontend/data/config/production/.keep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/conlite/external/frontend/data/config/production/.keep @@ -0,0 +1 @@ + diff --git a/conlite/external/frontend/data/config/production/config.php b/conlite/external/frontend/data/config/production/config.php new file mode 100644 index 0000000..f987795 --- /dev/null +++ b/conlite/external/frontend/data/config/production/config.php @@ -0,0 +1,52 @@ + + * @license http://www.contenido.org/license/LIZENZ.txt + * @link http://www.4fb.de + * @link http://www.contenido.org + * + * + * + * {@internal + * created unknown + * modified 2008-07-03, bilal arslan, added security fix + * + * $Id$: + * }} + * + */ + +if(!defined('CON_FRAMEWORK')) { + die('Illegal call'); +} + + +// Relative path to contenido directory, for all inclusions, in most cases: "../contenido/" +$contenido_path = "../conlite/"; + +// If language isn't specified, set this client and language (ID) +$load_lang = "1"; +$load_client = "1"; + +/* Various debugging options */ +$frontend_debug["container_display"] = false; +$frontend_debug["module_display"] = false; +$frontend_debug["module_timing"] = false; +$frontend_debug["module_timing_summary"]= false; + +/* Set to 1 to brute-force module regeneration */ +$force = 0; +?> diff --git a/conlite/external/frontend/environment.php b/conlite/external/frontend/environment.php new file mode 100644 index 0000000..180842c --- /dev/null +++ b/conlite/external/frontend/environment.php @@ -0,0 +1,19 @@ +D8og^o^?%pY{;wD`d67&ORQ|i`h4$+X|q2RX=p~& znBX$Ut#8Tpm1^P&?$^#Z{Or9b-VUlZkrGqOCS2Y>dAKChEptJ4UY)X1sDf1f3keh^ z%5m>=D$G+5qYNkKJ$*M)Hw}@JGKVsDH6u1}_0SaO4$viNS2Pk)yLg|!!~e}%)T=aX zjZ%;hgJs^1tjjVyB_WF#Uf3I!y|@nyA}SK&;Gn@r*>YgaQu#Vjjx=Ji`>~?AigwTy zk!E98mPCakZ}OMSaPDq~vowC-#8HAgOA# zIL}j!Ez)GTc0IRii$s!2)Gp)cU*L1Mcwf=RDH;TnwT7>F%cMHLpS`HpLC;}@z7vZ4 zCgcCv-J4Vxs9v;E^fN*aqft}uMb&(;_sJ(o^k2+czRNq6YrrBUv0g-jAaZ!^=u_eD z=i`E}WygPi=HxF|EAU?wqCKKPKr|N``Jl`vZpWX?D_*4BtWCN3l9zCOe{A;RUQ#Av zoHq;p?sFedksP31qwc$h?$wIgH6y*#o*cTXWsEqv%}r_z(I6tLgR4hgObXMjR_8bS z?&#$6ZdA47;b)pT@15MAKDV>TL6sP_pCf+uYPm`?lVVrS^BvcH<=|GnW4mp48GR~k z@8kdcu9gg!diXSpu9=hnTr*2)xTjbtd_+RYDtE<~(k$l>X9wC3^d4#HJEHZ*uUq<$ zY_VyS*{0F01IAizap-+Ac~|At3)1uy*U^5!XXYU-_Q_hx&b_>0Ss$sG^x*dXRYWJspY{%2I~(+5?rrHRk&3K01qB2q#;$F0|u z^cX&IX-0zol&(I*ng@<7hly?NBsHlfo# z$_@1qwahMjuB*!WWjxKit@3;oc+ccH@T^q$Ea@xC409dhJ-qd%k+2ME$1HqeD_A3H zN}K3uZ9pT=-aOu+?cSM|369o#9j$jxHBVVHL(Cgep>w?WVDICw3opc!h-A#~rj<{s zOZ!7>Ch{pu(&D!`^x5#WY0#LKA>(<=w2GS2I%Zm%SbOt5Gc5Mbv`BX9km1@p$K5W+ zeQ@gB?veH%o!b}BXWw<@h3QW1GmRE8HLgV}kC@aT(uzx;*ZJ(OAYNed1`q%7A8s1e z5-m1#0;&mQsE%UoE#e(45*^#7x_q$Deel86lM2>57RhEGT01q~`IEBLNIpCM_DRv& zglY`Yq%%~SG{-?PNJ*aUn+n79Wia6!}cfdsa_AYGx5BVKq^*T`}{_4)WeI^^+}QTjCi9pWV|f z_BdE1IknGP)c=s@lp^1`#haIbO!>}D7xrwwloWX>Ir5-v&W)qFBA*_ZNNBT919|m; zbd~zbaUUR30vSF|teoF3kWJ+Up3BRMT=*5*5BQ*aL1p2A!Yb^5$EZRd=i`A(P)%o| z{6Xe&%Fb(O4c#)9t1o-=B&QDOX9~QXjt4F+ z4O@RUI_P3T1fIw1If)gC5l6OrUq7l`pY}=7URkKY&r_d7T~f@!c>X_MEmzhNx3H32 zS{+(5N-XB3qTDUhdZ7P7H;8^X+ihT>j|-Y{S%mMo-COyZsz{I*1+OVhQ1(14PyG2- zgwC1j@cmCO{qjmw!AJ5|jh0rHG@d&9gEKMSV)~n>j)gc52%BsfJG#{{-^ogV~+Sc91nCuhjTMG?dE~x zZ*Sl0m-b{}))UKE8nUH&wZ^+8s`Sa4WcWK}k*oMx<5&q^FNujjPq3kN`rMDQ7x#pB z1^#=)rvNaVgI2G?apdl!-J>MoV?+u-||2n!E>1cdB$U z)aP&`se!!ODy}B_ipuDqNkH??-D3xf{HCd`^S9ZR_NasromWZiBNBc()U z!Gqs9;c*xy(tqjm^OcIy9V@u0HLq9EY*bl^WRz*r=5)>u@>rH}-AqEMab)%2tS52T z{vsK%1f^k~ht`fxb?K-|L*yp%5${lh+WF??9+@{yqp9(h7rZDMxPV_;~G5j#c`&x;H zlV~C_Lc}r`_9~NmJ@{5-1gWR4H%j)?rIO3Z^5dJ`a@=h=K1#Es&F)y_>rx)=f4}6= zwf)K={*C1So48I3u-u1Xlwq+ATa4>k#_%Xp~C~4Op(c zj3GiA_>2&et&9;;VQnZZh9M|~{ZL|teT`%ks@a?NDXjrp;Q#eLW#x%NY?Hu^elmE) z+33yJvi96RQ2^4qK6!Uvg;%`XSoXs2^ouR$Ug}DA_h=p#s96j9@x2oFSDdL>Wz6q| zZ`JayDS7e19)3TApSN*;)eVq%0eV?T1!h;vOu6!GTKHPU2fV*+_@68XFqg)Uxx z#olmft{qtTkw8&CKM|ojrqN3N7xsioh4Y*R=8A$q?}hkKsc^)<$`pMTq6$7z!|YJ- zuRK}Eapvv78-(nD|4@h0*nUuk|7z9Tq8nXQq0(k5PZnub;+aT4UPxMim)BQq z;H-y}2u?jL^6@ul!bfMaQba9=3ZIK8zdHGba$0{jdXrd>yxFrBe8K14zdc~xm(90~ zf#^Ie$02sC&qT+B$1N-@{(^#{w3YY+IeTdh&@l+IcGd z@in8^z~-$~LzluQV}1{jKNP_u{PPvsXbGP;0mcD&xb@*L2J_4Xee>7Z9}jdd4fQ&= zE9k_Q6~!^ZNLlgA>$j9uOez{k)pOEDaiChMfag2G&lW+ZCNE z9^ul^b?0^m<3TRjzV2dP22$qVeODjo{mlPztLnoICYW(Lppz$cL8@{@ndb zhaL5EJ+xT`ETST3eOicPTop<6M~iy z2b-uVt*~d1?`03O!?OubVnsqk!B#JxL)xuZLgVBsm->p$XO-{w8?Nmrv=G=+Z5B_0$62`3Jn`9gp5Be%moleb{;n-KpxQc=J*)7lm`Bu*_XC zR+_3jE9q3i&Z~v=Xo#PF3WuY}oI2-;2b9JUQ>Hq%7mXt*vdUgG=$rg(F^x0=XQjn1 z4CRo_3l~)2`PKF*kMid%!;e#nvhcRT?g$#>ox=SOP8Hp|`=d|Ui*7WOtBMsa-H-mM zO+4K@r&9hXcOG`M<5w-A8UrzQXKOJ5-@41$A_KKl_#p6;vqNl3*+T(lXic zo$RHM zKdc~4X&j+;U^Hu}$nh8(ka>$CmsX8Ou}+)o(OD#ONptxCiuhU<3zfnxu#;ys%vmuZ zvG_qzrMj0{k4(+4(2v2hoW0mKWB%v-e+<^gHo0BPhqb&3gK4g4>zQ?N%>D09JN0J}uk8G6~Fc2rE~cDPFMS&mZ$m|X3dVU{t!=k8e_ z;O3-U#nxub6`HMOy7odz)8~AQc*x8lJEkCU>#T+SVb3Fe&ba9-oWAluO%6EB;vgUW zHsX6$I7d%ykv6B>QNM*36XYjC>7eesB225O7Y*hXarx^U_-FiLaumJ|o!k*m3br{f zr$nAjr}{D%j+!01M~|d1ZepkQqX*?BxRbwqFlPirti*QHxm}aa&`aG!DZo!!CfkwWi#!b_sz7c z?4D^??38KeTbXIsaCW9$;|`g2ChsfJ81aTf@V#NCoy-VnjWg{Y*<{+Oo?Et-ivBnL zuLb_kEr8CV5zriH3(%ru0)WMv^A^t=W128j1P zpcc@_Pv3Vhkv9kErox>r__h*;@b`M~t`~pkc?WO?&HzsVecbBv-9gBp(OUB(uigpX zH0BH3>J#d;KlC&J;6Swe4R{6Aho8PQM|st3n>?-?IT~ zcTs>0z#C|FeE2?|ygK#aOw-WwK%oM*f^_Km7&r{PNt>rB>3}ZkCq01rws|Te^@aTb;#$8sfqFsY)g8g(G*FlA ze?giLfd=X#=o>jzxSfRlhWzS4V7 zkcQ@!W+aI03fO>KBDntUJ*+wFH^P+NG^zy)M>vbu0Jw1D*QV^+q0P#d4Ki7Pa;naG zNRYhxU_JO3QBrLm@S*39+Juy=w)iom=}I!dy8+tEu;qhH%CTd@@g~kV6VGBlhQ%p; z78@um+yPt|GR_QXTKwi=W3n81jZ}EZt9OGxolMnN2Y2zk)^>=~O-lf_4*Un-F9n2l z(*gFpvi_^)Y{1ACEH;x^I3!rS=fL7bKZ~6o7B3jE*hgWp9l^p=!QDgM{7m(r!auyq z6Gt?01gDDCgP-x8)-e#Avg_bZWjhIU7xbbXM50ab+{d)!Y>u57Rz9f}$D24~kA}q? z2`u(f*ti)MEVi1cJg@P#z{SP=o040F|Abdf0k>cDaHn!T0>rUO$Vwr2-K>NEYkVIC zaD5ka_wukc`IXu=PM)*WHmIGD&GG62&s)J6=k(b`M=KWl5p3%0kJ%)rjw~EO)m~pV zlcAsD`Y!Nl4}1&gv;R|kA0Xu|#OvTrw*M7aETnfE&~$^>m(8CAj%vx`H3ydLj$I#- zJK39fCphAHa_+=tF6_r*Z-T`x4hz>ln>4#S>aAq~__q>dg4+S$m7X%x;=6rfdP$@n z{O=>pL?O%4LB=VvVWuxR+v8cqn><{b!9FL~R`8+*Y;FmAf5_q}H+yi+6c(OL_L%=7 z7LH_GPi4a&@J4iEH$hdrv@o8#1ThZ5G`Kwz8ocMgwRyaG!S0>emQ8W_fW^KFxKC&C`UP7Yw4B8@B8x3>_H0ZL zTPl~a39fekB>(SW{~3a<&~9Tljxc>e{U!FXx&9IFV4=;U-OOsoW-lJZwROBy1MbV% zQ=#ivxK&vkPhl$(@vBk<_8`9*P+w9XL}B5 z#*f9}RR-W)0KC@2pPuc50taabZq&EeHGZWaO*6{3s9)0-nB&~Wn|Yl5i9dGw*`!%k zcwX&TICi<`v?OE=?C#H=-xI=d$7{0ewah(iet_GCEPOjAn66ip5qxds^!2CLE{!)#9@=2KV)-Pj%Beg!jkQ&-BiSfu~*V|fqy)EK0cI9UOJ{6eV4S~ zB-@N*1pe*x-hLwAv8EYJ{hFa!62#vNALHH*fariSJ^@eWpO zwwo=B*Yent+g5Y@sompn7F!&$mff>paGBhpyN$>pys9ZU`2ha`^x2-iI|pdazab2B z%4PuhF}2M(rT1vfRRVMc3}_CDXW0Vl6j!`dcOI`qy^M8upG|k|!yfdU%;tN~V)w6} z!X_*j{6p~MkAj27x9^Sv8vObxys9DiOayKN`kq^%Tua4rt3_Z>Lxo*y5Y|-()K{GY z|4vi}5`{7}LSJIK+RkJc<`q7EBU{6|@~-#DW6J8OqF7v?*S zzf{D65KumcDiXC^(ApKR!+;AtufGEV zKYbyU&lk|T?iI9vGu6QafX1r&@TW5T1o#7A0JMfP6y&Ldyg!`Q>EnRhdh!;^bOq@< zsmRlD0p6{EP~dT0WdK*9asPXO{8;CA&-tvteqB`5d!fJG1b^k)uzvh$ zF1G_v&aqXPYQF&IhQQYV^_4o?kq-XSvQYeG^qd~ICV1~nY!deSJ+TaR^QU=qHqZs& zpLy+cwcZ8qw}5HD@4CuRPySSf+Blbw?u?hEM7|yN`%mB_v};`!;!hW++~o-)uHF%vMC(D=(y@HPN!0h-@E1;qCB7x+^- zewgANzoSXmZ+Eqn;aA*?`n$Lbg$8HpS3d`f!`HiKe|p#6OP*#D`s+S$4hH%H+V@ib#)5!% z1E3v1d#Dir`Oe>zKg~bR@0!zfk@IR_dPbWAZ`{ZHPl`q50B_nKqdn+}0F{O2b+m_} ztvr>ue-MxX^gNjZ?*jiQ@Bc}e|IMr00_yJ(iPyD^5gm=9_l_P>Sd90jC}bEz3h|zj z5rs%&EJOGl=l&4Tdt2NZr4r}==(?E8LZJb@+Qi5ho7dcXQ;f`;OW6Pi5GhAP+@-KF z-m7XS3Gu!acWr{>f^;A6Ysu;vD)RC91v!nGM%;adX`%=lb9xPMED`!;R8lU45+9B~ z7gj84N*TF|t!AyuZa67}tuB&S_Z#wgCMO<-ec5 zW&!j~?*i5U_0NleZ9poJ3()+0Eieye9}6A_Glggv@THZOJCz2jeVB^+9Piy%9K~V13j~WLjd*~;g67GuBXIyF|8tk z{02Z9fX+$X0!Y5PPHorJ*V~HnP7@#>uW1tbB zxfbEu{8k-h$2q2|F9Ebo__^d&B&Riy0SLOJA=x+$=!8?y`)`L4V=1hS>&R@l7yjJmxbdkF9Vkm{v4wF9zuC-}ig_fYJSB)~`dKsK!T zbNCxyZWwO*EBx(+;Nb#Zd>fEg8A7)YuV177E7bL4zO@0+Sc~Bvt(8YZZ$p%CBKF=N z(muAZzeIa`w9i3+&-&R)TN4lRpK|iUtDG?Z)VA+J>lu~xK=LdLyclSKHIxSS;$9o* z?u7m2Qv8A*>EZTrX+M^!b`TQ1Xd-Yw8!vEtLOf=^@X8@?4Y2TcD z;t9~5weSmWKj>J18}{JVu&2V-v+2u5eGgml_6@I!fi7)+%nh3QHOh~@S&M$0{=p`v z@H2R?X)l(_PJ6Jab3cVIcnar}r#-at=s@=D?qD`+)s#DUK00vn!>iJ?l%Lvzy8cI! zdKb$7C-ghwegiynKJcYK$Ik(>cm)vq0Ug=>%SW(Bv2Ti>3Bz7SFncK_ioLKmyf${h z&|LU@$p_sSxCN-UKiUsiqE`M>(529;5@Ky`(R|5(rk{I%)%+&4dD;ubdyw27;)&pu z-2NNCj}p%w+rIXfpb4G${k-t1{?McC>;mogj8N0R5#_}5Pr6mw!F^m$@Eva25NBB? zp$-0s{e;)}twA<_{Y-BE?>zQ#E+$2?CnIFlQBJ)*&?hy4{5C)=pw0hI`yH)S^>cd{ z+V(kKLVp4Fz|7VRY5q3)04MA%l}1mudX=$g0JoP{`^#W*wwf0Tvs zPM;5v+QEIGC!jfAD+~g?J%D0fztj$*et`$sqbkX%-LE08Ln^v#K3@h7&mmhVr+P>> zSp_KP#p;!SYv?7vUT1{o5yGD$JP#WB1s)W>-i|%{0e%NhGzk0SPc;ryZfft2faduw zEga|;^y0^PEDix^|2zlik?K^B*GA0ick|=T=SskVo^PT2_Yf!lo8EG((|}I0Lra7- zFSty$s6#);Cv^V6TQ(c^oiGghqY^r)t@Q$Q*0;J|^=s%i1_nYuwYU3qaY%Bq`cKGw z+nBBaM@K=gHK6*Os4J-FHS{-xZd2eZz!RXe!|4(PBkqiJ?E#g!O+8iopC;q|1^5g1 zNG)6#kKn!_6f=D}$jI};p}R5Ouml=ouG<*zY%(hEZ6XnOpARVxzYBiJM#ldRPrG8c zEg;DUP`taTd~cHmgzmuqS3d>nm)06B09tM)co}Pz5fcjzezDRog3%(yDkv$Te=_e`_>mrqqlaKU1d4+?_kO9nQ6_U zEHMiCA!_nzyzMKLK}|O4*-PKyOx0;xvl3r^{b0eS&gp_PJ>%E{A18L#tZtQ9Gnqox z7=XrXp$rtCsYkw?zQg+a0j4A)-lk&UkG=^Y!n^I2EYcfFR+?CHbF2(Q`+`GRdIq_u2+ ziTr3a`Q%gZAm0Vf!AHXWwdwPF;mqa|7C+L(Ucecuw3U-`QTN21=CA5!m1(|=@rM6E z)?h&WOyD25Hyrcv#yGb+F>sXGzG%m;*LS&mad_+G&hv4;hGd%o>TQ$w#|pA3gq+3z z=3Oc_B6~f-Gv*FZ|F7)p<<;cp84fu&0jXUmPJV_iQuzuUy&(^4dsQ8fOMUdWKq}z3 zaFx#z!|+Gc$7}PUP#yaK%Kk&42y$ueMspGPFO)hUQ>9NzaBly2;=0JAm^W*iv&KWV z-gyjUI{@N21a*v$F!iq2-dD?v zj|#|j0JNX=QLhN4y{OK~e;Nhc0HnHp#C1-Bll9c8o_=CG)FJAB{WfN3cCQU8?Vd9- zyGjF@U9lm9_ws?Jj2+X+(2i+fWXBjF1R63*aQASH>6snV-N;UcP{tVBRWj`W8^~kr zNH*;knE=+nKQ#|a!F(B*4kQB?fUCd(U=9F3GUv-AUv>&`2G|XH+y~$H2Ce|C8lK~N z9G6I5B|{#(1Bdp<<22pJ_k(~MwR|L}8sL41a`-Vcedwq0y(w@X5cEDnJPa5He8}mg zKk}-f61}wVvI^*rG;0AN?<0(LgI3x$v&DEF3*S`|#@g{1Q}NDo)i6o^9|gH+uN8pM zkFUY_ISzg3pExJUl8*{_1v!iGEYLXsq5q(DA$O(^YbwRM(t>%pTtn>1B$%r28R2 zYZ6*t4*?YGdv1N5inG3LH;ruB*?&~)Py2YtX)Zu{afXG{P5EU?`&;1bj71!vume|@ zf1pl}1}z*J_ipIJYsgP|1dt6>`VZtKe+$ZC!HxNn_P}mfJn@?*+ke8?$K}6(&_d8H z4Ure;!7N;1k2})*6!%>`vAjvh_uk0M)wwjEdK~#1Ax}48A}|@~k9#`%fBOB9N(R3N aVvXMgvCXt&iUIsa2xFiHbYJcFL;f56R8$%O literal 0 HcmV?d00001 diff --git a/conlite/external/frontend/includes/Util/Modules/Contenido_NavMain_Util.class.php b/conlite/external/frontend/includes/Util/Modules/Contenido_NavMain_Util.class.php new file mode 100644 index 0000000..8ed6b08 --- /dev/null +++ b/conlite/external/frontend/includes/Util/Modules/Contenido_NavMain_Util.class.php @@ -0,0 +1,85 @@ + + * + * $Id$ + */ + +class Contenido_NavMain_Util { + /** + * Recursive Loop over all (sub)categories. + * Each level will be assigned a css class navmainStandardLevel_x + * + * @param Contenido_Category $oCategory + * @param Contenido_FrontendNavigation $oFrontendNavigation + * @param Template $oTpl + * @param string $sUrlStyle + * @param array $aCfg + * @param int $iLang + * @param array $aLevelInfo Information for marking active cat per levels + * @param array $aDepthInfo Info on level depth / where to stop. Format: array(iCurrentLoopCount, iMaxLoopCount) + * @return void + */ + public static function loopCats(Contenido_Category $oCategory, Contenido_FrontendNavigation $oFrontendNavigation, Template $oTpl, array $aCfg, $iLang, array $aLevelInfo, $iCurrentPageIdcat, array $aDepthInfo = array()) { + $aDepthInfo[0] = isset($aDepthInfo[0]) ? $aDepthInfo[0] + 1 : 1; + $aDepthInfo[1] = isset($aDepthInfo[1]) ? $aDepthInfo[1] : 1; + // display current item + $iItemLevel = $oFrontendNavigation->getLevel($oCategory->getIdCat()); + if (!isset($aLevelInfo[$oCategory->getIdCat()])) { + $aLevelInfo[$oCategory->getIdCat()] = array(); + } + $oCurrentSubcategories = $oFrontendNavigation->getSubCategories($oCategory->getIdCat()); + $aLevelInfo[$oCategory->getIdCat()]['has_children'] = $oCurrentSubcategories->count() > 0; + $aLevelInfo[$oCategory->getIdCat()]['first_child_item'] = -1; + $aLevelInfo[$oCategory->getIdCat()]['last_child_item'] = -1; + $bMarkActive = $oCategory->getIdCat() == $iCurrentPageIdcat || $oFrontendNavigation->isInPathToRoot($oCategory->getIdCat(), $iCurrentPageIdcat); + if ($oCurrentSubcategories->count() > 0) { + $aLevelInfo[$oCategory->getIdCat()]['first_child_item'] = $oCurrentSubcategories[0]->getIdCat(); + $aLevelInfo[$oCategory->getIdCat()]['last_child_item'] = $oCurrentSubcategories[$oCurrentSubcategories->count()-1]->getIdCat(); + } + // this is just for sample client - modify to your needs! + if (($aCfg['url_builder']['name'] == 'front_content') || ($aCfg['url_builder']['name'] == 'MR')) { + $aParams = array('lang' => $iLang, 'idcat' => $oCategory->getIdCat()); + } else { + $aParams = array('a' => $oCategory->getIdCat(), + 'idcat' => $oCategory->getIdCat(), // needed to build category path + 'lang' => $iLang, // needed to build category path + 'level' => 1); // needed to build category path + } + // fill template with values + $oTpl->set('d', 'name', $oCategory->getCategoryLanguage()->getName()); + $oTpl->set('d', 'css_level', $iItemLevel); + $oTpl->set('d', 'css_first_item', ($aLevelInfo[$oCategory->getIdParent()]['first_child_item'] == $oCategory->getIdCat() ? ' first' : '')); + $oTpl->set('d', 'css_last_item', ($aLevelInfo[$oCategory->getIdParent()]['last_child_item'] == $oCategory->getIdCat() ? ' last' : '')); + $oTpl->set('d', 'css_active_item', ($bMarkActive === true ? ' active' : '')); + try { + $oTpl->set('d', 'url', Contenido_Url::getInstance()->build($aParams)); + } catch (InvalidArgumentException $e) { + $oTpl->set('d', 'url', '#'); + } + $oTpl->next(); + // continue until max level depth + if ($aDepthInfo[1] > $aDepthInfo[0]) { + // check if current item has sub-items to be displayed + $bShowFollowUps = ($oCategory->getIdCat() == $iCurrentPageIdcat || $oFrontendNavigation->isInPathToRoot($oCategory->getIdCat(), $iCurrentPageIdcat)) + ? true : false; + if ($bShowFollowUps === true && $oCurrentSubcategories->count() > 0) { + $oSubCategories = $oCurrentSubcategories; + foreach ($oSubCategories as $oSubCategory) { + self::loopCats($oSubCategory, $oFrontendNavigation, $oTpl, $aCfg, $iLang, $aLevelInfo, $iCurrentPageIdcat, $aDepthInfo); + } + } + } + } +} +?> \ No newline at end of file diff --git a/conlite/external/frontend/includes/Util/Modules/Contenido_Sitemap_Util.class.php b/conlite/external/frontend/includes/Util/Modules/Contenido_Sitemap_Util.class.php new file mode 100644 index 0000000..f04de2b --- /dev/null +++ b/conlite/external/frontend/includes/Util/Modules/Contenido_Sitemap_Util.class.php @@ -0,0 +1,66 @@ + + * + * $Id$ + */ +class Contenido_Sitemap_Util { + /** + * Recursive Loop over all (sub)categories. + * Each level will be assigned a css class sitemapStandardLevel_x + * + * @param Contenido_Category $oCategory + * @param Contenido_FrontendNavigation $oFrontendNavigation + * @param Template $oTpl + * @param string $sUrlStyle + * @param array $aCfg + * @param int $iLang + * @param array $aDepthInfo Info on level depth / where to stop. Format: array(iCurrentLoopCount, iMaxLoopCount) + * @return void + */ + public static function loopCats(Contenido_Category $oCategory, Contenido_FrontendNavigation $oFrontendNavigation, Template $oTpl, $sUrlStyle, array $aCfg, $iLang, array $aDepthInfo = array()) { + $aDepthInfo[0] = isset($aDepthInfo[0]) ? $aDepthInfo[0] + 1 : 1; + $aDepthInfo[1] = isset($aDepthInfo[1]) ? $aDepthInfo[1] : 1; + // display current item + $iItemLevel = $oFrontendNavigation->getLevel($oCategory->getIdCat()); + // this is just for sample client - modify to your needs! + if (($aCfg['url_builder']['name'] == 'front_content') || ($aCfg['url_builder']['name'] == 'MR')) { + $aParams = array('lang' => $iLang, 'idcat' => $oCategory->getIdCat()); + } else { + $aParams = array('a' => $oCategory->getIdCat(), + 'idcat' => $oCategory->getIdCat(), // needed to build category path + 'lang' => $iLang, // needed to build category path + 'level' => 1); // needed to build category path + } + // fill template with values + $oTpl->set('d', 'name', $oCategory->getCategoryLanguage()->getName()); + $oTpl->set('d', 'css_level', $iItemLevel); + try { + $oTpl->set('d', 'url', Contenido_Url::getInstance()->build($aParams)); + } catch (InvalidArgumentException $e) { + $oTpl->set('d', 'url', '#'); + } + $oTpl->next(); + // continue until max level depth + if ($aDepthInfo[1] > $aDepthInfo[0]) { + // check if current item has sub-items + $oSubCategories = $oFrontendNavigation->getSubCategories($oCategory->getIdCat()); + if ($oSubCategories->count() > 0) { + foreach ($oSubCategories as $oSubCategory) { + self::loopCats($oSubCategory, $oFrontendNavigation, $oTpl, $sUrlStyle, $aCfg, $iLang, $aDepthInfo); + } + } + } + } +} +?> \ No newline at end of file diff --git a/conlite/external/frontend/includes/functions.include.php b/conlite/external/frontend/includes/functions.include.php new file mode 100644 index 0000000..f611b9c --- /dev/null +++ b/conlite/external/frontend/includes/functions.include.php @@ -0,0 +1,40 @@ + + * @license http://www.contenido.org/license/LIZENZ.txt + * @link http://www.4fb.de + * @link http://www.contenido.org + * + * $Id$: + */ + +if(!defined('CON_FRAMEWORK')) { + die('Illegal call'); +} + +function getTeaserImage ($text,$return = 'path') { + $regEx = "/]*?>.*?/i"; + $match = array(); + preg_match($regEx, $text, $match); + + $regEx = "/(src)(=)(['\"]?)([^\"']*)(['\"]?)/i"; + $img = array(); + preg_match($regEx, $match[0], $img); + + if ($return == 'path') { + return $img[4]; + } else { + return $match[0]; + } +} +?> \ No newline at end of file diff --git a/conlite/external/frontend/includes/functions.navigation.php b/conlite/external/frontend/includes/functions.navigation.php new file mode 100644 index 0000000..066a31d --- /dev/null +++ b/conlite/external/frontend/includes/functions.navigation.php @@ -0,0 +1,521 @@ + + * @license http://www.contenido.org/license/LIZENZ.txt + * @link http://www.4fb.de + * @link http://www.contenido.org + * + * $Id$: + */ +if (!defined('CON_FRAMEWORK')) { + die('Illegal call'); +} + +// create Navigation array for one level +function createNavigationArray($start_id, $db) { + global $user, $cfg, $client, $lang, $auth; + + $navigation = array(); + $FrontendPermissionCollection = new FrontendPermissionCollection; + +// SECURITY-FIX + $sql = "SELECT + A.idcat, + C.name, + C.public, + C.idcatlang + FROM + " . $cfg["tab"]["cat_tree"] . " AS A, + " . $cfg["tab"]["cat"] . " AS B, + " . $cfg["tab"]["cat_lang"] . " AS C + WHERE + A.idcat = B.idcat AND + B.idcat = C.idcat AND + B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND + C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND + C.visible = '1' AND + B.parentid = '" . Contenido_Security::escapeDB($start_id, $db) . "' + ORDER BY + A.idtree"; + $db->query($sql); + + while ($db->next_record()) { + $cat_id = $db->f("idcat"); + $cat_idlang = $db->f("idcatlang"); + $visible = false; + if ($db->f("public") != 0) { + $visible = true; + } elseif (($auth->auth['uid'] != '') && ($auth->auth['uid'] != 'nobody')) { + $FrontendGroupMemberCollection = new FrontendGroupMemberCollection; + + $FrontendGroupMemberCollection->setWhere("idfrontenduser", $auth->auth['uid']); + $FrontendGroupMemberCollection->query(); + $groups = array(); + while ($member = $FrontendGroupMemberCollection->next()) { + $groups[] = $member->get("idfrontendgroup"); + } + } + if (count($groups) > 0) { + for ($i = 0; $i < count($groups); $i++) { + if ($FrontendPermissionCollection->checkPerm($groups[$i], 'category', 'access', $cat_idlang, true)) { + $visible = true; + } + } + } + if ($visible) { + $navigation[$cat_id] = array("idcat" => $cat_id, + "name" => $db->f("name"), + "target" => '_self', # you can not call getTarget($cat_id, &$db) at this point with the same db instance! + "public" => $db->f("public")); + } + } // end while + + $db->free(); + + return $navigation; +} + +/** + * Return target of a given category id + * + * @deprecated + */ +function getTarget($cat_id, $db) { + global $cfg, $client, $lang; + +// SECURITY-FIX + $sql = "SELECT + a.external_redirect AS ext + FROM + " . $cfg["tab"]["art_lang"] . " AS a, + " . $cfg["tab"]["cat_art"] . " AS b, + " . $cfg["tab"]["cat"] . " AS c + WHERE + b.idcat = '" . Contenido_Security::escapeDB($cat_id, $db) . "' AND + c.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND + c.idcat = b.idcat AND + a.idart = b.idart AND + a.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "'"; + + $db->query($sql); + $db->next_record(); + + $target = ( $db->f('ext') == 0 ) ? '_self' : '_blank'; + + $db->free(); + return $target; +} + +/** + * Return true if $parentid is parent of $catid + */ +function isParent($parentid, $catid, $db) { + + + global $cfg, $client, $lang; + // SECURITY-FIX + $sql = "SELECT + a.parentid + FROM + " . $cfg["tab"]["cat"] . " AS a, + " . $cfg["tab"]["cat_lang"] . " AS b + WHERE + a.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND + b.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND + a.idcat = b.idcat AND + a.idcat = '" . Contenido_Security::escapeDB($catid, $db) . "'"; + + $db->query($sql); + $db->next_record(); + + $pre = $db->f("parentid"); + + if ($parentid == $pre) { + return true; + } else { + return false; + } +} + +function getParent($preid, &$db) { + + global $cfg, $client, $lang; + +// SECURITY-FIX + $sql = "SELECT + a.parentid + FROM + " . $cfg["tab"]["cat"] . " AS a, + " . $cfg["tab"]["cat_lang"] . " AS b + WHERE + a.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND + b.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND + a.idcat = b.idcat AND + a.idcat = '" . Contenido_Security::escapeDB($preid, $db) . "'"; + + $db->query($sql); + + if ($db->next_record()) { + return $db->f("parentid"); + } else { + return false; + } +} + +function getLevel($catid, &$db) { + global $cfg, $client, $lang; + +// SECURITY-FIX + $sql = "SELECT + level + FROM + " . $cfg["tab"]["cat_tree"] . " + WHERE + idcat = '" . Contenido_Security::escapeDB($catid, $db) . "' "; + + $db->query($sql); + + if ($db->next_record()) { + return $db->f("level"); + } else { + return false; + } +} + +/** + * Return path of a given category up to a certain level + */ +function getCategoryPath($cat_id, $level, $reverse = true, &$db) { + $root_path = array(); + + array_push($root_path, $cat_id); + + $parent_id = $cat_id; + + while (getLevel($parent_id, $db) != false AND getLevel($parent_id, $db) > $level AND getLevel($parent_id, $db) >= 0) { + + $parent_id = getParent($parent_id, $db); + if ($parent_id != false) { + array_push($root_path, $parent_id); + } + } + + if ($reverse == true) { + $root_path = array_reverse($root_path); + } + + return $root_path; +} + +/** + * Return location string of a given category + */ +function getLocationString($iStartCat, $level, $seperator, $sLinkStyleClass, $sTextStyleClass, $fullweblink = false, $reverse = true, $mod_rewrite = true, $db) { + global $sess, $cfgClient, $client; + + $aCatPath = getCategoryPath($iStartCat, $level, $reverse, $db); + + if (is_array($aCatPath) AND count($aCatPath) > 0) { + $aLocation = array(); + foreach ($aCatPath as $value) { + if (!$fullweblink) { + if ($mod_rewrite == true) { + $linkUrl = $sess->url("index-a-$value.html"); + } else { + $linkUrl = $sess->url("front_content.php?idcat=$value"); + } + } else { + if ($mod_rewrite == true) { + $linkUrl = $sess->url($cfgClient[$client]["path"]["htmlpath"] . "index-a-$value.html"); + } else { + $linkUrl = $sess->url($cfgClient[$client]["path"]["htmlpath"] . "front_content.php?idcat=$value"); + } + } + $name = getCategoryName($value, $db); + $aLocation[] = '' . $name . ''; + } + } + + $sLocation = implode($seperator, $aLocation); + $sLocation = '' . $sLocation . ''; + + + return $sLocation; +} + +/** + * + * get subtree by a given id + * + * @param int $idcat Id of category + * @return array Array with all deeper categories + * + * @copyright four for business AG + */ +function getSubTree($idcat_start, $db) { + global $client, $cfg; + + // SECURITY-FIX + $sql = "SELECT + B.idcat, A.level + FROM + " . $cfg["tab"]["cat_tree"] . " AS A, + " . $cfg["tab"]["cat"] . " AS B + WHERE + A.idcat = B.idcat AND + idclient = '" . Contenido_Security::escapeDB($client, $db) . "' + ORDER BY + idtree"; + + $db->query($sql); + + $subCats = false; + $curLevel = 0; + while ($db->next_record()) { + if ($db->f("idcat") == $idcat_start) { + $curLevel = $db->f("level"); + $subCats = true; + } else if ($db->f("level") <= $curLevel) { // ending part of tree + $subCats = false; + } + + if ($subCats == true) { //echo "true"; echo $db->f("idcat"); echo "
    "; + $deeper_cats[] = $db->f("idcat"); + } + } + return $deeper_cats; +} + +function getTeaserDeeperCategories($iIdcat, $db) { + global $client, $cfg, $lang; + + // SECURITY-FIX + $sql = "SELECT + B.parentid, B.idcat + FROM + " . $cfg["tab"]["cat_tree"] . " AS A, + " . $cfg["tab"]["cat"] . " AS B, + " . $cfg["tab"]["cat_lang"] . " AS C + WHERE + A.idcat = B.idcat AND + B.idcat = C.idcat AND + C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND + C.visible = '1' AND + B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' + ORDER BY + idtree"; + $db->query($sql); + + $subCats = false; + $curLevel = 0; + while ($db->next_record()) { + if ($db->f("idcat") == $iIdcat) { + $curLevel = $db->f("level"); + $subCats = true; + } else if ($curLevel == $db->f("level")) { // ending part of tree + $subCats = false; + } + + if ($subCats == true) { + $deeper_cats[] = $db->f("idcat"); + } + } + return $deeper_cats; +} + +/** + * + * get subtree by a given id, without protected and invisible categories + * + * @param int $idcat Id of category + * @return array Array with all deeper categories + * + * @copyright four for business AG + */ +function getProtectedSubTree($idcat_start, $db) { + global $client, $cfg, $lang; + + // SECURITY-FIX + $sql = "SELECT + B.parentid, B.idcat + FROM + " . $cfg["tab"]["cat_tree"] . " AS A, + " . $cfg["tab"]["cat"] . " AS B, + " . $cfg["tab"]["cat_lang"] . " AS C + WHERE + A.idcat = B.idcat AND + B.idcat = C.idcat AND + C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND + C.visible = '1' AND + C.public = '1' AND + B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' + ORDER BY + idtree"; + + $db->query($sql); + + $subCats = false; + $curLevel = 0; + while ($db->next_record()) { + if ($db->f("idcat") == $idcat_start) { + $curLevel = $db->f("level"); + $subCats = true; + } else if ($curLevel == $db->f("level")) { // ending part of tree + $subCats = false; + } + + if ($subCats == true) { //echo "true"; echo $db->f("idcat"); echo "
    "; + $deeper_cats[] = $db->f("idcat"); + } + } + return $deeper_cats; +} + +/** + * Return category name + */ +function getCategoryName($cat_id, &$db) { + + global $cfg, $client, $lang; + + // SECURITY-FIX + $sql = "SELECT + * + FROM + " . $cfg["tab"]["cat"] . " AS A, + " . $cfg["tab"]["cat_lang"] . " AS B + WHERE + A.idcat = B.idcat AND + A.idcat = '" . Contenido_Security::escapeDB($cat_id, $db) . "' AND + A.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND + B.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' + "; + + $db->query($sql); + + if ($db->next_record()) { + $cat_name = $db->f("name"); + return $cat_name; + } else { + return ''; + } +} + +// end function + +// get direct subcategories of a given category +function getSubCategories($parent_id, $db) { + + $subcategories = array(); + + global $cfg, $client, $lang; + +// SECURITY-FIX + $sql = "SELECT + A.idcat + FROM + " . $cfg["tab"]["cat_tree"] . " AS A, + " . $cfg["tab"]["cat"] . " AS B, + " . $cfg["tab"]["cat_lang"] . " AS C + WHERE + A.idcat = B.idcat AND + B.idcat = C.idcat AND + B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND + C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND + C.visible = '1' AND + C.public = '1' AND + B.parentid = '" . Contenido_Security::escapeDB($parent_id, $db) . "' + ORDER BY + A.idtree"; + + $db->query($sql); + + while ($db->next_record()) { + + $subcategories[] = $db->f("idcat"); + } // end while + + return $subcategories; +} + +// end function + +// get direct subcategories with protected categories +function getProtectedSubCategories($parent_id, $db) { + + $subcategories = array(); + unset($subcategories); + + global $cfg, $client, $lang; + +// SECURITY-FIX + $sql = "SELECT + A.idcat + FROM + " . $cfg["tab"]["cat_tree"] . " AS A, + " . $cfg["tab"]["cat"] . " AS B, + " . $cfg["tab"]["cat_lang"] . " AS C + WHERE + A.idcat = B.idcat AND + B.idcat = C.idcat AND + B.idclient = '" . Contenido_Security::escapeDB($client, $db) . "' AND + C.idlang = '" . Contenido_Security::escapeDB($lang, $db) . "' AND + B.parentid = '" . Contenido_Security::escapeDB($parent_id, $db) . "' + ORDER BY + A.idtree"; + + $db->query($sql); + + while ($db->next_record()) { + + $subcategories[] = $db->f("idcat"); + } // end while + + return $subcategories; +} + +// end function + +function checkCatPermission($idcatlang, $public) { + #Check if current user has permissions to access cat + + global $auth; + + $oDB = new DB_ConLite(); + + $FrontendPermissionCollection = new FrontendPermissionCollection; + $visible = false; + + if ($public != 0) { + $visible = true; + $groups = array(); + } elseif (($auth->auth['uid'] != '') && ($auth->auth['uid'] != 'nobody')) { + $FrontendGroupMemberCollection = new FrontendGroupMemberCollection; + $FrontendGroupMemberCollection->setWhere("idfrontenduser", $auth->auth['uid']); + $FrontendGroupMemberCollection->query(); + $groups = array(); + while ($member = $FrontendGroupMemberCollection->next()) { + $groups[] = $member->get("idfrontendgroup"); + } + } + if (count($groups) > 0) { + for ($i = 0; $i < count($groups); $i++) { + if ($FrontendPermissionCollection->checkPerm($groups[$i], 'category', 'access', $idcatlang, true)) { + $visible = true; + } + } + } + + return $visible; +} \ No newline at end of file diff --git a/conlite/external/frontend/includes/rss.inc.php b/conlite/external/frontend/includes/rss.inc.php new file mode 100644 index 0000000..2202b9e --- /dev/null +++ b/conlite/external/frontend/includes/rss.inc.php @@ -0,0 +1,59 @@ + \ No newline at end of file diff --git a/conlite/external/frontend/includes/rss_php.php b/conlite/external/frontend/includes/rss_php.php new file mode 100644 index 0000000..1456313 --- /dev/null +++ b/conlite/external/frontend/includes/rss_php.php @@ -0,0 +1,160 @@ + + Published: 200801 :: blacknet :: via rssphp.net + + RSS_PHP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. + + Usage: + See the documentation at http://rssphp.net/documentation + Examples: + Can be found online at http://rssphp.net/examples +*/ + +class rss_php { + + public $document; + public $channel; + public $items; + +/**************************** + public load methods +***/ + # load RSS by URL + public function load($url=false, $unblock=true) { + if($url) { + if($unblock) { + $this->loadParser(file_get_contents($url, false, $this->randomContext())); + } else { + $this->loadParser(file_get_contents($url)); + } + } + } + # load raw RSS data + public function loadRSS($rawxml=false) { + if($rawxml) { + $this->loadParser($rawxml); + } + } + +/**************************** + public load methods + @param $includeAttributes BOOLEAN + return array; +***/ + # return full rss array + public function getRSS($includeAttributes=false) { + if($includeAttributes) { + return $this->document; + } + return $this->valueReturner(); + } + # return channel data + public function getChannel($includeAttributes=false) { + if($includeAttributes) { + return $this->channel; + } + return $this->valueReturner($this->channel); + } + # return rss items + public function getItems($includeAttributes=false) { + if($includeAttributes) { + return $this->items; + } + return $this->valueReturner($this->items); + } + +/**************************** + internal methods +***/ + private function loadParser($rss=false) { + if($rss) { + $this->document = array(); + $this->channel = array(); + $this->items = array(); + $DOMDocument = new DOMDocument; + $DOMDocument->strictErrorChecking = false; + $DOMDocument->loadXML($rss); + $this->document = $this->extractDOM($DOMDocument->childNodes); + } + } + + private function valueReturner($valueBlock=false) { + if(!$valueBlock) { + $valueBlock = $this->document; + } + foreach($valueBlock as $valueName => $values) { + if(isset($values['value'])) { + $values = $values['value']; + } + if(is_array($values)) { + $valueBlock[$valueName] = $this->valueReturner($values); + } else { + $valueBlock[$valueName] = $values; + } + } + return $valueBlock; + } + + private function extractDOM($nodeList,$parentNodeName=false) { + $itemCounter = 0; + foreach($nodeList as $values) { + if(substr($values->nodeName,0,1) != '#') { + if($values->nodeName == 'item') { + $nodeName = $values->nodeName.':'.$itemCounter; + $itemCounter++; + } else { + $nodeName = $values->nodeName; + } + $tempNode[$nodeName] = array(); + if($values->attributes) { + for($i=0;$values->attributes->item($i);$i++) { + $tempNode[$nodeName]['properties'][$values->attributes->item($i)->nodeName] = $values->attributes->item($i)->nodeValue; + } + } + if(!$values->firstChild) { + $tempNode[$nodeName]['value'] = $values->textContent; + } else { + $tempNode[$nodeName]['value'] = $this->extractDOM($values->childNodes, $values->nodeName); + } + if(in_array($parentNodeName, array('channel','rdf:RDF'))) { + if($values->nodeName == 'item') { + $this->items[] = $tempNode[$nodeName]['value']; + } elseif(!in_array($values->nodeName, array('rss','channel'))) { + $this->channel[$values->nodeName] = $tempNode[$nodeName]; + } + } + } elseif(substr($values->nodeName,1) == 'text') { + $tempValue = trim(preg_replace('/\s\s+/',' ',str_replace("\n",' ', $values->textContent))); + if($tempValue) { + $tempNode = $tempValue; + } + } elseif(substr($values->nodeName,1) == 'cdata-section'){ + $tempNode = $values->textContent; + } + } + return $tempNode; + } + + private function randomContext() { + $headerstrings = array(); + $headerstrings['User-Agent'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.'.rand(0,2).'; en-US; rv:1.'.rand(2,9).'.'.rand(0,4).'.'.rand(1,9).') Gecko/2007'.rand(10,12).rand(10,30).' Firefox/2.0.'.rand(0,1).'.'.rand(1,9); + $headerstrings['Accept-Charset'] = rand(0,1) ? 'en-gb,en;q=0.'.rand(3,8) : 'en-us,en;q=0.'.rand(3,8); + $headerstrings['Accept-Language'] = 'en-us,en;q=0.'.rand(4,6); + $setHeaders = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'."\r\n". + 'Accept-Charset: '.$headerstrings['Accept-Charset']."\r\n". + 'Accept-Language: '.$headerstrings['Accept-Language']."\r\n". + 'User-Agent: '.$headerstrings['User-Agent']."\r\n"; + $contextOptions = array( + 'http'=>array( + 'method'=>"GET", + 'header'=>$setHeaders + ) + ); + return stream_context_create($contextOptions); + } + +} + +?> \ No newline at end of file diff --git a/conlite/external/frontend/logs/deprecated.txt b/conlite/external/frontend/logs/deprecated.txt new file mode 100644 index 0000000..0e406df --- /dev/null +++ b/conlite/external/frontend/logs/deprecated.txt @@ -0,0 +1,2 @@ +This folder is marked as deprecated and will be deleted in next versions of ConLite. +Please use folders in data-directory instead! \ No newline at end of file