Completed
Branch master (78c2af)
by Pierre-Henry
52:17 queued 17:37
created

app/system/core/forms/ResendActivationCoreForm.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 15 and the first side effect is on line 10.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * @author         Pierre-Henry Soria <[email protected]>
4
 * @copyright      (c) 2012-2017, Pierre-Henry Soria. All Rights Reserved.
5
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
6
 * @package        PH7 / App / System / Core / Form
7
 */
8
namespace PH7;
9
10
defined('PH7') or exit('Restricted access');
11
12
use PH7\Framework\Mvc\Model\DbConfig;
13
14
/** For "user" and "affiliate" module **/
15
class ResendActivationCoreForm
16
{
17
    public static function display($sTable = 'Members')
18
    {
19
        // Show the form only if the activation mode is activated by email
20
        $sMod = ($sTable == 'Affiliates') ? 'aff' : 'user';
21
        if (DbConfig::getSetting($sMod . 'ActivationType') == 2)
22
        {
23
            if (isset($_POST['submit_resend_activation']))
24
            {
25
                if (\PFBC\Form::isValid($_POST['submit_resend_activation']))
26
                    new ResendActivationCoreFormProcess($sTable);
27
28
                Framework\Url\Header::redirect();
29
            }
30
31
            $oForm = new \PFBC\Form('form_resend_activation');
32
            $oForm->configure(array('action' => '' ));
33
            $oForm->addElement(new \PFBC\Element\Hidden('submit_resend_activation', 'form_resend_activation'));
34
            $oForm->addElement(new \PFBC\Element\Token('resend_activation'));
35
            $oForm->addElement(new \PFBC\Element\Email(t('Your Email:'), 'mail', array('id'=>'email','onblur' =>'CValid(this.value, this.id,\'user\',\'' . $sTable . '\')','required' =>1)));
36
            $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error email"></span>'));
37
            $oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('id'=>'ccaptcha','onkeyup'=>'CValid(this.value, this.id)','description'=>t('Enter the code above:'))));
38
            $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error ccaptcha"></span>'));
39
            $oForm->addElement(new \PFBC\Element\Button(t('Send Activation'),'submit', array('icon'=>'key')));
40
            $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="'.PH7_URL_STATIC.PH7_JS.'validate.js"></script>'));
41
            $oForm->render();
42
        }
43
    }
44
}
45