Forráskód Böngészése

Merge branch 'master' of https://github.com/unaio/una

AntonLV 8 éve
szülő
commit
f9cbf2d554

+ 1 - 1
inc/utils.inc.php

@@ -290,7 +290,7 @@ function sendMailTemplate($sTemplateName, $iAccountId = 0, $iProfileId = 0, $aRe
     if (!$oAccount || !$oProfile || !$oEmailTemplates)
         return false;
 
-    $aTemplate = $oEmailTemplates->parseTemplate($sTemplateName, $aReplaceVars, $iAccountId, (int)$iProfileId);
+    $aTemplate = $oEmailTemplates->parseTemplate($sTemplateName, $aReplaceVars, $oAccount ? $oAccount->id() : 0, (int)$iProfileId);
     if (!$aTemplate)
         return false;
 

+ 0 - 2
install/sql/addon.sql

@@ -10,8 +10,6 @@ INSERT INTO `sys_profiles` (`account_id`, `type`, `content_id`, `status`) VALUES
 UPDATE `sys_options` SET `VALUE` = {admin_email} WHERE `Name` = 'site_email';
 UPDATE `sys_options` SET `VALUE` = {site_title} WHERE `Name` = 'site_title';
 UPDATE `sys_options` SET `VALUE` = {site_email} WHERE `Name` = 'site_email_notify';
-UPDATE `sys_options` SET `VALUE` = {oauth_key} WHERE `Name` = 'sys_oauth_key';
-UPDATE `sys_options` SET `VALUE` = {oauth_secret} WHERE `Name` = 'sys_oauth_secret';
 UPDATE `sys_options` SET `VALUE` = {language} WHERE `Name` = 'lang_default';
 UPDATE `sys_options` SET `VALUE` = {time} WHERE `Name` = 'sys_install_time';
 UPDATE `sys_options` SET `VALUE` = {oauth_key} WHERE `Name` = 'sys_oauth_key';

+ 16 - 2
modules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php

@@ -113,8 +113,22 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
 
         $oForm->aFormAttrs['method'] = BX_DOL_FORM_METHOD_SPECIFIC;
         $oForm->aParams['csrf']['disable'] = true;
-        if(!empty($oForm->aParams['db']['submit_name']))
-            $aValues[$oForm->aParams['db']['submit_name']] = $oForm->aInputs[$oForm->aParams['db']['submit_name']]['value'];
+        if(!empty($oForm->aParams['db']['submit_name'])) {            
+            $sSubmitName = false;
+            if (is_array($oForm->aParams['db']['submit_name'])) {
+                foreach ($oForm->aParams['db']['submit_name'] as $sVal) {
+                    if (isset($oForm->aInputs[$sVal])) {
+                        $sSubmitName = $sVal;
+                        break;
+                    }
+                }
+            } 
+            else {
+                $sSubmitName = $oForm->aParams['db']['submit_name'];
+            }
+            if ($sSubmitName && isset($oForm->aInputs[$sSubmitName]))
+                $aValues[$oForm->aParams['db']['submit_name']] = $oForm->aInputs[$sSubmitName]['value'];
+        }
 
         $oForm->initChecker(array(), $aValues);
         if (!$oForm->isSubmittedAndValid())

+ 12 - 5
modules/boonex/massmailer/classes/BxMassMailerModule.php

@@ -486,20 +486,27 @@ class BxMassMailerModule extends BxBaseModGeneralModule
     private function sendLetter($sEmail, $iCampaignId, $aCustomHeaders, $iProfileId, $aTemplate, $bAddToQueue)
     {
         $sLetterCode = $this->_oDb->addLetter($iCampaignId, $sEmail);
-       
+        
+        $aMarkers = $this->addMarkers($iProfileId, $sLetterCode);
+        bx_alert($this->_aModule['name'], 'user_fields', $iCampaignId, $iProfileId, array('email' => $sEmail, 'markers' => &$aMarkers));
+        
+        $oTemplate = BxDolTemplate::getInstance();
+        
         $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
         $aTemplate['Body'] = preg_replace_callback("/$regexp/siU",
-            function ($aMatch) use ($iCampaignId, $sLetterCode) {
+            function ($aMatch) use ($iCampaignId, $sLetterCode, $oTemplate, $aMarkers) {
                 if ($aMatch[2] != '{unsubscribe_url}'){
-                    $sLinkCode = $this->_oDb->addLink($sLetterCode, $aMatch[2], $aMatch[3], $iCampaignId);
-                    return str_replace($aMatch[2], BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'track/click/' . $sLinkCode . "/", $aMatch[0]);
+                    $sUrl = $oTemplate->parseHtmlByContent($aMatch[2], $aMarkers, array('{', '}'));
+                    $sLinkCode = $this->_oDb->addLink($sLetterCode, $sUrl, $aMatch[3], $iCampaignId);
+                    return str_replace($sUrl, BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'track/click/' . $sLinkCode . "/", $aMatch[0]);
                 }
                 else{
                     return $aMatch[0];
                 }
             },
             $aTemplate['Body']);
-        return sendMail($sEmail, $aTemplate['Subject'], $aTemplate['Body'], 0, $this->addMarkers($iProfileId, $sLetterCode), BX_EMAIL_MASS, 'html', false, $aCustomHeaders, $bAddToQueue);
+        
+        return sendMail($sEmail, $aTemplate['Subject'], $aTemplate['Body'], 0, $aMarkers, BX_EMAIL_MASS, 'html', false, $aCustomHeaders, $bAddToQueue);
     }
 
     public function getEmailCountInSegment($iCampaignId)

+ 0 - 5
modules/boonex/massmailer/install/sql/enable.sql

@@ -58,11 +58,6 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_massmailer_submenu', @sName, '_bx_massmailer_menu_set_title_submenu', 0);
 
--- MENU: add to "add content" menu
-SET @iAddMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_add_content_links' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
-INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
-('sys_add_content_links', @sName, 'create-campaign', '_bx_massmailer_menu_item_title_system_create_entry', '_bx_massmailer_menu_item_title_create_entry', 'page.php?i=create-campaign', '', '', 'envelope col-red2', '', 128, 1, 1, IFNULL(@iAddMenuOrder, 0) + 1);
-
 -- MENU: dashboard manage tools
 SET @iManageMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name`='sys_account_dashboard_manage_tools' LIMIT 1);
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 

+ 2 - 0
modules/boonex/notifications/classes/BxNtfsTemplate.php

@@ -9,6 +9,8 @@
  * @{
  */
 
+require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
+
 class BxNtfsTemplate extends BxBaseModNotificationsTemplate
 {
     function __construct(&$oConfig, &$oDb)

+ 2 - 0
template/scripts/BxBaseMenu.php

@@ -7,6 +7,8 @@
  * @{
  */
 
+require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
+
 /**
  * Menu representation.
  * @see BxDolMenu