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

Ticket #255 - Clean up: Online pages in Profile based modules.

AntonLV 10 лет назад
Родитель
Сommit
5e19524e0e

+ 1 - 1
inc/classes/BxDolSession.php

@@ -98,7 +98,7 @@ class BxDolSession extends BxDol implements iBxDolSingleton
 		$this->iUserId = (int)$mixedSession['user_id'];
 		$this->aData = unserialize($mixedSession['data']);
 
-		$this->oDb->update($this->sId);
+		$this->oDb->update($this->sId);		//--- update session's time
 		return true;
     }
 

+ 6 - 0
inc/classes/BxDolSessionQuery.php

@@ -32,6 +32,12 @@ class BxDolSessionQuery extends BxDolDb
     }
     function save($sId, $aSet)
     {
+    	if(isset($aSet['user_id']) && (int)$aSet['user_id'] > 0)
+			$this->query("DELETE FROM `" . $this->sTable . "` WHERE `id`<>:id AND `user_id`=:user_id", array(
+				'id' => $sId,
+				'user_id' => (int)$aSet['user_id']
+			));
+
     	$aSet['id'] = $sId;
         return (int)$this->query("REPLACE INTO `" . $this->sTable . "` SET " . $this->arrayToSQL($aSet) . ", `date`=UNIX_TIMESTAMP()") > 0;
     }

+ 1 - 2
install/sql/system.sql

@@ -387,7 +387,7 @@ INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `hidden`, `or
 SET @iCategoryId = LAST_INSERT_ID();
 
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
-(@iCategoryId, 'sys_account_online_time', '_adm_stg_cpt_option_sys_account_online_time', '1', 'digit', '', 'Avail', '_adm_stg_err_option_sys_account_online_time', 1),
+(@iCategoryId, 'sys_account_online_time', '_adm_stg_cpt_option_sys_account_online_time', '5', 'digit', '', 'Avail', '_adm_stg_err_option_sys_account_online_time', 1),
 (@iCategoryId, 'sys_account_autoapproval', '_adm_stg_cpt_option_sys_account_autoapproval', 'on', 'checkbox', '', '', '', 10);
 
 
@@ -661,7 +661,6 @@ CREATE TABLE IF NOT EXISTS `sys_sessions` (
   `data` text collate utf8_unicode_ci,
   `date` int(10) unsigned NOT NULL default '0',
   PRIMARY KEY (`id`),
-  UNIQUE KEY `session` (`id`, `user_id`),
   KEY `user_id` (`user_id`),
   KEY `date` (`date`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

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

@@ -1147,7 +1147,7 @@
 	<string name="_adm_stg_cpt_option_site_title"><![CDATA[Site title]]></string>
 	<string name="_adm_stg_cpt_option_sys_account_autoapproval"><![CDATA[Automatic account activation after creation]]></string>
 	<string name="_adm_stg_cpt_option_sys_account_online_time"><![CDATA[Online status timeframe (minutes)]]></string>
-	<string name="_adm_stg_err_option_sys_account_online_time"><![CDATA[You need to enter a value greater then zero.]]></string>
+	<string name="_adm_stg_err_option_sys_account_online_time"><![CDATA[You need to enter a value greater than zero.]]></string>
 	<string name="_adm_stg_cpt_option_sys_acl_expire_notification_days"><![CDATA[Number of days before membership expiration to notify members (-1 = after expiration)]]></string>
 	<string name="_adm_stg_cpt_option_sys_acl_expire_notify_once"><![CDATA[Notify members about membership expiration only once (every day otherwise)]]></string>
 	<string name="_adm_stg_cpt_option_sys_add_nofollow"><![CDATA[Add "nofollow" attribute for external links]]></string>

+ 1 - 0
modules/boonex/organizations/classes/BxOrgsSearchResult.php

@@ -110,6 +110,7 @@ class BxOrgsSearchResult extends BxBaseModProfileSearchResult
                 $this->aCurrent['rss']['link'] = 'modules/?r=orgs/rss/' . $sMode;
                 $this->aCurrent['title'] = _t('_bx_orgs_page_title_browse_online');
                 $this->aCurrent['restriction']['online']['value'] = time() - 60 * (int)getParam('sys_account_online_time');
+                $this->aCurrent['restriction_sql'] = ' AND `sys_accounts`.`profile_id`=`sys_profiles`.`id`';
                 $this->aCurrent['sorting'] = 'online';
                 $this->sBrowseUrl = 'page.php?i=organizations-online';
                 break;

+ 1 - 0
modules/boonex/persons/classes/BxPersonsSearchResult.php

@@ -110,6 +110,7 @@ class BxPersonsSearchResult extends BxBaseModProfileSearchResult
                 $this->aCurrent['rss']['link'] = 'modules/?r=persons/rss/' . $sMode;
                 $this->aCurrent['title'] = _t('_bx_persons_page_title_browse_online');
                 $this->aCurrent['restriction']['online']['value'] = time() - 60 * (int)getParam('sys_account_online_time');
+                $this->aCurrent['restriction_sql'] = ' AND `sys_accounts`.`profile_id`=`sys_profiles`.`id`';
                 $this->aCurrent['sorting'] = 'online';
                 $this->sBrowseUrl = 'page.php?i=persons-online';
                 break;