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.
35 lines
1.1 KiB
35 lines
1.1 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":
|
|
Post post = Post.LoadById(int.Parse(context.httprequest.QueryString["Number"]));
|
|
return "/Thread/" + post.thread.id.ToString() + "/p" + post.id.ToString();
|
|
case "showthreaded":
|
|
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]);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|