/
Maillog.php
71 lines (63 loc) · 1.92 KB
/
Maillog.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* Copyright 2015-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @category Horde
* @copyright 2015-2016 Horde LLC
* @license http://www.horde.org/licenses/gpl GPL
* @package IMP
*/
/**
* Maillog message ID lookup page for dynamic view.
*
* Expects two URL parameters:
* - msgid: Message-ID
* - type: Maillog type
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2015-2016 Horde LLC
* @license http://www.horde.org/licenses/gpl GPL
* @package IMP
*/
class IMP_Dynamic_Maillog extends IMP_Dynamic_Base
{
/**
* @throws IMP_Exception
*/
protected function _init()
{
global $page_output;
if (isset($this->vars->msgid) &&
isset($this->vars->type) &&
isset(IMP_Maillog_Storage_History::$drivers[$this->vars->type])) {
$log = new IMP_Maillog_Storage_History::$drivers[$this->vars->type](array(
'folder' => $this->vars->folder,
'msgid' => $this->vars->msgid
));
$query = $log->searchQuery();
foreach ($log->searchMailboxes() as $val) {
$indices = $val->runSearchQuery($query);
if (count($indices)) {
list($mbox, $uid) = $indices->getSingle();
$url = IMP_Dynamic_Message::url();
$url->add($mbox->urlParams($uid));
$url->redirect();
}
}
}
$page_output->addScriptFile('maillog.js');
$page_output->addInlineJsVars(array(
'ImpMaillog.error_msg' => _("Could not load message.")
));
}
/**
*/
public static function url(array $opts = array())
{
return Horde::url('dynamic.php')->add('page', 'maillog');
}
}