This file is indexed.

/usr/share/php/Horde/Controller/UrlWriter.php is in php-horde-controller 2.0.1-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
<?php
/**
 * URL generation utility for controllers
 *
 * @category Horde
 * @package  Controller
 * @author   Mike Naberezny <mike@maintainable.com>
 * @author   Derek DeVries <derek@maintainable.com>
 * @author   Chuck Hagenbuch <chuck@horde.org>
 * @license  http://www.horde.org/licenses/bsd BSD
 */
class Horde_Controller_UrlWriter
{
    /**
     * Defaults to merge into route parameters when not using named routes.
     * @var array
     */
    protected $_defaults;

    /**
     * @var Horde_Routes_Util
     */
    protected $_utils;

    /**
     * Class constructor
     *
     * @param  Horde_Routes_Utils  $utils     Route utilities
     * @param  array               $defaults  Defaults to merge for urlFor()
     */
    public function __construct(Horde_Routes_Utils $utils, $defaults = array())
    {
        $this->_utils = $utils;
        $this->_defaults = $defaults;
    }

    /**
     * Generate a URL.  Same signature as Horde_Routes_Utils->urlFor().
     *
     * @param  $first   mixed
     * @param  $second  mixed
     * @return string
     */
    public function urlFor($first, $second = array())
    {
        // anonymous route: serialize to params & merge defaults
        //   urlFor(array('controller' => 'books'))
        if (is_array($first)) {
            $first = array_merge($this->_defaults,
                                 $this->_serializeToParams($first));
        }

        // named route: serialize to params only (no merge)
        //   urlFor('notes', array('action' => 'show', 'id' => 1))
        if (is_array($second)) {
            $second = $this->_serializeToParams($second);
        }

        // url generation "route memory" is not useful here
        $this->_utils->mapperDict = array();

        // generate url
        return $this->_utils->urlFor($first, $second);
    }

    /**
     * Serialize any objects in the collection supporting toParam() before
     * passing the collection to Horde_Routes.
     *
     * @param  array  $collection
     * @param  array
     */
    protected function _serializeToParams($collection)
    {
        foreach ($collection as &$value) {
            if (is_object($value) && method_exists($value, 'toParam')) {
                $value = $value->toParam();
            }
        }
        return $collection;
    }
}