/** * Delete comment menu * * @return voud; * @access private */ function ossn_comment_menu($name, $type, $params) { ossn_unregister_menu('delete', 'comments'); $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_register_menu_link('delete', ossn_print('comment:delete'), array('href' => ossn_site_url("action/delete/comment?comment={$params['id']}", true), 'class' => 'ossn-delete-comment'), 'comments'); } } } $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_register_menu_link('delete', ossn_print('comment:delete'), array('href' => ossn_site_url("action/delete/comment?comment={$params['id']}", true), 'class' => 'ossn-delete-comment'), 'comments'); } } }
/** * Delete comment menu * * @return voud; * @access private */ function ossn_comment_menu($name, $type, $params) { ossn_unregister_menu('delete', 'comments'); $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); if (ossn_loggedin_user()->guid == $post->owner_guid) { ossn_register_menu_link('delete', ossn_print('comment:delete'), array('href' => ossn_site_url("action/delete/comment?comment={$params['id']}"), 'class' => 'ossn-delete-comment'), 'comments'); } } } $user = ossn_loggedin_user(); if (ossn_isLoggedin()) { if ($user->guid == $params['owner_guid'] || ossn_isAdminLoggedin()) { ossn_register_menu_link('delete', ossn_print('comment:delete'), array('href' => ossn_site_url("action/delete/comment?comment={$params['id']}"), 'class' => 'ossn-delete-comment'), 'comments'); } } }
<?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 */ //init ossnwall $OssnWall = new OssnWall(); //poster guid and owner guid is same as user is posting on its own wall $OssnWall->owner_guid = ossn_loggedin_user()->guid; $OssnWall->poster_guid = ossn_loggedin_user()->guid; //check if users is not posting on its own wall then change wallowner $owner = input('wallowner'); if (isset($owner) && !empty($owner)) { $OssnWall->owner_guid = $owner; } //walltype is user $OssnWall->name = 'user'; //getting some inputs that are required for wall post $post = input('post'); $friends = input('friends'); $location = input('location'); $privacy = input('privacy'); //validate wall privacy $privacy = ossn_access_id_str($privacy); if (!empty($privacy)) {
/** * Delete user wall posts * * @param string $callback Name of callback * @param string $type Callback type * @param array $params Arrays or Objects * * @return mixed data * @access private */ function ossn_user_posts_delete($callback, $type, $params) { $wall = new OssnWall(); $posts = $wall->getUserGroupPostsGuids($params['entity']->guid); if ($posts) { foreach ($posts as $post) { //$post is here int $wall->deletePost($post); } } }
/** * Delete profile photo/cover wall post * * @param int $fileguid Profile/Cover file id * @return bool */ public function deletePhotoWallPost($fileguid) { if (empty($fileguid)) { return false; } //prepare a query to get post guid $statement = "SELECT * FROM ossn_entities, ossn_entities_metadata WHERE(\n\t\t\t\t \t ossn_entities_metadata.guid = ossn_entities.guid \n\t\t\t\t AND ossn_entities.subtype='item_guid'\n\t\t\t\t AND ossn_entities.type = 'object'\n\t\t\t\t AND ossn_entities_metadata.value = '{$fileguid}'\n\t\t\t\t );"; $this->statement($statement); $this->execute(); $entity = $this->fetch(); //check if post exists or not if ($entity) { //get object $object = ossn_get_object($entity->owner_guid); if ($object && $object->subtype == 'wall') { $wall = new OssnWall(); //delete wall post if ($wall->deletePost($object->guid)) { return true; } } } return false; }
<?php /** * Open Source Social Network * * @packageOpen Source Social Network * @author Open Social Website Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ $wall = new OssnWall(); $accesstype = ossn_get_homepage_wall_access(); if ($accesstype == 'public' || ossn_isAdminLoggedin()) { $posts = $wall->GetPosts(); $count = $wall->GetPosts(array('count' => true)); } elseif ($accesstype == 'friends') { $posts = $wall->getFriendsPosts(); } if ($posts) { foreach ($posts as $post) { if (!isset($post->poster_guid)) { $post = ossn_get_object($post->guid); } $data = json_decode(html_entity_decode($post->description)); $text = ossn_restore_new_lines($data->post, true); $location = ''; if (isset($data->location)) { $location = '- ' . $data->location; } if (isset($post->{'file:wallphoto'})) {
<?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 */ $ossnwall = new OssnWall(); $id = input('post'); $post = $ossnwall->GetPost($id); if ($post->type == 'user' && !ossn_isAdminLoggedin()) { if ($post->poster_guid !== ossn_loggedin_user()->guid && $post->owner_guid !== ossn_loggedin_user()->guid) { if (!ossn_is_xhr()) { ossn_trigger_message(ossn_print('post:delete:fail'), 'error'); redirect(REF); } else { echo 0; exit; } } } if ($post->type == 'group' && !ossn_isAdminLoggedin()) { $group = new OssnGroup(); $group = $group->getGroup($post->owner_guid); //lastchange group admins are unable to delete member posting on group wall #171 // change or operator to and if ($post->poster_guid !== ossn_loggedin_user()->guid && ossn_loggedin_user()->guid !== $group->owner_guid) {
/** * Delete comment menu * * @return voud; * @access private */ function ossn_comment_menu($name, $type, $params) { //unset previous comment menu item //Post owner can not delete others comments #607 //Pull request #601 , refactoring ossn_unregister_menu('delete', 'comments'); $user = ossn_loggedin_user(); $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 || $user->guid == $comment->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'))); } } } //this section is for entity comment only if (ossn_isLoggedin() && $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'))); } } }
<?php /** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ //init ossnwall $OssnWall = new OssnWall(); //poster guid and owner guid is same as user is posting on home page on its own wall $OssnWall->owner_guid = ossn_loggedin_user()->guid; $OssnWall->poster_guid = ossn_loggedin_user()->guid; //check if owner guid is zero then exit if ($OssnWall->owner_guid == 0 || $OssnWall->poster_guid == 0) { ossn_trigger_message(ossn_print('post:create:error'), 'error'); redirect(REF); } //getting some inputs that are required for wall post $post = input('post'); $friends = input('friends'); $location = input('location'); $privacy = input('privacy'); //validate wall privacy $privacy = ossn_access_id_str($privacy); $access = ''; if (!empty($privacy)) { $access = input('privacy');
<?php /** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ $OssnWall = new OssnWall(); $OssnWall->poster_guid = ossn_loggedin_user()->guid; $owner = input('wallowner'); if (isset($owner) && !empty($owner)) { $OssnWall->owner_guid = $owner; } $OssnWall->type = 'group'; $post = input('post'); $friends = false; $location = input('location'); if ($OssnWall->Post($post, $friends, $location, OSSN_PRIVATE)) { //no need to show message on success // ossn_trigger_message(ossn_print('post:created'), 'success'); redirect(REF); } else { ossn_trigger_message(ossn_print('post:create:error'), 'error'); redirect(REF); }
<?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 */ $OssnWall = new OssnWall(); $OssnWall->poster_guid = ossn_loggedin_user()->guid; $owner = input('wallowner'); if (isset($owner) && !empty($owner)) { $OssnWall->owner_guid = $owner; } $OssnWall->type = 'group'; $post = input('post'); $friends = false; $location = input('location'); if ($OssnWall->Post($post, $friends, $location, OSSN_PRIVATE)) { if (ossn_is_xhr()) { $guid = $OssnWall->getObjectId(); $get = $OssnWall->GetPost($guid); if ($get) { $get = ossn_wallpost_to_item($get); ossn_set_ajax_data(array('post' => ossn_wall_view_template($get))); } } //no need to show message on success.
/** * Insereix un viatge a la base de dades * * * @return bool */ public function setTripDay($idTrip, $values) { $user = ossn_loggedin_user()->guid; //No usuari iniciat sessió sortim if (empty($user)) { return false; } //Agafem paràmetres passats $this->id_trip = $idTrip; // $this->from = $from; // $this->to = $to; $this->from = $values['from']; $this->to = $values['to']; // $this->description = $values['description']; //Preparem SQL into(taula) - names(columnes) - values(valors insertar) $params['into'] = 'ossn_trips_days'; $params['names'] = array('id_trip', 'from', 'to'); $params['values'] = array($this->id_trip, $this->from, $this->to); if ($this->insert($params)) { //Mostra viatge a les notícies i mur $wall = new OssnWall(); $wall->owner_guid = ossn_loggedin_user()->guid; $wall->poster_guid = ossn_loggedin_user()->guid; $url = "http://localhost/social1/social/trip/view/{$idTrip}"; // $post = '<b>' . $this->place . '</b>: '. $this->title; // $post = "<p><a href='http://localhost/social1/social/trip/view/26'>Leer más...</a>"; $post = "He añadido un nuevo viaje, échale un vistazo!<br>{$url}"; $friends = ''; $location = ''; $privacy = ''; $wall->Post($post, $friends, $location, $access); return true; } return false; }