diff --git a/conlite/classes/class.genericdb.php b/conlite/classes/class.genericdb.php index ee774fd..a3a070e 100644 --- a/conlite/classes/class.genericdb.php +++ b/conlite/classes/class.genericdb.php @@ -1311,7 +1311,7 @@ abstract class Item extends cItemBaseAbstract { * List of funcion names of the filtersused when data is retrieved from the db * @var array */ - protected $_arrOutFilters = array('stripslashes', 'htmldecode', 'urldecode'); + protected $_arrOutFilters = array('stripslashes', 'htmldecode','urldecode'); /** * Class name of meta object diff --git a/conlite/classes/class.i18n.php b/conlite/classes/class.i18n.php index 0c68760..469575e 100644 --- a/conlite/classes/class.i18n.php +++ b/conlite/classes/class.i18n.php @@ -130,7 +130,7 @@ class cI18n { // Is emulator to use? if (!$cfg['native_i18n']) { - return htmlentities(self::emulateGettext($string, $domain)); + return self::emulateGettext($string, $domain); } // Try to use native gettext implementation diff --git a/conlite/classes/widgets/class.widgets.page.php b/conlite/classes/widgets/class.widgets.page.php index de56dae..54495b7 100644 --- a/conlite/classes/widgets/class.widgets.page.php +++ b/conlite/classes/widgets/class.widgets.page.php @@ -320,8 +320,12 @@ class cPage extends cHTML { } $meta = ''; - if ($this->_encoding != "" && !$this->_isHtml5) { - $meta .= '' . "\n"; + if(!empty($this->_encoding)) { + if($this->_isHtml5) { + $meta .= '' . "\n"; + } else { + $meta .= '' . "\n"; + } } if ($this->_object !== false && method_exists($this->_object, "render")) { diff --git a/conlite/external/endroid/qr-code/composer.json b/conlite/external/endroid/qr-code/composer.json old mode 100755 new mode 100644 diff --git a/conlite/external/endroid/qr-code/src/QrCode.php b/conlite/external/endroid/qr-code/src/QrCode.php old mode 100755 new mode 100644 diff --git a/conlite/includes/api/functions.api.general.php b/conlite/includes/api/functions.api.general.php index 8b54d7e..f250631 100644 --- a/conlite/includes/api/functions.api.general.php +++ b/conlite/includes/api/functions.api.general.php @@ -1,4 +1,5 @@ = 2) { $tmp = $aPaths[1]; $aPaths[1] = $aPaths[$iLast]; @@ -176,14 +175,14 @@ function contenido_include($sWhere, $sWhat, $bForce = false, $bReturnPath = fals if ($bError) { $aBackTrace = debug_backtrace(); - if(is_array($aBackTrace[1])) { - $sError = " in ".$aBackTrace[1]['file'] - ." on line ".$aBackTrace[1]['line'] - ." function: ".$aBackTrace[1]['function']." "; + if (is_array($aBackTrace[1])) { + $sError = " in " . $aBackTrace[1]['file'] + . " on line " . $aBackTrace[1]['line'] + . " function: " . $aBackTrace[1]['function'] . " "; } else { $sError = ""; } - + trigger_error("Can't include $sInclude $sError", E_USER_ERROR); return; } @@ -196,7 +195,6 @@ function contenido_include($sWhere, $sWhat, $bForce = false, $bReturnPath = fals } } - /** * Shortcut to contenido_include. * @@ -207,8 +205,7 @@ function contenido_include($sWhere, $sWhat, $bForce = false, $bReturnPath = fals * @param bool $bForce If true, force the file to be included * @return void */ -function cInclude($sWhere, $sWhat, $bForce = false) -{ +function cInclude($sWhere, $sWhat, $bForce = false) { contenido_include($sWhere, $sWhat, $bForce); } @@ -224,21 +221,18 @@ function cInclude($sWhere, $sWhat, $bForce = false) */ function plugin_include($sWhere, $sWhat) { global $cfg; - $sInclude = $cfg['path']['contenido'] . $cfg['path']['plugins'] . $sWhere. '/' . $sWhat; - if(is_readable($sInclude)) { + $sInclude = $cfg['path']['contenido'] . $cfg['path']['plugins'] . $sWhere . '/' . $sWhat; + if (is_readable($sInclude)) { include_once($sInclude); } else { $sCaller = ""; $aTrace = debug_backtrace(); - foreach($aTrace as $iKey=>$aValue) { - if($aValue['function'] == __METHOD__) { - $sCaller = $aValue['file']." line ".$aValue['line']; + foreach ($aTrace as $iKey => $aValue) { + if ($aValue['function'] == __METHOD__) { + $sCaller = $aValue['file'] . " line " . $aValue['line']; break; } - } - trigger_error("Function ".__METHOD__.": Can't include $sInclude in ".$sCaller, E_USER_WARNING); + } + trigger_error("Function " . __METHOD__ . ": Can't include $sInclude in " . $sCaller, E_USER_WARNING); } } - - -?> \ No newline at end of file diff --git a/conlite/includes/functions.general.php b/conlite/includes/functions.general.php index 8fc9813..a0c46a8 100644 --- a/conlite/includes/functions.general.php +++ b/conlite/includes/functions.general.php @@ -2221,4 +2221,66 @@ function IP_match($network, $mask, $ip) { } } -?> \ No newline at end of file +/** + * Wrapper for php-function htmlspecialchars + * + * @author Ortwin Pinke + * @since 2.3.0 + * @uses htmlspecialchars php-function + * + * @param string $value + * @param int $flags + * @param string $encoding default UTF-8 + * @return string Returns the converted string + */ +function clHtmlSpecialChars(string $value, int $flags = ENT_COMPAT|ENT_HTML401, string $encoding = 'UTF-8') { + return htmlspecialchars($value, $flags, $encoding); +} + +/** + * Wrapper for php-function html_entity_decode + * + * @author Ortwin Pinke + * @since 2.3.0 + * @uses html_entity_decode php-function + * + * @param string $value + * @param int $flags + * @param string $encoding default UTF-8 + * @return string Returns the decoded string + */ +function clHtmlEntityDecode(string $value, int $flags = ENT_COMPAT|ENT_HTML401, string $encoding = 'UTF-8') { + return html_entity_decode($value, $flags, $encoding); +} + +/** + * Wrapper for php-function htmlentities + * + * @author Ortwin Pinke + * @since 2.3.0 + * @uses htmlentities php-function + * + * @param string $value + * @param int $flags + * @param string $encoding default UTF-8 + * @return string Returns the converted string + */ +function clHtmlEntities(string $value, int $flags = ENT_COMPAT|ENT_HTML401, string $encoding = 'UTF-8') { + return htmlentities($value, $flags, $encoding); +} + +/** + * Wrapper for php-function get_html_translation_table + * + * @author Ortwin Pinke + * @since 2.3.0 + * @uses get_html_translation_table php-function + * + * @param int $table + * @param int $flags + * @param string $encoding + * @return array + */ +function clGetHtmlTranslationTable(int $table = HTML_SPECIALCHARS, int $flags = ENT_COMPAT|ENT_HTML401, string $encoding = null) { + return get_html_translation_table($table, $flags, $encoding); +} \ No newline at end of file diff --git a/conlite/includes/functions.php54.php b/conlite/includes/functions.php54.php index c9c335b..f037d44 100644 --- a/conlite/includes/functions.php54.php +++ b/conlite/includes/functions.php54.php @@ -60,10 +60,11 @@ function clPhp54FixedFunc($funcname, $value, $flags = '', $encoding = '') { * @param string $encoding * @return string */ +/* function clHtmlSpecialChars($value, $flags = '', $encoding = '') { return clPhp54FixedFunc("htmlspecialchars", $value, $flags, $encoding); } - +*/ /** * * @uses clPhp54FixedFunc multi fix func for PHP5.4 @@ -74,9 +75,12 @@ function clHtmlSpecialChars($value, $flags = '', $encoding = '') { * @param string $encoding * @return string */ +/* function clHtmlEntityDecode($value, $flags = '', $encoding = '') { return clPhp54FixedFunc("html_entity_decode", $value, $flags, $encoding); } + * + */ /** * @@ -88,9 +92,12 @@ function clHtmlEntityDecode($value, $flags = '', $encoding = '') { * @param string $encoding * @return string */ +/* function clHtmlEntities($value, $flags = '', $encoding = '') { return clPhp54FixedFunc("htmlentities", $value, $flags, $encoding); } + * + */ /** * @@ -101,9 +108,12 @@ function clHtmlEntities($value, $flags = '', $encoding = '') { * @param mixed $flags * @return string */ +/* function clGetHtmlTranslationTable($table = '', $flags = '') { return clPhp54FixedFunc("get_html_translation_table", $table, $flags); } + * + */ // hold old functions from con 4.8 but use new ConLite functions, mark them as deprecated @@ -112,38 +122,11 @@ function clGetHtmlTranslationTable($table = '', $flags = '') { * Use compatible clHtmlSpecialChars instead * @deprecated since version 2.0 */ +/** if (function_exists('conHtmlSpecialChars') == false) { function conHtmlSpecialChars($value, $flags = '', $encoding = '') { return clHtmlSpecialChars($value, $flags, $encoding); } } - -/** - * Use compatible clHtmlEntityDecode instead - * @deprecated since version 2.0 - */ -if (function_exists('conHtmlEntityDecode') == false) { - function conHtmlEntityDecode($value, $flags = '', $encoding = '') { - return clHtmlEntityDecode($value, $flags, $encoding); - } -} - -/** - * Use compatible clHtmlEntities instead - * @deprecated since version 2.0 - */ -if (function_exists('conHtmlentities') == false) { - function conHtmlentities($value, $flags = '', $encoding = '') { - return clHtmlEntities($value, $flags, $encoding); - } -} - -/** - * Use compatible clGetHtmlTranslationTable instead - * @deprecated since version 2.0 - */ -if (function_exists('conGetHtmlTranslationTable') == false) { - function conGetHtmlTranslationTable($table = '', $flags = '') { - return clGetHtmlTranslationTable($table, $flags); - } -} \ No newline at end of file + * + */ \ No newline at end of file diff --git a/conlite/includes/include.mod_translate.php b/conlite/includes/include.mod_translate.php index 701a2f7..4a2b5a8 100644 --- a/conlite/includes/include.mod_translate.php +++ b/conlite/includes/include.mod_translate.php @@ -1,4 +1,5 @@ get("name") . ' ('.$lang.')'; +$langstring = $langobj->get("name") . ' (' . $lang . ')'; $moduletranslations = new cApiModuleTranslationCollection; $module = new cApiModule($idmod); -if ($action == "mod_translation_save") -{ - $strans = new cApiModuleTranslation; - $strans->loadByPrimaryKey($idmodtranslation); +if ($action == "mod_translation_save") { + $strans = new cApiModuleTranslation; + $strans->loadByPrimaryKey($idmodtranslation); - if ($strans->get("idmod") == $idmod) - { - $module->setTranslatedName($translatedname); + if ($strans->get("idmod") == $idmod) { + $module->setTranslatedName($translatedname); - $strans->set("translation", stripslashes($t_trans)); - $strans->store(); + $strans->set("translation", stripslashes($t_trans)); + $strans->store(); - /* Increase idmodtranslation */ - $moduletranslations->select("idmod = '$idmod' AND idlang = '$lang'"); + /* Increase idmodtranslation */ + $moduletranslations->select("idmod = '$idmod' AND idlang = '$lang'"); - while ($mitem = $moduletranslations->next()) - { - if ($mitem->get("idmodtranslation") == $idmodtranslation) - { - $mitem2 = $moduletranslations->next(); + while ($mitem = $moduletranslations->next()) { + if ($mitem->get("idmodtranslation") == $idmodtranslation) { + $mitem2 = $moduletranslations->next(); - if (is_object($mitem2)) - { - $idmodtranslation = $mitem2->get("idmodtranslation"); - break; - } - } - } - } + if (is_object($mitem2)) { + $idmodtranslation = $mitem2->get("idmodtranslation"); + break; + } + } + } + } } -if ($action == "mod_importexport_translation") -{ - if ($mode == "export") - { - $sFileName = uplCreateFriendlyName(strtolower($module->get("name") . "_" . $langobj->get("name"))); +if ($action == "mod_importexport_translation") { + if ($mode == "export") { + $sFileName = uplCreateFriendlyName(strtolower($module->get("name") . "_" . $langobj->get("name"))); - if ($sFileName != "") - { - $moduletranslations->export($idmod, $lang, $sFileName . ".xml"); - } - } - if ($mode == "import") - { - if (file_exists($_FILES["upload"]["tmp_name"])) - { - $moduletranslations->import($idmod, $lang, $_FILES["upload"]["tmp_name"]); - } - } -} + if ($sFileName != "") { + $moduletranslations->export($idmod, $lang, $sFileName . ".xml"); + } + } + if ($mode == "import") { + if (file_exists($_FILES["upload"]["tmp_name"])) { + $moduletranslations->import($idmod, $lang, $_FILES["upload"]["tmp_name"]); + } + } +} -if (!isset($idmodtranslation)) -{ - $idmodtranslation = 0; +if (!isset($idmodtranslation)) { + $idmodtranslation = 0; } $mtrans = new cApiModuleTranslation; $mtrans->loadByPrimaryKey($idmodtranslation); -if ($mtrans->get("idmod") != $idmod) -{ - $moduletranslations->select("idmod = '$idmod' AND idlang = '$lang'", '', 'idmodtranslation DESC', '1'); - $mtrans = $moduletranslations->next(); - - if (is_object($mtrans)) - { - $idmodtranslation = $mtrans->get("idmodtranslation"); - } else { - $mtrans = new cApiModuleTranslation; - } +if ($mtrans->get("idmod") != $idmod) { + $moduletranslations->select("idmod = '$idmod' AND idlang = '$lang'", '', 'idmodtranslation DESC', '1'); + $mtrans = $moduletranslations->next(); + + if (is_object($mtrans)) { + $idmodtranslation = $mtrans->get("idmodtranslation"); + } else { + $mtrans = new cApiModuleTranslation; + } } $strings = $module->parseModuleForStrings(); /* Insert new strings */ -foreach ($strings as $string) -{ - $moduletranslations->create($idmod, $lang, $string); +foreach ($strings as $string) { + $moduletranslations->create($idmod, $lang, $string); } $moduletranslations->select("idmod = '$idmod' AND idlang = '$lang'"); -while ($d_modtrans = $moduletranslations->next()) -{ - if (!in_array($d_modtrans->get("original"), $strings)) - { - $moduletranslations->delete($d_modtrans->get("idmodtranslation")); - } +while ($d_modtrans = $moduletranslations->next()) { + if (!in_array($d_modtrans->get("original"), $strings)) { + $moduletranslations->delete($d_modtrans->get("idmodtranslation")); + } } $page = new cPage; +$page->setHtml5(); +$page->setEncoding('UTF-8'); $form = new UI_Table_Form("translation"); $form->addHeader(sprintf(i18n("Translate module '%s'"), $module->get("name"))); @@ -142,7 +128,7 @@ $form->setVar("idmod", $idmod); $form->setVar("idmodtranslation", $idmodtranslation); $form->setVar("action", "mod_translation_save"); -$transmodname = new cHTMLTextbox("translatedname", $module->getTranslatedName(),60); +$transmodname = new cHTMLTextbox("translatedname", $module->getTranslatedName(), 60); $form->add(i18n("Translated Name"), $transmodname); @@ -152,22 +138,21 @@ $ilink->setCustom("idmod", $idmod); $ilink->setCustom("idmodtranslation", $mtrans->get("idmodtranslation")); $ilink->setAnchor($mtrans->get("idmodtranslation")); -$iframe = ''; +$iframe = ''; -$table = ''; +$table = '
'.i18n("Original module string").''.sprintf(i18n("Translation for %s"), $langstring).' 
'.$iframe.'
'; -$original = new cHTMLTextarea("t_orig",clHtmlSpecialChars($mtrans->get("original"))); +$original = new cHTMLTextarea("t_orig", clHtmlSpecialChars($mtrans->get("original"))); $original->setStyle("width: 300px;"); -$translated = new cHTMLTextarea("t_trans",clHtmlSpecialChars($mtrans->get("translation"))); +$translated = new cHTMLTextarea("t_trans", $mtrans->get("translation")); $translated->setStyle("width: 300px;"); -$table .= '
' . i18n("Original module string") . '' . sprintf(i18n("Translation for %s"), $langstring) . ' 
' . $iframe . '
'.$original->render().''.$translated->render().' 
'; +$table .= '' . $original->render() . '' . $translated->render() . ' '; $table .= i18n("Hint: Hit ALT+SHIFT+S to save the translated entry and advance to the next string."); $form->add(i18n("String list"), $table); $mark = ''; - $import = new cHTMLRadiobutton("mode", "import"); $export = new cHTMLRadiobutton("mode", "export"); $export->setLabelText(i18n("Export to file")); @@ -189,15 +174,14 @@ $form2->setVar("idmod", $idmod); $form2->setVar("idmodtranslation", $idmodtranslation); $form2->custom["submit"]["accesskey"] = ''; -$page->setContent($form->render(). $mark ."
". $form2->render()); +$page->setContent($form->render() . $mark . "
" . $form2->render()); $page->setMarkScript(2); $clang = new cApiLanguage($lang); $page->setEncoding($clang->get("encoding")); -if (!($action == "mod_importexport_translation" && $mode == "export")) -{ - $page->render(); +if (!($action == "mod_importexport_translation" && $mode == "export")) { + $page->render(); } ?> \ No newline at end of file diff --git a/conlite/includes/include.mod_translate_stringlist.php b/conlite/includes/include.mod_translate_stringlist.php index d11653c..ab03558 100644 --- a/conlite/includes/include.mod_translate_stringlist.php +++ b/conlite/includes/include.mod_translate_stringlist.php @@ -1,4 +1,5 @@ select("idmod = '$idmod' AND idlang='$lang'"); $page = new cPage; +$page->setHtml5(); +$page->setEncoding('UTF-8'); $page->setMargin(0); $v = ''; @@ -46,32 +48,35 @@ $link->setCLink("mod_translate", 4, ""); $mylink = new cHTMLLink; -while ($translation = $translations->next()) -{ - $string = $translation->get("original"); - $tstring = $translation->get("translation"); - +while ($translation = $translations->next()) { + + $string = utf8_encode($translation->get("original")); + $tstring = utf8_encode($translation->get("translation")); + $link->setCustom("idmod", $idmod); $link->setCustom("idmodtranslation", $translation->get("idmodtranslation")); $href = $link->getHREF(); - - $mylink->setLink('javascript:parent.location="'.$href.'"'); + + $mylink->setLink('javascript:parent.location="' . $href . '"'); $mylink->setContent($string); - $dark = !$dark; + $dark = !$dark; - if ($dark) - { - $bgcol = $cfg["color"]["table_dark"]; - } else { - $bgcol = $cfg["color"]["table_light"]; - } + if ($dark) { + $bgcol = $cfg["color"]["table_dark"]; + } else { + $bgcol = $cfg["color"]["table_light"]; + } - if ($idmodtranslation == $translation->get("idmodtranslation")) - { - $bgcol = $cfg["color"]["table_active"]; - } - $v .= ''; + if ($idmodtranslation == $translation->get("idmodtranslation")) { + $bgcol = $cfg["color"]["table_active"]; + } + $v .= ''."\n" + . ''."\n" + . ''."\n" + . ''."\n"; } $v .= '
'.$mylink->render().''.$tstring.'
'."\n" + . ''."\n" + . $mylink->render() . '' . $tstring . '
'; @@ -82,5 +87,4 @@ $clang = new cApiLanguage($lang); $page->setEncoding($clang->get("encoding")); $page->render(); - ?> \ No newline at end of file diff --git a/conlite/includes/include.pretplcfg_edit_form.php b/conlite/includes/include.pretplcfg_edit_form.php index 8cc4e41..17fbf4c 100644 --- a/conlite/includes/include.pretplcfg_edit_form.php +++ b/conlite/includes/include.pretplcfg_edit_form.php @@ -50,8 +50,8 @@ $formaction = $sess->url("main.php"); # $hidden = ' - - + + @@ -154,7 +154,5 @@ $buttons = ''; $tpl->set('s', 'BUTTONS', $buttons); - # Generate template -$tpl->generate($cfg['path']['templates'] . $cfg['templates']['tplcfg_edit_form']); -?> \ No newline at end of file +$tpl->generate($cfg['path']['templates'] . $cfg['templates']['tplcfg_edit_form']); \ No newline at end of file diff --git a/conlite/includes/startup.php b/conlite/includes/startup.php index 9a51ad9..451bffb 100644 --- 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.2.0 beta'); +define('CL_VERSION', '2.3.0 RC'); } diff --git a/conlite/plugins/cl-mod-rewrite b/conlite/plugins/cl-mod-rewrite index 91b0fd8..4c3d78a 160000 --- a/conlite/plugins/cl-mod-rewrite +++ b/conlite/plugins/cl-mod-rewrite @@ -1 +1 @@ -Subproject commit 91b0fd8c15cdf1b5e9704c8720a40f959e7eb4fe +Subproject commit 4c3d78a0443921bdc3adcaf89c151d94e8f4a876 diff --git a/conlite/templates/standard/html5/template.generic_page.html b/conlite/templates/standard/html5/template.generic_page.html index 47ef937..eea3476 100644 --- a/conlite/templates/standard/html5/template.generic_page.html +++ b/conlite/templates/standard/html5/template.generic_page.html @@ -1,7 +1,6 @@ - {META}