mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-24 17:36:39 +00:00
Various small fixes preparing for release.
Correct logic for auto-creating addressbook for new user. Fix non-creation of default addressbook. Fix principal/collection edit to allow write of no privileges. Fix collection edit timezone list to use new table. Update davical & libawl version in always.php. Regression test changes with update to davical.sql.
This commit is contained in:
parent
32662509e9
commit
2127c294a3
@ -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 );
|
||||
|
||||
|
||||
@ -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 );
|
||||
|
||||
|
||||
@ -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' => '<DAV::collection/><urn:ietf:params:xml:ns:caldav:calendar/>'
|
||||
);
|
||||
$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' => '<DAV::collection/><urn:ietf:params:xml:ns:caldav:calendar/>'
|
||||
);
|
||||
$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.");
|
||||
|
||||
@ -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 = '<div id="privileges">';
|
||||
$privileges_set = '<div id="privileges"><input type="hidden" name="default_privileges[fake_privilege_for_input]" value="0">';
|
||||
for( $i=0; $i<count($privilege_names); $i++ ) {
|
||||
$privilege_set = ( (1 << $i) & $default_privileges ? ' CHECKED' : '');
|
||||
$privileges_set .= '<label class="privilege"><input name="default_privileges['.$privilege_names[$i].']" id="default_privileges_'.$privilege_names[$i].'" type="checkbox"'.$privilege_set.'>'.$privilege_xlate[$privilege_names[$i]].'</label>'."\n";
|
||||
|
||||
@ -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 = '<div id="privileges">'."\n";
|
||||
$privileges_set = sprintf('<div id="privileges"><input type="hidden" name="%s[fake_privilege_for_input]" value="0">%s', $fname, "\n");
|
||||
for( $i=0; $i < count($privilege_names); $i++ ) {
|
||||
$privilege_set = ( (1 << $i) & $privs_dec ? ' CHECKED' : '');
|
||||
$privileges_set .= sprintf( ' <label class="privilege"><input name="%s[%s]" id="%s_%s" type="checkbox"%s>%s</label>'."\n",
|
||||
|
||||
@ -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, <PERMS> line 48.
|
||||
DBD::Pg::db do failed: ERROR: relation "timezones" does not exist at ../dba/update-davical-database line 410, <PERMS> line 48.
|
||||
DBD::Pg::db do failed: ERROR: relation "tz_aliases" does not exist at ../dba/update-davical-database line 400, <PERMS> line 49.
|
||||
DBD::Pg::db do failed: ERROR: relation "tz_aliases" does not exist at ../dba/update-davical-database line 410, <PERMS> line 49.
|
||||
DBD::Pg::db do failed: ERROR: relation "tz_localnames" does not exist at ../dba/update-davical-database line 400, <PERMS> line 50.
|
||||
DBD::Pg::db do failed: ERROR: relation "tz_localnames" does not exist at ../dba/update-davical-database line 410, <PERMS> line 50.
|
||||
DBD::Pg::db do failed: ERROR: relation "timezones_our_tzno_seq" does not exist at ../dba/update-davical-database line 400, <PERMS> line 60.
|
||||
DBD::Pg::db do failed: ERROR: relation "timezones_our_tzno_seq" does not exist at ../dba/update-davical-database line 410, <PERMS> line 60.
|
||||
DBD::Pg::db do failed: ERROR: relation "time_zone" does not exist at ../dba/update-davical-database line 400, <PERMS> line 63.
|
||||
DBD::Pg::db do failed: ERROR: relation "time_zone" does not exist at ../dba/update-davical-database line 410, <PERMS> line 63.
|
||||
RRULE functions updated.
|
||||
Database permissions updated.
|
||||
NOTE
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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, <PERMS> line 48.
|
||||
DBD::Pg::db do failed: ERROR: relation "timezones" does not exist at ../dba/update-davical-database line 410, <PERMS> line 48.
|
||||
DBD::Pg::db do failed: ERROR: relation "tz_aliases" does not exist at ../dba/update-davical-database line 400, <PERMS> line 49.
|
||||
DBD::Pg::db do failed: ERROR: relation "tz_aliases" does not exist at ../dba/update-davical-database line 410, <PERMS> line 49.
|
||||
DBD::Pg::db do failed: ERROR: relation "tz_localnames" does not exist at ../dba/update-davical-database line 400, <PERMS> line 50.
|
||||
DBD::Pg::db do failed: ERROR: relation "tz_localnames" does not exist at ../dba/update-davical-database line 410, <PERMS> line 50.
|
||||
DBD::Pg::db do failed: ERROR: relation "timezones_our_tzno_seq" does not exist at ../dba/update-davical-database line 400, <PERMS> line 60.
|
||||
DBD::Pg::db do failed: ERROR: relation "timezones_our_tzno_seq" does not exist at ../dba/update-davical-database line 410, <PERMS> line 60.
|
||||
DBD::Pg::db do failed: ERROR: relation "time_zone" does not exist at ../dba/update-davical-database line 400, <PERMS> line 63.
|
||||
DBD::Pg::db do failed: ERROR: relation "time_zone" does not exist at ../dba/update-davical-database line 410, <PERMS> line 63.
|
||||
RRULE functions updated.
|
||||
Database permissions updated.
|
||||
|
||||
@ -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"
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
@ -8,7 +8,7 @@ Content-Type: application/xml; charset="utf-8"
|
||||
<info>
|
||||
<primary-source>Olson tzdata2011j
|
||||
</primary-source>
|
||||
<contact>mailto:tzs@example.org</contact>
|
||||
<contact>mailto:admin@davical.example.com</contact>
|
||||
</info>
|
||||
|
||||
<operation>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user