[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17232] prepare for custom code outside tree
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17232] prepare for custom code outside tree |
Date: |
Wed, 1 Nov 2017 14:53:22 -0400 (EDT) |
Revision: 17232
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17232
Author: sigurdne
Date: 2017-11-01 14:53:21 -0400 (Wed, 01 Nov 2017)
Log Message:
-----------
prepare for custom code outside tree
Added Paths:
-----------
thirdparty/PE_custom/BK_EBF/property/inc/cron/default/forward_mail_as_sms.php
Copied:
thirdparty/PE_custom/BK_EBF/property/inc/cron/default/forward_mail_as_sms.php
(from rev 17218, trunk/property/inc/cron/default/forward_mail_as_sms.php)
===================================================================
---
thirdparty/PE_custom/BK_EBF/property/inc/cron/default/forward_mail_as_sms.php
(rev 0)
+++
thirdparty/PE_custom/BK_EBF/property/inc/cron/default/forward_mail_as_sms.php
2017-11-01 18:53:21 UTC (rev 17232)
@@ -0,0 +1,102 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package property
+ * @subpackage custom
+ * @version $Id$
+ */
+ /**
+ * Description
+ * usage:
+ * @package property
+ */
+ include_class('property', 'cron_parent', 'inc/cron/');
+
+ class forward_mail_as_sms extends property_cron_parent
+ {
+
+ function __construct()
+ {
+ parent::__construct();
+
+ $this->function_name = get_class($this);
+ $this->sub_location = lang('Async service');
+ $this->function_msg = 'Forward email as SMS';
+
+ $this->bocommon = CreateObject('property.bocommon');
+ }
+
+ function execute( $data = array() )
+ {
+ $data['account_id'] =
$GLOBALS['phpgw']->accounts->name2id($data['user']);
+ $this->check_for_new_mail($data);
+ }
+
+ function check_for_new_mail( $data )
+ {
+ $GLOBALS['phpgw_info']['user']['account_id'] =
$data['account_id'];
+
$GLOBALS['phpgw']->preferences->set_account_id($data['data_id'], true);
+
+ $GLOBALS['phpgw_info']['user']['preferences'] =
$GLOBALS['phpgw']->preferences->read();
+
+ $boPreferences =
CreateObject('felamimail.bopreferences');
+
+ $bofelamimail = CreateObject('felamimail.bofelamimail');
+
+// $bofelamimail->closeConnection();
+// $boPreferences->setProfileActive(false);
+// $boPreferences->setProfileActive(true,2); //2 for
selected user
+
+ $connectionStatus = $bofelamimail->openConnection();
+ $headers = $bofelamimail->getHeaders('INBOX', 1,
$maxMessages = 15, $sort = 0, $_reverse = 1, $_filter = array(
+ 'string' => '', 'type' => 'quick', 'status' =>
'unseen'));
+
+//_debug_array($headers);
+//die();
+
+ $sms = array();
+ $j = 0;
+ if (isset($headers['header']) &&
is_array($headers['header']))
+ {
+ foreach ($headers['header'] as $header)
+ {
+ //
if(!$header['seen'])
+ {
+ $sms[$j]['message'] =
utf8_encode($header['subject']);
+ $bodyParts =
$bofelamimail->getMessageBody($header['uid']);
+ $sms[$j]['message'] .= "\n";
+ for ($i = 0; $i <
count($bodyParts); $i++)
+ {
+ $sms[$j]['message'] .=
utf8_encode($bodyParts[$i]['body']) . "\n";
+ }
+
+ $sms[$j]['message'] =
substr($sms[$j]['message'], 0, 160);
+ $j++;
+ }
+ $bofelamimail->flagMessages('read',
$header['uid']);
+ }
+ }
+
+ if ($connectionStatus)
+ {
+ $bofelamimail->closeConnection();
+ }
+
+ $bosms = CreateObject('sms.bosms', false);
+ foreach ($sms as $entry)
+ {
+ $bosms->send_sms(array('p_num_text' =>
$data['cellphone'], 'message' => $entry['message']));
+ }
+
+ if ($j)
+ {
+ $msg = $j . ' meldinger er sendt';
+ $this->receipt['message'][] = array('msg' =>
$msg);
+ }
+ }
+ }
\ No newline at end of file
Property changes on:
thirdparty/PE_custom/BK_EBF/property/inc/cron/default/forward_mail_as_sms.php
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Revision Author Id
\ No newline at end of property
Added: svn:mergeinfo
## -0,0 +1,3 ##
+/branches/dev-syncromind/property/inc/cron/default/forward_mail_as_sms.php:13653
+/branches/dev-syncromind-2/property/inc/cron/default/forward_mail_as_sms.php:14933-16846
+/branches/stavangerkommune/property/inc/cron/default/forward_mail_as_sms.php:12743-12875,12986
\ No newline at end of property
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17232] prepare for custom code outside tree,
sigurdne <=