vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Okay, so im converting a mod, and... (https://vborg.vbsupport.ru/showthread.php?t=101623)

TyleR 11-26-2005 06:58 PM

Okay, so im converting a mod, and...
 
would like a tad bit o' help from you more experianced ones..im porting Mad_Max (of vbhackers.com)'s Install System Mod to vB 3.5.x...well, it requires a LOT of file editing..mostly within attachment.php (replacing code).

is there any way to get around replacing alot of the code by using a hook?

Thanks!,

Tyler

Code Monkey 11-26-2005 07:26 PM

Look inside attachment.php and see if there are any hooks located where your code would go.

TyleR 11-26-2005 09:35 PM

there is, but it needs to replace a line above the hook..what I was wondering is if there was a work-around from editing attachment.php itself.

Marco van Herwaarden 11-26-2005 09:41 PM

Try to recode it so it can run in the hook location instead of above.

TyleR 11-26-2005 10:30 PM

not possible..this is what i'm talking about:

Code:

======
find:
======

if ($attachmentinfo['postid'] == 0)
{        // Attachment that is in progress but hasn't been finalized
        if ($vbulletin->userinfo['userid'] != $attachmentinfo['userid'] AND !can_moderate($attachmentinfo['forumid'], 'caneditposts'))
        {        // Person viewing did not upload it
                eval(standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink'])));
        }
        // else allow user to view the attachment (from the attachment manager for example)
}
else
{
        $forumperms = fetch_permissions($attachmentinfo['forumid']);

        $threadinfo = array('threadid' => $attachmentinfo['threadid']); // used for session.inthread
        $foruminfo = array('forumid' => $attachmentinfo['forumid']); // used for session.inforum

        # Block attachments belonging to soft deleted posts and threads
        if (!can_moderate($attachmentinfo['forumid']) AND ($attachmentinfo['post_visible'] == 2 OR $attachmentinfo['thread_visible'] == 2))
        {
                eval(standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink'])));
        }

        # Block attachments belonging to moderated posts and threads
        if (!can_moderate($attachmentinfo['forumid'], 'canmoderateposts') AND ($attachmentinfo['post_visible'] == 0 OR $attachmentinfo['thread_visible'] == 0))
        {
                eval(standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink'])));
        }

        if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment'])  OR (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0)))
        {
                print_no_permission();
        }

        // check if there is a forum password and if so, ensure the user has it set
        verify_forum_password($attachmentinfo['forumid'], $vbulletin->forumcache["$attachmentinfo[forumid]"]['password']);

        if (!$attachmentinfo['visible'] AND !can_moderate($attachmentinfo['forumid'], 'canmoderateattachments') AND $attachmentinfo['userid'] != $vbulletin->userinfo['userid'])
        {
                eval(standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink'])));
        }
}

==============
replace with:
==============

if (!$_REQUEST['do'] == "download")
{
        if ($attachmentinfo['postid'] == 0)
        {        // Attachment that is in progress but hasn't been finalized

                if ($vbulletin->userinfo['userid'] != $attachmentinfo['userid'] AND !can_moderate($attachmentinfo['forumid'], 'caneditposts'))
                {        // Person viewing did not upload it
                        eval(standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink'])));
                }
                // else allow user to view the attachment (from the attachment manager for example)
        }
        else
        {
                $forumperms = fetch_permissions($attachmentinfo['forumid']);

                $threadinfo = array('threadid' => $attachmentinfo['threadid']); // used for session.inthread

                if (!can_moderate($attachmentinfo['forumid']) AND $attachmentinfo['isdeleted'])
                {
                        eval(standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink'])));
                }

                if (!($forumperms & CANVIEW) OR !($forumperms & CANGETATTACHMENT))
                {
                        print_no_permission();
                }

                // check if there is a forum password and if so, ensure the user has it set
                verify_forum_password($attachmentinfo['forumid'], $vbulletin->forumcache["$attachmentinfo[forumid]"]['password']);

                if (!$attachmentinfo['visible'] AND !can_moderate($attachmentinfo['forumid'], 'canmoderateattachments') AND $attachmentinfo['userid'] != $bbuserinfo['userid'])
                {
                        $idname = 'attachment';
                        eval(print_standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink'])));
                }
        }

}



All times are GMT. The time now is 02:39 AM.

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.00949 seconds
  • Memory Usage 1,734KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete