本文整理汇总了PHP中user_current_username函数的典型用法代码示例。如果您正苦于以下问题:PHP user_current_username函数的具体用法?PHP user_current_username怎么用?PHP user_current_username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_current_username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: theme_menu_both
function theme_menu_both($menu)
{
$links = array();
foreach (menu_visible_items() as $url => $page) {
$title = $url ? $url : 'home';
$title = str_replace("-", " ", $title);
if (!$url) {
$url = BASE_URL;
}
// Shouldn't be required, due to <base> element but some browsers are stupid.
if ($menu == 'bottom' && isset($page['accesskey'])) {
$links[] = "<a href='{$url}' accesskey='{$page['accesskey']}'>{$title}</a> {$page['accesskey']}";
} else {
$links[] = "<a href='{$url}'>{$title}</a>";
}
}
if (user_is_authenticated()) {
$user = user_current_username();
array_unshift($links, "<b><a href='user/{$user}'>{$user}</a></b>");
}
if ($menu == 'bottom') {
$links[] = "<a href='{$_GET['q']}' accesskey='5'>refresh</a> 5";
}
return "<div class='menu menu-{$menu}'>" . implode(' | ', $links) . '</div>';
}
示例2: touch_theme_menu_top
function touch_theme_menu_top()
{
$links = $main_menu_titles = array();
if (setting_fetch('tophome', 'yes') == 'yes') {
$main_menu_titles[] = __("Home");
}
if (setting_fetch('topreplies', 'yes') == 'yes') {
$main_menu_titles[] = __("Replies");
}
if (setting_fetch('topdirects', 'yes') == 'yes') {
$main_menu_titles[] = __("Directs");
}
if (setting_fetch('topsearch') == 'yes') {
$main_menu_titles[] = __("Search");
}
foreach (menu_visible_items() as $url => $page) {
$title = $url ? $page['title'] : __("Home");
$type = in_array($title, $main_menu_titles) ? 'main' : 'extras';
$links[$type][] = "<a href='" . BASE_URL . "{$url}'>{$title}</a>";
}
if (user_is_authenticated()) {
$user = user_current_username();
if (setting_fetch('topuser') == 'yes') {
array_unshift($links['main'], "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
}
array_unshift($links['extras'], "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
}
array_push($links['main'], '<a href="#" onclick="return toggleMenu()">' . __('More') . '</a>');
$html = '<div id="menu" class="menu">';
$html .= theme('list', $links['main'], array('id' => 'menu-main'));
$html .= theme('list', $links['extras'], array('id' => 'menu-extras'));
$html .= '</div>';
return $html;
}
示例3: settings_page
function settings_page($args)
{
if ($args[1] == 'save') {
$settings['browser'] = $_POST['browser'];
$settings['gwt'] = $_POST['gwt'];
$settings['colours'] = $_POST['colours'];
$settings['reverse'] = $_POST['reverse'];
$settings['timestamp'] = $_POST['timestamp'];
$settings['hide_inline'] = $_POST['hide_inline'];
$settings['utc_offset'] = (double) $_POST['utc_offset'];
// Save a user's oauth details to a MySQL table
if (MYSQL_USERS == 'ON' && ($newpass = $_POST['newpassword'])) {
user_is_authenticated();
list($key, $secret) = explode('|', $GLOBALS['user']['password']);
$sql = sprintf("REPLACE INTO user (username, oauth_key, oauth_secret, password) VALUES ('%s', '%s', '%s', MD5('%s'))", mysql_escape_string(user_current_username()), mysql_escape_string($key), mysql_escape_string($secret), mysql_escape_string($newpass));
mysql_query($sql);
}
setcookie_year('settings', base64_encode(serialize($settings)));
twitter_refresh('');
}
$modes = array('mobile' => 'Normal phone', 'touch' => 'Touch phone', 'desktop' => 'PC/Laptop', 'text' => 'Text only', 'worksafe' => 'Work Safe', 'bigtouch' => 'Big Touch');
$gwt = array('off' => 'direct', 'on' => 'via GWT');
$colour_schemes = array();
foreach ($GLOBALS['colour_schemes'] as $id => $info) {
list($name, $colours) = explode('|', $info);
$colour_schemes[$id] = $name;
}
$utc_offset = setting_fetch('utc_offset', 0);
/* returning 401 as it calls http://api.twitter.com/1/users/show.json?screen_name= (no username???)
if (!$utc_offset) {
$user = twitter_user_info();
$utc_offset = $user->utc_offset;
}
*/
if ($utc_offset > 0) {
$utc_offset = '+' . $utc_offset;
}
$content .= '<form action="settings/save" method="post"><p>Colour scheme:<br /><select name="colours">';
$content .= theme('options', $colour_schemes, setting_fetch('colours', 1));
$content .= '</select></p><p>Mode:<br /><select name="browser">';
$content .= theme('options', $modes, $GLOBALS['current_theme']);
$content .= '</select></p><p>External links go:<br /><select name="gwt">';
$content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off'));
$content .= '</select><small><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</small></p>';
$content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>';
$content .= '<p><label><input type="checkbox" name="timestamp" value="yes" ' . (setting_fetch('timestamp') == 'yes' ? ' checked="checked" ' : '') . ' /> Show the timestamp ' . twitter_date('H:i') . ' instead of 25 sec ago</label></p>';
$content .= '<p><label><input type="checkbox" name="hide_inline" value="yes" ' . (setting_fetch('hide_inline') == 'yes' ? ' checked="checked" ' : '') . ' /> Hide inline media (eg TwitPic thumbnails)</label></p>';
$content .= '<p><label>The time in UTC is currently ' . gmdate('H:i') . ', by using an offset of <input type="text" name="utc_offset" value="' . $utc_offset . '" size="3" /> we display the time as ' . twitter_date('H:i') . '.<br />It is worth adjusting this value if the time appears to be wrong.</label></p>';
// Allow users to choose a Dabr password if accounts are enabled
if (MYSQL_USERS == 'ON' && user_is_authenticated()) {
$content .= '<fieldset><legend>Dabr account</legend><small>If you want to sign in to Dabr without going via Twitter.com in the future, create a password and we\'ll remember you.</small></p><p>Change Dabr password<br /><input type="password" name="newpassword" /><br /><small>Leave blank if you don\'t want to change it</small></fieldset>';
}
$content .= '<p><input type="submit" value="Save" /></p></form>';
$content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>';
return theme('page', 'Settings', $content);
}
示例4: config_log_request
function config_log_request()
{
if (!user_is_authenticated()) {
return;
}
$allowed_users = file('invite.php');
if (!in_array(strtolower(user_current_username()) . "\n", $allowed_users)) {
user_logout();
die("对不起,您不是受邀用户,无法登录。");
}
}
示例5: blackberry_theme_menu_bottom
function blackberry_theme_menu_bottom()
{
$links = array();
$links[] = "<a href='" . BASE_URL . "'>" . __("Home") . "</a>";
if (user_is_authenticated()) {
if (setting_fetch('replies') == 'yes') {
$links[] = "<a href='" . BASE_URL . "replies'>" . __("Replies") . "</a>";
}
if (setting_fetch('retweets') == 'yes') {
$links[] = "<a href='" . BASE_URL . "retweets'>" . __("Retweets") . "</a>";
}
if (setting_fetch('directs') == 'yes') {
$links[] = "<a href='" . BASE_URL . "directs'>" . __("Directs") . "</a>";
}
if (setting_fetch('search') == 'yes') {
$links[] = "<a href='" . BASE_URL . "search'>" . __("Search") . "</a>";
}
if (setting_fetch('favourites') == 'yes') {
$links[] = "<a href='" . BASE_URL . "favourites'>" . __("Favourites") . "</a>";
}
if (setting_fetch('lists') == 'yes') {
$links[] = "<a href='" . BASE_URL . "lists'>" . __("Lists") . "</a>";
}
if (setting_fetch('followers') == 'yes') {
$links[] = "<a href='" . BASE_URL . "followers'>" . __("Followers") . "</a>";
}
if (setting_fetch('friends') == 'yes') {
$links[] = "<a href='" . BASE_URL . "friends'>" . __("Friends") . "</a>";
}
if (setting_fetch('blockings') == 'yes') {
$links[] = "<a href='" . BASE_URL . "blockings'>" . __("Blockings") . "</a>";
}
}
if (user_is_authenticated()) {
$user = user_current_username();
array_unshift($links, "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
if (setting_fetch('about') == 'yes') {
$links[] = "<a href='" . BASE_URL . "about'>" . __("About") . "</a>";
}
if (setting_fetch('ssettings', 'yes') == 'yes') {
$links[] = "<a href='" . BASE_URL . "settings'>" . __("Settings") . "</a>";
}
if (setting_fetch('slogout') == 'yes') {
$links[] = "<a href='" . BASE_URL . "logout'>" . __("Logout") . "</a>";
}
}
if (setting_fetch('srefresh', 'yes') == 'yes') {
$links[] = "<a href='" . BASE_URL . "{$_GET['q']}' accesskey='5'>" . __("Refresh") . "</a> 5";
}
return "<div class='menu menu-{$menu}'>" . implode(' | ', $links) . "</div>" . theme('pagination');
}
示例6: lists_controller
function lists_controller($query)
{
// Pick off $user from $query or default to the current user
$user = $query[1];
if (!$user) {
$user = user_current_username();
}
// Fiddle with the $query to find which part identifies the page they want
if ($query[3]) {
// URL in form: lists/$user/$list/$method
$member = $query[4];
$method = $query[3];
$list = $query[2];
} else {
// URL in form: lists/$user/$method
$method = $query[2];
}
// Attempt to call the correct page based on $method
switch ($method) {
case '':
case 'lists':
// Show which lists a user has created
return lists_lists_page($user);
case 'memberships':
// Show which lists a user belongs to
return lists_membership_page($user);
case 'create':
//Create a new list
return lists_list_create_page($user);
case 'ownerships':
// Show which lists a user owns
return lists_ownership_page($user);
case 'members':
// Show members of a list
return lists_list_members_page($user, $list);
case 'subscribers':
// Show subscribers of a list
return lists_list_subscribers_page($user, $list);
case 'edit':
// List editting page (name and availability)
return lists_list_edit_page($user, $list);
case 'delete':
return lists_list_delete_member($user, $list, $member);
default:
// Show tweets in a particular list
$list = $method;
return lists_list_tweets_page($user, $list);
}
// Error to be shown for any incomplete pages (breaks above)
return theme("error", __("List page not found"));
}
示例7: touch_theme_menu_top
function touch_theme_menu_top()
{
$links = array();
$main_menu_titles = array('home', 'replies', 'directs', 'search');
foreach (menu_visible_items() as $url => $page) {
$title = $url ? $url : 'home';
$type = in_array($title, $main_menu_titles) ? 'main' : 'extras';
$links[$type][] = "<a href='{$url}'>{$title}</a>";
}
if (user_is_authenticated()) {
$user = user_current_username();
array_unshift($links['extras'], "<b><a href='user/{$user}'>{$user}</a></b>");
}
array_push($links['main'], '<a href="#" onclick="return toggleMenu()">more</a>');
$html = '<div id="menu" class="menu">';
$html .= theme('list', $links['main'], array('id' => 'menu-main'));
$html .= theme('list', $links['extras'], array('id' => 'menu-extras'));
$html .= '</div>';
return $html;
}
示例8: theme_user_header
function theme_user_header($user)
{
$friendship = friendship($user->screen_name);
$followed_by = $friendship->relationship->target->followed_by;
//The $user is followed by the authenticating
$following = $friendship->relationship->target->following;
$name = theme('full_name', $user);
$full_avatar = theme_get_full_avatar($user);
$link = twitter_parse_tags($user->url, $user->entities->url);
//Some locations have a prefix which should be removed (UberTwitter and iPhone)
$cleanLocation = urlencode(str_replace(array("iPhone: ", "ÜT: "), "", $user->location));
$raw_date_joined = strtotime($user->created_at);
$date_joined = date('jS M Y', $raw_date_joined);
$tweets_per_day = twitter_tweets_per_day($user, 1);
$bio = twitter_parse_tags($user->description, $user->entities->description);
$out = "<div class='profile'>\n\t <span class='avatar'>" . theme('external_link', $full_avatar, theme('avatar', theme_get_avatar($user))) . "</span>\n\t <span class='status shift'><b>{$name}</b><br/>\n\t <span class='about'>";
// if ($user->verified == true) {
// $out .= ' <strong>Verified</strong> '.theme('action_icon', "", '✔', 'Verified').'<br />';
// }
if ($user->protected == true) {
$out .= '<strong>Private/Protected Tweets</strong><br />';
}
$out .= "Bio: {$bio}<br />\n\t Link: {$link}<br />\n\t <span class='icons'>⌖</span> <a href=\"https://maps.google.com/maps?q={$cleanLocation}\" target=\"" . get_target() . "\">\n\t {$user->location}\n\t </a>\n\t <br />\n\t Joined: {$date_joined} (~" . pluralise('tweet', $tweets_per_day, true) . " per day)\n\t </span>\n\t </span>\n\t <div class='features'>";
$out .= pluralise('tweet', $user->statuses_count, true);
//If the authenticated user is not following the protected used, the API will return a 401 error when trying to view friends, followers and favourites
//This is not the case on the Twitter website
//To avoid the user being logged out, check to see if she is following the protected user. If not, don't create links to friends, followers and favourites
if ($user->protected == true && $followed_by == false) {
$out .= " | " . pluralise('follower', $user->followers_count, true);
$out .= " | " . pluralise('friend', $user->friends_count, true);
$out .= " | " . pluralise('favourite', $user->favourites_count, true);
} else {
$out .= " | <a href='followers/{$user->screen_name}'>" . pluralise('follower', $user->followers_count, true) . "</a>";
$out .= " | <a href='friends/{$user->screen_name}'>" . pluralise('friend', $user->friends_count, true) . "</a>";
$out .= " | <a href='favourites/{$user->screen_name}'>" . pluralise('favourite', $user->favourites_count, true) . "</a>";
}
$out .= " | <a href='lists/{$user->screen_name}'>" . pluralise('list', $user->listed_count, true) . "</a>";
if ($following) {
$out .= " | <a href='messages/create/{$user->screen_name}'>Direct Message</a>";
}
// One cannot follow, block, nor report spam oneself.
if (strtolower($user->screen_name) !== strtolower(user_current_username())) {
if ($followed_by == false) {
$out .= " | <a href='follow/{$user->screen_name}'>Follow</a>";
} else {
$out .= " | <a href='unfollow/{$user->screen_name}'>Unfollow</a>";
if ($friendship->relationship->source->want_retweets) {
$out .= " | <a href='confirm/hideretweets/{$user->screen_name}'>Hide Retweets</a>";
} else {
$out .= " | <a href='confirm/showretweets/{$user->screen_name}'>Show Retweets</a>";
}
}
//We need to pass the User Name and the User ID. The Name is presented in the UI, the ID is used in checking
$blocked = $friendship->relationship->source->blocking;
//The $user is blocked by the authenticating
if ($blocked == true) {
$out .= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Unblock</a>";
} else {
$out .= " | <a href='confirm/block/{$user->screen_name}/{$user->id}'>Block</a>";
}
$out .= " | <a href='confirm/spam/{$user->screen_name}/{$user->id}'>Report Spam</a>";
} else {
// Items we can only show on ourself
$out .= " | <a href='blocked'>Show Blocked Users</a>";
}
$out .= " | <a href='search?query=%40{$user->screen_name}'>Search @{$user->screen_name}</a>";
$out .= "</div></div>";
return $out;
}
示例9: theme_menu_bottom
function theme_menu_bottom()
{
$links = array();
$links[] = "<a href='" . BASE_URL . "'>" . __("Home") . "</a>";
if (user_is_authenticated()) {
if (setting_fetch('replies') == 'yes') {
$links[] = "<a href='" . BASE_URL . "replies'>" . __("Replies") . "</a>";
}
if (setting_fetch('retweets') == 'yes') {
$links[] = "<a href='" . BASE_URL . "retweets'>" . __("Retweets") . "</a>";
}
if (setting_fetch('directs') == 'yes') {
$links[] = "<a href='" . BASE_URL . "directs'>" . __("Directs") . "</a>";
}
if (setting_fetch('search') == 'yes') {
$links[] = "<a href='" . BASE_URL . "search'>" . __("Search") . "</a>";
}
if (setting_fetch('favourites') == 'yes') {
$links[] = "<a href='" . BASE_URL . "favourites'>" . __("Favourites") . "</a>";
}
if (setting_fetch('lists') == 'yes') {
$links[] = "<a href='" . BASE_URL . "lists'>" . __("Lists") . "</a>";
}
if (setting_fetch('followers') == 'yes') {
$links[] = "<a href='" . BASE_URL . "followers'>" . __("Followers") . "</a>";
}
if (setting_fetch('friends') == 'yes') {
$links[] = "<a href='" . BASE_URL . "friends'>" . __("Friends") . "</a>";
}
if (setting_fetch('blockings') == 'yes') {
$links[] = "<a href='" . BASE_URL . "blockings'>" . __("Blockings") . "</a>";
}
}
if (user_is_authenticated()) {
$user = user_current_username();
array_unshift($links, "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
if (setting_fetch('about') == 'yes') {
$links[] = "<a href='" . BASE_URL . "about'>" . __("About") . "</a>";
}
if (setting_fetch('ssettings', 'yes') == 'yes') {
$links[] = "<a href='" . BASE_URL . "settings'>" . __("Settings") . "</a>";
}
if (setting_fetch('slogout', 'yes') == 'yes') {
$links[] = "<a href='" . BASE_URL . "logout'>" . __("Logout") . "</a>";
}
}
return '<div class="menu menu-$menu">' . implode(' | ', $links) . '</div>';
}
示例10: theme_action_icons
function theme_action_icons($status)
{
$from = $status->from->screen_name;
$retweeted_by = $status->retweeted_by->user->screen_name;
$retweeted_id = $status->retweeted_by->id;
$geo = $status->geo;
$actions = array();
if (!$status->is_direct) {
$actions[] = theme('action_icon', "user/{$from}/reply/{$status->id}", 'images/reply.png', '@');
}
//Reply All functionality.
if (substr_count($status->text, '@') >= 1) {
$found = Twitter_Extractor::extractMentionedScreennames($status->text);
$to_users = array_unique($found);
$key = array_search(user_current_username(), $to_users);
// Remove the username of the authenticated user
if ($key != NULL || $key !== FALSE) {
unset($to_users[$key]);
// remove the username from array
}
if (count($to_users) >= 1) {
$actions[] = theme('action_icon', "user/{$from}/replyall/{$status->id}", 'images/replyall.png', 'REPLY ALL');
}
}
if (!user_is_current_user($from)) {
$actions[] = theme('action_icon', "directs/create/{$from}", 'images/dm.png', 'DM');
}
if (!$status->is_direct) {
if ($status->favorited == '1') {
$actions[] = theme('action_icon', "unfavourite/{$status->id}", 'images/star.png', 'UNFAV');
} else {
$actions[] = theme('action_icon', "favourite/{$status->id}", 'images/star_grey.png', 'FAV');
}
$actions[] = theme('action_icon', "retweet/{$status->id}", 'images/retweet.png', 'RT');
if (user_is_current_user($from)) {
$actions[] = theme('action_icon', "confirm/delete/{$status->id}", 'images/trash.gif', 'DEL');
}
if ($retweeted_by) {
if (user_is_current_user($retweeted_by)) {
$actions[] = theme('action_icon', "confirm/delete/{$retweeted_id}", 'images/trash.gif', 'DEL');
}
}
} else {
$actions[] = theme('action_icon', "directs/delete/{$status->id}", 'images/trash.gif', 'DEL');
}
if ($geo !== null) {
$latlong = $geo->coordinates;
$lat = $latlong[0];
$long = $latlong[1];
$actions[] = theme('action_icon', "http://maps.google.co.uk/m?q={$lat},{$long}", 'images/map.png', 'MAP');
}
//Search for @ to a user
$actions[] = theme('action_icon', "search?query=%40{$from}", 'images/q.png', '?');
return implode(' ', $actions);
}
示例11: user_is_current_user
function user_is_current_user($username)
{
return strcasecmp($username, user_current_username()) == 0;
}
示例12: twitter_is_reply
function twitter_is_reply($status)
{
if (!user_is_authenticated()) {
return false;
}
$user = user_current_username();
// Use Twitter Entities to see if this contains a mention of the user
if ($status->entities) {
if ($status->entities->user_mentions) {
$entities = $status->entities;
foreach ($entities->user_mentions as $mentions) {
if ($mentions->screen_name == $user) {
return true;
}
}
}
return false;
}
// If there are no entities (for example on a search) do a simple regex
$found = Twitter_Extractor::create($status->text)->extractMentionedUsernames();
foreach ($found as $mentions) {
// Case insensitive compare
if (strcasecmp($mentions, $user) == 0) {
return true;
}
}
return false;
}
示例13: theme_user_info
function theme_user_info($user)
{
$screen_name = $user->screen_name;
if ($user->following == false) {
$out = "<div class='button-div'><a class='button' href='.follow/{$screen_name}'>" . _(FOLLOW) . "</a></div>";
} else {
$out = "<div class='button-div'><a class='button' href='.unfollow/{$screen_name}'>" . _(UNFOLLOW) . "</a></div>";
}
$out .= "<div>" . _(INFO) . ": ";
$out .= sprintf(ngettext("PROFILE_COUNT_TWEET %s", "PROFILE_COUNT_TWEETS %s", $user->statuses_count), number_format($user->statuses_count));
// If the authenticated user is not following the protected user,
// the API will return a 401 error when trying to view friends, followers and favourites
// This is not the case on the Twitter website
// To avoid the user being logged out, check to see if she is following the protected user.
// If not, don't create links to friends, followers and favourites
if ($user->protected == true && $followed_by == false) {
$out .= " | " . sprintf(ngettext("PROFILE_COUNT_FOLLOWER %s", "PROFILE_COUNT_FOLLOWERS %s", $user->followers_count), number_format($user->followers_count));
$out .= " | " . sprintf(ngettext("PROFILE_COUNT_FRIEND %s", "PROFILE_COUNT_FRIENDS %s", $user->friends_count), number_format($user->friends_count));
$out .= " | " . sprintf(ngettext("PROFILE_COUNT_FAVOURITE %s", "PROFILE_COUNT_FAVOURITES %s", $user->favourites_count), number_format($user->favourites_count));
} else {
$out .= " | <a href='followers/{$screen_name}'>" . sprintf(ngettext("PROFILE_COUNT_FOLLOWER %s", "PROFILE_COUNT_FOLLOWERS %s", $user->followers_count), number_format($user->followers_count)) . "</a>";
$out .= " | <a href='friends/{$screen_name}'>" . sprintf(ngettext("PROFILE_COUNT_FRIEND %s", "PROFILE_COUNT_FRIENDS %s", $user->friends_count), number_format($user->friends_count)) . "</a>";
$out .= " | <a href='favourites/{$screen_name}'>" . sprintf(ngettext("PROFILE_COUNT_FAVOURITE %s", "PROFILE_COUNT_FAVOURITES %s", $user->favourites_count), number_format($user->favourites_count)) . "</a>";
}
$out .= " | <a href='lists/{$screen_name}'>" . sprintf(ngettext("PROFILE_COUNT_LIST %s", "PROFILE_COUNT_LISTS %s", $user->listed_count), number_format($user->listed_count)) . "</a>";
// Blocking and Muting are not always returned. Here's the hacky way to get it.
if ($user->muting === null) {
// Too many API calls. Slow and inefficient
// $friendship = friendship($user->screen_name);
$muting = null;
//$friendship->relationship->source->muting;
$blocking = null;
//$friendship->relationship->source->blocking;
$messaging = null;
//$friendship->relationship->source->can_dm;
$retweets = null;
//$friendship->relationship->source->want_retweets;
} else {
$muting = $user->muting;
$blocking = $user->blocking;
$messaging = false;
//$user->following; // Is the authenticated user being followed by the listed user.
$retweets = true;
// Can assume that Retweets haven't been hidden?
}
if ($muting) {
$out .= " | <a href='.confirm/.unmute/{$screen_name}'>" . _(UNMUTE) . "</a>";
} else {
$out .= " | <a href='.confirm/.mute/{$screen_name}'>" . _(MUTE) . "</a>";
}
if ($blocking == true) {
$out .= " | <a href='.confirm/.unblock/{$screen_name}'>" . _(UNBLOCK) . "</a>";
} else {
$out .= " | <a href='.confirm/.block/{$screen_name}'>" . _(BLOCK) . "</a>";
}
if ($messaging == true) {
$out .= " | <a href='messages/create/{$screen_name}'>" . _(DIRECTS_BUTTON) . "</a>";
}
// One cannot follow, block, nor report spam oneself.
if (strtolower($screen_name) !== strtolower(user_current_username())) {
if ($user->following == true) {
if ($retweets) {
$out .= " | <a href='.confirm/.hideRetweets/{$screen_name}'>" . _(RETWEETS_HIDE) . "</a>";
} else {
$out .= " | <a href='.confirm/.showRetweets/{$screen_name}'>" . _(RETWEETS_SHOW) . "</a>";
}
}
$out .= " | <a href='.confirm/.spam/{$user->screen_name}/{$user->id}'>" . _(REPORT_SPAM) . "</a>";
} else {
// Items we can only show on ourself
$out .= " | <a href='blocked-list'>" . _(BLOCK_SHOW) . "</a>";
}
$out .= " | <a href='search?query=%40{$screen_name}'>" . sprintf(_(SEARCH_AT), $user->screen_name) . "</a>";
$out .= "</div>";
return $out;
}
示例14: error_reporting
<?php
error_reporting(E_ERROR | E_PARSE);
$dataFile = "onlineusers.txt";
if (user_is_authenticated()) {
$user = user_current_username();
}
// this is the time in **minutes** to consider someone online before removing them from our file
// berapa menit tenggang waktu yg dibutuhkan untuk tahu user masih online atau tidak.
$sessionTime = 5;
if (!file_exists($dataFile)) {
$fp = fopen($dataFile, "w+");
fclose($fp);
}
$users = array();
$onusers = array();
// check up
$fp = fopen($dataFile, "r");
flock($fp, LOCK_SH);
while (!feof($fp)) {
$users[] = rtrim(fgets($fp, 32));
}
flock($fp, LOCK_UN);
fclose($fp);
// clean up
$x = 0;
$alreadyIn = FALSE;
foreach ($users as $key => $data) {
list(, $lastvisit) = explode("|", $data);
if (time() - $lastvisit >= $sessionTime * 60) {
$users[$x] = "";
示例15: theme_menu_bottomtom
function theme_menu_bottomtom($menu)
{
$links = array();
$links[] = "<a href='" . BASE_URL . "' accesskey='0'>Home</a>";
if (user_is_authenticated()) {
if (setting_fetch('replies') == 'yes') {
$links[] = "<a href='replies' accesskey='1'>Replies</a>";
}
if (setting_fetch('retweets') == 'yes') {
$links[] = "<a href='retweets' accesskey='2'>Retweets</a>";
}
if (setting_fetch('retweeted') == 'yes') {
$links[] = "<a href='retweeted' accesskey='6'>Retweeted</a>";
}
if (setting_fetch('directs') == 'yes') {
$links[] = "<a href='directs' accesskey='3'>Directs</a>";
}
if (setting_fetch('search') == 'yes') {
$links[] = "<a href='search' accesskey='4'>Search</a>";
}
if (setting_fetch('picture') == 'yes') {
$links[] = "<a href='picture'>Picture</a>";
}
if (setting_fetch('favourites') == 'yes') {
$links[] = "<a href='favourites'>Favourites</a>";
}
if (setting_fetch('lists') == 'yes') {
$links[] = "<a href='lists'>Lists</a>";
}
if (setting_fetch('followers') == 'yes') {
$links[] = "<a href='followers'>Followers</a>";
}
if (setting_fetch('friends') == 'yes') {
$links[] = "<a href='friends'>Friends</a>";
}
/*if (setting_fetch('blockings') == 'yes') {
$links[] = "<a href='blockings'>Blockings</a>";
}*/
if (setting_fetch('trends') == 'yes') {
$links[] = "<a href='trends'>Trends</a>";
}
}
if (user_is_authenticated()) {
$user = user_current_username();
array_unshift($links, "<span class='textb'><a href='user/{$user}'>{$user}</a></span>");
if (setting_fetch('about') == 'yes') {
$links[] = "<a href='about'>About</a>";
}
if (setting_fetch('ssettings', 'yes') == 'yes') {
$links[] = "<a href='settings'>Settings</a>";
}
if (setting_fetch('slogout', 'yes') == 'yes') {
$links[] = "<a href='logout'>Logout</a>";
}
}
if (setting_fetch('srefresh', 'yes') == 'yes') {
$links[] = "<a href='{$_GET['q']}' accesskey='5'>Refresh</a>";
}
return '<div class="menu menu-$menu">' . implode(' | ', $links) . '</div>';
}