/**
 * reminder form
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Reminder
 * @author Henry Ruhs
 */
function reminder_form()
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* disable fields if attack blocked */
    if (ATTACK_BLOCKED > 9) {
        $code_disabled = ' disabled="disabled"';
    }
    /* captcha object */
    $captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance());
    $captcha->init();
    /* collect output */
    $output .= '<h2 class="title_content">' . l('reminder') . '</h2>';
    $output .= form_element('form', 'form_reminder', 'js_validate_form form_default form_reminder', '', '', '', 'action="' . REWRITE_ROUTE . 'reminder" method="post"');
    $output .= form_element('fieldset', '', 'set_reminder', '', '', l('reminder_request') . l('point')) . '<ul>';
    $output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', '', l('email'), 'maxlength="50" required="required" autofocus="autofocus"' . $code_disabled) . '</li>';
    /* collect captcha task output */
    $output .= '<li>' . form_element('number', 'task', 'field_text field_note', 'task', '', $captcha->getTask(), 'min="1" max="20" required="required"' . $code_disabled) . '</li>';
    $output .= '</ul></fieldset>';
    /* collect captcha solution output */
    $captchaHash = new Redaxscript\Hash(Redaxscript\Config::getInstance());
    $captchaHash->init($captcha->getSolution());
    $output .= form_element('hidden', '', '', 'solution', $captchaHash->getHash());
    /* collect hidden and button output */
    $output .= form_element('hidden', '', '', 'token', TOKEN);
    $output .= form_element('button', '', 'js_submit button_default', 'reminder_post', l('submit'), '', $code_disabled);
    $output .= '</form>';
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    $_SESSION[ROOT . '/reminder'] = 'visited';
    echo $output;
}
/**
 * login form
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Login
 * @author Henry Ruhs
 */
function login_form()
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* disable fields if attack blocked */
    if (ATTACK_BLOCKED > 9) {
        $code_disabled = ' disabled="disabled"';
    }
    /* captcha object */
    if (s('captcha') > 0) {
        $captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance());
        $captcha->init();
    }
    /* reminder question */
    if (s('reminder') == 1) {
        $legend = anchor_element('internal', '', 'link_legend', l('reminder_question') . l('question_mark'), 'reminder', '', 'rel="nofollow"');
    } else {
        $legend = l('fields_limited') . l('point');
    }
    /* collect output */
    $output .= '<h2 class="title_content">' . l('login') . '</h2>';
    $output .= form_element('form', 'form_login', 'js_validate_form form_default form_login', '', '', '', 'action="' . REWRITE_ROUTE . 'login" method="post"');
    $output .= form_element('fieldset', '', 'set_login', '', '', $legend) . '<ul>';
    $output .= '<li>' . form_element('text', 'user', 'field_text field_note', 'user', '', l('user'), 'maxlength="50" required="required" autofocus="autofocus"' . $code_disabled) . '</li>';
    $output .= '<li>' . form_element('password', 'password', 'js_unmask_password field_text field_note', 'password', '', l('password'), 'maxlength="50" required="required" autocomplete="off"' . $code_disabled) . '</li>';
    /* collect captcha task output */
    if (LOGGED_IN != TOKEN && s('captcha') > 0) {
        $output .= '<li>' . form_element('number', 'task', 'field_text field_note', 'task', '', $captcha->getTask(), 'min="1" max="20" required="required"' . $code_disabled) . '</li>';
    }
    $output .= '</ul></fieldset>';
    /* collect captcha solution output */
    if (s('captcha') > 0) {
        $captchaHash = new Redaxscript\Hash(Redaxscript\Config::getInstance());
        $captchaHash->init($captcha->getSolution());
        if (LOGGED_IN == TOKEN) {
            $output .= form_element('hidden', '', '', 'task', $captchaHash->getRaw());
        }
        $output .= form_element('hidden', '', '', 'solution', $captchaHash->getHash());
    }
    /* collect hidden and button output */
    $output .= form_element('hidden', '', '', 'token', TOKEN);
    $output .= form_element('button', '', 'js_submit button_default', 'login_post', l('submit'), '', $code_disabled);
    $output .= '</form>';
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    $_SESSION[ROOT . '/login'] = '******';
    echo $output;
}
Example #3
0
/**
 * contact form
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function contact_form()
{
    /* disable fields if attack blocked */
    if (ATTACK_BLOCKED > 9) {
        $code_readonly = $code_disabled = ' disabled="disabled"';
    } else {
        if (LOGGED_IN == TOKEN) {
            $author = MY_USER;
            $email = MY_EMAIL;
            $code_readonly = ' readonly="readonly"';
        }
    }
    /* captcha object */
    if (s('captcha') > 0) {
        $captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance());
        $captcha->init();
    }
    /* collect output */
    $output = form_element('form', 'form_contact', 'js_validate_form form_default form_contact', '', '', '', 'method="post"');
    $output .= form_element('fieldset', '', 'set_contact', '', '', l('fields_required') . l('point')) . '<ul>';
    $output .= '<li>' . form_element('text', 'author', 'field_text field_note', 'author', $author, '* ' . l('author'), 'maxlength="50" required="required"' . $code_readonly) . '</li>';
    $output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', $email, '* ' . l('email'), 'maxlength="50" required="required"' . $code_readonly) . '</li>';
    $output .= '<li>' . form_element('url', 'url', 'field_text', 'url', '', l('url'), 'maxlength="50"' . $code_disabled) . '</li>';
    $output .= '<li>' . form_element('textarea', 'text', 'js_auto_resize js_editor_textarea field_textarea field_note', 'text', '', '* ' . l('message'), 'rows="5" cols="100" required="required"' . $code_disabled) . '</li>';
    /* collect captcha task output */
    if (LOGGED_IN != TOKEN && s('captcha') > 0) {
        $output .= '<li>' . form_element('number', 'task', 'field_text field_note', 'task', '', $captcha->getTask(), 'min="1" max="20" required="required"' . $code_disabled) . '</li>';
    }
    $output .= '</ul></fieldset>';
    /* collect captcha solution output */
    if (s('captcha') > 0) {
        if (LOGGED_IN == TOKEN) {
            $output .= form_element('hidden', '', '', 'task', $captcha->getSolution('raw'));
        }
        $output .= form_element('hidden', '', '', 'solution', $captcha->getSolution());
    }
    /* collect hidden and button output */
    $output .= form_element('hidden', '', '', 'token', TOKEN);
    $output .= form_element('button', '', 'js_submit button_default', 'contact_post', l('submit'), '', $code_disabled);
    $output .= '</form>';
    $_SESSION[ROOT . '/contact'] = 'visited';
    echo $output;
}