Avoid unused variables (also fixed some bugs) found in static code analysis
This commit is contained in:
parent
5738a7a7ec
commit
ac4f6e7562
23 changed files with 36 additions and 53 deletions
|
@ -61,7 +61,6 @@ class calendar extends rcube_plugin
|
|||
private $ical;
|
||||
private $itip;
|
||||
private $driver;
|
||||
private $ics_parts = array();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -2469,7 +2468,7 @@ class calendar extends rcube_plugin
|
|||
public function mail_messages_list($p)
|
||||
{
|
||||
if (in_array('attachment', (array)$p['cols']) && !empty($p['messages'])) {
|
||||
foreach ($p['messages'] as $i => $header) {
|
||||
foreach ($p['messages'] as $header) {
|
||||
$part = new StdClass;
|
||||
$part->mimetype = $header->ctype;
|
||||
if (libcalendaring::part_is_vcalendar($part)) {
|
||||
|
@ -2873,7 +2872,7 @@ class calendar extends rcube_plugin
|
|||
$part = $imap->get_message_part($uid, $mime_id);
|
||||
if ($part->ctype_parameters['charset'])
|
||||
$charset = $part->ctype_parameters['charset'];
|
||||
$headers = $imap->get_message_headers($uid);
|
||||
// $headers = $imap->get_message_headers($uid);
|
||||
|
||||
if ($part) {
|
||||
$events = $this->get_ical()->import($part, $charset);
|
||||
|
|
|
@ -1186,7 +1186,7 @@ class database_driver extends calendar_driver
|
|||
" WHERE user_id=?",
|
||||
$user->ID);
|
||||
|
||||
while ($row = $db->fetch_assoc($calendars)) {
|
||||
while ($row = $db->fetch_assoc($events)) {
|
||||
$event_ids[] = $row['event_id'];
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,6 @@ class kolab_calendar extends kolab_storage_folder_api
|
|||
*/
|
||||
public function get_caldav_url()
|
||||
{
|
||||
$url = null;
|
||||
if ($template = $this->cal->rc->config->get('calendar_caldav_url', null)) {
|
||||
return strtr($template, array(
|
||||
'%h' => $_SERVER['HTTP_HOST'],
|
||||
|
|
|
@ -225,7 +225,7 @@ class kolab_user_calendar extends kolab_calendar
|
|||
}
|
||||
|
||||
$events = array();
|
||||
foreach ($this->events as $id => $event) {
|
||||
foreach ($this->events as $event) {
|
||||
// list events in requested time window
|
||||
if ($event['start'] <= $end_dt && $event['end'] >= $start_dt &&
|
||||
(!$limit_changed || !$event['changed'] || $event['changed'] >= $limit_changed)) {
|
||||
|
@ -310,8 +310,6 @@ class kolab_user_calendar extends kolab_calendar
|
|||
$ical = $this->cal->get_ical();
|
||||
$ical->import($fbdata);
|
||||
if ($fb = $ical->freebusy) {
|
||||
$result = array();
|
||||
|
||||
// consider 'changed >= X' queries
|
||||
if ($limit_changed && $fb['created'] && $fb['created'] < $limit_changed) {
|
||||
return 0;
|
||||
|
|
|
@ -86,7 +86,6 @@ class kolab_activesync extends rcube_plugin
|
|||
function folder_form($args)
|
||||
{
|
||||
$mbox_imap = $args['options']['name'];
|
||||
$myrights = $args['options']['rights'];
|
||||
|
||||
// Edited folder name (empty in create-folder mode)
|
||||
if (!strlen($mbox_imap)) {
|
||||
|
|
|
@ -102,7 +102,6 @@ class kolab_addressbook extends rcube_plugin
|
|||
public function address_sources($p)
|
||||
{
|
||||
$abook_prio = $this->addressbook_prio();
|
||||
$undelete = $this->rc->config->get('undo_timeout');
|
||||
|
||||
// Disable all global address books
|
||||
// Assumes that all non-kolab_addressbook sources are global
|
||||
|
@ -239,7 +238,6 @@ class kolab_addressbook extends rcube_plugin
|
|||
*/
|
||||
protected function addressbook_list_item($id, $source, &$jsdata, $search_mode = false)
|
||||
{
|
||||
$folder = $this->folders[$id];
|
||||
$current = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC);
|
||||
|
||||
if (!$source['virtual']) {
|
||||
|
@ -433,7 +431,6 @@ class kolab_addressbook extends rcube_plugin
|
|||
}
|
||||
|
||||
// convert to UTF8 and sort
|
||||
$names = array();
|
||||
foreach ($folders as $folder) {
|
||||
// create instance of rcube_contacts
|
||||
$abook_id = $folder->id;
|
||||
|
@ -632,7 +629,6 @@ class kolab_addressbook extends rcube_plugin
|
|||
$props['parent'] = kolab_storage::folder_id($kolab_folder->get_parent(), true);
|
||||
|
||||
$this->rc->output->show_message('kolab_addressbook.book'.$type.'d', 'confirmation');
|
||||
$this->rc->output->command('set_env', 'delimiter', $delimiter);
|
||||
$this->rc->output->command('book_update', $props, kolab_storage::folder_id($prop['oldname'], true));
|
||||
$this->rc->output->send('iframe');
|
||||
}
|
||||
|
|
|
@ -213,7 +213,6 @@ class rcube_kolab_contacts extends rcube_addressbook
|
|||
*/
|
||||
public function get_carddav_url()
|
||||
{
|
||||
$url = null;
|
||||
$rcmail = rcmail::get_instance();
|
||||
if ($template = $rcmail->config->get('kolab_addressbook_carddav_url', null)) {
|
||||
return strtr($template, array(
|
||||
|
@ -443,7 +442,7 @@ class rcube_kolab_contacts extends rcube_addressbook
|
|||
$this->filter = array('fields' => $fields, 'value' => $value, 'mode' => $mode, 'ids' => array());
|
||||
|
||||
// search by iterating over all records in dataset
|
||||
foreach ($this->dataset as $i => $record) {
|
||||
foreach ($this->dataset as $record) {
|
||||
$contact = $this->_to_rcube_contact($record);
|
||||
$id = $contact['ID'];
|
||||
|
||||
|
|
|
@ -88,8 +88,6 @@ class kolab_auth extends rcube_plugin
|
|||
*/
|
||||
public function startup($args)
|
||||
{
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
// Check access rights when logged in as another user
|
||||
if (!empty($_SESSION['kolab_auth_admin']) && $args['task'] != 'login' && $args['task'] != 'logout') {
|
||||
// access to specified task is forbidden,
|
||||
|
|
|
@ -57,8 +57,6 @@ class kolab_auth_ldap extends rcube_ldap_generic
|
|||
*/
|
||||
private function _connect()
|
||||
{
|
||||
$rcube = rcube::get_instance();
|
||||
|
||||
// try to connect + bind for every host configured
|
||||
// with OpenLDAP 2.x ldap_connect() always succeeds but ldap_bind will fail if host isn't reachable
|
||||
// see http://www.php.net/manual/en/function.ldap-connect.php
|
||||
|
|
|
@ -30,7 +30,6 @@ class kolab_config extends rcube_plugin
|
|||
{
|
||||
public $task = 'utils';
|
||||
|
||||
private $enabled;
|
||||
private $config;
|
||||
private $dicts = array();
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ class kolab_delegation_engine
|
|||
}
|
||||
|
||||
$list = $this->list_delegates();
|
||||
$user = $this->user();
|
||||
|
||||
// add delegate to the list
|
||||
$list = array_keys((array)$list);
|
||||
|
@ -448,7 +447,7 @@ class kolab_delegation_engine
|
|||
// sort users index
|
||||
asort($keys, SORT_LOCALE_STRING);
|
||||
// re-sort users according to index
|
||||
foreach ($keys as $idx => $val) {
|
||||
foreach (array_keys($keys) as $idx) {
|
||||
$keys[$idx] = $users[$idx];
|
||||
}
|
||||
$users = array_values($keys);
|
||||
|
|
|
@ -463,7 +463,7 @@ class kolab_files_engine
|
|||
$inner = $this->rc->gettext('listoptions');
|
||||
|
||||
if (is_string($attrib['optionsmenuicon']) && $attrib['optionsmenuicon'] != 'true') {
|
||||
$inner = html::img(array('src' => $skin_path . $attrib['optionsmenuicon'], 'alt' => $RCMAIL->gettext('listoptions')));
|
||||
$inner = html::img(array('src' => $skin_path . $attrib['optionsmenuicon'], 'alt' => $this->rc->gettext('listoptions')));
|
||||
}
|
||||
|
||||
$list_menu = html::a(array(
|
||||
|
|
|
@ -893,7 +893,7 @@ class kolab_notes extends rcube_plugin
|
|||
if (!empty($args['param']['with_notes'])) {
|
||||
$uids = explode(',', $args['param']['with_notes']);
|
||||
$list = $args['param']['notes_list'];
|
||||
$attachments = array();
|
||||
|
||||
foreach ($uids as $uid) {
|
||||
if ($note = $this->get_note(array('uid' => $uid, 'list' => $list))) {
|
||||
$args['attachments'][] = array(
|
||||
|
|
|
@ -154,7 +154,7 @@ class kolab_tags_engine
|
|||
|
||||
// ...filter members by folder/uid prefix
|
||||
foreach ((array) $tag['members'] as $idx => $member) {
|
||||
foreach ($filter as $folder => $members) {
|
||||
foreach ($filter as $members) {
|
||||
// list of prefixes
|
||||
if (is_array($members)) {
|
||||
foreach ($members as $message) {
|
||||
|
|
|
@ -353,7 +353,7 @@ class libcalendaring_itip
|
|||
if ($existing) {
|
||||
$rsvp = $event['rsvp'];
|
||||
$emails = $this->lib->get_user_emails();
|
||||
foreach ($existing['attendees'] as $i => $attendee) {
|
||||
foreach ($existing['attendees'] as $attendee) {
|
||||
if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
|
||||
$status = strtoupper($attendee['status']);
|
||||
break;
|
||||
|
|
|
@ -318,7 +318,7 @@ class libvcalendar implements Iterator
|
|||
if (!$seen[$object['uid']]++) {
|
||||
// parse recurrence exceptions
|
||||
if ($object['recurrence']) {
|
||||
foreach ($vobject->children as $i => $component) {
|
||||
foreach ($vobject->children as $component) {
|
||||
if ($component->name == 'VEVENT' && isset($component->{'RECURRENCE-ID'})) {
|
||||
$object['recurrence']['EXCEPTIONS'][] = $this->_to_array($component);
|
||||
}
|
||||
|
@ -391,7 +391,6 @@ class libvcalendar implements Iterator
|
|||
}
|
||||
|
||||
// map other attributes to internal fields
|
||||
$_attendees = array();
|
||||
foreach ($ve->children as $prop) {
|
||||
if (!($prop instanceof VObject\Property))
|
||||
continue;
|
||||
|
@ -857,7 +856,6 @@ class libvcalendar implements Iterator
|
|||
*/
|
||||
public function export($objects, $method = null, $write = false, $get_attachment = false, $with_timezones = true)
|
||||
{
|
||||
$memory_limit = parse_bytes(ini_get('memory_limit'));
|
||||
$this->method = $method;
|
||||
|
||||
// encapsulate in VCALENDAR container
|
||||
|
@ -1095,10 +1093,13 @@ class libvcalendar implements Iterator
|
|||
if ($event['comment'])
|
||||
$ve->add('COMMENT', $event['comment']);
|
||||
|
||||
$memory_limit = parse_bytes(ini_get('memory_limit'));
|
||||
|
||||
// export attachments
|
||||
if (!empty($event['attachments'])) {
|
||||
foreach ((array)$event['attachments'] as $attach) {
|
||||
// check available memory and skip attachment export if we can't buffer it
|
||||
// @todo: use rcube_utils::mem_check()
|
||||
if (is_callable($get_attachment) && $memory_limit > 0 && ($memory_used = function_exists('memory_get_usage') ? memory_get_usage() : 16*1024*1024)
|
||||
&& $attach['size'] && $memory_used + $attach['size'] * 3 > $memory_limit) {
|
||||
continue;
|
||||
|
|
|
@ -36,7 +36,7 @@ class kolab_bonnie_api
|
|||
*/
|
||||
public function __construct($config)
|
||||
{
|
||||
$this->config = $confg;
|
||||
$this->config = $config;
|
||||
|
||||
$this->client = new kolab_bonnie_api_client($config['uri'], $config['timeout'] ?: 5, (bool)$config['debug']);
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class kolab_format_event extends kolab_format_xcal
|
|||
$vexceptions = new vectorevent;
|
||||
foreach((array)$object['recurrence']['EXCEPTIONS'] as $exception) {
|
||||
$exevent = new kolab_format_event;
|
||||
$exevent->set($this->compact_exception($exception, $object)); // only save differing values
|
||||
$exevent->set($this->compact_exception($exception)); // only save differing values
|
||||
$exevent->obj->setRecurrenceID(self::get_datetime($exception['start'], null, true), (bool)$exception['thisandfuture']);
|
||||
$vexceptions->push($exevent->obj);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ class kolab_format_event extends kolab_format_xcal
|
|||
/**
|
||||
* Remove some attributes from the exception container
|
||||
*/
|
||||
private function compact_exception($exception, $master)
|
||||
private function compact_exception($exception)
|
||||
{
|
||||
$forbidden = array('recurrence','organizer','attendees','sequence');
|
||||
|
||||
|
|
|
@ -403,13 +403,13 @@ class kolab_storage
|
|||
'oldname' => $oldname, 'newname' => $newname));
|
||||
|
||||
$oldfolder = self::get_folder($oldname);
|
||||
$active = self::folder_is_active($oldname);
|
||||
$success = self::$imap->rename_folder($oldname, $newname);
|
||||
$active = self::folder_is_active($oldname);
|
||||
$success = self::$imap->rename_folder($oldname, $newname);
|
||||
self::$last_error = self::$imap->get_error_str();
|
||||
|
||||
// pass active state to new folder name
|
||||
if ($success && $active) {
|
||||
self::set_state($oldnam, false);
|
||||
self::set_state($oldname, false);
|
||||
self::set_state($newname, true);
|
||||
}
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ class kolab_storage
|
|||
return $types[self::CTYPE_KEY_PRIVATE];
|
||||
}
|
||||
else if (!empty($types[self::CTYPE_KEY])) {
|
||||
list($ctype, $suffix) = explode('.', $types[self::CTYPE_KEY]);
|
||||
list($ctype, ) = explode('.', $types[self::CTYPE_KEY]);
|
||||
return $ctype;
|
||||
}
|
||||
return null;
|
||||
|
@ -1464,7 +1464,7 @@ class kolab_storage
|
|||
$user_attrib = self::$config->get('kolab_users_id_attrib', self::$config->get('kolab_auth_login', 'mail'));
|
||||
|
||||
array_walk($results, function(&$user, $dn) use ($root, $user_attrib) {
|
||||
list($localpart, $domain) = explode('@', $user[$user_attrib]);
|
||||
list($localpart, ) = explode('@', $user[$user_attrib]);
|
||||
$user['kolabtargetfolder'] = $root . $localpart;
|
||||
});
|
||||
|
||||
|
|
|
@ -431,7 +431,7 @@ class kolab_storage_cache
|
|||
/**
|
||||
* Remove all objects from local cache
|
||||
*/
|
||||
public function purge($type = null)
|
||||
public function purge()
|
||||
{
|
||||
if (!$this->ready) {
|
||||
return true;
|
||||
|
|
|
@ -360,7 +360,7 @@ class kolab_storage_folder extends kolab_storage_folder_api
|
|||
$object['_formatobj']->get_attachments($object);
|
||||
}
|
||||
|
||||
foreach ($object['_attachments'] as $k => $attach) {
|
||||
foreach ($object['_attachments'] as $attach) {
|
||||
if ($attach['id'] == $part) {
|
||||
if ($print) echo $attach['content'];
|
||||
else if ($fp) fwrite($fp, $attach['content']);
|
||||
|
@ -882,7 +882,7 @@ class kolab_storage_folder extends kolab_storage_folder_api
|
|||
if (!empty($object['_attachments']) && ($mem_limit = parse_bytes(ini_get('memory_limit'))) > 0) {
|
||||
$memory = function_exists('memory_get_usage') ? memory_get_usage() : 16*1024*1024; // safe value: 16MB
|
||||
|
||||
foreach ($object['_attachments'] as $id => $attachment) {
|
||||
foreach ($object['_attachments'] as $attachment) {
|
||||
$memory += $attachment['size'];
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
$prefs = $this->rc->config->get('kolab_tasklists', array());
|
||||
|
||||
foreach ($folders as $folder) {
|
||||
$tasklist = $this->folder_props($folder, $delim, $prefs);
|
||||
$tasklist = $this->folder_props($folder, $prefs);
|
||||
|
||||
$this->lists[$tasklist['id']] = $tasklist;
|
||||
$this->folders[$tasklist['id']] = $folder;
|
||||
|
@ -103,7 +103,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
/**
|
||||
* Derive list properties from the given kolab_storage_folder object
|
||||
*/
|
||||
protected function folder_props($folder, $delim, $prefs)
|
||||
protected function folder_props($folder, $prefs)
|
||||
{
|
||||
if ($folder->get_namespace() == 'personal') {
|
||||
$norename = false;
|
||||
|
@ -179,7 +179,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
|
||||
$lists = array();
|
||||
foreach ($folders as $folder) {
|
||||
$list_id = $folder->id; #kolab_storage::folder_id($folder->name);
|
||||
$list_id = $folder->id; // kolab_storage::folder_id($folder->name);
|
||||
$imap_path = explode($delim, $folder->name);
|
||||
|
||||
// find parent
|
||||
|
@ -225,7 +225,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
}
|
||||
else {
|
||||
if (!$this->lists[$list_id]) {
|
||||
$this->lists[$list_id] = $this->folder_props($folder, $delim, $prefs);
|
||||
$this->lists[$list_id] = $this->folder_props($folder, $prefs);
|
||||
$this->folders[$list_id] = $folder;
|
||||
}
|
||||
$this->lists[$list_id]['parent'] = $parent_id;
|
||||
|
@ -249,7 +249,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
$folder = kolab_storage::get_folder(kolab_storage::id_decode($id));
|
||||
if ($folder->type) {
|
||||
$this->folders[$id] = $folder;
|
||||
$this->lists[$id] = $this->folder_props($folder, $this->rc->get_storage()->get_hierarchy_delimiter(), $this->rc->config->get('kolab_tasklists', array()));
|
||||
$this->lists[$id] = $this->folder_props($folder, $this->rc->config->get('kolab_tasklists', array()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
}
|
||||
else {
|
||||
$folder = kolab_storage::get_folder($folder);
|
||||
$prop += $this->folder_props($folder, $this->rc->get_storage()->get_hierarchy_delimiter(), array());
|
||||
$prop += $this->folder_props($folder, array());
|
||||
}
|
||||
|
||||
return $id;
|
||||
|
@ -413,13 +413,11 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
$this->search_more_results = false;
|
||||
$this->lists = $this->folders = array();
|
||||
|
||||
$delim = $this->rc->get_storage()->get_hierarchy_delimiter();
|
||||
|
||||
// find unsubscribed IMAP folders that have "event" type
|
||||
if ($source == 'folders') {
|
||||
foreach ((array)kolab_storage::search_folders('task', $query, array('other')) as $folder) {
|
||||
$this->folders[$folder->id] = $folder;
|
||||
$this->lists[$folder->id] = $this->folder_props($folder, $delim, array());
|
||||
$this->lists[$folder->id] = $this->folder_props($folder, array());
|
||||
}
|
||||
}
|
||||
// search other user's namespace via LDAP
|
||||
|
@ -435,11 +433,11 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
if (count($folders)) {
|
||||
$userfolder = new kolab_storage_folder_user($user['kolabtargetfolder'], '', $user);
|
||||
$this->folders[$userfolder->id] = $userfolder;
|
||||
$this->lists[$userfolder->id] = $this->folder_props($userfolder, $delim, array());
|
||||
$this->lists[$userfolder->id] = $this->folder_props($userfolder, array());
|
||||
|
||||
foreach ($folders as $folder) {
|
||||
$this->folders[$folder->id] = $folder;
|
||||
$this->lists[$folder->id] = $this->folder_props($folder, $delim, array());
|
||||
$this->lists[$folder->id] = $this->folder_props($folder, array());
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1605,7 +1605,7 @@ class tasklist extends rcube_plugin
|
|||
/**
|
||||
* Resolve the email message reference from the given URI
|
||||
*/
|
||||
public function get_message_reference($uri, $resolve = false)
|
||||
public function get_message_reference($uri)
|
||||
{
|
||||
if (strpos($uri, 'imap:///') === 0) {
|
||||
$url = parse_url(substr($uri, 8));
|
||||
|
@ -1657,7 +1657,7 @@ class tasklist extends rcube_plugin
|
|||
|
||||
if ($uid && $mime_id) {
|
||||
$part = $imap->get_message_part($uid, $mime_id);
|
||||
$headers = $imap->get_message_headers($uid);
|
||||
// $headers = $imap->get_message_headers($uid);
|
||||
|
||||
if ($part->ctype_parameters['charset']) {
|
||||
$charset = $part->ctype_parameters['charset'];
|
||||
|
|
Loading…
Add table
Reference in a new issue