Stubs removed from main page; Session LastActivity fixed

main
Inga 🏳‍🌈 15 years ago
parent 4674d80692
commit 24686a37af
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Builder/IISUploadHandler/build.txt
  3. 3
      Common/Config.cs
  4. 2
      IISMainHandler/WebContext.cs
  5. 21
      IISMainHandler/handlers/BoardsHandler.cs
  6. 17
      templates/Full/Boards.xslt

@ -25,6 +25,8 @@ namespace FLocal.Common {
public readonly string UploaderUrl; public readonly string UploaderUrl;
public readonly TimeSpan ActivityThreshold;
protected Config(NameValueCollection data) : base(data) { protected Config(NameValueCollection data) : base(data) {
this.InitTime = DateTime.Now.ToLongTimeString(); this.InitTime = DateTime.Now.ToLongTimeString();
this.mainConnection = new MySQLConnector.Connection(data["ConnectionString"], MySQLConnector.PostgresDBTraits.instance); this.mainConnection = new MySQLConnector.Connection(data["ConnectionString"], MySQLConnector.PostgresDBTraits.instance);
@ -34,6 +36,7 @@ namespace FLocal.Common {
this.SaltPasswords = data["SaltPasswords"]; this.SaltPasswords = data["SaltPasswords"];
this.SaltUploader = data["SaltUploader"]; this.SaltUploader = data["SaltUploader"];
this.UploaderUrl = data["UploaderUrl"]; this.UploaderUrl = data["UploaderUrl"];
this.ActivityThreshold = TimeSpan.FromMinutes(int.Parse(data["ActivityThreshold"]));
} }
public static void Init(NameValueCollection data) { public static void Init(NameValueCollection data) {

@ -5,6 +5,7 @@ using System.Text;
using System.Web; using System.Web;
using FLocal.Core; using FLocal.Core;
using FLocal.Common.dataobjects; using FLocal.Common.dataobjects;
using FLocal.Common.actions;
using System.Xml.Linq; using System.Xml.Linq;
namespace FLocal.IISHandler { namespace FLocal.IISHandler {
@ -69,6 +70,7 @@ namespace FLocal.IISHandler {
try { try {
this.session = Session.LoadByKey(sessionCookie.Value); this.session = Session.LoadByKey(sessionCookie.Value);
sessionCookie.Expires = DateTime.Now.AddDays(3); sessionCookie.Expires = DateTime.Now.AddDays(3);
this.session.updateLastActivity();
this.httpresponse.AppendCookie(sessionCookie); this.httpresponse.AppendCookie(sessionCookie);
} catch(NotFoundInDBException) { } catch(NotFoundInDBException) {
sessionCookie.Value = ""; sessionCookie.Value = "";

@ -6,6 +6,9 @@ using System.Web;
using System.Xml.Linq; using System.Xml.Linq;
using FLocal.Common; using FLocal.Common;
using FLocal.Common.dataobjects; using FLocal.Common.dataobjects;
using FLocal.Core;
using FLocal.Core.DB;
using FLocal.Core.DB.conditions;
namespace FLocal.IISHandler.handlers { namespace FLocal.IISHandler.handlers {
@ -18,7 +21,23 @@ namespace FLocal.IISHandler.handlers {
} }
override protected XElement[] getSpecificData(WebContext context) { 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()),
};
} }
} }

@ -31,15 +31,20 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<br /> <br />
<xsl:text>18983 Зарегистрированных пользователей.</xsl:text> <xsl:value-of select="totalRegistered"/>
<xsl:text> Зарегистрированных пользователей.</xsl:text>
<br /> <br />
<xsl:text>Приветствуем нового пользователя, </xsl:text> <!--xsl:text>Приветствуем нового пользователя, </xsl:text>
<a href="/showprofile.php?User=_PC&amp;What=ubbthreads">_PC</a> <a href="/showprofile.php?User=_PC&amp;What=ubbthreads">_PC</a>
<br /-->
<xsl:text>За последние </xsl:text>
<xsl:value-of select="activity/threshold"/>
<xsl:text> форум посещало </xsl:text>
<xsl:value-of select="activity/sessions"/>
<xsl:text> зарегистрированных пользователей.</xsl:text>
<br /> <br />
<xsl:text>Сейчас 222 зарегистрированных и 54 анонимных пользователей в онлайне.</xsl:text> <a href="/editdisplay.php?Cat=#offset">Текущее время:</a><xsl:text> </xsl:text>
<br /> <xsl:apply-templates select="currentDate" mode="dateTime"/>
<a href="/editdisplay.php?Cat=#offset">Текущее время:</a>
<xsl:text> 08.06.2010 14:17, Вторник</xsl:text>
</td> </td>
<td width="30%" class="small" valign="top"> <td width="30%" class="small" valign="top">
<b>Ïðîñìîòð íîâûõ ñîîáùåíèé</b> <b>Ïðîñìîòð íîâûõ ñîîáùåíèé</b>

Loading…
Cancel
Save