コード例 #1
0
 function eventCancelAccount(EventControler $evtcl)
 {
     //echo 'No cancellation after registration....';
     //echo '<br /> and for the reson that u have given <br />'.$evtcl->fields["reason"].'<br /> no way, no cancellation ';
     //exit;
     if ($evtcl->fields["reason"] != '') {
         $this->deleteContactRelated();
         $this->deleteUserContactNote();
         $this->deleteUserContactSharing();
         $this->deleteUserEmailTemplate();
         $this->deleteInvoiceRelated();
         $this->deleteMessage();
         $this->deleteProjectRelated();
         $this->deleteTask();
         $this->deletewebformuser();
         $this->deleteworkfeed();
         $this->deletenotedraft();
         $this->deletetwitteraccount();
         $this->deletetbreadcrumb();
         $this->deleteUserRel();
         $this->deleteUserSettings();
         $this->deleteUserTags();
         $this->dropContactView();
         $email_template = new EmailTemplate("ofuz_cancel_account_notification");
         $email_template->setSenderName($_SESSION['do_User']->getFullName());
         $email_template->setSenderEmail($_SESSION['do_User']->email);
         $email_data = array('name' => $_SESSION['do_User']->getFullName(), 'email' => $_SESSION['do_User']->email, 'reason' => $evtcl->fields["reason"]);
         $emailer = new Radria_Emailer();
         $emailer->setEmailTemplate($email_template);
         $emailer->mergeArray($email_data);
         $emailer->addTo("*****@*****.**");
         //$emailer->addTo("*****@*****.**");
         $emailer->send();
         $this->deleteUser();
     } else {
         $_SESSION['in_page_message'] = _("Please Provide a reason before cancelling the account");
         $dispError = new Display('cancel_account.php');
         $dispError->addParam("m", 'e');
         $evtcl->setDisplayNext($dispError);
     }
 }
コード例 #2
0
                $last_task = $_SESSION['adm_project_discuss_idtask'];
                $last_desc = $_SESSION['adm_project_task_discuss'];
            }
        }
        //echo $email.'<br />';echo $text;
        // send mails to the ofuz users with their respective worklog
        $do_template = new EmailTemplate();
        $do_template->senderemail = "*****@*****.**";
        $do_template->sendername = "Ofuz";
        $do_template->subject = "Worklog Reminder :" . date('Y-m-d');
        $do_template->bodytext = $text;
        $do_template->bodyhtml = $do_template->bodytext;
        //echo $text.'<br />';
        $values = array();
        //Use for sending email here for general users
        $emailer = new Radria_Emailer('UTF-8');
        $emailer->setEmailTemplate($do_template);
        $emailer->mergeArray($values);
        //required even if there is nothig to merge
        $emailer->addTo($email);
        $message_sent = (int) $emailer->send();
        //$emailer->cleanup();
        $text = '';
    }
} else {
    echo 'No Worklog For the Day <b>' . date('jS F Y') . '</b>';
}
/*if($message_sent==1) 
 {
     echo "Notification Sent Successfully";
 }*/
コード例 #3
0
ファイル: .Invoice.class.php プロジェクト: jacquesbagui/ofuz
 /**
  * Method to send Send Invoice Apporove/Reject Email to the Invoice Owner
  * @param $iduser -- INT
  * @param $idinvoice -- INT
  * @param $status -- STRING
  * @param $rejected_reason -- STRING
  */
 function sendInvoiceApproveReject($iduser, $idinvoice, $status, $rejected_reason = "")
 {
     $do_inv = new Invoice();
     $do_inv_user = new User();
     $do_contact = new Contact();
     $do_inv->getId($idinvoice);
     $do_inv_user->getId($iduser);
     $do_contact->getId($do_inv->idcontact);
     $total_due = $do_inv->amt_due;
     $inv_num = $do_inv->num;
     $inv_desc = $do_inv->description;
     $inv_address = nl2br($this->Only1brFirstLineBlack($do_inv->invoice_address));
     $contact_name = $do_contact->firstname . ' ' . $do_contact->lastname;
     if ($do_contact->email_address != '') {
         $contact_email = $do_contact->email_address;
     } else {
         $ContactEmail = $do_contact->getChildContactEmail();
         if ($ContactEmail->getNumRows()) {
             $contact_email = $ContactEmail->email_address;
         }
     }
     if ($contact_email == '') {
         $contact_email = '*****@*****.**';
     }
     if ($status == "Accept") {
         $email_template = new EmailTemplate("ofuz_inv_accept_confirmation");
     }
     $do_user_rel = new UserRelations();
     $invoice_url = $GLOBALS['cfg_ofuz_site_https_base'] . 'inv/' . $do_user_rel->encrypt($idinvoice) . '/' . $do_user_rel->encrypt($do_inv->idcontact);
     //$email_template->setSubject(_("Invoice #").$inv_num.' '.$inv_desc." "._("has been accepted by")." ".$contact_name);
     $email_template->setSenderName($contact_name);
     $email_template->setSenderEmail($contact_email);
     $signature = $inv_address;
     $email_data = array('name' => $contact_name, 'contact' => $contact_name, 'description' => $inv_desc, 'signature' => $signature, 'amount' => $total_due, 'num' => $inv_num, 'invoice_url' => $invoice_url, 'address' => $inv_address);
     $emailer = new Radria_Emailer();
     $emailer->setEmailTemplate($email_template);
     $emailer->mergeArray($email_data);
     $emailer->addTo($do_inv_user->email);
     $emailer->send();
 }
コード例 #4
0
 /** 
  * eventSendDiscussMessageByEmail
  * This will send an email to all the project participant 
  * Using Radria_Emailer and an email template stored in the emailtemplate table.
  * This method uses the currently open project persistant object. 
  * @param Eventcontroler
  */
 function eventSendDiscussMessageByEmail(EventControler $event_controler)
 {
     $this->setLog("\n eventSendDiscussMessageByEmail: starting (" . date("Y/m/d H:i:s"));
     try {
         $co_workers = $_SESSION["do_project"]->getProjectCoWorkers();
         // print_r($co_workers);exit;
         if ($co_workers !== false) {
             $email_template = new EmailTemplate("ofuz_project_discussion");
             $email_nudge = new EmailTemplate("ofuz_project_discussion_nudge");
             $project_task_url = $GLOBALS['cfg_ofuz_site_http_base'] . 'Task/' . $_SESSION['do_project_task']->idproject_task;
             $project_link = $GLOBALS['cfg_ofuz_site_http_base'] . 'Project/' . $_SESSION['do_project']->idproject;
             if ($event_controler->fields['document'] != '') {
                 // If a file is attached
                 $doc_link = $GLOBALS['cfg_ofuz_site_http_base'] . 'files/' . $event_controler->fields['document'];
                 $doc_text = '<br />' . _('Attachment') . ': <a href="' . $doc_link . '"> ' . $event_controler->fields['document'] . '</a>';
             } else {
                 $doc_text = '';
             }
             $message_html = nl2br(stripslashes($event_controler->fields['discuss'] . $doc_text));
             $message_txt = stripslashes($event_controler->fields['discuss'] . $doc_text);
             $email_data = array('project-name' => $_SESSION['do_project']->name, 'project-link' => $project_link, 'discussion-owner' => $_SESSION['do_User']->getFullName(), 'task_name' => $_SESSION['do_project_task']->task_description, 'task_category' => $_SESSION['do_project_task']->task_category, 'message_txt' => $message_txt, 'message_html' => $message_html, 'project-task-link' => $project_task_url);
             $do_discussion_email_setting = new DiscussionEmailSetting();
             if ($_SESSION['do_project_task']->drop_box_code < 10 || count($co_workers) > 19) {
                 foreach ($co_workers as $co_worker) {
                     $global_email_alert = $_SESSION['UserSettings']->getSettingValue('task_discussion_alert', $co_worker['idcoworker']);
                     $global_email_alert_on = true;
                     if (!$global_email_alert) {
                         $global_email_alert_on = true;
                         // means user has not set on/off in the settings and on by default
                     } else {
                         if (is_array($global_email_alert)) {
                             if ($global_email_alert["setting_value"] == 'Yes') {
                                 $global_email_alert_on = true;
                             } else {
                                 $global_email_alert_on = false;
                             }
                         }
                     }
                     //if($_SESSION['UserSettings']->global_task_discussion_alert  != 'No' && !$do_discussion_email_setting->isDiscussionAlertSet($_SESSION['do_project_task']->idproject,'Project',$co_worker['idcoworker']) ){
                     if ($global_email_alert_on && !$do_discussion_email_setting->isDiscussionAlertSet($_SESSION['do_project_task']->idproject_task, 'Project', $co_worker['idcoworker'])) {
                         $emailer = new Radria_Emailer('UTF-8');
                         $emailer->setEmailTemplate($email_template);
                         //$emailer->cleanup();
                         //$emailer->setFrom('*****@*****.**' , 'Ofuz.net');
                         $email_data['firstname'] = $co_worker['firstname'];
                         $emailer->mergeArray($email_data);
                         $this->setLog("\n Sending email to:" . $co_worker['email']);
                         $emailer->addTo($co_worker['email']);
                         $emailer->send();
                     }
                 }
             } else {
                 $co_workers_nudged = array();
                 $co_workers_nudged_emails = array();
                 foreach ($co_workers as $co_worker) {
                     if (preg_match("/@" . $co_worker['firstname'] . "/i", $event_controler->fields['discuss']) || preg_match("/@" . $co_worker['lastname'] . "/i", $event_controler->fields['discuss'])) {
                         //$co_workers_nudged[] = $co_worker;
                         $co_workers_nudged_emails[] = $co_worker['email'];
                         $this->setLog("\n Is nudged:" . $co_worker['firstname'] . " " . $co_worker['lastname'] . " " . $co_worker['email']);
                     }
                 }
                 $emailer = new Radria_Emailer('UTF-8');
                 $email_template->setSenderName($_SESSION['do_User']->getFullName());
                 $email_template->setSenderEmail($_SESSION['do_User']->email);
                 $emailer->setEmailTemplate($email_template);
                 $emailer->addCc($_SESSION['do_project_task']->getDropBoxEmail());
                 $emailer->addHeader("X-ofuz-emailer", $_SESSION['do_User']->iduser);
                 $emailer->mergeArray($email_data);
                 $this->setLog("\n Sending email to:" . $co_workers[0]['email']);
                 $someone_note_nudged = false;
                 foreach ($co_workers as $to_worker) {
                     /*
                         Check if the Co-Worker is supposed to get the email
                     */
                     $global_email_alert = $_SESSION['UserSettings']->getSettingValue('task_discussion_alert', $to_worker['idcoworker']);
                     $global_email_alert_on = true;
                     if (!$global_email_alert) {
                         $global_email_alert_on = true;
                         //means user has not set on/off in the settings and on by default
                     } else {
                         if (is_array($global_email_alert)) {
                             if ($global_email_alert["setting_value"] == 'Yes') {
                                 $global_email_alert_on = true;
                             } else {
                                 $global_email_alert_on = false;
                             }
                         }
                     }
                     /* if($_SESSION['UserSettings']->global_task_discussion_alert  != 'No' 
                        && !$do_discussion_email_setting->isDiscussionAlertSet($_SESSION['do_project_task']->idproject_task,$to_worker['idcoworker']) 
                        && !in_array($to_worker['email'], $co_workers_nudged_emails)){*/
                     if ($global_email_alert_on && !$do_discussion_email_setting->isDiscussionAlertSet($_SESSION['do_project_task']->idproject, 'Project', $to_worker['idcoworker']) && !in_array($to_worker['email'], $co_workers_nudged_emails)) {
                         $email_to = $to_worker['email'];
                         $emailer->addTo($email_to);
                         $someone_note_nudged = true;
                         break;
                     }
                 }
                 //$emailer->addTo($co_workers[0]['email']);
                 foreach ($co_workers as $cc_worker) {
                     /*
                     Check if the Co-Worker is supposed to get the email
                     */
                     $global_email_alert_on = true;
                     $global_email_alert = $_SESSION['UserSettings']->getSettingValue('task_discussion_alert', $cc_worker['idcoworker']);
                     if (!$global_email_alert) {
                         $global_email_alert_on = true;
                         //means user has not set on/off in the settings and on by default
                     } else {
                         if (is_array($global_email_alert)) {
                             if ($global_email_alert["setting_value"] == 'Yes') {
                                 $global_email_alert_on = true;
                             } else {
                                 $global_email_alert_on = false;
                             }
                         }
                     }
                     if ($email_to != $cc_worker['email']) {
                         /*  if($_SESSION['UserSettings']->global_task_discussion_alert  != 'No' 
                             && !$do_discussion_email_setting->isDiscussionAlertSet($_SESSION['do_project_task']->idproject_task,$cc_worker['idcoworker']) 
                             && !in_array($cc_worker['email'], $co_workers_nudged_emails)){*/
                         if ($global_email_alert_on && !$do_discussion_email_setting->isDiscussionAlertSet($_SESSION['do_project_task']->idproject, 'Project', $cc_worker['idcoworker']) && !in_array($cc_worker['email'], $co_workers_nudged_emails)) {
                             $emailer->addCc($cc_worker['email']);
                             $someone_note_nudged = true;
                         }
                     }
                 }
                 if ($someone_note_nudged) {
                     $emailer->send();
                 }
                 if (count($co_workers_nudged_emails) > 0) {
                     $email_nudge->setSenderName($_SESSION['do_User']->getFullName());
                     $email_nudge->setSenderEmail($_SESSION['do_User']->email);
                     $emailer_nudge = new Radria_Emailer();
                     $emailer_nudge->setEmailTemplate($email_nudge);
                     $emailer_nudge->addCc($_SESSION['do_project_task']->getDropBoxEmail());
                     $emailer_nudge->addHeader("X-ofuz-emailer", $_SESSION['do_User']->iduser);
                     $emailer_nudge->mergeArray($email_data);
                     $emailer_nudge->addTo($co_workers_nudged_emails[0]);
                     $this->setLog("\n Sending Nudge to:" . $co_workers_nudged_emails[0]);
                     for ($i = 1; $i < count($co_workers_nudged_emails); $i++) {
                         $this->setLog("\n Sending Nudge to:" . $co_workers_nudged_emails[$i]);
                         $emailer_nudge->addCc($co_workers_nudged_emails[$i]);
                     }
                     $emailer_nudge->send();
                     $emailer_nudge->cleanup();
                 }
                 $emailer->cleanup();
             }
         }
     } catch (Exception $e) {
         $this->setError('ProjectDiscuss Could not send email: ' . $e->getMessage());
     }
     $this->setLog("\n eventSendDiscussMessageByEmail: ending (" . date("Y/m/d H:i:s"));
 }
コード例 #5
0
                    $docustomer_invoice->getId($_SESSION['do_invoice']->idinvoice);
                    $email_data = array('name' => $customer_name, 'company' => $do_user_data->company, 'description' => $docustomer_invoice->desc, 'signature' => $signature, 'amount' => $paid_memebership_amount, 'num' => $docustomer_invoice->num, 'refnum' => $result['response']['id'], 'paytype' => 'Stripe', 'username' => $do_user_data->firstname, 'invoice_num' => $docustomer_invoice->num);
                    //Notify User by email about his payment
                    if (!empty($customer_email)) {
                        $emailer = new Radria_Emailer();
                        $email_template = new EmailTemplate("ofuz_inv_payment_confirmation");
                        $email_template->setSenderName($customer_name);
                        $email_template->setSenderEmail($customer_email);
                        $email_template->free();
                        $emailer->setEmailTemplate($email_template);
                        $emailer->mergeArray($email_data);
                        $emailer->addTo($customer_email);
                        print_r($emailer);
                        //$emailer->send();
                    }
                    //Email for admin
                    $doemail_template_adm = new EmailTemplate("ofuz_inv_payment_confirmation_adm");
                    $doemail_template_adm->setSenderName('Admin');
                    $doemail_template_adm->setSenderEmail($admin_email);
                    $emailer2 = new Radria_Emailer();
                    $emailer2->setEmailTemplate($doemail_template_adm);
                    $emailer2->mergeArray($email_data);
                    $emailer2->addTo($admin_email);
                    print_r($emailer);
                    //$emailer->send();
                }
            }
        }
    }
    $do_invoice->free();
}
コード例 #6
0
// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
/** 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 **/
/**
 * Auto tag for users who are in Phil's contact list
 *
 */
set_time_limit(3600);
include_once "config.php";
$do_user = new User();
$do_suspend_user = new User();
$do_user->getUserNotLoggedInWithinPeriod(60);
if ($do_user->getNumRows() > 0) {
    while ($do_user->next()) {
        if ($do_user->plan != 'free') {
            continue;
        }
        $do_suspend_user->suspendUser($do_user->iduser);
        echo 'Account suspended user :: ' . $do_user->iduser . '<br />';
        if ($do_user->iduser == 102 || $do_user->iduser == 19) {
            // Send Email To user
            $email_template = new EmailTemplate("suspend_unused_account");
            $email_data = array("firstname" => $do_user->firstname, "lastname" => $do_user->lastname);
            $emailer = new Radria_Emailer();
            $emailer->setEmailTemplate($email_template);
            $emailer->mergeArray($email_data);
            $emailer->addTo($do_user->email);
            $emailer->send();
            echo 'Email Sent to :: ' . $do_user->email . '<br />';
        }
    }
}
コード例 #7
0
$vcard .= "END:VCARD\r\n";
//echo $vcard;
$file_name = $_SESSION['public_profile_name'];
if ($send_email === true) {
    $file_path = 'contact_vcf/' . $file_name . 'vcf';
    $fh = fopen($file_path, 'w') or die("can't open file");
    fwrite($fh, $vcard);
    fclose($fh);
    $do_template = new EmailTemplate();
    $do_template->setSenderName("Ofuz.net");
    $do_template->setSenderEmail("*****@*****.**");
    $do_template->setSubject("Contact ::" . $_SESSION['do_contact']->lastname . " " . $_SESSION['do_contact']->firstname);
    //$do_template->setMessage("You have received a contact");
    $do_template->bodytext = "You have received a contact";
    $do_template->bodyhtml = nl2br($do_template->bodytext);
    $emailer = new Radria_Emailer();
    $emailer->setEmailTemplate($do_template);
    $emailer->mergeArray($email_data);
    $emailer->addTo($email_mbl);
    $vcf_file = file_get_contents($file_path);
    $at = $emailer->createAttachment($vcf_file);
    $at->type = 'text/x-vcard';
    //$at->disposition = Zend_Mime::DISPOSITION_INLINE;
    $at->encoding = Zend_Mime::ENCODING_BASE64;
    $at->filename = $file_name . '.vcf';
    try {
        $emailer->send();
        echo _('<b>Contact is sent.</b>');
        echo '<br /><a href="/profile/' . $_SESSION['public_profile_name'] . '">' . _('Go Back') . '</a>';
    } catch (Exception $e) {
        echo _('<b>Error Sending Email, Please try again.</b>');
コード例 #8
0
 /**
  * Method to send email after user registers using the invitation link
  * @param $idsender -- int
  * @param $User -- User object
  */
 function sendEmailOnCoWorkerRegistration($idsender, $User)
 {
     $do_sender_info = new User();
     $do_sender_info->getId($idsender);
     $email_template = new EmailTemplate("ofuz_coworker_registered_notification");
     $email_data = array('name' => $do_sender_info->getFullName($idsender), 'coworker_name' => $User->getFullName());
     $emailer = new Radria_Emailer();
     $emailer->setEmailTemplate($email_template);
     $emailer->mergeArray($email_data);
     $emailer->addTo($do_sender_info->email);
     $emailer->send();
 }
コード例 #9
0
 /**
  * If a task owner is changed to iduser then send and email notification to the user
  * @param integer $iduser 
  * @param Object $qobj, query object holding the data added since V- 0.6.1
  */
 function sendEmailOnTaskOwnershipChange($iduser, $qobj)
 {
     $email_id = $_SESSION['do_User']->getEmailId($iduser);
     $full_name = $_SESSION['do_User']->getFullName($iduser);
     $email_template = new EmailTemplate("ofuz_task_ownership_change");
     $project_task_url = $GLOBALS['cfg_ofuz_site_http_base'] . 'Task/' . $qobj->getData("idproject_task");
     $project_link = $GLOBALS['cfg_ofuz_site_http_base'] . 'Project/' . $qobj->getData("idproject");
     $email_data = array('project-name' => $qobj->getData("name"), 'project-link' => $project_link, 'task-name' => $qobj->getData("task_description"), 'project-task-link' => $project_task_url);
     $emailer = new Radria_Emailer();
     $emailer->setEmailTemplate($email_template);
     $email_data['firstname'] = $full_name;
     $emailer->mergeArray($email_data);
     $this->setLog("\n Sending email to:" . $email_id);
     $emailer->addTo($email_id);
     $emailer->send();
 }
コード例 #10
0
ファイル: User.class.php プロジェクト: jacquesbagui/ofuz
 /**
  * Send email for the User Object
  * @param $template -- STRING
  * @param $values -- Array
  * @return Boolean
  */
 function sendMessage($template, $values = array())
 {
     if (!is_object($template)) {
         return false;
     }
     if (empty($values)) {
         $values = $this->getValues();
     }
     $message_sent = false;
     if (strlen($this->email) > 4) {
         //Use for sending email here for general users
         $emailer = new Radria_Emailer('UTF-8');
         $emailer->setEmailTemplate($template);
         $emailer->mergeArray($values);
         //required even if there is nothig to merge
         $emailer->addTo($this->email);
         $emailer->send();
         $emailer->cleanup();
         $message_sent = true;
     } elseif ($this->fb_user_id && $this->global_fb_connected) {
         //echo 'here';
         //echo $template->subject;
         include_once 'facebook_client/facebook.php';
         include_once 'class/OfuzFacebook.class.php';
         $facebook = new Facebook(FACEBOOK_API_KEY, FACEBOOK_APP_SECRET);
         //$do_ofuz_fb =  new OfuzFacebook($facebook);
         try {
             //$facebook->api_client->notifications_sendEmail($this->fb_user_id, $template->subject,'', $template->bodyhtml);
             $message_sent = true;
         } catch (Exception $e) {
         }
     }
     if ($message_sent) {
         return true;
     } else {
         return false;
     }
 }