Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2007, 02:33 AM
w1z4rd w1z4rd is offline
 
Join Date: Feb 2005
Location: MooseTown
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Someone, anyone please help me!

I have been wracking my brain over this for hours because I'm very green in the php area. I'm trying to add an .nzb as a file attachment and parse the list of files within it so they display in a table below the attachment. I am basing my lame attempts on this code which is slightly modified.

I put this in my includes folder: class.nzbparser.php
PHP Code:
<?
function doe_iets($input)
{
    $slooppunt = NULL;
    for ($i=strlen($input);$i>0;$i--)
    {
        if ($input{$i} == "(")
        {
            break;
        }
    }

    return substr($input,-4,$i);
}
class show
{
    function text($what)
    {
    printf($what);
    }
    
}
class nzb
{
    function showcontent($where)
    {
        $where = str_replace("%20", " ", $where);
        $filecontent = file_get_contents($where);
        $parts=explode("</file>",$filecontent);
        show::text("<table cellspace=1 ><tr bgcolor=#B9CAE6><td><font face=Verdana size=1>Files listed in this nzb file.</td></tr>");        
        foreach($parts as $part){

            if (eregi ('subject="(.*)">', $part, $matches)) {
            $titel = $matches[1];
            $titel = explode('">', $titel);
            print('<tr bgcolor=#E9E9E9><td><font face=Verdana size=1>'.$titel[0]."</td>");
            }
        }
        print("</table>");

    }
}

?>
Now I know the above works stand alone in conjunction with this code: demo.php
PHP Code:
<?
# This is the demofile of the NzbParser class.
# Just specify your nzb location of the file.
require('class.nzbparser.php');

$nzbloc = 'test.nzb'; // Change to the path of your nzb file
nzb :: showcontent ( $nzbloc );
?>
This is where it gets funky and I start trying to find code that looks like it does what I want it to. (I'm trying to learn sorry)

In attachment.php I added: (around line 260)
PHP Code:
if ($extension == "nzb" && !$_GET['mode'])
{
    require_once(
'./includes/class.nzbparser.php');
    
nzblist($attachmentinfo['filedata'],$attachmentinfo['filename']);
    exit;

In class_postbit.php I added: (around line 395)
PHP Code:
$show['nzblist'] = false
AND below it: (around line 500)
PHP Code:
case 'nzb'
                            eval(
'$this->post[\'nzbattachments\'] .= "' fetch_template('postbit_attachmentnzb') . '";'); 
                            
$show['nzblist'] = true
                            break; 
Then I made a new template: postbit_attachmentnzb
HTML Code:
<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;stc=1&amp;mode=download">Download this nzb file</a>
<br>
What the hell goes here??
Then in postbit_legacy
HTML Code:
  <!-- NZB -->
                        <if condition="$show['nzblist']">
                                <fieldset class="fieldset">
                                        <legend>NZB file list</legend>
                                        <div style="padding:$stylevar[formspacer]px">
                                        $post[nzbattachments]
                                        </div>
                                </fieldset>
                        </if>
    <!-- END NZB -->
Could someone please for the love of whatever it is they love please tell me where im going wrong? I have tried this code and many different variations but this is as close as I can come with what I know (which is very little).

I know it's not much but i'll paypal someone $10 if they can help me straighten this out.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:36 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.03160 seconds
  • Memory Usage 2,178KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_html
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)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
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete