From 9b3131861f8ab6485791c667e4d514a53a34bb80 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 3 Feb 2011 17:20:40 +0100 Subject: [PATCH 1/4] Extend lockview to show info on items, photos and events --- mod/lockview.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/mod/lockview.php b/mod/lockview.php index a886effeb..a99628b6e 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -2,12 +2,23 @@ function lockview_content(&$a) { - - $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); + + $type = (($a->argc > 1) ? $a->argv[1] : 0); + if (is_numeric($type)) { + $item_id = intval($type); + $type='item'; + } else { + $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0); + } + if(! $item_id) killme(); - $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", + if (!in_array($type, array('item','photo','event'))) + killme(); + + $r = q("SELECT * FROM `%s` WHERE `id` = %d LIMIT 1", + dbesc($type), intval($item_id) ); if(! count($r)) @@ -37,6 +48,7 @@ function lockview_content(&$a) { dbesc(implode(', ', $allowed_groups)) ); if(count($r)) + if($item['uid'] != local_user()) foreach($r as $rr) $l[] = '' . $rr['name'] . ''; } @@ -68,7 +80,11 @@ function lockview_content(&$a) { } - echo $o . implode(', ', $l); + if (count($l)>0) { + echo $o . implode(', ', $l); + } else { + echo $o . t('nobody'); + } killme(); } From bed0391e6fb058c9f1165e40cdac552f2819808b Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 3 Feb 2011 17:24:58 +0100 Subject: [PATCH 2/4] Show lock info on photos --- mod/photos.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mod/photos.php b/mod/photos.php index 82060378e..c80a82e66 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -907,7 +907,15 @@ function photos_content(&$a) { $o .= '

' . '' . $ph[0]['album'] . '

'; if($can_post && ($ph[0]['uid'] == $owner_uid)) { - $o .= ''; + $o .= ''; } From c15c550a065add37cde0096dd495dd6c2731eb1b Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 3 Feb 2011 17:25:10 +0100 Subject: [PATCH 3/4] Fix tabs --- mod/lockview.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mod/lockview.php b/mod/lockview.php index a99628b6e..93baede9d 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -4,21 +4,21 @@ function lockview_content(&$a) { $type = (($a->argc > 1) ? $a->argv[1] : 0); - if (is_numeric($type)) { - $item_id = intval($type); - $type='item'; - } else { - $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0); - } + if (is_numeric($type)) { + $item_id = intval($type); + $type='item'; + } else { + $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0); + } if(! $item_id) killme(); - if (!in_array($type, array('item','photo','event'))) - killme(); + if (!in_array($type, array('item','photo','event'))) + killme(); $r = q("SELECT * FROM `%s` WHERE `id` = %d LIMIT 1", - dbesc($type), + dbesc($type), intval($item_id) ); if(! count($r)) @@ -80,11 +80,11 @@ function lockview_content(&$a) { } - if (count($l)>0) { - echo $o . implode(', ', $l); - } else { - echo $o . t('nobody'); - } + if (count($l)>0) { + echo $o . implode(', ', $l); + } else { + echo $o . t('nobody'); + } killme(); } From b5c3fb1545b67b2cce501e916483606300fe82a9 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Thu, 3 Feb 2011 19:42:32 +0100 Subject: [PATCH 4/4] remove an erroneously pasted line --- mod/lockview.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mod/lockview.php b/mod/lockview.php index 93baede9d..9e64e2608 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -48,7 +48,6 @@ function lockview_content(&$a) { dbesc(implode(', ', $allowed_groups)) ); if(count($r)) - if($item['uid'] != local_user()) foreach($r as $rr) $l[] = '' . $rr['name'] . ''; } @@ -80,11 +79,7 @@ function lockview_content(&$a) { } - if (count($l)>0) { - echo $o . implode(', ', $l); - } else { - echo $o . t('nobody'); - } + echo $o . implode(', ', $l); killme(); }