This file is indexed.

/usr/share/php/irods/prods/src/RODSGenQueConds.class.php is in php-irods-prods 3.3.0~beta1-2ubuntu1.

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
<?php
require_once("autoload.inc.php");
class RODSGenQueConds
{
    private $cond;
    private $cond_kw;

    /**
     * default constructor. It take names, ops, and vals.
     * suppose name='foo' op='>=' and val='0', then the triplex means
     * "foo >= 0" as one iRODS general query condition.
     * @param array (of string) $names names of the field, which must be one defined in file 'RodsGenQueryNum.inc.php'.
     * @param array (of string) $ops logical operator, such as '=' 'like' '>'
     * @param array (of string) $vals value of the filed
     */
    public function __construct(array $names = array(), array $ops = array(),
                                array $vals = array())
    {
        require_once("RodsGenQueryNum.inc.php"); //load magic numbers
        require_once("RodsGenQueryKeyWd.inc.php"); //load magic keywords

        $this->cond = array('names' => array(), 'sysnames' => array(), 'values' => array());
        $this->cond_kw = array('names' => array(), 'sysnames' => array(), 'values' => array());

        for ($i = 0; $i < count($names); $i++) {
            $name = $names[$i];
            $op = $ops[$i];
            $val = $vals[$i];
            if (isset($GLOBALS['PRODS_GENQUE_NUMS']["$name"])) {
                $this->cond['names'][] = $name;
                $this->cond['sysnames'][] = $GLOBALS['PRODS_GENQUE_NUMS']["$name"];
                $this->cond['values'][] = "$op '$val'";
            } else
                if (isset($GLOBALS['PRODS_GENQUE_KEYWD']["$name"])) {
                    $this->cond_kw['names'][] = $name;
                    $this->cond_kw['sysnames'][] = $GLOBALS['PRODS_GENQUE_KEYWD']["$name"];
                    $this->cond_kw['values'][] = "$op '$val'";
                } else {
                    throw new RODSException("General Query condition field name '$name' is not valid",
                        'PERR_USER_INPUT_ERROR');
                }
        }
    }

    /**
     * Add a single select field.
     * @param string $name names of the field, which must be one defined in file 'RodsGenQueryNum.inc.php'.
     * @param string $op logical operator, such as '=' 'like' '>'
     * @param string $val value of the filed
     * @param array  an array of tuples of extra op's and val's, each tuple is an assosive array that has key 'op' and 'val'. These conditions will be 'OR' with the other conditions.
     * for example add ('COL_D_DATA_ID','like', '/tempZone/home/rods/%', array(array('op'=>'=','val'=>'/tempZone/home/rods'")))
     * would select all file ids both in subdirectories under '/tempZone/home/rods' and directly under '/tempZone/home/rods'
     */
    public function add($name, $op, $val, array $OR_ops_vals = array())
    {
        require_once("RodsGenQueryNum.inc.php"); //load magic numbers
        require_once("RodsGenQueryKeyWd.inc.php"); //load magic keywords

        if (isset($GLOBALS['PRODS_GENQUE_NUMS']["$name"])) {
            $this->cond['names'][] = $name;
            $this->cond['sysnames'][] = $GLOBALS['PRODS_GENQUE_NUMS']["$name"];
            $value = "$op '$val'";
            foreach ($OR_ops_vals as $op_val) {
                $or_op = $op_val['op'];
                $or_val = $op_val['val'];
                if (empty($or_op) || empty($or_val))
                    continue;
                $value = $value . " || $or_op '$or_val'";
            }
            $this->cond['values'][] = $value;
        } else
            if (isset($GLOBALS['PRODS_GENQUE_KEYWD']["$name"])) {
                $this->cond_kw['names'][] = $name;
                $this->cond_kw['sysnames'][] = $GLOBALS['PRODS_GENQUE_KEYWD']["$name"];
                $value = "$op '$val'";
                foreach ($OR_ops_vals as $op_val) {
                    $or_op = $op_val['op'];
                    $or_val = $op_val['val'];
                    if (empty($or_op) || empty($or_val))
                        continue;
                    $value = $value . " || $or_op '$or_val'";
                }
                $this->cond_kw['values'][] = $value;
            } else {
                throw new RODSException("General Query condition field name '$name' is not valid",
                    'PERR_USER_INPUT_ERROR');
            }
    }

    /**
     * make a RP_InxValPair.
     */
    public function packetize()
    {
        return (new RP_InxValPair(count($this->cond['names']),
            $this->cond['sysnames'], $this->cond['values']));
    }

    /**
     * make a RP_KeyValPair.
     */
    public function packetizeKW()
    {
        return (new RP_KeyValPair(count($this->cond_kw['names']),
            $this->cond_kw['sysnames'], $this->cond_kw['values']));
    }

    public function getCond()
    {
        return $this->cond;
    }
}

?>