Fix bugs caught by static analysis
| | |
| | | $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); |
| | |
| | | $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 { |
| | |
| | | */ |
| | | 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'])) { |
| | |
| | | |
| | | return $key; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Compare search value with contact data |
| | |
| | | |
| | | $result = $this->query('SHOW VARIABLES'); |
| | | |
| | | while ($sql_arr = $this->fetch_array($result)) { |
| | | while ($row = $this->fetch_array($result)) { |
| | | $this->variables[$row[0]] = $row[1]; |
| | | } |
| | | } |
| | |
| | | // 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); |
| | |
| | | |
| | | // 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 |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | $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; |
| | |
| | | |
| | | 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') . " = ?", |
| | |
| | | */ |
| | | public function __construct($vcard = null, $charset = RCUBE_CHARSET, $detect = false, $fieldmap = array()) |
| | | { |
| | | if (!empty($fielmap)) { |
| | | if (!empty($fieldmap)) { |
| | | $this->extend_fieldmap($fieldmap); |
| | | } |
| | | |
| | |
| | | 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; |
| | | |
| | |
| | | // 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')); |
| | |
| | | |
| | | $content = html::p(null, rcube_label(array( |
| | | 'name' => 'importconfirm', |
| | | 'nr' => $IMORT_STATS->inserted, |
| | | 'nr' => $IMPORT_STATS->inserted, |
| | | 'vars' => $vars, |
| | | )) . ($IMPORT_STATS->names ? ':' : '.')); |
| | | |
| | |
| | | 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))); |
| | |
| | | } |
| | | |
| | | $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", |
| | |
| | | |
| | | 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 |
| | |
| | | |
| | | // 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), |