Exemplo n.º 1
0
	'S_NUM_POSTS' => sizeof($post_list))
);


if (!function_exists('array_all_thanks'))
{
	include($phpbb_root_path . 'includes/functions_thanks.' . $phpEx);
}
array_all_thanks($post_list);
if (isset($_REQUEST['thanks']) && !isset($_REQUEST['rthanks'])) 
{
	insert_thanks(request_var('thanks', 0), $user->data['user_id']);
}
if (isset($_REQUEST['rthanks']) && !isset($_REQUEST['thanks']))
{
	delete_thanks(request_var('rthanks', 0), $user->data['user_id']);
}
if (isset($_REQUEST['list_thanks'])) 
{
	clear_list_thanks(request_var('p', 0), request_var('list_thanks', ''));
}
// Output the posts
$first_unread = $post_unread = false;
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
{
	// A non-existing rowset only happens if there was no user present for the entered poster_id
	// This could be a broken posts table.
	if (!isset($rowset[$post_list[$i]]))
	{
		continue;
	}
Exemplo n.º 2
0
if ($_REQUEST['do'] == 'special_actions') {
    ($hook = vBulletinHook::fetch_hook('post_thanks_admin_special_actions_start')) ? eval($hook) : false;
    print_form_header('post_thanks_admin', 'delete_all_users_thanks');
    print_table_header($vbphrase['post_thanks_delete_all_users_thanks'], 2, 0);
    print_description_row($vbphrase['post_thanks_delete_all_users_thanks_help']);
    print_input_row($vbphrase['userid'], 'userid');
    print_submit_row($vbphrase['post_thanks_delete_all_users_thanks']);
    ($hook = vBulletinHook::fetch_hook('post_thanks_admin_special_actions_end')) ? eval($hook) : false;
}
if ($_REQUEST['do'] == 'delete_all_users_thanks') {
    $vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT));
    $userid = $vbulletin->GPC['userid'];
    ($hook = vBulletinHook::fetch_hook('post_thanks_admin_delete_all_users_thanks_start')) ? eval($hook) : false;
    echo '<p>' . $vbphrase['post_thanks_delete_all_users_thanks'] . '</p>';
    $thanks = $db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "post_thanks\n\t\tWHERE userid = {$userid}\n\t\tORDER BY postid\n\t");
    while ($thank = $db->fetch_array($thanks)) {
        $postinfo = fetch_postinfo($thank['postid']);
        if ($postinfo === false) {
            $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "post_thanks WHERE postid = '{$thank['postid']}' AND userid = '{$userid}'");
        } else {
            delete_thanks($postinfo, $userid);
        }
        echo construct_phrase($vbphrase['processing_x'], $thank['postid']) . "<br />\n";
        vbflush();
    }
    ($hook = vBulletinHook::fetch_hook('post_thanks_admin_delete_all_users_thanks_end')) ? eval($hook) : false;
    define('CP_REDIRECT', 'post_thanks_admin.php?do=special_actions');
    print_stop_message('post_thanks_delete_all_users_thanks_successfully');
}
($hook = vBulletinHook::fetch_hook('post_thanks_admin_end')) ? eval($hook) : false;
print_cp_footer();
Exemplo n.º 3
0
function do_like()
{
    global $vbulletin, $postinfo, $threadinfo, $forumid;
    @(require_once DIR . '/includes/functions_post_thanks.php');
    $vbulletin->input->clean_array_gpc('r', array('postid' => TYPE_INT));
    if (!function_exists('fetch_thanks') || !$vbulletin->userinfo['userid']) {
        return array('success' => true);
    }
    $thanks = fetch_thanks($vbulletin->GPC['postid']);
    // Figure out if we've thanked this post
    $thanked = false;
    if (is_array($thanks)) {
        foreach ($thanks as $thank) {
            if ($thank['userid'] == $vbulletin->userinfo['userid']) {
                $thanked = true;
                break;
            }
        }
    }
    $threadinfo = verify_id('thread', $postinfo['threadid'], 1, 1);
    if ($thanked) {
        delete_thanks($postinfo, $vbulletin->userinfo['userid']);
    } else {
        $postinfo = array_merge($postinfo, fetch_userinfo($postinfo['userid']));
        if (post_thanks_off($threadinfo['forumid'], $postinfo, $threadinfo['firstpostid']) || !can_thank_this_post($postinfo, $threadinfo['isdeleted']) || thanked_already($postinfo)) {
            return array('success' => true);
        }
        add_thanks($postinfo);
    }
    return array('success' => true);
}
Exemplo n.º 4
0
    ($hook = vBulletinHook::fetch_hook('post_thanks_main_remove_all_thanks_start')) ? eval($hook) : false;
    if (!can_delete_all_thanks()) {
        $using_ajax ? exit : print_no_permission();
    }
    delete_all_thanks($postinfo);
    ($hook = vBulletinHook::fetch_hook('post_thanks_main_remove_all_thanks_end')) ? eval($hook) : false;
    if ($using_ajax) {
        exit;
    } else {
        $vbulletin->url = "showthread.php?{$session['sessionurl']}p={$postid}";
        eval(print_standard_redirect('redirect_post_thanks'));
    }
}
if ($_REQUEST['do'] == 'post_thanks_remove_user') {
    ($hook = vBulletinHook::fetch_hook('post_thanks_main_remove_user_thanks_start')) ? eval($hook) : false;
    if (!delete_thanks($postinfo, $vbulletin->userinfo['userid'])) {
        $using_ajax ? exit : print_no_permission();
    }
    ($hook = vBulletinHook::fetch_hook('post_thanks_main_remove_user_thanks_end')) ? eval($hook) : false;
    $postinfo['post_thanks_amount'] = $postinfo['post_thanks_amount'] - 1;
    if ($postinfo['post_thanks_amount'] > 0 && $using_ajax) {
        $thanks = fetch_thanks($postid, '', true);
        $postinfo['post_thanks_bit'] = fetch_thanks_bit($forumid, $thanks);
        $postinfo['post_thanks_amount_formatted'] = vb_number_format($postinfo['post_thanks_amount']);
        $postinfo['post_thanks_user'] = false;
        $postinfo['ajax'] = true;
        $echo = fetch_post_thanks_template($postinfo);
        echo "{$echo}";
        exit;
    } else {
        if ($using_ajax) {