This file is indexed.

/usr/share/horde/ansel/lib/View/Gallery.php is in php-horde-ansel 3.0.5+debian0-1.

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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
/**
 *
 * @copyright 2003-2016 Horde LLC (http://www.horde.org)
 * @author Chuck Hagenbuch <chuck@horde.org>
 * @author Michael J Rubinsky <mrubinsk@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/gpl GPL
 * @package  Ansel
 */
/**
 * The Ansel_View_Gallery:: class wraps display of individual images.
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @copyright 2003-2016 Horde LLC (http://www.horde.org)
 * @author  Chuck Hagenbuch <chuck@horde.org>
 * @author Michael J Rubinsky <mrubinsk@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/gpl GPL
 * @package  Ansel
 */
class Ansel_View_Gallery extends Ansel_View_Ansel
{
    /**
     *  Holds the object that does the actual rendering.
     *
     *  @var Ansel_View_GalleryRenderer
     */
    protected $_renderer;

    /**
     * Const'r
     *
     * @see Ansel_View_Base::__construct
     */
    public function __construct(array $params = array())
    {
        parent::__construct($params);

        if (!empty($params['gallery_slug'])) {
            $this->gallery = $this->_getGallery(null, $params['gallery_slug']);
        } elseif (!empty($params['gallery_id'])) {
            $this->gallery = $this->_getGallery($params['gallery_id']);
        } else {
            $this->gallery = $this->_getGallery();
        }

        // Check user age
        if (!$this->gallery->isOldEnough()) {
            if (!empty($params['api'])) {
                throw new Ansel_Exception('Locked galleries are not viewable via the api.');
            }
            $date = Ansel::getDateParameter(
                array('year' => isset($this->_params['year']) ? $this->_params['year'] : 0,
                      'month' => isset($this->_params['month']) ? $this->_params['month'] : 0,
                      'day' => isset($this->_params['day']) ? $this->_params['day'] : 0));

            $galleryurl = Ansel::getUrlFor(
                'view',
                array_merge(
                    array(
                        'gallery' => $this->gallery->id,
                        'slug' => empty($params['slug']) ? '' : $params['slug'],
                        'page' => empty($params['page']) ? 0 : $params['page'],
                        'view' => 'Gallery'),
                    $date),
                true);

            $params = array('gallery' => $this->gallery->id, 'url' => $galleryurl);
            Horde::url('disclamer.php')->add($params)->setRaw(true)->redirect();
            exit;
        }

        if ($this->gallery->hasPasswd()) {
            if (!empty($params['api'])) {
                throw new Ansel_Exception(_("Locked galleries are not viewable via the api."));
            }
            $date = Ansel::getDateParameter(
                array('year' => isset($this->_params['year']) ? $this->_params['year'] : 0,
                      'month' => isset($this->_params['month']) ? $this->_params['month'] : 0,
                      'day' => isset($this->_params['day']) ? $this->_params['day'] : 0));

                $galleryurl = Ansel::getUrlFor(
                    'view',
                    array_merge(
                        array(
                            'gallery' => $this->gallery->id,
                            'slug' => empty($params['slug']) ? '' : $params['slug'],
                            'page' => empty($params['page']) ? 0 : $params['page'],
                            'view' => 'Gallery'),
                        $date),
                    true);
            $params = array('gallery' => $this->gallery->id, 'url' => $galleryurl);
            Horde::url('protect.php')->add($params)->setRaw(true)->redirect();
            exit;
        }

        if (!$this->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
            throw new Horde_Exception_PermissionDenied();
        }

        // Since this is a gallery view, the resource is the gallery.
        $this->resource = $this->gallery;

        // Do we have an explicit style set? If not, use the gallery's
        if (!empty($this->_params['style'])) {
            $style = Ansel::getStyleDefinition($this->_params['style']);
        } else {
            $style = $this->gallery->getStyle();
        }
        if (!empty($this->_params['gallery_view'])) {
            $renderer = $this->_params['gallery_view'];
        } else {
            $renderer = (!empty($style->gallery_view)) ? $style->gallery_view : 'Gallery';
        }

        // Load the helper
        $classname = 'Ansel_View_GalleryRenderer_' . basename($renderer);
        $this->_renderer = new $classname($this);
        $this->_renderer->init();
    }

    public function getGalleryCrumbData()
    {
        return $this->gallery->getGalleryCrumbData();
    }

    /**
     * Get this gallery's title.
     *
     * @return string  The gallery's title.
     */
    public function getTitle()
    {
        return $this->gallery->get('name');
    }

    /**
     * Return the HTML representing this view.
     *
     * @return string  The HTML.
     *
     */
    public function html()
    {
        return $this->_renderer->html();
    }

    public function viewType()
    {
        return 'Gallery';
    }
}