/usr/share/horde/whups/lib/Block/Queuecontents.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 | <?php
/**
* Show the open tickets in a queue.
*/
class Whups_Block_Queuecontents extends Whups_Block_Tickets
{
/**
* Is this block enabled?
*
* @var boolean
*/
public $enabled = true;
/**
*/
public function __construct($app, $params = array())
{
parent::__construct($app, $params);
$this->_name = _("Queue Contents");
}
/**
*/
protected function _params()
{
$qParams = array();
$qDefault = null;
$qParams = Whups::permissionsFilter(
$GLOBALS['whups_driver']->getQueues(),
'queue',
Horde_Perms::READ);
if (!$qParams) {
$qDefault = _("No queues available.");
$qType = 'error';
} else {
$qType = 'enum';
}
return array_merge(array(
'queue' => array(
'type' => $qType,
'name' => _("Queue"),
'default' => $qDefault,
'values' => $qParams,
)),
parent::_params()
);
}
/**
*/
protected function _title()
{
if ($queue = $this->_getQueue()) {
return sprintf(_("Open Tickets in %s"), htmlspecialchars($queue['name']));
}
return $this->getName();
}
/**
*/
protected function _content()
{
if (!($queue = $this->_getQueue())) {
return '<p class="horde-content"><em>' . _("No tickets in queue.") . '</em></p>';
}
$info = array('queue' => $this->_params['queue'],
'nores' => true);
$tickets = $GLOBALS['whups_driver']->getTicketsByProperties($info);
if (!$tickets) {
return '<p class="horde-content"><em>' . _("No tickets in queue.") . '</em></p>';
}
return $this->_table($tickets, 'whups_block_queue_' . $this->_params['queue']);
}
/**
*/
private function _getQueue()
{
if (empty($this->_params['queue'])) {
return false;
}
if (!Whups::permissionsFilter(array($this->_params['queue'] => true), 'queue', Horde_Perms::READ)) {
return false;
}
try {
return $GLOBALS['whups_driver']->getQueue($this->_params['queue']);
} catch (Whups_Exception $e) {
return false;
}
}
}
|