[RC] Attachments in subfolders

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
Locked
I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

[RC] Attachments in subfolders

Post by I-FR70 » Fri May 20, 2011 4:32 pm

Modification Name: Attachments in subfolders
Author: I-FR70

Modification Description: Saves the attachments in sub-folders instead of in only one folder. This means that the server works quickly finding the attachments and the FTP backup will be facilitated.

Modification Version: RC 0.9.9

Modification Download: http://www.rambaudi.net/attachments_in_subfolders.zip
Last edited by I-FR70 on Fri May 20, 2011 4:44 pm, edited 1 time in total.

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Fri May 20, 2011 4:37 pm

As I wrote in this topic:

http://www.phpbb.com/community/viewtopi ... &t=2130165

I'm searching someone who deeply knows the PHPBB core, to check my MOD and verify if I forgot to apply my modification to some file that handles the attachments...

Thank you in advance.

:)

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Fri May 20, 2011 4:52 pm

Sorry, the URL was wrong... I've fixed it.

:)

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [RC] Attachments in subfolders

Post by 4_seven » Fri May 20, 2011 5:43 pm

similar to this or different and with a new, selfprogrammed code-base?
Current Mods | Mod Base | php(BB) programming | No help via PM

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Fri May 20, 2011 6:46 pm

I was not aware of the MOD you linked... my MOD is a new, selfprogrammed code-base.

I don't think that is similar, even though both the 2 download links within the topic you've linked are related to the same file, that contains only the two "Included files", so I can't check the code... but reading the description, the method I've used to create the subfolders is different: is based on the attachment ID.

:)

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [RC] Attachments in subfolders

Post by 4_seven » Fri May 20, 2011 6:52 pm

I have take a closer look now. It's a good work and also a very important Mod.

Some little things yet:
File_Exists() < Functions should always be written lowercase
PHP/Html Mix in One File < Should have phpbb3 PHP/Template-Syntax** (*.php > *.html)
$_GET < Should be request_var() (if possible)
mysql_select_db < Use always phpBB3 dbal (if possible),
** so there is also no need, to add db_name, db_password etc to your main php

But i know you can fix that, so congrats and good luck with your further developement :geek:
Current Mods | Mod Base | php(BB) programming | No help via PM

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Fri May 20, 2011 8:30 pm

4_seven, thank you very much for checking the MOD ;)

My biggest concern was to forget to modify some important file... read your comments make me relieved.

About your comments:
4_seven wrote:File_Exists() < Functions should always be written lowercase
Yes... true... I have the bad habit to use the uppercase for functions too... :roll: ... but now I fixed the code.
4_seven wrote:PHP/Html Mix in One File < Should have phpbb3 PHP/Template-Syntax** (*.php > *.html)
$_GET < Should be request_var() (if possible)
mysql_select_db < Use always phpBB3 dbal (if possible),
** so there is also no need, to add db_name, db_password etc to your main php
These 3 comments are related to the file sposta_allegati_nelle_subdir.php that I wrote outside of PHPBB3 because I know nothing of PHPBB3 core. I don't know to write an embedded file from scratch, so this was the shortest and easiest way for me.

But now I have take a quick look to the interesting document you've linked to me and I'll try to rewrite the file in the right way.

Again thank you very much for the time you've spent to check the MOD.

:)

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Mon May 23, 2011 2:28 pm

OK, I've update the MOD according the 4_seven's suggestions (on the first post).

If someone want to give me any other suggestion or comment, I'll be delighted to get it.

:)

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [RC] Attachments in subfolders

Post by 4_seven » Mon May 23, 2011 9:02 pm

Looks much better now :geek:

In all cases avoid the using of Super- or Server-Globals, like $_GET or $_SERVER * (if possible anyway).
In all cases try to use genuine phpBB3-Functions, which are global.
And if some is not global out of the box, than try to make them so ;)
All other things code as you are, looks like a good style.

* so may change your

function current_page_url()

to this already present phpBB3 function

Code: Select all

/**
* Generate board url (example: http://www.example.com/phpBB)
* @param bool $without_script_path if set to true the script path gets not appended (example: http://www.example.com)
*/
function generate_board_url($without_script_path = false)
you find it in includes/functions.php (~line 2249)

This is an example, so take a look on other things too.

Here you have some different stuff from the first link, may for later usage..
http://wiki.phpbb.com/Viewtopic_Template_Variables
Current Mods | Mod Base | php(BB) programming | No help via PM

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Mon May 23, 2011 9:42 pm

Thank you very much again, 4_seven.
4_seven wrote:In all cases avoid the using of $_GET or $_SERVER * (if possible anyway).
I've tried to avoid the use of $_SERVER, but I didn't found any other option :oops: ... but now I think I can avoid the use of the server variables because I can use the function you've suggested to me: generate_board_url.

I'll try to do this tomorrow morning.

I’m infinitely grateful to you for these tips... ;)

:)

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Tue May 24, 2011 8:37 am

OK, I cleaned the code using the PHPBB3 framework function generate_board_url() instead of my function current_page_url().

I updated the link on the first topic with the last MOD version 0.9.92.

Any other comment?

:)

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [RC] Attachments in subfolders

Post by 4_seven » Tue May 24, 2011 10:20 am

@ a first glance it looks good now, so await more user-feedback.
Congrats for working out this awesome mod :geek:
Current Mods | Mod Base | php(BB) programming | No help via PM

Peter77sx
Registered User
Posts: 3250
Joined: Wed Nov 09, 2005 2:51 pm

Re: [RC] Attachments in subfolders

Post by Peter77sx » Tue May 24, 2011 10:31 am

Hello, does this create the folder based on a user's ID?

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [RC] Attachments in subfolders

Post by 4_seven » Tue May 24, 2011 11:16 am

Seems to be No. Best thing (for me) is, to generate link-structure like this files/user_id/date/*.* like in jQuery [img] Upload.
Current Mods | Mod Base | php(BB) programming | No help via PM

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Tue May 24, 2011 12:51 pm

4_seven wrote:@ a first glance it looks good now, so await more user-feedback.
Congrats for working out this awesome mod :geek:
Thank you to you for all comments and suggestions you gave to me. ;)

Now I know the 1% of PHPBB3 framework... :lol:

:)

Locked

Return to “[3.0.x] MODs in Development”

Who is online

Users browsing this forum: proximic and 17 guests