summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-05-03 08:41:26 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-05-03 08:41:26 (GMT)
commit484e5ad4982bf2b5037a297f314724f053965742 (patch)
treefa37e2437890dad02d92fc1bee05aa3b6bde6b78
parentd4e24304adac9250dfb5cd322c5ec5134c642982 (diff)
downloadroundcubemail-plugins-kolab-484e5ad4982bf2b5037a297f314724f053965742.tar.gz
Do case-insensitive checks whether the current user is an event attendee or organizer (#1838)
-rw-r--r--plugins/calendar/calendar.php20
-rw-r--r--plugins/calendar/calendar_ui.js10
2 files changed, 15 insertions, 15 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 1c6f9cd..82f7b3c 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -676,7 +676,7 @@ class calendar extends rcube_plugin
foreach ($old['attendees'] as $i => $attendee) {
if ($attendee['role'] == 'ORGANIZER')
$organizer = $attendee;
- else if ($attendee['email'] && in_array($attendee['email'], $emails)) {
+ else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
$old['attendees'][$i]['status'] = 'DECLINED';
}
}
@@ -713,7 +713,7 @@ class calendar extends rcube_plugin
if ($existing = $this->driver->get_event($event, true, false, true)) {
$emails = $this->get_user_emails();
foreach ($existing['attendees'] as $i => $attendee) {
- if ($attendee['email'] && in_array($attendee['email'], $emails)) {
+ if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
$status = $attendee['status'];
break;
}
@@ -1063,7 +1063,7 @@ class calendar extends rcube_plugin
$settings['identities'][$rec['identity_id']] = $rec['email'];
}
$identity['emails'][] = $this->rc->user->get_username();
- $settings['identity'] = array('name' => $identity['name'], 'email' => $identity['email'], 'emails' => ';' . join(';', $identity['emails']));
+ $settings['identity'] = array('name' => $identity['name'], 'email' => strtolower($identity['email']), 'emails' => ';' . strtolower(join(';', $identity['emails'])));
}
return $settings;
@@ -1296,7 +1296,7 @@ class calendar extends rcube_plugin
foreach ((array)$event['attendees'] as $i => $attendee) {
if ($attendee['role'] == 'ORGANIZER')
$organizer = $i;
- if ($attendee['email'] == in_array($attendee['email'], $emails))
+ if ($attendee['email'] == in_array(strtolower($attendee['email']), $emails))
$owner = $i;
else if (!isset($attendee['rsvp']))
$event['attendees'][$i]['rsvp'] = true;
@@ -1358,7 +1358,7 @@ class calendar extends rcube_plugin
$sent = 0;
foreach ((array)$event['attendees'] as $attendee) {
// skip myself for obvious reasons
- if (!$attendee['email'] || in_array($attendee['email'], $emails))
+ if (!$attendee['email'] || in_array(strtolower($attendee['email']), $emails))
continue;
// which template to use for mail text
@@ -1747,7 +1747,7 @@ class calendar extends rcube_plugin
// check my status
$status = 'unknown';
foreach ($event['attendees'] as $i => $attendee) {
- if ($attendee['email'] && in_array($attendee['email'], $emails)) {
+ if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
$status = strtoupper($attendee['status']);
break;
}
@@ -1856,7 +1856,7 @@ class calendar extends rcube_plugin
if ($attendee['role'] == 'ORGANIZER') {
$organizer = $attendee;
}
- else if ($attendee['email'] && in_array($attendee['email'], $emails)) {
+ else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
$event['attendees'][$i]['status'] = strtoupper($status);
}
}
@@ -1940,7 +1940,7 @@ class calendar extends rcube_plugin
// send iTip reply
- if ($this->ical->method == 'REQUEST' && $organizer && !in_array($organizer['email'], $emails) && !$error_msg) {
+ if ($this->ical->method == 'REQUEST' && $organizer && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
$itip = $this->load_itip();
if ($itip->send_itip_message($event, 'REPLY', $organizer, 'itipsubject' . $status, 'itipmailbody' . $status))
$this->rc->output->command('display_message', $this->gettext(array('name' => 'sentresponseto', 'vars' => array('mailto' => $organizer['name'] ? $organizer['name'] : $organizer['email']))), 'confirmation');
@@ -2037,7 +2037,7 @@ class calendar extends rcube_plugin
{
$emails = array();
$plugin = $this->rc->plugins->exec_hook('calendar_user_emails', array('emails' => $emails));
- $emails = $plugin['emails'];
+ $emails = array_map('strtolower', $plugin['emails']);
if ($plugin['abort']) {
return $emails;
@@ -2045,7 +2045,7 @@ class calendar extends rcube_plugin
$emails[] = $this->rc->user->get_username();
foreach ($this->rc->user->list_identities() as $identity)
- $emails[] = $identity['email'];
+ $emails[] = strtolower($identity['email']);
return array_unique($emails);
}
diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js
index 64210f8..4626414 100644
--- a/plugins/calendar/calendar_ui.js
+++ b/plugins/calendar/calendar_ui.js
@@ -166,15 +166,15 @@ function rcube_calendar_ui(settings)
// check if the event has 'real' attendees, excluding the current user
var has_attendees = function(event)
{
- return (event.attendees && event.attendees.length && (event.attendees.length > 1 || event.attendees[0].email != settings.identity.email));
+ return (event.attendees && event.attendees.length && (event.attendees.length > 1 || String(event.attendees[0].email).toLowerCase() != settings.identity.email));
};
// check if the current user is an attendee of this event
var is_attendee = function(event, role, email)
{
- var emails = email ? ';'+email : settings.identity.emails;
+ var emails = email ? ';'+email.toLowerCase() : settings.identity.emails;
for (var i=0; event.attendees && i < event.attendees.length; i++) {
- if ((!role || event.attendees[i].role == role) && event.attendees[i].email && emails.indexOf(';'+event.attendees[i].email) >= 0)
+ if ((!role || event.attendees[i].role == role) && event.attendees[i].email && emails.indexOf(';'+event.attendees[i].email.toLowerCase()) >= 0)
return event.attendees[i];
}
return false;
@@ -635,7 +635,7 @@ function rcube_calendar_ui(settings)
data._identity = $('#edit-identities-list option:selected').val();
// don't submit attendees if only myself is added as organizer
- if (data.attendees.length == 1 && data.attendees[0].role == 'ORGANIZER' && data.attendees[0].email == settings.identity.email)
+ if (data.attendees.length == 1 && data.attendees[0].role == 'ORGANIZER' && String(data.attendees[0].email).toLowerCase() == settings.identity.email)
data.attendees = [];
// tell server to send notifications
@@ -1522,7 +1522,7 @@ function rcube_calendar_ui(settings)
// update attendee status
for (var data, i=0; i < me.selected_event.attendees.length; i++) {
data = me.selected_event.attendees[i];
- if (settings.identity.emails.indexOf(';'+data.email) >= 0)
+ if (settings.identity.emails.indexOf(';'+String(data.email).toLowerCase()) >= 0)
data.status = response.toUpperCase();
}
event_show_dialog(me.selected_event);