/**
 * 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');
        }
    }
}
Exemple #3
0
<?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
 */
$OssnComment = new OssnComments();
$image = input('comment-attachment');
//comment image check if is attached or not
if (!empty($image)) {
    $OssnComment->comment_image = $image;
}
//post on which comment is going to be posted
$post = input('post');
//comment text
$comment = input('comment');
if ($OssnComment->PostComment($post, ossn_loggedin_user()->guid, $comment)) {
    $data['comment'] = ossn_get_comment($OssnComment->getCommentId());
    $data = ossn_plugin_view('comments/templates/comment', $data);
    if (!ossn_is_xhr()) {
        redirect(REF);
    } else {
        header('Content-Type: application/json');
        echo json_encode(array('comment' => $data, 'process' => 1));
    }
} else {
<?php

/**
 * Open Source Social Network
 *
 * @package   Open 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
 */
$object = $params->guid;
$OssnComments = new OssnComments();
$OssnLikes = new OssnLikes();
$comments = $OssnComments->GetComments($object);
echo "<div class='ossn-comments-list-{$object}'>";
if (is_object($comments)) {
    $count = 0;
    foreach ($comments as $comment) {
        if ($count <= 5) {
            $data['comment'] = get_object_vars($comment);
            echo ossn_view('components/OssnComments/templates/comment', $data);
        }
        $count++;
    }
}
echo '</div>';
if (ossn_isLoggedIn()) {
    echo '<div class="poster-image">';
    echo '<img src="' . ossn_site_url() . 'avatar/' . ossn_loggedin_user()->username . '/smaller" />';
    echo '</div>';
<?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
 */
$object = $params['entity_guid'];
$OssnComments = new OssnComments();
$OssnLikes = new OssnLikes();
$comments = $OssnComments->GetComments($object, 'entity');
echo "<div class='ossn-comments-list-{$object}'>";
if ($comments) {
    $count = 0;
    foreach ($comments as $comment) {
        if ($count <= 5) {
            $data['comment'] = get_object_vars($comment);
            echo ossn_plugin_view('comments/templates/comment', $data);
        } elseif ($params->full_view === true) {
            $data['comment'] = get_object_vars($comment);
            echo ossn_plugin_view('comments/templates/comment', $data);
        }
        $count++;
    }
}
echo '</div>';
if (ossn_isLoggedIn()) {
<?php

/**
 * Open Source Social Network
 *
 * @package   Open 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
 */
$OssnLikes = new OssnLikes();
$OssnComments = new OssnComments();
$object = $params['entity_guid'];
$count = $OssnLikes->CountLikes($object, 'entity');
if (ossn_isLoggedIn()) {
    ?>
    <div class="like_share  comments-like-comment-links">
        <div id="ossn-like-<?php 
    echo $object;
    ?>
" class="button-container">
            <?php 
    if (!$OssnLikes->isLiked($object, ossn_loggedin_user()->guid, 'entity')) {
        $link['onclick'] = "Ossn.EntityLike({$object});";
        $link['href'] = 'javascript::;';
        $link['text'] = ossn_print('ossn:like');
        echo ossn_view('system/templates/link', $link);
    } else {
        $user_liked = true;
        $link['onclick'] = "Ossn.EntityUnlike({$object});";
/**
 * Open Source Social Network
 *
 * @package   Open 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
 */
function ossn_get_comment($id)
{
    $get = new OssnComments();
    return $get->GetComment($id);
}
/**
 * Delete photos like
 *
 * @return voud;
 * @access private
 */
function ossn_photos_likes_comments_delete($name, $type, $params)
{
    if (class_exists('OssnLikes')) {
        $likes = new OssnLikes();
        $likes->deleteLikes($params['photo']['guid'], 'entity');
        $comments = new OssnComments();
        $comments->commentsDeleteAll($params['photo']['guid'], 'comments:entity');
    }
}
<?php

/**
 * Open Source Social Network
 *
 * @package   Open 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
 */
$OssnComment = new OssnComments();
$image = input('comment-attachment');
//comment image check if is attached or not
if (!empty($image)) {
    $OssnComment->comment_image = $image;
}
//entity on which comment is going to be posted
$entity = input('entity');
//comment text
$comment = input('comment');
if ($OssnComment->PostComment($entity, ossn_loggedin_user()->guid, $comment, 'entity')) {
    $data['comment'] = ossn_get_comment($OssnComment->getCommentId());
    $data = ossn_view('components/OssnComments/templates/comment', $data);
    if (!ossn_is_xhr()) {
        redirect(REF);
    } else {
        header('Content-Type: application/json');
        echo json_encode(array('comment' => $data, 'process' => 1));
    }
} else {
<?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
 */
$comment = input('comment');
$delete = new OssnComments();
if ($delete->GetComment($comment)->owner_guid == ossn_loggedin_user()->guid || ossn_isAdminLoggedin()) {
    if ($delete->deleteComment($comment)) {
        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');
            redirect(REF);
        }
    }
} else {
    if (ossn_is_xhr()) {
Exemple #11
0
/**
 * 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')));
        }
    }
}
Exemple #12
0
<?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
 */
$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;
<?php

/**
 * Open Source Social Network
 *
 * @package   Open 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
 */
$OssnLikes = new OssnLikes();
$OssnComments = new OssnComments();
$object = $params->guid;
$count = $OssnLikes->CountLikes($object);
$user_liked = '';
if (ossn_isLoggedIn()) {
    ?>

    <div class="like_share comments-like-comment-links">
        <div id="ossn-like-<?php 
    echo $object;
    ?>
" class="button-container">
            <?php 
    if (!$OssnLikes->isLiked($object, ossn_loggedin_user()->guid)) {
        $link['onclick'] = "Ossn.PostLike({$object});";
        $link['href'] = 'javascript::;';
        $link['text'] = ossn_print('ossn:like');
        echo ossn_view('system/templates/link', $link);
    } else {