Example #1
0
 /**
  * The UI for recommending the site.
  *
  * @return tempcode	The UI.
  */
 function gui()
 {
     require_code('form_templates');
     global $EXTRA_HEAD;
     $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />');
     // XHTMLXHTML
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'page_title';
     $NON_CANONICAL_PARAMS[] = 'subject';
     $NON_CANONICAL_PARAMS[] = 's_message';
     $NON_CANONICAL_PARAMS[] = 'from';
     $NON_CANONICAL_PARAMS[] = 'title';
     $NON_CANONICAL_PARAMS[] = 'ocp';
     $page_title = get_param('page_title', NULL, true);
     $submit_name = !is_null($page_title) ? make_string_tempcode($page_title) : do_lang_tempcode('SEND');
     $post_url = build_url(array('page' => '_SELF', 'type' => 'actual'), '_SELF', NULL, true);
     $hidden = new ocp_tempcode();
     $name = post_param('name', is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_username(get_member()));
     $recommender_email_address = post_param('recommender_email_address', $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member()));
     $fields = new ocp_tempcode();
     $fields->attach(form_input_line(do_lang_tempcode('YOUR_NAME'), '', 'name', $name, true));
     $fields->attach(form_input_email(do_lang_tempcode('YOUR_EMAIL_ADDRESS'), '', 'recommender_email_address', $recommender_email_address, true));
     $already = array();
     foreach ($_POST as $key => $email_address) {
         if (substr($key, 0, 14) != 'email_address_') {
             continue;
         }
         if (get_magic_quotes_gpc()) {
             $email_address = stripslashes($email_address);
         }
         $already[] = $email_address;
     }
     if (is_guest()) {
         $fields->attach(form_input_email(do_lang_tempcode('FRIEND_EMAIL_ADDRESS'), '', 'email_address_0', array_key_exists(0, $already) ? $already[0] : '', true));
     } else {
         $fields->attach(form_input_line_multi(do_lang_tempcode('FRIEND_EMAIL_ADDRESS'), do_lang_tempcode('THEIR_ADDRESS'), 'email_address_', $already, 1, NULL, 'email'));
     }
     if (may_use_invites() && get_forum_type() == 'ocf' && !is_guest()) {
         $invites = get_num_invites(get_member());
         if ($invites > 0) {
             require_lang('ocf');
             $invite = count($_POST) == 0 ? true : post_param_integer('invite', 0) == 1;
             $fields->attach(form_input_tick(do_lang_tempcode('USE_INVITE'), do_lang_tempcode('USE_INVITE_DESCRIPTION', $GLOBALS['FORUM_DRIVER']->is_super_admin(get_member()) ? do_lang('NA_EM') : integer_format($invites)), 'invite', $invite));
         }
     }
     $message = post_param('message', NULL);
     $subject = get_param('subject', do_lang('RECOMMEND_MEMBER_SUBJECT', get_site_name()), true);
     if (is_null($message)) {
         $message = get_param('s_message', '', true);
         if ($message == '') {
             $from = get_param('from', NULL, true);
             if (!is_null($from)) {
                 $resource_title = get_param('title', '', true);
                 if ($resource_title == '') {
                     $downloaded_at_link = http_download_file($from, 3000, false);
                     if (is_string($downloaded_at_link)) {
                         $matches = array();
                         if (preg_match('#\\s*<title[^>]*\\s*>\\s*(.*)\\s*\\s*<\\s*/title\\s*>#mi', $downloaded_at_link, $matches) != 0) {
                             $resource_title = trim(str_replace('&ndash;', '-', str_replace('&mdash;', '-', @html_entity_decode($matches[1], ENT_QUOTES, get_charset()))));
                             $resource_title = preg_replace('#^' . str_replace('#', '\\#', preg_quote(get_site_name())) . ' - #', '', $resource_title);
                             $resource_title = preg_replace('#\\s+[^\\d\\s][^\\d\\s]?[^\\d\\s]?\\s+' . str_replace('#', '\\#', preg_quote(get_site_name())) . '$#i', '', $resource_title);
                         }
                     }
                 }
                 if ($resource_title == '') {
                     $resource_title = do_lang('THIS');
                     // Could not find at all, so say 'this'
                 } else {
                     $subject = get_param('subject', do_lang('RECOMMEND_MEMBER_SUBJECT_SPECIFIC', get_site_name(), $resource_title), true);
                 }
                 $message = do_lang('FOUND_THIS_ON', get_site_name(), comcode_escape($from), comcode_escape($resource_title));
             }
         }
         if (get_param_integer('ocp', 0) == 1) {
             $message = do_lang('RECOMMEND_OCPORTAL');
         }
     }
     $text = is_null($page_title) ? do_lang_tempcode('RECOMMEND_SITE_TEXT') : new ocp_tempcode();
     if (!is_null(get_param('from', NULL, true))) {
         if (is_null($page_title)) {
             $title = get_page_title('RECOMMEND_LINK');
         } else {
             $title = get_page_title($page_title, false);
         }
         $submit_name = do_lang_tempcode('SEND');
         $text = do_lang_tempcode('RECOMMEND_AUTO_TEXT', get_site_name());
         $need_message = true;
     } else {
         if (is_null($page_title)) {
             $title = get_page_title('_RECOMMEND_SITE', true, array(escape_html(get_site_name())));
         } else {
             $title = get_page_title($page_title, false);
         }
         $hidden->attach(form_input_hidden('wrap_message', '1'));
         $need_message = false;
     }
     //add an upload CSV contacts file field
     $_help_url = build_url(array('page' => 'recommend_help'), get_page_zone('recommend_help'));
     $help_url = $_help_url->evaluate();
     if (get_value('disable_csv_recommend') !== '1' && !is_guest()) {
         $fields->attach(form_input_upload(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('UPLOAD')), do_lang_tempcode('DESCRIPTION_UPLOAD_CSV_FILE', escape_html($help_url)), 'upload', false, NULL, NULL, false));
     }
     handle_max_file_size($hidden);
     $fields->attach(form_input_line(do_lang_tempcode('SUBJECT'), '', 'subject', $subject, true));
     $fields->attach(form_input_text_comcode(do_lang_tempcode('MESSAGE'), do_lang_tempcode('RECOMMEND_SUP_MESSAGE'), 'message', $message, $need_message));
     if (addon_installed('captcha')) {
         require_code('captcha');
         if (use_captcha()) {
             $fields->attach(form_input_captcha());
             $text->attach(' ');
             $text->attach(do_lang_tempcode('FORM_TIME_SECURITY'));
         }
     }
     $hidden->attach(form_input_hidden('comcode__message', '1'));
     if (get_value('disable_csv_recommend') !== '1' && !is_guest()) {
         $javascript = 'standardAlternateFields(\'upload\',\'email_address_0\');';
     } else {
         $javascript = '';
     }
     $javascript .= function_exists('captcha_ajax_check') ? captcha_ajax_check() : '';
     return do_template('FORM_SCREEN', array('_GUID' => '08a538ca8d78597b0417f464758a59fd', 'JAVASCRIPT' => $javascript, 'SKIP_VALIDATION' => true, 'TITLE' => $title, 'HIDDEN' => $hidden, 'FIELDS' => $fields, 'URL' => $post_url, 'SUBMIT_NAME' => $submit_name, 'TEXT' => $text));
 }
Example #2
0
 /**
  * The UI to contact a member.
  *
  * @return tempcode		The UI
  */
 function gui()
 {
     $member_id = get_param_integer('id');
     $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id);
     if (is_null($username)) {
         warn_exit(do_lang_tempcode('USER_NO_EXIST'));
     }
     $title = get_page_title('EMAIL_MEMBER', true, array(escape_html($username)));
     global $EXTRA_HEAD;
     $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />');
     // XHTMLXHTML
     $text = do_lang_tempcode('EMAIL_MEMBER_TEXT');
     $fields = new ocp_tempcode();
     require_code('form_templates');
     $fields->attach(form_input_line(do_lang_tempcode('SUBJECT'), '', 'subject', get_param('subject', '', true), true));
     $default_email = is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_email_address');
     $default_name = is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_username');
     $fields->attach(form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('_DESCRIPTION_NAME'), 'name', $default_name, true));
     $fields->attach(form_input_email(do_lang_tempcode('EMAIL_ADDRESS'), do_lang_tempcode('YOUR_ADDRESS'), 'email_address', $default_email, true));
     $fields->attach(form_input_text(do_lang_tempcode('MESSAGE'), '', 'message', get_param('message', '', true), true));
     if (addon_installed('captcha')) {
         require_code('captcha');
         if (use_captcha()) {
             $fields->attach(form_input_captcha());
             $text->attach(' ');
             $text->attach(do_lang_tempcode('FORM_TIME_SECURITY'));
         }
     }
     $size = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_max_email_attach_size_mb');
     $hidden = new ocp_tempcode();
     if ($size != 0) {
         handle_max_file_size($hidden);
         $fields->attach(form_input_upload_multi(do_lang_tempcode('_ATTACHMENT'), do_lang_tempcode('EMAIL_ATTACHMENTS', integer_format($size)), 'attachment', false));
     }
     $submit_name = do_lang_tempcode('SEND');
     $redirect = get_param('redirect', '');
     if ($redirect == '') {
         $redirect = $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id, false, true);
         if (is_object($redirect)) {
             $redirect = $redirect->evaluate();
         }
     }
     $post_url = build_url(array('page' => '_SELF', 'type' => 'actual', 'id' => $member_id, 'redirect' => $redirect), '_SELF');
     return do_template('FORM_SCREEN', array('_GUID' => 'e06557e6eceacf1f46ee930c99ac5bb5', 'TITLE' => $title, 'HIDDEN' => $hidden, 'JAVASCRIPT' => function_exists('captcha_ajax_check') ? captcha_ajax_check() : '', 'FIELDS' => $fields, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url));
 }
Example #3
0
 /**
  * The UI to report a post.
  *
  * @return tempcode		The UI
  */
 function report_post()
 {
     $post_id = get_param_integer('id');
     $post_info = $GLOBALS['FORUM_DB']->query_select('f_posts', array('*'), array('id' => $post_id), '', 1);
     if (!array_key_exists(0, $post_info)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $topic_id = $post_info[0]['p_topic_id'];
     $topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('*'), array('id' => $topic_id), '', 1);
     if (!array_key_exists(0, $topic_info)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $this->handle_topic_breadcrumbs($topic_info[0]['t_forum_id'], $topic_id, $topic_info[0]['t_cache_first_title'], do_lang_tempcode('REPORT_POST'));
     $this->check_has_mod_access($topic_id);
     $poster = $post_info[0]['p_poster_name_if_guest'];
     $member = $poster;
     if (!is_guest($post_info[0]['p_poster'])) {
         $member = '[page type="view" id="' . strval($post_info[0]['p_poster']) . '" param="' . get_module_zone('members') . '" caption="' . $poster . '"]members[/page]';
     }
     $_postdetails = post_param('post', NULL);
     if (is_null($_postdetails)) {
         $__post = get_translated_text($post_info[0]['p_post'], $GLOBALS['FORUM_DB']);
         $post = do_template('OCF_REPORTED_POST_FCOMCODE', array('_GUID' => 'e0f65423f3cb7698d5f04431dbe52ddb', 'POST_ID' => strval($post_id), 'MEMBER' => $member, 'TOPIC_TITLE' => $topic_info[0]['t_cache_first_title'], 'POST' => $__post, 'POSTER' => $poster));
     } else {
         $post = make_string_tempcode($_postdetails);
     }
     $hidden_fields = new ocp_tempcode();
     if (!is_guest()) {
         $options = array();
         if (get_option('is_on_anonymous_posts') == '1') {
             $options[] = array(do_lang_tempcode('_MAKE_ANONYMOUS_POST'), 'anonymous', false, do_lang_tempcode('MAKE_ANONYMOUS_POST_DESCRIPTION'));
         }
         $specialisation = form_input_various_ticks($options, '');
     } else {
         $specialisation = new ocp_tempcode();
     }
     $hidden_fields->attach(form_input_hidden('forum_id', '-2'));
     $hidden_fields->attach(form_input_hidden('validated', '1'));
     $report_title = $post_info[0]['p_title'];
     if ($report_title == '') {
         $report_title = $topic_info[0]['t_cache_first_title'];
     }
     $hidden_fields->attach(form_input_hidden('title', do_lang('REPORTED_POST_TITLE', $report_title)));
     $hidden_fields->attach(form_input_hidden('o_post_id', strval($post_id)));
     $hidden_fields->attach(form_input_hidden('from_url', get_self_url(true)));
     $text = new ocp_tempcode();
     if (addon_installed('captcha')) {
         require_code('captcha');
         if (use_captcha()) {
             $specialisation->attach(form_input_captcha());
             $text->attach(paragraph(do_lang_tempcode('FORM_TIME_SECURITY')));
         }
     }
     if (addon_installed('points')) {
         $login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => get_self_url(true, true)), get_module_zone('login'));
         $_login_url = escape_html($login_url->evaluate());
         if (is_guest() && (get_forum_type() != 'ocf' || has_actual_page_access(get_member(), 'join'))) {
             $text->attach(paragraph(do_lang_tempcode('NOT_LOGGED_IN_NO_CREDIT', $_login_url)));
         }
     }
     $post_url = build_url(array('page' => '_SELF', 'type' => '_add_reply'), '_SELF');
     $posting_form = get_posting_form(do_lang('REPORT_POST'), $post->evaluate(), $post_url, $hidden_fields, $specialisation, NULL, '', NULL, NULL, $this->_post_javascript() . (function_exists('captcha_ajax_check') ? captcha_ajax_check() : ''), NULL, true, false);
     $title = get_page_title('REPORT_POST');
     return do_template('POSTING_SCREEN', array('_GUID' => 'eee64757e66fed702f74fecf8d595260', 'TITLE' => $title, 'TEXT' => $text, 'POSTING_FORM' => $posting_form));
 }
Example #4
0
form_end();
section_subhead(lang_get('two_factor_auth'), lang_get('using_totp'));
form_start('actions/profile');
if ($user['2fa_status'] == 'generated') {
    form_generic('QR', '<img src="' . get_two_factor_auth_qr_url() . '" alt="QR" title="' . lang_get('scan_with_totp_app') . '" />');
    form_input_text('Code');
    form_hidden('action', '2fa_enable');
    form_button_submit(lang_get('enable_two_factor_auth'));
} else {
    if ($user['2fa_status'] == 'disabled') {
        form_hidden('action', '2fa_generate');
        form_button_submit(lang_get('generate_codes'));
    } else {
        if ($user['2fa_status'] == 'enabled') {
            form_generic('QR', '<img src="' . get_two_factor_auth_qr_url() . '" alt="QR" title="' . lang_get('scan_with_totp_app') . '" />');
            form_hidden('action', '2fa_disable');
            form_button_submit(lang_get('disable_two_factor_auth'), 'danger');
        }
    }
}
form_end();
section_subhead(lang_get('reset_password'));
form_start('actions/profile');
form_input_password('Current password');
form_input_password('New password');
form_input_password('New password again');
form_hidden('action', 'reset_password');
form_input_captcha();
form_button_submit(lang_get('reset_password'), 'warning');
form_end();
foot();
Example #5
0
 function form()
 {
     $title = get_page_title('REPORT_CONTENT');
     require_code('form_templates');
     $url = get_param('url', false, true);
     $content_type = get_param('content_type');
     // Equates to a content_meta_aware hook
     $content_id = get_param('content_id');
     require_code('content');
     if (!is_null($GLOBALS['SITE_DB']->query_value_null_ok('reported_content', 'r_counts', array('r_session_id' => get_session_id(), 'r_content_type' => $content_type, 'r_content_id' => $content_id)))) {
         warn_exit(do_lang_tempcode('ALREADY_REPORTED_CONTENT'));
     }
     list($content_title, $poster_id, ) = content_get_details($content_type, $content_id);
     if ($content_title == '') {
         $content_title = $content_type . ' #' . $content_id;
     }
     $poster = $GLOBALS['FORUM_DRIVER']->get_username($poster_id);
     // Show form with input field and CAPTCHA, like forum's report post...
     $member = $poster;
     if (!is_guest($poster_id)) {
         $member = '[page type="view" id="' . strval($poster_id) . '" param="' . get_module_zone('members') . '" caption="' . $poster . '"]members[/page]';
     }
     $hidden_fields = build_keep_form_fields('', true);
     $text = paragraph(do_lang_tempcode('DESCRIPTION_REPORT_CONTENT', escape_html($content_title), escape_html(integer_format(intval(get_option('reported_times'))))));
     $specialisation = new ocp_tempcode();
     if (!is_guest()) {
         $options = array();
         if (get_option('is_on_anonymous_posts') == '1') {
             $options[] = array(do_lang_tempcode('_MAKE_ANONYMOUS_POST'), 'anonymous', false, do_lang_tempcode('MAKE_ANONYMOUS_POST_DESCRIPTION'));
         }
         $specialisation = form_input_various_ticks($options, '');
     } else {
         $specialisation = new ocp_tempcode();
     }
     if (addon_installed('captcha')) {
         require_code('captcha');
         if (use_captcha()) {
             $specialisation->attach(form_input_captcha());
             $text->attach(paragraph(do_lang_tempcode('FORM_TIME_SECURITY')));
         }
     }
     if (addon_installed('points')) {
         $login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => get_self_url(true, true)), get_module_zone('login'));
         $_login_url = escape_html($login_url->evaluate());
         if (is_guest() && (get_forum_type() != 'ocf' || has_actual_page_access(get_member(), 'join'))) {
             $text->attach(paragraph(do_lang_tempcode('NOT_LOGGED_IN_NO_CREDIT', $_login_url)));
         }
     }
     $post_url = build_url(array('page' => '_SELF', 'type' => 'actual'), '_SELF');
     $post = do_template('REPORTED_CONTENT_FCOMCODE', array('URL' => $url, 'CONTENT_ID' => $content_id, 'MEMBER' => $member, 'CONTENT_TITLE' => $content_title, 'POSTER' => $poster));
     $posting_form = get_posting_form(do_lang('REPORT_CONTENT'), $post->evaluate(), $post_url, $hidden_fields, $specialisation, NULL, '', NULL, NULL, NULL, NULL, true, false);
     return do_template('POSTING_SCREEN', array('TITLE' => $title, 'JAVASCRIPT' => function_exists('captcha_ajax_check') ? captcha_ajax_check() : '', 'TEXT' => $text, 'POSTING_FORM' => $posting_form));
 }
Example #6
0
/**
 * Get the join form.
 *
 * @param  tempcode		URL to direct to
 * @param  boolean		Whether to handle CAPTCHA (if enabled at all)
 * @param  boolean		Whether to ask for intro messages (if enabled at all)
 * @param  boolean		Whether to check for invites (if enabled at all)
 * @param  boolean		Whether to check email-address restrictions (if enabled at all)
 * @return array			A tuple: Necessary Javascript code, the form
 */
function ocf_join_form($url, $captcha_if_enabled = true, $intro_message_if_enabled = true, $invites_if_enabled = true, $one_per_email_address_if_enabled = true)
{
    ocf_require_all_forum_stuff();
    require_css('ocf');
    require_code('ocf_members_action');
    require_code('ocf_members_action2');
    require_code('form_templates');
    $hidden = new ocp_tempcode();
    $hidden->attach(build_keep_post_fields());
    $groups = ocf_get_all_default_groups(true);
    $primary_group = either_param_integer('primary_group', NULL);
    if ($primary_group !== NULL && !in_array($primary_group, $groups)) {
        // Check security
        $test = $GLOBALS['FORUM_DB']->query_value('f_groups', 'g_is_presented_at_install', array('id' => $primary_group));
        if ($test == 1) {
            $groups = ocf_get_all_default_groups(false);
            $hidden = form_input_hidden('primary_group', strval($primary_group));
            $groups[] = $primary_group;
        }
    }
    list($fields, $_hidden) = ocf_get_member_fields(true, NULL, $groups);
    $hidden->attach($_hidden);
    if ($intro_message_if_enabled) {
        $forum_id = get_option('intro_forum_id');
        if ($forum_id != '') {
            $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('INTRODUCE_YOURSELF'))));
            $fields->attach(form_input_line(do_lang_tempcode('TITLE'), '', 'intro_title', do_lang('INTRO_POST_DEFAULT', '___'), false));
            $fields->attach(form_input_text_comcode(do_lang_tempcode('POST_COMMENT'), do_lang_tempcode('DESCRIPTION_INTRO_POST'), 'intro_post', '', false));
        }
    }
    $text = do_lang_tempcode('ENTER_PROFILE_DETAILS');
    if ($captcha_if_enabled) {
        if (addon_installed('captcha')) {
            require_code('captcha');
            if (use_captcha()) {
                $fields->attach(form_input_captcha());
                $text->attach(' ');
                $text->attach(do_lang_tempcode('FORM_TIME_SECURITY'));
            }
        }
    }
    $submit_name = do_lang_tempcode('PROCEED');
    require_javascript('javascript_ajax');
    $script = find_script('username_check');
    $javascript = "\n\t\tvar form=document.getElementById('username').form;\n\t\tform.elements['username'].onchange=function()\n\t\t{\n\t\t\tif (form.elements['intro_title'])\n\t\t\t\tform.elements['intro_title'].value='" . addslashes(do_lang('INTRO_POST_DEFAULT')) . "'.replace(/\\{1\\}/g,form.elements['username'].value);\n\t\t}\n\t\tform.old_submit=form.onsubmit;\n\t\tform.onsubmit=function()\n\t\t\t{\n\t\t\t\tif ((form.elements['email_address_confirm']) && (form.elements['email_address_confirm'].value!=form.elements['email_address'].value))\n\t\t\t\t{\n\t\t\t\t\twindow.fauxmodal_alert('" . php_addslashes(do_lang('EMAIL_ADDRESS_MISMATCH')) . "');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif ((form.elements['password_confirm']) && (form.elements['password_confirm'].value!=form.elements['password'].value))\n\t\t\t\t{\n\t\t\t\t\twindow.fauxmodal_alert('" . php_addslashes(do_lang('PASSWORD_MISMATCH')) . "');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tdocument.getElementById('submit_button').disabled=true;\n\t\t\t\tvar url='" . addslashes($script) . "?username='******'username'].value);\n\t\t\t\tif (!do_ajax_field_test(url,'password='******'password'].value)))\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t";
    $script = find_script('snippet');
    if ($invites_if_enabled) {
        if (get_option('is_on_invites') == '1') {
            $javascript .= "\n\t\t\t\t\turl='" . addslashes($script) . "?snippet=invite_missing&name='+window.encodeURIComponent(form.elements['email_address'].value);\n\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t";
        }
    }
    if ($one_per_email_address_if_enabled) {
        if (get_option('one_per_email_address') == '1') {
            $javascript .= "\n\t\t\t\t\turl='" . addslashes($script) . "?snippet=email_exists&name='+window.encodeURIComponent(form.elements['email_address'].value);\n\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t";
        }
    }
    if ($captcha_if_enabled) {
        if (addon_installed('captcha')) {
            require_code('captcha');
            if (use_captcha()) {
                $javascript .= "\n\t\t\t\t\t\turl='" . addslashes($script) . "?snippet=captcha_wrong&name='+window.encodeURIComponent(form.elements['security_image'].value);\n\t\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t";
            }
        }
    }
    $javascript .= "\n\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\treturn true;\n\t\t\t};\n\t";
    $form = do_template('FORM', array('TEXT' => '', 'HIDDEN' => $hidden, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $url));
    return array($javascript, $form);
}