76 (edited by Frank H 2005-04-26 11:23)

Re: Attachment Mod 2.0.1 by Frank H

that looks imho very unclean/cluttrered, how does it look with say ... 20 groups?
But I'm glad you've made soemthing you're happy with, that suits your needs smile

well, there's a reason why I go through php script, to limit all possibility for direct linking. Letting apache or similar handle downloads, then one can just as well show all the files... and it's pretty unsecure to have files with correct names in public locations...  (sure, some people might have the attachments in a 'public' place, but direct linking is only possible if they bruteforce, as the filenames are random, or that they can fetch info from the database ...)


Re: Attachment Mod 2.0.1 by Frank H

hrmm... this "security" of attachments and  "downloading" limits IMHO very rarely needed..
for me this "attachment"/"uploading" is for fast pictures pasting, and there absolutely no need to make them secure, and uncacheble.
about fpassthru(); - in many download scripts they using readfile();

about rules wizard
well, 20 groups, and even 100 of them if you make css "table" width not 100%, table could be very large in both directions...
as for now - i've decided not to touch css, because there's need of many forums, not many groups. and by the way 10 groups fits screen good enough. smile

78 (edited by Frank H 2005-04-26 21:54)

Re: Attachment Mod 2.0.1 by Frank H

well, then why not just use some simple script? (I made this for me, and I need the security stuff ... thus this is why I've made it this way) ...

about fpasthru, yep I know, and the reason why other scripts use that is due to fpassthru is rumored to be a memory hog (probably reads most of the file into memory), but I had planned to rewrite the attachment.php file, and used that as I knew it worked, but it's on the todo list to be changed ... (and isn't it even commented in attachment.php that I use it only temporary? so what's the need to point it out more?)

but wasn't there another image upload mod? I think it'll fit better to those only needing a small "unsafe" mod for images in threads ... as I've said before, I made this mod to fulfill my needs, and shared it if anyone else wants it.
(note, that I'm not saying the other mod was unsafe, I never tried it or looked at how it worked, but IIRC it was simpler than mine)


Re: Attachment Mod 2.0.1 by Frank H

So, this mod is working great for me with one exception.  The administrator (me) can't attach files.  Is that normal?

80 (edited by Frank H 2005-04-27 15:12)

Re: Attachment Mod 2.0.1 by Frank H

ted: someone had a similar issue, but haven't heard any updates on his problems, if he solved it or not, this was the suggestion I gave to him on previous page

Administrators override security checks, so make sure all the code is in place, and that your administratorgroup has the right group id. (should be 1) ... you can also check so that you haven't set max upload size to something that php cannot handle. (Documentation chapter 1.6)

and if you change php.ini, you probably need to restart the webserver to put the changes in effect

Re: Attachment Mod 2.0.1 by Frank H

Daahh.. I get the same error as Smartmonkey. Cant understand.
IIS 6.0

php.ini is right
"everyone" and "iusr_x" has write and read permissions to attachments/
my files is right.. have tested yours too
permissions on the bord is right

When i'm posting, nothing happens. Then i read that Smartmonkey rebooted, so did I. Then the files was uploaded, but not shown in the posts. I tested your files then, but it didnt work. Then i restored the database and installed it over again. Back to zero, the files is not created.. have rebooted multiple times.. All catalogs and everything is there..

Trying to upload a 5k gif-file. Hm. sad

// Gardell

82 (edited by Frank H 2005-04-27 23:38)

Re: Attachment Mod 2.0.1 by Frank H

hmm... I think I'll email, and try to structure the error searching wink
(and I can do it in Swedish big_smile)


Re: Attachment Mod 2.0.1 by Frank H

Here is the weird thing about the admin not being able to add attachments:  I added the mod and couldn't add files.  I logged on as a regular user and could add attachments.  I logged back in as admin and could add attachments.  Everything is fine.  I added the Calendar mod and did some other small changes.  Now the admin can't attach files.  I don't see what I could have done that would have changed this.

Re: Attachment Mod 2.0.1 by Frank H

Hi Frank,
Excellent Job!  I really like this mod!

One question, I have this installed and everthing is working well except multiple file uploads.  It doesn't matter what I set in the rules for the number of allowed upload files only one can be uploaded.  I checked in the rules table in the  DB and the correct values are being set for the number of files to allow for the specific users groups,  but still only allowed to upload one file.

Any idea what I might have missed during the insall?

Thank you for your help and a great mod!

Re: Attachment Mod 2.0.1 by Frank H

ted: sounds like you've altered something, try to check what each modification has done, it's probably one of your modifications that has altered either my mod (doubt it, but not impossible), or that other mod alters used information (I'm guessing this, and it's a harder thing to find, so start with the first wink) ... $pun_user['g_id'] is used for identity checks, so make sure that that information is intact.

ultravibe: From the Edit rules page

Here you can increase the allowed number of attachments per post. (To add more attachments to a post the user needs to edit the message.)

So, have you edited the message to add more attachments?
(reason why it's like this is because I don't want to add a shitload of code for temporary storage, and handling that when people don't post (but send up files), and don't want to add javascripts, as not all people have them enabled)

86 (edited by Frank H 2005-04-28 14:46)

Re: Attachment Mod 2.0.1 by Frank H

ted: Gardell has also added the Calender mod (+ some other mods, but both of you have that and have problems, and his worked 'clean' so the attachment mod itself works, jsut some interferrence) ... might be that one that's interferring ...

I suppose it's just a matter of finding out what gets affected, and how to solve it ... I'll keep you all updated when the problem is figured out...

Edit: I looked at Calender 2.0.5(or 4), and at a first glance I dont' think that one is the one interfering ... as it doesn't alter any files used in attachment mod, and only adds a column in the users table, that I don't think should affect any queries in either PunBB or my mod ... so Calender is probably not the reason why it stopped working ... going to go through all other of Gardells mods...
Edit2: and now I've looked through Easy BBCode, dont think that one interfers either, 2 more mods to look through ...

Edit3: Ok, Gardell has a working mod now, turned out to be some stuff that hadn't been added into a file (easily done, I've done it a few times myself big_smile).
(so this mod will work with easy bb code, pm mod, calender, and easy poll) smile


Re: Attachment Mod 2.0.1 by Frank H

I added the polling mod, then your attachment mod, then the miniportal (a news page and changed index.php to forum.php), then the calendar mod.  Then I added code to index.php, forum.php, viewforum.php, viewtopic.php, and calendar.php to check that the user wasn't a guest.  If they are a guest they can't view those pages.  It doesn't seem that any of those would do this, but something happened.

Re: Attachment Mod 2.0.1 by Frank H

Ok, a small bug has surfaced...

The rule editing should go to max allowed size if a larger value is entered, but somehow that 'trick' was only in my head ... and not in the code. Due to this I'll add a couple of lines in two of the files (both the admin plugin and in attach_func.php), so that the max allowed isn't ovverridden by anyone. (there will be a check in the allow upload, and when editing/creating rules it'll set max upload instead of leaving a larger number)

So, I'll update the first post with links to the two slightly altered files, and update the zip (I'm just not sure if I'll increase the version or not, but I don't think it's such a big thing... well see) wink

89 (edited by Frank H 2005-04-28 20:19)

Re: Attachment Mod 2.0.1 by Frank H

New version released!
But don't worry, it's just a small bug update, and really easy to update from 2.0 to 2.0.1 (3 files replaced (attachment mod files) and run a script)

read more about it here and download

To update, just read the "update_2.0_to_2.0.1_readme.txt" ...
Fixed a ruleset check that I thought were there, but obv. not, and that I added Dexus header for that annoying 5-7s delay for downloading attachments.
(hopefully no more "users can upload, but not admins", as it's most likely partly due to this little bug I had done. Where usergroups could have a larger allowed size, than the max allowed size for the mod (that the admins used as limit))


Re: Attachment Mod 2.0.1 by Frank H

I am unable to access the download site to get this mod.  Is there an alternative location where I can download the mod?

Re: Attachment Mod 2.0.1 by Frank H

its up atm, i guess you were unlucky?

edit: doh i assumed it was on punres hmm


Re: Attachment Mod 2.0.1 by Frank H

Well it isn't right now.  I just tried again (went to see a movie) and it still ain't working.  The site resolves but no connection.  Grrr...  That would be the main mod too.

93 (edited by Frank H 2005-05-02 12:32)

Re: Attachment Mod 2.0.1 by Frank H

Sorry for that, but the network has dropped the routing to my machines at home (well, 3/4 machines, but totally out of my control) ... support is contacted ... and we will see when they fix it ... (I'm guessing the newly changed switch has dropped the ip's to route, dns still has them, but it's impossible to connect to anything outside of my apartment...)

send a mail to frank_n05pam [at] hotmail [dot] com and I'll mail the zip to you... but I hope the network will be up soon...

Edit: this was sent by using VNC onto a slooow windows server, in 640x480 256 colors ... and the ooold pci card really struggles big_smile ... but I'll be able to email the stuff from this one for those who want the mod ... hmmm... but I suppose it'll be on punres later ... just gotta register (yet another place roll (lol I couldn't login to my gmail, as I forgot the pass to that place big_smile)) ...

Re: Attachment Mod 2.0.1 by Frank H

now, everything works again...


Re: Attachment Mod 2.0.1 by Frank H

Ok I have it installed now.  I have a problem.

As administrator attachments will not show up during new topic post.  However attachments will get uploaded when I edit the post.

As a regular user attachments will show up during both topic post and edit.

In all cases the file is indeed getting uploaded but it never appears if an administrator is creating the topic or reply.  Only on edits for administrators.

For reference here are the mods installed:
PunDokuWiki 1.1
PunOnline 1.2.1
Attachments Mod 2.0.1
Image Verification Mod 1.0.3

96 (edited by Frank H 2005-05-03 12:55)

Re: Attachment Mod 2.0.1 by Frank H

well, download the modified files, and replace (but keep a backup of your modified) post.php ... and test if the same happens ... if it works we know it's in the modifications, if it doesn't we need to further narrow it down...

and make sure you're usign a really small file when testing, I suggest you make a textfile with the word test or something within ... that makes a 6 byte file or such ...  wink

97 (edited by shinji 2005-05-03 22:22)

Re: Attachment Mod 2.0.1 by Frank H

Problem solved.  It was my own damn fault.  It was something I should of checked but thought it was already set.  The "Alter Settings" page has the hard limit.  It is default to 2000 bytes.  I though it said kilobytes.  That was why it was rejecting.  The one I did as member probably was just a small <2k text file I did as a test.

This means that everyone that installs this mod should check that out.  I overlooked it.  *bangs his head a few times with an iron bat*

Oh and there is a typo on the orphan delete confirmation page.  It shows as "Orpahn attachment deleted."

Re: Attachment Mod 2.0.1 by Frank H

hehe, a classic error on this mod, but I feel it's best to keep it that small so people will actually set the values to their server, not just use default values
I might as well write that in the first post aswell, that people should test with really small files smile

I finally converted my old forum with ~1400 attachments, and it went flawlessy (phew) ... but the conversion took a little while when I used the 10 attachments/update smile ... but it worked big_smile


Re: Attachment Mod 2.0.1 by Frank H

Glad it that worked out for you.

100 (edited by snipersun 2005-05-24 08:31)

Re: Attachment Mod 2.0.1 by Frank H

Topic Attachment Icon

// If there are topics in this forum.
if ($db->num_rows($result))


//BEGIN Topic attachments icon
$AttachRes = $db->query('SELECT DISTINCT '.$db->prefix.'posts.topic_id FROM '.$db->prefix.'attach_2_files,'.$db->prefix.'posts WHERE '.$db->prefix.'attach_2_files.post_id = '.$db->prefix.'posts.id') or error('Unable to fetch attach_topic_id', __FILE__, __LINE__, $db->error());
    if($db->num_rows($AttachRes)) {
        $AttachTopic = array ();
        while($AttachRows = $db->fetch_row($AttachRes)) {
//END Topic attachments icon


// Should we display the dot or not? :)
        if (!$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')


//BEGIN Topic attachments icon
if(in_array($cur_topic['id'],$AttachTopic)) {
            $subject = '<FONT style="font-family : Courier New ;font-size : 12px;color: #000000" >@</FONT> '.$subject;
//END Topic attachments icon