summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-07 10:56:18 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-05-07 10:56:18 (GMT)
commit1857a64d4fa64887c26e6afce0495f471f229bc5 (patch)
tree55da7fc4d54930d99d60a29a88c241a388e72364
parent27e57c73352e1966918cdfe567c32c5a4844be82 (diff)
downloadroundcubemail-plugins-kolab-1857a64d4fa64887c26e6afce0495f471f229bc5.tar.gz
Fix undefined variable related errors caught in static code analysis
-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/tasklist/drivers/database/tasklist_database_driver.php6
-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
9 files changed, 20 insertions, 26 deletions
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/tasklist/drivers/database/tasklist_database_driver.php b/plugins/tasklist/drivers/database/tasklist_database_driver.php
index 93734ca..5c6a0ed 100644
--- a/plugins/tasklist/drivers/database/tasklist_database_driver.php
+++ b/plugins/tasklist/drivers/database/tasklist_database_driver.php
@@ -30,7 +30,6 @@ class tasklist_database_driver extends tasklist_driver
private $rc;
private $plugin;
- private $cache = array();
private $lists = array();
private $list_ids = '';
@@ -173,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
@@ -301,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)
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();