Пример #1
0
function qa_post_html_defaults($basetype, $full = false)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'qa-app-users.php';
    return array('tagsview' => $basetype == 'Q' && qa_using_tags(), 'categoryview' => $basetype == 'Q' && qa_using_categories(), 'contentview' => $full, 'voteview' => qa_get_vote_view($basetype, $full), 'flagsview' => qa_opt('flagging_of_posts') && $full, 'answersview' => $basetype == 'Q', 'viewsview' => $basetype == 'Q' && qa_opt('do_count_q_views') && qa_opt('show_view_counts'), 'whatview' => true, 'whatlink' => qa_opt('show_a_c_links'), 'whenview' => qa_opt('show_when_created'), 'ipview' => !qa_user_permit_error('permit_anon_view_ips'), 'whoview' => true, 'avatarsize' => qa_opt('avatar_q_list_size'), 'pointsview' => qa_opt('show_user_points'), 'pointstitle' => qa_opt('show_user_titles') ? qa_get_points_to_titles() : array(), 'updateview' => true, 'blockwordspreg' => qa_get_block_words_preg(), 'showurllinks' => qa_opt('show_url_links'), 'linksnewwindow' => qa_opt('links_in_new_window'), 'microformats' => $full, 'fulldatedays' => qa_opt('show_full_date_days'));
}
*/
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
require_once QA_INCLUDE_DIR . 'qa-app-votes.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-options.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$postid = qa_post_text('postid');
$vote = qa_post_text('vote');
$code = qa_post_text('code');
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
if (!qa_check_form_security_code('vote', $code)) {
    $voteerror = qa_lang_html('misc/form_security_reload');
} else {
    $post = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $postid));
    $voteerror = qa_vote_error_html($post, $vote, $userid, qa_request());
}
if ($voteerror === false) {
    qa_vote_set($post, $userid, qa_get_logged_in_handle(), $cookieid, $vote);
    $post = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $postid));
    $fields = qa_post_html_fields($post, $userid, $cookieid, array(), null, array('voteview' => qa_get_vote_view($post, true)));
    $themeclass = qa_load_theme_class(qa_get_site_theme(), 'voting', null, null);
    echo "QA_AJAX_RESPONSE\n1\n";
    $themeclass->voting_inner_html($fields);
} else {
    echo "QA_AJAX_RESPONSE\n0\n" . $voteerror;
}
/*
	Omit PHP closing tag to help avoid accidental output
*/
Пример #3
0
function qa_post_html_options($post, $defaults = null, $full = false)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    if (!isset($defaults)) {
        $defaults = qa_post_html_defaults($post['basetype'], $full);
    }
    $defaults['voteview'] = qa_get_vote_view($post, $full);
    $defaults['ipview'] = !qa_user_post_permit_error('permit_anon_view_ips', $post);
    return $defaults;
}
Пример #4
0
$count = (int) @$userpoints['aposts'];
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html($questions, false);
//	Prepare content for theme
$qa_content = qa_content_prepare(true);
if (count($questions)) {
    $qa_content['title'] = qa_lang_html_sub('profile/answers_by_x', $userhtml);
} else {
    $qa_content['title'] = qa_lang_html_sub('profile/no_answers_by_x', $userhtml);
}
//	Recent questions by this user
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
$htmldefaults = qa_post_html_defaults('Q');
$htmldefaults['whoview'] = false;
$htmldefaults['avatarsize'] = 0;
$htmldefaults['ovoteview'] = true;
$htmldefaults['answersview'] = false;
foreach ($questions as $question) {
    $options = qa_post_html_options($question, $htmldefaults);
    $options['voteview'] = qa_get_vote_view('A', false, false);
    $qa_content['q_list']['qs'][] = qa_other_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, $options);
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'));
//	Sub menu for navigation in user pages
$ismyuser = isset($loginuserid) && $loginuserid == (QA_FINAL_EXTERNAL_USERS ? $userid : $useraccount['userid']);
$qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'answers', $ismyuser);
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/