/usr/share/horde/ansel/lib/Report.php is in php-horde-ansel 3.0.5+debian0-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 | <?php
/**
* Reporting abstraction class
*
* Copyright 2008-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* Copyright 2008-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Duck <duck@obala.net>
* @package Ansel
*/
class Ansel_Report {
var $_title = '';
/**
* Create instance
*/
function factory($driver = null, $params = array())
{
if ($driver === null) {
$driver = $GLOBALS['conf']['report_content']['driver'];
}
if (empty($params)) {
$params = $GLOBALS['conf']['report_content'];
}
$class_name = 'Ansel_Report_' . $driver;
if (!class_exists($class_name)) {
return PEAR::RaiseError(_("Report driver does not exist."));
}
$report = new $class_name($params);
return $report;
}
/**
* Get reporting user email
*/
function getUserEmail()
{
return $this->_getUserEmail();
}
/**
* Get user email
*/
function _getUserEmail($user = null)
{
return $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create($user)->getValue('from_addr');
}
/**
* Get scope admins
*/
function getAdmins()
{
$name = $GLOBALS['registry']->getApp() . ':admin';
if ($GLOBALS['injector']->getInstance('Horde_Perms')->exists($name)) {
return array();
}
$permission = $GLOBALS['injector']->getInstance('Horde_Perms')->getPermission($name);
return $permission->getUserPermissions(PERM_DELETE);
}
/**
* Set title
*/
function setTitle($title)
{
$this->_title = $title;
}
/**
* Get report message title
*/
function getTitle()
{
if (empty($this->_title)) {
return sprintf(_("Content abuse report in %s"), $GLOBALS['registry']->get('name'));
} else {
return $this->_title;
}
}
/**
* Get report message content
*/
function getMessage($message)
{
$message .= "\n\n" . _("Report by user") . ': ' . $GLOBALS['registry']->getAuth()
. ' (' . $_SERVER['REMOTE_ADDR'] . ')';
return $message;
}
/**
* Report
*
* @param string $message to pass
*/
function report($message, $users = array())
{
return PEAR::raiseError(_("Unsupported"));
}
}
|