// Easily Simple Calendar // Version 3.1 (May 12, 2002) // (c) 2001-2002 Brian E. Nash -- Easily Simple Scripts // http://calendar.esscripts.com // Post bugs, comments, questions, suggestions at // http://calendar.esscripts.com/forum/index.php?c=38 // THIS SCRIPT IS FREE ONLY FOR NON-COMMERCIAL USE // If you intend to use this script on any website other than a persoanl, // non-commercial webiste or woule like to make a donation to the development // of this script, visit http://calendar.esscripts.com/buyonline.php. // Donations are graciously accepted. // Please take the time to vote for this script on HotScripts at the address below: // http://www.hotscripts.com/Detailed/10540.html // !!! Use this script at your own risk! // !!! There are no warranties or guarantees of any kind. // EDIT ANY OF THE VARIABLES BELOW TO MEET YOUR NEEDS // [See readme.htm for complete instructions] ////////////////////////////////////////// //////////BEGIN CALENDAR CODE //////////// ////////////////////////////////////////// // QUICK REFERENCE // :: uc = Use Configuration File // :: ms = Mark Style // :: ds = Day Start // :: ny = Not Display Year // :: nt = Not Mark Today // :: es = Event Start // :: ee = Event End // :: ot = Offset Time // :: th = Table Height // :: tw = Table Width // :: cs = Cell Spacing // :: cp = Cell Padding // :: al = Cell Alignment // :: nbc = Normal Numbers Background Color // :: tfc = Todays Font Color // :: mbc = Marked Numbers Background Color // :: dtc = Day Names Table Background Color // :: ntc = Blank Numbers Background Color // :: mtc = Month and Year Table Background Color // :: fsm = Font Fize Month // :: fsd = Font Size Dates // :: fsn = Font Size Numbers // :: fwm = Font Weight Month Name // :: fwd = Font Weight Day Names // :: fwn = Font Weight Numbers // LOAD CONFIGURATION FILE // $uc=x :: Use the configuration file set as 'x' // This option can be set here or overridden by the command-line option 'uc=' if (!$uc) $uc = "0"; // SET THIS TO A NUMBER TO USE THE CONFIGURATION FILE if ($uc>0 && file_exists("esconfig.php")) { require("esconfig.php"); $config = ereg_replace ("\?", "", $cfg[$uc]); $config = explode ("&",$config); foreach ($config as $values) { $c0 = explode ("=",$values); $$c0[0] = $c0[1]; }} // CALENDAR FILE NAME if (!$jumpto) $jumpto = ""; // CALENDAR MARKING STYLE // $ms=1 :: Mark calendar dates using table background colors [Default] // $ms=2 :: Mark calendar dates using graphics for background colors // NOTE: If using Style 2, all 'stat' graphics should be in the same directory as this script // You can edit the 'stat' graphics to meet your needs if (!$ms) $ms = "1"; // CALENDAR MARKING COLORS // Edit these colors to suit your needs // These options change be changed here or by the command-line options 'nbc', 'mbc', or 'tfc' if (!$nbc) $nbc = "CBC44B"; // NORMAL BACKGROUND COLOR if (!$mbc) $mbc = "EEBBBB"; // MARKED BACKGROUND COLOR if (!$tfc) $tfc = "CF0000"; // TODAY'S FONT COLOR if (!$mtc) $mtc = "CBC44B"; // DAY NAMES // Edit the calendar day name column headers below $day[0]="d"; $day[1]="l"; $day[2]="m"; $day[3]="m"; $day[4]="j"; $day[5]="v"; $day[6]="s"; // MONTH NAMES // Edit the calendar month names below $mth[1]="janvier"; $mth[2]="février"; $mth[3]="mars"; $mth[4]="avril"; $mth[5]="mai"; $mth[6]="juin"; $mth[7]="juillet"; $mth[8]="août"; $mth[9]="septembre"; $mth[10]="octobre"; $mth[11]="novembre"; $mth[12]="décembre"; $mthsh[0]="déc"; $mthsh[1]="jan"; $mthsh[2]="fév"; $mthsh[3]="mar"; $mthsh[4]="avr"; $mthsh[5]="mai"; $mthsh[6]="juin"; $mthsh[7]="juil"; $mthsh[8]="aoû"; $mthsh[9]="sep"; $mthsh[10]="oct"; $mthsh[11]="nov"; $mthsh[12]="déc"; $mthsh[13]="jan"; // ON WHAT DAY DOES THE WEEK START? // 0=Sunday; 1=Monday; 2=Tuesday; 3=Wednesday; 4=Thursday; 5=Friday; 6=Saturday // This option can be set here or overridden by the command-line option 'ds=' if (!$ds) $ds=0; // PRINT YEAR? // $ny=1 :: Don't display the year number after the month name // This option can be set here or overridden by the command-line option 'ny=' if (!$ny) $ny=1; // MARK TODAY? // $nt=1 :: Don't mark today's date // This option can be set here or overridden by the command-line option 'nt=' if (!$nt) $nt=0; // HOURS TO OFFSET TIME +/- // To add hours, enter a positive value. To substract hours, enter a "-" negative value // This option can be set here or overridden by the command-line option 'ot=' if (!$ot) $ot = "-0"; // CALENDAR WIDTH AND HEIGHT // Set $tw to the width of the calendar table // Set $th to the height of the calendar table (does not include the month table which is additional) // These options can be set here or overridden by the command-line options 'tw=' and 'ch=' if (!$tw) $tw="200"; // Table Width if (!$th) $th="140"; // Table Height (with 6 rows of dates) // NOTE: Table may be smaller than specified for months with only 5 rows of dates // CALENDAR CELL SPACING AND PADDING // Set $cs to the number of pixels of cell spacing (space between each cell) // Set $cp to the number of pixels of cell padding (space around names and numbers inside cells) // These options can be set here or overridden by the command-line options 'cs=' and 'cp=' if (!$cs) $cs=0; // IMPORTANT! To set cs to 0 from the command-line, you must use -0 if (!$cp) $cp=0; // DATE NUMBER ALIGNMENT // Set $algn to 0 [defult] to align the dates to the middle and center of table cells. // Set $algn to 1 to align the dates to the upper-right corner of table cells. // This option can be set here or overridden by the command-line option 'algn=' if (!$al) $al="0"; // FONT SIZES AND WEIGHT // These options can be set in the script or overridden by command-line options of // the same named variables. The sizes are in pixels. if (!$fsm) $fsm="10"; // FONT SIZE MONTH if (!$fsd) $fsd="10"; // FONT SIZE DAY NAMES if (!$fsn) $fsn="10"; // FONT SIZE NUMBERS if (!$fwm) $fwm="bold"; else $fwm="normal"; // FONT WEIGHT MONTH if (!$fwd) $fwd="normal"; else $fwd="bold"; // FONT WEIGHT DAY NAMES if (!$fwn) $fwn="normal"; else $fwn="bold"; // FONT WEIGHT NUMBERS // ONLY EDIT THE STYLE SHEET BELOW IF YOU WANT TO CHANGE THE FONT FACE AND/OR COLOR //////////////////////////////////////// ///// DO NOT EDIT BELOW THIS POINT ///// //////////////////////////////////////// // GET URI PARAMS global $HTTP_SERVER_VARS; $query=$HTTP_SERVER_VARS["QUERY_STRING_UNESCAPED"]; if ($query) { $query=str_replace("+"," ",$query); $origparams=split("\\\\\\\&",$query); //gosh ??? //var_dump ($origparams); } else { $query=$HTTP_SERVER_VARS["QUERY_STRING"]; $query=str_replace("+"," ",$query); $origparams=split("&",$query); } while (list(,$origparampair)=each($origparams)) { if (!$origparampair) continue; //die(var_dump($origparampair)); $origparampair=str_replace("\\","",$origparampair); list($key,$value)=split("=",$origparampair); $$key=$value; } // DETERMINE AND SET DATE NUMBER CELL ALIGNMENT if ($al==1) $al="align=\"right\" valign=\"top\""; elseif ($al==2) $al="align=\"left\" valign=\"top\""; elseif ($al!=1 && $al!=2) $al="align=\"center\" valign=\"middle\""; // DETERMINE TODAYS DAY NUMBER $ot = $ot*3600; if (!$nmo) {$tmo = date("m", time()+$ot);} else {$tmo=$nmo;} if (!$nda) {$tda = date("j", time()+$ot);} else {$tda=$nda;} if (!$nyr) {$tyr = date("Y", time()+$ot);} else {$tyr=$nyr;} $tnum = (intval((date ("U", mktime(20,0,0,$tmo,$tda,$tyr))/86400))); // TODAY'S DAY NUMBER // CHECK FOR COMMAND LINE DATE VARIABLES if (!$mo) $mo=$tmo; if (!$yr) $yr=$tyr; $daycount = (intval((date ("U", mktime(20,0,0,$mo,1,$yr))/86400)))-$ds; // FIRST OF MONTH DAY NUMBER $daycount=$daycount+$ds; // ADJUST FOR DAY START VARIABLE $mo=intval($mo); $mn = $mth[$mo]; // SET MONTH NAME if ($ny!=1) {$mn = $mn." ".$yr;} // ADD YEAR TO MONTH NAME? // ON WHAT DAY DOES THE FIRST FALL $sd = date ("w", mktime(0,0,0,$mo,1-$ds,$yr)); $cd = 1-$sd; // NUMBER OF DAYS IN MONTH $nd = mktime (0,0,0,$mo+1,0,$yr); $nd = (strftime ("%d",$nd))+1; //////////////////////////////////////// // PROCESS DAY MARKING ///////////////// //////////////////////////////////////// if ($es) { $es = explode ("x",$es); $smc = count ($es); $ee = explode ("x",$ee); $emc = count ($ee); if ($smc==1) { $es[1]="3000-01-01"; $ee[1]="3000-01-01"; } } $i=0; while ($i < $smc) { $es[$i] = ereg_replace('-','/', $es[$i]); $ee[$i] = ereg_replace('-','/', $ee[$i]); $start = intval(strtotime ($es[$i])/86400)+1; $end = intval(strtotime ($ee[$i])/86400)+1; if (!$ee[$i]) $end=$start; // MARK SINGLE DAY WITH ONLY ES VARIABLE if (!$bgc[$start]) {$bgc[$start]=1;} else {$bgc[$start]=4;} $bgc[$end]=3; for ($n = ($start+1); $n < $end; $n++) { $bgc[$n] = 2;} $i++; } //////////////////////////////////////////// // DISPLAY CALENDAR //////////////////////// //////////////////////////////////////////// // ADJUST TABLE HEIGHT FOR 5 ROW MONTHS $checksize=$fsd+$cs+$cp; $checkrows=$ds+$nd-$cd; if ($checkrows<36) $th=$th-intval(($th-$checksize)/6); ?>
| < | > | > | ||||
|---|---|---|---|---|---|---|
| $day[$dayprint] | \n"; } ?>||||||
| $cd | \n";$daycount++;$cd++;} else { ?>0 && $cd<$nd) {echo "class=\"dayoff\">$cd";$daycount++;} else {echo "class=\"dayempty\"> ";} $cd++;?> | }} ?>|||||
| $cd | \n";$daycount++;$cd++;} else { ?>0 && $cd<$nd) {echo " background=\"stat$bgc[$daycount].gif\">$cd";$daycount++;} else {echo ">";} $cd++;?> | }} ?>|||||