Wiki.Page Save()
{
// Get the slashes correct and trim it
txtPath.Text = txtPath.Text.Replace('\\', '/').Trim();
// Ensure they start with a slash
if (!txtPath.Text.StartsWith("/")) txtPath.Text = "/" + txtPath.Text;
// Ensure its a unique name
String path = txtPath.Text;
string newurlpath = Wiki.Page.PathToUrlPath(path);
// Are they renaming it? If so, check for dupes
if (urlpath.ToLower() != newurlpath.ToLower()) {
int uniqCount = 2;
while (DbServices.PageExistsWithUrlpath(newurlpath)) {
path = txtPath.Text + " " + uniqCount.ToString();
newurlpath = Wiki.Page.PathToUrlPath(path);
uniqCount++;
}
}
Wiki.Page page = DbServices.FindPageByUrlpath(urlpath);
page.path = path;
page.contents = txtRichEditor.Text.Trim();
page.author = Auth.UserName;
page.Save();
return page;
}
private void ReturnFile(Edit e, string region) { Response.Clear(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.DAT", e.Name.ToUpper())); byte[] data = File.ReadAllBytes(Server.MapPath(string.Format("/dats/{0}/{1}.DAT", region, e.ID))); Response.OutputStream.Write(data, 0, data.Length); Response.Flush(); Response.Close(); e.Downloads++; e.Save(); }