\ No newline at end of file
diff --git a/www/wp-content/plugins/social-connect/diagnostics/test.php b/www/wp-content/plugins/social-connect/diagnostics/test.php
new file mode 100755
index 0000000..356bafa
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/diagnostics/test.php
@@ -0,0 +1,26 @@
+ The rewrite rules on your server appear to be setup correctly for Social Connect to work.', 'social_connect' );
+} else {
+ $msg = sprintf( __( 'Test was unsuccessful. Expected "http://www.example.com", received "%s".', 'social_connect' ), $testing );
+}
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/www/wp-content/plugins/social-connect/facebook/callback.php b/www/wp-content/plugins/social-connect/facebook/callback.php
new file mode 100755
index 0000000..932ee68
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/facebook/callback.php
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
diff --git a/www/wp-content/plugins/social-connect/facebook/facebook.php b/www/wp-content/plugins/social-connect/facebook/facebook.php
new file mode 100755
index 0000000..ca9cd65
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/facebook/facebook.php
@@ -0,0 +1,959 @@
+
+ */
+if (!class_exists('FacebookApiException')) :
+class FacebookApiException extends Exception
+{
+ /**
+ * The result from the API server that represents the exception information.
+ */
+ protected $result;
+
+ /**
+ * Make a new API Exception with the given result.
+ *
+ * @param Array $result the result from the API server
+ */
+ public function __construct($result) {
+ $this->result = $result;
+
+ $code = isset($result['error_code']) ? $result['error_code'] : 0;
+
+ if (isset($result['error_description'])) {
+ // OAuth 2.0 Draft 10 style
+ $msg = $result['error_description'];
+ } else if (isset($result['error']) && is_array($result['error'])) {
+ // OAuth 2.0 Draft 00 style
+ $msg = $result['error']['message'];
+ } else if (isset($result['error_msg'])) {
+ // Rest server style
+ $msg = $result['error_msg'];
+ } else {
+ $msg = 'Unknown Error. Check getResult()';
+ }
+
+ parent::__construct($msg, $code);
+ }
+
+ /**
+ * Return the associated result object returned by the API server.
+ *
+ * @returns Array the result from the API server
+ */
+ public function getResult() {
+ return $this->result;
+ }
+
+ /**
+ * Returns the associated type for the error. This will default to
+ * 'Exception' when a type is not available.
+ *
+ * @return String
+ */
+ public function getType() {
+ if (isset($this->result['error'])) {
+ $error = $this->result['error'];
+ if (is_string($error)) {
+ // OAuth 2.0 Draft 10 style
+ return $error;
+ } else if (is_array($error)) {
+ // OAuth 2.0 Draft 00 style
+ if (isset($error['type'])) {
+ return $error['type'];
+ }
+ }
+ }
+ return 'Exception';
+ }
+
+ /**
+ * To make debugging easier.
+ *
+ * @returns String the string representation of the error
+ */
+ public function __toString() {
+ $str = $this->getType() . ': ';
+ if ($this->code != 0) {
+ $str .= $this->code . ': ';
+ }
+ return $str . $this->message;
+ }
+}
+endif;
+
+if (!class_exists('Facebook')) :
+/**
+ * Provides access to the Facebook Platform.
+ *
+ * @author Naitik Shah
+ */
+class Facebook
+{
+ /**
+ * Version.
+ */
+ const VERSION = '2.1.2';
+
+ /**
+ * Default options for curl.
+ */
+ public static $CURL_OPTS = array(
+ CURLOPT_CONNECTTIMEOUT => 10,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_TIMEOUT => 60,
+ CURLOPT_USERAGENT => 'facebook-php-2.0',
+ );
+
+ /**
+ * List of query parameters that get automatically dropped when rebuilding
+ * the current URL.
+ */
+ protected static $DROP_QUERY_PARAMS = array(
+ 'session',
+ 'signed_request',
+ );
+
+ /**
+ * Maps aliases to Facebook domains.
+ */
+ public static $DOMAIN_MAP = array(
+ 'api' => 'https://api.facebook.com/',
+ 'api_read' => 'https://api-read.facebook.com/',
+ 'graph' => 'https://graph.facebook.com/',
+ 'www' => 'https://www.facebook.com/',
+ );
+
+ /**
+ * The Application ID.
+ */
+ protected $appId;
+
+ /**
+ * The Application API Secret.
+ */
+ protected $apiSecret;
+
+ /**
+ * The active user session, if one is available.
+ */
+ protected $session;
+
+ /**
+ * The data from the signed_request token.
+ */
+ protected $signedRequest;
+
+ /**
+ * Indicates that we already loaded the session as best as we could.
+ */
+ protected $sessionLoaded = false;
+
+ /**
+ * Indicates if Cookie support should be enabled.
+ */
+ protected $cookieSupport = false;
+
+ /**
+ * Base domain for the Cookie.
+ */
+ protected $baseDomain = '';
+
+ /**
+ * Indicates if the CURL based @ syntax for file uploads is enabled.
+ */
+ protected $fileUploadSupport = false;
+
+ /**
+ * Initialize a Facebook Application.
+ *
+ * The configuration:
+ * - appId: the application ID
+ * - secret: the application secret
+ * - cookie: (optional) boolean true to enable cookie support
+ * - domain: (optional) domain for the cookie
+ * - fileUpload: (optional) boolean indicating if file uploads are enabled
+ *
+ * @param Array $config the application configuration
+ */
+ public function __construct($config) {
+ $this->setAppId($config['appId']);
+ $this->setApiSecret($config['secret']);
+ if (isset($config['cookie'])) {
+ $this->setCookieSupport($config['cookie']);
+ }
+ if (isset($config['domain'])) {
+ $this->setBaseDomain($config['domain']);
+ }
+ if (isset($config['fileUpload'])) {
+ $this->setFileUploadSupport($config['fileUpload']);
+ }
+ }
+
+ /**
+ * Set the Application ID.
+ *
+ * @param String $appId the Application ID
+ */
+ public function setAppId($appId) {
+ $this->appId = $appId;
+ return $this;
+ }
+
+ /**
+ * Get the Application ID.
+ *
+ * @return String the Application ID
+ */
+ public function getAppId() {
+ return $this->appId;
+ }
+
+ /**
+ * Set the API Secret.
+ *
+ * @param String $appId the API Secret
+ */
+ public function setApiSecret($apiSecret) {
+ $this->apiSecret = $apiSecret;
+ return $this;
+ }
+
+ /**
+ * Get the API Secret.
+ *
+ * @return String the API Secret
+ */
+ public function getApiSecret() {
+ return $this->apiSecret;
+ }
+
+ /**
+ * Set the Cookie Support status.
+ *
+ * @param Boolean $cookieSupport the Cookie Support status
+ */
+ public function setCookieSupport($cookieSupport) {
+ $this->cookieSupport = $cookieSupport;
+ return $this;
+ }
+
+ /**
+ * Get the Cookie Support status.
+ *
+ * @return Boolean the Cookie Support status
+ */
+ public function useCookieSupport() {
+ return $this->cookieSupport;
+ }
+
+ /**
+ * Set the base domain for the Cookie.
+ *
+ * @param String $domain the base domain
+ */
+ public function setBaseDomain($domain) {
+ $this->baseDomain = $domain;
+ return $this;
+ }
+
+ /**
+ * Get the base domain for the Cookie.
+ *
+ * @return String the base domain
+ */
+ public function getBaseDomain() {
+ return $this->baseDomain;
+ }
+
+ /**
+ * Set the file upload support status.
+ *
+ * @param String $domain the base domain
+ */
+ public function setFileUploadSupport($fileUploadSupport) {
+ $this->fileUploadSupport = $fileUploadSupport;
+ return $this;
+ }
+
+ /**
+ * Get the file upload support status.
+ *
+ * @return String the base domain
+ */
+ public function useFileUploadSupport() {
+ return $this->fileUploadSupport;
+ }
+
+ /**
+ * Get the data from a signed_request token
+ *
+ * @return String the base domain
+ */
+ public function getSignedRequest() {
+ if (!$this->signedRequest) {
+ if (isset($_REQUEST['signed_request'])) {
+ $this->signedRequest = $this->parseSignedRequest(
+ $_REQUEST['signed_request']);
+ }
+ }
+ return $this->signedRequest;
+ }
+
+ /**
+ * Set the Session.
+ *
+ * @param Array $session the session
+ * @param Boolean $write_cookie indicate if a cookie should be written. this
+ * value is ignored if cookie support has been disabled.
+ */
+ public function setSession($session=null, $write_cookie=true) {
+ $session = $this->validateSessionObject($session);
+ $this->sessionLoaded = true;
+ $this->session = $session;
+ if ($write_cookie) {
+ $this->setCookieFromSession($session);
+ }
+ return $this;
+ }
+
+ /**
+ * Get the session object. This will automatically look for a signed session
+ * sent via the signed_request, Cookie or Query Parameters if needed.
+ *
+ * @return Array the session
+ */
+ public function getSession() {
+ if (!$this->sessionLoaded) {
+ $session = null;
+ $write_cookie = true;
+
+ // try loading session from signed_request in $_REQUEST
+ $signedRequest = $this->getSignedRequest();
+ if ($signedRequest) {
+ // sig is good, use the signedRequest
+ $session = $this->createSessionFromSignedRequest($signedRequest);
+ }
+
+ // try loading session from $_REQUEST
+ if (!$session && isset($_REQUEST['session'])) {
+ $session = json_decode(
+ get_magic_quotes_gpc()
+ ? stripslashes($_REQUEST['session'])
+ : $_REQUEST['session'],
+ true
+ );
+ $session = $this->validateSessionObject($session);
+ }
+
+ // try loading session from cookie if necessary
+ if (!$session && $this->useCookieSupport()) {
+ $cookieName = $this->getSessionCookieName();
+ if (isset($_COOKIE[$cookieName])) {
+ $session = array();
+ parse_str(trim(
+ get_magic_quotes_gpc()
+ ? stripslashes($_COOKIE[$cookieName])
+ : $_COOKIE[$cookieName],
+ '"'
+ ), $session);
+ $session = $this->validateSessionObject($session);
+ // write only if we need to delete a invalid session cookie
+ $write_cookie = empty($session);
+ }
+ }
+
+ $this->setSession($session, $write_cookie);
+ }
+
+ return $this->session;
+ }
+
+ /**
+ * Get the UID from the session.
+ *
+ * @return String the UID if available
+ */
+ public function getUser() {
+ $session = $this->getSession();
+ return $session ? $session['uid'] : null;
+ }
+
+ /**
+ * Gets a OAuth access token.
+ *
+ * @return String the access token
+ */
+ public function getAccessToken() {
+ $session = $this->getSession();
+ // either user session signed, or app signed
+ if ($session) {
+ return $session['access_token'];
+ } else {
+ return $this->getAppId() .'|'. $this->getApiSecret();
+ }
+ }
+
+ /**
+ * Get a Login URL for use with redirects. By default, full page redirect is
+ * assumed. If you are using the generated URL with a window.open() call in
+ * JavaScript, you can pass in display=popup as part of the $params.
+ *
+ * The parameters:
+ * - next: the url to go to after a successful login
+ * - cancel_url: the url to go to after the user cancels
+ * - req_perms: comma separated list of requested extended perms
+ * - display: can be "page" (default, full page) or "popup"
+ *
+ * @param Array $params provide custom parameters
+ * @return String the URL for the login flow
+ */
+ public function getLoginUrl($params=array()) {
+ $currentUrl = $this->getCurrentUrl();
+ return $this->getUrl(
+ 'www',
+ 'login.php',
+ array_merge(array(
+ 'api_key' => $this->getAppId(),
+ 'cancel_url' => $currentUrl,
+ 'display' => 'page',
+ 'fbconnect' => 1,
+ 'next' => $currentUrl,
+ 'return_session' => 1,
+ 'session_version' => 3,
+ 'v' => '1.0',
+ ), $params)
+ );
+ }
+
+ /**
+ * Get a Logout URL suitable for use with redirects.
+ *
+ * The parameters:
+ * - next: the url to go to after a successful logout
+ *
+ * @param Array $params provide custom parameters
+ * @return String the URL for the logout flow
+ */
+ public function getLogoutUrl($params=array()) {
+ return $this->getUrl(
+ 'www',
+ 'logout.php',
+ array_merge(array(
+ 'next' => $this->getCurrentUrl(),
+ 'access_token' => $this->getAccessToken(),
+ ), $params)
+ );
+ }
+
+ /**
+ * Get a login status URL to fetch the status from facebook.
+ *
+ * The parameters:
+ * - ok_session: the URL to go to if a session is found
+ * - no_session: the URL to go to if the user is not connected
+ * - no_user: the URL to go to if the user is not signed into facebook
+ *
+ * @param Array $params provide custom parameters
+ * @return String the URL for the logout flow
+ */
+ public function getLoginStatusUrl($params=array()) {
+ return $this->getUrl(
+ 'www',
+ 'extern/login_status.php',
+ array_merge(array(
+ 'api_key' => $this->getAppId(),
+ 'no_session' => $this->getCurrentUrl(),
+ 'no_user' => $this->getCurrentUrl(),
+ 'ok_session' => $this->getCurrentUrl(),
+ 'session_version' => 3,
+ ), $params)
+ );
+ }
+
+ /**
+ * Make an API call.
+ *
+ * @param Array $params the API call parameters
+ * @return the decoded response
+ */
+ public function api(/* polymorphic */) {
+ $args = func_get_args();
+ if (is_array($args[0])) {
+ return $this->_restserver($args[0]);
+ } else {
+ return call_user_func_array(array($this, '_graph'), $args);
+ }
+ }
+
+ /**
+ * Invoke the old restserver.php endpoint.
+ *
+ * @param Array $params method call object
+ * @return the decoded response object
+ * @throws FacebookApiException
+ */
+ protected function _restserver($params) {
+ // generic application level parameters
+ $params['api_key'] = $this->getAppId();
+ $params['format'] = 'json-strings';
+
+ $result = json_decode($this->_oauthRequest(
+ $this->getApiUrl($params['method']),
+ $params
+ ), true);
+
+ // results are returned, errors are thrown
+ if (is_array($result) && isset($result['error_code'])) {
+ throw new FacebookApiException($result);
+ }
+ return $result;
+ }
+
+ /**
+ * Invoke the Graph API.
+ *
+ * @param String $path the path (required)
+ * @param String $method the http method (default 'GET')
+ * @param Array $params the query/post data
+ * @return the decoded response object
+ * @throws FacebookApiException
+ */
+ protected function _graph($path, $method='GET', $params=array()) {
+ if (is_array($method) && empty($params)) {
+ $params = $method;
+ $method = 'GET';
+ }
+ $params['method'] = $method; // method override as we always do a POST
+
+ $result = json_decode($this->_oauthRequest(
+ $this->getUrl('graph', $path),
+ $params
+ ), true);
+
+ // results are returned, errors are thrown
+ if (is_array($result) && isset($result['error'])) {
+ $e = new FacebookApiException($result);
+ switch ($e->getType()) {
+ // OAuth 2.0 Draft 00 style
+ case 'OAuthException':
+ // OAuth 2.0 Draft 10 style
+ case 'invalid_token':
+ $this->setSession(null);
+ }
+ throw $e;
+ }
+ return $result;
+ }
+
+ /**
+ * Make a OAuth Request
+ *
+ * @param String $path the path (required)
+ * @param Array $params the query/post data
+ * @return the decoded response object
+ * @throws FacebookApiException
+ */
+ protected function _oauthRequest($url, $params) {
+ if (!isset($params['access_token'])) {
+ $params['access_token'] = $this->getAccessToken();
+ }
+
+ // json_encode all params values that are not strings
+ foreach ($params as $key => $value) {
+ if (!is_string($value)) {
+ $params[$key] = json_encode($value);
+ }
+ }
+ return $this->makeRequest($url, $params);
+ }
+
+ /**
+ * Makes an HTTP request. This method can be overriden by subclasses if
+ * developers want to do fancier things or use something other than curl to
+ * make the request.
+ *
+ * @param String $url the URL to make the request to
+ * @param Array $params the parameters to use for the POST body
+ * @param CurlHandler $ch optional initialized curl handle
+ * @return String the response text
+ */
+ protected function makeRequest($url, $params, $ch=null) {
+ if (!$ch) {
+ $ch = curl_init();
+ }
+
+ $opts = self::$CURL_OPTS;
+ if ($this->useFileUploadSupport()) {
+ $opts[CURLOPT_POSTFIELDS] = $params;
+ } else {
+ $opts[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&');
+ }
+ $opts[CURLOPT_URL] = $url;
+
+ // disable the 'Expect: 100-continue' behaviour. This causes CURL to wait
+ // for 2 seconds if the server does not support this header.
+ if (isset($opts[CURLOPT_HTTPHEADER])) {
+ $existing_headers = $opts[CURLOPT_HTTPHEADER];
+ $existing_headers[] = 'Expect:';
+ $opts[CURLOPT_HTTPHEADER] = $existing_headers;
+ } else {
+ $opts[CURLOPT_HTTPHEADER] = array('Expect:');
+ }
+
+ curl_setopt_array($ch, $opts);
+ $result = curl_exec($ch);
+ if ($result === false) {
+ $e = new FacebookApiException(array(
+ 'error_code' => curl_errno($ch),
+ 'error' => array(
+ 'message' => curl_error($ch),
+ 'type' => 'CurlException',
+ ),
+ ));
+ curl_close($ch);
+ throw $e;
+ }
+ curl_close($ch);
+ return $result;
+ }
+
+ /**
+ * The name of the Cookie that contains the session.
+ *
+ * @return String the cookie name
+ */
+ protected function getSessionCookieName() {
+ return 'fbs_' . $this->getAppId();
+ }
+
+ /**
+ * Set a JS Cookie based on the _passed in_ session. It does not use the
+ * currently stored session -- you need to explicitly pass it in.
+ *
+ * @param Array $session the session to use for setting the cookie
+ */
+ protected function setCookieFromSession($session=null) {
+ if (!$this->useCookieSupport()) {
+ return;
+ }
+
+ $cookieName = $this->getSessionCookieName();
+ $value = 'deleted';
+ $expires = time() - 3600;
+ $domain = $this->getBaseDomain();
+ if ($session) {
+ $value = '"' . http_build_query($session, null, '&') . '"';
+ if (isset($session['base_domain'])) {
+ $domain = $session['base_domain'];
+ }
+ $expires = $session['expires'];
+ }
+
+ // prepend dot if a domain is found
+ if ($domain) {
+ $domain = '.' . $domain;
+ }
+
+ // if an existing cookie is not set, we dont need to delete it
+ if ($value == 'deleted' && empty($_COOKIE[$cookieName])) {
+ return;
+ }
+
+ if (headers_sent()) {
+ self::errorLog('Could not set cookie. Headers already sent.');
+
+ // ignore for code coverage as we will never be able to setcookie in a CLI
+ // environment
+ // @codeCoverageIgnoreStart
+ } else {
+ setcookie($cookieName, $value, $expires, '/', $domain);
+ }
+ // @codeCoverageIgnoreEnd
+ }
+
+ /**
+ * Validates a session_version=3 style session object.
+ *
+ * @param Array $session the session object
+ * @return Array the session object if it validates, null otherwise
+ */
+ protected function validateSessionObject($session) {
+ // make sure some essential fields exist
+ if (is_array($session) &&
+ isset($session['uid']) &&
+ isset($session['access_token']) &&
+ isset($session['sig'])) {
+ // validate the signature
+ $session_without_sig = $session;
+ unset($session_without_sig['sig']);
+ $expected_sig = self::generateSignature(
+ $session_without_sig,
+ $this->getApiSecret()
+ );
+ if ($session['sig'] != $expected_sig) {
+ self::errorLog('Got invalid session signature in cookie.');
+ $session = null;
+ }
+ // check expiry time
+ } else {
+ $session = null;
+ }
+ return $session;
+ }
+
+ /**
+ * Returns something that looks like our JS session object from the
+ * signed token's data
+ *
+ * TODO: Nuke this once the login flow uses OAuth2
+ *
+ * @param Array the output of getSignedRequest
+ * @return Array Something that will work as a session
+ */
+ protected function createSessionFromSignedRequest($data) {
+ if (!isset($data['oauth_token'])) {
+ return null;
+ }
+
+ $session = array(
+ 'uid' => $data['user_id'],
+ 'access_token' => $data['oauth_token'],
+ 'expires' => $data['expires'],
+ );
+
+ // put a real sig, so that validateSignature works
+ $session['sig'] = self::generateSignature(
+ $session,
+ $this->getApiSecret()
+ );
+
+ return $session;
+ }
+
+ /**
+ * Parses a signed_request and validates the signature.
+ * Then saves it in $this->signed_data
+ *
+ * @param String A signed token
+ * @param Boolean Should we remove the parts of the payload that
+ * are used by the algorithm?
+ * @return Array the payload inside it or null if the sig is wrong
+ */
+ protected function parseSignedRequest($signed_request) {
+ list($encoded_sig, $payload) = explode('.', $signed_request, 2);
+
+ // decode the data
+ $sig = self::base64UrlDecode($encoded_sig);
+ $data = json_decode(self::base64UrlDecode($payload), true);
+
+ if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
+ self::errorLog('Unknown algorithm. Expected HMAC-SHA256');
+ return null;
+ }
+
+ // check sig
+ $expected_sig = hash_hmac('sha256', $payload,
+ $this->getApiSecret(), $raw = true);
+ if ($sig !== $expected_sig) {
+ self::errorLog('Bad Signed JSON signature!');
+ return null;
+ }
+
+ return $data;
+ }
+
+ /**
+ * Build the URL for api given parameters.
+ *
+ * @param $method String the method name.
+ * @return String the URL for the given parameters
+ */
+ protected function getApiUrl($method) {
+ static $READ_ONLY_CALLS =
+ array('admin.getallocation' => 1,
+ 'admin.getappproperties' => 1,
+ 'admin.getbannedusers' => 1,
+ 'admin.getlivestreamvialink' => 1,
+ 'admin.getmetrics' => 1,
+ 'admin.getrestrictioninfo' => 1,
+ 'application.getpublicinfo' => 1,
+ 'auth.getapppublickey' => 1,
+ 'auth.getsession' => 1,
+ 'auth.getsignedpublicsessiondata' => 1,
+ 'comments.get' => 1,
+ 'connect.getunconnectedfriendscount' => 1,
+ 'dashboard.getactivity' => 1,
+ 'dashboard.getcount' => 1,
+ 'dashboard.getglobalnews' => 1,
+ 'dashboard.getnews' => 1,
+ 'dashboard.multigetcount' => 1,
+ 'dashboard.multigetnews' => 1,
+ 'data.getcookies' => 1,
+ 'events.get' => 1,
+ 'events.getmembers' => 1,
+ 'fbml.getcustomtags' => 1,
+ 'feed.getappfriendstories' => 1,
+ 'feed.getregisteredtemplatebundlebyid' => 1,
+ 'feed.getregisteredtemplatebundles' => 1,
+ 'fql.multiquery' => 1,
+ 'fql.query' => 1,
+ 'friends.arefriends' => 1,
+ 'friends.get' => 1,
+ 'friends.getappusers' => 1,
+ 'friends.getlists' => 1,
+ 'friends.getmutualfriends' => 1,
+ 'gifts.get' => 1,
+ 'groups.get' => 1,
+ 'groups.getmembers' => 1,
+ 'intl.gettranslations' => 1,
+ 'links.get' => 1,
+ 'notes.get' => 1,
+ 'notifications.get' => 1,
+ 'pages.getinfo' => 1,
+ 'pages.isadmin' => 1,
+ 'pages.isappadded' => 1,
+ 'pages.isfan' => 1,
+ 'permissions.checkavailableapiaccess' => 1,
+ 'permissions.checkgrantedapiaccess' => 1,
+ 'photos.get' => 1,
+ 'photos.getalbums' => 1,
+ 'photos.gettags' => 1,
+ 'profile.getinfo' => 1,
+ 'profile.getinfooptions' => 1,
+ 'stream.get' => 1,
+ 'stream.getcomments' => 1,
+ 'stream.getfilters' => 1,
+ 'users.getinfo' => 1,
+ 'users.getloggedinuser' => 1,
+ 'users.getstandardinfo' => 1,
+ 'users.hasapppermission' => 1,
+ 'users.isappuser' => 1,
+ 'users.isverified' => 1,
+ 'video.getuploadlimits' => 1);
+ $name = 'api';
+ if (isset($READ_ONLY_CALLS[strtolower($method)])) {
+ $name = 'api_read';
+ }
+ return self::getUrl($name, 'restserver.php');
+ }
+
+ /**
+ * Build the URL for given domain alias, path and parameters.
+ *
+ * @param $name String the name of the domain
+ * @param $path String optional path (without a leading slash)
+ * @param $params Array optional query parameters
+ * @return String the URL for the given parameters
+ */
+ protected function getUrl($name, $path='', $params=array()) {
+ $url = self::$DOMAIN_MAP[$name];
+ if ($path) {
+ if ($path[0] === '/') {
+ $path = substr($path, 1);
+ }
+ $url .= $path;
+ }
+ if ($params) {
+ $url .= '?' . http_build_query($params, null, '&');
+ }
+ return $url;
+ }
+
+ /**
+ * Returns the Current URL, stripping it of known FB parameters that should
+ * not persist.
+ *
+ * @return String the current URL
+ */
+ protected function getCurrentUrl() {
+ $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
+ ? 'https://'
+ : 'http://';
+ $currentUrl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+ $parts = parse_url($currentUrl);
+
+ // drop known fb params
+ $query = '';
+ if (!empty($parts['query'])) {
+ $params = array();
+ parse_str($parts['query'], $params);
+ foreach(self::$DROP_QUERY_PARAMS as $key) {
+ unset($params[$key]);
+ }
+ if (!empty($params)) {
+ $query = '?' . http_build_query($params, null, '&');
+ }
+ }
+
+ // use port if non default
+ $port =
+ isset($parts['port']) &&
+ (($protocol === 'http://' && $parts['port'] !== 80) ||
+ ($protocol === 'https://' && $parts['port'] !== 443))
+ ? ':' . $parts['port'] : '';
+
+ // rebuild
+ return $protocol . $parts['host'] . $port . $parts['path'] . $query;
+ }
+
+ /**
+ * Generate a signature for the given params and secret.
+ *
+ * @param Array $params the parameters to sign
+ * @param String $secret the secret to sign with
+ * @return String the generated signature
+ */
+ protected static function generateSignature($params, $secret) {
+ // work with sorted data
+ ksort($params);
+
+ // generate the base string
+ $base_string = '';
+ foreach($params as $key => $value) {
+ $base_string .= $key . '=' . $value;
+ }
+ $base_string .= $secret;
+
+ return md5($base_string);
+ }
+
+ /**
+ * Prints to the error log if you aren't in command line mode.
+ *
+ * @param String log message
+ */
+ protected static function errorLog($msg) {
+ // disable error log if we are running in a CLI environment
+ // @codeCoverageIgnoreStart
+ if (php_sapi_name() != 'cli') {
+ error_log($msg);
+ }
+ // uncomment this if you want to see the errors on the page
+ // print 'error_log: '.$msg."\n";
+ // @codeCoverageIgnoreEnd
+ }
+
+ /**
+ * Base64 encoding that doesn't need to be urlencode()ed.
+ * Exactly the same as base64_encode except it uses
+ * - instead of +
+ * _ instead of /
+ *
+ * @param String base64UrlEncodeded string
+ */
+ protected static function base64UrlDecode($input) {
+ return base64_decode(strtr($input, '-_', '+/'));
+ }
+}
+endif;
\ No newline at end of file
diff --git a/www/wp-content/plugins/social-connect/google/connect.php b/www/wp-content/plugins/social-connect/google/connect.php
new file mode 100755
index 0000000..e447d4a
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/google/connect.php
@@ -0,0 +1,45 @@
+identity = 'https://www.google.com/accounts/o8/id';
+ $openid->required = array('namePerson/first', 'namePerson/last', 'contact/email');
+ header('Location: ' . $openid->authUrl());
+ } else {
+ $openid = new LightOpenID;
+ if($openid->validate()) {
+ $google_id = $openid->identity;
+ $attributes = $openid->getAttributes();
+ $email = $attributes['contact/email'];
+ $first_name = $attributes['namePerson/first'];
+ $last_name = $attributes['namePerson/last'];
+ $signature = social_connect_generate_signature($google_id);
+ ?>
+
+
+
+
+
+
+
+ getMessage();
+}
+?>
\ No newline at end of file
diff --git a/www/wp-content/plugins/social-connect/languages/social_connect-pl_PL.mo b/www/wp-content/plugins/social-connect/languages/social_connect-pl_PL.mo
new file mode 100755
index 0000000..3e3a232
Binary files /dev/null and b/www/wp-content/plugins/social-connect/languages/social_connect-pl_PL.mo differ
diff --git a/www/wp-content/plugins/social-connect/languages/social_connect-pl_PL.po b/www/wp-content/plugins/social-connect/languages/social_connect-pl_PL.po
new file mode 100755
index 0000000..6a8a907
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/languages/social_connect-pl_PL.po
@@ -0,0 +1,212 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Social Connect\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-26 18:34+0100\n"
+"PO-Revision-Date: 2011-04-26 18:36+0100\n"
+"Last-Translator: Grzegorz Korba \n"
+"Language-Team: app2technologies\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: __;gettext;gettext_noop;_;_e\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-Language: Polish\n"
+"X-Poedit-Country: POLAND\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+"X-Poedit-SearchPath-0: ../.\n"
+
+#: .././admin.php:26
+msgid "Social Connect Settings"
+msgstr "Ustawienia Social Connect"
+
+#: .././admin.php:30
+msgid "Facebook Settings"
+msgstr "Ustawienia Facebooka"
+
+#: .././admin.php:31
+msgid "To connect your site to Facebook, you need a Facebook Application. If you have already created one, please insert your API & Secret key below."
+msgstr "Aby połączyć swoją witrynę z Facebookiem musisz utworzyć aplikację Facebook. Jeśli już takową zarejestrowałeś wpisz proszę poniżej Twój klucz API oraz klucz sekretny."
+
+#: .././admin.php:32
+#: .././admin.php:60
+#, php-format
+msgid "Already registered? Find your keys in your %1$s Application List"
+msgstr "Posiadasz zarejestrowaną aplikację? Znajdź jej klucze na liście swoich aplikacji %1$s"
+
+#: .././admin.php:33
+msgid "Need to register?"
+msgstr "Potrzebujesz zarejestrować?"
+
+#: .././admin.php:35
+#, php-format
+msgid "Visit the Facebook Application Setup page"
+msgstr "Odwiedź kreatora aplikacji Facebook"
+
+#: .././admin.php:36
+#, php-format
+msgid "Get the API information from the Facebook Application List"
+msgstr "Znajdź informacje o API na liście swoich aplikacji"
+
+#: .././admin.php:37
+msgid "Select the application you created, then copy and paste the API key & Application Secret from there."
+msgstr "Wybierz utworzoną przez siebie aplikację, a następnie skopiuj klucz API i Sekretny Klucz i wklej poniżej."
+
+#: .././admin.php:41
+#: .././admin.php:69
+msgid "Enable?"
+msgstr "Włączyć?"
+
+#: .././admin.php:44
+msgid "Check this box to enable register/login using Facebook."
+msgstr "Zaznacz to pole by włączyć opcję logowania/rejestracji przy użyciu konta Facebook"
+
+#: .././admin.php:48
+msgid "API Key"
+msgstr "Klucz API"
+
+#: .././admin.php:53
+msgid "Secret Key"
+msgstr "Sekretny klucz"
+
+#: .././admin.php:58
+msgid "Twitter Settings"
+msgstr "Ustawienia Twittera"
+
+#: .././admin.php:59
+msgid "To offer login via Twitter, you need to register your site as a Twitter Application and get a Consumer Key, a Consumer Secret, an Access Token and an Access Token Secret."
+msgstr "Aby połączyć witrynę z Twitterem musisz ją zarejestrować jako aplikację Twitter i zdobyć Klucz Konsumenta, Klucz Sekretny, Klucz (token) Dostępu oraz Seretny klucz (token) dostępu."
+
+#: .././admin.php:61
+#, php-format
+msgid "Need to register? Register an Application and fill the form with the details below:"
+msgstr "Musisz zarejestrować? Zrób to wykorzystując informacje wyszczególnione poniżej:"
+
+#: .././admin.php:63
+msgid "Application Type: Browser"
+msgstr "Typ aplikacji: Przeglądarka (Browser)"
+
+#: .././admin.php:64
+#, php-format
+msgid "Callback URL: %1$s"
+msgstr "Adres zwrotny: %1$s"
+
+#: .././admin.php:65
+msgid "Default Access: Read & Write"
+msgstr "Domyślny dostęp: Odczyt & Zapis"
+
+#: .././admin.php:72
+msgid "Twitter integration requires the generation of dummy email addresses for authenticating users. Please check with your domain administrator as this may require changes to your mail server."
+msgstr "Integracja z Twitterem wymaga generowania fikcyjnych adresów email w celu autoryzowania użytkowników. Proszę sprawdź u swojego administratora serwera czy to wymaga zmian w Twoim serwerze poczty."
+
+#: .././admin.php:76
+msgid "Consumer Key"
+msgstr "Klucz konsumenta (API)"
+
+#: .././admin.php:80
+msgid "Consumer Secret"
+msgstr "Sekretny klucz"
+
+#: .././admin.php:85
+msgid "OpenID Providers"
+msgstr "Dostawcy OpenID"
+
+#: .././admin.php:86
+msgid "Choose the OpenID providers your visitors can use to register, comment and login."
+msgstr "Wybierz dostawców OpenID dzięki którym odwiedzający będą mogli się logować, rejestrować i komentować wpisy."
+
+#: .././admin.php:109
+msgid "Save Changes"
+msgstr "Zapisz zmiany"
+
+#: .././admin.php:112
+msgid "Rewrite Diagnostics"
+msgstr "Diagnostyka przekierowań"
+
+#: .././admin.php:113
+msgid "Click on the link below to confirm your URL rewriting and query string parameter passing are setup correctly on your server. If you see a \"Test was successful\" message after clicking the link then you are good to go. If you see a 404 error or some other error then you need to update rewrite rules or ask your service provider to configure your server settings such that the below URL works correctly."
+msgstr "Kliknij w link poniżej aby sprawdzić czy ustawienia serwera dotyczące przekierowań są prawidłowe. Jeśli widzisz komunikat \"Pozytywny wynik testu\" po kliknięciu poniższego linku to znaczy, że konfiguracja jest prawidłowa. Jeśli widzisz błąd 404 lub jakiś inny błąd musisz zaktualizować ustawienia przekierowań lub skontaktować się z dostawcą hostingu w sprawie odpowiedniej konfiguracji serwera."
+
+#: .././admin.php:114
+msgid "Test server redirection settings"
+msgstr "Sprawdź ustawienia serwera"
+
+#: .././social-connect.php:20
+#, php-format
+msgid "Sorry, but you can not run Social Connect. It requires WordPress 3.0 or newer. Consider upgrading your WordPress installation, it's worth the effort. Return to Plugins Admin page »"
+msgstr "Przykro nam, ale nie możesz korzystać z Social Connect. Wymagany jest WordPress w wersji 3.0 lub wyższej. Proszę rozważyć aktualizację WordPressa. Return to Plugins Admin page »"
+
+#: .././social-connect.php:22
+#, php-format
+msgid "Sorry, but you can not run Social Connect. It requires the PHP libcurl extension be installed. Please contact your web host and request libcurl be installed. Return to Plugins Admin page »"
+msgstr "Przykro nam, ale nie możesz korzystać z Social Connect. Wymagana jest rozszerzenie PHP libcurl. Proszę skontaktować się z obsługą hostingu w celu zainstalowania tego rozszerzenia. Wróć do listy wtyczek »"
+
+#: .././social-connect.php:24
+#, php-format
+msgid "Sorry, but you can not run Social Connect. It requires PHP 5.1.2 or newer. Please contact your web host and request they migrate your PHP installation to run Social Connect. Return to Plugins Admin page »"
+msgstr "Przykro nam, ale nie możesz korzystać z Social Connect. Wymagana wersja PHP to 5.1.2 lub nowsza. Proszę skontaktować się z obsługą hostingu w celu uruchomienia odpowiedniej wersji PHP. Wróć do listy wtyczek »"
+
+#: .././ui.php:21
+msgid "Connect with"
+msgstr "Połącz z"
+
+#: .././ui.php:63
+#, php-format
+msgid "Welcome back %s, %scontinue?%s"
+msgstr "Witaj %s, %skontynuujemy?%s"
+
+#: .././ui.php:66
+msgid "Not you?"
+msgstr "To nie Ty?"
+
+#: .././ui.php:67
+msgid "Use another account"
+msgstr "Użyj innego konta"
+
+#: .././ui.php:82
+msgid "Enter your OpenID URL"
+msgstr "Wprowadź adres URL dostawcy OpenID"
+
+#: .././ui.php:85
+#: .././ui.php:93
+msgid "Proceed"
+msgstr "Dalej"
+
+#: .././ui.php:90
+msgid "Enter your WordPress.com blog URL"
+msgstr "Uzupełnij adres swojego bloga na WordPress.com"
+
+#: .././ui.php:162
+msgid "Login or register with Facebook, Twitter, Yahoo, Google or a Wordpress.com account"
+msgstr "Logowanie oraz rejestracja za pomocą konta Facebook, Twitter, Yahoo, Google lub WordPress.com."
+
+#: .././ui.php:214
+msgid "Title:"
+msgstr "Tytuł:"
+
+#: .././ui.php:216
+msgid "Before widget content:"
+msgstr "Dodaj przed treścią:"
+
+#: .././ui.php:218
+msgid "After widget content:"
+msgstr "Dodaj za treścią:"
+
+#: .././ui.php:220
+msgid "Hide for logged in users:"
+msgstr "Ukryj dla zalogowanych:"
+
+#: .././diagnostics/test.php:8
+msgid "Test was successful!
The rewrite rules on your server appear to be setup correctly for Social Connect to work."
+msgstr "Pozytywny wynik testu!
Zasady przepisywania adresów na Twoim serwerze są odpowiednie dla poprawnego działania Social Connect."
+
+#: .././diagnostics/test.php:10
+#, php-format
+msgid "Test was unsuccessful. Expected \"http://www.example.com\", received \"%s\"."
+msgstr "Test nieudany. Oczekiwano \"http://www.example.com\", otrzymano \"%s\"."
+
+#: .././diagnostics/test.php:20
+msgid "Social Connect Diagnostics"
+msgstr "Diagnostyka Social Connect"
+
diff --git a/www/wp-content/plugins/social-connect/liveid/callback.php b/www/wp-content/plugins/social-connect/liveid/callback.php
new file mode 100755
index 0000000..6107370
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/liveid/callback.php
@@ -0,0 +1,110 @@
+$liveid_appid,"secret"=>$liveid_secret,"securityalgorithm"=>$liveid_secalgo,"returnurl"=>$liveid_return,"policyurl"=>$liveid_policy);
+
+// Initialize the WindowsLiveLogin module.
+$wll = WindowsLiveLogin::initFromXml(false,$liveid_settings);
+$wll->setDebug($DEBUG);
+
+// Extract the 'action' parameter, if any, from the request.
+$action = @$_REQUEST['action'];
+
+// If action is 'logout', clear the login cookie and redirect to the
+// logout page.
+//
+// If action is 'clearcookie', clear the login cookie and return a GIF
+// as a response to signify success.
+//
+// If action is 'login', try to process sign-in. If the sign-in is
+// successful, cache the user token in a cookie and redirect to the
+// site's main page. If sign-in failed, clear the cookie and redirect
+// to the main page.
+//
+// If action is 'delauth', get user token from the cookie. Process the
+// consent token. If the consent token is valid, store the raw consent
+// token in persistent storage. Redirect to the site's main page.
+switch ($action) {
+ case 'logout':
+ setcookie($WEBAUTHCOOKIE);
+ header("Location: $LOGOUT");
+ break;
+ case "clearcookie":
+ ob_start();
+ setcookie($WEBAUTHCOOKIE);
+
+ list($type, $response) = $wll->getClearCookieResponse();
+ header("Content-Type: $type");
+ print($response);
+
+ ob_end_flush();
+ break;
+ case 'login':
+ $user = $wll->processLogin($_REQUEST);
+
+ if ($user) {
+ if ($user->usePersistentCookie()) {
+ setcookie($WEBAUTHCOOKIE, $user->getToken(), $COOKIETTL);
+ }
+ else {
+ setcookie($WEBAUTHCOOKIE, $user->getToken());
+ }
+ header("Location: $LOGIN");
+ }
+ else {
+ setcookie($WEBAUTHCOOKIE);
+ header("Location: $LOGIN");
+ }
+ break;
+ case 'delauth':
+ $user = null;
+ $logintoken = @$_COOKIE[$WEBAUTHCOOKIE];
+
+ if ($logintoken) {
+ $user = $wll->processToken($logintoken);
+ }
+
+ if ($user) {
+ $consent = $wll->processConsent(@$_REQUEST);
+ if ($consent && $consent->isValid()) {
+ //$tokens = new TokenDB($TOKENDB);
+ //$tokens->setToken($user->getId(), $consent->getToken());
+ update_option($user->getId(),$consent->getToken());
+ } else {
+ update_option($user->getId(),"");
+ }
+ }
+ header("Location: $LOGIN");
+ break;
+ default:
+ header("Location: $LOGIN");
+ break;
+}
+?>
diff --git a/www/wp-content/plugins/social-connect/liveid/connect.php b/www/wp-content/plugins/social-connect/liveid/connect.php
new file mode 100755
index 0000000..be4a37f
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/liveid/connect.php
@@ -0,0 +1,182 @@
+$liveid_appid,"secret"=>$liveid_secret,"securityalgorithm"=>$liveid_secalgo,"returnurl"=>$liveid_return,"policyurl"=>$liveid_policy);
+
+
+if($liveid_appid && $liveid_secret && $liveid_secalgo) {
+ // Initialize the WindowsLiveLogin module.
+ $wll = WindowsLiveLogin::initFromXml(false,$liveid_settings);
+ $wll->setDebug($DEBUG);
+ $APPID = $wll->getAppId();
+
+ $login_html = "
This application does not know who you are! Click the Sign in link above.
";
+ $consent_html = null;
+
+ // If the user token obtained from sign-in through Web Authentication
+ // has been cached in a site cookie, attempt to process it and extract
+ // the user ID.
+ $token = @$_COOKIE[$WEBAUTHCOOKIE];
+
+ $userid = null;
+ if ($token) {
+ $user = $wll->processToken($token);
+ if ($user) {
+ $userid = $user->getId();
+ }
+ }
+
+ // If the user ID is obtained successfully, prepare the message
+ // to include the consent URL if a valid token is not present in the
+ // persistent store; otherwise display the contents of the token.
+ if ($userid) {
+ $login_html = "
Now this application knows that you are the user with ID = \"$userid\".
Please click here to grant consent so that we may access your Windows Live data.
";
+
+ // Attempt to get the raw consent token from persistent store for the
+ // current user ID.
+ //$tokens = new TokenDB($TOKENDB);
+ //$token = $tokens->getToken($userid);
+ $token = get_option($userid);
+
+ $consenttoken = $wll->processConsentToken($token);
+
+ if ($consenttoken) {
+ if (!$consenttoken->isValid()) {
+ wp_redirect($consenturl);
+ }
+ }
+
+
+ // If a consent token is found and is stale, try to refresh it and store
+ // it in persistent storage.
+ if ($consenttoken) {
+ if (!$consenttoken->isValid()) {
+ if ($consenttoken->refresh() && $consenttoken->isValid()) {
+ //$tokens->setToken($userid, $consenttoken->getToken());
+ update_option($userid,$consenttoken->getToken());
+ }
+ }
+
+ if ($consenttoken->isValid()) {
+ // Convert Unix epoch time stamp to user-friendly format.
+ $expiry = $consenttoken->getExpiry();
+ $expiry = date(DATE_RFC2822, $expiry);
+ //Prepare the message to display the consent token contents.
+ $consent_html = <<Consent token found! The following are its contents..
+
+
+
Delegation token
{$consenttoken->getDelegationToken()}
+
Location ID
{$consenttoken->getLocationID()}
+
Refresh token
{$consenttoken->getRefreshToken()}
+
Expiry
{$expiry}
+
Offers
{$consenttoken->getOffersString()}
+
Context
{$consenttoken->getContext()}
+
Token
{$consenttoken->getToken()}
+
+END;
+
+ }
+ }
+ }
+
+// This code embeds the Web Authentication control on your Web page
+// to display the appropriate application Sign in/Sign out link.
+$control_html = <<
+
+END;
+}
+
+if ($consenttoken) {
+
+ $dt = $consenttoken->getDelegationToken();
+ $header = array("Authorization: DelegatedToken dt=\"$dt\"\r\n");
+
+ $opts = array(
+ 'http'=>array(
+ 'method'=>'GET',
+ 'header'=>$header
+ )
+ );
+
+ $context = stream_context_create($opts);
+
+ $xml = file_get_contents("https://livecontacts.services.live.com/users/@L@" . $consenttoken->getLocationID() . "/rest/livecontacts", false, $context);
+
+ if($xml) {
+ $oSimpleXML = new SimpleXMLElement($xml);
+ $contactsArray = array();
+ $i = 0;
+ $owner = $oSimpleXML->Owner;
+ $liveid = $owner->WindowsLiveID;
+ $email = $owner->Emails->Email->Address;
+ if (trim($email) == "") {$email = $liveid;}
+ $first_name = $owner->Profiles->Personal->FirstName;
+ $last_name = $owner->Profiles->Personal->LastName;
+ $signature = social_connect_generate_signature($liveid);
+
+ }
+}
+?>
+
+
+
+
+
+
+
+
+
diff --git a/www/wp-content/plugins/social-connect/liveid/windowslivelogin.php b/www/wp-content/plugins/social-connect/liveid/windowslivelogin.php
new file mode 100755
index 0000000..3cdc9ca
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/liveid/windowslivelogin.php
@@ -0,0 +1,1606 @@
+_timestamp;
+ }
+
+ /**
+ * Sets the Unix timestamp.
+ */
+ private function setTimestamp($timestamp)
+ {
+ if (!$timestamp) {
+ throw new Exception('Error: WLL_User: Null timestamp.');
+ }
+
+ if (!preg_match('/^\d+$/', $timestamp) || ($timestamp <= 0)) {
+ throw new Exception('Error: WLL_User: Invalid timestamp: '
+ . $timestamp);
+ }
+
+ $this->_timestamp = $timestamp;
+ }
+
+ private $_id;
+
+ /**
+ * Returns the pairwise unique ID for the user.
+ */
+ public function getId()
+ {
+ return $this->_id;
+ }
+
+ /**
+ * Sets the pairwise unique ID for the user.
+ */
+ private function setId($id)
+ {
+ if (!$id) {
+ throw new Exception('Error: WLL_User: Null id.');
+ }
+
+ if (!preg_match('/^\w+$/', $id)) {
+ throw new Exception('Error: WLL_User: Invalid id: ' . $id);
+ }
+
+ $this->_id = $id;
+ }
+
+ private $_usePersistentCookie;
+
+ /**
+ * Indicates whether the application is expected to store the
+ * user token in a session or persistent cookie.
+ */
+ public function usePersistentCookie()
+ {
+ return $this->_usePersistentCookie;
+ }
+
+ /**
+ * Sets the usePersistentCookie flag for the user.
+ */
+ private function setFlags($flags)
+ {
+ $this->_usePersistentCookie = false;
+ if (preg_match('/^\d+$/', $flags)) {
+ $this->_usePersistentCookie = (($flags % 2) == 1);
+ }
+ }
+
+ private $_context;
+
+ /**
+ * Returns the application context that was originally passed
+ * to the sign-in request, if any.
+ */
+ public function getContext()
+ {
+ return $this->_context;
+ }
+
+ /**
+ * Sets the the Application context.
+ */
+ private function setContext($context)
+ {
+ $this->_context = $context;
+ }
+
+ private $_token;
+
+ /**
+ * Returns the encrypted Web Authentication token containing
+ * the UID. This can be cached in a cookie and the UID can be
+ * retrieved by calling the ProcessToken method.
+ */
+ public function getToken()
+ {
+ return $this->_token;
+ }
+
+ /**
+ * Sets the the User token.
+ */
+ private function setToken($token)
+ {
+ $this->_token = $token;
+ }
+}
+
+/**
+ * Holds the Consent Token object corresponding to consent granted.
+ */
+class WLL_ConsentToken
+{
+ /**
+ * Indicates whether the delegation token is set and has not expired.
+ */
+ public function isValid()
+ {
+ if (!self::getDelegationToken()) {
+ return false;
+ }
+
+ $now = time();
+ return (($now-300) < self::getExpiry());
+ }
+
+ /**
+ * Refreshes the current token and replace it. If operation succeeds
+ * true is returned to signify success.
+ */
+ public function refresh()
+ {
+ $wll = $this->_wll;
+ $ct = $wll->refreshConsentToken($this);
+ if (!$ct) {
+ return false;
+ }
+ self::copy($ct);
+ return true;
+ }
+
+ private $_wll;
+
+ /**
+ * Initialize the ConsentToken module with the WindowsLiveLogin,
+ * delegation token, refresh token, session key, expiry, offers,
+ * location ID, context, decoded token, and raw token.
+ */
+ public function __construct($wll, $delegationtoken, $refreshtoken,
+ $sessionkey, $expiry, $offers, $locationID, $context,
+ $decodedtoken, $token)
+ {
+ $this->_wll = $wll;
+ self::setDelegationToken($delegationtoken);
+ self::setRefreshToken($refreshtoken);
+ self::setSessionKey($sessionkey);
+ self::setExpiry($expiry);
+ self::setOffers($offers);
+ self::setLocationID($locationID);
+ self::setContext($context);
+ self::setDecodedToken($decodedtoken);
+ self::setToken($token);
+ }
+
+ private $_delegationtoken;
+
+ /**
+ * Gets the Delegation token.
+ */
+ public function getDelegationToken()
+ {
+ return $this->_delegationtoken;
+ }
+
+ /**
+ * Sets the Delegation token.
+ */
+ private function setDelegationToken($delegationtoken)
+ {
+ if (!$delegationtoken) {
+ throw new Exception('Error: WLL_ConsentToken: Null delegation token.');
+ }
+ $this->_delegationtoken = $delegationtoken;
+ }
+
+ private $_refreshtoken;
+
+ /**
+ * Gets the refresh token.
+ */
+ public function getRefreshToken()
+ {
+ return $this->_refreshtoken;
+ }
+
+ /**
+ * Sets the refresh token.
+ */
+ private function setRefreshToken($refreshtoken)
+ {
+ $this->_refreshtoken = $refreshtoken;
+ }
+
+ private $_sessionkey;
+
+ /**
+ * Gets the session key.
+ */
+ public function getSessionKey()
+ {
+ return $this->_sessionkey;
+ }
+
+ /**
+ * Sets the session key.
+ */
+ private function setSessionKey($sessionkey)
+ {
+ if (!$sessionkey) {
+ throw new Exception('Error: WLL_ConsentToken: Null session key.');
+ }
+ $this->_sessionkey = base64_decode(urldecode($sessionkey));
+ }
+
+ private $_expiry;
+
+ /**
+ * Gets the expiry time of delegation token.
+ */
+ public function getExpiry()
+ {
+ return $this->_expiry;
+ }
+
+ /**
+ * Sets the expiry time of delegation token.
+ */
+ private function setExpiry($expiry)
+ {
+ if (!$expiry) {
+ throw new Exception('Error: WLL_ConsentToken: Null expiry time.');
+ }
+
+ if (!preg_match('/^\d+$/', $expiry) || ($expiry <= 0)) {
+ throw new Exception('Error: WLL_ConsentToken: Invalid expiry time: '
+ . $expiry);
+ }
+ $this->_expiry = $expiry;
+ }
+
+ private $_offers;
+
+ /**
+ * Gets the list of offers/actions for which the user granted consent.
+ */
+ public function getOffers()
+ {
+ return $this->_offers;
+ }
+
+ private $_offers_string;
+
+ /**
+ * Gets the string representation of all the offers/actions for which
+ * the user granted consent.
+ */
+ public function getOffersString()
+ {
+ return $this->_offers_string;
+ }
+
+ /**
+ * Sets the offers/actions for which user granted consent.
+ */
+ private function setOffers($offers)
+ {
+ if (!$offers) {
+ throw new Exception('Error: WLL_ConsentToken: Null offers.');
+ }
+
+ $off_s = "";
+ $off = array();
+
+ $offers = urldecode($offers);
+ $offers = split(";", $offers);
+ foreach ($offers as $offer) {
+ $offer = split(":", $offer);
+ $offer = $offer[0];
+ if ($off_s) {
+ $off_s .= ",";
+ }
+ $off_s .= $offer;
+ $off[] = $offer;
+ }
+
+ $this->_offers_string = $off_s;
+ $this->_offers = $off;
+ }
+
+ private $_locationID;
+ /**
+ * Gets the location ID.
+ */
+ public function getLocationID()
+ {
+ return $this->_locationID;
+ }
+
+ /**
+ * Sets the location ID.
+ */
+ private function setLocationID($locationID)
+ {
+ if (!$locationID) {
+ throw new Exception('Error: WLL_ConsentToken: Null Location ID.');
+ }
+ $this->_locationID = $locationID;
+ }
+
+ private $_context;
+ /**
+ * Returns the application context that was originally passed
+ * to the sign-in request, if any.
+ */
+ public function getContext()
+ {
+ return $this->_context;
+ }
+
+ /**
+ * Sets the application context.
+ */
+ private function setContext($context)
+ {
+ $this->_context = $context;
+ }
+
+ private $_decodedtoken;
+ /**
+ * Gets the decoded token.
+ */
+ public function getDecodedToken()
+ {
+ return $this->_decodedtoken;
+ }
+
+ /**
+ * Sets the decoded token.
+ */
+ private function setDecodedToken($decodedtoken)
+ {
+ $this->_decodedtoken = $decodedtoken;
+ }
+
+ private $_token;
+
+ /**
+ * Gets the raw token.
+ */
+ public function getToken()
+ {
+ return $this->_token;
+ }
+
+ /**
+ * Sets the raw token.
+ */
+ private function setToken($token)
+ {
+ $this->_token = $token;
+ }
+
+ /**
+ * Makes a copy of the ConsentToken object.
+ */
+ private function copy($ct)
+ {
+ $this->_delegationtoken = $ct->_delegationtoken;
+ $this->_refreshtoken = $ct->_refreshtoken;
+ $this->_sessionkey = $ct->_sessionkey;
+ $this->_expiry = $ct->_expiry;
+ $this->_offers = $ct->_offers;
+ $this->_offers_string = $ct->_offers_string;
+ $this->_locationID = $ct->_locationID;
+ $this->_decodedtoken = $ct->_decodedtoken;
+ $this->_token = $ct->_token;
+ }
+}
+
+class WindowsLiveLogin
+{
+ /* Implementation of basic methods for Web Authentication support. */
+
+ private $_debug = false;
+
+ /**
+ * Stub implementation for logging errors. If you want to enable
+ * debugging output, set this to true. In this implementation
+ * errors will be logged using the PHP error_log function.
+ */
+ public function setDebug($debug)
+ {
+ $this->_debug = $debug;
+ }
+
+ /**
+ * Stub implementation for logging errors. By default, this
+ * function does nothing if the debug flag has not been set with
+ * setDebug. Otherwise, errors are logged using the PHP error_log
+ * function.
+ */
+ private function debug($string)
+ {
+ if ($this->_debug) {
+ error_log($string);
+ }
+ }
+
+ /**
+ * Stub implementation for handling a fatal error.
+ */
+ private function fatal($string)
+ {
+ self::debug($string);
+ throw new Exception($string);
+ }
+
+ /**
+ * Initialize the WindowsLiveLogin module with the application ID,
+ * secret key, and security algorithm.
+ *
+ * We recommend that you employ strong measures to protect the
+ * secret key. The secret key should never be exposed to the Web
+ * or other users.
+ *
+ * Be aware that if you do not supply these settings at
+ * initialization time, you may need to set the corresponding
+ * properties manually.
+ *
+ * For Delegated Authentication, you may optionally specify the
+ * privacy policy URL and return URL. If you do not specify these
+ * values here, the default values that you specified when you
+ * registered your application will be used.
+ *
+ * The 'force_delauth_nonprovisioned' flag also indicates whether
+ * your application is registered for Delegated Authentication
+ * (that is, whether it uses an application ID and secret key). We
+ * recommend that your Delegated Authentication application always
+ * be registered for enhanced security and functionality.
+ */
+ public function __construct($appid=null, $secret=null, $securityalgorithm=null,
+ $force_delauth_nonprovisioned=null,
+ $policyurl=null, $returnurl=null)
+ {
+ self::setForceDelAuthNonProvisioned($force_delauth_nonprovisioned);
+
+ if ($appid) {
+ self::setAppId($appid);
+ }
+ if ($secret) {
+ self::setSecret($secret);
+ }
+ if ($securityalgorithm) {
+ self::setSecurityAlgorithm($securityalgorithm);
+ }
+ if ($policyurl) {
+ self::setPolicyUrl($policyurl);
+ }
+ if ($returnurl) {
+ self::setReturnUrl($returnurl);
+ }
+ }
+
+ /**
+ * Initialize the WindowsLiveLogin module from a settings file.
+ *
+ * 'settingsFile' specifies the location of the XML settings file
+ * that contains the application ID, secret key, and security
+ * algorithm. The file is of the following format:
+ *
+ *
+ * APPID
+ * SECRET
+ * wsignin1.0
+ *
+ *
+ * In a Delegated Authentication scenario, you may also specify
+ * 'returnurl' and 'policyurl' in the settings file, as shown in the
+ * Delegated Authentication samples.
+ *
+ * We recommend that you store the WindowsLiveLogin settings file
+ * in an area on your server that cannot be accessed through the
+ * Internet. This file contains important confidential information.
+ *
+ * Function modified for social-connect to accept passed hash when
+ * xml file is not to be used.
+ */
+ public static function initFromXml($settingsFile, $settings = array())
+ {
+ $o = new WindowsLiveLogin();
+
+ if($settingsFile) {
+ $settings = $o->parseSettings($settingsFile);
+ }
+
+ if (@$settings['debug'] == 'true') {
+ $o->setDebug(true);
+ }
+ else {
+ $o->setDebug(false);
+ }
+
+ if (@$settings['force_delauth_nonprovisioned'] == 'true') {
+ $o->setForceDelAuthNonProvisioned(true);
+ }
+ else {
+ $o->setForceDelAuthNonProvisioned(false);
+ }
+
+ $o->setAppId(@$settings['appid']);
+ $o->setSecret(@$settings['secret']);
+ $o->setOldSecret(@$settings['oldsecret']);
+ $o->setOldSecretExpiry(@$settings['oldsecretexpiry']);
+ $o->setSecurityAlgorithm(@$settings['securityalgorithm']);
+ $o->setPolicyUrl(@$settings['policyurl']);
+ $o->setReturnUrl(@$settings['returnurl']);
+ $o->setBaseUrl(@$settings['baseurl']);
+ $o->setSecureUrl(@$settings['secureurl']);
+ $o->setConsentBaseUrl(@$settings['consenturl']);
+ return $o;
+ }
+
+ private $_appid;
+
+ /**
+ * Sets the application ID. Use this method if you did not specify
+ * an application ID at initialization.
+ **/
+ public function setAppId($appid)
+ {
+ $_force_delauth_nonprovisioned = $this->_force_delauth_nonprovisioned;
+ if (!$appid) {
+ if ($_force_delauth_nonprovisioned) {
+ return;
+ }
+ self::fatal('Error: setAppId: Null application ID.');
+ }
+ if (!preg_match('/^\w+$/', $appid)) {
+ self::fatal("Error: setAppId: Application ID must be alpha-numeric: $appid");
+ }
+ $this->_appid = $appid;
+ }
+
+ /**
+ * Returns the application ID.
+ */
+ public function getAppId()
+ {
+ if (!$this->_appid) {
+ self::fatal('Error: getAppId: Application ID was not set. Aborting.');
+ }
+ return $this->_appid;
+ }
+
+ private $_signkey;
+ private $_cryptkey;
+
+ /**
+ * Sets your secret key. Use this method if you did not specify
+ * a secret key at initialization.
+ */
+ public function setSecret($secret)
+ {
+ $_force_delauth_nonprovisioned = $this->_force_delauth_nonprovisioned;
+ if (!$secret || (strlen($secret) < 16)) {
+ if ($_force_delauth_nonprovisioned) {
+ return;
+ }
+ self::fatal("Error: setSecret: Secret key is expected to be non-null and longer than 16 characters.");
+ }
+
+ $this->_signkey = self::derive($secret, "SIGNATURE");
+ $this->_cryptkey = self::derive($secret, "ENCRYPTION");
+ }
+
+ private $_oldsignkey;
+ private $_oldcryptkey;
+
+ /**
+ * Sets your old secret key.
+ *
+ * Use this property to set your old secret key if you are in the
+ * process of transitioning to a new secret key. You may need this
+ * property because the Windows Live ID servers can take up to
+ * 24 hours to propagate a new secret key after you have updated
+ * your application settings.
+ *
+ * If an old secret key is specified here and has not expired
+ * (as determined by the oldsecretexpiry setting), it will be used
+ * as a fallback if token decryption fails with the new secret
+ * key.
+ */
+ public function setOldSecret($secret)
+ {
+ if (!$secret) {
+ return;
+ }
+ if (strlen($secret) < 16) {
+ self::fatal("Error: setOldSecret: Secret key is expected to be non-null and longer than 16 characters.");
+ }
+
+ $this->_oldsignkey = self::derive($secret, "SIGNATURE");
+ $this->_oldcryptkey = self::derive($secret, "ENCRYPTION");
+ }
+
+ private $_oldsecretexpiry;
+
+ /**
+ * Sets the expiry time for your old secret key.
+ *
+ * After this time has passed, the old secret key will no longer be
+ * used even if token decryption fails with the new secret key.
+ *
+ * The old secret expiry time is represented as the number of seconds
+ * elapsed since January 1, 1970.
+ */
+ public function setOldSecretExpiry($timestamp)
+ {
+ if (!$timestamp) {
+ return;
+ }
+
+ if (!preg_match('/^\d+$/', $timestamp) || ($timestamp <= 0)) {
+ self::fatal('Error: setOldSecretExpiry Invalid timestamp: '
+ . $timestamp);
+ }
+
+ $this->_oldsecretexpiry = $timestamp;
+ }
+
+ /**
+ * Gets the old secret key expiry time.
+ */
+ public function getOldSecretExpiry()
+ {
+ return $this->_oldsecretexpiry;
+ }
+
+ private $_securityalgorithm;
+
+ /**
+ * Sets the version of the security algorithm being used.
+ */
+ public function setSecurityAlgorithm($securityalgorithm)
+ {
+ $this->_securityalgorithm = $securityalgorithm;
+ }
+
+ /**
+ * Gets the version of the security algorithm being used.
+ */
+ public function getSecurityAlgorithm()
+ {
+ $securityalgorithm = $this->_securityalgorithm;
+ if (!$securityalgorithm) {
+ return 'wsignin1.0';
+ }
+ return $securityalgorithm;
+ }
+
+ private $_force_delauth_nonprovisioned;
+
+ /**
+ * Sets a flag that indicates whether Delegated Authentication
+ * is non-provisioned (i.e. does not use an application ID or secret
+ * key).
+ */
+ public function setForceDelAuthNonProvisioned($force_delauth_nonprovisioned)
+ {
+ $this->_force_delauth_nonprovisioned = $force_delauth_nonprovisioned;
+ }
+
+ private $_policyurl;
+
+ /**
+ * Sets the privacy policy URL if you did not provide one at initialization time.
+ */
+ public function setPolicyUrl($policyurl)
+ {
+ $_force_delauth_nonprovisioned = $this->_force_delauth_nonprovisioned;
+ if (!$policyurl) {
+ if ($_force_delauth_nonprovisioned) {
+ self::fatal("Error: setPolicyUrl: Null policy URL given.");
+ }
+ }
+ $this->_policyurl = $policyurl;
+ }
+
+ /**
+ * Gets the privacy policy URL for your site.
+ */
+ public function getPolicyUrl()
+ {
+ $policyurl = $this->_policyurl;
+ $_force_delauth_nonprovisioned = $this->_force_delauth_nonprovisioned;
+ if (!$policyurl) {
+ self::debug("Warning: In the initial release of Delegated Auth, a Policy URL must be configured in the SDK for both provisioned and non-provisioned scenarios.");
+ if ($_force_delauth_nonprovisioned) {
+ self::fatal("Error: getPolicyUrl: Policy URL must be set in a Del Auth non-provisioned scenario. Aborting.");
+ }
+ }
+ return $policyurl;
+ }
+
+ private $_returnurl;
+
+ /**
+ * Sets the return URL--the URL on your site to which the consent
+ * service redirects users (along with the action, consent token,
+ * and application context) after they have successfully provided
+ * consent information for Delegated Authentication. This value will
+ * override the return URL specified during registration.
+ */
+ public function setReturnUrl($returnurl)
+ {
+ $_force_delauth_nonprovisioned = $this->_force_delauth_nonprovisioned;
+ if (!$returnurl) {
+ if ($_force_delauth_nonprovisioned) {
+ self::fatal("Error: setReturnUrl: Null return URL given.");
+ }
+ }
+ $this->_returnurl = $returnurl;
+ }
+
+ /**
+ * Returns the return URL of your site.
+ */
+ public function getReturnUrl()
+ {
+ $_force_delauth_nonprovisioned = $this->_force_delauth_nonprovisioned;
+ $returnurl = $this->_returnurl;
+ if (!$returnurl) {
+ if ($_force_delauth_nonprovisioned) {
+ self::fatal("Error: getReturnUrl: Return URL must be set in a Del Auth non-provisioned scenario. Aborting.");
+ }
+ }
+ return $returnurl;
+ }
+
+ private $_baseurl;
+
+ /**
+ * Sets the base URL to use for the Windows Live Login server.
+ * You should not have to change this property. Furthermore, we recommend
+ * that you use the Sign In control instead of the URL methods
+ * provided here.
+ */
+ public function setBaseUrl($baseurl)
+ {
+ $this->_baseurl = $baseurl;
+ }
+
+ /**
+ * Gets the base URL to use for the Windows Live Login server.
+ * You should not have to use this property. Furthermore, we recommend
+ * that you use the Sign In control instead of the URL methods
+ * provided here.
+ */
+ public function getBaseUrl()
+ {
+ $baseurl = $this->_baseurl;
+ if (!$baseurl) {
+ return "http://login.live.com/";
+ }
+ return $baseurl;
+ }
+
+ private $_secureurl;
+
+ /**
+ * Sets the secure (HTTPS) URL to use for the Windows Live Login
+ * server. You should not have to change this property.
+ */
+ public function setSecureUrl($secureurl)
+ {
+ $this->_secureurl = $secureurl;
+ }
+
+ /**
+ * Gets the secure (HTTPS) URL to use for the Windows Live Login
+ * server. You should not have to use this functon directly.
+ */
+ public function getSecureUrl()
+ {
+ $secureurl = $this->_secureurl;
+ if (!$secureurl) {
+ return "https://login.live.com/";
+ }
+ return $secureurl;
+ }
+
+ private $_consenturl;
+
+ /**
+ * Sets the Consent Base URL to use for the Windows Live Consent
+ * server. You should not have to use or change this property directly.
+ */
+ public function setConsentBaseUrl($consenturl)
+ {
+ $this->_consenturl = $consenturl;
+ }
+
+ /**
+ * Gets the URL to use for the Windows Live Consent server. You
+ * should not have to use or change this directly.
+ */
+ public function getConsentBaseUrl()
+ {
+ $consenturl = $this->_consenturl;
+ if (!$consenturl) {
+ return "https://consent.live.com/";
+ }
+ return $consenturl;
+ }
+
+ /* Methods for Web Authentication support. */
+
+ /**
+ * Returns the sign-in URL to use for the Windows Live Login server.
+ * We recommend that you use the Sign In control instead.
+ *
+ * If you specify it, 'context' will be returned as-is in the sign-in
+ * response for site-specific use.
+ */
+ public function getLoginUrl($context=null, $market=null)
+ {
+ $url = self::getBaseUrl();
+ $url .= 'wlogin.srf?appid=' . self::getAppId();
+ $url .= '&alg=' . self::getSecurityAlgorithm();
+ $url .= ($context ? '&appctx=' . urlencode($context) : '');
+ $url .= ($market ? '&mkt=' . urlencode($market) : '');
+ return $url;
+ }
+
+ /**
+ * Returns the sign-out URL to use for the Windows Live Login server.
+ * We recommend that you use the Sign In control instead.
+ */
+ public function getLogoutUrl($market=null)
+ {
+ $url = self::getBaseUrl();
+ $url .= "logout.srf?appid=" . self::getAppId();
+ $url .= ($market ? '&mkt=' . urlencode($market) : '');
+ return $url;
+ }
+
+ /**
+ * Processes the sign-in response from Windows Live Login server.
+ *
+ * @param query contains the preprocessed POST query, a map of
+ * Strings to an an array of Strings, such as that
+ * returned by ServletRequest.getParameterMap().
+ * @return a User object on successful sign-in; otherwise null.
+ */
+ public function processLogin($query)
+ {
+ $action = @$query['action'];
+ if ($action != 'login') {
+ self::debug("Warning: processLogin: query action ignored: $action");
+ return;
+ }
+ $token = @$query['stoken'];
+ $context = urldecode(@$query['appctx']);
+ return self::processToken($token, $context);
+ }
+
+ /**
+ * Decodes and validates a Web Authentication token. Returns a User
+ * object on success. If a context is passed in, it will be returned
+ * as the context field in the User object.
+ */
+ public function processToken($token, $context=null)
+ {
+ if (!$token) {
+ self::debug('Error: processToken: Invalid token specified.');
+ return;
+ }
+
+ $decodedToken = self::decodeAndValidateToken($token);
+ if (!$decodedToken) {
+ self::debug("Error: processToken: Failed to decode/validate token: $token");
+ return;
+ }
+
+ $parsedToken = self::parse($decodedToken);
+ if (!$parsedToken) {
+ self::debug("Error: processToken: Failed to parse token after decoding: $token");
+ return;
+ }
+
+ $appid = self::getAppId();
+ $tokenappid = @$parsedToken['appid'];
+ if ($appid != $tokenappid) {
+ self::debug("Error: processToken: Application ID in token did not match ours: $tokenappid, $appid");
+ return;
+ }
+
+ $user = null;
+
+ try {
+ $user = new WLL_User(@$parsedToken['ts'],
+ @$parsedToken['uid'],
+ @$parsedToken['flags'],
+ $context, $token);
+ } catch (Exception $e) {
+ self::debug("Error: processToken: Contents of token considered invalid: " + $e->getMessage());
+ }
+
+ return $user;
+ }
+
+ /**
+ * Returns an appropriate content type and body response that the
+ * application handler can return to signify a successful sign-out
+ * from the application.
+ *
+ * When a user signs out of Windows Live or a Windows Live
+ * application, a best-effort attempt is made at signing the user out
+ * from all other Windows Live applications the user might be signed
+ * in to. This is done by calling the handler page for each
+ * application with 'action' set to 'clearcookie' in the query
+ * string. The application handler is then responsible for clearing
+ * any cookies or data associated with the sign-in. After successfully
+ * signing the user out, the handler should return a GIF (any GIF)
+ * image as response to the 'action=clearcookie' query.
+ */
+ public function getClearCookieResponse()
+ {
+ $type = "image/gif";
+ $content = "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAIBTAA7";
+ $content = base64_decode($content);
+ return array($type, $content);
+ }
+
+ /* Methods for Delegated Authentication. */
+
+ /*
+ * Returns the consent URL to use for Delegated Authentication for
+ * the given comma-delimited list of offers.
+ *
+ * If you specify it, 'context' will be returned as-is in the consent
+ * response for site-specific use.
+ *
+ * The registered/configured return URL can also be overridden by
+ * specifying 'ru' here.
+ *
+ * You can change the language in which the consent page is displayed
+ * by specifying a culture ID (For example, 'fr-fr' or 'en-us') in the
+ * 'market' parameter.
+ */
+ public function getConsentUrl($offers, $context=null, $ru=null, $market=null)
+ {
+ if (!$offers) {
+ throw new Exception('Error: getConsentUrl: Invalid offers list.');
+ }
+ $url = self::getConsentBaseUrl();
+ $url .= 'Delegation.aspx?ps=' . urlencode($offers);
+ $ru = ($ru ? $ru : self::getReturnUrl());
+ $url .= ($ru ? '&ru=' . urlencode($ru) : '');
+ $pl = self::getPolicyUrl();
+ $url .= ($pl ? '&pl=' . urlencode($pl) : '');
+ $url .= ($market ? '&mkt=' . urlencode($market) : '');
+ if (!$this->_force_delauth_nonprovisioned) {
+ $url .= '&app=' . self::getAppVerifier();
+ }
+ $url .= ($context ? '&appctx=' . urlencode($context) : '');
+ return $url;
+ }
+
+ /*
+ * Returns the URL to use to download a new consent token, given the
+ * offers and refresh token.
+ *
+ * The registered/configured return URL can also be overridden by
+ * specifying 'ru' here.
+ */
+ public function getRefreshConsentTokenUrl($offers, $refreshtoken, $ru=null)
+ {
+ $_force_delauth_nonprovisioned = $this->_force_delauth_nonprovisioned;
+ if (!$offers) {
+ throw new Exception('Error: getRefreshConsentTokenUrl: Invalid offers list.');
+ }
+ if (!$refreshtoken) {
+ throw new Exception('Error: getRefreshConsentTokenUrl: Invalid refresh token.');
+ }
+
+ $url = self::getConsentBaseUrl();
+ $url .= 'RefreshToken.aspx?ps=' . urlencode($offers);
+ $url .= '&reft=' . $refreshtoken;
+ $ru = ($ru ? $ru : self::getReturnUrl());
+ $url .= ($ru ? '&ru=' . urlencode($ru) : '');
+
+ if (!$this->_force_delauth_nonprovisioned) {
+ $url .= '&app=' . self::getAppVerifier();
+ }
+
+ return $url;
+ }
+
+ /*
+ * Returns the URL for the consent-management user interface.
+ *
+ * You can change the language in which the consent page is displayed
+ * by specifying a culture ID (For example, 'fr-fr' or 'en-us') in the
+ * 'market' parameter.
+ */
+ public function getManageConsentUrl($market=null)
+ {
+ $url = self::getConsentBaseUrl();
+ $url .= 'ManageConsent.aspx';
+ $url .= ($market ? '?mkt=' . urlencode($market) : '');
+ return $url;
+ }
+
+ /*
+ * Processes the POST response from the Delegated Authentication
+ * service after a user has granted consent. The processConsent
+ * function extracts the consent token string and returns the result
+ * of invoking the processConsentToken method.
+ */
+ public function processConsent($query)
+ {
+ $action = @$query['action'];
+ if ($action != 'delauth') {
+ self::debug("Warning: processConsent: query action ignored: $action");
+ return;
+ }
+ $responsecode = @$query['ResponseCode'];
+ if ($responsecode != 'RequestApproved') {
+ self::debug("Warning: processConsent: consent was not successfully granted: $responsecode");
+ return;
+ }
+ $token = @$query['ConsentToken'];
+ $context = urldecode(@$query['appctx']);
+ return self::processConsentToken($token, $context);
+ }
+
+ /*
+ * Processes the consent token string that is returned in the POST
+ * response by the Delegated Authentication service after a
+ * user has granted consent.
+ */
+ public function processConsentToken($token, $context=null)
+ {
+ if (!$token) {
+ self::debug('Error: processConsentToken: Null token.');
+ return;
+ }
+
+ $decodedToken = $token;
+ $parsedToken = self::parse(urldecode($decodedToken));
+ if (!$parsedToken) {
+ self::debug("Error: processConsentToken: Failed to parse token: $token");
+ return;
+ }
+
+ $eact = @$parsedToken['eact'];
+ if ($eact) {
+ $decodedToken = self::decodeAndValidateToken($eact);
+ if (!$decodedToken) {
+ self::debug("Error: processConsentToken: Failed to decode/validate token: $token");
+ return;
+ }
+ $parsedToken = self::parse($decodedToken);
+ if (!$parsedToken) {
+ self::debug("Error: processConsentToken: Failed to parse token after decoding: $token");
+ return;
+ }
+ $decodedToken = urlencode($decodedToken);
+ }
+
+ $consenttoken = null;
+
+ try {
+ $consenttoken = new WLL_ConsentToken($this,
+ @$parsedToken['delt'],
+ @$parsedToken['reft'],
+ @$parsedToken['skey'],
+ @$parsedToken['exp'],
+ @$parsedToken['offer'],
+ @$parsedToken['lid'],
+ $context, $decodedToken, $token);
+ } catch (Exception $e) {
+ self::debug("Error: processConsentToken: Contents of token considered invalid: " + $e->getMessage());
+ }
+ return $consenttoken;
+ }
+
+ /*
+ * Attempts to obtain a new, refreshed token and return it. The
+ * original token is not modified.
+ */
+ public function refreshConsentToken($token, $ru=null)
+ {
+ if (!$token) {
+ self::debug("Error: refreshConsentToken: Null consent token.");
+ return;
+ }
+ self::refreshConsentToken2($token->getOffersString(), $token->getRefreshToken(), $ru);
+ }
+
+ /*
+ * Helper function to obtain a new, refreshed token and return it.
+ * The original token is not modified.
+ */
+ public function refreshConsentToken2($offers_string, $refreshtoken, $ru=null)
+ {
+ $body = self::fetch(self::getRefreshConsentTokenUrl($offers_string, $refreshtoken, $ru));
+ if (!$body) {
+ self::debug("Error: refreshConsentToken2: Failed to obtain a new token.");
+ return;
+ }
+
+ preg_match('/\{"ConsentToken":"(.*)"\}/', $body, $matches);
+ if(count($matches) == 2) {
+ return $matches[1];
+ }
+ else {
+ self::debug("Error: refreshConsentToken2: Failed to extract token: $body");
+ return;
+ }
+ }
+
+ /* Common methods. */
+
+ /*
+ * Decodes and validates the token.
+ */
+ public function decodeAndValidateToken($token, $cryptkey=null, $signkey=null,
+ $internal_allow_recursion=true)
+ {
+ if (!$cryptkey) {
+ $cryptkey = $this->_cryptkey;
+ }
+ if (!$signkey) {
+ $signkey = $this->_signkey;
+ }
+
+ $haveoldsecret = false;
+ $oldsecretexpiry = self::getOldSecretExpiry();
+ $oldcryptkey = $this->_oldcryptkey;
+ $oldsignkey = $this->_oldsignkey;
+
+ if ($oldsecretexpiry and (time() < $oldsecretexpiry)) {
+ if ($oldcryptkey and $oldsignkey) {
+ $haveoldsecret = true;
+ }
+ }
+ $haveoldsecret = ($haveoldsecret and $internal_allow_recursion);
+
+ $stoken = self::decodeToken($token, $cryptkey);
+
+ if ($stoken) {
+ $stoken = self::validateToken($stoken, $signkey);
+ }
+
+ if (!$stoken and $haveoldsecret) {
+ self::debug("Warning: Failed to validate token with current secret, attempting old secret.");
+ $stoken =
+ self::decodeAndValidateToken($token, $oldcryptkey, $oldsignkey, false);
+ }
+
+ return $stoken;
+ }
+
+ /**
+ * Decodes the given token string; returns undef on failure.
+ *
+ * First, the string is URL-unescaped and base64 decoded.
+ * Second, the IV is extracted from the first 16 bytes of the string.
+ * Finally, the string is decrypted using the encryption key.
+ */
+ public function decodeToken($token, $cryptkey=null)
+ {
+ if (!$cryptkey) {
+ $cryptkey = $this->_cryptkey;
+ }
+ if (!$cryptkey) {
+ self::fatal("Error: decodeToken: Secret key was not set. Aborting.");
+ }
+
+ $ivLen = 16;
+ $token = self::u64($token);
+ $len = strlen($token);
+
+ if (!$token || ($len <= $ivLen) || (($len % $ivLen) != 0)) {
+ self::debug("Error: decodeToken: Attempted to decode invalid token.");
+ return;
+ }
+
+ $iv = substr($token, 0, 16);
+ $crypted = substr($token, 16);
+ $mode = MCRYPT_MODE_CBC;
+ $enc = MCRYPT_RIJNDAEL_128;
+ return mcrypt_decrypt($enc, $cryptkey, $crypted, $mode, $iv);
+ }
+
+ /**
+ * Creates a signature for the given string by using the signature
+ * key.
+ */
+ public function signToken($token, $signkey=null)
+ {
+ if (!$signkey) {
+ $signkey = $this->_signkey;
+ }
+ if (!$signkey) {
+ self::fatal("Error: signToken: Secret key was not set. Aborting.");
+ }
+
+ if (!$token) {
+ self::debug("Attempted to sign null token.");
+ return;
+ }
+
+ return hash_hmac("sha256", $token, $signkey, true);
+ }
+
+ /**
+ * Extracts the signature from the token and validates it.
+ */
+ public function validateToken($token, $signkey=null)
+ {
+ if (!$signkey) {
+ $signkey = $this->_signkey;
+ }
+ if (!$token) {
+ self::debug("Error: validateToken: Invalid token.");
+ return;
+ }
+
+ $split = split("&sig=", $token);
+ if (count($split) != 2) {
+ self::debug("ERROR: validateToken: Invalid token: $token");
+ return;
+ }
+ list($body, $sig) = $split;
+
+ $sig = self::u64($sig);
+ if (!$sig) {
+ self::debug("Error: validateToken: Could not extract signature from token.");
+ return;
+ }
+
+ $sig2 = self::signToken($body, $signkey);
+ if (!$sig2) {
+ self::debug("Error: validateToken: Could not generate signature for the token.");
+ return;
+ }
+
+
+ if ($sig == $sig2) {
+ return $token;
+ }
+
+ self::debug("Error: validateToken: Signature did not match.");
+ return;
+ }
+
+ /* Implementation of the methods needed to perform Windows Live
+ application verification as well as trusted sign-in. */
+
+ /**
+ * Generates an application verifier token. An IP address can
+ * optionally be included in the token.
+ */
+ public function getAppVerifier($ip=null)
+ {
+ $token = 'appid=' . self::getAppId() . '&ts=' . self::getTimestamp();
+ $token .= ($ip ? "&ip={$ip}" : '');
+ $token .= '&sig=' . self::e64(self::signToken($token));
+ return urlencode($token);
+ }
+
+ /**
+ * Returns the URL that is required to retrieve the application
+ * security token.
+ *
+ * By default, the application security token is generated for
+ * the Windows Live site; a specific Site ID can optionally be
+ * specified in 'siteid'. The IP address can also optionally be
+ * included in 'ip'.
+ *
+ * If 'js' is nil, a JavaScript Output Notation (JSON) response is
+ * returned in the following format:
+ *
+ * {"token":""}
+ *
+ * Otherwise, a JavaScript response is returned. It is assumed that
+ * WLIDResultCallback is a custom function implemented to handle the
+ * token value:
+ *
+ * WLIDResultCallback("");
+ */
+ public function getAppLoginUrl($siteid=null, $ip=null, $js=null)
+ {
+ $url = self::getSecureUrl();
+ $url .= 'wapplogin.srf?app=' . self::getAppVerifier($ip);
+ $url .= '&alg=' . self::getSecurityAlgorithm();
+ $url .= ($siteid ? "&id=$siteid" : '');
+ $url .= ($js ? '&js=1' : '');
+ return $url;
+ }
+
+ /**
+ * Retrieves the application security token for application
+ * verification from the application sign-in URL.
+ *
+ * By default, the application security token will be generated for
+ * the Windows Live site; a specific Site ID can optionally be
+ * specified in 'siteid'. The IP address can also optionally be
+ * included in 'ip'.
+ *
+ * Implementation note: The application security token is downloaded
+ * from the application sign-in URL in JSON format:
+ *
+ * {"token":""}
+ *
+ * Therefore we must extract from the string and return it as
+ * seen here.
+ */
+ public function getAppSecurityToken($siteid=null, $ip=null)
+ {
+ $body = self::fetch(self::getAppLoginUrl($siteid, $ip));
+ if (!$body) {
+ self::debug("Error: getAppSecurityToken: Could not fetch the application security token.");
+ return;
+ }
+
+ preg_match('/\{"token":"(.*)"\}/', $body, $matches);
+ if(count($matches) == 2) {
+ return $matches[1];
+ }
+ else {
+ self::debug("Error: getAppSecurityToken: Failed to extract token: $body");
+ return;
+ }
+ }
+
+ /**
+ * Returns a string that can be passed to the getTrustedParams
+ * function as the 'retcode' parameter. If this is specified as the
+ * 'retcode', the application will be used as return URL after it
+ * finishes trusted sign-in.
+ */
+ public function getAppRetCode()
+ {
+ return 'appid=' . self::getAppId();
+ }
+
+ /**
+ * Returns a table of key-value pairs that must be posted to the
+ * sign-in URL for trusted sign-in. Use HTTP POST to do this. Be aware
+ * that the values in the table are neither URL nor HTML escaped and
+ * may have to be escaped if you are inserting them in code such as
+ * an HTML form.
+ *
+ * The user to be trusted on the local site is passed in as string
+ * 'user'.
+ *
+ * Optionally, 'retcode' specifies the resource to which successful
+ * sign-in is redirected, such as Windows Live Mail, and is typically
+ * a string in the format 'id=2000'. If you pass in the value from
+ * getAppRetCode instead, sign-in will be redirected to the
+ * application. Otherwise, an HTTP 200 response is returned.
+ */
+ public function getTrustedParams($user, $retcode=null)
+ {
+ $token = self::getTrustedToken($user);
+ if (!$token) {
+ return;
+ }
+ $token = "$tokenuri:WindowsLiveID";
+
+ $params = array();
+ $params['wa'] = self::getSecurityAlgorithm();
+ $params['wresult'] = $token;
+
+ if ($retcode) {
+ $params['wctx'] = $retcode;
+ }
+
+ return $params;
+ }
+
+ /**
+ * Returns the trusted sign-in token in the format that is needed by a
+ * control doing trusted sign-in.
+ *
+ * The user to be trusted on the local site is passed in as string
+ * 'user'.
+ */
+ public function getTrustedToken($user)
+ {
+ if (!$user) {
+ self::debug('Error: getTrustedToken: Null user specified.');
+ return;
+ }
+
+ $token = "appid=" . self::getAppId() . "&uid=" . urlencode($user)
+ . "&ts=". self::getTimestamp();
+ $token .= "&sig=" . self::e64(self::signToken($token));
+ return urlencode($token);
+ }
+
+ /**
+ * Returns the trusted sign-in URL to use for Windows Live Login server.
+ */
+ public function getTrustedLoginUrl()
+ {
+ return self::getSecureUrl() . 'wlogin.srf';
+ }
+
+ /**
+ * Returns the trusted sign-in URL to use for Windows Live
+ * Login server.
+ */
+ public function getTrustedLogoutUrl()
+ {
+ return self::getSecureUrl() . "logout.srf?appid=" + self::getAppId();
+ }
+
+ /* Helper methods */
+
+ /**
+ * Function to parse the settings file.
+ */
+ private function parseSettings($settingsFile)
+ {
+ $settings = array();
+ $doc = new DOMDocument();
+ if (!$doc->load($settingsFile)) {
+ self::fatal("Error: parseSettings: Error while reading $settingsFile");
+ }
+
+ $nl = $doc->getElementsByTagName('windowslivelogin');
+ if($nl->length != 1) {
+ self::fatal("error: parseSettings: Failed to parse settings file:"
+ . $settingsFile);
+ }
+
+ $topnode = $nl->item(0);
+ foreach ($topnode->childNodes as $node) {
+ if ($node->nodeType == XML_ELEMENT_NODE) {
+ $firstChild = $node->firstChild;
+ if (!$firstChild) {
+ self::fatal("error: parseSettings: Failed to parse settings file:"
+ . $settingsFile);
+ }
+ $settings[$node->nodeName] = $firstChild->nodeValue;
+ }
+ }
+
+ return $settings;
+ }
+
+ /**
+ * Derives the key, given the secret key and prefix as described in the
+ * Web Authentication SDK documentation.
+ */
+ private function derive($secret, $prefix)
+ {
+ if (!$secret || !$prefix) {
+ self::fatal("Error: derive: secret or prefix is null.");
+ }
+
+ $keyLen = 16;
+ $key = $prefix . $secret;
+ $key = mhash(MHASH_SHA256, $key);
+ if (!$key || (strlen($key) < $keyLen)) {
+ self::debug("Error: derive: Unable to derive key.");
+ return;
+ }
+
+ return substr($key, 0, $keyLen);
+ }
+
+ /**
+ * Parses query string and returns a hash.
+ *
+ * If a hash ref is passed in from CGI->Var, it is dereferenced and
+ * returned.
+ */
+ private function parse($input)
+ {
+ if (!$input) {
+ self::debug("Error: parse: Null input.");
+ return;
+ }
+
+ $input = split('&', $input);
+ $pairs = array();
+
+ foreach ($input as $pair) {
+ $kv = split('=', $pair);
+ if (count($kv) != 2) {
+ self::debug("Error: parse: Bad input to parse: " . $pair);
+ return;
+ }
+ $pairs[$kv[0]] = $kv[1];
+ }
+
+ return $pairs;
+ }
+
+ /**
+ * Generates a time stamp suitable for the application verifier
+ * token.
+ */
+ private function getTimestamp()
+ {
+ return time();
+ }
+
+ /**
+ * Base64-encodes and URL-escapes a string.
+ */
+ private function e64($input)
+ {
+ if (is_null($input)) {
+ return;
+ }
+ return urlencode(base64_encode($input));
+ }
+
+ /**
+ * URL-unescapes and Base64-decodes a string.
+ */
+ private function u64($input)
+ {
+ if(is_null($input))
+ return;
+ return base64_decode(urldecode($input));
+ }
+
+ /**
+ * Fetches the contents given a URL.
+ */
+ private function fetch($url)
+ {
+ if (!($handle = fopen($url, "rb"))) {
+ self::debug("error: fetch: Could not open url: $url");
+ return;
+ }
+
+ if (!($contents = stream_get_contents($handle))) {
+ self::debug("Error: fetch: Could not read from url: $url");
+ }
+
+ fclose($handle);
+ return $contents;
+ }
+}
+?>
diff --git a/www/wp-content/plugins/social-connect/media.php b/www/wp-content/plugins/social-connect/media.php
new file mode 100755
index 0000000..a8e863a
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/media.php
@@ -0,0 +1,47 @@
+");
+ jQuery('#loginform').append("");
+ }
+ }
+
+ jQuery.each(config, function(key, value) {
+ jQuery("#" + key).remove();
+ jQuery(form_id).append("");
+ });
+
+ if(jQuery("#simplemodal-login-form").length) {
+ var current_url = window.location.href;
+ jQuery("#redirect_to").remove();
+ jQuery(form_id).append("");
+ }
+
+ jQuery(form_id).submit();
+}
diff --git a/www/wp-content/plugins/social-connect/openid/connect.php b/www/wp-content/plugins/social-connect/openid/connect.php
new file mode 100755
index 0000000..02391e1
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/openid/connect.php
@@ -0,0 +1,45 @@
+identity = urldecode($_GET['openid_url']);
+ $openid->required = array('namePerson/first', 'namePerson/last', 'contact/email');
+ header('Location: ' . $openid->authUrl());
+ } else {
+ $openid = new LightOpenID;
+ if($openid->validate()) {
+ $open_id = $openid->identity;
+ $attributes = $openid->getAttributes();
+ $email = $attributes['contact/email'];
+ $first_name = $attributes['namePerson/first'];
+ $last_name = $attributes['namePerson/last'];
+ $signature = social_connect_generate_signature($open_id);
+ ?>
+
+
+
+
+
+
+
+ getMessage();
+}
+?>
diff --git a/www/wp-content/plugins/social-connect/openid/openid.php b/www/wp-content/plugins/social-connect/openid/openid.php
new file mode 100755
index 0000000..126896b
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/openid/openid.php
@@ -0,0 +1,706 @@
+
+* $openid = new LightOpenID;
+* $openid->identity = 'ID supplied by user';
+* header('Location: ' . $openid->authUrl());
+*
+* The provider then sends various parameters via GET, one of them is openid_mode.
+* Step two is verification:
+*
+* if ($this->data['openid_mode']) {
+* $openid = new LightOpenID;
+* echo $openid->validate() ? 'Logged in.' : 'Failed';
+* }
+*
+*
+* Optionally, you can set $returnUrl and $realm (or $trustRoot, which is an alias).
+* The default values for those are:
+* $openid->realm = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
+* $openid->returnUrl = $openid->realm . $_SERVER['REQUEST_URI']; # without the query part, if present
+* If you don't know their meaning, refer to any openid tutorial, or specification. Or just guess.
+*
+* AX and SREG extensions are supported.
+* To use them, specify $openid->required and/or $openid->optional before calling $openid->authUrl().
+* These are arrays, with values being AX schema paths (the 'path' part of the URL).
+* For example:
+* $openid->required = array('namePerson/friendly', 'contact/email');
+* $openid->optional = array('namePerson/first');
+* If the server supports only SREG or OpenID 1.1, these are automaticaly
+* mapped to SREG names, so that user doesn't have to know anything about the server.
+*
+* To get the values, use $openid->getAttributes().
+*
+*
+* The library requires PHP >= 5.1.2 with curl or http/https stream wrappers enabled..
+* @author Mewp
+* @copyright Copyright (c) 2010, Mewp
+* @license http://www.opensource.org/licenses/mit-license.php MIT
+*/
+class LightOpenID
+{
+ public $returnUrl
+ , $required = array()
+ , $optional = array();
+ private $identity, $claimed_id;
+ protected $server, $version, $trustRoot, $aliases, $identifier_select = false
+ , $ax = false, $sreg = false, $data;
+ static protected $ax_to_sreg = array(
+ 'namePerson/friendly' => 'nickname',
+ 'contact/email' => 'email',
+ 'namePerson' => 'fullname',
+ 'birthDate' => 'dob',
+ 'person/gender' => 'gender',
+ 'contact/postalCode/home' => 'postcode',
+ 'contact/country/home' => 'country',
+ 'pref/language' => 'language',
+ 'pref/timezone' => 'timezone',
+ );
+
+ function __construct()
+ {
+ $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
+ $uri = $_SERVER['REQUEST_URI'];
+ $uri = strpos($uri, '?') ? substr($uri, 0, strpos($uri, '?')) : $uri;
+ $this->returnUrl = $this->trustRoot . $uri;
+
+ $this->data = $_POST + $_GET; # OPs may send data as POST or GET.
+ }
+
+ function __set($name, $value)
+ {
+ switch ($name) {
+ case 'identity':
+ if (strlen($value = trim((String) $value))) {
+ if (preg_match('#^xri:/*#i', $value, $m)) {
+ $value = substr($value, strlen($m[0]));
+ } elseif (!preg_match('/^(?:[=@+\$!\(]|https?:)/i', $value)) {
+ $value = "http://$value";
+ }
+ if (preg_match('#^https?://[^/]+$#i', $value, $m)) {
+ $value .= '/';
+ }
+ }
+ $this->$name = $this->claimed_id = $value;
+ break;
+ case 'trustRoot':
+ case 'realm':
+ $this->trustRoot = trim($value);
+ }
+ }
+
+ function __get($name)
+ {
+ switch ($name) {
+ case 'identity':
+ # We return claimed_id instead of identity,
+ # because the developer should see the claimed identifier,
+ # i.e. what he set as identity, not the op-local identifier (which is what we verify)
+ return $this->claimed_id;
+ case 'trustRoot':
+ case 'realm':
+ return $this->trustRoot;
+ }
+ }
+
+ /**
+ * Checks if the server specified in the url exists.
+ *
+ * @param $url url to check
+ * @return true, if the server exists; false otherwise
+ */
+ function hostExists($url)
+ {
+ if (strpos($url, '/') === false) {
+ $server = $url;
+ } else {
+ $server = @parse_url($url, PHP_URL_HOST);
+ }
+
+ if (!$server) {
+ return false;
+ }
+
+ return !!gethostbynamel($server);
+ }
+
+ protected function request_curl($url, $method='GET', $params=array())
+ {
+ $params = http_build_query($params, '', '&');
+ $curl = curl_init($url . ($method == 'GET' && $params ? '?' . $params : ''));
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($curl, CURLOPT_HEADER, false);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xrds+xml, */*'));
+ if ($method == 'POST') {
+ curl_setopt($curl, CURLOPT_POST, true);
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
+ } elseif ($method == 'HEAD') {
+ curl_setopt($curl, CURLOPT_HEADER, true);
+ curl_setopt($curl, CURLOPT_NOBODY, true);
+ } else {
+ curl_setopt($curl, CURLOPT_HTTPGET, true);
+ }
+ $response = curl_exec($curl);
+
+ if($method == 'HEAD') {
+ $headers = array();
+ foreach(explode("\n", $response) as $header) {
+ $pos = strpos($header,':');
+ $name = strtolower(trim(substr($header, 0, $pos)));
+ $headers[$name] = trim(substr($header, $pos+1));
+ }
+
+ # Updating claimed_id in case of redirections.
+ $effective_url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
+ if($effective_url != $url) {
+ $this->claimed_id = $effective_url;
+ }
+
+ return $headers;
+ }
+
+ if (curl_errno($curl)) {
+ throw new ErrorException(curl_error($curl), curl_errno($curl));
+ }
+
+ return $response;
+ }
+
+ protected function request_streams($url, $method='GET', $params=array())
+ {
+ if(!$this->hostExists($url)) {
+ throw new ErrorException('Invalid request.');
+ }
+
+ $params = http_build_query($params, '', '&');
+ switch($method) {
+ case 'GET':
+ $opts = array(
+ 'http' => array(
+ 'method' => 'GET',
+ 'header' => 'Accept: application/xrds+xml, */*',
+ 'ignore_errors' => true,
+ )
+ );
+ $url = $url . ($params ? '?' . $params : '');
+ break;
+ case 'POST':
+ $opts = array(
+ 'http' => array(
+ 'method' => 'POST',
+ 'header' => 'Content-type: application/x-www-form-urlencoded',
+ 'content' => $params,
+ 'ignore_errors' => true,
+ )
+ );
+ break;
+ case 'HEAD':
+ # We want to send a HEAD request,
+ # but since get_headers doesn't accept $context parameter,
+ # we have to change the defaults.
+ $default = stream_context_get_options(stream_context_get_default());
+ stream_context_get_default(
+ array('http' => array(
+ 'method' => 'HEAD',
+ 'header' => 'Accept: application/xrds+xml, */*',
+ 'ignore_errors' => true,
+ ))
+ );
+
+ $url = $url . ($params ? '?' . $params : '');
+ $headers_tmp = get_headers ($url);
+ if(!$headers_tmp) {
+ return array();
+ }
+
+ # Parsing headers.
+ $headers = array();
+ foreach($headers_tmp as $header) {
+ $pos = strpos($header,':');
+ $name = strtolower(trim(substr($header, 0, $pos)));
+ $headers[$name] = trim(substr($header, $pos+1));
+
+ # Following possible redirections. The point is just to have
+ # claimed_id change with them, because get_headers() will
+ # follow redirections automatically.
+ # We ignore redirections with relative paths.
+ # If any known provider uses them, file a bug report.
+ if($name == 'location') {
+ if(strpos($headers[$name], 'http') === 0) {
+ $this->claimed_id = $headers[$name];
+ } elseif($headers[$name][0] == '/') {
+ $parsed_url = parse_url($this->claimed_id);
+ $this->claimed_id = $parsed_url['scheme'] . '://'
+ . $parsed_url['host']
+ . $headers[$name];
+ }
+ }
+ }
+
+ # And restore them.
+ stream_context_get_default($default);
+ return $headers;
+ }
+ $context = stream_context_create ($opts);
+
+ return file_get_contents($url, false, $context);
+ }
+
+ protected function request($url, $method='GET', $params=array())
+ {
+ if(function_exists('curl_init') && !ini_get('safe_mode')) {
+ return $this->request_curl($url, $method, $params);
+ }
+ return $this->request_streams($url, $method, $params);
+ }
+
+ protected function build_url($url, $parts)
+ {
+ if (isset($url['query'], $parts['query'])) {
+ $parts['query'] = $url['query'] . '&' . $parts['query'];
+ }
+
+ $url = $parts + $url;
+ $url = $url['scheme'] . '://'
+ . (empty($url['username'])?''
+ :(empty($url['password'])? "{$url['username']}@"
+ :"{$url['username']}:{$url['password']}@"))
+ . $url['host']
+ . (empty($url['port'])?'':":{$url['port']}")
+ . (empty($url['path'])?'':$url['path'])
+ . (empty($url['query'])?'':"?{$url['query']}")
+ . (empty($url['fragment'])?'':":{$url['fragment']}");
+ return $url;
+ }
+
+ /**
+ * Helper function used to scan for / tags and extract information
+ * from them
+ */
+ protected function htmlTag($content, $tag, $attrName, $attrValue, $valueName)
+ {
+ preg_match_all("#<{$tag}[^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*$valueName=['\"](.+?)['\"][^>]*/?>#i", $content, $matches1);
+ preg_match_all("#<{$tag}[^>]*$valueName=['\"](.+?)['\"][^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*/?>#i", $content, $matches2);
+
+ $result = array_merge($matches1[1], $matches2[1]);
+ return empty($result)?false:$result[0];
+ }
+
+ /**
+ * Performs Yadis and HTML discovery. Normally not used.
+ * @param $url Identity URL.
+ * @return String OP Endpoint (i.e. OpenID provider address).
+ * @throws ErrorException
+ */
+ function discover($url)
+ {
+ if (!$url) throw new ErrorException('No identity supplied.');
+ # Use xri.net proxy to resolve i-name identities
+ if (!preg_match('#^https?:#', $url)) {
+ $url = "https://xri.net/$url";
+ }
+
+ # We save the original url in case of Yadis discovery failure.
+ # It can happen when we'll be lead to an XRDS document
+ # which does not have any OpenID2 services.
+ $originalUrl = $url;
+
+ # A flag to disable yadis discovery in case of failure in headers.
+ $yadis = true;
+
+ # We'll jump a maximum of 5 times, to avoid endless redirections.
+ for ($i = 0; $i < 5; $i ++) {
+ if ($yadis) {
+ $headers = $this->request($url, 'HEAD');
+
+ $next = false;
+ if (isset($headers['x-xrds-location'])) {
+ $url = $this->build_url(parse_url($url), parse_url(trim($headers['x-xrds-location'])));
+ $next = true;
+ }
+
+ if (isset($headers['content-type'])
+ && strpos($headers['content-type'], 'application/xrds+xml') !== false
+ ) {
+ # Found an XRDS document, now let's find the server, and optionally delegate.
+ $content = $this->request($url, 'GET');
+
+ preg_match_all('#(.*?)#s', $content, $m);
+ foreach($m[1] as $content) {
+ $content = ' ' . $content; # The space is added, so that strpos doesn't return 0.
+
+ # OpenID 2
+ $ns = preg_quote('http://specs.openid.net/auth/2.0/');
+ if(preg_match('#\s*'.$ns.'(server|signon)\s*#s', $content, $type)) {
+ if ($type[1] == 'server') $this->identifier_select = true;
+
+ preg_match('#(.*)#', $content, $server);
+ preg_match('#<(Local|Canonical)ID>(.*)\1ID>#', $content, $delegate);
+ if (empty($server)) {
+ return false;
+ }
+ # Does the server advertise support for either AX or SREG?
+ $this->ax = (bool) strpos($content, 'http://openid.net/srv/ax/1.0');
+ $this->sreg = strpos($content, 'http://openid.net/sreg/1.0')
+ || strpos($content, 'http://openid.net/extensions/sreg/1.1');
+
+ $server = $server[1];
+ if (isset($delegate[2])) $this->identity = trim($delegate[2]);
+ $this->version = 2;
+
+ $this->server = $server;
+ return $server;
+ }
+
+ # OpenID 1.1
+ $ns = preg_quote('http://openid.net/signon/1.1');
+ if (preg_match('#\s*'.$ns.'\s*#s', $content)) {
+
+ preg_match('#(.*)#', $content, $server);
+ preg_match('#<.*?Delegate>(.*)#', $content, $delegate);
+ if (empty($server)) {
+ return false;
+ }
+ # AX can be used only with OpenID 2.0, so checking only SREG
+ $this->sreg = strpos($content, 'http://openid.net/sreg/1.0')
+ || strpos($content, 'http://openid.net/extensions/sreg/1.1');
+
+ $server = $server[1];
+ if (isset($delegate[1])) $this->identity = $delegate[1];
+ $this->version = 1;
+
+ $this->server = $server;
+ return $server;
+ }
+ }
+
+ $next = true;
+ $yadis = false;
+ $url = $originalUrl;
+ $content = null;
+ break;
+ }
+ if ($next) continue;
+
+ # There are no relevant information in headers, so we search the body.
+ $content = $this->request($url, 'GET');
+ if ($location = $this->htmlTag($content, 'meta', 'http-equiv', 'X-XRDS-Location', 'content')) {
+ $url = $this->build_url(parse_url($url), parse_url($location));
+ continue;
+ }
+ }
+
+ if (!$content) $content = $this->request($url, 'GET');
+
+ # At this point, the YADIS Discovery has failed, so we'll switch
+ # to openid2 HTML discovery, then fallback to openid 1.1 discovery.
+ $server = $this->htmlTag($content, 'link', 'rel', 'openid2.provider', 'href');
+ $delegate = $this->htmlTag($content, 'link', 'rel', 'openid2.local_id', 'href');
+ $this->version = 2;
+
+ if (!$server) {
+ # The same with openid 1.1
+ $server = $this->htmlTag($content, 'link', 'rel', 'openid.server', 'href');
+ $delegate = $this->htmlTag($content, 'link', 'rel', 'openid.delegate', 'href');
+ $this->version = 1;
+ }
+
+ if ($server) {
+ # We found an OpenID2 OP Endpoint
+ if ($delegate) {
+ # We have also found an OP-Local ID.
+ $this->identity = $delegate;
+ }
+ $this->server = $server;
+ return $server;
+ }
+
+ throw new ErrorException('No servers found!');
+ }
+ throw new ErrorException('Endless redirection!');
+ }
+
+ protected function sregParams()
+ {
+ $params = array();
+ # We always use SREG 1.1, even if the server is advertising only support for 1.0.
+ # That's because it's fully backwards compatibile with 1.0, and some providers
+ # advertise 1.0 even if they accept only 1.1. One such provider is myopenid.com
+ $params['openid.ns.sreg'] = 'http://openid.net/extensions/sreg/1.1';
+ if ($this->required) {
+ $params['openid.sreg.required'] = array();
+ foreach ($this->required as $required) {
+ if (!isset(self::$ax_to_sreg[$required])) continue;
+ $params['openid.sreg.required'][] = self::$ax_to_sreg[$required];
+ }
+ $params['openid.sreg.required'] = implode(',', $params['openid.sreg.required']);
+ }
+
+ if ($this->optional) {
+ $params['openid.sreg.optional'] = array();
+ foreach ($this->optional as $optional) {
+ if (!isset(self::$ax_to_sreg[$optional])) continue;
+ $params['openid.sreg.optional'][] = self::$ax_to_sreg[$optional];
+ }
+ $params['openid.sreg.optional'] = implode(',', $params['openid.sreg.optional']);
+ }
+ return $params;
+ }
+
+ protected function axParams()
+ {
+ $params = array();
+ if ($this->required || $this->optional) {
+ $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
+ $params['openid.ax.mode'] = 'fetch_request';
+ $this->aliases = array();
+ $counts = array();
+ $required = array();
+ $optional = array();
+ foreach (array('required','optional') as $type) {
+ foreach ($this->$type as $alias => $field) {
+ if (is_int($alias)) $alias = strtr($field, '/', '_');
+ $this->aliases[$alias] = 'http://axschema.org/' . $field;
+ if (empty($counts[$alias])) $counts[$alias] = 0;
+ $counts[$alias] += 1;
+ ${$type}[] = $alias;
+ }
+ }
+ foreach ($this->aliases as $alias => $ns) {
+ $params['openid.ax.type.' . $alias] = $ns;
+ }
+ foreach ($counts as $alias => $count) {
+ if ($count == 1) continue;
+ $params['openid.ax.count.' . $alias] = $count;
+ }
+
+ # Don't send empty ax.requied and ax.if_available.
+ # Google and possibly other providers refuse to support ax when one of these is empty.
+ if($required) {
+ $params['openid.ax.required'] = implode(',', $required);
+ }
+ if($optional) {
+ $params['openid.ax.if_available'] = implode(',', $optional);
+ }
+ }
+ return $params;
+ }
+
+ protected function authUrl_v1()
+ {
+ $returnUrl = $this->returnUrl;
+ # If we have an openid.delegate that is different from our claimed id,
+ # we need to somehow preserve the claimed id between requests.
+ # The simplest way is to just send it along with the return_to url.
+ if($this->identity != $this->claimed_id) {
+ $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?') . 'openid.claimed_id=' . $this->claimed_id;
+ }
+
+ $params = array(
+ 'openid.return_to' => $returnUrl,
+ 'openid.mode' => 'checkid_setup',
+ 'openid.identity' => $this->identity,
+ 'openid.trust_root' => $this->trustRoot,
+ ) + $this->sregParams();
+
+ return $this->build_url(parse_url($this->server)
+ , array('query' => http_build_query($params, '', '&')));
+ }
+
+ protected function authUrl_v2($identifier_select)
+ {
+ $params = array(
+ 'openid.ns' => 'http://specs.openid.net/auth/2.0',
+ 'openid.mode' => 'checkid_setup',
+ 'openid.return_to' => $this->returnUrl,
+ 'openid.realm' => $this->trustRoot,
+ );
+ if ($this->ax) {
+ $params += $this->axParams();
+ }
+ if ($this->sreg) {
+ $params += $this->sregParams();
+ }
+ if (!$this->ax && !$this->sreg) {
+ # If OP doesn't advertise either SREG, nor AX, let's send them both
+ # in worst case we don't get anything in return.
+ $params += $this->axParams() + $this->sregParams();
+ }
+
+ if ($identifier_select) {
+ $params['openid.identity'] = $params['openid.claimed_id']
+ = 'http://specs.openid.net/auth/2.0/identifier_select';
+ } else {
+ $params['openid.identity'] = $this->identity;
+ $params['openid.claimed_id'] = $this->claimed_id;
+ }
+
+ return $this->build_url(parse_url($this->server)
+ , array('query' => http_build_query($params, '', '&')));
+ }
+
+ /**
+ * Returns authentication url. Usually, you want to redirect your user to it.
+ * @return String The authentication url.
+ * @param String $select_identifier Whether to request OP to select identity for an user in OpenID 2. Does not affect OpenID 1.
+ * @throws ErrorException
+ */
+function authUrl($identifier_select = null)
+{
+ if (!$this->server) $this->discover($this->identity);
+
+ if ($this->version == 2) {
+ if ($identifier_select === null) {
+ return $this->authUrl_v2($this->identifier_select);
+ }
+ return $this->authUrl_v2($identifier_select);
+ }
+ return $this->authUrl_v1();
+}
+
+/**
+* Performs OpenID verification with the OP.
+* @return Bool Whether the verification was successful.
+* @throws ErrorException
+*/
+function validate()
+{
+ $this->claimed_id = isset($this->data['openid_claimed_id'])?$this->data['openid_claimed_id']:$this->data['openid_identity'];
+ $params = array(
+ 'openid.assoc_handle' => $this->data['openid_assoc_handle'],
+ 'openid.signed' => $this->data['openid_signed'],
+ 'openid.sig' => $this->data['openid_sig'],
+ );
+
+ if (isset($this->data['openid_ns'])) {
+ # We're dealing with an OpenID 2.0 server, so let's set an ns
+ # Even though we should know location of the endpoint,
+ # we still need to verify it by discovery, so $server is not set here
+ $params['openid.ns'] = 'http://specs.openid.net/auth/2.0';
+ } elseif(isset($this->data['openid_claimed_id'])) {
+ # If it's an OpenID 1 provider, and we've got claimed_id,
+ # we have to append it to the returnUrl, like authUrl_v1 does.
+ $this->returnUrl .= (strpos($this->returnUrl, '?') ? '&' : '?')
+ . 'openid.claimed_id=' . $this->claimed_id;
+ }
+
+ if ($this->data['openid_return_to'] != $this->returnUrl) {
+ # The return_to url must match the url of current request.
+ # I'm assuing that noone will set the returnUrl to something that doesn't make sense.
+ return false;
+ }
+
+ $server = $this->discover($this->data['openid_identity']);
+
+ foreach (explode(',', $this->data['openid_signed']) as $item) {
+ # Checking whether magic_quotes_gpc is turned on, because
+ # the function may fail if it is. For example, when fetching
+ # AX namePerson, it might containg an apostrophe, which will be escaped.
+ # In such case, validation would fail, since we'd send different data than OP
+ # wants to verify. stripslashes() should solve that problem, but we can't
+ # use it when magic_quotes is off.
+ $value = $this->data['openid_' . str_replace('.','_',$item)];
+ $params['openid.' . $item] = get_magic_quotes_gpc() ? stripslashes($value) : $value;
+
+ }
+
+ $params['openid.mode'] = 'check_authentication';
+
+ $response = $this->request($server, 'POST', $params);
+
+ return preg_match('/is_valid\s*:\s*true/i', $response);
+ }
+
+ protected function getAxAttributes()
+ {
+ $alias = null;
+ if (isset($this->data['openid_ns_ax'])
+ && $this->data['openid_ns_ax'] != 'http://openid.net/srv/ax/1.0'
+ ) { # It's the most likely case, so we'll check it before
+ $alias = 'ax';
+ } else {
+ # 'ax' prefix is either undefined, or points to another extension,
+ # so we search for another prefix
+ foreach ($this->data as $key => $val) {
+ if (substr($key, 0, strlen('openid_ns_')) == 'openid_ns_'
+ && $val == 'http://openid.net/srv/ax/1.0'
+ ) {
+ $alias = substr($key, strlen('openid_ns_'));
+ break;
+ }
+ }
+ }
+ if (!$alias) {
+ # An alias for AX schema has not been found,
+ # so there is no AX data in the OP's response
+ return array();
+ }
+
+ $attributes = array();
+ foreach ($this->data as $key => $value) {
+ $keyMatch = 'openid_' . $alias . '_value_';
+ if (substr($key, 0, strlen($keyMatch)) != $keyMatch) {
+ continue;
+ }
+ $key = substr($key, strlen($keyMatch));
+ if (!isset($this->data['openid_' . $alias . '_type_' . $key])) {
+ # OP is breaking the spec by returning a field without
+ # associated ns. This shouldn't happen, but it's better
+ # to check, than cause an E_NOTICE.
+ continue;
+ }
+ $key = substr($this->data['openid_' . $alias . '_type_' . $key],
+ strlen('http://axschema.org/'));
+ $attributes[$key] = $value;
+ }
+ return $attributes;
+}
+
+protected function getSregAttributes()
+{
+ $attributes = array();
+ $sreg_to_ax = array_flip(self::$ax_to_sreg);
+ foreach ($this->data as $key => $value) {
+ $keyMatch = 'openid_sreg_';
+ if (substr($key, 0, strlen($keyMatch)) != $keyMatch) {
+ continue;
+ }
+ $key = substr($key, strlen($keyMatch));
+ if (!isset($sreg_to_ax[$key])) {
+ # The field name isn't part of the SREG spec, so we ignore it.
+ continue;
+ }
+ $attributes[$sreg_to_ax[$key]] = $value;
+ }
+ return $attributes;
+}
+
+/**
+* Gets AX/SREG attributes provided by OP. should be used only after successful validaton.
+* Note that it does not guarantee that any of the required/optional parameters will be present,
+* or that there will be no other attributes besides those specified.
+* In other words. OP may provide whatever information it wants to.
+* * SREG names will be mapped to AX names.
+* * @return Array Array of attributes with keys being the AX schema names, e.g. 'contact/email'
+* @see http://www.axschema.org/types/
+*/
+function getAttributes()
+{
+ if (isset($this->data['openid_ns'])
+ && $this->data['openid_ns'] == 'http://specs.openid.net/auth/2.0'
+ ) { # OpenID 2.0
+ # We search for both AX and SREG attributes, with AX taking precedence.
+ return $this->getAxAttributes() + $this->getSregAttributes();
+ }
+ return $this->getSregAttributes();
+}
+}
diff --git a/www/wp-content/plugins/social-connect/readme.txt b/www/wp-content/plugins/social-connect/readme.txt
new file mode 100755
index 0000000..dd48846
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/readme.txt
@@ -0,0 +1,161 @@
+=== Social Connect ===
+Contributors: thenbrent
+Tags: facebook, wordpress.com, twitter, google, yahoo, social, login, register
+Requires at least: 3.0
+Tested up to: 3.2.1
+Stable tag: 0.9
+
+Allow your visitors to comment, login and register with their Twitter, Facebook, Google, Yahoo or WordPress.com account.
+
+== Description ==
+
+Social Connect adds social login buttons on the login, register and comment forms of your WordPress site.
+
+The buttons offer login and registration using a Twitter, Facebook, Google, Yahoo or WordPress.com account.
+
+It makes it super easy for new members to register with your site and existing members to login.
+
+= Props =
+
+Special thanks to:
+
+* [markusdrake](http://wordpress.org/support/profile/markusdrake) for patches and helping in the support forums;
+* [L D](http://wordpress.org/support/profile/enochfung) for patches and helping in the support forums;
+* [Geodanny](http://wordpress.org/support/profile/geodanny) for helping in the support forums; and
+* [Wirone](http://blog.wirone.info/) for polish translation and patches.
+
+And everyone else in the forums sharing the fixes they find and answering each others questions.
+
+= Contribute =
+
+Social Connect is rapidly growing in popularity and help with the growing pains is appreciated.
+
+If you're a developer, you can contribute fixes & optimisations via [Social Connect on GitHub](https://github.com/thenbrent/social-connect).
+
+Everyone can help out by answering questions in the [Support Forums](http://wordpress.org/tags/social-connect?forum_id=10#postform).
+
+
+== Installation ==
+
+1. Upload everything into the "/wp-content/plugins/" directory of your WordPress site.
+2. Activate in the "Plugins" admin panel.
+3. Visit the "Settings | Social Connect" administration page to configure social media providers.
+
+== Frequently Asked Questions ==
+
+= Does Social Connect work with WordPress Multisite? =
+
+Yes.
+
+= Does Social Connect work with the Theme My Login plugin? =
+
+Yes.
+
+= Can visitors connect with Social Connect to make a comment? =
+
+Yes.
+
+= Do I need to add template tags to my theme? =
+
+Social Connect attempts to work with the default WordPress comment, login and registration forms.
+
+If you want to add the social connect login or registration forms to another location in your theme, you can insert the following code in that location:
+
+``
+
+= What do I do if the Rewrite Diagnostics fail? =
+
+If you get a 403 and 404 on the Rewrite Diagnostics test, please request your hosting provider whitelist your domain on mod_security. This problem has been encountered with **Host Gator* and **GoDaddy**.
+
+For more information, see [Geodanny's](http://wordpress.org/support/profile/geodanny) kind responses in the forums to similar issues [here](http://wordpress.org/support/topic/plugin-social-connect-url-rewriting-and-query-string-parameter-passing) and [here](http://wordpress.org/support/topic/plugin-social-connect-url-rewrite).
+
+= Where can I report bugs & get support? =
+
+First, a few caveats on support.
+
+This is free software. Please be patient. I attempt to answer all questions, just not on the same day or even week. Polite and descriptive questions will always be given priority.
+
+Please search the support forums before asking a question - duplicate questions will not receive a reply.
+
+With those caveats in mind, ask questions in the [Support Forums](http://wordpress.org/tags/social-connect?forum_id=10#postform).
+
+To help me diagnose the issue, please include the following information in your post on the [Forums](http://wordpress.org/tags/social-connect?forum_id=10#postform):
+
+* what specifically is broken in Social Connect (eg. the buttons don't show up or it doesn't redirect back form Google)
+* what you did just before Social Connect stopped working (eg. activated, enabled all OpenID providers, clicked the Google login button)
+* version of the plugin
+* version of WordPress
+* list of other plugins installed
+* error messages you receive (if any)
+
+= Why doesn't Social Connect Work? =
+
+Please make sure you are running the latest version of Social Connect and the latest version of WordPress.
+
+If you have White Label CMS installed, the javascript it adds to your login page breaks all other plugins which run javascript on the login form.
+
+For a quick fix and for more information see this [forum topic](http://wordpress.org/support/topic/social-connect-does-not-work-at-all?replies=7#post-2029255).
+
+If you don't have White Label CMS installed, please double check your settings then post a question in the [Support Forums](http://wordpress.org/tags/social-connect?forum_id=10#postform).
+
+== Screenshots ==
+
+1. **Login** - on the login and registration form, buttons for 3rd party services are provided.
+2. **Comment** - buttons for 3rd party services are also provided on the comment form.
+
+== Changelog ==
+
+= 0.9 =
+* Setting CURLOPT_SSL_VERIFYPEER to false
+
+= 0.8 =
+* Moving comments icons to top of comment form (using `comment_form_top` hook instead of `comment_form` hook)
+* No longer relying on `file_get_contents()` function (using custom `sc_curl_get_contents()` function)
+* Removing "Not You?" double-dialogue.
+* Adding `social_connect_form` action to replace template tag with `do_action( 'social_connect_form' )`.
+
+= 0.7 =
+* Social Connect widget can now be customised
+* l10n implemented
+* Polish translation.
+
+= 0.6 =
+* Fixing 'email_exists' bug
+
+= 0.5 =
+* Removing Windows Live due to broken implementation
+* Fixing IE7 Bug reported here: http://wordpress.org/support/topic/plugin-social-connect-social-connect-fails-on-ie7?replies=9
+* Returning to a single admin page as diagnostics is smaller without Windows Live
+
+= 0.4 =
+* Removing generic OpenID for security concerns: http://wordpress.org/support/topic/545420
+* Only calling deprecated registration.php file if WP < 3.1 http://wordpress.org/support/topic/540156
+
+= 0.3 =
+* Social Connect moved to it's own top level menu in wp-admin.
+* Enable/disable integration with each social provider.
+* Simplified setup for Windows Live.
+* Introduced diagnostics to check for required cryptographic extensions and server rewrite rules.
+
+= 0.2 =
+* Fix for directory name
+
+= 0.1 =
+* Initial beta release.
+
+== Upgrade Notice ==
+
+= 0.9 =
+* Upgrade to fix Facebook connect SSL bug effecting some servers.
+
+= 0.8 =
+* Upgrade to fix bugs affecting Facebook connect on certain servers.
+
+= 0.7 =
+* Upgrade to be able to customise Social Connect widget & use in Polish.
+
+= 0.6 =
+* Important Upgrade: If you are running WordPress 3.0, you must upgrade. For versions 3.1 and above, this is an optional upgrade.
+
+= 0.5 =
+Important upgrade to fix a bug in versions of Internet Explorer prior to version 8.
diff --git a/www/wp-content/plugins/social-connect/screenshot-1.png b/www/wp-content/plugins/social-connect/screenshot-1.png
new file mode 100755
index 0000000..7814753
Binary files /dev/null and b/www/wp-content/plugins/social-connect/screenshot-1.png differ
diff --git a/www/wp-content/plugins/social-connect/screenshot-2.png b/www/wp-content/plugins/social-connect/screenshot-2.png
new file mode 100755
index 0000000..c5e16fe
Binary files /dev/null and b/www/wp-content/plugins/social-connect/screenshot-2.png differ
diff --git a/www/wp-content/plugins/social-connect/social-connect.php b/www/wp-content/plugins/social-connect/social-connect.php
new file mode 100755
index 0000000..7142ce7
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/social-connect.php
@@ -0,0 +1,203 @@
+upgrading your WordPress installation, it's worth the effort. Return to Plugins Admin page »", 'social_connect'), admin_url( 'plugins.php' ) ), 'social-connect' );
+ elseif ( !function_exists( 'curl_version' ) )
+ wp_die( sprintf( __( "Sorry, but you can not run Social Connect. It requires the PHP libcurl extension be installed. Please contact your web host and request libcurl be installed. Return to Plugins Admin page »", 'social_connect'), admin_url( 'plugins.php' ) ), 'social-connect' );
+ elseif ( !function_exists( 'hash' ) )
+ wp_die( sprintf( __( "Sorry, but you can not run Social Connect. It requires the PHP Hash Engine. Please contact your web host and request Hash engine be installed. Return to Plugins Admin page »", 'social_connect'), admin_url( 'plugins.php' ) ), 'social-connect' );
+ else
+ wp_die( sprintf( __( "Sorry, but you can not run Social Connect. It requires PHP 5.1.2 or newer. Please contact your web host and request they migrate your PHP installation to run Social Connect. Return to Plugins Admin page »", 'social_connect'), admin_url( 'plugins.php' ) ), 'social-connect' );
+ }
+ do_action( 'sc_activation' );
+}
+register_activation_hook( __FILE__, 'sc_activate' );
+
+
+/**
+ * Registration.php is deprecated since version 3.1 with no alternative available.
+ * registration.php functions moved to user.php, everything is now included by default
+ * This file only need to be included for versions before 3.1.
+ */
+if ( !function_exists( 'email_exists' ) )
+ require_once( ABSPATH . WPINC . '/registration.php' );
+
+/**
+ * Internationalization of the plugin
+ **/
+function sc_social_connect_l10n() {
+ $plugin_dir = basename( dirname( __FILE__ ) );
+ load_plugin_textdomain( 'social_connect', null, "$plugin_dir/languages" );
+}
+add_action( 'init', 'sc_social_connect_l10n', -1000 );
+
+require_once( dirname( __FILE__ ) . '/constants.php' );
+require_once( dirname( __FILE__ ) . '/utils.php' );
+require_once( dirname( __FILE__ ) . '/media.php' );
+require_once( dirname( __FILE__ ) . '/admin.php' );
+require_once( dirname( __FILE__ ) . '/ui.php' );
+
+
+function sc_social_connect_process_login( $is_ajax = false ){
+ if ( isset( $_REQUEST[ 'redirect_to' ] ) && $_REQUEST[ 'redirect_to' ] != '' ) {
+ $redirect_to = $_REQUEST[ 'redirect_to' ];
+ // Redirect to https if user wants ssl
+ if ( isset( $secure_cookie ) && $secure_cookie && false !== strpos( $redirect_to, 'wp-admin') )
+ $redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
+ } else {
+ $redirect_to = admin_url();
+ }
+ $redirect_to = apply_filters( 'social_connect_redirect_to', $redirect_to );
+
+ $social_connect_provider = $_REQUEST[ 'social_connect_provider' ];
+ $sc_provider_identity_key = 'social_connect_' . $social_connect_provider . '_id';
+ $sc_provided_signature = $_REQUEST[ 'social_connect_signature' ];
+
+ switch( $social_connect_provider ) {
+ case 'facebook':
+ social_connect_verify_signature( $_REQUEST[ 'social_connect_access_token' ], $sc_provided_signature, $redirect_to );
+ $fb_json = json_decode( sc_curl_get_contents("https://graph.facebook.com/me?access_token=" . $_REQUEST[ 'social_connect_access_token' ]) );
+ $sc_provider_identity = $fb_json->{ 'id' };
+ $sc_email = $fb_json->{ 'email' };
+ $sc_first_name = $fb_json->{ 'first_name' };
+ $sc_last_name = $fb_json->{ 'last_name' };
+ $sc_profile_url = $fb_json->{ 'link' };
+ $sc_name = $sc_first_name . ' ' . $sc_last_name;
+ $user_login = strtolower( $sc_first_name.$sc_last_name );
+ break;
+
+ case 'twitter':
+ $sc_provider_identity = $_REQUEST[ 'social_connect_twitter_identity' ];
+ social_connect_verify_signature( $sc_provider_identity, $sc_provided_signature, $redirect_to );
+ $sc_name = $_REQUEST[ 'social_connect_name' ];
+ $names = explode(" ", $sc_name );
+ $sc_first_name = $names[0];
+ $sc_last_name = $names[1];
+ $sc_screen_name = $_REQUEST[ 'social_connect_screen_name' ];
+ $sc_profile_url = '';
+ // Get host name from URL
+ $site_url = parse_url( site_url() );
+ $sc_email = 'tw_' . md5( $sc_provider_identity ) . '@' . $site_url['host'];
+ $user_login = $sc_screen_name;
+ break;
+
+ case 'google':
+ $sc_provider_identity = $_REQUEST[ 'social_connect_openid_identity' ];
+ social_connect_verify_signature( $sc_provider_identity, $sc_provided_signature, $redirect_to );
+ $sc_email = $_REQUEST[ 'social_connect_email' ];
+ $sc_first_name = $_REQUEST[ 'social_connect_first_name' ];
+ $sc_last_name = $_REQUEST[ 'social_connect_last_name' ];
+ $sc_profile_url = '';
+ $sc_name = $sc_first_name . ' ' . $sc_last_name;
+ $user_login = strtolower( $sc_first_name.$sc_last_name );
+ break;
+
+ case 'yahoo':
+ $sc_provider_identity = $_REQUEST[ 'social_connect_openid_identity' ];
+ social_connect_verify_signature( $sc_provider_identity, $sc_provided_signature, $redirect_to );
+ $sc_email = $_REQUEST[ 'social_connect_email' ];
+ $sc_name = $_REQUEST[ 'social_connect_name' ];
+ $sc_username = $_REQUEST[ 'social_connect_username' ];
+ $sc_profile_url = '';
+ if ( $sc_name == '') {
+ if ( $sc_username == '') {
+ $names = explode("@", $sc_email );
+ $sc_name = $names[0];
+ $sc_first_name = $sc_name;
+ $sc_last_name = '';
+ } else {
+ $names = explode(" ", $sc_username );
+ $sc_first_name = $names[0];
+ $sc_last_name = $names[1];
+ }
+ } else {
+ $names = explode(" ", $sc_name );
+ $sc_first_name = $names[0];
+ $sc_last_name = $names[1];
+ }
+ $user_login = strtolower( $sc_first_name.$sc_last_name );
+ break;
+
+ case 'wordpress':
+ $sc_provider_identity = $_REQUEST[ 'social_connect_openid_identity' ];
+ social_connect_verify_signature( $sc_provider_identity, $sc_provided_signature, $redirect_to );
+ $sc_email = $_REQUEST[ 'social_connect_email' ];
+ $sc_name = $_REQUEST[ 'social_connect_name' ];
+ $sc_profile_url = '';
+ if ( trim( $sc_name ) == '') {
+ $names = explode("@", $sc_email );
+ $sc_name = $names[0];
+ $sc_first_name = $sc_name;
+ $sc_last_name = '';
+ } else {
+ $names = explode(" ", $sc_name );
+ $sc_first_name = $names[0];
+ $sc_last_name = $names[1];
+ }
+ $user_login = strtolower( $sc_first_name.$sc_last_name );
+ break;
+ }
+
+ // Cookies used to display welcome message if already signed in recently using some provider
+ setcookie("social_connect_current_provider", $social_connect_provider, time()+3600, SITECOOKIEPATH, COOKIE_DOMAIN, false, true );
+
+ // Get user by meta
+ $user_id = social_connect_get_user_by_meta( $sc_provider_identity_key, $sc_provider_identity );
+ if ( $user_id ) {
+ $user_data = get_userdata( $user_id );
+ $user_login = $user_data->user_login;
+ } elseif ( $user_id = email_exists( $sc_email ) ) { // User not found by provider identity, check by email
+ update_user_meta( $user_id, $sc_provider_identity_key, $sc_provider_identity );
+
+ $user_data = get_userdata( $user_id );
+ $user_login = $user_data->user_login;
+
+ } else { // Create new user and associate provider identity
+ if ( username_exists( $user_login ) )
+ $user_login = apply_filters( 'social_connect_username_exists', strtolower("sc_". md5( $social_connect_provider . $sc_provider_identity ) ) );
+
+ $userdata = array( 'user_login' => $user_login, 'user_email' => $sc_email, 'first_name' => $sc_first_name, 'last_name' => $sc_last_name, 'user_url' => $sc_profile_url, 'user_pass' => wp_generate_password() );
+
+ // Create a new user
+ $user_id = wp_insert_user( $userdata );
+
+ if ( $user_id && is_integer( $user_id ) )
+ update_user_meta( $user_id, $sc_provider_identity_key, $sc_provider_identity );
+ }
+
+ wp_set_auth_cookie( $user_id );
+
+ do_action( 'social_connect_login', $user_login );
+
+ if ( $is_ajax )
+ echo '{"redirect":"' . $redirect_to . '"}';
+ else
+ wp_safe_redirect( $redirect_to );
+ exit();
+}
+// Hook to 'login_form_' . $action
+add_action( 'login_form_social_connect', 'sc_social_connect_process_login');
+
+// Handle calls from plugins that use an Ajax for login
+function sc_ajax_login(){
+ if ( isset( $_POST[ 'login_submit' ] ) && $_POST[ 'login_submit' ] == 'ajax' && // Plugins will need to pass this param
+ isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'social_connect' )
+ sc_social_connect_process_login( true );
+}
+add_action( 'init', 'sc_ajax_login');
diff --git a/www/wp-content/plugins/social-connect/twitter/EpiCurl.php b/www/wp-content/plugins/social-connect/twitter/EpiCurl.php
new file mode 100755
index 0000000..8cf18ea
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/twitter/EpiCurl.php
@@ -0,0 +1,128 @@
+mc = curl_multi_init();
+ $this->properties = array(
+ 'code' => CURLINFO_HTTP_CODE,
+ 'time' => CURLINFO_TOTAL_TIME,
+ 'length'=> CURLINFO_CONTENT_LENGTH_DOWNLOAD,
+ 'type' => CURLINFO_CONTENT_TYPE
+ );
+ }
+
+ public function addCurl($ch)
+ {
+ $key = (string)$ch;
+ $this->requests[$key] = $ch;
+
+ $res = curl_multi_add_handle($this->mc, $ch);
+
+ // (1)
+ if($res === CURLM_OK || $res === CURLM_CALL_MULTI_PERFORM)
+ {
+ do {
+ $mrc = curl_multi_exec($this->mc, $active);
+ } while ($mrc === CURLM_CALL_MULTI_PERFORM);
+
+ return new EpiCurlManager($key);
+ }
+ else
+ {
+ return $res;
+ }
+ }
+
+ public function getResult($key = null)
+ {
+ if($key != null)
+ {
+ if(isset($this->responses[$key]))
+ {
+ return $this->responses[$key];
+ }
+
+ $running = null;
+ do
+ {
+ $resp = curl_multi_exec($this->mc, $runningCurrent);
+ if($running !== null && $runningCurrent != $running)
+ {
+ $this->storeResponses($key);
+ if(isset($this->responses[$key]))
+ {
+ return $this->responses[$key];
+ }
+ }
+ $running = $runningCurrent;
+ }while($runningCurrent > 0);
+ }
+
+ return false;
+ }
+
+ private function storeResponses()
+ {
+ while($done = curl_multi_info_read($this->mc))
+ {
+ $key = (string)$done['handle'];
+ $this->responses[$key]['data'] = curl_multi_getcontent($done['handle']);
+ foreach($this->properties as $name => $const)
+ {
+ $this->responses[$key][$name] = curl_getinfo($done['handle'], $const);
+ curl_multi_remove_handle($this->mc, $done['handle']);
+ }
+ }
+ }
+
+ static function getInstance()
+ {
+ if(self::$inst == null)
+ {
+ self::$singleton = 1;
+ self::$inst = new EpiCurl();
+ }
+
+ return self::$inst;
+ }
+}
+
+class EpiCurlManager
+{
+ private $key;
+ private $epiCurl;
+
+ function __construct($key)
+ {
+ $this->key = $key;
+ $this->epiCurl = EpiCurl::getInstance();
+ }
+
+ function __get($name)
+ {
+ $responses = $this->epiCurl->getResult($this->key);
+ return $responses[$name];
+ }
+}
+
+/*
+ * Credits:
+ * - (1) Alistair pointed out that curl_multi_add_handle can return CURLM_CALL_MULTI_PERFORM on success.
+ */
+?>
diff --git a/www/wp-content/plugins/social-connect/twitter/EpiOAuth.php b/www/wp-content/plugins/social-connect/twitter/EpiOAuth.php
new file mode 100755
index 0000000..86fd329
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/twitter/EpiOAuth.php
@@ -0,0 +1,258 @@
+httpRequest('GET', $this->accessTokenUrl);
+ return new EpiOAuthResponse($resp);
+ }
+
+ public function getAuthenticateUrl()
+ {
+ $token = $this->getRequestToken();
+ return $this->authenticateUrl . '?oauth_token=' . $token->oauth_token;
+ }
+
+ public function getAuthorizationUrl()
+ {
+ $token = $this->getRequestToken();
+ return $this->authorizeUrl . '?oauth_token=' . $token->oauth_token;
+ }
+
+ public function getRequestToken()
+ {
+ $resp = $this->httpRequest('GET', $this->requestTokenUrl);
+ return new EpiOAuthResponse($resp);
+ }
+
+ public function httpRequest($method = null, $url = null, $params = null)
+ {
+ if(empty($method) || empty($url))
+ return false;
+
+ if(empty($params['oauth_signature']))
+ $params = $this->prepareParameters($method, $url, $params);
+
+ switch($method)
+ {
+ case 'GET':
+ return $this->httpGet($url, $params);
+ break;
+ case 'POST':
+ return $this->httpPost($url, $params);
+ break;
+ }
+ }
+
+ public function setToken($token = null, $secret = null)
+ {
+ $params = func_get_args();
+ $this->token = $token;
+ $this->tokenSecret = $secret;
+ }
+
+ protected function encode_rfc3986($string)
+ {
+ return str_replace('+', ' ', str_replace('%7E', '~', rawurlencode(($string))));
+ }
+
+ protected function addOAuthHeaders(&$ch, $url, $oauthHeaders)
+ {
+ $_h = array('Expect:');
+ $urlParts = parse_url($url);
+ $oauth = 'Authorization: OAuth realm="' . $urlParts['path'] . '",';
+ foreach($oauthHeaders as $name => $value)
+ {
+ $oauth .= "{$name}=\"{$value}\",";
+ }
+ $_h[] = substr($oauth, 0, -1);
+
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $_h);
+ }
+
+ protected function generateNonce()
+ {
+ if(isset($this->nonce)) // for unit testing
+ return $this->nonce;
+
+ return md5(uniqid(rand(), true));
+ }
+
+ protected function generateSignature($method = null, $url = null, $params = null)
+ {
+ if(empty($method) || empty($url))
+ return false;
+
+
+ // concatenating
+ $concatenatedParams = '';
+ foreach($params as $k => $v)
+ {
+ $v = $this->encode_rfc3986($v);
+ $concatenatedParams .= "{$k}={$v}&";
+ }
+ $concatenatedParams = $this->encode_rfc3986(substr($concatenatedParams, 0, -1));
+
+ // normalize url
+ $normalizedUrl = $this->encode_rfc3986($this->normalizeUrl($url));
+ $method = $this->encode_rfc3986($method); // don't need this but why not?
+
+ $signatureBaseString = "{$method}&{$normalizedUrl}&{$concatenatedParams}";
+ return $this->signString($signatureBaseString);
+ }
+
+ protected function httpGet($url, $params = null)
+ {
+ if(count($params['request']) > 0)
+ {
+ $url .= '?';
+ foreach($params['request'] as $k => $v)
+ {
+ $url .= "{$k}={$v}&";
+ }
+ $url = substr($url, 0, -1);
+ }
+ $ch = curl_init($url);
+ $this->addOAuthHeaders($ch, $url, $params['oauth']);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ $resp = $this->curl->addCurl($ch);
+
+ return $resp;
+ }
+
+ protected function httpPost($url, $params = null)
+ {
+ $ch = curl_init($url);
+ $this->addOAuthHeaders($ch, $url, $params['oauth']);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params['request']));
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ $resp = $this->curl->addCurl($ch);
+ return $resp;
+ }
+
+ protected function normalizeUrl($url = null)
+ {
+ $urlParts = parse_url($url);
+ $scheme = strtolower($urlParts['scheme']);
+ $host = strtolower($urlParts['host']);
+ $port = intval($urlParts['port']);
+
+ $retval = "{$scheme}://{$host}";
+ if($port > 0 && ($scheme === 'http' && $port !== 80) || ($scheme === 'https' && $port !== 443))
+ {
+ $retval .= ":{$port}";
+ }
+ $retval .= $urlParts['path'];
+ if(!empty($urlParts['query']))
+ {
+ $retval .= "?{$urlParts['query']}";
+ }
+
+ return $retval;
+ }
+
+ protected function prepareParameters($method = null, $url = null, $params = null)
+ {
+ if(empty($method) || empty($url))
+ return false;
+
+ $oauth['oauth_consumer_key'] = $this->consumerKey;
+ $oauth['oauth_token'] = $this->token;
+ $oauth['oauth_nonce'] = $this->generateNonce();
+ $oauth['oauth_timestamp'] = !isset($this->timestamp) ? time() : $this->timestamp; // for unit test
+ $oauth['oauth_signature_method'] = $this->signatureMethod;
+ $oauth['oauth_version'] = $this->version;
+
+ // encoding
+ array_walk($oauth, array($this, 'encode_rfc3986'));
+ if(is_array($params))
+ array_walk($params, array($this, 'encode_rfc3986'));
+ $encodedParams = array_merge($oauth, (array)$params);
+
+ // sorting
+ ksort($encodedParams);
+
+ // signing
+ $oauth['oauth_signature'] = $this->encode_rfc3986($this->generateSignature($method, $url, $encodedParams));
+ return array('request' => $params, 'oauth' => $oauth);
+ }
+
+ protected function signString($string = null)
+ {
+ $retval = false;
+ switch($this->signatureMethod)
+ {
+ case 'HMAC-SHA1':
+ $key = $this->encode_rfc3986($this->consumerSecret) . '&' . $this->encode_rfc3986($this->tokenSecret);
+ $retval = base64_encode(hash_hmac('sha1', $string, $key, true));
+ break;
+ }
+
+ return $retval;
+ }
+
+ public function __construct($consumerKey, $consumerSecret, $signatureMethod='HMAC-SHA1')
+ {
+ $this->consumerKey = $consumerKey;
+ $this->consumerSecret = $consumerSecret;
+ $this->signatureMethod = $signatureMethod;
+ $this->curl = EpiCurl::getInstance();
+ }
+}
+
+class EpiOAuthResponse
+{
+ private $__resp;
+
+ public function __construct($resp)
+ {
+ $this->__resp = $resp;
+ }
+
+ public function __get($name)
+ {
+ if($this->__resp->code != 200)
+ EpiOAuthException::raise($this->__resp->data, $this->__resp->code);
+
+ parse_str($this->__resp->data, $result);
+ foreach($result as $k => $v)
+ {
+ $this->$k = $v;
+ }
+
+ return $result[$name];
+ }
+}
+
+class EpiOAuthException extends Exception
+{
+ public static function raise($message, $code)
+ {
+ switch($code)
+ {
+ case 400:
+ throw new EpiOAuthBadRequestException($message, $code);
+ case 401:
+ throw new EpiOAuthUnauthorizedException($message, $code);
+ default:
+ throw new EpiOAuthException($message, $code);
+ }
+ }
+}
+
+
+class EpiOAuthBadRequestException extends EpiOAuthException{}
+class EpiOAuthUnauthorizedException extends EpiOAuthException{}
diff --git a/www/wp-content/plugins/social-connect/twitter/EpiTwitter.php b/www/wp-content/plugins/social-connect/twitter/EpiTwitter.php
new file mode 100755
index 0000000..ef7669f
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/twitter/EpiTwitter.php
@@ -0,0 +1,118 @@
+
+ */
+class EpiTwitter extends EpiOAuth
+{
+ const EPITWITTER_SIGNATURE_METHOD = 'HMAC-SHA1';
+ protected $requestTokenUrl= 'http://twitter.com/oauth/request_token';
+ protected $accessTokenUrl = 'http://twitter.com/oauth/access_token';
+ protected $authorizeUrl = 'http://twitter.com/oauth/authorize';
+ protected $authenticateUrl= 'http://twitter.com/oauth/authenticate';
+ protected $apiUrl = 'http://twitter.com';
+ protected $searchUrl = 'http://search.twitter.com';
+
+ public function __call($name, $params = null)
+ {
+ $parts = explode('_', $name);
+ $method = strtoupper(array_shift($parts));
+ $parts = implode('_', $parts);
+ $path = '/' . preg_replace('/[A-Z]|[0-9]+/e', "'/'.strtolower('\\0')", $parts) . '.json';
+ if(!empty($params))
+ $args = array_shift($params);
+
+ // intercept calls to the search api
+ if(preg_match('/^(search|trends)/', $parts))
+ {
+ $query = isset($args) ? http_build_query($args) : '';
+ $url = "{$this->searchUrl}{$path}?{$query}";
+ $ch = curl_init($url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+ return new EpiTwitterJson(EpiCurl::getInstance()->addCurl($ch));
+ }
+
+ return new EpiTwitterJson(call_user_func(array($this, 'httpRequest'), $method, "{$this->apiUrl}{$path}", $args));
+ }
+
+ public function __construct($consumerKey = null, $consumerSecret = null, $oauthToken = null, $oauthTokenSecret = null)
+ {
+ parent::__construct($consumerKey, $consumerSecret, self::EPITWITTER_SIGNATURE_METHOD);
+ $this->setToken($oauthToken, $oauthTokenSecret);
+ }
+}
+
+class EpiTwitterJson implements ArrayAccess, Countable, IteratorAggregate
+{
+ private $__resp;
+ public function __construct($response)
+ {
+ $this->__resp = $response;
+ }
+
+ // Implementation of the IteratorAggregate::getIterator() to support foreach ($this as $...)
+ public function getIterator ()
+ {
+ return new ArrayIterator($this->__obj);
+ }
+
+ // Implementation of Countable::count() to support count($this)
+ public function count ()
+ {
+ return count($this->__obj);
+ }
+
+ // Next four functions are to support ArrayAccess interface
+ // 1
+ public function offsetSet($offset, $value)
+ {
+ $this->response[$offset] = $value;
+ }
+
+ // 2
+ public function offsetExists($offset)
+ {
+ return isset($this->response[$offset]);
+ }
+
+ // 3
+ public function offsetUnset($offset)
+ {
+ unset($this->response[$offset]);
+ }
+
+ // 4
+ public function offsetGet($offset)
+ {
+ return isset($this->response[$offset]) ? $this->response[$offset] : null;
+ }
+
+ public function __get($name)
+ {
+ if($this->__resp->code != 200)
+ EpiOAuthException::raise($this->__resp->data, $this->__resp->code);
+
+ $this->responseText = $this->__resp->data;
+ $this->response = json_decode($this->responseText, 1);
+ $this->__obj = json_decode($this->responseText);
+ foreach($this->__obj as $k => $v)
+ {
+ $this->$k = $v;
+ }
+
+ return $this->$name;
+ }
+
+ public function __isset($name)
+ {
+ $value = self::__get($name);
+ return empty($name);
+ }
+}
diff --git a/www/wp-content/plugins/social-connect/twitter/callback.php b/www/wp-content/plugins/social-connect/twitter/callback.php
new file mode 100755
index 0000000..4110c3f
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/twitter/callback.php
@@ -0,0 +1,39 @@
+setToken($_GET['oauth_token']);
+$token = $twitter_api->getAccessToken();
+$twitter_api->setToken($token->oauth_token, $token->oauth_token_secret);
+
+$user = $twitter_api->get_accountVerify_credentials();
+$name = $user->name;
+$screen_name = $user->screen_name;
+$twitter_id = $user->id;
+$signature = social_connect_generate_signature($twitter_id);
+?>
+
+
+
+
+
+
+
+
diff --git a/www/wp-content/plugins/social-connect/twitter/connect.php b/www/wp-content/plugins/social-connect/twitter/connect.php
new file mode 100755
index 0000000..8c3b90b
--- /dev/null
+++ b/www/wp-content/plugins/social-connect/twitter/connect.php
@@ -0,0 +1,18 @@
+getAuthenticateUrl());
+ exit();
+}
+?>
+
Social Connect plugin has not been configured for Twitter