예제 #1
0
 private function Parse()
 {
     $this->c_dom = new DOMDocument();
     $this->c_dom->loadHTML($this->c_raw);
     $this->c_rows = Rooster::FindRows($this->c_dom);
     $this->PrettifyResult();
     $this->ProcessResult();
     return true;
 }
예제 #2
0
$payload = array();
if (!empty($_GET['pl'])) {
    $payload = json_decode(gzuncompress(base64_decode($_GET['pl'])), true);
    if (json_last_error() != JSON_ERROR_NONE) {
        die('JSON payload was malformed. Error: ' . json_last_error_msg());
    }
    //echo 'Got GET URL from external source: '.$url.'<br>'.PHP_EOL;
    $icallink = BASE_URL_L . BASE_URL_L_ICAL . '?' . $_SERVER['QUERY_STRING'];
    ?>
	<h3>Current Payload</h3>
			<a href="<?php 
    echo $icallink;
    ?>
" target="_blank">iCal link (subscription)</a><br />
		<?php 
    $rooster = new Rooster($icallink);
    foreach ($payload as $v) {
        $rooster->AddRooster($v);
    }
    $calendername = 'Rooster' . (count($rooster->names) ? 's' : '') . ' ' . $rooster->Name;
    $calenderdesc = 'Collegerooster' . (count($rooster->names) ? 's' : '') . ' voor ' . $rooster->Name . ' aan Universiteit Leiden';
    ?>
	<p><strong>Calendar Details</strong><br />
		<em>Name:</em> <?php 
    echo $calendername;
    ?>
<br />
		<em>Published on:</em> <?php 
    echo $rooster->PublishDate->format('Y-m-d H:i');
    ?>
<br />
예제 #3
0
<?php

require_once 'main.php';
ini_set('html_errors', false);
if (DEBUG) {
    header('Content-Type: text/plain; charset=utf-8;');
}
$payload = array();
if (!empty($_GET['pl'])) {
    $payload = json_decode(gzuncompress(base64_decode($_GET['pl'])), true);
    if (json_last_error() != JSON_ERROR_NONE) {
        die('JSON payload was malformed. Error: ' . json_last_error_msg());
    }
    //echo 'Got GET URL from external source: '.$url.'<br>'.PHP_EOL;
} else {
    $payload[] = array();
}
$rooster = new Rooster(BASE_URL_L . BASE_URL_L_ICAL . '?' . $_SERVER['QUERY_STRING']);
foreach ($payload as $v) {
    $rooster->AddRooster($v);
}
$rooster->Expand();
//echo 'Writing iCal...'.PHP_EOL;
$rooster->WriteiCal();
if (!DEBUG) {
    header('Content-Type: text/calendar; charset=utf-8; method="PUBLISH"; component="VEVENT"');
    header('Content-Disposition: attachment;filename=ical.ics');
}