93 lines
2.3 KiB
PHP
93 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* listCalendars
|
|
*
|
|
* Copyright 2014 Michael Palm <palm.michael@gmx.de>
|
|
*
|
|
* Open this file in a webbrowser to view a list of all accessible calendars
|
|
* on the server and the information related to those calendars. It can be used
|
|
* to determine the calendar-id, needed for SimpleCalDAV.
|
|
*
|
|
* @package simpleCalDAV
|
|
*/
|
|
require_once("session_init.php");
|
|
require_once("config.inc.php");
|
|
require_once('SimpleCalDAVClient.php');
|
|
require_once('fonctions.php');
|
|
|
|
$param = array(
|
|
"url::",
|
|
"user::",
|
|
"help::",
|
|
"pass::",
|
|
);
|
|
$optind=null;
|
|
|
|
if ( !($opt = getopt( 'h::', $param, $optind)) )
|
|
{
|
|
echo "erreur de paramètre de la commande" . EOL;
|
|
exit(1);
|
|
}
|
|
|
|
if( !empty(getopt("h")) or !empty(getopt("help")) )
|
|
{
|
|
echo "les arguments sont:
|
|
--url=<url du serveur dav>
|
|
--user=<identifiant utilisateur>
|
|
--pass=<mot de passe dde l'utilisateur>";
|
|
}else
|
|
{
|
|
|
|
$url = getpost("url");
|
|
$user = getpost("user");
|
|
$pass = getpost("pass");
|
|
|
|
if( empty($url))
|
|
{
|
|
echo '
|
|
<form action="#" method="post">
|
|
<p>This formular can be used to view a list of all accessible calendars on the server and the information related to those calendars. It can be used to determine the calendar-id, needed for SimpleCalDAV.</p>
|
|
<p>Calendar-URL:<br><input name="url" type="text" size="30" maxlength="100"></p>
|
|
<p>Username:<br><input name="user" type="text" size="30" maxlength="100"></p>
|
|
<p>Password:<br><input name="pass" type="text" size="30" maxlength="100"></p>
|
|
<input type="submit" value=" Show! ">
|
|
</form>';
|
|
}
|
|
|
|
else {
|
|
$client = new SimpleCalDAVClient();
|
|
|
|
try {
|
|
$client->connect($url, $user, $pass);
|
|
$calendars = $client->findCalendars();
|
|
|
|
echo'
|
|
<table>';
|
|
|
|
$i = 0;
|
|
foreach($calendars as $cal)
|
|
{
|
|
$i++;
|
|
|
|
echo '
|
|
<tr> <td></td> <td><strong>Calendar #'.$i.'</strong></td> </tr>
|
|
<tr> <td>URL:</td> <td>'.$cal->getURL().'</td> </tr>
|
|
<tr> <td>Display Name:</td> <td>'.$cal->getDisplayName().'</td> </tr>
|
|
<tr> <td>Calendar ID:</td> <td>'.$cal->getCalendarID().'</td> </tr>
|
|
<tr> <td>CTAG:</td> <td>'.$cal->getCTag().'</td> </tr>
|
|
<tr> <td>RBG-Color:</td> <td>'.$cal->getRBGcolor().'</td> </tr>
|
|
<tr> <td>Order:</td> <td>'.$cal->getOrder().'</td> </tr>
|
|
<tr> <td></td> <td></td> </tr>';
|
|
}
|
|
|
|
echo '</table>';
|
|
|
|
}catch (Exception $e)
|
|
{
|
|
echo $e->__toString();
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|