commit | author | age
|
48e9c1
|
1 |
<?php |
T |
2 |
|
|
3 |
/** |
|
4 |
* Mark as Junk |
|
5 |
* |
|
6 |
* Sample plugin that adds a new button to the mailbox toolbar |
|
7 |
* to mark the selected messages as Junk and move them to the Junk folder |
|
8 |
* |
|
9 |
* @version @package_version@ |
|
10 |
* @license GNU GPLv3+ |
|
11 |
* @author Thomas Bruederli |
|
12 |
*/ |
|
13 |
class markasjunk extends rcube_plugin |
|
14 |
{ |
|
15 |
public $task = 'mail'; |
|
16 |
|
|
17 |
function init() |
|
18 |
{ |
|
19 |
$rcmail = rcmail::get_instance(); |
|
20 |
|
|
21 |
$this->register_action('plugin.markasjunk', array($this, 'request_action')); |
|
22 |
|
|
23 |
if ($rcmail->action == '' || $rcmail->action == 'show') { |
|
24 |
$skin_path = $this->local_skin_path(); |
|
25 |
$this->include_script('markasjunk.js'); |
|
26 |
if (is_file($this->home . "/$skin_path/markasjunk.css")) |
|
27 |
$this->include_stylesheet("$skin_path/markasjunk.css"); |
|
28 |
$this->add_texts('localization', true); |
|
29 |
|
|
30 |
$this->add_button(array( |
|
31 |
'type' => 'link', |
|
32 |
'label' => 'buttontext', |
|
33 |
'command' => 'plugin.markasjunk', |
|
34 |
'class' => 'button buttonPas junk disabled', |
|
35 |
'classact' => 'button junk', |
|
36 |
'title' => 'buttontitle', |
|
37 |
'domain' => 'markasjunk'), 'toolbar'); |
|
38 |
} |
|
39 |
} |
|
40 |
|
|
41 |
function request_action() |
|
42 |
{ |
|
43 |
$this->add_texts('localization'); |
|
44 |
|
|
45 |
$GLOBALS['IMAP_FLAGS']['JUNK'] = 'Junk'; |
|
46 |
$GLOBALS['IMAP_FLAGS']['NONJUNK'] = 'NonJunk'; |
|
47 |
|
|
48 |
$uids = get_input_value('_uid', RCUBE_INPUT_POST); |
|
49 |
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST); |
|
50 |
|
|
51 |
$rcmail = rcmail::get_instance(); |
|
52 |
$rcmail->storage->unset_flag($uids, 'NONJUNK'); |
|
53 |
$rcmail->storage->set_flag($uids, 'JUNK'); |
|
54 |
|
|
55 |
if (($junk_mbox = $rcmail->config->get('junk_mbox')) && $mbox != $junk_mbox) { |
|
56 |
$rcmail->output->command('move_messages', $junk_mbox); |
|
57 |
} |
|
58 |
|
|
59 |
$rcmail->output->command('display_message', $this->gettext('reportedasjunk'), 'confirmation'); |
|
60 |
$rcmail->output->send(); |
|
61 |
} |
|
62 |
|
|
63 |
} |