소스 검색

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

AntonLV 4 년 전
부모
커밋
92759f95e3

+ 2 - 0
inc/js/classes/BxDolUploader.js

@@ -299,6 +299,7 @@ BxDolUploaderSimple.prototype.getMimeTypefromString  = function (ext) {
       'aiff'   : 'audio/x-aiff',
       'au'     : 'audio/basic',
       'avi'    : 'video/x-msvideo',
+      'avi'    : 'video/avi',
       'bat'    : 'text/plain',
       'bin'    : 'application/octet-stream',
       'bmp'    : 'image/x-ms-bmp',
@@ -524,6 +525,7 @@ function BxDolUploaderHTML5 (sUploaderObject, sStorageObject, sUniqId, options)
                     aAcceptableFiles.push($this.getMimeTypefromString(item));
             });
         }
+        
         if (aAcceptableFiles.length){
             _options.acceptedFileTypes = aAcceptableFiles;
         }

+ 12 - 0
modules/base/general/classes/BxBaseModGeneralDb.php

@@ -127,6 +127,18 @@ class BxBaseModGeneralDb extends BxDolModuleDb
         return $this->getOne($sQuery);
     }
     
+    public function getEntriesNumByParams ($aParams = [])
+    {
+        $sSql = "SELECT COUNT(*) FROM `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` WHERE 1";
+        
+        foreach($aParams as $aValue){
+            $sSql .= ' AND `' . $aValue['key'] ."` " . $aValue['operator'] . " '" . $aValue['value'] . "'";
+        }
+        
+        $sQuery = $this->prepare($sSql);
+        return $this->getOne($sQuery);
+    }
+    
     public function updateEntriesBy($aParamsSet, $aParamsWhere)
     {
         $CNF = &$this->_oConfig->CNF;

+ 17 - 1
modules/base/profile/classes/BxBaseModProfileDb.php

@@ -61,8 +61,8 @@ class BxBaseModProfileDb extends BxBaseModGeneralDb
 			'type' => $this->_oConfig->getName(),
 			'status' => BX_PROFILE_STATUS_ACTIVE
 		);
-
         $sSelect = "`c`.`id` AS `content_id`, `p`.`account_id`, `p`.`id` AS `profile_id`, `p`.`status` AS `profile_status` ";
+        
         $sJoin = "INNER JOIN `sys_profiles` AS `p` ON (`p`.`content_id` = `c`.`id` AND `p`.`type` = :type) INNER JOIN `sys_accounts` AS `a` ON (`a`.`id` =  `p`.`account_id`)";
         
         $sWhere = '';
@@ -110,6 +110,22 @@ class BxBaseModProfileDb extends BxBaseModGeneralDb
 
         parent::_getEntriesBySearchIds($aParams, $aMethod, $sSelectClause, $sJoinClause, $sWhereClause, $sOrderClause, $sLimitClause);        
     }
+    
+    public function getEntriesNumByParams ($aParams = [])
+    {
+        $CNF = &$this->_oConfig->CNF;
+        
+        $sSql = "SELECT COUNT(*) FROM `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` 
+            INNER JOIN `sys_profiles` ON `" . $CNF['TABLE_ENTRIES'] . "`.`" . $CNF['FIELD_ID'] . "`=`sys_profiles`.`content_id` AND `sys_profiles`.`type`=?
+            WHERE 1";
+        
+        foreach($aParams as $aValue){
+            $sSql .= ' AND ' . (isset($aValue['table'])? '`' . $aValue['table'] .'`.' : '') . '`' . $aValue['key'] ."` " . $aValue['operator'] . " '" . $aValue['value'] . "'";
+        }
+        
+        $sQuery = $this->prepare($sSql, $this->_oConfig->getName());
+        return $this->getOne($sQuery);
+    }
 }
 
 /** @} */

+ 19 - 13
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -231,24 +231,30 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
 
 	public function serviceGetMenuAddonManageTools()
 	{
-		bx_import('SearchResult', $this->_aModule);
-        $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
-        $o = new $sClass();
-        $o->unsetPaginate();
-        $iNumTotal = $o->getNum();
+        $CNF = &$this->_oConfig->CNF;
         
-        $o->fillFilters(array(
-			'perofileStatus' => BX_PROFILE_STATUS_PENDING
-        ));
-        $iNum1 = $o->getNum();
+		$iNumTotal = $this->_oDb->getEntriesNumByParams();
+
+        $iNum1 = $this->_oDb->getEntriesNumByParams([
+            [
+                'key' => 'status', 
+                'table' => 'sys_profiles',
+                'value' => BX_PROFILE_STATUS_PENDING, 
+                'operator' => '='
+            ]
+        ]);
         
         $iNum2 = 0;
-        $CNF = &$this->_oConfig->CNF;
         if (isset($CNF['OBJECT_REPORTS'])){
-            $o->fillFilters(array('perofileStatus' => ''));
-            $o->fillFiltersByObjects(array('reported' => array('value' => '0', 'field' => 'reports', 'operator' => '>', 'table' => $CNF['TABLE_ENTRIES'])));
-            $iNum2 = $o->getNum();
+            $iNum2 = $this->_oDb->getEntriesNumByParams([
+                [
+                    'key' => 'reports',
+                    'value' => '0', 
+                    'operator' => '>'
+                ]
+            ]);
         }
+        
         return array('counter1_value' => $iNum1, 'counter2_value' => $iNum2, 'counter3_value' => $iNumTotal, 'counter1_caption' => _t('_sys_menu_dashboard_manage_tools_addon_counter1_caption_profile_default'));
 	}
 

+ 17 - 13
modules/base/text/classes/BxBaseModTextModule.php

@@ -291,23 +291,27 @@ class BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolConten
 
     public function serviceGetMenuAddonManageTools()
     {
-        bx_import('SearchResult', $this->_aModule);
-        $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
-        $o = new $sClass();
-        $o->unsetPaginate();
-        $iNumTotal = $o->getNum();
+        $CNF = &$this->_oConfig->CNF;
         
-        $o->fillFilters(array(
-			'status' => 'hidden'
-        )); 
-        $iNum1 = $o->getNum();
+        $iNumTotal = $this->_oDb->getEntriesNumByParams();
+
+        $iNum1 = $this->_oDb->getEntriesNumByParams([
+            [
+                'key' => $CNF['FIELD_STATUS'], 
+                'value' => 'hidden', 
+                'operator' => '='
+            ]
+        ]);
         
         $iNum2 = 0;
-        $CNF = &$this->_oConfig->CNF;
         if (isset($CNF['OBJECT_REPORTS'])){
-            $o->fillFilters(array('status' => ''));
-            $o->fillFiltersByObjects(array('reported' => array('value' => '0', 'field' => 'reports', 'operator' => '>')));
-            $iNum2 = $o->getNum();
+            $iNum2 = $this->_oDb->getEntriesNumByParams([
+                [
+                    'key' => 'reports',
+                    'value' => '0', 
+                    'operator' => '>'
+                ]
+            ]);
         }
         return array('counter1_value' => $iNum1, 'counter2_value' => $iNum2, 'counter3_value' => $iNumTotal );
 	}

+ 14 - 0
modules/boonex/accounts/classes/BxAccntDb.php

@@ -30,6 +30,20 @@ class BxAccntDb extends BxBaseModGeneralDb
     {
     	return (int)$this->query("UPDATE `sys_accounts` SET " . $this->arrayToSQL($aSet) . " WHERE " . $this->arrayToSQL($aWhere, ' AND ')) > 0;
     }
+    
+    public function getEntriesNumByParams ($aParams = [])
+    {
+        $CNF = &$this->_oConfig->CNF;
+        
+        $sSql = "SELECT COUNT(*) FROM `sys_accounts` WHERE 1";
+        
+        foreach($aParams as $aValue){
+            $sSql .= ' AND ' . (isset($aValue['table'])? '`' . $aValue['table'] .'`.' : '') . '`' . $aValue['key'] ."` " . $aValue['operator'] . " '" . $aValue['value'] . "'";
+        }
+        
+        $sQuery = $this->prepare($sSql, $this->_oConfig->getName());
+        return $this->getOne($sQuery);
+    }
 }
 
 /** @} */

+ 31 - 12
modules/boonex/accounts/classes/BxAccntModule.php

@@ -72,19 +72,38 @@ class BxAccntModule extends BxBaseModGeneralModule
      * @ref bx_accounts-get_menu_addon_manage_tools "get_menu_addon_manage_tools"
      */
     public function serviceGetMenuAddonManageTools()
-    {
-        bx_import('SearchResult', $this->_aModule);
-        $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
-        $o = new $sClass();
-        $o->unsetPaginate();
-        $iNumTotal = $o->getNum();
+    {   
+        $iNumTotal = $this->_oDb->getEntriesNumByParams();
+
+        $aConfirmed = array();
+        $aUnConfirmed = array();
+        $sCnfnType = getParam('sys_account_confirmation_type');
+        $aFilter = [ 
+            [
+                'key' => 'name', 
+                'value' => 'Robot', 
+                'operator' => '<>'
+            ]
+        ];
+        
+        switch($sCnfnType) {
+            case 'email':
+                $aFilter[] = array('value' => '', 'key' => 'email_confirmed', 'operator' => '=');
+                $aFilter[] = array('value' => '', 'key' => 'email_confirmed', 'operator' => '<>');
+                break;
+            case 'phone':
+                $aFilter[] = array('value' => '', 'key' => 'phone_confirmed', 'operator' => '=');
+                $aFilter[] = array('value' => '', 'key' => 'phone_confirmed', 'operator' => '<>');
+                break;
+            case 'email_and_phone':
+                $aFilter[] = array('value' => '', 'key' => 'phone_confirmed` * `email_confirmed', 'operator' => '=');
+                $aFilter[] = array('value' => '', 'key' => 'phone_confirmed` * `email_confirmed', 'operator' => '<>');
+                break;
+        }
+
+        $iNum1 = $this->_oDb->getEntriesNumByParams($aFilter);      
         
-        $o->fillFilters(array(
-            'unconfirmed' => 1,
-            'non_robot' => 'Robot'
-        ));
-      
-        return array('counter1_value' => $o->getNum(),'counter3_value' => $iNumTotal, 'counter1_caption' => _t('_bx_accnt_menu_dashboard_manage_tools_addon_counter1_caption'));
+        return array('counter1_value' => $iNum1,'counter3_value' => $iNumTotal, 'counter1_caption' => _t('_bx_accnt_menu_dashboard_manage_tools_addon_counter1_caption'));
     }
     
     public function checkAllowedConfirm(&$aDataEntry, $isPerformAction = false)

+ 16 - 14
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -2877,20 +2877,22 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
      */
     public function serviceGetMenuAddonManageTools()
     {
-        $CNF = &$this->_oConfig->CNF;
-
-        bx_import('SearchResult', $this->_aModule);
-        $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
-        $oSearch = new $sClass();
-        $oSearch->unsetPaginate();
-
-        $oSearch->fillFilters(array('status' => BX_TIMELINE_STATUS_HIDDEN));
-        $iNum1 = $oSearch->getNum();
-
-        $oSearch->fillFilters(array('status' => ''));
-        $oSearch->fillFiltersByObjects(array('reported' => array('value' => '0', 'field' => 'reports', 'operator' => '>')));
-        $iNum2 = $oSearch->getNum();
-
+        $iNum1 = $this->_oDb->getEntriesNumByParams([
+            [
+                'key' => 'status', 
+                'value' => BX_TIMELINE_STATUS_HIDDEN, 
+                'operator' => '='
+            ]
+        ]);
+        
+        $iNum2 = $this->_oDb->getEntriesNumByParams([
+            [
+                'key' => 'reports',
+                'value' => '0', 
+                'operator' => '>'
+            ]
+        ]);
+        
         return array(
             'counter1_value' => $iNum1, 
             'counter2_value' => $iNum2,