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>'; }
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; }
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); }
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("对不起,您不是受邀用户,无法登录。"); } }
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'); }
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")); }
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; }
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; }
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>'; }
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); }
function user_is_current_user($username) { return strcasecmp($username, user_current_username()) == 0; }
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; }
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; }
<?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] = "";
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>'; }
function theme_topmenu() { $user = user_current_username(); $content = "<div class='header'></div><div class='menuy'><center>\n<a href=''><img src='http://twit.basko.ro/imgtop/home.png'></a>\n<a href='/replies'><img src='http://twit.basko.ro/imgtop/mentions.png'></a>\n<a href='/directs'><img src='http://twit.basko.ro/imgtop/directs.png'></a>\n<a href='/search'><img src='http://twit.basko.ro/imgtop/search.png'></a>\n<a href='user/" . $user . "'><img src='http://twit.basko.ro/imgtop/user.png'></a></center></div>"; return $content; }
function twitter_is_reply($status) { if (!user_is_authenticated()) { return false; } return stripos($status->text, "user/" . user_current_username()); }
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['tpp'] = $_POST['tpp']; $settings['ltpp'] = $_POST['ltpp']; $settings['topuser'] = $_POST['topuser']; $settings['tophome'] = $_POST['tophome']; $settings['topreplies'] = $_POST['topreplies']; $settings['topretweets'] = $_POST['topretweets']; $settings['topretweeted'] = $_POST['topretweeted']; $settings['topdirects'] = $_POST['topdirects']; $settings['toppicture'] = $_POST['toppicture']; $settings['topsearch'] = $_POST['topsearch']; $settings['replies'] = $_POST['replies']; $settings['retweets'] = $_POST['retweets']; $settings['retweeted'] = $_POST['retweeted']; $settings['directs'] = $_POST['directs']; $settings['search'] = $_POST['search']; $settings['favourites'] = $_POST['favourites']; $settings['lists'] = $_POST['lists']; $settings['followers'] = $_POST['followers']; $settings['friends'] = $_POST['friends']; /*$settings['blockings'] = $_POST['blockings'];*/ $settings['trends'] = $_POST['trends']; $settings['picture'] = $_POST['picture']; $settings['about'] = $_POST['about']; $settings['ssettings'] = $_POST['ssettings']; $settings['slogout'] = $_POST['slogout']; $settings['srefresh'] = $_POST['srefresh']; $settings['linktrans'] = $_POST['linktrans']; $settings['avataro'] = $_POST['avataro']; $settings['buttonrl'] = $_POST['buttonrl']; $settings['buttonre'] = $_POST['buttonre']; $settings['buttonreall'] = $_POST['buttonreall']; $settings['buttondm'] = $_POST['buttondm']; $settings['buttonfav'] = $_POST['buttonfav']; $settings['buttonrt'] = $_POST['buttonrt']; $settings['buttondel'] = $_POST['buttondel']; $settings['buttonmap'] = $_POST['buttonmap']; $settings['buttongeo'] = $_POST['buttongeo']; $settings['buttonot'] = $_POST['buttonot']; $settings['buttonsearch'] = $_POST['buttonsearch']; $settings['buttontime'] = $_POST['buttontime']; $settings['buttonfrom'] = $_POST['buttonfrom']; $settings['buttonend'] = $_POST['buttonend']; $settings['longurl'] = $_POST['longurl']; //$settings['showthumbs'] = $_POST['showthumbs']; $settings['fixedtagspre'] = $_POST['fixedtagspre']; $settings['fixedtagspreo'] = $_POST['fixedtagspreo']; $settings['fixedtagspost'] = $_POST['fixedtagspost']; $settings['fixedtagsposto'] = $_POST['fixedtagsposto']; $settings['rtsyntax'] = $_POST['rtsyntax']; $settings['timestamp'] = $_POST['timestamp']; $settings['hide_inline'] = $_POST['hide_inline']; $settings['utc_offset'] = (double) $_POST['utc_offset']; $settings['rl_user'] = $_POST['rl_user']; $settings['rl_pass'] = $_POST['rl_pass']; $settings['longtext'] = $_POST['longtext']; $settings['filtero'] = $_POST['filtero']; $settings['filterc'] = $_POST['filterc']; // Save a user's oauth details to a MySQL table if (ACCESS_USERS == 'MYSQL') { if ($newpass = $_POST['newpassword'] || ($delpass = $_POST['delpass'])) { user_is_authenticated(); $username = strtolower(user_current_username()); $con = @mysql_connect(MYSQL_URL, MYSQL_USER, MYSQL_PASSWORD) || theme('error', '<p>Error failed to connect your MySQL Database.</p>'); @mysql_select_db(MYSQL_DB) || theme('error', '<p>Error failed to select your MySQL Database.</p>'); if ($newpass = $_POST['newpassword']) { list($key, $secret) = explode('|', $GLOBALS['user']['password']); $sql = sprintf("REPLACE INTO user (username, oauth_key, oauth_secret, password) VALUES (%s, %s, %s, MD5(%s))", check_input($username), check_input($key), check_input($secret), check_input($newpass)); @mysql_query($sql) || theme('error', '<p>Error failed to save your OAuth Information into your MySQL Database.</p><p>Please check your MySQL Database.</p>'); } if ($delpass = $_POST['delpass']) { user_is_authenticated(); $del = "DELETE FROM user WHERE username = "******"settings/save" method="post">'; $content .= '<p><label>Colour scheme:<br /><select name="colours">' . theme('options', $colour_schemes, setting_fetch('colours', 1)) . '</select></label></p><hr />'; $content .= '<p><label>Mode:<br /><select name="browser">' . theme('options', $modes, $GLOBALS['current_theme']) . '</select></label></p><hr />'; $content .= '<p>Configure Menu Items<br />'; $content .= '<span class="texts">Choose what you want to display on the Top Bar.</span><br />'; $content .= '<label><input type="checkbox" name="topuser" value="yes" ' . (setting_fetch('topuser') == 'yes' ? ' checked="checked" ' : '') . ' /> User</label><br />'; $content .= '<label><input type="checkbox" name="tophome" value="yes" ' . (setting_fetch('tophome', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Home</label><br />'; $content .= '<label><input type="checkbox" name="topreplies" value="yes" ' . (setting_fetch('topreplies', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Replies</label><br />'; $content .= '<label><input type="checkbox" name="topretweets" value="yes" ' . (setting_fetch('topretweets', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Retweets</label><br />'; $content .= '<label><input type="checkbox" name="topretweeted" value="yes" ' . (setting_fetch('topretweeted') == 'yes' ? ' checked="checked" ' : '') . ' /> Retweeted</label><br />'; $content .= '<label><input type="checkbox" name="topdirects" value="yes" ' . (setting_fetch('topdirects', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Directs</label><br />'; $content .= '<label><input type="checkbox" name="topsearch" value="yes" ' . (setting_fetch('topsearch') == 'yes' ? ' checked="checked" ' : '') . ' /> Search</label><br />'; $content .= '<label><input type="checkbox" name="toppicture" value="yes" ' . (setting_fetch('toppicture') == 'yes' ? ' checked="checked" ' : '') . ' /> Picture</label><br />'; $content .= '<span class="texts">And Choose what you want to display on the Bottom Bar.</span><br />'; $content .= '<label><input type="checkbox" name="replies" value="yes" ' . (setting_fetch('replies') == 'yes' ? ' checked="checked" ' : '') . ' /> Replies</label><br />'; $content .= '<label><input type="checkbox" name="retweets" value="yes" ' . (setting_fetch('retweets') == 'yes' ? ' checked="checked" ' : '') . ' /> Retweets</label><br />'; $content .= '<label><input type="checkbox" name="retweeted" value="yes" ' . (setting_fetch('retweeted') == 'yes' ? ' checked="checked" ' : '') . ' /> Retweeted</label><br />'; $content .= '<label><input type="checkbox" name="directs" value="yes" ' . (setting_fetch('directs') == 'yes' ? ' checked="checked" ' : '') . ' /> Directs</label><br />'; $content .= '<label><input type="checkbox" name="search" value="yes" ' . (setting_fetch('search') == 'yes' ? ' checked="checked" ' : '') . ' /> Search</label><br />'; $content .= '<label><input type="checkbox" name="picture" value="yes" ' . (setting_fetch('pictue') == 'yes' ? ' checked="checked" ' : '') . ' /> Picture</label><br />'; $content .= '<label><input type="checkbox" name="favourites" value="yes" ' . (setting_fetch('favourites') == 'yes' ? ' checked="checked" ' : '') . ' /> Favourites</label><br />'; $content .= '<label><input type="checkbox" name="lists" value="yes" ' . (setting_fetch('lists') == 'yes' ? ' checked="checked" ' : '') . ' /> Lists</label><br />'; $content .= '<label><input type="checkbox" name="followers" value="yes" ' . (setting_fetch('followers') == 'yes' ? ' checked="checked" ' : '') . ' /> Followers</label><br />'; $content .= '<label><input type="checkbox" name="friends" value="yes" ' . (setting_fetch('friends') == 'yes' ? ' checked="checked" ' : '') . ' /> Friends</label><br />'; /*$content .= '<label><input type="checkbox" name="blockings" value="yes" '. (setting_fetch('blockings') == 'yes' ? ' checked="checked" ' : '') .' /> Blockings</label><br />';*/ $content .= '<label><input type="checkbox" name="trends" value="yes" ' . (setting_fetch('trends') == 'yes' ? ' checked="checked" ' : '') . ' /> Trends</label><br />'; $content .= '<label><input type="checkbox" name="about" value="yes" ' . (setting_fetch('about') == 'yes' ? ' checked="checked" ' : '') . ' /> About</label><br />'; $content .= '<label><input type="checkbox" name="ssettings" value="yes" ' . (setting_fetch('ssettings', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Settings</label><br />'; $content .= '<label><input type="checkbox" name="slogout" value="yes" ' . (setting_fetch('slogout', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Logout</label><br />'; $content .= '<label><input type="checkbox" name="srefresh" value="yes" ' . (setting_fetch('srefresh') == 'yes' ? ' checked="checked" ' : '') . ' /> Refresh</label></p><hr />'; $content .= '<p><span class="texts">And Choose What you Want to Display On each Status.</span><br />'; $content .= '<label><input type="checkbox" name="buttonrl" value="yes" ' . (setting_fetch('buttonrl', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> RL [Read It Later]</label>'; $content .= '<label><input type="checkbox" name="buttonre" value="yes" ' . (setting_fetch('buttonre', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> AT [@]</label>'; $content .= '<label><input type="checkbox" name="buttonreall" value="yes" ' . (setting_fetch('buttonreall', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> RE [Reply All]</label>'; $content .= '<label><input type="checkbox" name="buttondm" value="yes" ' . (setting_fetch('buttondm') == 'yes' ? ' checked="checked" ' : '') . ' /> DM [Direct Messages]</label>'; $content .= '<label><input type="checkbox" name="buttonfav" value="yes" ' . (setting_fetch('buttonfav', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> FAV [Favourite]</label>'; $content .= '<label><input type="checkbox" name="buttonrt" value="yes" ' . (setting_fetch('buttonrt', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> RT [Retweet]</label>'; $content .= '<label><input type="checkbox" name="buttondel" value="yes" ' . (setting_fetch('buttondel', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> DEL [Delete]</label><br />'; $content .= '<label><input type="checkbox" name="buttonmap" value="yes" ' . (setting_fetch('buttonmap', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> MAP [Google Map]</label>'; $content .= '<label><input type="checkbox" name="buttonot" value="yes" ' . (setting_fetch('buttonot', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> OT [Original Tweet]</label>'; $content .= '<label><input type="checkbox" name="buttonsearch" value="yes" ' . (setting_fetch('buttonsearch', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> ? [Search for @ to a user]</label>'; $content .= '<label><input type="checkbox" name="buttongeo" value="yes" ' . (setting_fetch('buttongeo') == 'yes' ? ' checked="checked" ' : '') . ' /> GEO [Geolocation]</label><br />'; $content .= '<label><input type="checkbox" name="buttontime" value="yes" ' . (setting_fetch('buttontime', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Status Times</label>'; $content .= '<label><input type="checkbox" name="buttonfrom" value="yes" ' . (setting_fetch('buttonfrom', 'yes') == 'yes' ? ' checked="checked" ' : '') . ' /> Status From</label></p><hr />'; $content .= '<p><label><input type="checkbox" name="avataro" value="yes" ' . (setting_fetch('avataro', 'no') == 'yes' ? ' checked="checked" ' : '') . ' /> Disable Avatar</label></p><hr />'; $content .= '<p><label>Tweets per page (20-200): <input type="text" id="tpp" name="tpp" value="' . setting_fetch('tpp', 20) . '" size="3" maxlength="3" class="minput" /></label></p><hr />'; $content .= '<p><label>List tweets per page (20-200): <input type="text" id="ltpp" name="ltpp" value="' . setting_fetch('ltpp', 20) . '" size="3" maxlength="3" class="minput" /></label></p><hr />'; $content .= '<p><label>External links go:<br /><select name="gwt">'; $content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off')); $content .= '</select></label><span class="texts"><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</span></p>'; $content .= '<p><label>Showing URL:<br /><select name="linktrans">' . theme('options', $linktrans, setting_fetch('linktrans', 'd')) . '</select></label><br /><span class="texts">Note: Domain Only means change https://twitter.com/JaHIY to [twitter.com]</span></p><hr />'; $content .= '<p><label>Use Read It Later<br />Email address or username: <input type="text" name="rl_user" value="' . setting_fetch('rl_user', '') . '" size="25" class="linput" /></label><br />'; $content .= '<label>Password, if you have one.: <input type="password" name="rl_pass" value="' . setting_fetch('rl_pass', '') . '" size="25" class="linput" /></label></p><hr />'; if (LONG_URL == 'ON') { $content .= '<p><label><input type="checkbox" name="longurl" value="yes" ' . (setting_fetch('longurl') == 'yes' ? ' checked="checked" ' : '') . ' /> Show Long URL</label></p><hr />'; } //$content .= '<p><label><input type="checkbox" name="showthumbs" value="yes" '. (setting_fetch('showthumbs', 'yes') == 'yes' ? ' checked="checked" ' : '') .' /> Preview Photos In Timelines</label></p><hr />'; $content .= '<p><label><input type="checkbox" name="fixedtagsposto" value="yes" ' . (setting_fetch('fixedtagsposto', 'no') == 'yes' ? ' checked="checked" ' : '') . ' /> Tweet Content [At the beginning of your tweets]:</label> <input type="text" id="fixedtagspost" name="fixedtagspost" value="' . setting_fetch('fixedtagspost') . '" maxlength="70" size="6" class="sinput" /><br />'; $content .= '<label><input type="checkbox" name="fixedtagspreo" value="yes" ' . (setting_fetch('fixedtagspreo', 'no') == 'yes' ? ' checked="checked" ' : '') . ' /> Fixed Tags [At the end of your tweets]:</label> <input type="text" id="fixedtagspre" name="fixedtagspre" value="' . setting_fetch('fixedtagspre') . '" maxlength="70" size="6" class="sinput" /><br /><span class="texts">Intro: Add Tags in Your Tweets</span></p><hr />'; $content .= '<p><label>RT Syntax:<br /><input type="text" id="rtsyntax" name="rtsyntax" value="' . setting_fetch('rtsyntax', 'RT [User]: [Content]') . '" maxlength="140" size="25" class="linput" /></label><br /><span class="texts">Default RT Syntax: RT [User]: [Content]</span></p><hr />'; $content .= '<p><label>When posting a 140+ chars tweet:<br /><select name="longtext">' . theme('options', $longtext, setting_fetch('longtext', 'r')) . '</select></label></p><hr />'; $content .= '<p><label><input type="checkbox" name="filtero" value="yes" ' . (setting_fetch('filtero', 'no') == 'yes' ? ' checked="checked" ' : '') . ' /> Keyword Filter:</label> <input type="text" id="filterc" name="filterc" value="' . setting_fetch('filterc') . '" maxlength="140" size="25" class="linput" /><br /><span class="texts">Note: Separate keywords with space</span></p><hr />'; $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" maxlength="3" class="minput" /> 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 ((ACCESS_USERS == 'MYSQL' || ACCESS_USERS == 'FILE') && user_is_authenticated()) { $content .= '<fieldset><legend>Dabr account</legend><span class="texts">If you want to sign in to Dabr without going via Twitter.com in the future, create a password and we\'ll remember you.</span><p><label>Change Dabr password<br /><input type="password" name="newpassword" maxlength="40" size="25" class="linput" /></label><br /><span class="texts">Leave blank if you don\'t want to change it</span><br /><label><input type="checkbox" name="delpass" value="yes" /> Delete my Dabr account, please.</label></p></fieldset>'; } $content .= '<p><button type="submit">Save</button></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); }