Fix undefined or unused variable errors caught in static code analysis
This commit is contained in:
parent
828b868d97
commit
27e57c7335
16 changed files with 38 additions and 46 deletions
|
@ -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) {
|
||||
|
|
|
@ -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(' ', $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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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, ' » ', kolab_storage::object_name($folder)));
|
||||
$foldername = Q(str_replace($delim, ' » ', kolab_storage::object_name($folder)));
|
||||
}
|
||||
else {
|
||||
$foldername = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30));
|
||||
|
|
|
@ -245,11 +245,11 @@ 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
|
||||
*
|
||||
* @return array Indexed list of contact records, each a hash array
|
||||
*/
|
||||
public function list_records($cols=null, $subset=0)
|
||||
public function list_records($subset = 0)
|
||||
{
|
||||
$this->result = new rcube_result_set(0, ($this->list_page-1) * $this->page_size);;
|
||||
|
||||
|
@ -808,8 +808,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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(' ', $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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(' ', $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();
|
||||
|
|
|
@ -106,7 +106,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);
|
||||
|
||||
|
@ -391,10 +391,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,7 +407,7 @@ class libcalendaring extends rcube_plugin
|
|||
*/
|
||||
public function alarms_action()
|
||||
{
|
||||
$action = get_input_value('action', RCUBE_INPUT_GPC);
|
||||
// $action = get_input_value('action', RCUBE_INPUT_GPC);
|
||||
$data = get_input_value('data', RCUBE_INPUT_POST, true);
|
||||
|
||||
$data['ids'] = explode(',', $data['id']);
|
||||
|
|
|
@ -63,6 +63,6 @@ class logon_page extends rcube_plugin
|
|||
$rcmail->output->add_footer($html);
|
||||
}
|
||||
|
||||
return $arg;
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue