View Single Post
  #3  
Old 06-19-2009, 09:29 PM
Dj Sagi Dj Sagi is offline
 
Join Date: Oct 2008
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in inlinemod.php file
i add to (2 times)
PHP Code:
switch ($_POST['do'])
{
    case 
'dodeletethreads':
    case 
'domovethreads'
this:
PHP Code:
    case 'domovethreadsbin'
my bin forum id is 168

so i add this:
PHP Code:
if ($_POST['do'] == 'domovethreadsbin')
{
    
$vbulletin->input->clean_array_gpc('p', array(
        
'destforumid' => TYPE_UINT,
        
'redirect'    => TYPE_STR,
        
'frame'       => TYPE_STR,
        
'period'      => TYPE_UINT,
    ));

    
// check whether dest can contain posts
    
$destforumid verify_id('forum''168');
    
$destforuminfo fetch_foruminfo($destforumid);
    if (!
$destforuminfo['cancontainthreads'] OR $destforuminfo['link'])
    {
        eval(
standard_error(fetch_error('moveillegalforum')));
    }

    
// check destination forum permissions
    
$forumperms fetch_permissions($destforuminfo['forumid']);
    if (!(
$forumperms $vbulletin->bf_ugp_forumpermissions['canview']))
    {
        
print_no_permission();
    }

    if (
$vbulletin->GPC['redirect'] == 'none')
    {
        
$method 'move';
    }
    else
    {
        
$method 'movered';
    }

    
$countingthreads = array();
    
$redirectids = array();

    
// Validate threads
    
$threads $db->query_read_slave("
        SELECT threadid, visible, open, pollid, title, prefixid, postuserid, forumid
        " 
. ($method == 'movered' ", lastpost, replycount, postusername, lastposter, dateline, views, iconid" "") . "
        FROM " 
TABLE_PREFIX "thread
        WHERE threadid IN(" 
implode(','$threadids) . ")
    "
);
    while (
$thread $db->fetch_array($threads))
    {
        
$forumperms fetch_permissions($thread['forumid']);
        if     (
            !(
$forumperms $vbulletin->bf_ugp_forumpermissions['canview'])
                OR
            !(
$forumperms $vbulletin->bf_ugp_forumpermissions['canviewthreads'])
                OR
            (!(
$forumperms $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND $thread['postuserid'] != $vbulletin->userinfo['userid'])
            )
        {
            
print_no_permission();
        }

        
$thread['prefix_plain_html'] = ($thread['prefixid'] ? htmlspecialchars_uni($vbphrase["prefix_$thread[prefixid]_title_plain"]) . ' ' '');

        if (!
can_moderate($thread['forumid'], 'canmanagethreads'))
        {
            eval(
standard_error(fetch_error('you_do_not_have_permission_to_manage_threads_and_posts'$vbphrase['n_a'], $thread['prefix_plain_html'] . $thread['title'], $vbulletin->forumcache["$thread[forumid]"]['title'])));
        }
        else if (!
$thread['visible'] AND !can_moderate($thread['forumid'], 'canmoderateposts'))
        {
            eval(
standard_error(fetch_error('you_do_not_have_permission_to_manage_moderated_threads_and_posts')));
        }
        else if (
$thread['visible'] == AND !can_moderate($thread['forumid'], 'candeleteposts'))
        {
            eval(
standard_error(fetch_error('you_do_not_have_permission_to_manage_deleted_threads_and_posts'$vbphrase['n_a'], $thread['prefix_plain_html'] . $thread['title'], $vbulletin->forumcache["$thread[forumid]"]['title'])));
        }

        if (
$thread['visible'] == AND !can_moderate($destforuminfo['forumid'], 'candeleteposts'))
        {
            eval(
standard_error(fetch_error('you_do_not_have_permission_to_manage_deleted_threads_and_posts_in_destination_forum')));
        }
        else if (!
$thread['visible'] AND !can_moderate($destforuminfo['forumid'], 'canmoderateposts'))
        {
            eval(
standard_error(fetch_error('you_do_not_have_permission_to_manage_moderated_threads_and_posts_in_destination_forum')));
        }

        
// Ignore all threads that are already in the destination forum
        
if ($thread['forumid'] == $destforuminfo['forumid'])
        {
            
$sameforum true;
            continue;
        }

        
$threadarray["$thread[threadid]"] = $thread;
        
$forumlist["$thread[forumid]"] = true;

        if (
$thread['open'] == 10)
        {
            
$redirectids["$thread[pollid]"][] = $thread['threadid'];
        }
        else if (
$thread['visible'])
        {
            
$countingthreads[] = $thread['threadid'];
        }
    }

    if (empty(
$threadarray))
    {
        if (
$sameforum)
        {
            eval(
standard_error(fetch_error('thread_is_already_in_the_forum')));
        }
        else
        {
            eval(
standard_error(fetch_error('you_did_not_select_any_valid_threads')));
        }
    }

    
// check to see if these threads are being returned to a forum they've already been in
    // if redirects exist in the destination forum, remove them
    
$checkprevious $db->query_read_slave("
        SELECT threadid
        FROM " 
TABLE_PREFIX "thread
        WHERE forumid = 
$destforuminfo[forumid]
            AND open = 10
            AND pollid IN(" 
implode(','array_keys($threadarray)) . ")
    "
);
    while (
$check $db->fetch_array($checkprevious))
    {
        
$old_redirect =& datamanager_init('Thread'$vbulletinERRTYPE_SILENT'threadpost');
        
$old_redirect->set_existing($check);
        
$old_redirect->delete(falsetrueNULLfalse);
        unset(
$old_redirect);
    }

    
// check to see if a redirect is being moved to a forum where its destination thread already exists
    // if so delete the redirect
    
if (!empty($redirectids))
    {
        
$checkprevious $db->query_read_slave("
            SELECT threadid
            FROM " 
TABLE_PREFIX "thread
            WHERE forumid = 
$destforuminfo[forumid]
                AND threadid IN(" 
implode(','array_keys($redirectids)) . ")

        "
);
        while (
$check $db->fetch_array($checkprevious))
        {
            if (!empty(
$redirectids["$check[threadid]"]))
            {
                foreach(
$redirectids["$check[threadid]"] AS $threadid)
                {
                    
$old_redirect =& datamanager_init('Thread'$vbulletinERRTYPE_SILENT'threadpost');
                    
$old_redirect->set_existing($threadarray["$threadid"]);
                    
$old_redirect->delete(falsetrueNULLfalse);
                    unset(
$old_redirect);

                    
# Remove redirect threadids from $threadarray so no log entry is entered below or new redirect is added
                    
unset($threadarray["$threadid"]);
                }
            }
        }
    }

    if (!empty(
$threadarray))
    {
        
// Move threads
        // If mod can not manage threads in destination forum then unstick all moved threads
        
$db->query_write("
            UPDATE " 
TABLE_PREFIX "thread
            SET forumid = 
$destforuminfo[forumid]
            " 
. (!can_moderate($destforuminfo['forumid'], 'canmanagethreads') ? ", sticky = 0" "") . "
            WHERE threadid IN(" 
implode(','array_keys($threadarray)) . ")
        "
);

        require_once(
DIR '/includes/functions_prefix.php');
        
remove_invalid_prefixes(array_keys($threadarray), $destforuminfo['forumid']);

        
// update canview status of thread subscriptions
        
update_subscriptions(array('threadids' => array_keys($threadarray)));

        
// kill the post cache for these threads
        
delete_post_cache_threads(array_keys($threadarray));

        
$movelog = array();
        
// Insert Redirects FUN FUN FUN
        
if ($method == 'movered')
        {
            
$redirectsql = array();
            if (
$vbulletin->GPC['redirect'] == 'expires')
            {
                switch(
$vbulletin->GPC['frame'])
                {
                    case 
'h':
                        
$expires mktime(date('H') + $vbulletin->GPC['period'], date('i'), date('s'), date('m'), date('d'), date('y'));
                        break;
                    case 
'd':
                        
$expires mktime(date('H'), date('i'), date('s'), date('m'), date('d') + $vbulletin->GPC['period'], date('y'));
                        break;
                    case 
'w':
                        
$expires $vbulletin->GPC['period'] * 60 60 24 TIMENOW;
                        break;
                    case 
'y':
                        
$expires =  mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('y') + $vbulletin->GPC['period']);
                        break;
                    case 
'm':
                        default:
                        
$expires =  mktime(date('H'), date('i'), date('s'), date('m') + $vbulletin->GPC['period'], date('d'), date('y'));
                }
            }
            foreach(
$threadarray AS $threadid => $thread)
            {
                if (
$thread['visible'] == 1)
                {
                    
$thread['open'] = 10;
                    
$thread['pollid'] = $threadid;
                    unset(
$thread['threadid']);
                    
$redir =& datamanager_init('Thread'$vbulletinERRTYPE_SILENT'threadpost');
                    foreach (
array_keys($thread) AS $field)
                    {
                        
// bypassing the verify_* calls; this data should be valid as is
                        
if (isset($redir->validfields["$field"]))
                        {
                            
$redir->setr($field$thread["$field"], truefalse);
                        }
                    }
                    
$redirthreadid $redir->save();
                    if (
$vbulletin->GPC['redirect'] == 'expires')
                    {
                        
$redirectsql[] = "$redirthreadid$expires";
                    }
                    unset(
$redir);
                }
                else
                {
                    
// else this is a moderated or deleted thread so leave no redirect behind
                    // insert modlog entry of just "move", not "moved with redirect"
                    // unset threadarray[threadid] so thread_moved_with_redirect log entry is not entered below.

                    
unset($threadarray["$threadid"]);
                    
$movelog = array(
                        
'userid'   =>& $vbulletin->userinfo['userid'],
                        
'forumid'  =>& $thread['forumid'],
                        
'threadid' => $threadid,
                    );
                }
            }

            if (!empty(
$redirectsql))
            {
                
$db->query_write("
                    INSERT INTO " 
TABLE_PREFIX "threadredirect
                        (threadid, expires)
                    VALUES
                        (" 
implode("), ("$redirectsql) . ")
                "
);
            }
        }

        if (!empty(
$movelog))
        {
            
log_moderator_action($movelog'thread_moved_to_x'$destforuminfo['title']);
        }

        if (!empty(
$threadarray))
        {
            foreach (
$threadarray AS $threadid => $thread)
            {
                
$modlog[] = array(
                    
'userid'   =>& $vbulletin->userinfo['userid'],
                    
'forumid'  =>& $thread['forumid'],
                    
'threadid' => $threadid,
                );
            }

            
log_moderator_action($modlog, ($method == 'move') ? 'thread_moved_to_x' 'thread_moved_with_redirect_to_a'$destforuminfo['title']);

            if (!empty(
$countingthreads))
            {
                
$posts $db->query_read_slave("
                    SELECT userid, threadid
                    FROM " 
TABLE_PREFIX "post
                    WHERE threadid IN(" 
implode(','$countingthreads) . ")
                        AND visible = 1
                        AND    userid > 0
                "
);
                
$userbyuserid = array();
                while (
$post $db->fetch_array($posts))
                {
                    
$foruminfo fetch_foruminfo($threadarray["$post[threadid]"]['forumid']);
                    if (
$foruminfo['countposts'] AND !$destforuminfo['countposts'])
                    {    
// Take away a post
                        
if (!isset($userbyuserid["$post[userid]"]))
                        {
                            
$userbyuserid["$post[userid]"] = -1;
                        }
                        else
                        {
                            
$userbyuserid["$post[userid]"]--;
                        }
                    }
                    else if (!
$foruminfo['countposts'] AND $destforuminfo['countposts'])
                    {    
// Add a post
                        
if (!isset($userbyuserid["$post[userid]"]))
                        {
                            
$userbyuserid["$post[userid]"] = 1;
                        }
                        else
                        {
                            
$userbyuserid["$post[userid]"]++;
                        }
                    }
                }

                if (!empty(
$userbyuserid))
                {
                    
$userbypostcount = array();
                    
$alluserids '';

                    foreach (
$userbyuserid AS $postuserid => $postcount)
                    {
                        
$alluserids .= ",$postuserid";
                        
$userbypostcount["$postcount"] .= ",$postuserid";
                    }
                    foreach (
$userbypostcount AS $postcount => $userids)
                    {
                        
$casesql .= " WHEN userid IN (0$userids) THEN $postcount";
                    }

                    
$db->query_write("
                        UPDATE " 
TABLE_PREFIX "user
                        SET posts = CAST(posts AS SIGNED) +
                        CASE
                            
$casesql
                            ELSE 0
                        END
                        WHERE userid IN (0
$alluserids)
                    "
);
                }
            }
        }
    }

    foreach(
array_keys($forumlist) AS $forumid)
    {
        
build_forum_counters($forumid);
    }
    
build_forum_counters($destforuminfo['forumid']);

    
// empty cookie
    
setcookie('vbulletin_inlinethread'''TIMENOW 3600'/');

    (
$hook vBulletinHook::fetch_hook('inlinemod_domovethread')) ? eval($hook) : false;

    eval(
print_standard_redirect('redirect_inline_moved'true$forceredirect));


i only take the domovethreads action and i copy
and i change the acion name to domovethreadsbin
after i change in the 10 first lines this line:
PHP Code:
    $destforumid verify_id('forum'$vbulletin->GPC['destforumid']); 
to this line:

PHP Code:
    $destforumid verify_id('forum''168'); 
and it is say that i dont choose any forum...

thx for help!
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01555 seconds
  • Memory Usage 2,052KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete