+++ /dev/null
-K 25
-svn:wc:ra_dav:version-url
-V 49
-/svn/repos/!svn/ver/1343/folks/lib/Notification
-END
-facebook.php
-K 25
-svn:wc:ra_dav:version-url
-V 62
-/svn/repos/!svn/ver/1469/folks/lib/Notification/facebook.php
-END
-letter.php
-K 25
-svn:wc:ra_dav:version-url
-V 60
-/svn/repos/!svn/ver/1470/folks/lib/Notification/letter.php
-END
-mail.php
-K 25
-svn:wc:ra_dav:version-url
-V 58
-/svn/repos/!svn/ver/1469/folks/lib/Notification/mail.php
-END
-tickets.php
-K 25
-svn:wc:ra_dav:version-url
-V 61
-/svn/repos/!svn/ver/1469/folks/lib/Notification/tickets.php
-END
+++ /dev/null
-9
-
-dir
-1367
-http://svn.obala.si/svn/repos/folks/lib/Notification
-http://svn.obala.si/svn/repos
-
-
-
-2009-03-05T13:25:20.591445Z
-1343
-duck
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-64c303f7-8c91-43f2-bf98-80ae1d46e4ff
-\f
-facebook.php
-file
-1469
-
-
-
-2009-03-12T10:53:26.000000Z
-844690b38a65f8179b23c1346190e245
-2009-03-12T10:51:11.048553Z
-1469
-duck
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-4394
-\f
-letter.php
-file
-1470
-
-
-
-2009-03-12T10:54:40.000000Z
-9b813aedf152b6d837b0ef06cd490e01
-2009-03-12T10:52:44.969970Z
-1470
-duck
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2400
-\f
-mail.php
-file
-1469
-
-
-
-2009-03-12T10:52:58.000000Z
-f5dd1ba35c8bf2dcad0d3302e2296021
-2009-03-12T10:51:11.048553Z
-1469
-duck
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-3138
-\f
-tickets.php
-file
-1469
-
-
-
-2009-03-12T10:53:26.000000Z
-260a1d54eb98aae552e999095f083b7b
-2009-03-12T10:51:11.048553Z
-1469
-duck
-has-props
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2410
-\f
+++ /dev/null
-K 13
-svn:eol-style
-V 6
-native
-K 12
-svn:keywords
-V 23
-Author Date Id Revision
-END
+++ /dev/null
-K 2
-Id
-V 3
-set
-END
+++ /dev/null
-K 2
-Id
-V 3
-set
-END
+++ /dev/null
-K 13
-svn:eol-style
-V 6
-native
-K 12
-svn:keywords
-V 23
-Author Date Id Revision
-END
+++ /dev/null
-<?php
-/**
- * Folks Notification Class.
- *
- * $Id$
- *
- * Copyright Obala d.o.o. (www.obala.si)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Duck <duck@obala.net>
- * @package Folks
- */
-class Folks_Notification_facebook extends Folks_Notification {
-
- /**
- * FB object
- */
- private $_fb;
-
- /**
- * FB connection parameters
- */
- private $_fbp;
-
- /**
- * Returns method human name
- */
- public function getName()
- {
- return _("Facebook");
- }
-
- /**
- * Checks if a driver is available for a certain notification type
- *
- * @param string $type Notification type
- *
- * @return boolean
- */
- public function isAvailable($type)
- {
- // Check FB installation
- if (!$GLOBALS['conf']['facebook']['enabled']) {
- return false;
- }
-
- // Chacke FB user config
- $fbp = unserialize($GLOBALS['prefs']->getValue('facebook'));
- if (!$fbp || empty($fbp['uid'])) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Notify user
- *
- * @param mixed $user User or array of users to send notification to
- * @param string $subject Subject of message
- * @param string $body Body of message
- * @param array $attachments Attached files
- *
- * @return true on succes, PEAR_Error on failure
- */
- public function notify($user, $subject, $body, $attachments = array())
- {
- if (!$this->_loadFB()) {
- return $this->_fb;
- }
-
- try {
- $message = '<strong>' . $subject . ':</strong> ' . $body;
- $result = $this->_fb->notifications->send(array($this->_fbp['uid']), $message, 'user_to_user');
- } catch (Horde_Service_Facebook_Exception $e) {
- return PEAR::raiseError($e->getMessage(), $e->getCode());
- }
-
- return $result;
- }
-
- /**
- * Notify user
- *
- * @param mixed $user User or array of users to send notification to
- * @param string $subject Subject of message
- * @param string $body Body of message
- * @param array $attachments Attached files
- *
- * @return true on succes, PEAR_Error on failure
- */
- public function notifyFriends($user, $subject, $body, $attachments = array())
- {
- if (!$this->_loadFB()) {
- return $this->_fb;
- }
-
- try {
- $friends = $this->_fb->friends->get(null, $this->_fbp['uid']);
- } catch (Horde_Service_Facebook_Exception $e) {
- return PEAR::raiseError($e->getMessage(), $e->getCode());
- }
-
- try {
- $message = '<strong>' . $subject . ':</strong> ' . $body;
- $result = $this->_fb->notifications->send($friends, $message, 'user_to_user');
- } catch (Horde_Service_Facebook_Exception $e) {
- return PEAR::raiseError($e->getMessage(), $e->getCode());
- }
-
- return $result;
- }
-
- /**
- * Load FB content
- */
- private function _loadFB()
- {
- if ($this->_fb) {
- return true;
- }
-
- // Check FB installation
- if (!$GLOBALS['conf']['facebook']['enabled']) {
- $this->_fb = PEAR::raiseError(_("No Facebook integration exists."));
- return false;
- }
-
- // Check FB user config
- $this->_fbp = unserialize($GLOBALS['prefs']->getValue('facebook'));
- if (!$this->_fbp || empty($this->_fbp['uid'])) {
- $this->_fb = PEAR::raiseError(sprintf(_("Could not find authorization for %s to interact with your Facebook account."), $GLOBALS['registry']->get('name', 'horde')));
- return false;
- }
-
- // Create FB Object
- $this->_fb = new Horde_Service_Facebook($GLOBALS['conf']['facebook']['key'],
- $GLOBALS['conf']['facebook']['secret'],
- array('http_client' => new Horde_Http_Client(),
- 'http_request' => new Horde_Controller_Request_Http()));
-
- // Set Auth user
- $this->_fb->auth->setUser($this->_fbp['uid'], $this->_fbp['sid'], 0);
-
- return true;
- }
-}
+++ /dev/null
-<?php
-/**
- * Folks Notification Class.
- *
- * $Id: Driver.php 1400 2009-03-09 09:58:40Z duck $
- *
- * Copyright Obala d.o.o. (www.obala.si)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Duck <duck@obala.net>
- * @package Folks
- */
-class Folks_Notification_letter extends Folks_Notification {
-
- /**
- * Returns method human name
- */
- public function getName()
- {
- return $GLOBALS['registry']->get('name', 'letter');
- }
-
- /**
- * Checks if a driver is available for a certain notification type
- *
- * @param string $type Notification type
- *
- * @return boolean
- */
- public function isAvailable($type)
- {
- if ($type == 'friends') {
- return $GLOBALS['registry']->hasMethod('users/getFriends');
- }
-
- return true;
- }
-
- /**
- * Notify user
- *
- * @param mixed $user User or array of users to send notification to
- * @param string $subject Subject of message
- * @param string $body Body of message
- * @param array $attachments Attached files
- *
- * @return true on succes, PEAR_Error on failure
- */
- public function notify($user, $subject, $body, $attachments = array())
- {
- if (empty($user)) {
- return true;
- }
-
- return $GLOBALS['registry']->callByPackage(
- 'letter', 'sendMessage', array($user,
- array('title' => $subject,
- 'content' => $body,
- 'attachments' => $attachments)));
- }
-
- /**
- * Notify user's friends
- *
- * @param mixed $user User or array of users to send notification to
- * @param string $subject Subject of message
- * @param string $body Body of message
- * @param array $attachments Attached files
- *
- * @return true on succes, PEAR_Error on failure
- */
- public function notifyFriends($user, $subject, $body, $attachments = array())
- {
- $friends = $GLOBALS['registry']->call('users/getFriends');
- if ($friends instanceof PEAR_Error) {
- return $friends;
- }
-
- return $this->notify($friends, $subject, $body, $attachments);
- }
-}
+++ /dev/null
-<?php
-/**
- * Folks Notification Class.
- *
- * $Id: Driver.php 1400 2009-03-09 09:58:40Z duck $
- *
- * Copyright Obala d.o.o. (www.obala.si)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Duck <duck@obala.net>
- * @package Folks
- */
-class Folks_Notification_mail extends Folks_Notification {
-
- /**
- * Returns method human name
- */
- public function getName()
- {
- return _("E-mail");
- }
-
- /**
- * Checks if a driver is available for a certain notification type
- *
- * @param string $type Notification type
- *
- * @return boolean
- */
- public function isAvailable($type)
- {
- if ($type == 'friends') {
- return $GLOBALS['registry']->hasMethod('users/getFriends');
- }
-
- return true;
- }
-
- /**
- * Notify user
- *
- * @param mixed $user User or array of users to send notification to
- * @param string $subject Subject of message
- * @param string $body Body of message
- * @param array $attachments Attached files
- *
- * @return true on succes, PEAR_Error on failure
- */
- public function notify($user, $subject, $body, $attachments = array())
- {
- if (empty($user)) {
- return true;
- }
-
- list($mail_driver, $mail_params) = Horde::getMailerConfig();
- require_once FOLKS_BASE . '/lib/version.php';
-
- $mail = new Horde_Mime_Mail($subject, $body, null,
- $this->_params['from_addr'],
- NLS::getCharset());
-
- $mail->addHeader('User-Agent', 'Folks ' . FOLKS_VERSION);
- $mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']);
- $mail->addHeader('X-Remote-Browser', $_SERVER['HTTP_USER_AGENT']);
-
- foreach ($attachments as $file) {
- if (file_exists($file)) {
- $mail->addAttachment($file, null, null, NLS::getCharset());
- }
- }
-
- if (is_string($user)) {
- $user = array($user);
- }
-
- foreach ($user as $recipent) {
- $to = $this->_getUserFromAddr($recipent);
- if (empty($to)) {
- continue;
- }
- $mail->addHeader('To', $to, NLS::getCharset(), true);
- $mail->send($mail_driver, $mail_params);
- }
-
- return true;
- }
-
- /**
- * Notify user's friends
- *
- * @param mixed $user User or array of users to send notification to
- * @param string $subject Subject of message
- * @param string $body Body of message
- * @param array $attachments Attached files
- *
- * @return true on succes, PEAR_Error on failure
- */
- public function notifyFriends($user, $subject, $body, $attachments = array())
- {
- $friends = $GLOBALS['registry']->call('users/getFriends');
- if ($friends instanceof PEAR_Error) {
- return $friends;
- }
-
- return $this->notify($friends, $subject, $body, $attachments);
- }
-}
+++ /dev/null
-<?php
-/**
- * Folks Notification Class.
- *
- * $Id$
- *
- * Copyright Obala d.o.o. (www.obala.si)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Duck <duck@obala.net>
- * @package Folks
- */
-class Folks_Notification_tickets extends Folks_Notification {
-
- /**
- * Returns method human name
- */
- public function getName()
- {
- return $GLOBALS['registry']->get('name', 'whups');
- }
-
- /**
- * Checks if a driver is available for a certain notification type
- *
- * @param string $type Notification type
- *
- * @return boolean
- */
- public function isAvailable($type)
- {
- if (!$GLOBALS['registry']->hasInterface('tickets') ||
- $type == 'admins') {
- return false;
- }
-
- return false;
- }
-
- /**
- * Notify user
- *
- * @param mixed $user User or array of users to send notification to
- * @param string $subject Subject of message
- * @param string $body Body of message
- * @param array $attachments Attached files
- *
- * @return true on succes, PEAR_Error on failure
- */
- public function notify($user, $subject, $body, $attachments = array())
- {
- global $registry;
-
- $info = array_merge($this->_params['ticket_params'],
- array('summary' => $subject,
- 'comment' => $body,
- 'user_email' => $this->_getUserFromAddr()));
-
- $ticket_id = $registry->call('tickets/addTicket', array($info));
- if ($ticket_id instanceof PEAR_Error) {
- return $ticket_id;
- }
-
- if (empty($attachments) ||
- !$registry->hasMethod('tickets/addAttachment')) {
- return $result;
- }
-
- foreach ($attachments as $attachment) {
- $result = $registry->call(
- 'tickets/addAttachment',
- array('ticket_id' => $ticket_id,
- 'name' => $attachment['name'],
- 'data' => file_get_contents($attachment['file'])));
- if ($result instanceof PEAR_Error) {
- return $result;
- }
- }
-
- return true;
- }
-}