diff options
-rw-r--r-- | mod/lockview.php | 17 | ||||
-rw-r--r-- | mod/photos.php | 10 |
2 files changed, 23 insertions, 4 deletions
diff --git a/mod/lockview.php b/mod/lockview.php index a886effeb..9e64e2608 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)) diff --git a/mod/photos.php b/mod/photos.php index f892e2ce2..52cc66eae 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -913,7 +913,15 @@ function photos_content(&$a) { $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']) . '">' . $ph[0]['album'] . '</a></h3>'; if($can_post && ($ph[0]['uid'] == $owner_uid)) { - $o .= '<div id="photo-edit-link-wrap" ><a id="photo-edit-link" href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/edit' . '">' . t('Edit photo') . '</a></div>'; + $o .= '<div id="photo-edit-link-wrap" ><a id="photo-edit-link" href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/edit' . '">' . t('Edit photo') . '</a>'; + + // lock + $o .= ( ( ($ph[0]['uid'] == local_user()) && (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid']) + || strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid'])) ) + ? ' - <img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,\'photo/' . $ph[0]['id'] . '\');" />' + : ''); + + $o .= '</div>'; } |