Skip to content

Commit

Permalink
upgrade from CardDavMATE 0.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jfroffice committed Apr 30, 2012
1 parent a2ba608 commit 9d5fc92
Show file tree
Hide file tree
Showing 30 changed files with 1,828 additions and 467 deletions.
31 changes: 18 additions & 13 deletions auth/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,26 @@
for($j=0;$j<$level;$j++)
$result.=" ";

$result.="<".htmlspecialchars($k);
if($k=='resource')
$result.=" xmlns=\"urn:com.inf-it:configuration\"";
$result.=">";
if(is_array($v))
{
$result.="\n";
array_to_xml($v,$level+1);
for($j=0;$j<$level;$j++)
$result.=" ";
}
if(is_numeric($k))
array_to_xml($v,$level);
else
$result.=htmlspecialchars($v);
{
$result.="<".htmlspecialchars($k);
if($k=='resource')
$result.=" xmlns=\"urn:com.inf-it:configuration\"";
$result.=">";
if(is_array($v))
{
$result.="\n";
array_to_xml($v,$level+1);
for($j=0;$j<$level;$j++)
$result.=" ";
}
else
$result.=htmlspecialchars($v);

$result.="</".htmlspecialchars($k).">\n";
$result.="</".htmlspecialchars($k).">\n";
}
}
return $result;
}
Expand Down
51 changes: 35 additions & 16 deletions auth/config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,39 @@
$config['auth_send_authenticate_header']=false;

// successfull authentication XML specification (change the "http://www.server.com:80" to your protocol/server/port)
$config['accounts']=array(
'resource'=>array(
'carddav'=>array(
'href'=>'http://www.server.com:80/caldav.php/'.$_SERVER['PHP_AUTH_USER'].'/',
'crossdomain'=>'true', // set to true for different protocol/server/port origin
'withcredentials'=>'false', // if true, Access-Control-Allow-Origin "*" is not allowed
'userauth'=>array(
'username'=>$_SERVER['PHP_AUTH_USER'],
'password'=>$_SERVER['PHP_AUTH_PW']
),
'syncinterval'=>15000,
'timeout'=>10000,
'locktimeout'=>10000
)
$config['accounts']=array('resource'=>array());

$config['accounts']['resource'][]=array(
'carddav'=>array(
'href'=>'http://www.server.com:80/caldav.php/'.$_SERVER['PHP_AUTH_USER'].'/',
'crossdomain'=>'false', // set to true for different protocol/server/port origin
'withcredentials'=>'false', // if true, Access-Control-Allow-Origin "*" is not allowed
'userauth'=>array(
'username'=>$_SERVER['PHP_AUTH_USER'],
'password'=>$_SERVER['PHP_AUTH_PW']
),
'syncinterval'=>30000,
'timeout'=>30000,
'locktimeout'=>10000
)
);

/*
// additional carddav accounts
$config['accounts']['resource'][]=array(
'carddav'=>array(
'href'=>'http://www.server.com:80/caldav.php/shared_resource/',
'crossdomain'=>'false', // set to true for different protocol/server/port origin
'withcredentials'=>'false', // if true, Access-Control-Allow-Origin "*" is not allowed
'userauth'=>array(
'username'=>$_SERVER['PHP_AUTH_USER'],
'password'=>$_SERVER['PHP_AUTH_PW']
),
'syncinterval'=>30000,
'timeout'=>30000,
'locktimeout'=>10000
)
);
?>
);
*/

?>
6 changes: 3 additions & 3 deletions auth/doc/example_config_response.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<username>user</username>
<password>password</password>
</userauth>
<syncinterval>15000</syncinterval>
<syncinterval>30000</syncinterval>
<timeout>30000</timeout>
<locktimeout>10000</locktimeout>
</carddav>
Expand All @@ -19,7 +19,7 @@
<username>user</username>
<password>password</password>
</userauth>
<syncinterval>15000</syncinterval>
<syncinterval>30000</syncinterval>
<timeout>30000</timeout>
<locktimeout>10000</locktimeout>
</carddav>
Expand All @@ -31,7 +31,7 @@
<username>user</username>
<password>password</password>
</userauth>
<syncinterval>15000</syncinterval>
<syncinterval>30000</syncinterval>
<timeout>30000</timeout>
<locktimeout>10000</locktimeout>
</carddav>
Expand Down
2 changes: 1 addition & 1 deletion auth/plugins/generic.inc
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@
}
return 0; // Empty username or password
}
?>
?>
2 changes: 1 addition & 1 deletion auth/plugins/generic_conf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
//$pluginconfig['request']='/principals/users';

$pluginconfig['timeout']=15;
?>
?>
2 changes: 1 addition & 1 deletion auth/plugins/ldap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
}
return 0; // Empty username or password
}
?>
?>
2 changes: 1 addition & 1 deletion auth/plugins/ldap_conf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

// optional
$pluginconfig['filter']='accountStatus=active';
?>
?>
23 changes: 23 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
CardDavMATE Changelog

version 0.9.6 [2012-04-25]:
- note: if you use Davical with cross-domain setup see the modified Apache configuration in misc/config_davical.txt (solved problem with CardDAV-Sync from Marten Gajda)
- note: if you use MacOS X Lion calendarserver it is recommended to re-patch your installation (see misc/readme_lion.txt and the changelog below)
- configuration - changed default syncInterval from 15000 to 30000
- added support for automatic detection of crossDomain option in globalAccountSettings, globalNetworkCheckSettings and globalNetworkAccountSettings (if not set to boolean true/false it is automatically detected; default is null - autodetect)
- added IE9+ support (non cross-domain setup only /IE9 & jQuery limitation/; minor graphics glitches due to missing CSS support for "disabled" html elements)
- added support for prefix and suffix (vCard N attribute)
- added Czech localization (cs_CZ)
- added Danish localization (da_DK) - thanks Niels Bo Andersen
- fixed search with upper case letters not present in globalSearchTransformAlphabet
- fixed parsing of double quoted vCard param values (who use this?)
- fixed Andorra address fields
- fixed minor graphics glitch with update notification after logout and new login
- updated auth module to support multiple resources in response + updated auth/config.inc with modified templates
- updated misc/config_davical.txt (better handling of preflighted OPTION requests)
- updated misc/calendarserver_CardDavMATE.diff (support for cross-domain queries with X-Requested-With header /upcoming Safari 5.2/)
- updated default globalSearchTransformAlphabet in config.js
- updated CSS detection rule for iPad (new screen resolution for iPad 3)
- updated jQuery to 1.7.2
- updated jQuery-UI to 1.8.19
- replaced .attr('value'[, ...]) with .val([...])
- many other fixes

version 0.9.5 [2012-03-12]:
- note: this release contains new configuration option (always use the latest config.js)
- configuration - added globalSearchTransformAlphabet setting - used for transformation of non-ASCII characters to ASCII (for search support)
Expand Down
20 changes: 18 additions & 2 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function localizeAddressTypes()
],
'ad': [ 'Andorra',
{fid: 2, type: 'input', 'data-addr-field': 'street', placeholder: localization[globalInterfaceLanguage].pholderAddressStreet},
{fid: 4, type: 'input', 'data-addr-field': 'code', placeholder: localization[globalInterfaceLanguage].pholderAddressPostalCode},
{fid: 5, type: 'input', 'data-addr-field': 'locality', placeholder: localization[globalInterfaceLanguage].pholderAddressCity},
{fid: 5, type: 'input', 'data-addr-field': 'code', placeholder: localization[globalInterfaceLanguage].pholderAddressPostalCode},
{fid: 6, type: 'input', 'data-addr-field': 'locality', placeholder: localization[globalInterfaceLanguage].pholderAddressCity},
{fid: 11, type: 'country'}
],
'ao': [ 'Angola',
Expand Down Expand Up @@ -1478,6 +1478,22 @@ function vcardUnescapeValue(inputValue)
return outputValue;
}

// Split parameters and remove double quotes from values (if parameter values are quoted)
function vcardSplitParam(inputValue)
{
var result=vcardSplitValue(inputValue, ';');
var index;

for(var i=0;i<result.length;i++)
{
index=result[i].indexOf('=');
if(index!=-1 && index+1<result[i].length && result[i][index+1]=='"' && result[i][result[i].length-1]=='"')
result[i]=result[i].substring(0,index+1)+result[i].substring(index+2,result[i].length-1);
}

return result;
}

// Split string by separator (but not '\' escaped separator)
function vcardSplitValue(inputValue, inputDelimiter)
{
Expand Down
30 changes: 13 additions & 17 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// globalAccountSettings must be an array (can be undefined if you use globalNetworkAccountSettings)
// globalAccountSettings must be an array (can be undefined if you use globalNetworkCheckSettings or globalNetworkAccountSettings)
// the href value is a "principal URL" - the last character in href must be '/'
// principal URL != collection URL -> the client automatically detects collections for each principal URL
// PROPER principal URL looks like:
Expand All @@ -27,36 +27,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// https://server.com:8443/caldav.php/USER/addressbook/ <- url to addressbook collection
// https://server.com:8443/principals/users/USER <- missing '/'
// https://server.com:8443/caldav.php/USER <- missing '/'
// the crossDomain sets jQuery's ajax crossDomain value (set to true if your CardDavMATE installation has not the same [protocol,hostname,port] as your CardDav server - by default true)
// the crossDomain sets jQuery's ajax crossDomain value (must be true if your CardDavMATE installation has not the same [protocol,hostname,port] as your CardDav server - by default null = autodetect /detected setting is shown in the console/)
// the withCredentials sets jQuery's ajax withCredentials value for cross domain queries (if true, Access-Control-Allow-Origin "*" is not allowed)
// the syncInterval sets how often (in miliseconds) to asynchronously sync the active collection on background (but only if the browser window has focus)
// the timeOut sets the timeout for jQuery .ajax call (in miliseconds)
// the lockTimeOut sets the LOCK Timeout value (in miliseconds)
//var globalAccountSettings=[{href: 'https://server1.com:8443/principals/users/USERNAME1/', crossDomain: true, withCredentials: false, userAuth: {userName: 'USERNAME1', userPassword: 'PASSWORD1'}, syncInterval: 15000, timeOut: 30000, lockTimeOut: 10000}, {href: 'https://server1.com:8443/principals/users/USERNAME2/', crossDomain: true, withCredentials: false, userAuth: {userName: 'USERNAME2', userPassword: 'PASSWORD2'}, syncInterval: 15000, timeOut: 30000, lockTimeOut: 10000}, {href: 'https://server2.com:8443/principals/users/USERNAME/', crossDomain: true, withCredentials: false, userAuth: {userName: 'USERNAME', userPassword: 'PASSWORD'}, syncInterval:15000, timeOut: 30000, lockTimeOut: 10000}];
//var globalAccountSettings=[{href: 'https://server1.com:8443/principals/users/USERNAME1/', crossDomain: null, withCredentials: false, userAuth: {userName: 'USERNAME1', userPassword: 'PASSWORD1'}, syncInterval: 30000, timeOut: 30000, lockTimeOut: 10000}, {href: 'https://server1.com:8443/principals/users/USERNAME2/', crossDomain: null, withCredentials: false, userAuth: {userName: 'USERNAME2', userPassword: 'PASSWORD2'}, syncInterval: 30000, timeOut: 30000, lockTimeOut: 10000}, {href: 'https://server2.com:8443/principals/users/USERNAME/', crossDomain: null, withCredentials: false, userAuth: {userName: 'USERNAME', userPassword: 'PASSWORD'}, syncInterval: 30000, timeOut: 30000, lockTimeOut: 10000}];

// if set, the client authenticates against the href URL (the last character in href must be '/') and if the authentication is successful it appends the USER + '/' to end of href and sets the userAuth: {userName: USER, userPassword: PASSWORD}
// then the client use the modified globalNetworkCheckSettings in the same way as the globalAccountSettings
// then the client uses the modified globalNetworkCheckSettings in the same way as the globalAccountSettings
// this option ivokes a login screen and disallows access until successfull authentication
// the additionalResources array can contain additional resources (shared resources accessible by all users), for example: additionalResources: ['company','customers'] ... href values for these resources are created in the same way as described above for the USER
// see globalAccountSettings for more information
// Lion server (cross domain) example (http + https setup):
//var globalNetworkCheckSettings={href: 'http://lion.server.com:8008/principals/users/', additionalResources: [], crossDomain: true, withCredentials: false, syncInterval: 15000, timeOut: 30000, lockTimeOut: 10000}
//var globalNetworkCheckSettings={href: 'https://lion.server.com:8443/principals/users/', additionalResources: [], crossDomain: true, withCredentials: false, syncInterval: 15000, timeOut: 30000, lockTimeOut: 10000}
// Davical example (cross domain):
//var globalNetworkCheckSettings={href: 'http://davical.server.com:8080/caldav.php/', additionalResources: [], crossDomain: true, withCredentials: false, syncInterval: 15000, timeOut: 30000, lockTimeOut: 10000}
// Lion server example (http + https setup; see misc/readme_lion.txt for server setup):
//var globalNetworkCheckSettings={href: 'http://lion.server.com:8008/principals/users/', additionalResources: [], crossDomain: null, withCredentials: false, syncInterval: 30000, timeOut: 30000, lockTimeOut: 10000}
//var globalNetworkCheckSettings={href: 'https://lion.server.com:8443/principals/users/', additionalResources: [], crossDomain: null, withCredentials: false, syncInterval: 30000, timeOut: 30000, lockTimeOut: 10000}
// Davical example (for cross-domain setup see misc/config_davical.txt):
//var globalNetworkCheckSettings={href: 'http://davical.server.com:8080/caldav.php/', additionalResources: [], crossDomain: null, withCredentials: false, syncInterval: 30000, timeOut: 30000, lockTimeOut: 10000}
// Davical example (CardDavMATE installed into Davical subdirectory - works out of the box, no additional setup required):
var globalNetworkCheckSettings={href: 'http://cloud.pubplongeeaixois.org/caldav.php/', additionalResources: [], crossDomain: false, withCredentials: false, syncInterval: 15000, timeOut: 30000, lockTimeOut: 10000}


//var globalNetworkCheckSettings={href: location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: '')+location.pathname.replace(RegExp('/+[^/]+/*$'),'')+'/caldav.php/ppa/', additionalResources: [], crossDomain: false, withCredentials: false, syncInterval: 15000, timeOut: 30000, lockTimeOut: 10000}
var globalNetworkCheckSettings={href: location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: '')+location.pathname.replace(RegExp('/+[^/]+/*$'),'')+'/caldav.php/', additionalResources: [], crossDomain: null, withCredentials: false, syncInterval: 30000, timeOut: 30000, lockTimeOut: 10000}

// if set, the configuration is loaded from the network (using HTTP auth) - the returned configuration XML settings are added
// to globalAccountSettings ... it is possible to combine this option with the globalAccountSettings although it is
// recommented to use it without this option
// to globalAccountSettings ... it is possible to combine this option with the globalAccountSettings although it is not recommended
// this option ivokes a login screen and disallows access until the client get correct XML configuration file from the server
// the syncInterval is currently unused (the configuration XML is loaded only once)
// the timeOut sets the timeout for jQuery .ajax call (in miliseconds)
//var globalNetworkAccountSettings={href: 'https://www.config-server.com/auth/', crossDomain: false, withCredentials: false, syncInterval: 0, timeOut: 30000};
//var globalNetworkAccountSettings={href: 'https://www.config-server.com/auth/', crossDomain: null, withCredentials: false, syncInterval: 0, timeOut: 30000};

// default interface language - see localization.js
// supported languages (note: value is case sensitive):
Expand All @@ -80,7 +76,7 @@ var globalCompatibility={anniversaryOutputFormat: ['apple']}
//var globalSortAlphabet=null; // use localeCompare()
var globalSortAlphabet='0123456789AÁÄBCČDĎEÉFGHIÍJKLĹĽMNŇOÓÖŐÔPQRŔSŠTŤUÚÜŰVWXYÝZŽaáäbcčdďeéfghiíjklĺľmnňoóöőôpqrŕsšßtťuúüűvwxyýzž'; // use custom alphabet sorting
// search functionality character equivalence (transformation to ASCII: key = regex text, value = result character)
var globalSearchTransformAlphabet={'[ÀàÁáÂâÄäÆæÃãÅåĀā]': 'a', '[ÇçĆćČč]': 'c', '[Ďď]': 'd', '[ÈèÉéÊêËëĒēĖėĘę]': 'e', '[ÎîÏïÍíĪīĮįÌì]': 'i', '[ŁłĽľĹĺ]': 'l', '[ÑñŃńŇň]': 'n', '[ÔôÖöÒòÓóŒœØøŌōÕõ]': 'o', '[ߌśŠš]': 's', '[Ťť]': 't', '[ÛûÜüÙùÚúŪūŰű]': 'u', '[ÝýŸÿ]': 'y', '[ŽžŹźŻż]': 'z'};
var globalSearchTransformAlphabet={'[ÀàÁáÂâÄäÆæÃãÅåĀā]': 'a', '[ÇçĆćČč]': 'c', '[Ďď]': 'd', '[ÈèÉéÊêËëĒēĖėĘęĚě]': 'e', '[ÎîÏïÍíĪīĮįÌì]': 'i', '[ŁłĽľĹĺ]': 'l', '[ÑñŃńŇň]': 'n', '[ÔôÖöÒòÓóŒœØøŌōÕõ]': 'o', '[Řř]': 'r', '[ẞߌśŠš]': 's', '[Ťť]': 't', '[ÛûÜüÙùÚúŪūŰűŮů]': 'u', '[ÝýŸÿ]': 'y', '[ŽžŹźŻż]': 'z'};

// set the collection sorting, displaying and storing FN attribute into vCard - use a pair of values separated by a comma (spaces are allowed)
// possible values:
Expand Down
Loading

0 comments on commit 9d5fc92

Please sign in to comment.