aboutsummaryrefslogtreecommitdiff
path: root/www/go.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-01-16 08:08:24 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-01-16 08:08:24 +0000
commit70e233b7de32f12342478c0ae8af68d6149ca72d (patch)
tree2e872eb642bfa8b4a5d487ed2a6614f8c007386e /www/go.php
parent6bc190b6725f4e644717ef3f5302323e40984aef (diff)
downloadsemanticscuttle-70e233b7de32f12342478c0ae8af68d6149ca72d.tar.gz
semanticscuttle-70e233b7de32f12342478c0ae8af68d6149ca72d.tar.bz2
first shorturl redirection implementation
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@575 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'www/go.php')
-rw-r--r--www/go.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/www/go.php b/www/go.php
new file mode 100644
index 0000000..d306be0
--- /dev/null
+++ b/www/go.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+require_once '../src/SemanticScuttle/header.php';
+
+if (!isset($_SERVER['PATH_INFO'])) {
+ header('HTTP/1.0 400 Bad Request');
+ header('Content-Type: text/plain');
+ echo 'Short URL name missing';
+ exit();
+}
+
+list($url, $short) = explode('/', $_SERVER['PATH_INFO']);
+
+$bs = SemanticScuttle_Service_Factory::get('Bookmark');
+$bookmark = $bs->getBookmarkByShortname($short);
+if ($bookmark === false) {
+ header('HTTP/1.0 404 Not found');
+ header('Content-Type: text/plain');
+ echo 'No bookmark found with short name of: ' . $short;
+ exit();
+}
+
+header('HTTP/1.0 302 Found');
+header('Location: ' . $bookmark['bAddress']);
+?> \ No newline at end of file