Alex Trofimov 12 лет назад
Родитель
Сommit
fa0cfea65a

+ 17 - 27
modules/boonex/smtpmailer/classes/BxSMTPConfig.php

@@ -1,32 +1,22 @@
-<?
-/***************************************************************************
-*                            Dolphin Smart Community Builder
-*                              -------------------
-*     begin                : Mon Mar 23 2006
-*     copyright            : (C) 2007 BoonEx Group
-*     website              : http://www.boonex.com
-* This file is part of Dolphin - Smart Community Builder
-*
-* Dolphin is free software; you can redistribute it and/or modify it under
-* the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2 of the
-* License, or  any later version.
-*
-* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-* See the GNU General Public License for more details.
-* You should have received a copy of the GNU General Public License along with Dolphin,
-* see license.txt file; if not, write to marketing@boonex.com
-***************************************************************************/
+<?php
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ * 
+ * @defgroup    SMTPMailer SMTP Mailer
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
 
 bx_import('BxDolModuleConfig');
 
-class BxSMTPConfig extends BxDolModuleConfig {
-
-	function BxSMTPConfig($aModule) {
-	    parent::BxDolModuleConfig($aModule);
-    }
-    
+class BxSMTPConfig extends BxDolModuleConfig 
+{
+	function __construct($aModule) 
+    {
+	    parent::__construct($aModule);
+    }   
 }
 
-?>
+/** @} */

+ 15 - 31
modules/boonex/smtpmailer/classes/BxSMTPDb.php

@@ -1,38 +1,22 @@
-<?
-/***************************************************************************
-*                            Dolphin Smart Community Builder
-*                              -------------------
-*     begin                : Mon Mar 23 2006
-*     copyright            : (C) 2007 BoonEx Group
-*     website              : http://www.boonex.com
-* This file is part of Dolphin - Smart Community Builder
-*
-* Dolphin is free software; you can redistribute it and/or modify it under
-* the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2 of the
-* License, or  any later version.
-*
-* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-* See the GNU General Public License for more details.
-* You should have received a copy of the GNU General Public License along with Dolphin,
-* see license.txt file; if not, write to marketing@boonex.com
-***************************************************************************/
+<?php
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ * 
+ * @defgroup    SMTPMailer SMTP Mailer
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
 
 bx_import('BxDolModuleDb');
 
-class BxSMTPDb extends BxDolModuleDb {	
-
-    var $_oConfig;
-
-	function __construct(&$oConfig) {
+class BxSMTPDb extends BxDolModuleDb
+{
+	function __construct(&$oConfig) 
+    {
 		parent::__construct($oConfig);	
-		$this->_oConfig = $oConfig;
     }
-
-    function getSettingsCategory() {
-        return $this->getOne("SELECT `ID` FROM `sys_options_cats` WHERE `name` = 'SMTP Mailer' LIMIT 1");
-    }    
 }
 
-?>
+/** @} */

+ 41 - 108
modules/boonex/smtpmailer/classes/BxSMTPModule.php

@@ -1,23 +1,13 @@
 <?php
-/***************************************************************************
-*                            Dolphin Smart Community Builder
-*                              -------------------
-*     begin                : Mon Mar 23 2006
-*     copyright            : (C) 2007 BoonEx Group
-*     website              : http://www.boonex.com
-* This file is part of Dolphin - Smart Community Builder
-*
-* Dolphin is free software; you can redistribute it and/or modify it under
-* the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2 of the
-* License, or  any later version.
-*
-* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-* See the GNU General Public License for more details.
-* You should have received a copy of the GNU General Public License along with Dolphin,
-* see license.txt file; if not, write to marketing@boonex.com
-***************************************************************************/
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ * 
+ * @defgroup    SMTPMailer SMTP Mailer
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
 
 bx_import('BxDolModule');
 bx_import('BxDolPaginate');
@@ -26,19 +16,20 @@ bx_import('BxDolAlerts');
 require_once (BX_DIRECTORY_PATH_PLUGINS . "phpmailer/class.phpmailer.php");
 require_once (BX_DIRECTORY_PATH_PLUGINS . "phpmailer/class.smtp.php");
 
-class BxSMTPModule extends BxDolModule {
-
-    function BxSMTPModule(&$aModule) {
-        parent::BxDolModule($aModule);
+class BxSMTPModule extends BxDolModule 
+{
+    function __construct(&$aModule) 
+    {
+        parent::__construct($aModule);
     }
 
-    function serviceSend ($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters, $isHtml, $aRecipientInfo = array()) {
-
+    function serviceSend ($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters, $isHtml, $aRecipientInfo = array()) 
+    {
         $iRet = true;
 
         if ($sRecipientEmail) {
 
-            $mail = new PHPMailer();
+            $mail = new PHPMailer(true);
             
             if ('on' == getParam('bx_smtp_on')) 
                 $mail->IsSMTP(); 
@@ -72,20 +63,20 @@ class BxSMTPModule extends BxDolModule {
             if ($sParamSender)
                 $mail->From = $sParamSender;
             else
-                $mail->From = $sSenderEmail;
+                $mail->From = getParam('site_email_notify');
             
             // get site name or some other name as sender's name
-            $mail->FromName   = getParam ('bx_smtp_from_name');
+            $mail->FromName = getParam ('bx_smtp_from_name');
             
-            $mail->Subject    = $sMailSubject;
+            $mail->Subject = $sMailSubject;
             if ($isHtml) {
-                $mail->Body       = $sMailBody;
-                $mail->AltBody    = $isHtml ? strip_tags($sMailBody) : $sMailBody; 
+                $mail->Body = $sMailBody;
+                $mail->AltBody = $isHtml ? strip_tags($sMailBody) : $sMailBody; 
             } else {
                 $mail->Body = $sMailBody;
             }
 
-            $mail->WordWrap   = 50; // set word wrap
+            $mail->WordWrap = 50; // set word wrap
 
             $mail->AddAddress($sRecipientEmail); 
                 
@@ -105,14 +96,15 @@ class BxSMTPModule extends BxDolModule {
 
             $mail->IsHTML($isHtml ? true : false); 
 
-            $iRet = $mail->Send();
-            if (!$iRet)
-                $this->log("Mailer Error ($sRecipientEmail): " . $mail->ErrorInfo);
-
+            try {
+                $mail->Send();
+            } catch (phpmailerException $e) {
+                $iRet = false;
+                $this->log("Mailer Error ($sRecipientEmail): " . $e->getMessage());
+            }
         }
 
         //--- create system event [begin]
-        bx_import('BxDolAlerts');
         $aAlertData = array(
             'email'     => $sRecipientEmail,
             'subject'   => $sMailSubject,
@@ -121,72 +113,21 @@ class BxSMTPModule extends BxDolModule {
             'params'    => $sMailParameters,
             'html'      => $isHtml,
         );
-
-        $oZ = new BxDolAlerts('profile', 'send_mail', $aRecipientInfo ? $aRecipientInfo['ID'] : 0, '', $aAlertData);
-        $oZ -> alert();
+        bx_alert('profile', 'send_mail', $aRecipientInfo ? $aRecipientInfo['ID'] : 0, '', $aAlertData);
         //--- create system event [ end ]
 
         return $iRet;
     }
 
-    function actionAdministration () {
-
-        if (!$this->isAdmin()) {
-            $this->_oTemplate->displayAccessDenied ();
-            return;
-        }
-
-        $this->_oTemplate->pageStart();
-
-	    $iId = $this->_oDb->getSettingsCategory();
-	    if(empty($iId)) {
-            echo MsgBox(_t('_sys_request_page_not_found_cpt'));
-            $this->_oTemplate->pageCodeAdmin (_t('_bx_smtp_administration'));
-            return;
-        }
-
-        bx_import('BxDolAdminSettings');
-
-        $mixedResult = '';
-        if(isset($_POST['save']) && isset($_POST['cat'])) {
-	        $oSettings = new BxDolAdminSettings($iId);
-            $mixedResult = $oSettings->saveChanges($_POST);
-        }
-
-        $oSettings = new BxDolAdminSettings($iId);
-        $sResult = $oSettings->getForm();
-        	       
-        if($mixedResult !== true && !empty($mixedResult))
-            $sResult = $mixedResult . $sResult;
-
-        $aVars = array (
-            'content' => $sResult,
-        );
-        echo $this->_oTemplate->adminBlock ($this->_oTemplate->parseHtmlByName('default_padding', $aVars), _t('_bx_smtp_administration')); 
-
-        $aVars = array (
-            'content' => _t('_bx_smtp_help_text')
-        );
-        echo $this->_oTemplate->adminBlock ($this->_oTemplate->parseHtmlByName('default_padding', $aVars), _t('_bx_smtp_help')); 
-
-        $aVars = array (
-            'content' => $this->formTester(),
-        );
-        echo $this->_oTemplate->adminBlock ($this->_oTemplate->parseHtmlByName('default_padding', $aVars), _t('_bx_smtp_tester')); 
-
-        $this->_oTemplate->addCssAdmin ('forms_adv.css');
-        $this->_oTemplate->pageCodeAdmin (_t('_bx_smtp_administration'));
-    }
-
-    function formTester() {
-
+    function formTester() 
+    {
         $sMsg  = '';
-        if ($_POST['tester_submit']) {
+        if (isset($_POST['tester_submit']) && $_POST['tester_submit']) {
             
-            $sRecipient = process_pass_data($_POST['recipient']);
-            $sSubj = process_pass_data($_POST['subject']);
-            $sBody = process_pass_data($_POST['body']);
-            $isHTML = $_POST['html'] == 'on' ? true : false;
+            $sRecipient = bx_process_pass(bx_get('recipient'));
+            $sSubj = bx_process_pass(bx_get('subject'));
+            $sBody = bx_process_pass(bx_get('body'));
+            $isHTML = bx_get('html') == 'on' ? true : false;
     
             if (sendMail($sRecipient, $sSubj, $sBody, 0, array(), BX_EMAIL_SYSTEM, $isHTML ? 'html' : ''))
                 $sMsg = MsgBox(_t('_bx_smtp_send_ok'));
@@ -196,14 +137,9 @@ class BxSMTPModule extends BxDolModule {
 
         $aForm = array(
             'form_attrs' => array(
-                'action' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/',
                 'method'   => 'post',
             ),
             'inputs' => array (
-                'header' => array(
-                    'type' => 'block_header',
-                    'caption' => _t('_bx_smtp_tester'),
-                ),
                 'recipient' => array(
                     'type' => 'text',
                     'name' => 'recipient',
@@ -241,18 +177,15 @@ class BxSMTPModule extends BxDolModule {
         return $sMsg . $oForm->getCode();
     }
 
-    function isAdmin () {
-        return $GLOBALS['logged']['admin'] ? true : false;
-    }
-
     function log ($s)
     {
-        $fn = BX_DIRECTORY_PATH_MODULES . "boonex/smtpmailer/data/logs/log.log";
+        $fn = BX_DIRECTORY_PATH_TMP . "smtp_mailer.log";
         $f = @fopen ($fn, 'a');
-        if (!$f) return;
+        if (!$f) 
+            return;
         fwrite ($f, date(DATE_RFC822) . "\t" . $s . "\n");
         fclose ($f);
     }
 }
 
-?>
+/** @} */

+ 48 - 0
modules/boonex/smtpmailer/classes/BxSMTPStudioPage.php

@@ -0,0 +1,48 @@
+<? defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ * 
+ * @defgroup    SMTPMailer SMTP Mailer
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
+
+bx_import('BxTemplStudioModule');
+
+class BxSMTPStudioPage extends BxTemplStudioModule 
+{
+    protected $oModule;
+
+    function __construct($sModule = "", $sPage = "") 
+    {
+        parent::__construct($sModule, $sPage);
+
+        bx_import('BxDolModule');
+        $this->oModule = BxDolModule::getInstance('bx_smtp');
+
+        $this->aMenuItems = array(
+    	    array('name' => 'general', 'icon' => 'cogs', 'title' => '_adm_lmi_cpt_settings'),
+    	    array('name' => 'tester', 'icon' => 'envelope', 'title' => '_bx_smtp_tester'),
+        );
+    }
+
+    function getTester () 
+    {
+        return $this->oModule->formTester();
+    }
+
+    function getHelp ()
+    {
+        return _t('_bx_smtp_help_text');
+    }
+
+    protected function getPageCaptionHelp() {
+        $oTemplate = BxDolStudioTemplate::getInstance();
+        $sContent = '<a href="' . BX_DOL_URL_STUDIO . 'module.php?name=bx_smtp&page=help">' . _t('_bx_smtp_help') . "</a>";
+        return $oTemplate->parseHtmlByName('page_caption_help.html', array('content' => $sContent));
+    }
+}
+
+/** @} */

+ 16 - 25
modules/boonex/smtpmailer/classes/BxSMTPTemplate.php

@@ -1,31 +1,22 @@
-<?
-/***************************************************************************
-*                            Dolphin Smart Community Builder
-*                              -------------------
-*     begin                : Mon Mar 23 2006
-*     copyright            : (C) 2007 BoonEx Group
-*     website              : http://www.boonex.com
-* This file is part of Dolphin - Smart Community Builder
-*
-* Dolphin is free software; you can redistribute it and/or modify it under
-* the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2 of the
-* License, or  any later version.
-*
-* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-* See the GNU General Public License for more details.
-* You should have received a copy of the GNU General Public License along with Dolphin,
-* see license.txt file; if not, write to marketing@boonex.com
-***************************************************************************/
+<?php
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ * 
+ * @defgroup    SMTPMailer SMTP Mailer
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
 
 bx_import ('BxDolModuleTemplate');
 
-class BxSMTPTemplate extends BxDolModuleTemplate {
-    
-	function BxSMTPTemplate(&$oConfig, &$oDb) {
-	    parent::BxDolModuleTemplate($oConfig, $oDb);
+class BxSMTPTemplate extends BxDolModuleTemplate 
+{    
+	function __construct(&$oConfig, &$oDb) 
+    {
+	    parent::__construct($oConfig, $oDb);
     }    
 }
 
-?>
+/** @} */

BIN
modules/boonex/smtpmailer/data/attach/sundance.png


+ 2 - 6
modules/boonex/smtpmailer/install/config.php

@@ -39,7 +39,7 @@ $aConfig = array(
 	 */
 	'install' => array(
 		'show_introduction' => 0,
-		'change_permissions' => 1,
+		'change_permissions' => 0,
 		'execute_sql' => 1,
 		'update_languages' => 1,
 		'recompile_main_menu' => 0,
@@ -132,11 +132,7 @@ $aConfig = array(
 	/**
 	 * Permissions Section
 	 */
-    'install_permissions' => array(
-        'writable' => array(
-            'data/logs/',
-        ),
-    ),
+    'install_permissions' => array(),
     'uninstall_permissions' => array(),
 
 	/**

+ 5 - 4
modules/boonex/smtpmailer/install/installer.php

@@ -3,7 +3,7 @@
  * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  * 
- * @defgroup    Persons Persons
+ * @defgroup    SMTPMailer SMTP Mailer
  * @ingroup     DolphinModules
  *
  * @{
@@ -11,9 +11,10 @@
 
 bx_import('BxDolStudioInstaller');
 
-class BxSMTPInstaller extends BxDolStudioInstaller {
-
-    function __construct($aConfig) {
+class BxSMTPInstaller extends BxDolStudioInstaller 
+{
+    function __construct($aConfig) 
+    {
         parent::__construct($aConfig);
     }    
 }

+ 2 - 2
modules/boonex/smtpmailer/install/langs/en.xml

@@ -7,7 +7,7 @@
 	<string name="_bx_smtp_subject"><![CDATA[Subject]]></string>
 	<string name="_bx_smtp_body"><![CDATA[Body]]></string>
 	<string name="_bx_smtp_is_html"><![CDATA[Is HTML?]]></string>
-	<string name="_bx_smtp_send_ok"><![CDATA[Mail has beed successfully sent]]></string>
+	<string name="_bx_smtp_send_ok"><![CDATA[Mail has been successfully sent]]></string>
 	<string name="_bx_smtp_send_fail"><![CDATA[Mail send failed]]></string>
 	<string name="_bx_smtp_help"><![CDATA[Help]]></string>
 	<string name="_bx_smtp_help_text"><![CDATA[
@@ -30,7 +30,7 @@
         <br />
         Alternatively, you can get above options from your desktop mail client, if you are going to use the same email address for sending mail from your site.
         
-        <hr />
+        <hr class="bx-def-hr" />
 
         If emails still go to spam folder, check the following:
         <ul>

+ 11 - 21
modules/boonex/smtpmailer/request.php

@@ -1,23 +1,13 @@
-<?
-/***************************************************************************
-*                            Dolphin Smart Community Builder
-*                              -------------------
-*     begin                : Mon Mar 23 2006
-*     copyright            : (C) 2007 BoonEx Group
-*     website              : http://www.boonex.com
-* This file is part of Dolphin - Smart Community Builder
-*
-* Dolphin is free software; you can redistribute it and/or modify it under
-* the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2 of the
-* License, or  any later version.
-*
-* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-* See the GNU General Public License for more details.
-* You should have received a copy of the GNU General Public License along with Dolphin,
-* see license.txt file; if not, write to marketing@boonex.com
-***************************************************************************/
+<?php
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ * 
+ * @defgroup    SMTPMailer SMTP Mailer
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
 
 require_once(BX_DIRECTORY_PATH_INC . 'profiles.inc.php');
 
@@ -26,4 +16,4 @@ check_logged();
 bx_import('BxDolRequest');
 BxDolRequest::processAsAction($GLOBALS['aModule'], $GLOBALS['aRequest']);
 
-?>
+/** @} */

+ 8 - 1
studio/template/css/general.css

@@ -107,8 +107,9 @@ div.bx-std-pmen-item {
 	overflow: hidden;
 }
 div.bx-std-pmen-item-cnt {
-	padding-left: 66px;
+	padding-left: 66px;    
 }
+
 span.bx-std-pmen-item-counter {}
 span.bx-std-pmen-ic-num {}
 div.bx-std-pmen-item img {
@@ -121,6 +122,12 @@ div.bx-std-pmen-item img {
 div.bx-std-pmen-item i.sys-icon {
 	position: absolute;
     left: 20px;
+    width:32px;
+
+    color:white;
+    font-size:20px;
+    text-align:center;
+    text-shadow:none;
 }
 div.bx-menu-tab-active {
 	background-color: #f2f2f2;

BIN
studio/template/images/icons/mi-empty.png


+ 5 - 2
studio/template/menu_side.html

@@ -2,11 +2,14 @@
     <div id="bx-std-pmi-__name__" class="bx-std-pmen-item bx-def-font-large __class_add__">
         <a href="__link__" target="__target__" onclick="__onclick__">
             <div class="bx-std-pmen-item-cnt">
-                <bx_if:icon><i class="sys-icon __icon__ bx-def-margin-sec-right"></i></bx_if:icon>
+                <bx_if:icon>
+                    <img src="<bx_icon_url:mi-empty.png />" />
+                    <i class="sys-icon __icon__ bx-def-margin-sec-right"></i>
+                </bx_if:icon>
                 <bx_if:image><img src="__icon_url__" /></bx_if:image>
                 __title__
             </div>
         </a>                
     </div>                
 </bx_repeat:menu_items>
-<div class="bx-clear"></div>
+<div class="bx-clear"></div>