This commit is contained in:
afornerot 2019-04-26 17:04:31 +02:00
parent 3c185e9635
commit 2d03fc6bf1
2 changed files with 40 additions and 13 deletions

View File

@ -1,13 +1,15 @@
SET NAMES utf8; SET NAMES utf8;
SET time_zone = '+00:00'; SET time_zone = '+00:00';
SET foreign_key_checks = 0; SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES 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 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; 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'), ('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'), ('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'), ('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'), ('040', 1, 1, 1, 'boolean', 'fgheader', '1', '', 'Utiliser une image en bannière du site'),

View File

@ -25,9 +25,11 @@ class CalFileParser {
private $DTfields = array('DTSTART', 'DTEND', 'DTSTAMP', 'CREATED', 'EXDATE', 'LAST-MODIFIED'); private $DTfields = array('DTSTART', 'DTEND', 'DTSTAMP', 'CREATED', 'EXDATE', 'LAST-MODIFIED');
private $_user_timezone = null; private $_user_timezone = null;
private $_file_timezone = null; private $_file_timezone = null;
private $ctx;
function __construct() { function __construct() {
$this->_default_output = $this->_output; $this->_default_output = $this->_output;
$this->ctx = stream_context_create(array('http'=>array('timeout' => 5)));
} }
public function set_base_path($path) { public function set_base_path($path) {
@ -78,6 +80,8 @@ class CalFileParser {
* read_file('http://michaelencode.com/example.vcal'); * read_file('http://michaelencode.com/example.vcal');
*/ */
public function read_file($file = '', $options = array()) { public function read_file($file = '', $options = array()) {
if (empty($file)) { if (empty($file)) {
$file = $this->_file_name; $file = $this->_file_name;
} }
@ -93,8 +97,13 @@ class CalFileParser {
} }
if (!empty($file) && file_exists($this->_base_path . $file)) { 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; return $file_contents;
}
catch (Exception $e) {
return false;
}
} else { } else {
return false; return false;
} }
@ -112,14 +121,25 @@ class CalFileParser {
'http' => array( 'http' => array(
'proxy' => 'tcp://'.$options["proxy"], 'proxy' => 'tcp://'.$options["proxy"],
'request_fulluri' => true, 'request_fulluri' => true,
'timeout' => 5
), ),
); );
$cxContext = stream_context_create($aContext); $cxContext = stream_context_create($aContext);
try {
$data = file_get_contents($file, False, $cxContext); @$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) { if ($data !== false) {
return $data; return $data;
@ -448,8 +468,13 @@ class SynchroICSCommand extends Command
else else
$cal = $client->parse($calendar->getUrl()); $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) { foreach($cal as $event) {
$event["SUMMARY"] = (isset($event["SUMMARY"])?$event["SUMMARY"]:""); $event["SUMMARY"] = (isset($event["SUMMARY"])?$event["SUMMARY"]:"");
$event["DESCRIPTION"] = (isset($event["DESCRIPTION"])?$event["DESCRIPTION"]:""); $event["DESCRIPTION"] = (isset($event["DESCRIPTION"])?$event["DESCRIPTION"]:"");
@ -535,16 +560,16 @@ class SynchroICSCommand extends Command
$client = new SimpleCalDAVClient(); $client = new SimpleCalDAVClient();
try { try {
if($PROXYactivate) 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 else
$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['timeout'=>5]); @$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['timeout'=>5]);
} }
catch (Exception $e) { catch (Exception $e) {
dump($e->__toString()); dump($e->__toString());
continue; continue;
} }
$this->writeln("connected"); $this->writeln("Connected");
$this->writeln(""); $this->writeln("");
$tbuid=array(); $tbuid=array();
$arrayOfCalendars = $client->findCalendars("afornerot"); $arrayOfCalendars = $client->findCalendars("afornerot");