Exemplo n.º 1
0
 function logged_in()
 {
     if (qa_is_logged_in()) {
         // output user avatar to login bar
         $this->output('<div class="qa-logged-in-avatar">', QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true) : qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(), qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'), 24, true), '</div>');
     }
     qa_html_theme_base::logged_in();
     if (qa_is_logged_in()) {
         // adds points count after logged in username
         $userpoints = qa_get_logged_in_points();
         $pointshtml = $userpoints == 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html(number_format($userpoints)));
         $this->output('<span class="qa-logged-in-points">', '(' . $pointshtml . ')', '</span>');
     }
 }
 function process_request($request)
 {
     // perform userinfuser registration
     $ui = new UserInfuser("*****@*****.**", "0658a511-d890-4e51-ba9e-126d6c0a12f2");
     $ui->update_user(qa_get_logged_in_email(), qa_get_logged_in_userid(), "", "");
     $ui->award_points(qa_get_logged_in_email(), 1000);
     $pw = $ui->get_widget(qa_get_logged_in_email(), "points", 100, 100);
     $lw = $ui->get_widget(qa_get_logged_in_email(), "leaderboard", 600, 300);
     $qa_content = qa_content_prepare();
     $qa_content['title'] = 'Example plugin page';
     $qa_content['error'] = 'An example error';
     $qa_content['custom'] = 'Some <B>custom html</B>';
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request' . qa_get_logged_in_userid(), 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
     $qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>';
     $qa_content['custom_3'] = $pw . $lw;
     return $qa_content;
 }
Exemplo n.º 3
0
if (qa_using_categories() && count($categories)) {
    $field = array('label' => qa_lang_html('question/q_category_label'), 'error' => qa_html(@$errors['categoryid']));
    qa_set_up_category_field($qa_content, $field, 'category', $categories, $in['categoryid'], true, qa_opt('allow_no_sub_category'));
    if (!qa_opt('allow_no_category')) {
        // don't auto-select a category even though one is required
        $field['options'][''] = '';
    }
    qa_array_insert($qa_content['form']['fields'], 'content', array('category' => $field));
}
if (qa_opt('extra_field_active')) {
    $field = array('label' => qa_html(qa_opt('extra_field_prompt')), 'tags' => 'name="extra"', 'value' => qa_html(@$in['extra']), 'error' => qa_html(@$errors['extra']));
    qa_array_insert($qa_content['form']['fields'], null, array('extra' => $field));
}
if (qa_using_tags()) {
    $field = array('error' => qa_html(@$errors['tags']));
    qa_set_up_tag_field($qa_content, $field, 'tags', isset($in['tags']) ? $in['tags'] : array(), array(), qa_opt('do_complete_tags') ? array_keys($completetags) : array(), qa_opt('page_size_ask_tags'));
    qa_array_insert($qa_content['form']['fields'], null, array('tags' => $field));
}
if (!isset($userid)) {
    qa_set_up_name_field($qa_content, $qa_content['form']['fields'], @$in['name']);
}
qa_set_up_notify_fields($qa_content, $qa_content['form']['fields'], 'Q', qa_get_logged_in_email(), isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), @$in['email'], @$errors['email']);
if ($captchareason) {
    require_once 'qa-app-captcha.php';
    qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors, qa_captcha_reason_note($captchareason));
}
$qa_content['focusid'] = 'title';
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
function qa_page_q_edit_c_form(&$qa_content, $id, $comment, $in, $errors)
{
    $commentid = $comment['postid'];
    $prefix = 'c' . $commentid . '_';
    $content = isset($in['content']) ? $in['content'] : $comment['content'];
    $format = isset($in['format']) ? $in['format'] : $comment['format'];
    $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_cs');
    $editor = qa_load_editor($content, $format, $editorname);
    $form = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'id' => $id, 'title' => qa_lang_html('question/edit_c_title'), 'style' => 'tall', 'fields' => array('content' => array_merge(qa_editor_load_field($editor, $qa_content, $content, $format, $prefix . 'content', 4, true), array('error' => qa_html(@$errors['content'])))), 'buttons' => array('save' => array('tags' => 'onclick="qa_show_waiting_after(this, false); ' . (method_exists($editor, 'update_script') ? $editor->update_script($prefix . 'content') : '') . '"', 'label' => qa_lang_html('main/save_button')), 'cancel' => array('tags' => 'name="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array($prefix . 'editor' => qa_html($editorname), $prefix . 'dosave' => '1', $prefix . 'code' => qa_get_form_security_code('edit-' . $commentid)));
    if ($comment['isbyuser']) {
        if (!qa_is_logged_in()) {
            qa_set_up_name_field($qa_content, $form['fields'], isset($in['name']) ? $in['name'] : @$comment['name'], $prefix);
        }
        qa_set_up_notify_fields($qa_content, $form['fields'], 'C', qa_get_logged_in_email(), isset($in['notify']) ? $in['notify'] : !empty($comment['notify']), isset($in['email']) ? $in['email'] : @$comment['notify'], @$errors['email'], $prefix);
    }
    if (!qa_user_post_permit_error('permit_edit_silent', $comment)) {
        $form['fields']['silent'] = array('type' => 'checkbox', 'label' => qa_lang_html('question/save_silent_label'), 'tags' => 'name="' . $prefix . 'silent"', 'value' => qa_html(@$in['silent']));
    }
    return $form;
}
Exemplo n.º 5
0
function qa_page_q_add_c_form(&$qa_content, $questionid, $parentid, $formid, $usecaptcha, $in, $errors, $loadfocusnow)
{
    switch (qa_user_permit_error('permit_post_c')) {
        case 'login':
            $form = array('title' => qa_insert_login_links(qa_lang_html('question/comment_must_login'), qa_request()));
            break;
        case 'confirm':
            $form = array('title' => qa_insert_login_links(qa_lang_html('question/comment_must_confirm'), qa_request()));
            break;
        case 'limit':
            $form = array('title' => qa_lang_html('question/comment_limit'));
            break;
        default:
            $form = array('title' => qa_lang_html('users/no_permission'));
            break;
        case false:
            $prefix = 'c' . $parentid . '_';
            $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_cs');
            $editor = qa_load_editor(@$in['content'], @$in['format'], $editorname);
            if (method_exists($editor, 'update_script')) {
                $updatescript = $editor->update_script($prefix . 'content');
            } else {
                $updatescript = '';
            }
            $custom = qa_opt('show_custom_comment') ? trim(qa_opt('custom_comment')) : '';
            $form = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '" NAME="c_form_' . qa_html($parentid) . '"', 'title' => qa_lang_html($questionid == $parentid ? 'question/your_comment_q' : 'question/your_comment_a'), 'fields' => array('custom' => array('type' => 'custom', 'note' => $custom), 'content' => array_merge(qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], $prefix . 'content', 4, $loadfocusnow, $loadfocusnow), array('error' => qa_html(@$errors['content'])))), 'buttons' => array('comment' => array('tags' => 'onClick="' . $updatescript . ' return qa_submit_comment(' . qa_js($questionid) . ', ' . qa_js($parentid) . ', this);"', 'label' => qa_lang_html('question/add_comment_button')), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array($prefix . 'editor' => qa_html($editorname), $prefix . 'doadd' => '1'));
            if (!strlen($custom)) {
                unset($form['fields']['custom']);
            }
            qa_set_up_notify_fields($qa_content, $form['fields'], 'C', qa_get_logged_in_email(), isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), $in['email'], @$errors['email'], $prefix);
            $onloads = array();
            if ($usecaptcha) {
                $userid = qa_get_logged_in_userid();
                $captchaloadscript = qa_set_up_captcha_field($qa_content, $form['fields'], $errors, qa_insert_login_links(qa_lang_html(isset($userid) ? 'misc/captcha_confirm_fix' : 'misc/captcha_login_fix')));
                if (strlen($captchaloadscript)) {
                    $onloads[] = 'document.getElementById(' . qa_js($formid) . ').qa_show=function() { ' . $captchaloadscript . ' }';
                }
            }
            if (!$loadfocusnow) {
                if (method_exists($editor, 'load_script')) {
                    $onloads[] = 'document.getElementById(' . qa_js($formid) . ').qa_load=function() { ' . $editor->load_script($prefix . 'content') . ' }';
                }
                if (method_exists($editor, 'focus_script')) {
                    $onloads[] = 'document.getElementById(' . qa_js($formid) . ').qa_focus=function() { ' . $editor->focus_script($prefix . 'content') . ' }';
                }
                $form['buttons']['cancel']['tags'] .= ' onClick="return qa_toggle_element()"';
            }
            if (count($onloads)) {
                $qa_content['script_onloads'][] = $onloads;
            }
    }
    $form['id'] = $formid;
    $form['collapse'] = !$loadfocusnow;
    $form['style'] = 'tall';
    return $form;
}
                    }
                } else {
                    $errors['avatar_default_show'] = qa_lang_sub('main/image_not_read', implode(', ', qa_gd_image_formats()));
                }
            }
        }
    }
}
//	Mailings management
if ($adminsection == 'mailing') {
    if (qa_clicked('domailingtest') || qa_clicked('domailingstart') || qa_clicked('domailingresume') || qa_clicked('domailingcancel')) {
        if (!qa_check_form_security_code('admin/' . $adminsection, qa_post_text('code'))) {
            $securityexpired = true;
        } else {
            if (qa_clicked('domailingtest')) {
                $email = qa_get_logged_in_email();
                if (qa_mailing_send_one(qa_get_logged_in_userid(), qa_get_logged_in_handle(), $email, qa_get_logged_in_user_field('emailcode'))) {
                    $formokhtml = qa_lang_html_sub('admin/test_sent_to_x', qa_html($email));
                } else {
                    $formokhtml = qa_lang_html('main/general_error');
                }
            }
            if (qa_clicked('domailingstart')) {
                qa_mailing_start();
                $startmailing = true;
            }
            if (qa_clicked('domailingresume')) {
                $startmailing = true;
            }
            if (qa_clicked('domailingcancel')) {
                qa_mailing_stop();
Exemplo n.º 7
0
    }
    if ($usecaptcha) {
        qa_captcha_validate($_POST, $errors);
    }
    if (empty($errors)) {
        $subs = array('^message' => $inmessage, '^name' => empty($inname) ? '-' : $inname, '^email' => empty($inemail) ? '-' : $inemail, '^previous' => empty($inreferer) ? '-' : $inreferer, '^url' => isset($qa_login_userid) ? qa_path('user/' . qa_get_logged_in_handle(), null, qa_opt('site_url')) : '-', '^ip' => qa_remote_ip_address(), '^browser' => @$_SERVER['HTTP_USER_AGENT']);
        if (qa_send_email(array('fromemail' => qa_email_validate(@$inemail) ? $inemail : qa_opt('from_email'), 'fromname' => $inname, 'toemail' => qa_opt('feedback_email'), 'toname' => qa_opt('site_title'), 'subject' => qa_lang_sub('emails/feedback_subject', qa_opt('site_title')), 'body' => strtr(qa_lang('emails/feedback_body'), $subs), 'html' => false))) {
            $feedbacksent = true;
        } else {
            $page_error = qa_lang_html('main/general_error');
        }
        qa_report_event('feedback', $qa_login_userid, qa_get_logged_in_handle(), $qa_cookieid, array('email' => $inemail, 'name' => $inname, 'message' => $inmessage, 'previous' => $inreferer, 'browser' => @$_SERVER['HTTP_USER_AGENT']));
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('misc/feedback_title');
$qa_content['error'] = @$page_error;
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('message' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html_sub('misc/feedback_message', qa_opt('site_title')), 'tags' => 'NAME="message" ID="message"', 'value' => qa_html(@$inmessage), 'rows' => 8, 'error' => qa_html(@$errors['message'])), 'name' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html('misc/feedback_name'), 'tags' => 'NAME="name"', 'value' => qa_html(isset($inname) ? $inname : @$userprofile['name'])), 'email' => array('type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html('misc/feedback_email'), 'tags' => 'NAME="email"', 'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()), 'note' => $feedbacksent ? null : qa_opt('email_privacy'))), 'buttons' => array('send' => array('label' => qa_lang_html('main/send_button'))), 'hidden' => array('dofeedback' => '1', 'referer' => qa_html(isset($inreferer) ? $inreferer : @$_SERVER['HTTP_REFERER'])));
if ($usecaptcha && !$feedbacksent) {
    qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors);
}
$qa_content['focusid'] = 'message';
if ($feedbacksent) {
    $qa_content['form']['ok'] = qa_lang_html('misc/feedback_sent');
    unset($qa_content['form']['buttons']);
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
    switch (qa_user_permit_error('permit_post_a')) {
        case 'login':
            $answerform = array('style' => 'tall', 'title' => qa_insert_login_links(qa_lang_html('question/answer_must_login'), $qa_request));
            break;
        case 'confirm':
            $answerform = array('style' => 'tall', 'title' => qa_insert_login_links(qa_lang_html('question/answer_must_confirm'), $qa_request));
            break;
        case false:
            $editorname = isset($ineditor) ? $ineditor : qa_opt('editor_for_as');
            $editor = qa_load_editor(@$incontent, @$informat, $editorname);
            $answerform = array('title' => qa_lang_html('question/your_answer_title'), 'style' => 'tall', 'fields' => array('content' => array_merge($editor->get_field($qa_content, @$incontent, @$informat, 'content', 12, $formrequested), array('error' => qa_html(@$errors['content'])))), 'buttons' => array('answer' => array('tags' => 'NAME="doansweradd"', 'label' => qa_lang_html('question/add_answer_button'))), 'hidden' => array('editor' => qa_html($editorname)));
            if ($formrequested) {
                // only show cancel button if user explicitly requested the form
                $answerform['buttons']['cancel'] = array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button'));
            }
            qa_set_up_notify_fields($qa_content, $answerform['fields'], 'A', qa_get_logged_in_email(), isset($innotify) ? $innotify : qa_opt('notify_users_default'), @$inemail, @$errors['email']);
            if ($usecaptcha) {
                qa_set_up_captcha_field($qa_content, $answerform['fields'], @$errors, qa_insert_login_links(qa_lang_html(isset($qa_login_userid) ? 'misc/captcha_confirm_fix' : 'misc/captcha_login_fix')));
            }
            break;
    }
    if ($formrequested || empty($qa_content['a_list']['as'])) {
        $qa_content['q_view']['a_form'] = $answerform;
    } else {
        $answerkeys = array_keys($qa_content['a_list']['as']);
        $qa_content['a_list']['as'][$answerkeys[count($answerkeys) - 1]]['c_form'] = $answerform;
        // under last answer
    }
}
//	List of related questions
if ($relatedcount > 1 && !$question['hidden']) {
Exemplo n.º 9
0
 function ra_user_avatar()
 {
     if (qw_hook_exist(__FUNCTION__)) {
         $args = func_get_args();
         array_unshift($args, $this);
         return qw_event_hook(__FUNCTION__, $args, NULL);
     }
     if (qa_is_logged_in()) {
         // output user avatar to login bar
         $img_html = QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true) : qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(), qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'), 24, true);
         preg_match('@src="([^"]+)"@', $img_html, $match);
         $this->output($match[1]);
     }
 }
Exemplo n.º 10
0
function qa_page_q_add_c_form(&$qa_content, $question, $parent, $formid, $captchareason, $in, $errors, $loadfocusnow)
{
    // The 'approve', 'login', 'confirm', 'userblock', 'ipblock' permission errors are reported to the user here
    // The other option ('level') prevents the comment button being shown, in qa_page_q_post_rules(...)
    switch (qa_user_post_permit_error('permit_post_c', $parent, QA_LIMIT_COMMENTS)) {
        case 'login':
            $form = array('title' => qa_insert_login_links(qa_lang_html('question/comment_must_login'), qa_request()));
            break;
        case 'confirm':
            $form = array('title' => qa_insert_login_links(qa_lang_html('question/comment_must_confirm'), qa_request()));
            break;
        case 'approve':
            $form = array('title' => qa_lang_html('question/comment_must_be_approved'));
            break;
        case 'limit':
            $form = array('title' => qa_lang_html('question/comment_limit'));
            break;
        default:
            $form = array('title' => qa_lang_html('users/no_permission'));
            break;
        case false:
            $prefix = 'c' . $parent['postid'] . '_';
            $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_cs');
            $editor = qa_load_editor(@$in['content'], @$in['format'], $editorname);
            if (method_exists($editor, 'update_script')) {
                $updatescript = $editor->update_script($prefix . 'content');
            } else {
                $updatescript = '';
            }
            $custom = qa_opt('show_custom_comment') ? trim(qa_opt('custom_comment')) : '';
            $form = array('tags' => 'method="post" action="' . qa_self_html() . '" name="c_form_' . qa_html($parent['postid']) . '"', 'title' => qa_lang_html($question['postid'] == $parent['postid'] ? 'question/your_comment_q' : 'question/your_comment_a'), 'fields' => array('custom' => array('type' => 'custom', 'note' => $custom), 'content' => array_merge(qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], $prefix . 'content', 4, $loadfocusnow, $loadfocusnow), array('error' => qa_html(@$errors['content'])))), 'buttons' => array('comment' => array('tags' => 'onclick="' . $updatescript . ' return qa_submit_comment(' . qa_js($question['postid']) . ', ' . qa_js($parent['postid']) . ', this);"', 'label' => qa_lang_html('question/add_comment_button')), 'cancel' => array('tags' => 'name="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array($prefix . 'editor' => qa_html($editorname), $prefix . 'doadd' => '1', $prefix . 'code' => qa_get_form_security_code('comment-' . $parent['postid'])));
            if (!strlen($custom)) {
                unset($form['fields']['custom']);
            }
            if (!qa_is_logged_in()) {
                qa_set_up_name_field($qa_content, $form['fields'], @$in['name'], $prefix);
            }
            qa_set_up_notify_fields($qa_content, $form['fields'], 'C', qa_get_logged_in_email(), isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), $in['email'], @$errors['email'], $prefix);
            $onloads = array();
            if ($captchareason) {
                $captchaloadscript = qa_set_up_captcha_field($qa_content, $form['fields'], $errors, qa_captcha_reason_note($captchareason));
                if (strlen($captchaloadscript)) {
                    $onloads[] = 'document.getElementById(' . qa_js($formid) . ').qa_show=function() { ' . $captchaloadscript . ' };';
                }
            }
            if (!$loadfocusnow) {
                if (method_exists($editor, 'load_script')) {
                    $onloads[] = 'document.getElementById(' . qa_js($formid) . ').qa_load=function() { ' . $editor->load_script($prefix . 'content') . ' };';
                }
                if (method_exists($editor, 'focus_script')) {
                    $onloads[] = 'document.getElementById(' . qa_js($formid) . ').qa_focus=function() { ' . $editor->focus_script($prefix . 'content') . ' };';
                }
                $form['buttons']['cancel']['tags'] .= ' onclick="return qa_toggle_element()"';
            }
            if (count($onloads)) {
                $qa_content['script_onloads'][] = $onloads;
            }
    }
    $form['id'] = $formid;
    $form['collapse'] = !$loadfocusnow;
    $form['style'] = 'tall';
    return $form;
}
Exemplo n.º 11
0
 function site_top()
 {
     $this->output('<div id="site-top" class="container">');
     $this->page_title_error();
     if (qa_is_logged_in()) {
         // output user avatar to login bar
         $this->output('<div class="qa-logged-in-avatar">', QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true) : qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(), qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'), 24, true), '</div>');
     } else {
         $this->output('<ul class="pull-right top-buttons clearfix">', '<li><a href="#" class="btn">' . qa_lang_html('cleanstrap/login') . '</a></li>', '<li><a href="#" class="btn">' . qa_lang_html('cleanstrap/register') . '</a></li>', '</ul>');
     }
     $this->output('</div>');
 }
function qa_page_q_edit_c_form(&$qa_content, $id, $comment, $in, $errors)
{
    $commentid = $comment['postid'];
    $prefix = 'c' . $commentid . '_';
    $content = isset($in['content']) ? $in['content'] : $comment['content'];
    $format = isset($in['format']) ? $in['format'] : $comment['format'];
    $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_cs');
    $editor = qa_load_editor($content, $format, $editorname);
    $form = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'id' => $id, 'title' => qa_lang_html('question/edit_c_title'), 'style' => 'tall', 'fields' => array('content' => array_merge(qa_editor_load_field($editor, $qa_content, $content, $format, $prefix . 'content', 4, true), array('error' => qa_html(@$errors['content'])))), 'buttons' => array('save' => array('tags' => method_exists($editor, 'update_script') ? 'onClick="' . $editor->update_script($prefix . 'content') . '"' : '', 'label' => qa_lang_html('main/save_button')), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array($prefix . 'editor' => qa_html($editorname), $prefix . 'dosave' => '1'));
    if ($comment['isbyuser']) {
        qa_set_up_notify_fields($qa_content, $form['fields'], 'C', qa_get_logged_in_email(), isset($in['notify']) ? $in['notify'] : !empty($comment['notify']), isset($in['email']) ? $in['email'] : @$comment['notify'], @$errors['email'], $prefix);
    }
    return $form;
}
Exemplo n.º 13
0
 function qa_ajax_comment_form()
 {
     global $qa_content, $incomment, $informat, $errors, $questionid, $ineditor, $innotify, $inemail, $jumptoanchor, $focusonid, $usecaptcha, $qa_login_userid;
     $jumptoanchor = isset($answerid) ? qa_anchor('A', $answerid) : qa_anchor('Q', $questionid);
     $focusonid = 'comment';
     $editorname = isset($ineditor) ? $ineditor : qa_opt('editor_for_cs');
     $editor = qa_load_editor(@$incomment, @$informat, $editorname);
     $form = array('title' => qa_lang_html(isset($answerid) ? 'question/your_comment_a' : 'question/your_comment_q'), 'style' => 'tall', 'fields' => array('content' => array_merge($editor->get_field($qa_content, @$incomment, @$informat, 'comment', 4, true), array('error' => qa_html(@$errors['content']), 'rows' => 8))), 'buttons' => array('comment' => array('tags' => 'onclick="ajaxPostComment()"', 'label' => qa_lang_html('question/add_comment_button'), 'ajax_comment' => $this->idx2), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button'), 'ajax_comment' => $this->idx2)), 'hidden' => array('editor' => qa_html($editorname)));
     $form['fields']['content']['tags'] = @$form['fields']['tags'] . ' id="comment" onkeydown="if(event.keyCode == 27) toggleComment(false);"';
     // add reminder text if commenting on answer to own question
     $ourid = qa_get_logged_in_userid();
     if (qa_opt('ajax_comment_answer_reminder') && !$this->content['q_view']['raw']['selchildid'] && isset($answerid) && $this->content['q_view']['raw']['userid'] == $ourid && @$this->content['a_list']['as'][$this->idx - 1]['raw']['userid'] != $ourid) {
         $form['fields']['custom_message'] = array('note' => '<div class="ajax-comment-reminder">' . qa_opt('ajax_comment_answer_reminder_text') . '</div>', 'type' => 'static');
     }
     qa_set_up_notify_fields($qa_content, $form['fields'], 'C', qa_get_logged_in_email(), isset($innotify) ? $innotify : qa_opt('notify_users_default'), @$inemail, @$errors['email']);
     if ($usecaptcha) {
         qa_set_up_captcha_field($qa_content, $form['fields'], @$errors, qa_insert_login_links(qa_lang_html(isset($qa_login_userid) ? 'misc/captcha_confirm_fix' : 'misc/captcha_login_fix')));
     }
     $form['ajax_comment'] = 0;
     $this->idx2++;
     return $form;
 }
Exemplo n.º 14
0
        if ($flags & QA_USER_FLAGS_EMAIL_CONFIRMED && !($flags & QA_USER_FLAGS_MUST_CONFIRM)) {
            $userconfirmed = true;
        } elseif (strtolower(trim($userinfo['emailcode'])) == strtolower($incode)) {
            qa_complete_confirm($userinfo['userid'], $userinfo['email'], $userinfo['handle']);
            $userconfirmed = true;
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/confirm_title');
if ($useremailed) {
    $qa_content['error'] = qa_lang_html('users/confirm_emailed');
} elseif ($userconfirmed) {
    $qa_content['error'] = qa_lang_html('users/confirm_complete');
    if (!isset($loginuserid)) {
        $qa_content['suggest_next'] = strtr(qa_lang_html('users/log_in_to_access'), array('^1' => '<A HREF="' . qa_path_html('login', array('e' => $inhandle)) . '">', '^2' => '</A>'));
    }
} elseif (isset($loginuserid)) {
    // if logged in, allow sending a fresh link
    if (strlen($incode)) {
        $qa_content['error'] = qa_lang_html('users/confirm_wrong_resend');
    }
    $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_path_html('confirm') . '"', 'style' => 'tall', 'fields' => array('email' => array('label' => qa_lang_html('users/email_label'), 'value' => qa_html(qa_get_logged_in_email()) . strtr(qa_lang_html('users/change_email_link'), array('^1' => '<A HREF="' . qa_path_html('account') . '">', '^2' => '</A>')), 'type' => 'static')), 'buttons' => array('send' => array('tags' => 'NAME="dosendconfirm"', 'label' => qa_lang_html('users/send_confirm_button'))));
} else {
    $qa_content['error'] = qa_insert_login_links(qa_lang_html('users/confirm_wrong_log_in'), 'confirm');
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Exemplo n.º 15
0
        } elseif (strtolower(trim($userinfo['emailcode'])) == strtolower($incode)) {
            qa_complete_confirm($userinfo['userid'], $userinfo['email'], $userinfo['handle']);
            $userconfirmed = true;
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/confirm_title');
if ($useremailed) {
    $qa_content['error'] = qa_lang_html('users/confirm_emailed');
} elseif ($userconfirmed) {
    $qa_content['error'] = qa_lang_html('users/confirm_complete');
    if (!isset($qa_login_userid)) {
        $qa_content['suggest_next'] = strtr(qa_lang_html('users/log_in_to_access'), array('^1' => '<A HREF="' . qa_path_html('login', array('e' => $inhandle)) . '">', '^2' => '</A>'));
    } elseif ($qa_login_userid == $userinfo['userid']) {
        $qa_content['suggest_next'] = strtr(qa_lang_html('users/view_account_page'), array('^1' => '<A HREF="' . qa_path_html('account') . '">', '^2' => '</A>'));
    }
} elseif (isset($qa_login_userid)) {
    // if logged in, allow sending a fresh link
    if (strlen($incode)) {
        $qa_content['error'] = qa_lang_html('users/confirm_wrong_resend');
    }
    $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_path_html('confirm') . '"', 'style' => 'tall', 'fields' => array('email' => array('label' => qa_lang_html('users/email_label'), 'value' => qa_html(qa_get_logged_in_email()), 'type' => 'static')), 'buttons' => array('send' => array('tags' => 'NAME="dosendconfirm"', 'label' => qa_lang_html('users/send_confirm_button'))));
} else {
    $qa_content['error'] = qa_insert_login_links(qa_lang_html('users/confirm_wrong_log_in'), 'confirm');
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
function qa_page_q_edit_c_form($commentid, $answerid)
{
    global $commentsfollows, $qa_content, $errors, $incomment, $informat, $ineditor, $questionid, $jumptoanchor, $focusonid, $innotify, $inemail;
    $comment = $commentsfollows[$commentid];
    $content = isset($incomment) ? $incomment : $comment['content'];
    $format = isset($informat) ? $informat : $comment['format'];
    $editorname = isset($ineditor) ? $ineditor : qa_opt('editor_for_cs');
    $editor = qa_load_editor($content, $format, $editorname);
    $jumptoanchor = isset($answerid) ? qa_anchor('A', $answerid) : qa_anchor('Q', $questionid);
    $form = array('title' => '<A NAME="edit">' . qa_lang_html('question/edit_c_title') . '</A>', 'style' => 'tall', 'fields' => array('content' => array_merge($editor->get_field($qa_content, $content, $format, 'comment', 4, true), array('error' => qa_html($errors['content'])))), 'buttons' => array('save' => array('label' => qa_lang_html('main/save_button')), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array('editor' => qa_html($editorname), 'dosavec_' . qa_html($commentid) => '1'));
    if ($comment['isbyuser']) {
        qa_set_up_notify_fields($qa_content, $form['fields'], 'C', qa_get_logged_in_email(), isset($innotify) ? $innotify : !empty($comment['notify']), isset($inemail) ? $inemail : @$comment['notify'], @$errors['email']);
    }
    return $form;
}