Version 4.7.13
This commit is contained in:
1 parent
fd22d99e69
commit
7124a02564
954 files changed
+29277
-59308
No files matched your search
@@ -42,6 +42,7 @@ class _contact extends \IPS\Dispatcher\Controller
|
||||
/* Execute */
|
||||
return parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method
|
||||
*
|
||||
@@ -82,6 +83,28 @@ class _contact extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( !\IPS\Member::loggedIn()->member_id AND \IPS\Settings::i()->contact_email_verify )
|
||||
{
|
||||
$key = \IPS\Login::generateRandomString( 32 );
|
||||
\IPS\Db::i()->insert( 'core_contact_verify', array(
|
||||
'email_address' => $values['email_address'],
|
||||
'contact_data' => json_encode( $values ),
|
||||
'verify_key' => $key
|
||||
), TRUE );
|
||||
|
||||
$email = \IPS\Email::buildFromTemplate( 'core', 'contact_verify', array( $values['email_address'], $key ), \IPS\Email::TYPE_TRANSACTIONAL );
|
||||
$email->send( $values['email_address'] );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( 'OK' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'contact_verify' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->contactVerify();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $extensions as $k => $class )
|
||||
{
|
||||
if ( $handled = $class->handleForm( $values ) )
|
||||
@@ -102,7 +125,63 @@ class _contact extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'contact' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->contact( $form );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function confirm()
|
||||
{
|
||||
/* Show interstitial page to prevent email clients from auto-verifying. */
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\Output::i()->bodyClasses[] = 'ipsLayout_minimal';
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'form', NULL );
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$form->actionButtons[] = \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->button( 'contact_click_to_verify', 'submit', null, 'ipsButton ipsButton_primary ipsButton_fullWidth', array( 'tabindex' => '2', 'accesskey' => 's' ) );
|
||||
$form->hiddenValues['email'] = \IPS\Request::i()->email;
|
||||
$form->hiddenValues['key'] = \IPS\Request::i()->key;
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
try
|
||||
{
|
||||
$verify = \IPS\Db::i()->select( '*', 'core_contact_verify', array( "email_address=?", $values['email'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C435/1', 404, '' );
|
||||
}
|
||||
|
||||
if ( \IPS\Login::compareHashes( $verify['verify_key'], $values['key'] ) === FALSE )
|
||||
{
|
||||
\IPS\Output::i()->error( 'contact_verify_key_mismatch', '2C435/2', 403, '' );
|
||||
}
|
||||
|
||||
/* Send it */
|
||||
$extensions = \IPS\Application::allExtensions( 'core', 'ContactUs', FALSE, 'core', 'InternalEmail', TRUE );
|
||||
|
||||
foreach( $extensions AS $k => $extension )
|
||||
{
|
||||
if ( $extension->handleForm( json_decode( $verify['contact_data'], true ) ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Db::i()->delete( 'core_contact_verify', array( "email_address=?", $values['email'] ) );
|
||||
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\Output::i()->bodyClasses[] = 'ipsLayout_minimal';
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'message_sent' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->contactDone();
|
||||
return;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'contact_verify' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->contactConfirmVerify( $form );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user