<?php
###
### Pastebin.ca (c) 2003-2005 Stephen Olesen
### All rights reserved.
###
### $Id: raw.php 233 2005-05-05 20:46:56Z slepp $
###
### Download the raw content of a paste.
require("template.php");
header("Content-Type: text/plain");
OpenDatabase();
if($_SERVER["PATH_INFO"] == "" ||
$_SERVER["PATH_INFO"] == "/") {
print _("Please specify http://pastebin.ca/raw/XXXX where XXXX is the post number.")."\n";
exit;
}
$_GET["id"] = substr($_SERVER["PATH_INFO"],1);
if(isset($_GET["id"]) && is_numeric($_GET["id"])) {
$Post = GetPost($_GET["id"], $VirtualUser);
if($Post === false || $Post['id_mask'] != '') {
header("HTTP/1.0 410 Post Not Found or Invalid");
print _("Invalid post ID.")."\n";
exit;
}
header("ETag: \"".md5($Post["content"].$Post["posted"].$Post["id"])."\"");
header("Last-Modified: ".gmdate("D, d M Y H:i:s") . ' GMT');
print $Post["content"];
pg_Close($DB);
exit;
}
print _("Invalid request. Please use the format of http://pastebin.ca/raw/XXXX where XXXX is a post number.")."\n";
pg_Close($DB);
?>