"; } echo "".translate("day")."   "; if ($op == "day"){ echo ""; } if ($op == "week"){ echo ""; } echo "".translate("week")."   "; if ($op == "week"){ echo ""; } if ($op == "cal"){ echo ""; } echo "".translate("cal")."   "; if ($op == "cal"){ echo ""; } if ($op == "addevent"){echo "";} if ($op == "eventform"){echo "";} echo "".translate("addeventuser").""; if ($op == "eventform"){echo "";} if ($op == "addevent"){echo "";} echo "

"; /*if ($language == "n"){ /*setlocale("LC_TIME", "german"); /*echo ucfirst(strftime("%A %d. %B %Y"))."\n"; /*} /*else{ /*echo ucfirst(date("l d F Y"))."\n"; /*} /*echo "

"; /**************/ /* view event */ /**************/ function view($id){ global $language,$maand; $query = "select id,title,cat_name,description,day,month,year,approved,url from events left join calendar_cat on events.cat=calendar_cat.cat_id where id='$id'"; $result = mysql_query($query); $row = mysql_fetch_object($result); echo "".stripslashes($row->title)."
\n"; echo "
".translate("bdate").":

".$row->day .". ".$maand[$row->month]." ".$row->year."
\n"; echo "
".translate("cat").":

".$row->cat_name."
\n"; echo "
".translate("description").":

\n"; echo "".stripslashes($row->description)."
\n"; if ($row->url){ echo "
".translate("moreinfo")."

url." target=_blank>".$row->url."\n"; } } /*****************/ /* back function */ /*****************/ function back(){ echo "
".translate("back")."\n"; } /*************************/ /* overview of categorys */ /*************************/ function cats(){ $query = "select cat_id,cat_name from calendar_cat"; $result = mysql_query($query); $rows = mysql_num_rows($result); // if no rows if ($rows == "0"){ echo "

".translate("nocats")."

\n"; } // show categorys else { echo "

".translate("cats")."

\n"; echo "\n"; while ($row = mysql_fetch_object($result)){ $foo++ % 2 ? $color="#F7F74A" : $color="#F7F74A"; echo "\n"; } echo "
  • cat_id.">".stripslashes($row->cat_name)."
  • \n"; } } /*******************************/ /* view events of one category */ /*******************************/ function cat($id){ global $language,$maand; $query = "select id,title,cat_name,day,month,year from events left join calendar_cat on events.cat=calendar_cat.cat_id where approved='1' and events.cat='$id' order by month,day,year ASC"; $result = mysql_query($query); $rowname = mysql_fetch_object($result); $rows = mysql_num_rows($result); if (!$rows){ echo "

    ".translate("noevents")."

    \n"; } else { echo "

    ".translate("numbevents")." ".$rowname->cat_name."

    \n"; $result = mysql_query($query); while ($row = mysql_fetch_object($result)){ $foo++ % 2 ? $color="#F7F74A" : $color="#F7F74A"; echo "\n"; echo "\n"; echo "
    \n
  • id.">".stripslashes($row->title)."".translate("op")." ".$row->day.". ".$maand[$row->month]." ".$row->year."\n"; echo "
  • \n"; } } } /**********************/ /* add event: the form */ /**********************/ function eventform(){ global $language; echo "

    ".translate("addevent")."

    "; echo "
    \n"; echo translate("eventitle")."
    \n"; echo "
    \n"; echo translate("description")."
    \n"; echo "
    \n"; echo "URL
    \n"; echo "
    \n"; // get the categorys echo "\n
    \n"; // get days echo translate("bdate")."
    \n"; echo "  \n"; // get months echo "  \n"; // get year and give 3 years more to select echo "

    \n"; echo "\n
    \n"; echo "\n"; } /*************/ /* add event */ /*************/ function addevent($title,$description,$url,$cat,$bday,$bmonth,$byear){ if (!$title) { echo translate("notitle"); back(); } elseif (!$description) { echo translate("nodescription"); back(); } elseif (!$cat) { echo translate("nocat"); back(); } elseif (!$bday) { echo translate("noday"); back(); } elseif (!$bmonth) { echo translate("nomonth"); back(); } elseif (!$byear) { echo translate("noyear"); back(); } else { $title = addslashes($title); $description = addslashes(nl2br($description)); $url = str_replace("http://","",$url); $query = "insert into events values('','$title','$description','$url','$cat','$bday','$bmonth','$byear','0')"; //echo $query; $result = mysql_query($query); echo translate("thankyou"); } } /***********************/ /* view events per day */ /***********************/ function day($ask,$da,$mo,$ye,$next,$prev){ global $maand,$week,$language,$m,$d,$y; // als er geen dag is, dan is het vandaag if (!$da){ $da = $d; $mo = $m; $ye = $y; } $we = mktime(0,0,0,$mo,$da,$ye); $we = strftime("%w",$we); $we++; echo "".translate("askedday")."
    ".$week[$we]." ".$da.". ".$maand[$mo]." ".$ye."


    "; // eerst alle items zoeken (anders serieuze mix-up van vars) $query = "select id,title,description,url,cat_name,day,month,year from events left join calendar_cat on events.cat=calendar_cat.cat_id where day='$da' and month='$mo' and year='$ye' and approved='1' order by title ASC"; $result = mysql_query($query); // als ask = volgende dag... if (!$ask || $ask == "nd"){ // bepaal maand en jaar voor previous (moet nu al, anders mix up !) $ymo = $mo; $yy = $ye; // als next is, optellen if ($next){ $ok = 86400*$next; $da = date("j",time()+ $ok); $next++; } // geen next, dag is vandag, dus maar 1 keer vermenigvuldigen else { $da = date("j",time()+86400); $next = '2'; } // vars voor volgende dag // nieuwe dag = 1, maand stijgt if ($da == "1") $mo++; // nieuwe maand = dertien, jaar stijgt if ($mo == "13"){ $mo = '1'; $ye += 1; } // vars voor vorige dag (als die er is natuurlijk) // dag if ($prev){ if ($prev != "O"){ $ok = 86400*$prev; $yda = date("j",time()+$ok); $prev++; } else { $yda = date("j"); $prev = '1'; } } else { $prev = 'O'; } // nieuwe dag = 2, maand stijgt if ($da == "2") $ymo--; if ($ymo == "0") $ymo = '12'; //als nieuwe dag gelijk aan 2 en nieuwe maand gelijk aan 1: jaar +1 pd-vars +1 if ($da == "2" && $ymo == "1"){ $yy -= 1; } // dag 31 & maand 12 = jaar beneden if ($yda == "31" && $ymo == "12") $yy -= 1; // vorige dag link, als next 2 is = vandaag op scherm, dus geen vorige dag (what's the use eh :) if ($next != "2") echo "".translate("prevday")." - "; // link naar volgende dag echo "".translate("nextday")."

    "; } // als ask = vorige dag ... if ($ask == "pd"){ // bepaal maand en jaar voor previous (moet nu al, anders mix up !) $ymo = $mo; $yy = $ye; // next -> optellen $next -= 2; $ok = 86400*$next; $da = date("j",time()+ $ok); $next++; // vars voor volgende dag // nieuwe dag = 1, maand daalt if ($da == "2") $mo--; // nieuwe maand = dertien, jaar daalt if ($mo == "0"){ $mo = '12'; $ye -= 1; } if ($da == "2" && $mo == "13") $mo = "1"; // vars voor vorige dag (als die er is natuurlijk) // dag $prev -=2; if ($prev == "0") $prev == "1"; $ok = 86400*$prev; $yda = date("j",time()+$ok); $prev++; // nieuwe dag = 2, maand daalt if ($da == "2"){ $ymo--; $mo++; } if ($da == "1") $mo++; if ($ymo == "13"){ $ymo = '1'; $yy -= 1; } if ($ymo == "0") $ymo = '12'; // nieuwe maand = twaalf, jaar daalt if ($yda == "31" && $ymo == "12"){ $yy -= 1; $mo = '1'; $ye += 1; } if ($yda == "30" && $ymo == "12"){ $mo = '1'; $ye += 1; } // als next gelijk is aan twee, dan is prev = O if ($next == "2") $prev ='O'; // vorige dag link, als next 2 is = vandaag op scherm, dus geen vorige dag (what's the use eh :) if ($next != "2") echo "".translate("prevday")." - "; // link naar volgende dag echo "".translate("nextday")."

    "; } // beeld de zaken af van de gevraagde dag while ($row = mysql_fetch_object($result)){ echo "".$row->title." (".$row->cat_name.")
    "; $de = str_replace("
    ","",$row->description); echo substr(stripslashes($de),0,100)." ..."; echo "
    id.">".translate("readmore").""; echo "

    "; } } /************************/ /* view events per week */ /************************/ function week($week,$date){ global $maand,$week,$language,$m,$d,$y,$ld,$fd; if (!$date){ $year = $y; $month = $m; $day = $d; } else{ $year = substr($date,0,4); $month = substr($date,5,2); $day = substr($date,8,2); } // weeknummer function weekNumber($dag,$maand,$jaar) { $a = (14-$maand)/12; settype($a,"integer"); $y = $jaar+4800-$a; settype($y,"integer"); $m = $maand + 12*$a - 3; settype($m,"integer"); $J = $dag + (153*$m+2)/5 + $y*365 + $y/4 - $y/100 + $y/400 - 32045; $d4 = ($J+31741 - ($J % 7)) % 146097 % 36524 % 1461; $L = $d4/1460; $d1 = (($d4-$L) % 365) + $L; $WeekNumber = ($d1/7)+1; settype($WeekNumber,"integer"); return $WeekNumber; } $deesweek = mktime(0,0,0,date("d"), date("m"), date("Y")); $weeknummer = weekNumber($day,$month,$year); $laatsteweek = ($weeknummer + 10); if ($laatsteweek > 52){ $laatsteweek = $laatsteweek - 52; } // eerste dag van de week function firstDayOfWeek($year,$month,$day){ global $fd; $dayOfWeek=date("w"); $sunday_offset=$dayOfWeek * 60 * 60 * 24; $fd = date("Y-m-d", mktime(0,0,0,$month,$day+1,$year) - $sunday_offset); return $fd; } firstDayOfWeek($year,$month,$day); // laatste dag van de week function lastDayOfWeek($year,$month,$day){ global $ld; $dayOfWeek=date("w"); $saturday_offset=(6-$dayOfWeek) * 60 * 60 * 24 ; $ld = date("Y-m-d", mktime(0,0,0,$month,$day+1,$year) + $saturday_offset); return $ld; } lastDayOfWeek($year,$month,$day); if (($date) && ($date != date("Y-m-d"))){ echo "".translate("prevweek")." - "; } echo "".translate("nextweek").""; // zin met datum begin van weeknummer en datum eind weeknummer echo "

    ".translate("eventsthisweek"); $fdy = substr($fd,0,4); $fdm = substr($fd,5,2); if (substr($fdm,0,1) == "0"){ $fdm = str_replace("0","",$fdm);} $fdd = substr($fd,8,2); echo $fdd.". ".$maand[$fdm]." ".$fdy; echo translate("till"); $ldy = substr($ld,0,4); $ldm = substr($ld,5,2); if (substr($ldm,0,1) == "0"){ $ldm = str_replace("0","",$ldm);} $ldd = substr($ld,8,2); echo $ldd.". ".$maand[$ldm]." ".$ldy; echo "
    (".$weeknummer.". ".translate("weeknr").")
    "; // en nu de evenementen eruit halen :) $ld = date("Y-m-d", mktime(0,0,0,$ldm,$ldd+1,$ldy)); echo "

    "; while ($fd != $ld){ $fdy = substr($fd,0,4); $fdm = substr($fd,5,2); if (substr($fdm,0,1) == "0"){ $fdm = str_replace("0","",$fdm);} $fdd = substr($fd,8,2); $query = "select id,title,description,url,cat_name,day,month,year from events left join calendar_cat on events.cat=calendar_cat.cat_id where day='$fdd' and month='$fdm' and year='$fdy' and approved='1' order by title ASC"; //echo $query."
    "; $result = mysql_query($query); while ($row = mysql_fetch_object($result)){ echo "".$row->day.".".$row->month.".".$row->year." (".$row->cat_name.")
    "; echo "".$row->title."
    "; $de = str_replace("
    ","",$row->description); echo substr(stripslashes($de),0,100)." ..."; echo "
    id.">".translate("readmore").""; echo "

    "; } $fd = date("Y-m-d", mktime(0,0,0,$fdm,$fdd+1,$fdy)); } } /*****************/ /* view calender */ /*****************/ function cal($month,$year){ global $maand,$week,$language,$m,$d,$y; // previous month $pm = $month; if ($month == "1") $pm = "12"; else $pm--; // previous year $py = $year; if ($pm == "12") $py--; // next month $nm = $month; if ($month == "12") $nm = "1"; else $nm++; // next year $ny = $year; if ($nm == 1) $ny++; // get month we want to see $askedmonth = $maand[$month]; $askedyear = $year; setlocale(LC_TIME, "de"); $firstday = strftime ("%w", mktime(12,0,0,$month,1,$year)); $firstday++; // nr of days in askedmonth $nr = date("t",mktime(12,0,0,$month,1,$year)); echo ""; echo ""; echo ""; echo ""; echo ""; // make the days of week, consisting of seven "; // sunday else echo "bgcolor=#F7CD4B>".$week[$i].""; // rest of week } echo ""; // begin the days for ($i=1;$i<$firstday;$i++){ echo ""; } $a=0; for ($i=1;$i<=$nr;$i++){ echo ""; // closing voor end of week $a++; if (($i == (8-$firstday)) or ($i == (15-$firstday)) or ($i == (22-$firstday)) or ($i == (29-$firstday)) or ($i == (36 - $firstday))){ echo ""; $a = 0; } } // ending stuff (making 'white' td's to fill table if ($a != 0){ $last = 7-$a; for ($i=1;$i<=$last;$i++){ echo ""; } } echo ""; echo "
    "; if ($month != date("n") || $year != date("Y")){ echo " ".$maand[$pm]." ".$py.""; } echo "     ".$askedmonth." ".$askedyear.""; echo "   ".$maand[$nm]." ".$ny."
    's (=days) for ($i=1;$i<=7;$i++){ echo "".$week[$i]."
     ".$i.""; // now get eventual events on $i $query = "select id,title from events left join calendar_cat on events.cat=calendar_cat.cat_id where day='$i' and month='$month' and year='$year' and approved='1' order by day,month,year ASC"; $result = mysql_query($query); while ($row = mysql_fetch_object($result)){ echo "
  • id.">".stripslashes($row->title).""; } echo "
  •  
    "; } switch ($op){ // overview of category case"cats":{ cats(); break; } // overview of one cat case"cat":{ cat($id); break; } // add event form case"eventform":{ eventform(); break; } // add event case "addevent":{ addevent($title,$description,$url,$cat,$bday,$bmonth,$byear); break; } // view details of event case "view":{ view($id); break; } // view per day case"day":{ day($ask,$da,$mo,$ye,$next,$prev); break; } // view per week case"week":{ week($week,$date); break; } // view cal per month case"cal":{ cal($month,$year); break; } // default: bar, and show new submissions default:{ day($ask,$da,$mo,$ye,$next,$prev); break; } } require "footer.inc.php"; ?>