Browse Source

Ticket #5338 - Issues with labels. Point 1.

AntonLV 9 tháng trước cách đây
mục cha
commit
2847addbde

+ 5 - 4
modules/base/general/classes/BxBaseModGeneralDb.php

@@ -22,15 +22,16 @@ class BxBaseModGeneralDb extends BxDolModuleDb
         $this->_oConfig = $oConfig;
     }
 
-    public function getContentInfoById ($iContentId)
+    public function getContentInfoById ($iContentId, $bForceGet = false)
     {
         $CNF = &$this->_oConfig->CNF;
 
         if(empty($CNF['TABLE_ENTRIES']) || empty($CNF['FIELD_ID']))
-            return array();
+            return [];
 
-        $sQuery = $this->prepare ("SELECT * FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE `" . $CNF['FIELD_ID'] . "` = ?", $iContentId);
-        return $this->getRow($sQuery);
+        return $this->getRow("SELECT * FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE `" . $CNF['FIELD_ID'] . "` = :id", [
+            'id' => $iContentId
+        ]);
     }
 
     function getEntriesBy($aParams = array())

+ 1 - 1
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -3918,7 +3918,7 @@ class BxBaseModGeneralModule extends BxDolModule
         if(empty($CNF['OBJECT_METATAGS']))
             return false;
 
-        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId, true);
 
         $bFldStatus = !empty($CNF['FIELD_STATUS']);
         $bFldStatusAdmin = !empty($CNF['FIELD_STATUS_ADMIN']);

+ 12 - 4
modules/base/profile/classes/BxBaseModProfileDb.php

@@ -19,13 +19,20 @@ class BxBaseModProfileDb extends BxBaseModGeneralDb
         parent::__construct($oConfig);
     }
 
-    public function getContentInfoById ($iContentId)
+    public function getContentInfoById ($iContentId, $bForceGet = false)
     {
-        $aInfo = $this->fromMemory("profile_content_info_" . $this->_oConfig->getName() . $iContentId, 'getRow', "SELECT `c`.*, `p`.`account_id`, `p`.`id` AS `profile_id`, `a`.`email` AS `profile_email`, `a`.`active` AS `profile_last_active`, `a`.`ip` AS `profile_ip`, `p`.`status` AS `profile_status` FROM `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` AS `c` INNER JOIN `sys_profiles` AS `p` ON (`p`.`content_id` = `c`.`id` AND `p`.`type` = :type) INNER JOIN `sys_accounts` AS `a` ON (`p`.`account_id` = `a`.`id`) WHERE `c`.`id` = :id", [
+        $sQuery = "SELECT `c`.*, `p`.`account_id`, `p`.`id` AS `profile_id`, `a`.`email` AS `profile_email`, `a`.`active` AS `profile_last_active`, `a`.`ip` AS `profile_ip`, `p`.`status` AS `profile_status` FROM `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` AS `c` INNER JOIN `sys_profiles` AS `p` ON (`p`.`content_id` = `c`.`id` AND `p`.`type` = :type) INNER JOIN `sys_accounts` AS `a` ON (`p`.`account_id` = `a`.`id`) WHERE `c`.`id` = :id";
+        $aBindings = [
             'type' => $this->_oConfig->getName(),
             'id' => $iContentId
-        ]);
-        
+        ];
+
+        $aInfo = [];
+        if($bForceGet)
+            $aInfo = $this->getRow($sQuery, $aBindings);
+        else
+            $aInfo = $this->fromMemory("profile_content_info_" . $this->_oConfig->getName() . $iContentId, 'getRow', $sQuery, $aBindings);
+
         /**
          * @hooks
          * @hookdef hook-profile-content_info_by_id 'profile', 'content_info_by_id' - hook to modify profile info retrieved by content id
@@ -42,6 +49,7 @@ class BxBaseModProfileDb extends BxBaseModGeneralDb
             'module' => $this->_oConfig->getName(), 
             'info' => &$aInfo
         ]);
+
         return $aInfo;
     }
 

+ 1 - 1
modules/boonex/events/classes/BxEventsDb.php

@@ -29,7 +29,7 @@ class BxEventsDb extends BxBaseModGroupsDb
         return $this->getContentInfoById ($iContentId);
     }
 
-    public function getContentInfoById ($iContentId)
+    public function getContentInfoById ($iContentId, $bForceGet = false)
     {
         $sQuery = $this->prepare ("SELECT `c`.*, `p`.`account_id`, `p`.`id` AS `profile_id`, `p`.`status` AS `profile_status`, MAX(`i`.`repeat_stop`) AS `repeat_stop` FROM `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` AS `c` 
             INNER JOIN `sys_profiles` AS `p` ON (`p`.`content_id` = `c`.`id` AND `p`.`type` = ?) 

+ 2 - 2
modules/boonex/polls/classes/BxPollsDb.php

@@ -19,9 +19,9 @@ class BxPollsDb extends BxBaseModTextDb
         parent::__construct($oConfig);
     }
 
-    public function getContentInfoById ($iContentId)
+    public function getContentInfoById ($iContentId, $bForceGet = false)
     {
-        $aContentInfo = parent::getContentInfoById($iContentId);
+        $aContentInfo = parent::getContentInfoById($iContentId, $bForceGet);
         if(!empty($aContentInfo) && is_array($aContentInfo))
             $aContentInfo['salt'] = $this->_oConfig->getSalt();