Fix bugs caught by static analysis

pull/73/head
Aleksander Machniak 12 years ago
parent 3a0dc87856
commit c027ba7709

@ -433,8 +433,9 @@ class acl extends rcube_plugin
$acl = trim(rcube_utils::get_input_value('_acl', rcube_utils::INPUT_GPC));
$oldid = trim(rcube_utils::get_input_value('_old', rcube_utils::INPUT_GPC));
$acl = array_intersect(str_split($acl), $this->rights_supported());
$users = $oldid ? array($user) : explode(',', $user);
$acl = array_intersect(str_split($acl), $this->rights_supported());
$users = $oldid ? array($user) : explode(',', $user);
$result = 0;
foreach ($users as $user) {
$user = trim($user);

@ -183,7 +183,7 @@ class rcube_sql_password
$res = $db->query($sql, $sql_vars);
if (!$db->is_error()) {
if (strtolower(substr(trim($query),0,6))=='select') {
if (strtolower(substr(trim($sql),0,6)) == 'select') {
if ($result = $db->fetch_array($res))
return PASSWORD_SUCCESS;
} else {

@ -535,7 +535,7 @@ abstract class rcube_addressbook
*/
public static function compose_contact_key($contact, $sort_col)
{
$key = $contact[$sort_col] . ':' . $row['sourceid'];
$key = $contact[$sort_col] . ':' . $contact['sourceid'];
// add email to a key to not skip contacts with the same name (#1488375)
if (!empty($contact['email'])) {
@ -545,7 +545,6 @@ abstract class rcube_addressbook
return $key;
}
/**
* Compare search value with contact data
*

@ -147,7 +147,7 @@ class rcube_db_mysql extends rcube_db
$result = $this->query('SHOW VARIABLES');
while ($sql_arr = $this->fetch_array($result)) {
while ($row = $this->fetch_array($result)) {
$this->variables[$row[0]] = $row[1];
}
}

@ -981,7 +981,7 @@ class rcube_imap extends rcube_storage
// use memory less expensive (and quick) method for big result set
$index = clone $this->index('', $this->sort_field, $this->sort_order);
// get messages uids for one page...
$index->slice($start_msg, min($cnt-$from, $this->page_size));
$index->slice($from, min($cnt-$from, $this->page_size));
if ($slice) {
$index->slice(-$slice, $slice);
@ -2727,7 +2727,7 @@ class rcube_imap extends rcube_storage
// filter folders list according to rights requirements
if ($rights && $this->get_capability('ACL')) {
$a_folders = $this->filter_rights($a_folders, $rights);
$a_mboxes = $this->filter_rights($a_mboxes, $rights);
}
// filter folders and sort them

@ -1077,7 +1077,7 @@ class rcube_imap_generic
}
if (!$this->data['READ-WRITE']) {
$this->setError(self::ERROR_READONLY, "Mailbox is read-only", 'EXPUNGE');
$this->setError(self::ERROR_READONLY, "Mailbox is read-only");
return false;
}
@ -1936,7 +1936,7 @@ class rcube_imap_generic
}
if (!$this->data['READ-WRITE']) {
$this->setError(self::ERROR_READONLY, "Mailbox is read-only", 'STORE');
$this->setError(self::ERROR_READONLY, "Mailbox is read-only");
return false;
}
@ -1997,7 +1997,7 @@ class rcube_imap_generic
}
if (!$this->data['READ-WRITE']) {
$this->setError(self::ERROR_READONLY, "Mailbox is read-only", 'STORE');
$this->setError(self::ERROR_READONLY, "Mailbox is read-only");
return false;
}
@ -2508,7 +2508,7 @@ class rcube_imap_generic
$tokens = $this->tokenizeResponse(preg_replace('/(^\(|\)$)/', '', $line));
for ($i=0; $i<count($tokens); $i+=2) {
if (preg_match('/^(BODY|BINARY)/i', $token)) {
if (preg_match('/^(BODY|BINARY)/i', $tokens[$i])) {
$result = $tokens[$i+1];
$found = true;
break;

@ -593,7 +593,7 @@ class rcube_spellchecker
if (empty($plugin['abort'])) {
$dict = array();
$this->rc->db->query(
$sql_result = $this->rc->db->query(
"SELECT data FROM ".$this->rc->db->table_name('dictionary')
." WHERE user_id ". ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
." AND " . $this->rc->db->quoteIdentifier('language') . " = ?",

@ -90,7 +90,7 @@ class rcube_vcard
*/
public function __construct($vcard = null, $charset = RCUBE_CHARSET, $detect = false, $fieldmap = array())
{
if (!empty($fielmap)) {
if (!empty($fieldmap)) {
$this->extend_fieldmap($fieldmap);
}

@ -60,8 +60,8 @@ Class utf8 {
function loadCharset($charset) {
$charset = preg_replace(array('/^WINDOWS-*125([0-8])$/', '/^CP-/'), array('CP125\\1', 'CP'), $charset);
if (isset($aliases[$charset]))
$charset = $aliases[$charset];
if (isset($this->aliases[$charset]))
$charset = $this->aliases[$charset];
$this->charset = $charset;

@ -167,7 +167,7 @@ function rcmail_set_sourcename($abook)
// get address book name (for display)
if ($abook && $_SESSION['addressbooks_count'] > 1) {
$name = $abook->get_name();
if (!$name && $source == 0) {
if (!$name) {
$name = rcube_label('personaladrbook');
}
$OUTPUT->set_env('sourcename', html_entity_decode($name, ENT_COMPAT, 'UTF-8'));

@ -88,7 +88,7 @@ function rcmail_import_confirm($attrib)
$content = html::p(null, rcube_label(array(
'name' => 'importconfirm',
'nr' => $IMORT_STATS->inserted,
'nr' => $IMPORT_STATS->inserted,
'vars' => $vars,
)) . ($IMPORT_STATS->names ? ':' : '.'));
@ -98,7 +98,7 @@ function rcmail_import_confirm($attrib)
if ($IMPORT_STATS->skipped) {
$content .= html::p(null, rcube_label(array(
'name' => 'importconfirmskipped',
'nr' => $IMORT_STATS->skipped,
'nr' => $IMPORT_STATS->skipped,
'vars' => $vars,
)) . ':');
$content .= html::p('em', join(', ', array_map('Q', $IMPORT_STATS->skipped_names)));

@ -223,7 +223,7 @@ function rcmail_contact_record_groups($contact_id)
}
$hiddenfields = new html_hiddenfield(array('name' => '_source', 'value' => get_input_value('_source', RCUBE_INPUT_GPC)));
$hiddenfields->add(array('name' => '_cid', 'value' => $record['ID']));
$hiddenfields->add(array('name' => '_cid', 'value' => $contact_id));
$form_start = $RCMAIL->output->request_form(array(
'name' => "form", 'method' => "post",

@ -639,7 +639,7 @@ function rcmail_prepare_message_body()
function rcmail_compose_part_body($part, $isHtml = false)
{
global $RCMAIL, $MESSAGE, $compose_mode;
global $RCMAIL, $MESSAGE, $LINE_LENGTH, $compose_mode;
// Check if we have enough memory to handle the message in it
// #1487424: we need up to 10x more memory than the body
@ -1224,10 +1224,11 @@ function rcmail_save_image($path, $mimetype='')
// handle attachments in memory
$data = file_get_contents($path);
$name = rcmail_basename($path);
$attachment = array(
'group' => $COMPOSE['id'],
'name' => rcmail_basename($path),
'name' => $name,
'mimetype' => $mimetype ? $mimetype : rc_mime_content_type($path, $name),
'data' => $data,
'size' => strlen($data),

Loading…
Cancel
Save