From 8e8482355baa55a5c9e3cb3553eecf5a733e2897 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 23 Oct 2012 17:14:50 -0700 Subject: more heavy lifting --- mod/attach.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mod/attach.php') diff --git a/mod/attach.php b/mod/attach.php index ae6540201..f300ec6fb 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -4,17 +4,17 @@ require_once('include/security.php'); function attach_init(&$a) { - if($a->argc != 2) { + if(argc() != 2) { notice( t('Item not available.') . EOL); return; } - $item_id = intval($a->argv[1]); + $hash = argv(1); // Check for existence, which will also provide us the owner uid - $r = q("SELECT * FROM `attach` WHERE `id` = %d LIMIT 1", - intval($item_id) + $r = q("SELECT * FROM `attach` WHERE `hash` = '%s' LIMIT 1", + dbesc($hash) ); if(! count($r)) { notice( t('Item was not found.'). EOL); @@ -25,8 +25,8 @@ function attach_init(&$a) { // Now we'll see if we can access the attachment - $r = q("SELECT * FROM `attach` WHERE `id` = '%d' $sql_extra LIMIT 1", - dbesc($item_id) + $r = q("SELECT * FROM `attach` WHERE hash = '%s' $sql_extra LIMIT 1", + dbesc($hash) ); if(! count($r)) { -- cgit v1.2.3