File: Security.php

package info (click to toggle)
php-horde-mime-viewer 2.2.4%2Bdebian0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 2,316 kB
  • sloc: javascript: 5,595; php: 1,648; xml: 1,006; makefile: 7
file content (53 lines) | stat: -rw-r--r-- 1,865 bytes parent folder | download | duplicates (3)
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
<?php
/**
 * The Horde_Mime_Viewer_Security class is a wrapper used to load the
 * appropriate Horde_Mime_Viewer for secure multipart messages (defined by RFC
 * 1847). This class handles multipart/signed and multipart/encrypted data.
 *
 * Copyright 2002-2017 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 *
 * @author   Michael Slusarz <slusarz@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package  Mime_Viewer
 */
class Horde_Mime_Viewer_Security extends Horde_Mime_Viewer_Base
{
    /**
     * Constructor.
     *
     * @param Horde_Mime_Part $mime_part  The object with the data to be
     *                                    rendered.
     * @param array $conf                 Configuration:
     * <pre>
     * 'viewer_callback' - (callback) A callback to a factory that will
     *                     return the appropriate viewer for the embedded
     *                     MIME type. Is passed three parameters: the
     *                     current driver object, the MIME part object, and
     *                     the MIME type to use.
     * </pre>
     */
    public function __construct(Horde_Mime_Part $part, array $conf = array())
    {
        parent::__construct($part, $conf);
    }

    /**
     * Return the underlying MIME Viewer for this part.
     *
     * @return mixed  A Horde_Mime_Viewer object, or false if not found.
     */
    protected function _getViewer()
    {
        if (($callback = $this->getConfigParam('viewer_callback')) &&
            ($protocol = $this->_mimepart->getContentTypeParameter('protocol'))) {
            return call_user_func($callback, $this, $this->_mimepart, $protocol);
        }

        return false;
    }

}