mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 22:27:34 +02:00
Handle case where an email address is optional, plus better error reporting
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
* Administration - Site Preferences
|
* Administration - Site Preferences
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
|
||||||
* $Revision: 1.35 $
|
* $Revision: 1.36 $
|
||||||
* $Date: 2009-09-28 21:00:15 $
|
* $Date: 2009-10-06 18:58:07 $
|
||||||
* $Author: e107steved $
|
* $Author: e107steved $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -66,9 +66,10 @@ if(isset($_POST['updateprefs']))
|
|||||||
$_POST['siteurl'] = substr($_POST['siteurl'], - 1) == "/" ? $_POST['siteurl'] : $_POST['siteurl']."/";
|
$_POST['siteurl'] = substr($_POST['siteurl'], - 1) == "/" ? $_POST['siteurl'] : $_POST['siteurl']."/";
|
||||||
|
|
||||||
// If email verification or Email/Password Login Method - email address is required!
|
// If email verification or Email/Password Login Method - email address is required!
|
||||||
if($_POST['user_reg_veri'] == 1 && $_POST['allowEmailLogin'] == 1)
|
if (($_POST['user_reg_veri'] == 1 || $_POST['allowEmailLogin'] == 1) && $_POST['disable_emailcheck'])
|
||||||
{
|
{
|
||||||
$_POST['disable_emailcheck'] = 0;
|
$_POST['disable_emailcheck'] = 0;
|
||||||
|
$emessage->add(PRFLAN_211, E_MESSAGE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table of range checking values - min and max for numerics. Only do the important ones
|
// Table of range checking values - min and max for numerics. Only do the important ones
|
||||||
@@ -90,9 +91,15 @@ if(isset($_POST['updateprefs']))
|
|||||||
if(is_numeric($value))
|
if(is_numeric($value))
|
||||||
{
|
{
|
||||||
if($value < $pref_limits[$key]['min'])
|
if($value < $pref_limits[$key]['min'])
|
||||||
|
{
|
||||||
$value = $pref_limits[$key]['min'];
|
$value = $pref_limits[$key]['min'];
|
||||||
|
$emessage->add(str_replace(array('--FIELD--','--VALUE--'),array($key,$value),PRFLAN_213), E_MESSAGE_WARNING);
|
||||||
|
}
|
||||||
if($value > $pref_limits[$key]['max'])
|
if($value > $pref_limits[$key]['max'])
|
||||||
|
{
|
||||||
$value = $pref_limits[$key]['max'];
|
$value = $pref_limits[$key]['max'];
|
||||||
|
$emessage->add(str_replace(array('--FIELD--','--VALUE--'),array($key,$value),PRFLAN_212), E_MESSAGE_WARNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* Handler - user-related functions
|
* Handler - user-related functions
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/user_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/user_handler.php,v $
|
||||||
* $Revision: 1.12 $
|
* $Revision: 1.13 $
|
||||||
* $Date: 2009-09-28 21:32:00 $
|
* $Date: 2009-10-06 18:58:08 $
|
||||||
* $Author: e107steved $
|
* $Author: e107steved $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -93,7 +93,7 @@ class UserHandler
|
|||||||
'user_password' => array('niceName'=> LAN_USER_05, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'password1', 'dataType' => 2, 'minLength' => varset($pref['signup_pass_len'],1)),
|
'user_password' => array('niceName'=> LAN_USER_05, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'password1', 'dataType' => 2, 'minLength' => varset($pref['signup_pass_len'],1)),
|
||||||
'user_sess' => array('niceName'=> LAN_USER_06, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'stripChars' => "#\"|'|(|)#", 'dbClean' => 'image', 'imagePath' => e_FILE.'public/avatars/', 'maxHeight' => varset($pref['im_height'], 100), 'maxWidth' => varset($pref['im_width'], 120)), // Photo
|
'user_sess' => array('niceName'=> LAN_USER_06, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'stripChars' => "#\"|'|(|)#", 'dbClean' => 'image', 'imagePath' => e_FILE.'public/avatars/', 'maxHeight' => varset($pref['im_height'], 100), 'maxWidth' => varset($pref['im_width'], 120)), // Photo
|
||||||
'user_image' => array('niceName'=> LAN_USER_07, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'image', 'stripChars' => "#\"|'|(|)#", 'dbClean' => 'avatar', 'maxHeight' => varset($pref['im_height'], 100), 'maxWidth' => varset($pref['im_width'], 120)), // Avatar
|
'user_image' => array('niceName'=> LAN_USER_07, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'image', 'stripChars' => "#\"|'|(|)#", 'dbClean' => 'avatar', 'maxHeight' => varset($pref['im_height'], 100), 'maxWidth' => varset($pref['im_width'], 120)), // Avatar
|
||||||
'user_email' => array('niceName'=> LAN_USER_08, 'fieldType' => 'string', 'vetMethod' => '1,3', 'vetParam' => '', 'srcName' => 'email', 'dbClean' => 'toDB'),
|
'user_email' => array('niceName'=> LAN_USER_08, 'fieldType' => 'string', 'vetMethod' => '1,3', 'vetParam' => '', 'fieldOptional' => varset($pref['disable_emailcheck'],0), 'srcName' => 'email', 'dbClean' => 'toDB'),
|
||||||
'user_signature' => array('niceName'=> LAN_USER_09, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'signature', 'dbClean' => 'toDB'),
|
'user_signature' => array('niceName'=> LAN_USER_09, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'signature', 'dbClean' => 'toDB'),
|
||||||
'user_hideemail' => array('niceName'=> LAN_USER_10, 'fieldType' => 'int', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'hideemail', 'dbClean' => 'intval'),
|
'user_hideemail' => array('niceName'=> LAN_USER_10, 'fieldType' => 'int', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'hideemail', 'dbClean' => 'intval'),
|
||||||
'user_xup' => array('niceName'=> LAN_USER_11, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'user_xup', 'dbClean' => 'toDB'),
|
'user_xup' => array('niceName'=> LAN_USER_11, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'user_xup', 'dbClean' => 'toDB'),
|
||||||
@@ -507,13 +507,17 @@ Following fields auto-filled in code as required:
|
|||||||
global $e107, $pref;
|
global $e107, $pref;
|
||||||
$u_sql = new db;
|
$u_sql = new db;
|
||||||
$ret = TRUE;
|
$ret = TRUE;
|
||||||
|
$errMsg = '';
|
||||||
if (isset($targetData['data']['user_email']))
|
if (isset($targetData['data']['user_email']))
|
||||||
{
|
{
|
||||||
$v = trim($targetData['data']['user_email']); // Always check email address if its entered
|
$v = trim($targetData['data']['user_email']); // Always check email address if its entered
|
||||||
if ($v == '')
|
if ($v == '')
|
||||||
|
{
|
||||||
|
if (!varsettrue($pref['disable_emailcheck']))
|
||||||
{
|
{
|
||||||
$errMsg = ERR_MISSING_VALUE;
|
$errMsg = ERR_MISSING_VALUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
elseif (!check_email($v))
|
elseif (!check_email($v))
|
||||||
{
|
{
|
||||||
$errMsg = ERR_INVALID_EMAIL;
|
$errMsg = ERR_INVALID_EMAIL;
|
||||||
@@ -528,7 +532,7 @@ Following fields auto-filled in code as required:
|
|||||||
if ($wc) { $wc = "`banlist_ip`='{$v}' OR ".$wc; }
|
if ($wc) { $wc = "`banlist_ip`='{$v}' OR ".$wc; }
|
||||||
if (($wc === FALSE) || !$e107->check_ban($wc, FALSE, TRUE))
|
if (($wc === FALSE) || !$e107->check_ban($wc, FALSE, TRUE))
|
||||||
{
|
{
|
||||||
echo "Email banned<br />";
|
// echo "Email banned<br />";
|
||||||
$errMsg = ERR_BANNED_EMAIL;
|
$errMsg = ERR_BANNED_EMAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
* Handler - general purpose validation functions
|
* Handler - general purpose validation functions
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/validator_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/validator_class.php,v $
|
||||||
* $Revision: 1.9 $
|
* $Revision: 1.10 $
|
||||||
* $Date: 2009-08-08 23:09:08 $
|
* $Date: 2009-10-06 18:58:08 $
|
||||||
* $Author: marj_nl_fr $
|
* $Author: e107steved $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -95,10 +95,13 @@ class validatorClass
|
|||||||
} //...otherwise don't add the value at all
|
} //...otherwise don't add the value at all
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (!varsettrue($defs['fieldOptional']))
|
||||||
{
|
{
|
||||||
$ret['errors'][$dest] = ERR_MISSING_VALUE; // No source value
|
$ret['errors'][$dest] = ERR_MISSING_VALUE; // No source value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ // Got a field we want, and some data to validate here
|
{ // Got a field we want, and some data to validate here
|
||||||
$value = $sourceFields[$src];
|
$value = $sourceFields[$src];
|
||||||
@@ -131,9 +134,12 @@ class validatorClass
|
|||||||
if (!$errNum && isset($defs['minLength']) && ($tp->uStrLen($value) < $defs['minLength']))
|
if (!$errNum && isset($defs['minLength']) && ($tp->uStrLen($value) < $defs['minLength']))
|
||||||
{
|
{
|
||||||
if ($value == '')
|
if ($value == '')
|
||||||
|
{
|
||||||
|
if (!varsettrue($defs['fieldOptional']))
|
||||||
{
|
{
|
||||||
$errNum = ERR_MISSING_VALUE;
|
$errNum = ERR_MISSING_VALUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$errNum = ERR_TOO_SHORT;
|
$errNum = ERR_TOO_SHORT;
|
||||||
@@ -307,6 +313,7 @@ class validatorClass
|
|||||||
$u_sql = new db;
|
$u_sql = new db;
|
||||||
$allOK = TRUE;
|
$allOK = TRUE;
|
||||||
$userID = intval($userID); // Precautionary
|
$userID = intval($userID); // Precautionary
|
||||||
|
$errMsg = '';
|
||||||
if (!$targetTable) return FALSE;
|
if (!$targetTable) return FALSE;
|
||||||
foreach ($targetData['data'] as $f => $v)
|
foreach ($targetData['data'] as $f => $v)
|
||||||
{
|
{
|
||||||
@@ -314,7 +321,7 @@ class validatorClass
|
|||||||
if (isset($definitions[$f]))
|
if (isset($definitions[$f]))
|
||||||
{
|
{
|
||||||
$options = $definitions[$f]; // Validation options to use
|
$options = $definitions[$f]; // Validation options to use
|
||||||
if (isset($options['vetMethod']))
|
if (!varsettrue($options['fieldOptional']) || ($v != ''))
|
||||||
{
|
{
|
||||||
$toDo = explode(',',$options['vetMethod']);
|
$toDo = explode(',',$options['vetMethod']);
|
||||||
foreach ($toDo as $vm)
|
foreach ($toDo as $vm)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id: lan_admin.php,v 1.28 2009-09-06 20:04:03 e107coders Exp $
|
* $Id: lan_admin.php,v 1.29 2009-10-06 18:58:08 e107steved Exp $
|
||||||
*
|
*
|
||||||
* Admin Language File
|
* Admin Language File
|
||||||
*/
|
*/
|
||||||
@@ -233,7 +233,7 @@ define("LAN_CREATED","Successfully created");
|
|||||||
define("LAN_CREATED_FAILED","Creation Unsuccessful");
|
define("LAN_CREATED_FAILED","Creation Unsuccessful");
|
||||||
define("LAN_DELETED_FAILED","Deletion Unsuccessful");
|
define("LAN_DELETED_FAILED","Deletion Unsuccessful");
|
||||||
define("LAN_UPDATED_FAILED","Update Unsuccessful");
|
define("LAN_UPDATED_FAILED","Update Unsuccessful");
|
||||||
define("LAN_NO_CHANGE","Update unsuccessful as no changes were made.");
|
define("LAN_NO_CHANGE","Nothing updated as no changes were made.");
|
||||||
define("LAN_TRY_AGAIN","Please try again.");
|
define("LAN_TRY_AGAIN","Please try again.");
|
||||||
|
|
||||||
define("LAN_RESET","Reset");
|
define("LAN_RESET","Reset");
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_prefs.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_prefs.php,v $
|
||||||
| $Revision: 1.22 $
|
| $Revision: 1.23 $
|
||||||
| $Date: 2009-09-28 21:00:17 $
|
| $Date: 2009-10-06 18:58:08 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -225,6 +225,9 @@ define("PRFLAN_207", "Members only-mode will be disabled for URLs that match any
|
|||||||
define('PRFLAN_208', 'User class which can email links to items on site');
|
define('PRFLAN_208', 'User class which can email links to items on site');
|
||||||
define('PRFLAN_209', 'Other Features');
|
define('PRFLAN_209', 'Other Features');
|
||||||
define('PRFLAN_210', 'Comments/Posting');
|
define('PRFLAN_210', 'Comments/Posting');
|
||||||
|
define('PRFLAN_211', 'Cannot make email address optional if required for validation or login');
|
||||||
|
define('PRFLAN_212', 'Value for --FIELD-- too high - changed to --VALUE--');
|
||||||
|
define('PRFLAN_213', 'Value for --FIELD-- too low - changed to --VALUE--');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user