summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-05-13 07:15:12 (GMT)
committerThomas Bruederli <thomas@roundcube.net>2013-05-13 07:15:12 (GMT)
commit7aa8ecfef6085db7863b4aa420905c53fcea682e (patch)
tree259737d9a118738991881751b17253ecbfb82346
parent80f9cd16634e196d9fd02494274a378aa723cad3 (diff)
parent147f9d3ddbec34391c8c35856f8a227e9d81dd73 (diff)
downloadroundcubemail-plugins-kolab-7aa8ecfef6085db7863b4aa420905c53fcea682e.tar.gz
Merge branch 'master' of ssh://git.kolab.org/git/roundcubemail-plugins-kolab
-rw-r--r--plugins/calendar/calendar.php57
-rw-r--r--plugins/calendar/calendar_ui.js10
-rw-r--r--plugins/calendar/drivers/calendar_driver.php13
-rw-r--r--plugins/calendar/drivers/database/database_driver.php21
-rw-r--r--plugins/calendar/drivers/kolab/kolab_calendar.php6
-rw-r--r--plugins/calendar/drivers/kolab/kolab_driver.php14
-rw-r--r--plugins/calendar/lib/calendar_ui.php11
-rw-r--r--plugins/kolab_activesync/kolab_activesync.php4
-rw-r--r--plugins/kolab_activesync/kolab_activesync_ui.php6
-rw-r--r--plugins/kolab_addressbook/kolab_addressbook.php13
-rw-r--r--plugins/kolab_addressbook/lib/kolab_addressbook_ui.php9
-rw-r--r--plugins/kolab_addressbook/lib/rcube_kolab_contacts.php67
-rw-r--r--plugins/kolab_auth/kolab_auth.php2
-rw-r--r--plugins/kolab_config/kolab_config.php2
-rw-r--r--plugins/kolab_delegation/kolab_delegation.php8
-rw-r--r--plugins/kolab_delegation/kolab_delegation_engine.php9
-rw-r--r--plugins/kolab_files/config.inc.php.dist2
-rw-r--r--plugins/kolab_folders/kolab_folders.php1
-rw-r--r--plugins/kolab_zpush/kolab_zpush_ui.php6
-rw-r--r--plugins/libcalendaring/libcalendaring.php78
-rw-r--r--plugins/libkolab/lib/kolab_format_contact.php36
-rw-r--r--plugins/libkolab/lib/kolab_format_event.php13
-rw-r--r--plugins/libkolab/lib/kolab_format_xcal.php2
-rw-r--r--plugins/libkolab/lib/kolab_storage.php3
-rw-r--r--plugins/libkolab/lib/kolab_storage_cache.php8
-rw-r--r--plugins/libkolab/lib/kolab_storage_folder.php6
-rw-r--r--plugins/logon_page/logon_page.php2
-rw-r--r--plugins/odfviewer/odfviewer.php2
-rw-r--r--plugins/pdfviewer/README2
-rw-r--r--plugins/pdfviewer/pdfviewer.php2
-rw-r--r--plugins/tasklist/drivers/database/tasklist_database_driver.php14
-rw-r--r--plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php2
-rw-r--r--plugins/tasklist/drivers/tasklist_driver.php2
-rw-r--r--plugins/tasklist/tasklist.php4
-rw-r--r--plugins/tinymce_config/tinymce_config.php3
35 files changed, 217 insertions, 223 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 1c6f9cd..6537c53 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -58,13 +58,6 @@ class calendar extends rcube_plugin
'calendar_time_indicator' => true,
);
- private $default_categories = array(
- 'Personal' => 'c0c0c0',
- 'Work' => 'ff0000',
- 'Family' => '00ff00',
- 'Holiday' => 'ff6600',
- );
-
private $ics_parts = array();
@@ -514,11 +507,13 @@ class calendar extends rcube_plugin
foreach ($this->driver->list_categories() as $name => $color) {
$old_categories[md5($name)] = $name;
}
- $categories = get_input_value('_categories', RCUBE_INPUT_POST);
- $colors = get_input_value('_colors', RCUBE_INPUT_POST);
+
+ $categories = (array) get_input_value('_categories', RCUBE_INPUT_POST);
+ $colors = (array) get_input_value('_colors', RCUBE_INPUT_POST);
+
foreach ($categories as $key => $name) {
$color = preg_replace('/^#/', '', strval($colors[$key]));
-
+
// rename categories in existing events -> driver's job
if ($oldname = $old_categories[$key]) {
$this->driver->replace_category($oldname, $name, $color);
@@ -526,7 +521,7 @@ class calendar extends rcube_plugin
}
else
$this->driver->add_category($name, $color);
-
+
$new_categories[$name] = $color;
}
@@ -534,7 +529,7 @@ class calendar extends rcube_plugin
foreach ((array)$old_categories[$key] as $key => $name) {
$this->driver->remove_category($name);
}
-
+
$p['prefs']['calendar_categories'] = $new_categories;
}
}
@@ -676,7 +671,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 +708,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;
}
@@ -850,7 +845,7 @@ class calendar extends rcube_plugin
{
$this->load_driver();
if ($alarms = $this->driver->pending_alarms($p['time'] ?: time())) {
- foreach ($alarms as $i => $alarm) {
+ foreach ($alarms as $alarm) {
$alarm['id'] = 'cal:' . $alarm['id']; // prefix ID with cal:
$p['alarms'][] = $alarm;
}
@@ -893,7 +888,6 @@ class calendar extends rcube_plugin
}
$calendar = get_input_value('calendar', RCUBE_INPUT_GPC);
- $uploadid = get_input_value('_uploadid', RCUBE_INPUT_GPC);
// process uploaded file if there is no error
$err = $_FILES['_data']['error'];
@@ -910,7 +904,7 @@ class calendar extends rcube_plugin
continue;
$event['calendar'] = $calendar;
- if ($success = $this->driver->new_event($event)) {
+ if ($this->driver->new_event($event)) {
$count++;
}
else
@@ -1063,7 +1057,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;
@@ -1168,9 +1162,10 @@ class calendar extends rcube_plugin
*/
public function generate_randomdata()
{
- $num = $_REQUEST['_num'] ? intval($_REQUEST['_num']) : 100;
- $cats = array_keys($this->driver->list_categories());
- $cals = $this->driver->list_calendars(true);
+ $num = $_REQUEST['_num'] ? intval($_REQUEST['_num']) : 100;
+ $cats = array_keys($this->driver->list_categories());
+ $cals = $this->driver->list_calendars(true);
+ $count = 0;
while ($count++ < $num) {
$start = round((time() + rand(-2600, 2600) * 1000) / 300) * 300;
@@ -1190,7 +1185,7 @@ class calendar extends rcube_plugin
$title = '';
$len = rand(2, 12);
$words = explode(" ", "The Hough transform is named after Paul Hough who patented the method in 1962. It is a technique which can be used to isolate features of a particular shape within an image. Because it requires that the desired features be specified in some parametric form, the classical Hough transform is most commonly used for the de- tection of regular curves such as lines, circles, ellipses, etc. A generalized Hough transform can be employed in applications where a simple analytic description of a feature(s) is not possible. Due to the computational complexity of the generalized Hough algorithm, we restrict the main focus of this discussion to the classical Hough transform. Despite its domain restrictions, the classical Hough transform (hereafter referred to without the classical prefix ) retains many applications, as most manufac- tured parts (and many anatomical parts investigated in medical imagery) contain feature boundaries which can be described by regular curves. The main advantage of the Hough transform technique is that it is tolerant of gaps in feature boundary descriptions and is relatively unaffected by image noise.");
- $chars = "!# abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890";
+// $chars = "!# abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890";
for ($i = 0; $i < $len; $i++)
$title .= $words[rand(0,count($words)-1)] . " ";
@@ -1296,7 +1291,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 +1353,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
@@ -1677,7 +1672,7 @@ class calendar extends rcube_plugin
$itip_part = null;
// check all message parts for .ics files
- foreach ((array)$this->message->mime_parts as $idx => $part) {
+ foreach ((array)$this->message->mime_parts as $part) {
if ($this->is_vcalendar($part)) {
if ($part->ctype_parameters['method'])
$itip_part = $part->mime_id;
@@ -1746,8 +1741,8 @@ class calendar extends rcube_plugin
// check my status
$status = 'unknown';
- foreach ($event['attendees'] as $i => $attendee) {
- if ($attendee['email'] && in_array($attendee['email'], $emails)) {
+ foreach ($event['attendees'] as $attendee) {
+ if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
$status = strtoupper($attendee['status']);
break;
}
@@ -1856,7 +1851,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 +1935,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 +2032,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 +2040,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);
diff --git a/plugins/calendar/drivers/calendar_driver.php b/plugins/calendar/drivers/calendar_driver.php
index 478a08c..a9402e1 100644
--- a/plugins/calendar/drivers/calendar_driver.php
+++ b/plugins/calendar/drivers/calendar_driver.php
@@ -91,6 +91,13 @@ abstract class calendar_driver
public $alarm_absolute = true;
public $last_error;
+ protected $default_categories = array(
+ 'Personal' => 'c0c0c0',
+ 'Work' => 'ff0000',
+ 'Family' => '00ff00',
+ 'Holiday' => 'ff6600',
+ );
+
/**
* Get a list of available calendars from this source
*
@@ -328,7 +335,7 @@ abstract class calendar_driver
public function list_categories()
{
$rcmail = rcube::get_instance();
- return $rcmail->config->get('calendar_categories', array());
+ return $rcmail->config->get('calendar_categories', $this->default_categories);
}
/**
@@ -372,12 +379,12 @@ abstract class calendar_driver
public function calendar_form($action, $calendar, $formfields)
{
$html = '';
- foreach ($formfields as $prop => $field) {
+ foreach ($formfields as $field) {
$html .= html::div('form-section',
html::label($field['id'], $field['label']) .
$field['value']);
}
-
+
return $html;
}
diff --git a/plugins/calendar/drivers/database/database_driver.php b/plugins/calendar/drivers/database/database_driver.php
index 7669350..74db88b 100644
--- a/plugins/calendar/drivers/database/database_driver.php
+++ b/plugins/calendar/drivers/database/database_driver.php
@@ -47,9 +47,6 @@ class database_driver extends calendar_driver
private $db_events = 'events';
private $db_calendars = 'calendars';
private $db_attachments = 'attachments';
- private $sequence_events = 'event_ids';
- private $sequence_calendars = 'calendar_ids';
- private $sequence_attachments = 'attachment_ids';
/**
@@ -68,9 +65,6 @@ class database_driver extends calendar_driver
$this->db_events = $this->rc->config->get('db_table_events', $this->db_events);
$this->db_calendars = $this->rc->config->get('db_table_calendars', $this->db_calendars);
$this->db_attachments = $this->rc->config->get('db_table_attachments', $this->db_attachments);
- $this->sequence_events = $this->rc->config->get('db_sequence_events', $this->sequence_events);
- $this->sequence_calendars = $this->rc->config->get('db_sequence_calendars', $this->sequence_calendars);
- $this->sequence_attachments = $this->rc->config->get('db_sequence_attachments', $this->sequence_attachments);
$this->_read_calendars();
}
@@ -154,7 +148,7 @@ class database_driver extends calendar_driver
);
if ($result)
- return $this->rc->db->insert_id($this->sequence_calendars);
+ return $this->rc->db->insert_id($this->db_calendars);
return false;
}
@@ -236,9 +230,10 @@ class database_driver extends calendar_driver
return false;
if (!$event['calendar'])
$event['calendar'] = reset(array_keys($this->calendars));
-
+
$event = $this->_save_preprocess($event);
- $query = $this->rc->db->query(sprintf(
+
+ $this->rc->db->query(sprintf(
"INSERT INTO " . $this->db_events . "
(calendar_id, created, changed, uid, %s, %s, all_day, recurrence, title, description, location, categories, free_busy, priority, sensitivity, attendees, alarms, notifyat)
VALUES (?, %s, %s, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
@@ -265,7 +260,7 @@ class database_driver extends calendar_driver
$event['notifyat']
);
- $event_id = $this->rc->db->insert_id($this->sequence_events);
+ $event_id = $this->rc->db->insert_id($this->db_events);
if ($event_id) {
$event['id'] = $event_id;
@@ -533,6 +528,7 @@ class database_driver extends calendar_driver
$recurrence = new calendar_recurrence($this->cal, $event);
+ $count = 0;
$duration = $event['start']->diff($event['end']);
while ($next_start = $recurrence->next_start()) {
$next_start->setTimezone($this->server_timezone);
@@ -560,7 +556,7 @@ class database_driver extends calendar_driver
break;
// stop adding events for inifinite recurrence after 20 years
- if (++$count > 999 || (!$recurrence->recurEnd && !$recurrence->recurCount && $next->year > date('Y') + 20))
+ if (++$count > 999 || (!$recurrence->recurEnd && !$recurrence->recurCount && $next_start->format('Y') > date('Y') + 20))
break;
}
}
@@ -636,7 +632,7 @@ class database_driver extends calendar_driver
$update_master = true;
// delete this and all future instances
- $fromdate = clone $old['start'];
+ $fromdate = clone $event['start'];
$fromdate->setTimezone($this->server_timezone);
$query = $this->rc->db->query(
"DELETE FROM " . $this->db_events . "
@@ -923,7 +919,6 @@ class database_driver extends calendar_driver
public function list_attachments($event)
{
$attachments = array();
- $event_id = $event['recurrence_id'] ? $event['recurrence_id'] : $event['event_id'];
if (!empty($this->calendar_ids)) {
$result = $this->rc->db->query(
diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php
index b9a6231..ce6e0ec 100644
--- a/plugins/calendar/drivers/kolab/kolab_calendar.php
+++ b/plugins/calendar/drivers/kolab/kolab_calendar.php
@@ -379,7 +379,7 @@ class kolab_calendar
rcube::raise_error(array(
'code' => 600, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Error undeleting the event object $uid from the Kolab server"),
+ 'message' => "Error undeleting the event object $event[id] from the Kolab server"),
true, false);
}
@@ -583,7 +583,7 @@ class kolab_calendar
// in kolab_storage attachments are indexed by content-id
$event['_attachments'] = array();
if (is_array($event['attachments'])) {
- foreach ($event['attachments'] as $idx => $attachment) {
+ foreach ($event['attachments'] as $attachment) {
$key = null;
// Roundcube ID has nothing to do with the storage ID, remove it
if ($attachment['content']) {
@@ -646,7 +646,7 @@ class kolab_calendar
if (is_array($prop)) {
foreach ($prop as $key => $val) {
if (is_numeric($key)) {
- $out .= self::_complex2string($val, $fields);
+ $out .= self::_complex2string($val);
}
else if (!in_array($key, $ignorekeys)) {
$out .= $val . ' ';
diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php
index 6b980cd..f5b32d9 100644
--- a/plugins/calendar/drivers/kolab/kolab_driver.php
+++ b/plugins/calendar/drivers/kolab/kolab_driver.php
@@ -83,7 +83,7 @@ class kolab_driver extends calendar_driver
asort($names, SORT_LOCALE_STRING);
- foreach ($names as $utf7name => $name) {
+ foreach (array_keys($names) as $utf7name) {
$calendar = new kolab_calendar($utf7name, $this->cal);
$this->calendars[$calendar->id] = $calendar;
if (!$calendar->readonly)
@@ -689,7 +689,7 @@ class kolab_driver extends calendar_driver
$calendars = explode(',', $calendars);
$events = $categories = array();
- foreach ($this->calendars as $cid => $calendar) {
+ foreach (array_keys($this->calendars) as $cid) {
if ($calendars && !in_array($cid, $calendars))
continue;
@@ -698,7 +698,7 @@ class kolab_driver extends calendar_driver
}
// add new categories to user prefs
- $old_categories = $this->rc->config->get('calendar_categories', array());
+ $old_categories = $this->rc->config->get('calendar_categories', $this->default_categories);
if ($newcats = array_diff(array_map('strtolower', array_keys($categories)), array_map('strtolower', array_keys($old_categories)))) {
foreach ($newcats as $category)
$old_categories[$category] = ''; // no color set yet
@@ -867,7 +867,7 @@ class kolab_driver extends calendar_driver
public function list_categories()
{
// FIXME: complete list with categories saved in config objects (KEP:12)
- return $this->rc->config->get('calendar_categories', array());
+ return $this->rc->config->get('calendar_categories', $this->default_categories);
}
/**
@@ -1040,7 +1040,7 @@ class kolab_driver extends calendar_driver
// Disable folder name input
if (!empty($options) && ($options['norename'] || $options['protected'])) {
$input_name = new html_hiddenfield(array('name' => 'name', 'id' => 'calendar-name'));
- $formfields['name']['value'] = Q(str_replace($delimiter, ' &raquo; ', kolab_storage::object_name($folder)))
+ $formfields['name']['value'] = Q(str_replace($delim, ' &raquo; ', kolab_storage::object_name($folder)))
. $input_name->show($folder);
}
@@ -1178,8 +1178,6 @@ class kolab_driver extends calendar_driver
$color = '';
}
- $hidden_fields[] = array('name' => 'oldname', 'value' => $folder);
-
$storage = $this->rc->get_storage();
$delim = $storage->get_hierarchy_delimiter();
$form = array();
@@ -1190,7 +1188,7 @@ class kolab_driver extends calendar_driver
$path_imap = implode($path_imap, $delim);
$options = $storage->folder_info($folder);
-
+
// Allow plugins to modify the form content (e.g. with ACL form)
$plugin = $this->rc->plugins->exec_hook('calendar_form_kolab',
array('form' => $form, 'options' => $options, 'name' => $folder));
diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php
index f06084c..61803e7 100644
--- a/plugins/calendar/lib/calendar_ui.php
+++ b/plugins/calendar/lib/calendar_ui.php
@@ -270,7 +270,7 @@ class calendar_ui
$select = new html_select($attrib);
$identities = $this->rc->user->list_identities();
- foreach ($identities as $id => $ident) {
+ foreach ($identities as $ident) {
$select->add(format_email_recipient($ident['email'], $ident['name']), $ident['identity_id']);
}
@@ -285,7 +285,7 @@ class calendar_ui
$attrib['name'] = 'categories';
$select = new html_select($attrib);
$select->add('---', '');
- foreach ((array)$this->cal->driver->list_categories() as $cat => $color) {
+ foreach (array_keys((array)$this->cal->driver->list_categories()) as $cat) {
$select->add($cat, $cat);
}
@@ -530,7 +530,6 @@ class calendar_ui
// Get max filesize, enable upload progress bar
$max_filesize = rcube_upload_init();
- $button = new html_inputfield(array('type' => 'button'));
$input = new html_inputfield(array(
'type' => 'file', 'name' => '_data', 'size' => $attrib['uploadfieldsize']));
@@ -543,12 +542,12 @@ class calendar_ui
$this->cal->gettext('all'),
),
array('1','2','6','12',0));
-
+
$html .= html::div('form-section',
html::div(null, $input->show()) .
html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize))))
);
-
+
$html .= html::div('form-section',
html::label('event-import-calendar', $this->cal->gettext('calendar')) .
$this->calendar_select(array('name' => 'calendar', 'id' => 'event-import-calendar'))
@@ -641,7 +640,7 @@ class calendar_ui
$formfields = array(
'name' => array(
'label' => $this->cal->gettext('name'),
- 'value' => $input_name->show($name),
+ 'value' => $input_name->show($calendar['name']),
'id' => 'calendar-name',
),
'color' => array(
diff --git a/plugins/kolab_activesync/kolab_activesync.php b/plugins/kolab_activesync/kolab_activesync.php
index 19604af..78f36c8 100644
--- a/plugins/kolab_activesync/kolab_activesync.php
+++ b/plugins/kolab_activesync/kolab_activesync.php
@@ -82,9 +82,9 @@ class kolab_activesync extends rcube_plugin
if (!$err) {
// iterate over folders list and update metadata if necessary
// old subscriptions
- foreach ($this->folder_meta() as $folder => $meta) {
+ foreach (array_keys($this->folder_meta()) as $folder) {
$err |= !$this->folder_set($folder, $imei, intval($subscriptions[$folder]));
- unset($subsciptions[$folder]);
+ unset($subscriptions[$folder]);
}
// new subscription
foreach ($subscriptions as $folder => $flag) {
diff --git a/plugins/kolab_activesync/kolab_activesync_ui.php b/plugins/kolab_activesync/kolab_activesync_ui.php
index 6e796cc..b723668 100644
--- a/plugins/kolab_activesync/kolab_activesync_ui.php
+++ b/plugins/kolab_activesync/kolab_activesync_ui.php
@@ -179,6 +179,7 @@ class kolab_activesync_ui
}
}
+ $folder_id = 'rcmf' . html_identifier($folder);
$names[] = $origname;
$classes = array('mailbox');
@@ -187,9 +188,6 @@ class kolab_activesync_ui
$classes[] = $folder_class;
}
- $folder_id = 'rcmf' . html_identifier($folder);
- $padding = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level);
-
$table->add_row();
$table->add('subscription', $checkbox_sync->show(
!empty($subscribed[$folder]) ? $folder : null,
@@ -201,7 +199,7 @@ class kolab_activesync_ui
array('value' => $folder, 'id' => $folder_id.'_alarm')));
}
- $table->add(join(' ', $classes), html::label($folder_id, $padding . $foldername));
+ $table->add(join(' ', $classes), html::label($folder_id, $foldername));
}
return $table->show();
diff --git a/plugins/kolab_addressbook/kolab_addressbook.php b/plugins/kolab_addressbook/kolab_addressbook.php
index a85965e..818a47a 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.php
+++ b/plugins/kolab_addressbook/kolab_addressbook.php
@@ -173,7 +173,7 @@ class kolab_addressbook extends rcube_plugin
}
$kolab_sources = array();
- foreach ($this->_list_sources() as $abook_id => $abook) {
+ foreach (array_keys($this->_list_sources()) as $abook_id) {
if (!in_array($abook_id, $sources))
$kolab_sources[] = $abook_id;
}
@@ -250,7 +250,7 @@ class kolab_addressbook extends rcube_plugin
asort($names, SORT_LOCALE_STRING);
- foreach ($names as $utf7name => $name) {
+ foreach (array_keys($names) as $utf7name) {
// create instance of rcube_contacts
$abook_id = kolab_storage::folder_id($utf7name);
$abook = new rcube_kolab_contacts($utf7name);
@@ -305,9 +305,10 @@ class kolab_addressbook extends rcube_plugin
private function _sort_form_fields($contents)
{
- $block = array();
+ $block = array();
$contacts = reset($this->sources);
- foreach ($contacts->coltypes as $col => $prop) {
+
+ foreach (array_keys($contacts->coltypes) as $col) {
if (isset($contents[$col]))
$block[$col] = $contents[$col];
}
@@ -441,10 +442,10 @@ class kolab_addressbook extends rcube_plugin
// create display name for the folder (see self::address_sources())
if (strpos($folder, $delimiter)) {
$names = array();
- foreach ($this->_list_sources() as $abook_id => $abook) {
+ foreach ($this->_list_sources() as $abook) {
$realname = $abook->get_realname();
// The list can be not updated yet, handle old folder name
- if ($type == 'update' && $realname == $oldfolder) {
+ if ($type == 'update' && $realname == $prop['oldname']) {
$abook = $kolab_folder;
$realname = $folder;
}
diff --git a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
index a1504fb..7546046 100644
--- a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
+++ b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
@@ -116,8 +116,9 @@ class kolab_addressbook_ui
$hidden_fields[] = array('name' => '_source', 'value' => $folder);
- $folder = rcube_charset::convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP');
- $delim = $_SESSION['imap_delimiter'];
+ $folder = rcube_charset::convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP');
+ $storage = $this->rc->get_storage();
+ $delim = $storage->get_hierarchy_delimiter();
if ($this->rc->action == 'plugin.book-save') {
// save error
@@ -144,7 +145,7 @@ class kolab_addressbook_ui
if (strlen($folder)) {
$hidden_fields[] = array('name' => '_oldname', 'value' => $folder);
- $options = $this->rc->get_storage()->folder_info($folder);
+ $options = $storage->folder_info($folder);
}
$form = array();
@@ -155,7 +156,7 @@ class kolab_addressbook_ui
);
if (!empty($options) && ($options['norename'] || $options['protected'])) {
- $foldername = Q(str_replace($delimiter, ' &raquo; ', kolab_storage::object_name($folder)));
+ $foldername = Q(str_replace($delim, ' &raquo; ', kolab_storage::object_name($folder)));
}
else {
$foldername = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30));
diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index 4ff585f..5437056 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -44,7 +44,7 @@ class rcube_kolab_contacts extends rcube_addressbook
'jobtitle' => array('limit' => 1),
'organization' => array('limit' => 1),
'department' => array('limit' => 1),
- 'email' => array('subtypes' => null),
+ 'email' => array('subtypes' => array('home','work','other')),
'phone' => array(),
'address' => array('subtypes' => array('home','work','office')),
'website' => array('subtypes' => array('homepage','blog')),
@@ -245,11 +245,12 @@ class rcube_kolab_contacts extends rcube_addressbook
/**
* List the current set of contact records
*
- * @param array List of cols to show
- * @param int Only return this number of records, use negative values for tail
+ * @param array List of cols to show
+ * @param int Only return this number of records, use negative values for tail
+ *
* @return array Indexed list of contact records, each a hash array
*/
- public function list_records($cols=null, $subset=0)
+ public function list_records($cols = null, $subset = 0)
{
$this->result = new rcube_result_set(0, ($this->list_page-1) * $this->page_size);;
@@ -808,8 +809,9 @@ class rcube_kolab_contacts extends rcube_addressbook
$this->_fetch_groups(true);
$list = $this->distlists[$gid];
- foreach ((array)$list['member'] as $i => $member)
+ foreach ((array)$list['member'] as $member) {
$exists[] = $member['ID'];
+ }
// substract existing assignments from list
$ids = array_diff($ids, $exists);
@@ -1035,21 +1037,15 @@ class rcube_kolab_contacts extends rcube_addressbook
{
$record['ID'] = $this->_uid2id($record['uid']);
- if (is_array($record['phone'])) {
- $phones = $record['phone'];
- unset($record['phone']);
- foreach ((array)$phones as $i => $phone) {
- $key = 'phone' . ($phone['type'] ? ':' . $phone['type'] : '');
- $record[$key][] = $phone['number'];
- }
- }
-
- if (is_array($record['website'])) {
- $urls = $record['website'];
- unset($record['website']);
- foreach ((array)$urls as $i => $url) {
- $key = 'website' . ($url['type'] ? ':' . $url['type'] : '');
- $record[$key][] = $url['url'];
+ // convert email, website, phone values
+ foreach (array('email'=>'address', 'website'=>'url', 'phone'=>'number') as $col => $propname) {
+ if (is_array($record[$col])) {
+ $values = $record[$col];
+ unset($record[$col]);
+ foreach ((array)$values as $i => $val) {
+ $key = $col . ($val['type'] ? ':' . $val['type'] : '');
+ $record[$key][] = $val[$propname];
+ }
}
}
@@ -1098,31 +1094,22 @@ class rcube_kolab_contacts extends rcube_addressbook
else if (!$contact['uid'] && $old['uid'])
$contact['uid'] = $old['uid'];
- $contact['email'] = array_filter($this->get_col_values('email', $contact, true));
$contact['im'] = array_filter($this->get_col_values('im', $contact, true));
- $websites = array();
- $phones = array();
- $addresses = array();
-
- foreach ($this->get_col_values('website', $contact) as $type => $values) {
- foreach ((array)$values as $url) {
- if (!empty($url)) {
- $websites[] = array('url' => $url, 'type' => $type);
- }
- }
- unset($contact['website:'.$type]);
- }
-
- foreach ($this->get_col_values('phone', $contact) as $type => $values) {
- foreach ((array)$values as $phone) {
- if (!empty($phone)) {
- $phones[] = array('number' => $phone, 'type' => $type);
+ // convert email, website, phone values
+ foreach (array('email'=>'address', 'website'=>'url', 'phone'=>'number') as $col => $propname) {
+ $contact[$col] = array();
+ foreach ($this->get_col_values($col, $contact) as $type => $values) {
+ foreach ((array)$values as $val) {
+ if (!empty($val)) {
+ $contact[$col][] = array($propname => $val, 'type' => $type);
+ }
}
+ unset($contact[$col.':'.$type]);
}
- unset($contact['phone:'.$type]);
}
+ $addresses = array();
foreach ($this->get_col_values('address', $contact) as $type => $values) {
foreach ((array)$values as $adr) {
// skip empty address
@@ -1143,8 +1130,6 @@ class rcube_kolab_contacts extends rcube_addressbook
unset($contact['address:'.$type]);
}
- $contact['website'] = $websites;
- $contact['phone'] = $phones;
$contact['address'] = $addresses;
// copy meta data (starting with _) from old object
diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php
index 719df98..f511949 100644
--- a/plugins/kolab_auth/kolab_auth.php
+++ b/plugins/kolab_auth/kolab_auth.php
@@ -337,7 +337,7 @@ class kolab_auth extends rcube_plugin
// check group
if (!$isadmin && !empty($group)) {
$groups = $ldap->get_record_groups($record['ID']);
- foreach ($groups as $g => $prop) {
+ foreach (array_keys($groups) as $g) {
if ($group == rcube_ldap::dn_decode($g)) {
$isadmin = true;
break;
diff --git a/plugins/kolab_config/kolab_config.php b/plugins/kolab_config/kolab_config.php
index 23188cf..e5f07ad 100644
--- a/plugins/kolab_config/kolab_config.php
+++ b/plugins/kolab_config/kolab_config.php
@@ -68,7 +68,7 @@ class kolab_config extends rcube_plugin
$this->require_plugin('libkolab');
$this->folders = kolab_storage::get_folders('configuration');
- foreach ($this->folders as $i => $folder) {
+ foreach ($this->folders as $folder) {
if ($folder->default) {
$this->default = $folder;
break;
diff --git a/plugins/kolab_delegation/kolab_delegation.php b/plugins/kolab_delegation/kolab_delegation.php
index 8ec1f8b..156e81f 100644
--- a/plugins/kolab_delegation/kolab_delegation.php
+++ b/plugins/kolab_delegation/kolab_delegation.php
@@ -350,7 +350,6 @@ class kolab_delegation extends rcube_plugin
asort($list, SORT_LOCALE_STRING);
foreach ($list as $id => $delegate) {
- $name = $id;
$table->add_row(array('id' => 'rcmrow' . $id));
$table->add(null, Q($delegate));
}
@@ -415,7 +414,6 @@ class kolab_delegation extends rcube_plugin
$folder_data = $engine->list_folders($delegate['uid']);
$rights = array();
- $folders = array();
$folder_groups = array();
foreach ($folder_data as $folder_name => $folder) {
@@ -471,6 +469,7 @@ class kolab_delegation extends rcube_plugin
}
}
+ $folder_id = 'rcmf' . html_identifier($folder);
$names[] = $origname;
$classes = array('mailbox');
@@ -479,9 +478,6 @@ class kolab_delegation extends rcube_plugin
$classes[] = $folder_class;
}
- $folder_id = 'rcmf' . html_identifier($folder);
- $padding = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level);
-
$table->add_row();
$table->add('read', $checkbox_read->show(
$rights[$folder] >= kolab_delegation_engine::ACL_READ ? $folder : null,
@@ -490,7 +486,7 @@ class kolab_delegation extends rcube_plugin
$rights[$folder] >= kolab_delegation_engine::ACL_WRITE ? $folder : null,
array('value' => $folder, 'id' => $folder_id)));
- $table->add(join(' ', $classes), html::label($folder_id, $padding . $foldername));
+ $table->add(join(' ', $classes), html::label($folder_id, $foldername));
}
return $table->show();
diff --git a/plugins/kolab_delegation/kolab_delegation_engine.php b/plugins/kolab_delegation/kolab_delegation_engine.php
index 7b35f41..26f6b38 100644
--- a/plugins/kolab_delegation/kolab_delegation_engine.php
+++ b/plugins/kolab_delegation/kolab_delegation_engine.php
@@ -60,10 +60,10 @@ class kolab_delegation_engine
if (!is_array($delegate)) {
$delegate = $this->delegate_get($delegate);
}
- $dn = $delegate['ID'];
- $list = $this->list_delegates();
- $user = $this->user();
- $ldap = $this->ldap();
+
+ $dn = $delegate['ID'];
+ $list = $this->list_delegates();
+ $user = $this->user();
if (empty($delegate) || empty($dn)) {
return false;
@@ -133,7 +133,6 @@ class kolab_delegation_engine
$delegate = $this->delegate_get($dn);
$list = $this->list_delegates();
$user = $this->user();
- $ldap = $this->ldap();
if (empty($delegate) || !isset($list[$dn])) {
return false;
diff --git a/plugins/kolab_files/config.inc.php.dist b/plugins/kolab_files/config.inc.php.dist
index 29ec6f0..0c9704c 100644
--- a/plugins/kolab_files/config.inc.php.dist
+++ b/plugins/kolab_files/config.inc.php.dist
@@ -1,7 +1,7 @@
<?php
// URL of kolab-chwala installation
-$rcmail_config['kolab_files_url'] = 'https://localhost/kolab-chwala/public_html';
+$rcmail_config['kolab_files_url'] = 'https://' . $_SERVER["HTTP_HOST"] . '/chwala';
// List of files list columns. Available are: name, size, mtime, type
$rcmail_config['kolab_files_list_cols'] = array('name', 'mtime', 'size');
diff --git a/plugins/kolab_folders/kolab_folders.php b/plugins/kolab_folders/kolab_folders.php
index cf2bb77..12c0423 100644
--- a/plugins/kolab_folders/kolab_folders.php
+++ b/plugins/kolab_folders/kolab_folders.php
@@ -486,7 +486,6 @@ class kolab_folders extends rcube_plugin
$storage = $this->rc->get_storage();
$namespace = $storage->get_namespace();
$defaults = array();
- $need_update = false;
$prefix = '';
// Find personal namespace prefix
diff --git a/plugins/kolab_zpush/kolab_zpush_ui.php b/plugins/kolab_zpush/kolab_zpush_ui.php
index 3d2fbcc..0e8e6e9 100644
--- a/plugins/kolab_zpush/kolab_zpush_ui.php
+++ b/plugins/kolab_zpush/kolab_zpush_ui.php
@@ -143,7 +143,6 @@ class kolab_zpush_ui
}
$names[] = $origname;
-
$classes = array('mailbox');
if ($folder_class = $this->rc->folder_classname($folder)) {
@@ -152,9 +151,8 @@ class kolab_zpush_ui
}
$folder_id = 'rcmf' . html_identifier($folder);
- $padding = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level);
- $table->add_row(array('class' => (($level+1) * $idx++) % 2 == 0 ? 'even' : 'odd'));
+ $table->add_row();
$table->add('subscription', $checkbox_sync->show('', array('value' => $folder, 'id' => $folder_id)));
if ($alarms)
@@ -162,7 +160,7 @@ class kolab_zpush_ui
else
$table->add('alarm', '');
- $table->add(join(' ', $classes), html::label($folder_id, $padding . Q($foldername)));
+ $table->add(join(' ', $classes), html::label($folder_id, Q($foldername)));
}
return $table->show();
diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
index 138c506..5185f17 100644
--- a/plugins/libcalendaring/libcalendaring.php
+++ b/plugins/libcalendaring/libcalendaring.php
@@ -85,10 +85,11 @@ class libcalendaring extends rcube_plugin
// include client scripts and styles
if ($this->rc->output) {
- $this->include_script('libcalendaring.js');
- $this->rc->output->set_env('libcal_settings', $this->load_settings());
-
- $this->include_stylesheet($this->local_skin_path() . '/libcal.css');
+ if ($this->rc->output->type == 'html') {
+ $this->rc->output->set_env('libcal_settings', $this->load_settings());
+ $this->include_script('libcalendaring.js');
+ $this->include_stylesheet($this->local_skin_path() . '/libcal.css');
+ }
// add hook to display alarms
$this->add_hook('refresh', array($this, 'refresh'));
@@ -106,7 +107,7 @@ class libcalendaring extends rcube_plugin
public function adjust_timezone($dt)
{
if (is_numeric($dt))
- $dt = new DateTime('@'.$td);
+ $dt = new DateTime('@'.$dt);
else if (is_string($dt))
$dt = new DateTime($dt);
@@ -136,16 +137,16 @@ class libcalendaring extends rcube_plugin
// localization
$settings['days'] = array(
- rcube_label('sunday'), rcube_label('monday'),
- rcube_label('tuesday'), rcube_label('wednesday'),
- rcube_label('thursday'), rcube_label('friday'),
- rcube_label('saturday')
+ $this->rc->gettext('sunday'), $this->rc->gettext('monday'),
+ $this->rc->gettext('tuesday'), $this->rc->gettext('wednesday'),
+ $this->rc->gettext('thursday'), $this->rc->gettext('friday'),
+ $this->rc->gettext('saturday')
);
$settings['days_short'] = array(
- rcube_label('sun'), rcube_label('mon'),
- rcube_label('tue'), rcube_label('wed'),
- rcube_label('thu'), rcube_label('fri'),
- rcube_label('sat')
+ $this->rc->gettext('sun'), $this->rc->gettext('mon'),
+ $this->rc->gettext('tue'), $this->rc->gettext('wed'),
+ $this->rc->gettext('thu'), $this->rc->gettext('fri'),
+ $this->rc->gettext('sat')
);
$settings['months'] = array(
$this->rc->gettext('longjan'), $this->rc->gettext('longfeb'),
@@ -309,20 +310,25 @@ class libcalendaring extends rcube_plugin
list($trigger, $action) = explode(':', $alarm);
$text = '';
+ $rcube = rcube::get_instance();
+
switch ($action) {
case 'EMAIL':
- $text = rcube_label('libcalendaring.alarmemail');
+ $text = $rcube->gettext('libcalendaring.alarmemail');
break;
case 'DISPLAY':
- $text = rcube_label('libcalendaring.alarmdisplay');
+ $text = $rcube->gettext('libcalendaring.alarmdisplay');
break;
}
if (preg_match('/@(\d+)/', $trigger, $m)) {
- $text .= ' ' . rcube_label(array('name' => 'libcalendaring.alarmat', 'vars' => array('datetime' => format_date($m[1]))));
+ $text .= ' ' . $rcube->gettext(array(
+ 'name' => 'libcalendaring.alarmat',
+ 'vars' => array('datetime' => $rcube->format_date($m[1]))
+ ));
}
else if ($val = self::parse_alaram_value($trigger)) {
- $text .= ' ' . intval($val[0]) . ' ' . rcube_label('libcalendaring.trigger' . $val[1]);
+ $text .= ' ' . intval($val[0]) . ' ' . $rcube->gettext('libcalendaring.trigger' . $val[1]);
}
else
return false;
@@ -391,10 +397,10 @@ class libcalendaring extends rcube_plugin
// collect pending alarms from all providers (e.g. calendar, tasks)
$plugin = $this->rc->plugins->exec_hook('pending_alarms', array(
'time' => time(),
- 'alarms' => $alarms,
+ 'alarms' => array(),
));
- if (!$plugin['abort'] && $plugin['alarms']) {
+ if (!$plugin['abort'] && !empty($plugin['alarms'])) {
// make sure texts and env vars are available on client
$this->add_texts('localization/', true);
$this->rc->output->set_env('snooze_select', $this->snooze_select());
@@ -407,8 +413,8 @@ class libcalendaring extends rcube_plugin
*/
public function alarms_action()
{
- $action = get_input_value('action', RCUBE_INPUT_GPC);
- $data = get_input_value('data', RCUBE_INPUT_POST, true);
+// $action = rcube_utils::get_input_value('action', rcube_utils::INPUT_GPC);
+ $data = rcube_utils::get_input_value('data', rcube_utils::INPUT_POST, true);
$data['ids'] = explode(',', $data['id']);
$plugin = $this->rc->plugins->exec_hook('dismiss_alarms', $data);
@@ -476,11 +482,11 @@ class libcalendaring extends rcube_plugin
{
// Upload progress update
if (!empty($_GET['_progress'])) {
- rcube_upload_progress();
+ $this->rc->upload_progress();
}
- $recid = $id_prefix . get_input_value('_id', RCUBE_INPUT_GPC);
- $uploadid = get_input_value('_uploadid', RCUBE_INPUT_GPC);
+ $recid = $id_prefix . rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC);
+ $uploadid = rcube_utils::get_input_value('_uploadid', rcube_utils::INPUT_GPC);
if (!is_array($_SESSION[$session_key]) || $_SESSION[$session_key]['id'] != $recid) {
$_SESSION[$session_key] = array();
@@ -501,7 +507,7 @@ class libcalendaring extends rcube_plugin
'path' => $filepath,
'size' => $_FILES['_attachments']['size'][$i],
'name' => $_FILES['_attachments']['name'][$i],
- 'mimetype' => rc_mime_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]),
+ 'mimetype' => rcube_mime::file_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]),
'group' => $recid,
);
@@ -518,18 +524,18 @@ class libcalendaring extends rcube_plugin
if (($icon = $_SESSION[$session_key . '_deleteicon']) && is_file($icon)) {
$button = html::img(array(
'src' => $icon,
- 'alt' => rcube_label('delete')
+ 'alt' => $this->rc->gettext('delete')
));
}
else {
- $button = Q(rcube_label('delete'));
+ $button = Q($this->rc->gettext('delete'));
}
$content = html::a(array(
'href' => "#delete",
'class' => 'delete',
'onclick' => sprintf("return %s.remove_from_attachment_list('rcmfile%s')", JS_OBJECT_NAME, $id),
- 'title' => rcube_label('delete'),
+ 'title' => $this->rc->gettext('delete'),
), $button);
$content .= Q($attachment['name']);
@@ -543,14 +549,14 @@ class libcalendaring extends rcube_plugin
}
else { // upload failed
if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) {
- $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array(
+ $msg = $this->rc->gettext(array('name' => 'filesizeerror', 'vars' => array(
'size' => show_bytes(parse_bytes(ini_get('upload_max_filesize'))))));
}
else if ($attachment['error']) {
$msg = $attachment['error'];
}
else {
- $msg = rcube_label('fileuploaderror');
+ $msg = $this->rc->gettext('fileuploaderror');
}
$this->rc->output->command('display_message', $msg, 'error');
@@ -562,10 +568,10 @@ class libcalendaring extends rcube_plugin
// if filesize exceeds post_max_size then $_FILES array is empty,
// show filesizeerror instead of fileuploaderror
if ($maxsize = ini_get('post_max_size'))
- $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array(
+ $msg = $this->rc->gettext(array('name' => 'filesizeerror', 'vars' => array(
'size' => show_bytes(parse_bytes($maxsize)))));
else
- $msg = rcube_label('fileuploaderror');
+ $msg = $this->rc->gettext('fileuploaderror');
$this->rc->output->command('display_message', $msg, 'error');
$this->rc->output->command('remove_from_attachment_list', $uploadid);
@@ -659,7 +665,7 @@ class libcalendaring extends rcube_plugin
public function attachment_loading_page()
{
$url = str_replace('&_preload=1', '', $_SERVER['REQUEST_URI']);
- $message = rcube_label('loadingdata');
+ $message = $this->rc->gettext('loadingdata');
header('Content-Type: text/html; charset=' . RCMAIL_CHARSET);
print "<html>\n<head>\n"
@@ -690,13 +696,13 @@ class libcalendaring extends rcube_plugin
$table = new html_table(array('cols' => 3));
if (!empty($this->attachment['name'])) {
- $table->add('title', Q(rcube_label('filename')));
+ $table->add('title', Q($this->rc->gettext('filename')));
$table->add('header', Q($this->attachment['name']));
- $table->add('download-link', html::a('?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), Q(rcube_label('download'))));
+ $table->add('download-link', html::a('?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), Q($this->rc->gettext('download'))));
}
if (!empty($this->attachment['size'])) {
- $table->add('title', Q(rcube_label('filesize')));
+ $table->add('title', Q($this->rc->gettext('filesize')));
$table->add('header', Q(show_bytes($this->attachment['size'])));
}
diff --git a/plugins/libkolab/lib/kolab_format_contact.php b/plugins/libkolab/lib/kolab_format_contact.php
index 3676f05..99b25bc 100644
--- a/plugins/libkolab/lib/kolab_format_contact.php
+++ b/plugins/libkolab/lib/kolab_format_contact.php
@@ -47,6 +47,12 @@ class kolab_format_contact extends kolab_format
'other' => Telephone::Textphone,
);
+ public $emailtypes = array(
+ 'home' => Email::Home,
+ 'work' => Email::Work,
+ 'other' => Email::NoType,
+ );
+
public $addresstypes = array(
'home' => Address::Home,
'work' => Address::Work,
@@ -125,10 +131,21 @@ class kolab_format_contact extends kolab_format
}
$org->setRelateds($rels);
- // email, im, url
- $this->obj->setEmailAddresses(self::array2vector($object['email']));
+ // im, email, url
$this->obj->setIMaddresses(self::array2vector($object['im']));
+ if (class_exists('vectoremail')) {
+ $vemails = new vectoremail;
+ foreach ((array)$object['email'] as $email) {
+ $type = $this->emailtypes[$email['type']];
+ $vemails->push(new Email($email['address'], intval($type)));
+ }
+ }
+ else {
+ $vemails = self::array2vector(array_map(function($v){ return $v['address']; }, $object['email']));
+ }
+ $this->obj->setEmailAddresses($vemails);
+
$vurls = new vectorurl;
foreach ((array)$object['website'] as $url) {
$type = $url['type'] == 'blog' ? Url::Blog : Url::NoType;
@@ -290,8 +307,19 @@ class kolab_format_contact extends kolab_format
$this->read_relateds($org->relateds(), $object);
}
- $object['email'] = self::vector2array($this->obj->emailAddresses());
- $object['im'] = self::vector2array($this->obj->imAddresses());
+ $object['im'] = self::vector2array($this->obj->imAddresses());
+
+ $emails = $this->obj->emailAddresses();
+ if ($emails instanceof vectoremail) {
+ $emailtypes = array_flip($this->emailtypes);
+ for ($i=0; $i < $emails->size(); $i++) {
+ $email = $emails->get($i);
+ $object['email'][] = array('address' => $email->address(), 'type' => $emailtypes[$email->types()]);
+ }
+ }
+ else {
+ $object['email'] = self::vector2array($emails);
+ }
$urls = $this->obj->urls();
for ($i=0; $i < $urls->size(); $i++) {
diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php
index a32f40c..e050774 100644
--- a/plugins/libkolab/lib/kolab_format_event.php
+++ b/plugins/libkolab/lib/kolab_format_event.php
@@ -168,7 +168,7 @@ class kolab_format_event extends kolab_format_xcal
if ($status == kolabformat::StatusTentative)
$object['free_busy'] = 'tentative';
else if ($status == kolabformat::StatusCancelled)
- $objec['cancelled'] = true;
+ $object['cancelled'] = true;
// handle attachments
$vattach = $this->obj->attachments();
@@ -235,16 +235,15 @@ class kolab_format_event extends kolab_format_xcal
*/
private function compact_exception($exception, $master)
{
- static $forbidden = array('recurrence','organizer','attendees','sequence');
+ $forbidden = array('recurrence','organizer','attendees','sequence');
- $out = $exception;
- foreach ($exception as $prop => $val) {
- if (in_array($prop, $forbidden)) {
- unset($out[$prop]);
+ foreach ($forbidden as $prop) {
+ if (array_key_exists($prop, $exception)) {
+ unset($exception[$prop]);
}
}
- return $out;
+ return $exception;
}
/**
diff --git a/plugins/libkolab/lib/kolab_format_xcal.php b/plugins/libkolab/lib/kolab_format_xcal.php
index 9249155..65f426e 100644
--- a/plugins/libkolab/lib/kolab_format_xcal.php
+++ b/plugins/libkolab/lib/kolab_format_xcal.php
@@ -105,7 +105,7 @@ abstract class kolab_format_xcal extends kolab_format
'title' => $this->obj->summary(),
'location' => $this->obj->location(),
'description' => $this->obj->description(),
- 'status' => $this->status_map[$this->obj->status()],
+ 'status' => $status_map[$this->obj->status()],
'sensitivity' => $sensitivity_map[$this->obj->classification()],
'priority' => $this->obj->priority(),
'categories' => self::vector2array($this->obj->categories()),
diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php
index 7d5e1c6..08e11b2 100644
--- a/plugins/libkolab/lib/kolab_storage.php
+++ b/plugins/libkolab/lib/kolab_storage.php
@@ -39,7 +39,6 @@ class kolab_storage
private static $subscriptions;
private static $states;
private static $config;
- private static $cache;
private static $imap;
@@ -291,7 +290,7 @@ class kolab_storage
else {
// these characters are problematic e.g. when used in LIST/LSUB
foreach (array($delimiter, '%', '*') as $char) {
- if (strpos($folder, $delimiter) !== false) {
+ if (strpos($folder, $char) !== false) {
self::$last_error = 'forbiddencharacter';
return false;
}
diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
index 9c80b28..4ba40a0 100644
--- a/plugins/libkolab/lib/kolab_storage_cache.php
+++ b/plugins/libkolab/lib/kolab_storage_cache.php
@@ -157,7 +157,7 @@ class kolab_storage_cache
{
// delegate to another cache instance
if ($foldername && $foldername != $this->folder->name) {
- return kolab_storage::get_folder($foldername)->cache->get($msguid, $object);
+ return kolab_storage::get_folder($foldername)->cache->get($msguid, $type);
}
// load object if not in memory
@@ -275,12 +275,12 @@ class kolab_storage_cache
* @param string Entry's Object UID
* @param string Target IMAP folder to move it to
*/
- public function move($msguid, $objuid, $target_folder)
+ public function move($msguid, $uid, $target_folder)
{
$target = kolab_storage::get_folder($target_folder);
// resolve new message UID in target folder
- if ($new_msguid = $target->cache->uid2msguid($objuid)) {
+ if ($new_msguid = $target->cache->uid2msguid($uid)) {
$this->db->query(
"UPDATE kolab_cache SET resource=?, msguid=? ".
"WHERE resource=? AND msguid=? AND type<>?",
@@ -418,7 +418,7 @@ class kolab_storage_cache
$sql_where = '';
foreach ($query as $param) {
if (is_array($param[0])) {
- $subs = array();
+ $subq = array();
foreach ($param[0] as $q) {
$subq[] = preg_replace('/^\s*AND\s+/i', '', $this->_sql_where(array($q)));
}
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index 2c6f04c..702b621 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -55,7 +55,6 @@ class kolab_storage_folder
private $idata;
private $owner;
private $resource_uri;
- private $uid2msg = array();
/**
@@ -161,7 +160,6 @@ class kolab_storage_folder
break;
default:
- $owner = '';
list($prefix, $user) = explode($this->imap->get_hierarchy_delimiter(), $info['name']);
if (strpos($user, '@') === false) {
$domain = strstr($rcmail->get_user_name(), '@');
@@ -635,7 +633,7 @@ class kolab_storage_folder
}
// save contact photo to attachment for Kolab2 format
- if (kolab_storage::$version == '2.0' && $object['photo'] && !$existing_photo) {
+ if (kolab_storage::$version == '2.0' && $object['photo']) {
$attkey = 'kolab-picture.png'; // this file name is hard-coded in libkolab/kolabformatV2/contact.cpp
$object['_attachments'][$attkey] = array(
'mimetype'=> rc_image_content_type($object['photo']),
@@ -843,7 +841,7 @@ class kolab_storage_folder
public function move($uid, $target_folder)
{
if ($msguid = $this->cache->uid2msguid($uid)) {
- if ($success = $this->imap->move_message($msguid, $target_folder, $this->name)) {
+ if ($this->imap->move_message($msguid, $target_folder, $this->name)) {
$this->cache->move($msguid, $uid, $target_folder);
return true;
}
diff --git a/plugins/logon_page/logon_page.php b/plugins/logon_page/logon_page.php
index 4c69099..8dee962 100644
--- a/plugins/logon_page/logon_page.php
+++ b/plugins/logon_page/logon_page.php
@@ -63,6 +63,6 @@ class logon_page extends rcube_plugin
$rcmail->output->add_footer($html);
}
- return $arg;
+ return $args;
}
}
diff --git a/plugins/odfviewer/odfviewer.php b/plugins/odfviewer/odfviewer.php
index 950b2dd..39d88de 100644
--- a/plugins/odfviewer/odfviewer.php
+++ b/plugins/odfviewer/odfviewer.php
@@ -136,8 +136,6 @@ class odfviewer extends rcube_plugin
*/
function gc_cleanup()
{
- $rcmail = rcube::get_instance();
-
$tmp = unslashify($this->tempdir);
$expire = mktime() - 172800; // expire in 48 hours
diff --git a/plugins/pdfviewer/README b/plugins/pdfviewer/README
index 5362887..57478cd 100644
--- a/plugins/pdfviewer/README
+++ b/plugins/pdfviewer/README
@@ -7,7 +7,7 @@ by andreasgal. See http://mozilla.github.com/pdf.js/ for more information.
INSTALLATION
------------
-Add 'odfviewer' to the list of plugins in the config/main.inc.php file
+Add 'pdfviewer' to the list of plugins in the config/main.inc.php file
of your Roundcube installation.
diff --git a/plugins/pdfviewer/pdfviewer.php b/plugins/pdfviewer/pdfviewer.php
index b6da2d2..93369da 100644
--- a/plugins/pdfviewer/pdfviewer.php
+++ b/plugins/pdfviewer/pdfviewer.php
@@ -83,7 +83,7 @@ class pdfviewer extends rcube_plugin
public function part_structure($args)
{
if (!empty($args['structure']->parts)) {
- foreach ($args['structure']->parts as $i => $part) {
+ foreach (array_keys($args['structure']->parts) as $i) {
$this->fix_mime_part($args['structure']->parts[$i], $args['object']);
}
}
diff --git a/plugins/tasklist/drivers/database/tasklist_database_driver.php b/plugins/tasklist/drivers/database/tasklist_database_driver.php
index ae2b5e2..5c6a0ed 100644
--- a/plugins/tasklist/drivers/database/tasklist_database_driver.php
+++ b/plugins/tasklist/drivers/database/tasklist_database_driver.php
@@ -30,14 +30,11 @@ class tasklist_database_driver extends tasklist_driver
private $rc;
private $plugin;
- private $cache = array();
private $lists = array();
private $list_ids = '';
private $db_tasks = 'tasks';
private $db_lists = 'tasklists';
- private $sequence_tasks = 'task_ids';
- private $sequence_lists = 'tasklist_ids';
/**
@@ -51,8 +48,6 @@ class tasklist_database_driver extends tasklist_driver
// read database config
$this->db_lists = $this->rc->config->get('db_table_lists', $this->db_lists);
$this->db_tasks = $this->rc->config->get('db_table_tasks', $this->db_tasks);
- $this->sequence_lists = $this->rc->config->get('db_sequence_lists', $this->sequence_lists);
- $this->sequence_tasks = $this->rc->config->get('db_sequence_tasks', $this->sequence_tasks);
$this->_read_lists();
}
@@ -119,7 +114,7 @@ class tasklist_database_driver extends tasklist_driver
);
if ($result)
- return $this->rc->db->insert_id($this->sequence_lists);
+ return $this->rc->db->insert_id($this->db_lists);
return false;
}
@@ -177,12 +172,13 @@ class tasklist_database_driver extends tasklist_driver
public function remove_list($prop)
{
$list_id = $prop['id'];
+
if ($this->lists[$list_id]) {
// delete all tasks linked with this list
$this->rc->db->query(
"DELETE FROM " . $this->db_tasks . "
WHERE tasklist_id=?",
- $lisr_id
+ $list_id
);
// delete list record
@@ -305,8 +301,6 @@ class tasklist_database_driver extends tasklist_driver
$tasks = array();
if (!empty($list_ids)) {
- $datecol = $this->rc->db->quote_identifier('date');
- $timecol = $this->rc->db->quote_identifier('time');
$result = $this->rc->db->query(sprintf(
"SELECT * FROM " . $this->db_tasks . "
WHERE tasklist_id IN (%s)
@@ -528,7 +522,7 @@ class tasklist_database_driver extends tasklist_driver
);
if ($result)
- return $this->rc->db->insert_id($this->sequence_tasks);
+ return $this->rc->db->insert_id($this->db_tasks);
return false;
}
diff --git a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
index a713311..078243a 100644
--- a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
+++ b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
@@ -68,7 +68,7 @@ class tasklist_kolab_driver extends tasklist_driver
// convert to UTF8 and sort
$names = array();
$default_folder = null;
- foreach ($this->folders as $i => $folder) {
+ foreach ($this->folders as $folder) {
$names[$folder->name] = rcube_charset::convert($folder->name, 'UTF7-IMAP');
$this->folders[$folder->name] = $folder;
if ($folder->default)
diff --git a/plugins/tasklist/drivers/tasklist_driver.php b/plugins/tasklist/drivers/tasklist_driver.php
index 40d0d9b..cc9a409 100644
--- a/plugins/tasklist/drivers/tasklist_driver.php
+++ b/plugins/tasklist/drivers/tasklist_driver.php
@@ -266,7 +266,7 @@ abstract class tasklist_driver
public function tasklist_edit_form($formfields)
{
$html = '';
- foreach ($formfields as $prop => $field) {
+ foreach ($formfields as $field) {
$html .= html::div('form-section',
html::label($field['id'], $field['label']) .
$field['value']);
diff --git a/plugins/tasklist/tasklist.php b/plugins/tasklist/tasklist.php
index 35c528c..6ebddc4 100644
--- a/plugins/tasklist/tasklist.php
+++ b/plugins/tasklist/tasklist.php
@@ -247,7 +247,7 @@ class tasklist extends rcube_plugin
break;
case 'collapse':
- if ($collapsed = intval(get_input_value('collapsed', RCUBE_INPUT_GPC))) {
+ if (intval(get_input_value('collapsed', RCUBE_INPUT_GPC))) {
$this->collapsed_tasks[] = $rec['id'];
}
else {
@@ -383,7 +383,7 @@ class tasklist extends rcube_plugin
}
// alarms cannot work without a date
- if ($rec['alarms'] && !$rec['date'] && !$rec['startdate'] && strpos($task['alarms'], '@') === false)
+ if ($rec['alarms'] && !$rec['date'] && !$rec['startdate'] && strpos($rec['alarms'], '@') === false)
$rec['alarms'] = '';
$attachments = array();
diff --git a/plugins/tinymce_config/tinymce_config.php b/plugins/tinymce_config/tinymce_config.php
index e6e5828..07b14e6 100644
--- a/plugins/tinymce_config/tinymce_config.php
+++ b/plugins/tinymce_config/tinymce_config.php
@@ -42,6 +42,7 @@ class tinymce_config extends rcube_plugin
$script = sprintf('$.extend(window.rcmail_editor_settings, %s);', json_encode($config));
$rcmail->output->add_script($script, 'foot');
+
+ return $args;
}
}
-