static function init() { // override autoloader spl_autoload_register('SnS::autoload'); self::$files_base = dirname(dirname(__FILE__)) . "/files/"; Db::init(); }
public function run() { self::fetch(); // if they're not running any kind of js analytics, redirect immediately if (self::is_url() && !Config::$analytics) { Response::redirect(self::$long); } self::$url = SnS::make_url(self::url()); return self::$template; }
public function save() { if (!$this->store_file()) { throw new Error_Save("failed to move"); } if (!parent::save()) { throw new Error_Save("failed to store"); } // override long now so we can display it properly $this->long = SnS::make_url("file/" . $this->short . "-" . $this->long); }
<?php require "../lib/sns.php"; try { SnS::init(); SnS::run(); } catch (Exception $e) { Response::fail($e->getMessage(), $e->getHTTPCode()); }
<?php include "../lib/sns.php"; SnS::init(); ?> <!doctype html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Short 'n Sweet</title> <meta name="description" content="andre bluehs file upload hosting"> <meta name="author" content="Andre Bluehs"> <link rel="shortcut icon" href="http://abcdn.us/img/andrebluehs/favicon.png" /> <link rel="stylesheet" href="http://abcdn.us/css/andrebluehs/style.css" /> </head> <body> <div id='header'> <div id='header-left'> <h2>Short 'n Sweet</h2> </div> <div id='header-right'> <ul class='horizontal'> <li><a href='http://github.com/helloandre/shortnsweet/' target='_blank'>view source on github</a></li> </ul> </div> </div> <div id='sub-header'>
static function out() { return array('url' => SnS::make_url(self::$object->short), 'long' => self::$object->long, 'name' => self::$object->name); }
<meta name="author" content="Andre Bluehs"> <link rel="shortcut icon" href="http://abcdn.us/img/andrebluehs/favicon.png" /> <link rel="stylesheet" href="http://abcdn.us/css/andrebluehs/style.css" /> </head> <body> <div id='header'> <div id='header-left'> <h2>Short 'n Sweet</h2> </div> <div id='header-right'> <ul class='horizontal'> <li><a href='http://github.com/helloandre/shortnsweet/' target='_blank'>view source on github</a></li> </ul> </div> </div> <div id='sub-header'> <h1>Error</h1> </div> <div id='center' class='post'> <h2><a href="<?php echo SnS::make_url('install/'); ?> ">Try Again</a><h2> </div> </body>
<link rel="shortcut icon" href="http://abcdn.us/img/andrebluehs/favicon.png" /> <link rel="stylesheet" href="http://abcdn.us/css/andrebluehs/style.css" /> </head> <body> <div id='header'> <div id='header-left'> <h2>Short 'n Sweet</h2> </div> <div id='header-right'> <ul class='horizontal'> <li><a href='http://github.com/helloandre/shortnsweet/' target='_blank'>view source on github</a></li> </ul> </div> </div> <div id='sub-header'> <h1>Installation Complete!</h1> </div> <div id='center' class='post'> <h1>Remove the /config directory</h1> <h2><a href="<?php echo SnS::make_url(''); ?> ">Visit your site</a><h2> </div> </body>