Avoid unused local variables
| | |
| | | $table->add_header(array('class' => 'acl'.$key, 'title' => $label), $label); |
| | | } |
| | | |
| | | $i = 1; |
| | | $js_table = array(); |
| | | foreach ($acl as $user => $rights) { |
| | | if ($this->rc->storage->conn->user == $user) { |
| | |
| | | |
| | | function startup($args) |
| | | { |
| | | $rcmail = rcmail::get_instance(); |
| | | |
| | | // change action to login |
| | | if (empty($_SESSION['user_id']) && !empty($_GET['_autologin']) && $this->is_localhost()) |
| | | $args['action'] = 'login'; |
| | |
| | | $args['cookiecheck'] = false; |
| | | $args['valid'] = true; |
| | | } |
| | | |
| | | |
| | | return $args; |
| | | } |
| | | |
| | |
| | | |
| | | public function print_totals(){ |
| | | $totals = array(); |
| | | foreach ( $this->run_log as $k => $entry ) { |
| | | foreach ($this->run_log as $entry) { |
| | | if ( $entry['type'] == 'start' && $entry['ended'] == true) { |
| | | $totals[$entry['value']]['duration'] += $entry['duration']; |
| | | $totals[$entry['value']]['count'] += 1; |
| | |
| | | */ |
| | | function parse_structure($p) |
| | | { |
| | | $struct = $p['structure']; |
| | | // $struct = $p['structure']; |
| | | |
| | | if ($p['mimetype'] == 'text/plain' || $p['mimetype'] == 'application/pgp') { |
| | | $this->parse_plain($p); |
| | |
| | | function message_load($p) |
| | | { |
| | | $this->message = $p['object']; |
| | | |
| | | |
| | | // handle attachments vcard attachments |
| | | foreach ((array)$this->message->attachments as $attachment) { |
| | | if ($this->is_keys_part($attachment)) { |
| | |
| | | } |
| | | } |
| | | // the same with message bodies |
| | | foreach ((array)$this->message->parts as $idx => $part) { |
| | | foreach ((array)$this->message->parts as $part) { |
| | | if ($this->is_keys_part($part)) { |
| | | $this->keys_parts[] = $part->mime_id; |
| | | $this->keys_bodies[] = $part->mime_id; |
| | |
| | | $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); |
| | | $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); |
| | | $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST); |
| | | $storage = $this->rc->get_storage(); |
| | | |
| | | if ($uid && $mime_id) { |
| | | $part = $this->rc->storage->get_message_part($uid, $mime_id); |
| | | $storage->set_folder($mbox); |
| | | $part = $storage->get_message_part($uid, $mime_id); |
| | | } |
| | | |
| | | if ($part && is_array($result = $this->import_key($part))) { |
| | |
| | | $part->body = $this->rc->storage->get_message_part( |
| | | $uid, $part->mime_id, $part); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Adds CSS style file to the page header. |
| | | */ |
| | | private function add_css() |
| | | { |
| | | $skin = $this->rc->config->get('skin'); |
| | | if (!file_exists($this->home . "/skins/$skin/enigma.css")) |
| | | $skin = 'default'; |
| | | |
| | | $this->include_stylesheet("skins/$skin/enigma.css"); |
| | | } |
| | | } |
| | |
| | | $search = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GPC); |
| | | |
| | | // define list of cols to be displayed |
| | | $a_show_cols = array('name'); |
| | | $result = array(); |
| | | // $a_show_cols = array('name'); |
| | | |
| | | // Get the list |
| | | $list = $this->enigma->engine->list_keys($search); |
| | |
| | | $size = count($list); |
| | | |
| | | // Add rows |
| | | foreach($list as $idx => $key) { |
| | | foreach ($list as $key) { |
| | | $this->rc->output->command('enigma_add_list_row', |
| | | array('name' => rcube::Q($key->name), 'id' => $key->id)); |
| | | } |
| | |
| | | |
| | | function init() |
| | | { |
| | | $rcmail = rcmail::get_instance(); |
| | | |
| | | $this->add_texts('localization/', false); |
| | | |
| | | // register task |
| | |
| | | |
| | | // rules |
| | | foreach ($this->content as $rule) { |
| | | $extension = ''; |
| | | $script = ''; |
| | | $tests = array(); |
| | | $i = 0; |
| | |
| | | * @param mixed $num Number of tokens to return, 0 for all |
| | | * or True for all tokens until separator is found. |
| | | * Separator will be returned as last token. |
| | | * @param int $in_list Enable to call recursively inside a list |
| | | * |
| | | * @return mixed Tokens array or string if $num=1 |
| | | */ |
| | | static function tokenize(&$str, $num=0, $in_list=false) |
| | | static function tokenize(&$str, $num=0) |
| | | { |
| | | $result = array(); |
| | | |
| | |
| | | // Parenthesized list |
| | | case '[': |
| | | $str = substr($str, 1); |
| | | $result[] = self::tokenize($str, 0, true); |
| | | $result[] = self::tokenize($str, 0); |
| | | break; |
| | | case ']': |
| | | $str = substr($str, 1); |
| | |
| | | .'value="' . rcube::Q($action['value']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'value', 'action_varvalue') .' />'; |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->gettext('setvarmodifiers')) . '</span><br />'; |
| | | foreach ($set_modifiers as $j => $s_m) { |
| | | foreach ($set_modifiers as $s_m) { |
| | | $s_m_id = 'action_varmods' . $id . $s_m; |
| | | $out .= sprintf('<input type="checkbox" name="_action_varmods[%s][]" value="%s" id="%s"%s />%s<br>', |
| | | $id, $s_m, $s_m_id, |
| | |
| | | $user_script = $_SESSION['managesieve_user_script']; |
| | | |
| | | // if the script is not active... |
| | | if ($user_script && ($key = array_search($name, $this->active)) === false) { |
| | | if ($user_script && array_search($name, $this->active) === false) { |
| | | // ...rewrite USER file adding appropriate include command |
| | | if ($this->sieve->load($user_script)) { |
| | | $script = $this->sieve->script->as_array(); |
| | |
| | | |
| | | // get all active scripts for sorting |
| | | foreach ($script as $rid => $rules) { |
| | | foreach ($rules['actions'] as $aid => $action) { |
| | | foreach ($rules['actions'] as $action) { |
| | | if ($action['type'] == 'include' && empty($action['global'])) { |
| | | $target = $extension ? preg_replace($regexp, '', $action['target']) : $action['target']; |
| | | $list[] = $target; |
| | |
| | | $name = $name.$extension; |
| | | |
| | | foreach ($script as $rid => $rules) { |
| | | foreach ($rules['actions'] as $aid => $action) { |
| | | foreach ($rules['actions'] as $action) { |
| | | if ($action['type'] == 'include' && empty($action['global']) |
| | | && $action['target'] == $name |
| | | ) { |
| | |
| | | |
| | | function lookup_user_name($args) |
| | | { |
| | | $rcmail = rcmail::get_instance(); |
| | | |
| | | if ($this->init_ldap($args['host'])) { |
| | | $results = $this->ldap->search('*', $args['user'], true); |
| | | if (count($results->records) == 1) { |
| | |
| | | $status = socket_get_status($socket); |
| | | $startTime = time(); |
| | | $length = 0; |
| | | $prevSecond = 0; |
| | | while ( !feof($socket) && !$status['timed_out'] ) |
| | | { |
| | | $chunk = fgets($socket,1024); |
| | |
| | | $db = $rcmail->get_dbh(); |
| | | } |
| | | |
| | | if ($err = $db->is_error()) |
| | | if ($db->is_error()) { |
| | | return PASSWORD_ERROR; |
| | | } |
| | | |
| | | // crypted password |
| | | if (strpos($sql, '%c') !== FALSE) { |
| | |
| | | |
| | | if (!$db->is_error()) { |
| | | if (strtolower(substr(trim($sql),0,6)) == 'select') { |
| | | if ($result = $db->fetch_array($res)) |
| | | if ($db->fetch_array($res)) |
| | | return PASSWORD_SUCCESS; |
| | | } else { |
| | | // This is the good case: 1 row updated |
| | |
| | | function send($msg) |
| | | { |
| | | socket_write($this->socket,$msg); |
| | | if (substr($in = socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { |
| | | if (substr(socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | return false; |
| | | } |
| | | |
| | | if (substr($in = socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { |
| | | if (substr(socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { |
| | | socket_close($this->socket); |
| | | return false; |
| | | } |
| | |
| | | if ($this->prefs['___sig'.$i.'___']) |
| | | $ident_data['signature'] = $this->prefs['___sig'.$i.'___']; |
| | | // insert identity |
| | | $identid = $rcmail->user->insert_identity($ident_data); |
| | | $rcmail->user->insert_identity($ident_data); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | // the same with message bodies |
| | | foreach ((array)$this->message->parts as $idx => $part) { |
| | | foreach ((array)$this->message->parts as $part) { |
| | | if ($this->is_vcard($part)) { |
| | | $this->vcard_parts[] = $part->mime_id; |
| | | $this->vcard_bodies[] = $part->mime_id; |
| | |
| | | function html_output($p) |
| | | { |
| | | $attach_script = false; |
| | | $icon = 'plugins/vcard_attachments/' .$this->local_skin_path(). '/vcard_add_contact.png'; |
| | | |
| | | foreach ($this->vcard_parts as $part) { |
| | | $vcards = rcube_vcard::import($this->message->get_part_content($part, null, true)); |
| | |
| | | for ($i = 0; ($i * $imap->get_pagesize()) <= $count; $i++) { |
| | | $a_headers = $imap->list_messages($mbox_name, ($i + 1)); |
| | | |
| | | foreach ($a_headers as $n => $header) { |
| | | foreach ($a_headers as $header) { |
| | | if (empty($header)) |
| | | continue; |
| | | |
| | |
| | | $zip = new ZipArchive(); |
| | | $zip->open($tmpfname, ZIPARCHIVE::OVERWRITE); |
| | | |
| | | foreach ($uids as $key => $uid){ |
| | | foreach ($uids as $uid){ |
| | | $headers = $imap->get_message_headers($uid); |
| | | $subject = rcube_mime::decode_mime_string((string)$headers->subject); |
| | | $subject = $this->_convert_filename($subject); |