X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ffilter%2Fchange%2Fclass_EmailChangeFilter.php;h=bc481dd709fa8af868cdc17017f58f4e535b882b;hp=4e75421e1832f566291a11263478f47440a832b4;hb=a2ec310b333194cfc83f0c2d76309fb5afccace6;hpb=558b417d946a1a6cee5278e86b5ed042afb3aad6 diff --git a/inc/classes/main/filter/change/class_EmailChangeFilter.php b/inc/classes/main/filter/change/class_EmailChangeFilter.php index 4e75421e18..bc481dd709 100644 --- a/inc/classes/main/filter/change/class_EmailChangeFilter.php +++ b/inc/classes/main/filter/change/class_EmailChangeFilter.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class EmailChangeFilter extends BaseFrameworkSystem implements Filterable { +class EmailChangeFilter extends BaseFilter implements Filterable { /** * Protected constructor * @@ -35,12 +35,16 @@ class EmailChangeFilter extends BaseFrameworkSystem implements Filterable { /** * Creates an instance of this filter class * - * @return $filterInstance An instance of this filter class + * @param $controllerInstance An instance of a Controller class + * @return $filterInstance An instance of this filter class */ - public final static function createEmailChangeFilter () { + public final static function createEmailChangeFilter (Controller $controllerInstance) { // Get a new instance $filterInstance = new EmailChangeFilter(); + // Set the controller + $filterInstance->setControllerInstance($controllerInstance); + // Return the instance return $filterInstance; } @@ -94,6 +98,12 @@ class EmailChangeFilter extends BaseFrameworkSystem implements Filterable { return false; } // END - if + // Are email and confirmation empty? + if ((empty($email1)) && (empty($email2))) { + // No email change required! + return true; + } // END - if + // Now, get a user instance for comparison $userInstance = Registry::getRegistry()->getInstance('user'); @@ -101,10 +111,13 @@ class EmailChangeFilter extends BaseFrameworkSystem implements Filterable { $userEmail = $userInstance->getField('email'); // Are they different? - if ($userEmail != $email1) { - // Update the "new_email" field - $this->partialStub("Unfinished part."); + if ($userEmail == $email1) { + // Nothing has been changed is fine... + return true; } // END - if + + // Update the "new_email" field + $this->partialStub("Unfinished part."); } }