mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +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
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
|
||||
* $Revision: 1.35 $
|
||||
* $Date: 2009-09-28 21:00:15 $
|
||||
* $Revision: 1.36 $
|
||||
* $Date: 2009-10-06 18:58:07 $
|
||||
* $Author: e107steved $
|
||||
*
|
||||
*/
|
||||
@@ -66,9 +66,10 @@ if(isset($_POST['updateprefs']))
|
||||
$_POST['siteurl'] = substr($_POST['siteurl'], - 1) == "/" ? $_POST['siteurl'] : $_POST['siteurl']."/";
|
||||
|
||||
// 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;
|
||||
$emessage->add(PRFLAN_211, E_MESSAGE_ERROR);
|
||||
}
|
||||
|
||||
// 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($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'])
|
||||
{
|
||||
$value = $pref_limits[$key]['max'];
|
||||
$emessage->add(str_replace(array('--FIELD--','--VALUE--'),array($key,$value),PRFLAN_212), E_MESSAGE_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* Handler - user-related functions
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/user_handler.php,v $
|
||||
* $Revision: 1.12 $
|
||||
* $Date: 2009-09-28 21:32:00 $
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 2009-10-06 18:58:08 $
|
||||
* $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_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_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_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'),
|
||||
@@ -507,12 +507,16 @@ Following fields auto-filled in code as required:
|
||||
global $e107, $pref;
|
||||
$u_sql = new db;
|
||||
$ret = TRUE;
|
||||
$errMsg = '';
|
||||
if (isset($targetData['data']['user_email']))
|
||||
{
|
||||
$v = trim($targetData['data']['user_email']); // Always check email address if its entered
|
||||
if ($v == '')
|
||||
{
|
||||
$errMsg = ERR_MISSING_VALUE;
|
||||
if (!varsettrue($pref['disable_emailcheck']))
|
||||
{
|
||||
$errMsg = ERR_MISSING_VALUE;
|
||||
}
|
||||
}
|
||||
elseif (!check_email($v))
|
||||
{
|
||||
@@ -528,7 +532,7 @@ Following fields auto-filled in code as required:
|
||||
if ($wc) { $wc = "`banlist_ip`='{$v}' OR ".$wc; }
|
||||
if (($wc === FALSE) || !$e107->check_ban($wc, FALSE, TRUE))
|
||||
{
|
||||
echo "Email banned<br />";
|
||||
// echo "Email banned<br />";
|
||||
$errMsg = ERR_BANNED_EMAIL;
|
||||
}
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@
|
||||
* Handler - general purpose validation functions
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/validator_class.php,v $
|
||||
* $Revision: 1.9 $
|
||||
* $Date: 2009-08-08 23:09:08 $
|
||||
* $Author: marj_nl_fr $
|
||||
* $Revision: 1.10 $
|
||||
* $Date: 2009-10-06 18:58:08 $
|
||||
* $Author: e107steved $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -96,7 +96,10 @@ class validatorClass
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret['errors'][$dest] = ERR_MISSING_VALUE; // No source value
|
||||
if (!varsettrue($defs['fieldOptional']))
|
||||
{
|
||||
$ret['errors'][$dest] = ERR_MISSING_VALUE; // No source value
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -130,9 +133,12 @@ class validatorClass
|
||||
}
|
||||
if (!$errNum && isset($defs['minLength']) && ($tp->uStrLen($value) < $defs['minLength']))
|
||||
{
|
||||
if ($value == '')
|
||||
if ($value == '')
|
||||
{
|
||||
$errNum = ERR_MISSING_VALUE;
|
||||
if (!varsettrue($defs['fieldOptional']))
|
||||
{
|
||||
$errNum = ERR_MISSING_VALUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -307,6 +313,7 @@ class validatorClass
|
||||
$u_sql = new db;
|
||||
$allOK = TRUE;
|
||||
$userID = intval($userID); // Precautionary
|
||||
$errMsg = '';
|
||||
if (!$targetTable) return FALSE;
|
||||
foreach ($targetData['data'] as $f => $v)
|
||||
{
|
||||
@@ -314,7 +321,7 @@ class validatorClass
|
||||
if (isset($definitions[$f]))
|
||||
{
|
||||
$options = $definitions[$f]; // Validation options to use
|
||||
if (isset($options['vetMethod']))
|
||||
if (!varsettrue($options['fieldOptional']) || ($v != ''))
|
||||
{
|
||||
$toDo = explode(',',$options['vetMethod']);
|
||||
foreach ($toDo as $vm)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
@@ -233,7 +233,7 @@ define("LAN_CREATED","Successfully created");
|
||||
define("LAN_CREATED_FAILED","Creation Unsuccessful");
|
||||
define("LAN_DELETED_FAILED","Deletion 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_RESET","Reset");
|
||||
|
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_prefs.php,v $
|
||||
| $Revision: 1.22 $
|
||||
| $Date: 2009-09-28 21:00:17 $
|
||||
| $Revision: 1.23 $
|
||||
| $Date: 2009-10-06 18:58:08 $
|
||||
| $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_209', 'Other Features');
|
||||
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