コード例 #1
0
<?php

session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once 'classes.php';
$money_class = new MoneyStuff();
$user_class = new Users();
$campaign_id = $_GET['id'];
$campaign_friendly = $_GET['name'];
if ($campaign_id == '') {
    $campaign_friendly_name = $money_class->GetCampaignIdFromFriendly($campaign_friendly);
    $campaign_id = $campaign_friendly_name['id'];
}
$access_token = $_SESSION['access_token'];
$user_profile = $_SESSION['user_profile'];
//var_dump($to_user_id);
//Check if from user is logged id
$user_logon_data = $_SESSION['user_profile'];
$content = $_SESSION['content'];
$user_prof = get_object_vars($content);
// Get data from campaign
$campaign_data = $money_class->GetCampaignData($campaign_id);
// Extract user owner of campaign
$profile_id = $user_class->GetTwitterIdFromUserId($campaign_data['user_id']);
$access_token = $_SESSION['access_token'];
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
if ($user_data == false) {
    $user_data = $user_class->GetUSerFullProfileFromTwitter($profile_id);
    $user_data['profile_image_url_https'] = $user_data['profile_img'];
    $user_data['friends_count'] = $user_data['following_count'];
コード例 #2
0
<?php

session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once 'classes.php';
require_once 'url_slug.php';
$money_class = new MoneyStuff();
$user_class = new Users();
$various_class = new FunctionsAndVarious();
//var_dump($_POST);
$foto = $_FILES['campaign_imagen'];
$image_name = $various_class->UploadImage($foto);
if ($image_name != '') {
    $img_to_insert = UPLOAD_PATH . '/' . $image_name;
} else {
    $img_to_insert = '';
}
$name = $_POST['campaign_name'];
$friendly_url = url_slug($name);
$desc = $_POST['campaign_desc'];
$needed_money = $_POST['campaign_money_needed'];
$max_money = $_POST['campaign_money_max'];
$currency = $_SESSION['user_profile']['currency'];
$video_url = $_POST['campaign_utube_url'];
$campaign_type = $_POST['campaign_type'];
$user_id = $_SESSION['user_profile']['id'];
$save_campaign = $money_class->SaveNewCampaign($user_id, $name, $desc, $needed_money, $max_money, $currency, $img_to_insert, $video_url, $campaign_type, $friendly_url);
if ($save_campaign == true) {
    //print($save_campaign);
    printf("<script>document.location.href='campaign.php?id=" . $save_campaign . "'</script>;");
コード例 #3
0
ファイル: paypal.php プロジェクト: centaurustech/tuitflow-dev
<?php

session_start();
require_once 'config.php';
require_once 'classes.php';
require_once 'paypal.class.php';
// include the class file
$m = new MoneyStuff();
$p = new paypal_class();
// initiate an instance of the class
$p->paypal_url = $url_pay;
// testing paypal url
//$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';     // paypal url
// setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php')
$this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// if there is not action variable, set the default action of 'process'
if (empty($_GET['action'])) {
    $_GET['action'] = 'process';
}
switch ($_GET['action']) {
    case 'process':
        // Process and order...
        //Generate hash
        $hash = md5($_SESSION['user_profile']['id'] . time() . "EsEHPayPaLdame1leuro");
        $secure = md5($hash . PAYPAL_SECRET_HASH);
        $amount_b = $_GET['amount_c'];
        $amount = round($_GET['amount_c'] * PAYPAL_FARE_PER, 2) + PAYPAL_FARE_FIX;
        $currency = $_GET['currency'];
        $to_user_id = $_GET['to_user_id'];
        $insert_paypal = mysql_query("INSERT INTO  `paypal_payments` (`id` ,`hash` ,`amount` ,`user_id` ,`status` ,`date`,`currency`)VALUES (\nNULL ,  '" . $hash . "',  '" . $amount_b . "',  '" . $_SESSION['user_profile']['id'] . "',  '0', CURRENT_TIMESTAMP,'" . $currency . "');");
        $p->add_field('business', $account_pay);
コード例 #4
0
<?php

session_start();
require_once 'config.php';
require_once 'classes.php';
$m = new MoneyStuff();
$promo_code = $_GET['promo_code'];
//Validate promo code and user session
$validate = $m->ValidateVoucher($promo_code);
if ($validate == false) {
    printf("<script>document.location.href='index.php?error=ERR_CODE_NOT_VALID'</script>;");
    die("ERR_CODE_NOT_VALID");
}
$user_logon_data = $_SESSION['user_profile'];
if ($user_logon_data['id'] == '') {
    printf("<script>document.location.href='index.php?error=ERR_NO_SESSION'</script>;");
    die("ERR_NO_SESSION");
}
if ($user_logon_data['currency'] != $validate['currency']) {
    $amount = round($validate['amount'] * $m->CurrencyExchange($user_logon_data['currency'], $validate['currency']), 2);
} else {
    $amount = $validate['amount'];
}
$m->SumMoney($user_logon_data['id'], $amount);
$m->InsertPaymentVoucher($user_logon_data['id'], $validate['currency'], $validate['amount']);
$m->RedeemCode($promo_code);
printf("<script>document.location.href='index.php?message=VOUCHER_OK'</script>;");
コード例 #5
0
<?php

session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once 'classes.php';
require_once 'payment.class.php';
/* If access tokens are not available redirect to connect page. */
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
    header('Location: ./clearsessions.php');
}
/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];
$money_class = new MoneyStuff();
$user_class = new Users();
$user_logon_data = $_SESSION['user_profile'];
$content = $_SESSION['content'];
$user_prof = get_object_vars($content);
$user_profile = $_SESSION['user_profile'];
if ($user_profile == '') {
    die('no session cowboy');
}
//Get user account balance
$currency = $user_profile['currency'];
$balance = $user_class->GetBalance($_SESSION['user_profile']['id']);
if ($currency == 'USD') {
    $conversion = $money_class->CurrencyExchange("USD", "EUR");
    $limit = round(PAYPAL_MIN_GET * $conversion, 2);
} else {
    $limit = PAYPAL_MIN_GET;
}
コード例 #6
0
<?php

//var_dump($_POST);die();
session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once 'classes.php';
$money_class = new MoneyStuff();
$user_class = new Users();
$user_logon_data = $_SESSION['user_profile'];
$campaign_id = $_GET['id'];
$amount = $_POST['amount'];
$content = $_SESSION['content'];
$user_prof = get_object_vars($content);
//Check if user is logged
if ($user_logon_data == '') {
    $return_url = urlencode($_SERVER['SCRIPT_NAME'] . '?id=' . $campaign_id . '');
    print "<script>document.location.href='connect.php?message=INIT_SESSION&return=" . $return_url . "'</script>;";
    die;
}
//Get to user id
$campaign_owner = $money_class->GetCampaignOwner($campaign_id);
//Check if user has balance
$account_balance = $user_class->GetBalance($user_logon_data['id']);
if ($account_balance >= $amount && $amount != '') {
    $from_user_currency = $user_logon_data['currency'];
    $to_user_currency = $user_class->GetUSerCurrency($campaign_owner['user_id']);
    //Substract money to user
    $substract = $money_class->SubtractMoney($user_logon_data['id'], $amount);
    if ($from_user_currency == $to_user_currency) {
        $amount = $amount;
コード例 #7
0
ファイル: index.php プロジェクト: centaurustech/tuitflow-dev
<?php

/*
 * tuitflow 2013 
 * 
 */
/* Load required lib files. */
session_start();
error_reporting(E_ALL);
//TODO DEV ONLY
require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once 'classes.php';
$user_class = new Users();
$money_class = new MoneyStuff();
/* If access tokens are not available redirect to connect page. */
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
    header('Location: ./clearsessions.php');
}
/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];
/* Create a TwitterOauth object with consumer/user tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
//if already have $content, dont query it
if ($_SESSION['content'] == '') {
    /* If method is set change API call made. Test is called by default. */
    $content = $connection->get('account/verify_credentials');
    $_SESSION['content'] = $content;
} else {
    $content = $_SESSION['content'];
}
コード例 #8
0
<?php

//var_dump($_POST);die();
include 'rosetta.php';
//session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once 'classes.php';
$money_class = new MoneyStuff();
$user_class = new Users();
$user_logon_data = $_SESSION['user_profile'];
$to_user_id = intval($_GET['to_user_id']);
// This user will be recieve the money
$user_data = $_SESSION['user'][$to_user_id];
$amount = $_POST['amount'];
$content = $_SESSION['content'];
$user_prof = get_object_vars($content);
/*
var_dump($_POST);
var_dump($user_logon_data);
var_dump($to_user_id);
var_dump($user_data);
*/
$user_exists = $user_class->check_user_exists($user_data['screen_name'], $user_data['id']);
//var_dump($user_exists);die();
// Check if logged user has sufficient money
$account_balance = $user_class->GetBalance($user_logon_data['id']);
//If transaction anonymous?
if ($_POST['anon']) {
    $anonymous = '1';
} else {
コード例 #9
0
ファイル: redeem.php プロジェクト: centaurustech/tuitflow-dev
<?php

session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once 'classes.php';
$money_class = new MoneyStuff();
$user_class = new Users();
$user_logon_data = $_SESSION['user_profile'];
$content = $_SESSION['content'];
$user_prof = get_object_vars($content);
$user_profile = $_SESSION['user_profile'];
//Retrieve data from transaction hash
$hash = $_GET['id'];
$transaction = $money_class->RetrieveTransaction($hash);
//var_dump($transaction);die();
/* If access tokens are not available redirect to connect page. */
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
    //User not logged
    //but, is user in app?
    $to_user_screen_name = $user_class->GetUSerScreenNameFromTwitterId($transaction['to_twitter_user_id']);
    $user_exists = $user_class->check_user_exists($to_user_screen_name, $transaction['to_twitter_user_id']);
    printf("<script>document.location.href='connect.php?message=INIT_SESSION'</script>;");
    die;
    //Show this content in main index. User need log on.
    /*
    	if($transaction['anonymous']=='1'){
    		$from_profile="Anonymous";
    		print("<a>Anonymous User</a> <br>");
    		print("<img src='".anonymous_profile_img."' />"."<br>");
    		$currency=$user_class->GetUSerCurrency($transaction['from_user_id']);
コード例 #10
0
ファイル: tf_bot.php プロジェクト: centaurustech/tuitflow-dev
<?php

/*
 * Tuitflow Bot - :D - i do this things:
 * 
 * - check if campaign raised max money level 
 * - Disable expired campaign
 */
print "\n\n*************************\nHi! I'm botflow!\n\nExecuting at: " . date("Y-m-d H:i:s") . "\n*************************\n\n";
$environment = 'test';
// REMOVE IT FOR PRODUCTION
require_once '../twitteroauth/twitteroauth.php';
require_once '../config.php';
require_once '../classes.php';
$money_class = new MoneyStuff();
$user_class = new Users();
// First check if campaigns raised max money level
print "\nChecking if active campaigns raises max money level:\n";
$find_active_campaigns = mysql_query("SELECT id,max_money,campaign_type FROM campaigns WHERE enabled='1' AND max_money != '0';");
while ($campaign = mysql_fetch_array($find_active_campaigns)) {
    $campaign_id = $campaign['id'];
    $campaign_max_money = $campaign['max_money'];
    $campaign_type = $campaign['campaign_type'];
    switch ($campaign_type) {
        case 'oneweek':
            $fare = 0.01;
            break;
        case 'twoweeks':
            $fare = 0.05;
            break;
    }
コード例 #11
0
<?php

session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'config.php';
require_once 'classes.php';
/* If access tokens are not available redirect to connect page. */
if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) {
    header('Location: ./clearsessions.php');
}
/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];
$money_class = new MoneyStuff();
$user_class = new Users();
$user_logon_data = $_SESSION['user_profile'];
$content = $_SESSION['content'];
$user_prof = get_object_vars($content);
$user_profile = $_SESSION['user_profile'];
if ($user_profile == '') {
    die('no session cowboy');
}
//Get user account balance
$currency = $user_profile['currency'];
$balance = $user_class->GetBalance($_SESSION['user_profile']['id']);
if ($currency == 'USD') {
    $conversion = $money_class->CurrencyExchange("USD", "EUR");
    $limit = round(PAYPAL_MIN_GET * $conversion, 2);
} else {
    $limit = PAYPAL_MIN_GET;
}
$amount = $_POST['amount_to'];
コード例 #12
0
<?php

/*
 * Tuitflow Bot - :D - i do this things:
 * 
 * - Notify users about its campaigns
 */
print "\n\n*************************\nHi! I'm botflow!\n\nExecuting at: " . date("Y-m-d H:i:s") . "\n*************************\n\n";
$environment = 'test';
// REMOVE IT FOR PRODUCTION
require_once '../twitteroauth/twitteroauth.php';
require_once '../config.php';
require_once '../classes.php';
$money_class = new MoneyStuff();
$user_class = new Users();
// First check active campaigns
print "\nChecking active campaigns...\n";
$find_active_campaigns = mysql_query("SELECT id,needed_money,user_id FROM campaigns WHERE enabled='1';");
while ($campaign = mysql_fetch_array($find_active_campaigns)) {
    $campaign_id = $campaign['id'];
    $campaign_user_id = $campaign['user_id'];
    $campaign_needed_money = $campaign['needed_money'];
    $campaign_twitter_user_id = $user_class->GetTwitterIdFromUserId($campaign_user_id);
    $campaign_twitter_screen_name = $user_class->GetUSerScreenName($campaign_user_id);
    $campaign_amount = $money_class->GetCampaignAmountReceived($campaign_id);
    $campaign_user_currency = $user_class->GetUSerCurrency($campaign_user_id);
    $campaign_fund_raised_a = $campaign_amount['sum(amount)'];
    if ($campaign_fund_raised_a == '') {
        $campaign_fund_raised_a = 0;
    }
    //be careful, notifier:
コード例 #13
0
<?php

session_start();
include 'config.php';
include 'classes.php';
$user_class = new Users();
$money_class = new MoneyStuff();
$task = $_GET['task'];
switch ($task) {
    case 'CHANGE_LANG':
        $user_logon_data = $_SESSION['user_profile'];
        if ($user_logon_data != '') {
            $lang = $_GET['lang'];
            $lang = strtolower($lang);
            $process_change = $user_class->ChangeLang($lang, $user_logon_data['id']);
            print "Languaje changed!";
        }
        break;
    case 'CHANGE_CURR':
        $curr = $_GET['curr'];
        $user_logon_data = $_SESSION['user_profile'];
        if ($user_logon_data != '') {
            if ($curr != $user_logon_data['currency']) {
                $process_change = $user_class->ChangeCurr($curr, $user_logon_data['id']);
                $change_balance = $money_class->UpdateBalanceChangeCurr($user_logon_data['id'], $curr, $user_logon_data['currency']);
                //var_dump($change_balance);die();
                $record = $user_class->Record_user_log($user_logon_data['id'], "User changed currency from " . $user_logon_data['currency'] . " to " . $curr);
                print "Currency changed!";
            }
        }
        break;