예제 #1
1
/**
 * View post menu
 *
 * @param string $hook Name of hook
 * @param string $type Hook type
 * @param string $return mixed data
 * @param array $params Arrays or Objects
 *
 * @return mixed data
 * @access private
 */
function ossn_wall_post_menu($hook, $type, $return, $params)
{
    if ($params['post']->poster_guid == ossn_loggedin_user()->guid || $params['post']->owner_guid == ossn_loggedin_user()->guid || ossn_isAdminLoggedin()) {
        $deleteurl = ossn_site_url("action/wall/post/delete?post={$params['post']->guid}", true);
        ossn_register_menu_link("delete", ossn_print('ossn:post:delete'), array('class' => 'ossn-wall-post-delete', 'href' => $deleteurl, 'data-guid' => $params['post']->guid), 'wallpost');
    } else {
        ossn_unregister_menu('delete', 'wallpost');
    }
    return ossn_view_menu('wallpost', 'wall/menus/post-controls');
}
/**
 * User block menu item in profile.
 *
 * @return void;
 * @access private;
 */
function ossn_user_block_menu($name, $type, $params)
{
    $user = ossn_user_by_guid(ossn_get_page_owner_guid());
    if (OssnBlock::isBlocked(ossn_loggedin_user(), $user)) {
        $unblock = ossn_site_url("action/unblock/user?user={$user->guid}", true);
        ossn_register_menu_link('block', ossn_print('user:unblock'), $unblock, 'profile_extramenu');
    } else {
        $block = ossn_site_url("action/block/user?user={$user->guid}", true);
        ossn_register_menu_link('block', ossn_print('user:block'), $block, 'profile_extramenu');
    }
}
예제 #3
0
파일: ossn_com.php 프로젝트: emnaborgi/RS
/**
 * Add a entity like menu item
 *
 * @return void
 */
function ossn_entity_like_link($callback, $type, $params)
{
    $guid = $params['entity']->guid;
    ossn_unregister_menu('like', 'entityextra');
    if (!empty($guid)) {
        $likes = new OssnLikes();
        if (!$likes->isLiked($guid, ossn_loggedin_user()->guid, 'entity')) {
            ossn_register_menu_item('entityextra', array('name' => 'like', 'href' => "javascript:;", 'id' => 'ossn-like-' . $guid, 'onclick' => "Ossn.EntityLike({$guid});", 'text' => ossn_print('ossn:like')));
        } else {
            ossn_register_menu_item('entityextra', array('name' => 'like', 'href' => "javascript:;", 'id' => 'ossn-like-' . $guid, 'onclick' => "Ossn.EntityUnlike({$guid});", 'text' => ossn_print('ossn:unlike')));
        }
    }
}
예제 #4
0
파일: Blog.php 프로젝트: sathish4fri/Blog
 /**
  * Add blog;
  *
  * @param string $title A title for blog
  * @param string $descriptionn A body/contents for blog
  *
  * return boolean;
  */
 public function addBlog($title = '', $description = '')
 {
     $user = ossn_loggedin_user();
     if (!empty($title) && !empty($description) && $user) {
         $this->title = $title;
         $this->description = $description;
         $this->type = 'user';
         $this->subtype = 'blog';
         $this->owner_guid = $user->guid;
         if ($this->addObject()) {
             return true;
         }
     }
     return false;
 }
예제 #5
0
 /**
  * Add photo to album
  *
  * @params = $album Album guid
  *           $photo Photo type
  *           $access Private or Public ( its actually depend on album privacy)
  *
  * @return bool;
  */
 public function AddPhoto($album, $photo = 'ossnphoto', $access = OSSN_PUBLIC)
 {
     //check access
     if (!in_array($access, ossn_access_types())) {
         $access = OSSN_PUBLIC;
     }
     //album initialize
     $this->album = new OssnAlbums();
     $this->album = $this->album->GetAlbum($album);
     //check if album guid is not less than 0 and validate photo uploader
     if (!empty($album) && $album > 0 && $this->album->album->owner_guid == ossn_loggedin_user()->guid) {
         //initialize variables
         $this->owner_guid = $album;
         $this->type = 'object';
         $this->subtype = 'ossn:aphoto';
         $this->setFile($photo);
         $this->permission = $access;
         $this->setPath('album/photos/');
         $this->setExtension(array('jpg', 'png', 'jpeg', 'gif'));
         //add file
         if ($this->addFile()) {
             $sizes = ossn_photos_sizes();
             $resize = $this->getFiles();
             if (isset($resize->{0}->value)) {
                 $datadir = ossn_get_userdata("object/{$album}/{$resize->{0}->value}");
                 $file_name = str_replace('album/photos/', '', $resize->{0}->value);
                 //crop photos and create new photos from source
                 $sizes = ossn_photos_sizes();
                 foreach ($sizes as $size => $params) {
                     $params = explode('x', $params);
                     $width = $params[1];
                     $height = $params[0];
                     if ($size !== 'view') {
                         $resized = ossn_resize_image($datadir, $width, $height, true);
                     } else {
                         $resized = ossn_resize_image($datadir, $width, $height, false);
                     }
                     //create newly created image
                     $image = ossn_get_userdata("object/{$album}/album/photos/{$size}_{$file_name}");
                     file_put_contents($image, $resized);
                 }
                 //return true if photos is added to database
                 return true;
             }
         }
         return false;
     }
 }
 /**
  * Send emails to provided addresses
  *
  * @return bool;
  */
 public function sendInvitation()
 {
     $email = $this->address;
     $message = strip_tags($this->message);
     $message = html_entity_decode($message, ENT_QUOTES, "UTF-8");
     $message = ossn_restore_new_lines($message);
     $user = ossn_loggedin_user();
     if (!isset($user->guid) || empty($email)) {
         return false;
     }
     $site = ossn_site_settings('site_name');
     $url = ossn_site_url();
     if (empty($message)) {
         $params = array($url, $user->profileURL(), $user->fullname);
         $message = ossn_print('com:ossn:invite:mail:message:default', $params);
     } else {
         $params = array($site, $user->fullname, $message, $url, $user->profileURL());
         $message = ossn_print("com:ossn:invite:mail:message", $params);
     }
     $subject = ossn_print("com:ossn:invite:mail:subject", array($site));
     return $this->NotifiyUser($email, $subject, $message);
 }
예제 #7
0
 * @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 {
    if (!ossn_is_xhr()) {
        redirect(REF);
    } else {
        header('Content-Type: application/json');
        echo json_encode(array('process' => 0));
    }
 * @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>';
    echo '<script>  Ossn.PostComment(' . $object . '); </script>';
    echo ossn_view_form('post/comment_add', array('action' => ossn_site_url() . 'action/post/comment', 'component' => 'OssnComments', 'id' => "comment-container-{$object}", 'class' => 'comment-container', 'autocomplete' => 'off', 'params' => array('object' => $object)), false);
    echo '<div class="ossn-comment-attachment" id="comment-attachment-container-' . $object . '">';
    echo '<script>Ossn.CommentImage(' . $object . ');</script>';
    echo ossn_view_form('comment_image', array('id' => "ossn-comment-attachment-{$object}", 'component' => 'OssnComments', 'params' => array('object' => $object)), false);
    echo '</div>';
}
예제 #9
0
) </a>
        </div>
        <div class="inner">
            <?php 
if ($params['recent']) {
    foreach ($params['recent'] as $message) {
        if ($message->message_from == ossn_loggedin_user()->guid) {
            $user = ossn_user_by_guid($message->message_to);
            $text = strl($message->message, 19);
            $replied = "<div class='ossn-arrow-back'></div><div class='reply-text'>{$text}</div>";
        } else {
            $user = ossn_user_by_guid($message->message_from);
            $text = strl($message->message, 19);
            $replied = "<div class='reply-text-from'>{$text}</div>";
        }
        if ($message->viewed == 0 && $message->message_from !== ossn_loggedin_user()->guid) {
            $new = 'message-new';
        } else {
            $new = '';
        }
        ?>
                    <div class="user-item <?php 
        echo $new;
        ?>
" 
                              onclick="Ossn.redirect('messages/message/<?php 
        echo $user->username;
        ?>
');">

                        <div class="image"><img
 * @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});";
        $link['href'] = 'javascript::;';
        $link['text'] = ossn_print('ossn:unlike');
        echo ossn_view('system/templates/link', $link);
    }
    ?>
        </div>
        <span class="dot-comments">.</span> <a href="#comment-box-<?php 
    echo $object;
예제 #11
0
    $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'})) {
            $image = str_replace('ossnwall/images/', '', $post->{'file:wallphoto'});
        } else {
            $image = '';
        }
        $user = ossn_user_by_guid($post->poster_guid);
        if ($post->access == OSSN_FRIENDS) {
            if (ossn_user_is_friend(ossn_loggedin_user()->guid, $post->owner_guid) || ossn_loggedin_user()->guid == $post->owner_guid) {
                echo ossn_plugin_view('wall/templates/activity-item', array('post' => $post, 'friends' => explode(',', $data->friend), 'text' => $text, 'location' => $location, 'user' => $user, 'image' => $image));
            }
        }
        if ($post->access == OSSN_PUBLIC) {
            echo ossn_plugin_view('wall/templates/activity-item', array('post' => $post, 'friends' => explode(',', $data->friend), 'text' => $text, 'location' => $location, 'user' => $user, 'image' => $image));
        }
        unset($data->friend);
    }
}
echo ossn_view_pagination($count);
예제 #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
 */
header('Content-Type: application/json');
$group = ossn_get_group_by_guid(input('group'));
if ($group->owner_guid !== ossn_loggedin_user()->guid) {
    exit;
}
if ($group->repositionCOVER($group->guid, input('top'), input('left'))) {
    $params = $group->coverParameters($group->guid);
    echo json_encode(array('top' => $params[0], 'left' => $params[1]));
}
예제 #13
0
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
$OssnLikes = new OssnLikes();
$anotation = input('post');
$entity = input('entity');
if (!empty($anotation)) {
    $subject = $anotation;
    $type = 'post';
}
if (!empty($entity)) {
    $subject = $entity;
    $type = 'entity';
}
if ($OssnLikes->Like($subject, ossn_loggedin_user()->guid, $type)) {
    if (!ossn_is_xhr()) {
        redirect(REF);
    } else {
        header('Content-Type: application/json');
        echo json_encode(array('done' => 1, 'button' => ossn_print('ossn:unlike')));
    }
} else {
    if (!ossn_is_xhr()) {
        redirect(REF);
    } else {
        header('Content-Type: application/json');
        echo json_encode(array('done' => 0, 'button' => ossn_print('ossn:like')));
    }
}
exit;
예제 #14
0
/**
 * 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 = $params['image'];
if (!isset($params['show_group'])) {
    $params['show_group'] = NULL;
}
if (!isset($params['ismember'])) {
    $group = ossn_get_group_by_guid($params['post']->owner_guid);
    if ($group->isMember(NULL, ossn_loggedin_user()->guid)) {
        $params['ismember'] = 1;
    }
}
?>
<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"/>
/**
 * 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;
    }
}
예제 #16
0
<?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
 */
$poke = new OssnPoke();
$user = input('user');
if ($poke->addPoke(ossn_loggedin_user()->guid, $user)) {
    ossn_trigger_message(ossn_print('user:poked'), 'success');
    redirect(REF);
} else {
    ossn_trigger_message(ossn_print('user:poke:error'), 'error');
    redirect(REF);
}
 /**
  * Get all new non-viewed messages
  *
  * @params = $parm (ossn_messages)
  *
  * @return object;
  */
 public function getNewAll($parm = array())
 {
     if (empty($params)) {
         $parm = array('message_from', 'message');
     }
     $parm = implode(',', $parm);
     $user = ossn_loggedin_user()->guid;
     $params['from'] = 'mesajlar';
     $params['params'] = array("{$parm}");
     $params['wheres'] = array("message_to='{$user}' AND viewed='0'");
     $friends = $this->select($params, true);
     return $friends;
 }
예제 #18
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
 */
$guid = input('guid');
$user = ossn_user_by_guid($guid);
if ($user && $user->guid !== ossn_loggedin_user()->guid) {
    if ($user->deleteUser()) {
        ossn_trigger_message(ossn_print('admin:user:deleted'), 'success');
    } else {
        ossn_trigger_message(ossn_print('admin:user:delete:error'), 'error');
    }
}
redirect(REF);
예제 #19
0
        ?>
u/<?php 
        echo $user->username;
        ?>
"><?php 
        echo $user->fullname;
        ?>
</a>
            </div>
            <?php 
        if (ossn_isLoggedIn()) {
            ?>
                <?php 
            if (ossn_loggedin_user()->guid !== $user->guid) {
                if (!ossn_user_is_friend(ossn_loggedin_user()->guid, $user->guid)) {
                    if (ossn_user()->requestExists(ossn_loggedin_user()->guid, $user->guid)) {
                        ?>
                            <a href="<?php 
                        echo ossn_site_url("action/friend/remove?cancel=true&user={$user->guid}", true);
                        ?>
"
                               class='button-grey friendlink'>
                                <?php 
                        echo ossn_print('cancel:request');
                        ?>
                            </a>
                        <?php 
                    } else {
                        ?>
                            <a href="<?php 
                        echo ossn_site_url("action/friend/add?user={$user->guid}", true);
예제 #20
0
파일: ossn_com.php 프로젝트: emnaborgi/RS
/**
 * 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')));
        }
    }
}
예제 #21
0
    ?>
 </div>
                    <div class="text"><?php 
    echo $params['group']->description;
    ?>
</div>
                    <div class="members-count"><a> <?php 
    echo ossn_print('total:members');
    ?>
                            (<?php 
    echo count($members);
    ?>
) </a></div>
                </div>
                <?php 
    if ($params['group']->owner_guid == ossn_loggedin_user()->guid) {
        ?>
                    <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');
        ?>
예제 #22
0
function ossn_messages_page($pages)
{
    if (!ossn_isLoggedin()) {
        ossn_error_page();
    }
    $OssnMessages = new OssnMessages();
    $page = $pages[0];
    if (empty($page)) {
        $page = 'messages';
    }
    switch ($page) {
        case 'message':
            $username = $pages[1];
            if (!empty($username)) {
                $user = ossn_user_by_username($username);
                if (empty($user->guid)) {
                    ossn_error_page();
                }
                $title = ossn_print('ossn:message:between', array($user->fullname));
                $OssnMessages->markViewed($user->guid, ossn_loggedin_user()->guid);
                $params['data'] = $OssnMessages->get(ossn_loggedin_user()->guid, $user->guid);
                $params['user'] = $user;
                $params['recent'] = $OssnMessages->recentChat(ossn_loggedin_user()->guid);
                $contents = array('content' => ossn_plugin_view('messages/pages/view', $params));
                $content = ossn_set_page_layout('media', $contents);
                echo ossn_view_page($title, $content);
            } else {
                ossn_error_page();
            }
            break;
        case 'all':
            $params['recent'] = $OssnMessages->recentChat(ossn_loggedin_user()->guid);
            $active = $params['recent'][0];
            if (isset($active->message_to) && $active->message_to == ossn_loggedin_user()->guid) {
                $getuser = $active->message_from;
            }
            if (isset($active->message_from) && $active->message_from == ossn_loggedin_user()->guid) {
                $getuser = $active->message_to;
            }
            if (isset($getuser)) {
                $user = ossn_user_by_guid($getuser);
                $OssnMessages->markViewed($getuser, ossn_loggedin_user()->guid);
                $params['data'] = $OssnMessages->get(ossn_loggedin_user()->guid, $getuser);
                $params['user'] = $user;
            }
            $contents = array('content' => ossn_plugin_view('messages/pages/messages', $params));
            if (!isset($getuser)) {
                $contents = array('content' => ossn_plugin_view('messages/pages/messages-none'));
            }
            $title = ossn_print('messages');
            $content = ossn_set_page_layout('media', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'getnew':
            $username = $pages[1];
            $guid = ossn_user_by_username($username)->guid;
            $messages = $OssnMessages->getNew($guid, ossn_loggedin_user()->guid);
            if ($messages) {
                foreach ($messages as $message) {
                    $user = ossn_user_by_guid($message->message_from);
                    $message = $message->message;
                    $params['user'] = $user;
                    $params['message'] = $message;
                    echo ossn_plugin_view('messages/templates/message-send', $params);
                }
                $OssnMessages->markViewed($guid, ossn_loggedin_user()->guid);
                echo '<script>Ossn.playSound();</script>';
            }
            break;
        case 'getrecent':
            $params['recent'] = $OssnMessages->recentChat(ossn_loggedin_user()->guid);
            echo ossn_plugin_view('messages/templates/message-with', $params);
            break;
        default:
            ossn_error_page();
            break;
    }
}
예제 #23
0
} elseif ($comment->type == 'comments:post') {
    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()) {
    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
echo ossn_plugin_view('output/url', array('href' => 'javascript::;', 'text' => $likes_total, 'class' => "ossn-total-likes-{$comment->id}", 'data-likes' => $datalikes));
?>
        </div>
    </div>
</div>
예제 #24
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
 */
$block = new OssnBlock();
$user = input('user');
if ($block->removeBlock(ossn_loggedin_user()->guid, $user)) {
    ossn_trigger_message(ossn_print('user:blocked'), 'success');
    redirect(REF);
} else {
    ossn_trigger_message(ossn_print('user:block:error'), 'error');
    redirect(REF);
}
예제 #25
0
 /**
  * Get user group posts guids
  *
  * @param integer $userguid Guid of user
  *
  * @return array;
  */
 public function getFriendsPosts($params = array())
 {
     $user = ossn_loggedin_user();
     if (isset($user->guid) && !empty($user->guid)) {
         $friends = $user->getFriends();
         $friend_guids = '';
         if ($friends) {
             foreach ($friends as $friend) {
                 $friend_guids[] = $friend->guid;
             }
         }
         // add all users posts;
         // (if user has 0 friends, show at least his own postings if wall access type = friends only)
         $friend_guids[] = $user->guid;
         $friend_guids = implode(',', $friend_guids);
         //prepare default attributes
         $default = array('limit' => false, 'offset' => input('offset', '', 1), 'page_limit' => ossn_call_hook('pagination', 'page_limit', false, 10), 'count' => false);
         $options = array_merge($default, $params);
         //get only required result, don't bust your server memory
         $getlimit = $this->generateLimit($options['limit'], $options['page_limit'], $options['offset']);
         if ($getlimit) {
             $options['limit'] = $getlimit;
         }
         $wheres = array("md.guid = e.guid", "e.subtype='poster_guid'", "e.type = 'object'", "md.value IN ({$friend_guids})", "o.guid = e.owner_guid");
         $vars = array();
         $vars['from'] = 'ossn_entities as e, ossn_entities_metadata as md, ossn_object as o';
         $vars['params'] = array("o.*");
         $vars['wheres'] = array($this->constructWheres($wheres));
         $vars['order_by'] = "o.guid DESC";
         $vars['limit'] = $options['limit'];
         //prepare count data;
         if ($options['count'] === true) {
             unset($vars['params']);
             unset($vars['limit']);
             $count = array();
             $count['params'] = array("count(*) as total");
             $count = array_merge($vars, $count);
             return $this->select($count)->total;
         }
         $data = $this->select($vars, true);
         if ($data) {
             return $data;
         }
     }
     return false;
 }
        <div class="ossn-chat-icon-smilies">
            <?php 
$vars['tab'] = $user->guid;
echo ossn_view('components/OssnChat/views/OssnChat/smilies/view', $vars);
?>
        </div>
        <!-- $arsalan.shah datatstart -->
        <div class="data" id="ossn-chat-messages-data-<?php 
echo $user->guid;
?>
">
            <?php 
$messages_meta = ossn_chat()->get(ossn_loggedin_user()->guid, $user->guid);
if ($messages_meta) {
    foreach ($messages_meta as $message) {
        if (ossn_loggedin_user()->guid == $message->message_from) {
            $vars['message'] = $message->message;
            $vars['time'] = $message->time;
            echo ossn_view('components/OssnChat/views/OssnChat/message-item-send', $vars);
        } else {
            $vars['reciever'] = ossn_user_by_guid($message->message_from);
            $vars['message'] = $message->message;
            $vars['time'] = $message->time;
            echo ossn_view('components/OssnChat/views/OssnChat/message-item-received', $vars);
        }
    }
}
?>

        </div>
        <!-- $arsalan.shah datatend -->
예제 #27
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
 */
//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)) {
예제 #28
0
$posts = $Pagination->getItem();
if ($posts) {
    foreach ($posts as $post) {
        $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($data->friend)) {
            $data->friend = '';
        }
        if (isset($post->{'file:wallphoto'})) {
            $image = str_replace('ossnwall/images/', '', $post->{'file:wallphoto'});
        } else {
            $image = '';
        }
        $user = ossn_user_by_guid($post->poster_guid);
        if ($post->access == OSSN_FRIENDS) {
            //lastchage: site admins are unable to access member profile threads without friendship #176
            if (ossn_user_is_friend(ossn_loggedin_user()->guid, $post->owner_guid) || ossn_loggedin_user()->guid == $post->owner_guid || ossn_isAdminLoggedin()) {
                echo ossn_plugin_view('wall/templates/activity-item', array('post' => $post, 'friends' => explode(',', $data->friend), 'text' => $text, 'location' => $location, 'user' => $user, 'image' => $image));
            }
        }
        if ($post->access == OSSN_PUBLIC) {
            echo ossn_plugin_view('wall/templates/activity-item', array('post' => $post, 'friends' => explode(',', $data->friend), 'text' => $text, 'location' => $location, 'user' => $user, 'image' => $image));
        }
    }
}
echo $Pagination->pagination();
echo '</div>';
예제 #29
0
"><span><?php 
    echo ossn_print('home');
    ?>
</span></a>
                </li>

                <?php 
    echo ossn_view('components/OssnNotifications/page/topbar');
    ?>

                <div class="ossn-topbar-dropdown-menu">
                    <label class="ossn-topbar-dropdown-menu-button"><span class="arrow"></span></label>
                    <ul class="ossn-topbar-dropdown-menu-content">
                        <li>
                            <a href="<?php 
    echo ossn_site_url("u/" . ossn_loggedin_user()->username . "/edit");
    ?>
"><?php 
    echo ossn_print('acount:settings');
    ?>
</a>
                        </li>
                        <?php 
    if (ossn_isAdminLoggedin()) {
        ?>
			<li>
				 <a href="<?php 
        echo ossn_site_url('administrator');
        ?>
"><?php 
        echo ossn_print('admin');
예제 #30
0
    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) {
        if (!ossn_is_xhr()) {
            ossn_trigger_message(ossn_print('post:delete:fail'), 'error');
            redirect(REF);
        } else {
            echo 0;
            exit;
        }
    }
}
if ($ossnwall->deletePost($id)) {
    if (ossn_is_xhr()) {
        echo 1;
    } else {
        ossn_trigger_message(ossn_print('post:delete:success'), 'success');
        redirect(REF);