$userSettings = new goUserSettings(); $userSettings->setOutputFlag('xml'); header("Content-Type: text/xml"); $userSettings->setStatusMessage("Not authorized"); $userSettings->setStatusCode("403"); echo $userSettings; ob_flush(); exit; } } //if $params = array(); $params['operation'] = $operation; if (!empty($userID)) { $params['userid'] = $userID; } else { if (!empty($userName)) { $params['username'] = $userName; } } $userSettings = new goUserSettings($params); if (isset($userSettings)) { $userSettings->setOutputFlag('xml'); header("Content-Type: text/xml"); echo $userSettings; } ob_end_flush(); exit; ?>
//If there is a problem throw an exception } header("Location:" . $loginurl); exit; } $oauth_token = $_GET['oauth_token']; if (!empty($oauth_token)) { session_start(); $foursquareObj = new EpiFoursquare($consumer_key, $consumer_secret); $foursquareObj->setToken($_REQUEST['oauth_token'], $_SESSION['secret']); $token = $foursquareObj->getAccessToken(); $foursquareObj->setToken($token->oauth_token, $token->oauth_token_secret); try { //Making a call to the API $foursquareTest = $foursquareObj->get_user(); $userSettings = new goUserSettings(); $responseUserArray = $foursquareTest->response['user']; $fquserID = $responseUserArray['id']; $fqphoto = $responseUserArray['photo']; $userSettings->updateFoursquareOAuth(1, $fquserID, $fqphoto, $token->oauth_token, $token->oauth_token_secret); print_r($foursquareTest->response); echo 'working with array'; $a = $foursquareTest->response['user']; echo "user id " . $a['id']; } catch (Exception $e) { echo "Error: " . $e; } header("Location:http://jittr.com/jittr/gameon"); } /* echo "<a href='" . $loginurl . "'>Login Via Foursquare</a>"; //Display the Foursquare login link
setcookie("username", "", time() - 3600); setcookie("userid", "", time() - 3600); header("Location:" . $_SERVER['PHP_SELF']); exit; } $userID = $_COOKIE['userid']; $userName = $_COOKIE['username']; if (!isset($userID, $userName)) { ob_end_clean(); header("Location: http://jittr.com/jittr/gameon/gologin.php"); exit; } include 'gohtmlhead.php'; include 'goheader.php'; if (!isset($_GET['title'])) { $userSettings = new goUserSettings($userID); ?> <div id="personal"> <h2><?php echo 'Welcome user <a href="goprofile.php?userid=' . $userID . '">' . $userName . '</a>' . " - you have ID of {$userID}"; ?> </h2> <a href="<?php echo $_SERVER['PHP_SELF'] . "?logout=true"; ?> ">Logout</a> </div> <br /> <div id="quickcreategame"> <form name="input" action="<?php echo $_SERVER['PHP_SELF'];
require_once 'config.class.php'; require_once 'go_usersettings.class.php'; /* Author:Julio Hernandez-Miyares date: May 11,2010 Purpose: view user's profile (go_user/go_userSettings) TODO - enable security to only allow editing by the authenticated user */ include 'gohtmlhead.php'; include 'goheader.php'; $userID = $_REQUEST['userid']; $operation = strtolower($_REQUEST['bsupdateuser']); /* updating user profile */ if ($operation == 'update') { } if (!empty($userID)) { $userSettings = new goUserSettings($userID); $userName = $userSettings->getUserName(); } else { header("location: " . Config::getErrorPage() . "/" . "user_not_found"); exit; } echo '<form name="input" action="' . $_SERVER['PHP_SELF'] . '" method="POST">'; echo '<div id="personal">'; echo "<h2>User {$userName} - you have ID of {$userID}</h2>"; echo 'First Name: <input type="textbox" name="bsfirstname" value="' . $userSettings->getFirstName() . '" />'; echo 'Last Name: <input type="textbox" name="bslastname" value="' . $userSettings->getLastName() . '" />'; echo 'Email: <input type="textbox" name="bsemail" value="' . $userSettings->getEmail() . '" />'; echo '<input type="submit" name="bsupdateuser" value="Update" />'; echo "</div></br>"; echo "</form>"; echo '<div id="socialnetwork">';
require_once 'goutility.class.php'; require_once 'go_usersettings.class.php'; require_once 'EpiCurl.php'; require_once 'EpiOAuth.php'; require_once 'EpiTwitter.php'; require_once 'secret.php'; $twitterObj = new EpiTwitter($consumer_key, $consumer_secret); $twitterObj->setToken($_GET['oauth_token']); $token = $twitterObj->getAccessToken(); $twitterObj->setToken($token->oauth_token, $token->oauth_token_secret); $twitterInfo = $twitterObj->get_accountVerify_credentials(); $twitterInfo->response; //echo "Your twitter username is {$twitterInfo->screen_name} and your profile picture is <img src=\"{$twitterInfo->profile_image_url}\">"; //$tok = file_put_contents('tok', $token->oauth_token); //$sec = file_put_contents('sec', $token->oauth_token_secret); $tok = $token->oauth_token; $sec = $token->oauth_token_secret; $twitterID = $twitterInfo->screen_name; $imageUrl = $twitterInfo->profile_image_url; $userSettings = new goUserSettings(); $userID = 1; $userSettings->updateTwitterOAuth($userID, $twitterID, $imageUrl, $sec, $tok); echo "Your twitter username is {$twitterInfo->screen_name} and your profile picture is <img src=\"{$twitterInfo->profile_image_url}\">"; /*echo("<twitter><oauth_token>" . $token->oauth_token . "</oauth_token"); echo("<oauth_token_secret>" . $token->oauth_token_secret . "</oauth_token_secret>"); echo("<twitter_userid>" . $twitterInfo->screen_name . "</twitter_userid>"); echo("</twitter>"); */ ?>
</form> <?php $errorMessage = $_GET['errormessage']; if (!empty($errorMessage)) { echo "<p id=errormessage>" . $errorMessage . "</p>"; } include 'gofooter.php'; } else { if ($operation == "login") { /*Login using the credentials passed in returns userId if successful, -0- otherwise*/ $rc = goUserSettings::login($userName, $password); if ($rc == 0) { header("Location:" . $_SERVER['PHP_SELF'] . "?errormessage=" . urlencode("Invalid user name or password")); exit; } $userSettings = new goUserSettings(); $rc = $userSettings->getUserSettings($userName, 'Yes'); /* TODO - add code to determine if the retrieval failed due to error or because the userid or username not defined. For now assume error */ if (!rc) { // Server error mydie("Error connecting to Database"); } $userID = $userSettings->getuserID(); setcookie('userid', $userID); setcookie('username', $userSettings->getUserName()); header("Location: " . Config::getRootDomain()); } else { if ($operation == "register") { // make sure we have the minimum necessary populated fields if (empty($newUserName) || empty($newPassword)) { }
//if $createdBy = trim($createdBy, $trimCharlist); $title = trim($title, $trimCharlist); $wagerType = trim($wagerType, $trimCharlist); if (is_null($eventName)) { $eventName = $title; } if (is_null($description)) { $description = $title; } if (is_null($wagerUnits)) { $wagerUnits = 1; } /* define the url to use for syndicating the bet*/ $syndicationUrl = ""; $userSettings = new goUserSettings($createdByUserID); //grab user who created this wager - will need properties for syndication including oauth credentials header("Content-Type: text/xml"); echo '<?xml version="1.0"?>'; $link = mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase()); if (!$link) { // Server error header('HTTP/1.1 500 Internal Server Error'); mydie("Error connecting to Database"); } $gameInviteKey = Utility::generateGameInvite('GAMEID'); //if not set or empty, calculare default subscriptionClose date/time //TODO -currently defaulting to a Wager of type "date" driven - if (empty($subscriptionClose)) { $pivotDateObj = new DateTime($pivotDate, new DateTimeZone('America/New_York')); $subscriptionCloseObj = Game::getDefaultSubscriptionClose($typeName, $pivotDateObj);