caldav
This commit is contained in:
parent
3c185e9635
commit
2d03fc6bf1
|
@ -1,13 +1,15 @@
|
|||
|
||||
SET NAMES utf8;
|
||||
SET time_zone = '+00:00';
|
||||
SET foreign_key_checks = 0;
|
||||
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
|
||||
INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
|
||||
(-100, 'BER', 'BERSIREN');
|
||||
(-100, 'cadtools', '0000000A');
|
||||
|
||||
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
|
||||
(-100, -100, 'admin', 'Administrateur', 'BER', '', 'admin.ber-assos.fr', 'admin.jpg', 'ROLE_ADMIN', 'BERSIREN', 'simple');
|
||||
(-100, -100, 'admin', 'Administrateur', 'cadtools', 'PWD_CAS', 'admin@cadtools.cadol.es', 'admin.jpg', 'ROLE_ADMIN', '0000000A', 'simple');
|
||||
|
||||
|
||||
|
||||
TRUNCATE TABLE sidebar;
|
||||
|
@ -45,7 +47,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
|
|||
('002', 1, 0, 1, 'string', 'version', '1.0.0', '', 'Version de l\'application'),
|
||||
('003', 1, 1, 0, 'string', 'subappname', 'Portail', '', 'Le sous titre de votre site'),
|
||||
('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'),
|
||||
('005', 1, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'),
|
||||
('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'),
|
||||
|
||||
|
||||
('040', 1, 1, 1, 'boolean', 'fgheader', '1', '', 'Utiliser une image en bannière du site'),
|
||||
|
|
|
@ -25,9 +25,11 @@ class CalFileParser {
|
|||
private $DTfields = array('DTSTART', 'DTEND', 'DTSTAMP', 'CREATED', 'EXDATE', 'LAST-MODIFIED');
|
||||
private $_user_timezone = null;
|
||||
private $_file_timezone = null;
|
||||
private $ctx;
|
||||
|
||||
function __construct() {
|
||||
$this->_default_output = $this->_output;
|
||||
$this->ctx = stream_context_create(array('http'=>array('timeout' => 5)));
|
||||
}
|
||||
|
||||
public function set_base_path($path) {
|
||||
|
@ -78,6 +80,8 @@ class CalFileParser {
|
|||
* read_file('http://michaelencode.com/example.vcal');
|
||||
*/
|
||||
public function read_file($file = '', $options = array()) {
|
||||
|
||||
|
||||
if (empty($file)) {
|
||||
$file = $this->_file_name;
|
||||
}
|
||||
|
@ -93,8 +97,13 @@ class CalFileParser {
|
|||
}
|
||||
|
||||
if (!empty($file) && file_exists($this->_base_path . $file)) {
|
||||
$file_contents = file_get_contents($this->_base_path . $file);
|
||||
try {
|
||||
@$file_contents = file_get_contents($this->_base_path . $file,false,$this->ctx);
|
||||
return $file_contents;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -112,14 +121,25 @@ class CalFileParser {
|
|||
'http' => array(
|
||||
'proxy' => 'tcp://'.$options["proxy"],
|
||||
'request_fulluri' => true,
|
||||
'timeout' => 5
|
||||
),
|
||||
);
|
||||
$cxContext = stream_context_create($aContext);
|
||||
|
||||
$data = file_get_contents($file, False, $cxContext);
|
||||
try {
|
||||
@$data = file_get_contents($file, False, $cxContext);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
@$data = file_get_contents($file,false,$this->ctx);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
$data = file_get_contents($file);
|
||||
|
||||
if ($data !== false) {
|
||||
return $data;
|
||||
|
@ -448,8 +468,13 @@ class SynchroICSCommand extends Command
|
|||
else
|
||||
$cal = $client->parse($calendar->getUrl());
|
||||
|
||||
$tbuid=array();
|
||||
if(!is_array($cal)) {
|
||||
$this->writelnred("Impossible de récupérer le calendrier");
|
||||
$this->writeln("");
|
||||
continue;
|
||||
}
|
||||
|
||||
$tbuid=array();
|
||||
foreach($cal as $event) {
|
||||
$event["SUMMARY"] = (isset($event["SUMMARY"])?$event["SUMMARY"]:"");
|
||||
$event["DESCRIPTION"] = (isset($event["DESCRIPTION"])?$event["DESCRIPTION"]:"");
|
||||
|
@ -535,16 +560,16 @@ class SynchroICSCommand extends Command
|
|||
$client = new SimpleCalDAVClient();
|
||||
try {
|
||||
if($PROXYactivate)
|
||||
$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['proxy_host'=>$PROXYserver.":".$PROXYport,'timeout'=>5]);
|
||||
@$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['proxy_host'=>$PROXYserver.":".$PROXYport,'timeout'=>5]);
|
||||
else
|
||||
$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['timeout'=>5]);
|
||||
@$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['timeout'=>5]);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
dump($e->__toString());
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->writeln("connected");
|
||||
$this->writeln("Connected");
|
||||
$this->writeln("");
|
||||
$tbuid=array();
|
||||
$arrayOfCalendars = $client->findCalendars("afornerot");
|
||||
|
|
Loading…
Reference in New Issue