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
This commit is contained in:
Christoph Anton Mitterer 2013-03-20 00:48:02 +01:00 committed by Andrew McMillan
parent 92c15bed64
commit 8e60bb3124
30 changed files with 813 additions and 794 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>
* 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.
*/
$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');

View File

@ -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 <installdir>/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 <installdir>/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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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 "<pre>\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;

View File

@ -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);
}

View File

@ -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.

View File

@ -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 = <<<EOSQL
if ( $some_old_token == 0 || empty($some_old_token) ) {
$sql = <<<EOSQL
SELECT calendar_item.*, caldav_data.*, addressbook_resource.*, 201 AS sync_status,
COALESCE(addressbook_resource.uid,calendar_item.uid) AS uid
FROM caldav_data
LEFT JOIN calendar_item USING (dav_id)
LEFT JOIN addressbook_resource USING (dav_id)
WHERE caldav_data.collection_id = :collection_id
ORDER BY caldav_data.collection_id, caldav_data.dav_id
EOSQL;
}
LEFT JOIN calendar_item USING (dav_id)
LEFT JOIN addressbook_resource USING (dav_id)
WHERE caldav_data.collection_id = :collection_id
ORDER BY caldav_data.collection_id, caldav_data.dav_id
EOSQL;
}
else {
$params[':sync_token'] = $some_old_token;
$sql = <<<EOSQL
$params[':sync_token'] = $some_old_token;
$sql = <<<EOSQL
SELECT calendar_item.*, caldav_data.*, addressbook_resource.*, sync_changes.*,
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)
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() ) {

View File

@ -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,

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("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);

View File

@ -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();

View File

@ -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);

View File

@ -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;

View File

@ -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 ) );

View File

@ -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 = <<<EOSQL
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
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
EOSQL;
$calitem_insert = <<<EOSQL
@ -869,18 +869,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)
EOSQL;
$calitem_update = <<<EOSQL
UPDATE calendar_item SET user_no=:user_no, dav_etag=:etag, uid=:uid, dtstamp=:dtstamp,
dtstart=:dtstart, dtend=##dtend##, summary=:summary, location=:location,
class=:class, transp=:transp, description=:description, rrule=:rrule,
tz_id=:tzid, last_modified=:modified, url=:url, priority=:priority,
due=:due, percent_complete=:percent_complete, status=:status
WHERE collection_id=:collection_id AND dav_name=:dav_name
EOSQL;
$calitem_update = <<<EOSQL
UPDATE calendar_item SET user_no=:user_no, dav_etag=:etag, uid=:uid, dtstamp=:dtstamp,
dtstart=:dtstart, dtend=##dtend##, summary=:summary, location=:location,
class=:class, transp=:transp, description=:description, rrule=:rrule,
tz_id=:tzid, last_modified=:modified, url=:url, priority=:priority,
due=:due, percent_complete=:percent_complete, status=:status
WHERE collection_id=:collection_id AND dav_name=:dav_name
EOSQL;
$last_olson = '';
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 ) {
@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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) ) {

View File

@ -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.

View File

@ -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();

View File

@ -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 ) {

View File

@ -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" ) {

View File

@ -1,107 +1,107 @@
<?php
/**
* Manages PAM repository connection with local imap server help
*
* @package davical
* @category Technical
* @subpackage ldap
* @author Oliver Schulze <oliver@samera.com.py>,
* Andrew McMillan <andrew@mcmillan.net.nz>
* @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;
}
}
<?php
/**
* Manages PAM repository connection with local imap server help
*
* @package davical
* @category Technical
* @subpackage ldap
* @author Oliver Schulze <oliver@samera.com.py>,
* Andrew McMillan <andrew@mcmillan.net.nz>
* @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;
}
}

View File

@ -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

View File

@ -1,112 +1,112 @@
<?php
/**
* Manages PAM repository connection with local imap server help
*
* @package davical
* @category Technical
* @subpackage ldap
* @author Oliver Schulze <oliver@samera.com.py>,
* Andrew McMillan <andrew@mcmillan.net.nz>
* @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;
}
}
<?php
/**
* Manages PAM repository connection with local imap server help
*
* @package davical
* @category Technical
* @subpackage ldap
* @author Oliver Schulze <oliver@samera.com.py>,
* Andrew McMillan <andrew@mcmillan.net.nz>
* @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;
}
}

View File

@ -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());
}
}
}

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', '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 );

View File

@ -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' );