ok here's our hack for edit.php

this gives ALL users the same permissions regarding attachments within the edit page. Not ideal obviously but we didn't see it as a major issue as guest can't get to the edit page and we are happy for members to delete their own attachments and add more



----FIND


<li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
                        </ul>
                    </div>
                </fieldset>






------AFTER ADD
//hard code attach settings and grab existing attachments for this post
$attach_allowed=true;
    $attach_allow_delete=true;

    $attach_allow_owner_delete=true;

    $attach_allow_upload=true;

    $attach_allow_size=$pun_config['attach_max_size'];

    $attach_per_post=5;
    $attach_allowed=true;
$attach_output='';
$attach_output_two='';
    $result_attach=$db->query('SELECT af.id, af.owner, af.filename, af.extension, af.size, af.downloads FROM '.$db->prefix.'attach_2_files AS af WHERE post_id=\''.$id.'\'')or error('Unable to fetch current attachments',__FILE__,__LINE__,$db->error());

    if($db->num_rows($result_attach)>0){

        //time for some output ... create the existing files ...

        $i=0;

        while(list($attach_id,$attach_owner,$attach_filename,$attach_extension,$attach_size,$attach_downloads)=$db->fetch_row($result_attach)){

            if(($attach_owner==$pun_user['id']&&$attach_allow_owner_delete)||$attach_allow_delete)

                $attach_output .= '<br />'."\n".'<input type="checkbox" name="attach_delete_'.$i.'" value="'.$attach_id.'" />'.$lang_attach['Delete?'].' '.attach_icon($attach_extension).' <a href="./attachment.php?item='.$attach_id.'">'.$attach_filename.'</a>, '.$lang_attach['Size:'].' '.number_format($attach_size).' '.$lang_attach['bytes'].', '.$lang_attach['Downloads:'].' '.number_format($attach_downloads);

            else

                $attach_output_two .= '<br />'."\n".attach_icon($attach_extension).' <a href="./attachment.php?item='.$attach_id.'">'.$attach_filename.'</a>, '.$lang_attach['Size:'].' '.number_format($attach_size).' '.$lang_attach['bytes'].', '.$lang_attach['Downloads:'].' '.number_format($attach_downloads);

            $i++;

        }

        if(strlen($attach_output)>0)

            $attach_output = '<input type="hidden" name="attach_num_attachments" value="'.$db->num_rows($result_attach).'" />'.$lang_attach['Existing'] . $attach_output;

        if(strlen($attach_output_two)>0)

            $attach_output .= "<br />\n".$lang_attach['Existing2'] . $attach_output_two;

        $attach_output .= "<br />\n";

    }else{

        // we have not existing files

    }
   
   
   
    if(strlen($attach_output)>0)$attach_output .= "<br />\n";

    if($attach_per_post==-1)$attach_per_post = '<em>unlimited</em>';

    $attach_output .= str_replace('%%ATTACHMENTS%%',$attach_per_post,$lang_attach['Upload'])."<br />\n".'<input type="hidden" name="MAX_FILE_SIZE" value="'.$attach_allow_size.'" /><input type="file" name="attached_file" size="80" />';













I'm sure someone can find a cleaner way to do this - I'll watch this thread

cheers

we just redid the edit.php changes and it was exactly the same.  It looks like there are large chunks of missing code in edit.php that are needed to get and display the details of any existing attachments.  Down around line 500 where it checks

if($attach_allowed){


none of those variables have actually been defined.

We are in the process of hacking it together now

I also have an error when I try to edit a post with an attachment.  Underneath the original post when it is meant to list the attachments it says

Notice: Undefined variable: attach_allowed in /www-vhost/www.hed.swin.edu.au/design/nidr/forum/edit.php on line 500

I cleared the config cache file again but the problem persists

thanks in advance

I'm having an issue where I don't get the correct number of 'choose file' or 'browse' buttons on the new post page.  In the mod settings I have set this to 5 for all users but I only get one browse button.  The code doesn't seem to check if multiple browse buttons are required


        <fieldset>

                    <legend><?php echo $lang_attach['Attachment'] ?></legend>

                    <div class="infldset">

                        <div class="rbox">

                            <input type="hidden" name="MAX_FILE_SIZE" value="<?php print $attach_size; ?>" /><input type="file" name="attached_file" size="80" tabindex="<?php echo $cur_index++ ?>" /><br />

                            <?php echo $lang_attach['Note'] ?>

                        </div>

                    </div>

                </fieldset>




I went back to the install instructions and belive I did everything correctly - can you see what I have missed?

Thanks in advance

Hey Frank H

We are running a PunBB forum, and have installed your attachment mod, all seems fine but we are getting this error message...  bill the guy that knows more than me in this area sent me this to post

MySQL 4.1.21-log    Rows: 52846    Size: 4.18 MB
Operating system: Linux   PHP: 5.1.5   PunBB 1.2.7

We do have a Image Upload mod running, but thats working fine...

Notice: Undefined index: attach_cur_version in
/www-vhost/www.hed.swin.edu.au/design/nidr/forum/plugins/AP_Attachment_Mod.php on line 1090

Config table has been updated and new tables have been added.  Folder with
long random name was created in the attachments folder

If you have any ideas we would love to know any angles we need to look at... and if you need any more info I will try to get it...   we have looked over the "Installing the mod on PunBB 1.2.6+" site trying to work this bug out...

Our small forum is at
http://www.hed.swin.edu.au/design/nidr/forum/

Regards
Volker