Non gregorian calenders and phpBB 3.1.x

Discussion forum for Extension Writers regarding Extension Development.
hubaishan
Translator
Posts: 153
Joined: Sun Apr 10, 2011 2:47 pm
Name: Saeed Hubaishan
Contact:

Non gregorian calenders and phpBB 3.1.x

Post by hubaishan »

Is there a method to hook a phpBB class, I want to add some functions to DateTime class
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: Can I hook a phpBB class?

Post by nickvergessen »

DateTime is from php itself
No Support via PM
hubaishan
Translator
Posts: 153
Joined: Sun Apr 10, 2011 2:47 pm
Name: Saeed Hubaishan
Contact:

Re: Can I hook a phpBB class?

Post by hubaishan »

But It is Extened by datetime.php in phpbb folder. I want to add some functions to these extended class>
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: Can I hook a phpBB class?

Post by nickvergessen »

Then create your own class which extends phpbb\datetime ?
No Support via PM
hubaishan
Translator
Posts: 153
Joined: Sun Apr 10, 2011 2:47 pm
Name: Saeed Hubaishan
Contact:

Re: Can I hook a phpBB class?

Post by hubaishan »

The class is ready. How to tell phpBB to use it in new Extention Format.
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: Can I hook a phpBB class?

Post by nickvergessen »

Well what exactly do you want to do?
No Support via PM
hubaishan
Translator
Posts: 153
Joined: Sun Apr 10, 2011 2:47 pm
Name: Saeed Hubaishan
Contact:

Re: Can I hook a phpBB class?

Post by hubaishan »

I have this MOD https://www.phpbb.com/customise/db/mod/hijri_calendar/
I is Allowing user to view the Hijri (Islamic) Calendar, I want to move it to 3.1.0 Extension
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: Can I hook a phpBB class?

Post by nickvergessen »

Okay that is indeed a bit different and a special case. I will look into it
No Support via PM
User avatar
Meis2M
Translator
Posts: 963
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

shamsi date problem in 3.1

Post by Meis2M »

Hello

in persian language we use "Shamsi date".
in phpBB 3.0 we have a "jalali.php" file that uploaded into "includes" folder in root, then

[The extension php has been deactivated and can no longer be displayed.]

change "includes/session.php"

find:

Code: Select all

		return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $zone_offset), $date_cache[$format]['lang']);
replace with:

Code: Select all

                $myformata = array('Y m d', ', g:i a', 'D ');
                $firststep = @gmdate($myformata[0], $gmepoch);
                $secstep = explode(" ", $firststep);
                require_once ('jalali.php');
                list( $jy, $jm, $jd ) = gregorian_to_jalali($secstep[0], $secstep[1], $secstep[2]);
                return strtr(@gmdate($myformata[2], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']).
                $jd . ' ' . givemonth($jm) . ' ' . $jy.
                strtr(@gmdate($myformata[1], $gmepoch + $date_cache[$format]['zone_offset']), $date_cache[$format]['lang']);  
now, how can i change the date format to "shamsi date" in phpBB 3.1?

there is not the codes and there is not "session.php" in "includes" folder.

plz help me.
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
david63
Registered User
Posts: 19701
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: shamsi date problem in 3.1

Post by david63 »

The session.php file for phpBB 3.1 can be found in root/phpbb folder. Be aware that this file has changed significantly from 3.0

The "correct" way in phpBB 3.1 would be to create an extension to handle this but, currently, there are no events in the session.php file so you would have to create one to have it incorporated in the core.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: shamsi date problem in 3.1

Post by nickvergessen »

I also have a request for Hijri on my todo.
Maybe we can try to make it easily usable in general
No Support via PM
User avatar
Meis2M
Translator
Posts: 963
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: shamsi date problem in 3.1

Post by Meis2M »

Thanks david63 and nickvergessen .

Nick u working on it? when will be ready?
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: shamsi date problem in 3.1

Post by nickvergessen »

Hi Meis2M,
looking at it at the moment. Do I see this correctly, that the time still is the same as in the default time system?
Only the number of days per month, the names and current year differ?
No Support via PM
User avatar
nickvergessen
Former Team Member
Posts: 4397
Joined: Mon Apr 30, 2007 5:33 pm
Location: Stuttgart, Germany
Name: Joas Schilling
Contact:

Re: shamsi date problem in 3.1

Post by nickvergessen »

And hubaishan same for you

Edit: I just realised these are the same calendars, or am I mixing something up here?
No Support via PM
hubaishan
Translator
Posts: 153
Joined: Sun Apr 10, 2011 2:47 pm
Name: Saeed Hubaishan
Contact:

Re: Non gregorian calenders and phpBB 3.1.x

Post by hubaishan »

nickvergessen, See my old suggest for this
https://area51.phpbb.com/phpBB/viewtopi ... 08&t=41817
Post Reply

Return to “Extension Writers Discussion”