Changeset 526 for trunk/Common/System.php
- Timestamp:
- Apr 21, 2013, 10:23:56 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/System.php
r525 r526 1 1 <?php 2 3 include_once(dirname(__FILE__).'/EmailQueue.php'); 2 4 3 5 class System … … 13 15 var $PathItems; 14 16 var $RootURLFolder; 17 var $EmailQueue; 15 18 16 19 function __construct() … … 21 24 $this->Database = new Database(); 22 25 $this->FormManager = new FormManager($this->Database); 26 $this->EmailQueue = new EmailQueue($this); 23 27 } 24 28 … … 79 83 } 80 84 81 function AddEmailToQueue($To, $Subject, $Content, $From, $AttachmentFileId = '')82 {83 $Values = array('To' => $To,84 'Subject' => $Subject, 'Content' => $Content, 'Time' => 'NOW()',85 'From' => $From);86 if($AttachmentFileId != '') $Values['AttachmentFile'] = $AttachmentFileId;87 $this->Database->insert('EmailQueue', $Values);88 }89 90 function ProcessEmailQueue()91 {92 $Output = '';93 $DbResult = $this->Database->select('EmailQueue', '*', 'Archive=0');94 while($DbRow = $DbResult->fetch_assoc())95 {96 $Mail = new Mail();97 $Mail->AddToCombined($DbRow['To']);98 $Mail->Subject = $DbRow['Subject'];99 $Mail->From = $DbRow['From'];100 $Mail->AddBody(strip_tags($DbRow['Content']), 'text/plain');101 $Mail->AddBody($DbRow['Content'], 'text/html');102 if($DbRow['AttachmentFile'] != '')103 {104 $DbResult2 = $this->Database->select('File', '*', 'Id='.$DbRow['AttachmentFile']);105 while($File = $DbResult2->fetch_assoc())106 $Mail->AttachFile($this->Config['Web']['FileRootFolder'].$File['DrivePath'], $File['MimeType']);107 }108 $Mail->Send();109 $this->Database->update('EmailQueue', 'Id='.$DbRow['Id'], array('Archive' => 1));110 $this->ModuleManager->Modules['Log']->NewRecord('System', 'SendEmail', $DbRow['Id']);111 $Output .= 'To: '.$DbRow['To'].' Subject: '.$DbRow['Subject'].'<br />';112 }113 return($Output);114 }115 116 85 function HumanDate($Time) 117 86 {
Note:
See TracChangeset
for help on using the changeset viewer.