diff -r -u phpwiki-1.2.0/index.php phpwiki/index.php --- phpwiki-1.2.0/index.php Wed Nov 8 15:34:06 2000 +++ phpwiki/index.php Thu Aug 30 18:45:09 2001 @@ -36,6 +36,8 @@ include "lib/pageinfo.php"; } elseif (isset($diff)) { include "lib/diff.php"; + } elseif (isset($calendar)) { + include "lib/calendar.php"; } else { include "lib/display.php"; // defaults to FrontPage } diff -r -u phpwiki-1.2.0/lib/config.php phpwiki/lib/config.php --- phpwiki-1.2.0/lib/config.php Wed Jan 31 07:38:10 2001 +++ phpwiki/lib/config.php Thu Aug 30 18:44:02 2001 @@ -142,6 +142,7 @@ // formats are given as format strings to PHP date() function $datetimeformat = "F j, Y"; // may contain time of day $dateformat = "F j, Y"; // must not contain time + $caldateformat = "m/d/Y"; // must not contain time // this defines how many page names to list when displaying // the MostPopular pages; the default is to show the 20 most popular pages Only in phpwiki/lib: config.php.orig diff -r -u phpwiki-1.2.0/lib/stdlib.php phpwiki/lib/stdlib.php --- phpwiki-1.2.0/lib/stdlib.php Mon Jan 15 12:32:57 2001 +++ phpwiki/lib/stdlib.php Thu Aug 30 18:41:19 2001 @@ -10,6 +10,7 @@ RenderQuickSearch($value) RenderFullSearch($value) RenderMostPopular() + RenderCalendar($month, $year) CookSpaces($pagearray) class Stack (push(), pop(), cnt(), top()) SetHTMLOutputMode($newmode, $depth) @@ -105,6 +106,69 @@ return $result; } + function RenderCalendar($month, $year, $more_link=TRUE) { + global $caldateformat, $ScriptUrl, $dbi; + + exec( "/usr/bin/cal $month $year", $result ); + array_pop($result); + + $output = "\n"; + + $output .= '\n"; + + $output .= '\n \n"; + + $today = date($caldateformat); + + $week_count = 0; + foreach($result as $week) + { + if(defined($days)) unset($days); + if($week_count == 0) { + ereg("^(..) (..) (..) (..) (..) (..) (..)$", $week, $days); + array_shift($days); + array_pop($days); + array_pop($days); + } else { + $week = ereg_replace("^ +", "", $week); + $days = split(" +", $week); + } + + $output .= "\n"; + foreach($days as $day) + { + $day = ereg_replace(" ", "", $day); + + $page = date($caldateformat, mktime(0, 0, 0, $month, $day, $year)); + $output .= $page==$today ? + '\n"; + } + $output .= "\n"; + $week_count++; + } + + if($more_link) { + $output .= '\n"; + } + $output .= '

'; + $output .= ereg_replace(" ", " ", + ereg_replace(" {2,}", "", array_shift($result))); + $output .= "

'; + $output .= ereg_replace(" ", "", + array_shift($result)); + $output .= "
' : ''; + + $output .= IsWikiPage($dbi, $page) ? + "" : + ""; + $output .= "$day"; + + $output .= "
'; + $output .= "more..."; + $output .= "
'; + + return $output; + } function ParseAdminTokens($line) { global $ScriptUrl; @@ -431,6 +495,10 @@ } } + $date_array = getdate(time()); + $month = $date_array[mon]; + $year = $date_array[year]; + $page = join('', file($templates[$template])); $page = str_replace('###', "$FieldSeparator#", $page); @@ -444,6 +512,7 @@ _dotoken('PAGE', htmlspecialchars($name), $page); _dotoken('ALLOWEDPROTOCOLS', $AllowedProtocols, $page); _dotoken('LOGO', $logo, $page); + _dotoken('CALENDAR', RenderCalendar($month, $year), $page); // invalid for messages (search results, error messages) if ($template != 'MESSAGE') {