Exemple #1
0
 function prefs_table($args)
 {
     global $CURR_SECTION;
     if ($args['section'] == 'folders') {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         // load folders list when needed
         if ($CURR_SECTION) {
             $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, 'maxlength' => 30, 'exceptions' => array('INBOX')));
         } else {
             $select = new html_select();
         }
         $args['blocks']['main']['options']['archive_mbox'] = array('title' => $this->gettext('archivefolder'), 'content' => $select->show($rcmail->config->get('archive_mbox'), array('name' => "_archive_mbox")));
     }
     return $args;
 }
Exemple #2
0
 function action_div($fid, $id, $div = true)
 {
     $action = isset($this->form) ? $this->form['actions'][$id] : $this->script[$fid]['actions'][$id];
     $rows_num = isset($this->form) ? sizeof($this->form['actions']) : sizeof($this->script[$fid]['actions']);
     $out = $div ? '<div class="actionrow" id="actionrow' . $id . '">' . "\n" : '';
     $out .= '<table><tr><td class="rowactions">';
     // action select
     $select_action = new html_select(array('name' => "_action_type[{$id}]", 'id' => 'action_type' . $id, 'onchange' => 'action_type_select(' . $id . ')'));
     if (in_array('fileinto', $this->exts)) {
         $select_action->add(Q($this->gettext('messagemoveto')), 'fileinto');
     }
     if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts)) {
         $select_action->add(Q($this->gettext('messagecopyto')), 'fileinto_copy');
     }
     $select_action->add(Q($this->gettext('messageredirect')), 'redirect');
     if (in_array('copy', $this->exts)) {
         $select_action->add(Q($this->gettext('messagesendcopy')), 'redirect_copy');
     }
     if (in_array('reject', $this->exts)) {
         $select_action->add(Q($this->gettext('messagediscard')), 'reject');
     } else {
         if (in_array('ereject', $this->exts)) {
             $select_action->add(Q($this->gettext('messagediscard')), 'ereject');
         }
     }
     if (in_array('vacation', $this->exts)) {
         $select_action->add(Q($this->gettext('messagereply')), 'vacation');
     }
     $select_action->add(Q($this->gettext('messagedelete')), 'discard');
     if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) {
         $select_action->add(Q($this->gettext('setflags')), 'setflag');
         $select_action->add(Q($this->gettext('addflags')), 'addflag');
         $select_action->add(Q($this->gettext('removeflags')), 'removeflag');
     }
     $select_action->add(Q($this->gettext('rulestop')), 'stop');
     $select_type = $action['type'];
     if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) {
         $select_type .= '_copy';
     }
     $out .= $select_action->show($select_type);
     $out .= '</td>';
     // actions target inputs
     $out .= '<td class="rowtargets">';
     // shared targets
     $out .= '<input type="text" name="_action_target[' . $id . ']" id="action_target' . $id . '" ' . 'value="' . ($action['type'] == 'redirect' ? Q($action['target'], 'strict', false) : '') . '" size="35" ' . 'style="display:' . ($action['type'] == 'redirect' ? 'inline' : 'none') . '" ' . $this->error_class($id, 'action', 'target', 'action_target') . ' />';
     $out .= '<textarea name="_action_target_area[' . $id . ']" id="action_target_area' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'targetarea', 'action_target_area') . 'style="display:' . (in_array($action['type'], array('reject', 'ereject')) ? 'inline' : 'none') . '">' . (in_array($action['type'], array('reject', 'ereject')) ? Q($action['target'], 'strict', false) : '') . "</textarea>\n";
     // vacation
     $out .= '<div id="action_vacation' . $id . '" style="display:' . ($action['type'] == 'vacation' ? 'inline' : 'none') . '">';
     $out .= '<span class="label">' . Q($this->gettext('vacationreason')) . '</span><br />' . '<textarea name="_action_reason[' . $id . ']" id="action_reason' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'reason', 'action_reason') . '>' . Q($action['reason'], 'strict', false) . "</textarea>\n";
     $out .= '<br /><span class="label">' . Q($this->gettext('vacationsubject')) . '</span><br />' . '<input type="text" name="_action_subject[' . $id . ']" id="action_subject' . $id . '" ' . 'value="' . (is_array($action['subject']) ? Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' . $this->error_class($id, 'action', 'subject', 'action_subject') . ' />';
     $out .= '<br /><span class="label">' . Q($this->gettext('vacationaddresses')) . '</span><br />' . '<input type="text" name="_action_addresses[' . $id . ']" id="action_addr' . $id . '" ' . 'value="' . (is_array($action['addresses']) ? Q(implode(', ', $action['addresses']), 'strict', false) : $action['addresses']) . '" size="35" ' . $this->error_class($id, 'action', 'addresses', 'action_addr') . ' />';
     $out .= '<br /><span class="label">' . Q($this->gettext('vacationdays')) . '</span><br />' . '<input type="text" name="_action_days[' . $id . ']" id="action_days' . $id . '" ' . 'value="' . Q($action['days'], 'strict', false) . '" size="2" ' . $this->error_class($id, 'action', 'days', 'action_days') . ' />';
     $out .= '</div>';
     // flags
     $flags = array('read' => '\\Seen', 'answered' => '\\Answered', 'flagged' => '\\Flagged', 'deleted' => '\\Deleted', 'draft' => '\\Draft');
     $flags_target = (array) $action['target'];
     $out .= '<div id="action_flags' . $id . '" style="display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none') . '"' . $this->error_class($id, 'action', 'flags', 'action_flags') . '>';
     foreach ($flags as $fidx => $flag) {
         $out .= '<input type="checkbox" name="_action_flags[' . $id . '][]" value="' . $flag . '"' . (in_array_nocase($flag, $flags_target) ? 'checked="checked"' : '') . ' />' . Q($this->gettext('flag' . $fidx)) . '<br>';
     }
     $out .= '</div>';
     // mailbox select
     if ($action['type'] == 'fileinto') {
         $mailbox = $this->mod_mailbox($action['target'], 'out');
     } else {
         $mailbox = '';
     }
     $select = rcmail_mailbox_select(array('realnames' => false, 'maxlength' => 100, 'id' => 'action_mailbox' . $id, 'name' => "_action_mailbox[{$id}]", 'style' => 'display:' . (!isset($action) || $action['type'] == 'fileinto' ? 'inline' : 'none')));
     $out .= $select->show($mailbox);
     $out .= '</td>';
     // add/del buttons
     $out .= '<td class="rowbuttons">';
     $out .= '<a href="#" id="actionadd' . $id . '" title="' . Q($this->gettext('add')) . '"
         onclick="rcmail.managesieve_actionadd(' . $id . ')" class="button add"></a>';
     $out .= '<a href="#" id="actiondel' . $id . '" title="' . Q($this->gettext('del')) . '"
         onclick="rcmail.managesieve_actiondel(' . $id . ')" class="button del' . ($rows_num < 2 ? ' disabled' : '') . '"></a>';
     $out .= '</td>';
     $out .= '</tr></table>';
     $out .= $div ? "</div>\n" : '';
     return $out;
 }
Exemple #3
0
 function action_div($fid, $id, $div = true)
 {
     $action = isset($this->form) ? $this->form['actions'][$id] : $this->script[$fid]['actions'][$id];
     $rows_num = isset($this->form) ? sizeof($this->form['actions']) : sizeof($this->script[$fid]['actions']);
     $out = $div ? '<div class="actionrow" id="actionrow' . $id . '">' . "\n" : '';
     $out .= '<table><tr><td class="rowactions">';
     // action select
     $select_action = new html_select(array('name' => "_action_type[{$id}]", 'id' => 'action_type' . $id, 'onchange' => 'action_type_select(' . $id . ')'));
     if (in_array('fileinto', $this->exts)) {
         $select_action->add(Q($this->gettext('messagemoveto')), 'fileinto');
     }
     if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts)) {
         $select_action->add(Q($this->gettext('messagecopyto')), 'fileinto_copy');
     }
     $select_action->add(Q($this->gettext('messageredirect')), 'redirect');
     if (in_array('copy', $this->exts)) {
         $select_action->add(Q($this->gettext('messagesendcopy')), 'redirect_copy');
     }
     if (in_array('reject', $this->exts)) {
         $select_action->add(Q($this->gettext('messagediscard')), 'reject');
     } else {
         if (in_array('ereject', $this->exts)) {
             $select_action->add(Q($this->gettext('messagediscard')), 'ereject');
         }
     }
     if (in_array('vacation', $this->exts)) {
         $select_action->add(Q($this->gettext('messagereply')), 'vacation');
     }
     $select_action->add(Q($this->gettext('messagedelete')), 'discard');
     if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) {
         $select_action->add(Q($this->gettext('setflags')), 'setflag');
         $select_action->add(Q($this->gettext('addflags')), 'addflag');
         $select_action->add(Q($this->gettext('removeflags')), 'removeflag');
     }
     if (in_array('variables', $this->exts)) {
         $select_action->add(Q($this->gettext('setvariable')), 'set');
     }
     if (in_array('enotify', $this->exts) || in_array('notify', $this->exts)) {
         $select_action->add(Q($this->gettext('notify')), 'notify');
     }
     $select_action->add(Q($this->gettext('rulestop')), 'stop');
     $select_type = $action['type'];
     if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) {
         $select_type .= '_copy';
     }
     $out .= $select_action->show($select_type);
     $out .= '</td>';
     // actions target inputs
     $out .= '<td class="rowtargets">';
     // shared targets
     $out .= '<input type="text" name="_action_target[' . $id . ']" id="action_target' . $id . '" ' . 'value="' . ($action['type'] == 'redirect' ? Q($action['target'], 'strict', false) : '') . '" size="35" ' . 'style="display:' . ($action['type'] == 'redirect' ? 'inline' : 'none') . '" ' . $this->error_class($id, 'action', 'target', 'action_target') . ' />';
     $out .= '<textarea name="_action_target_area[' . $id . ']" id="action_target_area' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'targetarea', 'action_target_area') . 'style="display:' . (in_array($action['type'], array('reject', 'ereject')) ? 'inline' : 'none') . '">' . (in_array($action['type'], array('reject', 'ereject')) ? Q($action['target'], 'strict', false) : '') . "</textarea>\n";
     // vacation
     $out .= '<div id="action_vacation' . $id . '" style="display:' . ($action['type'] == 'vacation' ? 'inline' : 'none') . '">';
     $out .= '<span class="label">' . Q($this->gettext('vacationreason')) . '</span><br />' . '<textarea name="_action_reason[' . $id . ']" id="action_reason' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'reason', 'action_reason') . '>' . Q($action['reason'], 'strict', false) . "</textarea>\n";
     $out .= '<br /><span class="label">' . Q($this->gettext('vacationsubject')) . '</span><br />' . '<input type="text" name="_action_subject[' . $id . ']" id="action_subject' . $id . '" ' . 'value="' . (is_array($action['subject']) ? Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' . $this->error_class($id, 'action', 'subject', 'action_subject') . ' />';
     $out .= '<br /><span class="label">' . Q($this->gettext('vacationaddresses')) . '</span><br />' . '<input type="text" name="_action_addresses[' . $id . ']" id="action_addr' . $id . '" ' . 'value="' . (is_array($action['addresses']) ? Q(implode(', ', $action['addresses']), 'strict', false) : $action['addresses']) . '" size="35" ' . $this->error_class($id, 'action', 'addresses', 'action_addr') . ' />';
     $out .= '<br /><span class="label">' . Q($this->gettext('vacationdays')) . '</span><br />' . '<input type="text" name="_action_days[' . $id . ']" id="action_days' . $id . '" ' . 'value="' . Q($action['days'], 'strict', false) . '" size="2" ' . $this->error_class($id, 'action', 'days', 'action_days') . ' />';
     $out .= '</div>';
     // flags
     $flags = array('read' => '\\Seen', 'answered' => '\\Answered', 'flagged' => '\\Flagged', 'deleted' => '\\Deleted', 'draft' => '\\Draft');
     $flags_target = (array) $action['target'];
     $out .= '<div id="action_flags' . $id . '" style="display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none') . '"' . $this->error_class($id, 'action', 'flags', 'action_flags') . '>';
     foreach ($flags as $fidx => $flag) {
         $out .= '<input type="checkbox" name="_action_flags[' . $id . '][]" value="' . $flag . '"' . (in_array_nocase($flag, $flags_target) ? 'checked="checked"' : '') . ' />' . Q($this->gettext('flag' . $fidx)) . '<br>';
     }
     $out .= '</div>';
     // set variable
     $set_modifiers = array('lower', 'upper', 'lowerfirst', 'upperfirst', 'quotewildcard', 'length');
     $out .= '<div id="action_set' . $id . '" style="display:' . ($action['type'] == 'set' ? 'inline' : 'none') . '">';
     $out .= '<span class="label">' . Q($this->gettext('setvarname')) . '</span><br />' . '<input type="text" name="_action_varname[' . $id . ']" id="action_varname' . $id . '" ' . 'value="' . Q($action['name']) . '" size="35" ' . $this->error_class($id, 'action', 'name', 'action_varname') . ' />';
     $out .= '<br /><span class="label">' . Q($this->gettext('setvarvalue')) . '</span><br />' . '<input type="text" name="_action_varvalue[' . $id . ']" id="action_varvalue' . $id . '" ' . 'value="' . Q($action['value']) . '" size="35" ' . $this->error_class($id, 'action', 'value', 'action_varvalue') . ' />';
     $out .= '<br /><span class="label">' . Q($this->gettext('setvarmodifiers')) . '</span><br />';
     foreach ($set_modifiers as $j => $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, array_key_exists($s_m, (array) $action) && $action[$s_m] ? ' checked="checked"' : '', Q($this->gettext('var' . $s_m)));
     }
     $out .= '</div>';
     // notify
     // skip :options tag - not used by the mailto method
     $out .= '<div id="action_notify' . $id . '" style="display:' . ($action['type'] == 'notify' ? 'inline' : 'none') . '">';
     $out .= '<span class="label">' . Q($this->gettext('notifyaddress')) . '</span><br />' . '<input type="text" name="_action_notifyaddress[' . $id . ']" id="action_notifyaddress' . $id . '" ' . 'value="' . Q($action['address']) . '" size="35" ' . $this->error_class($id, 'action', 'address', 'action_notifyaddress') . ' />';
     $out .= '<br /><span class="label">' . Q($this->gettext('notifybody')) . '</span><br />' . '<textarea name="_action_notifybody[' . $id . ']" id="action_notifybody' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'method', 'action_notifybody') . '>' . Q($action['body'], 'strict', false) . "</textarea>\n";
     $out .= '<br /><span class="label">' . Q($this->gettext('notifysubject')) . '</span><br />' . '<input type="text" name="_action_notifymessage[' . $id . ']" id="action_notifymessage' . $id . '" ' . 'value="' . Q($action['message']) . '" size="35" ' . $this->error_class($id, 'action', 'message', 'action_notifymessage') . ' />';
     $out .= '<br /><span class="label">' . Q($this->gettext('notifyfrom')) . '</span><br />' . '<input type="text" name="_action_notifyfrom[' . $id . ']" id="action_notifyfrom' . $id . '" ' . 'value="' . Q($action['from']) . '" size="35" ' . $this->error_class($id, 'action', 'from', 'action_notifyfrom') . ' />';
     $importance_options = array(3 => 'notifyimportancelow', 2 => 'notifyimportancenormal', 1 => 'notifyimportancehigh');
     $select_importance = new html_select(array('name' => '_action_notifyimportance[' . $id . ']', 'id' => '_action_notifyimportance' . $id, 'class' => $this->error_class($id, 'action', 'importance', 'action_notifyimportance')));
     foreach ($importance_options as $io_v => $io_n) {
         $select_importance->add(Q($this->gettext($io_n)), $io_v);
     }
     $out .= '<br /><span class="label">' . Q($this->gettext('notifyimportance')) . '</span><br />';
     $out .= $select_importance->show($action['importance'] ? $action['importance'] : 2);
     $out .= '</div>';
     // mailbox select
     if ($action['type'] == 'fileinto') {
         $mailbox = $this->mod_mailbox($action['target'], 'out');
     } else {
         $mailbox = '';
     }
     $select = rcmail_mailbox_select(array('realnames' => false, 'maxlength' => 100, 'id' => 'action_mailbox' . $id, 'name' => "_action_mailbox[{$id}]", 'style' => 'display:' . (!isset($action) || $action['type'] == 'fileinto' ? 'inline' : 'none')));
     $out .= $select->show($mailbox);
     $out .= '</td>';
     // add/del buttons
     $out .= '<td class="rowbuttons">';
     $out .= '<a href="#" id="actionadd' . $id . '" title="' . Q($this->gettext('add')) . '"
         onclick="rcmail.managesieve_actionadd(' . $id . ')" class="button add"></a>';
     $out .= '<a href="#" id="actiondel' . $id . '" title="' . Q($this->gettext('del')) . '"
         onclick="rcmail.managesieve_actiondel(' . $id . ')" class="button del' . ($rows_num < 2 ? ' disabled' : '') . '"></a>';
     $out .= '</td>';
     $out .= '</tr></table>';
     $out .= $div ? "</div>\n" : '';
     return $out;
 }
 function gen_form()
 {
     $this->rcmail_inst->imap_connect(TRUE);
     $id = get_input_value('_id', RCUBE_INPUT_GET);
     $this->rcmail_inst->output->add_label('ispconfig3_filter.filterdelconfirm');
     if ($id != '' || $id != 0) {
         try {
             $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
             $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
             $filter = $this->soap->mail_user_filter_get($session_id, array('filter_id' => $id));
             $mail_server = $this->soap->server_get($session_id, $mail_user[0]['server_id'], 'mail');
             $this->soap->logout($session_id);
         } catch (SoapFault $e) {
             $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
         }
         $enabled = $filter[0]['active'];
         if ($filter[0]['mailuser_id'] != $mail_user[0]['mailuser_id']) {
             $this->rcmail_inst->output->command('display_message', 'Error: ' . $this->gettext('opnotpermitted'), 'error');
             $enabled = 'n';
             $mail_fetchmail['rulename'] = '';
             $mail_fetchmail['source'] = '';
             $mail_fetchmail['searchterm'] = '';
             $mail_fetchmail['op'] = '';
             $mail_fetchmail['action'] = '';
             $mail_fetchmail['target'] = '';
         }
         if ($mail_server['mail_filter_syntax'] == 'maildrop') {
             $filter[0]['target'] = "INBOX." . $filter[0]['target'];
         }
     }
     if ($enabled == 'y') {
         $enabled = 1;
     } else {
         $enabled = 0;
     }
     $this->rcmail_inst->output->set_env('framed', TRUE);
     $out .= '<fieldset><legend>' . $this->gettext('acc_filter') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     $hidden_id = new html_hiddenfield(array('name' => '_id', 'value' => $filter[0]['filter_id']));
     $out .= $hidden_id->show();
     $input_filtername = new html_inputfield(array('name' => '_filtername', 'id' => 'filtername', 'size' => 70));
     $table->add('title', rep_specialchars_output($this->gettext('filtername')));
     $table->add('', $input_filtername->show($filter[0]['rulename']));
     $input_filtersource = new html_select(array('name' => '_filtersource', 'id' => 'filtersource'));
     $input_filtersource->add(array($this->gettext('filtersubject'), $this->gettext('filterfrom'), $this->gettext('filterto')), array('Subject', 'From', 'To'));
     $input_filterop = new html_select(array('name' => '_filterop', 'id' => 'filterop'));
     $input_filterop->add(array($this->gettext('filtercontains'), $this->gettext('filteris'), $this->gettext('filterbegins'), $this->gettext('filterends')), array('contains', 'is', 'begins', 'ends'));
     $input_filtersearchterm = new html_inputfield(array('name' => '_filtersearchterm', 'id' => 'filtersearchterm', 'size' => 43));
     $table->add('title', rep_specialchars_output($this->gettext('filtersource')));
     $table->add('', $input_filtersource->show($filter[0]['source']) . $input_filterop->show($filter[0]['op']) . $input_filtersearchterm->show($filter[0]['searchterm']));
     $input_filteraction = new html_select(array('name' => '_filteraction', 'id' => 'filteraction'));
     $input_filteraction->add(array($this->gettext('filtermove'), $this->gettext('filterdelete')), array('move', 'delete'));
     $input_filtertarget = rcmail_mailbox_select(array('name' => '_filtertarget', 'id' => 'filtertarget'));
     $table->add('title', rep_specialchars_output($this->gettext('filteraction')));
     $table->add('', $input_filteraction->show($filter[0]['action']) . $input_filtertarget->show($filter[0]['target']));
     $input_filterenabled = new html_checkbox(array('name' => '_filterenabled', 'id' => 'filterenabled', 'value' => '1'));
     $table->add('title', rep_specialchars_output($this->gettext('filterenabled')));
     $table->add('', $input_filterenabled->show($enabled));
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
Exemple #5
0
 function filters_form()
 {
     $rcmail = rcmail::get_instance();
     $rcmail->imap_connect();
     $table = new html_table(array('cols' => 2));
     $table->add('title', Q($this->gettext('whatfilter') . ":"));
     $select = new html_select(array('name' => '_whatfilter', 'id' => 'whatfilter'));
     $select->add($this->gettext('from'), 'from');
     $select->add($this->gettext('to'), 'to');
     $select->add($this->gettext('cc'), 'cc');
     $select->add($this->gettext('subject'), 'subject');
     $table->add('', $select->show($this->gettext('from')));
     $table->add('title', Q($this->gettext('searchstring') . ":"));
     $inputfield = new html_inputfield(array('name' => '_searchstring', 'id' => 'searchstring'));
     $table->add('', $inputfield->show(""));
     $table->add('title', Q($this->gettext('moveto') . ":"));
     $select = rcmail_mailbox_select(array('name' => '_folders', 'id' => 'folders'));
     $table->add('title', $select->show());
     # new option: all, read and unread messages
     $table->add('title', Q($this->gettext('messagecount') . ":"));
     $select = new html_select(array('name' => '_messages', 'id' => 'messages'));
     $select->add($this->gettext('all'), 'all');
     $select->add($this->gettext('unread'), 'unread');
     $select->add($this->gettext('isread'), 'isread');
     $table->add('', $select->show($this->gettext('all')));
     # new option: markread or markunread messages
     $table->add('title', Q($this->gettext('markmessages') . ":"));
     $select = new html_select(array('name' => '_markread', 'id' => 'markread'));
     $select->add($this->gettext('none'), 'none');
     $select->add($this->gettext('markunread'), 'markunread');
     $select->add($this->gettext('markread'), 'markread');
     $table->add('', $select->show($this->gettext('none')));
     # new option: filter priority, "on" as enable and "" as disable
     $table->add('title', Q($this->gettext('filterpriority') . ":"));
     $checkbox = new html_checkbox(array('name' => '_checkbox', 'id' => 'checkbox'));
     $table->add('', $checkbox->show("0"));
     // load saved filters
     $user = $rcmail->user;
     $arr_prefs = $user->get_prefs();
     $i = 1;
     $flag = false;
     $table2 = new html_table(array('cols' => 2));
     foreach ($arr_prefs['filters'] as $key => $saved_filter) {
         $flag = true;
         if (empty($saved_filter['markread'])) {
             $saved_filter['markread'] = 'none';
         }
         $folder_id = $saved_filter['destfolder'];
         $folder_name = rcmail_localize_folderpath($folder_id);
         $messages = $saved_filter['messages'];
         $msg = $i . " - " . $this->gettext('msg_if_field') . " <b>" . $this->gettext($saved_filter['whatfilter']) . "</b> " . $this->gettext('msg_contains') . " <b>" . stripslashes($saved_filter['searchstring']) . "</b> " . $this->gettext('msg_move_msg_in') . " <b>" . $folder_name . "</b> " . "(" . $this->gettext('messagecount') . ": " . $this->gettext($saved_filter['messages']) . ", " . $this->gettext('mark') . ": " . $this->gettext($saved_filter['markread']) . ")";
         if (!empty($saved_filter['filterpriority'])) {
             $msg = "<font color='green'>" . $msg . "</font>";
         }
         $table2->add('title', $msg);
         $dlink = "<a href='./?_task=settings&_action=plugin.filters-delete&filterid=" . $key . "'>" . $this->gettext('delete') . "</a>";
         $table2->add('title', $dlink);
         $i++;
     }
     if (!$flag) {
         $table2->add('title', Q($this->gettext('msg_no_stored_filters')));
     }
     $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('filters')) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $rcmail->output->button(array('command' => 'plugin.filters-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $out .= html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('storedfilters')) . html::div(array('class' => 'uibox listbox scroller', 'style' => 'margin-top:205px;'), html::div(array('class' => 'boxcontent'), $table2->show()));
     $rcmail->output->add_gui_object('filtersform', 'filters-form');
     return $rcmail->output->form_tag(array('id' => 'filters-form', 'name' => 'filters-form', 'method' => 'post', 'class' => 'propform', 'action' => './?_task=settings&_action=plugin.filters-save'), $out);
 }
Exemple #6
0
 function filters_form()
 {
     $this->rc->imap_connect();
     $table = new html_table(array('cols' => 4));
     $table->add('title', Q($this->gettext('whatfilter') . ":"));
     $select = new html_select(array('name' => '_whatfilter', 'id' => 'whatfilter'));
     $select->add($this->gettext('from'), 'from');
     $select->add($this->gettext('to'), 'to');
     $select->add($this->gettext('cc'), 'cc');
     $select->add($this->gettext('subject'), 'subject');
     $table->add('', $select->show($this->gettext('from')));
     $table->add_row();
     $table->add('title', Q($this->gettext('searchstring') . ":"));
     $inputfield = new html_inputfield(array('name' => '_searchstring', 'id' => 'searchstring'));
     $table->add('', $inputfield->show(""));
     $table->add('title', Q($this->gettext('casesensitive') . ":"));
     $checkbox = new html_checkbox(array('name' => '_casesensitive', 'id' => 'casesensitive', 'value' => '1'));
     $casesensitive = $this->rc->config->get('caseInsensitiveSearch', true);
     $table->add('', $checkbox->show($casesensitive ? 1 : 0));
     $table->add_row();
     $table->add('title', Q($this->gettext('moveto') . ":"));
     $select = rcmail_mailbox_select(array('name' => '_folders', 'id' => 'folders'));
     $table->add('title', $select->show());
     $table->add_row();
     # new option: all, read and unread messages
     $table->add('title', Q($this->gettext('messagecount') . ":"));
     $select = new html_select(array('name' => '_messages', 'id' => 'messages'));
     $select->add($this->gettext('all'), 'all');
     $select->add($this->gettext('unread'), 'unread');
     $select->add($this->gettext('markread'), 'markread');
     $table->add('', $select->show($this->gettext('all')));
     // get mailbox list
     $a_folders = $this->rc->imap->list_mailboxes('', '*');
     $delimiter = $this->rc->imap->get_hierarchy_delimiter();
     $a_mailboxes = array();
     foreach ($a_folders as $folder) {
         rcmail_build_folder_tree($a_mailboxes, $folder, $delimiter);
     }
     // load saved filters
     $user = $this->rc->user;
     $arr_prefs = $user->get_prefs();
     $i = 1;
     $flag = false;
     $table2 = new html_table(array('cols' => 2));
     //To prevent PHP Warning when no filter already set
     if (!empty($arr_prefs['filters'])) {
         foreach ($arr_prefs['filters'] as $key => $saved_filter) {
             $flag = true;
             $folder_id = $saved_filter['destfolder'];
             $folder_name = "";
             if (strtoupper($folder_id) == 'INBOX') {
                 $folder_name = rcube_label('inbox');
             } else {
                 foreach ($a_mailboxes as $folder => $vet) {
                     if ($vet['id'] == $folder_id) {
                         $folder_name = $vet['name'];
                         break;
                     }
                 }
             }
             $messages = $saved_filter['messages'];
             $msg = $i . " - " . $this->gettext('msg_if_field') . " <b>" . $this->gettext($saved_filter['whatfilter']) . "</b> " . $this->gettext('msg_contains') . " <b>" . $saved_filter['searchstring'] . "</b> " . ($saved_filter['casesensitive'] == '1' ? $this->gettext('msg_and_is') . " <b>" . $this->gettext('casesensitive') . "</b> " : "") . $this->gettext('msg_move_msg_in') . " <b>" . $folder_name . "</b> " . "(" . $this->gettext('messagecount') . ": " . $this->gettext($saved_filter['messages']) . ")";
             $table2->add('title', $msg);
             $dlink = "<a href='./?_task=settings&_action=plugin.filters-delete&filterid=" . $key . "'>" . $this->gettext('delete') . "</a>";
             $table2->add('title', $dlink);
             $i++;
         }
     }
     if (!$flag) {
         $table2->add('title', Q($this->gettext('msg_no_stored_filters')));
     }
     $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('filters')) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $this->rc->output->button(array('command' => 'plugin.filters-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $out .= html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('storedfilters')) . html::div(array('class' => 'uibox listbox scroller', 'style' => 'margin-top:205px;'), html::div(array('class' => 'boxcontent'), $table2->show()));
     $this->rc->output->add_gui_object('filtersform', 'filters-form');
     return $this->rc->output->form_tag(array('id' => 'filters-form', 'name' => 'filters-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.filters-save'), $out);
 }
 function prefs_table($args)
 {
     if ($args['section'] == 'folders') {
         $rcmail = rcmail::get_instance();
         $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, 'maxlength' => 30));
         $args['blocks']['main']['options']['archive_mbox']['title'] = Q($this->gettext('archivefolder'));
         $args['blocks']['main']['options']['archive_mbox']['content'] = $select->show($rcmail->config->get('archive_mbox'), array('name' => "_archive_mbox"));
     }
     if ($args['section'] == 'folderslink') {
         $args['blocks']['main']['options']['folderslink']['title'] = $this->gettext('folders') . " ::: " . $_SESSION['username'];
         $args['blocks']['main']['options']['folderslink']['content'] = "<script type='text/javascript'>\n";
         $args['blocks']['main']['options']['folderslink']['content'] .= "  parent.location.href='./?_task=settings&_action=folders'\n";
         $args['blocks']['main']['options']['folderslink']['content'] .= "</script>\n";
     }
     return $args;
 }