326 (edited by Frank H 2006-10-09 16:03)

Re: Attachment Mod 2.0.1 by Frank H

yep, it's not optimized ... (in the first pages there's one that points out the same problem, and created a fix aswell)

But for PunBB 1.3 I'll rewrite the code again, to fit with the hooks, and I'll try to make it much more optimized... (and I'm going to look more into the JOIN aswell)


in the rules, you could easily end up with more than 255 chars ... as you set them with

txt"jpg"jpeg"gif"bmp"tga"tiff"tif"zip"z01"z02"z03"z04"rar"r00"r01"r02
and so on...

(and since it doesn't store so many lines, I figured it would be ok ... as it's only a per forum and per group setting)


Thanks for the input though, it's always nice to get tips and such smile

327 (edited by binjured 2006-10-10 04:30)

Re: Attachment Mod 2.0.1 by Frank H

Frank H wrote:

in the rules, you could easily end up with more than 255 chars ... as you set them with

txt"jpg"jpeg"gif"bmp"tga"tiff"tif"zip"z01"z02"z03"z04"rar"r00"r01"r02
and so on...

(and since it doesn't store so many lines, I figured it would be ok ... as it's only a per forum and per group setting)


Thanks for the input though, it's always nice to get tips and such smile

Okay, I'll give you that it's possible, I guess I just changed it to something I knew would work for my particular situation because screw typing in that many extensions wink

Oh, there is also a matter of your AP_* file being pretty incompatible with Postgres.  In this case, one of the problems is changing tinyint(1) to Boolean (which I admit isn't actually necessary as INT works just fine, but from a semantic point of view using Boolean is better), so all your "WHERE 1" statements need to be changed to "WHERE true", though I see no reason for those statements anyway, I mean "true" is always "true" just like "1" is always "1", right?  Once again, I could be wrong here.  Also, for compatability reasons you should avoid using ` as a quote character, instead use ', ", or nothing as the case dictates.  I can supply a more compatible version of this file if you like. 

I think the JOIN is easily the best way to go, the only extra "gotcha" associated with it is the loop to delete duplicate posts, but if v1.3 has a "proper" templating system then you won't even need that.  There's quite a bit of optimization that could be done, but to be perfectly honest the only place it really matters is in viewtopic.php, all the other stuff either can't suffer from its time complexity or is an Admin area, and who cares how fast those are tongue

Good luck with the next version smile


EDIT:  Most of the Admin Plugin for this mod is incompatible with Postgres, too sad

Re: Attachment Mod 2.0.1 by Frank H

Bit of help anyone?

click "Attachment Mod" in the plugins area on the administration interface

I havent got one of them!!! Its all installed and working fine, just that hasnt appeared!

Cheers.

329

Re: Attachment Mod 2.0.1 by Frank H

Are you sure you put the plugin in the plugins/ folder?

Re: Attachment Mod 2.0.1 by Frank H

err... yea... err... of course i did.... errr....

/me burrys head in sand.

ill go shoot my self.

331 (edited by janterje 2006-10-25 20:54)

Re: Attachment Mod 2.0.1 by Frank H

Hi folks,

A while ago I had some errors with the attachment mod, after which my life suddenly got extremely busy and I wasn't able to follow up properly. Since I've tried installing a fresh PunBB four times (1.2.12 twice, 1.2.13 and 1.2.14) with the attachment mod, always getting the same error, I doubt I'm doing something wrong in the installation procedure as I've REALLY followed the instructions to the point. My symptoms are:

* Attachment mod working wonderfully for all files below about 2-3000 bytes.

What happens is that I set the attachment rules (increasing attachment size), but they keep bouncing back to "default" 2000 bytes. I've changed the setting in phpmyadmin and it still bounces back. Even when I changed the sizelimit in phpmyadmin and then immediately tried to post a 100Kb file it didn't work. And yes, the PHP-settings are valid (huge size-limits etc, which work with other php-scripts). I've tried it on two different servers; my home server and one from One.com, so it seems doubtful that it is server related.

Anyway, I don't think I have any more time to spend on installing this mod, but I'm writing this just to notify you of a potential error (unless I have made the same mistake four times on two different servers).

Lastly, one question: The attachment mod says to support versions of PunBB higher than what seems to be the newest one, how is that possible? Is it a clone or separate project that has come further? In that case I'd very much like to give that version a try in case it solves my error - PunBB seems to be clearly the best choice for my site (www.pianophilia.com), but to switch forums is impossible without an attachment mod (my 460 existing users use it all the time).

Jan Terje

332

Re: Attachment Mod 2.0.1 by Frank H

sounds like your cachefiles isn't updated properly
edit/view the cache_config.php in the /cache/ directory to see if the following variables are there:

  'attach_cur_version' => '2.0.1',
  'attach_create_orphans' => '1',
  'attach_basefolder' => '/******** REMOVED, but a directory should be here ;) *******/',
  'attach_always_deny' => 'html"htm"php"php3"php4"exe"com"bat',
  'attach_icon_folder' => 'img/attach/',
  'attach_icon_extension' => 'txt"doc"pdf"wav"mp3"ogg"avi"mpg"mpeg"png"jpg"jpeg"gif',
  'attach_icon_name' => 'text.png"doc.png"doc.png"audio.png"audio.png"audio.png"video.png"video.png"video.png"image.png"image.png"image.png"image.png',
  'attach_max_size' => '5242880',
  'attach_subfolder' => '***** 32 random letters *****',
  'attach_use_icon' => '1',

If not, you should delete that cachefile and let PunBB regenerate it ...

When you installed the mod, did you follow the installation guide I've linked to from the first post of this thread?

333

Re: Attachment Mod 2.0.1 by Frank H

Oh my God!! That did the trick!!!!! The cache-file clearly wasn't updated to contain the attachment variables, as soon as I deleted it and entered PunBB again, it worked!!

I must thank you for all the help you've given. I must say that not only is PunBB a brilliant forum, but the excellent, fast and friendly community support is unsurpassable! Together I can't imagine a better forum to run on my site, and hope to be ready to switch from the ugly&bloated fudforum during the weekend!

Thanks again, I'm very grateful!


Jan Terje

334

Re: Attachment Mod 2.0.1 by Frank H

hehe, you're welcome smile

(but the script should be able to update the cachefiles, as I use the PunBB stock function to update it, but it could have been some ownership things that did interfer so PHP couldn't delete the old cache files)

335

Re: Attachment Mod 2.0.1 by Frank H

hey
i did a search about it..
but i didnt find the answer.. i got an error : "Unable to copy .htaccess file" when i try to execute the install_mod.php
i got index.html and .htacces on the "attach" folder at the root..

what's wrong ?
when i try to upload.. there is nothing...
thanks to you wink
Nico

336

Re: Attachment Mod 2.0.1 by Frank H

make sure the server hasn't safe_mode on, (it's mentioned in the first post of this thread)

Frank H wrote:

9. Installation trouble can be caused by php running in safe mode, turning it off will make it work. (if you're getting an error on .htaccess being copied, but the chmod seems to be correct)

If it hasn't, then make sure that the owner and rights to the attachment directory is the same as for /cache/
Then try to re-run install_mod.php ...

If that doesn't work, please ask for help again wink

337

Re: Attachment Mod 2.0.1 by Frank H

Hi again,

Just finetuning my installation of punbb & attachment mod before the big opening, and I have one question and one request:

Question: When I download (left-click) an attachment with spaces in the filename, it adds lots 19%2C%2012% etc. Is it possible to remove this?
Request: To be able to attach more files in one go, instead of having to edit the post.

Apart from that, I'm very happy with everything! smile


Jan Terje

338 (edited by Frank H 2006-10-31 17:17)

Re: Attachment Mod 2.0.1 by Frank H

Hello
Glad you like it smile

janterje wrote:

Question: When I download (left-click) an attachment with spaces in the filename, it adds lots 19%2C%2012% etc. Is it possible to remove this?

Well, this is something where different browsers behave differently, unfortunately. In IE6 it should be spaces, in Firefox 2 however, I see now that it doesn't get translated to what it should have ... If you know a bit of php you could look into attachment.php, around line 100, you see I do a rawurlencode, but it's possible to make some if/switch statements that will encode it differently for different browsers...
So unfortunately I haven't a good answer on that question...
As I'll rewrite big parts of the mod for PunBB1.3, so it becomes an extension instead, I'll also have a closer look on this.

janterje wrote:

To be able to attach more files in one go, instead of having to edit the post.

Well, I decided not to include this due to the extra code/features needed. First you probably need to add some sort of temporary storage, then you need to be able to fill it, and then make sure the correct temporary files goes into the correct post... and if someone aborts the post, the temporary file must dissapear, if you allow several files on one submit, their combined size will affect what gets uploaded or not, with one file it's much easier to let the browser see the max uploadlimit, and let the browser respond (at least it's supposed to respond) ...
I thought about this for a while, but hasn't figured out a clean/javafree/easy-method, and therefore decided not to add it.
But wink, as I've recieved a bunch of requests for this, I'll have another look at this for the conversion to an extension. I think I now know how I would be able to do it quite clean, but still usable. (it would require the people to upload to some sort of personal filestorage, and then selecting the files they want attached to the posts ... but it would of course be a setting for the mod, so that it still can function like it does today)

339

Re: Attachment Mod 2.0.1 by Frank H

Thanks for the good answer. I'm afraid I doesn't know any php at all (just leeching on others work), but I understand why the multiple attachments is a barrier to break elegantly. And what I love with punbb in general that what it does, it does extremely well. Better to keep it clean, bugfree and fast than to just throw in every feature imaginable.

One question though; when's the planned releasedate for PunBB1.3? I've tried to find any clues whatsoever (next week, next month, next year, next decade?), but haven't had any luck.

Jan Terje

340

Re: Attachment Mod 2.0.1 by Frank H

the PunBB1.3 release is as far as I know only stated "when it's ready" wink
(i.e. better take the time needed to get it right than to stress out something half done just to follow a timeline/releasedate ... and I agree fully on that kind of philosophy wink)

nah... better get some sleep ... just came home from a 12+ hour workday at 00:30 ... time to hit the sack if I'm going to get up at 0650 wink

341

Re: Attachment Mod 2.0.1 by Frank H

Hi, i'm running punbb 1.2.12 and i really appreciate the work you've put into this plugin.

I have followed all installation steps, including the steps for versions later than 1.2.6 at http://cms.frankh.shacknet.nu/

Nothing uploads, everything loads perfectly without any errors at all but when anyone tries to upload a file, their post is made but the file just isn't uploaded. The attachment directory is chmodded to 777

Any Ideas?

342

Re: Attachment Mod 2.0.1 by Frank H

Sounds like the problems I had (see my previous post). Create a text-file just with the word test and try to upload it. If that works, review all your file-size settings (in php and the mod settings), then delete the cachefiles and try again with a bigger file.

Good luck.

Jan Terje

343

Re: Attachment Mod 2.0.1 by Frank H

thnx for helping out janterje smile

when you say you followed all installation steps, did you also do "Testing the mod" and "Setup the mod"?
(if Testing the mod works, the file edits are usually ok (that's why I ask), and then it's usually something in the rules(/cache) or file access)

344

Re: Attachment Mod 2.0.1 by Frank H

It works faultlessly now on my 1.2.12 installation. Thanks heaps for your help janterje and Frank H, i appreciate it.

345

Re: Attachment Mod 2.0.1 by Frank H

nice smile

(you should upgrade to the 1.2.14 though, as there are some bugfixes ... it's quite easy to do with the hdiffs)

346

Re: Attachment Mod 2.0.1 by Frank H

Hi,

Finally I manage to get this plugin done, and also able to increase the upload size.
But.... there is another problem.

I tried to download the attachment, if the file size is more than 2,000,000 bytes , it just always stop at that size.
if less than this file size, then it got no problem, I can download the whole file.

Hope you can help me out on this.

Thanks!

347

Re: Attachment Mod 2.0.1 by Frank H

Sent an email smile

348 (edited by FredrikK 2006-11-24 15:31)

Re: Attachment Mod 2.0.1 by Frank H

File: /customers/brunna.se/brunna.se/httpd.www/forum/install_mod.php
Line: 114

PunBB reported: Unable to create new subfolder with name '/attachments/dd0f394a40a4598b317405930dae3c4b' with mode 0750

Please help. sad

hej!

349 (edited by Frank H 2006-11-24 17:40)

Re: Attachment Mod 2.0.1 by Frank H

FredrikK: Your email bounce, but I saw that you had solved it by yourself.

This is an automatically generated Delivery Status Notification

Delivery to the following recipient failed permanently:

    <snip>.<snip>@telia.com

Technical details of permanent failure:
PERM_FAILURE: SMTP Error (state 9): 550 RCPT TO:<<snip>.<snip>@telia.com> User unknown

(so you know what I got)




The problem koktsing had was that the fpassthru function couldn't load the whole file, but instead sent only the first 2'000'000 bytes. To solve this one just need to replace line 116 in attachment.php to an fread inside a while statement, like this:

#
#---------[ 1. OPEN ]---------------------------------------------------------
#

attachment.php


#
#---------[ 2. FIND (line: 116) ]----------------------------------------------
#

        fpassthru($fp);


#
#---------[ 3. REPLACE WITH ]------------------------------------------------
#

        while(!feof($fp))
            echo fread($fp,4096);


#
#---------[ 49. SAVE, UPLOAD ]------------------------------------------------
#

This will probably make PHP use less memory aswell, but I'm not sure if it's slower than fpassthru (as that can read everything in one burst from hdd)

350 (edited by FredrikK 2006-11-26 14:26)

Re: Attachment Mod 2.0.1 by Frank H

Frank H wrote:

FredrikK: Your email bounce, but I saw that you had solved it by yourself.

Well, not really. smile

Now i get this message when I trying to upload a .txt-file:

An error was encountered
Error: Unable to move file from: /tmp/phpv4Nscc to /customers/brunna.se/brunna.se/httpd.www/forum/attachments/9eea88ac6e1a8fd7730b777b3fe9f99c/3ef4b1a12400d4f50b7480e2c3d55aa7.attach.

But when I try to uploade a gif, jpg or any other file everything loads perfectly without any errors and the post is made, but the file isn't uploaded. hmm

hej!