More about this license: http://www.question2answer.org/license.php
*/
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
//	First check whether the person has permission to do this
if (!qa_user_permit_error('permit_post_a', QA_LIMIT_ANSWERS)) {
    require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
    require_once QA_INCLUDE_DIR . 'qa-app-captcha.php';
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    require_once QA_INCLUDE_DIR . 'qa-app-post-create.php';
    require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
    require_once QA_INCLUDE_DIR . 'qa-page-question-view.php';
    require_once QA_INCLUDE_DIR . 'qa-page-question-submit.php';
    //	Load relevant information about this question and check it exists
    $usecaptcha = qa_user_use_captcha();
    $questionid = qa_post_text('a_questionid');
    $userid = qa_get_logged_in_userid();
    list($question, $childposts) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid), qa_db_full_child_posts_selectspec($userid, $questionid));
    if (@$question['basetype'] == 'Q' && !isset($question['closedbyid'])) {
        $answers = qa_page_q_load_as($question, $childposts);
        //	Try to create the new answer
        $answerid = qa_page_q_add_a_submit($question, $answers, $usecaptcha, $in, $errors);
        $countanswers = $question['acount'] + 1;
        if (isset($answerid)) {
            //	If successful, page content will be updated via Ajax
            $answer = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $answerid));
            $question = $question + qa_page_q_post_rules($question, null, null, $childposts);
            // array union
            $answer = $answer + qa_page_q_post_rules($answer, $question, $answers, null);
            $usershtml = qa_userids_handles_html(array($answer), true);
Exemple #2
0
function ra_ajax_add_answer()
{
    //	Load relevant information about this question
    $questionid = qa_post_text('a_questionid');
    $userid = qa_get_logged_in_userid();
    list($question, $childposts) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid), qa_db_full_child_posts_selectspec($userid, $questionid));
    //	Check if the question exists, is not closed, and whether the user has permission to do this
    if (@$question['basetype'] == 'Q' && !isset($question['closedbyid']) && !qa_user_post_permit_error('permit_post_a', $question, QA_LIMIT_ANSWERS)) {
        require_once QA_INCLUDE_DIR . 'qa-app-captcha.php';
        require_once QA_INCLUDE_DIR . 'qa-app-format.php';
        require_once QA_INCLUDE_DIR . 'qa-app-post-create.php';
        require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
        require_once QA_INCLUDE_DIR . 'qa-page-question-view.php';
        require_once QA_INCLUDE_DIR . 'qa-page-question-submit.php';
        //	Try to create the new answer
        $usecaptcha = qa_user_use_captcha(qa_user_level_for_post($question));
        $answers = qa_page_q_load_as($question, $childposts);
        $answerid = qa_page_q_add_a_submit($question, $answers, false, $in, $errors);
        if ($answerid) {
            return true;
        }
    }
    die;
}
	More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) {
    // don't allow this page to be requested directly from browser
    header('Location: ../');
    exit;
}
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING'], 'path' => $_SERVER['SCRIPT_NAME']));
require_once QA_INCLUDE_DIR . 'qa-app-captcha.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
//	Get useful information on the logged in user
if (isset($qa_login_userid) && !QA_FINAL_EXTERNAL_USERS) {
    list($useraccount, $userprofile) = qa_db_select_with_pending(qa_db_user_account_selectspec($qa_login_userid, true), qa_db_user_profile_selectspec($qa_login_userid, true));
}
$usecaptcha = qa_user_use_captcha('captcha_on_feedback');
//	Check feedback is enabled
if (!qa_opt('feedback_enabled')) {
    return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
//	Send the feedback form
$feedbacksent = false;
if (qa_clicked('dofeedback')) {
    require_once QA_INCLUDE_DIR . 'qa-util-emailer.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $inmessage = qa_post_text('message');
    $inname = qa_post_text('name');
    $inemail = qa_post_text('email');
    $inreferer = qa_post_text('referer');
    if (empty($inmessage)) {
        $errors['message'] = qa_lang('misc/feedback_empty');
<?php

require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-util-sort.php';
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
require_once QA_INCLUDE_DIR . 'qa-app-captcha.php';
$questionid = $pass_questionid;
// picked up from index.php
//	Get information about this question
global $qa_login_userid, $questionid, $question, $parentquestion, $answers, $commentsfollows, $relatedcount, $relatedquestions, $question, $categories;
$usecaptcha = qa_user_use_captcha('captcha_on_anon_post');
$permiterror = qa_user_permit_error('permit_view_q_page');
//	If we're responding to an HTTP POST, include file that handles all posting/editing/etc... logic
//	This is in a separate file because it's a *lot* of logic, and will slow down ordinary page views
$pageerror = null;
$formtype = null;
$formpostid = null;
$jumptoanchor = null;
$focusonid = null;
if (qa_is_http_post() || strlen($qa_state)) {
    require QA_INCLUDE_DIR . 'qa-page-question-post.php';
    qa_page_q_load_q();
    // reload since we may have changed something
}
$formrequested = isset($formtype);
if (!$formrequested && $question['answerbutton']) {
    $immedoption = qa_opt('show_a_form_immediate');
    if ($immedoption == 'always' || $immedoption == 'if_no_as' && !$question['isbyuser'] && !$question['acount']) {
        $formtype = 'a_add';
    }
Exemple #5
0
require_once QA_INCLUDE_DIR . 'app/limits.php';
require_once QA_INCLUDE_DIR . 'db/selects.php';
//	Load relevant information about this question
$questionid = qa_post_text('a_questionid');
$userid = qa_get_logged_in_userid();
list($question, $childposts) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid), qa_db_full_child_posts_selectspec($userid, $questionid));
//	Check if the question exists, is not closed, and whether the user has permission to do this
if (@$question['basetype'] == 'Q' && !isset($question['closedbyid']) && !qa_user_post_permit_error('permit_post_a', $question, QA_LIMIT_ANSWERS)) {
    require_once QA_INCLUDE_DIR . 'app/captcha.php';
    require_once QA_INCLUDE_DIR . 'app/format.php';
    require_once QA_INCLUDE_DIR . 'app/post-create.php';
    require_once QA_INCLUDE_DIR . 'app/cookies.php';
    require_once QA_INCLUDE_DIR . 'pages/question-view.php';
    require_once QA_INCLUDE_DIR . 'pages/question-submit.php';
    //	Try to create the new answer
    $usecaptcha = qa_user_use_captcha(qa_user_level_for_post($question));
    $answers = qa_page_q_load_as($question, $childposts);
    $answerid = qa_page_q_add_a_submit($question, $answers, $usecaptcha, $in, $errors);
    //	If successful, page content will be updated via Ajax
    if (isset($answerid)) {
        $answer = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $answerid));
        $question = $question + qa_page_q_post_rules($question, null, null, $childposts);
        // array union
        $answer = $answer + qa_page_q_post_rules($answer, $question, $answers, null);
        $usershtml = qa_userids_handles_html(array($answer), true);
        $a_view = qa_page_q_answer_view($question, $answer, false, $usershtml, false);
        $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-answer', null, null);
        $themeclass->initialize();
        echo "QA_AJAX_RESPONSE\n1\n";
        //	Send back whether the 'answer' button should still be visible
        echo (int) qa_opt('allow_multi_answers') . "\n";
Exemple #6
0
	More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) {
    // don't allow this page to be requested directly from browser
    header('Location: ../');
    exit;
}
require_once QA_INCLUDE_DIR . 'app/captcha.php';
require_once QA_INCLUDE_DIR . 'db/selects.php';
//	Get useful information on the logged in user
$userid = qa_get_logged_in_userid();
if (isset($userid) && !QA_FINAL_EXTERNAL_USERS) {
    list($useraccount, $userprofile) = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true), qa_db_user_profile_selectspec($userid, true));
}
$usecaptcha = qa_opt('captcha_on_feedback') && qa_user_use_captcha();
//	Check feedback is enabled and the person isn't blocked
if (!qa_opt('feedback_enabled')) {
    return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
if (qa_user_permit_error()) {
    $qa_content = qa_content_prepare();
    $qa_content['error'] = qa_lang_html('users/no_permission');
    return $qa_content;
}
//	Send the feedback form
$feedbacksent = false;
if (qa_clicked('dofeedback')) {
    require_once QA_INCLUDE_DIR . 'app/emails.php';
    require_once QA_INCLUDE_DIR . 'util/string.php';
    $inmessage = qa_post_text('message');