vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Inline Moderation Tools (v1.2.1) (https://vborg.vbsupport.ru/showthread.php?t=68791)

rob_daemon 12-09-2004 03:07 PM

Quote:

Originally Posted by sv1cec
Nope!

Database error in vBulletin 3.0.3:

Invalid SQL: UPDATE subscribethread SET threadid = 281 WHERE subscribethread IN (Array)
mysql error: Unknown column 'subscribethread' in 'where clause'

mysql error number: 1054

Date: Thursday 09th of December 2004 11:57:56 AM
Script: http://forum.m1911.org/inlinemod.php
Referer: http://forum.m1911.org/inlinemod.php
Username: John
IP Address: 62.38.176.245

Replace

PHP Code:

$DB_site->query("UPDATE " TABLE_PREFIX "subscribethread SET threadid = $firstthread WHERE subscribethread IN ($subthreads)"); 

With:

PHP Code:

$DB_site->query("UPDATE " TABLE_PREFIX "subscribethread SET threadid = $firstthread WHERE subscribethread IN (" implode(', '$subthreads) . ")"); 

And if that doesn't work, then just change:

PHP Code:

$DB_site->query("UPDATE " TABLE_PREFIX "subscribethread SET threadid = $firstthread WHERE subscribethread IN (" implode(', '$subthreads) . ")"); 

To:

PHP Code:

// $DB_site->query("UPDATE " . TABLE_PREFIX . "subscribethread SET threadid = $firstthread WHERE subscribethread IN (" . implode(', ', $subthreads) . ")"); 


sv1cec 12-09-2004 04:41 PM

Quote:

Originally Posted by rob_daemon
Replace

PHP Code:

$DB_site->query("UPDATE " TABLE_PREFIX "subscribethread SET threadid = $firstthread WHERE subscribethread IN ($subthreads)"); 

With:

PHP Code:

$DB_site->query("UPDATE " TABLE_PREFIX "subscribethread SET threadid = $firstthread WHERE subscribethread IN (" implode(', '$subthreads) . ")"); 

And if that doesn't work, then just change:

PHP Code:

$DB_site->query("UPDATE " TABLE_PREFIX "subscribethread SET threadid = $firstthread WHERE subscribethread IN (" implode(', '$subthreads) . ")"); 

To:

PHP Code:

// $DB_site->query("UPDATE " . TABLE_PREFIX . "subscribethread SET threadid = $firstthread WHERE subscribethread IN (" . implode(', ', $subthreads) . ")"); 


Can you please check your code in inlinemod.php? for example:

PHP Code:

case 'move':
            if (!
can_moderate($threadinfo['forumid'], 'canmanagethreads')) 

PHP Code:

case 'open':
            if (!
can_moderate($vars['forumid'], 'canopenclose')) 

In the first case, you check for $threadinfo['forumid'] and in the second you check for vars['forumid']. I think the second is the correct, but should it be replaced in all thread-related cases?

sv1cec 12-09-2004 05:20 PM

OK, here is the code I came up with, it is mostly based on the postings.php code, with some mods to make it suitable for more than two threads.

PHP Code:

        case 'merge':

            if (!
can_moderate($vars['forumid'], 'canmanagethreads'))
            {
                
print_no_permission();
            }
            if (!
is_array($vars['threads']))
            {
                eval(
print_standard_error('error_invalidid'));
            }
            if (empty(
$_POST['do']))
            {
                
define('PRINT_TPL''inline_merge_thread');
            }
            else
            {
            
toss_cookies();
                    
            
$sqlthreads implode(', '$vars['threads']);
            
            
$firstpost $DB_site->query_first("SELECT * FROM " TABLE_PREFIX "post WHERE threadid IN ($sqlthreads) ORDER BY dateline ASC");
            
$notes=$firstpost['notes'];
            
$thrd_firstpost=$firstpost['postid'];
            
$oldtitle=$firstpost['title'];
            
$notes=$firstpost['notes'];
            
$title=$_POST['title'];
            
$threadid=$firstpost['threadid'];
            
$newnotes sprintf('Thread merged from other threads by %1$s on %2$s at %3$s via Moderation Tool.'$bbuserinfo['username'], vbdate($vboptions['dateformat'], TIMENOW), vbdate($vboptions['timeformat'], TIMENOW));
            
$newnotes .= $notes;

            if (
$title=='')
            {
                
$title=$oldtitle;
            }

            foreach (
$vars['threads'] AS $mergethreadid)
            {
                if (
$mergethreadid!=$threadid)
                {
                    
$mergethreadid verify_id('thread'$mergethreadid);
                    
$mergethreadinfo fetch_threadinfo($mergethreadid);
                    
$mergeforuminfo fetch_foruminfo($mergethreadinfo['forumid']);
                
                    if (!
$mergethreadinfo['visible'] OR $mergethreadinfo['isdeleted'] OR $mergethreadid == $threadid)
                    {
                        eval(
print_standard_error('error_invalidid'));
                    }
                
                    
// check forum permissions for the merge forum
                    
$mergeforumperms fetch_permissions($mergethreadinfo['forumid']);
                    if (!(
$mergeforumperms CANVIEW) OR !can_moderate($mergethreadinfo['forumid'], 'canmanagethreads'))
                    {
                        
print_no_permission();
                    }
                
                    
// check if there is a forum password and if so, ensure the user has it set
                    
verify_forum_password($mergeforuminfo['forumid'], $mergeforuminfo['password']);
                    
$mrgthrd_firstpost $DB_site->query_first("
                        SELECT postid
                        FROM " 
TABLE_PREFIX "post
                        WHERE threadid = 
$mergethreadinfo[threadid]
                        ORDER BY dateline ASC
                    "
);
                
                    
// sort out polls
                    
$pollcode '';
                    if (
$mergethreadinfo['pollid'] != 0)
                    { 
// merge thread has poll ...
                        
if ($threadinfo['pollid'] == 0)
                        { 
// ... and original thread doesn't
                            
$pollcode ',pollid = ' $mergethreadinfo['pollid'];
                        }
                        else
                        { 
// ... and original does
                            // if the poll isn't found anywhere else, delete the merge thread's poll
                            
if (!$poll $DB_site->query_first("
                                SELECT threadid
                                FROM " 
TABLE_PREFIX "thread
                                WHERE pollid = 
$mergethreadinfo[pollid] AND
                                    threadid <> 
$mergethreadinfo[threadid]
                                "
))
                            {
                                
$DB_site->query("DELETE FROM " TABLE_PREFIX "poll WHERE pollid = $mergethreadinfo[pollid]");
                                
$DB_site->query("DELETE FROM " TABLE_PREFIX "pollvote WHERE pollid = $mergethreadinfo[pollid]");
                            }
                        }
                    }
                
                    
// move posts
                    
$DB_site->query("UPDATE " TABLE_PREFIX "post SET threadid = $threadid WHERE threadid = $mergethreadid");
                    
$DB_site->query("UPDATE " TABLE_PREFIX "post SET parentid = $thrd_firstpost[postid] WHERE postid = $mrgthrd_firstpost[postid]"); // make merge thread child of first post in other thread
                    
$DB_site->query("UPDATE " TABLE_PREFIX "thread SET title = '" addslashes(htmlspecialchars_uni($title)) . "'$pollcode WHERE threadid = $threadid");
                    
$DB_site->query("DELETE FROM " TABLE_PREFIX "thread WHERE threadid = $mergethreadid");
                    
$DB_site->query("UPDATE " TABLE_PREFIX "thread SET pollid = $threadid WHERE open = 10 AND pollid = $mergethreadid"); // update redirects
                    
$DB_site->query("DELETE FROM " TABLE_PREFIX "threadrate WHERE threadid = $mergethreadid");
                    
$DB_site->query("DELETE FROM " TABLE_PREFIX "subscribethread WHERE threadid = $mergethreadid");
                
                    
// update postindex for the 2 posts who's titles may have changed (first post of each thread)
                    
delete_post_index($thrd_firstpost['postid']);
                    
delete_post_index($mrgthrd_firstpost['postid']);
                    
build_post_index($thrd_firstpost['postid'] , $foruminfo);
                    
build_post_index($mrgthrd_firstpost['postid'] , $foruminfo);
                
                    
build_thread_counters($threadid);
                    
build_forum_counters($threadinfo['forumid']);
                    if (
$mergethreadinfo['forumid'] != $threadinfo['forumid'])
                    {
                        
build_forum_counters($mergethreadinfo['forumid']);
                    }
                }
            }
            if (
$vars['forumid'])
            {
                
$url "forumdisplay.php?$session[sessionurl]f=$vars[forumid]&mod=1";
                eval(
print_standard_redirect('redirect_mergethread'));
            }
        }
        break; 

It works for me!

I just do not know what toss_cookies does!

Rgds

rob_daemon 12-10-2004 04:49 AM

Tell me if the attached file fixes the bug, it should. If it does I'll release 1.2.1. By the way, the code you posted doesn't handle polls in two or more threads elegantly (which is why I chose to throw an error in this event), it doesn't update the parentid for all the merged threads, and other things for more than two threads. If you just merge two, it should work, but otherwise there will be a problem.

By the way, toss_cookies() is the first of two methods to remove the inline moderation cookies after an action.

sv1cec 12-10-2004 05:23 AM

Quote:

Originally Posted by rob_daemon
Tell me if the attached file fixes the bug, it should. If it does I'll release 1.2.1. By the way, the code you posted doesn't handle polls in two or more threads elegantly (which is why I chose to throw an error in this event), it doesn't update the parentid for all the merged threads, and other things for more than two threads. If you just merge two, it should work, but otherwise there will be a problem.

By the way, toss_cookies() is the first of two methods to remove the inline moderation cookies after an action.

Rob_daemon,

Yes, this file works fine. May I humbly suggest two improvements before you release next version? First, I would like to see a note attached at the merged thread saying "This thread was created by merging other threads, by ...., on ...., at ..... . I'll add that myself if you don't, but I think it is a worthwhile addition.

Second, you do not have to be so restrictive with the title of the new thread. What I would suggest is, to show the mod the title of the first thread you are merging, and allow him to change it, if he so wants. If he doesn't, then you can use the original, first thread title, as the title for the new merged thread.

Finally, since merging two threads can result in a new thread, whose placement needs to be changed (moved to a different forum), why don't you add the forum selection in the template form, and if the user selects a different forum, from the one in which the initial threads were, then move the new, merged thread to the new forum. In that way, the mod does not have to do a merge and then do a move.

Just a couple of thoughts.

One more thing I just found out, although I am not sure if you can do something about it. I have installed another hack, which shows me which members have seen a thread. It looks as if after the merging, that information is lost, since in the merged thread, it only shows me, as having seen it. I think it should show all members who have seen all merged threads. A pain? Yeah, I guess you are right. I'll see if I can do something about this.

By the way, this is one of the most useful hacks I've seen, thank you Sir.

Rgds

rob_daemon 12-10-2004 03:26 PM

Glad that finally fixed :).

I do plan to add logging to all of the inline actions; I do it for a few right now, but I want to add it in for all as well as cleaning up the entire system.

Also in 1.2.1 there will be a small change to the inline_merge_thread template that will set the default title.

Adding a move thread in the merge screen could be a possibility. I'll see about adding that in either 1.2.1 or the next version.

As far as that hack, wherever the hack is storing read information, the table probably needs to be updated to change all the old threadid's to the new ones.

sv1cec 12-10-2004 04:37 PM

Quote:

Originally Posted by rob_daemon
Glad that finally fixed :).

I do plan to add logging to all of the inline actions; I do it for a few right now, but I want to add it in for all as well as cleaning up the entire system.

Also in 1.2.1 there will be a small change to the inline_merge_thread template that will set the default title.

Adding a move thread in the merge screen could be a possibility. I'll see about adding that in either 1.2.1 or the next version.

As far as that hack, wherever the hack is storing read information, the table probably needs to be updated to change all the old threadid's to the new ones.

I have changed the merge_thread template and the code, to do a merging and a move. I also edit it so that it shows the user the title of the first thread, and if he doesn't change it, the merged thread uses that title instead. If you want, I can send you my code.

I also added the remove thread functionality, to show up in the menu only for admins. Admitedly it's a risk, but it's quite useful for cleaning up the forums sometimes.

Rgds
----------
John

dndog 12-11-2004 02:41 PM

I don't understand, but the inline moderation tools work horridly at my site.

They often deny users with permission the ability to use them. The users are in the registered user group, but they have moderator abilities.

In IE, they cause a "script error, debug" message which pops up on each page where they are.

I am currently using vB3.0.1.

Any fix I can do for this?

rob_daemon 12-11-2004 06:21 PM

Quote:

Originally Posted by dndog
I don't understand, but the inline moderation tools work horridly at my site.

They often deny users with permission the ability to use them. The users are in the registered user group, but they have moderator abilities.

In IE, they cause a "script error, debug" message which pops up on each page where they are.

I am currently using vB3.0.1.

Any fix I can do for this?

What version of the inline moderation tools are you using? If you're not using at least 1.2.0 you should upgrade which will fix all of the javascript errors and other problems.

WebMasterAJ 12-11-2004 08:12 PM

Thanks for that first fix... but I have some good news and some bad news.

It now displays the drop down menu for my, however, there are no check boxes in the forum display and posts. It just displays a black cell in the forum display...

Any ideas?

Thanks again for your time and energy!

Sincerely,
Andrew Tatum


All times are GMT. The time now is 03:39 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.02613 seconds
  • Memory Usage 1,876KB
  • 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
  • (11)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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