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]); } } } }