An alternative to UBB.threads
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FLocal/IISMainHandler/handlers/response/LegacyPHPHandler.cs

38 lines
1.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FLocal.Core;
using FLocal.Common;
using FLocal.Common.dataobjects;
namespace FLocal.IISHandler.handlers.response {
class LegacyPHPHandler : RedirectGetHandler {
protected override string getRedirectUrl(WebContext context) {
string[] scriptParts = context.requestParts[0].Split('.');
if(scriptParts.Length != 2) {
throw new FLocalException("wrong url");
}
if(scriptParts[1].ToLower() != "php") {
throw new FLocalException("wrong url");
}
switch(scriptParts[0].ToLower()) {
case "showflat":
case "ashowflat":
Post post = Post.LoadById(int.Parse(context.httprequest.QueryString["Number"]));
return "/Thread/" + post.thread.id.ToString() + "/p" + post.id.ToString();
case "showthreaded":
case "ashowthreaded":
return "/Post/" + int.Parse(context.httprequest.QueryString["Number"]).ToString() + "/";
case "postlist":
return "/Board/" + Board.LoadByLegacyName(context.httprequest.QueryString["Board"]).id.ToString() + "/";
default:
throw new NotImplementedException("unknown script " + scriptParts[0]);
}
}
}
}