本文整理汇总了PHP中messages_count_unread函数的典型用法代码示例。如果您正苦于以下问题:PHP messages_count_unread函数的具体用法?PHP messages_count_unread怎么用?PHP messages_count_unread使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了messages_count_unread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: theme_haarlem_intranet_personal_menu
/**
* Add menu items to the (theme)personal menu
*
* @param string $hook the name of the hook
* @param string $type the type of the hook
* @param ElggMenuItem[] $return_value current return value
* @param array $params supplied params
*
* @return ElggMenuItem[]
*/
function theme_haarlem_intranet_personal_menu($hook, $type, $return_value, $params)
{
$user = elgg_get_logged_in_user_entity();
if (empty($user)) {
return $return_value;
}
$return_value[] = ElggMenuItem::factory(array('name' => 'dashboard', 'text' => elgg_echo('theme_haarlem_intranet:menu:site:dashboard'), 'href' => 'dashboard', 'section' => 'personal', 'is_trusted' => true, 'priority' => 100));
if (elgg_is_active_plugin('content_redirector')) {
$return_value[] = ElggMenuItem::factory(array('name' => 'content_redirector', 'text' => elgg_view_icon('plus'), 'title' => elgg_echo('content_redirector:selector:add'), 'href' => 'add', 'section' => 'personal', 'is_trusted' => true, 'priority' => 150));
}
if (elgg_is_active_plugin('groups')) {
$invited_groups = groups_get_invited_groups($user->getGUID(), true);
$invite_count = count($invited_groups);
$postfix = '';
if ($invite_count) {
$postfix = "<span class='theme-haarlem-intranet-counter'>{$invite_count}</span>";
}
$return_value[] = ElggMenuItem::factory(array('name' => 'groups', 'text' => elgg_view_icon('group') . $postfix, 'title' => elgg_echo('groups:yours'), 'href' => "#", 'section' => 'personal', 'is_trusted' => true, 'priority' => 150));
// add my groups
$dbprefix = elgg_get_config('dbprefix');
$group_options = array('type' => 'group', 'limit' => false, 'relationship' => 'member', 'relationship_guid' => $user->getGUID(), 'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"), 'order_by' => 'ge.name ASC');
$groups = new ElggBatch('elgg_get_entities_from_relationship', $group_options);
$groups_found = false;
foreach ($groups as $index => $group) {
$groups_found = true;
$return_value[] = ElggMenuItem::factory(array('name' => "group_{$group->getGUID()}", 'text' => $group->name, 'href' => $group->getURL(), 'section' => 'personal', 'is_trusted' => true, 'priority' => $index, 'parent_name' => 'groups_member_of'));
}
if ($groups_found) {
$return_value[] = ElggMenuItem::factory(array('name' => 'groups_member_of', 'text' => false, 'href' => false, 'section' => 'personal', 'is_trusted' => true, 'priority' => 8888888, 'parent_name' => 'groups'));
}
$return_value[] = ElggMenuItem::factory(array('name' => 'my_groups', 'text' => elgg_echo('groups:yours'), 'href' => "groups/member/{$user->username}", 'section' => 'personal', 'is_trusted' => true, 'priority' => 9999999, 'parent_name' => 'groups'));
}
if (elgg_is_active_plugin('messages')) {
$message_count = messages_count_unread();
$postfix = '';
if ($message_count) {
$postfix = "<span class='theme-haarlem-intranet-counter'>{$message_count}</span>";
}
$return_value[] = ElggMenuItem::factory(array('name' => 'messages', 'text' => elgg_view_icon('envelope') . $postfix, 'title' => elgg_echo('messages'), 'href' => "messages/inbox/{$user->username}", 'section' => 'personal', 'is_trusted' => true, 'priority' => 200));
}
if (elgg_is_active_plugin('quicklinks')) {
$return_value[] = ElggMenuItem::factory(array('name' => 'quicklinks', 'text' => elgg_view('page/elements/topbar/quicklinks'), 'href' => false, 'section' => 'personal', 'is_trusted' => true, 'priority' => 250));
}
$return_value[] = ElggMenuItem::factory(array('name' => 'profile', 'text' => elgg_view('output/img', array('src' => $user->getIconURL('tiny'))), 'title' => $user->name, 'href' => '#', 'section' => 'personal', 'is_trusted' => true, 'priority' => 300));
$return_value[] = ElggMenuItem::factory(array('name' => 'profile_mine', 'text' => elgg_echo('theme_haarlem_intranet:menu:site:profile:mine'), 'href' => $user->getURL(), 'section' => 'personal', 'parent_name' => 'profile', 'is_trusted' => true, 'priority' => 100));
$return_value[] = ElggMenuItem::factory(array('name' => 'profile_settings', 'text' => elgg_echo('theme_haarlem_intranet:menu:site:profile:settings'), 'href' => "settings/user/{$user->username}", 'section' => 'personal', 'parent_name' => 'profile', 'is_trusted' => true, 'priority' => 200));
$return_value[] = ElggMenuItem::factory(array('name' => 'profile_logout', 'text' => elgg_echo('logout'), 'href' => 'action/logout', 'section' => 'personal', 'parent_name' => 'profile', 'is_trusted' => true, 'is_action' => true, 'priority' => 300));
return $return_value;
}
示例2: theme_eersel_register_topbar_menu_handler
/**
* Return the site menu
*
* @param string $hook name of the hook
* @param string $entity_type type of the hook
* @param array $returnvalue current return value
* @param array $params extra params
*/
function theme_eersel_register_topbar_menu_handler($hook, $entity_type, $returnvalue, $params)
{
// we will make our own menu
$menu_items = array();
$user = elgg_get_logged_in_user_entity();
if (!$user) {
return;
}
$groups_count = "";
$invitation_count = (int) groups_get_invited_groups($user->getGUID(), false, array('count' => true));
if ($invitation_count) {
$groups_count = "<span title='" . elgg_echo('groups:invitations:pending', array($invitation_count)) . "' class='theme-eersel-topbar-status-new'>{$invitation_count}</span>";
}
// get unread messages
$message_count = "";
$num_messages = (int) messages_count_unread();
if ($num_messages) {
$message_count = "<span title='" . elgg_echo('messages:unreadcount', array($num_messages)) . "' class='theme-eersel-topbar-status-new'>{$num_messages}</span>";
}
// main menu
$wiki_group = get_entity("32599992");
$menu_items[] = ElggMenuItem::factory(array("name" => "home", "title" => elgg_echo("theme_eersel:menu:home"), "href" => elgg_get_site_url(), "text" => "<i class='fa fa-home'></i>"));
$menu_items[] = ElggMenuItem::factory(array("name" => "groups", "title" => elgg_echo("theme_eersel:menu:groups:all"), "href" => "groups/all", "text" => "<i class='fa fa-group'></i>"));
if ($wiki_group) {
$menu_items[] = ElggMenuItem::factory(array("name" => "wiki", "title" => $wiki_group->name, "href" => $wiki_group->getURL(), "text" => "<i class='fa fa-stack-overflow'></i>"));
}
$menu_items[] = ElggMenuItem::factory(array("name" => "members", "title" => elgg_echo("members"), "href" => "members/all", "text" => "<i class='fa fa-user'></i>"));
$menu_items[] = ElggMenuItem::factory(array("name" => "add", "title" => elgg_echo("theme_eersel:menu:add"), "href" => "/add", "text" => "<i class='fa fa-plus'></i>", "section" => "alt"));
$menu_items[] = ElggMenuItem::factory(array("name" => "my-groups", "title" => elgg_echo("theme_eersel:menu:groups:mine"), "href" => "groups/member/" . $user->username, "text" => $groups_count . "<i class='fa fa-group'></i>", "section" => "alt"));
$menu_items[] = ElggMenuItem::factory(array("name" => "messages", "title" => elgg_echo("messages"), "href" => "messages/inbox/" . $user->username, "text" => $message_count . "<i class='fa fa-envelope'></i>", "section" => "alt"));
$menu_items[] = ElggMenuItem::factory(array("name" => "settings", "title" => elgg_echo("settings"), "href" => "settings", "text" => "<i class='fa fa-cog'></i>", "section" => "alt"));
if (elgg_is_admin_logged_in()) {
$menu_items[] = ElggMenuItem::factory(array("name" => "admin", "title" => elgg_echo("admin"), "href" => "admin", "text" => "<i class='fa fa-gears'></i>", "section" => "alt"));
}
$menu_items[] = ElggMenuItem::factory(array("name" => "profile", "title" => elgg_echo("profile"), "href" => $user->getURL(), "text" => elgg_view("output/img", array("src" => $user->getIconURL('small'))), "section" => "alt"));
return $menu_items;
}
示例3: messages_register_topbar
/**
* Add inbox link to topbar
*
* @param string $hook "register"
* @param string $type "menu:topbar"
* @param array $items Menu items
* @param array $params Hook params
* @return array
*/
function messages_register_topbar($hook, $type, $items, $params)
{
if (!elgg_is_logged_in()) {
return;
}
$text = elgg_view_icon("mail");
$tooltip = elgg_echo("messages");
// get unread messages
$num_messages = (int) messages_count_unread();
if ($num_messages != 0) {
$text .= "<span class=\"messages-new\">{$num_messages}</span>";
$tooltip .= " (" . elgg_echo("messages:unreadcount", array($num_messages)) . ")";
}
$items[] = ElggMenuItem::factory(['name' => 'messages', 'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username, 'text' => $text, 'priority' => 600, 'title' => $tooltip]);
return $items;
}
示例4: count_unread_messages
function count_unread_messages()
{
elgg_deprecated_notice('Your theme is using count_unread_messages which has been deprecated for messages_count_unread()', 1.8);
return messages_count_unread();
}
示例5: substr
* Project Name: Sociable Theme
* Project Description: Theme for Elgg 1.8
* Author: Shane Barron - SocialApparatus
* License: GNU General Public License (GPL) version 2
* Website: http://socia.us
* Contact: sales@socia.us
*
* File Version: 1.0
* Last Updated: 5/11/2013
*/
$last = substr(elgg_get_site_entity()->name, 1);
$first = elgg_get_site_entity()->name[0];
$url = $CONFIG->url;
$username = elgg_get_logged_in_user_entity()->username;
$context = elgg_get_context();
$messages = messages_count_unread();
if (!elgg_is_logged_in()) {
?>
<div id="sociaLogin" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="sociaLoginLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="sociaLoginLabel"><?php
echo elgg_echo("login");
?>
</h3>
</div>
<div class="modal-body">
<?php
echo elgg_view_form("login");
?>
</div>
示例6: messages_notifier
/**
* Display notification of new messages in topbar
*/
function messages_notifier()
{
if (elgg_is_logged_in()) {
$text = elgg_view_icon("mail");
$tooltip = elgg_echo("messages");
// get unread messages
$num_messages = (int) messages_count_unread();
if ($num_messages != 0) {
$text .= "<span class=\"messages-new\">{$num_messages}</span>";
$tooltip .= " (" . elgg_echo("messages:unreadcount", array($num_messages)) . ")";
}
elgg_register_menu_item('topbar', array('name' => 'messages', 'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username, 'text' => $text, 'priority' => 600, 'title' => $tooltip));
}
}
示例7: messages_register_topbar
/**
* Add inbox link to topbar
*
* @param string $hook "register"
* @param string $type "menu:topbar"
* @param array $items Menu items
* @param array $params Hook params
* @return array
*/
function messages_register_topbar($hook, $type, $items, $params)
{
if (!elgg_is_logged_in()) {
return;
}
$user = elgg_get_logged_in_user_entity();
$text = elgg_echo('messages');
$title = $text;
$num_messages = (int) messages_count_unread();
if ($num_messages) {
$title .= " (" . elgg_echo("messages:unreadcount", array($num_messages)) . ")";
}
$items[] = ElggMenuItem::factory(['name' => 'messages', 'href' => "messages/inbox/{$user->username}", 'text' => $text, 'priority' => 600, 'title' => $title, 'icon' => 'mail', 'badge' => $num_messages ? $num_messages : null]);
return $items;
}
示例8: elgg_view
<?php
if (elgg_is_logged_in()) {
$body = elgg_view('subsite_manager/account/details');
$spacer_url = elgg_get_site_url() . '_graphics/spacer.gif';
$icon_url = elgg_format_url(elgg_get_logged_in_user_entity()->getIconURL("tiny"));
$icon = elgg_view('output/img', array('src' => $spacer_url, 'alt' => elgg_get_logged_in_user_entity()->name, 'title' => elgg_get_logged_in_user_entity()->name, 'class' => "elgg-avatar elgg-avatar-small", 'style' => "background: url({$icon_url}) no-repeat;"));
$messages = "";
if (elgg_is_active_plugin("messages")) {
if ($message_count = messages_count_unread()) {
$messages = " <span class='subsite-manager-account-dropdown-messages'>[" . $message_count . "]</span>";
}
}
echo "<div id='subsite-manager-login-dropdown'>";
echo elgg_view('output/url', array('href' => 'login#login-dropdown-box', 'rel' => 'popup', 'class' => 'elgg-button elgg-button-dropdown subsite-manager-account-dropdown-button', 'text' => $icon . elgg_get_logged_in_user_entity()->name . $messages));
echo elgg_view_module('dropdown', '', $body, array('id' => 'login-dropdown-box', 'class' => 'subsite-manager-account-dropdown'));
echo "</div>";
}
示例9: westorElggMan_count_unread_messages
function westorElggMan_count_unread_messages()
{
if (function_exists("messages_count_unread")) {
return messages_count_unread();
} else {
return count_unread_messages();
}
}
示例10: gatekeeper
<?php
/**
* Elgg messages topbar extender
*
* @package ElggMessages
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd <info@elgg.com>
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.com/
*/
//need to be logged in to send a message
gatekeeper();
//get unread messages
$num_messages = (int) messages_count_unread();
if ($num_messages) {
$indicator = "<span id='messages-new' class='messages-new'>{$num_messages}</span>";
} else {
$indicator = "<span id='messages-new'></span>";
}
$result_array = array('unread_messages' => $indicator);
$json_array = json_encode($result_array);
header("Content-Type: application/json");
echo $json_array;
forward(REFERER);
示例11: time_theme_pagesetup
/**
* Rearrange menu items
*/
function time_theme_pagesetup()
{
elgg_unextend_view('page/elements/sidebar', 'search/header');
//elgg_extend_view('page/elements/topbar', 'search/header', 0);
elgg_register_menu_item('topbar', array('name' => 'sidebar', 'href' => "#", 'text' => '<i class="sb-toggle-left fa fa-bars fa-lg"></i>', 'priority' => 50, 'link_class' => ''));
elgg_unregister_menu_item('footer', 'powered');
if (elgg_is_logged_in()) {
$user = elgg_get_logged_in_user_entity();
$username = $user->username;
elgg_unregister_menu_item('topbar', 'messages');
$text = "<i class=\"fa fa-envelope fa-lg\"></i>";
$tooltip = elgg_echo("messages");
// get unread messages
$num_messages = (int) messages_count_unread();
if ($num_messages != 0) {
$text .= "<span class=\"elgg-topbar-new\">{$num_messages}</span>";
$tooltip .= ": " . elgg_echo("messages:unreadcount", array($num_messages));
}
elgg_register_menu_item('topbar', array('name' => 'messages', 'href' => "messages/inbox/{$username}", 'text' => $text, 'section' => 'alt', 'priority' => 100, 'title' => $tooltip));
elgg_register_menu_item('topbar', array('href' => false, 'name' => 'search', 'text' => '<i class="fa fa-search fa-lg"></i>' . elgg_view('search/header'), 'priority' => 0, 'section' => 'alt'));
$text = '<i class="fa fa-users fa-lg"></i>';
$tooltip = elgg_echo("friends");
$href = "/friends/" . $username;
if (elgg_is_active_plugin('friend_request')) {
elgg_unregister_menu_item('topbar', 'friend_request');
$options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $user->getGUID(), "inverse_relationship" => true);
$count = elgg_get_entities_from_relationship($options);
if (!empty($count)) {
$text .= "<span class=\"elgg-topbar-new\">{$count}</span>";
$tooltip = elgg_echo("friend_request:menu") . ": " . $count;
$href = "friend_request/" . $username;
}
}
elgg_unregister_menu_item('topbar', 'friends');
elgg_register_menu_item('topbar', array('href' => $href, 'name' => 'friends', 'text' => $text, 'section' => 'alt', 'priority' => 200, 'title' => $tooltip));
$viewer = elgg_get_logged_in_user_entity();
elgg_unregister_menu_item('topbar', 'profile');
elgg_register_menu_item('topbar', array('name' => 'profile', 'href' => $viewer->getURL(), 'text' => elgg_view('output/img', array('src' => $viewer->getIconURL('small'), 'alt' => $viewer->name, 'title' => elgg_echo('profile'), 'class' => 'elgg-border-plain elgg-transition')) . '<span class="profile-text">' . elgg_get_excerpt($viewer->name, 20) . '</span>', 'priority' => 500, 'link_class' => 'elgg-topbar-avatar', 'item_class' => 'elgg-avatar elgg-avatar-topbar'));
elgg_register_menu_item('topbar', array('name' => 'home', 'text' => '<i class="fa fa-home fa-lg"></i> ', 'href' => "/", 'priority' => 90, 'section' => 'alt'));
elgg_register_menu_item('topbar', array('name' => 'account', 'text' => '<i class="fa fa-cog fa-lg"></i> ', 'href' => "#", 'priority' => 300, 'section' => 'alt', 'link_class' => 'elgg-topbar-dropdown'));
if (elgg_is_active_plugin('dashboard')) {
$item = elgg_unregister_menu_item('topbar', 'dashboard');
if ($item) {
$item->setText(elgg_echo('dashboard'));
$item->setSection('default');
elgg_register_menu_item('site', $item);
}
}
$item = elgg_unregister_menu_item('extras', 'bookmark');
if ($item) {
$item->setText('<i class="fa fa-bookmark fa-lg"></i>');
elgg_register_menu_item('extras', $item);
}
elgg_unregister_menu_item('extras', 'rss');
/*if ($item) {
$item->setText('<i class="fa fa-rss fa-lg"></i>');
elgg_register_menu_item('extras', $item);
}*/
$url = elgg_format_url($url);
elgg_register_menu_item('extras', array('name' => 'rss', 'text' => '<i class="fa fa-rss fa-lg"></i>', 'href' => $url, 'title' => elgg_echo('feed:rss')));
$item = elgg_get_menu_item('topbar', 'usersettings');
if ($item) {
$item->setParentName('account');
$item->setText(elgg_echo('settings'));
$item->setPriority(103);
}
$item = elgg_get_menu_item('topbar', 'logout');
if ($item) {
$item->setParentName('account');
$item->setText(elgg_echo('logout'));
$item->setPriority(104);
}
$item = elgg_get_menu_item('topbar', 'administration');
if ($item) {
$item->setParentName('account');
$item->setText(elgg_echo('admin'));
$item->setPriority(101);
}
if (elgg_is_active_plugin('site_notifications')) {
$item = elgg_get_menu_item('topbar', 'site_notifications');
if ($item) {
$item->setParentName('account');
$item->setText(elgg_echo('site_notifications:topbar'));
$item->setPriority(102);
}
}
if (elgg_is_active_plugin('reportedcontent')) {
$item = elgg_unregister_menu_item('footer', 'report_this');
if ($item) {
$item->setText('<i class="fa fa-flag fa-lg"></i>');
$item->setPriority(500);
$item->setSection('default');
elgg_register_menu_item('extras', $item);
}
}
}
}
示例12: login_dologin
function login_dologin($username, $password, $options = array())
{
$ghost = isset($options['ghost']) && $options['ghost'] == true;
if (strtolower($username) == 'borttagen') {
header('Location: http://disneyworld.disney.go.com/wdw/index?bhcp=1');
exit;
}
if ($ghost) {
$query = 'SELECT id, lastaction, lastlogon, session_id FROM login WHERE username = "' . $username . '" LIMIT 1';
$loginquery = mysql_query($query) or report_sql_error($query);
} elseif ($username && $password) {
$password = utf8_decode($password);
// Test for SHA1 with hash
$query = 'SELECT id, lastaction, lastlogon, session_id FROM login WHERE username = "' . $username . '" AND password_hash = "' . sha1($password . PASSWORD_SALT) . '" LIMIT 1';
$loginquery = mysql_query($query) or report_sql_error($query);
if (mysql_num_rows($loginquery) == 0) {
// SHA1 not found, try the old MD5
$md5_query = 'SELECT id FROM login WHERE username = "' . $username . '" AND password = "' . md5($password) . '" LIMIT 1';
$md5_result = mysql_query($md5_query) or report_sql_error($md5_query);
if (mysql_num_rows($md5_result) == 1) {
// MD5 found, update to SHA1
$data = mysql_fetch_assoc($md5_result);
$md5_to_sha1_query = 'UPDATE login SET password = "", password_hash = "' . sha1($password . PASSWORD_SALT) . '" WHERE id = "' . $data['id'] . '" LIMIT 1';
mysql_query($md5_to_sha1_query);
// Load data using the SHA1-hash
$query = 'SELECT id, lastaction, lastlogon, session_id FROM login WHERE username = "' . $username . '" AND password_hash = "' . sha1($password . PASSWORD_SALT) . '" LIMIT 1';
$loginquery = mysql_query($query) or die('Query failed: ' . mysql_error());
}
}
} else {
return 2;
}
if (mysql_num_rows($loginquery) > 0) {
$tempdata = mysql_fetch_assoc($loginquery);
if ($tempdata['lastlogon'] < strtotime(date('Y-m-d'))) {
event_log_log('user_unique_log_on');
}
if ($tempdata['lastaction'] > time() - 600 && false) {
$old_session = session_load($tempdata['session_id']);
session_destroy();
session_id($tempdata['session_id']);
session_start();
$_SESSION = $old_session;
if (isset($_SESSION['login']['id'])) {
if ($ghost) {
$_SESSION['ghost'] = true;
}
return true;
}
}
if ($ghost) {
$_SESSION['ghost'] = true;
}
$uid = $tempdata['id'];
$ip = $_SERVER['REMOTE_ADDR'];
$_SESSION['cache']['lastupdate'] = 0;
$_SESSION['userid'] = $uid;
$_SESSION['login']['id'] = $uid;
$guestbook_sql = 'SELECT COUNT(id) AS unread FROM traffa_guestbooks WHERE recipient = ' . $_SESSION['login']['id'] . ' AND `read` = 0 AND deleted = 0';
$guestbook_result = mysql_query($guestbook_sql) or die('Ett fel inträffade!' . mysql_error() . $guestbook_sql);
$guestbook_data = mysql_fetch_assoc($guestbook_result);
$_SESSION['notices']['unread_gb_entries'] = $guestbook_data['unread'];
require_once $hp_includepath . 'message-functions.php';
$message_status = messages_count_unread($_SESSION['login']['id']);
$_SESSION['notices']['unread_messages'] = $message_status;
$fetch['login'] = array('id', 'lastlogon', 'username', 'password_hash', 'userlevel', 'regtimestamp', 'lastusernamechange', 'session_id', 'lastaction', 'lastip', 'regip', 'quality_level', 'quality_level_expire');
$fetch['preferences'] = array('bubblemessage_visitors', 'allow_hotmessages', 'activate_current_action', 'enable_hetluft', 'randomizer', 'left_login_module', 'enable_shoutbox', 'module_states', 'module_order', 'forum_enable_smilies', 'forum_subscribe_on_create', 'forum_subscribe_on_post');
$fetch['traffa'] = array('firstname', 'profile_modules');
$fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'image', 'image_ban_expire', 'forum_signature', 'zip_code', 'forum_quality_rank', 'parlino_activated', 'cell_phone', 'firstname', 'surname', 'email', 'streetaddress', 'msn', 'visible_level', 'phone_ov', 'user_status', 'gbrss');
$userinfo = login_load_user_data($uid, $fetch, __FILE__, __LINE__);
$_SESSION = array_merge($_SESSION, $userinfo);
// $_SESSION['preferences']['forum_favourite_categories'] = unserialize($_SESSION['preferences']['forum_favourite_categories']);
$_SESSION['module_states'] = unserialize($_SESSION['preferences']['module_states']);
$_SESSION['module_order'] = explode('|', $_SESSION['preferences']['module_order']);
/* Notes in the note-module */
$query = 'SELECT text FROM notes WHERE id = "' . $_SESSION['login']['id'] . '" LIMIT 1';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
$data = mysql_fetch_assoc($result);
$_SESSION['note'] = $data['text'];
/* groups-start-here */
$group_data['groups_members'] = array('groupid');
$groups = login_load_group_data($uid, $group_data);
$_SESSION = array_merge($_SESSION, $groups);
if (!$ghost) {
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
}
/* Friends start here */
$options['user_id'] = $_SESSION['login']['id'];
$_SESSION['friends'] = friends_fetch_online_smart($options);
$query = 'SELECT DISTINCT(uel.remote_user_id) AS id, uel.timestamp, l.username ';
$query .= 'FROM user_event_log AS uel, login AS l, userinfo AS u';
$query .= ' WHERE uel.action = "profile_visit" AND uel.user = "' . $_SESSION['login']['id'] . '" AND l.id = uel.remote_user_id AND (u.image = 1 OR u.image = 2) AND u.userid = uel.remote_user_id';
$query .= ' GROUP BY uel.remote_user_id ORDER BY timestamp DESC LIMIT 8';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
while ($data = mysql_fetch_assoc($result)) {
$_SESSION['visitors_with_image'][] = $data;
}
/* Fetch the latest posts, the posts antiflood system will use this */
$query = 'SELECT MD5(content), timestamp FROM posts WHERE author = "' . $_SESSION['login']['id'] . '" ORDER BY id DESC LIMIT 50';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
//.........这里部分代码省略.........
示例13: messages_count
/**
* Web service to get a count of the users unread messages
*
*
* @return array $message Array of message content
*/
function messages_count()
{
$count = (int) messages_count_unread();
return $count;
}
示例14: mobilize_setup_handler
function mobilize_setup_handler()
{
if (!elgg_in_context('admin')) {
elgg_load_css('elgg.mobilize');
}
// remove more menu dropdown
elgg_unregister_plugin_hook_handler('prepare', 'menu:site', 'elgg_site_menu_setup');
elgg_unextend_view('page/elements/header', 'search/header');
elgg_unregister_menu_item('footer', 'report_this');
// Extend footer with copyright
$year = date('Y');
$href = "http://www.perjensen-online.dk";
elgg_register_menu_item('footer', array('name' => 'copyright_this', 'href' => $href, 'title' => elgg_echo('mobilize:tooltip'), 'text' => elgg_echo('mobilize:copyright') . $year . elgg_echo(' Elggzone'), 'priority' => 1, 'section' => 'alt'));
// Extend footer with elgg link
$href = "http://elgg.org";
elgg_register_menu_item('footer', array('name' => 'elgg', 'href' => $href, 'text' => elgg_echo('mobilize:elgg'), 'priority' => 2, 'section' => 'alt'));
if (elgg_is_logged_in()) {
if (elgg_is_active_plugin('dashboard')) {
elgg_unregister_menu_item('topbar', 'dashboard');
elgg_register_menu_item('site', array('name' => 'dashboard', 'href' => '/dashboard', 'text' => elgg_echo('dashboard')));
}
$user = elgg_get_logged_in_user_entity();
elgg_register_menu_item('footer', array('name' => 'logout', 'href' => '/action/logout', 'is_action' => TRUE, 'text' => elgg_echo('logout'), 'priority' => 100, 'section' => 'alt'));
elgg_register_menu_item('footer', array('name' => 'usersettings', 'href' => "/settings/user/{$user->username}", 'text' => elgg_echo('settings'), 'priority' => 101, 'section' => 'alt'));
elgg_unregister_menu_item('topbar', 'friends');
elgg_register_menu_item('site', array('name' => 'friends', 'text' => elgg_echo('friends'), 'href' => "/friends/{$user->username}"));
if (elgg_is_active_plugin('profile')) {
elgg_unregister_menu_item('topbar', 'profile');
elgg_register_menu_item('site', array('name' => 'profile', 'text' => elgg_echo('profile'), 'href' => "/profile/{$user->username}"));
}
if (elgg_is_active_plugin('messages')) {
elgg_unregister_menu_item('topbar', 'messages');
$num_messages = (int) messages_count_unread();
if ($num_messages != 0) {
$text .= "<span class=\"messages-new\">{$num_messages}</span>";
}
elgg_register_menu_item('site', array('name' => 'messages', 'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username, 'text' => elgg_echo('messages') . $text));
}
}
if (elgg_is_admin_logged_in()) {
elgg_register_menu_item('footer', array('name' => 'administration', 'href' => 'admin', 'text' => elgg_echo('admin'), 'priority' => 102, 'section' => 'alt'));
}
}
示例15: elgg_get_logged_in_user_entity
<?php
$user = elgg_get_logged_in_user_entity();
?>
<div class="clearfix">
<?php
echo elgg_view_entity_icon($user, "medium", array("use_hover" => false));
echo "<label>" . $user->name . "</label>";
echo "<br />";
echo elgg_view("output/url", array("href" => $user->getURL(), "text" => elgg_echo("profile"), "title" => elgg_echo("profile"), "is_trusted" => true));
echo "<br />";
if (elgg_is_active_plugin("messages")) {
echo elgg_view("output/url", array("href" => "/messages/inbox/" . $user->username, "text" => elgg_echo("messages:inbox") . " [" . messages_count_unread() . "]", "title" => elgg_echo("messages:unreadcount", array(messages_count_unread())), "is_trusted" => true));
echo "<br />";
}
if (elgg_is_active_plugin("friend_request")) {
$request_count = "";
$options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $user->getGUID(), "inverse_relationship" => true);
if ($count = elgg_get_entities_from_relationship($options)) {
$request_count = " [" . $count . "]";
}
echo elgg_view("output/url", array("href" => "friend_request/" . $user->username, "text" => elgg_echo("friend_request:menu") . $request_count, "title" => elgg_echo("friend_request:menu"), "is_trusted" => true));
echo "<br />";
}
if (elgg_is_active_plugin("groups")) {
$invite_count = "";
$options = array("type" => "group", "relationship" => "invited", "relationship_guid" => $user->getGUID(), "inverse_relationship" => true, "count" => true);
if (!subsite_manager_on_subsite()) {
$options["site_guids"] = false;
}
if ($count = elgg_get_entities_from_relationship($options)) {