eliminate trailing whitespace, expand tabs

This commit is contained in:
Florian Schlichting 2016-12-28 10:31:59 +01:00
parent 063048802f
commit eb7f2edc0c
50 changed files with 475 additions and 482 deletions

View File

@ -155,12 +155,12 @@ $c->protocol_server_port = sprintf( '%s://%s%s',
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'? 'https' : 'http'), (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'? 'https' : 'http'),
$_SERVER['SERVER_NAME'], $_SERVER['SERVER_NAME'],
( (
( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') ( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')
&& (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80) ) && (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80) )
|| (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
&& (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 443) ) && (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 443) )
? '' ? ''
: ':'.$_SERVER['SERVER_PORT'] : ':'.$_SERVER['SERVER_PORT']
) ); ) );
$c->protocol_server_port_script = $c->protocol_server_port . ($_SERVER['SCRIPT_NAME'] == '/index.php' ? '' : $_SERVER['SCRIPT_NAME']); $c->protocol_server_port_script = $c->protocol_server_port . ($_SERVER['SCRIPT_NAME'] == '/index.php' ? '' : $_SERVER['SCRIPT_NAME']);
@ -389,20 +389,20 @@ function ISODateToHTTPDate( $isodate ) {
// It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info. // It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info.
$month = gmstrftime('%m', strtotime($isodate)); $month = gmstrftime('%m', strtotime($isodate));
switch( intval($month) ) { switch( intval($month) ) {
case 1: $month = 'Jan'; break; case 1: $month = 'Jan'; break;
case 2: $month = 'Feb'; break; case 2: $month = 'Feb'; break;
case 3: $month = 'Mar'; break; case 3: $month = 'Mar'; break;
case 4: $month = 'Apr'; break; case 4: $month = 'Apr'; break;
case 5: $month = 'May'; break; case 5: $month = 'May'; break;
case 6: $month = 'Jun'; break; case 6: $month = 'Jun'; break;
case 7: $month = 'Jul'; break; case 7: $month = 'Jul'; break;
case 8: $month = 'Aug'; break; case 8: $month = 'Aug'; break;
case 9: $month = 'Sep'; break; case 9: $month = 'Sep'; break;
case 10: $month = 'Oct'; break; case 10: $month = 'Oct'; break;
case 11: $month = 'Nov'; break; case 11: $month = 'Nov'; break;
case 12: $month = 'Dec'; break; case 12: $month = 'Dec'; break;
default: default:
throw new Exception('Invalid month '.$month); throw new Exception('Invalid month '.$month);
} }
// Use strtotime since strptime is not available on Windows platform. // Use strtotime since strptime is not available on Windows platform.
return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) ); return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) );

View File

@ -92,9 +92,9 @@ function caldav_get_feed( $request, $collection ) {
$feed->setLink($url); $feed->setLink($url);
$feed->setFeedLink($c->protocol_server_port_script . $request->path, 'atom'); $feed->setFeedLink($c->protocol_server_port_script . $request->path, 'atom');
$feed->addAuthor(array( $feed->addAuthor(array(
'name' => $principal->GetProperty('displayname'), 'name' => $principal->GetProperty('displayname'),
'email' => $principal->GetProperty('email'), 'email' => $principal->GetProperty('email'),
'uri' => $c->protocol_server_port . $principal->url(), 'uri' => $c->protocol_server_port . $principal->url(),
)); ));
$feed_description = $collection->GetProperty('description'); $feed_description = $collection->GetProperty('description');
if ( isset($feed_description) && $feed_description != '' ) $feed->setDescription($feed_description); if ( isset($feed_description) && $feed_description != '' ) $feed->setDescription($feed_description);

View File

@ -427,7 +427,7 @@ EOSQL;
SELECT collection.*, path_privs(:session_principal::int8, collection.dav_name,:scan_depth::int), p.principal_id, SELECT collection.*, path_privs(:session_principal::int8, collection.dav_name,:scan_depth::int), p.principal_id,
p.type_id AS principal_type_id, p.displayname AS principal_displayname, p.default_privileges AS principal_default_privileges, p.type_id AS principal_type_id, p.displayname AS principal_displayname, p.default_privileges AS principal_default_privileges,
timezones.vtimezone, dav_binding.access_ticket_id, dav_binding.parent_container AS bind_parent_container, timezones.vtimezone, dav_binding.access_ticket_id, dav_binding.parent_container AS bind_parent_container,
dav_binding.dav_displayname, owner.dav_name AS bind_owner_url, dav_binding.dav_name AS bound_to, dav_binding.dav_displayname, owner.dav_name AS bind_owner_url, dav_binding.dav_name AS bound_to,
dav_binding.external_url AS external_url, dav_binding.type AS external_type, dav_binding.bind_id AS bind_id dav_binding.external_url AS external_url, dav_binding.type AS external_type, dav_binding.bind_id AS bind_id
FROM dav_binding FROM dav_binding
LEFT JOIN collection ON (collection.collection_id=bound_source_id) LEFT JOIN collection ON (collection.collection_id=bound_source_id)
@ -1694,7 +1694,7 @@ EOQRY;
if ( isset($c->disable_caldav_proxy) && $c->disable_caldav_proxy ) return false; if ( isset($c->disable_caldav_proxy) && $c->disable_caldav_proxy ) return false;
if ( !isset($proxy_type) ) $proxy_type = 'write'; if ( !isset($proxy_type) ) $proxy_type = 'write';
// ProxyFor is an already constructed URL // ProxyFor is an already constructed URL
$this->FetchPrincipal(); $this->FetchPrincipal();
$reply->CalendarserverElement($prop, 'calendar-proxy-'.$proxy_type.'-for', $reply->href( $this->principal->ProxyFor($proxy_type) ) ); $reply->CalendarserverElement($prop, 'calendar-proxy-'.$proxy_type.'-for', $reply->href( $this->principal->ProxyFor($proxy_type) ) );
break; break;

View File

@ -31,7 +31,7 @@ class Principal {
return array( return array(
'username', 'email', 'user_active', 'modified', 'password', 'fullname', 'username', 'email', 'user_active', 'modified', 'password', 'fullname',
'email_ok', 'date_format_type', 'locale', 'type_id', 'displayname', 'default_privileges' 'email_ok', 'date_format_type', 'locale', 'type_id', 'displayname', 'default_privileges'
); );
} }
/** /**

View File

@ -155,12 +155,12 @@ $c->protocol_server_port = sprintf( '%s://%s%s',
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'? 'https' : 'http'), (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'? 'https' : 'http'),
$_SERVER['SERVER_NAME'], $_SERVER['SERVER_NAME'],
( (
( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') ( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')
&& (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80) ) && (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80) )
|| (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
&& (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 443) ) && (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 443) )
? '' ? ''
: ':'.$_SERVER['SERVER_PORT'] : ':'.$_SERVER['SERVER_PORT']
) ); ) );
$c->protocol_server_port_script = $c->protocol_server_port . ($_SERVER['SCRIPT_NAME'] == '/index.php' ? '' : $_SERVER['SCRIPT_NAME']); $c->protocol_server_port_script = $c->protocol_server_port . ($_SERVER['SCRIPT_NAME'] == '/index.php' ? '' : $_SERVER['SCRIPT_NAME']);
@ -389,20 +389,20 @@ function ISODateToHTTPDate( $isodate ) {
// It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info. // It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info.
$month = gmstrftime('%m', strtotime($isodate)); $month = gmstrftime('%m', strtotime($isodate));
switch( intval($month) ) { switch( intval($month) ) {
case 1: $month = 'Jan'; break; case 1: $month = 'Jan'; break;
case 2: $month = 'Feb'; break; case 2: $month = 'Feb'; break;
case 3: $month = 'Mar'; break; case 3: $month = 'Mar'; break;
case 4: $month = 'Apr'; break; case 4: $month = 'Apr'; break;
case 5: $month = 'May'; break; case 5: $month = 'May'; break;
case 6: $month = 'Jun'; break; case 6: $month = 'Jun'; break;
case 7: $month = 'Jul'; break; case 7: $month = 'Jul'; break;
case 8: $month = 'Aug'; break; case 8: $month = 'Aug'; break;
case 9: $month = 'Sep'; break; case 9: $month = 'Sep'; break;
case 10: $month = 'Oct'; break; case 10: $month = 'Oct'; break;
case 11: $month = 'Nov'; break; case 11: $month = 'Nov'; break;
case 12: $month = 'Dec'; break; case 12: $month = 'Dec'; break;
default: default:
throw new Exception('Invalid month '.$month); throw new Exception('Invalid month '.$month);
} }
// Use strtotime since strptime is not available on Windows platform. // Use strtotime since strptime is not available on Windows platform.
return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) ); return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) );

View File

@ -261,10 +261,10 @@ else {
$request->PreconditionFailed( 404, 'must-exist', translate('That resource is not present on this server.') ); $request->PreconditionFailed( 404, 'must-exist', translate('That resource is not present on this server.') );
} }
$resource->NeedPrivilege('DAV::read'); $resource->NeedPrivilege('DAV::read');
if ( $resource->IsExternal() ) { if ( $resource->IsExternal() ) {
require_once("external-fetch.php"); require_once("external-fetch.php");
update_external ( $resource ); update_external ( $resource );
} }
if ( $resource->IsCollection() ) { if ( $resource->IsCollection() ) {
dbg_error_log('PROPFIND','Getting collection contents: Depth %d, Path: %s', $request->depth, $resource->dav_name() ); dbg_error_log('PROPFIND','Getting collection contents: Depth %d, Path: %s', $request->depth, $resource->dav_name() );
$responses[] = $resource->RenderAsXML($property_list, $reply); $responses[] = $resource->RenderAsXML($property_list, $reply);

View File

@ -61,17 +61,17 @@ switch( $xmltree->GetNSTag() ) {
include("caldav-REPORT-pps-set.php"); include("caldav-REPORT-pps-set.php");
exit; // Not that it should return anyway. exit; // Not that it should return anyway.
case 'DAV::sync-collection': case 'DAV::sync-collection':
if ( $target->IsExternal() ) { if ( $target->IsExternal() ) {
require_once("external-fetch.php"); require_once("external-fetch.php");
update_external ( $target ); update_external ( $target );
} }
include("caldav-REPORT-sync-collection.php"); include("caldav-REPORT-sync-collection.php");
exit; // Not that it should return anyway. exit; // Not that it should return anyway.
case 'DAV::expand-property': case 'DAV::expand-property':
if ( $target->IsExternal() ) { if ( $target->IsExternal() ) {
require_once("external-fetch.php"); require_once("external-fetch.php");
update_external ( $target ); update_external ( $target );
} }
include("caldav-REPORT-expand-property.php"); include("caldav-REPORT-expand-property.php");
exit; // Not that it should return anyway. exit; // Not that it should return anyway.
case 'DAV::principal-match': case 'DAV::principal-match':
@ -218,8 +218,8 @@ function component_to_xml( $properties, $item ) {
} }
if ( $target->IsExternal() ) { if ( $target->IsExternal() ) {
require_once("external-fetch.php"); require_once("external-fetch.php");
update_external ( $target ); update_external ( $target );
} }
// These reports are always allowed to see the resource_data because they are special // These reports are always allowed to see the resource_data because they are special

View File

@ -6,7 +6,7 @@
* @category Technical * @category Technical
* @subpackage ldap * @subpackage ldap
* @author Oliver Schulze <oliver@samera.com.py>, * @author Oliver Schulze <oliver@samera.com.py>,
* Andrew McMillan <andrew@mcmillan.net.nz> * Andrew McMillan <andrew@mcmillan.net.nz>
* @copyright Based on Eric Seigne script drivers_squid_pam.php * @copyright Based on Eric Seigne script drivers_squid_pam.php
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
*/ */

View File

@ -6,7 +6,7 @@
* @category Technical * @category Technical
* @subpackage ldap * @subpackage ldap
* @author Maxime Delorme <mdelorme@tennaxia.net>, * @author Maxime Delorme <mdelorme@tennaxia.net>,
* Andrew McMillan <andrew@mcmillan.net.nz> * Andrew McMillan <andrew@mcmillan.net.nz>
* @copyright Maxime Delorme * @copyright Maxime Delorme
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
*/ */
@ -170,7 +170,7 @@ class ldapDrivers
$row[$arr[$j]] = count($arr[$arr[$j]])>2?$arr[$arr[$j]]:$arr[$arr[$j]][0]; $row[$arr[$j]] = count($arr[$arr[$j]])>2?$arr[$arr[$j]]:$arr[$arr[$j]][0];
} }
$ret[]=$row; $ret[]=$row;
unset($row); unset($row);
} }
} }
return $ret; return $ret;

View File

@ -6,8 +6,8 @@
* @category Technical * @category Technical
* @subpackage pwauth * @subpackage pwauth
* @author Eric Seigne <eric.seigne@ryxeo.com>, * @author Eric Seigne <eric.seigne@ryxeo.com>,
* Michael B. Trausch <mike@trausch.us>, * Michael B. Trausch <mike@trausch.us>,
* Andrew McMillan <andrew@mcmillan.net.nz> * Andrew McMillan <andrew@mcmillan.net.nz>
* @copyright Eric Seigne * @copyright Eric Seigne
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
* *
@ -95,8 +95,7 @@ function PWAUTH_PAM_check($username, $password) {
case 3: case 3:
// STATUS_BLOCKED: UID for username is < pwauth's MIN_UNIX_UID // STATUS_BLOCKED: UID for username is < pwauth's MIN_UNIX_UID
dbg_error_log('pwauth', 'UID for username %s is < pwauth MIN_UNIX_UID', dbg_error_log('pwauth', 'UID for username %s is < pwauth MIN_UNIX_UID', $username);
$username);
break; break;
case 4: case 4:
@ -106,8 +105,7 @@ function PWAUTH_PAM_check($username, $password) {
case 5: case 5:
// STATUS_PW_EXPIRED: The user account's password has expired. // STATUS_PW_EXPIRED: The user account's password has expired.
dbg_error_log('pwauth', 'The account password for user %s has expired', dbg_error_log('pwauth', 'The account password for user %s has expired', $username);
$username);
break; break;
case 6: case 6:
@ -117,14 +115,12 @@ function PWAUTH_PAM_check($username, $password) {
case 7: case 7:
// STATUS_MANYFAILS: Too many login failures for user account. // STATUS_MANYFAILS: Too many login failures for user account.
dbg_error_log('pwauth', 'Login rejected for %s, too many failures', dbg_error_log('pwauth', 'Login rejected for %s, too many failures', $username);
$username);
break; break;
case 50: case 50:
// STATUS_INT_USER: Configuration error, Web server cannot use pwauth // STATUS_INT_USER: Configuration error, Web server cannot use pwauth
dbg_error_log('pwauth', 'config error: see pwauth man page (%s)', dbg_error_log('pwauth', 'config error: see pwauth man page (%s)', 'STATUS_INT_USER');
'STATUS_INT_USER');
break; break;
case 51: case 51:
@ -134,20 +130,17 @@ function PWAUTH_PAM_check($username, $password) {
case 52: case 52:
// STATUS_INT_ERR: unknown error // STATUS_INT_ERR: unknown error
dbg_error_log('pwauth', 'error: see pwauth man page (%s)', dbg_error_log('pwauth', 'error: see pwauth man page (%s)', 'STATUS_INT_ERR');
'STATUS_INT_ERR');
break; break;
case 53: case 53:
// STATUS_INT_NOROOT: pwauth could not read the password database // STATUS_INT_NOROOT: pwauth could not read the password database
dbg_error_log('pwauth', 'config error: cannot read password database (%s)', dbg_error_log('pwauth', 'config error: cannot read password database (%s)', 'STATUS_INT_NOROOT');
'STATUS_INT_NOROOT');
break; break;
default: default:
// Unknown error code. // Unknown error code.
dbg_error_log('pwauth', 'An unknown error (%d) has occurred', dbg_error_log('pwauth', 'An unknown error (%d) has occurred', $return_status);
$return_status);
} }
return(FALSE); return(FALSE);

View File

@ -6,7 +6,7 @@
* @category Technical * @category Technical
* @subpackage ldap * @subpackage ldap
* @author Oliver Schulze <oliver@samera.com.py>, * @author Oliver Schulze <oliver@samera.com.py>,
* Andrew McMillan <andrew@mcmillan.net.nz> * Andrew McMillan <andrew@mcmillan.net.nz>
* @copyright Based on Eric Seigne script drivers_squid_pam.php * @copyright Based on Eric Seigne script drivers_squid_pam.php
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
*/ */

View File

@ -102,7 +102,7 @@ function fetch_external ( $bind_id, $min_age = '1 hour' )
function update_external ( $request ) function update_external ( $request )
{ {
global $c; global $c;
if ( $c->external_refresh < 1 ) if ( $c->external_refresh < 1 )
return ; return ;
if ( ! function_exists ( "curl_init" ) ) { if ( ! function_exists ( "curl_init" ) ) {
@ -111,11 +111,11 @@ function update_external ( $request )
} }
$sql = 'SELECT bind_id, external_url as url from dav_binding LEFT JOIN collection ON (collection.collection_id=bound_source_id) WHERE dav_binding.dav_name = :dav_name AND collection.modified + interval :interval < NOW()'; $sql = 'SELECT bind_id, external_url as url from dav_binding LEFT JOIN collection ON (collection.collection_id=bound_source_id) WHERE dav_binding.dav_name = :dav_name AND collection.modified + interval :interval < NOW()';
$qry = new AwlQuery( $sql, array ( ':dav_name' => $request->dav_name(), ':interval' => $c->external_refresh . ' minutes' ) ); $qry = new AwlQuery( $sql, array ( ':dav_name' => $request->dav_name(), ':interval' => $c->external_refresh . ' minutes' ) );
dbg_error_log("external", "checking if external resource needs update"); dbg_error_log("external", "checking if external resource needs update");
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' );
} }
} }
} }