This file is indexed.

/usr/share/horde/gollem/selectlist.php is in php-horde-gollem 3.0.7-1build1.

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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
/**
 * Selectlist handler.
 *
 * Copyright 2004-2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author   Michael Slusarz <slusarz@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/gpl GPL
 * @package  Gollem
 */

require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('gollem', array(
    'authentication' => 'selectlist'
));

$vars = Horde_Variables::getDefaultVariables();

/* Set directory. */
try {
    Gollem::changeDir();
} catch (Gollem_Exception $e) {
    $notification->push($e);
}

/* Create a new cache ID if one does not already exist. */
$cacheid = $vars->get('cacheid', strval(new Horde_Support_Randomid()));

$selectlist = $session->get('gollem', 'selectlist/' . $cacheid, Horde_Session::TYPE_ARRAY);

/* Run through the action handlers. */
switch ($vars->actionID) {
case 'select':
    if (is_array($vars->items) && count($vars->items)) {
        foreach ($vars->items as $item) {
            $item_value = Gollem::$backend['dir'] . '|' . $item;
            if (empty($selectlist['files'])) {
                $selectlist['files'] = array($item_value);
            } else {
                $item_key = array_search($item_value, $selectlist['files']);
                if ($item_key !== false) {
                    unset($selectlist['files'][$item_key]);
                    sort($selectlist['files']);
                } else {
                    $selectlist['files'][] = $item_value;
                }
            }
        }

        $session->set('gollem', 'selectlist/' . $cacheid, $selectlist);

        $filelist = array_keys(array_flip($selectlist['files']));
    }
    break;
}

try {
    $info = array('list' => Gollem::listFolder(Gollem::$backend['dir']));
} catch (Gollem_Exception $e) {
    /* If that didn't work, fall back to the parent or the home directory. */
    $notification->push(sprintf(_("Permission denied to %s: %s"), Gollem::$backend['dir'], $e->getMessage()), 'horde.error');

    $loc = strrpos(Gollem::$backend['dir'], '/');
    Gollem::setDir(($loc !== false) ? substr(Gollem::$backend['dir'], 0, $loc) : Gollem::$backend['home']);
    $info = array('list' => Gollem::listFolder(Gollem::$backend['dir']));
}

$info['title'] = htmlspecialchars(Gollem::$backend['label']);

/* Commonly used URLs. */
$self_url = Horde::url('selectlist.php');

/* Set up the template object. */
$view = $injector->createInstance('Horde_View');
$view->self_url = $self_url;
$view->forminput = Horde_Util::formInput();
$view->cacheid = $cacheid;
$view->currdir = htmlspecialchars(Gollem::$backend['dir']);
$view->formid = htmlspecialchars($vars->formid);
$view->navlink = Gollem::directoryNavLink(Gollem::$backend['dir'], $self_url->copy()->add(array('cacheid' => $cacheid, 'formid' => $vars->formid)));
if ($GLOBALS['conf']['backend']['backend_list'] == 'shown') {
    // TODO
    //$view->changeserver = Horde::link(htmlspecialchars(Horde_Auth::addLogoutParameters(Horde::url('login.php')->add(array('url' => Horde::url('selectlist.php')->add(array('formid' => $vars->formid)))), Horde_Auth::REASON_LOGOUT)), _("Change Server")) . Horde::img('logout.png', _("Change Server")) . '</a>', true;
}

if (is_array($info['list']) &&
    count($info['list']) &&
    Gollem::checkPermissions('backend', Horde_Perms::READ)) {

    $entry = $icon_cache = array();
    $rowct = 0;

    foreach ($info['list'] as $key => $val) {
        $item = array(
          'dir' => false,
          'name' => htmlspecialchars($val['name']),
          'selected' => false,
          'type' => $val['type']
        );

        $name = str_replace(' ', '&nbsp;', $item['name']);

        /* Determine graphic to use. */
        if (!empty($val['link'])) {
            $item['graphic'] = '<span class="iconImg gollem-symlink"></span>';
        } elseif ($val['type'] == '**dir') {
            $item['graphic'] = '<span class="iconImg gollem-folder"></span>';
        } else {
            if (empty($icon_cache[$val['type']])) {
                $icon_cache[$val['type']] = Horde::img($injector->getInstance('Horde_Core_Factory_MimeViewer')->getIcon($val['type']));
            }
            $item['graphic'] = $icon_cache[$val['type']];
        }

        /* Create proper link. */
        switch ($val['type']) {
        case '**dir':
            $url = $self_url->copy()->add(array(
                'cacheid' => $cacheid,
                'dir' => Gollem::subdirectory(Gollem::$backend['dir'], $val['name']),
                'formid' => $vars->formid
            ));
            $item['link'] = $url->link() . '<strong>' . $name . '</strong></a>';
            $item['dir'] = true;
            break;

        case '**sym':
            if ($val['linktype'] === '**dir') {
                if (substr($val['link'], 0, 1) == '/') {
                    $parts = explode('/', $val['link']);
                    $name = array_pop($parts);
                    $dir = implode('/', $parts);
                } else {
                    $name = $val['link'];
                    $dir = Gollem::$backend['dir'];
                }

                $url = $self_url->copy()->add(array(
                    'cacheid' => $cacheid,
                    'dir' => Gollem::subdirectory(Gollem::$backend['dir'], $val['name']),
                    'formid' => $vars->formid
                ));
                $item['link'] = $item['name'] . ' -> <strong>' . $url->link() . $val['link'] . '</a></strong>';
            } else {
                $item['link'] = $item['name'] . ' -> ' . $val['link'];
            }
            break;

        default:
            $item['link'] = $name;
            break;
        }

        if (!empty($selectlist['files']) &&
            in_array(Gollem::$backend['dir'] . '|' . $val['name'], $selectlist['files'])) {
            $item['selected'] = true;
        }

        $item['item'] = (++$rowct % 2) ? 'rowEven' : 'rowOdd';

        $entry[] = $item;
    }

    $view->entries = $entry;
}

$page_output->addScriptFile('selectlist.js');
$page_output->addInlineJsVars(array(
    'var GollemText' => array(
        'opener_window' => _("The original opener window has been closed. Exiting."),
    ),
));
$page_output->topbar = $page_output->sidebar = false;

$page_output->header(array(
    'title' => $info['title']
));
$notification->notify(array('listeners' => 'status'));
echo $view->render('selectlist');
$page_output->footer();