Changeset 219 for trunk/global.php


Ignore:
Timestamp:
May 27, 2009, 1:17:11 PM (15 years ago)
Author:
george
Message:
  • Přidáno: Podpora pro odesílání emailů o měsíčních platbách přes frontu emailů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/global.php

    r208 r219  
    3737    $this->Modules[get_class($Module)] = $Module;
    3838  }
     39 
     40  function AddEmailToQueue($Address, $Subject, $Content, $Headers = '')
     41  {
     42    $this->Database->insert('EmailQueue', array('Address' => $Address, 'Subject' => $Subject, 'Content' => $Content, 'Time' => 'NOW()', 'Headers' => $Headers));
     43  }
     44 
     45  function MailUTF8($To, $Subject = '(No subject)', $Message = '', $Header = '')
     46  {
     47    $Header = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n".$Header;
     48    mail($To, '=?UTF-8?B?'.base64_encode($Subject).'?=', $Message, $Header);
     49  }
     50
     51  function ProcessEmailQueue()
     52  {
     53    $DbResult = $this->Database->select('EmailQueue', '*', 'Archive=0');
     54    while($DbRow = $DbResult->fetch_assoc())
     55    {     
     56      $this->MailUTF8($DbRow['Address'], $DbRow['Subject'], $DbRow['Content'], $DbRow['Headers']);
     57      //echo('mail('.$DbRow['Address'].', '.$DbRow['Subject'].', '.$DbRow['Content'].', FromUTF8('.$DbRow['Headers'].', \'iso2\'));');
     58      $this->Database->update('EmailQueue', 'Id='.$DbRow['Id'], array('Archive' => 1));
     59      $this->Modules['Log']->NewRecord('System', 'SendEmail', $DbRow['Id']);
     60    }   
     61  }
    3962}
    4063
    4164$System = new System();
    4265$System->Config = $Config;
     66$System->Database = &$Database;
    4367include_once('log.php');
    4468$System->AddModule(new Log());
     
    119143function ToCzfreeIp($Host)
    120144{
    121     $Parts = explode('.', $Host['external_ip']);
    122     if($Host['name'] == 'CENTRALA') return('10.144.1.1');
    123       else return('10.144.200.'.$Parts[3]);
     145  $Parts = explode('.', $Host['external_ip']);
     146  if($Host['name'] == 'CENTRALA') return('10.144.1.1');
     147    else return('10.144.200.'.$Parts[3]);
    124148}
    125149
Note: See TracChangeset for help on using the changeset viewer.