Esempio n. 1
0
<?php

require 'Autolink.php';
require 'Extractor.php';
menu_register(array('' => array('callback' => 'twitter_home_page', 'accesskey' => '0'), 'status' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_status_page'), 'update' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_update'), 'twitter-retweet' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_retweet'), 'replies' => array('security' => true, 'callback' => 'twitter_replies_page', 'accesskey' => '1'), 'favourite' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_mark_favourite_page'), 'unfavourite' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_mark_favourite_page'), 'directs' => array('security' => true, 'callback' => 'twitter_directs_page', 'accesskey' => '2'), 'search' => array('security' => true, 'callback' => 'twitter_search_page', 'accesskey' => '3'), 'user' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_user_page'), 'follow' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_follow_page'), 'unfollow' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_follow_page'), 'confirm' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_confirmation_page'), 'block' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_block_page'), 'unblock' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_block_page'), 'spam' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_spam_page'), 'favourites' => array('security' => true, 'callback' => 'twitter_favourites_page'), 'followers' => array('security' => true, 'callback' => 'twitter_followers_page'), 'friends' => array('security' => true, 'security' => true, 'callback' => 'twitter_friends_page'), 'delete' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_delete_page'), 'retweet' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_retweet_page'), 'hash' => array('security' => true, 'hidden' => true, 'callback' => 'twitter_hashtag_page'), 'twitpic' => array('security' => true, 'callback' => 'twitter_twitpic_page'), 'trends' => array('security' => true, 'callback' => 'twitter_trends_page'), 'retweets' => array('security' => true, 'callback' => 'twitter_retweets_page')));
function long_url($shortURL)
{
    if (!defined('LONGURL_KEY')) {
        return $shortURL;
    }
    $url = "http://www.longurlplease.com/api/v1.1?q=" . $shortURL;
    $curl_handle = curl_init();
    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl_handle, CURLOPT_URL, $url);
    $url_json = curl_exec($curl_handle);
    curl_close($curl_handle);
    $url_array = json_decode($url_json, true);
    $url_long = $url_array["{$shortURL}"];
    if ($url_long == null) {
        return $shortURL;
    }
    return $url_long;
}
function friendship_exists($user_a)
{
    $request = API_URL . 'friendships/show.json?target_screen_name=' . $user_a;
    $following = twitter_process($request);
    if ($following->relationship->target->following == 1) {
        return true;
    } else {
        return false;
Esempio n. 2
0
<?php

/*
Syntax is 
'Name|links,bodybg,bodyt,small,odd,even,replyodd,replyeven,menubg,menut,menua',

Assembled in theme_css()
*/
$GLOBALS['colour_schemes'] = array(0 => 'Pretty In Pink|c06,fcd,623,c8a,fee,fde,ffa,dd9,c06,fee,fee', 1 => 'Ugly Orange|b50,ddd,111,555,fff,eee,ffa,dd9,e81,c40,fff', 2 => 'Touch Blue|138,ddd,111,555,fff,eee,ffa,dd9,138,fff,fff', 3 => 'Sickly Green|293C03,ccc,000,555,fff,eee,CCE691,ACC671,495C23,919C35,fff', 4 => 'Kris\' Purple|d5d,000,ddd,999,222,111,202,101,909,222,000,000', 5 => '#red|d12,ddd,111,555,fff,eee,ffa,dd9,c12,fff,fff');
menu_register(array('settings' => array('callback' => 'settings_page'), 'reset' => array('hidden' => true, 'callback' => 'cookie_monster')));
function cookie_monster()
{
    $cookies = array('browser', 'settings', 'utc_offset', 'search_favourite', 'perPage', 'USER_AUTH');
    $duration = time() - 3600;
    foreach ($cookies as $cookie) {
        setcookie($cookie, null, $duration, '/');
        setcookie($cookie, null, $duration);
    }
    return theme('page', 'Cookie Monster', '<p>The cookie monster has logged you out and cleared all settings. Try logging in again now.</p>');
}
function setting_fetch($setting, $default = null)
{
    $settings = (array) unserialize(base64_decode($_COOKIE['settings']));
    if (array_key_exists($setting, $settings)) {
        return $settings[$setting];
    } else {
        return $default;
    }
}
function setcookie_year($name, $value)
{
Esempio n. 3
0
$dabr_start = microtime(1);
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . date('r'));
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Content-Type: text/html; charset=utf-8');
require 'config.php';
require 'common/menu.php';
require 'common/user.php';
require 'common/theme.php';
require 'common/twitter.php';
require 'common/settings.php';
require 'common/codebird.php';
require 'common/css.php';
//	Initial menu items to show even when not logged in.
menu_register(array('about' => array('callback' => 'about_page', 'display' => '🛈'), 'logout' => array('security' => true, 'callback' => 'logout_page', 'display' => ''), 'oauth' => array('callback' => 'user_oauth', 'hidden' => 'true'), 'widgets' => array('callback' => 'css', 'hidden' => 'true')));
function logout_page()
{
    user_logout();
    header("Location: " . BASE_URL);
    /* Redirect browser */
    exit;
}
function about_page()
{
    theme('page', 'About', theme('about'));
}
session_start();
menu_execute_active_handler();
Esempio n. 4
0
<?php

menu_register(array('lists' => array('security' => true, 'callback' => 'lists_controller')));
function lists_paginated_process($url)
{
    // Adds cursor/pagination parameters to a query
    $cursor = $_GET['cursor'];
    if (!is_numeric($cursor)) {
        $cursor = -1;
    }
    $url .= '&cursor=' . $cursor;
    return twitter_process($url);
}
function twitter_lists_tweets($user, $list)
{
    // Tweets belonging to a list
    $url = API_NEW . "lists/statuses.json?owner_screen_name={$user}&slug={$list}";
    if ($_GET['max_id']) {
        $url .= '&max_id=' . $_GET['max_id'];
    }
    return twitter_process($url);
}
function twitter_lists_user_lists($user)
{
    // Lists a user has created
    return twitter_process(API_NEW . "lists/list.json?screen_name={$user}");
}
function twitter_lists_user_memberships($user)
{
    // Lists a user belongs to
    return lists_paginated_process(API_NEW . "lists/memberships.json?screen_name={$user}");
Esempio n. 5
0
        - Go to your dabr installed directory
        - Place instagram.php into 'common/' folder
        - Open your index.php with text editor, and
        - Insert this line, below the "require 'common/settings.php';" :
 
          require 'common/instagram.php';
 
        - Login and browse your dabr installation and see new 'Instagram' button on menu navigation
 
        please enjoy, and take your own risk!
*/
/*
        here we re-register the menu callback handler
        and insert new `instagram` button on logged user menu navigation
*/
menu_register(array('instagram' => array('callback' => 'instagram_page', 'security' => true)));
function instagram_page($query)
{
    $cmd = isset($_REQUEST["cmd"]) ? $_REQUEST["cmd"] : null;
    if ($cmd == "register") {
        instagram_register();
    } else {
        instagram_upload();
    }
}
function instagram_upload()
{
    $content = "<p style='padding:5px'>";
    $content .= "Instagram is a popular photograph apps on iPhone / iPad users<br/>";
    $content .= "Now, without any iOS device you can register an Instagram account or even upload photos to Instagram and share to your timeline :)";
    $content .= "<br/>";
Esempio n. 6
0
File: user.php Progetto: xctcc/npt
<?php

menu_register(array('oauth' => array('callback' => 'user_oauth', 'hidden' => 'true'), 'itap' => array('callback' => 'user_itap', 'hidden' => 'true')));
function user_oauth()
{
    require_once 'OAuth.php';
    session_start();
    $GLOBALS['user']['type'] = 'oauth';
    if ($oauth_token = $_GET['oauth_token']) {
        $params = array('oauth_verifier' => $_GET['oauth_verifier']);
        $response = twitter_process('https://api.twitter.com/oauth/access_token', $params);
        unset($_SESSION['oauth_request_token_secret']);
        parse_str($response, $token);
        // 判断 user 是否在列表中
        if (INVITE && !_is_user_invited($token['screen_name'])) {
            unset($GLOBALS['user']);
            exit('对不起,您不是受邀用户,无法登录(如果你有邀请码,<a href="' . BASE_URL . 'invite.php">请自行添加</a>)');
        }
        $GLOBALS['user']['username'] = $token['screen_name'];
        $GLOBALS['user']['password'] = $token['oauth_token'] . '|' . $token['oauth_token_secret'];
        _user_save_cookie();
        header('Location: ' . BASE_URL);
        return;
    }
    $params = array('oauth_callback' => BASE_URL . 'oauth');
    $response = twitter_process('https://api.twitter.com/oauth/request_token', $params);
    parse_str($response, $token);
    $_SESSION['oauth_request_token_secret'] = $token['oauth_token_secret'];
    $authorise_url = 'https://api.twitter.com/oauth/authorize?oauth_token=' . $token['oauth_token'];
    header('Location: ' . $authorise_url);
}
Esempio n. 7
0
<?php

$dabr_start = microtime(1);
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . date('r'));
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
require 'config.php';
require 'common/browser.php';
require 'common/menu.php';
require 'common/user.php';
require 'common/theme.php';
require 'common/twitter.php';
require 'common/lists.php';
require 'common/settings.php';
menu_register(array('about' => array('callback' => 'about_page'), 'logout' => array('security' => true, 'callback' => 'logout_page')));
function logout_page()
{
    user_logout();
    $content = theme('logged_out');
    theme('page', 'Logged out', $content);
}
function about_page()
{
    $content = file_get_contents('about.html');
    theme('page', 'About', $content);
}
browser_detect();
menu_execute_active_handler();
Esempio n. 8
0
<?php

require 'Autolink.php';
require 'Extractor.php';
require 'lists.php';
menu_register(array('' => array('callback' => 'twitter_home_page', 'display' => '🏠'), 'status' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_status_page'), 'update' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_update'), 'twitter-retweet' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_retweet'), 'replies' => array('security' => true, 'callback' => 'twitter_replies_page', 'display' => '@'), 'favourite' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_mark_favourite_page'), 'unfavourite' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_mark_favourite_page'), 'messages' => array('security' => true, 'callback' => 'twitter_directs_page', 'display' => '✉'), 'search' => array('security' => true, 'callback' => 'twitter_search_page', 'display' => '🔍'), 'user' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_user_page'), 'follow' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_follow_page'), 'unfollow' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_follow_page'), 'confirm' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_confirmation_page'), 'confirmed' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_confirmed_page'), 'block' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_block_page'), 'unblock' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_block_page'), 'spam' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_spam_page'), 'favourites' => array('security' => true, 'callback' => 'twitter_favourites_page', 'display' => '★'), 'followers' => array('security' => true, 'callback' => 'twitter_followers_page', 'display' => '☻'), 'friends' => array('security' => true, 'callback' => 'twitter_friends_page', 'display' => '😉'), 'delete' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_delete_page'), 'deleteDM' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_deleteDM_page'), 'retweet' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_retweet_page'), 'hash' => array('security' => true, 'hidden' => true, 'callback' => 'twitter_hashtag_page'), 'trends' => array('security' => true, 'callback' => 'twitter_trends_page', 'display' => '↗'), 'retweets' => array('security' => true, 'callback' => 'twitter_retweets_page', 'display' => '♻'), 'lists' => array('security' => true, 'callback' => 'lists_controller', 'display' => '≡'), 'retweeted_by' => array('security' => true, 'hidden' => true, 'callback' => 'twitter_retweeters_page'), 'account' => array('security' => true, 'callback' => 'twitter_profile_page', 'display' => '☺'), 'showretweets' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_retweets'), 'hideretweets' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_retweets'), 'blocked' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_blocks')));
// How should external links be opened?
function get_target()
{
    // Kindle doesn't support opening in a new window
    if (stristr($_SERVER['HTTP_USER_AGENT'], "Kindle/")) {
        return "_self";
    } else {
        return "_blank";
    }
}
//	Edit User Profile
function twitter_profile_page()
{
    // process form data
    if ($_POST['name']) {
        // post profile update
        $api_options = array("name" => stripslashes($_POST['name']), "url" => stripslashes($_POST['url']), "location" => stripslashes($_POST['location']), "description" => stripslashes($_POST['description']));
        $cb = get_codebird();
        @twitter_api_status($cb->account_updateProfile($api_options));
        $content = "<h2>Profile Updated</h2>";
    }
    //	http://api.twitter.com/1/account/update_profile_image.format
    if ($_FILES['image']['tmp_name']) {
        // these files to upload. You can also just upload 1 image!
        $api_options = array("image" => $_FILES['image']['tmp_name']);
Esempio n. 9
0
<?php

menu_register(array('oauth' => array('callback' => 'user_oauth', 'hidden' => 'true'), 'login' => array('callback' => 'user_login', 'hidden' => 'true')));
function user_oauth()
{
    require_once 'OAuth.php';
    // Session used to keep track of secret token during authorisation step
    session_start();
    // Flag forces twitter_process() to use OAuth signing
    $GLOBALS['user']['type'] = 'oauth';
    if ($oauth_token = $_GET['oauth_token']) {
        // Generate ACCESS token request
        $params = array('oauth_verifier' => $_GET['oauth_verifier']);
        $response = twitter_process('https://api.twitter.com/oauth/access_token', $params);
        parse_str($response, $token);
        // Store ACCESS tokens in COOKIE
        $GLOBALS['user']['password'] = $token['oauth_token'] . '|' . $token['oauth_token_secret'];
        // Fetch the user's screen name with a quick API call
        unset($_SESSION['oauth_request_token_secret']);
        $user = twitter_process(API_URL . 'account/verify_credentials.json');
        $GLOBALS['user']['username'] = $user->screen_name;
        _user_save_cookie(1);
        header('Location: ' . BASE_URL);
        exit;
    } else {
        // Generate AUTH token request
        $params = array('oauth_callback' => BASE_URL . 'oauth');
        $response = twitter_process('https://api.twitter.com/oauth/request_token', $params);
        parse_str($response, $token);
        // Save secret token to session to validate the result that comes back from Twitter
        $_SESSION['oauth_request_token_secret'] = $token['oauth_token_secret'];
Esempio n. 10
0
<?php

date_default_timezone_set("Asia/Shanghai");
require 'class.autolink.php';
require 'class.extractor.php';
require 'lists.php';
require 'class.embedly.php';
menu_register(array('' => array('callback' => 'twitter_home_page', 'accesskey' => '0'), 'status' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_status_page'), 'update' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_update'), 'replies' => array('security' => true, 'callback' => 'twitter_replies_page', 'accesskey' => '1', 'title' => __("Replies")), 'twitter-retweet' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_retweet'), 'favourite' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_mark_favourite_page'), 'unfavourite' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_mark_favourite_page'), 'directs' => array('security' => true, 'callback' => 'twitter_directs_page', 'accesskey' => '3', 'title' => __("Directs")), 'search' => array('security' => true, 'callback' => 'twitter_search_page', 'accesskey' => '4', 'title' => __("Search")), 'user' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_user_page'), 'follow' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_follow_page'), 'unfollow' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_follow_page'), 'confirm' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_confirmation_page'), 'block' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_block_page'), 'unblock' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_block_page'), 'favourites' => array('security' => true, 'callback' => 'twitter_favourites_page', 'title' => __("Favourites")), 'followers' => array('security' => true, 'callback' => 'twitter_followers_page', 'title' => __("Followers")), 'friends' => array('security' => true, 'callback' => 'twitter_friends_page', 'title' => __("Friends")), 'blockings' => array('security' => true, 'security' => true, 'callback' => 'twitter_blockings_page', 'title' => __("Blockings")), 'delete' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_delete_page'), 'retweet' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_retweet_page'), 'hash' => array('security' => true, 'hidden' => true, 'callback' => 'twitter_hashtag_page'), 'upload' => array('security' => true, 'callback' => 'twitter_upload_page', 'title' => __("Upload Picture")), 'profile' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_profile_page'), 'lists' => array('security' => true, 'callback' => 'lists_controller', 'title' => __("Lists")), 'spam' => array('hidden' => true, 'security' => true, 'callback' => 'twitter_spam_page')));
$blackberry_pagination = NULL;
function friendship_exists($user_a)
{
    $following = friendship($user_a);
    if ($following->relationship->target->following == 1) {
        return true;
    } else {
        return false;
    }
}
function friendship($user_a, $user_id = 0)
{
    if ($user_a != NULL) {
        $request = API_ROOT . 'friendships/show.json?target_screen_name=' . $user_a;
    } else {
        $request = API_ROOT . 'friendships/show.json?target_id=' . $user_id;
    }
    return twitter_process($request);
}
function twitter_block_exists($query, $user_a = NULL)
{
    if ($query > 0) {
        $following = friendship(NULL, $query);
Esempio n. 11
0
File: index.php Progetto: xctcc/npt
if (!file_exists('config.php')) {
    $root .= ($directory = trim(dirname($_SERVER["SCRIPT_NAME"]), "/\\,")) ? "/{$directory}/" : "/";
    header('Location: ' . $root . 'setup.php');
    exit;
}
require 'config.php';
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . date('r'));
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Content-type: text/html; charset=utf-8');
require 'languages/languages.php';
require 'common/theme.php';
require 'common/browser.php';
require 'common/menu.php';
if (!function_exists('mcrypt_module_open')) {
    require 'common/class.xxtea.php';
}
require 'common/user.php';
require 'common/twitter.php';
require 'common/settings.php';
menu_register(array('logout' => array('security' => true, 'callback' => 'logout_page', 'title' => __("Logout"))));
function logout_page()
{
    user_logout();
    header("Location: " . BASE_URL);
    exit;
}
browser_detect();
menu_execute_active_handler();