updates for php8

Dieser Commit ist enthalten in:
o.pinke 2023-04-25 19:54:58 +02:00
Ursprung 6525928e83
Commit bfadeb3ffc
2 geänderte Dateien mit 24 neuen und 41 gelöschten Zeilen

Datei anzeigen

@ -26,14 +26,6 @@ $oField = new cHTMLTextbox("CMS_VAR[4]", "CMS_VALUE[4]");
$oField->setWidth(8); $oField->setWidth(8);
$oCfgTable->setCell(4, 0, mi18n("Hintergrundfarbe bei Fehlern (z.B. red):")); $oCfgTable->setCell(4, 0, mi18n("Hintergrundfarbe bei Fehlern (z.B. red):"));
$oCfgTable->setCell(4, 1, $oField->render()); $oCfgTable->setCell(4, 1, $oField->render());
/*
$oField = new cHTMLCheckbox("CMS_VAR[5]", "true");
$bHasJQuery = ("CMS_VALUE[5]" == 'true')?true:false;
$oField->setChecked($bHasJQuery);
$oField->setLabelText(' ');
$oCfgTable->setCell(5, 0, mi18n("jQuery Script vorhanden:"));
$oCfgTable->setCell(5, 1, $oField->render());
*/
$oCfgTable->render(true); $oCfgTable->render(true);
?><?php ?><?php

Datei anzeigen

@ -11,35 +11,24 @@
* Modified : 24-08-2013, Murat Purc, adapted to newer CONTENIDO (4.8) and PHP (5.3/5.4) versions * Modified : 24-08-2013, Murat Purc, adapted to newer CONTENIDO (4.8) and PHP (5.3/5.4) versions
* *********************************************** */ * *********************************************** */
$sFrontEndPath = cRegistry::getClientConfig(cRegistry::getClientId())['path']['frontend'] . 'securimage'; $sFrontEndPath = cRegistry::getClientConfig(cRegistry::getClientId())['path']['frontend'] . 'securimage' . DIRECTORY_SEPARATOR;
require_once $sFrontEndPath . '/securimage.php'; require_once $sFrontEndPath . 'securimage.php';
require_once $sFrontEndPath . '/CaptchaObject.php'; require_once $sFrontEndPath . 'CaptchaObject.php';
require_once $sFrontEndPath . '/StorageAdapter/AdapterInterface.php'; require_once $sFrontEndPath . 'StorageAdapter/AdapterInterface.php';
class w3form { class w3form {
private $email = array( private array $email = ['adresses' => '', 'from' => ['name' => '', 'email' => ''], 'message' => '', 'subject' => ''];
'adresses' => '', private array $unraveled = [];
'from' => array( private array $form = ['form' => '', 'answer' => '', 'colorError' => ''];
'name' => '', private array $formField = [];
'email' => ''
),
'message' => '',
'subject' => ''
);
private $unraveled = array();
private $form = array(
'form' => '',
'answer' => '',
'colorError' => ''
);
private $formField = array();
public function __construct() public function __construct()
{ {
} }
private function sendEmail() { private function sendEmail(): bool
{
$this->unravel($this->suppress('sent')); $this->unravel($this->suppress('sent'));
$this->generateEmailMessage(); $this->generateEmailMessage();
@ -58,7 +47,8 @@ class w3form {
return false; return false;
} }
private function unravel($toUnravel, $prefix = '') { private function unravel($toUnravel, $prefix = ''): void
{
foreach ($toUnravel as $key => $value) { foreach ($toUnravel as $key => $value) {
if (is_array($value)) { if (is_array($value)) {
$this->unravel($value, $key . ' '); $this->unravel($value, $key . ' ');
@ -86,6 +76,7 @@ class w3form {
} }
private function suppress() { private function suppress() {
$fields = [];
$suppress = func_get_args(); $suppress = func_get_args();
foreach ($_POST as $key => $value) { foreach ($_POST as $key => $value) {
if (array_search($key, $suppress) === false) if (array_search($key, $suppress) === false)
@ -125,7 +116,7 @@ class w3form {
public function formInterpretation(&$form) { public function formInterpretation(&$form) {
$fields = explode('###', $form); $fields = explode('###', $form);
$field = array(); $field = [];
for ($i = 1; $i < count($fields); $i = $i + 2) { for ($i = 1; $i < count($fields); $i = $i + 2) {
$attributte = explode(';', trim($fields[$i])); $attributte = explode(';', trim($fields[$i]));
@ -202,7 +193,7 @@ class w3form {
} }
} }
// show captcha HTML using Securimage::getCaptchaHtml() // show captcha HTML using Securimage::getCaptchaHtml()
$options = array(); $options = [];
$options['input_name'] = 'ct_captcha'; // change name of input element for form post input_text $options['input_name'] = 'ct_captcha'; // change name of input element for form post input_text
$options['input_text'] = mi18n("Zeichen eingeben"); $options['input_text'] = mi18n("Zeichen eingeben");
$options['input_required'] = false; $options['input_required'] = false;
@ -231,7 +222,7 @@ class w3form {
break; break;
case 'select': case 'select':
echo "<select $parameter $style>"; echo "<select $parameter $style>";
for ($i = 0; $i < count($attribute['option']); $i++) { for ($i = 0; $i < (is_countable($attribute['option']) ? count($attribute['option']) : 0); $i++) {
if (!empty($attribute['optionvalue'][$i])) { if (!empty($attribute['optionvalue'][$i])) {
if (!empty($_POST["{$attribute['name']}"]) && $_POST["{$attribute['name']}"] == $attribute['optionvalue'][$i]) { if (!empty($_POST["{$attribute['name']}"]) && $_POST["{$attribute['name']}"] == $attribute['optionvalue'][$i]) {
echo "<option value=\"{$attribute['optionvalue'][$i]}\" selected=\"selected\">{$attribute['option'][$i]}</option>\n"; echo "<option value=\"{$attribute['optionvalue'][$i]}\" selected=\"selected\">{$attribute['option'][$i]}</option>\n";
@ -339,42 +330,42 @@ class w3form {
if (!empty($field['valid'])) { if (!empty($field['valid'])) {
switch ($field['valid']) { switch ($field['valid']) {
case 'textmitumbruch': case 'textmitumbruch':
if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[\n\r,;:\. ÄÖÜäöüß\-\+\$%&\/()=?!\"'\w\d]*$/")))) { if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => "/^[\n\r,;:\. ÄÖÜäöüß\-\+\$%&\/()=?!\"'\w\d]*$/"]])) {
return false; return false;
} }
break; break;
case 'simpletext': case 'simpletext':
if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[\w]*$/i")))) { if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => "/^[\w]*$/i"]])) {
return false; return false;
} }
break; break;
case 'text': case 'text':
if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[,;:\. ÄÖÜäöüß\-\+\$%&\/()=?!\"'\w\d]*$/")))) { if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => "/^[,;:\. ÄÖÜäöüß\-\+\$%&\/()=?!\"'\w\d]*$/"]])) {
return false; return false;
} }
break; break;
case 'phone': case 'phone':
if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^(\(?([\d \-\)\\+\/\(]+){6,}\)?([ .\-–\/]?)([\d]+))$/")))) { if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => "/^(\(?([\d \-\)\\+\/\(]+){6,}\)?([ .\-–\/]?)([\d]+))$/"]])) {
return false; return false;
} }
break; break;
case 'integer': case 'integer':
if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^\d*$/")))) { if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => "/^\d*$/"]])) {
return false; return false;
} }
break; break;
case 'float': case 'float':
if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[+-]?([0-9]*[.])?[0-9]+$/")))) { if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => "/^[+-]?([0-9]*[.])?[0-9]+$/"]])) {
return false; return false;
} }
break; break;
case 'date': case 'date':
if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[0-9]{1,2}.[0-9]{1,2}.[0-9]{2,4}$/")))) { if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => "/^[0-9]{1,2}.[0-9]{1,2}.[0-9]{2,4}$/"]])) {
return false; return false;
} }
break; break;
case 'email': case 'email':
if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[öäüéàèâêîç_a-z0-9-]+(\.[öäüéàèâêîç_a-z0-9-]+)*@[öäüéàèâêîça-z0-9-]+(\.[öäüéàèâêîça-z0-9-]+)*$/")))) { if (!filter_var($sPostFieldValue, FILTER_VALIDATE_REGEXP, ["options" => ["regexp" => "/^[öäüéàèâêîç_a-z0-9-]+(\.[öäüéàèâêîç_a-z0-9-]+)*@[öäüéàèâêîça-z0-9-]+(\.[öäüéàèâêîça-z0-9-]+)*$/"]])) {
return false; return false;
} }
break; break;