From 8e60bb3124e2cc4ff09f388e520f3b6935ffc733 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Wed, 20 Mar 2013 00:48:02 +0100 Subject: [PATCH] set line endings of most text files to LF * Changed the end-of-line encodings of all non-Windows-related and non-autogenerated text files to use UNIX LF (lots of them had mixed LF/CRLF). Conflicts: inc/caldav-PUT-functions.php --- ChangeLog | 5 + config/imap_pam_conf_php.txt | 22 +- docs/api/phpdoc.ini | 178 ++++++------ docs/website/style.css | 502 +++++++++++++++++----------------- docs/website/wikiheader.css | 134 ++++----- htdocs/caldav.php | 4 +- htdocs/setup.php | 10 +- inc/CalDAVRequest.php | 12 +- inc/DAViCalSession.php | 22 +- inc/WritableCollection.php | 42 +-- inc/caldav-BIND.php | 6 +- inc/caldav-DELETE.php | 6 +- inc/caldav-GET-functions.php | 4 +- inc/caldav-MKCOL.php | 2 +- inc/caldav-POST.php | 16 +- inc/caldav-PROPPATCH.php | 40 +-- inc/caldav-PUT-functions.php | 56 ++-- inc/caldav-PUT-vcalendar.php | 14 +- inc/caldav-PUT-vcard.php | 36 +-- inc/caldav-REPORT-calquery.php | 2 +- inc/caldav-REPORT-cardquery.php | 2 +- inc/caldav-REPORT-multiget.php | 2 +- inc/caldav-REPORT-sync-collection.php | 2 +- inc/caldav-REPORT.php | 6 +- inc/drivers_imap_pam.php | 214 +++++++-------- inc/drivers_ldap.php | 26 +- inc/drivers_rimap.php | 224 +++++++-------- inc/schedule-functions.php | 6 +- inc/ui/collection-edit.php | 6 +- inc/ui/principal-edit.php | 6 +- 30 files changed, 813 insertions(+), 794 deletions(-) diff --git a/ChangeLog b/ChangeLog index f38afc7f..ed20829b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-03-20 Christoph Anton Mitterer + * Changed the end-of-line encodings of all non-Windows-related and + non-autogenerated text files to use UNIX LF (lots of them had mixed + LF/CRLF). + 2013-03-06 Andrew McMillan * Fix capitalisation of 'plpgsql' & 'sql' for Postgres 9.2. (debbug #702403) diff --git a/config/imap_pam_conf_php.txt b/config/imap_pam_conf_php.txt index a4e026f4..b7574782 100644 --- a/config/imap_pam_conf_php.txt +++ b/config/imap_pam_conf_php.txt @@ -1,11 +1,11 @@ -/** - * Authentication against IMAP using the imap_open function. - */ -$c->authenticate_hook['call'] = 'IMAP_PAM_check'; -$c->authenticate_hook['config'] = array( - 'imap_url' => '{localhost:993/imap/ssl/novalidate-cert}', - 'email_base' => 'example.com' -); - -include('drivers_imap_pam.php'); - +/** + * Authentication against IMAP using the imap_open function. + */ +$c->authenticate_hook['call'] = 'IMAP_PAM_check'; +$c->authenticate_hook['config'] = array( + 'imap_url' => '{localhost:993/imap/ssl/novalidate-cert}', + 'email_base' => 'example.com' +); + +include('drivers_imap_pam.php'); + diff --git a/docs/api/phpdoc.ini b/docs/api/phpdoc.ini index e5a12811..c1c7c2f1 100644 --- a/docs/api/phpdoc.ini +++ b/docs/api/phpdoc.ini @@ -1,89 +1,89 @@ -;; phpDocumentor configuration file for DAViCal API documentation -;; - -[Parse Data] -;; title of all the documentation -;; legal values: any string -title = DAViCal - -;; parse files that start with a . like .bash_profile -;; legal values: true, false -hidden = false - -;; show elements marked @access private in documentation by setting this to on -;; legal values: on, off -parseprivate = off - -;; parse with javadoc-like description (first sentence is always the short description) -;; legal values: on, off -javadocdesc = off - -;; add any custom @tags separated by commas here -;; legal values: any legal tagname separated by commas. -;customtags = mytag1,mytag2 - -;; This is only used by the XML:DocBook/peardoc2 converter -defaultcategoryname = Documentation - -;; what is the main package? -;; legal values: alphanumeric string plus - and _ -defaultpackagename = davical - -;; output any parsing information? set to on for cron jobs -;; legal values: on -quiet = on - -;; parse a PEAR-style repository. Do not turn this on if your project does -;; not have a parent directory named "pear" -;; legal values: on/off -;pear = on - -;; where should the documentation be written? -;; legal values: a legal path -target = docs/api - -;; Which files should be parsed out as special documentation files, such as README, -;; INSTALL and CHANGELOG? This overrides the default files found in -;; phpDocumentor.ini (this file is not a user .ini file, but the global file) -readmeinstallchangelog = README, INSTALL, CHANGELOG, NEWS, FAQ, LICENSE - -;; limit output to the specified packages, even if others are parsed -;; legal values: package names separated by commas -;packageoutput = package1,package2 -packageoutput = davical,awl - -;; comma-separated list of files to parse -;; legal values: paths separated by commas -;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory - -;; comma-separated list of directories to parse -;; legal values: directory paths separated by commas -;directory = /path1,/path2,.,..,subdirectory -;directory = /home/jeichorn/cvs/pear -directory = inc,htdocs - -;; template base directory (the equivalent directory of /phpDocumentor) -;templatebase = /path/to/my/templates - -;; directory to find any example files in through @example and {@example} tags -;examplesdir = /path/to/my/templates -examplesdir = examples - -;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore -;; legal values: any wildcard strings separated by commas -;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/ -ignore = htdocs/css/,htdocs/images/,htdocs/js/, - -;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format -;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib, -;; HTML:frames:earthli, -;; HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de, -;; HTML:frames:DOM/phphtmllib,HTML:frames:DOM/earthli -;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS -;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default -output=HTML:frames:earthli - -;; turn this option on if you want highlighted source code for every file -;; legal values: on/off -sourcecode = off - +;; phpDocumentor configuration file for DAViCal API documentation +;; + +[Parse Data] +;; title of all the documentation +;; legal values: any string +title = DAViCal + +;; parse files that start with a . like .bash_profile +;; legal values: true, false +hidden = false + +;; show elements marked @access private in documentation by setting this to on +;; legal values: on, off +parseprivate = off + +;; parse with javadoc-like description (first sentence is always the short description) +;; legal values: on, off +javadocdesc = off + +;; add any custom @tags separated by commas here +;; legal values: any legal tagname separated by commas. +;customtags = mytag1,mytag2 + +;; This is only used by the XML:DocBook/peardoc2 converter +defaultcategoryname = Documentation + +;; what is the main package? +;; legal values: alphanumeric string plus - and _ +defaultpackagename = davical + +;; output any parsing information? set to on for cron jobs +;; legal values: on +quiet = on + +;; parse a PEAR-style repository. Do not turn this on if your project does +;; not have a parent directory named "pear" +;; legal values: on/off +;pear = on + +;; where should the documentation be written? +;; legal values: a legal path +target = docs/api + +;; Which files should be parsed out as special documentation files, such as README, +;; INSTALL and CHANGELOG? This overrides the default files found in +;; phpDocumentor.ini (this file is not a user .ini file, but the global file) +readmeinstallchangelog = README, INSTALL, CHANGELOG, NEWS, FAQ, LICENSE + +;; limit output to the specified packages, even if others are parsed +;; legal values: package names separated by commas +;packageoutput = package1,package2 +packageoutput = davical,awl + +;; comma-separated list of files to parse +;; legal values: paths separated by commas +;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory + +;; comma-separated list of directories to parse +;; legal values: directory paths separated by commas +;directory = /path1,/path2,.,..,subdirectory +;directory = /home/jeichorn/cvs/pear +directory = inc,htdocs + +;; template base directory (the equivalent directory of /phpDocumentor) +;templatebase = /path/to/my/templates + +;; directory to find any example files in through @example and {@example} tags +;examplesdir = /path/to/my/templates +examplesdir = examples + +;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore +;; legal values: any wildcard strings separated by commas +;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/ +ignore = htdocs/css/,htdocs/images/,htdocs/js/, + +;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format +;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib, +;; HTML:frames:earthli, +;; HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de, +;; HTML:frames:DOM/phphtmllib,HTML:frames:DOM/earthli +;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS +;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default +output=HTML:frames:earthli + +;; turn this option on if you want highlighted source code for every file +;; legal values: on/off +sourcecode = off + diff --git a/docs/website/style.css b/docs/website/style.css index 5e059868..d42f19b2 100644 --- a/docs/website/style.css +++ b/docs/website/style.css @@ -1,251 +1,251 @@ -* { - margin: 0px; - padding: 0px; - } - -body { - margin: 0px; - padding: 0px; - background-color: #FFFFFF; - color: #333333; - } - -hr { - height: 0.4em; - width: 100%; - background-color: #000000; - border: none; - color:#000000; - margin-bottom: 0.5em; - } - -#pageContainer { - width: 740px; - margin-left: auto; - margin-right: auto; - } - -#header { - width: 740px; - height: 80px; - background: url(images/logo.gif) #bb1f1f no-repeat center left; - margin-top: 10px; - border-bottom: #d2d2d2 solid 5px; - text-align: right; - margin-bottom: 20px; - } - -#headerLinks { - color: #FFFFFF; - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 80%; - padding-top: 64px; - padding-right: 5px; - display:block; - text-decoration: none; - } - -.hlink { - color: #FFFFFF; - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 80%; - text-decoration: none; -} -.hlink:link, .hlink:active, .hlink:visited { - color: #FFFFFF; -} - -.hlink:hover { - color: #FFFFFF; - text-decoration: underline; -} - -#pageContent { - /* Not used for anything at present */ - } - -h1 { - color: #600000; - font-family: helvetica, arial, sans-serif; - font-size: 135%; - margin-top: 1em; - margin-bottom: 0.3em; - } - -h2, h3 { - color: black; - font-family: helvetica, arial, sans-serif; - font-size: 115%; - margin-top: 1em; - margin-bottom: 0.3em; - } - -h3 { - font-size: 100%; -} - -.showcase { - margin: 2px; - padding: 2px; - border: 2px #000000 solid; - } - -p { - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 90%; - margin-bottom: 20px; - } - -ol, ul { - margin-bottom: 20px; -} - -ul { - list-style-type: square; - font-family: helvetica, arial, sans-serif; -} - -li { - list-style-position: outside; - font-family: helvetica, arial, sans-serif; - font-size: 90%; - margin: 0.1em 2em; - } - -code { - font-family: courier, courier new, fixed; - font-size: inherit; -} - -pre { - font-family: courier, courier new, fixed; - font-size: 90%; - padding: 1em; - margin-bottom: 1em; - background-color: #eee; -} - -#footer { - clear: both; - width: 740px; - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 80%; - border-top: 2px #000000 solid; - } - -#title { - float: left; - color: #FFFFFF; - padding-left: 100px; - margin-top: 1px; - font-family: helvetica, arial, sans-serif; - font-size: 190%; - } - -#subTitle { - float: left; - clear: left; - color: #FFFFFF; - padding-left: 102px; - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 75%; -} - -.right { - float: right; - margin: 0px; - } - -.left { - float: left; - margin: 0px; - } - -.flink:link { - color: #333333; - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 80%; - text-decoration: none; - vertical-align: text-top; - } - -.flink:active { - color: #333333; - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 80%; - text-decoration: none; - vertical-align: text-top; - } - -.flink:hover { - color: #333333; - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 80%; - text-decoration: underline; - vertical-align: text-top; - } - -.flink:visited { - color: #333333; - font-family: helvetica, arial, sans-serif; - font-size: 8pt; - font-size: 80%; - text-decoration: none; - vertical-align: text-top; - } - -.gone { - width: 0.01em; - height: 0.01em; -} - -.prompt { - font-weight: 700; - width: 4em; - } - -#leftSide { - width: 170px; - float: left; -} - -#leftSide p { - text-align: center; - margin-bottom: 1em; - padding:0.3em 0; - font-weight: bold; - background-color: #d2d2d2; -} - -#leftSide p.selected { - background-color: #bb1f1f; - color: white; -} - -#leftSide img { - border: none; -} - -#leftSide a, #leftSide a:link, #leftSide a:hover, #leftSide a:active, #leftSide a:visited { - text-decoration: none; - color: black; -} - -#leftSide a.selected, #leftSide a.selected:link, #leftSide a.selected:hover, #leftSide a.selected:active, #leftSide a.selected:visited { - text-decoration: none; - color: white; -} - -#rightSide { - width: 530px; - float: right; -} - +* { + margin: 0px; + padding: 0px; + } + +body { + margin: 0px; + padding: 0px; + background-color: #FFFFFF; + color: #333333; + } + +hr { + height: 0.4em; + width: 100%; + background-color: #000000; + border: none; + color:#000000; + margin-bottom: 0.5em; + } + +#pageContainer { + width: 740px; + margin-left: auto; + margin-right: auto; + } + +#header { + width: 740px; + height: 80px; + background: url(images/logo.gif) #bb1f1f no-repeat center left; + margin-top: 10px; + border-bottom: #d2d2d2 solid 5px; + text-align: right; + margin-bottom: 20px; + } + +#headerLinks { + color: #FFFFFF; + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 80%; + padding-top: 64px; + padding-right: 5px; + display:block; + text-decoration: none; + } + +.hlink { + color: #FFFFFF; + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 80%; + text-decoration: none; +} +.hlink:link, .hlink:active, .hlink:visited { + color: #FFFFFF; +} + +.hlink:hover { + color: #FFFFFF; + text-decoration: underline; +} + +#pageContent { + /* Not used for anything at present */ + } + +h1 { + color: #600000; + font-family: helvetica, arial, sans-serif; + font-size: 135%; + margin-top: 1em; + margin-bottom: 0.3em; + } + +h2, h3 { + color: black; + font-family: helvetica, arial, sans-serif; + font-size: 115%; + margin-top: 1em; + margin-bottom: 0.3em; + } + +h3 { + font-size: 100%; +} + +.showcase { + margin: 2px; + padding: 2px; + border: 2px #000000 solid; + } + +p { + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 90%; + margin-bottom: 20px; + } + +ol, ul { + margin-bottom: 20px; +} + +ul { + list-style-type: square; + font-family: helvetica, arial, sans-serif; +} + +li { + list-style-position: outside; + font-family: helvetica, arial, sans-serif; + font-size: 90%; + margin: 0.1em 2em; + } + +code { + font-family: courier, courier new, fixed; + font-size: inherit; +} + +pre { + font-family: courier, courier new, fixed; + font-size: 90%; + padding: 1em; + margin-bottom: 1em; + background-color: #eee; +} + +#footer { + clear: both; + width: 740px; + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 80%; + border-top: 2px #000000 solid; + } + +#title { + float: left; + color: #FFFFFF; + padding-left: 100px; + margin-top: 1px; + font-family: helvetica, arial, sans-serif; + font-size: 190%; + } + +#subTitle { + float: left; + clear: left; + color: #FFFFFF; + padding-left: 102px; + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 75%; +} + +.right { + float: right; + margin: 0px; + } + +.left { + float: left; + margin: 0px; + } + +.flink:link { + color: #333333; + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 80%; + text-decoration: none; + vertical-align: text-top; + } + +.flink:active { + color: #333333; + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 80%; + text-decoration: none; + vertical-align: text-top; + } + +.flink:hover { + color: #333333; + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 80%; + text-decoration: underline; + vertical-align: text-top; + } + +.flink:visited { + color: #333333; + font-family: helvetica, arial, sans-serif; + font-size: 8pt; + font-size: 80%; + text-decoration: none; + vertical-align: text-top; + } + +.gone { + width: 0.01em; + height: 0.01em; +} + +.prompt { + font-weight: 700; + width: 4em; + } + +#leftSide { + width: 170px; + float: left; +} + +#leftSide p { + text-align: center; + margin-bottom: 1em; + padding:0.3em 0; + font-weight: bold; + background-color: #d2d2d2; +} + +#leftSide p.selected { + background-color: #bb1f1f; + color: white; +} + +#leftSide img { + border: none; +} + +#leftSide a, #leftSide a:link, #leftSide a:hover, #leftSide a:active, #leftSide a:visited { + text-decoration: none; + color: black; +} + +#leftSide a.selected, #leftSide a.selected:link, #leftSide a.selected:hover, #leftSide a.selected:active, #leftSide a.selected:visited { + text-decoration: none; + color: white; +} + +#rightSide { + width: 530px; + float: right; +} + diff --git a/docs/website/wikiheader.css b/docs/website/wikiheader.css index 868a60f9..39c040b7 100644 --- a/docs/website/wikiheader.css +++ b/docs/website/wikiheader.css @@ -1,67 +1,67 @@ - -#logo { - height: 80px; - width: 99.9%; - background: url(images/logo.gif) #bb1f1f no-repeat center left; - margin-left: 0px; - margin-top: 0px; - border-bottom: #d2d2d2 solid 5px; - text-align: right; - margin-bottom: 5px; - font-family: helvetica, arial, serif; - font-weight: normal; - font-size: 1em; - color: #FFFFFF; - display:block; -} - -#title { - float: left; - color: #FFFFFF; - padding-left: 100px; - margin-top: 10px; - font-size: 190%; - } - -#subTitle { - float: left; - clear: left; - color: #FFFFFF; - padding-left: 102px; - padding-top: 3px; - margin-top: 5px; - font-size: 75%; -} - - -#headerLinks { - color: #FFFFFF; - font-family: helvetica, arial, sans-serif; - font-size: 65%; - padding-top: 60px; - padding-right: 5px; - } - -#headerLinks .hlink { - color: #FFFFFF; - } - -#headerLinks .hlink:link { - color: #FFFFFF; - text-decoration: none; - } - -#headerLinks .hlink:active { - color: #FFFFFF; - text-decoration: none; - } - -#headerLinks .hlink:hover { - color: #FFFFFF; - text-decoration: underline; - } - -#headerLinks .hlink:visited { - color: #FFFFFF; - } - + +#logo { + height: 80px; + width: 99.9%; + background: url(images/logo.gif) #bb1f1f no-repeat center left; + margin-left: 0px; + margin-top: 0px; + border-bottom: #d2d2d2 solid 5px; + text-align: right; + margin-bottom: 5px; + font-family: helvetica, arial, serif; + font-weight: normal; + font-size: 1em; + color: #FFFFFF; + display:block; +} + +#title { + float: left; + color: #FFFFFF; + padding-left: 100px; + margin-top: 10px; + font-size: 190%; + } + +#subTitle { + float: left; + clear: left; + color: #FFFFFF; + padding-left: 102px; + padding-top: 3px; + margin-top: 5px; + font-size: 75%; +} + + +#headerLinks { + color: #FFFFFF; + font-family: helvetica, arial, sans-serif; + font-size: 65%; + padding-top: 60px; + padding-right: 5px; + } + +#headerLinks .hlink { + color: #FFFFFF; + } + +#headerLinks .hlink:link { + color: #FFFFFF; + text-decoration: none; + } + +#headerLinks .hlink:active { + color: #FFFFFF; + text-decoration: none; + } + +#headerLinks .hlink:hover { + color: #FFFFFF; + text-decoration: underline; + } + +#headerLinks .hlink:visited { + color: #FFFFFF; + } + diff --git a/htdocs/caldav.php b/htdocs/caldav.php index f6ddf918..0ea34be6 100644 --- a/htdocs/caldav.php +++ b/htdocs/caldav.php @@ -99,8 +99,8 @@ if ( ! ($request->IsPrincipal() || isset($request->collection) || $request->meth @ob_flush(); exit(0); } } -param_to_global('add_member','.*'); -$add_member = isset($add_member); +param_to_global('add_member','.*'); +$add_member = isset($add_member); switch ( $request->method ) { case 'OPTIONS': include_once('caldav-OPTIONS.php'); break; diff --git a/htdocs/setup.php b/htdocs/setup.php index 77a846cc..54345f39 100644 --- a/htdocs/setup.php +++ b/htdocs/setup.php @@ -25,9 +25,9 @@ function catch_setup_errors($errno , $errstr , $errfile , $errline , $errcontext return true; } else if ( $errno == 256 ) { - // This will (probably) be a database connection error, which will throw an exception if we return. - log_setup_error($errno , $errstr , $errfile , $errline); - return true; + // This will (probably) be a database connection error, which will throw an exception if we return. + log_setup_error($errno , $errstr , $errfile , $errline); + return true; } if ( !headers_sent() ) header("Content-type: text/plain"); else echo "
\n";
   try {
@@ -207,7 +207,7 @@ catch( Exception $e ) {
       return true;
     }
   }
-  $session = new FakeSession(1);
+  $session = new FakeSession(1);
 }
 
 
@@ -261,7 +261,7 @@ function check_davical_version() {
       $result->setDescription( sprintf(i18n('Stable: %s, We have: %s !'), $current_version, $c->version_string) );
     }
     else {
-      $result->setDescription( sprintf(i18n('Want: %s, Currently: %s'), $current_version, $c->version_string) );
+      $result->setDescription( sprintf(i18n('Want: %s, Currently: %s'), $current_version, $c->version_string) );
     }
   }
   return $result;
diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php
index c89fd96a..d6003a6a 100644
--- a/inc/CalDAVRequest.php
+++ b/inc/CalDAVRequest.php
@@ -122,7 +122,7 @@ class CalDAVRequest
     if ( !isset($this->options['allow_by_email']) ) $this->options['allow_by_email'] = false;
 
     if ( isset($_SERVER['HTTP_PREFER']) ) {
-      $this->prefer = explode( ',', $_SERVER['HTTP_PREFER']);
+      $this->prefer = explode( ',', $_SERVER['HTTP_PREFER']);
     }
     else if ( isset($_SERVER['HTTP_BRIEF']) && (strtoupper($_SERVER['HTTP_BRIEF']) == 'T') ) {
       $this->prefer = array( 'return-minimal');
@@ -1268,9 +1268,9 @@ EOSQL;
     exit(0);  // Unecessary, but might clarify things
   }
 
-  public static function kill_on_exit() {
-    posix_kill( getmypid(), 28 );
-  }
+  public static function kill_on_exit() {
+    posix_kill( getmypid(), 28 );
+  }
   
   /**
   * Utility function we call when we have a simple status-based response to
@@ -1330,8 +1330,8 @@ EOSQL;
     if ( isset($c->exit_after_memory_exceeds) && function_exists('memory_get_peak_usage') && memory_get_peak_usage(true) > $c->exit_after_memory_exceeds ) { // 64M
       @dbg_error_log("statistics", "Peak memory use exceeds %d bytes (%d) - killing process %d", $c->exit_after_memory_exceeds, memory_get_peak_usage(true), getmypid());
       register_shutdown_function( 'CalDAVRequest::kill_on_exit' );
-    }
-    
+    }
+    
     
     exit(0);
   }
diff --git a/inc/DAViCalSession.php b/inc/DAViCalSession.php
index 09bf9fd5..a6398f2a 100644
--- a/inc/DAViCalSession.php
+++ b/inc/DAViCalSession.php
@@ -35,7 +35,7 @@ EOSQL;
 * We extend the AWL Session class.
 */
 require('Session.php');
-include_once('DAVResource.php');
+include_once('DAVResource.php');
 
 
 @Session::_CheckLogout();
@@ -101,26 +101,26 @@ class DAViCalSession extends Session
   }
 
 
-  /**
-   * Does the user have the privileges to do what is requested.
-   * @param $do_what mixed The request privilege name, or array of privilege names, to be checked.
+  /**
+   * Does the user have the privileges to do what is requested.
+   * @param $do_what mixed The request privilege name, or array of privilege names, to be checked.
    * @param $path string The path we want that permission for
-   * @param $any boolean Whether we accept any of the privileges. The default is true, unless the requested privilege is 'all', when it is false.
-   * @return boolean Whether they do have one of those privileges against the specified path.
-   */
+   * @param $any boolean Whether we accept any of the privileges. The default is true, unless the requested privilege is 'all', when it is false.
+   * @return boolean Whether they do have one of those privileges against the specified path.
+   */
   function HavePrivilegeTo( $do_what, $path, $any = null ) {
     if ( $this->AllowedTo('Admin') ) return true;
     if ( !isset($this->privilege_resources[$path]) ) {
       $this->privilege_resources[$path] = new DAVResource($path);
     }
-    $resource = $this->privilege_resources[$path];
+    $resource = $this->privilege_resources[$path];
     if ( isset($resource) && $resource->Exists() ) {
       return $resource->HavePrivilegeTo($do_what,$any);
     }
     return false;
-  }
-
-
+  }
+
+
 
   /**
   * Checks that this user is logged in, and presents a login screen if they aren't.
diff --git a/inc/WritableCollection.php b/inc/WritableCollection.php
index 76832c06..267d3897 100644
--- a/inc/WritableCollection.php
+++ b/inc/WritableCollection.php
@@ -450,33 +450,33 @@ EOSQL;
    */
   public function whatChangedSince( $some_old_token ) {
     $params = array( ':collection_id' => $this->collection_id() );
-    if ( $some_old_token == 0 || empty($some_old_token) ) {
-      $sql = <<= (SELECT modification_time FROM sync_tokens WHERE sync_token = :sync_token)
+         COALESCE(addressbook_resource.uid,calendar_item.uid) AS uid
+      FROM sync_changes
+      LEFT JOIN caldav_data USING (collection_id,dav_id)
+      LEFT JOIN calendar_item USING (collection_id,dav_id)
+      LEFT JOIN addressbook_resource USING (dav_id)
+      WHERE sync_changes.collection_id = :collection_id
+            AND sync_time >= (SELECT modification_time FROM sync_tokens WHERE sync_token = :sync_token)
       ORDER BY sync_changes.collection_id, sync_changes.dav_id, sync_changes.sync_time
-EOSQL;
-
-    }
-    $qry = new AwlQuery($sql, $params );
+EOSQL;
+
+    }
+    $qry = new AwlQuery($sql, $params );
 
     $changes = array();
     if ( $qry->Exec('WritableCollection') && $qry->rows() ) {
diff --git a/inc/caldav-BIND.php b/inc/caldav-BIND.php
index 4736d157..0e3d8b8c 100644
--- a/inc/caldav-BIND.php
+++ b/inc/caldav-BIND.php
@@ -99,9 +99,9 @@ else {
     $request->PreconditionFailed(403,'DAV::binding-allowed',translate('DAViCal only allows BIND requests for collections at present.'));
   }
   
-  if ( $source->IsBinding() )
-    $source = new DAVResource( $source->bound_from() );
-
+  if ( $source->IsBinding() )
+    $source = new DAVResource( $source->bound_from() );
+
 
   /*
     bind_id INT8 DEFAULT nextval('dav_id_seq') PRIMARY KEY,
diff --git a/inc/caldav-DELETE.php b/inc/caldav-DELETE.php
index 52add374..ac3715ec 100644
--- a/inc/caldav-DELETE.php
+++ b/inc/caldav-DELETE.php
@@ -86,9 +86,9 @@ else {
     && $qry->QDo("DELETE FROM locks WHERE dav_name = (SELECT dav_name FROM caldav_data WHERE dav_id = :dav_id)", $params )
     && $qry->QDo("SELECT write_sync_change(collection_id, 404, caldav_data.dav_name) FROM caldav_data WHERE dav_id = :dav_id", $params )
     && $qry->QDo("DELETE FROM caldav_data WHERE dav_id = :dav_id", $params ) ) {
-    if ( function_exists('log_caldav_action') ) {
-      log_caldav_action( 'DELETE', $dav_resource->GetProperty('uid'), $dav_resource->GetProperty('user_no'), $collection_id, $request->path );
-    }
+    if ( function_exists('log_caldav_action') ) {
+      log_caldav_action( 'DELETE', $dav_resource->GetProperty('uid'), $dav_resource->GetProperty('user_no'), $collection_id, $request->path );
+    }
     
     $qry->Commit();
     @dbg_error_log( "DELETE", "DELETE: User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path);
diff --git a/inc/caldav-GET-functions.php b/inc/caldav-GET-functions.php
index 1f45cb38..d91c233f 100644
--- a/inc/caldav-GET-functions.php
+++ b/inc/caldav-GET-functions.php
@@ -76,10 +76,10 @@ function export_iCalendar( DAVResource $dav_resource ) {
     $vcal->AddProperty("X-WR-CALNAME", $displayname);
   }
   if ( !empty($c->auto_refresh_duration) ) {
-    $vcal->AddProperty("X-APPLE-AUTO-REFRESH-INTERVAL", $c->auto_refresh_duration);
+    $vcal->AddProperty("X-APPLE-AUTO-REFRESH-INTERVAL", $c->auto_refresh_duration);
     $vcal->AddProperty("AUTO-REFRESH", $c->auto_refresh_duration);
     $vcal->AddProperty("X-PUBLISHED-TTL", $c->auto_refresh_duration);
-  }
+  }
   
   $need_zones = array();
   $timezones = array();
diff --git a/inc/caldav-MKCOL.php b/inc/caldav-MKCOL.php
index 261f3d86..79cae799 100644
--- a/inc/caldav-MKCOL.php
+++ b/inc/caldav-MKCOL.php
@@ -65,7 +65,7 @@ if ( isset($request->xml_tags) ) {
 
   foreach( $setprops AS $k => $setting ) {
     $tag = $setting->GetNSTag();
-    $content = $setting->RenderContent(0,null,true);
+    $content = $setting->RenderContent(0,null,true);
     
     dbg_error_log( 'MKCOL', 'Processing tag "%s"', $tag);
 
diff --git a/inc/caldav-POST.php b/inc/caldav-POST.php
index 58323a8b..26629a63 100644
--- a/inc/caldav-POST.php
+++ b/inc/caldav-POST.php
@@ -15,14 +15,14 @@ include_once('caldav-PUT-functions.php');
 include_once('freebusy-functions.php');
 include_once('iSchedule.php');
 
-if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['post'])) ) {
-  $fh = fopen('/tmp/POST.txt','w');
-  if ( $fh ) {
-    fwrite($fh,$request->raw_post);
-    fclose($fh);
-  }
-}
-
+if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['post'])) ) {
+  $fh = fopen('/tmp/POST.txt','w');
+  if ( $fh ) {
+    fwrite($fh,$request->raw_post);
+    fclose($fh);
+  }
+}
+
 
 function handle_freebusy_request( $ic ) {
   global $c, $session, $request, $ical;
diff --git a/inc/caldav-PROPPATCH.php b/inc/caldav-PROPPATCH.php
index 1daebb8c..b47a6c49 100644
--- a/inc/caldav-PROPPATCH.php
+++ b/inc/caldav-PROPPATCH.php
@@ -45,7 +45,7 @@ $rmprops  = $xmltree->GetPath("/DAV::propertyupdate/DAV::remove/DAV::prop/*");
 $failure   = array();
 $success   = array();
 
-$reply = new XMLDocument( array( 'DAV:' => '') );
+$reply = new XMLDocument( array( 'DAV:' => '') );
 
 /**
  * Small utility function to add propstat for one failure
@@ -55,19 +55,19 @@ $reply = new XMLDocument( array( 'DAV:' => '') );
  * @param unknown_type $error_tag
  */
 function add_failure( $type, $tag, $status, $description=null, $error_tag = null) {
-  global $failure, $reply;
+  global $failure, $reply;
   $prop = new XMLElement('prop');
   $reply->NSElement($prop, $tag);
   $propstat = array($prop,new XMLElement( 'status', $status ));
-
-  if ( isset($description))
-    $propstat[] = new XMLElement( 'responsedescription', $description );
-  if ( isset($error_tag) )
-    $propstat[] = new XMLElement( 'error', new XMLElement( $error_tag ) );
+
+  if ( isset($description))
+    $propstat[] = new XMLElement( 'responsedescription', $description );
+  if ( isset($error_tag) )
+    $propstat[] = new XMLElement( 'error', new XMLElement( $error_tag ) );
 
   $failure[$type.'-'.$tag] = new XMLElement('propstat', $propstat ); 
-}
-
+}
+
 
 /**
 * Not much for it but to process the incoming settings in a big loop, doing
@@ -139,8 +139,8 @@ foreach( $setprops AS $k => $setting ) {
         $success[$tag] = 1;
       }
       else if ( $setcalendar && $setaddressbook ) {
-        add_failure('set', $tag, 'HTTP/1.1 409 Conflict',
-            translate("A collection may not be both a calendar and an addressbook."));
+        add_failure('set', $tag, 'HTTP/1.1 409 Conflict',
+            translate("A collection may not be both a calendar and an addressbook."));
       }
       else if ( $setother ) {
         add_failure('set', $tag, 'HTTP/1.1 403 Forbidden',
@@ -285,20 +285,20 @@ foreach( $rmprops AS $k => $setting ) {
 */
 if ( count($failure) > 0 ) {
 
-  $qry->Rollback();
+  $qry->Rollback();
   
   $url = ConstructURL($request->path);
   $multistatus = new XMLElement('multistatus');
-  array_unshift($failure,new XMLElement('responsedescription', translate("Some properties were not able to be changed.") ));
+  array_unshift($failure,new XMLElement('responsedescription', translate("Some properties were not able to be changed.") ));
   array_unshift($failure,new XMLElement('href', $url));
-  $response = $reply->DAVElement($multistatus,'response', $failure);
+  $response = $reply->DAVElement($multistatus,'response', $failure);
   
   if ( !empty($success) ) { 
-    $prop = new XMLElement('prop');
-    foreach( $success AS $tag => $v ) {
-      $reply->NSElement($prop, $tag);
-    }
-    $reply->DAVElement($response, 'propstat', array( $prop, new XMLElement( 'status', 'HTTP/1.1 424 Failed Dependency' )) );
+    $prop = new XMLElement('prop');
+    foreach( $success AS $tag => $v ) {
+      $reply->NSElement($prop, $tag);
+    }
+    $reply->DAVElement($response, 'propstat', array( $prop, new XMLElement( 'status', 'HTTP/1.1 424 Failed Dependency' )) );
   }  
   $request->DoResponse( 207, $reply->Render($multistatus), 'text/xml; charset="utf-8"' );
 
@@ -334,7 +334,7 @@ if ( $qry->Commit() ) {
   foreach( $success AS $tag => $v ) {
     $reply->NSElement($prop, $tag);
   }
-  $reply->DAVElement($multistatus, 'propstat', array( $prop, new XMLElement( 'status', 'HTTP/1.1 200 OK' )) );
+  $reply->DAVElement($multistatus, 'propstat', array( $prop, new XMLElement( 'status', 'HTTP/1.1 200 OK' )) );
   
   $url = ConstructURL($request->path);
   array_unshift( $failure, new XMLElement('href', $url ) );
diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php
index 5be20eb8..f94d7950 100644
--- a/inc/caldav-PUT-functions.php
+++ b/inc/caldav-PUT-functions.php
@@ -20,7 +20,7 @@ require_once('vComponent.php');
 require_once('vCalendar.php');
 require_once('WritableCollection.php');
 include_once('iSchedule.php');
-include_once('RRule-v2.php');
+include_once('RRule-v2.php');
 
 $bad_events = null;
 
@@ -858,8 +858,8 @@ INSERT INTO caldav_data ( user_no, dav_name, dav_etag, caldav_data, caldav_type,
 EOSQL;
 
   $dav_data_update = << 0 )
-    $qry->QDo('SELECT new_sync_token(0,'.$collection_id.')');
+    $qry->QDo('SELECT new_sync_token(0,'.$collection_id.')');
   
   foreach( $resources AS $uid => $resource ) {
 
@@ -890,7 +890,21 @@ EOSQL;
     $icalendar = $vcal->Render();
     $dav_name = sprintf( '%s%s.ics', $path, preg_replace('{[&?\\/@%+:]}','',$uid) );
 
-    if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Begin();
+    /** Do we need to do anything? */
+    $inserting = true;
+    if ( isset($current_data[$dav_name]) ) {
+      if ( $icalendar == $current_data[$dav_name] ) {
+        unset($current_data[$dav_name]);
+        continue;
+      }
+      $sync_change = 200;
+      unset($current_data[$dav_name]);
+      $inserting = false;
+    }
+    else
+      $sync_change = 201;
+    
+    if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Begin();
     
     /** As ever, we mostly deal with the first resource component */
     $first = $resource[0];
@@ -977,7 +991,7 @@ EOSQL;
         $dtstart_prop = $first->GetProperty('DTSTART');
         if ( empty($dtstart_prop) ) {
           dbg_error_log('PUT','Invalid VEVENT without DTSTART, UID="%s" in collection %d', $uid, $collection_id);
-          continue;
+          continue;
         } 
         $value_type = $dtstart_prop->GetParameterValue('VALUE');
         dbg_error_log('PUT','DTSTART without DTEND. DTSTART value type is %s', $value_type );
@@ -1054,13 +1068,13 @@ EOSQL;
     write_alarms($dav_id, $first);
     write_attendees($dav_id, $vcal);
 
-    $qry->QDo("SELECT write_sync_change( $collection_id, $sync_change, :dav_name)", array(':dav_name' => $dav_name ) );
+    $qry->QDo("SELECT write_sync_change( $collection_id, $sync_change, :dav_name)", array(':dav_name' => $dav_name ) );
     
     do_scheduling_requests( $vcal, true );
     if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Commit();
   }
 
-  if ( !$appending && count($current_data) > 0 ) {
+  if ( !$appending && count($current_data) > 0 ) {
     $params = array( ':collection_id' => $collection_id );
     if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Begin();
     foreach( $current_data AS $dav_name => $data ) {
@@ -1069,7 +1083,7 @@ EOSQL;
       $qry->QDo('SELECT write_sync_change(:collection_id, 404, :dav_name)', $params);
     }
     if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Commit();
-  }
+  }
   
   if ( !(isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import) ) {
     if ( ! $qry->Commit() ) rollback_on_error( $caldav_context, $user_no, $path);
@@ -1371,7 +1385,7 @@ function write_resource( DAVResource $resource, $caldav_data, DAVResource $colle
 
   }
 
-  $qry->QDo('SELECT new_sync_token(0,'.$collection_id.')');
+  $qry->QDo('SELECT new_sync_token(0,'.$collection_id.')');
 
   $calitem_params[':tzid'] = $tzid;
   $calitem_params[':uid'] = $first->GetPValue('UID');
@@ -1461,9 +1475,9 @@ EOSQL;
   $qry->QDo("SELECT write_sync_change( $collection_id, $sync_change, :dav_name)", array(':dav_name' => $path ) );
   $qry->Commit();
 
-  if ( function_exists('post_commit_action') ) {
-    post_commit_action( $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path );
-  }
+  if ( function_exists('post_commit_action') ) {
+    post_commit_action( $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path );
+  }
   
   // Uncache anything to do with the collection
   $cache = getCacheInstance();
diff --git a/inc/caldav-PUT-vcalendar.php b/inc/caldav-PUT-vcalendar.php
index b683d929..1d130531 100644
--- a/inc/caldav-PUT-vcalendar.php
+++ b/inc/caldav-PUT-vcalendar.php
@@ -14,12 +14,12 @@ require_once('DAVResource.php');
 
 include_once('caldav-PUT-functions.php');
 
-$vcalendar = new vCalendar( $request->raw_post );
-$uid = $vcalendar->GetUID();
-if ( empty($uid) ) {
-  $uid = uuid();
-  $vcalendar->SetUID($uid);
-}
+$vcalendar = new vCalendar( $request->raw_post );
+$uid = $vcalendar->GetUID();
+if ( empty($uid) ) {
+  $uid = uuid();
+  $vcalendar->SetUID($uid);
+}
 
 if ( $add_member ) {
   $request->path = $request->dav_name() . $uid . '.ics';
@@ -76,7 +76,7 @@ if ( $dav_resource->IsCollection()  ) {
 
 $etag = md5($request->raw_post);
 
-$request->CheckEtagMatch( $dav_resource->Exists(), $dav_resource->unique_tag() );
+$request->CheckEtagMatch( $dav_resource->Exists(), $dav_resource->unique_tag() );
 
 $put_action_type = ($dav_resource->Exists() ? 'UPDATE' : 'INSERT');
 $collection = $dav_resource->GetParentContainer();
diff --git a/inc/caldav-PUT-vcard.php b/inc/caldav-PUT-vcard.php
index a579d5f1..0ced7ec3 100644
--- a/inc/caldav-PUT-vcard.php
+++ b/inc/caldav-PUT-vcard.php
@@ -22,20 +22,20 @@ if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put'
 
 $lock_opener = $request->FailIfLocked();
 
-require_once('vcard.php');
-$vcard = new vCard( $request->raw_post );
-$uid = $vcard->GetPValue('UID');
-if ( empty($uid) ) {
-  $uid = uuid();
-  $vcard->AddProperty('UID',$uid);
-}
+require_once('vcard.php');
+$vcard = new vCard( $request->raw_post );
+$uid = $vcard->GetPValue('UID');
+if ( empty($uid) ) {
+  $uid = uuid();
+  $vcard->AddProperty('UID',$uid);
+}
 
 if ( $add_member ) {
   $request->path = $request->dav_name() . $uid . '.vcf';
   $dest = new DAVResource($request->path);
   if ( $dest->Exists() ) {
-    $uid = uuid();
-    $vcard->AddProperty('UID',$uid);
+    $uid = uuid();
+    $vcard->AddProperty('UID',$uid);
     $request->path = $request->dav_name() . $uid . '.vcf';
     $dest = new DAVResource($request->path);
     if ( $dest->Exists() ) throw new Exception("Failed to generate unique segment name for add-member!");
@@ -124,7 +124,7 @@ else {
   $params[':collection_id'] = $collection_id;
   $response_code = 201;
   $qry->QDo( $sql, $params );
-  $put_action_type = 'INSERT';
+  $put_action_type = 'INSERT';
   
   $qry->QDo("SELECT currval('dav_id_seq') AS dav_id" );
 }
@@ -134,14 +134,14 @@ $vcard->Write( $row->dav_id, $dest->Exists() );
 
 $qry->QDo("SELECT write_sync_change( $collection_id, $response_code, :dav_name)", array(':dav_name' => $dest->bound_from() ) );
 
-if ( isset($log_action) && $log_action && function_exists('log_caldav_action') ) {
-  log_caldav_action( $put_action_type, $uid, $user_no, $collection_id, $request->path );
-}
-else if ( isset($log_action) && $log_action  ) {
-  dbg_error_log( 'PUT', 'No log_caldav_action( %s, %s, %s, %s, %s) can be called.',
-      $put_action_type, $uid, $user_no, $collection_id, $request->path );
-}
-
+if ( isset($log_action) && $log_action && function_exists('log_caldav_action') ) {
+  log_caldav_action( $put_action_type, $uid, $user_no, $collection_id, $request->path );
+}
+else if ( isset($log_action) && $log_action  ) {
+  dbg_error_log( 'PUT', 'No log_caldav_action( %s, %s, %s, %s, %s) can be called.',
+      $put_action_type, $uid, $user_no, $collection_id, $request->path );
+}
+
 
 if ( !$qry->Commit() ) {
    $qry->Rollback();
diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php
index 6d09f093..9914d44a 100644
--- a/inc/caldav-REPORT-calquery.php
+++ b/inc/caldav-REPORT-calquery.php
@@ -318,7 +318,7 @@ if ( ! ($target_collection->IsCalendar() || $target_collection->IsSchedulingColl
 }
 else {
   $where = ' WHERE caldav_data.collection_id = ' . $target_collection->resource_id();
-  $distinct = '';
+  $distinct = '';
 }
 
 if ( is_array($qry_filters) ) {
diff --git a/inc/caldav-REPORT-cardquery.php b/inc/caldav-REPORT-cardquery.php
index 0a78bbf9..fdc82149 100644
--- a/inc/caldav-REPORT-cardquery.php
+++ b/inc/caldav-REPORT-cardquery.php
@@ -41,7 +41,7 @@ switch( $proptype ) {
   default:
     $properties[$proptype] = 1;
 }
-if ( empty($properties) ) $properties['DAV::allprop'] = 1;
+if ( empty($properties) ) $properties['DAV::allprop'] = 1;
 
 /**
  * There can only be *one* FILTER element.
diff --git a/inc/caldav-REPORT-multiget.php b/inc/caldav-REPORT-multiget.php
index 87207c9a..bdb1151e 100644
--- a/inc/caldav-REPORT-multiget.php
+++ b/inc/caldav-REPORT-multiget.php
@@ -50,7 +50,7 @@ switch( $proptype ) {
   default:
     $properties[$proptype] = 1;
 }
-if ( empty($properties) ) $properties['DAV::allprop'] = 1;
+if ( empty($properties) ) $properties['DAV::allprop'] = 1;
 
 $collection = new DAVResource($request->path);
 $bound_from = $collection->bound_from();
diff --git a/inc/caldav-REPORT-sync-collection.php b/inc/caldav-REPORT-sync-collection.php
index f0a12cad..b5a0c9bd 100644
--- a/inc/caldav-REPORT-sync-collection.php
+++ b/inc/caldav-REPORT-sync-collection.php
@@ -81,7 +81,7 @@ if ( $sync_token == $new_token ) {
 }
 else {
   $hide_older = '';
-  if ( isset($c->hide_older_than) && intval($c->hide_older_than) > 0 )
+  if ( isset($c->hide_older_than) && intval($c->hide_older_than) > 0 )
     $hide_older = " AND (CASE WHEN caldav_data.caldav_type<>'VEVENT' OR calendar_item.dtstart IS NULL THEN true ELSE calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') END)";
 
   if ( $sync_token == 0 ) {
diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php
index 57a5c332..8d0e4355 100644
--- a/inc/caldav-REPORT.php
+++ b/inc/caldav-REPORT.php
@@ -189,11 +189,11 @@ function component_to_xml( $properties, $item ) {
   if ( $need_resource ) {
     if ( !isset($dav_resource) ) $dav_resource = new DAVResource($item->dav_name);
     $elements = $dav_resource->GetPropStat(array_keys($properties), $reply);
-    array_unshift($elements, $href);
+    array_unshift($elements, $href);
   }
   else {
     $elements = array($href);
-    $status = new XMLElement("status", "HTTP/1.1 200 OK" );
+    $status = new XMLElement("status", "HTTP/1.1 200 OK" );
     $elements[] = new XMLElement( "propstat", array( $prop, $status) );
     if ( count($denied) > 0 ) {
       $status = new XMLElement("status", "HTTP/1.1 403 Forbidden" );
@@ -224,7 +224,7 @@ if ( $target->IsExternal() ) {
 	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
 $c->sync_resource_data_ok = true;
 
 if ( $xmltree->GetNSTag() == "urn:ietf:params:xml:ns:caldav:calendar-query" ) {
diff --git a/inc/drivers_imap_pam.php b/inc/drivers_imap_pam.php
index f2cdfcf3..f3260657 100644
--- a/inc/drivers_imap_pam.php
+++ b/inc/drivers_imap_pam.php
@@ -1,107 +1,107 @@
-,
-*   		 Andrew McMillan 
-* @copyright Based on Eric Seigne script drivers_squid_pam.php
-* @license   http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
-*/
-
-// The PHP interpreter will die quietly unless satisfied. This provides user feedback instead.
-if (!function_exists('imap_open')) {
-  die("drivers_imap_pam: php5-imap required.");
-}
-
-require_once("auth-functions.php");
-
-class imapPamDrivers
-{
-  /**#@+
-  * @access private
-  */
-
-  /**#@-*/
-
-
-  /**
-  * The constructor
-  *
-  * @param string $imap_url formated for imap_open()
-  */
-  function __construct($imap_url)
-  {
-      global $c;
-      if (empty($imap_url)){
-          $c->messages[] = sprintf(i18n('drivers_imap_pam : imap_url parameter not configured in /etc/davical/*-conf.php'));
-          $this->valid=false;
-          return ;
-      }
-  }
-}
-
-
-/**
-* Check the username / password against the PAM system
-*/
-function IMAP_PAM_check($username, $password ){
-  global $c;
-
-  $imap_username = $username;
-  if ( function_exists('mb_convert_encoding') ) {
-    $imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP",mb_detect_encoding($imap_username));
-  }
-  else {
-    $imap_username = imap_utf7_encode($imap_username);
-  }
-
-  //$imap_url = '{localhost:143/imap/notls}';
-  //$imap_url = '{localhost:993/imap/ssl/novalidate-cert}';
-  $imap_url = $c->authenticate_hook['config']['imap_url'];
-  $auth_result = "ERR";
-  
-  $imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN);
-  //print_r(imap_errors());
-  if ( $imap_stream ) {
-    // disconnect
-    imap_close($imap_stream);
-    // login ok
-    $auth_result = "OK";
-  }
-
-  if ( $auth_result == "OK") {
-    $principal = new Principal('username',$username);
-    if ( ! $principal->Exists() ) {
-      dbg_error_log( "PAM", "Principal '%s' doesn't exist in local DB, we need to create it",$username );
-      $cmd = "getent passwd '$username'";
-      $getent_res = exec($cmd);
-      $getent_arr = explode(":", $getent_res);
-      $fullname = $getent_arr[4];
-      if(empty($fullname)) {
-        $fullname = $username;
-      }
-
-      $principal->Create( array(
-                      'username' => $username,
-                      'user_active' => true,
-                      'email' => $username . "@" . $c->authenticate_hook['config']['email_base'],
-                      'modified' => date('c'),
-                      'fullname' => $fullname
-              ));
-      if ( ! $principal->Exists() ) {
-        dbg_error_log( "PAM", "Unable to create local principal for '%s'", $username );
-        return false;
-      }
-      CreateHomeCalendar($username);
-    }
-    return $principal;
-  }
-  else {
-    dbg_error_log( "PAM", "User %s is not a valid username (or password was wrong)", $username );
-    return false;
-  }
-
-}
+,
+*   		 Andrew McMillan 
+* @copyright Based on Eric Seigne script drivers_squid_pam.php
+* @license   http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
+*/
+
+// The PHP interpreter will die quietly unless satisfied. This provides user feedback instead.
+if (!function_exists('imap_open')) {
+  die("drivers_imap_pam: php5-imap required.");
+}
+
+require_once("auth-functions.php");
+
+class imapPamDrivers
+{
+  /**#@+
+  * @access private
+  */
+
+  /**#@-*/
+
+
+  /**
+  * The constructor
+  *
+  * @param string $imap_url formated for imap_open()
+  */
+  function __construct($imap_url)
+  {
+      global $c;
+      if (empty($imap_url)){
+          $c->messages[] = sprintf(i18n('drivers_imap_pam : imap_url parameter not configured in /etc/davical/*-conf.php'));
+          $this->valid=false;
+          return ;
+      }
+  }
+}
+
+
+/**
+* Check the username / password against the PAM system
+*/
+function IMAP_PAM_check($username, $password ){
+  global $c;
+
+  $imap_username = $username;
+  if ( function_exists('mb_convert_encoding') ) {
+    $imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP",mb_detect_encoding($imap_username));
+  }
+  else {
+    $imap_username = imap_utf7_encode($imap_username);
+  }
+
+  //$imap_url = '{localhost:143/imap/notls}';
+  //$imap_url = '{localhost:993/imap/ssl/novalidate-cert}';
+  $imap_url = $c->authenticate_hook['config']['imap_url'];
+  $auth_result = "ERR";
+  
+  $imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN);
+  //print_r(imap_errors());
+  if ( $imap_stream ) {
+    // disconnect
+    imap_close($imap_stream);
+    // login ok
+    $auth_result = "OK";
+  }
+
+  if ( $auth_result == "OK") {
+    $principal = new Principal('username',$username);
+    if ( ! $principal->Exists() ) {
+      dbg_error_log( "PAM", "Principal '%s' doesn't exist in local DB, we need to create it",$username );
+      $cmd = "getent passwd '$username'";
+      $getent_res = exec($cmd);
+      $getent_arr = explode(":", $getent_res);
+      $fullname = $getent_arr[4];
+      if(empty($fullname)) {
+        $fullname = $username;
+      }
+
+      $principal->Create( array(
+                      'username' => $username,
+                      'user_active' => true,
+                      'email' => $username . "@" . $c->authenticate_hook['config']['email_base'],
+                      'modified' => date('c'),
+                      'fullname' => $fullname
+              ));
+      if ( ! $principal->Exists() ) {
+        dbg_error_log( "PAM", "Unable to create local principal for '%s'", $username );
+        return false;
+      }
+      CreateHomeCalendar($username);
+    }
+    return $principal;
+  }
+  else {
+    dbg_error_log( "PAM", "User %s is not a valid username (or password was wrong)", $username );
+    return false;
+  }
+
+}
diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php
index caf09bcc..d2c80147 100644
--- a/inc/drivers_ldap.php
+++ b/inc/drivers_ldap.php
@@ -295,19 +295,19 @@ function sync_user_from_LDAP( Principal &$principal, $mapping, $ldap_values ) {
   }
 }
 
-/*
-* explode the multipart mapping
-*/
-function array_values_mapping($mapping){
-  $attributes=array();
-  foreach ( $mapping as $field ) {
-    $tab_part_field = explode(",",$field);
-    foreach( $tab_part_field as $part_field ) {
-      $attributes[] = $part_field;
-    }
-  }
-  return $attributes;
-}
+/*
+* explode the multipart mapping
+*/
+function array_values_mapping($mapping){
+  $attributes=array();
+  foreach ( $mapping as $field ) {
+    $tab_part_field = explode(",",$field);
+    foreach( $tab_part_field as $part_field ) {
+      $attributes[] = $part_field;
+    }
+  }
+  return $attributes;
+}
 
 /**
 * Check the username / password against the LDAP server
diff --git a/inc/drivers_rimap.php b/inc/drivers_rimap.php
index a599df5a..323f4483 100644
--- a/inc/drivers_rimap.php
+++ b/inc/drivers_rimap.php
@@ -1,112 +1,112 @@
-,
-*   		 Andrew McMillan 
-* @copyright Based on Eric Seigne script drivers_squid_pam.php
-* @license   http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
-*/
-
-require_once("auth-functions.php");
-
-class imapPamDrivers
-{
-  /**#@+
-  * @access private
-  */
-
-  /**#@-*/
-
-
-  /**
-  * Constructor.
-  * @param string $imap_url formated for imap_open()
-  */
-  function imapPamDrivers($imap_url){
-      $this->__construct($imap_url);
-  }
-
-
-  /**
-  * The constructor
-  *
-  * @param string $imap_url formated for imap_open()
-  */
-  function __construct($imap_url)
-  {
-      global $c;
-      if (empty($imap_url)){
-          $c->messages[] = sprintf(i18n('drivers_imap_pam : imap_url parameter not configured in /etc/davical/*-conf.php'));
-          $this->valid=false;
-          return ;
-      }
-  }
-}
-
-
-/**
-* Check the username / password against the IMAP server
-*/
-function RIMAP_check($username, $password ){
-  global $c;
-
-  $imap_username = $username;
-  if ( function_exists('mb_convert_encoding') ) {
-    $imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP",mb_detect_encoding($imap_username));
-  }
-  else {
-    $imap_username = imap_utf7_encode($imap_username);
-  }
-
-  //$imap_url = '{localhost:143/imap/notls}';
-  //$imap_url = '{localhost:993/imap/ssl/novalidate-cert}';
-  $imap_url = $c->authenticate_hook['config']['imap_url'];
-  $auth_result = "ERR";
-  
-  $imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN);
-  //print_r(imap_errors());
-  if ( $imap_stream ) {
-    // disconnect
-    imap_close($imap_stream);
-    // login ok
-    $auth_result = "OK";
-  }
-
-  if ( $auth_result == "OK") {
-    $principal = new Principal('username',$username);
-    if ( ! $principal->Exists() ) {
-      dbg_error_log( "PAM", "Principal '%s' doesn't exist in local DB, we need to create it",$username );
-      if ( strstr($username, '@') ) {
-        $name_arr = explode('@', $username);
-        $fullname = ucfirst(strtolower($name_arr[0]));
-        $email = $username;
-      }
-      else {
-        $fullname = ucfirst(strtolower($username));
-        $email = $username . "@" . $c->authenticate_hook['config']['email_base'];
-      }
-
-      $principal->Create( array(
-                      'username' => $username,
-                      'user_active' => true,
-                      'email' => $email,
-                      'fullname' => ucfirst($fullname)
-              ));
-      if ( ! $principal->Exists() ) {
-        dbg_error_log( "PAM", "Unable to create local principal for '%s'", $username );
-        return false;
-      }
-      CreateHomeCollections($username);
-    }
-    return $principal;
-  }
-  else {
-    dbg_error_log( "PAM", "User %s is not a valid username (or password was wrong)", $username );
-    return false;
-  }
-
-}
+,
+*   		 Andrew McMillan 
+* @copyright Based on Eric Seigne script drivers_squid_pam.php
+* @license   http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
+*/
+
+require_once("auth-functions.php");
+
+class imapPamDrivers
+{
+  /**#@+
+  * @access private
+  */
+
+  /**#@-*/
+
+
+  /**
+  * Constructor.
+  * @param string $imap_url formated for imap_open()
+  */
+  function imapPamDrivers($imap_url){
+      $this->__construct($imap_url);
+  }
+
+
+  /**
+  * The constructor
+  *
+  * @param string $imap_url formated for imap_open()
+  */
+  function __construct($imap_url)
+  {
+      global $c;
+      if (empty($imap_url)){
+          $c->messages[] = sprintf(i18n('drivers_imap_pam : imap_url parameter not configured in /etc/davical/*-conf.php'));
+          $this->valid=false;
+          return ;
+      }
+  }
+}
+
+
+/**
+* Check the username / password against the IMAP server
+*/
+function RIMAP_check($username, $password ){
+  global $c;
+
+  $imap_username = $username;
+  if ( function_exists('mb_convert_encoding') ) {
+    $imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP",mb_detect_encoding($imap_username));
+  }
+  else {
+    $imap_username = imap_utf7_encode($imap_username);
+  }
+
+  //$imap_url = '{localhost:143/imap/notls}';
+  //$imap_url = '{localhost:993/imap/ssl/novalidate-cert}';
+  $imap_url = $c->authenticate_hook['config']['imap_url'];
+  $auth_result = "ERR";
+  
+  $imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN);
+  //print_r(imap_errors());
+  if ( $imap_stream ) {
+    // disconnect
+    imap_close($imap_stream);
+    // login ok
+    $auth_result = "OK";
+  }
+
+  if ( $auth_result == "OK") {
+    $principal = new Principal('username',$username);
+    if ( ! $principal->Exists() ) {
+      dbg_error_log( "PAM", "Principal '%s' doesn't exist in local DB, we need to create it",$username );
+      if ( strstr($username, '@') ) {
+        $name_arr = explode('@', $username);
+        $fullname = ucfirst(strtolower($name_arr[0]));
+        $email = $username;
+      }
+      else {
+        $fullname = ucfirst(strtolower($username));
+        $email = $username . "@" . $c->authenticate_hook['config']['email_base'];
+      }
+
+      $principal->Create( array(
+                      'username' => $username,
+                      'user_active' => true,
+                      'email' => $email,
+                      'fullname' => ucfirst($fullname)
+              ));
+      if ( ! $principal->Exists() ) {
+        dbg_error_log( "PAM", "Unable to create local principal for '%s'", $username );
+        return false;
+      }
+      CreateHomeCollections($username);
+    }
+    return $principal;
+  }
+  else {
+    dbg_error_log( "PAM", "User %s is not a valid username (or password was wrong)", $username );
+    return false;
+  }
+
+}
diff --git a/inc/schedule-functions.php b/inc/schedule-functions.php
index 35091ed2..b792b932 100644
--- a/inc/schedule-functions.php
+++ b/inc/schedule-functions.php
@@ -177,7 +177,7 @@ function doItipAttendeeReply( vCalendar $resource, $partstat ) {
       }
     }
     else {
-      header( "Debug: Could maybe do the iMIP message dance for attendee ". $email );
+      header( "Debug: Could maybe do the iMIP message dance for attendee ". $email );
     }
   }
 
@@ -397,9 +397,9 @@ EOTEMPLATE;
     $email->Pretend($mime->getMimeHeaders());
   }
   else if ( !isset($c->iMIP->send_email) || !$c->iMIP->send_email) {
-    $email->PretendLog($mime->getMimeHeaders());
+    $email->PretendLog($mime->getMimeHeaders());
   }
   else {
     $email->Send($mime->getMimeHeaders());
   }
-}
\ No newline at end of file
+}
diff --git a/inc/ui/collection-edit.php b/inc/ui/collection-edit.php
index 246d59ea..9a3e056b 100644
--- a/inc/ui/collection-edit.php
+++ b/inc/ui/collection-edit.php
@@ -27,9 +27,9 @@ $editor->AddField('ics_file', "''");
 $editor->AddAttribute('ics_file', 'title', translate('Upload an iCalendar file or VCard file to replace this collection.'));
 $editor->AddAttribute('ics_file', 'id', 'fld_ics_file');
 $editor->AddField('mode', 'FALSE');
-$editor->AddAttribute('mode', 'title', translate('Should the uploaded entries be appended to the collection?'));
-$editor->AddAttribute('mode', '_label', translate('Append'));
-$editor->AddAttribute('mode', 'id', 'fld_mode');
+$editor->AddAttribute('mode', 'title', translate('Should the uploaded entries be appended to the collection?'));
+$editor->AddAttribute('mode', '_label', translate('Append'));
+$editor->AddAttribute('mode', 'id', 'fld_mode');
 
 $editor->SetWhere( 'collection_id='.$id );
 
diff --git a/inc/ui/principal-edit.php b/inc/ui/principal-edit.php
index 82bc5480..6ada0168 100644
--- a/inc/ui/principal-edit.php
+++ b/inc/ui/principal-edit.php
@@ -32,8 +32,8 @@ $can_write_principal = ($session->AllowedTo('Admin') || ($session->principal_id
 if ( !$can_write_principal && $id > 0 ) {
   $target_principal = new Principal('principal_id', $id);
   $can_write_principal = $session->HavePrivilegeTo('DAV::write', $target_principal->dav_name());
-}
-
+}
+
 
 $delete_collection_confirmation_required = null;
 $delete_principal_confirmation_required = null;
@@ -624,7 +624,7 @@ function edit_grant_row( $row_data ) {
   }
   else {
     $grantrow->Initialise( $row_data );
-  }
+  }
   
   $privs_html = build_privileges_html( $grantrow, 'grant_privileges' );
 
-- 
2.11.4.GIT