You are here

function shurly_get_latest_short in ShURLy 6

Same name and namespace in other branches
  1. 8 shurly.module \shurly_get_latest_short()
  2. 7 shurly.module \shurly_get_latest_short()

Get the latest generated short URL by a given user for a given long URL

2 calls to shurly_get_latest_short()
shurly_create_form_validate in ./shurly.module
shurly_shorten in ./shurly.module
API function to shorten a URL @arg $long_url - the long URL to shorten @arg $custom - optional custom short URL, user_access('enter custom URLs') should be checked prior to calling shurly_shorten()

File

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

Code

function shurly_get_latest_short($long, $uid) {
  $hash = md5($long);
  return db_result(db_query("SELECT source FROM {shurly} WHERE hash = '%s' AND uid = %d AND custom = 0 AND active = 1 ORDER BY rid DESC LIMIT 1", $hash, $uid));
}