本文整理匯總了PHP中rcmail::get_uids方法的典型用法代碼示例。如果您正苦於以下問題:PHP rcmail::get_uids方法的具體用法?PHP rcmail::get_uids怎麽用?PHP rcmail::get_uids使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rcmail
的用法示例。
在下文中一共展示了rcmail::get_uids方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: request_action
function request_action()
{
$this->add_texts('localization');
$rcmail = rcmail::get_instance();
$storage = $rcmail->get_storage();
foreach (rcmail::get_uids() as $mbox => $uids) {
$storage->unset_flag($uids, 'NONJUNK', $mbox);
$storage->set_flag($uids, 'JUNK', $mbox);
$message = new rcube_message($uids[0]);
if ($junk_mbox = $rcmail->config->get('junk_mbox')) {
$rcmail->output->command('move_messages', $junk_mbox);
}
if (isset($message->headers->others['received-spfbl'])) {
$received_spfbl = $message->headers->others['received-spfbl'];
$received_spfbl = explode(' ', $received_spfbl);
$received_spfbl = $received_spfbl[1];
$fp = fsockopen($this->spfbl_server, $this->spfbl_port, $errno, $errstr, $this->spfbl_timeout);
if (!$fp) {
echo "Erro: {$errstr} ({$errno})<br />\n";
} else {
$out = "SPAM {$received_spfbl}\n";
fwrite($fp, $out);
$return = '';
while (!feof($fp)) {
$return .= fgets($fp, 128);
}
fclose($fp);
$return = strtolower(trim($return));
if (substr($return, 0, 2) == 'ok') {
$rcmail->output->command('display_message', $this->gettext('reportedasjunk'), 'confirmation');
} else {
if ($return == 'error: decryption') {
$rcmail->output->command('display_message', "Ticket SPFBL inválido.", 'error');
} else {
if ($return == 'duplicate complain') {
$rcmail->output->command('display_message', "Esta mensagem já foi reportada como spam", 'error');
} else {
if ($return == '') {
$rcmail->output->command('display_message', "Timeout no envio do report", 'error');
} else {
$rcmail->output->command('display_message', "Erro: " . $return, 'error');
}
}
}
}
}
}
}
$rcmail->output->send();
}
示例2: request_action
function request_action()
{
$this->add_texts('localization');
$rcmail = rcmail::get_instance();
$storage = $rcmail->get_storage();
foreach (rcmail::get_uids() as $mbox => $uids) {
$storage->unset_flag($uids, 'NONJUNK', $mbox);
$storage->set_flag($uids, 'JUNK', $mbox);
}
if ($junk_mbox = $rcmail->config->get('junk_mbox')) {
$rcmail->output->command('move_messages', $junk_mbox);
}
$rcmail->output->command('display_message', $this->gettext('reportedasjunk'), 'confirmation');
$rcmail->output->send();
}
示例3: mark_message
function mark_message()
{
$this->add_texts('localization');
$is_spam = rcube::get_instance()->action == 'plugin.markasjunk2.junk' ? true : false;
$multi_folder = $_POST['_multifolder'] == 'true' ? true : false;
$messageset = rcmail::get_uids();
$mbox_name = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST);
$dest_mbox = $is_spam ? $this->spam_mbox : $this->ham_mbox;
$result = $is_spam ? $this->_spam($messageset, $dest_mbox) : $this->_ham($messageset, $dest_mbox);
if ($result) {
if ($dest_mbox && ($mbox_name !== $dest_mbox || $multi_folder)) {
$this->api->output->command('rcmail_markasjunk2_move', $dest_mbox, $this->_messageset_to_uids($messageset, $multi_folder));
} else {
$this->api->output->command('command', 'list', $mbox_name);
}
$this->api->output->command('display_message', $is_spam ? $this->gettext('reportedasjunk') : $this->gettext('reportedasnotjunk'), 'confirmation');
}
$this->api->output->send();
}
示例4: managesieve_actions
/**
* Plugin action handler
*/
function managesieve_actions()
{
// handle fetching email headers for the new filter form
if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) {
$uids = rcmail::get_uids();
$mailbox = key($uids);
$message = new rcube_message($uids[$mailbox][0], $mailbox);
$headers = $this->parse_headers($message->headers);
$this->rc->output->set_env('sieve_headers', $headers);
$this->rc->output->command('managesieve_create', true);
$this->rc->output->send();
}
// handle other actions
$engine_type = $this->rc->action == 'plugin.managesieve-vacation' ? 'vacation' : '';
$engine = $this->get_engine($engine_type);
$this->init_ui();
$engine->actions();
}
示例5: download_messages
/**
* Handler for message download action
*/
public function download_messages()
{
$rcmail = rcmail::get_instance();
if ($rcmail->config->get('zipdownload_selection') && !empty($_POST['_uid'])) {
$messageset = rcmail::get_uids();
if (sizeof($messageset)) {
$this->_download_messages($messageset);
}
}
}
示例6: add_rule
function add_rule()
{
$_SESSION['plugin.sieverules.rule'] = true;
$_SESSION['plugin.sieverules.messageset'] = serialize(rcmail::get_uids());
rcube::get_instance()->output->redirect(array('task' => 'settings', 'action' => 'plugin.sieverules'));
}
示例7: move_messages
/**
* Plugin action to move the submitted list of messages to the archive subfolders
* according to the user settings and their headers.
*/
function move_messages()
{
$this->add_texts('localization');
$rcmail = rcmail::get_instance();
$storage = $rcmail->get_storage();
$delimiter = $storage->get_hierarchy_delimiter();
$archive_folder = $rcmail->config->get('archive_mbox');
$archive_type = $rcmail->config->get('archive_type', '');
$current_mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST);
$result = array('reload' => false, 'update' => false, 'errors' => array());
$folders = array();
$uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
$search_request = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC);
if ($uids == '*') {
$index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order());
$messageset = array($current_mbox => $index->get());
} else {
$messageset = rcmail::get_uids();
}
foreach ($messageset as $mbox => $uids) {
$storage->set_folder($current_mbox = $mbox);
foreach ($uids as $uid) {
if (!$archive_folder || !($message = $rcmail->storage->get_message($uid))) {
continue;
}
$subfolder = null;
switch ($archive_type) {
case 'year':
$subfolder = $rcmail->format_date($message->timestamp, 'Y');
break;
case 'month':
$subfolder = $rcmail->format_date($message->timestamp, 'Y') . $delimiter . $rcmail->format_date($message->timestamp, 'm');
break;
case 'folder':
$subfolder = $current_mbox;
break;
case 'sender':
$from = $message->get('from');
if (preg_match('/[\\b<](.+@.+)[\\b>]/i', $from, $m)) {
$subfolder = $m[1];
} else {
$subfolder = $this->gettext('unkownsender');
}
// replace reserved characters in folder name
$repl = $delimiter == '-' ? '_' : '-';
$replacements[$delimiter] = $repl;
$replacements['.'] = $repl;
// some IMAP server do not allow . characters
$subfolder = strtr($subfolder, $replacements);
break;
default:
$subfolder = '';
break;
}
// compose full folder path
$folder = $archive_folder . ($subfolder ? $delimiter . $subfolder : '');
// create archive subfolder if it doesn't yet exist
// we'll create all folders in the path
if (!in_array($folder, $folders)) {
if (empty($list)) {
$list = $storage->list_folders('', $archive_folder . '*', 'mail', null, true);
}
$path = explode($delimiter, $folder);
for ($i = 0; $i < count($path); $i++) {
$_folder = implode($delimiter, array_slice($path, 0, $i + 1));
if (!in_array($_folder, $list)) {
if ($storage->create_folder($_folder, true)) {
$result['reload'] = true;
$list[] = $_folder;
}
}
}
$folders[] = $folder;
}
// move message to target folder
if ($storage->move_message(array($uid), $folder)) {
$result['update'] = true;
} else {
$result['errors'][] = $uid;
}
}
// end for
}
// send response
if ($result['errors']) {
$rcmail->output->show_message($this->gettext('archiveerror'), 'warning');
}
if ($result['reload']) {
$rcmail->output->show_message($this->gettext('archivedreload'), 'confirmation');
} else {
if ($result['update']) {
$rcmail->output->show_message($this->gettext('archived'), 'confirmation');
}
}
// refresh saved search set after moving some messages
if ($search_request && $rcmail->storage->get_search_set()) {
//.........這裏部分代碼省略.........
示例8: move_messages
/**
* Plugin action to move the submitted list of messages to the archive subfolders
* according to the user settings and their headers.
*/
function move_messages()
{
$rcmail = rcmail::get_instance();
// only process ajax requests
if (!$rcmail->output->ajax_call) {
return;
}
$this->add_texts('localization');
$storage = $rcmail->get_storage();
$delimiter = $storage->get_hierarchy_delimiter();
$read_on_move = (bool) $rcmail->config->get('read_on_archive');
$archive_type = $rcmail->config->get('archive_type', '');
$archive_folder = $rcmail->config->get('archive_mbox');
$archive_prefix = $archive_folder . $delimiter;
$current_mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST);
$search_request = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC);
$uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
// count messages before changing anything
if ($_POST['_from'] != 'show') {
$threading = (bool) $storage->get_threading();
$old_count = $storage->count(null, $threading ? 'THREADS' : 'ALL');
$old_pages = ceil($old_count / $storage->get_pagesize());
}
$count = 0;
// this way response handler for 'move' action will be executed
$rcmail->action = 'move';
$this->result = array('reload' => false, 'error' => false, 'sources' => array(), 'destinations' => array());
foreach (rcmail::get_uids(null, null, $multifolder) as $mbox => $uids) {
if (!$archive_folder || strpos($mbox, $archive_prefix) === 0) {
$count = count($uids);
continue;
} else {
if (!$archive_type || $archive_type == 'folder') {
$folder = $archive_folder;
if ($archive_type == 'folder') {
// compose full folder path
$folder .= $delimiter . $mbox;
// create archive subfolder if it doesn't yet exist
$this->subfolder_worker($folder);
}
$count += $this->move_messages_worker($uids, $mbox, $folder, $read_on_move);
} else {
if ($uids == '*') {
$index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order());
$uids = $index->get();
}
$messages = $storage->fetch_headers($mbox, $uids);
$execute = array();
foreach ($messages as $message) {
$subfolder = null;
switch ($archive_type) {
case 'year':
$subfolder = $rcmail->format_date($message->timestamp, 'Y');
break;
case 'month':
$subfolder = $rcmail->format_date($message->timestamp, 'Y') . $delimiter . $rcmail->format_date($message->timestamp, 'm');
break;
case 'sender':
$from = $message->get('from');
preg_match('/[\\b<](.+@.+)[\\b>]/i', $from, $m);
$subfolder = $m[1] ?: $this->gettext('unkownsender');
// replace reserved characters in folder name
$repl = $delimiter == '-' ? '_' : '-';
$replacements[$delimiter] = $repl;
$replacements['.'] = $repl;
// some IMAP server do not allow . characters
$subfolder = strtr($subfolder, $replacements);
break;
}
// compose full folder path
$folder = $archive_folder . ($subfolder ? $delimiter . $subfolder : '');
$execute[$folder][] = $message->uid;
}
foreach ($execute as $folder => $uids) {
// create archive subfolder if it doesn't yet exist
$this->subfolder_worker($folder);
$count += $this->move_messages_worker($uids, $mbox, $folder, $read_on_move);
}
}
}
}
if ($this->result['error']) {
if ($_POST['_from'] != 'show') {
$rcmail->output->command('list_mailbox');
}
$rcmail->output->show_message($this->gettext('archiveerror'), 'warning');
$rcmail->output->send();
}
if (!empty($_POST['_refresh'])) {
// FIXME: send updated message rows instead of reloading the entire list
$rcmail->output->command('refresh_list');
} else {
$addrows = true;
}
// refresh saved search set after moving some messages
if ($search_request && $rcmail->storage->get_search_set()) {
//.........這裏部分代碼省略.........