* @return Folks_Friends The newly created concrete Folks_Friends
* instance, or false on an error.
*/
- public function factory($driver = null, $params = null)
+ static public function factory($driver = null, $params = null)
{
if ($driver === null) {
$driver = $GLOBALS['conf']['friends'];
*
* $Horde: ansel/lib/Report.php,v 1.9 2008-07-03 04:16:00 mrubinsk Exp $
*
- * Copyright 2008-2009 The Horde Project (http://www.horde.org)
+ * Copyright 2009 The Horde Project (http://www.horde.org)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
- * Copyright 2008-2009 The Horde Project (http://www.horde.org)
+ * Copyright 2008 The Horde Project (http://www.horde.org)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
/**
* Create instance
*/
- function factory($driver = null, $params = array())
+ public static factory($driver = null, $params = array())
{
if ($driver === null) {
$driver = $GLOBALS['conf']['report_content']['driver'];
$params = $GLOBALS['conf']['report_content'];
}
- require_once ANSEL_BASE . '/lib/Report/' . $driver . '.php';
+ require_once FOLKS_BASE . '/lib/Report/' . $driver . '.php';
$class_name = 'Folks_Report_' . $driver;
if (!class_exists($class_name)) {
return PEAR::RaiseError(_("Report driver does not exist."));
}
- $report = &new $class_name($params);
+ $report = new $class_name($params);
return $report;
}
/**
* Get reporting user email
*/
- function getUserEmail()
+ public function getUserEmail()
{
return $this->_getUserEmail();
}
/**
* Get user email
*/
- function _getUserEmail($user = null)
+ public function _getUserEmail($user = null)
{
require_once 'Horde/Identity.php';
/**
* Get scope admins
*/
- function getAdmins()
+ public function getAdmins()
{
$name = $GLOBALS['registry']->getApp() . ':admin';
/**
* Set title
*/
- function setTitle($title)
+ public function setTitle($title)
{
$this->_title = $title;
}
/**
* Get report message title
*/
- function getTitle()
+ public function getTitle()
{
if (empty($this->_title)) {
return sprintf(_("Content abuse report in %s"), $GLOBALS['registry']->get('name'));
/**
* Get report message content
*/
- function getMessage($message)
+ public function getMessage($message)
{
$message .= "\n\n" . _("Report by user") . ': ' . Auth::getAuth()
. ' (' . $_SERVER['REMOTE_ADDR'] . ')';
*
* @param string $message to pass
*/
- function report($message, $users = array())
+ public function report($message, $users = array())
{
return PEAR::raiseError(_("Unsupported"));
}
/**
* Report
*/
- function report($message, $users = array())
+ public function report($message, $users = array())
{
if (!empty($users)) {
// We are sending a report to to the gallery owner
/**
* Report
*/
- function report($message, $users = array())
+ public function report($message, $users = array())
{
global $conf;
}
}
- require_once 'Horde/MIME.php';
- require_once 'Horde/MIME/Headers.php';
- require_once 'Horde/MIME/Message.php';
-
- $email = $this->getUserEmail();
-
- $msg_headers = new MIME_Headers();
- $msg_headers->addReceivedHeader();
- $msg_headers->addMessageIdHeader();
- $msg_headers->addAgentHeader();
- $msg_headers->addHeader('Date', date('r'));
- $msg_headers->addHeader('To', $to);
- $msg_headers->addHeader('Subject', $this->getTitle());
- $msg_headers->addHeader('From', $email);
+ /*
+ * Needed for the Horde 4 mime library - use autoload everywhere we can
+ * when this is *really* refactored for horde 4
+ */
+ $mail = new Horde_Mime_Mail($this->getTitle(), $this->getMessage($message), $to, $this->getUserEmail());
//FIXME: This address should be configurable
- $msg_headers->addHeader('Sender', 'horde-problem@' . $conf['report_content']['maildomain']);
-
- $mime = new MIME_Message();
- $mime->addPart(
- new MIME_Part('text/plain',
- String::wrap($this->getMessage($message), 80, "\n"),
- NLS::getCharset()));
- $msg_headers->addMIMEHeaders($mime);
+ $mail->addHeader('Sender', 'horde-problem@' . $conf['report_content']['maildomain']);
$mail_driver = $conf['mailer']['type'];
$mail_params = $conf['mailer']['params'];
}
}
- return $mime->send($conf['report_content']['email'],
- $msg_headers, $mail_driver, $mail_params);
+ return $mail->send($mail_driver, $mail_params);
}
}
\ No newline at end of file
/**
* Report
*/
- function report($message)
+ public function report($message)
{
$info = array_merge($GLOBALS['conf']['report_content']['ticket_params'],
array('summary' => $this->getTitle(),
*
* $Horde: folks/report.php,v 1.5 2008-08-03 18:32:29 mrubinsk Exp $
*
- * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
+ * Copyright 2007-2008 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
$body = _("User") . ': ' . $user . "\n"
. _("Report type") . ': ' . $enum[$vars->get('type')] . "\n"
. _("Report reason") . ': ' . $vars->get('reason') . "\n"
- . $return_url;
+ . Folks::getUrlFor('user', $user);
$result = $report->report($body);
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceof PEAR_Error) {
$notification->push(_("User was not reported.") . ' ' .
$result->getMessage(), 'horde.error');
} else {
} else {
$notification->push(_("User was not reported."), 'horde.warning');
}
- header('Location: ' . $return_url);
+ header('Location: ' . Folks::getUrlFor('user', $user));
exit;
}