Beispiel #1
0
function ossn_js_page_handler($pages)
{
    switch ($pages[0]) {
        case 'boot':
            if (!ossn_isLoggedIn()) {
                ossn_error_page();
            }
            if (isset($pages[1]) && $pages[1] == 'ossn.boot.chat.js') {
                header('Content-Type: application/javascript');
                echo ossn_plugin_view('js/OssnChat.Boot');
            }
            break;
        case 'selectfriend':
            $user = input('user');
            if (!empty($user)) {
                $user = ossn_user_by_guid($user);
                OssnChat::setUserChatSession($user);
                $friend['user'] = $user;
                echo ossn_plugin_view('chat/selectfriend', $friend);
            }
            break;
        default:
            ossn_error_page();
            break;
    }
}
Beispiel #2
0
function ossn_entity_comment_link($callback, $type, $params)
{
    $guid = $params['entity']->guid;
    ossn_unregister_menu('comment', 'entityextra');
    if (!empty($guid) && ossn_isLoggedIn()) {
        ossn_register_menu_item('entityextra', array('name' => 'comment', 'class' => "comment-post", 'href' => "javascript::void(0)", 'data-guid' => $guid, 'text' => ossn_print('comment:comment')));
    }
}
Beispiel #3
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
 */
if (ossn_isLoggedIn()) {
    ?>
    <div class="ossn-photo-menu">
        <li><a href="<?php 
    echo ossn_site_url("action/profile/cover/photo/delete?id={$params->guid}", true);
    ?>
"> <?php 
    echo ossn_print('delete:photo');
    ?>
 </a>
        </li>
    </div>
<?php 
}
?>
<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);
}
?>
        </div>

        <div class="subject">
            <?php 
$owner = ossn_user_by_guid($params['post']->owner_guid);
?>
            <a class="owner-link"
               href="<?php 
echo $params['user']->profileURL();
?>
"> <?php 
/**
 * Notification Page
 *
 * @return mixed data;
 * @access public
 */
function ossn_notification_page($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        ossn_error_page();
    }
    header('Content-Type: application/json');
    switch ($page) {
        case 'notification':
            $get = new OssnNotifications();
            $notifications['notifications'] = $get->get(ossn_loggedin_user()->guid, true);
            $notifications['seeall'] = ossn_site_url("notifications/all");
            if (!empty($notifications['notifications'])) {
                $data = ossn_view('components/OssnNotifications/pages/notification/notification', $notifications);
                echo json_encode(array('type' => 1, 'data' => $data));
            } else {
                echo json_encode(array('type' => 0, 'data' => '<div class="ossn-no-notification">Nothing to show</div>'));
            }
            break;
        case 'friends':
            $friends['friends'] = ossn_loggedin_user()->getFriendRequests();
            $friends_count = count($friends['friends']);
            if ($friends_count > 0 && !empty($friends['friends'])) {
                $data = ossn_view('components/OssnNotifications/pages/notification/friends', $friends);
                echo json_encode(array('type' => 1, 'data' => $data));
            } else {
                echo json_encode(array('type' => 0, 'data' => '<div class="ossn-no-notification">Nothing to show</div>'));
            }
            break;
        case 'messages':
            $OssnMessages = new OssnMessages();
            $params['recent'] = $OssnMessages->recentChat(ossn_loggedin_user()->guid);
            $data = ossn_view('components/OssnMessages/templates/message-with-notifi', $params);
            if (!empty($params['recent'])) {
                echo json_encode(array('type' => 1, 'data' => $data));
            } else {
                echo json_encode(array('type' => 0, 'data' => '<div class="ossn-no-notification">Nothing to show</div>'));
            }
            break;
        case 'read':
            if (!empty($pages[1])) {
                $notification = new OssnNotifications();
                $guid = $notification->getbyGUID($pages[1]);
                if ($guid->owner_guid == ossn_loggedin_user()->guid) {
                    $notification->setViewed($pages[1]);
                    $url = urldecode(input('notification'));
                    header("Location: {$url}");
                } else {
                    redirect();
                }
            } else {
                redirect();
            }
            break;
        case 'count':
            if (!ossn_isLoggedIn()) {
                ossn_error_page();
            }
            $notification = new OssnNotifications();
            $messages = new OssnMessages();
            $count_notif = $notification->countNotification(ossn_loggedin_user()->guid);
            $count_messages = $messages->countUNREAD(ossn_loggedin_user()->guid);
            if (!$count_notif) {
                $count_notif = 0;
            }
            $friends = ossn_loggedin_user()->getFriendRequests();
            $friends_c = 0;
            if (count($friends) > 0 && !empty($friends)) {
                $friends_c = count($friends);
            }
            echo json_encode(array('notifications' => $count_notif, 'messages' => $count_messages, 'friends' => $friends_c));
            break;
        default:
            ossn_error_page();
            break;
    }
}
/**
 * Notification Page
 *
 * @return mixed data;
 * @access public
 */
function ossn_notification_page($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        ossn_error_page();
    }
    header('Content-Type: application/json');
    switch ($page) {
        case 'notification':
            $get = new OssnNotifications();
            //removed true as second arg of get() as second arg is introduced in v2.0
            $notifications['notifications'] = $get->get(ossn_loggedin_user()->guid);
            $notifications['seeall'] = ossn_site_url("notifications/all");
            $clearall = ossn_plugin_view('output/url', array('action' => true, 'href' => ossn_site_url('action/notification/mark/allread'), 'class' => 'ossn-notification-mark-read', 'text' => ossn_print('ossn:notifications:mark:as:read')));
            if (!empty($notifications['notifications'])) {
                $data = ossn_plugin_view('notifications/pages/notification/notification', $notifications);
                echo json_encode(array('type' => 1, 'data' => $data, 'extra' => $clearall));
            } else {
                echo json_encode(array('type' => 0, 'data' => '<div class="ossn-no-notification">' . ossn_print('ossn:notification:no:notification') . '</div>'));
            }
            break;
        case 'friends':
            $friends['friends'] = ossn_loggedin_user()->getFriendRequests();
            $friends_count = count($friends['friends']);
            if ($friends_count > 0 && !empty($friends['friends'])) {
                $data = ossn_plugin_view('notifications/pages/notification/friends', $friends);
                echo json_encode(array('type' => 1, 'data' => $data));
            } else {
                echo json_encode(array('type' => 0, 'data' => '<div class="ossn-no-notification">' . ossn_print('ossn:notification:no:notification') . '</div>'));
            }
            break;
        case 'messages':
            $OssnMessages = new OssnMessages();
            $params['recent'] = $OssnMessages->recentChat(ossn_loggedin_user()->guid);
            $data = ossn_plugin_view('messages/templates/message-with-notifi', $params);
            if (!empty($params['recent'])) {
                echo json_encode(array('type' => 1, 'data' => $data));
            } else {
                echo json_encode(array('type' => 0, 'data' => '<div class="ossn-no-notification">' . ossn_print('ossn:notification:no:notification') . '</div>'));
            }
            break;
        case 'read':
            if (!empty($pages[1])) {
                $notification = new OssnNotifications();
                $guid = $notification->getbyGUID($pages[1]);
                if ($guid->owner_guid == ossn_loggedin_user()->guid) {
                    $notification->setViewed($pages[1]);
                    $url = urldecode(input('notification'));
                    header("Location: {$url}");
                } else {
                    redirect();
                }
            } else {
                redirect();
            }
            break;
        case 'count':
            if (!ossn_isLoggedIn()) {
                ossn_error_page();
            }
            $notification = new OssnNotifications();
            $messages = new OssnMessages();
            $count_notif = $notification->countNotification(ossn_loggedin_user()->guid);
            $count_messages = $messages->countUNREAD(ossn_loggedin_user()->guid);
            if (!$count_notif) {
                $count_notif = 0;
            }
            $friends = ossn_loggedin_user()->getFriendRequests();
            $friends_c = 0;
            if (count($friends) > 0 && !empty($friends)) {
                $friends_c = count($friends);
            }
            echo json_encode(array('notifications' => $count_notif, 'messages' => $count_messages, 'friends' => $friends_c));
            break;
        default:
            ossn_error_page();
            break;
    }
}
Beispiel #7
0
    echo ' ' . $comment->getParam('comments:post');
}
$image = $comment->getParam('file:comment:photo');
if (!empty($image)) {
    $image = str_replace('comment/photo/', '', $image);
    $image = ossn_site_url("comment/image/{$comment->id}/{$image}");
    echo "<img src='{$image}' />";
}
?>
        </p>

        <div class="comment-metadata"> <?php 
echo ossn_user_friendly_time($comment->time_created);
?>
            <?php 
if (ossn_isLoggedIn() && class_exists('OssnLikes')) {
    if (!$OssnLikes->isLiked($comment->id, ossn_loggedin_user()->guid, $type)) {
        echo ossn_plugin_view('output/url', array('href' => ossn_site_url("action/annotation/like?annotation={$comment->id}"), 'text' => ossn_print('like'), 'class' => 'ossn-like-comment', 'data-type' => 'Like', 'action' => true));
    } else {
        echo ossn_plugin_view('output/url', array('href' => ossn_site_url("action/annotation/unlike?annotation={$comment->id}"), 'text' => ossn_print('unlike'), 'class' => 'ossn-like-comment', 'data-type' => 'Unlike', 'action' => true));
    }
}
// Likes only for loggedin users end
// Show total likes
if ($likes_total) {
    echo ossn_plugin_view('output/url', array('href' => 'javascript:void(0);', 'text' => $likes_total, 'class' => "ossn-total-likes-{$comment->id}", 'data-likes' => $datalikes));
}
?>
        </div>
    </div>
</div>