mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-09-19 05:59:02 +00:00
Merge branch 'external-ua' into 'master'
Set the user agent string for external calendars Closes #115 See merge request !37
This commit is contained in:
commit
513e58fa41
@ -211,6 +211,13 @@ $c->admin_email ='calendar-admin@example.com';
|
|||||||
*/
|
*/
|
||||||
// $c->external_refresh = 60;
|
// $c->external_refresh = 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External subscription (BIND) user agent string
|
||||||
|
* Required if your remote calendar only delivers to known user agents.
|
||||||
|
* Default: none
|
||||||
|
*/
|
||||||
|
// $c->external_ua_string = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you want to force DAViCal to use HTTP Digest Authentication for CalDAV
|
* If you want to force DAViCal to use HTTP Digest Authentication for CalDAV
|
||||||
* access. Note that this requires all user passwords to be stored in plain text
|
* access. Note that this requires all user passwords to be stored in plain text
|
||||||
|
|||||||
@ -39,7 +39,7 @@ function create_external ( $path,$is_calendar,$is_addressbook )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetch_external ( $bind_id, $min_age = '1 hour' )
|
function fetch_external ( $bind_id, $min_age = '1 hour', $ua_string )
|
||||||
{
|
{
|
||||||
if ( ! function_exists ( "curl_init" ) ) {
|
if ( ! function_exists ( "curl_init" ) ) {
|
||||||
dbg_error_log("external", "external resource cannot be fetched without curl, please install curl");
|
dbg_error_log("external", "external resource cannot be fetched without curl, please install curl");
|
||||||
@ -64,6 +64,8 @@ function fetch_external ( $bind_id, $min_age = '1 hour' )
|
|||||||
curl_setopt ( $curl, CURLOPT_NOBODY, true );
|
curl_setopt ( $curl, CURLOPT_NOBODY, true );
|
||||||
curl_setopt ( $curl, CURLOPT_TIMEVALUE, $local_ts->format("U") );
|
curl_setopt ( $curl, CURLOPT_TIMEVALUE, $local_ts->format("U") );
|
||||||
curl_setopt ( $curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE );
|
curl_setopt ( $curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE );
|
||||||
|
if ( isset( $ua_string ) )
|
||||||
|
curl_setopt($curl, CURLOPT_USERAGENT, $ua_string);
|
||||||
dbg_error_log("external", "checking external resource for remote changes " . $row->external_url );
|
dbg_error_log("external", "checking external resource for remote changes " . $row->external_url );
|
||||||
$ics = curl_exec ( $curl );
|
$ics = curl_exec ( $curl );
|
||||||
$info = curl_getinfo ( $curl );
|
$info = curl_getinfo ( $curl );
|
||||||
@ -115,7 +117,7 @@ function update_external ( $request )
|
|||||||
if ( $qry->Exec('DAVResource') && $qry->rows() > 0 && $row = $qry->Fetch() ) {
|
if ( $qry->Exec('DAVResource') && $qry->rows() > 0 && $row = $qry->Fetch() ) {
|
||||||
if ( $row->bind_id != 0 ) {
|
if ( $row->bind_id != 0 ) {
|
||||||
dbg_error_log("external", "external resource needs updating, this might take a minute : %s", $row->url );
|
dbg_error_log("external", "external resource needs updating, this might take a minute : %s", $row->url );
|
||||||
fetch_external ( $row->bind_id, $c->external_refresh . ' minutes' );
|
fetch_external ( $row->bind_id, $c->external_refresh . ' minutes', $c->external_ua_string );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user