Location: PHPKode > projects > PBBoard > PBBoard_v2.1.4/Upload/modules/calendar.module.php
<?php
(!defined('IN_PowerBB')) ? die() : '';

include('common.php');
define('JAVASCRIPT_PowerCode',true);

define('CLASS_NAME','PowerBBCalendarMOD');

class PowerBBCalendarMOD
{
	function run()
	{
		global $PowerBB;
 		if (!$PowerBB->_CONF['info_row']['active_calendar'])
		{
		exit;
        }
		$PowerBB->functions->ShowHeader();

  $PowerBB->template->display('address_bar_part1');
echo ' '. $PowerBB->_CONF['template']['lang']['Calendar'];
  $PowerBB->template->display('address_bar_part2');

   		/** Show Calendar form **/
		if ($PowerBB->_GET['show'])
		{
			if ($PowerBB->_GET['show'] == '1')
			{
			$this->_GetCalendar();
			}
			if ($PowerBB->_GET['show'] == '2')
			{
			$this->_GetCalendarHijri();
			}
		}

		$this->_GetJumpSectionsList();

       $PowerBB->functions->GetFooter();
	}

	function _GetCalendar()
	{
   		global $PowerBB;

 		$PowerBB->_GET['show'] = $PowerBB->functions->CleanVariable($PowerBB->_GET['show'],'intval');


		$get_now_date = getdate();
		$now_year = $get_now_date[year];
		$now_month = $get_now_date[mon];
		$now_day = $get_now_date[mday];
		$month=$PowerBB->_POST['month'];
		$year=$PowerBB->_POST['year'];

		define ("ADAY", (60*60*24));
		if (!checkdate($month,1,$year)){
			$nowArray = getdate();
			$month = $nowArray[mon];
			$year = $nowArray[year];
		}

		$start = mktime (0, 0, 0, $month, 1, $year);

		$firstDayArray = getdate($start);

	?>

	<br>

<table class=rwo1 cellpadding='0' cellspacing='0' width='98%' ><tr>
		<td valign="top">
  <?php $PowerBB->template->display('calendar'); ?>

		</td>
		<td width="80%" class='row2' valign="top">
	<div align="center">
	<table border="0" cellspacing="1" class="border" width="99%">
	<tr>
	<td width="99%" align="center" class='row1'>

	<form name=calendar_form action="<?$_SERVER['PHP_SELF']?>" method="post" >
	<select name=month onChange='document.calendar_form.submit();'>

	<?php

		$months = Array($PowerBB->_CONF['template']['lang']['January'],$PowerBB->_CONF['template']['lang']['February'],$PowerBB->_CONF['template']['lang']['March'],$PowerBB->_CONF['template']['lang']['April'],$PowerBB->_CONF['template']['lang']['May'],$PowerBB->_CONF['template']['lang']['June'],$PowerBB->_CONF['template']['lang']['July'],$PowerBB->_CONF['template']['lang']['August'],$PowerBB->_CONF['template']['lang']['September'],$PowerBB->_CONF['template']['lang']['October'],$PowerBB->_CONF['template']['lang']['November'],$PowerBB->_CONF['template']['lang']['December']);
		for ($x=1; $x<=count($months); $x++){
			print "\t<option value='$x'";
			print ($x == $month)? " SELECTED":"";
			print ">" . $months[$x-1]."\n";
		}

	?>

	</select>
	<select name=year onChange='document.calendar_form.submit();'>
	<?php

		for ($x=$now_year; $x<=$now_year+10; $x++){
			print "\t<option";
			print ($x == $year)? " SELECTED":"";
			print ">$x\n" ;
		}

	?>
	</select>

	</form>

	</td>
	</tr>
	</table></div>
	<br>

	<?php
	$days = Array($PowerBB->_CONF['template']['lang']['Mon'], $PowerBB->_CONF['template']['lang']['Tue'], $PowerBB->_CONF['template']['lang']['Wed'], $PowerBB->_CONF['template']['lang']['Thu'], $PowerBB->_CONF['template']['lang']['Fri'],$PowerBB->_CONF['template']['lang']['Sat'],$PowerBB->_CONF['template']['lang']['Sun'] );
	$Calendar = $PowerBB->_CONF['template']['lang']['Gregorian_calendar'];
	print "<div align='center' STYLE=\"cursor:hand;cursor:pointer\" ><center>\n<table class=border cellpadding='1' cellspacing='0' width='99%' >
	<tr><td class='tcat' colspan='7'>$Calendar</td></tr>
	<tr>\n";

	foreach ($days as $day) {
		print "\t<td class=Calendar_Title_Background_Color align='center' width='40'>$day</td>\n";
	}

	for ($count=0; $count < (6*7); $count++){
		$dayArray = getdate($start);
		if ((($count) % 7) == 0){
			if ($dayArray[mon] != $month)
				break;
				print "</tr>\n<tr>\n";
		}

		if ($count < $firstDayArray[wday] || $dayArray[mon] != $month) {
			print "\t<td><br></td>\n";
		}
		else {

			if ($now_day == $dayArray[mday] && $now_month == $month && $now_year == $year){
				print "\t<td class=Calendar_ToDay_Background_Color title=\"Date $firstDayArray[month] $dayArray[mday] $firstDayArray[year]\" onClick=\"SetFormat('$firstDayArray[month] $dayArray[mday] $firstDayArray[year]')\" onMouseover=\"this.className='Calendar_MouseOver';\" onMouseout=\"this.className='Calendar_ToDay_Background_Color';\" height='22' align='center' width='14%'>$dayArray[mday]</td>\n";
			}
			else{
				print "\t<td class=Calendar_NormalDay_Background_Color title=\"Date $firstDayArray[month] $dayArray[mday] $firstDayArray[year]\" onClick=\"SetFormat('$firstDayArray[month] $dayArray[mday] $firstDayArray[year]')\" onMouseover=\"this.className='Calendar_MouseOver';\" onMouseout=\"this.className='Calendar_NormalDay_Background_Color';\" height='22' align='center' width='14%'>$dayArray[mday]</td>\n";
			}
			$start += ADAY;
		}
	}

	print "</tr></table>\n</center></div><p class=Calendar_first_day_array align='center'>";
	?>
		<script language="JavaScript">

		var fixd;

		function isGregLeapYear(year)
		{
		return year%4 == 0 && year%100 != 0 || year%400 == 0;
		}


		function gregToFixed(year, month, day)
		{
		var a = Math.floor((year - 1) / 4);
		var b = Math.floor((year - 1) / 100);
		var c = Math.floor((year - 1) / 400);
		var d = Math.floor((367 * month - 362) / 12);

		if (month <= 2)
		e = 0;
		else if (month > 2 && isGregLeapYear(year))
		e = -1;
		else
		e = -2;

		return 1 - 1 + 365 * (year - 1) + a - b + c + d + e + day;
		}

		function Hijri(year, month, day)
		{
		this.year = year;
		this.month = month;
		this.day = day;
		this.toFixed = hijriToFixed;
		this.toString = hijriToString;
		}

		function hijriToFixed()
		{
		return this.day + Math.ceil(29.5 * (this.month - 1)) + (this.year - 1) * 354 +
		Math.floor((3 + 11 * this.year) / 30) + 227015 - 1;
		}

		function hijriToString()
		{
		var months = new Array("Muharram","Safar","Rabi-al Awwal","Rabi-al Thani","Jumada al-Ula","Jumada al-Thani","Rajab","Sha\'ban","Ramadhan","Shawwal","Dh ul Qa\'dah","Dhul Hijjah");
		return this.day + " " + months[this.month - 1]+ " " + this.year;
		}

		function fixedToHijri(f)
		{
		var i=new Hijri(1100, 1, 1);
		i.year = Math.floor((30 * (f - 227015) + 10646) / 10631);
		var i2=new Hijri(i.year, 1, 1);
		var m = Math.ceil((f - 29 - i2.toFixed()) / 29.5) + 1;
		i.month = Math.min(m, 12);
		i2.year = i.year;
		i2.month = i.month;
		i2.day = 1;
		i.day = f - i2.toFixed() + 1;
		return i;
		}

		var tod=new Date();
		var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
		var monthname=new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December");

		var y = tod.getFullYear();
		var m = tod.getMonth();
		var d = tod.getDate();
		var dow = tod.getDay();
		document.write(weekday[dow] + " " + d + " " + monthname[m] + " " + y);
		m++;
		fixd=gregToFixed(y, m, d);
		var h=new Hijri(1421, 11, 28);
		h = fixedToHijri(fixd);
		document.write(" CE | " + h.toString() + " AH &nbsp;&nbsp;");

		</script>
</td>
     	</tr>
</table>
	</body>
	</html>
<?php
     }


	function _GetCalendarHijri()
	{
   		global $PowerBB;


 		$PowerBB->_GET['show'] = $PowerBB->functions->CleanVariable($PowerBB->_GET['show'],'intval');

      // Hijri Date
		$DateType   ="h";    // h=هجري       m=ميلادي
		$m = date("m");
		$y = date("Y");
		$d = date("d");
		$dd=date("D");
		if ($DateType == "h") {
		If ( $m > 2 )
		{
		$y = $y;
		$m = $m;
		}
		If ($m == 1 || $m == 2) {
		$y = $y - 1;
		$m = $m + 12;
		}
		$j = intval(365.25 * $y) + intval(30.6001 * ($m + 1)) + $d + 1720994.5;
		If (date("d / m / Y") >= (15 / 10 / 1582)) {
		$a = intval($y / 100);
		$b = 2 - $a + intval($a / 4);
		$jd = $j + $b;
		}
		If (date("d / m / Y") < (15 / 10 / 1582)) {
		$jd = $j;
		}
		$hh = $jd - 1948437.5;
		$y = ($hh / 354.3667);
		$hy = intval($y) + 1;
		$m = (12 * ($y - intval($y)));
		$hm = intval($m) + 1;
		$d = (29.5305 * ($m - intval($m)));
		$hd = intval($d);
		If ($hd == 0) {
		$hd = 30;
		$hm = $hm - 1;
		}
		If ($hm == 0 ) {
		$hm = 12;
		$hy = $hy - 1;
		}
		}
      //

		$get_now_date = getdate();
		$now_year = $get_now_date[year];
		$now_month = $get_now_date[mon];
		$now_day = $hd;
		$month=$PowerBB->_POST['month'];
		$year=$PowerBB->_POST['year'];

		define ("ADAY", (60*60*24));
		if (!@checkdate($month,1,$year)){
			$nowArray = getdate();
			$month = $nowArray[mon];
			$year = $nowArray[year];
		}

		$start = mktime (0, 0, 0, $month, 1, $year);

		$firstDayArray = getdate($start);

	?>


	<br>
<table class=rwo1 cellpadding='0' cellspacing='0' width='98%' ><tr>
		<td valign="top">
		<?php $PowerBB->template->display('calendar'); ?>
		</td>
		<td width="80%">
	<div align="center">
	<table border="0" cellspacing="1" class="border" width="99%">
	<tr>
	<td width="99%" align="center" class='row1' valign="top">

	<form name=calendar_form action="<?$_SERVER['PHP_SELF']?>" method="post" >
	<select name=month onChange='document.calendar_form.submit();'>
	<?php

		$months = Array($PowerBB->_CONF['template']['lang']['January'],$PowerBB->_CONF['template']['lang']['February'],$PowerBB->_CONF['template']['lang']['March'],$PowerBB->_CONF['template']['lang']['April'],$PowerBB->_CONF['template']['lang']['May'],$PowerBB->_CONF['template']['lang']['June'],$PowerBB->_CONF['template']['lang']['July'],$PowerBB->_CONF['template']['lang']['August'],$PowerBB->_CONF['template']['lang']['September'],$PowerBB->_CONF['template']['lang']['October'],$PowerBB->_CONF['template']['lang']['November']);


		for ($x=1; $x<=count($months); $x++){
			print "\t<option value='$x'";
			print ($x == $month)? " SELECTED":"";

			if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['January']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Muharram'];
			 }
			 if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['February']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Safar'];
			 }
			if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['March']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Rabi_Al_Awwal'];
			 }
			if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['April']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Rabi_Al_Akhar'];
			 }
			if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['May']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Jumada_Al_Awwal'];
			 }
			if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['June']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Jumada_Al_Akhirah'];
			 }
			 if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['July']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Rajab'];
			 }
			 if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['August']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Shaban'];
			 }
			 if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['September']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Ramadan'];
			 }
			 if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['October']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Shawwal'];
			 }
			  if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['November']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Dhul_Qadah'];
			 }
			  if ($months[$x-1] == $PowerBB->_CONF['template']['lang']['December']) {
			 $months[$x-1]=$PowerBB->_CONF['template']['lang']['Dhul_Hijjah'];
			 }

			print ">" . $months[$x-1]."\n";
		}

	?>

	</select>

	<select name=year onChange='document.calendar_form.submit();'>
	<?php


$x=$now_year;
		 if ($x == '2010') {
			 $x='1431';
			 }
		 if ($x == '2011') {
			 $x='1432';
			 }
			 if ($x == '2012') {
			 $x='1433';
			 }
			 if ($x == '2013') {
			 $x='1434';
			 }
			 if ($x == '2014') {
			 $x='1435';
			 }
			 if ($x == '2015') {
			 $x='1436';
			 }
			 if ($x == '2016') {
			 $x='1437';
			 }
			 if ($x == '2017') {
			 $x='1438';
			 }
			 if ($x == '2018') {
			 $x='1439';
			 }
			 if ($x == '2019') {
			 $x='1440';
			 }
			 if ($x == '2020') {
			 $x='1441';
			 }
			 if ($x == '2021') {
			 $x='1442';
			 }
            print '\t<option value="$now_year">'.$x.'</option>';
             print '<option value="2011">1432</option>';
              print '<option value="2012">1433</option>';
               print '<option value="2013">1434</option>';
                print '<option value="2014">1435</option>';
                 print '<option value="2015">1436</option>';
                  print '<option value="2016">1437</option>';
                   print '<option value="2017">1438</option>';
                    print '<option value="2018">1439</option>';
                    print '<option value="2019">1440</option>';

	?>
	</select>

	</form>

	</td>
	</tr>
	</table></div>
	<br>

	<?php
	$days = Array($PowerBB->_CONF['template']['lang']['Tue'], $PowerBB->_CONF['template']['lang']['Wed'], $PowerBB->_CONF['template']['lang']['Thu'], $PowerBB->_CONF['template']['lang']['Fri'],$PowerBB->_CONF['template']['lang']['Sat'],$PowerBB->_CONF['template']['lang']['Sun'], $PowerBB->_CONF['template']['lang']['Mon'] );
	$Calendar = $PowerBB->_CONF['template']['lang']['CalendarHijri'];
	print "<div align='center' STYLE=\"cursor:hand;cursor:pointer\" ><center>\n<table class=border cellpadding='1' cellspacing='0' width='99%' >
	<tr><td class='tcat' colspan='7'>$Calendar</td></tr>
	<tr>\n";

	foreach ($days as $day) {
		print "\t<td class=Calendar_Title_Background_Color align='center' width='40'>$day</td>\n";
	}

	for ($count=0; $count < (6*7); $count++){
		$dayArray = getdate($start);
		if ((($count) % 7) == 0){
			if ($dayArray[mon] != $month)
				break;
				print "</tr>\n<tr>\n";
		}

		if ($count < $firstDayArray[wday] || $dayArray[mon] != $month) {
			print "\t<td><br></td>\n";
		}
		else {

			if ($now_day == $dayArray[mday] && $now_month == $month && $now_year == $year){
	 if ($firstDayArray[year] == '2010') {
			 $firstDayArray[year]='1431';
			 }
		 if ($firstDayArray[year] == '2011') {
			 $firstDayArray[year]='1432';
			 }
			 if ($firstDayArray[year] == '2012') {
			 $firstDayArray[year]='1433';
			 }
			 if ($firstDayArray[year] == '2013') {
			 $firstDayArray[year]='1434';
			 }
			 if ($firstDayArray[year] == '2014') {
			 $firstDayArray[year]='1435';
			 }
			 if ($firstDayArray[year] == '2015') {
			 $firstDayArray[year]='1436';
			 }
			 if ($firstDayArray[year] == '2016') {
			 $firstDayArray[year]='1437';
			 }
			 if ($firstDayArray[year] == '2017') {
			 $firstDayArray[year]='1438';
			 }
			 if ($firstDayArray[year] == '2018') {
			 $firstDayArray[year]='1439';
			 }
			 if ($firstDayArray[year] == '2019') {
			 $firstDayArray[year]='1440';
			 }
			 if ($firstDayArray[year] == '2020') {
			 $firstDayArray[year]='1441';
			 }
			 if ($firstDayArray[year] == '2021') {
			 $firstDayArray[year]='1442';
			 }

			if ($firstDayArray[month] == 'January') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Muharram'];
			 }
			 if ($firstDayArray[month] == 'February') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Safar'];
			 }
			if ($firstDayArray[month] == 'March') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Rabi_Al_Awwal'];
			 }
			if ($firstDayArray[month] == 'April') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Rabi_Al_Akhar'];
			 }
			if ($firstDayArray[month] == 'May') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Jumada_Al_Awwal'];
			 }
			if ($firstDayArray[month] == 'June') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Jumada_Al_Akhirah'];
			 }
			 if ($firstDayArray[month] == 'July') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Rajab'];
			 }
			 if ($firstDayArray[month] == 'August') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Shaban'];
			 }
			 if ($firstDayArray[month] == 'September') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Ramadan'];
			 }
			 if ($firstDayArray[month] == 'October') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Shawwal'];
			 }
			  if ($firstDayArray[month] == 'November') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Dhul_Qadah'];
			 }
			  if ($firstDayArray[month] == 'December') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Dhul_Hijjah'];
			 }
           $Hijri= $PowerBB->_CONF['template']['lang']['Hijri'];
				print "\t<td class=Calendar_ToDay_Background_Color title=\"  $dayArray[mday] $firstDayArray[month] $firstDayArray[year] $Hijri\" onClick=\"SetFormat('$firstDayArray[month] $dayArray[mday] $firstDayArray[year]')\" onMouseover=\"this.className='Calendar_MouseOver';\" onMouseout=\"this.className='Calendar_ToDay_Background_Color';\" height='22' align='center' width='14%'>$dayArray[mday]</td>\n";
			}
			else{
	 if ($firstDayArray[year] == '2010') {
			 $firstDayArray[year]='1431';
			 }
		 if ($firstDayArray[year] == '2011') {
			 $firstDayArray[year]='1432';
			 }
			 if ($firstDayArray[year] == '2012') {
			 $firstDayArray[year]='1433';
			 }
			 if ($firstDayArray[year] == '2013') {
			 $firstDayArray[year]='1434';
			 }
			 if ($firstDayArray[year] == '2014') {
			 $firstDayArray[year]='1435';
			 }
			 if ($firstDayArray[year] == '2015') {
			 $firstDayArray[year]='1436';
			 }
			 if ($firstDayArray[year] == '2016') {
			 $firstDayArray[year]='1437';
			 }
			 if ($firstDayArray[year] == '2017') {
			 $firstDayArray[year]='1438';
			 }
			 if ($firstDayArray[year] == '2018') {
			 $firstDayArray[year]='1439';
			 }
			 if ($firstDayArray[year] == '2019') {
			 $firstDayArray[year]='1440';
			 }
			 if ($firstDayArray[year] == '2020') {
			 $firstDayArray[year]='1441';
			 }
			 if ($firstDayArray[year] == '2021') {
			 $firstDayArray[year]='1442';
			 }

			if ($firstDayArray[month] == 'January') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Muharram'];
			 }
			 if ($firstDayArray[month] == 'February') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Safar'];
			 }
			if ($firstDayArray[month] == 'March') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Rabi_Al_Awwal'];
			 }
			if ($firstDayArray[month] == 'May') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Rabi_Al_Akhar'];
			 }
			if ($firstDayArray[month] == 'June') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Jumada_Al_Awwal'];
			 }
			if ($firstDayArray[month] == 'July') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Jumada_Al_Akhirah'];
			 }
			 if ($firstDayArray[month] == 'August') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Rajab'];
			 }
			 if ($firstDayArray[month] == 'April') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Shaban'];
			 }
			 if ($firstDayArray[month] == 'September') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Ramadan'];
			 }
			 if ($firstDayArray[month] == 'October') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Shawwal'];
			 }
			  if ($firstDayArray[month] == 'November') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Dhul_Qadah'];
			 }
			  if ($firstDayArray[month] == 'December') {
			 $firstDayArray[month]=$PowerBB->_CONF['template']['lang']['Dhul_Hijjah'];
			 }
			$Hijri= $PowerBB->_CONF['template']['lang']['Hijri'];
				print "\t<td class=Calendar_NormalDay_Background_Color title=\" $dayArray[mday] $firstDayArray[month] $firstDayArray[year] $Hijri\" onClick=\"SetFormat('$firstDayArray[month] $dayArray[mday] $firstDayArray[year]')\" onMouseover=\"this.className='Calendar_MouseOver';\" onMouseout=\"this.className='Calendar_NormalDay_Background_Color';\" height='22' align='center' width='14%'>$dayArray[mday]</td>\n";
			}
			$start += ADAY;
		}
	}

	print "</tr></table>\n</center></div><p class=Calendar_first_day_array align='center'>";
	?>
		<script language="JavaScript">

		var fixd;

		function isGregLeapYear(year)
		{
		return year%4 == 0 && year%100 != 0 || year%400 == 0;
		}


		function gregToFixed(year, month, day)
		{
		var a = Math.floor((year - 1) / 4);
		var b = Math.floor((year - 1) / 100);
		var c = Math.floor((year - 1) / 400);
		var d = Math.floor((367 * month - 362) / 12);

		if (month <= 2)
		e = 0;
		else if (month > 2 && isGregLeapYear(year))
		e = -1;
		else
		e = -2;

		return 1 - 1 + 365 * (year - 1) + a - b + c + d + e + day;
		}

		function Hijri(year, month, day)
		{
		this.year = year;
		this.month = month;
		this.day = day;
		this.toFixed = hijriToFixed;
		this.toString = hijriToString;
		}

		function hijriToFixed()
		{
		return this.day + Math.ceil(29.5 * (this.month - 1)) + (this.year - 1) * 354 +
		Math.floor((3 + 11 * this.year) / 30) + 227015 - 1;
		}

		function hijriToString()
		{
		var months = new Array("محرم","صفر","ربيع أول","ربيع ثانى","جمادى أول","جمادى ثانى","رجب","شعبان","رمضان","شوال","ذو القعدة","ذو الحجة");
		return this.day + " " + months[this.month - 1]+ " " + this.year;
		}

		function fixedToHijri(f)
		{
		var i=new Hijri(1100, 1, 1);
		i.year = Math.floor((30 * (f - 227015) + 10646) / 10631);
		var i2=new Hijri(i.year, 1, 1);
		var m = Math.ceil((f - 29 - i2.toFixed()) / 29.5) + 1;
		i.month = Math.min(m, 12);
		i2.year = i.year;
		i2.month = i.month;
		i2.day = 1;
		i.day = f - i2.toFixed() + 1;
		return i;
		}

		var tod=new Date();
		var weekday=new Array("الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت");
		var monthname=new Array("يناير","فبراير","مارس","إبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر");

		var y = tod.getFullYear();
		var m = tod.getMonth();
		var d = tod.getDate();
		var dow = tod.getDay();
		document.write(weekday[dow] + " " + d + " " + monthname[m] + " " + y);
		m++;
		fixd=gregToFixed(y, m, d);
		var h=new Hijri(1431, 11, 28);
		h = fixedToHijri(fixd);
		document.write(" ميلادى - " + h.toString() + " هجرى &nbsp;&nbsp;");

		</script>
</td>
     	</tr>
</table>

	</body>
	</html>
<?php
     }

	    /**
	 * Get the Jump Sections List
	 */
	function _GetJumpSectionsList()
    {
		global $PowerBB;

		//////////

		$SecArr 						= 	array();
		$SecArr['get_from']				=	'db';

		$SecArr['proc'] 				= 	array();
		$SecArr['proc']['*'] 			= 	array('method'=>'clean','param'=>'html');

		$SecArr['order']				=	array();
		$SecArr['order']['field']		=	'sort';
		$SecArr['order']['type']		=	'ASC';

		$SecArr['where']				=	array();
		$SecArr['where'][0]['name']		= 	'parent';
		$SecArr['where'][0]['oper']		= 	'=';
		$SecArr['where'][0]['value']	= 	'0';

		// Get main sections
		$catsy = $PowerBB->section->GetSectionsList($SecArr);

		// We will use forumsy_list to store list of forums which will view in main page
		$PowerBB->_CONF['template']['foreach']['forumsy_list'] = array();

		// Loop to read the information of main sections
		foreach ($catsy as $caty)
		{
			// Get the groups information to know view this section or not
			$groups = unserialize(base64_decode($caty['sectiongroup_cache']));

			if (is_array($groups[$PowerBB->_CONF['group_info']['id']]))
			{
				if ($groups[$PowerBB->_CONF['group_info']['id']]['view_section'])
				{
					$PowerBB->_CONF['template']['foreach']['forumsy_list'][$caty['id'] . '_m'] = $caty;
				}
			}

			unset($groups);

			if (!empty($caty['forums_cache']))
			{
				$forumsy = unserialize(base64_decode($caty['forums_cache']));

				foreach ($forumsy as $forumy)
				{
					if (is_array($forumy['groups'][$PowerBB->_CONF['group_info']['id']]))
					{
						if ($forumy['groups'][$PowerBB->_CONF['group_info']['id']]['view_section'])
						{
							//////////

							// Get the first-level sub forums as a _link_ and store it in $forumy['sub']

							$forumy['is_sub'] 	= 	0;
							$forumy['sub']		=	'';

							if (!empty($forumy['forums_cache']))
							{
								$subsy = unserialize(base64_decode($forumy['forums_cache']));

								if (is_array($subsy))
								{
									foreach ($subsy as $suby)
									{
										if (is_array($suby['groups'][$PowerBB->_CONF['group_info']['id']]))
										{
											if ($suby['groups'][$PowerBB->_CONF['group_info']['id']]['view_section'])
											{
												if (!$forumy['is_sub'])
												{
													$forumy['is_sub'] = 1;
												}

												$forumy['sub'] .= ('<option value="index.php?page=forum&amp;show=1&amp;id=' . $suby['id'] . '">---'  . $suby['title'] . '</option>');
											}
										}
									}
								}
							}


							$PowerBB->_CONF['template']['foreach']['forumsy_list'][$forumy['id'] . '_f'] = $forumy;
						}
					} // end if is_array
				} // end foreach ($forumsy)
			} // end !empty($forums_cache)
		} // end foreach ($catsy)

		//////////
  $PowerBB->template->display('jump_forums_list');

   }

}

?>
Return current item: PBBoard