This file is indexed.

/usr/share/php/Horde/View/Helper/Block.php is in php-horde-view 2.0.6-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
 * Copyright 2006-2016 Horde LLC (http://www.horde.org/)
 *
 * @author     Chuck Hagenbuch <chuck@horde.org>
 * @category   Horde
 * @package    View
 * @subpackage Helper
 */

/**
 * View helper for displaying Horde block objects.
 *
 * @author     Chuck Hagenbuch <chuck@horde.org>
 * @category   Horde
 * @package    View
 * @subpackage Helper
 */
class Horde_View_Helper_Block extends Horde_View_Helper_Base
{
    /**
     * Blocks that have already been fetched.
     *
     * @var array
     */
    protected $_blockCache = array();

    /**
     * Returns the title of the specified block.
     *
     * @param string $block  The name of the block to get the title for.
     * @param mixed $arg1    The first argument to the Block constructor.
     *
     * @return string  The requested Block's title.
     * @throws Horde_View_Exception
     * @throws InvalidArgumentException
     */
    public function blockTitle()
    {
        list($block, $params) = $this->_args(func_get_args());
        return $this->_block($block, $params)->getTitle();
    }

    /**
     * Returns the content of the specified block.
     *
     * @param string $block  The name of the block to get the content for.
     * @param mixed $arg1    The first argument to the Block constructor.
     *
     * @return string  The requested Block's content.
     * @throws Horde_View_Exception
     * @throws InvalidArgumentException
     */
    public function blockContent()
    {
        list($block, $params) = $this->_args(func_get_args());
        return $this->_block($block, $params)->getContent();
    }

    /**
     * Instantiates and caches Block objects.
     *
     * @param string $block  The name of the block to fetch.
     * @param array $params  Any arguments to the Block constructor.
     *
     * @return Horde_Core_Block  The requested Block object.
     * @throws Horde_View_Exception
     */
    protected function _block($block, $params)
    {
        $hash = sha1(serialize(array($block, $params)));

        if (!isset($this->_blockCache[$hash])) {
            try {
                $this->_blockCache[$hash] = $GLOBALS['injector']
                    ->getInstance('Horde_Core_Factory_BlockCollection')
                    ->create()
                    ->getBlock($block, $params);
            } catch (Exception $e) {
                throw new Horde_View_Exception($e);
            }
        }

        return $this->_blockCache[$hash];
    }

    /**
     * Parses any argument style for the Block-fetching functions.
     *
     * @param array $args
     */
    protected function _args($args)
    {
        $argc = count($args);

        if ($argc == 1) {
            if (is_array($args[0])) {
                $args = $args[0];
                $argc = count($args);
            }
        }

        if ($argc < 2) {
            throw new InvalidArgumentException('You must provide at least an application name and a block name.');
        }
        $app = array_shift($args);
        $block = array_shift($args);

        return array($app, $block, $args);
    }
}