diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 334ec4827f6..451cd8cd81c 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -300,7 +300,7 @@ if (empty($reshook)) { $object->gender = trim(GETPOST("gender", 'alphanohtml')); $object->login = trim(GETPOST("login", 'alphanohtml')); if (GETPOSTISSET('pass')) { - $object->pass = trim(GETPOST("pass", 'none')); // For password, we must use 'none' + $object->pass = trim(GETPOST("pass", 'password')); // For password, we must use 'none' } $object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated @@ -465,10 +465,10 @@ if (empty($reshook)) { $phone = GETPOST("phone", 'alpha'); $phone_perso = GETPOST("phone_perso", 'alpha'); $phone_mobile = GETPOST("phone_mobile", 'alpha'); - $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); + $email = preg_replace('/\s+/', '', GETPOST("member_email", 'aZ09arobase')); $url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL)); $login = GETPOST("member_login", 'alphanohtml'); - $pass = GETPOST("password", 'none'); // For password, we use 'none' + $pass = GETPOST("password", 'password'); // For password, we use 'none' $photo = GETPOST("photo", 'alphanohtml'); $morphy = GETPOST("morphy", 'alphanohtml'); $public = GETPOST("public", 'alphanohtml'); @@ -1230,7 +1230,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Password if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { - print ''.$langs->trans("Password").''; + print ''.$langs->trans("Password").''; } // Type diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index 6d18833819d..162144c8192 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -131,7 +131,7 @@ if (!getDolGlobalString('ASTERISK_MAX_RETRY')) { $login = GETPOST('login', 'alphanohtml'); -$password = GETPOST('password', 'none'); +$password = GETPOST('password', 'password'); $caller = GETPOST('caller', 'alphanohtml'); $called = GETPOST('called', 'alphanohtml'); diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 45e630799b8..b06ba8834e9 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -156,7 +156,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { $object->$key = '(PROV)'; } if ($key == 'pass_crypted') { - $object->pass = GETPOST("pass", "none"); + $object->pass = GETPOST("pass", "password"); // TODO Manadatory for password not yet managed } else { if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) { diff --git a/htdocs/core/ajax/editinline.php b/htdocs/core/ajax/editinline.php index 4d4fbe74e17..c7e9c606115 100644 --- a/htdocs/core/ajax/editinline.php +++ b/htdocs/core/ajax/editinline.php @@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; $action = GETPOST('action', 'alpha'); $website_ref = GETPOST('website_ref'); $page_id = GETPOST('page_id'); -$content = GETPOST('content', 'none'); +$content = GETPOST('content', 'restricthtml'); $element_id = GETPOST('element_id'); $element_type = GETPOST('element_type'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e69cee2c049..1a004d1d818 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -729,8 +729,8 @@ function GETPOSTISARRAY($paramname, $method = 0) * * @param string $paramname Name of parameter to found * @param string $check Type of check - * ''=no check (deprecated) - * 'none'=no check (only for param that should have very rich content like passwords) + * '' or 'none'=no check (deprecated) + * 'password'=allow characters for a password * 'array', 'array:restricthtml' or 'array:aZ09' to check it's an array * 'int'=check it's numeric (integer or float) * 'intcomma'=check it's integer+comma ('1,2,3,4...') @@ -1157,6 +1157,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options // Check is done after replacement switch ($check) { case 'none': + case 'password': break; case 'int': // Check param is a numeric value (integer but also float or hexadecimal) if (!is_numeric($out)) { diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 792d3ac7d0c..e360e1476ce 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -47,13 +47,13 @@ $main_data_dir = GETPOST('main_data_dir') ? GETPOST('main_data_dir') : (empty($a $main_url = GETPOST('main_url') ? GETPOST('main_url') : (empty($argv[5]) ? '' : $argv[5]); // Database login information $userroot = GETPOST('db_user_root', 'alpha') ? GETPOST('db_user_root', 'alpha') : (empty($argv[6]) ? '' : $argv[6]); -$passroot = GETPOST('db_pass_root', 'none') ? GETPOST('db_pass_root', 'none') : (empty($argv[7]) ? '' : $argv[7]); +$passroot = GETPOST('db_pass_root', 'password') ? GETPOST('db_pass_root', 'password') : (empty($argv[7]) ? '' : $argv[7]); // Database server $db_type = GETPOST('db_type', 'aZ09') ? GETPOST('db_type', 'aZ09') : (empty($argv[8]) ? '' : $argv[8]); $db_host = GETPOST('db_host', 'alpha') ? GETPOST('db_host', 'alpha') : (empty($argv[9]) ? '' : $argv[9]); $db_name = GETPOST('db_name', 'aZ09') ? GETPOST('db_name', 'aZ09') : (empty($argv[10]) ? '' : $argv[10]); $db_user = GETPOST('db_user', 'alpha') ? GETPOST('db_user', 'alpha') : (empty($argv[11]) ? '' : $argv[11]); -$db_pass = GETPOST('db_pass', 'none') ? GETPOST('db_pass', 'none') : (empty($argv[12]) ? '' : $argv[12]); +$db_pass = GETPOST('db_pass', 'password') ? GETPOST('db_pass', 'password') : (empty($argv[12]) ? '' : $argv[12]); $db_port = GETPOSTINT('db_port') ? GETPOSTINT('db_port') : (empty($argv[13]) ? '' : $argv[13]); $db_prefix = GETPOST('db_prefix', 'aZ09') ? GETPOST('db_prefix', 'aZ09') : (empty($argv[14]) ? '' : $argv[14]); $db_create_database = GETPOST('db_create_database', 'alpha') ? GETPOST('db_create_database', 'alpha') : (empty($argv[15]) ? '' : $argv[15]); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index decbc7210f6..474d0406d5d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -873,7 +873,7 @@ if (!defined('NOLOGIN')) { } // TODO Remove use of $_COOKIE['login_dolibarr'] ? Replace $usertotest = with $usertotest = GETPOST("username", "alpha", $allowedmethodtopostusername); $usertotest = (!empty($_COOKIE['login_dolibarr']) ? preg_replace('/[^a-zA-Z0-9_@\-\.]/', '', $_COOKIE['login_dolibarr']) : GETPOST("username", "alpha", $allowedmethodtopostusername)); - $passwordtotest = GETPOST('password', 'none', $allowedmethodtopostusername); + $passwordtotest = GETPOST('password', 'password', $allowedmethodtopostusername); $entitytotest = (GETPOSTINT('entity') ? GETPOSTINT('entity') : (!empty($conf->entity) ? $conf->entity : 1)); // Define if we received the correct data to go into the test of the login with the checkLoginPassEntity(). diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 99a9927990a..eb73c037eea 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -243,10 +243,10 @@ if (empty($reshook) && $action == 'add') { if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && empty(GETPOST('email'))) { $error++; $errmsg .= $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Email'))."
\n"; - } elseif (GETPOST("email") && !isValidEmail(GETPOST("email"))) { + } elseif (GETPOST("email", "aZ09arobase") && !isValidEmail(GETPOST("email", "aZ09arobase"))) { $langs->load('errors'); $error++; - $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email", "aZ09arobase"))."
\n"; } $birthday = dol_mktime(GETPOSTINT("birthhour"), GETPOSTINT("birthmin"), GETPOSTINT("birthsec"), GETPOSTINT("birthmonth"), GETPOSTINT("birthday"), GETPOSTINT("birthyear")); if (GETPOST("birthmonth") && empty($birthday)) { @@ -278,6 +278,7 @@ if (empty($reshook) && $action == 'add') { // E-mail looks OK and login does not exist $adh = new Adherent($db); $adh->statut = -1; + $adh->status = -1; $adh->public = $public; $adh->firstname = GETPOST('firstname'); $adh->lastname = GETPOST('lastname'); @@ -287,10 +288,10 @@ if (empty($reshook) && $action == 'add') { $adh->address = GETPOST('address'); $adh->zip = GETPOST('zipcode'); $adh->town = GETPOST('town'); - $adh->email = GETPOST('email'); + $adh->email = GETPOST('email', 'aZ09arobase'); if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { $adh->login = GETPOST('login'); - $adh->pass = GETPOST('pass1'); + $adh->pass = GETPOST('pass1', 'password'); } $adh->photo = GETPOST('photo'); $adh->country_id = getDolGlobalInt("MEMBER_NEWFORM_FORCECOUNTRYCODE", GETPOSTINT('country_id')); @@ -632,7 +633,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR // EMail print ''.$langs->trans("Email").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? ' *' : '').''; //print img_picto('', 'email', 'class="pictofixedwidth"'); - print ''."\n"; + print ''."\n"; // Login if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { @@ -809,7 +810,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR // Display Captcha code if is enabled if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/public/webportal/webportal.main.inc.php b/htdocs/public/webportal/webportal.main.inc.php index de198b4a494..6e62e750dc5 100644 --- a/htdocs/public/webportal/webportal.main.inc.php +++ b/htdocs/public/webportal/webportal.main.inc.php @@ -136,7 +136,7 @@ if (!defined('WEBPORTAL_NOLOGIN') && !empty($context->controllerInstance->access if ($action == 'login') { $login = GETPOST('login', 'alphanohtml'); - $password = GETPOST('password', 'none'); + $password = GETPOST('password', 'password'); // $security_code = GETPOST('security_code', 'alphanohtml'); if (empty($login)) { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 532258aaca6..a17d32c5f58 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -349,8 +349,8 @@ if (empty($reshook)) { $id = $object->create($user); if ($id > 0) { $resPass = 0; - if (GETPOST('password', 'none')) { - $resPass = $object->setPassword($user, GETPOST('password', 'none')); + if (GETPOST('password', 'password')) { + $resPass = $object->setPassword($user, GETPOST('password', 'password')); } if (is_int($resPass) && $resPass < 0) { $langs->load("errors"); @@ -438,7 +438,7 @@ if (empty($reshook)) { } $object->gender = GETPOST("gender", 'aZ09'); if ($caneditpasswordandsee) { - $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields + $object->pass = GETPOST("password", 'password'); } if ($caneditpasswordandsee || $user->hasRight("api", "apikey", "generate")) { $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key; @@ -658,10 +658,10 @@ if (empty($reshook)) { $object->fetch($id); - if (GETPOST("password", "none")) { // If pass is empty, we do not change it. + if (GETPOST("password", "password")) { // If pass is empty, we do not change it. $object->oldcopy = clone $object; - $ret = $object->setPassword($user, GETPOST("password", "none")); + $ret = $object->setPassword($user, GETPOST("password", "password")); if (is_int($ret) && $ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 311a49fd352..4c0c2038f83 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1926,7 +1926,7 @@ class User extends CommonObject $this->db->commit(); return $this->id; } else { - // $this->error deja positionne + // $this->error was already set $this->db->rollback(); return -2; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ad0522a4923..5c9fc327241 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1152,7 +1152,7 @@ if ($action == 'addcontainer' && $usercanedit) { $objectpage->image = GETPOST('WEBSITE_IMAGE', 'alpha'); $objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml')); $objectpage->allowed_in_frames = GETPOST('WEBSITE_ALLOWED_IN_FRAMES', 'aZ09'); - $objectpage->htmlheader = GETPOST('htmlheader', 'none'); + $objectpage->htmlheader = GETPOST('htmlheader', 'none'); // Must accept tags like '