Просмотр исходного кода

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

AntonLV 9 лет назад
Родитель
Сommit
d7a0621c8b

+ 2 - 2
inc/classes/BxDolProfile.php

@@ -87,10 +87,10 @@ class BxDolProfile extends BxDolFactory implements iBxDolProfile
     /**
     /**
      * Get singleton instance of Profile by Account id (currently active profile is returned)
      * Get singleton instance of Profile by Account id (currently active profile is returned)
      */
      */
-    public static function getInstanceByAccount($iAccountId = false)
+    public static function getInstanceByAccount($iAccountId = false, $bClearCache = false)
     {
     {
         $oQuery = BxDolProfileQuery::getInstance();
         $oQuery = BxDolProfileQuery::getInstance();
-        $mixedProfileId = $oQuery->getCurrentProfileByAccount($iAccountId);
+        $mixedProfileId = $oQuery->getCurrentProfileByAccount($iAccountId, $bClearCache);
 
 
         return self::getInstance($mixedProfileId);
         return self::getInstance($mixedProfileId);
     }
     }

+ 5 - 2
inc/classes/BxDolProfileQuery.php

@@ -117,10 +117,13 @@ class BxDolProfileQuery extends BxDolDb implements iBxDolSingleton
      * @param  string  $iAccountId account id
      * @param  string  $iAccountId account id
      * @return current account's profile id
      * @return current account's profile id
      */
      */
-    public function getCurrentProfileByAccount ($iAccountId)
+    public function getCurrentProfileByAccount ($iAccountId, $bClearCache = false)
     {
     {
-        $sSql = $this->prepare("SELECT `profile_id` FROM `sys_accounts` WHERE `id` = ? LIMIT 1", $iAccountId);
         $sKey = 'BxDolProfileQuery::getCurrentProfileByAccount' . $iAccountId;
         $sKey = 'BxDolProfileQuery::getCurrentProfileByAccount' . $iAccountId;
+        if ($bClearCache)
+            $this->cleanMemory($sKey);
+
+        $sSql = $this->prepare("SELECT `profile_id` FROM `sys_accounts` WHERE `id` = ? LIMIT 1", $iAccountId);        
         $iProfileId = $this->fromMemory($sKey, 'getOne', $sSql);
         $iProfileId = $this->fromMemory($sKey, 'getOne', $sSql);
         if (!$iProfileId) {
         if (!$iProfileId) {
             $this->cleanMemory($sKey);
             $this->cleanMemory($sKey);

+ 2 - 2
modules/base/connect/classes/BxBaseModConnectModule.php

@@ -164,7 +164,7 @@ class BxBaseModConnectModule extends BxBaseModGeneralModule
         // create new profile
         // create new profile
         if ($oExistingAccount) {
         if ($oExistingAccount) {
 
 
-            if (!($oExistingProfile = BxDolProfile::getInstanceByAccount($oExistingAccount->id())))
+            if (!($oExistingProfile = BxDolProfile::getInstanceByAccount($oExistingAccount->id(), true)))
                 return _t('_sys_txt_error_account_creation');
                 return _t('_sys_txt_error_account_creation');
 
 
             $iProfileId = $oExistingProfile->id();
             $iProfileId = $oExistingProfile->id();
@@ -195,7 +195,7 @@ class BxBaseModConnectModule extends BxBaseModGeneralModule
                 if ($sErrorMsg = $oFormHelperProfile->onDataAddAfter ($iAccountId, $iContentId))
                 if ($sErrorMsg = $oFormHelperProfile->onDataAddAfter ($iAccountId, $iContentId))
                     return $sErrorMsg;
                     return $sErrorMsg;
                 
                 
-                $oProfile = BxDolProfile::getInstanceByAccount($iAccountId);
+                $oProfile = BxDolProfile::getInstanceByAccount($iAccountId, true);
                 $iProfileId = $oProfile->id();
                 $iProfileId = $oProfile->id();
             } 
             } 
             else {
             else {

+ 3 - 3
modules/base/general/classes/BxBaseModGeneralFormEntry.php

@@ -61,10 +61,10 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         if (isset($CNF['FIELD_AUTHOR']) && empty($aValsToAdd[$CNF['FIELD_AUTHOR']]))
         if (isset($CNF['FIELD_AUTHOR']) && empty($aValsToAdd[$CNF['FIELD_AUTHOR']]))
             $aValsToAdd[$CNF['FIELD_AUTHOR']] = bx_get_logged_profile_id ();
             $aValsToAdd[$CNF['FIELD_AUTHOR']] = bx_get_logged_profile_id ();
 
 
-        if (isset($CNF['FIELD_ADDED']) && empty($aValsToAdd[$CNF['FIELD_ADDED']]))
+        if (isset($CNF['FIELD_ADDED']) && empty($aValsToAdd[$CNF['FIELD_ADDED']]) && empty($this->getCleanValue($CNF['FIELD_ADDED'])))
             $aValsToAdd[$CNF['FIELD_ADDED']] = time();
             $aValsToAdd[$CNF['FIELD_ADDED']] = time();
 
 
-        if (isset($CNF['FIELD_CHANGED']) && empty($aValsToAdd[$CNF['FIELD_CHANGED']]))
+        if (isset($CNF['FIELD_CHANGED']) && empty($aValsToAdd[$CNF['FIELD_CHANGED']]) && empty($this->getCleanValue($CNF['FIELD_CHANGED'])))
             $aValsToAdd[$CNF['FIELD_CHANGED']] = time();
             $aValsToAdd[$CNF['FIELD_CHANGED']] = time();
 
 
         return parent::insert ($aValsToAdd, $isIgnore);
         return parent::insert ($aValsToAdd, $isIgnore);
@@ -74,7 +74,7 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
     {
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
         $CNF = &$this->_oModule->_oConfig->CNF;
 
 
-        if (isset($CNF['FIELD_CHANGED']))
+        if (isset($CNF['FIELD_CHANGED']) && empty($aValsToAdd[$CNF['FIELD_CHANGED']]) && empty($this->getCleanValue($CNF['FIELD_CHANGED'])))
             $aValsToAdd[$CNF['FIELD_CHANGED']] = time();
             $aValsToAdd[$CNF['FIELD_CHANGED']] = time();
             
             
         return parent::update ($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
         return parent::update ($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);

+ 0 - 1
samples/interface.php

@@ -33,7 +33,6 @@ $oTemplate->setPageHeader ("Interface elements");
 $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
 $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
 $oTemplate->addCss(BX_DOL_URL_PLUGINS_PUBLIC . 'jush/jush.css');
 $oTemplate->addCss(BX_DOL_URL_PLUGINS_PUBLIC . 'jush/jush.css');
 $oTemplate->addJs(BX_DOL_URL_PLUGINS_PUBLIC . 'jush/jush.js');
 $oTemplate->addJs(BX_DOL_URL_PLUGINS_PUBLIC . 'jush/jush.js');
-$oTemplate->addJs(BX_DOL_URL_ROOT . 'samples/jquery.smint.js');
 $oTemplate->getPageCode();
 $oTemplate->getPageCode();
 
 
 /**
 /**