From eb7f2edc0cd10dd4c98d3f65ff4c4682ebd9953c Mon Sep 17 00:00:00 2001 From: Florian Schlichting Date: Wed, 28 Dec 2016 10:31:59 +0100 Subject: [PATCH] eliminate trailing whitespace, expand tabs --- htdocs/always.php | 42 ++++----- htdocs/caldav.php | 4 +- htdocs/feed.php | 10 +- htdocs/iSchedule.php | 2 +- htdocs/metrics.php | 2 +- htdocs/setup.php | 24 ++--- htdocs/tools.php | 2 +- inc/AtomFeed.php | 42 ++++----- inc/CalDAVRequest.php | 22 ++--- inc/DAVResource.php | 30 +++--- inc/DAViCalSession.php | 4 +- inc/HTTPAuthSession.php | 16 ++-- inc/Principal.php | 116 +++++++++++------------ inc/PublicSession.php | 4 +- inc/WritableCollection.php | 82 ++++++++--------- inc/always.php.in | 42 ++++----- inc/auth-functions.php | 4 +- inc/caldav-ACL.php | 6 +- inc/caldav-BIND.php | 22 ++--- inc/caldav-DELETE.php | 6 +- inc/caldav-GET-functions.php | 4 +- inc/caldav-GET.php | 2 +- inc/caldav-MKCOL.php | 2 +- inc/caldav-MOVE.php | 2 +- inc/caldav-POST.php | 4 +- inc/caldav-PROPFIND.php | 10 +- inc/caldav-PROPPATCH.php | 16 ++-- inc/caldav-PUT-functions.php | 32 +++---- inc/caldav-PUT-vcalendar.php | 2 +- inc/caldav-PUT-vcard.php | 2 +- inc/caldav-REPORT-calquery.php | 6 +- inc/caldav-REPORT-sync-collection.php | 4 +- inc/caldav-REPORT.php | 20 ++-- inc/caldav-client-v2.php | 10 +- inc/drivers_imap_pam.php | 4 +- inc/drivers_ldap.php | 10 +- inc/drivers_pwauth_pam.php | 27 ++---- inc/drivers_rimap.php | 4 +- inc/external-fetch.php | 16 ++-- inc/iSchedule-POST.php | 14 +-- inc/iSchedule.php | 128 +++++++++++++------------- inc/other_translated_strings.php | 2 +- inc/schedule-functions.php | 20 ++-- inc/tz/capabilities.php | 24 ++--- inc/tz/expand.php | 12 +-- inc/ui/collection-edit.php | 16 ++-- inc/ui/external-browse.php | 4 +- inc/ui/principal-edit.php | 70 +++++++------- inc/vtimezone.php | 6 +- inc/well-known.php | 2 +- 50 files changed, 475 insertions(+), 482 deletions(-) diff --git a/htdocs/always.php b/htdocs/always.php index 1bb34414..42227c8e 100644 --- a/htdocs/always.php +++ b/htdocs/always.php @@ -38,7 +38,7 @@ function early_exception_handler($e) { foreach( $trace AS $k => $v ) { printf( "%s[%d] %s%s%s()\n", $v['file'], $v['line'], (isset($v['class'])?$v['class']:''), (isset($v['type'])?$v['type']:''), (isset($v['function'])?$v['function']:'') ); } - + } set_exception_handler('early_exception_handler'); @@ -155,12 +155,12 @@ $c->protocol_server_port = sprintf( '%s://%s%s', (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'? 'https' : 'http'), $_SERVER['SERVER_NAME'], ( - ( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') - && (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80) ) - || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' - && (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 443) ) - ? '' - : ':'.$_SERVER['SERVER_PORT'] + ( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') + && (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80) ) + || ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' + && (!isset($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 443) ) + ? '' + : ':'.$_SERVER['SERVER_PORT'] ) ); $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. $month = gmstrftime('%m', strtotime($isodate)); switch( intval($month) ) { - case 1: $month = 'Jan'; break; - case 2: $month = 'Feb'; break; - case 3: $month = 'Mar'; break; - case 4: $month = 'Apr'; break; - case 5: $month = 'May'; break; - case 6: $month = 'Jun'; break; - case 7: $month = 'Jul'; break; - case 8: $month = 'Aug'; break; - case 9: $month = 'Sep'; break; - case 10: $month = 'Oct'; break; - case 11: $month = 'Nov'; break; - case 12: $month = 'Dec'; break; - default: - throw new Exception('Invalid month '.$month); + case 1: $month = 'Jan'; break; + case 2: $month = 'Feb'; break; + case 3: $month = 'Mar'; break; + case 4: $month = 'Apr'; break; + case 5: $month = 'May'; break; + case 6: $month = 'Jun'; break; + case 7: $month = 'Jul'; break; + case 8: $month = 'Aug'; break; + case 9: $month = 'Sep'; break; + case 10: $month = 'Oct'; break; + case 11: $month = 'Nov'; break; + case 12: $month = 'Dec'; break; + default: + throw new Exception('Invalid month '.$month); } // Use strtotime since strptime is not available on Windows platform. return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) ); diff --git a/htdocs/caldav.php b/htdocs/caldav.php index da9fbc79..8b83e9d7 100644 --- a/htdocs/caldav.php +++ b/htdocs/caldav.php @@ -22,13 +22,13 @@ elseif ( isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == '/autodiscover function logRequestHeaders() { global $c; - + /** Log the request headers */ $lines = apache_request_headers(); dbg_error_log( "LOG ", "***************** Request Header ****************" ); dbg_error_log( "LOG ", "%s %s", $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'] ); foreach( $lines AS $k => $v ) { - if ( $k != 'Authorization' || (isset($c->dbg['password']) && $c->dbg['password'] ) ) + if ( $k != 'Authorization' || (isset($c->dbg['password']) && $c->dbg['password'] ) ) dbg_error_log( "LOG headers", "-->%s: %s", $k, $v ); else dbg_error_log( "LOG headers", "-->%s: %s", $k, 'Delicious tasty password eaten by debugging monster!' ); diff --git a/htdocs/feed.php b/htdocs/feed.php index 151da22c..9c7adc30 100644 --- a/htdocs/feed.php +++ b/htdocs/feed.php @@ -53,7 +53,7 @@ function caldav_get_feed( $request, $collection ) { if ( $response !== false ) return $response; $principal = $collection->GetProperty('principal'); - + /** * The CalDAV specification does not define GET on a collection, but typically this is * used as a .ics download for the whole collection, which is what we do also. @@ -92,9 +92,9 @@ function caldav_get_feed( $request, $collection ) { $feed->setLink($url); $feed->setFeedLink($c->protocol_server_port_script . $request->path, 'atom'); $feed->addAuthor(array( - 'name' => $principal->GetProperty('displayname'), - 'email' => $principal->GetProperty('email'), - 'uri' => $c->protocol_server_port . $principal->url(), + 'name' => $principal->GetProperty('displayname'), + 'email' => $principal->GetProperty('email'), + 'uri' => $c->protocol_server_port . $principal->url(), )); $feed_description = $collection->GetProperty('description'); if ( isset($feed_description) && $feed_description != '' ) $feed->setDescription($feed_description); @@ -112,7 +112,7 @@ function caldav_get_feed( $request, $collection ) { $ical = new vComponent( $event->caldav_data ); $event_data = $ical->GetComponents('VTIMEZONE', false); - + $item = $feed->createEntry(); $item->setId( $c->protocol_server_port_script . ConstructURL($event->dav_name) ); diff --git a/htdocs/iSchedule.php b/htdocs/iSchedule.php index d96f52e2..209ea8b2 100644 --- a/htdocs/iSchedule.php +++ b/htdocs/iSchedule.php @@ -106,7 +106,7 @@ function SRVOk ( $value, $name, $row ) { global $BrowserCurrentRow; if ( empty($BrowserCurrentRow->domain) ) return ''; // skip empty rows $s = new iSchedule(); - $s->domain = $BrowserCurrentRow->domain; + $s->domain = $BrowserCurrentRow->domain; return translate( ( $s->getServer()?'OK': SRVFormat ( $s->domain ) ) ); } diff --git a/htdocs/metrics.php b/htdocs/metrics.php index 170ee66d..2474a6b3 100644 --- a/htdocs/metrics.php +++ b/htdocs/metrics.php @@ -100,7 +100,7 @@ if ( $c->metrics_style != 'counters' ) { if ( $c->metrics_style != 'memcache' ) { // These are more basic metrics. Just counts of requests, by type. $sql = <<ok = (boolean) $success; $this->description = (isset($description)?$description : ($success===true? i18n('Passed') : i18n('Fail'))); - $this->use_class = (isset($use_class)?$use_class:($success===true?'dep_ok' : 'dep_fail')); + $this->use_class = (isset($use_class)?$use_class:($success===true?'dep_ok' : 'dep_fail')); } - + public function getClass() { return $this->use_class; } @@ -169,7 +169,7 @@ $loaded_extensions = array_flip(get_loaded_extensions()); function do_error( $errormessage ) { - // We can't translate this because we're testing these things even before + // We can't translate this because we're testing these things even before // the translation interface is available... printf("


%s

", $errormessage ); } @@ -185,7 +185,7 @@ function get_phpinfo() { phpinfo(); $phpinfo = ob_get_contents( ); ob_end_clean( ); - + $phpinfo = preg_replace( '{^.*?}s', '', $phpinfo); $phpinfo = preg_replace( '{.*?$}s', '', $phpinfo); return $phpinfo; @@ -275,16 +275,16 @@ function check_davical_version() { function check_awl_version() { global $c; - + if ( !function_exists('awl_version') ) return new CheckResult(false); - + $result = new CheckResult($c->want_awl_version == awl_version()); if ( ! $result->getOK() ) { $result->setDescription( sprintf(i18n('Want: %s, Currently: %s'), $c->want_awl_version, awl_version()) ); if ( $c->want_awl_version < awl_version() ) $result->setClass('dep_warning'); } return $result; - + } @@ -318,7 +318,7 @@ EOTABLE; function build_dependencies_table( ) { global $c; - + $dependencies = array( translate('Current DAViCal version ') => 'check_davical_version', translate('AWL Library version ') => 'check_awl_version', @@ -343,7 +343,7 @@ function build_dependencies_table( ) { } $translated_failure_code = translate('Explanation on DAViCal Wiki'); - + $dependencies_table = ''; $dep_tpl = ' %s @@ -359,7 +359,7 @@ function build_dependencies_table( ) { rawurlencode($k) ); } - + return $dependencies_table; } diff --git a/htdocs/tools.php b/htdocs/tools.php index 58c1fe0c..8f41810c 100644 --- a/htdocs/tools.php +++ b/htdocs/tools.php @@ -78,7 +78,7 @@ class Tools { $html = '
'; $html .= '

'.translate('Import all .ics files of a directory') .'

'; $html .= '

'.translate('This process will import each file in a directory named "username.ics" and create a user and calendar for each file to import.') .'

'; - + $data = (object) array('directory_path' => '/path/to/your/ics/files','calendar_path' => 'calendar'); $ef = new EntryForm( $_SERVER['REQUEST_URI'],$data , true,true ); $html .= "\n"; diff --git a/inc/AtomFeed.php b/inc/AtomFeed.php index 6e1dbf47..e71a65a6 100644 --- a/inc/AtomFeed.php +++ b/inc/AtomFeed.php @@ -12,18 +12,18 @@ define('XHTML_XMLNS','http://www.w3.org/1999/xhtml'); * in a DAViCal way, and we have some huge limitations: * - We *only* support Atom feeds. * - We *only* support creating them. - * + * * @author Andrew McMillan * */ class AtomXHTMLContent /* extends XMLElement */ { private $content_string; - + function __construct($xhtml) { $this->content_string = $xhtml; } - + function Render( $ignore1, $ignore2, $ignore3 ) { return $this->content_string . "\n"; } @@ -58,28 +58,28 @@ class AtomEntry { $this->id = new XMLElement('id', rtrim($new_value,"\r\n")); return $this->id; } - + public function setTitle( $new_value, $type = 'text' ) { $this->title = new XMLElement('title', $new_value, array( 'type' => $type )); return $this->title; } - + public static function setDate( $tagname, $epoch ) { // e.g. 2010-12-26T17:49:16+13:00 return new XMLElement($tagname, date('Y-m-d\TH:i:sP',$epoch)); } - + public function setDateModified( $epoch ) { $this->updated = self::setDate('updated', $epoch); return $this->updated; } - + public function setDateCreated( $epoch ) { $node = self::setDate('published', $epoch); $this->nodes[] = $node; return $node; } - + public function setLink( $new_value, $type="text/calendar", $rel='alternate' ) { return $this->addNode('link', $new_value, array( 'rel' => $rel, 'type' => $type ) ); } @@ -95,7 +95,7 @@ class AtomEntry { throw new Exception("AtomFeed::addAuthor(\$new_value) the \$new_value MUST be an array with at least a 'name' element. RFC4287-3.2"); } - + public function addCategory( $new_value ) { if ( is_array($new_value) && isset($new_value['term']) ) { $category = $this->addNode('category', null, $new_value ); @@ -104,22 +104,22 @@ class AtomEntry { throw new Exception("AtomFeed::addCategory(\$new_value) the \$new_value MUST be an array with at least a 'term' element, and potentially a 'scheme' and a 'label' element. RFC4287-4.2.2"); } - + public function setDescription( $new_value, $type = 'text' ) { return $this->addNode('summary', $new_value, array( 'type' => $type ) ); } - + public function setContent( $new_value, $type = 'xhtml' ) { $content = $this->addNode('content', null, array( 'type' => $type ) ); if ( $type == 'xhtml' ) { $content->NewElement('div', array( new AtomXHTMLContent($new_value) ), array('xmlns' => XHTML_XMLNS)); } else { - $content->SetContent($new_value); + $content->SetContent($new_value); } return $content; } - + public function addNode( $in_tag, $content=false, $attributes=false, $xmlns=null ) { $node = new XMLElement($in_tag,$content,$attributes,$xmlns); if ( !isset($node) ) return null; @@ -170,17 +170,17 @@ class AtomFeed extends XMLDocument { $this->id = $this->NewXMLElement('id', $new_value); return $this->id; } - + public function setTitle( $new_value, $type = 'text' ) { $this->title = $this->NewXMLElement('title', $new_value, array( 'type' => $type )); return $this->title; } - + public function setDateModified( $epoch ) { $this->updated = AtomEntry::setDate('updated', $epoch); return $this->updated; } - + public function setLink( $new_value, $type="text/calendar", $rel='alternate' ) { return $this->addNode('link', $new_value, array( 'rel' => $rel, 'type' => $type ) ); } @@ -189,15 +189,15 @@ class AtomFeed extends XMLDocument { /** * Sets the feed link (rel=self), ignoring the parameter which is for * compatibility with the Zend library API, although we use this for - * the Id, whereas they use the first link that is set. + * the Id, whereas they use the first link that is set. * @param uri $new_value The link target - * @return XMLElement the node that was added. + * @return XMLElement the node that was added. */ public function setFeedLink( $new_value, $type = null ) { $this->setId($new_value); return $this->setLink($new_value , 'application/atom+xml', 'self' ); } - + public function addAuthor( $new_value ) { if ( is_array($new_value) && isset($new_value['name']) ) { $author = $this->addNode('author' ); @@ -209,11 +209,11 @@ class AtomFeed extends XMLDocument { throw new Exception("AtomFeed::addAuthor(\$new_value) the \$new_value MUST be an array with at leas a 'name' element. RFC4287-3.2"); } - + public function setDescription( $new_value, $type = 'text' ) { return $this->addNode('subtitle', $new_value, array( 'type' => $type ) ); } - + public function addNode( $in_tag, $content=false, $attributes=false, $xmlns=null ) { $node = $this->NewXMLElement($in_tag,$content,$attributes,$xmlns); if ( !isset($node) ) return null; diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 1fa7d9be..f61f7733 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -111,7 +111,7 @@ class CalDAVRequest * can test that value with the PreferMinimal() method. */ private $prefer; - + /** * Create a new CalDAVRequest object. */ @@ -127,8 +127,8 @@ class CalDAVRequest else if ( isset($_SERVER['HTTP_BRIEF']) && (strtoupper($_SERVER['HTTP_BRIEF']) == 'T') ) { $this->prefer = array( 'return-minimal'); } - else - $this->prefer = array(); + else + $this->prefer = array(); /** * Our path is /