summaryrefslogtreecommitdiff
path: root/lib/kolab_sync_data_email.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-11-21 11:37:21 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-11-21 11:37:21 (GMT)
commitc79937f2a59ba0ac31619970f97cef47d9be0512 (patch)
tree4a275966183ca4163179fd892915b3b96e2f434e /lib/kolab_sync_data_email.php
parentf824ad56747cb387df363279fa033ff27c55b38e (diff)
downloadkolab-syncroton-c79937f2a59ba0ac31619970f97cef47d9be0512.tar.gz
Fix some issues found in static code analysis
Diffstat (limited to 'lib/kolab_sync_data_email.php')
-rw-r--r--lib/kolab_sync_data_email.php30
1 files changed, 13 insertions, 17 deletions
diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
index 434416b..48e8d0d 100644
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -129,7 +129,6 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
throw new Syncroton_Exception_NotFound("Message $serverId not found");
}
- $msg = $this->parseMessageId($serverId);
$headers = $message->headers; // rcube_message_header
// Calendar namespace fields
@@ -643,7 +642,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
* @param mixed $message MIME message
* @param boolean $saveInSent Enables saving the sent message in Sent folder
*
- * @param throws Syncroton_Exception_Status
+ * @throws Syncroton_Exception_Status
*/
public function sendEmail($message, $saveInSent)
{
@@ -676,7 +675,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
* @param boolean $saveInSent Enables saving the sent message in Sent folder
* @param boolean $replaceMime If enabled, original message would be appended
*
- * @param throws Syncroton_Exception_Status
+ * @throws Syncroton_Exception_Status
*/
public function forwardEmail($itemId, $body, $saveInSent, $replaceMime)
{
@@ -693,9 +692,10 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
or a meeting, the behavior of the SmartForward command is the same as that of the SmartReply command (section 2.2.2.18).
*/
- $msg = $this->parseMessageId($itemId);
+ $msg = $this->parseMessageId($itemId);
+ $message = $this->getObject($itemId);
- if (empty($msg)) {
+ if (empty($message)) {
throw new Syncroton_Exception_Status(Syncroton_Exception_Status::ITEM_NOT_FOUND);
}
@@ -720,7 +720,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
}
// Send message
- $sent = $this->sendEmail($sync_msg, $saveInSent);
+ $this->sendEmail($sync_msg, $saveInSent);
// Set FORWARDED flag on the replied message
if (empty($message->headers->flags['FORWARDED'])) {
@@ -737,7 +737,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
* @param boolean $saveInSent Enables saving the sent message in Sent folder
* @param boolean $replaceMime If enabled, original message would be appended
*
- * @param throws Syncroton_Exception_Status
+ * @throws Syncroton_Exception_Status
*/
public function replyEmail($itemId, $body, $saveInSent, $replaceMime)
{
@@ -770,7 +770,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
}
// Send message
- $sent = $this->sendEmail($sync_msg, $saveInSent);
+ $this->sendEmail($sync_msg, $saveInSent);
// Set ANSWERED flag on the replied message
if (empty($message->headers->flags['ANSWERED'])) {
@@ -812,10 +812,8 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$changed_msgs = $this->getChangesByRelations($folderid, $filter);
$result = $result_type == self::RESULT_COUNT ? 0 : array();
- // no sorting for best performance
- $sort_by = null;
- $found = 0;
- $ts = time();
+ $found = 0;
+ $ts = time();
foreach ($folders as $folder_id) {
$foldername = $this->backend->folder_id2name($folder_id, $this->device->deviceid);
@@ -947,7 +945,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
// convert filter into one IMAP search string
$filter_str = 'ALL UNDELETED';
- foreach ($filter as $idx => $filter_item) {
+ foreach ($filter as $filter_item) {
if (is_string($filter_item)) {
$filter_str .= ' ' . $filter_item;
}
@@ -984,7 +982,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$search = '';
$search_count = 0;
- foreach ($result as $folder => $data) {
+ foreach ($result as $data) {
foreach ($data as $p) {
$search_params = array();
$search_count++;
@@ -1036,8 +1034,6 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
}
$result = array();
- // no sorting for best performance
- $sort_by = null;
// @TODO: caching with Options->RebuildResults support
@@ -1399,7 +1395,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$uri = kolab_storage_config::get_message_uri($message->headers, $folder);
// for all tag objects...
- foreach ($config->get_tags() as $idx => $relation) {
+ foreach ($config->get_tags() as $relation) {
// resolve members if it wasn't done recently
$uid = $relation['uid'];
$force = empty($this->tag_rts[$uid]) || $this->tag_rts[$uid] <= time() - $delta;