1 (edited by Frank H 2003-11-07 18:54)

Topic: Attachment Mod 1.0 by Frank H

##
##
##        Mod title:  Attachment Mod
##
##      Mod version:  1.0
##   Works on PunBB:  1.0.1
##     Release date:  2003-11-07
##           Author:  Frank Hagstrom (frank_n05pam@hotmail.com)
##
##      Description:  This mod will add the ability for attachments beeing
##                    posted in PunBB
##
##   Affected files:  admin_forums.php
##                    delete.php
##                    edit.php
##                    post.php
##                    viewtopic.php
##                    commonadmin.php
##
##       Affects DB:  Yes
##
##            Notes:  This mod stores the files in the database, thus you must
##                    configure it to accept large querys. You must set this
##                    alittle larger than the files you accept. Settings for
##                    mysql can be found in my.cnf (or in windows my.ini).
##                    Furthermore you also need to let php accept large posts,
##                    and files attached. Set this in php.ini.
##
##                    The attachment mod can be configured by altering the
##                    /include/attach.php file, in there you will find the
##                    following variables:
##
##                    $attach_use_icon    - Set this to false if you don't
##                                          want icons next to your
##                                          attachments. Users that don't want
##                                          to view images, don't see icons.
##                    $attach_max_size    - Set this to the max allowed
##                                          filesize you want to be uploaded.
##                                          Will be dependent on what you have
##                                          set in the configuration of PHP
##                                          and SQL. This is for the whole mod
##                                          and each forum is then configured
##                                          with it's own max size, that cannot
##                                          be larger than this.
##                    $attach_always_deny - These are the files the attachment
##                                          mod will deny from everyone but
##                                          the Administrators. So if you 
##                                          allow all files on a forum, these
##                                          will still be rejected, and it's
##                                          impossible to override by setting
##                                          the forum to allow them. Good for
##                                          the forum owner that he has the
##                                          control, and not the admins.
##                    $attach_mime_types  - This holds different mime types if
##                                          the browser fail to supply them.
##                    $attach_icon_mime   - This array links each mime to an
##                                          icon. Option to link to extentions
##                                          might be added at a later version.
##
##                    Generated with ModGenerator (http://modgen.cactuz.nu/)
##                    on: 2003-09-06 20:26:03
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Link removed, pointed to an old location

If you use another language you need to copy en_attachments.php into that language directory and rename the two first letters to match. And then you can edit the language file and if you'd like, e-mail it to me and I will post it on the download page.

On that same link, you will also find a zip containing more colors for the icons, and it also has a template for your own board if you want something other. Have fun! smile

Re: Attachment Mod 1.0 by Frank H

Sweet! I hope a lot of you guys will try this out because it's a really high quality mod.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Attachment Mod 1.0 by Frank H

so far so good i was looking for this when i first installed PunBB. i like it!

Re: Attachment Mod 1.0 by Frank H

i actually found something it needs it needs an icon or somethin on the topic that tells the user that there is an attachment in that topic

Re: Attachment Mod 1.0 by Frank H

not a bug

I might add it on a later version (but I must say I'm not certain PunBB needs it)

Re: Attachment Mod 1.0 by Frank H

I told the owner of our site about this mod, but apparently he has concerns:

Mr Slugger wrote:

The only downside to that mod is that everything goes into the database. And our message board database is huge already. Hopefully someone will come up with a ftp upload version so it doesn't bog down the database.

I don't quite understand what he's talking about, but I'm sure it makes sense to you guys.  Would something like this be possible?

Re: Attachment Mod 1.0 by Frank H

Well atm I'm storing files in the database ... instead of storing it as separate files on disk on a separate place that's inacessible from others... this I made because it's easier to control rights if you don't have full access to the server, so you can refuse people from reading from certain directories etc...

But in the future (not near though) I might also add the possibility to store as files on disk ...

Re: Attachment Mod 1.0 by Frank H

Mike from CS wrote:

I told the owner of our site about this mod, but apparently he has concerns:

Mr Slugger wrote:

The only downside to that mod is that everything goes into the database. And our message board database is huge already. Hopefully someone will come up with a ftp upload version so it doesn't bog down the database.

I don't quite understand what he's talking about, but I'm sure it makes sense to you guys.  Would something like this be possible?

Is the website he is talking about running PunBB?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Attachment Mod 1.0 by Frank H

frank wasn't saying it was a bug just thought it might be needed if i could do it i would add it to mine but i'm not very good at php writing just can do a bit of editing

Re: Attachment Mod 1.0 by Frank H

Kennel wrote:
Is the website he is talking about running PunBB?

Yes, we just started using it a couple months ago.  We were using EZBoard (yuk) before that.  Our site is "Customers Suck" if anyone's curious.

11

Re: Attachment Mod 1.0 by Frank H

Yup that's my site. Before we used vbulliten as a forum software. Our database was roughly 700MB and our server began suffering from too many database connections. So we loved the fact that we could store the files because we've got plenty of room for files. It was the database stuff that was killing us.

Re: Attachment Mod 1.0 by Frank H

ok ... well I'll investigate the ftp and php file possibilities more later ... but now I'm going to have a _really_ busy time ahead (waiting on some stuff that's more or less out of my control on my Master Thesis, so I'll work day and night on that when I can)...

But as I said, I took the decision to store it in the database as it's easier for 'the everyday user' to control rights, and disable the possiblity to direct link to files if one shouldn't have rights to it ... but in the future file storage is probably going to be added ...
I have done two tables for the files, one with info, and one for the huge data ... this is to speed up the database handling abit ... as things have a habit of going abit slow in the table holding all the binary data... and I know of some small things I want to alter in the future versions (moving mime out of the binary table, or at least make a copy of it to the file info, to remove that call to the 'heavy' table, and some other small things, on one hand I want mime there as it can make it easier to recover lost files)...

This mod turned out waay more 'complete' than I had plans for as a first release, and most of the time is actually spent on the administration part of the mod, as it's a huge thing once one start to think of it smile

But files on disk will probably be added ... when I have time...

Re: Attachment Mod 1.0 by Frank H

How to give the Users right to add attachments?

Re: Attachment Mod 1.0 by Frank H

In the admin-forums ... it should look like this:
http://stingray.campus.luth.se/attachme … forums.png

Then you click the "Forum Attachment Rules" link at the right side of the forum you'd like to allow people to post.
Then you're linked to this window
http://stingray.campus.luth.se/attachme … _rules.png
There you check who should be able to up and download, how large the files may be, and also if you'd like to restrict to a few file extentions, you just write them there...

When you submit the changes you go to the admin forums again, you should see the updated info ... on who are allowed and who are denied upload/download access...


So you set this per forum basis ...

Re: Attachment Mod 1.0 by Frank H

Thx!

16

Re: Attachment Mod 1.0 by Frank H

Hi

I've installed this - very impressive.
Only thing is when I go into Forum Attachment Rules I get the following error at the top of the page
Warning: implode(): Bad arguments. in ../forum/admin_attach.php on line 91

Any ideas?

I've been down so long it's beginning to look like up..

17 (edited by Frank H 2004-01-15 23:35)

Re: Attachment Mod 1.0 by Frank H

I hope you're using 1.0.1, as the mod was made for that version, and there are a few things that is altered to the 1.1.1 version of PunBB.

Anyhow, I think I know the reason for that error, and I think I know why I get it aswell ... but I'm currently rewriting it for PunBB 1.1.1

So if you've got time to wait a few days I think I will have done a proper version for PunBB 1.1.1, hopefully a functional wink

(I will need to rewrite some if statements etc. to get rid of that ... but I hope you've got time to wait smile)

Edit: I just noticed I got this on the 1.0.1 version of PunBB aswell, strange, didn't happen to me when I betatested it ... hmm.. might be a windows/*nix difference ... or a difference in php versions or something ... anyhow, I'll release a version for PunBB 1.1.1 soon, so then you should use that instead big_smile
(if you doesn't have any text in the field for file extentions ... you get this error ... so specifying files to be allowed should still work)

Re: Attachment Mod 1.0 by Frank H

updated version working with PunBB 1.1.1 is now released, check this thread for info...