From 8242c982ebcdfc67274c8ab79a2f34aa451872d7 Mon Sep 17 00:00:00 2001 From: "cohen.jacob" Date: Thu, 13 Aug 2009 05:09:54 +0000 Subject: Initial port of rafb.net codebase from rafb.net to Google Code. git-svn-id: http://rafb-nopaste.googlecode.com/svn/trunk@2 6adb9682-87ac-11de-b610-71a7c637a048 --- paste/paste.php | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 paste/paste.php (limited to 'paste/paste.php') diff --git a/paste/paste.php b/paste/paste.php new file mode 100644 index 0000000..17cec80 --- /dev/null +++ b/paste/paste.php @@ -0,0 +1,107 @@ + 20) + $language = substr($language, 0, 20); + $language = stripslashes($language); + $language = strip_tags($language); + $language = htmlspecialchars($language, ENT_QUOTES); + } + else + { + $language = "Plain Text"; + } + + + # Add a description if available + if (isset($_POST['desc']) && "" != ($dtemp = rtrim($_POST['desc']))) + { + $desc = stripslashes($dtemp); + if (strlen($desc) > 80) + { + $desc = substr($desc, 0, 76); + $desc .= " ..."; + } + $desc = strip_tags($desc); + $desc = htmlspecialchars($desc, ENT_QUOTES); + if ("" == $desc) + $desc = "No description"; + } + else + $desc = "No description"; + + + if (get_magic_quotes_gpc()) + $text = stripslashes($text); + + $finalText = PastifyText($text, $language, $desc); + $url = CreatePage($finalText); + + # Note: this function was pretty specific to my implementation. It stored + # paste metadata about the language used, description, and URL, as well as + # a timestamp (but the raw pastes were never preserved - they always expired + # as promised after 24 hours) + #add_to_db($desc, $language, $url); + + Header("Location: $url"); +} +else +{ + header("Location: " . $_SERVER['HTTP_REFERER']); + exit; +} + +?> -- cgit v1.2.3