This file is indexed.

/usr/share/horde/whups/lib/Form/Renderer/Query.php is in php-horde-whups 3.0.9-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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<?php
/**
 * A Horde_Form_Renderer for rendering Whups queries.
 *
 * Copyright 2001-2002 Robert E. Coyle <robertecoyle@hotmail.com>
 * Copyright 2001-2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (BSD). If you
 * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
 *
 * @package Whups
 */

/*class Horde_Form_Renderer_QuerySetCurrentType extends Horde_Form_Renderer {

    function _renderForm(&$form, &$vars, $isActive)
    {
        global $whups_driver;

        $droptext = Horde_Core_Ui_VarRenderer_html::selectOptions($whups_driver->getAllTypes());
        include WHUPS_TEMPLATES . '/renderer/querysetcurrenttype.inc';
    }

    function submit()
    {
        // noop
    }
}*/

class Whups_Form_Renderer_Query extends Horde_Form_Renderer
{
    public $ticketTypes = null;

    public $attributes = null;

    function __construct()
    {
        $this->ticketTypes = $GLOBALS['whups_driver']->getAllTypes();
        $this->attributes = $GLOBALS['whups_driver']->getAllAttributes();
    }

    protected function _renderBegin()
    {
        echo '<table class="item">';
    }

    /**
     * @TODO: this is public because the parent:: method is public
     */
    public function _renderForm(&$query, &$vars, $active)
    {
        $this->currentRow = 1;
        $this->isActive = $active;
        $this->currentPath = $vars->get('path');

        $this->_renderBegin();
        $query->walk($this, '_renderRow');
        $this->_renderEnd();
    }

    public function edit(&$operations, $formname, $id)
    {
        include WHUPS_TEMPLATES . '/renderer/query/edit.inc';
    }

    /**
     * @TODO: This must be public, but method name has underscore.
     */
    public function _renderRow(&$more, &$path, $type, $criterion, $cvalue, $operator, $value)
    {
        global $whups_driver, $registry;

        $this->currentRow++;

        $pathstring = Whups_Query::pathToString($path);

        $depth = count($path);
        $class = "item" . ($this->currentRow % 2);

        switch ($type) {
        case Whups_Query::TYPE_AND: $text = _("And"); break;
        case Whups_Query::TYPE_OR:  $text = _("Or");  break;
        case Whups_Query::TYPE_NOT: $text = _("Not"); break;
        case Whups_Query::TYPE_CRITERION:

            switch ($criterion) {
            case Whups_Query::CRITERION_ID:             $text = _("Id"); break;
            case Whups_Query::CRITERION_OWNERS:         $text = _("Owners"); break;
            case Whups_Query::CRITERION_GROUPS:         $text = _("Groups"); break;
            case Whups_Query::CRITERION_REQUESTER:      $text = _("Requester"); break;
            case Whups_Query::CRITERION_ADDED_COMMENT:  $text = _("Commentor"); break;
            case Whups_Query::CRITERION_COMMENT:        $text = _("Comment"); break;
            case Whups_Query::CRITERION_SUMMARY:        $text = _("Summary"); break;

            case Whups_Query::CRITERION_QUEUE:
                $queue = $whups_driver->getQueue($value);
                if ($queue) {
                    $text = _("Queue");
                    $value = $queue['name'];
                }
                break;

            case Whups_Query::CRITERION_VERSION:
                $version = $whups_driver->getVersion($value);
                if ($version) {
                    $text = _("Version");
                    $value = $version['name'];
                }
                break;

            case Whups_Query::CRITERION_TYPE:
                $text = _("Type");
                $value = $whups_driver->getTypeName($value);
                break;

            case Whups_Query::CRITERION_STATE:
                // The value of the following depends on the type.
                $state = $whups_driver->getState($value);
                if ($state && isset($this->ticketTypes[$state['type']])) {
                    $text = '[' . $this->ticketTypes[$state['type']] . '] ' .
                        _("State");
                    $value = $state['name'];
                }
                break;

            case Whups_Query::CRITERION_PRIORITY:
                $state = $whups_driver->getPriority($value);
                $text = '[' . $this->ticketTypes[$state['type']] . '] ' .
                    _("Priority");
                $value = $state['name'];
                break;

            case Whups_Query::CRITERION_ATTRIBUTE:
                // The value of the following depends on the type.
                $aname = $whups_driver->getAttributeName($cvalue);
                foreach ($this->attributes as $attribute) {
                    if ($attribute['attribute_id'] == $cvalue) {
                        $type = $attribute['type_id'];
                        break;
                    }
                }
                if (isset($this->ticketTypes[$type])) {
                    $aname .= ' (' . $this->ticketTypes[$type] . ')';
                }
                $text = sprintf("Attribute \"%s\"", $aname);
                break;

            case Whups_Query::CRITERION_TIMESTAMP:
                $text = _("Created");
                $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                break;

            case Whups_Query::CRITERION_UPDATED:
                $text = _("Updated");
                $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                break;

            case Whups_Query::CRITERION_RESOLVED:
                $text = _("Resolved");
                $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                break;

            case Whups_Query::CRITERION_ASSIGNED:
                $text = _("Assigned");
                $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                break;

            case Whups_Query::CRITERION_DUE:
                $text = _("Due");
                $value = strftime($GLOBALS['prefs']->getValue('report_time_format'), $value);
                break;
            }

            if (!isset($text)) {
                $text = sprintf(_("Unknown node type %s"), $type);
                break;
            }

            $text .= ' ';

            switch ($operator) {
            case Whups_Query::OPERATOR_GREATER:
                $text .= _("is greater than");
                break;

            case Whups_Query::OPERATOR_LESS:
                $text .= _("is less than");
                break;

            case Whups_Query::OPERATOR_EQUAL:
                $text .= _("is");
                break;

            case Whups_Query::OPERATOR_CI_SUBSTRING:
                $text .= _("contains (case insensitive) substring");
                break;

            case Whups_Query::OPERATOR_CS_SUBSTRING:
                $text .= _("contains (case sensitive) substring");
                break;

            case Whups_Query::OPERATOR_WORD:
                $text .= _("contains the word");
                break;

            case Whups_Query::OPERATOR_PATTERN:
                $text .= _("matches the pattern");
                break;
            }

            $text .= " $value";
            break;

        default:
            $text = sprintf(_("Unknown node type %s"), $type);
            break;
        }

        // Stick vertical-align: middle; on everything to make it look a
        // little nicer.
        $fimgattrs = 'height="20" width="0" style="vertical-align: middle;"';
        $imgattrs = 'height="20" width="20" style="vertical-align: middle;"';

        $space = '';
        $count = count($more);

        if ($count == 0) {
            // Always have at least one image to make sure all rows are the
            // same height.
            $space = Horde::img('tree/blank.png', '', $fimgattrs) . "\n";
        } else {
            for ($i = 0; $i < $count - 1; $i++) {
                if ($more[$i] == 1) {
                    $space .= Horde::img('tree/line.png', '|', $imgattrs) . "\n";
                } else {
                    $space .= Horde::img('tree/blank.png', '', $imgattrs) . "\n";
                }
            }
        }

        if ($count > 0) {
            if ($more[$count - 1] == 1) {
                $space .= Horde::img('tree/join.png', '+', $imgattrs) . "\n";
            } else {
                $space .= Horde::img('tree/joinbottom.png', '-', $imgattrs) . "\n";
            }
        }

        $extra  = ($this->isActive ? '' : ' disabled="disabled"');
        $extra .= ($pathstring == $this->currentPath ? ' checked="checked"' : '');
        include WHUPS_TEMPLATES . '/renderer/query/render.inc';
    }

    /**
     * @TODO: This needs to stay public for now since Horde_Form_Renderer::
     *        has it as public.
     */
    public function _renderEnd()
    {
        echo '</table>';
    }

}