Line endings

This commit is contained in:
Christoph Haas 2016-12-16 14:51:04 +01:00
parent d6783cbc83
commit 9cb9978adc
21 changed files with 3670 additions and 3639 deletions

View File

@ -1,7 +1,7 @@
Backend setup: Backend setup:
1. Create a Admin User in Zarafa: 1. Create a Admin User in Kopano:
zarafa-admin -c adminuser -e admin@domain.com -f "Calendar Sync Admin" -p topsecretpw -a 1 kopano-admin -c adminuser -e admin@domain.com -f "Calendar Sync Admin" -p topsecretpw -a 1
2. Edit the config.php to fit your needs. 2. Edit the config.php to fit your needs.

View File

@ -1 +1,7 @@
<?php // config options $ADMINUSERNAME = "admin"; $ADMINPASSWORD = "admin"; $SERVER = "file:///var/run/zarafa"; $CALDAVURL = "http://localhost:8080/ical/"; $TEMPDIR = "/tmp/"; ?> <?php
// config options
$ADMINUSERNAME = "admin"; // Kopano administrative user
$ADMINPASSWORD = "admin"; // Kopano administrative user password
$SERVER = "file:///var/run/zarafa"; // Kopano socket or http(s) connection
$CALDAVURL = "http://localhost:8080/ical/"; // Caldav URL
$TEMPDIR = "/tmp/"; // Temporary directory for storing downloaded ics files

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* functions.php, zarafa calender to ics im/exporter backend * functions.php, Kopano calender to ics im/exporter backend
* *
* Author: Christoph Haas <christoph.h@sprinternet.at> * Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas * Copyright (C) 2012-2016 Christoph Haas
@ -18,10 +18,16 @@
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/ */
/* gets the data from a URL */ /**
* gets the data from a URL
*
* @param $url
* @param null $username
* @param null $password
* @return mixed|null
*/
function curl_get_data($url, $username = NULL, $password = NULL) { function curl_get_data($url, $username = NULL, $password = NULL) {
$ch = curl_init(); $ch = curl_init();
$timeout = 5; $timeout = 5;
@ -44,7 +50,12 @@ function curl_get_data($url, $username = NULL, $password = NULL) {
return $data; return $data;
} }
/* gets all zarafa users */ /**
* gets all zarafa users
*
* @param $userStore
* @return null|void
*/
function get_user_ics_list($userStore) { function get_user_ics_list($userStore) {
// get settings // get settings
// first check if property exist and we can open that using mapi_openproperty // first check if property exist and we can open that using mapi_openproperty
@ -89,7 +100,13 @@ function get_user_ics_list($userStore) {
} }
} }
/* updates the webapp settings */ /**
* updates the webapp settings
*
* @param $userStore
* @param $icsentry
* @return bool|void
*/
function update_last_sync_date($userStore, $icsentry) { function update_last_sync_date($userStore, $icsentry) {
// get settings // get settings
// first check if property exist and we can open that using mapi_openproperty // first check if property exist and we can open that using mapi_openproperty
@ -134,7 +151,17 @@ function update_last_sync_date($userStore, $icsentry) {
return false; return false;
} }
/* upload a file */ /**
* upload a file
*
* @param $filename
* @param $caldavurl
* @param $username
* @param $calendarname
* @param null $authuser
* @param null $authpass
* @return int
*/
function upload_ics_to_caldav($filename, $caldavurl, $username, $calendarname, $authuser = NULL, $authpass = NULL) { function upload_ics_to_caldav($filename, $caldavurl, $username, $calendarname, $authuser = NULL, $authpass = NULL) {
$url = $caldavurl . $username . "/" . rawurlencode($calendarname) . "/"; $url = $caldavurl . $username . "/" . rawurlencode($calendarname) . "/";
$post = array('file'=>'@'.$filename); $post = array('file'=>'@'.$filename);
@ -162,4 +189,3 @@ function upload_ics_to_caldav($filename, $caldavurl, $username, $calendarname, $
return $http_status; return $http_status;
} }
?>

View File

@ -1,7 +1,7 @@
#!/usr/bin/php #!/usr/bin/php
<?php <?php
/** /**
* sync.php, zarafa calender to ics im/exporter backend * sync.php, Kopano calender to ics im/exporter backend
* *
* Author: Christoph Haas <christoph.h@sprinternet.at> * Author: Christoph Haas <christoph.h@sprinternet.at>
* Copyright (C) 2012-2016 Christoph Haas * Copyright (C) 2012-2016 Christoph Haas
@ -26,7 +26,7 @@ if(php_sapi_name() !== 'cli') {
} }
/** /**
* Make sure that the zarafa mapi extension is enabled in cli mode: * Make sure that the kopano mapi extension is enabled in cli mode:
* Add: /etc/php5/cli/conf.d/50-mapi.ini * Add: /etc/php5/cli/conf.d/50-mapi.ini
* Content: extension=mapi.so * Content: extension=mapi.so
*/ */
@ -147,4 +147,3 @@ foreach($userList as $userName => $userData) {
echo "###Done sync for user: " . $userName . "\n\n"; echo "###Done sync for user: " . $userName . "\n\n";
} }
?>