/** * Callback function used to build mailto: links around e-mail strings * * This also adds an onclick-handler to open the Rouncube compose message screen on such links * * @param array Matches result from preg_replace_callback * @return int Index of saved string value * @see rcube_string_replacer::mailto_callback() */ public function mailto_callback($matches) { $href = $matches[1]; $suffix = $this->parse_url_brackets($href); $i = $this->add(html::a(array('href' => 'mailto:' . $href, 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".command('compose','" . rcube::JQ($href) . "',this)"), rcube::Q($href)) . $suffix); return $i >= 0 ? $this->get_replacement($i) : ''; }
/** * Place a link in the messageAttachments (template object) * to trigger the removal of all attachments */ function attachment_removelink($p) { /* // place links to remove attachment for each attachment $links = preg_split('/(<li[^>]*>)/', $p['content'], null, PREG_SPLIT_DELIM_CAPTURE); for ($i = 1; $i < count($links); $i+=2) { if (preg_match('/ id="attach([0-9]+)"/', $links[$i], $matches)) { $remove = $this->api->output->button(array('command' => 'plugin.removeattachments.removeone', 'prop' => $matches[1], 'image' => $this->url(null) . $this->local_skin_path() . '/del.png', 'title' => 'removeattachments.removeattachment', 'style' => 'vertical-align:middle')); $links[$i+1] = str_replace('</li>', ' ' . $remove . '</li>', $links[$i+1]); } } $p['content'] = join('', $links); */ // when there are multiple attachments allow delete all if (substr_count($p['content'], ' id="attach') > 1) { $link = $this->api->output->button(array('type' => 'link', 'command' => 'plugin.removeattachments.removeall', 'content' => rcube::Q($this->gettext('removeattachments.removeall')), 'title' => 'removeattachments.removeall', 'class' => 'button removeattachments')); switch (rcmail::get_instance()->config->get('skin')) { case 'classic': //$p['content'] = preg_replace('/(<ul[^>]*>)/', '$1' . $link, $p['content']); $p['content'] = str_replace('</ul>', html::tag('li', null, $link) . '</ul>', $p['content']); break; default: $p['content'] .= $link; break; } $this->include_stylesheet($this->local_skin_path() . '/removeattachments.css'); } return $p; }
/** * This callback function adds a box below the message content * if there is a vcard attachment available */ function html_output($p) { $attach_script = false; foreach ($this->vcard_parts as $part) { $vcards = rcube_vcard::import($this->message->get_part_content($part, null, true)); // successfully parsed vcards? if (empty($vcards)) { continue; } // remove part's body if (in_array($part, $this->vcard_bodies)) { $p['content'] = ''; } foreach ($vcards as $idx => $vcard) { // skip invalid vCards if (empty($vcard->email) || empty($vcard->email[0])) { continue; } $display = $vcard->displayname . ' <' . $vcard->email[0] . '>'; // add box below message body $p['content'] .= html::p(array('class' => 'vcardattachment'), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . rcube::JQ($part . ':' . $idx) . "')", 'title' => $this->gettext('addvcardmsg')), html::span(null, rcube::Q($display)))); } $attach_script = true; } if ($attach_script) { $this->include_script('vcardattach.js'); $this->include_stylesheet($this->local_skin_path() . '/style.css'); } return $p; }
/** * Callback function when HTML page is rendered * We'll add an overlay box here. */ function render_page($p) { if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') { $this->add_texts('localization'); $rcmail = rcmail::get_instance(); $identity = $rcmail->user->get_identity(); $identities_level = intval($rcmail->config->get('identities_level', 0)); // compose user-identity dialog $table = new html_table(array('cols' => 2)); $table->add('title', $this->gettext('name')); $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'], 'disabled' => $identities_level == 4))); $table->add('title', $this->gettext('email')); $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => rcube_utils::idn_to_utf8($identity['email']), 'disabled' => in_array($identities_level, array(1, 3, 4))))); $table->add('title', $this->gettext('organization')); $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_organization', 'value' => $identity['organization'], 'disabled' => $identities_level == 4))); $table->add('title', $this->gettext('signature')); $table->add(null, html::tag('textarea', array('name' => '_signature', 'rows' => '3'), $identity['signature'])); // add overlay input box to html page $rcmail->output->add_footer(html::tag('form', array('id' => 'newuserdialog', 'action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::p('hint', rcube::Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save')))))); $title = rcube::JQ($this->gettext('identitydialogtitle')); $script = "\n\$('#newuserdialog').show()\n .dialog({modal:true, resizable:false, closeOnEscape:false, width:450, title:'{$title}'})\n .submit(function() {\n var i, request = {}, form = \$(this).serializeArray();\n for (i in form)\n request[form[i].name] = form[i].value;\n\n rcmail.http_post('plugin.newusersave', request, true);\n return false;\n });\n\n\$('input[name=_name]').focus();\nrcube_webmail.prototype.new_user_dialog_close = function() { \$('#newuserdialog').dialog('close'); }\n"; // disable keyboard events for messages list (#1486726) $rcmail->output->add_script($script, 'docready'); $this->include_stylesheet('newuserdialog.css'); } }
function settings_blocks($args) { if ($args['section'] == 'server') { $use_subscriptions = rcmail::get_instance()->config->get('use_subscriptions'); $field_id = 'rcmfd_use_subscriptions'; $checkbox = new html_checkbox(array('name' => '_use_subscriptions', 'id' => $field_id, 'value' => 1)); $args['blocks']['main']['options']['use_subscriptions'] = array('title' => html::label($field_id, rcube::Q($this->gettext('useimapsubscriptions'))), 'content' => $checkbox->show($use_subscriptions ? 1 : 0)); } return $args; }
function prefs_list($args) { if ($args['section'] == 'compose') { $this->add_texts('localization/'); $reminder = rcube::get_instance()->config->get('attachment_reminder'); $field_id = 'rcmfd_attachment_reminder'; $checkbox = new html_checkbox(array('name' => '_attachment_reminder', 'id' => $field_id, 'value' => 1)); $args['blocks']['main']['options']['attachment_reminder'] = array('title' => html::label($field_id, rcube::Q($this->gettext('reminderoption'))), 'content' => $checkbox->show($reminder ? 1 : 0)); } return $args; }
/** * Callback function used to build mailto: links around e-mail strings * * This also adds an onclick-handler to open the Rouncube compose message screen on such links * * @param array Matches result from preg_replace_callback * @return int Index of saved string value * @see rcube_string_replacer::mailto_callback() */ public function mailto_callback($matches) { $href = $matches[1]; $suffix = $this->parse_url_brackets($href); $email = $href; if (strpos($email, '?')) { list($email, ) = explode('?', $email); } // skip invalid emails if (!rcube_utils::check_email($email, false)) { return $matches[1]; } $i = $this->add(html::a(array('href' => 'mailto:' . $href, 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".command('compose','" . rcube::JQ($href) . "',this)"), rcube::Q($href)) . $suffix); return $i >= 0 ? $this->get_replacement($i) : ''; }
/** * This callback function adds a box below the message content * if there is a vcard attachment available */ function html_output($p) { $attach_script = false; foreach ($this->ics_parts as $part) { $icscontent = $this->message->get_part_content($part['part'], null, true); $file_name = $part['uid']; $file = '../../../cache/import/' . $file_name . '.ics'; file_put_contents($file, $icscontent); // add box below message body $p['content'] .= html::p(array('class' => 'icalattachments'), html::a(array('href' => "#", 'class' => rcube::JQ($file_name), 'title' => $this->gettext('addicalinvitemsg')), html::span(null, rcube::Q($this->gettext('addicalinvitemsg'))))); $attach_script = true; } if ($attach_script) { $this->include_stylesheet($this->local_skin_path() . '/style.css'); } return $p; }
/** * Place a link/button after attachments listing to trigger download */ public function attachment_ziplink($p) { $rcmail = rcmail::get_instance(); // only show the link if there is more than the configured number of attachments if (substr_count($p['content'], '<li') > $rcmail->config->get('zipdownload_attachments', 1)) { $href = $rcmail->url(array('_action' => 'plugin.zipdownload.zip_attachments', '_mbox' => $rcmail->output->env['mailbox'], '_uid' => $rcmail->output->env['uid'])); $link = html::a(array('href' => $href, 'class' => 'button zipdownload'), rcube::Q($this->gettext('downloadall'))); // append link to attachments list, slightly different in some skins switch (rcmail::get_instance()->config->get('skin')) { case 'classic': $p['content'] = str_replace('</ul>', html::tag('li', array('class' => 'zipdownload'), $link) . '</ul>', $p['content']); break; default: $p['content'] .= $link; break; } $this->include_stylesheet($this->local_skin_path() . '/zipdownload.css'); } return $p; }
/** * Handler for user preferences form (preferences_list hook) */ public function prefs_list($args) { if ($args['section'] != 'mailbox') { return $args; } // Load localization and configuration $this->add_texts('localization/'); // Check that configuration is not disabled $dont_override = (array) $this->rc->config->get('dont_override', array()); $key = 'pref_use_infinite_scroll'; if (!in_array($key, $dont_override)) { $config_key = 'use_infinite_scroll'; $field_id = "_" . $key; $is_checked = $this->rc->config->get($config_key, true); $input = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1)); $content = $input->show($is_checked); $args['blocks']['main']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext($key))), 'content' => $content); } return $args; }
function infohtml() { $rcmail = rcmail::get_instance(); $user = $rcmail->user; $identity = $user->get_identity(); $table = new html_table(array('cols' => 2, 'cellpadding' => 3)); $table->add('title', 'ID'); $table->add('', rcube::Q($user->ID)); $table->add('title', rcube::Q($this->gettext('username'))); $table->add('', rcube::Q($user->data['username'])); $table->add('title', rcube::Q($this->gettext('server'))); $table->add('', rcube::Q($user->data['mail_host'])); $table->add('title', rcube::Q($this->gettext('created'))); $table->add('', rcube::Q($user->data['created'])); $table->add('title', rcube::Q($this->gettext('lastlogin'))); $table->add('', rcube::Q($user->data['last_login'])); $table->add('title', rcube::Q($this->gettext('defaultidentity'))); $table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>')); return html::tag('h4', null, rcube::Q('Infos for ' . $user->get_username())) . $table->show(); }
/** * Adds a link to prefrences section. * * @param array $args Default hook arguments. * * @return array */ public function prefs_section_link($args) { $args['list']['recipienttocontact'] = array('id' => 'recipienttocontact', 'section' => rcube::Q($this->gettext('prefs_title'))); return $args; }
public function identity_form($args) { $user = $this->get_user_email(); $origin = array('type' => 'text', 'size' => 40, 'label' => rcube::Q($this->rcmail->gettext('email')), 'disabled' => 'disabled'); $alias = array('name' => rcube::Q($this->gettext('Alias')), 'content' => array('email' => $args['form']['addressing']['content']['email'])); unset($args['form']['addressing']['content']['email']); //unset($args['form']['addressing']['content']['standard']); $args['form'] = $this->array_insert_after('addressing', $args['form'], 'aliasing', $alias); $args['form']['addressing']['content'] = $this->array_insert_after('name', $args['form']['addressing']['content'], 'origin', $origin); $args['record']['origin'] = rcube_utils::idn_to_utf8($user['email']); $args['record']['email'] = !empty($args['record']['email']) ? $args['record']['email'] : rcube_utils::idn_to_utf8($user['email']); return $args; }
/** * Callback function used to build mailto: links around e-mail strings * * @param array Matches result from preg_replace_callback * @return int Index of saved string value */ public function mailto_callback($matches) { $href = $matches[1]; $suffix = $this->parse_url_brackets($href); $i = $this->add(html::a('mailto:' . $href, rcube::Q($href)) . $suffix); return $i >= 0 ? $this->get_replacement($i) : ''; }
/** * */ public function attachment_header($attrib = array()) { $rcmail = rcmail::get_instance(); $dl_link = strtolower($attrib['downloadlink']) == 'true'; $dl_url = $this->rc->url(array('_frame' => null, '_download' => 1) + $_GET); $table = new html_table(array('cols' => $dl_link ? 3 : 2)); if (!empty($this->attachment['name'])) { $table->add('title', rcube::Q($this->rc->gettext('filename'))); $table->add('header', rcube::Q($this->attachment['name'])); if ($dl_link) { $table->add('download-link', html::a($dl_url, rcube::Q($this->rc->gettext('download')))); } } if (!empty($this->attachment['mimetype'])) { $table->add('title', rcube::Q($this->rc->gettext('type'))); $table->add('header', rcube::Q($this->attachment['mimetype'])); } if (!empty($this->attachment['size'])) { $table->add('title', rcube::Q($this->rc->gettext('filesize'))); $table->add('header', rcube::Q($this->rc->show_bytes($this->attachment['size']))); } $this->rc->output->set_env('attachment_download_url', $dl_url); return $table->show($attrib); }
private function _showhint($message, $url = '') { $hint = rcube::Q($message); if ($url) { $hint .= ($hint ? '; ' : '') . 'See <a href="' . rcube::Q($url) . '" target="_blank">' . rcube::Q($url) . '</a>'; } if ($hint) { echo '<span class="indent">(' . $hint . ')</span>'; } }
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(rcube::Q($this->plugin->gettext('messagemoveto')), 'fileinto'); } if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagecopyto')), 'fileinto_copy'); } $select_action->add(rcube::Q($this->plugin->gettext('messageredirect')), 'redirect'); if (in_array('copy', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagesendcopy')), 'redirect_copy'); } if (in_array('reject', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagediscard')), 'reject'); } else { if (in_array('ereject', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagediscard')), 'ereject'); } } if (in_array('vacation', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagereply')), 'vacation'); } $select_action->add(rcube::Q($this->plugin->gettext('messagedelete')), 'discard'); if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('setflags')), 'setflag'); $select_action->add(rcube::Q($this->plugin->gettext('addflags')), 'addflag'); $select_action->add(rcube::Q($this->plugin->gettext('removeflags')), 'removeflag'); } if (in_array('variables', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('setvariable')), 'set'); } if (in_array('enotify', $this->exts) || in_array('notify', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('notify')), 'notify'); } $select_action->add(rcube::Q($this->plugin->gettext('messagekeep')), 'keep'); $select_action->add(rcube::Q($this->plugin->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">'; // force domain selection in redirect email input $domains = (array) $this->rc->config->get('managesieve_domains'); if (!empty($domains)) { sort($domains); $domain_select = new html_select(array('name' => "_action_target_domain[{$id}]", 'id' => 'action_target_domain' . $id)); $domain_select->add(array_combine($domains, $domains)); if ($action['type'] == 'redirect') { $parts = explode('@', $action['target']); if (!empty($parts)) { $action['domain'] = array_pop($parts); $action['target'] = implode('@', $parts); } } } // redirect target $out .= '<span id="redirect_target' . $id . '" style="white-space:nowrap;' . ' display:' . ($action['type'] == 'redirect' ? 'inline' : 'none') . '">' . '<input type="text" name="_action_target[' . $id . ']" id="action_target' . $id . '"' . ' value="' . ($action['type'] == 'redirect' ? rcube::Q($action['target'], 'strict', false) : '') . '"' . (!empty($domains) ? ' size="20"' : ' size="35"') . $this->error_class($id, 'action', 'target', 'action_target') . ' />' . (!empty($domains) ? ' @ ' . $domain_select->show($action['domain']) : '') . '</span>'; // (e)reject 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')) ? rcube::Q($action['target'], 'strict', false) : '') . "</textarea>\n"; // vacation $vsec = in_array('vacation-seconds', $this->exts); $out .= '<div id="action_vacation' . $id . '" style="display:' . ($action['type'] == 'vacation' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . rcube::Q($this->plugin->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">' . rcube::Q($this->plugin->gettext('vacationsubject')) . '</span><br />' . '<input type="text" name="_action_subject[' . $id . ']" id="action_subject' . $id . '" ' . 'value="' . (is_array($action['subject']) ? rcube::Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' . $this->error_class($id, 'action', 'subject', 'action_subject') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('vacationaddr')) . '</span><br />' . $this->list_input($id, 'action_addresses', $action['addresses'], true, $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30); $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '</span><br />' . '<input type="text" name="_action_interval[' . $id . ']" id="action_interval' . $id . '" ' . 'value="' . rcube::Q(isset($action['seconds']) ? $action['seconds'] : $action['days'], 'strict', false) . '" size="2" ' . $this->error_class($id, 'action', 'interval', 'action_interval') . ' />'; if ($vsec) { $out .= ' <label><input type="radio" name="_action_interval_type[' . $id . ']" value="days"' . (!isset($action['seconds']) ? ' checked="checked"' : '') . ' class="radio" />' . $this->plugin->gettext('days') . '</label>' . ' <label><input type="radio" name="_action_interval_type[' . $id . ']" value="seconds"' . (isset($action['seconds']) ? ' checked="checked"' : '') . ' class="radio" />' . $this->plugin->gettext('seconds') . '</label>'; } $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"' : '') . ' />' . rcube::Q($this->plugin->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">' . rcube::Q($this->plugin->gettext('setvarname')) . '</span><br />' . '<input type="text" name="_action_varname[' . $id . ']" id="action_varname' . $id . '" ' . 'value="' . rcube::Q($action['name']) . '" size="35" ' . $this->error_class($id, 'action', 'name', 'action_varname') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('setvarvalue')) . '</span><br />' . '<input type="text" name="_action_varvalue[' . $id . ']" id="action_varvalue' . $id . '" ' . 'value="' . rcube::Q($action['value']) . '" size="35" ' . $this->error_class($id, 'action', 'value', 'action_varvalue') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('setvarmodifiers')) . '</span><br />'; 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, array_key_exists($s_m, (array) $action) && $action[$s_m] ? ' checked="checked"' : '', rcube::Q($this->plugin->gettext('var' . $s_m))); } $out .= '</div>'; // notify $notify_methods = (array) $this->rc->config->get('managesieve_notify_methods'); $importance_options = $this->notify_importance_options; if (empty($notify_methods)) { $notify_methods = $this->notify_methods; } list($method, $target) = explode(':', $action['method'], 2); $method = strtolower($method); if ($method && !in_array($method, $notify_methods)) { $notify_methods[] = $method; } $select_method = new html_select(array('name' => "_action_notifymethod[{$id}]", 'id' => "_action_notifymethod{$id}", 'class' => $this->error_class($id, 'action', 'method', 'action_notifymethod'))); foreach ($notify_methods as $m_n) { $select_method->add(rcube::Q($this->rc->text_exists('managesieve.notifymethod' . $m_n) ? $this->plugin->gettext('managesieve.notifymethod' . $m_n) : $m_n), $m_n); } $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(rcube::Q($this->plugin->gettext($io_n)), $io_v); } // @TODO: nice UI for mailto: (other methods too) URI parameters $out .= '<div id="action_notify' . $id . '" style="display:' . ($action['type'] == 'notify' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('notifytarget')) . '</span><br />' . $select_method->show($method) . '<input type="text" name="_action_notifytarget[' . $id . ']" id="action_notifytarget' . $id . '" ' . 'value="' . rcube::Q($target) . '" size="25" ' . $this->error_class($id, 'action', 'target', 'action_notifytarget') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifymessage')) . '</span><br />' . '<textarea name="_action_notifymessage[' . $id . ']" id="action_notifymessage' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'message', 'action_notifymessage') . '>' . rcube::Q($action['message'], 'strict', false) . "</textarea>\n"; if (in_array('enotify', $this->exts)) { $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifyfrom')) . '</span><br />' . '<input type="text" name="_action_notifyfrom[' . $id . ']" id="action_notifyfrom' . $id . '" ' . 'value="' . rcube::Q($action['from']) . '" size="35" ' . $this->error_class($id, 'action', 'from', 'action_notifyfrom') . ' />'; } $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifyimportance')) . '</span><br />'; $out .= $select_importance->show($action['importance'] ? (int) $action['importance'] : 2); $out .= '<div id="action_notifyoption_div' . $id . '">' . '<span class="label">' . rcube::Q($this->plugin->gettext('notifyoptions')) . '</span><br />' . $this->list_input($id, 'action_notifyoption', (array) $action['options'], true, $this->error_class($id, 'action', 'options', 'action_notifyoption'), 30) . '</div>'; $out .= '</div>'; // mailbox select if ($action['type'] == 'fileinto') { $mailbox = $this->mod_mailbox($action['target'], 'out'); } else { $mailbox = ''; } $select = $this->rc->folder_selector(array('realnames' => false, 'maxlength' => 100, 'id' => 'action_mailbox' . $id, 'name' => "_action_mailbox[{$id}]", 'style' => 'display:' . (empty($action['type']) || $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="' . rcube::Q($this->plugin->gettext('add')) . '" onclick="rcmail.managesieve_actionadd(' . $id . ')" class="button add"></a>'; $out .= '<a href="#" id="actiondel' . $id . '" title="' . rcube::Q($this->plugin->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 prefs_list($args) { if ($args['section'] == 'mailbox') { $RCMAIL = rcmail::get_instance(); $field_id = 'rcmfd_html5_notifier'; $select_duration = new html_select(array('name' => '_html5_notifier_duration', 'id' => $field_id)); $select_duration->add($this->gettext('off'), '0'); $times = array('3', '5', '8', '10', '12', '15', '20', '25', '30'); foreach ($times as $time) { $select_duration->add($time . ' ' . $this->gettext('seconds'), $time); } $select_duration->add($this->gettext('durable'), '-1'); $select_smbox = new html_select(array('name' => '_html5_notifier_smbox', 'id' => $field_id)); $select_smbox->add($this->gettext('no_mailbox'), '0'); $select_smbox->add($this->gettext('short_mailbox'), '1'); $select_smbox->add($this->gettext('full_mailbox'), '2'); $content = $select_duration->show($RCMAIL->config->get('html5_notifier_duration') . ''); $content .= $select_smbox->show($RCMAIL->config->get('html5_notifier_smbox') . ''); $content .= html::a(array('href' => '#', 'id' => 'rcmfd_html5_notifier_browser_conf', 'onclick' => 'rcmail_browser_notifications(); return false;'), $this->gettext('conf_browser')) . ' '; $content .= html::a(array('href' => '#', 'onclick' => 'rcmail_browser_notifications_test(); return false;'), $this->gettext('test_browser')); $args['blocks']['new_message']['options']['html5_notifier'] = array('title' => html::label($field_id, rcube::Q($this->gettext('shownotifies'))), 'content' => $content); $check_only_new = new html_checkbox(array('name' => '_html5_notifier_only_new', 'id' => $field_id . '_only_new', 'value' => 1)); $content = $check_only_new->show($RCMAIL->config->get('html5_notifier_only_new', false)); $args['blocks']['new_message']['options']['html5_notifier_only_new'] = array('title' => html::label($field_id, rcube::Q($this->gettext('onlynew'))), 'content' => $content); $input_excluded = new html_inputfield(array('name' => '_html5_notifier_excluded_directories', 'id' => $field_id . '_excluded')); $args['blocks']['new_message']['options']['html5_notifier_excluded_directories'] = array('title' => html::label($field_id, rcube::Q($this->gettext('excluded_directories'))), 'content' => $input_excluded->show($RCMAIL->config->get('html5_notifier_excluded_directories') . '')); $select_type = new html_select(array('name' => '_html5_notifier_popuptype', 'id' => $field_id . '_popuptype')); $select_type->add($this->gettext('new_tab'), '0'); $select_type->add($this->gettext('new_window'), '1'); $args['blocks']['new_message']['options']['html5_notifier_popuptype'] = array('title' => html::label($field_id, rcube::Q($this->gettext('notifier_popuptype'))), 'content' => $select_type->show($RCMAIL->config->get('html5_notifier_popuptype') . '')); $RCMAIL->output->add_script("\$(document).ready(function(){ rcmail_browser_notifications_colorate(); });"); } return $args; }
/** * */ private function mail_agenda_event_row($event, $class = '') { $time = $event['allday'] ? $this->gettext('all-day') : $this->rc->format_date($event['start'], $this->rc->config->get('time_format')) . ' - ' . $this->rc->format_date($event['end'], $this->rc->config->get('time_format')); return html::div(rtrim('event-row ' . $class), html::span('event-date', $time) . html::span('event-title', rcube::Q($event['title']))); }
/** * Handler for message_compose_body hook * Display error when the message cannot be encrypted * and provide a way to try again with a password. */ function message_compose($p) { $engine = $this->enigma->load_engine(); // skip: message has no signed/encoded content if (!$this->enigma->engine) { return $p; } $engine = $this->enigma->engine; // Decryption status foreach ($engine->decryptions as $status) { if ($status instanceof enigma_error) { $code = $status->getCode(); if ($code == enigma_error::KEYNOTFOUND) { $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')), $this->enigma->gettext('decryptnokey'))); } else { if ($code == enigma_error::BADPASS) { $this->password_prompt($status, array('compose-init' => true)); return $p; } else { $msg = rcube::Q($this->enigma->gettext('decrypterror')); } } } } if ($msg) { $this->rc->output->show_message($msg, 'error'); } // Check sign/ecrypt options for signed/encrypted drafts $this->rc->output->set_env('enigma_force_encrypt', !empty($engine->decryptions)); $this->rc->output->set_env('enigma_force_sign', !empty($engine->signatures)); return $p; }
function gen_form() { $this->rcmail_inst->output->set_env('framed', true); $out = '<form class="propform"><fieldset><legend>' . $this->gettext('acc_general') . '</legend>' . "\n"; $table = new html_table(array('cols' => 2, 'cellpadding' => 3, 'class' => 'propform')); $table->add('title', rcube::Q($this->gettext('username'))); $table->add('', rcube::Q($this->rcmail_inst->user->data['username'])); $table->add('title', rcube::Q($this->gettext('server'))); $table->add('', rcube::Q($this->rcmail_inst->user->data['mail_host'])); $table->add('title', rcube::Q($this->gettext('acc_lastlogin'))); $table->add('', rcube::Q($this->rcmail_inst->user->data['last_login'])); $identity = $this->rcmail_inst->user->get_identity(); $table->add('title', rcube::Q($this->gettext('acc_defaultidentity'))); $table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>')); $out .= $table->show(); $out .= "</fieldset>\n"; $out .= '<fieldset><legend>' . $this->gettext('acc_alias') . '</legend>' . "\n"; $alias_table = new html_table(array('id' => 'alias-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 1)); $alias_table->add_header(array('width' => '100%'), $this->gettext('mail')); 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'])); $alias = $this->soap->mail_alias_get($session_id, array('destination' => $mail_user[0]['email'], 'type' => 'alias', 'active' => 'y')); $this->soap->logout($session_id); $class = $class == 'odd' ? 'even' : 'odd'; $alias_table->set_row_attribs(array('class' => $class)); $alias_table->add('', $mail_user[0]['email']); for ($i = 0; $i < count($alias); $i++) { $class = $class == 'odd' ? 'even' : 'odd'; $alias_table->set_row_attribs(array('class' => $class)); $alias_table->add('', $alias[$i]['source']); } } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } $out .= "<div id=\"alias-cont\">" . $alias_table->show() . "</div>\n"; $out .= "</fieldset></form>\n"; return $out; }
/** * Helper function used in calendar_form_content(). Creates a part of the form. */ private function get_form_part($form) { $content = ''; if (is_array($form['content']) && !empty($form['content'])) { $table = new html_table(array('cols' => 2)); foreach ($form['content'] as $col => $colprop) { $label = !empty($colprop['label']) ? $colprop['label'] : $this->cal->gettext($col); $table->add('title', html::label($colprop['id'], rcube::Q($label))); $table->add(null, $colprop['value']); } $content = $table->show(); } else { $content = $form['content']; } return $content; }
/** * Handler for user preferences form (preferences_list hook) */ function prefs_list($args) { if ($args['section'] != 'mailbox') { return $args; } // Load configuration $this->load_config(); // Load localization and configuration $this->add_texts('localization/'); if (!empty($_REQUEST['_framed'])) { $this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.testbody', 'newmail_notifier.desktopunsupported', 'newmail_notifier.desktopenabled', 'newmail_notifier.desktopdisabled'); $this->include_script('newmail_notifier.js'); } // Check that configuration is not disabled $dont_override = (array) $this->rc->config->get('dont_override', array()); foreach (array('basic', 'desktop', 'sound') as $type) { $key = 'newmail_notifier_' . $type; if (!in_array($key, $dont_override)) { $field_id = '_' . $key; $input = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1)); $content = $input->show($this->rc->config->get($key)) . ' ' . html::a(array('href' => '#', 'onclick' => 'newmail_notifier_test_' . $type . '()'), $this->gettext('test')); $args['blocks']['new_message']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext($type))), 'content' => $content); } } $type = 'desktop_timeout'; $key = 'newmail_notifier_' . $type; if (!in_array($key, $dont_override)) { $field_id = '_' . $key; $select = new html_select(array('name' => $field_id, 'id' => $field_id)); foreach (array(5, 10, 15, 30, 45, 60) as $sec) { $label = $this->rc->gettext(array('name' => 'afternseconds', 'vars' => array('n' => $sec))); $select->add($label, $sec); } $args['blocks']['new_message']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext('desktoptimeout'))), 'content' => $select->show((int) $this->rc->config->get($key))); } return $args; }
/** * Outputs error message according to server error/response codes * * @param string $fallback Fallback message label * @param array $fallback_args Fallback message label arguments * @param string $suffix Message label suffix * @param array $params Additional parameters (type, prefix) */ public function display_server_error($fallback = null, $fallback_args = null, $suffix = '', $params = array()) { $err_code = $this->storage->get_error_code(); $res_code = $this->storage->get_response_code(); $args = array(); if ($res_code == rcube_storage::NOPERM) { $error = 'errornoperm'; } else { if ($res_code == rcube_storage::READONLY) { $error = 'errorreadonly'; } else { if ($res_code == rcube_storage::OVERQUOTA) { $error = 'erroroverquota'; } else { if ($err_code && ($err_str = $this->storage->get_error_str())) { // try to detect access rights problem and display appropriate message if (stripos($err_str, 'Permission denied') !== false) { $error = 'errornoperm'; } else { if (stripos($err_str, 'quot') !== false && preg_match('/exceed|over/i', $err_str)) { $error = 'erroroverquota'; } else { $error = 'servererrormsg'; $args = array('msg' => rcube::Q($err_str)); } } } else { if ($err_code < 0) { $error = 'storageerror'; } else { if ($fallback) { $error = $fallback; $args = $fallback_args; $params['prefix'] = false; } } } } } } if ($error) { if ($suffix && $this->text_exists($error . $suffix)) { $error .= $suffix; } $msg = $this->gettext(array('name' => $error, 'vars' => $args)); if ($params['prefix'] && $fallback) { $msg = $this->gettext(array('name' => $fallback, 'vars' => $fallback_args)) . ' ' . $msg; } $this->output->show_message($msg, $params['type'] ?: 'error'); } }
/** * Handler for preferences_list hook. * Adds options blocks into Calendar settings sections in Preferences. * * @param array Original parameters * @return array Modified parameters */ function preferences_list($p) { if ($p['section'] != 'calendar') { return $p; } $no_override = array_flip((array) $this->rc->config->get('dont_override')); $p['blocks']['view']['name'] = $this->gettext('mainoptions'); if (!isset($no_override['calendar_default_view'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_default_view'; $select = new html_select(array('name' => '_default_view', 'id' => $field_id)); $select->add($this->gettext('day'), "agendaDay"); $select->add($this->gettext('week'), "agendaWeek"); $select->add($this->gettext('month'), "month"); $select->add($this->gettext('agenda'), "table"); $p['blocks']['view']['options']['default_view'] = array('title' => html::label($field_id, Q($this->gettext('default_view'))), 'content' => $select->show($this->rc->config->get('calendar_default_view', $this->defaults['calendar_default_view']))); } if (!isset($no_override['calendar_timeslots'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_timeslot'; $choices = array('1', '2', '3', '4', '6'); $select = new html_select(array('name' => '_timeslots', 'id' => $field_id)); $select->add($choices); $p['blocks']['view']['options']['timeslots'] = array('title' => html::label($field_id, Q($this->gettext('timeslots'))), 'content' => $select->show(strval($this->rc->config->get('calendar_timeslots', $this->defaults['calendar_timeslots'])))); } if (!isset($no_override['calendar_first_day'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_firstday'; $select = new html_select(array('name' => '_first_day', 'id' => $field_id)); $select->add(rcube_label('sunday'), '0'); $select->add(rcube_label('monday'), '1'); $select->add(rcube_label('tuesday'), '2'); $select->add(rcube_label('wednesday'), '3'); $select->add(rcube_label('thursday'), '4'); $select->add(rcube_label('friday'), '5'); $select->add(rcube_label('saturday'), '6'); $p['blocks']['view']['options']['first_day'] = array('title' => html::label($field_id, Q($this->gettext('first_day'))), 'content' => $select->show(strval($this->rc->config->get('calendar_first_day', $this->defaults['calendar_first_day'])))); } if (!isset($no_override['calendar_first_hour'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $time_format = $this->rc->config->get('time_format', libcalendaring::to_php_date_format($this->rc->config->get('calendar_time_format', $this->defaults['calendar_time_format']))); $select_hours = new html_select(); for ($h = 0; $h < 24; $h++) { $select_hours->add(date($time_format, mktime($h, 0, 0)), $h); } $field_id = 'rcmfd_firsthour'; $p['blocks']['view']['options']['first_hour'] = array('title' => html::label($field_id, Q($this->gettext('first_hour'))), 'content' => $select_hours->show($this->rc->config->get('calendar_first_hour', $this->defaults['calendar_first_hour']), array('name' => '_first_hour', 'id' => $field_id))); } if (!isset($no_override['calendar_work_start'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_workstart'; $p['blocks']['view']['options']['workinghours'] = array('title' => html::label($field_id, Q($this->gettext('workinghours'))), 'content' => $select_hours->show($this->rc->config->get('calendar_work_start', $this->defaults['calendar_work_start']), array('name' => '_work_start', 'id' => $field_id)) . ' — ' . $select_hours->show($this->rc->config->get('calendar_work_end', $this->defaults['calendar_work_end']), array('name' => '_work_end', 'id' => $field_id))); } if (!isset($no_override['calendar_event_coloring'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_coloring'; $select_colors = new html_select(array('name' => '_event_coloring', 'id' => $field_id)); $select_colors->add($this->gettext('coloringmode0'), 0); $select_colors->add($this->gettext('coloringmode1'), 1); $select_colors->add($this->gettext('coloringmode2'), 2); $select_colors->add($this->gettext('coloringmode3'), 3); $p['blocks']['view']['options']['eventcolors'] = array('title' => html::label($field_id . 'value', Q($this->gettext('eventcoloring'))), 'content' => $select_colors->show($this->rc->config->get('calendar_event_coloring', $this->defaults['calendar_event_coloring']))); } // loading driver is expensive, don't do it if not needed $this->load_driver(); if (!isset($no_override['calendar_default_alarm_type'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_alarm'; $select_type = new html_select(array('name' => '_alarm_type', 'id' => $field_id)); $select_type->add($this->gettext('none'), ''); foreach ($this->driver->alarm_types as $type) { $select_type->add(rcube_label(strtolower("alarm{$type}option"), 'libcalendaring'), $type); } $p['blocks']['view']['options']['alarmtype'] = array('title' => html::label($field_id, Q($this->gettext('defaultalarmtype'))), 'content' => $select_type->show($this->rc->config->get('calendar_default_alarm_type', ''))); } if (!isset($no_override['calendar_default_alarm_offset'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_alarm'; $input_value = new html_inputfield(array('name' => '_alarm_value', 'id' => $field_id . 'value', 'size' => 3)); $select_offset = new html_select(array('name' => '_alarm_offset', 'id' => $field_id . 'offset')); foreach (array('-M', '-H', '-D', '+M', '+H', '+D') as $trigger) { $select_offset->add(rcube_label('trigger' . $trigger, 'libcalendaring'), $trigger); } $preset = libcalendaring::parse_alarm_value($this->rc->config->get('calendar_default_alarm_offset', '-15M')); $p['blocks']['view']['options']['alarmoffset'] = array('title' => html::label($field_id . 'value', Q($this->gettext('defaultalarmoffset'))), 'content' => $input_value->show($preset[0]) . ' ' . $select_offset->show($preset[1])); } if (!isset($no_override['calendar_default_calendar'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } // default calendar selection $field_id = 'rcmfd_default_calendar'; $select_cal = new html_select(array('name' => '_default_calendar', 'id' => $field_id, 'is_escaped' => true)); foreach ((array) $this->driver->list_calendars(false, true) as $id => $prop) { $select_cal->add($prop['name'], strval($id)); if ($prop['default']) { $default_calendar = $id; } } $p['blocks']['view']['options']['defaultcalendar'] = array('title' => html::label($field_id . 'value', Q($this->gettext('defaultcalendar'))), 'content' => $select_cal->show($this->rc->config->get('calendar_default_calendar', $default_calendar))); } $p['blocks']['itip']['name'] = $this->gettext('itipoptions'); // Invitations handling if (!isset($no_override['calendar_itip_after_action'])) { if (!$p['current']) { $p['blocks']['itip']['content'] = true; return $p; } $field_id = 'rcmfd_after_action'; $select = new html_select(array('name' => '_after_action', 'id' => $field_id, 'onchange' => "\$('#{$field_id}_select')[this.value == 4 ? 'show' : 'hide']()")); $select->add($this->gettext('afternothing'), ''); $select->add($this->gettext('aftertrash'), 1); $select->add($this->gettext('afterdelete'), 2); $select->add($this->gettext('afterflagdeleted'), 3); $select->add($this->gettext('aftermoveto'), 4); $val = $this->rc->config->get('calendar_itip_after_action', $this->defaults['calendar_itip_after_action']); if ($val !== null && $val !== '' && !is_int($val)) { $folder = $val; $val = 4; } $folders = $this->rc->folder_selector(array('id' => $field_id . '_select', 'name' => '_after_action_folder', 'maxlength' => 30, 'folder_filter' => 'mail', 'folder_rights' => 'w', 'style' => $val !== 4 ? 'display:none' : '')); $p['blocks']['itip']['options']['after_action'] = array('title' => html::label($field_id, Q($this->gettext('afteraction'))), 'content' => $select->show($val) . $folders->show($folder)); } // category definitions if (!$this->driver->nocategories && !isset($no_override['calendar_categories'])) { $p['blocks']['categories']['name'] = $this->gettext('categories'); if (!$p['current']) { $p['blocks']['categories']['content'] = true; return $p; } $categories = (array) $this->driver->list_categories(); $categories_list = ''; foreach ($categories as $name => $color) { $key = md5($name); $field_class = 'rcmfd_category_' . str_replace(' ', '_', $name); $category_remove = new html_inputfield(array('type' => 'button', 'value' => 'X', 'class' => 'button', 'onclick' => '$(this).parent().remove()', 'title' => $this->gettext('remove_category'))); $category_name = new html_inputfield(array('name' => "_categories[{$key}]", 'class' => $field_class, 'size' => 30, 'disabled' => $this->driver->categoriesimmutable)); $category_color = new html_inputfield(array('name' => "_colors[{$key}]", 'class' => "{$field_class} colors", 'size' => 6)); $hidden = $this->driver->categoriesimmutable ? html::tag('input', array('type' => 'hidden', 'name' => "_categories[{$key}]", 'value' => $name)) : ''; $categories_list .= html::div(null, $hidden . $category_name->show($name) . ' ' . $category_color->show($color) . ' ' . $category_remove->show()); } $p['blocks']['categories']['options']['category_' . $name] = array('content' => html::div(array('id' => 'calendarcategories'), $categories_list)); $field_id = 'rcmfd_new_category'; $new_category = new html_inputfield(array('name' => '_new_category', 'id' => $field_id, 'size' => 30)); $add_category = new html_inputfield(array('type' => 'button', 'class' => 'button', 'value' => $this->gettext('add_category'), 'onclick' => "rcube_calendar_add_category()")); $p['blocks']['categories']['options']['categories'] = array('content' => $new_category->show('') . ' ' . $add_category->show()); $this->rc->output->add_script('function rcube_calendar_add_category(){ var name = $("#rcmfd_new_category").val(); if (name.length) { var input = $("<input>").attr("type", "text").attr("name", "_categories[]").attr("size", 30).val(name); var color = $("<input>").attr("type", "text").attr("name", "_colors[]").attr("size", 6).addClass("colors").val("000000"); var button = $("<input>").attr("type", "button").attr("value", "X").addClass("button").click(function(){ $(this).parent().remove() }); $("<div>").append(input).append(" ").append(color).append(" ").append(button).appendTo("#calendarcategories"); color.miniColors({ colorValues:(rcmail.env.mscolors || []) }); $("#rcmfd_new_category").val(""); } }'); $this->rc->output->add_script('$("#rcmfd_new_category").keypress(function(event){ if (event.which == 13) { rcube_calendar_add_category(); event.preventDefault(); } }); ', 'docready'); // load miniColors js/css files jqueryui::miniColors(); } // virtual birthdays calendar if (!isset($no_override['calendar_contact_birthdays'])) { $p['blocks']['birthdays']['name'] = $this->gettext('birthdayscalendar'); if (!$p['current']) { $p['blocks']['birthdays']['content'] = true; return $p; } $field_id = 'rcmfd_contact_birthdays'; $input = new html_checkbox(array('name' => '_contact_birthdays', 'id' => $field_id, 'value' => 1, 'onclick' => '$(".calendar_birthday_props").prop("disabled",!this.checked)')); $p['blocks']['birthdays']['options']['contact_birthdays'] = array('title' => html::label($field_id, $this->gettext('displaybirthdayscalendar')), 'content' => $input->show($this->rc->config->get('calendar_contact_birthdays') ? 1 : 0)); $input_attrib = array('class' => 'calendar_birthday_props', 'disabled' => !$this->rc->config->get('calendar_contact_birthdays')); $sources = array(); $checkbox = new html_checkbox(array('name' => '_birthday_adressbooks[]') + $input_attrib); foreach ($this->rc->get_address_sources(false, true) as $source) { $active = in_array($source['id'], (array) $this->rc->config->get('calendar_birthday_adressbooks', array())) ? $source['id'] : ''; $sources[] = html::label(null, $checkbox->show($active, array('value' => $source['id'])) . ' ' . rcube::Q($source['realname'] ?: $source['name'])); } $p['blocks']['birthdays']['options']['birthday_adressbooks'] = array('title' => rcube::Q($this->gettext('birthdayscalendarsources')), 'content' => join(html::br(), $sources)); $field_id = 'rcmfd_birthdays_alarm'; $select_type = new html_select(array('name' => '_birthdays_alarm_type', 'id' => $field_id) + $input_attrib); $select_type->add($this->gettext('none'), ''); foreach ($this->driver->alarm_types as $type) { $select_type->add(rcube_label(strtolower("alarm{$type}option"), 'libcalendaring'), $type); } $input_value = new html_inputfield(array('name' => '_birthdays_alarm_value', 'id' => $field_id . 'value', 'size' => 3) + $input_attrib); $select_offset = new html_select(array('name' => '_birthdays_alarm_offset', 'id' => $field_id . 'offset') + $input_attrib); foreach (array('-M', '-H', '-D') as $trigger) { $select_offset->add(rcube_label('trigger' . $trigger, 'libcalendaring'), $trigger); } $preset = libcalendaring::parse_alarm_value($this->rc->config->get('calendar_birthdays_alarm_offset', '-1D')); $p['blocks']['birthdays']['options']['birthdays_alarmoffset'] = array('title' => html::label($field_id . 'value', rcube::Q($this->gettext('showalarms'))), 'content' => $select_type->show($this->rc->config->get('calendar_birthdays_alarm_type', '')) . ' ' . $input_value->show($preset[0]) . ' ' . $select_offset->show($preset[1])); } return $p; }
/** * Independent vacation form */ public function vacation_form($attrib) { // check supported extensions $date_extension = in_array('date', $this->exts); $regex_extension = in_array('regex', $this->exts); $seconds_extension = in_array('vacation-seconds', $this->exts); // build FORM tag $form_id = $attrib['id'] ?: 'form'; $out = $this->rc->output->request_form(array('id' => $form_id, 'name' => $form_id, 'method' => 'post', 'task' => 'settings', 'action' => 'plugin.managesieve-vacation', 'noclose' => true) + $attrib); $from_addr = $this->rc->config->get('managesieve_vacation_from_init'); $auto_addr = $this->rc->config->get('managesieve_vacation_addresses_init'); if (count($this->vacation) < 2) { if ($auto_addr) { $this->vacation['addresses'] = $this->user_emails(); } if ($from_addr) { $default_identity = $this->rc->user->list_emails(true); $this->vacation['from'] = $default_identity['email']; } } // form elements $from = new html_inputfield(array('name' => 'vacation_from', 'id' => 'vacation_from', 'size' => 50)); $subject = new html_inputfield(array('name' => 'vacation_subject', 'id' => 'vacation_subject', 'size' => 50)); $reason = new html_textarea(array('name' => 'vacation_reason', 'id' => 'vacation_reason', 'cols' => 60, 'rows' => 8)); $interval = new html_inputfield(array('name' => 'vacation_interval', 'id' => 'vacation_interval', 'size' => 5)); $addresses = '<textarea name="vacation_addresses" id="vacation_addresses" data-type="list" data-size="30" style="display: none">' . rcube::Q(implode("\n", (array) $this->vacation['addresses']), 'strict', false) . '</textarea>'; $status = new html_select(array('name' => 'vacation_status', 'id' => 'vacation_status')); $action = new html_select(array('name' => 'vacation_action', 'id' => 'vacation_action', 'onchange' => 'vacation_action_select()')); $addresses_link = new html_inputfield(array('type' => 'button', 'href' => '#', 'class' => 'button', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.managesieve_vacation_addresses()')); $status->add($this->plugin->gettext('vacation.on'), 'on'); $status->add($this->plugin->gettext('vacation.off'), 'off'); $action->add($this->plugin->gettext('vacation.keep'), 'keep'); $action->add($this->plugin->gettext('vacation.discard'), 'discard'); $action->add($this->plugin->gettext('vacation.redirect'), 'redirect'); if (in_array('copy', $this->exts)) { $action->add($this->plugin->gettext('vacation.copy'), 'copy'); } if ($this->rc->config->get('managesieve_vacation') != 2 && count($this->vacation['list'])) { $after = new html_select(array('name' => 'vacation_after', 'id' => 'vacation_after')); $after->add('', ''); foreach ($this->vacation['list'] as $idx => $rule) { $after->add($rule, $idx); } } $interval_txt = $interval->show(self::vacation_interval($this->vacation)); if ($seconds_extension) { $interval_select = new html_select(array('name' => 'vacation_interval_type')); $interval_select->add($this->plugin->gettext('days'), 'days'); $interval_select->add($this->plugin->gettext('seconds'), 'seconds'); $interval_txt .= ' ' . $interval_select->show(isset($this->vacation['seconds']) ? 'seconds' : 'days'); } else { $interval_txt .= ' ' . $this->plugin->gettext('days'); } if ($date_extension || $regex_extension) { $date_from = new html_inputfield(array('name' => 'vacation_datefrom', 'id' => 'vacation_datefrom', 'class' => 'datepicker', 'size' => 12)); $date_to = new html_inputfield(array('name' => 'vacation_dateto', 'id' => 'vacation_dateto', 'class' => 'datepicker', 'size' => 12)); $date_format = $this->rc->config->get('date_format', 'Y-m-d'); } if ($date_extension) { $time_from = new html_inputfield(array('name' => 'vacation_timefrom', 'id' => 'vacation_timefrom', 'size' => 6)); $time_to = new html_inputfield(array('name' => 'vacation_timeto', 'id' => 'vacation_timeto', 'size' => 6)); $time_format = $this->rc->config->get('time_format', 'H:i'); $date_value = array(); foreach ((array) $this->vacation['tests'] as $test) { if ($test['test'] == 'currentdate') { $idx = $test['type'] == 'value-ge' ? 'from' : 'to'; if ($test['part'] == 'date') { $date_value[$idx]['date'] = $test['arg']; } else { if ($test['part'] == 'iso8601') { $date_value[$idx]['datetime'] = $test['arg']; } } } } foreach ($date_value as $idx => $value) { $date = $value['datetime'] ?: $value['date']; $date_value[$idx] = $this->rc->format_date($date, $date_format, false); if (!empty($value['datetime'])) { $date_value['time_' . $idx] = $this->rc->format_date($date, $time_format, true); } } } else { if ($regex_extension) { // Sieve 'date' extension not available, read start/end from RegEx based rules instead if ($date_tests = self::parse_regexp_tests($this->vacation['tests'])) { $date_value['from'] = $this->rc->format_date($date_tests['from'], $date_format, false); $date_value['to'] = $this->rc->format_date($date_tests['to'], $date_format, false); } } } // force domain selection in redirect email input $domains = (array) $this->rc->config->get('managesieve_domains'); $redirect = $this->vacation['action'] == 'redirect' || $this->vacation['action'] == 'copy'; if (!empty($domains)) { sort($domains); $domain_select = new html_select(array('name' => 'action_domain', 'id' => 'action_domain')); $domain_select->add(array_combine($domains, $domains)); if ($redirect && $this->vacation['target']) { $parts = explode('@', $this->vacation['target']); if (!empty($parts)) { $this->vacation['domain'] = array_pop($parts); $this->vacation['target'] = implode('@', $parts); } } } // redirect target $action_target = ' <span id="action_target_span" style="display:' . ($redirect ? 'inline' : 'none') . '">' . '<input type="text" name="action_target" id="action_target"' . ' value="' . ($redirect ? rcube::Q($this->vacation['target'], 'strict', false) : '') . '"' . (!empty($domains) ? ' size="20"' : ' size="35"') . '/>' . (!empty($domains) ? ' @ ' . $domain_select->show($this->vacation['domain']) : '') . '</span>'; // Message tab $table = new html_table(array('cols' => 2)); $table->add('title', html::label('vacation_subject', $this->plugin->gettext('vacation.subject'))); $table->add(null, $subject->show($this->vacation['subject'])); $table->add('title', html::label('vacation_reason', $this->plugin->gettext('vacation.body'))); $table->add(null, $reason->show($this->vacation['reason'])); if ($date_extension || $regex_extension) { $table->add('title', html::label('vacation_datefrom', $this->plugin->gettext('vacation.start'))); $table->add(null, $date_from->show($date_value['from']) . ($time_from ? ' ' . $time_from->show($date_value['time_from']) : '')); $table->add('title', html::label('vacation_dateto', $this->plugin->gettext('vacation.end'))); $table->add(null, $date_to->show($date_value['to']) . ($time_to ? ' ' . $time_to->show($date_value['time_to']) : '')); } $table->add('title', html::label('vacation_status', $this->plugin->gettext('vacation.status'))); $table->add(null, $status->show(!isset($this->vacation['disabled']) || $this->vacation['disabled'] ? 'off' : 'on')); $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.reply')) . $table->show($attrib)); // Advanced tab $table = new html_table(array('cols' => 2)); $table->add('title', html::label('vacation_from', $this->plugin->gettext('vacation.from'))); $table->add(null, $from->show($this->vacation['from'])); $table->add('title', html::label('vacation_addresses', $this->plugin->gettext('vacation.addresses'))); $table->add(null, $addresses . $addresses_link->show($this->plugin->gettext('filladdresses'))); $table->add('title', html::label('vacation_interval', $this->plugin->gettext('vacation.interval'))); $table->add(null, $interval_txt); if ($after) { $table->add('title', html::label('vacation_after', $this->plugin->gettext('vacation.after'))); $table->add(null, $after->show($this->vacation['idx'] - 1)); } $table->add('title', html::label('vacation_action', $this->plugin->gettext('vacation.action'))); $table->add('vacation', $action->show($this->vacation['action']) . $action_target); $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.advanced')) . $table->show($attrib)); $out .= '</form>'; $this->rc->output->add_gui_object('sieveform', $form_id); if ($time_format) { $this->rc->output->set_env('time_format', $time_format); } return $out; }
function password_form() { $rcmail = rcmail::get_instance(); // add some labels to client $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency'); $rcmail->output->set_env('product_name', $rcmail->config->get('product_name')); $table = new html_table(array('cols' => 2)); if ($rcmail->config->get('password_confirm_current')) { // show current password selection $field_id = 'curpasswd'; $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, rcube::Q($this->gettext('curpasswd')))); $table->add(null, $input_curpasswd->show()); } // show new password selection $field_id = 'newpasswd'; $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, rcube::Q($this->gettext('newpasswd')))); $table->add(null, $input_newpasswd->show()); // show confirm password selection $field_id = 'confpasswd'; $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, rcube::Q($this->gettext('confpasswd')))); $table->add(null, $input_confpasswd->show()); $rules = ''; $required_length = intval($rcmail->config->get('password_minimum_length')); if ($required_length > 0) { $rules .= html::tag('li', array('id' => 'required-length'), $this->gettext(array('name' => 'passwordshort', 'vars' => array('length' => $required_length)))); } if ($rcmail->config->get('password_require_nonalpha')) { $rules .= html::tag('li', array('id' => 'require-nonalpha'), $this->gettext('passwordweak')); } if (!empty($rules)) { $rules = html::tag('ul', array('id' => 'ruleslist'), $rules); } $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . $rules . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))))); $rcmail->output->add_gui_object('passform', 'password-form'); return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out); }
/** * Creates <UL> list with descriptive access rights * * @param array $rights MYRIGHTS result * * @return string HTML content */ function acl2text($rights) { if (empty($rights)) { return ''; } $supported = $this->rights_supported(); $list = array(); $attrib = array('name' => 'rcmyrights', 'style' => 'margin:0; padding:0 15px;'); foreach ($supported as $right) { if (in_array($right, $rights)) { $list[] = html::tag('li', null, rcube::Q($this->gettext('acl' . $right))); } } if (count($list) == count($supported)) { return rcube::Q($this->gettext('aclfull')); } return html::tag('ul', $attrib, implode("\n", $list)); }
function save_data() { $COMPOSE_ID = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC); $COMPOSE = null; if ($COMPOSE_ID && $_SESSION['compose_data_' . $COMPOSE_ID]) { $SESSION_KEY = 'compose_data_' . $COMPOSE_ID; $COMPOSE =& $_SESSION[$SESSION_KEY]; } if (!$COMPOSE) { die("Invalid session var!"); } $uploadid = rcube_utils::get_input_value('_uploadid', rcube_utils::INPUT_POST); $files = rcube_utils::get_input_value('files', rcube_utils::INPUT_POST); $RCMAIL = rcmail::get_instance(); $RCMAIL->output->reset(); //rcube::write_log('dropbox_attachments', $files); if (is_array($files)) { $multiple = count($files) > 1; foreach ($files as $i => $file) { /*File checks*/ $err = false; if ($file['is_dir'] == 'true') { $err = "UPLOAD_ERR_DIRECTORY"; } // Fetch file $filepath = $this->download_fopen($file['link']); //rcube::write_log('dropbox_attachments', link); //rcube::write_log('dropbox_attachments', $filepath); rcube::write_log('dropbox_attachments', $file['link']); if (!$filepath) { $err = "UPLOAD_ERR_FETCH"; } if (!$err) { $attachment = $this->move_file(array('path' => $filepath, 'size' => $file['bytes'], 'name' => $file['name'], 'mimetype' => rcube_mime::file_content_type($filepath, $file['name']), 'group' => $COMPOSE_ID)); } //rcube::write_log('dropbox_attachments', $attachment); if (!$err && $attachment['status'] && !$attachment['abort']) { $id = $attachment['id']; // store new attachment in session unset($attachment['status'], $attachment['abort']); $RCMAIL->session->append($SESSION_KEY . '.attachments', $id, $attachment); if (($icon = $COMPOSE['deleteicon']) && is_file($icon)) { $button = html::img(array('src' => $icon, 'alt' => $RCMAIL->gettext('delete'))); } else { if ($COMPOSE['textbuttons']) { $button = rcube::Q($RCMAIL->gettext('delete')); } else { $button = ''; } } $content = html::a(array('href' => "#delete", 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", rcmail_output::JS_OBJECT_NAME, $id), 'title' => $RCMAIL->gettext('delete'), 'class' => 'delete'), $button); $content .= rcube::Q($attachment['name']); $RCMAIL->output->command('add2attachment_list', "rcmfile{$id}", array('html' => $content, 'name' => $attachment['name'], 'mimetype' => $attachment['mimetype'], 'classname' => rcube_utils::file2class($attachment['mimetype'], $attachment['name']), 'complete' => true), $uploadid); } else { // upload failed if ($err == "UPLOAD_ERR_DIRECTORY") { $msg = "Directory upload not allowed."; } else { if ($err == "UPLOAD_ERR_FETCH") { $msg = "Failed to download file from Dropbox"; } else { if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) { $size = $RCMAIL->show_bytes(parse_bytes(ini_get('upload_max_filesize'))); $msg = $RCMAIL->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $size))); } else { if ($attachment['error']) { $msg = $attachment['error']; } else { $msg = $RCMAIL->gettext('fileuploaderror'); } } } } if ($attachment['error'] || $err != UPLOAD_ERR_NO_FILE) { $RCMAIL->output->command('display_message', $msg, 'error'); $RCMAIL->output->command('remove_from_attachment_list', $uploadid); } } } } $RCMAIL->output->command('auto_save_start', 'false'); $RCMAIL->output->send(); }
echo '</div></body></html>'; exit; } ?> <h1>Roundcube Webmail Installer</h1> <ol id="progress"> <?php $include_steps = array(1 => './check.php', 2 => './config.php', 3 => './test.php'); if (!in_array($RCI->step, array_keys($include_steps))) { $RCI->step = 1; } foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { $j = $i + 1; $link = $RCI->step >= $j || $RCI->configured ? '<a href="./index.php?_step=' . $j . '">' . rcube::Q($item) . '</a>' : rcube::Q($item); printf('<li class="step%d%s">%s</li>', $j + 1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link); } ?> </ol> <?php include $include_steps[$RCI->step]; ?> </div> <div id="footer"> Installer by the Roundcube Dev Team. Copyright © 2008-2012 – Published under the GNU Public License; Icons by <a href="http://famfamfam.com">famfamfam</a> </div> </body>