Re: [dokuwiki-i18n] Various Calendars
Omid Mottaghi <omidmr <at> gmail.com>
2009-03-03 20:16:45 GMT
Patch to add calendar feature to DW.
What this patch do:
- Add calendar feature to DW
- Add Gregorian and Persian calendars to configuration panel to choose. (default = Gregorian)
- Change all "strftime" functions those used "$config['dformat']" to "strtime"
- Add and "strtime" to DW.
<joke> Now, you can have Mayan calendar too

</joke>
___
Omid Mottaghi
http://oxygenws.com/PGP key:
http://tinyurl.com/66q5cyOn Thu, Feb 26, 2009 at 2:50 AM, Wes
<stararmy <at> gmail.com> wrote:
We could also add a Mayan calendar that will terminate Dokuwiki's
functionality on December 21, 2012. </joke>
--
diff -uNr dokuwiki-2009-02-14/conf/dokuwiki.php dokuwiki-2009-02-14-calendar/conf/dokuwiki.php
--- dokuwiki-2009-02-14/conf/dokuwiki.php 2009-02-14 15:43:24.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/conf/dokuwiki.php 2009-03-03 23:13:37.000000000 +0330
@@ -16,6 +16,7 @@
$conf['fmode'] = 0644; //set file creation mode
$conf['dmode'] = 0755; //set directory creation mode
$conf['lang'] = 'en'; //your language
+$conf['calendar'] = 'Gregorian'; //your calendar
$conf['basedir'] = ''; //absolute dir from serveroot - blank for autodetection
$conf['baseurl'] = ''; //URL to server including protocol - blank for autodetect
$conf['savedir'] = './data'; //where to store all the files
diff -uNr dokuwiki-2009-02-14/inc/calendars.php dokuwiki-2009-02-14-calendar/inc/calendars.php
--- dokuwiki-2009-02-14/inc/calendars.php 1970-01-01 03:30:00.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/calendars.php 2009-03-03 23:13:37.000000000 +0330
@@ -0,0 +1,470 @@
+<?php
+
+/**
+ * Gregorian to Persian Convertor
+ *
+ * @author farsiweb.info
+ * @access public
+ * @param int year
+ * @param int month
+ * @param int day
+ * @return array converted time
+ */
+function g2p($g_y, $g_m, $g_d)
+{
+ $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+ $p_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
+
+ $gy = $g_y-1600;
+ $gm = $g_m-1;
+ $gd = $g_d-1;
+
+ $g_day_no = 365*$gy+floor(($gy+3)/4)-floor(($gy+99)/100)+floor(($gy+399)/400);
+
+ for ($i=0; $i < $gm; ++$i){
+ $g_day_no += $g_days_in_month[$i];
+ }
+
+ if ($gm>1 && (($gy%4==0 && $gy%100!=0) || ($gy%400==0))){
+ /* leap and after Feb */
+ ++$g_day_no;
+ }
+
+ $g_day_no += $gd;
+ $p_day_no = $g_day_no-79;
+ $p_np = floor($p_day_no/12053);
+ $p_day_no %= 12053;
+ $py = 979+33*$p_np+4*floor($p_day_no/1461);
+ $p_day_no %= 1461;
+
+ if ($p_day_no >= 366) {
+ $py += floor(($p_day_no-1)/365);
+ $p_day_no = ($p_day_no-1)%365;
+ }
+ $p_all_days = $p_day_no+1;
+
+ for ($i = 0; $i < 11 && $p_day_no >= $p_days_in_month[$i]; ++$i) {
+ $p_day_no -= $p_days_in_month[$i];
+ }
+
+ $pm = $i+1;
+ $pd = $p_day_no+1;
+
+ return array($py, $pm, $pd, $p_all_days);
+}
+
+/**
+ * Persian to Gregorian Convertor
+ *
+ * @author farsiweb.info
+ * @access public
+ * @param int year
+ * @param int month
+ * @param int day
+ * @return array converted time
+ */
+function p2g($p_y, $p_m, $p_d)
+{
+ $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+ $p_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
+ $py = $p_y-979;
+ $pm = $p_m-1;
+ $pd = $p_d-1;
+ $p_day_no = 365*$py + floor($py/33)*8 + floor(($py%33+3)/4);
+ for ($i=0; $i < $pm; ++$i){
+ $p_day_no += $p_days_in_month[$i];
+ }
+ $p_day_no += $pd;
+ $g_day_no = $p_day_no+79;
+ $gy = 1600 + 400*floor($g_day_no/146097);
+ $g_day_no = $g_day_no % 146097;
+ $leap = true;
+ if ($g_day_no >= 36525){
+ $g_day_no--;
+ $gy += 100*floor($g_day_no/36524);
+ $g_day_no = $g_day_no % 36524;
+ if ($g_day_no >= 365){
+ $g_day_no++;
+ }else{
+ $leap = false;
+ }
+ }
+ $gy += 4*floor($g_day_no/1461);
+ $g_day_no %= 1461;
+ if ($g_day_no >= 366){
+ $leap = false;
+ $g_day_no--;
+ $gy += floor($g_day_no/365);
+ $g_day_no = $g_day_no % 365;
+ }
+ for ($i = 0; $g_day_no >= $g_days_in_month[$i] + ($i == 1 && $leap); $i++){
+ $g_day_no -= $g_days_in_month[$i] + ($i == 1 && $leap);
+ }
+ $gm = $i+1;
+ $gd = $g_day_no+1;
+
+ return array($gy, $gm, $gd);
+}
+
+/**
+ * Format a string according to Persian calendar (UTF)
+ *
+ * @author Omid Mottaghi
+ * @access public
+ * @param string Formatting string
+ * @param int Timestamp to format
+ * @return string Formatted local time/date according to locale settings
+ */
+function persian_strftime_utf($format, $timestamp='')
+{
+
+ if($timestamp==''){
+ $timestamp = mktime();
+ }
+
+ $g_d=date('j', $timestamp);
+ $g_m=date('n', $timestamp);
+ $g_y=date('Y', $timestamp);
+
+ list($py, $pm, $pd, $p_all_days) = g2p($g_y, $g_m, $g_d);
+
+ $p_month_name = array('', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر',
+ 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند');
+ $p_week_name = array('Saturday' => 'شنبه',
+ 'Sunday' => 'یک شنبه',
+ 'Monday' => 'دوشنبه',
+ 'Tuesday' => 'سه شنبه',
+ 'Wednesday' => 'چهارشنبه',
+ 'Thursday' => 'پنج شنبه',
+ 'Friday' => 'جمعه',
+ 'Sat' => 'ش',
+ 'Sun' => 'ی',
+ 'Mon' => 'د',
+ 'Tue' => 'س',
+ 'Wed' => 'چ',
+ 'Thu' => 'پ',
+ 'Fri' => 'ج');
+ $p_week_number = array('Sat' => '1',
+ 'Sun' => '2',
+ 'Mon' => '3',
+ 'Tue' => '4',
+ 'Wed' => '5',
+ 'Thu' => '6',
+ 'Fri' => '7');
+
+ // calculate string
+ $output_str='';
+
+ for ($i=0; $i<strlen($format); $i++){
+
+ if($format[$i]=='%'){
+ $i++;
+ switch($format[$i]){
+ case 'a':
+ $output_str.=$p_week_name[date('D', $timestamp)];
+ break;
+ case 'A':
+ $output_str.=$p_week_name[date('l', $timestamp)];
+ break;
+ case 'b':
+ case 'B':
+ case 'h':
+ $output_str.=$p_month_name[$pm];
+ break;
+ case 'c':
+ $output_str.=persian_strftime_utf('%y/%m/%d %I:%M:%S', $timestamp);
+ break;
+ case 'C':
+ $output_str.=floor($py/100);
+ break;
+ case 'd':
+ if($pd<10) $output_str.='0'.$pd; else $output_str.=$pd;
+ break;
+ case 'D':
+ $output_str.=$py.'/'.$pm.'/'.$pd;
+ break;
+ case 'e':
+ if($pd<10) $output_str.=' '.$pd; else $output_str.=$pd;
+ break;
+ case 'H':
+ $output_str.=date('H', $timestamp);
+ break;
+ case 'I':
+ $output_str.=date('h', $timestamp);
+ break;
+ case 'j':
+ $output_str.=sprintf('%03d', $p_all_days);
+ break;
+ case 'm':
+ if($pm<10) $output_str.='0'.$pm; else $output_str.=$pm;
+ break;
+ case 'M':
+ $output_str.=date('i', $timestamp);
+ break;
+ case 'n':
+ $output_str.="\n";
+ break;
+ case 'r':
+ case 'p':
+ if(date('a',$timestamp)=='pm') $output_str.='بعد از ظهر'; else $output_str.='قبل
از ظهر';
+ break;
+ case 'R':
+ $output_str.=strftime('%R', $timestamp);
+ break;
+ case 'S':
+ $output_str.=date('s', $timestamp);
+ break;
+ case 't':
+ $output_str.="\t";
+ break;
+ case 'U':
+ case 'V':
+ case 'W':
+ $output_str.=sprintf('%02d', floor(($p_all_days+1)/7));
+ break;
+ case 'u':
+ case 'w':
+ $output_str.=$p_week_number[date('D', $timestamp)];
+ break;
+ case 'x':
+ $output_str.=persian_strftime_utf('%y/%m/%d', $timestamp);
+ break;
+ case 'X':
+ $output_str.=persian_strftime_utf('%I:%M:%S', $timestamp);
+ break;
+ case 'g':
+ case 'y':
+ $output_str.=$py-(floor($py/100)*100);
+ break;
+ case 'G':
+ case 'Y':
+ $output_str.=$py;
+ break;
+ case 'z':
+ case 'Z':
+ $output_str.=strftime('%z', $timestamp);
+ break;
+ case '%':
+ $output_str.='%';
+ break;
+ }
+ }else{
+ $output_str.=$format[$i];
+ }
+ }
+
+ return persian_numbers($output_str);
+}
+
+/**
+ * Format a string according to Persian calendar (UTF)
+ *
+ * @author Omid Mottaghi
+ * @access public
+ * @param string Formatting string
+ * @param int Timestamp to format
+ * @return string Formatted local time/date
+ */
+function persian_date_utf($format, $timestamp='')
+{
+
+ if($timestamp==''){
+ $timestamp = mktime();
+ }
+
+ $g_d=date('j', $timestamp);
+ $g_m=date('n', $timestamp);
+ $g_y=date('Y', $timestamp);
+
+ list($py, $pm, $pd, $p_all_days) = g2p($g_y, $g_m, $g_d);
+
+ $p_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
+ $leap = 0;
+ if ($g_m>1 && (($g_y%4==0 && $g_y%100!=0) || ($g_y%400==0))){
+ $p_days_in_month[12]++;
+ $leap = 1;
+ }
+
+ $p_month_name = array('', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر',
+ 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند');
+ $p_week_name = array('Saturday' => 'شنبه',
+ 'Sunday' => 'یک شنبه',
+ 'Monday' => 'دوشنبه',
+ 'Tuesday' => 'سه شنبه',
+ 'Wednesday' => 'چهارشنبه',
+ 'Thursday' => 'پنج شنبه',
+ 'Friday' => 'جمعه',
+ 'Sat' => 'ش',
+ 'Sun' => 'ی',
+ 'Mon' => 'د',
+ 'Tue' => 'س',
+ 'Wed' => 'چ',
+ 'Thu' => 'پ',
+ 'Fri' => 'ج');
+ $p_week_number = array('Sat' => '1',
+ 'Sun' => '2',
+ 'Mon' => '3',
+ 'Tue' => '4',
+ 'Wed' => '5',
+ 'Thu' => '6',
+ 'Fri' => '7');
+
+ // calculate string
+ $output_str='';
+
+ for ($i=0; $i<strlen($format); $i++){
+
+ if($format[$i]!='\\'){
+ switch($format[$i]){
+ case 'd':
+ if($pd<10) $output_str.='0'.$pd; else $output_str.=$pd;
+ break;
+ case 'j':
+ $output_str.=$pd;
+ break;
+ case 'D':
+ case 'S':
+ $output_str.=$p_week_name[date('D', $timestamp)];
+ break;
+ case 'l':
+ $output_str.=$p_week_name[date('l', $timestamp)];
+ break;
+ case 'w':
+ case 'N':
+ $output_str.=$p_week_number[date('D', $timestamp)];
+ break;
+ case 'z':
+ $output_str.=sprintf('%03d', $p_all_days);
+ break;
+ case 'W':
+ $output_str.=floor(($p_all_days+1)/7);
+ break;
+ case 'F':
+ case 'M':
+ $output_str.=$p_month_name[$pm];
+ break;
+ case 'm':
+ if($pm<10) $output_str.='0'.$pm; else $output_str.=$pm;
+ break;
+ case 'n':
+ $output_str.=$pm;
+ break;
+ case 't':
+ $output_str.=$p_days_in_month[$pm];
+ break;
+ case 'L':
+ $output_str.=$leap;
+ break;
+ case 'o':
+ case 'Y':
+ $output_str.=$py;
+ break;
+ case 'y':
+ $output_str.=$py-(floor($py/100)*100);
+ break;
+ case 'a':
+ case 'A':
+ if(date('a', $timestamp)=='pm') $output_str.='بعد از ظهر'; else $output_str.='قبل
از ظهر';
+ break;
+ case 'B':
+ $output_str.=date('B', $timestamp);
+ break;
+ case 'g':
+ $output_str.=date('g', $timestamp);
+ break;
+ case 'G':
+ $output_str.=date('G', $timestamp);
+ break;
+ case 'h':
+ $output_str.=date('h', $timestamp);
+ break;
+ case 'H':
+ $output_str.=date('H', $timestamp);
+ break;
+ case 'i':
+ $output_str.=date('i', $timestamp);
+ break;
+ case 's':
+ $output_str.=date('s', $timestamp);
+ break;
+ case 'e':
+ $output_str.=date('e', $timestamp);
+ break;
+ case 'I':
+ $output_str.=date('I', $timestamp);
+ break;
+ case 'O':
+ $output_str.=date('O', $timestamp);
+ break;
+ case 'Z':
+ $output_str.=date('Z', $timestamp);
+ break;
+ case 'c':
+ $output_str.=persian_date_utf('d-m-Y\TH:i:sO', $timestamp);
+ break;
+ case 'r':
+ $output_str.=persian_date_utf('D، j F Y H:i:s O', $timestamp);
+ break;
+ case 'U':
+ $output_str.=date('U', $timestamp);
+ break;
+ default:
+ $output_str.=$format[$i];
+ break;
+ }
+ }else{
+ $i++;
+ $output_str.=$format[$i];
+ }
+ }
+
+ return persian_numbers($output_str);
+}
+
+/**
+ * Create a Unix timestamp for a Persian date
+ * This function works only with day > 0
+ *
+ * @author Omid Mottaghi
+ * @access public
+ * @param int hour
+ * @param int minute
+ * @param int second
+ * @param int month
+ * @param int day
+ * @param int year
+ * @param int is daylight savings time set?
+ * @return int returned timestamp
+ */
+function persian_mktime($hour='', $min='', $sec='', $mon='', $day='', $year='', $is_dst=-1)
+{
+ $p_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
+
+ if ( (string) $hour == '' ) { $hour = persian_date_utf('H'); }
+ if ( (string) $min == '' ) { $min = persian_date_utf('i'); }
+ if ( (string) $sec == '' ) { $sec = persian_date_utf('s'); }
+ if ( (string) $day == '' ) { $day = persian_date_utf('j'); }
+ if ( (string) $mon == '' ) { $mon = persian_date_utf('n'); }
+ if ( (string) $year == '' ) { $year = persian_date_utf('Y'); }
+
+ // calculate days of years from 1349 till now
+ $leap_years = floor(($year - 1349 - 2) / 4);
+ $normal_years = $year - 1349 - $leap_years;
+ $years_days = ($leap_years * 366) + ($normal_years * 365);
+
+ $secs = 0;
+ $secs += $sec;
+ $secs += $min * 60;
+ $secs += $hour * 3600;
+ $secs += $day * 86400;
+
+ list($year, $mon, $day) = p2g($year, $mon, $day);
+ return mktime($hour, $min, $sec, $mon, $day, $year, $is_dst);
+}
+
+function persian_numbers($str)
+{
+ $fa_numbers = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
+ $en_numbers = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
+ return str_replace($en_numbers, $fa_numbers, $str);
+}
diff -uNr dokuwiki-2009-02-14/inc/common.php dokuwiki-2009-02-14-calendar/inc/common.php
--- dokuwiki-2009-02-14/inc/common.php 2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/common.php 2009-03-03 23:13:37.000000000 +0330
@@ -13,6 +13,7 @@
require_once(DOKU_INC.'inc/mail.php');
require_once(DOKU_INC.'inc/parserutils.php');
require_once(DOKU_INC.'inc/infoutils.php');
+require_once(DOKU_INC.'inc/calendars.php');
/**
* These constants are used with the recents function
@@ -859,7 +860,7 @@
), $tpl);
// we need the callback to work around strftime's char limit
- $tpl = preg_replace_callback('/%./',create_function('$m','return strftime($m[0]);'),$tpl);
+ $tpl = preg_replace_callback('/%./',create_function('$m','return strtime($m[0]);'),$tpl);
return $tpl;
}
@@ -1072,7 +1073,7 @@
}
$ip = clientIP();
- $text = str_replace('@DATE@',strftime($conf['dformat']),$text);
+ $text = str_replace('@DATE@',strtime($conf['dformat']),$text);
$text = str_replace('@BROWSER@',$_SERVER['HTTP_USER_AGENT'],$text);
$text = str_replace('@IPADDRESS@',$ip,$text);
$text = str_replace('@HOSTNAME@',gethostsbyaddrs($ip),$text);
@@ -1478,4 +1479,26 @@
exit;
}
+/**
+ * Generate date and time
+ *
+ * This function will generate date and time according to selected calendar
+ *
+ * @author Omid Mottaghi <omidmr <at> gmail.com>
+ */
+function strtime($format, $timestamp = false){
+ global $conf;
+
+ if(!$timestamp){
+ $timestamp = time();
+ }
+
+ switch(strtolower($conf['calendar'])){
+ case 'persian':
+ return persian_strftime_utf($format, $timestamp);
+ default:
+ return strftime($format, $timestamp);
+ }
+}
+
//Setup VIM: ex: et ts=2 enc=utf-8 :
diff -uNr dokuwiki-2009-02-14/inc/html.php dokuwiki-2009-02-14-calendar/inc/html.php
--- dokuwiki-2009-02-14/inc/html.php 2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/html.php 2009-03-03 23:26:32.000000000 +0330
@@ -250,7 +250,7 @@
$form->addHidden('date', $draft['date']);
$form->addElement(form_makeWikiText($text, array('readonly'=>'readonly')));
$form->addElement(form_makeOpenTag('div', array('id'=>'draft__status')));
- $form->addElement($lang['draftdate'].' '. strftime($conf['dformat'],filemtime($INFO['draft'])));
+ $form->addElement($lang['draftdate'].' '. strtime($conf['dformat'],filemtime($INFO['draft'])));
$form->addElement(form_makeCloseTag('div'));
$form->addElement(form_makeButton('submit', 'recover', $lang['btn_recover'], array('tabindex'=>'1')));
$form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_draftdel'], array('tabindex'=>'2')));
@@ -385,7 +385,7 @@
global $INFO;
$locktime = filemtime(wikiLockFN($ID));
- $expire = @strftime($conf['dformat'], $locktime + $conf['locktime'] );
+ $expire = @strtime($conf['dformat'], $locktime + $conf['locktime'] );
$min = round(($conf['locktime'] - (time() - $locktime) )/60);
print p_locale_xhtml('locked');
@@ -421,7 +421,7 @@
array_pop($revisions); // remove extra log entry
}
- $date = @strftime($conf['dformat'],$INFO['lastmod']);
+ $date = @strtime($conf['dformat'],$INFO['lastmod']);
print p_locale_xhtml('revisions');
@@ -469,7 +469,7 @@
}
foreach($revisions as $rev){
- $date = strftime($conf['dformat'],$rev);
+ $date = strtime($conf['dformat'],$rev);
$info = getRevisionInfo($ID,$rev,true);
$exists = page_exists($ID,$rev);
@@ -596,7 +596,7 @@
$form->addElement(form_makeOpenTag('ul'));
foreach($recents as $recent){
- $date = strftime($conf['dformat'],$recent['date']);
+ $date = strtime($conf['dformat'],$recent['date']);
if ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
$form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
else
@@ -881,7 +881,7 @@
$l_rev = '';
$l_text = rawWiki($ID,'');
$l_head = '<a class="wikilink1" href="'.wl($ID).'">'.
- $ID.' '.strftime($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '.
+ $ID.' '.strtime($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '.
$lang['current'];
$r_rev = '';
@@ -927,7 +927,7 @@
if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"';
$l_head = '<a class="wikilink1" href="'.wl($ID,"rev=$l_rev").'">'.
- $ID.' ['.strftime($conf['dformat'],$l_rev).']</a>'.
+ $ID.' ['.strtime($conf['dformat'],$l_rev).']</a>'.
'<br />'.$l_user.' '.$l_sum;
}
@@ -941,7 +941,7 @@
if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
$r_head = '<a class="wikilink1" href="'.wl($ID,"rev=$r_rev").'">'.
- $ID.' ['.strftime($conf['dformat'],$r_rev).']</a>'.
+ $ID.' ['.strtime($conf['dformat'],$r_rev).']</a>'.
'<br />'.$r_user.' '.$r_sum;
}elseif($_rev = @filemtime(wikiFN($ID))){
$_info = getRevisionInfo($ID,$_rev,true);
@@ -953,7 +953,7 @@
if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
$r_head = '<a class="wikilink1" href="'.wl($ID).'">'.
- $ID.' ['.strftime($conf['dformat'],$_rev).']</a> '.
+ $ID.' ['.strtime($conf['dformat'],$_rev).']</a> '.
'('.$lang['current'].')'.
'<br />'.$_user.' '.$_sum;
}else{
@@ -1175,7 +1175,7 @@
<div style="width:99%;">
<div class="toolbar">
- <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.strftime($conf['dformat']);?></div>
+ <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.strtime($conf['dformat']);?></div>
<div id="tool__bar"><?php if($wr){?><a href="<?php echo
DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>"
target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div>
diff -uNr dokuwiki-2009-02-14/inc/media.php dokuwiki-2009-02-14-calendar/inc/media.php
--- dokuwiki-2009-02-14/inc/media.php 2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/media.php 2009-03-03 23:25:10.000000000 +0330
@@ -402,7 +402,7 @@
if(empty($conf['notify'])) return; //notify enabled?
$text = rawLocale('uploadmail');
- $text = str_replace('@DATE@',strftime($conf['dformat']),$text);
+ $text = str_replace('@DATE@',strtime($conf['dformat']),$text);
$text = str_replace('@BROWSER@',$_SERVER['HTTP_USER_AGENT'],$text);
$text = str_replace('@IPADDRESS@',$_SERVER['REMOTE_ADDR'],$text);
$text = str_replace('@HOSTNAME@',gethostbyaddr($_SERVER['REMOTE_ADDR']),$text);
@@ -528,7 +528,7 @@
$info .= (int) $item['meta']->getField('File.Height');
$info .= ' ';
}
- $info .= '<i>'.strftime($conf['dformat'],$item['mtime']).'</i>';
+ $info .= '<i>'.strtime($conf['dformat'],$item['mtime']).'</i>';
$info .= ' ';
$info .= filesize_h($item['size']);
diff -uNr dokuwiki-2009-02-14/inc/template.php dokuwiki-2009-02-14-calendar/inc/template.php
--- dokuwiki-2009-02-14/inc/template.php 2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/template.php 2009-03-03 23:26:26.000000000 +0330
@@ -941,7 +941,7 @@
}
}
$fn = utf8_decodeFN($fn);
- $date = strftime($conf['dformat'],$INFO['lastmod']);
+ $date = strtime($conf['dformat'],$INFO['lastmod']);
// print it
if($INFO['exists']){
diff -uNr dokuwiki-2009-02-14/inc/toolbar.php dokuwiki-2009-02-14-calendar/inc/toolbar.php
--- dokuwiki-2009-02-14/inc/toolbar.php 2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/toolbar.php 2009-03-03 23:25:27.000000000 +0330
@@ -196,7 +196,7 @@
$sig = str_replace('@USER@',$_SERVER['REMOTE_USER'],$sig);
$sig = str_replace('@NAME@',$INFO['userinfo']['name'],$sig);
$sig = str_replace('@MAIL@',$INFO['userinfo']['mail'],$sig);
- $sig = str_replace('@DATE@',strftime($conf['dformat']),$sig);
+ $sig = str_replace('@DATE@',strtime($conf['dformat']),$sig);
$sig = str_replace('\\\\n','\\n',addslashes($sig));
return $sig;
}
diff -uNr dokuwiki-2009-02-14/lib/plugins/config/settings/config.metadata.php dokuwiki-2009-02-14-calendar/lib/plugins/config/settings/config.metadata.php
--- dokuwiki-2009-02-14/lib/plugins/config/settings/config.metadata.php 2009-02-14
15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/lib/plugins/config/settings/config.metadata.php 2009-03-03
23:18:18.000000000 +0330
@@ -87,6 +87,7 @@
$meta['title'] = array('string');
$meta['start'] = array('string','_pattern' => '!^[^:;/]+$!'); // don't accept namespaces
$meta['lang'] = array('dirchoice','_dir' => DOKU_INC.'inc/lang/');
+$meta['calendar'] = array('multichoice','_choices' => array('Gregorian','Persian'));
$meta['template'] = array('dirchoice','_dir' => DOKU_INC.'lib/tpl/','_pattern' => '/^[\w-]+$/');
$meta['license'] = array('license');
$meta['savedir'] = array('savedir');
diff -uNr dokuwiki-2009-02-14/lib/plugins/revert/admin.php dokuwiki-2009-02-14-calendar/lib/plugins/revert/admin.php
--- dokuwiki-2009-02-14/lib/plugins/revert/admin.php 2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/lib/plugins/revert/admin.php 2009-03-03 23:26:41.000000000 +0330
@@ -146,7 +146,7 @@
}
$cnt++;
- $date = strftime($conf['dformat'],$recent['date']);
+ $date = strtime($conf['dformat'],$recent['date']);
echo ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>';
echo '<div class="li">';