本文整理汇总了PHP中ossn_loggedin_user函数的典型用法代码示例。如果您正苦于以下问题:PHP ossn_loggedin_user函数的具体用法?PHP ossn_loggedin_user怎么用?PHP ossn_loggedin_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ossn_loggedin_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ossn_wall_post_menu
/**
* 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');
}
示例2: ossn_user_block_menu
/**
* 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: ossn_entity_like_link
/**
* 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: addBlog
/**
* 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: AddPhoto
/**
* 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;
}
}
示例6: sendInvitation
/**
* 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: OssnComments
* @author Open Social Website Core Team <info@informatikon.com>
* @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));
}
示例8: OssnComments
* @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: foreach
) </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
示例10: OssnLikes
* @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: foreach
$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: header
<?php
/**
* Open Source Social Network
*
* @package (Informatikon.com).ossn
* @author OSSN Core Team <info@opensource-socialnetwork.org>
* @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: OssnLikes
* @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: ossn_get_group_by_guid
/**
* Open Source Social Network
*
* @package (Informatikon.com).ossn
* @author OSSN Core Team <info@opensource-socialnetwork.org>
* @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"/>
示例15: ossn_notification_page
/**
* 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;
}
}