示例#1
0
文件: mutes.php 项目: Hircine/embrr
<?php

include 'lib/twitese.php';
$title = "Mutes";
include 'inc/header.php';
if (!loginStatus()) {
    header('location: login.php');
}
$type = 'mutes';
include 'inc/userlist.php';
include 'inc/sidebar.php';
include 'inc/footer.php';
}
// Test errors
if (isset($_GET['OK'])) {
    stop(0, "This is an OK message.");
}
if (isset($_GET['D'])) {
    stop(1, "This is a debug message.");
}
if (isset($_GET['W'])) {
    stop(2, "This is a warning!");
}
if (isset($_GET['E'])) {
    stop('E-1', "This is an error!");
}
// Get current login status
$status = loginStatus();
$isLoggedIn = $status['login'] == "true";
$isAdmin = $status['isAdmin'] == "true";
$username = $status['username'];
// # Small functions
// Check if a string starts with a specific value
function str_starts_with($haystack, $needle)
{
    $length = strlen($needle);
    return substr($haystack, 0, $length) === $needle;
}
// Check if a string ends with a specific value
function str_ends_with($haystack, $needle)
{
    $length = strlen($needle);
    return $length == 0 || substr($haystack, -$length) === $needle;
示例#3
0
文件: twitese.php 项目: Hircine/embrr
function getTwitter()
{
    if (loginStatus()) {
        $access_token = $_SESSION['access_token'] ? $_SESSION['access_token'] : null;
        $oauth_token = $access_token ? $access_token['oauth_token'] : $_COOKIE['oauth_token'];
        $oauth_token_secret = $access_token ? $access_token['oauth_token_secret'] : $_COOKIE['oauth_token_secret'];
        $oauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
        return $oauth;
    }
    return null;
}
示例#4
0
文件: user.php 项目: Hircine/embrr
<?php

include 'lib/twitese.php';
$title = "{$_GET['id']}";
include 'inc/header.php';
include 'lib/timeline_format.php';
?>

<script src="js/user.js"></script>

<div id="statuses" class="column round-left">
<?php 
if (!loginStatus() || !isset($_GET['id'])) {
    header('location: error.php?code=' . $t->http_code);
    exit;
}
$t = getTwitter();
$userid = $_GET['id'];
$since_id = isset($_GET['since_id']) ? $_GET['since_id'] : false;
$max_id = isset($_GET['max_id']) ? $_GET['max_id'] : false;
if (isset($_GET['fav'])) {
    $statuses = $t->getFavorites($userid, $since_id, $max_id);
} else {
    $statuses = $t->userTimeline($userid, $since_id, $max_id);
}
if ($statuses === false) {
    header('location: error.php?code=' . $t->http_code);
    exit;
}
if ($t->http_code == 429) {
    $apiout = true;