This file is indexed.

/usr/share/horde/ingo/lib/Script/Customsql.php is in php-horde-ingo 3.2.13-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
<?php
/**
 * Copyright 2013-2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (ASL).  If you
 * did not receive this file, see http://www.horde.org/licenses/apache.
 *
 * @author   Jan Schneider <jan@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/apache ASL
 * @package  Ingo
 */

/**
 * The Ingo_Script_Customsql class generates SQL scripts out of custom SQL
 * queries.
 *
 * @author   Jan Schneider <jan@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/apache ASL
 * @package  Ingo
 */
class Ingo_Script_Customsql extends Ingo_Script_Base
{
    /**
     * A list of driver features.
     *
     * @var array
     */
    protected $_features = array(
        /* Can tests be case sensitive? */
        'case_sensitive' => false,
        /* Does the driver support setting IMAP flags? */
        'imap_flags' => false,
        /* Does the driver support the stop-script option? */
        'stop_script' => false,
        /* Can this driver perform on demand filtering? */
        'on_demand' => false,
        /* Does the driver require a script file to be generated? */
        'script_file' => true,
    );

    /**
     * The categories of filtering allowed.
     *
     * @var array
     */
    protected $_categories = array(
        Ingo_Storage::ACTION_VACATION,
    );

    /**
     * Which form fields are supported in each category by this driver?
     *
     * This is an associative array with the keys taken from $_actions, each
     * value is a list of strings with the supported feature names.  An absent
     * key is interpreted as "all features supported".
     *
     * @var array
     */
    protected $_categoryFeatures = array(
        Ingo_Storage::ACTION_VACATION => array(
            'subject', 'reason'
        )
    );

    /**
     * Generates the scripts to do the filtering specified in the rules.
     */
    protected function _generate()
    {
        $filters = $this->_params['storage']
             ->retrieve(Ingo_Storage::ACTION_FILTERS);
        foreach ($filters->getFilterList($this->_params['skip']) as $filter) {
            switch ($filter['action']) {
            case Ingo_Storage::ACTION_VACATION:
                $this->_addItem(
                    Ingo::RULE_VACATION,
                    new Ingo_Script_String(
                        $this->_placeHolders($this->_params['vacation_unset'],
                                             Ingo::RULE_VACATION)
                    )
                );
                if (!empty($filter['disable'])) {
                    break;
                }
                $this->_addItem(
                    Ingo::RULE_VACATION,
                    new Ingo_Script_String(
                        $this->_placeHolders($this->_params['vacation_set'],
                                             Ingo::RULE_VACATION)
                    )
                );
                break;
            }
        }
    }

    /**
     * Replaces place holders in a query.
     *
     * @param string $query  A SQL query with place holders.
     * @param integer $rule  A Ingo::RULE_* constant.
     *
     * @return string  A valid query.
     */
    protected function _placeHolders($query, $rule)
    {
        $transport = $GLOBALS['injector']
            ->getInstance('Ingo_Factory_Transport')
            ->create(
                isset($this->_params['transport'][$rule])
                    ? $this->_params['transport'][$rule]
                    : $this->_params['transport'][Ingo::RULE_ALL]
            );

        $search = array('%u', '%d');
        $replace = array(
            $transport->quote(Ingo::getUser()),
            $transport->quote(Ingo::getDomain())
        );

        switch ($rule) {
        case Ingo::RULE_VACATION:
            $vacation = $this->_params['storage']
              ->retrieve(Ingo_Storage::ACTION_VACATION);
            $search[] = '%m';
            $search[] = '%s';
            $replace[] = $transport->quote($vacation->getVacationReason());
            $replace[] = $transport->quote($vacation->getVacationSubject());
            break;
        }

        return str_replace($search, $replace, $query);
    }
}