Liturgie ontwikkelpagina

[insert_php]
printf(‘

Dit is een testpagina!!!

‘);

// Initialiseer variabelen

$debug = 0;
if ($debug)
printf(‘

Debug mode

‘);

$map = “FileGator/repository/Liturgie/”; // map met bestanden
$amap = “FileGator/repository/Liturgie-archief/”; // map met bestanden

// Kopiëren vanaf hier!!!

// definities en constanten

require “myphp/myphp.php”;
$litdat = $map . ‘.Liturgie.datum’; // grensdatum is de datum van dit bestand
if (!file_exists($litdat)) {
touch($litdat); // als het besstand niet bestaat maak het
file_put_contents($litdat,date(“Ymd”,strtotime(“this sunday”)));
}
$litdattime = filectime($litdat); // datum en tijd van creatie
$thissunday=file_get_contents($litdat);
$onehour = 3600;
$oneday = 24 * $onehour;
$oneweek = 7 * $oneday;
$now = time(); // datum en tijd
$today = strtotime(date(‘Y-m-d’, $now)); // datum
$weekday = date(‘w’); // dag van de week (0-6, 0=zondag)
$day = date(‘j’); // dag van de maand
$month = date(‘n’); // maand
$year = date(‘Y’); // jaar
$dstb = strtotime(“last sunday”, strtotime(“1 april”)) + 2 * $onehour; // begin zomertijd
$dste = strtotime(“last sunday”, strtotime(“1 november”)) + 3 * $onehour; // einde zomertijd
$utcoffset = $onehour; // verschil met UTC wintertijd
if (($now > $dstb) && ($now < $dste)) $utcoffset = 2 * $onehour; // verschil met UTC zomertijd $time = date("H:i", $now + $utcoffset); // tijd van de dag $weekday = date('w', $now + $utcoffset); // dag van de week $day = date('j', $now + $utcoffset); // dag van de maand $month = date('n', $now + $utcoffset); // maand $year = date('Y', $now + $utcoffset); // jaar $hour = date('YmdHi', $now + $utcoffset); // uur $df = "d-m-Y H:i"; // datumformaat $lsd = strtotime('last sunday', $now); // afgelopen zondag $tsd = strtotime($thissunday); // komende zondag //$thissunday = date("j F Y", $tsd); // komende zondag $lastsunday = strtolower(date("j F Y", $lsd)); // afgelopen zondag $sday = date('d', $tsd); // datum huidig zondag $smonth = date('n', $tsd); // maand huidige zondag $syear = date('Y', $tsd); // jaar huidige zondag $csd = $syear . date('m', $tsd) . $sday; // huidige zondag (jjjjmmdd) $biddag = strtotime("second wednesday", strtotime("1 march")); $dankdag = strtotime("first wednesday", strtotime("1 november")); $pasen = easter_date(); $goedevrijdag = $pasen - (2 * $oneday); $hemelvaart = $pasen + (39 * $oneday); $pinksteren = $pasen + (49 * $oneday); $kerst = strtotime("25 december"); $oudjaar = strtotime("31 december"); $nieuwjaar = strtotime("1 january"); $nb = "-"; $nnb = "-"; $dl = "Nu"; $durl = "Live“;
$vurl = “Live“;
$pad = ‘padding=”0px”‘;
$ctr = ‘align=”center”‘;
$lft = ‘align=”left”‘;
$rgt = ‘align=”right”‘;
$bg0 = ‘bgcolor=”#f1f1f1″‘;
$bgh = ‘bgcolor=”#1998a1″‘; //”#ffa0a0″‘; // Kopkleur
$bgo = ‘bgcolor=”#a0ffff”‘; // achtergrondkleur Oost
$bgw = ‘bgcolor=”#ffffa0″‘; // West
$bgg = ‘bgcolor=”#a0ffa0″‘; // Gezamenlijk
$bggo = ‘bgcolor=”#a0ffcc”‘; // Oost/West
$bggw = ‘bgcolor=”#ccffa0″‘; // West/Oost
$colors = array(‘Oost’ => ‘bgcolor=”#a0ffff”‘,
‘West’ => ‘bgcolor=”#ffffa0″‘,
‘Oost+West’ => ‘bgcolor=”#a0ffb0″‘,
‘West+Oost’ => ‘bgcolor=”#b0ffa0″‘);

// bestanden

$fformat = “[LlPpOo]*-2*-*-*”;
$f = glob($map . $fformat, GLOB_BRACE); // vind alle bestanden
foreach ($f as $filename) {
$fn=substr(strrchr($filename, “/”), 1);
$nn = $map.strtolower($fn); // de namen naar onderkast
// echo $filename.” “.$nn.”\n”;
rename($filename, $nn);
if (substr($nn,strlen($map),1) == “p”) {
$i = strrpos($nn,”.”);
$ne = substr($nn,0,$i + 1) . “pps”;
rename($nn, $ne);
}
}
$lformat = “[Ll]*-*-*-*.*”;
$l = glob($map . $lformat, GLOB_BRACE); // zoek de liturgiebestanden
$lcount = count($l); // aantal bestanden
$pformat = “[Pp]*-*-*-*.*”; // zoek de presentatiebestanden
$p = glob($map . $pformat, GLOB_BRACE);
$pcount = count($p);
$oformat = “[Oo]*-*-*-*.mp3”; // zoek de audiobestanden
$o = glob($map . $oformat, GLOB_BRACE);
$ocount = count($o);
$vformat = “[Oo]*-*-*-*.mp4”; // zoek de audiobestanden
$v = glob($map . $vformat, GLOB_BRACE);
$vcount = count($v);
$rl = array_reverse($l);
$rp = array_reverse($p);
$ro = array_reverse($o);
$rv = array_reverse($v);

// maak array $z (datum,tijd,gemeente,bestand,bestand,feestdag,audio,video)
$i = 0;
foreach ($l as $filename) {
if (strpos($filename, $csd)) {
split_filename($filename, $z[$i][0], $z[$i][1], $z[$i][2], $h);
$z[$i][3] = $filename;
$z[$i][4] = “”;
$z[$i][5] = $h;
foreach ($p as $filename) {
split_filename($filename, $y[0], $y[1], $y[2], $h1);
if (strpos($filename, $csd) && compare_elements($z[$i], $y, 2)) {
$z[$i][4] = $filename;
}
}
foreach ($o as $filename) {
split_filename($filename, $y[0], $y[1], $y[2], $h1);
if (strpos($filename, $csd) && compare_elements($z[$i], $y, 2)) {
$z[$i][6] = $filename;
}
}
foreach ($v as $filename) {
split_filename($filename, $y[0], $y[1], $y[2], $h1);
if (strpos($filename, $csd) && compare_elements($z[$i], $y, 2)) {
$z[$i][7] = $filename;
}
}
$i += 1;
}
}
$lcount=$i;
printf(‘‘);
//printf(‘

‘);
printf(“Het is nu %s uur, %s %s %s

“, $time, $days[$weekday], $day, $months[$month], $year);
$tcap = sprintf(“Zondag %s”, format_date($thissunday));
printf(‘%s’, $tcap);
if ($tsd == $pasen)
printf(“ – Pasen“);
if ($tsd == $pinksteren)
printf(“ – Pinksteren“);
printf(“

“);
printf(‘

‘);
printf(‘

‘, $bgh, $ctr, $ctr, $ctr, $ctr, $ctr, $ctr);
for ($j = 0; $j < count($z); $j++) { /* $bg = $bgg; if ($z[$j][2] == "Oost") $bg = $bgo; if ($z[$j][2] == "West") $bg = $bgw; */ $bg = $colors[$z[$j][2]]; $url1 = make_url($z[$j][3], "Liturgie", filectime($z[$j][3]) + $utcoffset, $df); $url2 = $nnb; // printf('

‘,$tsd,$now);
if (($tsd + $oneday) < $now) $url2 = $nb; if ($z[$j][4] <> “”)
$url2 = make_url($z[$j][4], “Presentatie”, filectime($z[$j][4]) + $utcoffset, $df);
$url3 = $nnb;
// printf(‘

‘,$tsd,$now);
if (($tsd + $oneday) < $now) $url3 = $nb; if ($z[$j][6] <> “”) {
$url3 = make_url($z[$j][6], “Audio”, filectime($z[$j][6]) + $utcoffset, $df, true); } else {
$uur = $thissunday.substr($z[$j][1],0,2).substr($z[$j][1],3,2);
// printf(‘

‘,$hour,$uur-5);
if (($hour >= $uur-45) && ($hour < $uur+115)) { $url3 = $durl; }} $url4 = $nnb; // printf('

‘,$tsd,$now);
if (($tsd + $oneday) < $now) $url4 = $nb; if ($z[$j][7] <> “”) {
$url4 = make_url($z[$j][7], “Video”, filectime($z[$j][7]) + $utcoffset, $df, true); } else {
$uur = $thissunday.substr($z[$j][1],0,2).substr($z[$j][1],3,2);
// printf(‘

‘,$hour,$uur-5);
if (($hour >= $uur-45) && ($hour < $uur+115)) { $url4 = $vurl; }} printf('

‘, $bg, $ctr, $z[$j][1], $ctr, $z[$j][2], $ctr, $url1, $ctr, $url2, $ctr, $url3, $ctr, $url4);
}
printf(‘

Tijd Gemeente Liturgie Presentatie Audio Video
%s %s
%s %s
%s %s
%s %s
%s %s
%s %s %s %s %s %s

‘);

if ($lcount == 0)
printf(“Nog niet beschikbaar…“);

printf(‘

 

‘);

// maak array $x (datum,tijd,gemeente,bestand,bestand,feestdag,audio,video)
$i = 0; $j = 0;
foreach ($l as $filename) {
if (!strpos($filename, $csd)) {
split_filename($filename, $x[$i][0], $x[$i][1], $x[$i][2], $x[$i][5]);
$x[$i][3] = $filename;
$x[$i][4] = “”;
foreach ($p as $filename) {
split_filename($filename, $y[0], $y[1], $y[2], $h);
if (!strpos($filename, $csd) && compare_elements($x[$i], $y, 2)) {
$x[$i][4] = $filename;
}
}
foreach ($o as $filename) {
split_filename($filename, $y[0], $y[1], $y[2], $h);
if (!strpos($filename, $csd) && compare_elements($x[$i], $y, 2)) {
$x[$i][6] = $filename;
}
}
foreach ($v as $filename) {
split_filename($filename, $y[0], $y[1], $y[2], $h);
if (!strpos($filename, $csd) && compare_elements($x[$i], $y, 2)) {
$x[$i][7] = $filename;
}
}
if ($x[$i][0] > $csd) {
$w[$j] = $x[$i];
$j++;
array_pop($x);
$i -= 1;
}
$i += 1;
}
}
if (count($w) > 0) {
$tcap = sprintf(“Overige erediensten“);
printf(‘%s’, $tcap);
printf(‘

‘);
printf(‘

‘, $bgh, $ctr, $ctr, $ctr, $ctr, $ctr, $ctr, $ctr);
for ($j = 0; $j < count($w); $j++) { /* $bg = $bgg; if ($w[$j][2] == "Oost") $bg = $bgo; if ($w[$j][2] == "West") $bg = $bgw; */ $bg = $colors[$w[$j][2]]; $w[$j][0] = format_date($w[$j][0]); if ($w[$j][5] <> “”) $w[$j][0] .= ” – ” . $w[$j][5];
$url1 = make_url($w[$j][3], “Liturgie”, filectime($w[$j][3]) + $utcoffset, $df);
$url2 = $nnb;
if ($w[$j][4] <> “”)
$url2 = make_url($w[$j][4], “Presentatie”, filectime($w[$j][4]) + $utcoffset, $df);
$url3 = $nnb;
if ($w[$j][6] <> “”)
$url3 = make_url($w[$j][6], “Audio”, filectime($w[$j][6]) + $utcoffset, $df, true);
if (($hour >= $uur-45) && ($hour < $uur+115)) { $url3 = $durl; } $url4 = $nnb; if ($w[$j][7] <> “”)
$url4 = make_url($w[$j][7], “Video”, filectime($w[$j][7]) + $utcoffset, $df, true);
if (($hour >= $uur-45) && ($hour < $uur+115)) { $url4 = $vurl; } printf('

‘, $bg, $ctr, $w[$j][0], $ctr, $w[$j][1], $ctr, $w[$j][2], $ctr, $url1, $ctr, $url2, $ctr, $url3, $ctr, $url4);
}
printf(‘

Datum Tijd Gemeente Liturgie Presentatie Audio Video
%s %s %s %s %s %s %s

‘);
printf(‘

 

‘);
}

$rx = array_reverse($x);
for ($j = 0; $j < count($rx) - 1; $j++) { if (($rx[$j][0] == $rx[$j + 1][0]) && ($rx[$j][1] > $rx[$j + 1][1])) {
swap_elements($rx[$j], $rx[$j + 1]);
$j = -1;
}
}
$i=0;

$tcap = sprintf(“Eerdere erediensten“);
printf(‘%s’, $tcap);
printf(‘

‘);
printf(‘

‘, $bgh, $ctr, $ctr, $ctr, $ctr, $ctr, $ctr, $ctr);
for ($j = 0; $j < count($rx); $j++) { /* $bg = $bgg; if ($rx[$j][2] == "Oost") $bg = $bgo; if ($rx[$j][2] == "West") $bg = $bgw; */ $bg = $colors[$rx[$j][2]]; $rx[$j][0] = format_date($rx[$j][0]); if ($rx[$j][5] <> “”) $rx[$j][0] .= ” – ” . $rx[$j][5];
$url1 = make_url($rx[$j][3], “Liturgie”, filectime($rx[$j][3]) + $utcoffset, $df);
$url2 = $nb;
if ($rx[$j][4] <> “”)
$url2 = make_url($rx[$j][4], “Presentatie”, filectime($rx[$j][4]) + $utcoffset, $df);
$url3 = $nb;
if ($rx[$j][6] <> “”)
$url3 = make_url($rx[$j][6], “Audio”, filectime($rx[$j][6]) + $utcoffset, $df, true);
$url4 = $nb;
if ($rx[$j][7] <> “”)
$url4 = make_url($rx[$j][7], “Video”, filectime($rx[$j][7]) + $utcoffset, $df, true);
printf(‘

‘, $bg, $ctr, $rx[$j][0], $ctr, $rx[$j][1], $ctr, $rx[$j][2], $ctr, $url1, $ctr, $url2, $ctr, $url3, $ctr, $url4);
}
printf(‘

Datum Tijd Gemeente Liturgie Presentatie Audio Video
%s %s %s %s %s %s %s

‘);
printf(‘

‘);
printf(‘‘);
//printf(‘‘);

// Kopiëren tot hier!!

[/insert_php]