vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Prevent Doubleposting (https://vborg.vbsupport.ru/showthread.php?t=96602)

Xenon 05-05-2006 03:53 PM

yep, and the solution to to an automatic refresh after a post is posted here, iirc, just search the first pages of the thread, it was in them :)

JohnBee 05-05-2006 04:19 PM

Okay thanks.

I was aware of this post

Code:

// ########### Xenon Modified Prevent Doublepost Hack #########
    $dp_settings = array(
        'timespan' => 3600 * 24, // how many seconds after the last post the new post is defined as doublepost (default: 24 hours)
        'spacer' => "\n\n Additional Comment: \n",    // What should be between the old post and the new one (default: two empty lines). Note: PersianImmortal has added Additional Comment: \n to make it clear what is being added each time - can be removed if you wish.
        'editedbymsg' => '[Automerged Doublepost]', // If left blank no edited by will appear
    );
   
    $isdoublepost = false;
    $oldmsg = $post['message'];

    if ($type != 'thread'
        AND $threadinfo['lastpost'] > TIMENOW - $dp_settings['timespan']
        AND $threadinfo['lastposter'] == $vbulletin->userinfo['username'])
    {
        // we are here, so we may have a doublepost -> do more exact checkings
        $doublepost = $vbulletin->db->query_first("
            SELECT post.*
            FROM " . TABLE_PREFIX . "post AS post
            LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = post.postid AND type = 'post')
            WHERE threadid = $threadinfo[threadid]
                AND dateline > " . (TIMENOW - $dp_settings['timespan']) . "
                AND visible = 1 AND deletionlog.primaryid IS NULL
            ORDER BY dateline DESC
            LIMIT 1
        ");
   
        if ($doublepost['userid'] == $vbulletin->userinfo['userid'])
        {
            // we truely have a doublepost, now check if the merged post still fits the rules!
            $dataman2 =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
            $dataman2->set_existing($doublepost);
            $post['message'] = $doublepost['pagetext'] . $dp_settings['spacer'] . $post['message'];
           
            // set info
            $dataman2->set_info('preview', $post['preview']);
            $dataman2->set_info('parseurl', $post['parseurl']);
            $dataman2->set_info('posthash', $post['posthash']);
            $dataman2->set_info('forum', $foruminfo);
            $dataman2->set_info('thread', $threadinfo);
   
            // set options
            $dataman2->setr('showsignature', $post['signature']);
            $dataman2->setr('allowsmilie', $post['enablesmilies']);
   
            // set data
            $dataman2->setr('pagetext', $post['message']);
            $dataman2->setr('iconid', $post['iconid']);
   
            $dataman2->pre_save();
            if (!$dataman2->errors)
            {
                // merged post is ok, so do merging
                $isdoublepost = true;
                unset($dataman);
                $dataman =& $dataman2;
                $post['postid'] = $doublepost['postid'];
            }
            else
            {
                // merging will produce errors so keep it as a single post..
                $isdoublepost = false;
            }
        }
    }
   
if ($isdoublepost)
    {
        // Ugly hack added by Paul M to fix ajax merge //
        if (!$vbulletin->GPC['ajax'])
        {
            $id = $doublepost['postid'];
            $dataman->save();
       
            if ($dp_settings['editedbymsg'] != '')
            {
                $vbulletin->db->query_write("
                REPLACE INTO " . TABLE_PREFIX . "editlog (postid, userid, username, dateline, reason)
                VALUES ($id, " . $vbulletin->userinfo['userid'] . ", '" . addslashes($vbulletin->userinfo['username']) . "', " . TIMENOW . ", '" . addslashes($dp_settings['editedbymsg']) . "')
                ");
            }
        }
        $vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$post[postid]#post$post[postid]";
        eval(print_standard_redirect('redirect_postthanks', true, false));
    } 
    else
    {
        // no doublepost so save as new post
        $post['message'] = $oldmsg;
        $id = $dataman->save();
    }

This was for the file based edit however, for kicks I replaced my Main Doublepost Prevent Engine contente with this one :p
it wasn't pretty. I did a search within the thread for auto refresh and I did find 2 results but no reference with code changes other than the one shown above. am I missing it?

MixMakers 05-05-2006 04:32 PM

I tried uninstalling/reinstalling because it didn't seem to work, and now when I try to import the xml, i get this error:

XML Error: mismatched tag at Line 6

Xenon 05-06-2006 01:43 PM

sounds like a corrupted xml file, redownload it again might help :)

JohnBee 05-06-2006 02:08 PM

Quote:

Originally Posted by Xenon
yep, and the solution to to an automatic refresh after a post is posted here, iirc, just search the first pages of the thread, it was in them :)

What does iirc mean?
and I was unable to find an auto refresh function that I could incorporate into the plugin system.

vitnuce 05-06-2006 02:50 PM

Hi Xenon,

Does this hack work with v3.5.4 ?

- v

JohnBee 05-06-2006 03:05 PM

Quote:

Originally Posted by vitnuce
Hi Xenon,

Does this hack work with v3.5.4 ?

- v

Yes I'm using it on 3.5.4, its fine

Xenon 05-06-2006 04:32 PM

iirc = if i remember correctly

i just think it was posted here, but not by myself, because the things i wanted to do didn't work out as they should

JohnBee 05-06-2006 04:55 PM

Quote:

Originally Posted by Xenon
iirc = if i remember correctly

i just think it was posted here, but not by myself, because the things i wanted to do didn't work out as they should

Ah okay well thanks, I learned a new thing today iirc ;)
I have the script looking beautifully and other than the lacking autorefresh feature its way nicer than my last file edit based version. However I do miss the auto refresh option though... I wish it came as an option under the CPanel so that way we could use it as an option.

As it is now, my members are a bit confused when they see the merged message and multiple post windows within the thread. So what happens is they try to edit it and then are even more confused afterwards... (its a mess) and yes... they are not all that technical, but I still love them :p

Anyways I would be more than happy with an edit in the plugin section if you could help me have it refresh after the double post feature is activated though. I tried on my own and although i did get it to autorefresh it was very nasty looking because it would created double, triples, and more everytime. lol

Any idea what command or edit I could add to the existing script to have it auto refresh?

Xenon 05-06-2006 05:26 PM

well, nope, as i said, my tests didn'T work out well, thats why i did it the "ghost post" way ;)


All times are GMT. The time now is 04:02 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01723 seconds
  • Memory Usage 1,759KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete