diff --git a/components/OssnPhotos/ossn_com.php b/components/OssnPhotos/ossn_com.php index 34b7f353b..ab2742e0c 100644 --- a/components/OssnPhotos/ossn_com.php +++ b/components/OssnPhotos/ossn_com.php @@ -85,14 +85,15 @@ function ossn_photos_initialize(){ 'icon' => $icon, )); //Non friend may able to add comment to friend photo only [huntr.dev] #1979 - ossn_register_callback('comment', 'before:created', 'ossn_photos_comment_permission_check'); + ossn_register_callback('comment', 'before:created', 'ossn_photos_like_comment_permission_check'); + ossn_register_callback('like', 'before:created', 'ossn_photos_like_comment_permission_check'); } //gallery plugin dist include ossn_new_external_js('jquery.fancybox.min.js', '//cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js', false); ossn_new_external_css('jquery.fancybox.min.css', '//cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css', false); } /** - * Comment photos check before comment + * Like & Comment on photos check before like & comment * * @param string $callback comment * @param string $type before:created @@ -100,7 +101,7 @@ function ossn_photos_initialize(){ * * @access private */ -function ossn_photos_comment_permission_check($callback, $type, $params){ +function ossn_photos_like_comment_permission_check($callback, $type, $params){ if(isset($params['type']) && $params['type'] == 'entity'){ if(isset($params['entity']) && isset($params['entity']->subtype) && $params['entity']->subtype == 'file:ossn:aphoto'){ $album = ossn_get_object($params['entity']->owner_guid); @@ -112,9 +113,18 @@ function ossn_photos_comment_permission_check($callback, $type, $params){ redirect(REF); } else { header('Content-Type: application/json'); - echo json_encode(array( - 'process' => 0, - )); + if($callback == 'comment'){ + echo json_encode(array( + 'process' => 0, + )); + } + if($callback == 'like'){ + echo json_encode(array( + 'done' => 0, + 'container' => false, + 'button' => ossn_print('ossn:like'), + )); + } exit(); } } @@ -598,6 +608,7 @@ function ossn_album_page_handler($album){ 'text' => ossn_print('back'), 'href' => ossn_site_url("u/{$user['user']->username}/photos"), 'class' => 'button-grey', + ); $control = ossn_plugin_view('output/url', $back); //view profile photos in module layout