Example #1
0
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>';
}
Example #2
0
File: user.php Project: xctcc/npt
function user_ensure_authenticated()
{
    if (!user_is_authenticated()) {
        $content = theme('login');
        theme('page', __("Login"), $content);
    }
}
Example #3
0
File: touch.php Project: xctcc/npt
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;
}
Example #4
0
function user_ensure_authenticated()
{
    if (!user_is_authenticated()) {
        $content = theme('login');
        $content .= theme('about');
        theme('page', 'Login', $content);
    }
}
Example #5
0
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL)
{
    if (user_is_authenticated()) {
        if ($_SERVER['HTTPS'] == "on") {
            $icon = "https://si0.twimg.com/images/dev/cms/intents/bird/bird_blue/bird_16_blue.png";
        } else {
            $icon = "http://a1.twimg.com/images/dev/cms/intents/bird/bird_blue/bird_16_blue.png";
        }
        //	adding ?status=foo will automaticall add "foo" to the text area.
        if ($_GET['status']) {
            $text = $_GET['status'];
        }
        $output = '
		<form method="post" action="update">

			<fieldset>
				<legend><img src="' . $icon . '" width="16" height="16" /> What\'s Happening?</legend>
				<textarea id="status" name="status" rows="4" style="width:95%; max-width: 400px;">' . $text . '</textarea>
				<div>
					<input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" />
					<input type="submit" value="Tweet" />
					<span id="remaining">140</span> 
					<span id="geo" style="display: none;">
						<input onclick="goGeo()" type="checkbox" id="geoloc" name="location" />
						<label for="geoloc" id="lblGeo"></label>
					</span>
				</div>
			</fieldset>
			<script type="text/javascript">
				started = false;
				chkbox = document.getElementById("geoloc");
				if (navigator.geolocation) {
					geoStatus("Tweet my location");
					if ("' . $_COOKIE['geo'] . '"=="Y") {
						chkbox.checked = true;
						goGeo();
					}
				}
				function goGeo(node) {
					if (started) return;
					started = true;
					geoStatus("Locating...");
					navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus , { enableHighAccuracy: true });
				}
				function geoStatus(msg) {
					document.getElementById("geo").style.display = "inline";
					document.getElementById("lblGeo").innerHTML = msg;
				}
				function geoSuccess(position) {
					geoStatus("Tweet my <a href=\'http://maps.google.co.uk/m?q=" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>");
					chkbox.value = position.coords.latitude + "," + position.coords.longitude;
				}
			</script>
		</form>';
        $output .= js_counter('status');
        return $output;
    }
}
Example #6
0
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);
}
Example #7
0
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("对不起,您不是受邀用户,无法登录。");
    }
}
Example #8
0
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL, $is_desktop = true)
{
    if (user_is_authenticated()) {
        $fixedtags = setting_fetch('fixedtago', 'no') == "yes" && $text == '' ? " #" . setting_fetch('fixedtagc') : null;
        $output = '<form method="post" action="' . BASE_URL . 'update"><textarea id="status" name="status" rows="3" style="width:100%; max-width: 400px;">' . $text . $fixedtags . '</textarea><div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><input type="submit" value="' . __('Update') . '" /> <span id="remaining">140</span> ';
        if (substr($_GET["q"], 0, 4) !== "user") {
            $output .= ' <a href="' . BASE_URL . 'upload">' . __('Upload Picture') . '</a>';
        }
        $output .= '</div></form>';
        return $output;
    }
}
Example #9
0
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');
}
Example #10
0
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL, $is_desktop = true)
{
    if (user_is_authenticated()) {
        $fixedtags = setting_fetch('fixedtago', 'no') == "yes" && $text == '' ? " #" . setting_fetch('fixedtagc') : null;
        $output = '<form method="post" action="' . BASE_URL . 'update"><textarea id="status" name="status" rows="3" style="width:100%; max-width: 400px;">' . $text . $fixedtags . '</textarea>';
        if (setting_fetch('buttongeo') == 'yes') {
            $output .= '
<br /><span id="geo" style="display: inline;"><input onclick="goGeo()" type="checkbox" id="geoloc" name="location" /> <label for="geoloc" id="lblGeo"></label></span>
<script type="text/javascript">
<!--
started = false;
chkbox = document.getElementById("geoloc");
if (navigator.geolocation) {
	geoStatus("' . __("Tweet my location") . '");
	if ("' . $_COOKIE['geo'] . '"=="Y") {
		chkbox.checked = true;
		goGeo();
	}
}
function goGeo(node) {
	if (started) return;
	started = true;
	geoStatus("' . __("Locating...") . '");
	navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus, {enableHighAccuracy: true});
}
function geoStatus(msg) {
	document.getElementById("geo").style.display = "inline";
	document.getElementById("lblGeo").innerHTML = msg;
}
function geoSuccess(position) {
	if(typeof position.address !== "undefined")
		geoStatus("' . __("Tweet my ") . '<a href=\'https://maps.google.com/maps?q=loc:" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>" + " (" + position.address.country + position.address.region + "省" + position.address.city + "市,' . __("accuracy: ") . '" + position.coords.accuracy + "m)");
	else
		geoStatus("' . __("Tweet my ") . '<a href=\'https://maps.google.com/maps?q=loc:" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>' . __("location") . '</a>" + " (' . __("accuracy: ") . '" + position.coords.accuracy + "m)");
	chkbox.value = position.coords.latitude + "," + position.coords.longitude;
}
//-->
</script>
';
        }
        $output .= '<div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><input type="submit" value="' . __('Update') . '" /> <span id="remaining">140</span> ';
        if (substr($_GET["q"], 0, 4) !== "user") {
            $output .= ' <a href="' . BASE_URL . 'upload">' . __('Upload Picture') . '</a>';
        }
        $output .= '</div></form>';
        return $output;
    }
}
Example #11
0
function menu_visible_items()
{
    static $items;
    if (!isset($items)) {
        $items = array();
        foreach ($GLOBALS['menu_registry'] as $url => $page) {
            if ($page['security'] && !user_is_authenticated()) {
                continue;
            }
            if ($page['hidden']) {
                continue;
            }
            $items[$url] = $page;
        }
    }
    return $items;
}
function feedback_post($query)
{
    include_once 'login.inc.php';
    if (user_is_authenticated()) {
        $id1 = ', user_id';
        $id2 = ', \'' . get_current_user_id() . '\'';
    } else {
        $id1 = $id2 = "";
    }
    $question = get_post('question');
    $description = get_post('description');
    $email = get_post('email');
    include_once "uuid.inc.php";
    $v4uuid = str_replace("-", "", UUID::v4());
    connect_db();
    $add = "INSERT INTO feedback (\r\n\t\t\t\t\t feedback_id, question, description, post_datetime, email{$id1})\r\n\t\t\t\t     VALUES ('{$v4uuid}', '{$question}', '{$description}', '" . date('Y-m-d H:i:s') . "', '{$email}'{$id2})";
    $added = mysql_query($add) or die("Could not add entry!");
    echo "0";
}
Example #13
0
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;
}
Example #14
0
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL)
{
    if (user_is_authenticated()) {
        $output = '<form method="post" action="update">
  <textarea id="status" name="status" rows="3" style="width:95%; max-width: 400px;">' . $text . '</textarea>
  <div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><input type="submit" value="Update" /> <span id="remaining">140</span> 
  <span id="geo" style="display: none; float: right;"><input onclick="goGeo()" type="checkbox" id="geoloc" name="location" /> <label for="geoloc" id="lblGeo"></label></span></div>
  <script type="text/javascript">
started = false;
chkbox = document.getElementById("geoloc");
if (navigator.geolocation) {
	geoStatus("Tweet my location");
	if ("' . $_COOKIE['geo'] . '"=="Y") {
		chkbox.checked = true;
		goGeo();
	}
}
function goGeo(node) {
	if (started) return;
	started = true;
	geoStatus("Locating...");
	navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus);
}
function geoStatus(msg) {
	document.getElementById("geo").style.display = "inline";
	document.getElementById("lblGeo").innerHTML = msg;
}
function geoSuccess(position) {
	geoStatus("Tweet my <a href=\'http://maps.google.co.uk/m?q=" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>");
	chkbox.value = position.coords.latitude + "," + position.coords.longitude;
}
  </script>
</form>';
        $output .= js_counter('status');
        return $output;
    }
}
Example #15
0
function twitter_is_reply($status)
{
    if (!user_is_authenticated()) {
        return false;
    }
    $user = user_current_username();
    return preg_match("#@{$user}#i", $status->text);
}
Example #16
0
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL)
{
    if (user_is_authenticated()) {
        $fixedtagspre = setting_fetch('fixedtagspre');
        $fixedtagspost = setting_fetch('fixedtagspost');
        $fixedtagspre = !empty($fixedtagspre) && setting_fetch('fixedtagspreo', 'no') == "yes" && $text == '' ? $fixedtagspre . " " : NULL;
        $fixedtagspost = !empty($fixedtagspost) && setting_fetch('fixedtagsposto', 'no') == "yes" && $text == '' ? " " . $fixedtagspost : NULL;
        $text = $fixedtagspre . $text . $fixedtagspost;
        // adding ?status=foo will automaticall add "foo" to the text area.
        if ($_GET['status']) {
            $text = $_GET['status'];
        }
        $output = '<form method="post" action="update">
  <fieldset><legend>What\'s Happening?</legend>
  <div><textarea id="status" name="status" rows="4" cols="60">' . $text . '</textarea>
        ';
        if (setting_fetch('buttongeo') == 'yes') {
            $output .= '<br /><span id="geo" style="display: inline;"><input onclick="goGeo()" type="checkbox" id="geoloc" name="location" /> <label for="geoloc" id="lblGeo"></label></span>
  <script type="text/javascript">
<!--
started = false;
chkbox = document.getElementById("geoloc");
if (navigator.geolocation) {
    geoStatus("Tweet my location");
    if ("' . $_COOKIE['geo'] . '"=="Y") {
        chkbox.checked = true;
        goGeo();
    }
}
function goGeo(node) {
    if (started) return;
    started = true;
    geoStatus("Locating...");
    navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus, {enableHighAccuracy: true});
}
function geoStatus(msg) {
    document.getElementById("geo").style.display = "inline";
    document.getElementById("lblGeo").innerHTML = msg;
}
function geoSuccess(position) {
    if(typeof position.address !== "undefined")
        geoStatus("Tweet my <a href=\'https://maps.google.com/maps?q=loc:" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>" + " (" + position.address.country + position.address.region + "省" + position.address.city + "市,accuracy: " + position.coords.accuracy + "m)");
    else
        geoStatus("Tweet my <a href=\'https://maps.google.com/maps?q=loc:" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>" + " (accuracy: " + position.coords.accuracy + "m)");
    chkbox.value = position.coords.latitude + "," + position.coords.longitude;
}
//-->
</script>
';
        }
        $output .= '<div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><button id="submit" type="submit">Tweet</button><span id="remaining">140</span>';
        $output .= '</div></div></fieldset></form>';
        $output .= js_counter('status');
        if (setting_fetch('browser') == 'desktop') {
            $output .= '<script type="text/javascript">
    <!--
    document.getElementById("status").onkeydown=function(b){var a=null;a=window.event?window.event:b;a!=null&&a.ctrlKey&&a.keyCode==13&&document.getElementById("submit").click()};
    //-->
    </script>';
        }
        return $output;
    }
}
function user_ensure_authenticated()
{
    if (!user_is_authenticated()) {
        header("Location: " . BASE_URL . "login");
    }
}
function search_show()
{
    $args = func_get_args();
    $cate = $args[2];
    $time = get_post('time');
    $page = get_post('page');
    $key = trim(get_post('search'));
    $admin = get_post('admin');
    if ($key and $key != "all") {
        include_once 'login.inc.php';
        if (user_is_authenticated()) {
            search_history_add("", "", $cate);
        }
    }
    $data = get_search_result($key, 10, $cate, $time, $page);
    if (!$page and !$time and !$admin) {
        search_count("", "", $cate);
        echo ',';
        include_once 'follow.inc.php';
        if ($key and $key != "all") {
            following_exist("", "", $key);
        } else {
            echo '0';
        }
        echo ',';
    }
    $content = theme('result', $data, $key, $admin);
    theme('search', $key, $content);
}
Example #19
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;
}
Example #20
0
function theme_menu_both($menu)
{
    $links = array();
    foreach (menu_visible_items() as $url => $page) {
        $title = $url ? $url : 'home';
        $title = ucwords(str_replace("-", " ", $title));
        if ('yes' == setting_fetch('menu_icons')) {
            $display = $page['display'];
            $class = "menu";
        } else {
            $display = $title . " |";
            $class = "menu-text";
        }
        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'>$title</a> {$page['accesskey']}";
        // } else {
        // 	// $links[] = "<a href='$url'>$title</a>";
        // }
        $links[] = "<a href=\"{$url}\" title=\"{$title}\">{$display}</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='{$class}' id='menu'>" . implode('&ensp;', $links) . '</div>';
}
Example #21
0
<?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] = "";
Example #22
0
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>';
}
Example #23
0
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);
}
function theme_result($result, $keyword = '', $admin = false)
{
    include_once "login.inc.php";
    include_once "hot.inc.php";
    if (user_is_authenticated()) {
        include_once "like.inc.php";
        $allfav = get_likes(32767, "");
        include_once "apply_sent.inc.php";
        $allapp = get_sent_applies(32767, "");
    }
    $content = "";
    foreach ($result as $r) {
        if ($keyword) {
            $jg = parsekeyword($keyword, parselink(str_replace(array("<", ">"), array("&lt;", "&gt;"), $r['content'])));
        } else {
            $jg = parselink(str_replace(array("<", ">"), array("&lt;", "&gt;"), $r['content']));
        }
        $tags = get_tags($r['tweet_id']);
        if (strstr($r['source'], '<')) {
            $source = str_replace("<a ", '<a target="_blank" class="left microblog-item-position"', $r['source']);
        } else {
            $source = '<a class="left microblog-item-position" target="_blank">' . $r['source'] . '</a>';
        }
        $content .= '<div class="microblog-item" id="' . strtotime($r['post_datetime']) . '">
                    <div class="left microblog-item-pic">
                        <a target="_blank" href="' . BASE_URL . 'profile/' . $r['post_screenname'] . '"><img alt="" width="50" height="50" src="' . $r['profile_image_url'] . '"/></a>
                    </div>
                    <div class="left microblog-item-content">
                        <div class="microblog-item-blog">
                            <a class="microblog-item-blog-name" target="_blank" href="' . BASE_URL . 'profile/' . $r['post_screenname'] . '">' . $r['post_screenname'] . '</a>:' . $jg . '
        </div>';
        if ($r['thumbnail']) {
            $content .= '
                        <div><a onclick="ShowMiddlePic(\'' . str_replace("/thumbnail/", "/bmiddle/", $r['thumbnail']) . '\')"><img src="' . $r['thumbnail'] . '" /></a></div>';
        }
        $content .= '
                        <div class="microblog-item-other">
                            <a target="_blank" href="http://api.t.sina.com.cn/' . $r['user_site_id'] . '/statuses/' . $r['tweet_site_id'] . '" class="left microblog-item-time">' . time_tran($r['post_datetime']) . '</a> ' . $source;
        if ($admin) {
            $content .= '<a class="right item-control last delete" onclick="DeleteTweet(\'' . $r['tweet_id'] . '\', this)">删除</a>';
        } else {
            if (user_is_authenticated()) {
                $fav = 0;
                $app = 0;
                foreach ($allfav as $f) {
                    if ($f['tweet_id'] == $r['tweet_id']) {
                        $fav = 1;
                        break;
                    }
                }
                foreach ($allapp as $f) {
                    if ($f['tweet_id'] == $r['tweet_id']) {
                        $app = 1;
                        break;
                    }
                }
                if (!$fav) {
                    $content .= '<a class="right microblog-item-control like" onclick="JobLike(this,\'' . $r['tweet_id'] . '\')">收藏</a><a class="right microblog-item-control unlike"
                                            style="display: none;" onclick="JobUnLike(this,\'' . $r['tweet_id'] . '\')">取消收藏</a> ';
                } else {
                    $content .= '<a class="right microblog-item-control like" style="display: none;" onclick="JobLike(this,\'' . $r['tweet_id'] . '\')">收藏</a><a class="right microblog-item-control unlike"
                                             onclick="JobUnLike(this,\'' . $r['tweet_id'] . '\')">取消收藏</a> ';
                }
                $role = get_current_user_role();
                if ($role == 1) {
                    if ($r['type'] != 1 and !$app) {
                        $content .= '<a class="right microblog-item-control microblog-item-apply apply" onclick="JobApply(this,\'' . $r['tweet_id'] . '\',\'' . $r['post_screenname'] . '\')">
                                 申请该职位</a><a class="right microblog-item-control microblog-item-apply unapply" style="display: none;" onclick="JobUnApply(this,\'' . $r['tweet_id'] . '\')">
                                 取消申请</a>';
                    } elseif ($app) {
                        $content .= '<a class="right microblog-item-control microblog-item-apply apply" style="display: none;" onclick="JobApply(this,\'' . $r['tweet_id'] . '\',\'' . $r['post_screenname'] . '\')">
                                 申请该职位</a><a class="right microblog-item-control microblog-item-apply unapply" onclick="JobUnApply(this,\'' . $r['tweet_id'] . '\')">
                                 取消申请</a>';
                    }
                }
            }
            if ($tags) {
                $content .= '</div><div class="microblog-item-other1">
                                <span class="left microblog-item-relate">相关职位:</span> ';
                foreach ($tags as $t) {
                    $content .= '<a class="left keyword microblog-item-relate" onclick="SearchContent(false, \'' . $t . '\', 0, 0)">' . $t . '</a>';
                }
            }
        }
        $content .= '
                        </div>
                    </div>
                </div>';
    }
    return $content;
}
Example #25
0
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>';
}
Example #26
0
function twitter_is_reply($status)
{
    if (!user_is_authenticated()) {
        return false;
    }
    return stripos($status->text, "user/" . user_current_username());
}
Example #27
0
function theme_status_form($text = '', $in_reply_to_id = null)
{
    if (user_is_authenticated()) {
        $icon = "";
        //"images/twitter-bird-16x16.png";
        //	adding ?status=foo will automaticall add "foo" to the text area.
        if ($_GET['status']) {
            $text = $_GET['status'];
        }
        if ('yes' == setting_fetch('menu_icons')) {
            $camera = "📷";
        } else {
            $camera = "Add photo";
        }
        $output = '
        <form method="post" action="update" enctype="multipart/form-data">
            <fieldset>
                <legend><span class="icons" id="twitterbird">' . $icon . '</span> What\'s Happening?</legend>
                <textarea id="status" name="status" rows="4" class="statusbox">' . $text . '</textarea>
                <div>
                    <input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" />
                    <input type="submit" value="Tweet" />
                    <span id="remaining">140</span> 
                    <span id="geo" style="display: none;">
                        <input onclick="goGeo()" type="checkbox" id="geoloc" name="location" />
                        <label for="geoloc" id="lblGeo"></label>
                    </span>
                </div>
                <span class="icons" style="float:right;">' . $camera . '</span>
                <div class="fileinputs">
					<input type="file" accept="image/*,video/mp4" name="image" class="file" />
				</div>
            </fieldset>
            <script type="text/javascript">
                started = false;
                chkbox = document.getElementById("geoloc");
                if (navigator.geolocation) {
                    geoStatus("Tweet my location");
                    if ("' . $_COOKIE['geo'] . '"=="Y") {
                        chkbox.checked = true;
                        goGeo();
                    }
                }
                function goGeo(node) {
                    if (started) return;
                    started = true;
                    geoStatus("Locating...");
                    navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus , { enableHighAccuracy: true });
                }
                function geoStatus(msg) {
                    document.getElementById("geo").style.display = "inline";
                    document.getElementById("lblGeo").innerHTML = msg;
                }
                function geoSuccess(position) {
                    geoStatus("Tweet my <a href=\'http://maps.google.co.uk/m?q=" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>");
                    chkbox.value = position.coords.latitude + "," + position.coords.longitude;
                }
            </script>
        </form>';
        $output .= js_counter('status');
        return $output;
    }
}
Example #28
0
function theme_page($title, $content)
{
    $body .= theme('topmenu');
    $body .= $content;
    $body .= theme('menu_bottom');
    $body .= theme('footer');
    $body .= theme('google_analytics');
    if (DEBUG_MODE == 'ON') {
        global $dabr_start, $api_time, $services_time, $rate_limit;
        $time = microtime(1) - $dabr_start;
        $body .= '<p>Processed in ' . round($time, 4) . ' seconds (' . round(($time - $api_time - $services_time) / $time * 100) . '% Dabr, ' . round($api_time / $time * 100) . '% Twitter, ' . round($services_time / $time * 100) . '% other services)</p>';
    }
    if ($title == 'Login') {
        $title = 'twitUBe - mobile Twitter Login';
        $meta = '<meta name="description" content="alternative to mobile Twitter, bringing you the complete Twitter experience to your phone." />';
    }
    ob_start('ob_gzhandler');
    header('Content-Type: text/html; charset=utf-8');
    echo '<!DOCTYPE html>
				<html>
					<head>
					<link rel="shortcut icon" href="http://twit.basko.ro/favicon.ico" type="image/x-icon" /> 
						<meta charset="utf-8" />
						<meta name="viewport" content="width=device-width; initial-scale=1.0;" />
						<title>twitUBe - ' . $title . '</title>
						<base href="', BASE_URL, '" />
						' . $meta . theme('css') . '
					</head>
					<body id="thepage">';
    echo "<div id=\"advert\">" . show_advert() . "</div>";
    //theme('advert');
    echo $body;
    //[+] user online
    if (user_is_authenticated()) {
        require_once "count.php";
    }
    echo '</body>
	        </html>';
    exit;
    //[+] end
    if (setting_fetch('colours') == null) {
        //	If the cookies haven't been set, remind the user that they can set how Dabr looks
        echo '<p>Think twitUBe looks ugly? <a href="settings">Change the colours!</a></p>';
    }
    echo '		</body>
				</html>';
    exit;
}