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 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) {

@ -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 = "";

@ -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()),
};
}
}

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

Loading…
Cancel
Save