getByEmailIsValidKey( $key ); if ( $ulf->getRecordCount() == 1 ) { Debug::Text( 'FOUND Email Validation key! Email: ' . $email, __FILE__, __LINE__, __METHOD__, 10 ); $valid_key = true; $ttsc = new TimeTrexSoapClient(); $user_obj = $ulf->getCurrent(); if ( $user_obj->getWorkEmailIsValidKey() == $key && $user_obj->getWorkEmail() == $email ) { $user_obj->setWorkEmailIsValidKey( '' ); //$user_obj->setWorkEmailIsValidDate( '' ); //Keep date so we know when the address was validated last. $user_obj->setWorkEmailIsValid( true ); $remote_validation_result = $ttsc->validateEmail( $user_obj->getWorkEmail() ); } else if ( $user_obj->getHomeEmailIsValidKey() == $key && $user_obj->getHomeEmail() == $email ) { $user_obj->setHomeEmailIsValidKey( '' ); //$user_obj->setHomeEmailIsValidDate( '' ); //Keep date so we know when the address was validated last. $user_obj->setHomeEmailIsValid( true ); $remote_validation_result = $ttsc->validateEmail( $user_obj->getHomeEmail() ); } else { $valid_key = false; } if ( $valid_key == true && $user_obj->isValid() ) { $user_obj->Save( false ); Debug::Text( 'Email validation is succesful!', __FILE__, __LINE__, __METHOD__, 10 ); TTLog::addEntry( $user_obj->getId(), 500, TTi18n::gettext( 'Validated email address' ) . ': ' . $email, $user_obj->getId(), 'users' ); Redirect::Page( URLBuilder::getURL( [ 'email_confirmed' => 1, 'email' => $email ], Environment::getBaseURL() . 'html5/ConfirmEmail.php' ) ); break; } else { Debug::Text( 'aDID NOT FIND email validation key!', __FILE__, __LINE__, __METHOD__, 10 ); $email_confirmed = false; } } else { Debug::Text( 'bDID NOT FIND email validation key!', __FILE__, __LINE__, __METHOD__, 10 ); $email_confirmed = false; } break; default: //Make sure we don't allow malicious users to use some long email address like: //"This is the FBI, you have been fired if you don't..." if ( $validator->isEmail( 'email', $email, TTi18n::getText( 'Invalid confirmation key' ) ) == false ) { $email = null; $email_confirmed = false; } break; } $BASE_URL = './'; $META_TITLE = TTi18n::getText( 'Confirm Email' ); require( '../../includes/Header.inc.php' ); ?>