You are here

function shurly_boot in ShURLy 6

Same name and namespace in other branches
  1. 7 shurly.module \shurly_boot()

Implementation of hook_boot()

File

./shurly.module, line 99
description http://www.youtube.com/watch?v=Qo7qoonzTCE

Code

function shurly_boot() {

  // if the path has any slashes in it, it's not a short URL
  // so we can bail out and save ourselves a database call
  if (isset($_GET['q']) && strpos($_GET['q'], '/') === FALSE) {
    $row = db_fetch_object(db_query("SELECT rid, destination FROM {shurly} WHERE source = '%s' AND active = 1", $_GET['q']));
    if ($row) {
      shurly_goto($row);
    }
  }
}