vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Someone, anyone please help me! (https://vborg.vbsupport.ru/showthread.php?t=135593)

w1z4rd 01-05-2007 02:33 AM

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.


All times are GMT. The time now is 01:08 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.01156 seconds
  • Memory Usage 1,733KB
  • 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
  • (2)bbcode_html_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)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