RomanL 5 лет назад
Родитель
Сommit
deae2d68b4

+ 19 - 11
inc/classes/BxDolAccount.php

@@ -115,6 +115,12 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
                 if($a['email_confirmed'] && $a['phone_confirmed'])
                     $bResult = true;
                 break;
+                
+            case BX_ACCOUNT_CONFIRMATION_EMAIL_OR_PHONE:
+                if($a['email_confirmed'] || $a['phone_confirmed'])
+                    $bResult = true;
+                break;  
+                
         }
 
         bx_alert('account', 'is_confirmed', $iId, false, array('type' => $sConfirmationType, 'override_result' => &$bResult));
@@ -175,14 +181,14 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
 
     static public function isNeedConfirmEmail()
     {
-        if (getParam('sys_account_confirmation_type') == BX_ACCOUNT_CONFIRMATION_EMAIL || getParam('sys_account_confirmation_type') == BX_ACCOUNT_CONFIRMATION_EMAIL_PHONE) 
+        if(in_array(getParam('sys_account_confirmation_type'), array(BX_ACCOUNT_CONFIRMATION_EMAIL, BX_ACCOUNT_CONFIRMATION_EMAIL_PHONE, BX_ACCOUNT_CONFIRMATION_EMAIL_OR_PHONE)))
             return true;
         return false;
     }
     
     static public function isNeedConfirmPhone()
     {
-        if (getParam('sys_account_confirmation_type') == BX_ACCOUNT_CONFIRMATION_PHONE || getParam('sys_account_confirmation_type') == BX_ACCOUNT_CONFIRMATION_EMAIL_PHONE) 
+        if(in_array(getParam('sys_account_confirmation_type'), array(BX_ACCOUNT_CONFIRMATION_PHONE, BX_ACCOUNT_CONFIRMATION_EMAIL_PHONE, BX_ACCOUNT_CONFIRMATION_EMAIL_OR_PHONE)))
             return true;
         return false;
     }
@@ -658,15 +664,17 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
      */
     public function addInformerPermanentMessages ($oInformer)
     {
-        if (!$this->isConfirmedEmail()) {
-            $sUrl = BxDolPermalinks::getInstance()->permalink('page.php?i=confirm-email') . '&resend=1';
-            $aAccountInfo = $this->getInfo();
-            $oInformer->add('sys-account-unconfirmed-email', _t('_sys_txt_account_unconfirmed_email', $sUrl, $aAccountInfo['email']), BX_INFORMER_ALERT);
-        }
-		if (!$this->isConfirmedPhone()) {
-            $sUrl = BxDolPermalinks::getInstance()->permalink('page.php?i=confirm-phone') . '';
-            $aAccountInfo = $this->getInfo();
-            $oInformer->add('sys-account-unconfirmed-phone', _t('_sys_txt_account_unconfirmed_phone', $sUrl), BX_INFORMER_ALERT);
+        if (!$this->isConfirmed()) {
+            if (!$this->isConfirmedEmail()) {
+                $sUrl = BxDolPermalinks::getInstance()->permalink('page.php?i=confirm-email') . '&resend=1';
+                $aAccountInfo = $this->getInfo();
+                $oInformer->add('sys-account-unconfirmed-email', _t('_sys_txt_account_unconfirmed_email', $sUrl, $aAccountInfo['email']), BX_INFORMER_ALERT);
+            }
+            if (!$this->isConfirmedPhone()) {
+                $sUrl = BxDolPermalinks::getInstance()->permalink('page.php?i=confirm-phone') . '';
+                $aAccountInfo = $this->getInfo();
+                $oInformer->add('sys-account-unconfirmed-phone', _t('_sys_txt_account_unconfirmed_phone', $sUrl), BX_INFORMER_ALERT);
+            }
         }
     }
 

+ 1 - 0
inc/params.inc.php

@@ -90,6 +90,7 @@ define('BX_ACCOUNT_CONFIRMATION_NONE', 'none');
 define('BX_ACCOUNT_CONFIRMATION_EMAIL', 'email');
 define('BX_ACCOUNT_CONFIRMATION_PHONE', 'phone');
 define('BX_ACCOUNT_CONFIRMATION_EMAIL_PHONE', 'email_and_phone');
+define('BX_ACCOUNT_CONFIRMATION_EMAIL_OR_PHONE', 'email_or_phone');
 
 //--- Include files needed for basic functionality ---//
 require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDol.php');

+ 5 - 0
modules/base/profile/classes/BxBaseModProfileSearchResult.php

@@ -75,6 +75,7 @@ class BxBaseModProfileSearchResult extends BxBaseModGeneralSearchResult
         $this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], array(
             'account_confirmed_email' => array('value' => '', 'field' => 'email_confirmed', 'operator' => '=', 'table' => 'sys_accounts'),
             'account_confirmed_phone' => array('value' => '', 'field' => 'phone_confirmed', 'operator' => '=', 'table' => 'sys_accounts'),
+            'account_confirmed_email_and_phone' => array('value' => '', 'field' => 'phone_confirmed` | `sys_accounts`.`email_confirmed', 'operator' => '=', 'table' => 'sys_accounts'),
         ));
 
         switch($sConfirmationType) {
@@ -90,6 +91,10 @@ class BxBaseModProfileSearchResult extends BxBaseModGeneralSearchResult
                 $this->aCurrent['restriction']['account_confirmed_email']['value'] = 1;
                 $this->aCurrent['restriction']['account_confirmed_phone']['value'] = 1;
                 break;
+                
+            case BX_ACCOUNT_CONFIRMATION_EMAIL_OR_PHONE:
+                $this->aCurrent['restriction']['account_confirmed_email_and_phone']['value'] = 1;
+                break;
         }
     }
 

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -1859,6 +1859,7 @@
 	<string name="_sys_acc_confirmation_type_email"><![CDATA[email is confirmed]]></string>
 	<string name="_sys_acc_confirmation_type_phone"><![CDATA[phone is confirmed]]></string>
 	<string name="_sys_acc_confirmation_type_email_and_phone"><![CDATA[email and phone are confirmed]]></string>
+  <string name="_sys_acc_confirmation_type_email_or_phone"><![CDATA[email or phone is confirmed]]></string>
 	<string name="_sys_acl_action_account"><![CDATA[You didn't created any profiles, so you can't '{1}'.]]></string>
 	<string name="_sys_acl_action_chart_view"><![CDATA[View charts]]></string>
 	<string name="_sys_acl_action_chart_view_desc"><![CDATA[View statistical charts]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -1845,6 +1845,7 @@
 	<string name="_sys_acc_confirmation_type_email"><![CDATA[email подтвержден]]></string>
 	<string name="_sys_acc_confirmation_type_phone"><![CDATA[телефон подтвержден]]></string>
 	<string name="_sys_acc_confirmation_type_email_and_phone"><![CDATA[email и телефон подтвержден]]></string>
+  <string name="_sys_acc_confirmation_type_email_or_phone"><![CDATA[email или телефон подтвержден]]></string>
 	<string name="_sys_acl_action_account"><![CDATA[Вы не создали ни одного профиля, поэтому Вы не можете '{1}'.]]></string>
 	<string name="_sys_acl_action_chart_view"><![CDATA[Диаграммы - Просматривать]]></string>
     <string name="_sys_acl_action_chart_view_desc"><![CDATA[Просматривать статистические диаграммы]]></string>

+ 2 - 2
template/scripts/BxBaseServiceAccount.php

@@ -132,7 +132,7 @@ class BxBaseServiceAccount extends BxDol
     public function serviceGetConfirmationTypes()
     {
         $aResult = array();
-        $aChoices = array(BX_ACCOUNT_CONFIRMATION_NONE, BX_ACCOUNT_CONFIRMATION_EMAIL, BX_ACCOUNT_CONFIRMATION_PHONE, BX_ACCOUNT_CONFIRMATION_EMAIL_PHONE);
+        $aChoices = array(BX_ACCOUNT_CONFIRMATION_NONE, BX_ACCOUNT_CONFIRMATION_EMAIL, BX_ACCOUNT_CONFIRMATION_PHONE, BX_ACCOUNT_CONFIRMATION_EMAIL_PHONE, BX_ACCOUNT_CONFIRMATION_EMAIL_OR_PHONE);
         foreach($aChoices as $sChoice)
             $aResult[$sChoice] = _t('_sys_acc_confirmation_type_' . $sChoice);
         
@@ -430,7 +430,7 @@ class BxBaseServiceAccount extends BxDol
                 $sSmsText = _t('_sys_txt_forgot_pasword_sms_text', $sForgotPasswordUrl);
 
                 $mixedOverrideResult = null;
-                bx_alert('account', 'before_forgot_password_send_sms', $aAccountInfo['id'], false, array('phone_number' => $sPhone, 'sms_text' => $sSmsText, 'override_result' => &$mixedOverrideResult));
+                bx_alert('account', 'before_forgot_password_send_sms', $aAccountInfo['id'], false, array('phone_number' => &$sPhone, 'sms_text' => &$sSmsText, 'override_result' => &$mixedOverrideResult));
                 if ($mixedOverrideResult === null) {
                     $oTwilio = BxDolTwilio::getInstance();
                     if($oTwilio->sendSms($sPhone,  $sSmsText))