/** * Delete comment menu * * @return voud; * @access private */ function ossn_comment_menu($name, $type, $params) { $OssnComment = new OssnComments(); if (is_object($params)) { $params = get_object_vars($params); } $comment = $OssnComment->getComment($params['id']); if ($comment->type == 'comments:post') { if (com_is_active('OssnWall')) { $ossnwall = new OssnWall(); $post = $ossnwall->GetPost($comment->subject_guid); //check if type is group if ($post->type == 'group') { $group = ossn_get_group_by_guid($post->owner_guid); } //group admins must be able to delete ANY comment in their own group #170 //just show menu if group owner is loggedin if (ossn_loggedin_user()->guid == $post->owner_guid || ossn_loggedin_user()->guid == $group->owner_guid) { ossn_unregister_menu('delete', 'comments'); ossn_register_menu_item('comments', array('name' => 'delete', 'href' => ossn_site_url("action/delete/comment?comment={$params['id']}", true), 'class' => 'ossn-delete-comment', 'text' => ossn_print('comment:delete'))); } } } $user = ossn_loggedin_user(); if (ossn_isLoggedin()) { if ($comment->type == 'comments:entity') { $entity = ossn_get_entity($comment->subject_guid); } if ($user->guid == $params['owner_guid'] || ossn_isAdminLoggedin() || $comment->type == 'comments:entity' && ($entity->type = 'user' && $user->guid == $entity->owner_guid)) { ossn_unregister_menu('delete', 'comments'); ossn_register_menu_item('comments', array('name' => 'delete', 'href' => ossn_site_url("action/delete/comment?comment={$params['id']}", true), 'class' => 'ossn-delete-comment', 'text' => ossn_print('comment:delete'))); } } }
echo ossn_user_friendly_time($params['post']->time_created); ?> <?php echo $params['location']; ?> - <div class="ossn-inline-table ossn-icon-access-<?php echo ossn_access_id_str($params['post']->access); ?> " title="<?php echo ossn_print("title:access:{$params['post']->access}"); ?> "></div> </div> </div> <div class="description"> <img src="<?php echo $image; ?> "/> </div> </div> <?php $vars['entity'] = ossn_get_entity($params['post']->item_guid); echo ossn_plugin_view('entity/comment/like/share/view', $vars); ?> </div>
<?php /** * Open Source Social Network * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ $image = ossn_get_entity($params['post']->item_guid); $image = ossn_profile_coverphoto_wall_url($image); ?> <div class="activity-item" id="activity-item-<?php echo $params['post']->guid; ?> "> <div class="activity-item-container"> <div class="owner"> <img src="<?php echo $params['user']->iconURL()->small; ?> " width="40" height="40"/> </div> <div class="post-controls"> <?php if (ossn_is_hook('wall', 'post:menu') && ossn_isLoggedIn()) { $menu['post'] = $params['post']; echo ossn_call_hook('wall', 'post:menu', $menu);
/** * Ossn Photos page handler * @pages: * view, * user, * add, * viewer * * @return mixed contents */ function ossn_photos_page_handler($album) { $page = $album[0]; if (empty($page)) { ossn_error_page(); } switch ($page) { case 'view': if (isset($album[1])) { $title = ossn_print('photos'); $photo['photo'] = $album[1]; $view = new OssnPhotos(); $image = $view->GetPhoto($photo['photo']); $photo['entity'] = $image; //redirect user to home page if image is empty if (empty($image)) { redirect(); } //throw 404 page if there is no album access $albumget = ossn_albums(); $owner = $albumget->GetAlbum($image->owner_guid)->album; if ($owner->access == 3) { if (!ossn_validate_access_friends($owner->owner_guid)) { ossn_error_page(); } } //shows widget back button $addphotos = array('text' => ossn_print('back'), 'href' => 'javascript::;', 'class' => 'button-grey'); $control = ossn_plugin_view('output/url', $addphotos); $contents = array('title' => ossn_print('photos'), 'content' => ossn_plugin_view('photos/pages/photo/view', $photo), 'controls' => $control); //set page layout $module['content'] = ossn_set_page_layout('media', $contents); $content = ossn_set_page_layout('contents', $module); echo ossn_view_page($title, $content); } break; case 'user': if (isset($album[1]) && isset($album[2]) && $album[1] == 'view') { $title = ossn_print('photos'); $photo['photo'] = $album[2]; $type = input('type'); $view = new OssnPhotos(); $image = $view->GetPhoto($photo['photo']); $photo['entity'] = $image; //redirect user if photo is empty if (empty($image->value)) { redirect(); } $addphotos = array('text' => ossn_print('back'), 'href' => 'javascript::;', 'class' => 'button-grey'); $control = ossn_plugin_view('output/url', $addphotos); $contents = array('title' => 'Photos', 'content' => ossn_plugin_view('photos/pages/profile/photos/view', $photo), 'controls' => $control); //set page layout $module['content'] = ossn_set_page_layout('media', $contents); $content = ossn_set_page_layout('contents', $module); echo ossn_view_page($title, $content); } break; case 'cover': if (isset($album[1]) && isset($album[2]) && $album[1] == 'view') { $title = ossn_print('cover:view'); $photo['photo'] = $album[2]; $type = input('type'); $image = ossn_get_entity($photo['photo']); $photo['entity'] = $image; //redirect user if photo is empty if (empty($image->value)) { redirect(); } $addphotos = array('text' => ossn_print('back'), 'href' => 'javascript::;', 'class' => 'button-grey'); $control = ossn_plugin_view('output/url', $addphotos); $contents = array('title' => 'Photos', 'content' => ossn_plugin_view('photos/pages/profile/covers/view', $photo), 'controls' => $control); //set page layout $module['content'] = ossn_set_page_layout('media', $contents); $content = ossn_set_page_layout('contents', $module); echo ossn_view_page($title, $content); } break; case 'add': //add photos (ajax) if (!ossn_is_xhr()) { ossn_error_page(); } echo ossn_plugin_view('output/ossnbox', array('title' => ossn_print('add:photos'), 'contents' => ossn_plugin_view('photos/pages/photos/add'), 'callback' => '#ossn-photos-submit')); break; case 'viewer': //ossn image viewer currently works for profile images $image = input('user'); $url = ossn_site_url("avatar/{$image}"); $media = "<img src='{$url}' />"; $photo_guid = get_profile_photo_guid(ossn_user_by_username($image)->guid); //set viewer sidebar (comments and likes) $sidebar = ossn_plugin_view('photos/viewer/comments', array('entity_guid' => $photo_guid)); echo ossn_plugin_view('output/viewer', array('media' => $media, 'sidebar' => $sidebar)); break; default: ossn_error_page(); break; } }
* @link http://www.opensource-socialnetwork.org/licence */ $comment = input('comment'); $delete = new OssnComments(); $comment = $delete->GetComment($comment); //group admins must be able to delete ANY comment in their own group #170 //first get wall post then get group and check if loggedin user is group owner if ($comment->type == 'comments:post') { $post = ossn_get_object($comment->subject_guid); if ($post && $post->type == 'group') { $group = ossn_get_group_by_guid($post->owner_guid); } } $user = ossn_loggedin_user(); if ($comment->type == 'comments:entity') { $entity = ossn_get_entity($comment->subject_guid); } //Post owner can not delete others comments #607 if ($comment->owner_guid == $user->guid || $post->type == 'user' && $user->guid == $post->owner_guid || $group->owner_guid == $user->guid || $entity->owner_guid == $user->guid || ossn_isAdminLoggedin()) { if ($delete->deleteComment($comment->getID())) { if (ossn_is_xhr()) { echo 1; } else { ossn_trigger_message(ossn_print('comment:deleted'), 'success'); redirect(REF); } } else { if (ossn_is_xhr()) { echo 0; } else { ossn_trigger_message(ossn_print('comment:delete:error'), 'error');