diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 87d78b2..98c1572 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -322 \ No newline at end of file +327 \ No newline at end of file diff --git a/Builder/IISUploadHandler/build.txt b/Builder/IISUploadHandler/build.txt index 43c451e..fc9afb4 100644 --- a/Builder/IISUploadHandler/build.txt +++ b/Builder/IISUploadHandler/build.txt @@ -1 +1 @@ -54 \ No newline at end of file +59 \ No newline at end of file diff --git a/Common/Config.cs b/Common/Config.cs index 6b3c45b..472eeba 100644 --- a/Common/Config.cs +++ b/Common/Config.cs @@ -25,6 +25,8 @@ namespace FLocal.Common { public readonly string UploaderUrl; + public readonly TimeSpan ActivityThreshold; + protected Config(NameValueCollection data) : base(data) { this.InitTime = DateTime.Now.ToLongTimeString(); this.mainConnection = new MySQLConnector.Connection(data["ConnectionString"], MySQLConnector.PostgresDBTraits.instance); @@ -34,6 +36,7 @@ namespace FLocal.Common { this.SaltPasswords = data["SaltPasswords"]; this.SaltUploader = data["SaltUploader"]; this.UploaderUrl = data["UploaderUrl"]; + this.ActivityThreshold = TimeSpan.FromMinutes(int.Parse(data["ActivityThreshold"])); } public static void Init(NameValueCollection data) { diff --git a/IISMainHandler/WebContext.cs b/IISMainHandler/WebContext.cs index b83d78f..bb697cc 100644 --- a/IISMainHandler/WebContext.cs +++ b/IISMainHandler/WebContext.cs @@ -5,6 +5,7 @@ using System.Text; using System.Web; using FLocal.Core; using FLocal.Common.dataobjects; +using FLocal.Common.actions; using System.Xml.Linq; namespace FLocal.IISHandler { @@ -69,6 +70,7 @@ namespace FLocal.IISHandler { try { this.session = Session.LoadByKey(sessionCookie.Value); sessionCookie.Expires = DateTime.Now.AddDays(3); + this.session.updateLastActivity(); this.httpresponse.AppendCookie(sessionCookie); } catch(NotFoundInDBException) { sessionCookie.Value = ""; diff --git a/IISMainHandler/handlers/BoardsHandler.cs b/IISMainHandler/handlers/BoardsHandler.cs index c8ae6b8..175e476 100644 --- a/IISMainHandler/handlers/BoardsHandler.cs +++ b/IISMainHandler/handlers/BoardsHandler.cs @@ -6,6 +6,9 @@ using System.Web; using System.Xml.Linq; using FLocal.Common; using FLocal.Common.dataobjects; +using FLocal.Core; +using FLocal.Core.DB; +using FLocal.Core.DB.conditions; namespace FLocal.IISHandler.handlers { @@ -18,7 +21,23 @@ namespace FLocal.IISHandler.handlers { } override protected XElement[] getSpecificData(WebContext context) { - return new XElement[] { new XElement("categories", from category in Category.allCategories select category.exportToXmlForMainPage(context)) }; + return new XElement[] { + new XElement("categories", from category in Category.allCategories select category.exportToXmlForMainPage(context)), + new XElement("totalRegistered", Config.instance.mainConnection.GetCountByConditions(User.TableSpec.instance, new EmptyCondition(), new JoinSpec[0])), + new XElement("activity", + new XElement("threshold", Config.instance.ActivityThreshold.ToString()), + new XElement("sessions", Config.instance.mainConnection.GetCountByConditions( + Session.TableSpec.instance, + new ComparisonCondition( + Session.TableSpec.instance.getColumnSpec(Session.TableSpec.FIELD_LASTACTIVITY), + ComparisonType.GREATEROREQUAL, + DateTime.Now.Subtract(Config.instance.ActivityThreshold).ToUTCString() + ), + new JoinSpec[0] + )) + ), + new XElement("currentDate", DateTime.Now.ToXml()), + }; } } diff --git a/templates/Full/Boards.xslt b/templates/Full/Boards.xslt index 3e600d7..5265e7a 100644 --- a/templates/Full/Boards.xslt +++ b/templates/Full/Boards.xslt @@ -31,15 +31,20 @@
- 18983 Зарегистрированных пользователей. + + Зарегистрированных пользователей.
- Приветствуем нового пользователя, + + За последние + + форум посещало + + зарегистрированных пользователей.
- Сейчас 222 зарегистрированных и 54 анонимных пользователей в онлайне. -
- Текущее время: - 08.06.2010 14:17, Вторник + Текущее время: + Просмотр новых сообщений