Changeset 1305


Ignore:
Timestamp:
03/13/10 11:22:58 (3 years ago)
Author:
nick_ramsay
Message:

[Trunk] Hotaru 1.1.2

Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Hotaru.php

    r1304 r1305  
    4343    protected $includes;                        // for CSS/JavaScript includes 
    4444    protected $debug;                           // Debug object 
     45    protected $email;                           // Email object 
    4546     
    4647    // page info 
     
    20632064    public function email($to = '', $subject = '', $body = '', $headers = '', $type = 'email') 
    20642065    { 
    2065         require_once(LIBS . 'EmailFunctions.php'); 
    2066         $emailFunctions = new EmailFunctions($to, $subject, $body, $headers, $type); 
    2067         $emailFunctions->type = $type; 
    2068         return $emailFunctions->doEmail(); 
     2066        if (!is_object($this->email)) {  
     2067            require_once(LIBS . 'EmailFunctions.php'); 
     2068            $this->email = new EmailFunctions(); 
     2069        } 
     2070         
     2071        $this->email->to = $to; 
     2072        $this->email->subject = $subject; 
     2073        $this->email->body = $body; 
     2074        $this->email->headers = $headers; 
     2075        $this->email->type = $type; 
     2076         
     2077        return $this->email->doEmail(); 
    20692078    } 
    20702079} 
  • trunk/content/admin_language.php

    r1108 r1305  
    120120 
    121121/* Settings */ 
    122 $lang['admin_settings_update_success'] = "Updated successfully."; 
     122$lang['admin_settings_update_success'] = "Updated successfully"; 
     123$lang['admin_settings_update_failure'] = "Error saving settings"; 
    123124$lang["admin_settings_theme_activate_success"] = "Theme was activated successfully."; 
    124125$lang["admin_theme_settings"] = "Settings"; 
  • trunk/content/admin_themes/admin_default/css/style.css

    r1081 r1305  
    149149.green { 
    150150        background-color: #99FF66 !important; 
     151} 
     152 
     153.yellow { 
     154        background-color: #fbe760 !important; 
    151155} 
    152156 
  • trunk/content/plugins

  • trunk/content/plugins/admin_email/admin_email.php

    r1190 r1305  
    154154        echo "<meta http-equiv='Refresh' content='0; URL=" . $url . "' />"; 
    155155        echo $h->lang["admin_email_redirecting"]; 
    156         ob_flush(); 
     156        @ob_flush(); 
    157157        flush(); 
    158158        exit; 
     
    214214            $from = SITE_EMAIL; // Send_From_Email is admin 
    215215            $to = $recipient->user_email;   
    216             $headers = "From: " . $from . "\r\nReply-To: " . $from . "\r\nX-Priority: 3\r\n"; 
    217216             
    218217            if ($send_self && ($h->currentUser->id == $recipient->user_id)) { 
    219218                echo $h->lang["admin_email_sent_to"] . "<i>" . $to . "</i><br />\n"; 
    220                 @mail($to, $subject, $message, $headers);   // This sends an email to the requesting admin 
     219                $h->email($to, $subject, $message);   // This sends an email to the requesting admin 
    221220            } elseif ($simulation) { 
    222221                echo $h->lang["admin_email_fake_sending"] . $to . "<br />\n"; 
    223222            } else { 
    224223                echo $h->lang["admin_email_sent_to"] . $to . "<br />\n"; 
    225                 @mail($to, $subject, $message, $headers);   // This does the actual sending! 
    226             } 
    227             ob_flush(); 
     224                $h->email($to, $subject, $message);   // This does the actual sending! 
     225            } 
     226            @ob_flush(); 
    228227            flush(); 
    229228            sleep(1); // one second pause between sending emails 
  • trunk/content/plugins/comments/comments.php

    r1248 r1305  
    33 * name: Comments 
    44 * description: Enables logged-in users to comment on posts 
    5  * version: 1.6 
     5 * version: 1.7 
    66 * folder: comments 
    77 * class: Comments 
     
    148148        } 
    149149         
    150         if ($h->pageName == 'comments') { 
     150        if ($h->pageName == 'comments') 
     151        { 
     152            // set current comment and responses to pending: 
     153            if ($h->cage->get->getAlpha('action') == 'setpending') {  
     154             
     155                // before setting pending, we need to be certain this user has permission: 
     156                if ($h->currentUser->loggedIn && $h->currentUser->getPermission('can_set_comments_pending') == 'yes') { 
     157                    $cid = $h->cage->get->testInt('cid'); // comment id 
     158                    $comment = $h->comment->getComment($h, $cid); 
     159                    $h->comment->readComment($h, $comment); // read comment 
     160                    $h->comment->status = 'pending'; // set to pending 
     161                    $h->comment->editComment($h);  // update this comment 
     162 
     163                    $h->comment->postId = $h->cage->get->testInt('pid');  // post id 
     164                    $h->comment->setPendingCommentTree($h,$cid);   // set all responses to 'pending', too. 
     165                     
     166                    // redirect back to thread: 
     167                    $h->post = new Post(); 
     168                    $h->readPost($h->comment->postId); 
     169                    header("Location: " . $h->url(array('page'=>$h->post->id)));    // Go to the post 
     170                    die(); 
     171                } 
     172            } 
     173             
     174            // delete current comment and responses: 
     175            if ($h->cage->get->getAlpha('action') == 'delete') {  
     176             
     177                // before deleting a comment, we need to be certain this user has permission: 
     178                if ($h->currentUser->loggedIn && $h->currentUser->getPermission('can_delete_comments') == 'yes') { 
     179                    $cid = $h->cage->get->testInt('cid'); // comment id 
     180                    $comment = $h->comment->getComment($h, $cid); 
     181                    $h->comment->readComment($h, $comment); // read comment 
     182                     
     183                    $h->pluginHook('comments_delete_comment'); 
     184                     
     185                    $h->comment->deleteComment($h, $cid); // delete this comment 
     186                    $h->comment->deleteCommentTree($h, $cid);   // delete all responses, too. 
     187                     
     188                    $h->clearCache('html_cache', false); // clear HTML cache to refresh Comments and Activity widgets 
     189                     
     190                    $h->comment->postId = $h->cage->get->testInt('pid');  // post id 
     191                     
     192                    // redirect back to thread: 
     193                    $h->readPost($h->comment->postId); 
     194                    header("Location: " . $h->url(array('page'=>$h->comment->postId)));    // Go to the post 
     195                    die(); 
     196                } 
     197            } 
     198             
     199            // FOR THE COMMENTS PAGE: 
    151200            $h->pageTitle = $h->lang['comments']; 
    152201            if ($h->cage->get->keyExists('user')) { 
     
    257306                     
    258307                } 
    259                  
    260                 // set current comment and responses to pending: 
    261                 if ($h->cage->get->getAlpha('action') == 'setpending') {  
    262                  
    263                     // before setting pending, we need to be certain this user has permission: 
    264                     if ($h->currentUser->getPermission('can_set_comments_pending') == 'yes') { 
    265                         $cid = $h->cage->get->testInt('cid'); // comment id 
    266                         $comment = $h->comment->getComment($h, $cid); 
    267                         $h->comment->readComment($h, $comment); // read comment 
    268                         $h->comment->status = 'pending'; // set to pending 
    269                         $h->comment->editComment($h);  // update this comment 
    270      
    271                         $h->comment->postId = $h->cage->get->testInt('pid');  // post id 
    272                         $h->comment->setPendingCommentTree($h,$cid);   // set all responses to 'pending', too. 
    273                          
    274                         // redirect back to thread: 
    275                         $h->post = new Post(); 
    276                         $h->readPost($h->comment->postId); 
    277                         header("Location: " . $h->url(array('page'=>$h->post->id)));    // Go to the post 
    278                         die(); 
    279                     } 
    280                 } 
    281                  
    282                 // delete current comment and responses: 
    283                 if ($h->cage->get->getAlpha('action') == 'delete') {  
    284                  
    285                     // before deleting a comment, we need to be certain this user has permission: 
    286                     if ($h->currentUser->getPermission('can_delete_comments') == 'yes') { 
    287                         $cid = $h->cage->get->testInt('cid'); // comment id 
    288                         $comment = $h->comment->getComment($h, $cid); 
    289                         $h->comment->readComment($h, $comment); // read comment 
    290                          
    291                         $h->pluginHook('comments_delete_comment'); 
    292                          
    293                         $h->comment->deleteComment($h, $cid); // delete this comment 
    294                         $h->comment->deleteCommentTree($h, $cid);   // delete all responses, too. 
    295                          
    296                         $h->clearCache('html_cache', false); // clear HTML cache to refresh Comments and Activity widgets 
    297                          
    298                         $h->comment->postId = $h->cage->get->testInt('pid');  // post id 
    299                          
    300                         // redirect back to thread: 
    301                         $h->readPost($h->comment->postId); 
    302                         header("Location: " . $h->url(array('page'=>$h->comment->postId)));    // Go to the post 
    303                         die(); 
    304                     } 
    305                 } 
    306      
    307308            } 
    308309             
  • trunk/content/plugins/comments/readme.txt

    r1248 r1305  
    1515Changelog 
    1616--------- 
     17v.1.7 2010/03/11 - Nick - Fix for a previous change that broke the set pending and delete links within comments. 
    1718v.1.6 2010/02/26 - Nick - Adds link to profile navigation; Email changed to go through Hotaru's "email" function  
    1819v.1.5 2010/02/23 - Nick - Shows messages for moderated comments: "Awaiting approval", "Exceeded Daily Limit", etc. 
  • trunk/content/plugins/rss_show/readme.txt

    r1081 r1305  
    3232Changelog 
    3333--------- 
     34v.0.8 2010/03/11 - Nick - Added some sanitation to feed output 
    3435v.0.7 2010/01/04 - Nick - Updates for compatibility with Hotaru 1.0 
    3536v.0.6 2009/11/04 - Nick - Updated install function for easier upgrading 
  • trunk/content/plugins/rss_show/rss_show.php

    r1108 r1305  
    33 * name: RSS Show 
    44 * description: Adds links in a widget block to the latest posts from a specified RSS feed. 
    5  * version: 0.7 
     5 * version: 0.8 
    66 * folder: rss_show 
    77 * class: RssShow 
     
    8787                            $output .= "<li class='rss_show_feed_item'>"; 
    8888                            $output .= "<span class='rss_show_title'>"; 
    89                             $output .= "<a href='" . $item->get_permalink() . "'>" . $item->get_title() . "</a></span>\n"; 
     89                            $output .= "<a href='" . $item->get_permalink() . "'>" . sanitize($item->get_title(), 'tags') . "</a></span>\n"; 
    9090                             
    9191                            // AUTHOR / DATE 
     
    9595                                    $output .= " by "; 
    9696                                        foreach ($item->get_authors() as $author)  { 
    97                                     $output .= $author->get_name();  
     97                                    $output .= sanitize($author->get_name(), 'ents');  
    9898                                } 
    9999                            } 
     
    106106                        // SUMMARY 
    107107                        if ($settings['content'] == 'summaries') { 
    108                             $output .= "<p class='rss_show_content'>" . substr(strip_tags($item->get_content()), 0, 300); 
     108                            $output .= "<p class='rss_show_content'>" . substr(sanitize($item->get_content(), 'tags'), 0, 300); 
    109109                            $output .= "... "; 
    110                             $output .= "<small><a href='" . $item->get_permalink() . "' title='" . $item->get_title() . "'>" . $h->lang["rss_show_read_more"] . "</a>"; 
     110                            $output .= "<small><a href='" . $item->get_permalink() . "' title='" . sanitize($item->get_title(), 'tags') . "'>" . $h->lang["rss_show_read_more"] . "</a>"; 
    111111                            $output .= "</small></p>"; 
    112112                        } 
  • trunk/content/plugins/sb_base/libs/SbBaseFunctions.php

    r1234 r1305  
    129129            $end = date('YmdHis', strtotime($upcoming_duration)); // should be negative 
    130130            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    131             $h->vars['orderby'] = "post_votes_up DESC"; 
     131            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    132132        }  
    133133        elseif ($type == 'top-24-hours') 
     
    138138            $end = date('YmdHis', strtotime("-1 day")); 
    139139            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    140             $h->vars['orderby'] = "post_votes_up DESC"; 
     140            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    141141        }  
    142142        elseif ($type == 'top-48-hours')  
     
    147147            $end = date('YmdHis', strtotime("-2 days")); 
    148148            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    149             $h->vars['orderby'] = "post_votes_up DESC"; 
     149            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    150150        }  
    151151        elseif ($type == 'top-7-days') 
     
    156156            $end = date('YmdHis', strtotime("-7 days")); 
    157157            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    158             $h->vars['orderby'] = "post_votes_up DESC"; 
     158            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    159159        }  
    160160        elseif ($type == 'top-30-days') 
     
    165165            $end = date('YmdHis', strtotime("-30 days")); 
    166166            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    167             $h->vars['orderby'] = "post_votes_up DESC"; 
     167            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    168168        }  
    169169        elseif ($type == 'top-365-days') 
     
    174174            $end = date('YmdHis', strtotime("-365 days")); 
    175175            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    176             $h->vars['orderby'] = "post_votes_up DESC"; 
     176            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    177177        }  
    178178        elseif ($type == 'top-all-time') 
     
    180180            // Filters page to "top" stories in order of votes 
    181181            $h->vars['filter']['post_status = %s'] = 'top';  
    182             $h->vars['orderby'] = "post_votes_up DESC"; 
     182            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    183183        }  
    184184        elseif ($type == 'top') 
  • trunk/content/plugins/user_rankings/user_rankings.php

    r1304 r1305  
    177177                $output .= "<a class='user_rankings_" . $css . "_name' href='" . $h->url(array('user' => $user->name)) . "'>" . $user->name . "</a> \n"; 
    178178            } 
     179             
     180            $h->vars['user_rankings_output'] = ""; 
     181            $h->pluginHook('user_rankings_item', '', array('points' => $points, 'css' => $css)); 
     182            $output .= $h->vars['user_rankings_output']; 
    179183             
    180184            $output .= "<div class='user_rankings_" . $css . "_points'>" . $points . "</div>\n"; 
  • trunk/content/plugins/users/libs/UserFunctions.php

    r1234 r1305  
    114114            $body .= $h->lang['userfunctions_notifymods_body_user_role'] . $user->role . $next_line; 
    115115            $body .= $h->lang['userfunctions_notifymods_body_user_email'] . $user->email . $next_line; 
    116             $body .= $h->lang['userfunctions_notifymods_body_user_account'] . $h->url(array('page'=>'account', 'user'=>$user->name)) . $next_line; 
     116            $body .= $h->lang['userfunctions_notifymods_body_user_account'] . BASEURL . "index.php?page=account&user=" . $user->name . $next_line; 
    117117            $body .= $h->lang['userfunctions_notifymods_body_user_management'] . BASEURL . "admin_index.php?search_value=" . $user->name . "&plugin=user_manager&page=plugin_settings&type=search"; 
    118118             
  • trunk/content/plugins/vote/vote.php

    r1234 r1305  
    206206                    } else { 
    207207                        $h->changePostStatus('buried'); 
     208                        $h->clearCache('html_cache', false); 
    208209                        $h->pluginHook('vote_post_status_buried'); // Akismet hooks in here to report the post as spam 
    209210                    } 
  • trunk/content/themes/default/css/style.css

    r1304 r1305  
    7878 
    7979.green    { background-color: #99FF66; } 
     80.yellow   { background-color: #fbe760; } 
    8081.red      { background-color: #FF6A55; color: #ffffff; } 
    8182.bold_red { color: red; font-weight: bold; } 
  • trunk/hotaru_settings_default.php

    r1081 r1305  
    4141// Paths 
    4242define('BASEURL', "http://www.mysite.com/");    // e.g. http://www.mysite.com/ 
    43  
    4443                                                // Needs trailing slash (/) 
    4544 
  • trunk/install/install_tables.php

    r1304 r1305  
    371371        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
    372372        $db->query($db->prepare($sql, 'DEBUG', 'false', 'false', '')); 
     373         
     374        // SMTP on 
     375        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     376        $db->query($db->prepare($sql, 'SMTP_ON', 'false', 'false', 'Email auth')); 
     377         
     378        // SMTP host 
     379        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     380        $db->query($db->prepare($sql, 'SMTP_HOST', 'mail.example.com', 'mail.example.com', '')); 
     381         
     382        // SMTP port 
     383        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     384        $db->query($db->prepare($sql, 'SMTP_PORT', '25', '25', '')); 
     385         
     386        // SMTP username 
     387        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     388        $db->query($db->prepare($sql, 'SMTP_USERNAME', '', '', '')); 
     389         
     390        // SMTP password 
     391        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     392        $db->query($db->prepare($sql, 'SMTP_PASSWORD', '', '', '')); 
    373393    } 
    374394     
  • trunk/install/upgrade.php

    r1304 r1305  
    346346     
    347347    // 1.1 to 1.1.2 
    348     if ($old_version == "1.1.1") { $old_version = "1.1.2"; } // update "old version" for next set of upgrades 
     348    if ($old_version == "1.1.1") {  
     349     
     350        // SMTP on 
     351        $sql = "INSERT INTO " . TABLE_SETTINGS . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     352        $h->db->query($h->db->prepare($sql, 'SMTP_ON', 'false', 'false', 'Email auth')); 
     353         
     354        // SMTP host 
     355        $sql = "INSERT INTO " . TABLE_SETTINGS . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     356        $h->db->query($h->db->prepare($sql, 'SMTP_HOST', 'mail.example.com', 'mail.example.com', '')); 
     357         
     358        // SMTP port 
     359        $sql = "INSERT INTO " . TABLE_SETTINGS . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     360        $h->db->query($h->db->prepare($sql, 'SMTP_PORT', '25', '25', '')); 
     361         
     362        // SMTP username 
     363        $sql = "INSERT INTO " . TABLE_SETTINGS . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     364        $h->db->query($h->db->prepare($sql, 'SMTP_USERNAME', '', '', '')); 
     365         
     366        // SMTP password 
     367        $sql = "INSERT INTO " . TABLE_SETTINGS . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     368        $h->db->query($h->db->prepare($sql, 'SMTP_PASSWORD', '', '', '')); 
     369         
     370        // update "old version" for next set of upgrades 
     371        $old_version = "1.1.2";  
     372    } 
    349373     
    350374    // Update Hotaru version number to the database (referred to when upgrading) 
  • trunk/libs/AdminPages.php

    r1120 r1305  
    134134            foreach ($loaded_settings as $setting_name) { 
    135135                if ($h->cage->post->keyExists($setting_name->settings_name)) { 
    136                     $setting_value = $h->cage->post->noTags($setting_name->settings_name); 
     136                    $setting_value = $h->cage->post->getRaw($setting_name->settings_name); 
    137137                    if (!$error && $setting_value && $setting_value != $setting_name->settings_value) { 
    138138                        $this->adminSettingUpdate($h, $setting_name->settings_name, $setting_value); 
     
    141141                        if (!$setting_value) { 
    142142                            // empty value  
    143                             $error = 1;  
    144                         } else {  
    145                             // No change to the value 
    146                             $error = 0;  
     143                            $error = 1; 
    147144                        } 
    148145                    } 
    149146                } else { 
    150                     // error, setting empty. 
    151                     $error = 1; 
     147                    // values that are allowed to be empty: 
     148                    $exempt = array('SMTP_USERNAME', 'SMTP_PASSWORD'); 
     149                    if (!in_array($setting_name->settings_name, $exempt)) {  
     150                        // otherwise flag as an error: 
     151                        $error = 1; 
     152                    }  
    152153                } 
    153154            } 
  • trunk/libs/EmailFunctions.php

    r1304 r1305  
    2828{ 
    2929    protected $to           = ''; 
    30     protected $subject      = ''; 
     30    protected $from         = ''; 
     31    protected $subject      = 'No Subject'; 
    3132    protected $body         = ''; 
    3233    protected $headers      = ''; 
    33     protected $type         = ''; 
     34    protected $type         = 'email'; 
     35    private $smtp   = NULL; 
    3436     
    3537    /** 
     
    5052        return $this->$var; 
    5153    } 
    52      
     54 
    5355     
    5456    /** 
    55      * Constructor 
    56      * 
    57      * @param string $to - defaults to SITE_EMAIL 
    58      * @param string $subject - defaults to "No Subject"; 
    59      * @param string $body - returns false if empty 
    60      * @param string $headers e.g. "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    61      * @param string $type - default is "email", but you can write to a "log" file, print to "screen" or "return" the content 
    62      * @return array - only if $type = "return" 
    63      */ 
    64     public function __construct($to = '', $subject = '', $body = '', $headers = '', $type = 'email') 
    65     { 
    66         $this->to = $to; 
    67         $this->subject = $subject; 
    68         $this->body = $body; 
    69         $this->headers = $headers; 
    70         $this->type = $type; 
    71          
    72         if (!$this->to) { $this->to = SITE_EMAIL; } 
    73         if (!$this->subject) { $this->subject = "No Subject"; } 
    74         if (!$this->body) { return false; } 
    75         if (!$this->headers) { $this->headers = "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; } 
    76     } 
    77      
    78     /** 
    79      * Send emails 
    80      * 
    81      * @param string $to - defaults to SITE_EMAIL 
    82      * @param string $subject - defaults to "No Subject"; 
    83      * @param string $body - returns false if empty 
    84      * @param string $headers default is "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    85      * @param string $type - default is "email", but you can write to a "log" file, print to "screen" or "return" an array of the content 
    86      * @return array - only if $type = "return" 
     57     * Send emails - Note: properties must be set before calling this function 
    8758     */ 
    8859    public function doEmail() 
    89     { 
    90         // OVERRIDE THE TYPE HERE BY UNCOMMENTING THE LINE BELOW - Very handy when developing offline with WampServer, etc. 
    91         // $this->type = 'log'; // this will write all emails to email_log.txt in the cache folder INSTEAD of sending them. 
     60    {         
     61        if (!$this->body) { return false; } 
     62         
     63        if (!$this->to) { $this->to = SITE_NAME . ' <' . SITE_EMAIL . '>'; } 
     64        if (!$this->from) { $this->from = SITE_NAME . ' <' . SITE_EMAIL . '>'; } 
     65         
     66        if (SMTP_ON == 'true') { 
     67            // note: this overwrites headers passed to this function: 
     68            $this->headers = array ('From' => $this->from, 'To' => $this->to, 'Subject' => $this->subject); 
     69        } else { 
     70            // if not using SMTP and no headers passed to this function, use default 
     71            if (!$this->headers) {  
     72                $this->headers = "From: " . $this->from . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
     73            } 
     74        } 
    9275         
    9376        switch ($this->type) 
     
    11396                break; 
    11497            default: 
    115                 $return_path = "-f " . SITE_EMAIL; 
    116                 mail($this->to, $this->subject, $this->body, $this->headers, $return_path); 
     98                if (SMTP_ON == 'true') { 
     99                    $this->doSmtpEmail(); 
     100                } else { 
     101                    $return_path = "-f " . SITE_EMAIL; 
     102                    mail($this->to, $this->subject, $this->body, $this->headers, $return_path); 
     103                } 
    117104        } 
     105    } 
     106     
     107     
     108    /** 
     109     * Send email using SMTP authentication and SSL Encryption 
     110     */ 
     111    public function doSmtpEmail() 
     112    { 
     113        //  Only create a new smtp object if we don't already have one: 
     114        if (!is_object($this->smtp)) 
     115        { 
     116            $smtp_array = array ( 
     117                'host' => SMTP_HOST,  
     118                'port' => SMTP_PORT, 
     119                'auth' => true,  
     120                'username' => SMTP_USERNAME,  
     121                'password' => SMTP_PASSWORD 
     122            ); 
     123 
     124            require_once "Mail.php"; 
     125            $this->smtp = Mail::factory('smtp', $smtp_array); 
     126        } 
     127 
     128        $mail = $this->smtp->send($this->to, $this->headers, $this->body); 
     129 
     130         
     131        if (PEAR::isError($mail)) { 
     132            echo("<p>" . $mail->getMessage() . "</p>"); 
     133            exit; 
     134        }  
    118135    } 
    119136} 
  • trunk/libs/Feeds.php

    r1081 r1305  
    7979                 
    8080                // Title 
    81                 $output .= "<a href='" . $item->get_permalink() . "'>" . $item->get_title() . "</a><br />"; 
     81                $output .= "<a href='" . $item->get_permalink() . "'>" . sanitize($item->get_title(), 'tags') . "</a><br />"; 
    8282                 
    8383                if ($item_count < $items_with_content) 
     
    9696                     
    9797                    // Content 
    98                     $output .= substr(strip_tags($item->get_content()), 0, $max_chars); 
     98                    $output .= substr(sanitize($item->get_content(), 'tags'), 0, $max_chars); 
    9999                    $output .= "... "; 
    100100                     
    101101                    // Read more 
    102                     $output .= "<small><a href='" . $item->get_permalink() . "' title='" . $item->get_title() . "'>[" . $lang["admin_news_read_more"] . "]</a>"; 
     102                    $output .= "<small><a href='" . $item->get_permalink() . "' title='" . sanitize($item->get_title(), 'tags') . "'>[" . $lang["admin_news_read_more"] . "]</a>"; 
    103103                    $output .= "</small>"; 
    104104                } 
  • trunk/libs/InspektExtras.php

    r1234 r1305  
    163163    protected function inspekt($text) 
    164164    { 
    165         $config = array('safe' => 1); 
     165        /*  make_tag_strict is OFF because we don't want to convert <u>, etc. to css  
     166            otherwise the strip_tags won't be able to allow them when requested in sanitize(). */ 
     167        $config = array('safe' => 1, 'make_tag_strict' => 0); 
    166168         
    167169        // Allow plugins to alter the value of $config/ 
  • trunk/libs/extensions/ezSQL/mysql/ez_sql_mysql.php

    r1234 r1305  
    226226            { 
    227227                if (defined(DEBUG) && (DEBUG == 'true')) { 
    228                     $headers = "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    229228                    $subject = SITE_NAME . " Database Error"; 
    230229                    $body = SITE_NAME . " Database Error\r\n\r\n"; 
     
    248247                    // we can avoid using the $h object (which we might not have) by calling EmailFunctions directly. 
    249248                    require_once(LIBS . 'EmailFunctions.php'); 
    250                     $emailFunctions = new EmailFunctions(SITE_EMAIL, $subject, $body, $headers); 
     249                    $emailFunctions = new EmailFunctions(); 
     250                    $emailFunctions->subject = $subject; 
     251                    $emailFunctions->body = $body; 
    251252                    $emailFunctions->doEmail(); 
    252253                } 
Note: See TracChangeset for help on using the changeset viewer.