Changeset 1214


Ignore:
Timestamp:
02/22/10 15:30:59 (3 years ago)
Author:
nick_ramsay
Message:

[Branch 1.2] New EmailFunctions class which channels all mail operations through one output. A flick of the switch and you can write email content to a log file or the screen instead of sending it (great for developers). Note that this feature won't get any use until plugins are updated to use it.

Location:
branches/1.2
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/Hotaru.php

    r1213 r1214  
    11921192    public function openLog($type = 'debug', $mode = 'a+') 
    11931193    { 
    1194         $this->debug->openLog($this, $type, $mode); 
     1194        $this->debug->openLog($type, $mode); 
    11951195    } 
    11961196     
     
    12031203    public function writeLog($type = 'error', $string = '') 
    12041204    { 
    1205         $this->debug->writeLog($this, $type, $string); 
     1205        $this->debug->writeLog($type, $string); 
    12061206    } 
    12071207     
     
    12141214    public function closeLog($type = 'error') 
    12151215    { 
    1216         $this->debug->closeLog($this, $type); 
     1216        $this->debug->closeLog($type); 
    12171217    } 
    12181218     
     
    20292029        return $widget->getPluginFromFunction($this, $function); 
    20302030    } 
     2031     
     2032     
     2033/* ************************************************************* 
     2034 * 
     2035 *  EMAIL FUNCTIONS 
     2036 * 
     2037 * *********************************************************** */ 
     2038  
     2039    /** 
     2040     * Send emails 
     2041     * 
     2042     * @param string $to - defaults to SITE_EMAIL 
     2043     * @param string $subject - defaults to "No Subject"; 
     2044     * @param string $body - returns false if empty 
     2045     * @param string $headers default is "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
     2046     * @param string $type - default is "email", but you can write to a "log" file, print to "screen" or "return" an array of the content 
     2047     * @return array|false - only if $type = "return" 
     2048     */ 
     2049    public function email($to = '', $subject = '', $body = '', $headers = '', $type = 'email') 
     2050    { 
     2051        require_once(LIBS . 'EmailFunctions.php'); 
     2052        $emailFunctions = new EmailFunctions($to, $subject, $body, $headers, $type); 
     2053        $emailFunctions->type = $type; 
     2054        return $emailFunctions->doEmail(); 
     2055    } 
    20312056} 
    20322057?> 
  • branches/1.2/libs/Debug.php

    r961 r1214  
    5757     * @link http://php.net/manual/en/function.fopen.php 
    5858     */ 
    59     public function openLog($h, $type = 'debug', $mode = 'a+') 
     59    public function openLog($type = 'debug', $mode = 'a+') 
    6060    { 
    6161        $this->log[$type] = CACHE . "debug_logs/" . $type . ".txt"; 
     
    7878     * @param string $type "error", "speed", etc. 
    7979     */ 
    80     public function writeLog($h, $type = 'debug', $string = '') 
     80    public function writeLog($type = 'debug', $string = '') 
    8181    { 
    8282        if ($string) { 
     
    9292     * @param string $type "speed", "error", etc. 
    9393     */ 
    94     public function closeLog($h, $type = 'debug') 
     94    public function closeLog($type = 'debug') 
    9595    { 
    9696        if (isset($this->fh[$type])) { fclose($this->fh[$type]); } 
  • branches/1.2/libs/extensions/ezSQL/mysql/ez_sql_mysql.php

    r1213 r1214  
    245245                     
    246246                    $body .= "If you need help, visit the forums at http://hotarucms.org\r\n"; 
    247                     mail(SITE_EMAIL, $subject, $body, $headers); 
     247                     
     248                    // we can avoid using the $h object (which we might not have) by calling EmailFunctions directly. 
     249                    require_once(LIBS . 'EmailFunctions.php'); 
     250                    $emailFunctions = new EmailFunctions(SITE_EMAIL, $subject, $body, $headers); 
     251                    $emailFunctions->doEmail(); 
    248252                } 
    249253 
Note: See TracChangeset for help on using the changeset viewer.