function qa_question_set_hidden($oldquestion, $hidden, $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost = null) { qa_question_set_status($oldquestion, $hidden ? QA_POST_STATUS_HIDDEN : QA_POST_STATUS_NORMAL, $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost); }
function qa_page_q_single_click_q($question, $answers, $commentsfollows, $closepost, &$error) { require_once QA_INCLUDE_DIR . 'app/post-update.php'; require_once QA_INCLUDE_DIR . 'app/limits.php'; $userid = qa_get_logged_in_userid(); $handle = qa_get_logged_in_handle(); $cookieid = qa_cookie_get(); if (qa_clicked('q_doreopen') && $question['reopenable'] && qa_page_q_click_check_form_code($question, $error)) { qa_question_close_clear($question, $closepost, $userid, $handle, $cookieid); return true; } if (qa_clicked('q_dohide') && $question['hideable'] || qa_clicked('q_doreject') && $question['moderatable']) { if (qa_page_q_click_check_form_code($question, $error)) { qa_question_set_hidden($question, true, $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost); return true; } } if (qa_clicked('q_doreshow') && $question['reshowable'] || qa_clicked('q_doapprove') && $question['moderatable']) { if (qa_page_q_click_check_form_code($question, $error)) { if ($question['moderatable'] || $question['reshowimmed']) { $status = QA_POST_STATUS_NORMAL; } else { $in = qa_page_q_prepare_post_for_filters($question); $filtermodules = qa_load_modules_with('filter', 'filter_question'); // run through filters but only for queued status foreach ($filtermodules as $filtermodule) { $tempin = $in; // always pass original question in because we aren't modifying anything else $filtermodule->filter_question($tempin, $temperrors, $question); $in['queued'] = $tempin['queued']; // only preserve queued status in loop } $status = $in['queued'] ? QA_POST_STATUS_QUEUED : QA_POST_STATUS_NORMAL; } qa_question_set_status($question, $status, $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost); return true; } } if (qa_clicked('q_doclaim') && $question['claimable'] && qa_page_q_click_check_form_code($question, $error)) { if (qa_user_limits_remaining(QA_LIMIT_QUESTIONS)) { // already checked 'permit_post_q' qa_question_set_userid($question, $userid, $handle, $cookieid); return true; } else { $error = qa_lang_html('question/ask_limit'); } } if (qa_clicked('q_doflag') && $question['flagbutton'] && qa_page_q_click_check_form_code($question, $error)) { require_once QA_INCLUDE_DIR . 'app/votes.php'; $error = qa_flag_error_html($question, $userid, qa_request()); if (!$error) { if (qa_flag_set_tohide($question, $userid, $handle, $cookieid, $question)) { qa_question_set_hidden($question, true, null, null, null, $answers, $commentsfollows, $closepost); } // hiding not really by this user so pass nulls return true; } } if (qa_clicked('q_dounflag') && $question['unflaggable'] && qa_page_q_click_check_form_code($question, $error)) { require_once QA_INCLUDE_DIR . 'app/votes.php'; qa_flag_clear($question, $userid, $handle, $cookieid); return true; } if (qa_clicked('q_doclearflags') && $question['clearflaggable'] && qa_page_q_click_check_form_code($question, $error)) { require_once QA_INCLUDE_DIR . 'app/votes.php'; qa_flags_clear_all($question, $userid, $handle, $cookieid); return true; } return false; }
function qa_post_set_status($postid, $status, $byuserid = null) { $oldpost = qa_post_get_full($postid, 'QAC'); $byhandle = qa_post_userid_to_handle($byuserid); switch ($oldpost['basetype']) { case 'Q': $answers = qa_post_get_question_answers($postid); $commentsfollows = qa_post_get_question_commentsfollows($postid); $closepost = qa_post_get_question_closepost($postid); qa_question_set_status($oldpost, $status, $byuserid, $byhandle, null, $answers, $commentsfollows, $closepost); break; case 'A': $question = qa_post_get_full($oldpost['parentid'], 'Q'); $commentsfollows = qa_post_get_answer_commentsfollows($postid); qa_answer_set_status($oldpost, $status, $byuserid, $byhandle, null, $question, $commentsfollows); break; case 'C': $parent = qa_post_get_full($oldpost['parentid'], 'QA'); $question = qa_post_parent_to_question($parent); qa_comment_set_status($oldpost, $status, $byuserid, $byhandle, null, $question, $parent); break; } }