/usr/share/horde/whups/lib/Form/Query/PropertyCriterion.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 | <?php
/**
* 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/bsd.
*
* @author Jan Schneider <jan@horde.org>
* @author Robert E. Coyle <robertecoyle@hotmail.com>
* @category Horde
* @license http://www.horde.org/licenses/bsd BSD
* @package Whups
*/
/**
* Form to add or edit property criteria.
*
* @author Jan Schneider <jan@horde.org>
* @author Robert E. Coyle <robertecoyle@hotmail.com>
* @category Horde
* @copyright 2001-2002 Robert E. Coyle
* @copyright 2001-2016 Horde LLC
* @license http://www.horde.org/licenses/bsd BSD
* @package Whups
*/
class Whups_Form_Query_PropertyCriterion extends Horde_Form
{
public function __construct($vars)
{
global $whups_driver;
parent::__construct(
$vars,
$vars->get('edit') ? _("Edit Property Criterion") : _("Add Property Criterion"),
'Whups_Form_Query_PropertyCriterion');
$this->addHidden('', 'edit', 'boolean', false);
$this->addVariable(_("Id"), 'id', 'intlist', false);
/* Types. */
$this->addVariable(
_("Type"), 'ttype', 'enum', false, false, null,
array($whups_driver->getAllTypes(), _("Any")));
/* Queues. */
$queues = Whups::permissionsFilter(
$whups_driver->getQueues(), 'queue', Horde_Perms::READ);
if (count($queues)) {
$v = $this->addVariable(
_("Queue"), 'queue', 'enum', false, false, null,
array($queues, _("Any")));
$v->setAction(Horde_Form_Action::factory('reload'));
if ($vars->get('queue')) {
$this->addVariable(
_("Version"), 'version', 'enum', false, false, null,
array($whups_driver->getVersions($vars->get('queue')), _("Any")));
}
}
/* States. */
$states = $whups_driver->getStates();
$this->addVariable(
_("State"), 'state', 'enum', false, false, null,
array($states, _("Any")));
/* Priorities. */
$priorities = $whups_driver->getPriorities();
$this->addVariable(
_("Priority"), 'priority', 'enum', false, false, null,
array($priorities, _("Any")));
}
public function execute($vars)
{
$path = $vars->get('path');
$id = $vars->get('id');
if (strlen(trim($id))) {
$newpath = $path;
$ids = split("[\\t\\n ,]+", $id);
if (count($ids) > 1) {
$newpath = $GLOBALS['whups_query']->insertBranch(
$path, Whups_Query::TYPE_OR);
}
foreach ($ids as $id) {
$GLOBALS['whups_query']->insertCriterion(
$newpath, Whups_Query::CRITERION_ID, null,
Whups_Query::OPERATOR_EQUAL, $id);
}
}
$queue = $vars->get('queue');
if ($queue) {
$version = $vars->get('version');
if ($version) {
$path = $GLOBALS['whups_query']->insertBranch(
$path, Whups_Query::TYPE_AND);
}
$GLOBALS['whups_query']->insertCriterion(
$path, Whups_Query::CRITERION_QUEUE, null,
Whups_Query::OPERATOR_EQUAL, $queue);
if ($version) {
$GLOBALS['whups_query']->insertCriterion(
$path, Whups_Query::CRITERION_VERSION, null,
Whups_Query::OPERATOR_EQUAL, $version);
}
}
$type = $vars->get('ttype');
if ($type) {
$GLOBALS['whups_query']->insertCriterion(
$path, Whups_Query::CRITERION_TYPE, null,
Whups_Query::OPERATOR_EQUAL, $type);
}
$state = $vars->get('state');
if ($state) {
$GLOBALS['whups_query']->insertCriterion(
$path, Whups_Query::CRITERION_STATE, null,
Whups_Query::OPERATOR_EQUAL, $state);
}
$priority = $vars->get('priority');
if ($priority) {
$GLOBALS['whups_query']->insertCriterion(
$path, Whups_Query::CRITERION_PRIORITY, null,
Whups_Query::OPERATOR_EQUAL, $priority);
}
$this->unsetVars($vars);
}
}
|