/**
 * 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');
        }
    }
}
/**
 * Check user blocks.
 *
 * @return void;
 * @access private;
 */
function ossn_user_block($name, $type, $return, $params)
{
    /*
     * Deny from visiting profile
     */
    if ($params['handler'] == 'u') {
        $user = ossn_user_by_username($params['page'][0]);
        if (OssnBlock::UserBlockCheck($user)) {
            ossn_error_page();
        }
    }
    /*
     * Deny from sending messages
     */
    if ($params['handler'] == 'messages' && isset($params['page'][1])) {
        $user = ossn_user_by_username($params['page'][1]);
        if ($user && OssnBlock::UserBlockCheck($user)) {
            ossn_error_page();
        }
    }
    /*
     * Deny from viewing user wall posts
     */
    if ($params['handler'] == 'post' && $params['page'][0] == 'view' && com_is_active('OssnWall')) {
        $post = new OssnWall();
        $post = $post->GetPost($params['page'][1]);
        $user = ossn_user_by_guid($post->owner_guid);
        if (OssnBlock::UserBlockCheck($user)) {
            ossn_error_page();
        }
    }
    /*
     * Deny from viewing profile photos album and albums
     */
    if ($params['handler'] == 'album') {
        //check if album is profile photos
        if ($params['page'][0] == 'profile') {
            $user = ossn_user_by_guid($params['page'][1]);
            //if album is not profile photos album then it means it simple album
        } elseif ($params['page'][0] == 'view') {
            $album = new OssnAlbums();
            $album = $album->GetAlbum($params['page'][1]);
            $user = ossn_user_by_guid($album->album->owner_guid);
        }
        if (isset($user) && OssnBlock::UserBlockCheck($user)) {
            ossn_error_page();
        }
    }
}
/**
 * Register basic pages
 * @pages:
 *       home,
 *    login,
 *       registered
 *
 * @return mixed contents
 */
function ossn_user_pagehandler($home, $handler)
{
    switch ($handler) {
        case 'home':
            if (!ossn_isLoggedin()) {
                ossn_error_page();
            }
            $title = ossn_print('news:feed');
            if (com_is_active('OssnWall')) {
                $contents['content'] = ossn_view('components/OssnWall/pages/wall');
            }
            $content = ossn_set_page_layout('newsfeed', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'resetlogin':
            $user = input('user');
            $code = input('c');
            $contents['content'] = ossn_view('pages/contents/user/resetlogin');
            if (!empty($user) && !empty($code)) {
                $contents['content'] = ossn_view('pages/contents/user/resetcode');
            }
            $title = ossn_print('reset:login');
            $content = ossn_set_page_layout('startup', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'login':
            $title = ossn_print('site:login');
            $contents['content'] = ossn_view('pages/contents/user/login');
            $content = ossn_set_page_layout('startup', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'registered':
            $title = ossn_print('account:registered');
            $contents['content'] = ossn_view('pages/contents/user/registered');
            $content = ossn_set_page_layout('startup', $contents);
            echo ossn_view_page($title, $content);
            break;
        default:
            ossn_error_page();
            break;
    }
}
 /**
  * Add poke
  *
  * @params $poker guid of user who is trying to poke
  *         $owner guid of user who is going to be poked
  *
  * @return bool;
  * @access public;
  */
 public function addPoke($poker, $owner)
 {
     /*
      * Check if user is blocked or not
      */
     if (com_is_active('OssnBlock')) {
         $user = ossn_user_by_guid($owner);
         if (OssnBlock::UserBlockCheck($user)) {
             return false;
         }
     }
     /*
      * Send notification
      */
     $type = 'ossnpoke:poke';
     $params['into'] = 'bildirimler';
     $params['names'] = array('type', 'poster_guid', 'owner_guid', 'subject_guid', 'item_guid', 'time_created');
     $params['values'] = array($type, $poker, $owner, NULL, NULL, time());
     if ($this->insert($params)) {
         return true;
     }
     return false;
 }
/**
 * 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');
        }
    }
}
예제 #6
0
        ?>
                    <div class="group-about" style="margin-top: 10px;">
                        <div
                            class='heading'> <?php 
        echo ossn_print('member:requests', array($params['group']->countRequests()));
        ?>
</div>
                        <div class="members-count"><a
                                href="<?php 
        echo ossn_group_url($params['group']->guid);
        ?>
requests">
                                <?php 
        echo ossn_print('view:all');
        ?>
</a></div>
                    </div>
                <?php 
    }
    if (com_is_active('OssnAds')) {
        echo ossn_plugin_view('ads/page/view');
    }
    ?>
            </div>
        <?php 
}
?>
    </div>

</div>
예제 #7
0
파일: profile.php 프로젝트: emnaborgi/RS
    <?php 
if (isset($params['subpage']) && !empty($params['subpage']) && ossn_is_profile_subapge($params['subpage'])) {
    if (ossn_is_hook('profile', 'subpage')) {
        echo ossn_call_hook('profile', 'subpage', $params);
    }
} else {
    ?>
        <div class="ossn-profile-modules">
            <?php 
    if (ossn_is_hook('profile', 'modules')) {
        $params['user'] = $user;
        $modules = ossn_call_hook('profile', 'modules', $params);
        echo implode('', $modules);
    }
    ?>

        </div>

        <div class="ossn-profile-wall">
            <?php 
    if (com_is_active('OssnWall')) {
        $params['user'] = $user;
        echo ossn_plugin_view('wall/user/wall', $params);
    }
    ?>
        </div>
    <?php 
}
?>
</div>
예제 #8
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')));
        }
    }
}