1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
24: class IMP_Basic_Listinfo extends IMP_Basic_Base
25: {
26: 27:
28: protected function _init()
29: {
30: global $injector, $page_output;
31:
32:
33: try {
34: $imp_contents = $injector->getInstance('IMP_Factory_Contents')->create($this->indices);
35: } catch (IMP_Exception $e) {
36: throw new IMP_Exception(_("Could not load message."));
37: }
38:
39: $view = new Horde_View(array(
40: 'templatePath' => IMP_TEMPLATES . '/listinfo'
41: ));
42:
43: $listheaders = $injector->getInstance('Horde_ListHeaders');
44: $mime_headers = $imp_contents->getHeader();
45:
46: $view->headers = array();
47: foreach ($listheaders->headers() as $key => $val) {
48: if ($data = $mime_headers->getValue($key)) {
49: $view->headers[$val] = $this->_parseListHeaders($key, $data);
50: }
51: }
52:
53: $this->output = $view->render('listinfo');
54: $this->title = _("Mailing List Information");
55:
56: $page_output->addInlineScript(array(
57: 'window.resizeBy(0, window.document.body.scrollHeight - window.innerHeight + 20)'
58: ), true);
59:
60: $page_output->topbar = $page_output->sidebar = false;
61: }
62:
63: 64:
65: public function status()
66: {
67: }
68:
69: 70: 71: 72: 73: 74:
75: public static function url(array $opts = array())
76: {
77: $url = Horde::url('basic.php')
78: ->add('page', 'listinfo')
79: ->unique()
80: ->setRaw(!empty($opts['full']));
81:
82: if (!empty($opts['mailbox'])) {
83: $url->add(array(
84: 'buid' => $opts['buid'],
85: 'mailbox' => IMP_Mailbox::get($opts['mailbox'])->form_to
86: ));
87: }
88:
89: return $url;
90: }
91:
92: 93: 94: 95: 96: 97: 98: 99:
100: protected function ($id, $data)
101: {
102: global $injector;
103:
104: $parser = $injector->getInstance('Horde_ListHeaders');
105: $text_filter = $injector->getInstance('Horde_Core_Factory_TextFilter');
106:
107: foreach ($parser->parse($id, $data) as $val) {
108: 109:
110: if (stripos($val->url, 'mailto:') === 0) {
111: $url = substr($val->url, 7);
112: $clink = new IMP_Compose_Link($url);
113: $out = Horde::link($clink->link()) . $url . '</a>';
114: foreach ($val->comments as $val2) {
115: $out .= htmlspecialchars('(' . $val2 . ')');
116: }
117: return $out;
118: } elseif ($url = $text_filter->filter($val->url, 'Linkurls')) {
119: $out = $url;
120: foreach ($val->comments as $val2) {
121: $out .= htmlspecialchars('(' . $val2 . ')');
122: }
123: return $out;
124: }
125: }
126:
127: 128:
129: return Horde_Text_Filter_Linkurls::decode(htmlspecialchars(
130: $text_filter->filter($data, 'Linkurls', array('encode' => true))
131: ));
132: }
133:
134: }
135: