diff --git a/htdocs/always.php b/htdocs/always.php
index 9f356778..1f06a602 100644
--- a/htdocs/always.php
+++ b/htdocs/always.php
@@ -174,8 +174,8 @@ init_gettext( 'davical', $c->locale_path );
*
*/
$c->code_version = 0;
-$c->want_awl_version = '0.47';
-$c->version_string = '0.9.9.5'; // The actual version # is replaced into that during the build /release process
+$c->want_awl_version = '0.48';
+$c->version_string = '0.9.9.6'; // The actual version # is replaced into that during the build /release process
if ( isset($c->version_string) && preg_match( '/(\d+)\.(\d+)\.(\d+)(.*)/', $c->version_string, $matches) ) {
$c->code_major = $matches[1];
$c->code_minor = $matches[2];
@@ -192,7 +192,7 @@ $_SERVER['SERVER_NAME'] = $c->domain_name;
require_once('AwlQuery.php');
-$c->want_dbversion = array(1,2,10);
+$c->want_dbversion = array(1,2,11);
$c->schema_version = 0;
$qry = new AwlQuery( 'SELECT schema_major, schema_minor, schema_patch FROM awl_db_revision ORDER BY schema_id DESC LIMIT 1;' );
if ( $qry->Exec('always',__LINE__,__FILE__) && $row = $qry->Fetch() ) {
@@ -387,6 +387,7 @@ function privilege_to_bits( $raw_privs ) {
case 'schedule-deliver' : $out_priv |= 7168; break; // 1024 + 2048 + 4096
case 'schedule-send' : $out_priv |= 57344; break; // 8192 + 16384 + 32768
case 'all' : $out_priv = DAVICAL_MAXPRIV; break;
+ case 'fake_privilege_for_input' : break;
default:
dbg_error_log( 'ERROR', 'Cannot convert privilege of "%s" into bits.', $priv );
diff --git a/inc/always.php.in b/inc/always.php.in
index 39bc4cbd..05a9ac22 100644
--- a/inc/always.php.in
+++ b/inc/always.php.in
@@ -387,6 +387,7 @@ function privilege_to_bits( $raw_privs ) {
case 'schedule-deliver' : $out_priv |= 7168; break; // 1024 + 2048 + 4096
case 'schedule-send' : $out_priv |= 57344; break; // 8192 + 16384 + 32768
case 'all' : $out_priv = DAVICAL_MAXPRIV; break;
+ case 'fake_privilege_for_input' : break;
default:
dbg_error_log( 'ERROR', 'Cannot convert privilege of "%s" into bits.', $priv );
diff --git a/inc/auth-functions.php b/inc/auth-functions.php
index ffa4869f..57f23fb4 100644
--- a/inc/auth-functions.php
+++ b/inc/auth-functions.php
@@ -70,42 +70,45 @@ function getPrincipalByID( $principal_id, $use_cache = true ) {
*/
function CreateHomeCollections( $username ) {
global $session, $c;
- if ( ! isset($c->home_calendar_name) || strlen($c->home_calendar_name) == 0 ) return true;
+ if ( empty($c->home_calendar_name) && empty($c->home_addressbook_name) ) return true;
$principal = new Principal('username',$username);
- $params = array( ':collection_path' => $principal->dav_name().$c->home_calendar_name.'/' );
- $qry = new AwlQuery( 'SELECT 1 FROM collection WHERE dav_name = :collection_path', $params );
- if ( !$qry->Exec() ) {
- $c->messages[] = i18n("There was an error reading from the database.");
- return false;
- }
- if ( $qry->rows() > 0 ) {
- $c->messages[] = i18n("Home calendar already exists.");
- return true;
- }
- else {
- $sql = 'INSERT INTO collection (user_no, parent_container, dav_name, dav_etag, dav_displayname, is_calendar, created, modified, resourcetypes) ';
- $sql .= 'VALUES( :user_no, :parent_container, :collection_path, :dav_etag, :displayname, true, current_timestamp, current_timestamp, :resourcetypes );';
- $params = array(
- ':user_no' => $principal->user_no(),
- ':parent_container' => $principal->dav_name(),
- ':collection_path' => $principal->dav_name().$c->home_calendar_name.'/',
- ':dav_etag' => '-1',
- ':displayname' => $principal->fullname,
- ':resourcetypes' => ''
- );
- $qry = new AwlQuery( $sql, $params );
- if ( $qry->Exec() ) {
- $c->messages[] = i18n("Home calendar added.");
- dbg_error_log("User",":Write: Created user's home calendar at '%s'", $params[':collection_path'] );
+
+ $sql = 'INSERT INTO collection (user_no, parent_container, dav_name, dav_etag, dav_displayname, is_calendar, created, modified, resourcetypes) ';
+ $sql .= 'VALUES( :user_no, :parent_container, :collection_path, :dav_etag, :displayname, true, current_timestamp, current_timestamp, :resourcetypes );';
+ if ( !empty($c->home_calendar_name) ) {
+ $params = array( ':collection_path' => $principal->dav_name().$c->home_calendar_name.'/' );
+ $qry = new AwlQuery( 'SELECT 1 FROM collection WHERE dav_name = :collection_path', $params );
+ if ( !$qry->Exec() ) {
+ $c->messages[] = i18n("There was an error reading from the database.");
+ return false;
+ }
+ if ( $qry->rows() > 0 ) {
+ $c->messages[] = i18n("Home calendar already exists.");
+ return true;
}
else {
- $c->messages[] = i18n("There was an error writing to the database.");
- return false;
+ $params = array(
+ ':user_no' => $principal->user_no(),
+ ':parent_container' => $principal->dav_name(),
+ ':collection_path' => $principal->dav_name().$c->home_calendar_name.'/',
+ ':dav_etag' => '-1',
+ ':displayname' => $principal->fullname,
+ ':resourcetypes' => ''
+ );
+ $qry = new AwlQuery( $sql, $params );
+ if ( $qry->Exec() ) {
+ $c->messages[] = i18n("Home calendar added.");
+ dbg_error_log("User",":Write: Created user's home calendar at '%s'", $params[':collection_path'] );
+ }
+ else {
+ $c->messages[] = i18n("There was an error writing to the database.");
+ return false;
+ }
}
}
- if ( !isset($c->home_addressbook_name) ) {
+ if ( !empty($c->home_addressbook_name) ) {
$qry = new AwlQuery( 'SELECT 1 FROM collection WHERE dav_name = :dav_name', array( ':dav_name' => $principal->dav_name().$c->home_addressbook_name.'/') );
if ( !$qry->Exec() ) {
$c->messages[] = i18n("There was an error reading from the database.");
diff --git a/inc/ui/collection-edit.php b/inc/ui/collection-edit.php
index 14e47b82..5f2c78e2 100644
--- a/inc/ui/collection-edit.php
+++ b/inc/ui/collection-edit.php
@@ -8,7 +8,7 @@ param_to_global('principal_id', 'int' );
param_to_global('collection_name', '{^.+$}' );
if ( isset($user_no) ) $principal = new Principal('user_no',$user_no);
if ( isset($principal_id) ) $principal = new Principal('principal_id',$principal_id);
-$editor->SetLookup( 'timezone', 'SELECT \'\', \'*** Unknown ***\' UNION SELECT tz_id, tz_locn FROM time_zone WHERE tz_id = tz_locn AND length(tz_spec) > 100 ORDER BY 1' );
+$editor->SetLookup( 'timezone', 'SELECT \'\', \'*** Unknown ***\' UNION SELECT tzid, olson_name FROM timezones WHERE tzid = olson_name AND length(vtimezone) > 100 ORDER BY 1' );
$editor->SetLookup( 'schedule_transp', 'SELECT \'opaque\', \'Opaque\' UNION SELECT \'transp\', \'Transparent\'' );
@@ -190,7 +190,7 @@ function privilege_format_function( $value, $column, $row ) {
}
$default_privileges = bindec($editor->Value('default_privileges'));
-$privileges_set = '
';
+$privileges_set = '
';
for( $i=0; $i'.$privilege_xlate[$privilege_names[$i]].''."\n";
diff --git a/inc/ui/principal-edit.php b/inc/ui/principal-edit.php
index 5c8c72c4..736bf86e 100644
--- a/inc/ui/principal-edit.php
+++ b/inc/ui/principal-edit.php
@@ -220,7 +220,7 @@ function principal_editor() {
if ( $_POST['type_id'] != 3 && $editor->IsCreate() ) {
/** We only add the default calendar if it isn't a group, and this is a create action */
require_once('auth-functions.php');
- CreateHomeCalendar($editor->Value('username'));
+ CreateHomeCollections($editor->Value('username'));
}
if ( $session->AllowedTo('Admin') ) {
if ( $_POST['is_admin'] == 'on' ) {
@@ -380,7 +380,7 @@ function build_privileges_html( $ed, $fname ) {
$btn_ss = htmlspecialchars(translate('Schedule Send')); $btn_ss_title = htmlspecialchars(translate('Set schedule-deliver privileges'));
$privs_dec = bindec($ed->Value($fname));
- $privileges_set = '
'."\n";
+ $privileges_set = sprintf('
%s', $fname, "\n");
for( $i=0; $i < count($privilege_names); $i++ ) {
$privilege_set = ( (1 << $i) & $privs_dec ? ' CHECKED' : '');
$privileges_set .= sprintf( ' '."\n",
diff --git a/testing/tests/regression-suite/Create-Database.result b/testing/tests/regression-suite/Create-Database.result
index 60c0f95f..8586a791 100644
--- a/testing/tests/regression-suite/Create-Database.result
+++ b/testing/tests/regression-suite/Create-Database.result
@@ -3,14 +3,8 @@
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
-DBD::Pg::db do failed: ERROR: relation "timezones" does not exist at ../dba/update-davical-database line 400, line 48.
-DBD::Pg::db do failed: ERROR: relation "timezones" does not exist at ../dba/update-davical-database line 410, line 48.
-DBD::Pg::db do failed: ERROR: relation "tz_aliases" does not exist at ../dba/update-davical-database line 400, line 49.
-DBD::Pg::db do failed: ERROR: relation "tz_aliases" does not exist at ../dba/update-davical-database line 410, line 49.
-DBD::Pg::db do failed: ERROR: relation "tz_localnames" does not exist at ../dba/update-davical-database line 400, line 50.
-DBD::Pg::db do failed: ERROR: relation "tz_localnames" does not exist at ../dba/update-davical-database line 410, line 50.
-DBD::Pg::db do failed: ERROR: relation "timezones_our_tzno_seq" does not exist at ../dba/update-davical-database line 400, line 60.
-DBD::Pg::db do failed: ERROR: relation "timezones_our_tzno_seq" does not exist at ../dba/update-davical-database line 410, line 60.
+DBD::Pg::db do failed: ERROR: relation "time_zone" does not exist at ../dba/update-davical-database line 400, line 63.
+DBD::Pg::db do failed: ERROR: relation "time_zone" does not exist at ../dba/update-davical-database line 410, line 63.
RRULE functions updated.
Database permissions updated.
NOTE
diff --git a/testing/tests/regression-suite/Really Upgrade Database.result b/testing/tests/regression-suite/Really Upgrade Database.result
index 13952c93..a8659ccc 100644
--- a/testing/tests/regression-suite/Really Upgrade Database.result
+++ b/testing/tests/regression-suite/Really Upgrade Database.result
@@ -1,6 +1,5 @@
-The database is version 8.4 currently at revision 1.2.10.
-Applying patch 1.2.11.sql ... succeeded.
-Successfully applied 1 patches.
+The database is version 8.4 currently at revision 1.2.11.
+No patches were applied.
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
diff --git a/testing/tests/regression-suite/Upgrade-Database.result b/testing/tests/regression-suite/Upgrade-Database.result
index 71f63f42..4a6b8e41 100644
--- a/testing/tests/regression-suite/Upgrade-Database.result
+++ b/testing/tests/regression-suite/Upgrade-Database.result
@@ -1,13 +1,7 @@
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
-DBD::Pg::db do failed: ERROR: relation "timezones" does not exist at ../dba/update-davical-database line 400, line 48.
-DBD::Pg::db do failed: ERROR: relation "timezones" does not exist at ../dba/update-davical-database line 410, line 48.
-DBD::Pg::db do failed: ERROR: relation "tz_aliases" does not exist at ../dba/update-davical-database line 400, line 49.
-DBD::Pg::db do failed: ERROR: relation "tz_aliases" does not exist at ../dba/update-davical-database line 410, line 49.
-DBD::Pg::db do failed: ERROR: relation "tz_localnames" does not exist at ../dba/update-davical-database line 400, line 50.
-DBD::Pg::db do failed: ERROR: relation "tz_localnames" does not exist at ../dba/update-davical-database line 410, line 50.
-DBD::Pg::db do failed: ERROR: relation "timezones_our_tzno_seq" does not exist at ../dba/update-davical-database line 400, line 60.
-DBD::Pg::db do failed: ERROR: relation "timezones_our_tzno_seq" does not exist at ../dba/update-davical-database line 410, line 60.
+DBD::Pg::db do failed: ERROR: relation "time_zone" does not exist at ../dba/update-davical-database line 400, line 63.
+DBD::Pg::db do failed: ERROR: relation "time_zone" does not exist at ../dba/update-davical-database line 410, line 63.
RRULE functions updated.
Database permissions updated.
diff --git a/testing/tests/timezone/5000-capabilities.result b/testing/tests/timezone/5000-capabilities.result
index ed7d5c98..b9512e1d 100644
--- a/testing/tests/timezone/5000-capabilities.result
+++ b/testing/tests/timezone/5000-capabilities.result
@@ -1,6 +1,6 @@
HTTP/1.1 200 OK
Date: Dow, 01 Jan 2000 00:00:00 GMT
-Content-Length: 2992
+Content-Length: 3002
Content-Type: application/xml; charset="utf-8"
@@ -8,7 +8,7 @@ Content-Type: application/xml; charset="utf-8"
Olson tzdata2011j
- mailto:tzs@example.org
+ mailto:admin@davical.example.com