コード例 #1
0
ファイル: actions.class.php プロジェクト: yasirgit/afids
 public function executeAjaxSave(sfWebRequest $request)
 {
     $template = trim($request->getParameter('template'));
     if (empty($template)) {
         return $this->renderText('Please specify template name');
     }
     $email_template = new EmailTemplate();
     $email_template->setName($template);
     $email_template->setSubject($request->getParameter('subject'));
     $email_template->setSenderEmail($request->getParameter('email'));
     $email_template->setSenderName($request->getParameter('name'));
     $email_template->setBody($request->getParameter('body'));
     $email_template->setPersonId($this->getUser()->getId());
     $email_template->save();
     return $this->renderText('#New template have successfully saved!');
 }
コード例 #2
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);
     }
 }
コード例 #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
$ContactWebsite = $_SESSION['do_contact']->getChildContactWebsite();
if ($ContactWebsite->getNumRows()) {
    while ($ContactWebsite->next()) {
        $vcard .= "URL;TYPE=" . $ContactWebsite->website_type . ":" . $ContactWebsite->website . "\r\n";
    }
}
$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';
コード例 #7
0
 /**
  * Method to send the Co-Worker invitation email
  * @param $idcoworker -- int
  */
 function sendCoWorkerInvitationEmail($idcoworker)
 {
     $email_template = new EmailTemplate("ofuz_coworker_add_notification");
     $email_template->setSenderName($_SESSION['do_User']->getFullName());
     $email_template->setSenderEmail($_SESSION['do_User']->email);
     $coworker_url = $GLOBALS['cfg_ofuz_site_http_base'] . 'co_workers.php';
     $email_data = array('coworker-name' => $_SESSION['do_User']->getFullName($idcoworker), 'sender-name' => $_SESSION['do_User']->getFullName(), 'coworker_url' => $coworker_url);
     $emailer = new Radria_Emailer();
     $emailer->setEmailTemplate($email_template);
     $emailer->mergeArray($email_data);
     $emailer->addTo($_SESSION['do_User']->getEmailId($idcoworker));
     $emailer->send();
 }