Jalali Calander (Solar Or Shamsi) For vBulletin
Hello
I have made on Jalali Calander for vBulletin. Thanks from: 1- Hamed Hadadian 2- Reza Gholampanahi (jdf.scr.ir) jalali date on forum is completed but in cms and blogs completed up to 99% For do this action must be in original vBulletin files to manually do the changes. This changes is: Code:
1. Upload 'jalali.php' to vBulletin's includes folder. EX: vb/includes **************************************************************************** 2. Upload 'hooks_jlalali.xml' to includes's xml folder. EX: vb/includes/xml **************************************************************************** 3. Open 'includes/functions.php' then **************************************************************************** Find below, at first: // ###### ... Before add below: require_once('jalali.php'); **************************************************************************** Find below: $datefunc = 'strftime'; After add with: ($hook = vBulletinHook::fetch_hook('jalali_strftime')) ? eval($hook) : false; **************************************************************************** Find below: $datefunc = 'date'; After add with: ($hook = vBulletinHook::fetch_hook('jalali_date')) ? eval($hook) : false; **************************************************************************** Find below: $datetest = @date('n-j-Y', $timestamp - $hourdiff); After add with: ($hook = vBulletinHook::fetch_hook('jalali_datetest')) ? eval($hook) : false; **************************************************************************** 4. Open 'includes/functions_misc.php' then **************************************************************************** Find below: return mktime(intval($hours), intval($minutes), intval($seconds), intval($month), intval($day), intval($year)) + $vbulletin->options['hourdiff']; Replace with: if ( VB_AREA == 'AdminCP' or VB_AREA == 'ModCP' or THIS_SCRIPT == 'blog' ){ return mktime(intval($hours), intval($minutes), intval($seconds), intval($month), intval($day), intval($year)) + $vbulletin->options['hourdiff'];} else{ if ($vbulletin->options['jalali_act'] == 1){ return jmktime(intval($hours), intval($minutes), intval($seconds), intval($month), intval($day), intval($year)) + $vbulletin->options['hourdiff'];} else{ return mktime(intval($hours), intval($minutes), intval($seconds), intval($month), intval($day), intval($year)) + $vbulletin->options['hourdiff'];} } **************************************************************************** Find below: $datearray = array( 'day' => date('d', $timestamp), 'month' => date('n', $timestamp), 'year' => date('Y', $timestamp) ); After add with: ($hook = vBulletinHook::fetch_hook('jalali_datearray')) ? eval($hook) : false; *************************************************************************** 5. Open 'includes/class_dm_user.php' then *************************************************************************** Find below: function verify_birthday(&$birthday) { After Add Below: ($hook = vBulletinHook::fetch_hook('jalali_verify_birthday')) ? eval($hook) : false; *************************************************************************** 6. Open 'includes/class_userprofile.php' then **************************************************************************** Find below: $bday = explode('-', $userinfo['birthday']); $year = vbdate('Y', TIMENOW, false, false); $month = vbdate('n', TIMENOW, false, false); $day = vbdate('j', TIMENOW, false, false); After add with: ($hook = vBulletinHook::fetch_hook('jalali_bday')) ? eval($hook) : false; **************************************************************************** Find below: $this->registry->options['calformat1'] = mktimefix($this->registry->options['calformat1'], $bday[2]); Before add with: ($hook = vBulletinHook::fetch_hook('jalali_tbday')) ? eval($hook) : false; **************************************************************************** 7. Open 'includes/class_postbit.php' then **************************************************************************** Find below: $this->cache['year'] = vbdate('Y', TIMENOW, false, false); $this->cache['month'] = vbdate('n', TIMENOW, false, false); $this->cache['day'] = vbdate('j', TIMENOW, false, false); After add with: ($hook = vBulletinHook::fetch_hook('jalali_bday')) ? eval($hook) : false; **************************************************************************** 8. open 'includes/blog_functions.php' then **************************************************************************** Find below: $startdate = getdate(gmmktime(12, 0, 0, $month, 1, $year)); Before add below: ($hook = vBulletinHook::fetch_hook('jalali_blog')) ? eval($hook) : false; **************************************************************************** Find below: if ($userinfo['showbirthday'] == 1 OR $userinfo['showbirthday'] == 2) { $year = vbdate('Y', TIMENOW, false, false); $month = vbdate('n', TIMENOW, false, false); $day = vbdate('j', TIMENOW, false, false); After add with: ($hook = vBulletinHook::fetch_hook('jalali_blog')) ? eval($hook) : false; **************************************************************************** 9. Open 'register.php' then *************************************************************************** Find below: $bday = explode('-', $birthday); After add below: ($hook = vBulletinHook::fetch_hook('jalali_bday_register')) ? eval($hook) : false; *************************************************************************** Find below: if ($vbulletin->GPC['month'] == 0 OR $vbulletin->GPC['day'] == 0 OR !preg_match('#^\d{4}$#', $vbulletin->GPC['year']) OR $vbulletin->GPC['year'] < 1901 OR $vbulletin->GPC['year'] > $current['year']) { eval(standard_error(fetch_error('select_valid_dob', $current['year']))); } Replace with: if ($vbulletin->options['jalali_act'] == 1){ $jalalicurrent['year'] = jdate('Y'); list ( $vbulletin->GPC['year'], $vbulletin->GPC['month'], $vbulletin->GPC['day'] ) = jalali_to_gregorian ( $vbulletin->GPC['year'], $vbulletin->GPC['month'], $vbulletin->GPC['day'] ); if ($vbulletin->GPC['month'] == 0 OR $vbulletin->GPC['day'] == 0 OR !preg_match('#^\d{4}$#', $vbulletin->GPC['year']) OR $vbulletin->GPC['year'] < 1901 OR $vbulletin->GPC['year'] > $current['year']){ eval(standard_error(fetch_error('jalali_select_valid_month_and_year', $jalalicurrent['year'])));}} else{ if ($vbulletin->GPC['month'] == 0 OR $vbulletin->GPC['day'] == 0 OR !preg_match('#^\d{4}$#', $vbulletin->GPC['year']) OR $vbulletin->GPC['year'] < 1901 OR $vbulletin->GPC['year'] > $current['year']){ eval(standard_error(fetch_error('select_valid_dob', $current['year'])));} } *************************************************************************** Find below: // pre-cache templates used by specific actions Before add below: require_once('./global.php'); ($hook = vBulletinHook::fetch_hook('jalali_globaltemplates')) ? eval($hook) : false; **************************************************************************** Find below: $templater = vB_Template::create('register_verify_age'); After add with: ($hook = vBulletinHook::fetch_hook('jalali_templater_register')) ? eval($hook) : false; **************************************************************************** Find below: $templater = vB_Template::create('modifyprofile_birthday'); After add with: ($hook = vBulletinHook::fetch_hook('jalali_templater_modifyprofile')) ? eval($hook) : false; **************************************************************************** 10.Open 'private.php' then **************************************************************************** Find below: $templater = vB_Template::create('pm_filter'); After add with: ($hook = vBulletinHook::fetch_hook('jalali_templater_private')) ? eval($hook) : false; **************************************************************************** 11.Open 'announcement.php' then **************************************************************************** Find below: $templater = vB_Template::create('announcement_edit'); After add with: ($hook = vBulletinHook::fetch_hook('jalali_templater_announcement')) ? eval($hook) : false; **************************************************************************** Find below: $GLOBALS["{$date_type}_date_array"] = array( 'day' => vbdate('j', $announcementinfo["{$date_type}date"], false, false), 'month' => vbdate('n', $announcementinfo["{$date_type}date"], false, false), 'year' => vbdate('Y', $announcementinfo["{$date_type}date"], false, false) ); After add with: ($hook = vBulletinHook::fetch_hook('jalali_fields')) ? eval($hook) : false; **************************************************************************** 12. Open 'profile.php' then **************************************************************************** Find below: if (date('Y') >= $birthday[2] AND $birthday[2] != '0000') { $year = $birthday[2]; } After add with: ($hook = vBulletinHook::fetch_hook('jalali_set_birthday')) ? eval($hook) : false; **************************************************************************** Find below: $vbulletin->options['calformat1'] = mktimefix($vbulletin->options['calformat1'], $birthday[2]); Before add with: ($hook = vBulletinHook::fetch_hook('jalali_calformat')) ? eval($hook) : false; **************************************************************************** Find below: $actiontemplates['docustomize'] = $actiontemplates['customize']; Before add below: require_once('./global.php'); ($hook = vBulletinHook::fetch_hook('jalali_actiontemplates')) ? eval($hook) : false; **************************************************************************** Find below: $birthdaybit = $templater->render(); After add with: ($hook = vBulletinHook::fetch_hook('jalali_templater_profile')) ? eval($hook) : false; **************************************************************************** 13. Open 'forum.php' then **************************************************************************** Find below: $today = vbdate('Y-m-d', TIMENOW, false, false); After add with: ($hook = vBulletinHook::fetch_hook('jalali_today')) ? eval($hook) : false; **************************************************************************** 14. Open 'memberlist.php' then **************************************************************************** Find below: if ($vbulletin->options['usememberlistadvsearch']) { After add below: ($hook = vBulletinHook::fetch_hook('jalali_usememberlistadvsearch')) ? eval($hook) : false; **************************************************************************** Find below: $today_year = vbdate('Y', TIMENOW, false, false); $today_month = vbdate('n', TIMENOW, false, false); $today_day = vbdate('j', TIMENOW, false, false); After add with: ($hook = vBulletinHook::fetch_hook('jalali_memberlistbits')) ? eval($hook) : false; **************************************************************************** Find below: $birthdayformat = mktimefix($vbulletin->options['calformat1'], $bday[2]); After add with: ($hook = vBulletinHook::fetch_hook('jalali_birthdayformat')) ? eval($hook) : false; **************************************************************************** 15. Final: Goto Admin Control Panel then **************************************************************************** Product Manager -> Add/Import Product -> Select jalali.xml and import it. Enjoy it! Then go to : Settings > Options > jalali date > And click Yes ============================================================================ For better display the Forum's proposed use this format : Format For Date : Code:
l d F y Format For Time: Code:
H:i Format For Registration Date Code:
F Y Format For Birthdays with Year Specified Code:
l j F Y Format For Birthdays with Year Unspecified Code:
j F Log Date Format Code:
F Y H:i Other Format is : Download
Jalali Calander Product.zip (13.2 KB, 56 downloads) Screenshots |