This file is indexed.

/usr/share/horde/ansel/lib/Widget/OtherGalleries.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
<?php
/**
 * Copyright 2008-2016 Horde LLC (http://www.horde.org/)
 *
 * @author Michael J. Rubinsky <mrubinsk@horde.org>
 * @package Ansel
 */
/**
 * Ansel_Widget_OtherGalleries:: class to display a widget containing mini
 * thumbnails and links to other galleries owned by the same user as the
 * currently viewed image/gallery.
 *
 * Copyright 2008-2016 Horde LLC (http://www.horde.org/)
 *
 * @author Michael J. Rubinsky <mrubinsk@horde.org>
 * @package Ansel
 */
class Ansel_Widget_OtherGalleries extends Ansel_Widget_Base
{
    /**
     * Override the parent class' attach method and set the owner in the
     * title string.
     *
     * @param Ansel_View_Base $view  The view we are attaching to
     */
    public function attach(Ansel_View_Base $view)
    {
        if (parent::attach($view)) {
            $owner = $this->_view->gallery->getIdentity();
            $name = $owner->getValue('fullname');
            if (!$name) {
                $name = $this->_view->gallery->get('owner');
            }
            $this->_title = sprintf(_("%s's Galleries"), $name);
        } else {
            return false;
        }

        return true;
    }

    /**
     * Build the HTML for this widget.
     *
     * @return string  The HTML representing this widget.
     */
    public function html()
    {
        $view = $GLOBALS['injector']->getInstance('Horde_View');
        $view->addTemplatePath(ANSEL_TEMPLATES . '/widgets');
        $view->title = $this->_title;
        $view->background = $this->_style->background;
        $view->toggle_url = Horde::selfUrl(true, true)
            ->add('actionID', 'show_othergalleries')
            ->link(array(
                'id' => 'othergalleries-toggle',
                'class' => ($GLOBALS['prefs']->getValue('show_othergalleries') ? 'hide' : 'show')
            )
        );
        $this->_getOtherGalleries($view);

        return $view->render('othergalleries');
    }

    /**
     * Build the HTML for the other galleries widget content.
     *
     * @param Horde_View $view  The view object.
     */
    protected function _getOtherGalleries(&$view)
    {
        $owner = $this->_view->gallery->get('owner');

        // Set up the tree
        $tree = $GLOBALS['injector']
            ->getInstance('Horde_Core_Factory_Tree')
            ->create('otherAnselGalleries_' . md5($owner), 'Javascript', array('class' => 'anselWidgets'));

        try {
            $galleries = $GLOBALS['injector']
                ->getInstance('Ansel_Storage')
                ->listGalleries(array('attributes' => $owner));
        } catch (Ansel_Exception $e) {
            Horde::log($e, 'ERR');
            return;
        }

        foreach ($galleries as $gallery) {
            $parents = $gallery->get('parents');
            if (empty($parents)) {
                $parent = null;
            } else {
                $parents = explode(':', $parents);
                $parent = array_pop($parents);
            }

            $img = (string)Ansel::getImageUrl(
                $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')),
                'mini',
                true);
            $link = Ansel::getUrlFor(
                'view',
                array('gallery' => $gallery->id,
                      'slug' => $gallery->get('slug'),
                      'view' => 'Gallery'),
                true);

            $tree->addNode(array(
                'id' => $gallery->id,
                'parent' => $parent,
                'label' => $gallery->get('name'),
                'expanded' => $gallery->id == $this->_view->gallery->id,
                'params' => array('icon' => $img, 'url' => $link)
            ));
        }

        Horde::startBuffer();
        $tree->sort('label');
        $tree->renderTree();
        $view->tree = Horde::endBuffer();

        $GLOBALS['injector']
            ->getInstance('Horde_Core_Factory_Imple')
            ->create(
                'Ansel_Ajax_Imple_ToggleOtherGalleries',
                array('id' => 'othergalleries-toggle'));

    }

}