Merge pull request #1 from calestyo/unix-line-endings

set line endings of most text files to LF
This commit is contained in:
Christoph Anton Mitterer 2013-03-19 16:55:15 -07:00
commit 4ef8dc9d53
30 changed files with 801 additions and 796 deletions

View File

@ -1,3 +1,8 @@
2013-03-20 Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
* 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 <andrew@morphoss.com> 2013-03-06 Andrew McMillan <andrew@morphoss.com>
* Fix capitalisation of 'plpgsql' & 'sql' for Postgres 9.2. (debbug #702403) * Fix capitalisation of 'plpgsql' & 'sql' for Postgres 9.2. (debbug #702403)

View File

@ -1,11 +1,11 @@
/** /**
* Authentication against IMAP using the imap_open function. * Authentication against IMAP using the imap_open function.
*/ */
$c->authenticate_hook['call'] = 'IMAP_PAM_check'; $c->authenticate_hook['call'] = 'IMAP_PAM_check';
$c->authenticate_hook['config'] = array( $c->authenticate_hook['config'] = array(
'imap_url' => '{localhost:993/imap/ssl/novalidate-cert}', 'imap_url' => '{localhost:993/imap/ssl/novalidate-cert}',
'email_base' => 'example.com' 'email_base' => 'example.com'
); );
include('drivers_imap_pam.php'); include('drivers_imap_pam.php');

View File

@ -1,89 +1,89 @@
;; phpDocumentor configuration file for DAViCal API documentation ;; phpDocumentor configuration file for DAViCal API documentation
;; ;;
[Parse Data] [Parse Data]
;; title of all the documentation ;; title of all the documentation
;; legal values: any string ;; legal values: any string
title = DAViCal title = DAViCal
;; parse files that start with a . like .bash_profile ;; parse files that start with a . like .bash_profile
;; legal values: true, false ;; legal values: true, false
hidden = false hidden = false
;; show elements marked @access private in documentation by setting this to on ;; show elements marked @access private in documentation by setting this to on
;; legal values: on, off ;; legal values: on, off
parseprivate = off parseprivate = off
;; parse with javadoc-like description (first sentence is always the short description) ;; parse with javadoc-like description (first sentence is always the short description)
;; legal values: on, off ;; legal values: on, off
javadocdesc = off javadocdesc = off
;; add any custom @tags separated by commas here ;; add any custom @tags separated by commas here
;; legal values: any legal tagname separated by commas. ;; legal values: any legal tagname separated by commas.
;customtags = mytag1,mytag2 ;customtags = mytag1,mytag2
;; This is only used by the XML:DocBook/peardoc2 converter ;; This is only used by the XML:DocBook/peardoc2 converter
defaultcategoryname = Documentation defaultcategoryname = Documentation
;; what is the main package? ;; what is the main package?
;; legal values: alphanumeric string plus - and _ ;; legal values: alphanumeric string plus - and _
defaultpackagename = davical defaultpackagename = davical
;; output any parsing information? set to on for cron jobs ;; output any parsing information? set to on for cron jobs
;; legal values: on ;; legal values: on
quiet = on quiet = on
;; parse a PEAR-style repository. Do not turn this on if your project does ;; parse a PEAR-style repository. Do not turn this on if your project does
;; not have a parent directory named "pear" ;; not have a parent directory named "pear"
;; legal values: on/off ;; legal values: on/off
;pear = on ;pear = on
;; where should the documentation be written? ;; where should the documentation be written?
;; legal values: a legal path ;; legal values: a legal path
target = docs/api target = docs/api
;; Which files should be parsed out as special documentation files, such as README, ;; Which files should be parsed out as special documentation files, such as README,
;; INSTALL and CHANGELOG? This overrides the default files found in ;; INSTALL and CHANGELOG? This overrides the default files found in
;; phpDocumentor.ini (this file is not a user .ini file, but the global file) ;; phpDocumentor.ini (this file is not a user .ini file, but the global file)
readmeinstallchangelog = README, INSTALL, CHANGELOG, NEWS, FAQ, LICENSE readmeinstallchangelog = README, INSTALL, CHANGELOG, NEWS, FAQ, LICENSE
;; limit output to the specified packages, even if others are parsed ;; limit output to the specified packages, even if others are parsed
;; legal values: package names separated by commas ;; legal values: package names separated by commas
;packageoutput = package1,package2 ;packageoutput = package1,package2
packageoutput = davical,awl packageoutput = davical,awl
;; comma-separated list of files to parse ;; comma-separated list of files to parse
;; legal values: paths separated by commas ;; legal values: paths separated by commas
;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory ;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory
;; comma-separated list of directories to parse ;; comma-separated list of directories to parse
;; legal values: directory paths separated by commas ;; legal values: directory paths separated by commas
;directory = /path1,/path2,.,..,subdirectory ;directory = /path1,/path2,.,..,subdirectory
;directory = /home/jeichorn/cvs/pear ;directory = /home/jeichorn/cvs/pear
directory = inc,htdocs directory = inc,htdocs
;; template base directory (the equivalent directory of <installdir>/phpDocumentor) ;; template base directory (the equivalent directory of <installdir>/phpDocumentor)
;templatebase = /path/to/my/templates ;templatebase = /path/to/my/templates
;; directory to find any example files in through @example and {@example} tags ;; directory to find any example files in through @example and {@example} tags
;examplesdir = /path/to/my/templates ;examplesdir = /path/to/my/templates
examplesdir = examples examplesdir = examples
;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore ;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore
;; legal values: any wildcard strings separated by commas ;; legal values: any wildcard strings separated by commas
;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/ ;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/
ignore = htdocs/css/,htdocs/images/,htdocs/js/, ignore = htdocs/css/,htdocs/images/,htdocs/js/,
;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format ;; 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, ;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,
;; HTML:frames:earthli, ;; HTML:frames:earthli,
;; HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de, ;; HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,
;; HTML:frames:DOM/phphtmllib,HTML:frames:DOM/earthli ;; HTML:frames:DOM/phphtmllib,HTML:frames:DOM/earthli
;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS ;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS
;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default ;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default
output=HTML:frames:earthli output=HTML:frames:earthli
;; turn this option on if you want highlighted source code for every file ;; turn this option on if you want highlighted source code for every file
;; legal values: on/off ;; legal values: on/off
sourcecode = off sourcecode = off

View File

@ -1,251 +1,251 @@
* { * {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
} }
body { body {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
background-color: #FFFFFF; background-color: #FFFFFF;
color: #333333; color: #333333;
} }
hr { hr {
height: 0.4em; height: 0.4em;
width: 100%; width: 100%;
background-color: #000000; background-color: #000000;
border: none; border: none;
color:#000000; color:#000000;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
#pageContainer { #pageContainer {
width: 740px; width: 740px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
#header { #header {
width: 740px; width: 740px;
height: 80px; height: 80px;
background: url(images/logo.gif) #bb1f1f no-repeat center left; background: url(images/logo.gif) #bb1f1f no-repeat center left;
margin-top: 10px; margin-top: 10px;
border-bottom: #d2d2d2 solid 5px; border-bottom: #d2d2d2 solid 5px;
text-align: right; text-align: right;
margin-bottom: 20px; margin-bottom: 20px;
} }
#headerLinks { #headerLinks {
color: #FFFFFF; color: #FFFFFF;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 80%; font-size: 80%;
padding-top: 64px; padding-top: 64px;
padding-right: 5px; padding-right: 5px;
display:block; display:block;
text-decoration: none; text-decoration: none;
} }
.hlink { .hlink {
color: #FFFFFF; color: #FFFFFF;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 80%; font-size: 80%;
text-decoration: none; text-decoration: none;
} }
.hlink:link, .hlink:active, .hlink:visited { .hlink:link, .hlink:active, .hlink:visited {
color: #FFFFFF; color: #FFFFFF;
} }
.hlink:hover { .hlink:hover {
color: #FFFFFF; color: #FFFFFF;
text-decoration: underline; text-decoration: underline;
} }
#pageContent { #pageContent {
/* Not used for anything at present */ /* Not used for anything at present */
} }
h1 { h1 {
color: #600000; color: #600000;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 135%; font-size: 135%;
margin-top: 1em; margin-top: 1em;
margin-bottom: 0.3em; margin-bottom: 0.3em;
} }
h2, h3 { h2, h3 {
color: black; color: black;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 115%; font-size: 115%;
margin-top: 1em; margin-top: 1em;
margin-bottom: 0.3em; margin-bottom: 0.3em;
} }
h3 { h3 {
font-size: 100%; font-size: 100%;
} }
.showcase { .showcase {
margin: 2px; margin: 2px;
padding: 2px; padding: 2px;
border: 2px #000000 solid; border: 2px #000000 solid;
} }
p { p {
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 90%; font-size: 90%;
margin-bottom: 20px; margin-bottom: 20px;
} }
ol, ul { ol, ul {
margin-bottom: 20px; margin-bottom: 20px;
} }
ul { ul {
list-style-type: square; list-style-type: square;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
} }
li { li {
list-style-position: outside; list-style-position: outside;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 90%; font-size: 90%;
margin: 0.1em 2em; margin: 0.1em 2em;
} }
code { code {
font-family: courier, courier new, fixed; font-family: courier, courier new, fixed;
font-size: inherit; font-size: inherit;
} }
pre { pre {
font-family: courier, courier new, fixed; font-family: courier, courier new, fixed;
font-size: 90%; font-size: 90%;
padding: 1em; padding: 1em;
margin-bottom: 1em; margin-bottom: 1em;
background-color: #eee; background-color: #eee;
} }
#footer { #footer {
clear: both; clear: both;
width: 740px; width: 740px;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 80%; font-size: 80%;
border-top: 2px #000000 solid; border-top: 2px #000000 solid;
} }
#title { #title {
float: left; float: left;
color: #FFFFFF; color: #FFFFFF;
padding-left: 100px; padding-left: 100px;
margin-top: 1px; margin-top: 1px;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 190%; font-size: 190%;
} }
#subTitle { #subTitle {
float: left; float: left;
clear: left; clear: left;
color: #FFFFFF; color: #FFFFFF;
padding-left: 102px; padding-left: 102px;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 75%; font-size: 75%;
} }
.right { .right {
float: right; float: right;
margin: 0px; margin: 0px;
} }
.left { .left {
float: left; float: left;
margin: 0px; margin: 0px;
} }
.flink:link { .flink:link {
color: #333333; color: #333333;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 80%; font-size: 80%;
text-decoration: none; text-decoration: none;
vertical-align: text-top; vertical-align: text-top;
} }
.flink:active { .flink:active {
color: #333333; color: #333333;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 80%; font-size: 80%;
text-decoration: none; text-decoration: none;
vertical-align: text-top; vertical-align: text-top;
} }
.flink:hover { .flink:hover {
color: #333333; color: #333333;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 80%; font-size: 80%;
text-decoration: underline; text-decoration: underline;
vertical-align: text-top; vertical-align: text-top;
} }
.flink:visited { .flink:visited {
color: #333333; color: #333333;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 8pt; font-size: 8pt;
font-size: 80%; font-size: 80%;
text-decoration: none; text-decoration: none;
vertical-align: text-top; vertical-align: text-top;
} }
.gone { .gone {
width: 0.01em; width: 0.01em;
height: 0.01em; height: 0.01em;
} }
.prompt { .prompt {
font-weight: 700; font-weight: 700;
width: 4em; width: 4em;
} }
#leftSide { #leftSide {
width: 170px; width: 170px;
float: left; float: left;
} }
#leftSide p { #leftSide p {
text-align: center; text-align: center;
margin-bottom: 1em; margin-bottom: 1em;
padding:0.3em 0; padding:0.3em 0;
font-weight: bold; font-weight: bold;
background-color: #d2d2d2; background-color: #d2d2d2;
} }
#leftSide p.selected { #leftSide p.selected {
background-color: #bb1f1f; background-color: #bb1f1f;
color: white; color: white;
} }
#leftSide img { #leftSide img {
border: none; border: none;
} }
#leftSide a, #leftSide a:link, #leftSide a:hover, #leftSide a:active, #leftSide a:visited { #leftSide a, #leftSide a:link, #leftSide a:hover, #leftSide a:active, #leftSide a:visited {
text-decoration: none; text-decoration: none;
color: black; color: black;
} }
#leftSide a.selected, #leftSide a.selected:link, #leftSide a.selected:hover, #leftSide a.selected:active, #leftSide a.selected:visited { #leftSide a.selected, #leftSide a.selected:link, #leftSide a.selected:hover, #leftSide a.selected:active, #leftSide a.selected:visited {
text-decoration: none; text-decoration: none;
color: white; color: white;
} }
#rightSide { #rightSide {
width: 530px; width: 530px;
float: right; float: right;
} }

View File

@ -1,67 +1,67 @@
#logo { #logo {
height: 80px; height: 80px;
width: 99.9%; width: 99.9%;
background: url(images/logo.gif) #bb1f1f no-repeat center left; background: url(images/logo.gif) #bb1f1f no-repeat center left;
margin-left: 0px; margin-left: 0px;
margin-top: 0px; margin-top: 0px;
border-bottom: #d2d2d2 solid 5px; border-bottom: #d2d2d2 solid 5px;
text-align: right; text-align: right;
margin-bottom: 5px; margin-bottom: 5px;
font-family: helvetica, arial, serif; font-family: helvetica, arial, serif;
font-weight: normal; font-weight: normal;
font-size: 1em; font-size: 1em;
color: #FFFFFF; color: #FFFFFF;
display:block; display:block;
} }
#title { #title {
float: left; float: left;
color: #FFFFFF; color: #FFFFFF;
padding-left: 100px; padding-left: 100px;
margin-top: 10px; margin-top: 10px;
font-size: 190%; font-size: 190%;
} }
#subTitle { #subTitle {
float: left; float: left;
clear: left; clear: left;
color: #FFFFFF; color: #FFFFFF;
padding-left: 102px; padding-left: 102px;
padding-top: 3px; padding-top: 3px;
margin-top: 5px; margin-top: 5px;
font-size: 75%; font-size: 75%;
} }
#headerLinks { #headerLinks {
color: #FFFFFF; color: #FFFFFF;
font-family: helvetica, arial, sans-serif; font-family: helvetica, arial, sans-serif;
font-size: 65%; font-size: 65%;
padding-top: 60px; padding-top: 60px;
padding-right: 5px; padding-right: 5px;
} }
#headerLinks .hlink { #headerLinks .hlink {
color: #FFFFFF; color: #FFFFFF;
} }
#headerLinks .hlink:link { #headerLinks .hlink:link {
color: #FFFFFF; color: #FFFFFF;
text-decoration: none; text-decoration: none;
} }
#headerLinks .hlink:active { #headerLinks .hlink:active {
color: #FFFFFF; color: #FFFFFF;
text-decoration: none; text-decoration: none;
} }
#headerLinks .hlink:hover { #headerLinks .hlink:hover {
color: #FFFFFF; color: #FFFFFF;
text-decoration: underline; text-decoration: underline;
} }
#headerLinks .hlink:visited { #headerLinks .hlink:visited {
color: #FFFFFF; color: #FFFFFF;
} }

View File

@ -99,8 +99,8 @@ if ( ! ($request->IsPrincipal() || isset($request->collection) || $request->meth
@ob_flush(); exit(0); @ob_flush(); exit(0);
} }
} }
param_to_global('add_member','.*'); param_to_global('add_member','.*');
$add_member = isset($add_member); $add_member = isset($add_member);
switch ( $request->method ) { switch ( $request->method ) {
case 'OPTIONS': include_once('caldav-OPTIONS.php'); break; case 'OPTIONS': include_once('caldav-OPTIONS.php'); break;

View File

@ -25,9 +25,9 @@ function catch_setup_errors($errno , $errstr , $errfile , $errline , $errcontext
return true; return true;
} }
else if ( $errno == 256 ) { else if ( $errno == 256 ) {
// This will (probably) be a database connection error, which will throw an exception if we return. // This will (probably) be a database connection error, which will throw an exception if we return.
log_setup_error($errno , $errstr , $errfile , $errline); log_setup_error($errno , $errstr , $errfile , $errline);
return true; return true;
} }
if ( !headers_sent() ) header("Content-type: text/plain"); else echo "<pre>\n"; if ( !headers_sent() ) header("Content-type: text/plain"); else echo "<pre>\n";
try { try {
@ -207,7 +207,7 @@ catch( Exception $e ) {
return true; 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) ); $result->setDescription( sprintf(i18n('Stable: %s, We have: %s !'), $current_version, $c->version_string) );
} }
else { 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; return $result;

View File

@ -122,7 +122,7 @@ class CalDAVRequest
if ( !isset($this->options['allow_by_email']) ) $this->options['allow_by_email'] = false; if ( !isset($this->options['allow_by_email']) ) $this->options['allow_by_email'] = false;
if ( isset($_SERVER['HTTP_PREFER']) ) { 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') ) { else if ( isset($_SERVER['HTTP_BRIEF']) && (strtoupper($_SERVER['HTTP_BRIEF']) == 'T') ) {
$this->prefer = array( 'return-minimal'); $this->prefer = array( 'return-minimal');
@ -1268,9 +1268,9 @@ EOSQL;
exit(0); // Unecessary, but might clarify things exit(0); // Unecessary, but might clarify things
} }
public static function kill_on_exit() { public static function kill_on_exit() {
posix_kill( getmypid(), 28 ); posix_kill( getmypid(), 28 );
} }
/** /**
* Utility function we call when we have a simple status-based response to * 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 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()); @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' ); register_shutdown_function( 'CalDAVRequest::kill_on_exit' );
} }
exit(0); exit(0);
} }

View File

@ -35,7 +35,7 @@ EOSQL;
* We extend the AWL Session class. * We extend the AWL Session class.
*/ */
require('Session.php'); require('Session.php');
include_once('DAVResource.php'); include_once('DAVResource.php');
@Session::_CheckLogout(); @Session::_CheckLogout();
@ -101,26 +101,26 @@ class DAViCalSession extends Session
} }
/** /**
* Does the user have the privileges to do what is requested. * 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 $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 $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. * @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. * @return boolean Whether they do have one of those privileges against the specified path.
*/ */
function HavePrivilegeTo( $do_what, $path, $any = null ) { function HavePrivilegeTo( $do_what, $path, $any = null ) {
if ( $this->AllowedTo('Admin') ) return true; if ( $this->AllowedTo('Admin') ) return true;
if ( !isset($this->privilege_resources[$path]) ) { if ( !isset($this->privilege_resources[$path]) ) {
$this->privilege_resources[$path] = new DAVResource($path); $this->privilege_resources[$path] = new DAVResource($path);
} }
$resource = $this->privilege_resources[$path]; $resource = $this->privilege_resources[$path];
if ( isset($resource) && $resource->Exists() ) { if ( isset($resource) && $resource->Exists() ) {
return $resource->HavePrivilegeTo($do_what,$any); return $resource->HavePrivilegeTo($do_what,$any);
} }
return false; return false;
} }
/** /**
* Checks that this user is logged in, and presents a login screen if they aren't. * Checks that this user is logged in, and presents a login screen if they aren't.

View File

@ -450,33 +450,33 @@ EOSQL;
*/ */
public function whatChangedSince( $some_old_token ) { public function whatChangedSince( $some_old_token ) {
$params = array( ':collection_id' => $this->collection_id() ); $params = array( ':collection_id' => $this->collection_id() );
if ( $some_old_token == 0 || empty($some_old_token) ) { if ( $some_old_token == 0 || empty($some_old_token) ) {
$sql = <<<EOSQL $sql = <<<EOSQL
SELECT calendar_item.*, caldav_data.*, addressbook_resource.*, 201 AS sync_status, SELECT calendar_item.*, caldav_data.*, addressbook_resource.*, 201 AS sync_status,
COALESCE(addressbook_resource.uid,calendar_item.uid) AS uid COALESCE(addressbook_resource.uid,calendar_item.uid) AS uid
FROM caldav_data FROM caldav_data
LEFT JOIN calendar_item USING (dav_id) LEFT JOIN calendar_item USING (dav_id)
LEFT JOIN addressbook_resource USING (dav_id) LEFT JOIN addressbook_resource USING (dav_id)
WHERE caldav_data.collection_id = :collection_id WHERE caldav_data.collection_id = :collection_id
ORDER BY caldav_data.collection_id, caldav_data.dav_id ORDER BY caldav_data.collection_id, caldav_data.dav_id
EOSQL; EOSQL;
} }
else { else {
$params[':sync_token'] = $some_old_token; $params[':sync_token'] = $some_old_token;
$sql = <<<EOSQL $sql = <<<EOSQL
SELECT calendar_item.*, caldav_data.*, addressbook_resource.*, sync_changes.*, SELECT calendar_item.*, caldav_data.*, addressbook_resource.*, sync_changes.*,
COALESCE(addressbook_resource.uid,calendar_item.uid) AS uid COALESCE(addressbook_resource.uid,calendar_item.uid) AS uid
FROM sync_changes FROM sync_changes
LEFT JOIN caldav_data USING (collection_id,dav_id) LEFT JOIN caldav_data USING (collection_id,dav_id)
LEFT JOIN calendar_item USING (collection_id,dav_id) LEFT JOIN calendar_item USING (collection_id,dav_id)
LEFT JOIN addressbook_resource USING (dav_id) LEFT JOIN addressbook_resource USING (dav_id)
WHERE sync_changes.collection_id = :collection_id WHERE sync_changes.collection_id = :collection_id
AND sync_time >= (SELECT modification_time FROM sync_tokens WHERE sync_token = :sync_token) 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 ORDER BY sync_changes.collection_id, sync_changes.dav_id, sync_changes.sync_time
EOSQL; EOSQL;
} }
$qry = new AwlQuery($sql, $params ); $qry = new AwlQuery($sql, $params );
$changes = array(); $changes = array();
if ( $qry->Exec('WritableCollection') && $qry->rows() ) { if ( $qry->Exec('WritableCollection') && $qry->rows() ) {

View File

@ -99,9 +99,9 @@ else {
$request->PreconditionFailed(403,'DAV::binding-allowed',translate('DAViCal only allows BIND requests for collections at present.')); $request->PreconditionFailed(403,'DAV::binding-allowed',translate('DAViCal only allows BIND requests for collections at present.'));
} }
if ( $source->IsBinding() ) if ( $source->IsBinding() )
$source = new DAVResource( $source->bound_from() ); $source = new DAVResource( $source->bound_from() );
/* /*
bind_id INT8 DEFAULT nextval('dav_id_seq') PRIMARY KEY, bind_id INT8 DEFAULT nextval('dav_id_seq') PRIMARY KEY,

View File

@ -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("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("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 ) ) { && $qry->QDo("DELETE FROM caldav_data WHERE dav_id = :dav_id", $params ) ) {
if ( function_exists('log_caldav_action') ) { if ( function_exists('log_caldav_action') ) {
log_caldav_action( 'DELETE', $dav_resource->GetProperty('uid'), $dav_resource->GetProperty('user_no'), $collection_id, $request->path ); log_caldav_action( 'DELETE', $dav_resource->GetProperty('uid'), $dav_resource->GetProperty('user_no'), $collection_id, $request->path );
} }
$qry->Commit(); $qry->Commit();
@dbg_error_log( "DELETE", "DELETE: User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path); @dbg_error_log( "DELETE", "DELETE: User: %d, ETag: %s, Path: %s", $session->user_no, $request->etag_if_match, $request->path);

View File

@ -76,10 +76,10 @@ function export_iCalendar( DAVResource $dav_resource ) {
$vcal->AddProperty("X-WR-CALNAME", $displayname); $vcal->AddProperty("X-WR-CALNAME", $displayname);
} }
if ( !empty($c->auto_refresh_duration) ) { 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("AUTO-REFRESH", $c->auto_refresh_duration);
$vcal->AddProperty("X-PUBLISHED-TTL", $c->auto_refresh_duration); $vcal->AddProperty("X-PUBLISHED-TTL", $c->auto_refresh_duration);
} }
$need_zones = array(); $need_zones = array();
$timezones = array(); $timezones = array();

View File

@ -65,7 +65,7 @@ if ( isset($request->xml_tags) ) {
foreach( $setprops AS $k => $setting ) { foreach( $setprops AS $k => $setting ) {
$tag = $setting->GetNSTag(); $tag = $setting->GetNSTag();
$content = $setting->RenderContent(0,null,true); $content = $setting->RenderContent(0,null,true);
dbg_error_log( 'MKCOL', 'Processing tag "%s"', $tag); dbg_error_log( 'MKCOL', 'Processing tag "%s"', $tag);

View File

@ -15,14 +15,14 @@ include_once('caldav-PUT-functions.php');
include_once('freebusy-functions.php'); include_once('freebusy-functions.php');
include_once('iSchedule.php'); include_once('iSchedule.php');
if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['post'])) ) { if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['post'])) ) {
$fh = fopen('/tmp/POST.txt','w'); $fh = fopen('/tmp/POST.txt','w');
if ( $fh ) { if ( $fh ) {
fwrite($fh,$request->raw_post); fwrite($fh,$request->raw_post);
fclose($fh); fclose($fh);
} }
} }
function handle_freebusy_request( $ic ) { function handle_freebusy_request( $ic ) {
global $c, $session, $request, $ical; global $c, $session, $request, $ical;

View File

@ -45,7 +45,7 @@ $rmprops = $xmltree->GetPath("/DAV::propertyupdate/DAV::remove/DAV::prop/*");
$failure = array(); $failure = array();
$success = array(); $success = array();
$reply = new XMLDocument( array( 'DAV:' => '') ); $reply = new XMLDocument( array( 'DAV:' => '') );
/** /**
* Small utility function to add propstat for one failure * Small utility function to add propstat for one failure
@ -55,19 +55,19 @@ $reply = new XMLDocument( array( 'DAV:' => '') );
* @param unknown_type $error_tag * @param unknown_type $error_tag
*/ */
function add_failure( $type, $tag, $status, $description=null, $error_tag = null) { function add_failure( $type, $tag, $status, $description=null, $error_tag = null) {
global $failure, $reply; global $failure, $reply;
$prop = new XMLElement('prop'); $prop = new XMLElement('prop');
$reply->NSElement($prop, $tag); $reply->NSElement($prop, $tag);
$propstat = array($prop,new XMLElement( 'status', $status )); $propstat = array($prop,new XMLElement( 'status', $status ));
if ( isset($description)) if ( isset($description))
$propstat[] = new XMLElement( 'responsedescription', $description ); $propstat[] = new XMLElement( 'responsedescription', $description );
if ( isset($error_tag) ) if ( isset($error_tag) )
$propstat[] = new XMLElement( 'error', new XMLElement( $error_tag ) ); $propstat[] = new XMLElement( 'error', new XMLElement( $error_tag ) );
$failure[$type.'-'.$tag] = new XMLElement('propstat', $propstat ); $failure[$type.'-'.$tag] = new XMLElement('propstat', $propstat );
} }
/** /**
* Not much for it but to process the incoming settings in a big loop, doing * 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; $success[$tag] = 1;
} }
else if ( $setcalendar && $setaddressbook ) { else if ( $setcalendar && $setaddressbook ) {
add_failure('set', $tag, 'HTTP/1.1 409 Conflict', add_failure('set', $tag, 'HTTP/1.1 409 Conflict',
translate("A collection may not be both a calendar and an addressbook.")); translate("A collection may not be both a calendar and an addressbook."));
} }
else if ( $setother ) { else if ( $setother ) {
add_failure('set', $tag, 'HTTP/1.1 403 Forbidden', add_failure('set', $tag, 'HTTP/1.1 403 Forbidden',
@ -285,20 +285,20 @@ foreach( $rmprops AS $k => $setting ) {
*/ */
if ( count($failure) > 0 ) { if ( count($failure) > 0 ) {
$qry->Rollback(); $qry->Rollback();
$url = ConstructURL($request->path); $url = ConstructURL($request->path);
$multistatus = new XMLElement('multistatus'); $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)); array_unshift($failure,new XMLElement('href', $url));
$response = $reply->DAVElement($multistatus,'response', $failure); $response = $reply->DAVElement($multistatus,'response', $failure);
if ( !empty($success) ) { if ( !empty($success) ) {
$prop = new XMLElement('prop'); $prop = new XMLElement('prop');
foreach( $success AS $tag => $v ) { foreach( $success AS $tag => $v ) {
$reply->NSElement($prop, $tag); $reply->NSElement($prop, $tag);
} }
$reply->DAVElement($response, 'propstat', array( $prop, new XMLElement( 'status', 'HTTP/1.1 424 Failed Dependency' )) ); $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"' ); $request->DoResponse( 207, $reply->Render($multistatus), 'text/xml; charset="utf-8"' );
@ -334,7 +334,7 @@ if ( $qry->Commit() ) {
foreach( $success AS $tag => $v ) { foreach( $success AS $tag => $v ) {
$reply->NSElement($prop, $tag); $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); $url = ConstructURL($request->path);
array_unshift( $failure, new XMLElement('href', $url ) ); array_unshift( $failure, new XMLElement('href', $url ) );

View File

@ -20,7 +20,7 @@ require_once('vComponent.php');
require_once('vCalendar.php'); require_once('vCalendar.php');
require_once('WritableCollection.php'); require_once('WritableCollection.php');
include_once('iSchedule.php'); include_once('iSchedule.php');
include_once('RRule-v2.php'); include_once('RRule-v2.php');
$bad_events = null; $bad_events = null;
@ -842,8 +842,8 @@ INSERT INTO caldav_data ( user_no, dav_name, dav_etag, caldav_data, caldav_type,
EOSQL; EOSQL;
$dav_data_update = <<<EOSQL $dav_data_update = <<<EOSQL
UPDATE caldav_data SET user_no=:user_no, caldav_data=:dav_data, dav_etag=:etag, caldav_type=:caldav_type, logged_user=:session_user, UPDATE caldav_data SET user_no=:user_no, caldav_data=:dav_data, dav_etag=:etag, caldav_type=:caldav_type, logged_user=:session_user,
modified=current_timestamp WHERE collection_id=:collection_id AND dav_name=:dav_name modified=current_timestamp WHERE collection_id=:collection_id AND dav_name=:dav_name
EOSQL; EOSQL;
$calitem_insert = <<<EOSQL $calitem_insert = <<<EOSQL
@ -853,18 +853,18 @@ INSERT INTO calendar_item (user_no, dav_name, dav_id, dav_etag, uid, dtstamp, dt
:description, :rrule, :tzid, :modified, :url, :priority, :created, :due, :percent_complete, :status, :collection_id) :description, :rrule, :tzid, :modified, :url, :priority, :created, :due, :percent_complete, :status, :collection_id)
EOSQL; EOSQL;
$calitem_update = <<<EOSQL $calitem_update = <<<EOSQL
UPDATE calendar_item SET user_no=:user_no, dav_etag=:etag, uid=:uid, dtstamp=:dtstamp, UPDATE calendar_item SET user_no=:user_no, dav_etag=:etag, uid=:uid, dtstamp=:dtstamp,
dtstart=:dtstart, dtend=##dtend##, summary=:summary, location=:location, dtstart=:dtstart, dtend=##dtend##, summary=:summary, location=:location,
class=:class, transp=:transp, description=:description, rrule=:rrule, class=:class, transp=:transp, description=:description, rrule=:rrule,
tz_id=:tzid, last_modified=:modified, url=:url, priority=:priority, tz_id=:tzid, last_modified=:modified, url=:url, priority=:priority,
due=:due, percent_complete=:percent_complete, status=:status due=:due, percent_complete=:percent_complete, status=:status
WHERE collection_id=:collection_id AND dav_name=:dav_name WHERE collection_id=:collection_id AND dav_name=:dav_name
EOSQL; EOSQL;
$last_olson = ''; $last_olson = '';
if ( count($resources) > 0 ) if ( count($resources) > 0 )
$qry->QDo('SELECT new_sync_token(0,'.$collection_id.')'); $qry->QDo('SELECT new_sync_token(0,'.$collection_id.')');
foreach( $resources AS $uid => $resource ) { foreach( $resources AS $uid => $resource ) {
@ -885,10 +885,10 @@ EOSQL;
unset($current_data[$dav_name]); unset($current_data[$dav_name]);
$inserting = false; $inserting = false;
} }
else else
$sync_change = 201; $sync_change = 201;
if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Begin(); 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 */ /** As ever, we mostly deal with the first resource component */
$first = $resource[0]; $first = $resource[0];
@ -947,7 +947,7 @@ EOSQL;
$dtstart_prop = $first->GetProperty('DTSTART'); $dtstart_prop = $first->GetProperty('DTSTART');
if ( empty($dtstart_prop) ) { if ( empty($dtstart_prop) ) {
dbg_error_log('PUT','Invalid VEVENT without DTSTART, UID="%s" in collection %d', $uid, $collection_id); dbg_error_log('PUT','Invalid VEVENT without DTSTART, UID="%s" in collection %d', $uid, $collection_id);
continue; continue;
} }
$value_type = $dtstart_prop->GetParameterValue('VALUE'); $value_type = $dtstart_prop->GetParameterValue('VALUE');
dbg_error_log('PUT','DTSTART without DTEND. DTSTART value type is %s', $value_type ); dbg_error_log('PUT','DTSTART without DTEND. DTSTART value type is %s', $value_type );
@ -1024,13 +1024,13 @@ EOSQL;
write_alarms($dav_id, $first); write_alarms($dav_id, $first);
write_attendees($dav_id, $vcal); 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 ); do_scheduling_requests( $vcal, true );
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 ) $qry->Commit();
} }
if ( !$appending && count($current_data) > 0 ) { if ( !$appending && count($current_data) > 0 ) {
$params = array( ':collection_id' => $collection_id ); $params = array( ':collection_id' => $collection_id );
if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Begin(); if ( isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import ) $qry->Begin();
foreach( $current_data AS $dav_name => $data ) { foreach( $current_data AS $dav_name => $data ) {
@ -1039,7 +1039,7 @@ EOSQL;
$qry->QDo('SELECT write_sync_change(:collection_id, 404, :dav_name)', $params); $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 ) $qry->Commit();
} }
if ( !(isset($c->skip_bad_event_on_import) && $c->skip_bad_event_on_import) ) { 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); if ( ! $qry->Commit() ) rollback_on_error( $caldav_context, $user_no, $path);
@ -1341,7 +1341,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[':tzid'] = $tzid;
$calitem_params[':uid'] = $first->GetPValue('UID'); $calitem_params[':uid'] = $first->GetPValue('UID');
@ -1431,9 +1431,9 @@ EOSQL;
$qry->QDo("SELECT write_sync_change( $collection_id, $sync_change, :dav_name)", array(':dav_name' => $path ) ); $qry->QDo("SELECT write_sync_change( $collection_id, $sync_change, :dav_name)", array(':dav_name' => $path ) );
$qry->Commit(); $qry->Commit();
if ( function_exists('post_commit_action') ) { if ( function_exists('post_commit_action') ) {
post_commit_action( $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path ); post_commit_action( $put_action_type, $first->GetPValue('UID'), $user_no, $collection_id, $path );
} }
// Uncache anything to do with the collection // Uncache anything to do with the collection
$cache = getCacheInstance(); $cache = getCacheInstance();

View File

@ -14,12 +14,12 @@ require_once('DAVResource.php');
include_once('caldav-PUT-functions.php'); include_once('caldav-PUT-functions.php');
$vcalendar = new vCalendar( $request->raw_post ); $vcalendar = new vCalendar( $request->raw_post );
$uid = $vcalendar->GetUID(); $uid = $vcalendar->GetUID();
if ( empty($uid) ) { if ( empty($uid) ) {
$uid = uuid(); $uid = uuid();
$vcalendar->SetUID($uid); $vcalendar->SetUID($uid);
} }
if ( $add_member ) { if ( $add_member ) {
$request->path = $request->dav_name() . $uid . '.ics'; $request->path = $request->dav_name() . $uid . '.ics';
@ -76,7 +76,7 @@ if ( $dav_resource->IsCollection() ) {
$etag = md5($request->raw_post); $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'); $put_action_type = ($dav_resource->Exists() ? 'UPDATE' : 'INSERT');
$collection = $dav_resource->GetParentContainer(); $collection = $dav_resource->GetParentContainer();

View File

@ -22,20 +22,20 @@ if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || (isset($c->dbg['put'
$lock_opener = $request->FailIfLocked(); $lock_opener = $request->FailIfLocked();
require_once('vcard.php'); require_once('vcard.php');
$vcard = new vCard( $request->raw_post ); $vcard = new vCard( $request->raw_post );
$uid = $vcard->GetPValue('UID'); $uid = $vcard->GetPValue('UID');
if ( empty($uid) ) { if ( empty($uid) ) {
$uid = uuid(); $uid = uuid();
$vcard->AddProperty('UID',$uid); $vcard->AddProperty('UID',$uid);
} }
if ( $add_member ) { if ( $add_member ) {
$request->path = $request->dav_name() . $uid . '.vcf'; $request->path = $request->dav_name() . $uid . '.vcf';
$dest = new DAVResource($request->path); $dest = new DAVResource($request->path);
if ( $dest->Exists() ) { if ( $dest->Exists() ) {
$uid = uuid(); $uid = uuid();
$vcard->AddProperty('UID',$uid); $vcard->AddProperty('UID',$uid);
$request->path = $request->dav_name() . $uid . '.vcf'; $request->path = $request->dav_name() . $uid . '.vcf';
$dest = new DAVResource($request->path); $dest = new DAVResource($request->path);
if ( $dest->Exists() ) throw new Exception("Failed to generate unique segment name for add-member!"); 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; $params[':collection_id'] = $collection_id;
$response_code = 201; $response_code = 201;
$qry->QDo( $sql, $params ); $qry->QDo( $sql, $params );
$put_action_type = 'INSERT'; $put_action_type = 'INSERT';
$qry->QDo("SELECT currval('dav_id_seq') AS dav_id" ); $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() ) ); $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') ) { if ( isset($log_action) && $log_action && function_exists('log_caldav_action') ) {
log_caldav_action( $put_action_type, $uid, $user_no, $collection_id, $request->path ); log_caldav_action( $put_action_type, $uid, $user_no, $collection_id, $request->path );
} }
else if ( isset($log_action) && $log_action ) { else if ( isset($log_action) && $log_action ) {
dbg_error_log( 'PUT', 'No log_caldav_action( %s, %s, %s, %s, %s) can be called.', 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 ); $put_action_type, $uid, $user_no, $collection_id, $request->path );
} }
if ( !$qry->Commit() ) { if ( !$qry->Commit() ) {
$qry->Rollback(); $qry->Rollback();

View File

@ -318,7 +318,7 @@ if ( ! ($target_collection->IsCalendar() || $target_collection->IsSchedulingColl
} }
else { else {
$where = ' WHERE caldav_data.collection_id = ' . $target_collection->resource_id(); $where = ' WHERE caldav_data.collection_id = ' . $target_collection->resource_id();
$distinct = ''; $distinct = '';
} }
if ( is_array($qry_filters) ) { if ( is_array($qry_filters) ) {

View File

@ -41,7 +41,7 @@ switch( $proptype ) {
default: default:
$properties[$proptype] = 1; $properties[$proptype] = 1;
} }
if ( empty($properties) ) $properties['DAV::allprop'] = 1; if ( empty($properties) ) $properties['DAV::allprop'] = 1;
/** /**
* There can only be *one* FILTER element. * There can only be *one* FILTER element.

View File

@ -50,7 +50,7 @@ switch( $proptype ) {
default: default:
$properties[$proptype] = 1; $properties[$proptype] = 1;
} }
if ( empty($properties) ) $properties['DAV::allprop'] = 1; if ( empty($properties) ) $properties['DAV::allprop'] = 1;
$collection = new DAVResource($request->path); $collection = new DAVResource($request->path);
$bound_from = $collection->bound_from(); $bound_from = $collection->bound_from();

View File

@ -81,7 +81,7 @@ if ( $sync_token == $new_token ) {
} }
else { else {
$hide_older = ''; $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)"; $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 ) { if ( $sync_token == 0 ) {

View File

@ -189,11 +189,11 @@ function component_to_xml( $properties, $item ) {
if ( $need_resource ) { if ( $need_resource ) {
if ( !isset($dav_resource) ) $dav_resource = new DAVResource($item->dav_name); if ( !isset($dav_resource) ) $dav_resource = new DAVResource($item->dav_name);
$elements = $dav_resource->GetPropStat(array_keys($properties), $reply); $elements = $dav_resource->GetPropStat(array_keys($properties), $reply);
array_unshift($elements, $href); array_unshift($elements, $href);
} }
else { else {
$elements = array($href); $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) ); $elements[] = new XMLElement( "propstat", array( $prop, $status) );
if ( count($denied) > 0 ) { if ( count($denied) > 0 ) {
$status = new XMLElement("status", "HTTP/1.1 403 Forbidden" ); $status = new XMLElement("status", "HTTP/1.1 403 Forbidden" );
@ -224,7 +224,7 @@ if ( $target->IsExternal() ) {
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
$c->sync_resource_data_ok = true; $c->sync_resource_data_ok = true;
if ( $xmltree->GetNSTag() == "urn:ietf:params:xml:ns:caldav:calendar-query" ) { if ( $xmltree->GetNSTag() == "urn:ietf:params:xml:ns:caldav:calendar-query" ) {

View File

@ -1,107 +1,107 @@
<?php <?php
/** /**
* Manages PAM repository connection with local imap server help * Manages PAM repository connection with local imap server help
* *
* @package davical * @package davical
* @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
*/ */
// The PHP interpreter will die quietly unless satisfied. This provides user feedback instead. // The PHP interpreter will die quietly unless satisfied. This provides user feedback instead.
if (!function_exists('imap_open')) { if (!function_exists('imap_open')) {
die("drivers_imap_pam: php5-imap required."); die("drivers_imap_pam: php5-imap required.");
} }
require_once("auth-functions.php"); require_once("auth-functions.php");
class imapPamDrivers class imapPamDrivers
{ {
/**#@+ /**#@+
* @access private * @access private
*/ */
/**#@-*/ /**#@-*/
/** /**
* The constructor * The constructor
* *
* @param string $imap_url formated for imap_open() * @param string $imap_url formated for imap_open()
*/ */
function __construct($imap_url) function __construct($imap_url)
{ {
global $c; global $c;
if (empty($imap_url)){ if (empty($imap_url)){
$c->messages[] = sprintf(i18n('drivers_imap_pam : imap_url parameter not configured in /etc/davical/*-conf.php')); $c->messages[] = sprintf(i18n('drivers_imap_pam : imap_url parameter not configured in /etc/davical/*-conf.php'));
$this->valid=false; $this->valid=false;
return ; return ;
} }
} }
} }
/** /**
* Check the username / password against the PAM system * Check the username / password against the PAM system
*/ */
function IMAP_PAM_check($username, $password ){ function IMAP_PAM_check($username, $password ){
global $c; global $c;
$imap_username = $username; $imap_username = $username;
if ( function_exists('mb_convert_encoding') ) { if ( function_exists('mb_convert_encoding') ) {
$imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP",mb_detect_encoding($imap_username)); $imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP",mb_detect_encoding($imap_username));
} }
else { else {
$imap_username = imap_utf7_encode($imap_username); $imap_username = imap_utf7_encode($imap_username);
} }
//$imap_url = '{localhost:143/imap/notls}'; //$imap_url = '{localhost:143/imap/notls}';
//$imap_url = '{localhost:993/imap/ssl/novalidate-cert}'; //$imap_url = '{localhost:993/imap/ssl/novalidate-cert}';
$imap_url = $c->authenticate_hook['config']['imap_url']; $imap_url = $c->authenticate_hook['config']['imap_url'];
$auth_result = "ERR"; $auth_result = "ERR";
$imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN); $imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN);
//print_r(imap_errors()); //print_r(imap_errors());
if ( $imap_stream ) { if ( $imap_stream ) {
// disconnect // disconnect
imap_close($imap_stream); imap_close($imap_stream);
// login ok // login ok
$auth_result = "OK"; $auth_result = "OK";
} }
if ( $auth_result == "OK") { if ( $auth_result == "OK") {
$principal = new Principal('username',$username); $principal = new Principal('username',$username);
if ( ! $principal->Exists() ) { if ( ! $principal->Exists() ) {
dbg_error_log( "PAM", "Principal '%s' doesn't exist in local DB, we need to create it",$username ); dbg_error_log( "PAM", "Principal '%s' doesn't exist in local DB, we need to create it",$username );
$cmd = "getent passwd '$username'"; $cmd = "getent passwd '$username'";
$getent_res = exec($cmd); $getent_res = exec($cmd);
$getent_arr = explode(":", $getent_res); $getent_arr = explode(":", $getent_res);
$fullname = $getent_arr[4]; $fullname = $getent_arr[4];
if(empty($fullname)) { if(empty($fullname)) {
$fullname = $username; $fullname = $username;
} }
$principal->Create( array( $principal->Create( array(
'username' => $username, 'username' => $username,
'user_active' => true, 'user_active' => true,
'email' => $username . "@" . $c->authenticate_hook['config']['email_base'], 'email' => $username . "@" . $c->authenticate_hook['config']['email_base'],
'modified' => date('c'), 'modified' => date('c'),
'fullname' => $fullname 'fullname' => $fullname
)); ));
if ( ! $principal->Exists() ) { if ( ! $principal->Exists() ) {
dbg_error_log( "PAM", "Unable to create local principal for '%s'", $username ); dbg_error_log( "PAM", "Unable to create local principal for '%s'", $username );
return false; return false;
} }
CreateHomeCalendar($username); CreateHomeCalendar($username);
} }
return $principal; return $principal;
} }
else { else {
dbg_error_log( "PAM", "User %s is not a valid username (or password was wrong)", $username ); dbg_error_log( "PAM", "User %s is not a valid username (or password was wrong)", $username );
return false; return false;
} }
} }

View File

@ -295,19 +295,19 @@ function sync_user_from_LDAP( Principal &$principal, $mapping, $ldap_values ) {
} }
} }
/* /*
* explode the multipart mapping * explode the multipart mapping
*/ */
function array_values_mapping($mapping){ function array_values_mapping($mapping){
$attributes=array(); $attributes=array();
foreach ( $mapping as $field ) { foreach ( $mapping as $field ) {
$tab_part_field = explode(",",$field); $tab_part_field = explode(",",$field);
foreach( $tab_part_field as $part_field ) { foreach( $tab_part_field as $part_field ) {
$attributes[] = $part_field; $attributes[] = $part_field;
} }
} }
return $attributes; return $attributes;
} }
/** /**
* Check the username / password against the LDAP server * Check the username / password against the LDAP server

View File

@ -1,112 +1,112 @@
<?php <?php
/** /**
* Manages PAM repository connection with local imap server help * Manages PAM repository connection with local imap server help
* *
* @package davical * @package davical
* @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
*/ */
require_once("auth-functions.php"); require_once("auth-functions.php");
class imapPamDrivers class imapPamDrivers
{ {
/**#@+ /**#@+
* @access private * @access private
*/ */
/**#@-*/ /**#@-*/
/** /**
* Constructor. * Constructor.
* @param string $imap_url formated for imap_open() * @param string $imap_url formated for imap_open()
*/ */
function imapPamDrivers($imap_url){ function imapPamDrivers($imap_url){
$this->__construct($imap_url); $this->__construct($imap_url);
} }
/** /**
* The constructor * The constructor
* *
* @param string $imap_url formated for imap_open() * @param string $imap_url formated for imap_open()
*/ */
function __construct($imap_url) function __construct($imap_url)
{ {
global $c; global $c;
if (empty($imap_url)){ if (empty($imap_url)){
$c->messages[] = sprintf(i18n('drivers_imap_pam : imap_url parameter not configured in /etc/davical/*-conf.php')); $c->messages[] = sprintf(i18n('drivers_imap_pam : imap_url parameter not configured in /etc/davical/*-conf.php'));
$this->valid=false; $this->valid=false;
return ; return ;
} }
} }
} }
/** /**
* Check the username / password against the IMAP server * Check the username / password against the IMAP server
*/ */
function RIMAP_check($username, $password ){ function RIMAP_check($username, $password ){
global $c; global $c;
$imap_username = $username; $imap_username = $username;
if ( function_exists('mb_convert_encoding') ) { if ( function_exists('mb_convert_encoding') ) {
$imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP",mb_detect_encoding($imap_username)); $imap_username = mb_convert_encoding($imap_username, "UTF7-IMAP",mb_detect_encoding($imap_username));
} }
else { else {
$imap_username = imap_utf7_encode($imap_username); $imap_username = imap_utf7_encode($imap_username);
} }
//$imap_url = '{localhost:143/imap/notls}'; //$imap_url = '{localhost:143/imap/notls}';
//$imap_url = '{localhost:993/imap/ssl/novalidate-cert}'; //$imap_url = '{localhost:993/imap/ssl/novalidate-cert}';
$imap_url = $c->authenticate_hook['config']['imap_url']; $imap_url = $c->authenticate_hook['config']['imap_url'];
$auth_result = "ERR"; $auth_result = "ERR";
$imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN); $imap_stream = @imap_open($imap_url, $imap_username, $password, OP_HALFOPEN);
//print_r(imap_errors()); //print_r(imap_errors());
if ( $imap_stream ) { if ( $imap_stream ) {
// disconnect // disconnect
imap_close($imap_stream); imap_close($imap_stream);
// login ok // login ok
$auth_result = "OK"; $auth_result = "OK";
} }
if ( $auth_result == "OK") { if ( $auth_result == "OK") {
$principal = new Principal('username',$username); $principal = new Principal('username',$username);
if ( ! $principal->Exists() ) { if ( ! $principal->Exists() ) {
dbg_error_log( "PAM", "Principal '%s' doesn't exist in local DB, we need to create it",$username ); dbg_error_log( "PAM", "Principal '%s' doesn't exist in local DB, we need to create it",$username );
if ( strstr($username, '@') ) { if ( strstr($username, '@') ) {
$name_arr = explode('@', $username); $name_arr = explode('@', $username);
$fullname = ucfirst(strtolower($name_arr[0])); $fullname = ucfirst(strtolower($name_arr[0]));
$email = $username; $email = $username;
} }
else { else {
$fullname = ucfirst(strtolower($username)); $fullname = ucfirst(strtolower($username));
$email = $username . "@" . $c->authenticate_hook['config']['email_base']; $email = $username . "@" . $c->authenticate_hook['config']['email_base'];
} }
$principal->Create( array( $principal->Create( array(
'username' => $username, 'username' => $username,
'user_active' => true, 'user_active' => true,
'email' => $email, 'email' => $email,
'fullname' => ucfirst($fullname) 'fullname' => ucfirst($fullname)
)); ));
if ( ! $principal->Exists() ) { if ( ! $principal->Exists() ) {
dbg_error_log( "PAM", "Unable to create local principal for '%s'", $username ); dbg_error_log( "PAM", "Unable to create local principal for '%s'", $username );
return false; return false;
} }
CreateHomeCollections($username); CreateHomeCollections($username);
} }
return $principal; return $principal;
} }
else { else {
dbg_error_log( "PAM", "User %s is not a valid username (or password was wrong)", $username ); dbg_error_log( "PAM", "User %s is not a valid username (or password was wrong)", $username );
return false; return false;
} }
} }

View File

@ -177,7 +177,7 @@ function doItipAttendeeReply( vCalendar $resource, $partstat ) {
} }
} }
else { 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()); $email->Pretend($mime->getMimeHeaders());
} }
else if ( !isset($c->iMIP->send_email) || !$c->iMIP->send_email) { else if ( !isset($c->iMIP->send_email) || !$c->iMIP->send_email) {
$email->PretendLog($mime->getMimeHeaders()); $email->PretendLog($mime->getMimeHeaders());
} }
else { else {
$email->Send($mime->getMimeHeaders()); $email->Send($mime->getMimeHeaders());
} }
} }

View File

@ -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', 'title', translate('Upload an iCalendar file or VCard file to replace this collection.'));
$editor->AddAttribute('ics_file', 'id', 'fld_ics_file'); $editor->AddAttribute('ics_file', 'id', 'fld_ics_file');
$editor->AddField('mode', 'FALSE'); $editor->AddField('mode', 'FALSE');
$editor->AddAttribute('mode', 'title', translate('Should the uploaded entries be appended to the collection?')); $editor->AddAttribute('mode', 'title', translate('Should the uploaded entries be appended to the collection?'));
$editor->AddAttribute('mode', '_label', translate('Append')); $editor->AddAttribute('mode', '_label', translate('Append'));
$editor->AddAttribute('mode', 'id', 'fld_mode'); $editor->AddAttribute('mode', 'id', 'fld_mode');
$editor->SetWhere( 'collection_id='.$id ); $editor->SetWhere( 'collection_id='.$id );

View File

@ -32,8 +32,8 @@ $can_write_principal = ($session->AllowedTo('Admin') || ($session->principal_id
if ( !$can_write_principal && $id > 0 ) { if ( !$can_write_principal && $id > 0 ) {
$target_principal = new Principal('principal_id', $id); $target_principal = new Principal('principal_id', $id);
$can_write_principal = $session->HavePrivilegeTo('DAV::write', $target_principal->dav_name()); $can_write_principal = $session->HavePrivilegeTo('DAV::write', $target_principal->dav_name());
} }
$delete_collection_confirmation_required = null; $delete_collection_confirmation_required = null;
$delete_principal_confirmation_required = null; $delete_principal_confirmation_required = null;
@ -624,7 +624,7 @@ function edit_grant_row( $row_data ) {
} }
else { else {
$grantrow->Initialise( $row_data ); $grantrow->Initialise( $row_data );
} }
$privs_html = build_privileges_html( $grantrow, 'grant_privileges' ); $privs_html = build_privileges_html( $grantrow, 'grant_privileges' );