From 501b26ef4cc1e36be6ceb994b3571eb0eff964e6 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 19 Feb 2010 03:21:07 +0100 Subject: some changes --- paste/include/storage/MysqlStorage.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'paste/include/storage/MysqlStorage.php') diff --git a/paste/include/storage/MysqlStorage.php b/paste/include/storage/MysqlStorage.php index 5dd24c3..bd532b5 100644 --- a/paste/include/storage/MysqlStorage.php +++ b/paste/include/storage/MysqlStorage.php @@ -76,6 +76,8 @@ INDEX (nick) public function setContent($content, $language, $nick, $description) { + global $config; + $name = sha1(date('r') . rand(1000, getrandmax())); if ($stmt = $this->mysql->prepare( 'INSERT INTO ' . $this->table . ' @@ -94,10 +96,17 @@ INDEX (nick) $stmt->close(); } + + if (isset($config['short_results_path'])) + return $config['short_results_path'] . $pid; + + return $config['site_domain'] . $config['site_path'] . 'get.php?p=' . $name; } public function getContent($pid) { + global $config; + if ($stmt = $this->mysql->prepare( 'SELECT nick, language, content, description, time FROM ' . $this->table . ' WHERE pid = ? LIMIT 1')) @@ -120,7 +129,9 @@ INDEX (nick) $stmt->close(); - echo PastifyText($content, $lang, $description); + $get_url = $config['site_domain'] . $config['site_path'] . 'get.php?p=' . $pid; + $remove_url = $config['site_domain'] . $config['site_path'] . 'remove.php?p=' . $pid . '&t=' . $this->generateToken($pid); + echo PastifyText($content, $lang, $description, $get_url, $remove_url); } } -- cgit v1.2.3