Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added the sendmessage pages and events inside the Marketing plug in.

Created a ContactMailing object that extend contacts and move the methods sendMessage and eventSendMessage to that new class
could not full test as local setup can't send emails with sendmail
Overal it seems to work.
  • Loading branch information...
commit 8d0aeb92165fa635b2335865f56bd66bee3fe647 1 parent 8976566
Philippe Lewicki authored
29 plugin/Marketing.conf.inc.php
@@ -24,17 +24,19 @@
24 24 );
25 25
26 26 // Classes
27   - include_once("plugin/Marketing/AutoResponder.class.php");
28   - include_once("plugin/Marketing/AutoResponderEmail.class.php");
  27 + include_once("plugin/Marketing/class/ContactMailing.class.php");
  28 + include_once("plugin/Marketing/class/AutoResponder.class.php");
  29 + include_once("plugin/Marketing/class/AutoResponderEmail.class.php");
29 30 //include_once("plugin/Marketing/WebForm.class.php");
30   - include_once("plugin/Marketing/WebFormField.class.php");
31   - include_once("plugin/Marketing/WebFormUserField.class.php");
32   - include_once("plugin/Marketing/WebFormUser.class.php");
  31 + include_once("plugin/Marketing/class/WebFormField.class.php");
  32 + include_once("plugin/Marketing/class/WebFormUserField.class.php");
  33 + include_once("plugin/Marketing/class/WebFormUser.class.php");
33 34 // blocks
34   - include_once("plugin/Marketing/BlockMarketing.class.php");
35   - include_once("plugin/Marketing/BlockWebFormList.class.php");
36   - include_once("plugin/Marketing/BlockEmailTemplateList.class.php");
37   -
  35 + include_once("plugin/Marketing/class/BlockMarketing.class.php");
  36 + include_once("plugin/Marketing/class/BlockWebFormList.class.php");
  37 + include_once("plugin/Marketing/class/BlockEmailTemplateList.class.php");
  38 +
  39 + define('OFUZ_LOG_RUN_PLUGIN_MARKETING', true);
38 40
39 41 $cfg_plugin_mkt_path = "/Tab/Marketing/";
40 42
@@ -46,7 +48,7 @@
46 48 $GLOBALS['cfg_plugin_eventmultiple_placement']['contacts'][] =
47 49 Array('name'=> 'Send a Message ',
48 50 'confirm' => '',
49   - 'event' => 'do_Contacts->eventGetForMailMerge',
  51 + 'event' => 'ContactMailing->eventGetForMailMerge',
50 52 'action' => '');
51 53
52 54
@@ -73,7 +75,9 @@
73 75 "AutoResponder",
74 76 "AutoResponderEmail",
75 77 "AutoResponderEmailEdit",
76   - "settings_auto_responder_edit"
  78 + "settings_auto_responder_edit",
  79 + "SendMessage",
  80 + "SaveTemplate"
77 81 ))
78 82 ->setMenu($plugin_marketing_menu)
79 83 ->setDefaultPage("MEmailTemplate");
@@ -86,6 +90,7 @@
86 90 // $GLOBALS['cfg_submenu_placement']['WebForm'] = $plugin_marketing_menu;
87 91 // $GLOBALS['cfg_submenu_placement']['WebFormURL'] = $plugin_marketing_menu;
88 92 // $GLOBALS['cfg_submenu_placement']['MEmailTemplate'] = $plugin_marketing_menu;
89   -
  93 + $GLOBALS['cfg_submenu_placement']['SendMessage'] = '';
  94 + $GLOBALS['cfg_submenu_placement']['SaveTemplate'] = '';
90 95
91 96 ?>
11 plugin/Marketing/MEmailTemplate.php
@@ -42,15 +42,10 @@ function fnInsertMergeField(merge){
42 42 }
43 43 ?>
44 44 <div class="banner50 pad020 text16 fuscia_text"><?php echo _('Email Templates'); ?></div>
45   - <div class="contentfull">
46   - <div class="messageshadow">
47   - <div class="messages">
48 45 <?php
49 46 $msg = new Message();
50 47 //echo $msg->getMessage('web form creator instruction');
51 48 ?>
52   - </div>
53   - </div><br />
54 49 <div align="right">
55 50 <form id="select_merge_field">
56 51 <select name="merge_fields" onchange="fnInsertMergeField(this)">
@@ -88,9 +83,5 @@ function fnInsertMergeField(merge){
88 83 echo '<div align="right">'.$do_user_email_teml->form->getFormFooter(_('Create')).'</div>';
89 84 }
90 85 ?>
91   - </div>
  86 +
92 87 <div class="solidline"></div>
93   - </td></tr></table>
94   - <div class="spacerblock_40"></div>
95   - <div class="layout_footer"></div>
96   -</div>
52 contact_sendemail_save_template.php → plugin/Marketing/SaveTemplate.php
... ... @@ -1,26 +1,15 @@
1 1 <?php
2 2 /** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
3   -// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
  3 +// Copyright 2008 - 2012 all rights reserved, SQLFusion LLC, info@sqlfusion.com
4 4 /** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
5 5
6 6 /*
7 7 * contact_sendemail_save_tempatle.php
8 8 *
9   - * Copyright 2009 SQLFusion LLC, Philippe Lewicki <philippe@sqlfusion.com>
  9 + * Copyright 2009-2012 SQLFusion LLC, Philippe Lewicki <philippe@sqlfusion.com>
10 10 *
11 11 */
12 12
13   -
14   - include_once('config.php');
15   - $pageTitle = _('Ofuz :: Contacts Send Email Save Template');
16   - $Author = 'SQLFusion LLC';
17   - $Keywords = 'Keywords for search engine';
18   - $Description = 'Description for search engine';
19   - $background_color = 'white';
20   -
21   - include_once('includes/ofuz_check_access.script.inc.php');
22   - include_once('includes/header.inc.php');
23   -
24 13 $do_message = new EmailTemplateUser("blank");
25 14
26 15 if ($_GET['idtemplate']) {
@@ -29,29 +18,18 @@
29 18
30 19 ?>
31 20
32   -
33   -<table class="layout_columns"><tr><td class="layout_lmargin"></td><td>
34   -<div class="layout_content">
35   -
36   -
37   -<?php $thistab = 'Contacts'; include_once('includes/ofuz_navtabs.php');
38   -
39   - $do_breadcrumb = new Breadcrumb(); $do_breadcrumb->getBreadcrumbs(); ?>
40   - <div class="grayline1"></div>
41   - <div class="spacerblock_20"></div>
42   - <div class="mainheader">
43   - <div class="pad20">
44   - <span class="headline11"><?php echo _('Save Template');?></span>
45   - </div>
46   - </div>
47   - <div class="contentfull">
48 21 <div class="messageshadow">
49 22 <div class="messages">
50 23 <?php
51   - $msg = new Message();
52   - echo $msg->getMessage('save as template');
53   - echo "<br>".$_SESSION['in_page_message'] ;
54   - $_SESSION['in_page_message'] = '';
  24 + $message = new Message();
  25 + $message->getMessage("save as template");
  26 + $message->displayMessage();
  27 + if (!empty($_SESSION['in_page_message'])) {
  28 + $in_page_message = new Message();
  29 + $in_page_message->setContent($_SESSION['in_page_message'] );
  30 + $in_page_message->displayMessage();
  31 + $_SESSION['in_page_message'] = '';
  32 + }
55 33 ?>
56 34 </div>
57 35 </div>
@@ -96,11 +74,3 @@
96 74
97 75 }
98 76 ?>
99   -
100   -
101   -
102   - </div>
103   - <div class="spacerblock_40"></div>
104   - <div class="layout_footer"></div>
105   -</div>
106   -</td><td class="layout_rmargin"></td></tr></table>
44 contact_sendemail.php → plugin/Marketing/SendMessage.php
... ... @@ -1,16 +1,6 @@
1 1 <?php
2 2 /** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
3   -// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
4   -/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
5   -
6   - $pageTitle = 'Ofuz :: Contacts Send Email';
7   - $Author = 'SQLFusion LLC';
8   - $Keywords = 'Keywords for search engine';
9   - $Description = 'Description for search engine';
10   - $background_color = 'white';
11   - include_once('config.php');
12   - include_once('includes/ofuz_check_access.script.inc.php');
13   - include_once('includes/header.inc.php');
  3 +// Copyright 2008 - 2012 all rights reserved, SQLFusion LLC, info@sqlfusion.com
14 4
15 5 $do_message = new EmailTemplateUser("blank");
16 6 $do_message->sessionPersistent("do_message", "contacts.php", OFUZ_TTL);
@@ -20,6 +10,7 @@
20 10 $do_note_draft->sessionPersistent("do_message_draft","index.php",OFUZ_TTL);
21 11 }
22 12 ?>
  13 +
23 14 <script type="text/javascript">
24 15 //<![CDATA[
25 16 function fnInsertMergeField(merge){
@@ -108,23 +99,7 @@ function discardDraft(id){
108 99 });
109 100 //]]>
110 101 </script>
111   -<table class="layout_columns"><tr><td class="layout_lmargin"></td><td>
112   -<div class="layout_content">
113   -
114   -
115   -<?php $thistab = 'Contacts'; include_once('includes/ofuz_navtabs.php');
116   -
117   - $do_breadcrumb = new Breadcrumb(); $do_breadcrumb->getBreadcrumbs(); ?>
118   - <div class="grayline1"></div>
119   - <div class="spacerblock_20"></div>
120   - <div class="mainheader">
121   - <div class="pad20">
122   - <span class="headline11"><?php echo _('Send Message'); ?></span>
123   - </div>
124   - </div>
125   - <div class="contentfull">
126   - <div align="right">
127   - <?php echo _('Select an email template');
  102 +<?php echo _('Select an email template');
128 103 echo '<form id="select_email_template"><select name="idtemplate" onchange=\'$("#select_email_template").submit();\'><option value="0"></option><option value="0">'._('New Template').'</option>';
129 104 $template_list = new EmailTemplateUser();
130 105 $template_list->query('SELECT * FROM '.$template_list->getTable().' WHERE iduser='.$_SESSION['do_User']->iduser.' AND name <> \'\'');
@@ -190,9 +165,9 @@ function discardDraft(id){
190 165 $do_message->form->setLevel(920);
191 166 $do_message->form->addEventAction('do_message_draft->eventDeleteSavedDraft', 900);//added to delete the draft
192 167 //$do_message->form->addEventAction('do_message->eventPrepareSaving', 920);
193   - $do_message->form->addEventAction('do_Contacts->eventSendMessage', 2340);
  168 + $do_message->form->addEventAction('do_ContactMailing->eventSendMessage', 2340);
194 169 $do_message->form->addEventAction('mydb.gotoPage', 2430);
195   - $do_message->form->goto = 'contact_sendemail_save_template.php';
  170 + $do_message->form->goto = $GLOBALS['cfg_plugin_mkt_path'].'SaveTemplate';
196 171 $do_message->form->type = 'contact_email';//Message Draft Type
197 172 $do_message->iduser = $_SESSION['do_User']->iduser;
198 173 $do_message->setFields("emailtemplate_user");
@@ -234,12 +209,3 @@ function discardDraft(id){
234 209 // echo '<br/><div align="right">'._('Or').' '.$do_message->name.' '.$do_message->form->getFormFooter(_('Save as template')).'</div>';
235 210 // }
236 211 ?>
237   - </div>
238   - <div class="spacerblock_40"></div>
239   - <div class="layout_footer"></div>
240   -</div>
241   -</td><td class="layout_rmargin"></td></tr></table>
242   -
243   -</body>
244   -</html>
245   -
0  plugin/Marketing/AutoResponder.class.php → plugin/Marketing/class/AutoResponder.class.php
File renamed without changes
0  plugin/Marketing/AutoResponderEmail.class.php → plugin/Marketing/class/AutoResponderEmail.class.php
File renamed without changes
0  plugin/Marketing/BlockEmailTemplateList.class.php → .../Marketing/class/BlockEmailTemplateList.class.php
File renamed without changes
0  plugin/Marketing/BlockMarketing.class.php → plugin/Marketing/class/BlockMarketing.class.php
File renamed without changes
0  plugin/Marketing/BlockWebFormList.class.php → plugin/Marketing/class/BlockWebFormList.class.php
File renamed without changes
259 plugin/Marketing/class/ContactMailing.class.php
... ... @@ -0,0 +1,259 @@
  1 +<?php
  2 +// Copyright 2008 - 2012 all rights reserved, SQLFusion LLC, info@sqlfusion.com
  3 +/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html
  4 + **/
  5 +
  6 +
  7 + /**
  8 + * ContactMailing class
  9 + * Using the Contact and DataObject
  10 + *
  11 + * Method to reuse:
  12 + * sendMessage() its a very simple and easy way to send messages to contacts.
  13 + *
  14 + *
  15 + * @author SQLFusion's Dream Team 2 <info@sqlfusion.com>
  16 + * @package Marketing
  17 + * @license GNU Affero General Public License
  18 + * @version 0.6
  19 + * @date 2010-09-03
  20 + * @since 0.1
  21 + */
  22 +
  23 +class ContactMailing extends Contact {
  24 +
  25 + function __construct(sqlConnect $conx=NULL, $table_name="") {
  26 + parent::__construct($conx, $table_name);
  27 + if (RADRIA_LOG_RUN_OFUZ) {
  28 + $this->setLogRun(OFUZ_LOG_RUN_PLUGIN_MARKETING);
  29 + }
  30 +
  31 + $this->setLog("\n ContactMailing Object instantiated");
  32 + }
  33 +
  34 + /**
  35 + * eventGetForMailMerge
  36 + * Get the list of contact for mailmerge
  37 + * load in the current contact object the list of
  38 + * selected contacts from the contacts.php
  39 + * Then redirect to the contact_sendemail.php.
  40 + */
  41 + function eventGetForMailMerge(EventControler $event_controler) {
  42 +
  43 + $idcontacts = $event_controler->getParam("ck");
  44 + $sql_in = "(";
  45 + foreach($idcontacts as $idcontact) {
  46 + $sql_in .= $idcontact.",";
  47 + }
  48 + $sql_in = substr($sql_in, 0, -1);
  49 + $sql_in .= ")";
  50 + $tag_search = $this->getSearchTags();
  51 + if(is_array($tag_search) && count($tag_search > 0)){
  52 + $_SESSION['searched_tags'] = $tag_search ;
  53 + }
  54 +
  55 + $this->clearSearch();
  56 + $this->setSqlQuery("SELECT * FROM contact WHERE idcontact in ".$sql_in);
  57 + $this->sessionPersistent("do_ContactMailing", "contacts.php", 36000);
  58 + $event_controler->goto = $GLOBALS['cfg_plugin_mkt_path']."SendMessage";
  59 + //$event_controler->setDisplayNext(new Display($GLOBALS['cfg_plugin_mkt_path']."SendMessage/"));
  60 + }
  61 +
  62 + /**
  63 + * eventSendMessage
  64 + * This will send a message to one or multiple users.
  65 + * @todo Problem with the getBodyText(true) it returns some bad encoding and no newline, could also be the problem in the template it self...
  66 + */
  67 +
  68 + function eventSendMessage(EventControler $event_controler) {
  69 + $this->setLog("\n eventSendMessage (".date("Y/m/d H:i:s").")");
  70 + if ($event_controler->send == _('Send Mailing')) {
  71 + $email_template = $_SESSION['do_message'];
  72 + $email_template->setApplyFieldFormating(false);
  73 + $this->setLog("\n EmailTemplate id: ".$email_template->getPrimarykeyValue());
  74 + //$this->setLogObject($email_template);
  75 + $this->setLog("\n SQL:".$this->getSqlQuery());
  76 + $this->query();
  77 + $this->setLog("\n ".$this->getNumRows()." contacts to send the message");
  78 +
  79 + while ($this->next()) {
  80 + set_time_limit(500);
  81 + if($event_controler->unsubtag == 'on'){ // set unsubscribe auto-responder list
  82 + $values_contact = $this->getValues();
  83 + $tag_values = array("flag"=>"unsubscribe_autoresponder","idtag"=>$event_controler->idtag);
  84 + $values = array_merge($values_contact,$tag_values);
  85 + $message = $this->sendMessage($email_template, $values);
  86 + }else{
  87 + $message = $this->sendMessage($email_template, $this->getValues());
  88 + }
  89 + if ($this->last_message_sent) {
  90 + //$do_contact_notes->iduser = $_SESSION['do_User']->iduser;
  91 + $do_contact_notes = new ContactNotes();
  92 + $do_contact_notes->iduser = $_SESSION['do_User']->iduser;
  93 + //$do_contact_notes->note = '<b>'.$message->getSubject().'</b><br/>'.$message->getBodyText(true);
  94 + //->getTemplateBodyHtml();
  95 + $note_text = preg_replace('/^(.*?)<hr>.*$/','$1',str_replace("\n",'',$message->getBodyHtml(true)));
  96 + $do_contact_notes->note = '<b>'.$message->getSubject().'</b><br/>'.$note_text;
  97 + $do_contact_notes->date_added = date("Y-m-d");
  98 + $do_contact_notes->idcontact = $this->getPrimaryKeyValue();
  99 + $do_contact_notes->add();
  100 +
  101 +
  102 + /*
  103 + * Recording the messages sent by User
  104 + */
  105 + $msg_con = new sqlQuery($this->getDbCon());
  106 + $sql_msg_check = "SELECT * FROM `message_usage` WHERE `iduser` = ".$_SESSION['do_User']->iduser." AND `date_sent` = '".date("Y-m-d")."'";
  107 + $msg_con->query($sql_msg_check);
  108 + if($msg_con->getNumRows()) {
  109 + $msg_con->fetch();
  110 + $sql_con_update = new sqlQuery($this->getDbCon());
  111 + $sql_msg_update = "UPDATE `message_usage` SET `num_msg_sent` = num_msg_sent+1 WHERE `idmessage_usage` = ".$msg_con->getData("idmessage_usage");
  112 + $sql_con_update->query($sql_msg_update);
  113 + } else {
  114 + $sql_con_ins = new sqlQuery($this->getDbCon());
  115 + $sql_msg_ins = "INSERT INTO `message_usage`(iduser,date_sent,num_msg_sent) VALUES(".$_SESSION['do_User']->iduser.",'".date("Y-m-d")."',1)";
  116 + $sql_con_ins->query($sql_msg_ins);
  117 + }
  118 +
  119 +
  120 +
  121 + }
  122 + }
  123 + } else { $event_controler->goto = "contacts.php"; }
  124 + $this->clearSearch();
  125 + $this->free();
  126 + }
  127 +
  128 + /**
  129 + * eventSendNote
  130 + * This event is triggered when adding a note in a contact
  131 + * It will send a copy of the note the contact.
  132 + */
  133 +
  134 + function eventSendNote(EventControler $event_controler) {
  135 + $send_note = $event_controler->fields['send_email'];
  136 + $this->setLog("eventSendNote starting (".date("Y/m/d H:i:s").")");
  137 + $this->setLog("do we send a message:".$send_note);
  138 + if ($send_note == "y") {
  139 + $template = new EmailTemplate();
  140 + $template->setSubject("{Ofuz} Message: ".substr($event_controler->fields['note'], 0, 70)."...")
  141 + ->setMessage($event_controler->fields['note']);
  142 + $this->sendMessage($template);
  143 + }
  144 + }
  145 +
  146 + /**
  147 + * sendMessage
  148 + * This abstract the message sending so we use a general function
  149 + * that will send email or facebook or twitter based on the user
  150 + * preferences and settings.
  151 + * its possible to generate an EmailTemplate on the fly with no records in the DB
  152 + * Here is an exemple:
  153 + * <code php>
  154 + * $do_template = new EmailTemplate();
  155 + * $do_template->senderemail = "philippe@sqlfusion.com";
  156 + * $do_template->sendername = "Philippe Lewicki";
  157 + * $do_template->subject = "This is an example";
  158 + * $do_template->bodytext = "This is the content of the sample message";
  159 + * $do_template->bodyhtml = nl2br($do_template->bodytext);
  160 + * </code>
  161 + *
  162 + * An other example more OO / stylish
  163 + * <code php>
  164 + * $do_template = new EmailTemplate();
  165 + * $do_template->setFrom("phil@sqlfusion.com", "Philippe Lewicki")
  166 + * ->setSubject("This is an example")
  167 + * ->setMessage("This is the content of the sample message");
  168 + * </code>
  169 + * setFrom() is optional, if not provided it takes the do_User data
  170 + *
  171 + * Then send the message with: $contact->sendMessage($do_template);
  172 + *
  173 + * If you used a saved EmailTemplate like
  174 + * $do_template = new EmailTemplate("my template in email template table");
  175 + * and want the sender to be the currently signed in user, make sure the senderemail field
  176 + * is empty.
  177 + *
  178 + * @param $message an EmailTemplate object.
  179 + * @param $values an array with values to merge, optional.
  180 + *
  181 + */
  182 + function sendMessage($template, $values=Array()) {
  183 + if (!is_object($template)) { return false; }
  184 + if (empty($values)) { $values = $this->getValues(); }
  185 + $this->last_message_sent = false;
  186 + $do_contact_email = $this->getChildContactEmail();
  187 + $email_to = $do_contact_email->getDefaultEmail();
  188 + $this->setLog("\n Sending message to:".$email_to);
  189 + $contact_link = '<a href="/Contact/'.$this->idcontact.'">'.$this->firstname.' '.$this->lastname.'</a>';
  190 + if (strlen($email_to) > 4) {
  191 + if ($this->email_optout != 'y') {
  192 + $emailer = new Ofuz_Emailer('UTF-8');
  193 + if (strlen($template->senderemail) == 0) {
  194 + $template->setFrom($_SESSION['do_User']->email, $_SESSION['do_User']->getFullName());
  195 + }
  196 + $emailer->setEmailTemplate($template);
  197 + $emailer->mergeArrayWithFooter($values);
  198 + $emailer->addTo($email_to);
  199 + $this->last_message_sent = true;
  200 + return $emailer->send();
  201 + } else {
  202 + $_SESSION['in_page_message'] .= _("<br>".$contact_link." has opt-out and will not receive this email");
  203 + }
  204 + } elseif (strlen($this->tw_user_id) > 0) {
  205 + // send direct message using twitter api.
  206 + try{
  207 + $do_twitter = new OfuzTwitter();
  208 + $tw_config = $do_twitter->getTwitterConfig();
  209 + $serialized_token = $do_twitter->getAccessToken();
  210 + $token = unserialize($serialized_token);
  211 + $ofuz_twitter = new Ofuz_Service_Twitter($token->getParam('user_id'), $tw_config, $token);
  212 + $followers = $ofuz_twitter->userFollowers(false);
  213 + if (is_object($followers) && count($followers->user) > 0) {
  214 + foreach ($followers->user as $follower) {
  215 + if ($follower->id == $this->tw_user_id) {
  216 + $merge = new MergeString();
  217 + $message = $merge->withArray($template->bodytext, $values);
  218 + $ofuz_twitter->directMessageNew($this->tw_user_id, $message);
  219 + $do_contact_notes = new ContactNotes();
  220 + $do_contact_notes->iduser = $_SESSION['do_User']->iduser;
  221 + $do_contact_notes->note = $message;
  222 + $do_contact_notes->date_added = date('Y-m-d');
  223 + $do_contact_notes->idcontact = $this->idcontact;
  224 + $do_contact_notes->add();
  225 + return true;
  226 + }
  227 + }
  228 + }
  229 + $_SESSION['in_page_message'] .= _("<br>Notification can not be sent to ".$contact_link);
  230 + }catch(Exception $e){
  231 + $_SESSION['in_page_message'] .= _("<br>Notification can not be sent to ".$contact_link);
  232 + }
  233 + } elseif ($this->fb_userid && $_SESSION["do_User"]->global_fb_connected) {
  234 + // send message using facebook api.
  235 + include_once 'facebook_client/facebook.php';
  236 + include_once 'class/OfuzFacebook.class.php';
  237 + $facebook = new Facebook(FACEBOOK_API_KEY, FACEBOOK_APP_SECRET);
  238 + try{
  239 + $msg = _(' has sent the following message using ofuz').'<br />';
  240 + $msg .= '<b>'.$template->subject.'</b><br/>'.$template->bodyhtml;
  241 + $facebook->api_client->notifications_send($this->fb_userid, $msg, 'user_to_user');
  242 + //$this->last_message_sent = true;
  243 + }catch(Exception $e){
  244 + $_SESSION['in_page_message'] .= _("<br>Notification can not be sent to ".$contact_link);
  245 + }
  246 + } else {
  247 + $_SESSION['in_page_message'] .= _("<br>".$contact_link." doesn't have a valid email address, facebook account, or twitter id.");
  248 + }
  249 +
  250 + if ($this->last_message_sent) {
  251 + return true;
  252 + } else {
  253 + return false;
  254 + }
  255 + }
  256 +
  257 +
  258 +
  259 +}
0  plugin/Marketing/WebFormField.class.php → plugin/Marketing/class/WebFormField.class.php
File renamed without changes
0  plugin/Marketing/WebFormUser.class.php → plugin/Marketing/class/WebFormUser.class.php
File renamed without changes
0  plugin/Marketing/WebFormUserField.class.php → plugin/Marketing/class/WebFormUserField.class.php
File renamed without changes

0 comments on commit 8d0aeb9

Please sign in to comment.
Something went wrong with that request. Please try again.