added version

This commit is contained in:
Ralf Becker 2008-07-30 06:49:55 +00:00
parent a17e5ebad0
commit 72e99175e9
2 changed files with 26 additions and 24 deletions

View File

@ -7,6 +7,7 @@
* @subpackage backends
* @link http://www.egroupware.org
* @author Christian Binder <christian@jaytraxx.de>
* @version $Id$
*/
/**
@ -18,28 +19,28 @@ class notifications_email implements notifications_iface {
* Appname
*/
const _appname = 'notifications';
/**
* holds account object for user who sends the message
*
* @var object
*/
private $sender;
/**
* holds account object for user to notify
*
* @var object
*/
private $recipient;
/**
* holds config object (sitewide application config)
*
* @var object
*/
private $config;
/**
* holds preferences object of user to notify
*
@ -53,7 +54,7 @@ class notifications_email implements notifications_iface {
* @var object
*/
private $mail;
/**
* constructor of notifications_email
*
@ -74,7 +75,7 @@ class notifications_email implements notifications_iface {
$this->mail = new send();
}
}
/**
* sends notification
*
@ -86,7 +87,7 @@ class notifications_email implements notifications_iface {
public function send(array $_messages, $_subject = false, $_links = false, $_attachments = false) {
$body_plain = $_messages['plain'].$this->render_links($_links, false, $this->preferences->external_mailclient);
$body_html = "<html><body>\n".$_messages['html'].$this->render_links($_links, true, $this->preferences->external_mailclient)."</body>\n</html>\n";
$this->mail->ClearAddresses();
$this->mail->ClearAttachments();
$this->mail->IsHTML(true);
@ -106,7 +107,7 @@ class notifications_email implements notifications_iface {
throw new Exception("Failed sending notification message via email.$error");
}
}
/**
* renders plaintext/html links from given link array
*
@ -117,14 +118,14 @@ class notifications_email implements notifications_iface {
*/
private function render_links($_links = false, $_render_html = false, $_render_external = true) {
if(!is_array($_links) || count($_links) == 0) { return false; }
// provide defaults if given arguments are null
// php distinguishes between missing and present(null) arguments
if(is_null($_render_html)) { $_render_html = false; }
if(is_null($_render_external)) { $_render_external = true; }
$newline = $_render_html ? "<br />" : "\n";
$hruler = $_render_html ? html::hr() : '';
$rendered_links = array();
foreach($_links as $link) {
if($_render_external || ! $link->popup) { $link->view['no_popup'] = 1; }

View File

@ -7,6 +7,7 @@
* @subpackage backends
* @link http://www.egroupware.org
* @author Christian Binder <christian@jaytraxx.de>
* @version $Id$
*/
/**
@ -18,44 +19,44 @@ class notifications_winpopup implements notifications_iface {
* Appname
*/
const _appname = 'notifications';
/**
* Login table in SQL database
*/
const _login_table = 'egw_access_log';
/**
* holds account object for user who sends the message
*
* @var object
*/
private $sender;
/**
* holds account object for user to notify
*
* @var object
*/
private $recipient;
/**
* holds config object (sitewide application config)
*
* @var object
*/
private $config;
/**
* holds preferences object of user to notify
*
* @var object
*/
private $preferences;
/**
* holds the netbios command to be executed on notification
*
* @abstract
* @abstract
* Example: $netbios_command = "/bin/echo [MESSAGE] | /usr/bin/smbclient -M computer-[4] -I [IP] -U [SENDER]";
*
* Placeholders are:
@ -68,7 +69,7 @@ class notifications_winpopup implements notifications_iface {
* @var string
*/
private $netbios_command = "/bin/echo [MESSAGE] >> /Users/jaytraxx/winpopup.out";
/**
* constructor of notifications_winpopup
*
@ -90,7 +91,7 @@ class notifications_winpopup implements notifications_iface {
$this->config = $_config;
$this->preferences = $_preferences;
}
/**
* sends notification
*
@ -110,11 +111,11 @@ class notifications_winpopup implements notifications_iface {
}
}
if ( empty($user_sessions) ) throw new Exception("User #{$this->recipient->account_id} isn't online. Can't send notification via winpopup");
$this->send_winpopup( $this->render_infos($_subject).$_messages['plain'], $user_sessions );
return true;
}
/**
* sends the winpopup message via command line string netbios_command specified above
*
@ -144,7 +145,7 @@ class notifications_winpopup implements notifications_iface {
}
}
}
/**
* checks for a valid IPv4-address without CIDR notation
*
@ -154,7 +155,7 @@ class notifications_winpopup implements notifications_iface {
private function valid_ip($_ip) {
return eregi('^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$',$_ip);
}
/**
* renders additional info from subject
*
@ -162,7 +163,7 @@ class notifications_winpopup implements notifications_iface {
* @return plain rendered info as complete string
*/
private function render_infos($_subject = false) {
$newline = "\n";
$newline = "\n";
if(!empty($_subject)) { return $_subject.$newline; }
return false;
}