from the site, where this extra is included! // -> use absolute path if you have it included in files with different directories! // (e.g. /home/www/htdocs/mysite.com/vwar/) // -> if included in your _header.php/_footer.php, it is normally: './' // -> if not, use: './../' $vwar_xroot = "./../"; // include header- & footer-information (1=enabled / 0=disabled) $include = 0; // months $monthnames = array( "1" => "January", "2" => "February", "3" => "March", "4" => "April", "5" => "May", "6" => "June", "7" => "July", "8" => "August", "9" => "September", "10" => "October", "11" => "November", "12" => "December" ); // weekdays $weekdaynames = array( "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ); //########################### start calendar ########################################### // check, if we need to get some global vars or if we need to include them if (!defined ("VWAR_COMMON_INCLUDED")) { $vwar_root = $vwar_xroot; require_once ($vwar_root . "includes/functions_common.php"); } if ($include == 1) { include_once ($vwar_root . "_header.php"); } include_once($vwar_root . "includes/functions_calendar.php"); $result = $vwardb->query_first("SELECT replaceword FROM vwar".$n."_replacement WHERE findword = '{highlightcolor}'"); $highlightcolor = $result['replaceword']; ?> (7 - $startofweek); $countdown--) { // check if it's the last available day if (($countdown - 1 - (7 - $startofweek)) == 0) { if ($countdown == 7) { $weekdays[0] = $weekdaynames[0]; } else { $weekdays[$countdown] = $weekdaynames[0]; } } else { if ($countdown == 7) { $weekdays[0] = $weekdaynames[$countdown - 1 - (7 - $startofweek)]; } else { $weekdays[$countdown] = $weekdaynames[$countdown - 1 - (7 - $startofweek)]; } } } $weekdaynames = $weekdays; // start calendar precalculations $current_day = date("j", time() + $timezoneoffset * 3600); $current_month = date("n", time() + $timezoneoffset * 3600); $current_year = date("Y", time() + $timezoneoffset * 3600); $month = $GPC["month"]; $year = $GPC["year"]; if (empty($month)) $month = $current_month; if (empty($year)) $year = $current_year; $numdays = date("t", mktime ( 0, 0, 0, $month + 1, 0, $year)); $calendar_headline = $monthnames[$month] . " " . $year; if ($month < 10) { $searchmonth = "0" . $month; } else { $searchmonth = $month; } // do calendar output $displayday = $startofweek; $lastday = $startofweek + 6; if ($lastday > 6) { $lastday = $lastday - 7; } $end = false; $counter = 1; if ($month == 1) { $prev_month = 12; $prev_year = $year - 1; } else { $prev_month = $month - 1; $prev_year = $year; } if ($month == 12) { $next_month = 1; $next_year = $year + 1; } else { $next_month = $month + 1; $next_year = $year; } ?> query("SELECT memberid, birthday FROM vwar".$n."_member ORDER BY name ASC"); while ($row = $vwardb->fetch_array($result)) { $birthdays[$row["memberid"]] = $row; } // get wars $wars = array(); $result = $vwardb->query(" SELECT warid, dateline, repeat_number, repeat_mod FROM vwar".$n." " . getPublicMatchtypes(0) . " ORDER BY dateline ASC "); while ($row = $vwardb->fetch_array($result)) { $wars[$row["warid"]] = $row; } unset($wherematchtype); // get events $events = array(); $result = $vwardb->query(" SELECT eventid, eventdate, enddate FROM vwar".$n."_calendarevents WHERE deleted = '0' "); while ($row = $vwardb->fetch_array($result)) { $events[$row["eventid"]] = dbSelect($row); } while (!$end) { for ($i = 0; $i < 7; $i++) { // get number of wars $dateline_low = mktime( 0, 0, 0, $month, $counter, $year); $dateline_high = mktime( 23, 59, 59, $month, $counter, $year); $numwars = count(getWars($wars, $dateline_low, $dateline_high)); // get number of birthdays $searchday = ifelse($counter < 10, "0" . $counter, $counter); $searchstring = $searchmonth . "-" . $searchday; $numbirthdays = count(getBirthdays($birthdays, $searchstring));; // get number of events $numevents = count(getEvents($events, $dateline_low,$dateline_high)); // calculate total number of events $numtotal = $numwars + $numbirthdays + $numevents; $today = mktime ( 0, 0, 0, $month, $counter, $year); if (date("w", $today) == $displayday && $month == date("n", $today)) { // check if we need to highlight the current day if ($counter == $current_day && $month == $current_month && $year == $current_year) { $font1 = ""; $font2 = ""; } else { $font1 = ""; $font2 = ""; } if ($numtotal > 0) { echo "\n"; } else { echo "\n"; } $counter++; if (date("w", $today) == $lastday) { echo "\n"; if ($counter < $numdays) echo "\n"; } } else { if (date("w", mktime( 0, 0, 0, $month, $counter, $year)) != $startofweek) { echo "\n"; } if ($counter > 1) $end = true; } $displayday++; if ($displayday > 6) { $displayday = 0; } unset($daylink); unset($numevents); } } $calendarbits .= "\n"; $monthselected = "month" . $month . "selected"; $$monthselected = "selected"; $min_year = $current_year; $count = 1; for ($selectyear = $min_year - 4; $selectyear < ($min_year + 5); $selectyear++) { $yearvalue[$count] = $selectyear; if ($year == $selectyear) { $yearselected = "year" . $count . "selected"; $$yearselected = "selected"; } $count++; } ?>
Calendar
«   »
" . $font1 . date("d", mktime( 0, 0, 0, $month, $counter, $year)) . $font2 . "/ " . makelink($urltovwar . "calendar.php?action=day&day=" . $counter . "&month=" . $month . "&year=" . $year, $numtotal) . "" . $font1 . date("d", mktime( 0, 0, 0, $month, $counter, $year)) . $font2 . "/0