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)

sv1cec 03-31-2005 02:55 PM

As I said before, one thing my mods were asking from this tool, was the ability to copy selected posts to a new thread in a specified forum. Some times, they want to edit a post, but their instructions is always to keep evidence of the original post, for dispute resolution. They usually do that, by making a copy of the thread in a specific forum. But this gets stupid, if you want to edit one post in a 200 posts thread.

So I came up with an addition to this hack, which is similar to split, but doesn't remove the original posts from the original thread, it just creates a new thread with the selected posts, in a selected forum, without touching the originals. In addition, you can select if you want to end up in the new thread's forum, or return to where you were originally (so that you can edit the original post).

For those interested, here is what you need to do, to add this functionality to this hack:

1. Open inlinemod.php and find:

PHP Code:

        // -------------------------------------------------------------------
        
        
default:
            
print_no_permission();
        break;
    }
}

// ###################################################################
// Thread moderation 

Right above that, add:

PHP Code:

        // -------------------------------------------------------------------
        
        
case 'copy':
            if (!
$vars['thread']['visible'] OR !$vars['thread']['visible'])
            {
                eval(
print_standard_error('error_invalidid'));
            }
            if (!
is_array($vars['posts']))
            {
                eval(
print_standard_error('error_nosplitposts'));
            }
            if (!
can_moderate($vars['thread']['forumid'], 'canmanagethreads'))
            {
                
print_no_permission();
            }
            
            
// Make sure that we've specified the split options
            
if (empty($_POST['do']))
            {
                
$curforumid $vars['thread']['forumid'];
                
$moveforumbits construct_move_forums_options();
                
define('PRINT_TPL''inline_copy');
            }
            else
            {
                
                
// Get the scoop on this new forum
                
$vars['newforum'] = verify_id('forum'intval($_POST['newforumid']));
                
$vars['newforuminfo'] = fetch_foruminfo($vars['newforum']);
                if (!
$vars['newforuminfo']['cancontainthreads'] OR $vars['newforuminfo']['link'])
                {
                    eval(
print_standard_error('error_moveillegalforum'));
                }
                
                
// Construct notes
                
$vars['newnotes'] = sprintf('Thread split from threadid %1$s by %2$s on %3$s at %4$s via Moderation Tool.'$vars['threadid'], $bbuserinfo['username'], vbdate($vboptions['dateformat'], TIMENOW), vbdate($vboptions['timeformat'], TIMENOW));
                
$vars['newnotes'] .= ' ' $vars['thread']['notes'];
                
                
// Create the new thread
                
$DB_site->query("
                    INSERT INTO " 
TABLE_PREFIX "thread
                    (
                        title,
                        lastpost,
                        forumid,
                        open,
                        replycount,
                        postusername,
                        postuserid,
                        lastposter,
                        dateline,
                        views,
                        iconid,
                        notes,
                        visible
                    )
                    VALUES
                    (
                        '" 
addslashes(htmlspecialchars_uni($_POST['title'])) . "',
                        " 
intval($vars['thread']['lastpost']) . ",
                        " 
intval($vars['newforum']) . ",
                        " 
intval($vars['thread']['open']) . ",
                        " 
intval($vars['thread']['replycount']) . ",
                        '" 
addslashes($vars['thread']['postusername']) . "',
                        " 
intval($vars['thread']['postuserid']) . ",
                        '" 
addslashes($vars['thread']['lastposter']) . "',
                        " 
intval($vars['thread']['dateline']) . ",
                        0,
                        " 
intval($vars['thread']['iconid']) . ",
                        '" 
addslashes($vars['newnotes']) . "',
                        " 
intval($vars['thread']['visible']) . "
                    )"
                
);
                
$vars['newthreadid'] = $DB_site->insert_id();
                
            foreach(
$vars['posts'] as $postnumber)
            {
                
$posts=$DB_site->query("SELECT * FROM " TABLE_PREFIX "post WHERE postid=$postnumber");
                
$pst=$DB_site->fetch_array($posts);
                
                
                
$DB_site->query("
                INSERT INTO " 
TABLE_PREFIX "post
                (
                    threadid,
                    parentid,
                    username,
                    userid,
                    title,
                    dateline,
                    pagetext,
                    allowsmilie,
                    showsignature,
                    ipaddress,
                    iconid,
                    visible,
                    attach,
                    warn_flag
                )
                VALUES
                (
                    " 
intval($vars[newthreadid]) . ",
                    " 
intval($pst['parentid']) . ",
                    '" 
addslashes($pst['username']) . "',
                    " 
intval($pst['userid']) . ",
                    '" 
addslashes($pst['title']) . "',
                    " 
intval($pst['dateline']) . ",
                    '" 
addslashes($pst['pagetext']) . "',
                    " 
intval($pst['allowsmilie']) . ",
                    " 
intval($pst['showsignature']) . ",
                    '" 
addslashes($pst['ipaddress']) . "',
                    " 
intval($pst['iconid']) . ",
                    " 
intval($pst['visible']) . ",
                    " 
intval($pst['attach']) . ",
                    " 
intval($pst['warn_flag']) . "
                )"
            
);
             }

                
                
// Update counters
                // #*# things like rebuild search index can go here (maybe, depeneds on MySQL fulltext imp), post count problems from switching post-counted to not (vv) forum(?)
                
build_thread_counters($vars['threadid']);
                
build_thread_counters($vars['newthreadid']);
                
build_forum_counters($vars['thread']['forumid']);
                if (
$vars['thread']['forumid'] != $vars['newforum'])
                {
                    
build_forum_counters($vars['newforum']);
                }
                
                
log_moderator_action($vars['thread'], sprintf('thread copied to %1$s (inline copy)'$vars['newthreadid']));
                
                
// Done! w00t!
                
toss_cookies();
                if (
$_POST['destination']=='old')
                {
                    
$url "showthread.php?$session[sessionurl]t=$vars[threadid]&mod=1";

                }
                else
                {
                    
$url "showthread.php?$session[sessionurl]t=$vars[newthreadid]&mod=1";
                }
                eval(
print_standard_redirect('redirect_copyposts'));
            }
        break; 

Then create a new template called inline_copy, which shall contain the followings:

HTML Code:

<form action="inlinemod.php" method="post" name="vbform">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="doproces" />
<input type="hidden" name="type" value="post" />
<input type="hidden" name="inlinemodact" value="copy" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat">$vbphrase[copy_thread]</td>
</tr>
<!--
<tr>

        <td class="thead">$vbphrase[title]: <span style="font-weight:normal">{$vars['thread']['title']}</span></td>
</tr>
-->

<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div style="width:$stylevar[formwidth]" align="$stylevar[left]">
                       
                        <fieldset class="fieldset">
                                <legend>Specify new copy thread details</legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                                <tr>
                                        <td>The selected post(s) will be copied into a new thread in the forum you will specify.<br>You may select the new thread title and in which forum it will be created.<p>
                                                New thread $vbphrase[title]  (old thread title shown):<br />
                                                <input type="text" class="bginput" name="title" size="50" value="{$vars['thread']['title']}"/>
                                        </td>
                                </tr>
                                <tr>
                                        <td>
                                                New thread $vbphrase[forum]:<br />
                                                <select name="newforumid">$moveforumbits</select>
                                        </td>
                                </tr>
                                <tr>
                                        <td>
                                                Where you want to go after the copy:<br />
<select name="destination"><option value="old">Where I was before</option><option value="new">Where the new thread will be created</option></select>
                                        </td>
                                </tr>
                                </table>
                        </fieldset>
               
                </div>
        </div>
       
        <div style="margin-top:$stylevar[cellpadding]px">
                <input type="submit" class="button" value="$vbphrase[copy_thread]" accesskey="s" />
                <input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />
                <input type="button" class="button" value="$vbphrase[cancel]" accesskey="c" onclick="history.back(1)" />
        </div>
        </td>
</tr>
</table>

</form>


Then open your SHOWTHREAD template and find:

HTML Code:

<select name="inlinemodact">
                                        <option value="merge" selected="selected">Merge Posts</option>
                                        <option value="delete">Soft Delete Posts</option>
                                        <option value="split">Split Posts</option>

Right below that, add :

HTML Code:

<option value="copy">Copy Posts</option>
Finally add a phrase:

Type : Front-end redirect messages
Name: copyposts
Contents: The selected posts have been copied to a new thread, in the forum you specified.

You may want to run this query, to change an existing phrase, so that it can be used in copying as well as in splitting:

update phrase set text='You must specify some posts to split/copy from this thread.' where varname='nosplitposts'


I think this is it, I hope I am not forgetting anything.

YLP1 04-04-2005 05:00 PM

Quote:

You may want to run this query, to change an existing phrase, so that it can be used in copying as well as in splitting:

update phrase set text='You must specify some posts to split/copy from this thread.' where varname='nosplitposts'

I'm confused with this part of this code. How do I do this?

Thanks in advance.

Delphiprogrammi 04-04-2005 09:12 PM

Quote:

Originally Posted by YLP1
I'm confused with this part of this code. How do I do this?

Thanks in advance.

that's a database query phpMyAdmin will help you ...

Code:

UPDATE  phrase SET text='You must specify some posts to split/copy from this thread.' WHERE varname='nosplitposts'

Nordinho 04-05-2005 10:32 PM

Heya,

My body onload tag was allready modified by the image resize hack.
Currently I changed it to:

<body onload="<if condition="can_moderate($thread['forumid']) AND $show['inlinemod']">inline_init($thread[threadid], 'post');</if>$onload ; fiImageResize()">

but this is not working, any idea's what I need to change here??

previously it was:

<body onload="$onload; fiImageResize()">

rob_daemon 04-07-2005 02:58 AM

Try this:

HTML Code:

<body onload="<if condition="can_moderate($thread['forumid']) AND $show['inlinemod']">inline_init($thread[threadid], 'post');</if> fiImageResize(); $onload">

rob_daemon 04-07-2005 03:05 AM

Just an update on things:

I'm working on abstracting a lot of the functions to make it easier to keep things organized and working right. This weekend I'm going to be swamped with work, so I probably won't get anything done. Next weekend I have to finish off a few of my own coding projects. Then in three weeks, I should have time to put the final touches on it. My goal is to have it out by the end of the month.

MentaL 04-10-2005 12:28 AM

hi, my mods say they get a no permission error when using this.. any idea?

rob_daemon 04-10-2005 10:58 PM

Do they have JavaScript enabled? When they click the "Go" button does it have a number in parenthesis or not? What browsers are they using?

MentaL 04-11-2005 12:16 AM

they areable to use it but they get permission denied error.. like as if they where not allowed to use script.. IE (Not mods..)

rob_daemon 04-12-2005 05:34 AM

When they're using the tool, at the bottom of the page there's a "Go" button; when they click it is there a number in parenthesis or not?


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