示例#1
0
require_once QA_INCLUDE_DIR . 'app/users.php';
require_once QA_INCLUDE_DIR . 'app/cookies.php';
require_once QA_INCLUDE_DIR . 'db/selects.php';
$message = qa_post_text('message');
$tohandle = qa_post_text('handle');
$morelink = qa_post_text('morelink');
$touseraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($tohandle, false));
$loginuserid = qa_get_logged_in_userid();
$errorhtml = qa_wall_error_html($loginuserid, $touseraccount['userid'], $touseraccount['flags']);
if ($errorhtml || !strlen($message) || !qa_check_form_security_code('wall-' . $tohandle, qa_post_text('code'))) {
    echo "QA_AJAX_RESPONSE\n0";
} else {
    $messageid = qa_wall_add_post($loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), $touseraccount['userid'], $touseraccount['handle'], $message, '');
    $touseraccount['wallposts']++;
    // won't have been updated
    $usermessages = qa_db_select_with_pending(qa_db_recent_messages_selectspec(null, null, $touseraccount['userid'], true, qa_opt('page_size_wall')));
    $usermessages = qa_wall_posts_add_rules($usermessages, 0);
    $themeclass = qa_load_theme_class(qa_get_site_theme(), 'wall', null, null);
    echo "QA_AJAX_RESPONSE\n1\n";
    echo 'm' . $messageid . "\n";
    // element in list to be revealed
    foreach ($usermessages as $message) {
        $themeclass->message_item(qa_wall_post_view($message));
    }
    if ($morelink && $touseraccount['wallposts'] > count($usermessages)) {
        $themeclass->message_item(qa_wall_view_more_link($tohandle, count($usermessages)));
    }
}
/*
	Omit PHP closing tag to help avoid accidental output
*/
示例#2
0
    } elseif (!$wallposterrorhtml) {
        qa_wall_add_post($loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), $useraccount['userid'], $useraccount['handle'], $inmessage, '');
        qa_redirect(qa_request());
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html_sub('profile/wall_for_x', $userhtml);
$qa_content['error'] = @$errors['page'];
$qa_content['script_rel'][] = 'qa-content/qa-user.js?' . QA_VERSION;
$qa_content['message_list'] = array('tags' => 'id="wallmessages"', 'form' => array('tags' => 'name="wallpost" method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'hidden' => array('qa_click' => '', 'handle' => qa_html($useraccount['handle']), 'start' => qa_html($start), 'code' => qa_get_form_security_code('wall-' . $useraccount['handle']))), 'messages' => array());
if ($start == 0) {
    // only allow posting on first page
    if ($wallposterrorhtml) {
        $qa_content['message_list']['error'] = $wallposterrorhtml;
    } else {
        $qa_content['message_list']['form']['fields'] = array('message' => array('tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, false), 'rows' => 2, 'error' => qa_html(@$errors['message'])));
        $qa_content['message_list']['form']['buttons'] = array('post' => array('tags' => 'name="dowallpost" onclick="return qa_submit_wall_post(this, false);"', 'label' => qa_lang_html('profile/post_wall_button')));
    }
}
foreach ($usermessages as $message) {
    $qa_content['message_list']['messages'][] = qa_wall_post_view($message);
}
$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, 'wall', $ismyuser);
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/