";
-}//end xrds_page
-
-function xrds_tab($s) {
- add_submenu_page('options-general.php', 'XRDS-Simple', 'XRDS-Simple', 1, __FILE__, 'xrds_page');
- return $s;
-}//end function
-add_action('admin_menu', 'xrds_tab');
-
-}//end if ! included
-
-if(isset($_GET['xrds'])) {
- xrds_write();
-} else {
- if(in_array('application/xrds+xml',explode(',',$_SERVER['HTTP_ACCEPT']))) {
- xrds_write();
- } else {
- header('X-XRDS-Location: '.get_bloginfo('home').'/?xrds');
- header('X-Yadis-Location: '.get_bloginfo('home').'/?xrds');
- }//end if header
-}//end if ! in wordpress
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/LICENSE b/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/LICENSE
deleted file mode 100755
index bcc03ec..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2008 Stephen Paul Weber.
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/OAuth.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/OAuth.php
deleted file mode 100755
index d3e4e48..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/OAuth.php
+++ /dev/null
@@ -1,630 +0,0 @@
-$value) {
- if (substr($key,0,5)=="HTTP_") {
- $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
- $out[$key]=$value;
- }
- }
- return $out;
- }
-}
-/* END HEADERS ON SHARED HOSTS */
-
-/* Generic exception class
- */
-class OAuthException {
- // pass
-}
-
-class OAuthConsumer {
- var $key;
- var $secret;
-
- function OAuthConsumer($key, $secret, $callback_url=NULL) {
- $this->key = $key;
- $this->secret = $secret;
- $this->callback_url = $callback_url;
- }
-}
-
-class OAuthToken {
- // access tokens and request tokens
- var $key;
- var $secret;
-
- /**
- * key = the token
- * secret = the token secret
- */
- function OAuthToken($key, $secret) {/*{{{*/
- $this->key = $key;
- $this->secret = $secret;
- }/*}}}*/
-
- /**
- * generates the basic string serialization of a token that a server
- * would respond to request_token and access_token calls with
- */
- function to_string() {/*{{{*/
- return "oauth_token=" . urlencode($this->key) .
- "&oauth_token_secret=" . urlencode($this->secret);
- }/*}}}*/
-
- function __toString() {/*{{{*/
- return $this->to_string();
- }/*}}}*/
-}/*}}}*/
-
-class OAuthSignatureMethod {/*{{{*/
-
-}/*}}}*/
-
-class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod {/*{{{*/
- function get_name() {/*{{{*/
- return "HMAC-SHA1";
- }/*}}}*/
-
- function build_signature($request, $consumer, $token) {/*{{{*/
- $sig = array(
- urlencode($request->get_normalized_http_method()),
- urlencode($request->get_normalized_http_url()),
- urlencode($request->get_signable_parameters()),
- );
-
- $key = $consumer->secret . "&";
-
- if ($token) {
- $key .= $token->secret;
- }
-
- $raw = implode("&", $sig);
-
- if (!(function_exists('hash_hmac'))) {
-
- function &hash_hmac($algo, $data, $key, $raw_output ) {
- $data = trim($data);
- $key = trim($key);
- $blocksize=64;
- $hashfunc='sha1';
- if (strlen($key)>$blocksize)
- $key=pack('H*', $hashfunc($key));
- $key=str_pad($key,$blocksize,chr(0x00));
- $ipad=str_repeat(chr(0x36),$blocksize);
- $opad=str_repeat(chr(0x5c),$blocksize);
- $hmac = pack(
- 'H*',$hashfunc(
- ($key^$opad).pack(
- 'H*',$hashfunc(
- ($key^$ipad).$data
- )
- )
- )
- );
- return $hmac;
-
- }
-
- }
-
- $raw = str_replace("%2B","%2520",$raw);
- $raw = str_replace("%257E","~",$raw);
- $raw = str_replace("%7E","~",$raw);
-
- $hashed = base64_encode(hash_hmac("sha1", trim($raw), trim($key), TRUE));
- return $hashed;
- }/*}}}*/
-}/*}}}*/
-
-class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod {/*{{{*/
- function get_name() {/*{{{*/
- return "PLAINTEXT";
- }/*}}}*/
- function build_signature($request, $consumer, $token) {/*{{{*/
- $sig = array(
- urlencode($consumer->secret)
- );
-
- if ($token) {
- array_push($sig, urlencode($token->secret));
- } else {
- array_push($sig, '');
- }
-
- $raw = implode("&", $sig);
- return $raw;
- }/*}}}*/
-}/*}}}*/
-
-class OAuthRequest {
- var $parameters;
- var $http_method;
- var $http_url;
- var $base_string;
- var $version = '1.0';
-
- function OAuthRequest($http_method, $http_url, $parameters=NULL) {/*{{{*/
- if ($parameters == NULL) $parameters = array();
- $defaults = array("oauth_version" => $this->version,
- "oauth_nonce" => $this->generate_nonce(),
- "oauth_timestamp" => $this->generate_timestamp()
- );
-
-
- $parameters = array_merge($defaults, $parameters);
- $this->parameters = $parameters;
- $this->http_method = $http_method;
- $this->http_url = $http_url;
- }/*}}}*/
-
- /**
- * attempt to build up a request from what was passed to the server
- */
- function from_request($http_method=NULL, $http_url=NULL, $parameters=NULL) {/*{{{*/
- @$http_url or $http_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
- @$http_method or $http_method = $_SERVER['REQUEST_METHOD'];
-
- // we need this to get the actual Authorization: header
- // because apache tends to tell us it doesn't exist
- $request_headers = apache_request_headers();
-
- // let the library user override things however they'd like, if they know
- // which parameters to use then go for it, for example XMLRPC might want to
- // do this
- if ($parameters) {
- $req = new OAuthRequest($http_method, $http_url, $parameters);
- }
- // next check for the auth header, we need to do some extra stuff
- // if that is the case, namely suck in the parameters from GET or POST
- // so that we can include them in the signature
- else if (@substr($request_headers['Authorization'], 0, 5) == "OAuth") {
- $header_parameters = OAuthRequest::split_header($request_headers['Authorization']);
- if ($http_method == "GET") {
- $req_parameters = $_GET;
- }
- else if ($http_method = "POST") {
- $req_parameters = $_POST;
- }
- $parameters = array_merge($header_parameters, $req_parameters);
- $req = new OAuthRequest($http_method, $http_url, $parameters);
- }
- else if ($_GET['oauth_version'] || $_GET['oauth_token']) {
- $req = new OAuthRequest($http_method, $http_url, $_GET);
- }
- else { //must return an OAuthRequest, even if empty, so just use this
- $req = new OAuthRequest($http_method, $http_url, $_POST);
- }
- return $req;
- }/*}}}*/
-
- /**
- * pretty much a helper function to set up the request
- */
- function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) {
- if ($parameters == NULL)
- $parameters = array();
- $defaults = array("oauth_consumer_key" => $consumer->key);
- $parameters = array_merge($defaults, $parameters);
-
- if ($token) {
- $parameters['oauth_token'] = $token->key;
- }
- return new OAuthRequest($http_method, $http_url, $parameters);
- }/*}}}*/
-
- function set_parameter($name, $value) {
- $this->parameters[$name] = $value;
- }
-
- function get_parameter($name) {
- return $this->parameters[$name];
- }
-
- function get_parameters() {
- return $this->parameters;
- }
-
- /**
- * return a string that consists of all the parameters that need to be signed
- */
- function get_signable_parameters() {/*{{{*/
- $sorted = $this->parameters;
- ksort($sorted);
-
- $total = array();
- foreach ($sorted as $k => $v) {
- if ($k == "oauth_signature") continue;
- //$total[] = $k . "=" . $v;
- $total[] = urlencode($k) . "=" . urlencode($v);
- }
- return implode("&", $total);
- }/*}}}*/
-
- /**
- * just uppercases the http method
- */
- function get_normalized_http_method() {/*{{{*/
- return strtoupper($this->http_method);
- }/*}}}*/
-
- /**
- * parses the url and rebuilds it to be
- * scheme://host/path
- */
- function get_normalized_http_url() {/*{{{*/
- $parts = parse_url($this->http_url);
- $url_string = "{$parts['scheme']}://{$parts['host']}{$parts['path']}";
- return $url_string;
- }/*}}}*/
-
- /**
- * builds a url usable for a GET request
- */
- function to_url() {/*{{{*/
- $out = $this->get_normalized_http_url() . "?";
- $out .= $this->to_postdata();
- return $out;
- }/*}}}*/
-
- /**
- * builds the data one would send in a POST request
- */
- function to_postdata() {/*{{{*/
- $total = array();
- foreach ($this->parameters as $k => $v) {
- $total[] = urlencode($k) . "=" . urlencode($v);
- }
- $out = implode("&", $total);
- return $out;
- }/*}}}*/
-
- /**
- * builds the Authorization: header
- */
- function to_header() {/*{{{*/
- $out ='"Authorization: OAuth realm="",';
- $total = array();
- foreach ($this->parameters as $k => $v) {
- if (substr($k, 0, 5) != "oauth") continue;
- $total[] = urlencode($k) . '="' . urlencode($v) . '"';
- }
- $out = implode(",", $total);
- return $out;
- }/*}}}*/
-
- function __toString() {/*{{{*/
- return $this->to_url();
- }/*}}}*/
-
-
- function sign_request($signature_method, $consumer, $token) {/*{{{*/
- $this->set_parameter("oauth_signature_method", $signature_method->get_name());
- $signature = $this->build_signature($signature_method, $consumer, $token);
- $this->set_parameter("oauth_signature", $signature);
- }/*}}}*/
-
- function build_signature($signature_method, $consumer, $token) {/*{{{*/
- $signature = $signature_method->build_signature($this, $consumer, $token);
- return $signature;
- }/*}}}*/
-
- /**
- * util function: current timestamp
- */
- function generate_timestamp() {/*{{{*/
- return time();
- }/*}}}*/
-
- /**
- * util function: current nonce
- */
- function generate_nonce() {/*{{{*/
- $mt = microtime();
- $rand = mt_rand();
-
- return md5($mt . $rand); // md5s look nicer than numbers
- }/*}}}*/
-
- /**
- * util function for turning the Authorization: header into
- * parameters, has to do some unescaping
- */
- function split_header($header) {/*{{{*/
- // this should be a regex
- // error cases: commas in parameter values
- $parts = explode(",", $header);
- $out = array();
- foreach ($parts as $param) {
- $param = ltrim($param);
- // skip the "realm" param, nobody ever uses it anyway
- if (substr($param, 0, 5) != "oauth") continue;
-
- $param_parts = explode("=", $param);
-
- // rawurldecode() used because urldecode() will turn a "+" in the
- // value into a space
- $out[$param_parts[0]] = rawurldecode(substr($param_parts[1], 1, -1));
- }
- return $out;
- }/*}}}*/
-
-}/*}}}*/
-
-class OAuthServer {/*{{{*/
- var $timestamp_threshold = 300; // in seconds, five minutes
- var $version = 1.0; // hi blaine
- var $signature_methods = array();
-
- var $data_store;
-
- function OAuthServer($data_store) {/*{{{*/
- $this->data_store = $data_store;
- }/*}}}*/
-
- function add_signature_method($signature_method) {/*{{{*/
- $this->signature_methods[$signature_method->get_name()] =
- $signature_method;
- }/*}}}*/
-
- // high level functions
-
- /**
- * process a request_token request
- * returns the request token on success
- */
- function fetch_request_token(&$request) {/*{{{*/
- $this->get_version($request);
-
- $consumer = $this->get_consumer($request);
-
- // no token required for the initial token request
- $token = NULL;
-
- $this->check_signature($request, $consumer, $token);
-
- $new_token = $this->data_store->new_request_token($consumer);
-
- return $new_token;
- }/*}}}*/
-
- /**
- * process an access_token request
- * returns the access token on success
- */
- function fetch_access_token(&$request) {/*{{{*/
- $this->get_version($request);
-
- $consumer = $this->get_consumer($request);
-
- // requires authorized request token
- $token = $this->get_token($request, $consumer, "request");
-
- $this->check_signature($request, $consumer, $token);
-
- $new_token = $this->data_store->new_access_token($token, $consumer);
-
- return $new_token;
- }/*}}}*/
-
- /**
- * verify an api call, checks all the parameters
- */
- function verify_request(&$request) {/*{{{*/
- $this->get_version($request);
- $consumer = $this->get_consumer($request);
- $token = $this->get_token($request, $consumer, "access");
- $this->check_signature($request, $consumer, $token);
- return array($consumer, $token);
- }/*}}}*/
-
- // Internals from here
- /**
- * version 1
- */
- function get_version(&$request) {/*{{{*/
- $version = $request->get_parameter("oauth_version");
- if (!$version) {
- $version = 1.0;
- }
- if ($version && $version != $this->version) {
- trigger_error("OAuth version '$version' not supported",E_USER_ERROR);
- }
- return $version;
- }/*}}}*/
-
- /**
- * figure out the signature with some defaults
- */
- function get_signature_method(&$request) {/*{{{*/
- $signature_method =
- @$request->get_parameter("oauth_signature_method");
- if (!$signature_method) {
- $signature_method = "PLAINTEXT";
- }
- if (!in_array($signature_method,
- array_keys($this->signature_methods))) {
- trigger_error(
- "Signature method '$signature_method' not supported try one of the following: " . implode(", ", array_keys($this->signature_methods),E_USER_ERROR)
- );
- }
- return $this->signature_methods[$signature_method];
- }/*}}}*/
-
- /**
- * try to find the consumer for the provided request's consumer key
- */
- function get_consumer(&$request) {/*{{{*/
- $consumer_key = @$request->get_parameter("oauth_consumer_key");
- if (!$consumer_key) {
- trigger_error("Invalid consumer key",E_USER_ERROR);
- }
-
- $consumer = $this->data_store->lookup_consumer($consumer_key);
- if (!$consumer) {
- trigger_error("Invalid consumer",E_USER_ERROR);
- }
-
- return $consumer;
- }/*}}}*/
-
- /**
- * try to find the token for the provided request's token key
- */
- function get_token(&$request, $consumer, $token_type="access") {/*{{{*/
- $token_field = @$request->get_parameter('oauth_token');
- $token = $this->data_store->lookup_token(
- $consumer, $token_type, $token_field
- );
- if (!$token) {
- trigger_error("Invalid $token_type token: $token_field",E_USER_ERROR);
- }
- return $token;
- }/*}}}*/
-
- /**
- * all-in-one function to check the signature on a request
- * should guess the signature method appropriately
- */
- function check_signature(&$request, $consumer, $token) {/*{{{*/
- // this should probably be in a different method
- $timestamp = @$request->get_parameter('oauth_timestamp');
- $nonce = @$request->get_parameter('oauth_nonce');
-
- $this->check_timestamp($timestamp);
- $this->check_nonce($consumer, $token, $nonce, $timestamp);
-
- $signature_method = $this->get_signature_method($request);
-
- $signature = $request->get_parameter('oauth_signature');
- $built = $signature_method->build_signature(
- $request, $consumer, $token
- );
-
-
- if ($signature != $built) {
- trigger_error("Invalid signature",E_USER_ERROR);
- }
- }/*}}}*/
-
- /**
- * check that the timestamp is new enough
- */
- function check_timestamp($timestamp) {/*{{{*/
- // verify that timestamp is recentish
- $now = time();
- if ($now - $timestamp > $this->timestamp_threshold) {
- trigger_error("Expired timestamp, yours $timestamp, ours $now",E_USER_ERROR);
- }
- }/*}}}*/
-
- /**
- * check that the nonce is not repeated
- */
- function check_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
- // verify that the nonce is uniqueish
- $found = $this->data_store->lookup_nonce($consumer, $token, $nonce, $timestamp);
- if ($found) {
- trigger_error("Nonce already used: $nonce",E_USER_ERROR);
- }
- }/*}}}*/
-
-
-
-}/*}}}*/
-
-class OAuthDataStore {/*{{{*/
- function lookup_consumer($consumer_key) {/*{{{*/
- // implement me
- }/*}}}*/
-
- function lookup_token($consumer, $token_type, $token) {/*{{{*/
- // implement me
- }/*}}}*/
-
- function lookup_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
- // implement me
- }/*}}}*/
-
- function fetch_request_token($consumer) {/*{{{*/
- // return a new token attached to this consumer
- }/*}}}*/
-
- function fetch_access_token($token, $consumer) {/*{{{*/
- // return a new access token attached to this consumer
- // for the user associated with this token if the request token
- // is authorized
- // should also invalidate the request token
- }/*}}}*/
-
-}/*}}}*/
-
-
-/* A very naive dbm-based oauth storage
- */
-class SimpleOAuthDataStore extends OAuthDataStore {/*{{{*/
- var $dbh;
-
- function SimpleOAuthDataStore($path = "oauth.gdbm") {/*{{{*/
- $this->dbh = dba_popen($path, 'c', 'gdbm');
- }/*}}}*/
-
- function __destruct() {/*{{{*/
- dba_close($this->dbh);
- }/*}}}*/
-
- function lookup_consumer($consumer_key) {/*{{{*/
- $rv = dba_fetch("consumer_$consumer_key", $this->dbh);
- if ($rv === FALSE) {
- return NULL;
- }
- $obj = unserialize($rv);
- if (!(get_class($obj) == 'OAuthConsumer')) {
- return NULL;
- }
- return $obj;
- }/*}}}*/
-
- function lookup_token($consumer, $token_type, $token) {/*{{{*/
- $rv = dba_fetch("${token_type}_${token}", $this->dbh);
- if ($rv === FALSE) {
- return NULL;
- }
- $obj = unserialize($rv);
- if (!(get_class($obj) == 'OAuthToken')) {
- return NULL;
- }
- return $obj;
- }/*}}}*/
-
- function lookup_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
- return dba_exists("nonce_$nonce", $this->dbh);
- }/*}}}*/
-
- function new_token($consumer, $type="request") {/*{{{*/
- $key = md5(time());
- $secret = time() + time();
- $token = new OAuthToken($key, md5(md5($secret)));
- if (!dba_insert("${type}_$key", serialize($token), $this->dbh)) {
- trigger_error("doooom!",E_USER_ERROR);
- }
- return $token;
- }/*}}}*/
-
- function new_request_token($consumer) {/*{{{*/
- return $this->new_token($consumer, "request");
- }/*}}}*/
-
- function new_access_token($token, $consumer) {/*{{{*/
-
- $token = $this->new_token($consumer, 'access');
- dba_delete("request_" . $token->key, $this->dbh);
- return $token;
- }/*}}}*/
-}/*}}}*/
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/OAuthWordpressStore.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/OAuthWordpressStore.php
deleted file mode 100755
index 67a211a..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/OAuthWordpressStore.php
+++ /dev/null
@@ -1,108 +0,0 @@
-query("CREATE TABLE IF NOT EXISTS {$wpdb->prefix}oauth_consumers (consumer_key CHAR(40) PRIMARY KEY, secret CHAR(40), description CHAR(40))");
- $wpdb->query("CREATE TABLE IF NOT EXISTS {$wpdb->prefix}oauth_tokens (consumer_key CHAR(40), token CHAR(40), secret CHAR(40), token_type CHAR(7), nonce CHAR(40), user_id TINYINT DEFAULT 0, expires INT DEFAULT 0)");
- $wpdb->query("INSERT INTO {$wpdb->prefix}oauth_consumers (consumer_key, secret, description) VALUES ('DUMMYKEY', '', 'Unidentified Consumer')");
- update_option('oauth_version', 0.12);
- }
- }//end contructor
-
- function __destruct() {}
-
- function new_consumer($description) {
- global $wpdb;
- $description = $wpdb->escape($description);
- $consumer_key = sha1($_SERVER['REMOTE_ADDR'] . microtime() . (string)rand());
- $secret = sha1(md5($_SERVER['REMOTE_ADDR']) . microtime() . (string)time());
- $wpdb->query("INSERT INTO {$wpdb->prefix}oauth_consumers (consumer_key, secret, description) VALUES ('$consumer_key', '$secret', '$description')");
- return new OAuthConsumer($consumer_key, $secret);
- }//end function new_consumer
-
- function lookup_consumer($consumer_key) {
- global $wpdb;
- $secret = $wpdb->get_var("SELECT secret FROM {$wpdb->prefix}oauth_consumers WHERE consumer_key='$consumer_key' LIMIT 1");
- if($secret === FALSE) return NULL;
- return new OAuthConsumer($consumer_key, $secret);
- }//end function lookup_consumer
-
- function lookup_consumer_description($consumer_key) {
- global $wpdb;
- $description = $wpdb->get_var("SELECT description FROM {$wpdb->prefix}oauth_consumers WHERE consumer_key='$consumer_key' LIMIT 1");
- return $description;
- }//end function lookup_consumer_description
-
- function user_from_token($consumer_key, $token) {
- global $wpdb;
- return $wpdb->get_var("SELECT user_id FROM {$wpdb->prefix}oauth_tokens WHERE consumer_key='$consumer_key' AND token='$token'");
- }//end function user_from_token
-
- function authorize_request_token($consumer_key, $token, $user_id) {
- global $wpdb;
- $wpdb->query("UPDATE {$wpdb->prefix}oauth_tokens SET user_id=$user_id WHERE consumer_key='$consumer_key' AND token='$token'");
- }//end function authorize_roquest_token
-
- function token_expires($token) {
- global $wpdb;
- return $wpdb->get_var("SELECT expires FROM {$wpdb->prefix}oauth_tokens WHERE token='{$token->key}' AND secret='{$token->secret}'");
- }//end function teken_expires
-
- function lookup_token($consumer, $token_type, $token) {
- global $wpdb;
- @$consumer_key = $consumer->key;
- if(!$consumer_key)
- $consumer_key = $wpdb->get_var("SELECT consumer_key FROM {$wpdb->prefix}oauth_tokens WHERE token='$token' AND token_type='$token_type' LIMIT 1");
- $secret = $wpdb->get_var("SELECT secret FROM {$wpdb->prefix}oauth_tokens WHERE consumer_key='{$consumer_key}' AND token='$token' AND token_type='$token_type' LIMIT 1");
- if(!$secret) return NULL;
- $token = new OAuthToken($token, $secret);
- $expires = $this->token_expires($token);
- if($expires && $expires < time()) {
- $wpdb->get_var("DELETE FROM {$wpdb->prefix}oauth_tokens WHERE token='{$token->key}' AND secret='{$token->secret}' AND token_type='$token_type' LIMIT 1");
- return NULL;
- }//end if expired
- if($consumer) return $token;
- else return $consumer_key;
- }//end function lookup_token
-
- function lookup_nonce($consumer, $token, $nonce, $timestamp) {
- global $wpdb;
- $nonce = $wpdb->get_var("SELECT nonce FROM {$wpdb->prefix}oauth_tokens WHERE consumer_key='{$consumer->key}' AND token='$token' AND (token_type='request' OR token_type='access') AND nonce='$nonce' LIMIT 1");
- if(!$nonce || !preg_match("/(\S)/", $nonce)) return NULL;
- return $nonce;
- }//end function lookup_token
-
- function new_token($consumer, $token_type, $user_id=0) {
- global $wpdb;
- $token = sha1($_SERVER['REMOTE_ADDR'] . microtime() . (string)rand());
- $secret = sha1(md5($_SERVER['REMOTE_ADDR']) . microtime() . (string)time());
- $wpdb->query("INSERT INTO {$wpdb->prefix}oauth_tokens (consumer_key, token_type, token, secret, user_id, expires) VALUES ('{$consumer->key}', '$token_type', '$token', '$secret', $user_id, 0)");
- return new OAuthToken($token, $secret);
- }//end function now_token
-
- function new_request_token($consumer) {
- return $this->new_token($consumer, 'request');
- }//end new_request_token
-
- function new_access_token($request_token,$consumer) {
- global $wpdb;
- $request_token = $request_token->to_string();
- preg_match('/oauth_token=(.*?)&/',$request_token,$request_token);
- $request_token = $request_token[1];
- $user_id = $wpdb->get_var("SELECT user_id FROM {$wpdb->prefix}oauth_tokens WHERE token_type='request' AND consumer_key='{$consumer->key}' AND token='$request_token' LIMIT 1");
- if(!$user_id) trigger_error('Request token not authorized', E_USER_ERROR);
- $wpdb->query("DELETE FROM {$wpdb->prefix}oauth_tokens WHERE token_type='request' AND consumer_key='{$consumer->key}' AND token='$request_token'");
- return $this->new_token($consumer, 'access', $user_id);
- }//end new_request_token
-
-}//end class OAuthWorepressStore
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/access_token.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/access_token.php
deleted file mode 100755
index c39f6c8..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/access_token.php
+++ /dev/null
@@ -1,22 +0,0 @@
-add_signature_method($sha1_method);
-$server->add_signature_method($plaintext_method);
-
-try {
- $req = OAuthRequest::from_request();
- $token = $server->fetch_access_token($req);
- print $token.'&xoauth_token_expires='.urlencode($store->token_expires($token));
-} catch (OAuthException $e) {
- header('Content-type: text/plain;', true, 400);
- print($e->getMessage() . "\n\n");
- var_dump($req);
- die;
-}
-
-?>
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/authorize_token.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/authorize_token.php
deleted file mode 100755
index e6451a8..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/authorize_token.php
+++ /dev/null
@@ -1,89 +0,0 @@
-escape($_REQUEST['oauth_token']);
- $consumer_key = $store->lookup_token('','request',$token);//verify token
- if(!$consumer_key) die('Invalid token passed');
-}//end if ! POST authorize
-
-get_currentuserinfo();
-if(!$userdata->ID) {
- $redirect_to = urlencode(get_bloginfo('wpurl').'/wp-content/plugins/wp-oauth/authorize_token.php?oauth_token='.urlencode($_REQUEST['oauth_token']).'&oauth_callback='.urlencode($_REQUEST['oauth_callback']));
- header('Location: '.get_bloginfo('wpurl').'/wp-login.php?redirect_to='.$redirect_to,true,303);
- exit;
-}//end if ! userdata->ID
-
-if($_POST['authorize']) {
- session_start();
- $_REQUEST['oauth_callback'] = $_SESSION['oauth_callback']; unset($_SESSION['oauth_callback']);
- $token = $_SESSION['oauth_token']; unset($_SESSION['oauth_token']);
- $consumer_key = $_SESSION['oauth_consumer_key']; unset($_SESSION['oauth_consumer_key']);
- if($_POST['authorize'] != 'Ok') {
- if($_REQUEST['oauth_callback']) {
- header('Location: '.$_REQUEST['oauth_callback'],true,303);
- } else {
- get_header();
- echo '
You chose to cancel authorization. You may now close this window.
';
- get_footer();
- }//end if-else callback
- exit;
- }//cancel authorize
- $consumers = $userdata->oauth_consumers ? $userdata->oauth_consumers : array();
- $services = get_option('oauth_services');
- $yeservices = array();
- foreach($services as $k => $v)
- if(in_array($k, array_keys($_REQUEST['services'])))
- $yeservices[$k] = $v;
- $consumers[$consumer_key] = array_merge(array('authorized' => true), $yeservices);//it's an array so that more granular data about permissions could go in here
- $userdata->oauth_consumers = $consumers;
- update_usermeta($userdata->ID, 'oauth_consumers', $consumers);
-}//end if authorize
-
-if($userdata->oauth_consumers && in_array($consumer_key,array_keys($userdata->oauth_consumers))) {
- $store->authorize_request_token($consumer_key, $token, $userdata->ID);
- if($_REQUEST['oauth_callback']) {
- header('Location: '.$_REQUEST['oauth_callback'],true,303);
- } else {
- get_header();
- echo '
Authorized! You may now close this window.
';
- get_footer();
- }//end if-else callback
- exit;
-} else {
- session_start();//use a session to prevent the consumer from tricking the user into posting the Yes answer
- $_SESSION['oauth_token'] = $token;
- $_SESSION['oauth_callback'] = $_REQUEST['oauth_callback'];
- $_SESSION['oauth_consumer_key'] = $consumer_key;
- get_header();
- $description = $store->lookup_consumer_description($consumer_key);
- if($description) $description = 'Allow '.$description.' to access your Wordpress account and...';
- else $description = 'Allow the service you came from to access your Wordpress account and...';
- ?>
-
';
- $anid = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_type='post' ORDER BY post_date DESC LIMIT 1");
- echo 'Click here for a test page »';
-}//end function oauth_page
-
-function oauth_tab($s) {
- add_submenu_page('options-general.php', 'OAuth', 'OAuth', 1, __FILE__, 'oauth_page');
- return $s;
-}//end function
-add_action('admin_menu', 'oauth_tab');
-
-function oauth_services_render() {
- global $userdata;
- get_currentuserinfo();
- $services = get_option('oauth_services');
-
- if($_POST['save']) {
- $userdata->oauth_consumers = array();
- if(!$_POST['services']) $_POST['services'] = array();
- foreach($_POST['services'] as $key => $value) {
- $service = array('authorized' => true);
- foreach($services as $k => $v)
- if(in_array($k, array_keys($value)))
- $service[$k] = $v;
- $userdata->oauth_consumers[$key] = $service;
- }//end foreach services
- update_usermeta($userdata->ID, 'oauth_consumers', $userdata->oauth_consumers);
- }//end if save
-
- require_once dirname(__FILE__).'/OAuthWordpressStore.php';
- $store = new OAuthWordpressStore();
- echo '
';
- echo '
Change Service Permissions
';
- echo ' ';
- echo '
';
-}//end function oauth_services_render
-function oauth_services_tab($s) {
- add_submenu_page('profile.php', 'Services', 'Services', 1, __FILE__, 'oauth_services_render');
- return $s;
-}//end function
-add_action('admin_menu', 'oauth_services_tab');
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/request_token.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/request_token.php
deleted file mode 100755
index fd779bb..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-oauth/request_token.php
+++ /dev/null
@@ -1,22 +0,0 @@
-add_signature_method($sha1_method);
-$server->add_signature_method($plaintext_method);
-
-try {
- $req = OAuthRequest::from_request();
- $token = $server->fetch_request_token($req);
- print $token.'&xoauth_token_expires='.urlencode($store->token_expires($token));
-} catch (OAuthException $e) {
- header('Content-type: text/plain;', true, 400);
- print($e->getMessage() . "\n\n");
- var_dump($req);
- die;
-}
-
-?>
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID.php
deleted file mode 100755
index a1a0d43..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID.php
+++ /dev/null
@@ -1,577 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Require the fetcher code.
- */
-require_once "Auth/Yadis/PlainHTTPFetcher.php";
-require_once "Auth/Yadis/ParanoidHTTPFetcher.php";
-require_once "Auth/OpenID/BigMath.php";
-
-/**
- * Status code returned by the server when the only option is to show
- * an error page, since we do not have enough information to redirect
- * back to the consumer. The associated value is an error message that
- * should be displayed on an HTML error page.
- *
- * @see Auth_OpenID_Server
- */
-define('Auth_OpenID_LOCAL_ERROR', 'local_error');
-
-/**
- * Status code returned when there is an error to return in key-value
- * form to the consumer. The caller should return a 400 Bad Request
- * response with content-type text/plain and the value as the body.
- *
- * @see Auth_OpenID_Server
- */
-define('Auth_OpenID_REMOTE_ERROR', 'remote_error');
-
-/**
- * Status code returned when there is a key-value form OK response to
- * the consumer. The value associated with this code is the
- * response. The caller should return a 200 OK response with
- * content-type text/plain and the value as the body.
- *
- * @see Auth_OpenID_Server
- */
-define('Auth_OpenID_REMOTE_OK', 'remote_ok');
-
-/**
- * Status code returned when there is a redirect back to the
- * consumer. The value is the URL to redirect back to. The caller
- * should return a 302 Found redirect with a Location: header
- * containing the URL.
- *
- * @see Auth_OpenID_Server
- */
-define('Auth_OpenID_REDIRECT', 'redirect');
-
-/**
- * Status code returned when the caller needs to authenticate the
- * user. The associated value is a {@link Auth_OpenID_ServerRequest}
- * object that can be used to complete the authentication. If the user
- * has taken some authentication action, use the retry() method of the
- * {@link Auth_OpenID_ServerRequest} object to complete the request.
- *
- * @see Auth_OpenID_Server
- */
-define('Auth_OpenID_DO_AUTH', 'do_auth');
-
-/**
- * Status code returned when there were no OpenID arguments
- * passed. This code indicates that the caller should return a 200 OK
- * response and display an HTML page that says that this is an OpenID
- * server endpoint.
- *
- * @see Auth_OpenID_Server
- */
-define('Auth_OpenID_DO_ABOUT', 'do_about');
-
-/**
- * Defines for regexes and format checking.
- */
-define('Auth_OpenID_letters',
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
-
-define('Auth_OpenID_digits',
- "0123456789");
-
-define('Auth_OpenID_punct',
- "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
-
-if (Auth_OpenID_getMathLib() === null) {
- Auth_OpenID_setNoMathSupport();
-}
-
-/**
- * The OpenID utility function class.
- *
- * @package OpenID
- * @access private
- */
-class Auth_OpenID {
-
- /**
- * Return true if $thing is an Auth_OpenID_FailureResponse object;
- * false if not.
- *
- * @access private
- */
- function isFailure($thing)
- {
- return is_a($thing, 'Auth_OpenID_FailureResponse');
- }
-
- /**
- * Gets the query data from the server environment based on the
- * request method used. If GET was used, this looks at
- * $_SERVER['QUERY_STRING'] directly. If POST was used, this
- * fetches data from the special php://input file stream.
- *
- * Returns an associative array of the query arguments.
- *
- * Skips invalid key/value pairs (i.e. keys with no '=value'
- * portion).
- *
- * Returns an empty array if neither GET nor POST was used, or if
- * POST was used but php://input cannot be opened.
- *
- * @access private
- */
- function getQuery($query_str=null)
- {
- $data = array();
-
- if ($query_str !== null) {
- $data = Auth_OpenID::params_from_string($query_str);
- } else if (!array_key_exists('REQUEST_METHOD', $_SERVER)) {
- // Do nothing.
- } else {
- // XXX HACK FIXME HORRIBLE.
- //
- // POSTing to a URL with query parameters is acceptable, but
- // we don't have a clean way to distinguish those parameters
- // when we need to do things like return_to verification
- // which only want to look at one kind of parameter. We're
- // going to emulate the behavior of some other environments
- // by defaulting to GET and overwriting with POST if POST
- // data is available.
- $data = Auth_OpenID::params_from_string($_SERVER['QUERY_STRING']);
-
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $str = file_get_contents('php://input');
-
- if ($str === false) {
- $post = array();
- } else {
- $post = Auth_OpenID::params_from_string($str);
- }
-
- $data = array_merge($data, $post);
- }
- }
-
- return $data;
- }
-
- function params_from_string($str)
- {
- $chunks = explode("&", $str);
-
- $data = array();
- foreach ($chunks as $chunk) {
- $parts = explode("=", $chunk, 2);
-
- if (count($parts) != 2) {
- continue;
- }
-
- list($k, $v) = $parts;
- $data[$k] = urldecode($v);
- }
-
- return $data;
- }
-
- /**
- * Create dir_name as a directory if it does not exist. If it
- * exists, make sure that it is, in fact, a directory. Returns
- * true if the operation succeeded; false if not.
- *
- * @access private
- */
- function ensureDir($dir_name)
- {
- if (is_dir($dir_name) || @mkdir($dir_name)) {
- return true;
- } else {
- if (Auth_OpenID::ensureDir(dirname($dir_name))) {
- return is_dir($dir_name) || @mkdir($dir_name);
- } else {
- return false;
- }
- }
- }
-
- /**
- * Adds a string prefix to all values of an array. Returns a new
- * array containing the prefixed values.
- *
- * @access private
- */
- function addPrefix($values, $prefix)
- {
- $new_values = array();
- foreach ($values as $s) {
- $new_values[] = $prefix . $s;
- }
- return $new_values;
- }
-
- /**
- * Convenience function for getting array values. Given an array
- * $arr and a key $key, get the corresponding value from the array
- * or return $default if the key is absent.
- *
- * @access private
- */
- function arrayGet($arr, $key, $fallback = null)
- {
- if (is_array($arr)) {
- if (array_key_exists($key, $arr)) {
- return $arr[$key];
- } else {
- return $fallback;
- }
- } else {
- trigger_error("Auth_OpenID::arrayGet (key = ".$key.") expected " .
- "array as first parameter, got " .
- gettype($arr), E_USER_WARNING);
-
- return false;
- }
- }
-
- /**
- * Replacement for PHP's broken parse_str.
- */
- function parse_str($query)
- {
- if ($query === null) {
- return null;
- }
-
- $parts = explode('&', $query);
-
- $new_parts = array();
- for ($i = 0; $i < count($parts); $i++) {
- $pair = explode('=', $parts[$i]);
-
- if (count($pair) != 2) {
- continue;
- }
-
- list($key, $value) = $pair;
- $new_parts[$key] = urldecode($value);
- }
-
- return $new_parts;
- }
-
- /**
- * Implements the PHP 5 'http_build_query' functionality.
- *
- * @access private
- * @param array $data Either an array key/value pairs or an array
- * of arrays, each of which holding two values: a key and a value,
- * sequentially.
- * @return string $result The result of url-encoding the key/value
- * pairs from $data into a URL query string
- * (e.g. "username=bob&id=56").
- */
- function httpBuildQuery($data)
- {
- $pairs = array();
- foreach ($data as $key => $value) {
- if (is_array($value)) {
- $pairs[] = urlencode($value[0])."=".urlencode($value[1]);
- } else {
- $pairs[] = urlencode($key)."=".urlencode($value);
- }
- }
- return implode("&", $pairs);
- }
-
- /**
- * "Appends" query arguments onto a URL. The URL may or may not
- * already have arguments (following a question mark).
- *
- * @access private
- * @param string $url A URL, which may or may not already have
- * arguments.
- * @param array $args Either an array key/value pairs or an array of
- * arrays, each of which holding two values: a key and a value,
- * sequentially. If $args is an ordinary key/value array, the
- * parameters will be added to the URL in sorted alphabetical order;
- * if $args is an array of arrays, their order will be preserved.
- * @return string $url The original URL with the new parameters added.
- *
- */
- function appendArgs($url, $args)
- {
- if (count($args) == 0) {
- return $url;
- }
-
- // Non-empty array; if it is an array of arrays, use
- // multisort; otherwise use sort.
- if (array_key_exists(0, $args) &&
- is_array($args[0])) {
- // Do nothing here.
- } else {
- $keys = array_keys($args);
- sort($keys);
- $new_args = array();
- foreach ($keys as $key) {
- $new_args[] = array($key, $args[$key]);
- }
- $args = $new_args;
- }
-
- $sep = '?';
- if (strpos($url, '?') !== false) {
- $sep = '&';
- }
-
- return $url . $sep . Auth_OpenID::httpBuildQuery($args);
- }
-
- /**
- * Turn a string into an ASCII string.
- *
- * Replace non-ascii characters with a %-encoded, UTF-8
- * encoding. This function will fail if the input is a string and
- * there are non-7-bit-safe characters. It is assumed that the
- * caller will have already translated the input into a Unicode
- * character sequence, according to the encoding of the HTTP POST
- * or GET.
- *
- * Do not escape anything that is already 7-bit safe, so we do the
- * minimal transform on the identity URL
- *
- * @access private
- */
- function quoteMinimal($s)
- {
- $res = array();
- for ($i = 0; $i < strlen($s); $i++) {
- $c = $s[$i];
- if ($c >= "\x80") {
- for ($j = 0; $j < count(utf8_encode($c)); $j++) {
- array_push($res, sprintf("%02X", ord($c[$j])));
- }
- } else {
- array_push($res, $c);
- }
- }
-
- return implode('', $res);
- }
-
- /**
- * Implements python's urlunparse, which is not available in PHP.
- * Given the specified components of a URL, this function rebuilds
- * and returns the URL.
- *
- * @access private
- * @param string $scheme The scheme (e.g. 'http'). Defaults to 'http'.
- * @param string $host The host. Required.
- * @param string $port The port.
- * @param string $path The path.
- * @param string $query The query.
- * @param string $fragment The fragment.
- * @return string $url The URL resulting from assembling the
- * specified components.
- */
- function urlunparse($scheme, $host, $port = null, $path = '/',
- $query = '', $fragment = '')
- {
-
- if (!$scheme) {
- $scheme = 'http';
- }
-
- if (!$host) {
- return false;
- }
-
- if (!$path) {
- $path = '';
- }
-
- $result = $scheme . "://" . $host;
-
- if ($port) {
- $result .= ":" . $port;
- }
-
- $result .= $path;
-
- if ($query) {
- $result .= "?" . $query;
- }
-
- if ($fragment) {
- $result .= "#" . $fragment;
- }
-
- return $result;
- }
-
- /**
- * Given a URL, this "normalizes" it by adding a trailing slash
- * and / or a leading http:// scheme where necessary. Returns
- * null if the original URL is malformed and cannot be normalized.
- *
- * @access private
- * @param string $url The URL to be normalized.
- * @return mixed $new_url The URL after normalization, or null if
- * $url was malformed.
- */
- function normalizeUrl($url)
- {
- if ($url === null) {
- return null;
- }
-
- assert(is_string($url));
-
- $old_url = $url;
- $url = trim($url);
-
- if (strpos($url, "://") === false) {
- $url = "http://" . $url;
- }
-
- $parsed = @parse_url($url);
-
- if ($parsed === false) {
- return null;
- }
-
- $defaults = array(
- 'scheme' => '',
- 'host' => '',
- 'path' => '',
- 'query' => '',
- 'fragment' => '',
- 'port' => ''
- );
-
- $parsed = array_merge($defaults, $parsed);
-
- if (($parsed['scheme'] == '') ||
- ($parsed['host'] == '')) {
- if ($parsed['path'] == '' &&
- $parsed['query'] == '') {
- return null;
- }
-
- $url = 'http://' + $url;
- $parsed = parse_url($url);
-
- $parsed = array_merge($defaults, $parsed);
- }
-
- $tail = array_map(array('Auth_OpenID', 'quoteMinimal'),
- array($parsed['path'],
- $parsed['query']));
- if ($tail[0] == '') {
- $tail[0] = '/';
- }
-
- $url = Auth_OpenID::urlunparse($parsed['scheme'], $parsed['host'],
- $parsed['port'], $tail[0], $tail[1]);
-
- assert(is_string($url));
-
- return $url;
- }
-
- /**
- * Replacement (wrapper) for PHP's intval() because it's broken.
- *
- * @access private
- */
- function intval($value)
- {
- $re = "/^\\d+$/";
-
- if (!preg_match($re, $value)) {
- return false;
- }
-
- return intval($value);
- }
-
- /**
- * Count the number of bytes in a string independently of
- * multibyte support conditions.
- *
- * @param string $str The string of bytes to count.
- * @return int The number of bytes in $str.
- */
- function bytes($str)
- {
- return strlen(bin2hex($str)) / 2;
- }
-
- /**
- * Get the bytes in a string independently of multibyte support
- * conditions.
- */
- function toBytes($str)
- {
- $hex = bin2hex($str);
-
- if (!$hex) {
- return array();
- }
-
- $b = array();
- for ($i = 0; $i < strlen($hex); $i += 2) {
- $b[] = chr(base_convert(substr($hex, $i, 2), 16, 10));
- }
-
- return $b;
- }
-
- function urldefrag($url)
- {
- $parts = explode("#", $url, 2);
-
- if (count($parts) == 1) {
- return array($parts[0], "");
- } else {
- return $parts;
- }
- }
-
- function filter($callback, &$sequence)
- {
- $result = array();
-
- foreach ($sequence as $item) {
- if (call_user_func_array($callback, array($item))) {
- $result[] = $item;
- }
- }
-
- return $result;
- }
-
- function update(&$dest, &$src)
- {
- foreach ($src as $k => $v) {
- $dest[$k] = $v;
- }
- }
-}
-?>
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/AX.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/AX.php
deleted file mode 100755
index d183c44..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/AX.php
+++ /dev/null
@@ -1,1013 +0,0 @@
-message = $message;
- }
-}
-
-/**
- * Abstract class containing common code for attribute exchange
- * messages.
- *
- * @package OpenID
- */
-class Auth_OpenID_AX_Message extends Auth_OpenID_Extension {
- /**
- * ns_alias: The preferred namespace alias for attribute exchange
- * messages
- */
- var $ns_alias = 'ax';
-
- /**
- * mode: The type of this attribute exchange message. This must be
- * overridden in subclasses.
- */
- var $mode = null;
-
- var $ns_uri = Auth_OpenID_AX_NS_URI;
-
- /**
- * Return Auth_OpenID_AX_Error if the mode in the attribute
- * exchange arguments does not match what is expected for this
- * class; true otherwise.
- *
- * @access private
- */
- function _checkMode($ax_args)
- {
- $mode = Auth_OpenID::arrayGet($ax_args, 'mode');
- if ($mode != $this->mode) {
- return new Auth_OpenID_AX_Error(
- sprintf(
- "Expected mode '%s'; got '%s'",
- $this->mode, $mode));
- }
-
- return true;
- }
-
- /**
- * Return a set of attribute exchange arguments containing the
- * basic information that must be in every attribute exchange
- * message.
- *
- * @access private
- */
- function _newArgs()
- {
- return array('mode' => $this->mode);
- }
-}
-
-/**
- * Represents a single attribute in an attribute exchange
- * request. This should be added to an AXRequest object in order to
- * request the attribute.
- *
- * @package OpenID
- */
-class Auth_OpenID_AX_AttrInfo {
- /**
- * Construct an attribute information object. Do not call this
- * directly; call make(...) instead.
- *
- * @param string $type_uri The type URI for this attribute.
- *
- * @param int $count The number of values of this type to request.
- *
- * @param bool $required Whether the attribute will be marked as
- * required in the request.
- *
- * @param string $alias The name that should be given to this
- * attribute in the request.
- */
- function Auth_OpenID_AX_AttrInfo($type_uri, $count, $required,
- $alias)
- {
- /**
- * required: Whether the attribute will be marked as required
- * when presented to the subject of the attribute exchange
- * request.
- */
- $this->required = $required;
-
- /**
- * count: How many values of this type to request from the
- * subject. Defaults to one.
- */
- $this->count = $count;
-
- /**
- * type_uri: The identifier that determines what the attribute
- * represents and how it is serialized. For example, one type
- * URI representing dates could represent a Unix timestamp in
- * base 10 and another could represent a human-readable
- * string.
- */
- $this->type_uri = $type_uri;
-
- /**
- * alias: The name that should be given to this attribute in
- * the request. If it is not supplied, a generic name will be
- * assigned. For example, if you want to call a Unix timestamp
- * value 'tstamp', set its alias to that value. If two
- * attributes in the same message request to use the same
- * alias, the request will fail to be generated.
- */
- $this->alias = $alias;
- }
-
- /**
- * Construct an attribute information object. For parameter
- * details, see the constructor.
- */
- function make($type_uri, $count=1, $required=false,
- $alias=null)
- {
- if ($alias !== null) {
- $result = Auth_OpenID_AX_checkAlias($alias);
-
- if (Auth_OpenID_AX::isError($result)) {
- return $result;
- }
- }
-
- return new Auth_OpenID_AX_AttrInfo($type_uri, $count, $required,
- $alias);
- }
-
- /**
- * When processing a request for this attribute, the OP should
- * call this method to determine whether all available attribute
- * values were requested. If self.count == UNLIMITED_VALUES, this
- * returns True. Otherwise this returns False, in which case
- * self.count is an integer.
- */
- function wantsUnlimitedValues()
- {
- return $this->count === Auth_OpenID_AX_UNLIMITED_VALUES;
- }
-}
-
-/**
- * Given a namespace mapping and a string containing a comma-separated
- * list of namespace aliases, return a list of type URIs that
- * correspond to those aliases.
- *
- * @param $namespace_map The mapping from namespace URI to alias
- * @param $alias_list_s The string containing the comma-separated
- * list of aliases. May also be None for convenience.
- *
- * @return $seq The list of namespace URIs that corresponds to the
- * supplied list of aliases. If the string was zero-length or None, an
- * empty list will be returned.
- *
- * return null If an alias is present in the list of aliases but
- * is not present in the namespace map.
- */
-function Auth_OpenID_AX_toTypeURIs(&$namespace_map, $alias_list_s)
-{
- $uris = array();
-
- if ($alias_list_s) {
- foreach (explode(',', $alias_list_s) as $alias) {
- $type_uri = $namespace_map->getNamespaceURI($alias);
- if ($type_uri === null) {
- // raise KeyError(
- // 'No type is defined for attribute name %r' % (alias,))
- return new Auth_OpenID_AX_Error(
- sprintf('No type is defined for attribute name %s',
- $alias)
- );
- } else {
- $uris[] = $type_uri;
- }
- }
- }
-
- return $uris;
-}
-
-/**
- * An attribute exchange 'fetch_request' message. This message is sent
- * by a relying party when it wishes to obtain attributes about the
- * subject of an OpenID authentication request.
- *
- * @package OpenID
- */
-class Auth_OpenID_AX_FetchRequest extends Auth_OpenID_AX_Message {
-
- var $mode = 'fetch_request';
-
- function Auth_OpenID_AX_FetchRequest($update_url=null)
- {
- /**
- * requested_attributes: The attributes that have been
- * requested thus far, indexed by the type URI.
- */
- $this->requested_attributes = array();
-
- /**
- * update_url: A URL that will accept responses for this
- * attribute exchange request, even in the absence of the user
- * who made this request.
- */
- $this->update_url = $update_url;
- }
-
- /**
- * Add an attribute to this attribute exchange request.
- *
- * @param attribute: The attribute that is being requested
- * @return true on success, false when the requested attribute is
- * already present in this fetch request.
- */
- function add($attribute)
- {
- if ($this->contains($attribute->type_uri)) {
- return new Auth_OpenID_AX_Error(
- sprintf("The attribute %s has already been requested",
- $attribute->type_uri));
- }
-
- $this->requested_attributes[$attribute->type_uri] = $attribute;
-
- return true;
- }
-
- /**
- * Get the serialized form of this attribute fetch request.
- *
- * @returns Auth_OpenID_AX_FetchRequest The fetch request message parameters
- */
- function getExtensionArgs()
- {
- $aliases = new Auth_OpenID_NamespaceMap();
-
- $required = array();
- $if_available = array();
-
- $ax_args = $this->_newArgs();
-
- foreach ($this->requested_attributes as $type_uri => $attribute) {
- if ($attribute->alias === null) {
- $alias = $aliases->add($type_uri);
- } else {
- $alias = $aliases->addAlias($type_uri, $attribute->alias);
-
- if ($alias === null) {
- return new Auth_OpenID_AX_Error(
- sprintf("Could not add alias %s for URI %s",
- $attribute->alias, $type_uri
- ));
- }
- }
-
- if ($attribute->required) {
- $required[] = $alias;
- } else {
- $if_available[] = $alias;
- }
-
- if ($attribute->count != 1) {
- $ax_args['count.' . $alias] = strval($attribute->count);
- }
-
- $ax_args['type.' . $alias] = $type_uri;
- }
-
- if ($required) {
- $ax_args['required'] = implode(',', $required);
- }
-
- if ($if_available) {
- $ax_args['if_available'] = implode(',', $if_available);
- }
-
- return $ax_args;
- }
-
- /**
- * Get the type URIs for all attributes that have been marked as
- * required.
- *
- * @return A list of the type URIs for attributes that have been
- * marked as required.
- */
- function getRequiredAttrs()
- {
- $required = array();
- foreach ($this->requested_attributes as $type_uri => $attribute) {
- if ($attribute->required) {
- $required[] = $type_uri;
- }
- }
-
- return $required;
- }
-
- /**
- * Extract a FetchRequest from an OpenID message
- *
- * @param message: The OpenID message containing the attribute
- * fetch request
- *
- * @returns mixed An Auth_OpenID_AX_Error or the
- * Auth_OpenID_AX_FetchRequest extracted from the message if
- * successful
- */
- function &fromOpenIDRequest($message)
- {
- $obj = new Auth_OpenID_AX_FetchRequest();
- $ax_args = $message->getArgs($obj->ns_uri);
-
- $result = $obj->parseExtensionArgs($ax_args);
-
- if (Auth_OpenID_AX::isError($result)) {
- return $result;
- }
-
- if ($obj->update_url) {
- // Update URL must match the openid.realm of the
- // underlying OpenID 2 message.
- $realm = $message->getArg(Auth_OpenID_OPENID_NS, 'realm',
- $message->getArg(
- Auth_OpenID_OPENID_NS,
- 'return_to'));
-
- if (!$realm) {
- $obj = new Auth_OpenID_AX_Error(
- sprintf("Cannot validate update_url %s " .
- "against absent realm", $obj->update_url));
- } else if (!Auth_OpenID_TrustRoot::match($realm,
- $obj->update_url)) {
- $obj = new Auth_OpenID_AX_Error(
- sprintf("Update URL %s failed validation against realm %s",
- $obj->update_url, $realm));
- }
- }
-
- return $obj;
- }
-
- /**
- * Given attribute exchange arguments, populate this FetchRequest.
- *
- * @return $result Auth_OpenID_AX_Error if the data to be parsed
- * does not follow the attribute exchange specification. At least
- * when 'if_available' or 'required' is not specified for a
- * particular attribute type. Returns true otherwise.
- */
- function parseExtensionArgs($ax_args)
- {
- $result = $this->_checkMode($ax_args);
- if (Auth_OpenID_AX::isError($result)) {
- return $result;
- }
-
- $aliases = new Auth_OpenID_NamespaceMap();
-
- foreach ($ax_args as $key => $value) {
- if (strpos($key, 'type.') === 0) {
- $alias = substr($key, 5);
- $type_uri = $value;
-
- $alias = $aliases->addAlias($type_uri, $alias);
-
- if ($alias === null) {
- return new Auth_OpenID_AX_Error(
- sprintf("Could not add alias %s for URI %s",
- $alias, $type_uri)
- );
- }
-
- $count_s = Auth_OpenID::arrayGet($ax_args, 'count.' . $alias);
- if ($count_s) {
- $count = Auth_OpenID::intval($count_s);
- if (($count === false) &&
- ($count_s === Auth_OpenID_AX_UNLIMITED_VALUES)) {
- $count = $count_s;
- }
- } else {
- $count = 1;
- }
-
- if ($count === false) {
- return new Auth_OpenID_AX_Error(
- sprintf("Integer value expected for %s, got %s",
- 'count.' . $alias, $count_s));
- }
-
- $attrinfo = Auth_OpenID_AX_AttrInfo::make($type_uri, $count,
- false, $alias);
-
- if (Auth_OpenID_AX::isError($attrinfo)) {
- return $attrinfo;
- }
-
- $this->add($attrinfo);
- }
- }
-
- $required = Auth_OpenID_AX_toTypeURIs($aliases,
- Auth_OpenID::arrayGet($ax_args, 'required'));
-
- foreach ($required as $type_uri) {
- $attrib =& $this->requested_attributes[$type_uri];
- $attrib->required = true;
- }
-
- $if_available = Auth_OpenID_AX_toTypeURIs($aliases,
- Auth_OpenID::arrayGet($ax_args, 'if_available'));
-
- $all_type_uris = array_merge($required, $if_available);
-
- foreach ($aliases->iterNamespaceURIs() as $type_uri) {
- if (!in_array($type_uri, $all_type_uris)) {
- return new Auth_OpenID_AX_Error(
- sprintf('Type URI %s was in the request but not ' .
- 'present in "required" or "if_available"',
- $type_uri));
-
- }
- }
-
- $this->update_url = Auth_OpenID::arrayGet($ax_args, 'update_url');
-
- return true;
- }
-
- /**
- * Iterate over the AttrInfo objects that are contained in this
- * fetch_request.
- */
- function iterAttrs()
- {
- return array_values($this->requested_attributes);
- }
-
- function iterTypes()
- {
- return array_keys($this->requested_attributes);
- }
-
- /**
- * Is the given type URI present in this fetch_request?
- */
- function contains($type_uri)
- {
- return in_array($type_uri, $this->iterTypes());
- }
-}
-
-/**
- * An abstract class that implements a message that has attribute keys
- * and values. It contains the common code between fetch_response and
- * store_request.
- *
- * @package OpenID
- */
-class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
-
- function Auth_OpenID_AX_KeyValueMessage()
- {
- $this->data = array();
- }
-
- /**
- * Add a single value for the given attribute type to the
- * message. If there are already values specified for this type,
- * this value will be sent in addition to the values already
- * specified.
- *
- * @param type_uri: The URI for the attribute
- * @param value: The value to add to the response to the relying
- * party for this attribute
- * @return null
- */
- function addValue($type_uri, $value)
- {
- if (!array_key_exists($type_uri, $this->data)) {
- $this->data[$type_uri] = array();
- }
-
- $values =& $this->data[$type_uri];
- $values[] = $value;
- }
-
- /**
- * Set the values for the given attribute type. This replaces any
- * values that have already been set for this attribute.
- *
- * @param type_uri: The URI for the attribute
- * @param values: A list of values to send for this attribute.
- */
- function setValues($type_uri, &$values)
- {
- $this->data[$type_uri] =& $values;
- }
-
- /**
- * Get the extension arguments for the key/value pairs contained
- * in this message.
- *
- * @param aliases: An alias mapping. Set to None if you don't care
- * about the aliases for this request.
- *
- * @access private
- */
- function _getExtensionKVArgs(&$aliases)
- {
- if ($aliases === null) {
- $aliases = new Auth_OpenID_NamespaceMap();
- }
-
- $ax_args = array();
-
- foreach ($this->data as $type_uri => $values) {
- $alias = $aliases->add($type_uri);
-
- $ax_args['type.' . $alias] = $type_uri;
- $ax_args['count.' . $alias] = strval(count($values));
-
- foreach ($values as $i => $value) {
- $key = sprintf('value.%s.%d', $alias, $i + 1);
- $ax_args[$key] = $value;
- }
- }
-
- return $ax_args;
- }
-
- /**
- * Parse attribute exchange key/value arguments into this object.
- *
- * @param ax_args: The attribute exchange fetch_response
- * arguments, with namespacing removed.
- *
- * @return Auth_OpenID_AX_Error or true
- */
- function parseExtensionArgs($ax_args)
- {
- $result = $this->_checkMode($ax_args);
- if (Auth_OpenID_AX::isError($result)) {
- return $result;
- }
-
- $aliases = new Auth_OpenID_NamespaceMap();
-
- foreach ($ax_args as $key => $value) {
- if (strpos($key, 'type.') === 0) {
- $type_uri = $value;
- $alias = substr($key, 5);
-
- $result = Auth_OpenID_AX_checkAlias($alias);
-
- if (Auth_OpenID_AX::isError($result)) {
- return $result;
- }
-
- $alias = $aliases->addAlias($type_uri, $alias);
-
- if ($alias === null) {
- return new Auth_OpenID_AX_Error(
- sprintf("Could not add alias %s for URI %s",
- $alias, $type_uri)
- );
- }
- }
- }
-
- foreach ($aliases->iteritems() as $pair) {
- list($type_uri, $alias) = $pair;
-
- if (array_key_exists('count.' . $alias, $ax_args)) {
-
- $count_key = 'count.' . $alias;
- $count_s = $ax_args[$count_key];
-
- $count = Auth_OpenID::intval($count_s);
-
- if ($count === false) {
- return new Auth_OpenID_AX_Error(
- sprintf("Integer value expected for %s, got %s",
- 'count. %s' . $alias, $count_s,
- Auth_OpenID_AX_UNLIMITED_VALUES)
- );
- }
-
- $values = array();
- for ($i = 1; $i < $count + 1; $i++) {
- $value_key = sprintf('value.%s.%d', $alias, $i);
-
- if (!array_key_exists($value_key, $ax_args)) {
- return new Auth_OpenID_AX_Error(
- sprintf(
- "No value found for key %s",
- $value_key));
- }
-
- $value = $ax_args[$value_key];
- $values[] = $value;
- }
- } else {
- $key = 'value.' . $alias;
-
- if (!array_key_exists($key, $ax_args)) {
- return new Auth_OpenID_AX_Error(
- sprintf(
- "No value found for key %s",
- $key));
- }
-
- $value = $ax_args['value.' . $alias];
-
- if ($value == '') {
- $values = array();
- } else {
- $values = array($value);
- }
- }
-
- $this->data[$type_uri] = $values;
- }
-
- return true;
- }
-
- /**
- * Get a single value for an attribute. If no value was sent for
- * this attribute, use the supplied default. If there is more than
- * one value for this attribute, this method will fail.
- *
- * @param type_uri: The URI for the attribute
- * @param default: The value to return if the attribute was not
- * sent in the fetch_response.
- *
- * @return $value Auth_OpenID_AX_Error on failure or the value of
- * the attribute in the fetch_response message, or the default
- * supplied
- */
- function getSingle($type_uri, $default=null)
- {
- $values = Auth_OpenID::arrayGet($this->data, $type_uri);
- if (!$values) {
- return $default;
- } else if (count($values) == 1) {
- return $values[0];
- } else {
- return new Auth_OpenID_AX_Error(
- sprintf('More than one value present for %s',
- $type_uri)
- );
- }
- }
-
- /**
- * Get the list of values for this attribute in the
- * fetch_response.
- *
- * XXX: what to do if the values are not present? default
- * parameter? this is funny because it's always supposed to return
- * a list, so the default may break that, though it's provided by
- * the user's code, so it might be okay. If no default is
- * supplied, should the return be None or []?
- *
- * @param type_uri: The URI of the attribute
- *
- * @return $values The list of values for this attribute in the
- * response. May be an empty list. If the attribute was not sent
- * in the response, returns Auth_OpenID_AX_Error.
- */
- function get($type_uri)
- {
- if (array_key_exists($type_uri, $this->data)) {
- return $this->data[$type_uri];
- } else {
- return new Auth_OpenID_AX_Error(
- sprintf("Type URI %s not found in response",
- $type_uri)
- );
- }
- }
-
- /**
- * Get the number of responses for a particular attribute in this
- * fetch_response message.
- *
- * @param type_uri: The URI of the attribute
- *
- * @returns int The number of values sent for this attribute. If
- * the attribute was not sent in the response, returns
- * Auth_OpenID_AX_Error.
- */
- function count($type_uri)
- {
- if (array_key_exists($type_uri, $this->data)) {
- return count($this->get($type_uri));
- } else {
- return new Auth_OpenID_AX_Error(
- sprintf("Type URI %s not found in response",
- $type_uri)
- );
- }
- }
-}
-
-/**
- * A fetch_response attribute exchange message.
- *
- * @package OpenID
- */
-class Auth_OpenID_AX_FetchResponse extends Auth_OpenID_AX_KeyValueMessage {
- var $mode = 'fetch_response';
-
- function Auth_OpenID_AX_FetchResponse($update_url=null)
- {
- $this->Auth_OpenID_AX_KeyValueMessage();
- $this->update_url = $update_url;
- }
-
- /**
- * Serialize this object into arguments in the attribute exchange
- * namespace
- *
- * @return $args The dictionary of unqualified attribute exchange
- * arguments that represent this fetch_response, or
- * Auth_OpenID_AX_Error on error.
- */
- function getExtensionArgs($request=null)
- {
- $aliases = new Auth_OpenID_NamespaceMap();
-
- $zero_value_types = array();
-
- if ($request !== null) {
- // Validate the data in the context of the request (the
- // same attributes should be present in each, and the
- // counts in the response must be no more than the counts
- // in the request)
-
- foreach ($this->data as $type_uri => $unused) {
- if (!$request->contains($type_uri)) {
- return new Auth_OpenID_AX_Error(
- sprintf("Response attribute not present in request: %s",
- $type_uri)
- );
- }
- }
-
- foreach ($request->iterAttrs() as $attr_info) {
- // Copy the aliases from the request so that reading
- // the response in light of the request is easier
- if ($attr_info->alias === null) {
- $aliases->add($attr_info->type_uri);
- } else {
- $alias = $aliases->addAlias($attr_info->type_uri,
- $attr_info->alias);
-
- if ($alias === null) {
- return new Auth_OpenID_AX_Error(
- sprintf("Could not add alias %s for URI %s",
- $attr_info->alias, $attr_info->type_uri)
- );
- }
- }
-
- if (array_key_exists($attr_info->type_uri, $this->data)) {
- $values = $this->data[$attr_info->type_uri];
- } else {
- $values = array();
- $zero_value_types[] = $attr_info;
- }
-
- if (($attr_info->count != Auth_OpenID_AX_UNLIMITED_VALUES) &&
- ($attr_info->count < count($values))) {
- return new Auth_OpenID_AX_Error(
- sprintf("More than the number of requested values " .
- "were specified for %s",
- $attr_info->type_uri)
- );
- }
- }
- }
-
- $kv_args = $this->_getExtensionKVArgs($aliases);
-
- // Add the KV args into the response with the args that are
- // unique to the fetch_response
- $ax_args = $this->_newArgs();
-
- // For each requested attribute, put its type/alias and count
- // into the response even if no data were returned.
- foreach ($zero_value_types as $attr_info) {
- $alias = $aliases->getAlias($attr_info->type_uri);
- $kv_args['type.' . $alias] = $attr_info->type_uri;
- $kv_args['count.' . $alias] = '0';
- }
-
- $update_url = null;
- if ($request) {
- $update_url = $request->update_url;
- } else {
- $update_url = $this->update_url;
- }
-
- if ($update_url) {
- $ax_args['update_url'] = $update_url;
- }
-
- Auth_OpenID::update(&$ax_args, $kv_args);
-
- return $ax_args;
- }
-
- /**
- * @return $result Auth_OpenID_AX_Error on failure or true on
- * success.
- */
- function parseExtensionArgs($ax_args)
- {
- $result = parent::parseExtensionArgs($ax_args);
-
- if (Auth_OpenID_AX::isError($result)) {
- return $result;
- }
-
- $this->update_url = Auth_OpenID::arrayGet($ax_args, 'update_url');
-
- return true;
- }
-
- /**
- * Construct a FetchResponse object from an OpenID library
- * SuccessResponse object.
- *
- * @param success_response: A successful id_res response object
- *
- * @param signed: Whether non-signed args should be processsed. If
- * True (the default), only signed arguments will be processsed.
- *
- * @return $response A FetchResponse containing the data from the
- * OpenID message
- */
- function &fromSuccessResponse($success_response, $signed=true)
- {
- $obj = new Auth_OpenID_AX_FetchResponse();
- if ($signed) {
- $ax_args = $success_response->getSignedNS($obj->ns_uri);
- } else {
- $ax_args = $success_response->message->getArgs($obj->ns_uri);
- }
-
- return $obj->parseExtensionArgs($ax_args);
- }
-}
-
-/**
- * A store request attribute exchange message representation.
- *
- * @package OpenID
- */
-class Auth_OpenID_AX_StoreRequest extends Auth_OpenID_AX_KeyValueMessage {
- var $mode = 'store_request';
-
- /**
- * @param array $aliases The namespace aliases to use when making
- * this store response. Leave as None to use defaults.
- */
- function getExtensionArgs($aliases=null)
- {
- $ax_args = $this->_newArgs();
- $kv_args = $this->_getExtensionKVArgs($aliases);
- Auth_OpenID::update(&$ax_args, $kv_args);
- return $ax_args;
- }
-}
-
-/**
- * An indication that the store request was processed along with this
- * OpenID transaction. Use make(), NOT the constructor, to create
- * response objects.
- *
- * @package OpenID
- */
-class Auth_OpenID_AX_StoreResponse extends Auth_OpenID_AX_Message {
- var $SUCCESS_MODE = 'store_response_success';
- var $FAILURE_MODE = 'store_response_failure';
-
- /**
- * Returns Auth_OpenID_AX_Error on error or an
- * Auth_OpenID_AX_StoreResponse object on success.
- */
- function &make($succeeded=true, $error_message=null)
- {
- if (($succeeded) && ($error_message !== null)) {
- return new Auth_OpenID_AX_Error('An error message may only be '.
- 'included in a failing fetch response');
- }
-
- return new Auth_OpenID_AX_StoreResponse($succeeded, $error_message);
- }
-
- function Auth_OpenID_AX_StoreResponse($succeeded=true, $error_message=null)
- {
- if ($succeeded) {
- $this->mode = $this->SUCCESS_MODE;
- } else {
- $this->mode = $this->FAILURE_MODE;
- }
-
- $this->error_message = $error_message;
- }
-
- /**
- * Was this response a success response?
- */
- function succeeded()
- {
- return $this->mode == $this->SUCCESS_MODE;
- }
-
- function getExtensionArgs()
- {
- $ax_args = $this->_newArgs();
- if ((!$this->succeeded()) && $this->error_message) {
- $ax_args['error'] = $this->error_message;
- }
-
- return $ax_args;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Association.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Association.php
deleted file mode 100755
index 904655f..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Association.php
+++ /dev/null
@@ -1,613 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * @access private
- */
-require_once 'Auth/OpenID/CryptUtil.php';
-
-/**
- * @access private
- */
-require_once 'Auth/OpenID/KVForm.php';
-
-/**
- * @access private
- */
-require_once 'Auth/OpenID/HMACSHA1.php';
-
-/**
- * This class represents an association between a server and a
- * consumer. In general, users of this library will never see
- * instances of this object. The only exception is if you implement a
- * custom {@link Auth_OpenID_OpenIDStore}.
- *
- * If you do implement such a store, it will need to store the values
- * of the handle, secret, issued, lifetime, and assoc_type instance
- * variables.
- *
- * @package OpenID
- */
-class Auth_OpenID_Association {
-
- /**
- * This is a HMAC-SHA1 specific value.
- *
- * @access private
- */
- var $SIG_LENGTH = 20;
-
- /**
- * The ordering and name of keys as stored by serialize.
- *
- * @access private
- */
- var $assoc_keys = array(
- 'version',
- 'handle',
- 'secret',
- 'issued',
- 'lifetime',
- 'assoc_type'
- );
-
- var $_macs = array(
- 'HMAC-SHA1' => 'Auth_OpenID_HMACSHA1',
- 'HMAC-SHA256' => 'Auth_OpenID_HMACSHA256'
- );
-
- /**
- * This is an alternate constructor (factory method) used by the
- * OpenID consumer library to create associations. OpenID store
- * implementations shouldn't use this constructor.
- *
- * @access private
- *
- * @param integer $expires_in This is the amount of time this
- * association is good for, measured in seconds since the
- * association was issued.
- *
- * @param string $handle This is the handle the server gave this
- * association.
- *
- * @param string secret This is the shared secret the server
- * generated for this association.
- *
- * @param assoc_type This is the type of association this
- * instance represents. The only valid values of this field at
- * this time is 'HMAC-SHA1' and 'HMAC-SHA256', but new types may
- * be defined in the future.
- *
- * @return association An {@link Auth_OpenID_Association}
- * instance.
- */
- function fromExpiresIn($expires_in, $handle, $secret, $assoc_type)
- {
- $issued = time();
- $lifetime = $expires_in;
- return new Auth_OpenID_Association($handle, $secret,
- $issued, $lifetime, $assoc_type);
- }
-
- /**
- * This is the standard constructor for creating an association.
- * The library should create all of the necessary associations, so
- * this constructor is not part of the external API.
- *
- * @access private
- *
- * @param string $handle This is the handle the server gave this
- * association.
- *
- * @param string $secret This is the shared secret the server
- * generated for this association.
- *
- * @param integer $issued This is the time this association was
- * issued, in seconds since 00:00 GMT, January 1, 1970. (ie, a
- * unix timestamp)
- *
- * @param integer $lifetime This is the amount of time this
- * association is good for, measured in seconds since the
- * association was issued.
- *
- * @param string $assoc_type This is the type of association this
- * instance represents. The only valid values of this field at
- * this time is 'HMAC-SHA1' and 'HMAC-SHA256', but new types may
- * be defined in the future.
- */
- function Auth_OpenID_Association(
- $handle, $secret, $issued, $lifetime, $assoc_type)
- {
- if (!in_array($assoc_type,
- Auth_OpenID_getSupportedAssociationTypes())) {
- $fmt = 'Unsupported association type (%s)';
- trigger_error(sprintf($fmt, $assoc_type), E_USER_ERROR);
- }
-
- $this->handle = $handle;
- $this->secret = $secret;
- $this->issued = $issued;
- $this->lifetime = $lifetime;
- $this->assoc_type = $assoc_type;
- }
-
- /**
- * This returns the number of seconds this association is still
- * valid for, or 0 if the association is no longer valid.
- *
- * @return integer $seconds The number of seconds this association
- * is still valid for, or 0 if the association is no longer valid.
- */
- function getExpiresIn($now = null)
- {
- if ($now == null) {
- $now = time();
- }
-
- return max(0, $this->issued + $this->lifetime - $now);
- }
-
- /**
- * This checks to see if two {@link Auth_OpenID_Association}
- * instances represent the same association.
- *
- * @return bool $result true if the two instances represent the
- * same association, false otherwise.
- */
- function equal($other)
- {
- return ((gettype($this) == gettype($other))
- && ($this->handle == $other->handle)
- && ($this->secret == $other->secret)
- && ($this->issued == $other->issued)
- && ($this->lifetime == $other->lifetime)
- && ($this->assoc_type == $other->assoc_type));
- }
-
- /**
- * Convert an association to KV form.
- *
- * @return string $result String in KV form suitable for
- * deserialization by deserialize.
- */
- function serialize()
- {
- $data = array(
- 'version' => '2',
- 'handle' => $this->handle,
- 'secret' => base64_encode($this->secret),
- 'issued' => strval(intval($this->issued)),
- 'lifetime' => strval(intval($this->lifetime)),
- 'assoc_type' => $this->assoc_type
- );
-
- assert(array_keys($data) == $this->assoc_keys);
-
- return Auth_OpenID_KVForm::fromArray($data, $strict = true);
- }
-
- /**
- * Parse an association as stored by serialize(). This is the
- * inverse of serialize.
- *
- * @param string $assoc_s Association as serialized by serialize()
- * @return Auth_OpenID_Association $result instance of this class
- */
- function deserialize($class_name, $assoc_s)
- {
- $pairs = Auth_OpenID_KVForm::toArray($assoc_s, $strict = true);
- $keys = array();
- $values = array();
- foreach ($pairs as $key => $value) {
- if (is_array($value)) {
- list($key, $value) = $value;
- }
- $keys[] = $key;
- $values[] = $value;
- }
-
- $class_vars = get_class_vars($class_name);
- $class_assoc_keys = $class_vars['assoc_keys'];
-
- sort($keys);
- sort($class_assoc_keys);
-
- if ($keys != $class_assoc_keys) {
- trigger_error('Unexpected key values: ' . var_export($keys, true),
- E_USER_WARNING);
- return null;
- }
-
- $version = $pairs['version'];
- $handle = $pairs['handle'];
- $secret = $pairs['secret'];
- $issued = $pairs['issued'];
- $lifetime = $pairs['lifetime'];
- $assoc_type = $pairs['assoc_type'];
-
- if ($version != '2') {
- trigger_error('Unknown version: ' . $version, E_USER_WARNING);
- return null;
- }
-
- $issued = intval($issued);
- $lifetime = intval($lifetime);
- $secret = base64_decode($secret);
-
- return new $class_name(
- $handle, $secret, $issued, $lifetime, $assoc_type);
- }
-
- /**
- * Generate a signature for a sequence of (key, value) pairs
- *
- * @access private
- * @param array $pairs The pairs to sign, in order. This is an
- * array of two-tuples.
- * @return string $signature The binary signature of this sequence
- * of pairs
- */
- function sign($pairs)
- {
- $kv = Auth_OpenID_KVForm::fromArray($pairs);
-
- /* Invalid association types should be caught at constructor */
- $callback = $this->_macs[$this->assoc_type];
-
- return call_user_func_array($callback, array($this->secret, $kv));
- }
-
- /**
- * Generate a signature for some fields in a dictionary
- *
- * @access private
- * @param array $fields The fields to sign, in order; this is an
- * array of strings.
- * @param array $data Dictionary of values to sign (an array of
- * string => string pairs).
- * @return string $signature The signature, base64 encoded
- */
- function signMessage($message)
- {
- if ($message->hasKey(Auth_OpenID_OPENID_NS, 'sig') ||
- $message->hasKey(Auth_OpenID_OPENID_NS, 'signed')) {
- // Already has a sig
- return null;
- }
-
- $extant_handle = $message->getArg(Auth_OpenID_OPENID_NS,
- 'assoc_handle');
-
- if ($extant_handle && ($extant_handle != $this->handle)) {
- // raise ValueError("Message has a different association handle")
- return null;
- }
-
- $signed_message = $message;
- $signed_message->setArg(Auth_OpenID_OPENID_NS, 'assoc_handle',
- $this->handle);
-
- $message_keys = array_keys($signed_message->toPostArgs());
- $signed_list = array();
- $signed_prefix = 'openid.';
-
- foreach ($message_keys as $k) {
- if (strpos($k, $signed_prefix) === 0) {
- $signed_list[] = substr($k, strlen($signed_prefix));
- }
- }
-
- $signed_list[] = 'signed';
- sort($signed_list);
-
- $signed_message->setArg(Auth_OpenID_OPENID_NS, 'signed',
- implode(',', $signed_list));
- $sig = $this->getMessageSignature($signed_message);
- $signed_message->setArg(Auth_OpenID_OPENID_NS, 'sig', $sig);
- return $signed_message;
- }
-
- /**
- * Given a {@link Auth_OpenID_Message}, return the key/value pairs
- * to be signed according to the signed list in the message. If
- * the message lacks a signed list, return null.
- *
- * @access private
- */
- function _makePairs(&$message)
- {
- $signed = $message->getArg(Auth_OpenID_OPENID_NS, 'signed');
- if (!$signed) {
- // raise ValueError('Message has no signed list: %s' % (message,))
- return null;
- }
-
- $signed_list = explode(',', $signed);
- $pairs = array();
- $data = $message->toPostArgs();
- foreach ($signed_list as $field) {
- $pairs[] = array($field, Auth_OpenID::arrayGet($data,
- 'openid.' .
- $field, ''));
- }
- return $pairs;
- }
-
- /**
- * Given an {@link Auth_OpenID_Message}, return the signature for
- * the signed list in the message.
- *
- * @access private
- */
- function getMessageSignature(&$message)
- {
- $pairs = $this->_makePairs($message);
- return base64_encode($this->sign($pairs));
- }
-
- /**
- * Confirm that the signature of these fields matches the
- * signature contained in the data.
- *
- * @access private
- */
- function checkMessageSignature(&$message)
- {
- $sig = $message->getArg(Auth_OpenID_OPENID_NS,
- 'sig');
-
- if (!$sig) {
- return false;
- }
-
- $calculated_sig = $this->getMessageSignature($message);
- return $calculated_sig == $sig;
- }
-}
-
-function Auth_OpenID_getSecretSize($assoc_type)
-{
- if ($assoc_type == 'HMAC-SHA1') {
- return 20;
- } else if ($assoc_type == 'HMAC-SHA256') {
- return 32;
- } else {
- return null;
- }
-}
-
-function Auth_OpenID_getAllAssociationTypes()
-{
- return array('HMAC-SHA1', 'HMAC-SHA256');
-}
-
-function Auth_OpenID_getSupportedAssociationTypes()
-{
- $a = array('HMAC-SHA1');
-
- if (Auth_OpenID_HMACSHA256_SUPPORTED) {
- $a[] = 'HMAC-SHA256';
- }
-
- return $a;
-}
-
-function Auth_OpenID_getSessionTypes($assoc_type)
-{
- $assoc_to_session = array(
- 'HMAC-SHA1' => array('DH-SHA1', 'no-encryption'));
-
- if (Auth_OpenID_HMACSHA256_SUPPORTED) {
- $assoc_to_session['HMAC-SHA256'] =
- array('DH-SHA256', 'no-encryption');
- }
-
- return Auth_OpenID::arrayGet($assoc_to_session, $assoc_type, array());
-}
-
-function Auth_OpenID_checkSessionType($assoc_type, $session_type)
-{
- if (!in_array($session_type,
- Auth_OpenID_getSessionTypes($assoc_type))) {
- return false;
- }
-
- return true;
-}
-
-function Auth_OpenID_getDefaultAssociationOrder()
-{
- $order = array();
-
- if (!Auth_OpenID_noMathSupport()) {
- $order[] = array('HMAC-SHA1', 'DH-SHA1');
-
- if (Auth_OpenID_HMACSHA256_SUPPORTED) {
- $order[] = array('HMAC-SHA256', 'DH-SHA256');
- }
- }
-
- $order[] = array('HMAC-SHA1', 'no-encryption');
-
- if (Auth_OpenID_HMACSHA256_SUPPORTED) {
- $order[] = array('HMAC-SHA256', 'no-encryption');
- }
-
- return $order;
-}
-
-function Auth_OpenID_getOnlyEncryptedOrder()
-{
- $result = array();
-
- foreach (Auth_OpenID_getDefaultAssociationOrder() as $pair) {
- list($assoc, $session) = $pair;
-
- if ($session != 'no-encryption') {
- if (Auth_OpenID_HMACSHA256_SUPPORTED &&
- ($assoc == 'HMAC-SHA256')) {
- $result[] = $pair;
- } else if ($assoc != 'HMAC-SHA256') {
- $result[] = $pair;
- }
- }
- }
-
- return $result;
-}
-
-function &Auth_OpenID_getDefaultNegotiator()
-{
- $x = new Auth_OpenID_SessionNegotiator(
- Auth_OpenID_getDefaultAssociationOrder());
- return $x;
-}
-
-function &Auth_OpenID_getEncryptedNegotiator()
-{
- $x = new Auth_OpenID_SessionNegotiator(
- Auth_OpenID_getOnlyEncryptedOrder());
- return $x;
-}
-
-/**
- * A session negotiator controls the allowed and preferred association
- * types and association session types. Both the {@link
- * Auth_OpenID_Consumer} and {@link Auth_OpenID_Server} use
- * negotiators when creating associations.
- *
- * You can create and use negotiators if you:
-
- * - Do not want to do Diffie-Hellman key exchange because you use
- * transport-layer encryption (e.g. SSL)
- *
- * - Want to use only SHA-256 associations
- *
- * - Do not want to support plain-text associations over a non-secure
- * channel
- *
- * It is up to you to set a policy for what kinds of associations to
- * accept. By default, the library will make any kind of association
- * that is allowed in the OpenID 2.0 specification.
- *
- * Use of negotiators in the library
- * =================================
- *
- * When a consumer makes an association request, it calls {@link
- * getAllowedType} to get the preferred association type and
- * association session type.
- *
- * The server gets a request for a particular association/session type
- * and calls {@link isAllowed} to determine if it should create an
- * association. If it is supported, negotiation is complete. If it is
- * not, the server calls {@link getAllowedType} to get an allowed
- * association type to return to the consumer.
- *
- * If the consumer gets an error response indicating that the
- * requested association/session type is not supported by the server
- * that contains an assocation/session type to try, it calls {@link
- * isAllowed} to determine if it should try again with the given
- * combination of association/session type.
- *
- * @package OpenID
- */
-class Auth_OpenID_SessionNegotiator {
- function Auth_OpenID_SessionNegotiator($allowed_types)
- {
- $this->allowed_types = array();
- $this->setAllowedTypes($allowed_types);
- }
-
- /**
- * Set the allowed association types, checking to make sure each
- * combination is valid.
- *
- * @access private
- */
- function setAllowedTypes($allowed_types)
- {
- foreach ($allowed_types as $pair) {
- list($assoc_type, $session_type) = $pair;
- if (!Auth_OpenID_checkSessionType($assoc_type, $session_type)) {
- return false;
- }
- }
-
- $this->allowed_types = $allowed_types;
- return true;
- }
-
- /**
- * Add an association type and session type to the allowed types
- * list. The assocation/session pairs are tried in the order that
- * they are added.
- *
- * @access private
- */
- function addAllowedType($assoc_type, $session_type = null)
- {
- if ($this->allowed_types === null) {
- $this->allowed_types = array();
- }
-
- if ($session_type === null) {
- $available = Auth_OpenID_getSessionTypes($assoc_type);
-
- if (!$available) {
- return false;
- }
-
- foreach ($available as $session_type) {
- $this->addAllowedType($assoc_type, $session_type);
- }
- } else {
- if (Auth_OpenID_checkSessionType($assoc_type, $session_type)) {
- $this->allowed_types[] = array($assoc_type, $session_type);
- } else {
- return false;
- }
- }
-
- return true;
- }
-
- // Is this combination of association type and session type allowed?
- function isAllowed($assoc_type, $session_type)
- {
- $assoc_good = in_array(array($assoc_type, $session_type),
- $this->allowed_types);
-
- $matches = in_array($session_type,
- Auth_OpenID_getSessionTypes($assoc_type));
-
- return ($assoc_good && $matches);
- }
-
- /**
- * Get a pair of assocation type and session type that are
- * supported.
- */
- function getAllowedType()
- {
- if (!$this->allowed_types) {
- return array(null, null);
- }
-
- return $this->allowed_types[0];
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/BigMath.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/BigMath.php
deleted file mode 100755
index 98815f5..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/BigMath.php
+++ /dev/null
@@ -1,471 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Needed for random number generation
- */
-require_once 'Auth/OpenID/CryptUtil.php';
-
-/**
- * Need Auth_OpenID::bytes().
- */
-require_once 'Auth/OpenID.php';
-
-/**
- * The superclass of all big-integer math implementations
- * @access private
- * @package OpenID
- */
-class Auth_OpenID_MathLibrary {
- /**
- * Given a long integer, returns the number converted to a binary
- * string. This function accepts long integer values of arbitrary
- * magnitude and uses the local large-number math library when
- * available.
- *
- * @param integer $long The long number (can be a normal PHP
- * integer or a number created by one of the available long number
- * libraries)
- * @return string $binary The binary version of $long
- */
- function longToBinary($long)
- {
- $cmp = $this->cmp($long, 0);
- if ($cmp < 0) {
- $msg = __FUNCTION__ . " takes only positive integers.";
- trigger_error($msg, E_USER_ERROR);
- return null;
- }
-
- if ($cmp == 0) {
- return "\x00";
- }
-
- $bytes = array();
-
- while ($this->cmp($long, 0) > 0) {
- array_unshift($bytes, $this->mod($long, 256));
- $long = $this->div($long, pow(2, 8));
- }
-
- if ($bytes && ($bytes[0] > 127)) {
- array_unshift($bytes, 0);
- }
-
- $string = '';
- foreach ($bytes as $byte) {
- $string .= pack('C', $byte);
- }
-
- return $string;
- }
-
- /**
- * Given a binary string, returns the binary string converted to a
- * long number.
- *
- * @param string $binary The binary version of a long number,
- * probably as a result of calling longToBinary
- * @return integer $long The long number equivalent of the binary
- * string $str
- */
- function binaryToLong($str)
- {
- if ($str === null) {
- return null;
- }
-
- // Use array_merge to return a zero-indexed array instead of a
- // one-indexed array.
- $bytes = array_merge(unpack('C*', $str));
-
- $n = $this->init(0);
-
- if ($bytes && ($bytes[0] > 127)) {
- trigger_error("bytesToNum works only for positive integers.",
- E_USER_WARNING);
- return null;
- }
-
- foreach ($bytes as $byte) {
- $n = $this->mul($n, pow(2, 8));
- $n = $this->add($n, $byte);
- }
-
- return $n;
- }
-
- function base64ToLong($str)
- {
- $b64 = base64_decode($str);
-
- if ($b64 === false) {
- return false;
- }
-
- return $this->binaryToLong($b64);
- }
-
- function longToBase64($str)
- {
- return base64_encode($this->longToBinary($str));
- }
-
- /**
- * Returns a random number in the specified range. This function
- * accepts $start, $stop, and $step values of arbitrary magnitude
- * and will utilize the local large-number math library when
- * available.
- *
- * @param integer $start The start of the range, or the minimum
- * random number to return
- * @param integer $stop The end of the range, or the maximum
- * random number to return
- * @param integer $step The step size, such that $result - ($step
- * * N) = $start for some N
- * @return integer $result The resulting randomly-generated number
- */
- function rand($stop)
- {
- static $duplicate_cache = array();
-
- // Used as the key for the duplicate cache
- $rbytes = $this->longToBinary($stop);
-
- if (array_key_exists($rbytes, $duplicate_cache)) {
- list($duplicate, $nbytes) = $duplicate_cache[$rbytes];
- } else {
- if ($rbytes[0] == "\x00") {
- $nbytes = Auth_OpenID::bytes($rbytes) - 1;
- } else {
- $nbytes = Auth_OpenID::bytes($rbytes);
- }
-
- $mxrand = $this->pow(256, $nbytes);
-
- // If we get a number less than this, then it is in the
- // duplicated range.
- $duplicate = $this->mod($mxrand, $stop);
-
- if (count($duplicate_cache) > 10) {
- $duplicate_cache = array();
- }
-
- $duplicate_cache[$rbytes] = array($duplicate, $nbytes);
- }
-
- do {
- $bytes = "\x00" . Auth_OpenID_CryptUtil::getBytes($nbytes);
- $n = $this->binaryToLong($bytes);
- // Keep looping if this value is in the low duplicated range
- } while ($this->cmp($n, $duplicate) < 0);
-
- return $this->mod($n, $stop);
- }
-}
-
-/**
- * Exposes BCmath math library functionality.
- *
- * {@link Auth_OpenID_BcMathWrapper} wraps the functionality provided
- * by the BCMath extension.
- *
- * @access private
- * @package OpenID
- */
-class Auth_OpenID_BcMathWrapper extends Auth_OpenID_MathLibrary{
- var $type = 'bcmath';
-
- function add($x, $y)
- {
- return bcadd($x, $y);
- }
-
- function sub($x, $y)
- {
- return bcsub($x, $y);
- }
-
- function pow($base, $exponent)
- {
- return bcpow($base, $exponent);
- }
-
- function cmp($x, $y)
- {
- return bccomp($x, $y);
- }
-
- function init($number, $base = 10)
- {
- return $number;
- }
-
- function mod($base, $modulus)
- {
- return bcmod($base, $modulus);
- }
-
- function mul($x, $y)
- {
- return bcmul($x, $y);
- }
-
- function div($x, $y)
- {
- return bcdiv($x, $y);
- }
-
- /**
- * Same as bcpowmod when bcpowmod is missing
- *
- * @access private
- */
- function _powmod($base, $exponent, $modulus)
- {
- $square = $this->mod($base, $modulus);
- $result = 1;
- while($this->cmp($exponent, 0) > 0) {
- if ($this->mod($exponent, 2)) {
- $result = $this->mod($this->mul($result, $square), $modulus);
- }
- $square = $this->mod($this->mul($square, $square), $modulus);
- $exponent = $this->div($exponent, 2);
- }
- return $result;
- }
-
- function powmod($base, $exponent, $modulus)
- {
- if (function_exists('bcpowmod')) {
- return bcpowmod($base, $exponent, $modulus);
- } else {
- return $this->_powmod($base, $exponent, $modulus);
- }
- }
-
- function toString($num)
- {
- return $num;
- }
-}
-
-/**
- * Exposes GMP math library functionality.
- *
- * {@link Auth_OpenID_GmpMathWrapper} wraps the functionality provided
- * by the GMP extension.
- *
- * @access private
- * @package OpenID
- */
-class Auth_OpenID_GmpMathWrapper extends Auth_OpenID_MathLibrary{
- var $type = 'gmp';
-
- function add($x, $y)
- {
- return gmp_add($x, $y);
- }
-
- function sub($x, $y)
- {
- return gmp_sub($x, $y);
- }
-
- function pow($base, $exponent)
- {
- return gmp_pow($base, $exponent);
- }
-
- function cmp($x, $y)
- {
- return gmp_cmp($x, $y);
- }
-
- function init($number, $base = 10)
- {
- return gmp_init($number, $base);
- }
-
- function mod($base, $modulus)
- {
- return gmp_mod($base, $modulus);
- }
-
- function mul($x, $y)
- {
- return gmp_mul($x, $y);
- }
-
- function div($x, $y)
- {
- return gmp_div_q($x, $y);
- }
-
- function powmod($base, $exponent, $modulus)
- {
- return gmp_powm($base, $exponent, $modulus);
- }
-
- function toString($num)
- {
- return gmp_strval($num);
- }
-}
-
-/**
- * Define the supported extensions. An extension array has keys
- * 'modules', 'extension', and 'class'. 'modules' is an array of PHP
- * module names which the loading code will attempt to load. These
- * values will be suffixed with a library file extension (e.g. ".so").
- * 'extension' is the name of a PHP extension which will be tested
- * before 'modules' are loaded. 'class' is the string name of a
- * {@link Auth_OpenID_MathWrapper} subclass which should be
- * instantiated if a given extension is present.
- *
- * You can define new math library implementations and add them to
- * this array.
- */
-function Auth_OpenID_math_extensions()
-{
- $result = array();
-
- if (!defined('Auth_OpenID_BUGGY_GMP')) {
- $result[] =
- array('modules' => array('gmp', 'php_gmp'),
- 'extension' => 'gmp',
- 'class' => 'Auth_OpenID_GmpMathWrapper');
- }
-
- $result[] = array(
- 'modules' => array('bcmath', 'php_bcmath'),
- 'extension' => 'bcmath',
- 'class' => 'Auth_OpenID_BcMathWrapper');
-
- return $result;
-}
-
-/**
- * Detect which (if any) math library is available
- */
-function Auth_OpenID_detectMathLibrary($exts)
-{
- $loaded = false;
-
- foreach ($exts as $extension) {
- // See if the extension specified is already loaded.
- if ($extension['extension'] &&
- extension_loaded($extension['extension'])) {
- $loaded = true;
- }
-
- // Try to load dynamic modules.
- if (!$loaded) {
- foreach ($extension['modules'] as $module) {
- if (@dl($module . "." . PHP_SHLIB_SUFFIX)) {
- $loaded = true;
- break;
- }
- }
- }
-
- // If the load succeeded, supply an instance of
- // Auth_OpenID_MathWrapper which wraps the specified
- // module's functionality.
- if ($loaded) {
- return $extension;
- }
- }
-
- return false;
-}
-
-/**
- * {@link Auth_OpenID_getMathLib} checks for the presence of long
- * number extension modules and returns an instance of
- * {@link Auth_OpenID_MathWrapper} which exposes the module's
- * functionality.
- *
- * Checks for the existence of an extension module described by the
- * result of {@link Auth_OpenID_math_extensions()} and returns an
- * instance of a wrapper for that extension module. If no extension
- * module is found, an instance of {@link Auth_OpenID_MathWrapper} is
- * returned, which wraps the native PHP integer implementation. The
- * proper calling convention for this method is $lib =&
- * Auth_OpenID_getMathLib().
- *
- * This function checks for the existence of specific long number
- * implementations in the following order: GMP followed by BCmath.
- *
- * @return Auth_OpenID_MathWrapper $instance An instance of
- * {@link Auth_OpenID_MathWrapper} or one of its subclasses
- *
- * @package OpenID
- */
-function &Auth_OpenID_getMathLib()
-{
- // The instance of Auth_OpenID_MathWrapper that we choose to
- // supply will be stored here, so that subseqent calls to this
- // method will return a reference to the same object.
- static $lib = null;
-
- if (isset($lib)) {
- return $lib;
- }
-
- if (Auth_OpenID_noMathSupport()) {
- $null = null;
- return $null;
- }
-
- // If this method has not been called before, look at
- // Auth_OpenID_math_extensions and try to find an extension that
- // works.
- $ext = Auth_OpenID_detectMathLibrary(Auth_OpenID_math_extensions());
- if ($ext === false) {
- $tried = array();
- foreach (Auth_OpenID_math_extensions() as $extinfo) {
- $tried[] = $extinfo['extension'];
- }
- $triedstr = implode(", ", $tried);
-
- Auth_OpenID_setNoMathSupport();
-
- $result = null;
- return $result;
- }
-
- // Instantiate a new wrapper
- $class = $ext['class'];
- $lib = new $class();
-
- return $lib;
-}
-
-function Auth_OpenID_setNoMathSupport()
-{
- if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) {
- define('Auth_OpenID_NO_MATH_SUPPORT', true);
- }
-}
-
-function Auth_OpenID_noMathSupport()
-{
- return defined('Auth_OpenID_NO_MATH_SUPPORT');
-}
-
-?>
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Consumer.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Consumer.php
deleted file mode 100755
index 210934b..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Consumer.php
+++ /dev/null
@@ -1,2189 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Require utility classes and functions for the consumer.
- */
-require_once "Auth/OpenID.php";
-require_once "Auth/OpenID/Message.php";
-require_once "Auth/OpenID/HMACSHA1.php";
-require_once "Auth/OpenID/Association.php";
-require_once "Auth/OpenID/CryptUtil.php";
-require_once "Auth/OpenID/DiffieHellman.php";
-require_once "Auth/OpenID/KVForm.php";
-require_once "Auth/OpenID/Nonce.php";
-require_once "Auth/OpenID/Discover.php";
-require_once "Auth/Yadis/Manager.php";
-require_once "Auth/Yadis/XRI.php";
-
-/**
- * This is the status code returned when the complete method returns
- * successfully.
- */
-define('Auth_OpenID_SUCCESS', 'success');
-
-/**
- * Status to indicate cancellation of OpenID authentication.
- */
-define('Auth_OpenID_CANCEL', 'cancel');
-
-/**
- * This is the status code completeAuth returns when the value it
- * received indicated an invalid login.
- */
-define('Auth_OpenID_FAILURE', 'failure');
-
-/**
- * This is the status code completeAuth returns when the
- * {@link Auth_OpenID_Consumer} instance is in immediate mode, and the
- * identity server sends back a URL to send the user to to complete his
- * or her login.
- */
-define('Auth_OpenID_SETUP_NEEDED', 'setup needed');
-
-/**
- * This is the status code beginAuth returns when the page fetched
- * from the entered OpenID URL doesn't contain the necessary link tags
- * to function as an identity page.
- */
-define('Auth_OpenID_PARSE_ERROR', 'parse error');
-
-/**
- * An OpenID consumer implementation that performs discovery and does
- * session management. See the Consumer.php file documentation for
- * more information.
- *
- * @package OpenID
- */
-class Auth_OpenID_Consumer {
-
- /**
- * @access private
- */
- var $discoverMethod = 'Auth_OpenID_discover';
-
- /**
- * @access private
- */
- var $session_key_prefix = "_openid_consumer_";
-
- /**
- * @access private
- */
- var $_token_suffix = "last_token";
-
- /**
- * Initialize a Consumer instance.
- *
- * You should create a new instance of the Consumer object with
- * every HTTP request that handles OpenID transactions.
- *
- * @param Auth_OpenID_OpenIDStore $store This must be an object
- * that implements the interface in {@link
- * Auth_OpenID_OpenIDStore}. Several concrete implementations are
- * provided, to cover most common use cases. For stores backed by
- * MySQL, PostgreSQL, or SQLite, see the {@link
- * Auth_OpenID_SQLStore} class and its sublcasses. For a
- * filesystem-backed store, see the {@link Auth_OpenID_FileStore}
- * module. As a last resort, if it isn't possible for the server
- * to store state at all, an instance of {@link
- * Auth_OpenID_DumbStore} can be used.
- *
- * @param mixed $session An object which implements the interface
- * of the {@link Auth_Yadis_PHPSession} class. Particularly, this
- * object is expected to have these methods: get($key), set($key),
- * $value), and del($key). This defaults to a session object
- * which wraps PHP's native session machinery. You should only
- * need to pass something here if you have your own sessioning
- * implementation.
- *
- * @param str $consumer_cls The name of the class to instantiate
- * when creating the internal consumer object. This is used for
- * testing.
- */
- function Auth_OpenID_Consumer(&$store, $session = null,
- $consumer_cls = null)
- {
- if ($session === null) {
- $session = new Auth_Yadis_PHPSession();
- }
-
- $this->session =& $session;
-
- if ($consumer_cls !== null) {
- $this->consumer =& new $consumer_cls($store);
- } else {
- $this->consumer =& new Auth_OpenID_GenericConsumer($store);
- }
-
- $this->_token_key = $this->session_key_prefix . $this->_token_suffix;
- }
-
- /**
- * Used in testing to define the discovery mechanism.
- *
- * @access private
- */
- function getDiscoveryObject(&$session, $openid_url,
- $session_key_prefix)
- {
- return new Auth_Yadis_Discovery($session, $openid_url,
- $session_key_prefix);
- }
-
- /**
- * Start the OpenID authentication process. See steps 1-2 in the
- * overview at the top of this file.
- *
- * @param string $user_url Identity URL given by the user. This
- * method performs a textual transformation of the URL to try and
- * make sure it is normalized. For example, a user_url of
- * example.com will be normalized to http://example.com/
- * normalizing and resolving any redirects the server might issue.
- *
- * @param bool $anonymous True if the OpenID request is to be sent
- * to the server without any identifier information. Use this
- * when you want to transport data but don't want to do OpenID
- * authentication with identifiers.
- *
- * @return Auth_OpenID_AuthRequest $auth_request An object
- * containing the discovered information will be returned, with a
- * method for building a redirect URL to the server, as described
- * in step 3 of the overview. This object may also be used to add
- * extension arguments to the request, using its 'addExtensionArg'
- * method.
- */
- function begin($user_url, $anonymous=false)
- {
- $openid_url = $user_url;
-
- $disco = $this->getDiscoveryObject($this->session,
- $openid_url,
- $this->session_key_prefix);
-
- // Set the 'stale' attribute of the manager. If discovery
- // fails in a fatal way, the stale flag will cause the manager
- // to be cleaned up next time discovery is attempted.
-
- $m = $disco->getManager();
- $loader = new Auth_Yadis_ManagerLoader();
-
- if ($m) {
- if ($m->stale) {
- $disco->destroyManager();
- } else {
- $m->stale = true;
- $disco->session->set($disco->session_key,
- serialize($loader->toSession($m)));
- }
- }
-
- $endpoint = $disco->getNextService($this->discoverMethod,
- $this->consumer->fetcher);
-
- // Reset the 'stale' attribute of the manager.
- $m =& $disco->getManager();
- if ($m) {
- $m->stale = false;
- $disco->session->set($disco->session_key,
- serialize($loader->toSession($m)));
- }
-
- if ($endpoint === null) {
- return null;
- } else {
- return $this->beginWithoutDiscovery($endpoint,
- $anonymous);
- }
- }
-
- /**
- * Start OpenID verification without doing OpenID server
- * discovery. This method is used internally by Consumer.begin
- * after discovery is performed, and exists to provide an
- * interface for library users needing to perform their own
- * discovery.
- *
- * @param Auth_OpenID_ServiceEndpoint $endpoint an OpenID service
- * endpoint descriptor.
- *
- * @param bool anonymous Set to true if you want to perform OpenID
- * without identifiers.
- *
- * @return Auth_OpenID_AuthRequest $auth_request An OpenID
- * authentication request object.
- */
- function &beginWithoutDiscovery($endpoint, $anonymous=false)
- {
- $loader = new Auth_OpenID_ServiceEndpointLoader();
- $auth_req = $this->consumer->begin($endpoint);
- $this->session->set($this->_token_key,
- $loader->toSession($auth_req->endpoint));
- if (!$auth_req->setAnonymous($anonymous)) {
- return new Auth_OpenID_FailureResponse(null,
- "OpenID 1 requests MUST include the identifier " .
- "in the request.");
- }
- return $auth_req;
- }
-
- /**
- * Called to interpret the server's response to an OpenID
- * request. It is called in step 4 of the flow described in the
- * consumer overview.
- *
- * @param array $query An array of the query parameters (key =>
- * value pairs) for this HTTP request. Defaults to null. If
- * null, the GET or POST data are automatically gotten from the
- * PHP environment. It is only useful to override $query for
- * testing.
- *
- * @return Auth_OpenID_ConsumerResponse $response A instance of an
- * Auth_OpenID_ConsumerResponse subclass. The type of response is
- * indicated by the status attribute, which will be one of
- * SUCCESS, CANCEL, FAILURE, or SETUP_NEEDED.
- */
- function complete($return_to, $query=null)
- {
-
- if ($return_to && !is_string($return_to)) {
- // This is ugly, but we need to complain loudly when
- // someone uses the API incorrectly.
- trigger_error("return_to must be a string; see NEWS file " .
- "for upgrading notes.",
- E_USER_ERROR);
- }
-
- if ($query === null) {
- $query = Auth_OpenID::getQuery();
- }
-
- $loader = new Auth_OpenID_ServiceEndpointLoader();
- $endpoint_data = $this->session->get($this->_token_key);
- $endpoint =
- $loader->fromSession($endpoint_data);
-
- $message = Auth_OpenID_Message::fromPostArgs($query);
- $response = $this->consumer->complete($message, $endpoint, $return_to);
- $this->session->del($this->_token_key);
-
- if (in_array($response->status, array(Auth_OpenID_SUCCESS,
- Auth_OpenID_CANCEL))) {
- if ($response->identity_url !== null) {
- $disco = $this->getDiscoveryObject($this->session,
- $response->identity_url,
- $this->session_key_prefix);
- $disco->cleanup(true);
- }
- }
-
- return $response;
- }
-}
-
-/**
- * A class implementing HMAC/DH-SHA1 consumer sessions.
- *
- * @package OpenID
- */
-class Auth_OpenID_DiffieHellmanSHA1ConsumerSession {
- var $session_type = 'DH-SHA1';
- var $hash_func = 'Auth_OpenID_SHA1';
- var $secret_size = 20;
- var $allowed_assoc_types = array('HMAC-SHA1');
-
- function Auth_OpenID_DiffieHellmanSHA1ConsumerSession($dh = null)
- {
- if ($dh === null) {
- $dh = new Auth_OpenID_DiffieHellman();
- }
-
- $this->dh = $dh;
- }
-
- function getRequest()
- {
- $math =& Auth_OpenID_getMathLib();
-
- $cpub = $math->longToBase64($this->dh->public);
-
- $args = array('dh_consumer_public' => $cpub);
-
- if (!$this->dh->usingDefaultValues()) {
- $args = array_merge($args, array(
- 'dh_modulus' =>
- $math->longToBase64($this->dh->mod),
- 'dh_gen' =>
- $math->longToBase64($this->dh->gen)));
- }
-
- return $args;
- }
-
- function extractSecret($response)
- {
- if (!$response->hasKey(Auth_OpenID_OPENID_NS,
- 'dh_server_public')) {
- return null;
- }
-
- if (!$response->hasKey(Auth_OpenID_OPENID_NS,
- 'enc_mac_key')) {
- return null;
- }
-
- $math =& Auth_OpenID_getMathLib();
-
- $spub = $math->base64ToLong($response->getArg(Auth_OpenID_OPENID_NS,
- 'dh_server_public'));
- $enc_mac_key = base64_decode($response->getArg(Auth_OpenID_OPENID_NS,
- 'enc_mac_key'));
-
- return $this->dh->xorSecret($spub, $enc_mac_key, $this->hash_func);
- }
-}
-
-/**
- * A class implementing HMAC/DH-SHA256 consumer sessions.
- *
- * @package OpenID
- */
-class Auth_OpenID_DiffieHellmanSHA256ConsumerSession extends
- Auth_OpenID_DiffieHellmanSHA1ConsumerSession {
- var $session_type = 'DH-SHA256';
- var $hash_func = 'Auth_OpenID_SHA256';
- var $secret_size = 32;
- var $allowed_assoc_types = array('HMAC-SHA256');
-}
-
-/**
- * A class implementing plaintext consumer sessions.
- *
- * @package OpenID
- */
-class Auth_OpenID_PlainTextConsumerSession {
- var $session_type = 'no-encryption';
- var $allowed_assoc_types = array('HMAC-SHA1', 'HMAC-SHA256');
-
- function getRequest()
- {
- return array();
- }
-
- function extractSecret($response)
- {
- if (!$response->hasKey(Auth_OpenID_OPENID_NS, 'mac_key')) {
- return null;
- }
-
- return base64_decode($response->getArg(Auth_OpenID_OPENID_NS,
- 'mac_key'));
- }
-}
-
-/**
- * Returns available session types.
- */
-function Auth_OpenID_getAvailableSessionTypes()
-{
- $types = array(
- 'no-encryption' => 'Auth_OpenID_PlainTextConsumerSession',
- 'DH-SHA1' => 'Auth_OpenID_DiffieHellmanSHA1ConsumerSession',
- 'DH-SHA256' => 'Auth_OpenID_DiffieHellmanSHA256ConsumerSession');
-
- return $types;
-}
-
-/**
- * This class is the interface to the OpenID consumer logic.
- * Instances of it maintain no per-request state, so they can be
- * reused (or even used by multiple threads concurrently) as needed.
- *
- * @package OpenID
- */
-class Auth_OpenID_GenericConsumer {
- /**
- * @access private
- */
- var $discoverMethod = 'Auth_OpenID_discover';
-
- /**
- * This consumer's store object.
- */
- var $store;
-
- /**
- * @access private
- */
- var $_use_assocs;
-
- /**
- * @access private
- */
- var $openid1_nonce_query_arg_name = 'janrain_nonce';
-
- /**
- * Another query parameter that gets added to the return_to for
- * OpenID 1; if the user's session state is lost, use this claimed
- * identifier to do discovery when verifying the response.
- */
- var $openid1_return_to_identifier_name = 'openid1_claimed_id';
-
- /**
- * This method initializes a new {@link Auth_OpenID_Consumer}
- * instance to access the library.
- *
- * @param Auth_OpenID_OpenIDStore $store This must be an object
- * that implements the interface in {@link Auth_OpenID_OpenIDStore}.
- * Several concrete implementations are provided, to cover most common use
- * cases. For stores backed by MySQL, PostgreSQL, or SQLite, see
- * the {@link Auth_OpenID_SQLStore} class and its sublcasses. For a
- * filesystem-backed store, see the {@link Auth_OpenID_FileStore} module.
- * As a last resort, if it isn't possible for the server to store
- * state at all, an instance of {@link Auth_OpenID_DumbStore} can be used.
- *
- * @param bool $immediate This is an optional boolean value. It
- * controls whether the library uses immediate mode, as explained
- * in the module description. The default value is False, which
- * disables immediate mode.
- */
- function Auth_OpenID_GenericConsumer(&$store)
- {
- $this->store =& $store;
- $this->negotiator =& Auth_OpenID_getDefaultNegotiator();
- $this->_use_assocs = ($this->store ? true : false);
-
- $this->fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
-
- $this->session_types = Auth_OpenID_getAvailableSessionTypes();
- }
-
- /**
- * Called to begin OpenID authentication using the specified
- * {@link Auth_OpenID_ServiceEndpoint}.
- *
- * @access private
- */
- function begin($service_endpoint)
- {
- $assoc = $this->_getAssociation($service_endpoint);
- $r = new Auth_OpenID_AuthRequest($service_endpoint, $assoc);
- $r->return_to_args[$this->openid1_nonce_query_arg_name] =
- Auth_OpenID_mkNonce();
-
- if ($r->message->isOpenID1()) {
- $r->return_to_args[$this->openid1_return_to_identifier_name] =
- $r->endpoint->claimed_id;
- }
-
- return $r;
- }
-
- /**
- * Given an {@link Auth_OpenID_Message}, {@link
- * Auth_OpenID_ServiceEndpoint} and optional return_to URL,
- * complete OpenID authentication.
- *
- * @access private
- */
- function complete($message, $endpoint, $return_to)
- {
- $mode = $message->getArg(Auth_OpenID_OPENID_NS, 'mode',
- '');
-
- $mode_methods = array(
- 'cancel' => '_complete_cancel',
- 'error' => '_complete_error',
- 'setup_needed' => '_complete_setup_needed',
- 'id_res' => '_complete_id_res',
- );
-
- $method = Auth_OpenID::arrayGet($mode_methods, $mode,
- '_completeInvalid');
- return call_user_func_array(array(&$this, $method),
- array($message, $endpoint, $return_to));
- }
-
- /**
- * @access private
- */
- function _completeInvalid($message, &$endpoint, $unused)
- {
- $mode = $message->getArg(Auth_OpenID_OPENID_NS, 'mode',
- '');
-
- return new Auth_OpenID_FailureResponse($endpoint,
- sprintf("Invalid openid.mode '%s'", $mode));
- }
-
- /**
- * @access private
- */
- function _complete_cancel($message, &$endpoint, $unused)
- {
- return new Auth_OpenID_CancelResponse($endpoint);
- }
-
- /**
- * @access private
- */
- function _complete_error($message, &$endpoint, $unused)
- {
- $error = $message->getArg(Auth_OpenID_OPENID_NS, 'error');
- $contact = $message->getArg(Auth_OpenID_OPENID_NS, 'contact');
- $reference = $message->getArg(Auth_OpenID_OPENID_NS, 'reference');
-
- return new Auth_OpenID_FailureResponse($endpoint, $error,
- $contact, $reference);
- }
-
- /**
- * @access private
- */
- function _complete_setup_needed($message, &$endpoint, $unused)
- {
- if (!$message->isOpenID2()) {
- return $this->_completeInvalid($message, $endpoint);
- }
-
- return new Auth_OpenID_SetupNeededResponse($endpoint);
- }
-
- /**
- * @access private
- */
- function _complete_id_res($message, &$endpoint, $return_to)
- {
- $user_setup_url = $message->getArg(Auth_OpenID_OPENID1_NS,
- 'user_setup_url');
-
- if ($this->_checkSetupNeeded($message)) {
- return SetupNeededResponse($endpoint, $user_setup_url);
- } else {
- return $this->_doIdRes($message, $endpoint, $return_to);
- }
- }
-
- /**
- * @access private
- */
- function _checkSetupNeeded($message)
- {
- // In OpenID 1, we check to see if this is a cancel from
- // immediate mode by the presence of the user_setup_url
- // parameter.
- if ($message->isOpenID1()) {
- $user_setup_url = $message->getArg(Auth_OpenID_OPENID1_NS,
- 'user_setup_url');
- if ($user_setup_url !== null) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * @access private
- */
- function _doIdRes($message, $endpoint, $return_to)
- {
- // Checks for presence of appropriate fields (and checks
- // signed list fields)
- $result = $this->_idResCheckForFields($message);
-
- if (Auth_OpenID::isFailure($result)) {
- return $result;
- }
-
- if (!$this->_checkReturnTo($message, $return_to)) {
- return new Auth_OpenID_FailureResponse(null,
- sprintf("return_to does not match return URL. Expected %s, got %s",
- $return_to,
- $message->getArg(Auth_OpenID_OPENID_NS, 'return_to')));
- }
-
- // Verify discovery information:
- $result = $this->_verifyDiscoveryResults($message, $endpoint);
-
- if (Auth_OpenID::isFailure($result)) {
- return $result;
- }
-
- $endpoint = $result;
-
- $result = $this->_idResCheckSignature($message,
- $endpoint->server_url);
-
- if (Auth_OpenID::isFailure($result)) {
- return $result;
- }
-
- $result = $this->_idResCheckNonce($message, $endpoint);
-
- if (Auth_OpenID::isFailure($result)) {
- return $result;
- }
-
- $signed_list_str = $message->getArg(Auth_OpenID_OPENID_NS, 'signed',
- Auth_OpenID_NO_DEFAULT);
- $signed_list = explode(',', $signed_list_str);
-
- $signed_fields = Auth_OpenID::addPrefix($signed_list, "openid.");
-
- return new Auth_OpenID_SuccessResponse($endpoint, $message,
- $signed_fields);
-
- }
-
- /**
- * @access private
- */
- function _checkReturnTo($message, $return_to)
- {
- // Check an OpenID message and its openid.return_to value
- // against a return_to URL from an application. Return True
- // on success, False on failure.
-
- // Check the openid.return_to args against args in the
- // original message.
- $result = Auth_OpenID_GenericConsumer::_verifyReturnToArgs(
- $message->toPostArgs());
- if (Auth_OpenID::isFailure($result)) {
- return false;
- }
-
- // Check the return_to base URL against the one in the
- // message.
- $msg_return_to = $message->getArg(Auth_OpenID_OPENID_NS,
- 'return_to');
-
- $return_to_parts = parse_url($return_to);
- $msg_return_to_parts = parse_url($msg_return_to);
-
- // If port is absent from both, add it so it's equal in the
- // check below.
- if ((!array_key_exists('port', $return_to_parts)) &&
- (!array_key_exists('port', $msg_return_to_parts))) {
- $return_to_parts['port'] = null;
- $msg_return_to_parts['port'] = null;
- }
-
- // If path is absent from both, add it so it's equal in the
- // check below.
- if ((!array_key_exists('path', $return_to_parts)) &&
- (!array_key_exists('path', $msg_return_to_parts))) {
- $return_to_parts['path'] = null;
- $msg_return_to_parts['path'] = null;
- }
-
- // The URL scheme, authority, and path MUST be the same
- // between the two URLs.
- foreach (array('scheme', 'host', 'port', 'path') as $component) {
- // If the url component is absent in either URL, fail.
- // There should always be a scheme, host, port, and path.
- if (!array_key_exists($component, $return_to_parts)) {
- return false;
- }
-
- if (!array_key_exists($component, $msg_return_to_parts)) {
- return false;
- }
-
- if (Auth_OpenID::arrayGet($return_to_parts, $component) !==
- Auth_OpenID::arrayGet($msg_return_to_parts, $component)) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * @access private
- */
- function _verifyReturnToArgs($query)
- {
- // Verify that the arguments in the return_to URL are present in this
- // response.
-
- $message = Auth_OpenID_Message::fromPostArgs($query);
- $return_to = $message->getArg(Auth_OpenID_OPENID_NS, 'return_to');
-
- // XXX: this should be checked by _idResCheckForFields
- if (!$return_to) {
- return new Auth_OpenID_FailureResponse(null,
- "Response has no return_to");
- }
-
- $parsed_url = parse_url($return_to);
-
- $q = array();
- if (array_key_exists('query', $parsed_url)) {
- $rt_query = $parsed_url['query'];
- $q = Auth_OpenID::parse_str($rt_query);
- }
-
- foreach ($q as $rt_key => $rt_value) {
- if (!array_key_exists($rt_key, $query)) {
- return new Auth_OpenID_FailureResponse(null,
- sprintf("return_to parameter %s absent from query", $rt_key));
- } else {
- $value = $query[$rt_key];
- if ($rt_value != $value) {
- return new Auth_OpenID_FailureResponse(null,
- sprintf("parameter %s value %s does not match " .
- "return_to value %s", $rt_key,
- $value, $rt_value));
- }
- }
- }
-
- // Make sure all non-OpenID arguments in the response are also
- // in the signed return_to.
- $bare_args = $message->getArgs(Auth_OpenID_BARE_NS);
- foreach ($bare_args as $key => $value) {
- if (Auth_OpenID::arrayGet($q, $key) != $value) {
- return new Auth_OpenID_FailureResponse(null,
- sprintf("Parameter %s = %s not in return_to URL",
- $key, $value));
- }
- }
-
- return true;
- }
-
- /**
- * @access private
- */
- function _idResCheckSignature($message, $server_url)
- {
- $assoc_handle = $message->getArg(Auth_OpenID_OPENID_NS,
- 'assoc_handle');
-
- $assoc = $this->store->getAssociation($server_url, $assoc_handle);
-
- if ($assoc) {
- if ($assoc->getExpiresIn() <= 0) {
- // XXX: It might be a good idea sometimes to re-start
- // the authentication with a new association. Doing it
- // automatically opens the possibility for
- // denial-of-service by a server that just returns
- // expired associations (or really short-lived
- // associations)
- return new Auth_OpenID_FailureResponse(null,
- 'Association with ' . $server_url . ' expired');
- }
-
- if (!$assoc->checkMessageSignature($message)) {
- return new Auth_OpenID_FailureResponse(null,
- "Bad signature");
- }
- } else {
- // It's not an association we know about. Stateless mode
- // is our only possible path for recovery. XXX - async
- // framework will not want to block on this call to
- // _checkAuth.
- if (!$this->_checkAuth($message, $server_url)) {
- return new Auth_OpenID_FailureResponse(null,
- "Server denied check_authentication");
- }
- }
-
- return null;
- }
-
- /**
- * @access private
- */
- function _verifyDiscoveryResults($message, $endpoint=null)
- {
- if ($message->getOpenIDNamespace() == Auth_OpenID_OPENID2_NS) {
- return $this->_verifyDiscoveryResultsOpenID2($message,
- $endpoint);
- } else {
- return $this->_verifyDiscoveryResultsOpenID1($message,
- $endpoint);
- }
- }
-
- /**
- * @access private
- */
- function _verifyDiscoveryResultsOpenID1($message, $endpoint)
- {
- $claimed_id = $message->getArg(Auth_OpenID_BARE_NS,
- $this->openid1_return_to_identifier_name);
-
- if (($endpoint === null) && ($claimed_id === null)) {
- return new Auth_OpenID_FailureResponse($endpoint,
- 'When using OpenID 1, the claimed ID must be supplied, ' .
- 'either by passing it through as a return_to parameter ' .
- 'or by using a session, and supplied to the GenericConsumer ' .
- 'as the argument to complete()');
- } else if (($endpoint !== null) && ($claimed_id === null)) {
- $claimed_id = $endpoint->claimed_id;
- }
-
- $to_match = new Auth_OpenID_ServiceEndpoint();
- $to_match->type_uris = array(Auth_OpenID_TYPE_1_1);
- $to_match->local_id = $message->getArg(Auth_OpenID_OPENID1_NS,
- 'identity');
-
- // Restore delegate information from the initiation phase
- $to_match->claimed_id = $claimed_id;
-
- if ($to_match->local_id === null) {
- return new Auth_OpenID_FailureResponse($endpoint,
- "Missing required field openid.identity");
- }
-
- $to_match_1_0 = $to_match->copy();
- $to_match_1_0->type_uris = array(Auth_OpenID_TYPE_1_0);
-
- if ($endpoint !== null) {
- $result = $this->_verifyDiscoverySingle($endpoint, $to_match);
-
- if (is_a($result, 'Auth_OpenID_TypeURIMismatch')) {
- $result = $this->_verifyDiscoverySingle($endpoint,
- $to_match_1_0);
- }
-
- if (Auth_OpenID::isFailure($result)) {
- // oidutil.log("Error attempting to use stored
- // discovery information: " + str(e))
- // oidutil.log("Attempting discovery to
- // verify endpoint")
- } else {
- return $endpoint;
- }
- }
-
- // Endpoint is either bad (failed verification) or None
- $result = $this->_discoverAndVerify($to_match);
-
- if (is_a($result, 'Auth_OpenID_TypeURIMismatch')) {
- return $this->_discoverAndVerify($to_match_1_0);
- } else {
- return $result;
- }
- }
-
- /**
- * @access private
- */
- function _verifyDiscoverySingle($endpoint, $to_match)
- {
- // Every type URI that's in the to_match endpoint has to be
- // present in the discovered endpoint.
- foreach ($to_match->type_uris as $type_uri) {
- if (!$endpoint->usesExtension($type_uri)) {
- return new Auth_OpenID_TypeURIMismatch($endpoint,
- "Required type ".$type_uri." not present");
- }
- }
-
- // Fragments do not influence discovery, so we can't compare a
- // claimed identifier with a fragment to discovered
- // information.
- list($defragged_claimed_id, $_) =
- Auth_OpenID::urldefrag($to_match->claimed_id);
-
- if ($defragged_claimed_id != $endpoint->claimed_id) {
- return new Auth_OpenID_FailureResponse($endpoint,
- sprintf('Claimed ID does not match (different subjects!), ' .
- 'Expected %s, got %s', $defragged_claimed_id,
- $endpoint->claimed_id));
- }
-
- if ($to_match->getLocalID() != $endpoint->getLocalID()) {
- return new Auth_OpenID_FailureResponse($endpoint,
- sprintf('local_id mismatch. Expected %s, got %s',
- $to_match->getLocalID(), $endpoint->getLocalID()));
- }
-
- // If the server URL is None, this must be an OpenID 1
- // response, because op_endpoint is a required parameter in
- // OpenID 2. In that case, we don't actually care what the
- // discovered server_url is, because signature checking or
- // check_auth should take care of that check for us.
- if ($to_match->server_url === null) {
- if ($to_match->preferredNamespace() != Auth_OpenID_OPENID1_NS) {
- return new Auth_OpenID_FailureResponse($endpoint,
- "Preferred namespace mismatch (bug)");
- }
- } else if ($to_match->server_url != $endpoint->server_url) {
- return new Auth_OpenID_FailureResponse($endpoint,
- sprintf('OP Endpoint mismatch. Expected %s, got %s',
- $to_match->server_url, $endpoint->server_url));
- }
-
- return null;
- }
-
- /**
- * @access private
- */
- function _verifyDiscoveryResultsOpenID2($message, $endpoint)
- {
- $to_match = new Auth_OpenID_ServiceEndpoint();
- $to_match->type_uris = array(Auth_OpenID_TYPE_2_0);
- $to_match->claimed_id = $message->getArg(Auth_OpenID_OPENID2_NS,
- 'claimed_id');
-
- $to_match->local_id = $message->getArg(Auth_OpenID_OPENID2_NS,
- 'identity');
-
- $to_match->server_url = $message->getArg(Auth_OpenID_OPENID2_NS,
- 'op_endpoint');
-
- if ($to_match->server_url === null) {
- return new Auth_OpenID_FailureResponse($endpoint,
- "OP Endpoint URL missing");
- }
-
- // claimed_id and identifier must both be present or both be
- // absent
- if (($to_match->claimed_id === null) &&
- ($to_match->local_id !== null)) {
- return new Auth_OpenID_FailureResponse($endpoint,
- 'openid.identity is present without openid.claimed_id');
- }
-
- if (($to_match->claimed_id !== null) &&
- ($to_match->local_id === null)) {
- return new Auth_OpenID_FailureResponse($endpoint,
- 'openid.claimed_id is present without openid.identity');
- }
-
- if ($to_match->claimed_id === null) {
- // This is a response without identifiers, so there's
- // really no checking that we can do, so return an
- // endpoint that's for the specified `openid.op_endpoint'
- return Auth_OpenID_ServiceEndpoint::fromOPEndpointURL(
- $to_match->server_url);
- }
-
- if (!$endpoint) {
- // The claimed ID doesn't match, so we have to do
- // discovery again. This covers not using sessions, OP
- // identifier endpoints and responses that didn't match
- // the original request.
- // oidutil.log('No pre-discovered information supplied.')
- return $this->_discoverAndVerify($to_match);
- } else {
-
- // The claimed ID matches, so we use the endpoint that we
- // discovered in initiation. This should be the most
- // common case.
- $result = $this->_verifyDiscoverySingle($endpoint, $to_match);
-
- if (Auth_OpenID::isFailure($result)) {
- $endpoint = $this->_discoverAndVerify($to_match);
-
- if (Auth_OpenID::isFailure($endpoint)) {
- return $endpoint;
- }
- }
- }
-
- // The endpoint we return should have the claimed ID from the
- // message we just verified, fragment and all.
- if ($endpoint->claimed_id != $to_match->claimed_id) {
- $endpoint->claimed_id = $to_match->claimed_id;
- }
-
- return $endpoint;
- }
-
- /**
- * @access private
- */
- function _discoverAndVerify($to_match)
- {
- // oidutil.log('Performing discovery on %s' % (to_match.claimed_id,))
- list($unused, $services) = call_user_func($this->discoverMethod,
- $to_match->claimed_id,
- $this->fetcher);
-
- if (!$services) {
- return new Auth_OpenID_FailureResponse(null,
- sprintf("No OpenID information found at %s",
- $to_match->claimed_id));
- }
-
- return $this->_verifyDiscoveryServices($services, $to_match);
- }
-
- /**
- * @access private
- */
- function _verifyDiscoveryServices(&$services, &$to_match)
- {
- // Search the services resulting from discovery to find one
- // that matches the information from the assertion
-
- foreach ($services as $endpoint) {
- $result = $this->_verifyDiscoverySingle($endpoint, $to_match);
-
- if (!Auth_OpenID::isFailure($result)) {
- // It matches, so discover verification has
- // succeeded. Return this endpoint.
- return $endpoint;
- }
- }
-
- return new Auth_OpenID_FailureResponse(null,
- sprintf('No matching endpoint found after discovering %s',
- $to_match->claimed_id));
- }
-
- /**
- * Extract the nonce from an OpenID 1 response. Return the nonce
- * from the BARE_NS since we independently check the return_to
- * arguments are the same as those in the response message.
- *
- * See the openid1_nonce_query_arg_name class variable
- *
- * @returns $nonce The nonce as a string or null
- *
- * @access private
- */
- function _idResGetNonceOpenID1($message, $endpoint)
- {
- return $message->getArg(Auth_OpenID_BARE_NS,
- $this->openid1_nonce_query_arg_name);
- }
-
- /**
- * @access private
- */
- function _idResCheckNonce($message, $endpoint)
- {
- if ($message->isOpenID1()) {
- // This indicates that the nonce was generated by the consumer
- $nonce = $this->_idResGetNonceOpenID1($message, $endpoint);
- $server_url = '';
- } else {
- $nonce = $message->getArg(Auth_OpenID_OPENID2_NS,
- 'response_nonce');
-
- $server_url = $endpoint->server_url;
- }
-
- if ($nonce === null) {
- return new Auth_OpenID_FailureResponse($endpoint,
- "Nonce missing from response");
- }
-
- $parts = Auth_OpenID_splitNonce($nonce);
-
- if ($parts === null) {
- return new Auth_OpenID_FailureResponse($endpoint,
- "Malformed nonce in response");
- }
-
- list($timestamp, $salt) = $parts;
-
- if (!$this->store->useNonce($server_url, $timestamp, $salt)) {
- return new Auth_OpenID_FailureResponse($endpoint,
- "Nonce already used or out of range");
- }
-
- return null;
- }
-
- /**
- * @access private
- */
- function _idResCheckForFields($message)
- {
- $basic_fields = array('return_to', 'assoc_handle', 'sig', 'signed');
- $basic_sig_fields = array('return_to', 'identity');
-
- $require_fields = array(
- Auth_OpenID_OPENID2_NS => array_merge($basic_fields,
- array('op_endpoint')),
-
- Auth_OpenID_OPENID1_NS => array_merge($basic_fields,
- array('identity'))
- );
-
- $require_sigs = array(
- Auth_OpenID_OPENID2_NS => array_merge($basic_sig_fields,
- array('response_nonce',
- 'claimed_id',
- 'assoc_handle')),
- Auth_OpenID_OPENID1_NS => array_merge($basic_sig_fields,
- array('nonce'))
- );
-
- foreach ($require_fields[$message->getOpenIDNamespace()] as $field) {
- if (!$message->hasKey(Auth_OpenID_OPENID_NS, $field)) {
- return new Auth_OpenID_FailureResponse(null,
- "Missing required field '".$field."'");
- }
- }
-
- $signed_list_str = $message->getArg(Auth_OpenID_OPENID_NS,
- 'signed',
- Auth_OpenID_NO_DEFAULT);
- $signed_list = explode(',', $signed_list_str);
-
- foreach ($require_sigs[$message->getOpenIDNamespace()] as $field) {
- // Field is present and not in signed list
- if ($message->hasKey(Auth_OpenID_OPENID_NS, $field) &&
- (!in_array($field, $signed_list))) {
- return new Auth_OpenID_FailureResponse(null,
- "'".$field."' not signed");
- }
- }
-
- return null;
- }
-
- /**
- * @access private
- */
- function _checkAuth($message, $server_url)
- {
- $request = $this->_createCheckAuthRequest($message);
- if ($request === null) {
- return false;
- }
-
- $resp_message = $this->_makeKVPost($request, $server_url);
- if (($resp_message === null) ||
- (is_a($resp_message, 'Auth_OpenID_ServerErrorContainer'))) {
- return false;
- }
-
- return $this->_processCheckAuthResponse($resp_message, $server_url);
- }
-
- /**
- * @access private
- */
- function _createCheckAuthRequest($message)
- {
- $signed = $message->getArg(Auth_OpenID_OPENID_NS, 'signed');
- if ($signed === null) {
- return null;
- }
-
- $whitelist = array('assoc_handle', 'sig',
- 'signed', 'invalidate_handle');
-
- $check_args = array();
-
- foreach ($whitelist as $k) {
- $val = $message->getArg(Auth_OpenID_OPENID_NS, $k);
- if ($val !== null) {
- $check_args[$k] = $val;
- }
- }
-
- $signed = $message->getArg(Auth_OpenID_OPENID_NS,
- 'signed');
-
- if ($signed) {
- foreach (explode(',', $signed) as $k) {
- if ($k == 'ns') {
- $check_args['ns'] = $message->getOpenIDNamespace();
- continue;
- }
-
- $value = $message->getAliasedArg($k);
- if ($value === null) {
- return null;
- }
-
- $check_args[$k] = $value;
- }
- }
-
- $check_args['mode'] = 'check_authentication';
- return Auth_OpenID_Message::fromOpenIDArgs($check_args);
- }
-
- /**
- * @access private
- */
- function _processCheckAuthResponse($response, $server_url)
- {
- $is_valid = $response->getArg(Auth_OpenID_OPENID_NS, 'is_valid',
- 'false');
-
- $invalidate_handle = $response->getArg(Auth_OpenID_OPENID_NS,
- 'invalidate_handle');
-
- if ($invalidate_handle !== null) {
- $this->store->removeAssociation($server_url,
- $invalidate_handle);
- }
-
- if ($is_valid == 'true') {
- return true;
- }
-
- return false;
- }
-
- /**
- * Adapt a POST response to a Message.
- *
- * @param $response Result of a POST to an OpenID endpoint.
- *
- * @access private
- */
- function _httpResponseToMessage($response, $server_url)
- {
- // Should this function be named Message.fromHTTPResponse instead?
- $response_message = Auth_OpenID_Message::fromKVForm($response->body);
-
- if ($response->status == 400) {
- return Auth_OpenID_ServerErrorContainer::fromMessage(
- $response_message);
- } else if ($response->status != 200) {
- return null;
- }
-
- return $response_message;
- }
-
- /**
- * @access private
- */
- function _makeKVPost($message, $server_url)
- {
- $body = $message->toURLEncoded();
- $resp = $this->fetcher->post($server_url, $body);
-
- if ($resp === null) {
- return null;
- }
-
- return $this->_httpResponseToMessage($resp, $server_url);
- }
-
- /**
- * @access private
- */
- function _getAssociation($endpoint)
- {
- if (!$this->_use_assocs) {
- return null;
- }
-
- $assoc = $this->store->getAssociation($endpoint->server_url);
-
- if (($assoc === null) ||
- ($assoc->getExpiresIn() <= 0)) {
-
- $assoc = $this->_negotiateAssociation($endpoint);
-
- if ($assoc !== null) {
- $this->store->storeAssociation($endpoint->server_url,
- $assoc);
- }
- }
-
- return $assoc;
- }
-
- /**
- * Handle ServerErrors resulting from association requests.
- *
- * @return $result If server replied with an C{unsupported-type}
- * error, return a tuple of supported C{association_type},
- * C{session_type}. Otherwise logs the error and returns null.
- *
- * @access private
- */
- function _extractSupportedAssociationType(&$server_error, &$endpoint,
- $assoc_type)
- {
- // Any error message whose code is not 'unsupported-type'
- // should be considered a total failure.
- if (($server_error->error_code != 'unsupported-type') ||
- ($server_error->message->isOpenID1())) {
- return null;
- }
-
- // The server didn't like the association/session type that we
- // sent, and it sent us back a message that might tell us how
- // to handle it.
-
- // Extract the session_type and assoc_type from the error
- // message
- $assoc_type = $server_error->message->getArg(Auth_OpenID_OPENID_NS,
- 'assoc_type');
-
- $session_type = $server_error->message->getArg(Auth_OpenID_OPENID_NS,
- 'session_type');
-
- if (($assoc_type === null) || ($session_type === null)) {
- return null;
- } else if (!$this->negotiator->isAllowed($assoc_type,
- $session_type)) {
- return null;
- } else {
- return array($assoc_type, $session_type);
- }
- }
-
- /**
- * @access private
- */
- function _negotiateAssociation($endpoint)
- {
- // Get our preferred session/association type from the negotiatior.
- list($assoc_type, $session_type) = $this->negotiator->getAllowedType();
-
- $assoc = $this->_requestAssociation(
- $endpoint, $assoc_type, $session_type);
-
- if (Auth_OpenID::isFailure($assoc)) {
- return null;
- }
-
- if (is_a($assoc, 'Auth_OpenID_ServerErrorContainer')) {
- $why = $assoc;
-
- $supportedTypes = $this->_extractSupportedAssociationType(
- $why, $endpoint, $assoc_type);
-
- if ($supportedTypes !== null) {
- list($assoc_type, $session_type) = $supportedTypes;
-
- // Attempt to create an association from the assoc_type
- // and session_type that the server told us it
- // supported.
- $assoc = $this->_requestAssociation(
- $endpoint, $assoc_type, $session_type);
-
- if (is_a($assoc, 'Auth_OpenID_ServerErrorContainer')) {
- // Do not keep trying, since it rejected the
- // association type that it told us to use.
- // oidutil.log('Server %s refused its suggested association
- // 'type: session_type=%s, assoc_type=%s'
- // % (endpoint.server_url, session_type,
- // assoc_type))
- return null;
- } else {
- return $assoc;
- }
- } else {
- return null;
- }
- } else {
- return $assoc;
- }
- }
-
- /**
- * @access private
- */
- function _requestAssociation($endpoint, $assoc_type, $session_type)
- {
- list($assoc_session, $args) = $this->_createAssociateRequest(
- $endpoint, $assoc_type, $session_type);
-
- $response_message = $this->_makeKVPost($args, $endpoint->server_url);
-
- if ($response_message === null) {
- // oidutil.log('openid.associate request failed: %s' % (why[0],))
- return null;
- } else if (is_a($response_message,
- 'Auth_OpenID_ServerErrorContainer')) {
- return $response_message;
- }
-
- return $this->_extractAssociation($response_message, $assoc_session);
- }
-
- /**
- * @access private
- */
- function _extractAssociation(&$assoc_response, &$assoc_session)
- {
- // Extract the common fields from the response, raising an
- // exception if they are not found
- $assoc_type = $assoc_response->getArg(
- Auth_OpenID_OPENID_NS, 'assoc_type',
- Auth_OpenID_NO_DEFAULT);
-
- if ($assoc_type === null) {
- return new Auth_OpenID_FailureResponse(null,
- 'assoc_type missing from association response');
- }
-
- $assoc_handle = $assoc_response->getArg(
- Auth_OpenID_OPENID_NS, 'assoc_handle',
- Auth_OpenID_NO_DEFAULT);
-
- if ($assoc_handle === null) {
- return new Auth_OpenID_FailureResponse(null,
- 'assoc_handle missing from association response');
- }
-
- // expires_in is a base-10 string. The Python parsing will
- // accept literals that have whitespace around them and will
- // accept negative values. Neither of these are really in-spec,
- // but we think it's OK to accept them.
- $expires_in_str = $assoc_response->getArg(
- Auth_OpenID_OPENID_NS, 'expires_in',
- Auth_OpenID_NO_DEFAULT);
-
- if ($expires_in_str === null) {
- return new Auth_OpenID_FailureResponse(null,
- 'expires_in missing from association response');
- }
-
- $expires_in = Auth_OpenID::intval($expires_in_str);
- if ($expires_in === false) {
- return null;
- }
-
- // OpenID 1 has funny association session behaviour.
- if ($assoc_response->isOpenID1()) {
- $session_type = $this->_getOpenID1SessionType($assoc_response);
- } else {
- $session_type = $assoc_response->getArg(
- Auth_OpenID_OPENID2_NS, 'session_type',
- Auth_OpenID_NO_DEFAULT);
-
- if ($session_type === null) {
- return new Auth_OpenID_FailureResponse(null,
- 'session_type missing from association response');
- }
- }
-
- // Session type mismatch
- if ($assoc_session->session_type != $session_type) {
- if ($assoc_response->isOpenID1() &&
- ($session_type == 'no-encryption')) {
- // In OpenID 1, any association request can result in
- // a 'no-encryption' association response. Setting
- // assoc_session to a new no-encryption session should
- // make the rest of this function work properly for
- // that case.
- $assoc_session = new Auth_OpenID_PlainTextConsumerSession();
- } else {
- // Any other mismatch, regardless of protocol version
- // results in the failure of the association session
- // altogether.
- return null;
- }
- }
-
- // Make sure assoc_type is valid for session_type
- if (!in_array($assoc_type, $assoc_session->allowed_assoc_types)) {
- return null;
- }
-
- // Delegate to the association session to extract the secret
- // from the response, however is appropriate for that session
- // type.
- $secret = $assoc_session->extractSecret($assoc_response);
-
- if ($secret === null) {
- return null;
- }
-
- return Auth_OpenID_Association::fromExpiresIn(
- $expires_in, $assoc_handle, $secret, $assoc_type);
- }
-
- /**
- * @access private
- */
- function _createAssociateRequest($endpoint, $assoc_type, $session_type)
- {
- if (array_key_exists($session_type, $this->session_types)) {
- $session_type_class = $this->session_types[$session_type];
-
- if (is_callable($session_type_class)) {
- $assoc_session = $session_type_class();
- } else {
- $assoc_session = new $session_type_class();
- }
- } else {
- return null;
- }
-
- $args = array(
- 'mode' => 'associate',
- 'assoc_type' => $assoc_type);
-
- if (!$endpoint->compatibilityMode()) {
- $args['ns'] = Auth_OpenID_OPENID2_NS;
- }
-
- // Leave out the session type if we're in compatibility mode
- // *and* it's no-encryption.
- if ((!$endpoint->compatibilityMode()) ||
- ($assoc_session->session_type != 'no-encryption')) {
- $args['session_type'] = $assoc_session->session_type;
- }
-
- $args = array_merge($args, $assoc_session->getRequest());
- $message = Auth_OpenID_Message::fromOpenIDArgs($args);
- return array($assoc_session, $message);
- }
-
- /**
- * Given an association response message, extract the OpenID 1.X
- * session type.
- *
- * This function mostly takes care of the 'no-encryption' default
- * behavior in OpenID 1.
- *
- * If the association type is plain-text, this function will
- * return 'no-encryption'
- *
- * @access private
- * @return $typ The association type for this message
- */
- function _getOpenID1SessionType($assoc_response)
- {
- // If it's an OpenID 1 message, allow session_type to default
- // to None (which signifies "no-encryption")
- $session_type = $assoc_response->getArg(Auth_OpenID_OPENID1_NS,
- 'session_type');
-
- // Handle the differences between no-encryption association
- // respones in OpenID 1 and 2:
-
- // no-encryption is not really a valid session type for OpenID
- // 1, but we'll accept it anyway, while issuing a warning.
- if ($session_type == 'no-encryption') {
- // oidutil.log('WARNING: OpenID server sent "no-encryption"'
- // 'for OpenID 1.X')
- } else if (($session_type == '') || ($session_type === null)) {
- // Missing or empty session type is the way to flag a
- // 'no-encryption' response. Change the session type to
- // 'no-encryption' so that it can be handled in the same
- // way as OpenID 2 'no-encryption' respones.
- $session_type = 'no-encryption';
- }
-
- return $session_type;
- }
-}
-
-/**
- * This class represents an authentication request from a consumer to
- * an OpenID server.
- *
- * @package OpenID
- */
-class Auth_OpenID_AuthRequest {
-
- /**
- * Initialize an authentication request with the specified token,
- * association, and endpoint.
- *
- * Users of this library should not create instances of this
- * class. Instances of this class are created by the library when
- * needed.
- */
- function Auth_OpenID_AuthRequest(&$endpoint, $assoc)
- {
- $this->assoc = $assoc;
- $this->endpoint =& $endpoint;
- $this->return_to_args = array();
- $this->message = new Auth_OpenID_Message();
- $this->message->setOpenIDNamespace(
- $endpoint->preferredNamespace());
- $this->_anonymous = false;
- }
-
- /**
- * Add an extension to this checkid request.
- *
- * $extension_request: An object that implements the extension
- * request interface for adding arguments to an OpenID message.
- */
- function addExtension(&$extension_request)
- {
- $extension_request->toMessage($this->message);
- }
-
- /**
- * Add an extension argument to this OpenID authentication
- * request.
- *
- * Use caution when adding arguments, because they will be
- * URL-escaped and appended to the redirect URL, which can easily
- * get quite long.
- *
- * @param string $namespace The namespace for the extension. For
- * example, the simple registration extension uses the namespace
- * 'sreg'.
- *
- * @param string $key The key within the extension namespace. For
- * example, the nickname field in the simple registration
- * extension's key is 'nickname'.
- *
- * @param string $value The value to provide to the server for
- * this argument.
- */
- function addExtensionArg($namespace, $key, $value)
- {
- $this->message->setArg($namespace, $key, $value);
- }
-
- /**
- * Set whether this request should be made anonymously. If a
- * request is anonymous, the identifier will not be sent in the
- * request. This is only useful if you are making another kind of
- * request with an extension in this request.
- *
- * Anonymous requests are not allowed when the request is made
- * with OpenID 1.
- */
- function setAnonymous($is_anonymous)
- {
- if ($is_anonymous && $this->message->isOpenID1()) {
- return false;
- } else {
- $this->_anonymous = $is_anonymous;
- return true;
- }
- }
-
- /**
- * Produce a {@link Auth_OpenID_Message} representing this
- * request.
- *
- * @param string $realm The URL (or URL pattern) that identifies
- * your web site to the user when she is authorizing it.
- *
- * @param string $return_to The URL that the OpenID provider will
- * send the user back to after attempting to verify her identity.
- *
- * Not specifying a return_to URL means that the user will not be
- * returned to the site issuing the request upon its completion.
- *
- * @param bool $immediate If true, the OpenID provider is to send
- * back a response immediately, useful for behind-the-scenes
- * authentication attempts. Otherwise the OpenID provider may
- * engage the user before providing a response. This is the
- * default case, as the user may need to provide credentials or
- * approve the request before a positive response can be sent.
- */
- function getMessage($realm, $return_to=null, $immediate=false)
- {
- if ($return_to) {
- $return_to = Auth_OpenID::appendArgs($return_to,
- $this->return_to_args);
- } else if ($immediate) {
- // raise ValueError(
- // '"return_to" is mandatory when
- //using "checkid_immediate"')
- return new Auth_OpenID_FailureResponse(null,
- "'return_to' is mandatory when using checkid_immediate");
- } else if ($this->message->isOpenID1()) {
- // raise ValueError('"return_to" is
- // mandatory for OpenID 1 requests')
- return new Auth_OpenID_FailureResponse(null,
- "'return_to' is mandatory for OpenID 1 requests");
- } else if ($this->return_to_args) {
- // raise ValueError('extra "return_to" arguments
- // were specified, but no return_to was specified')
- return new Auth_OpenID_FailureResponse(null,
- "extra 'return_to' arguments where specified, " .
- "but no return_to was specified");
- }
-
- if ($immediate) {
- $mode = 'checkid_immediate';
- } else {
- $mode = 'checkid_setup';
- }
-
- $message = $this->message->copy();
- if ($message->isOpenID1()) {
- $realm_key = 'trust_root';
- } else {
- $realm_key = 'realm';
- }
-
- $message->updateArgs(Auth_OpenID_OPENID_NS,
- array(
- $realm_key => $realm,
- 'mode' => $mode,
- 'return_to' => $return_to));
-
- if (!$this->_anonymous) {
- if ($this->endpoint->isOPIdentifier()) {
- // This will never happen when we're in compatibility
- // mode, as long as isOPIdentifier() returns False
- // whenever preferredNamespace() returns OPENID1_NS.
- $claimed_id = $request_identity =
- Auth_OpenID_IDENTIFIER_SELECT;
- } else {
- $request_identity = $this->endpoint->getLocalID();
- $claimed_id = $this->endpoint->claimed_id;
- }
-
- // This is true for both OpenID 1 and 2
- $message->setArg(Auth_OpenID_OPENID_NS, 'identity',
- $request_identity);
-
- if ($message->isOpenID2()) {
- $message->setArg(Auth_OpenID_OPENID2_NS, 'claimed_id',
- $claimed_id);
- }
- }
-
- if ($this->assoc) {
- $message->setArg(Auth_OpenID_OPENID_NS, 'assoc_handle',
- $this->assoc->handle);
- }
-
- return $message;
- }
-
- function redirectURL($realm, $return_to = null,
- $immediate = false)
- {
- $message = $this->getMessage($realm, $return_to, $immediate);
-
- if (Auth_OpenID::isFailure($message)) {
- return $message;
- }
-
- return $message->toURL($this->endpoint->server_url);
- }
-
- /**
- * Get html for a form to submit this request to the IDP.
- *
- * form_tag_attrs: An array of attributes to be added to the form
- * tag. 'accept-charset' and 'enctype' have defaults that can be
- * overridden. If a value is supplied for 'action' or 'method', it
- * will be replaced.
- */
- function formMarkup($realm, $return_to=null, $immediate=false,
- $form_tag_attrs=null)
- {
- $message = $this->getMessage($realm, $return_to, $immediate);
-
- if (Auth_OpenID::isFailure($message)) {
- return $message;
- }
-
- return $message->toFormMarkup($this->endpoint->server_url,
- $form_tag_attrs);
- }
-
- function shouldSendRedirect()
- {
- return $this->endpoint->compatibilityMode();
- }
-}
-
-/**
- * The base class for responses from the Auth_OpenID_Consumer.
- *
- * @package OpenID
- */
-class Auth_OpenID_ConsumerResponse {
- var $status = null;
-
- function setEndpoint($endpoint)
- {
- $this->endpoint = $endpoint;
- if ($endpoint === null) {
- $this->identity_url = null;
- } else {
- $this->identity_url = $endpoint->claimed_id;
- }
- }
-
- function getDisplayIdentifier()
- {
- if ($this->endpoint !== null) {
- return $this->endpoint->getDisplayIdentifier();
- }
- return null;
- }
-}
-
-/**
- * A response with a status of Auth_OpenID_SUCCESS. Indicates that
- * this request is a successful acknowledgement from the OpenID server
- * that the supplied URL is, indeed controlled by the requesting
- * agent. This has three relevant attributes:
- *
- * claimed_id - The identity URL that has been authenticated
- *
- * signed_args - The arguments in the server's response that were
- * signed and verified.
- *
- * status - Auth_OpenID_SUCCESS.
- *
- * @package OpenID
- */
-class Auth_OpenID_SuccessResponse extends Auth_OpenID_ConsumerResponse {
- var $status = Auth_OpenID_SUCCESS;
-
- /**
- * @access private
- */
- function Auth_OpenID_SuccessResponse($endpoint, $message, $signed_args=null)
- {
- $this->endpoint = $endpoint;
- $this->identity_url = $endpoint->claimed_id;
- $this->signed_args = $signed_args;
- $this->message = $message;
-
- if ($this->signed_args === null) {
- $this->signed_args = array();
- }
- }
-
- /**
- * Extract signed extension data from the server's response.
- *
- * @param string $prefix The extension namespace from which to
- * extract the extension data.
- */
- function extensionResponse($namespace_uri, $require_signed)
- {
- if ($require_signed) {
- return $this->getSignedNS($namespace_uri);
- } else {
- return $this->message->getArgs($namespace_uri);
- }
- }
-
- function isOpenID1()
- {
- return $this->message->isOpenID1();
- }
-
- function isSigned($ns_uri, $ns_key)
- {
- // Return whether a particular key is signed, regardless of
- // its namespace alias
- return in_array($this->message->getKey($ns_uri, $ns_key),
- $this->signed_args);
- }
-
- function getSigned($ns_uri, $ns_key, $default = null)
- {
- // Return the specified signed field if available, otherwise
- // return default
- if ($this->isSigned($ns_uri, $ns_key)) {
- return $this->message->getArg($ns_uri, $ns_key, $default);
- } else {
- return $default;
- }
- }
-
- function getSignedNS($ns_uri)
- {
- $args = array();
-
- $msg_args = $this->message->getArgs($ns_uri);
-
- foreach ($msg_args as $key => $value) {
- if (!$this->isSigned($ns_uri, $key)) {
- return null;
- }
- }
-
- return $msg_args;
- }
-
- /**
- * Get the openid.return_to argument from this response.
- *
- * This is useful for verifying that this request was initiated by
- * this consumer.
- *
- * @return string $return_to The return_to URL supplied to the
- * server on the initial request, or null if the response did not
- * contain an 'openid.return_to' argument.
- */
- function getReturnTo()
- {
- return $this->getSigned(Auth_OpenID_OPENID_NS, 'return_to');
- }
-}
-
-/**
- * A response with a status of Auth_OpenID_FAILURE. Indicates that the
- * OpenID protocol has failed. This could be locally or remotely
- * triggered. This has three relevant attributes:
- *
- * claimed_id - The identity URL for which authentication was
- * attempted, if it can be determined. Otherwise, null.
- *
- * message - A message indicating why the request failed, if one is
- * supplied. Otherwise, null.
- *
- * status - Auth_OpenID_FAILURE.
- *
- * @package OpenID
- */
-class Auth_OpenID_FailureResponse extends Auth_OpenID_ConsumerResponse {
- var $status = Auth_OpenID_FAILURE;
-
- function Auth_OpenID_FailureResponse($endpoint, $message = null,
- $contact = null, $reference = null)
- {
- $this->setEndpoint($endpoint);
- $this->message = $message;
- $this->contact = $contact;
- $this->reference = $reference;
- }
-}
-
-/**
- * A specific, internal failure used to detect type URI mismatch.
- *
- * @package OpenID
- */
-class Auth_OpenID_TypeURIMismatch extends Auth_OpenID_FailureResponse {
-}
-
-/**
- * Exception that is raised when the server returns a 400 response
- * code to a direct request.
- *
- * @package OpenID
- */
-class Auth_OpenID_ServerErrorContainer {
- function Auth_OpenID_ServerErrorContainer($error_text,
- $error_code,
- $message)
- {
- $this->error_text = $error_text;
- $this->error_code = $error_code;
- $this->message = $message;
- }
-
- /**
- * @access private
- */
- function fromMessage($message)
- {
- $error_text = $message->getArg(
- Auth_OpenID_OPENID_NS, 'error', '');
- $error_code = $message->getArg(Auth_OpenID_OPENID_NS, 'error_code');
- return new Auth_OpenID_ServerErrorContainer($error_text,
- $error_code,
- $message);
- }
-}
-
-/**
- * A response with a status of Auth_OpenID_CANCEL. Indicates that the
- * user cancelled the OpenID authentication request. This has two
- * relevant attributes:
- *
- * claimed_id - The identity URL for which authentication was
- * attempted, if it can be determined. Otherwise, null.
- *
- * status - Auth_OpenID_SUCCESS.
- *
- * @package OpenID
- */
-class Auth_OpenID_CancelResponse extends Auth_OpenID_ConsumerResponse {
- var $status = Auth_OpenID_CANCEL;
-
- function Auth_OpenID_CancelResponse($endpoint)
- {
- $this->setEndpoint($endpoint);
- }
-}
-
-/**
- * A response with a status of Auth_OpenID_SETUP_NEEDED. Indicates
- * that the request was in immediate mode, and the server is unable to
- * authenticate the user without further interaction.
- *
- * claimed_id - The identity URL for which authentication was
- * attempted.
- *
- * setup_url - A URL that can be used to send the user to the server
- * to set up for authentication. The user should be redirected in to
- * the setup_url, either in the current window or in a new browser
- * window. Null in OpenID 2.
- *
- * status - Auth_OpenID_SETUP_NEEDED.
- *
- * @package OpenID
- */
-class Auth_OpenID_SetupNeededResponse extends Auth_OpenID_ConsumerResponse {
- var $status = Auth_OpenID_SETUP_NEEDED;
-
- function Auth_OpenID_SetupNeededResponse($endpoint,
- $setup_url = null)
- {
- $this->setEndpoint($endpoint);
- $this->setup_url = $setup_url;
- }
-}
-
-?>
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/CryptUtil.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/CryptUtil.php
deleted file mode 100755
index 8d7e069..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/CryptUtil.php
+++ /dev/null
@@ -1,109 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-if (!defined('Auth_OpenID_RAND_SOURCE')) {
- /**
- * The filename for a source of random bytes. Define this yourself
- * if you have a different source of randomness.
- */
- define('Auth_OpenID_RAND_SOURCE', '/dev/urandom');
-}
-
-class Auth_OpenID_CryptUtil {
- /**
- * Get the specified number of random bytes.
- *
- * Attempts to use a cryptographically secure (not predictable)
- * source of randomness if available. If there is no high-entropy
- * randomness source available, it will fail. As a last resort,
- * for non-critical systems, define
- * Auth_OpenID_RAND_SOURCE as null, and
- * the code will fall back on a pseudo-random number generator.
- *
- * @param int $num_bytes The length of the return value
- * @return string $bytes random bytes
- */
- function getBytes($num_bytes)
- {
- static $f = null;
- $bytes = '';
- if ($f === null) {
- if (Auth_OpenID_RAND_SOURCE === null) {
- $f = false;
- } else {
- $f = @fopen(Auth_OpenID_RAND_SOURCE, "r");
- if ($f === false) {
- $msg = 'Define Auth_OpenID_RAND_SOURCE as null to ' .
- ' continue with an insecure random number generator.';
- trigger_error($msg, E_USER_ERROR);
- }
- }
- }
- if ($f === false) {
- // pseudorandom used
- $bytes = '';
- for ($i = 0; $i < $num_bytes; $i += 4) {
- $bytes .= pack('L', mt_rand());
- }
- $bytes = substr($bytes, 0, $num_bytes);
- } else {
- $bytes = fread($f, $num_bytes);
- }
- return $bytes;
- }
-
- /**
- * Produce a string of length random bytes, chosen from chrs. If
- * $chrs is null, the resulting string may contain any characters.
- *
- * @param integer $length The length of the resulting
- * randomly-generated string
- * @param string $chrs A string of characters from which to choose
- * to build the new string
- * @return string $result A string of randomly-chosen characters
- * from $chrs
- */
- function randomString($length, $population = null)
- {
- if ($population === null) {
- return Auth_OpenID_CryptUtil::getBytes($length);
- }
-
- $popsize = strlen($population);
-
- if ($popsize > 256) {
- $msg = 'More than 256 characters supplied to ' . __FUNCTION__;
- trigger_error($msg, E_USER_ERROR);
- }
-
- $duplicate = 256 % $popsize;
-
- $str = "";
- for ($i = 0; $i < $length; $i++) {
- do {
- $n = ord(Auth_OpenID_CryptUtil::getBytes(1));
- } while ($n < $duplicate);
-
- $n %= $popsize;
- $str .= $population[$n];
- }
-
- return $str;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DatabaseConnection.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DatabaseConnection.php
deleted file mode 100755
index 3f4515f..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DatabaseConnection.php
+++ /dev/null
@@ -1,131 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * An empty base class intended to emulate PEAR connection
- * functionality in applications that supply their own database
- * abstraction mechanisms. See {@link Auth_OpenID_SQLStore} for more
- * information. You should subclass this class if you need to create
- * an SQL store that needs to access its database using an
- * application's database abstraction layer instead of a PEAR database
- * connection. Any subclass of Auth_OpenID_DatabaseConnection MUST
- * adhere to the interface specified here.
- *
- * @package OpenID
- */
-class Auth_OpenID_DatabaseConnection {
- /**
- * Sets auto-commit mode on this database connection.
- *
- * @param bool $mode True if auto-commit is to be used; false if
- * not.
- */
- function autoCommit($mode)
- {
- }
-
- /**
- * Run an SQL query with the specified parameters, if any.
- *
- * @param string $sql An SQL string with placeholders. The
- * placeholders are assumed to be specific to the database engine
- * for this connection.
- *
- * @param array $params An array of parameters to insert into the
- * SQL string using this connection's escaping mechanism.
- *
- * @return mixed $result The result of calling this connection's
- * internal query function. The type of result depends on the
- * underlying database engine. This method is usually used when
- * the result of a query is not important, like a DDL query.
- */
- function query($sql, $params = array())
- {
- }
-
- /**
- * Starts a transaction on this connection, if supported.
- */
- function begin()
- {
- }
-
- /**
- * Commits a transaction on this connection, if supported.
- */
- function commit()
- {
- }
-
- /**
- * Performs a rollback on this connection, if supported.
- */
- function rollback()
- {
- }
-
- /**
- * Run an SQL query and return the first column of the first row
- * of the result set, if any.
- *
- * @param string $sql An SQL string with placeholders. The
- * placeholders are assumed to be specific to the database engine
- * for this connection.
- *
- * @param array $params An array of parameters to insert into the
- * SQL string using this connection's escaping mechanism.
- *
- * @return mixed $result The value of the first column of the
- * first row of the result set. False if no such result was
- * found.
- */
- function getOne($sql, $params = array())
- {
- }
-
- /**
- * Run an SQL query and return the first row of the result set, if
- * any.
- *
- * @param string $sql An SQL string with placeholders. The
- * placeholders are assumed to be specific to the database engine
- * for this connection.
- *
- * @param array $params An array of parameters to insert into the
- * SQL string using this connection's escaping mechanism.
- *
- * @return array $result The first row of the result set, if any,
- * keyed on column name. False if no such result was found.
- */
- function getRow($sql, $params = array())
- {
- }
-
- /**
- * Run an SQL query with the specified parameters, if any.
- *
- * @param string $sql An SQL string with placeholders. The
- * placeholders are assumed to be specific to the database engine
- * for this connection.
- *
- * @param array $params An array of parameters to insert into the
- * SQL string using this connection's escaping mechanism.
- *
- * @return array $result An array of arrays representing the
- * result of the query; each array is keyed on column name.
- */
- function getAll($sql, $params = array())
- {
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DiffieHellman.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DiffieHellman.php
deleted file mode 100755
index b9a8034..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DiffieHellman.php
+++ /dev/null
@@ -1,112 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-require_once 'Auth/OpenID.php';
-require_once 'Auth/OpenID/BigMath.php';
-require_once 'Auth/OpenID/HMACSHA1.php';
-
-function Auth_OpenID_getDefaultMod()
-{
- return '155172898181473697471232257763715539915724801'.
- '966915404479707795314057629378541917580651227423'.
- '698188993727816152646631438561595825688188889951'.
- '272158842675419950341258706556549803580104870537'.
- '681476726513255747040765857479291291572334510643'.
- '245094715007229621094194349783925984760375594985'.
- '848253359305585439638443';
-}
-
-function Auth_OpenID_getDefaultGen()
-{
- return '2';
-}
-
-/**
- * The Diffie-Hellman key exchange class. This class relies on
- * {@link Auth_OpenID_MathLibrary} to perform large number operations.
- *
- * @access private
- * @package OpenID
- */
-class Auth_OpenID_DiffieHellman {
-
- var $mod;
- var $gen;
- var $private;
- var $lib = null;
-
- function Auth_OpenID_DiffieHellman($mod = null, $gen = null,
- $private = null, $lib = null)
- {
- if ($lib === null) {
- $this->lib =& Auth_OpenID_getMathLib();
- } else {
- $this->lib =& $lib;
- }
-
- if ($mod === null) {
- $this->mod = $this->lib->init(Auth_OpenID_getDefaultMod());
- } else {
- $this->mod = $mod;
- }
-
- if ($gen === null) {
- $this->gen = $this->lib->init(Auth_OpenID_getDefaultGen());
- } else {
- $this->gen = $gen;
- }
-
- if ($private === null) {
- $r = $this->lib->rand($this->mod);
- $this->private = $this->lib->add($r, 1);
- } else {
- $this->private = $private;
- }
-
- $this->public = $this->lib->powmod($this->gen, $this->private,
- $this->mod);
- }
-
- function getSharedSecret($composite)
- {
- return $this->lib->powmod($composite, $this->private, $this->mod);
- }
-
- function getPublicKey()
- {
- return $this->public;
- }
-
- function usingDefaultValues()
- {
- return ($this->mod == Auth_OpenID_getDefaultMod() &&
- $this->gen == Auth_OpenID_getDefaultGen());
- }
-
- function xorSecret($composite, $secret, $hash_func)
- {
- $dh_shared = $this->getSharedSecret($composite);
- $dh_shared_str = $this->lib->longToBinary($dh_shared);
- $hash_dh_shared = $hash_func($dh_shared_str);
-
- $xsecret = "";
- for ($i = 0; $i < Auth_OpenID::bytes($secret); $i++) {
- $xsecret .= chr(ord($secret[$i]) ^ ord($hash_dh_shared[$i]));
- }
-
- return $xsecret;
- }
-}
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Discover.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Discover.php
deleted file mode 100755
index b8f4d56..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Discover.php
+++ /dev/null
@@ -1,547 +0,0 @@
-claimed_id = null;
- $this->server_url = null;
- $this->type_uris = array();
- $this->local_id = null;
- $this->canonicalID = null;
- $this->used_yadis = false; // whether this came from an XRDS
- $this->display_identifier = null;
- }
-
- function getDisplayIdentifier()
- {
- if ($this->display_identifier) {
- return $this->display_identifier;
- }
- return $this->claimed_id;
- }
-
- function usesExtension($extension_uri)
- {
- return in_array($extension_uri, $this->type_uris);
- }
-
- function preferredNamespace()
- {
- if (in_array(Auth_OpenID_TYPE_2_0_IDP, $this->type_uris) ||
- in_array(Auth_OpenID_TYPE_2_0, $this->type_uris)) {
- return Auth_OpenID_OPENID2_NS;
- } else {
- return Auth_OpenID_OPENID1_NS;
- }
- }
-
- /*
- * Query this endpoint to see if it has any of the given type
- * URIs. This is useful for implementing other endpoint classes
- * that e.g. need to check for the presence of multiple versions
- * of a single protocol.
- *
- * @param $type_uris The URIs that you wish to check
- *
- * @return all types that are in both in type_uris and
- * $this->type_uris
- */
- function matchTypes($type_uris)
- {
- $result = array();
- foreach ($type_uris as $test_uri) {
- if ($this->supportsType($test_uri)) {
- $result[] = $test_uri;
- }
- }
-
- return $result;
- }
-
- function supportsType($type_uri)
- {
- // Does this endpoint support this type?
- return ((in_array($type_uri, $this->type_uris)) ||
- (($type_uri == Auth_OpenID_TYPE_2_0) &&
- $this->isOPIdentifier()));
- }
-
- function compatibilityMode()
- {
- return $this->preferredNamespace() != Auth_OpenID_OPENID2_NS;
- }
-
- function isOPIdentifier()
- {
- return in_array(Auth_OpenID_TYPE_2_0_IDP, $this->type_uris);
- }
-
- function fromOPEndpointURL($op_endpoint_url)
- {
- // Construct an OP-Identifier OpenIDServiceEndpoint object for
- // a given OP Endpoint URL
- $obj = new Auth_OpenID_ServiceEndpoint();
- $obj->server_url = $op_endpoint_url;
- $obj->type_uris = array(Auth_OpenID_TYPE_2_0_IDP);
- return $obj;
- }
-
- function parseService($yadis_url, $uri, $type_uris, $service_element)
- {
- // Set the state of this object based on the contents of the
- // service element. Return true if successful, false if not
- // (if findOPLocalIdentifier returns false).
- $this->type_uris = $type_uris;
- $this->server_url = $uri;
- $this->used_yadis = true;
-
- if (!$this->isOPIdentifier()) {
- $this->claimed_id = $yadis_url;
- $this->local_id = Auth_OpenID_findOPLocalIdentifier(
- $service_element,
- $this->type_uris);
- if ($this->local_id === false) {
- return false;
- }
- }
-
- return true;
- }
-
- function getLocalID()
- {
- // Return the identifier that should be sent as the
- // openid.identity_url parameter to the server.
- if ($this->local_id === null && $this->canonicalID === null) {
- return $this->claimed_id;
- } else {
- if ($this->local_id) {
- return $this->local_id;
- } else {
- return $this->canonicalID;
- }
- }
- }
-
- /*
- * Parse the given document as XRDS looking for OpenID services.
- *
- * @return array of Auth_OpenID_ServiceEndpoint or null if the
- * document cannot be parsed.
- */
- function fromXRDS($uri, $xrds_text)
- {
- $xrds =& Auth_Yadis_XRDS::parseXRDS($xrds_text);
-
- if ($xrds) {
- $yadis_services =
- $xrds->services(array('filter_MatchesAnyOpenIDType'));
- return Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services);
- }
-
- return null;
- }
-
- /*
- * Create endpoints from a DiscoveryResult.
- *
- * @param discoveryResult Auth_Yadis_DiscoveryResult
- * @return array of Auth_OpenID_ServiceEndpoint or null if
- * endpoints cannot be created.
- */
- function fromDiscoveryResult($discoveryResult)
- {
- if ($discoveryResult->isXRDS()) {
- return Auth_OpenID_ServiceEndpoint::fromXRDS(
- $discoveryResult->normalized_uri,
- $discoveryResult->response_text);
- } else {
- return Auth_OpenID_ServiceEndpoint::fromHTML(
- $discoveryResult->normalized_uri,
- $discoveryResult->response_text);
- }
- }
-
- function fromHTML($uri, $html)
- {
- $discovery_types = array(
- array(Auth_OpenID_TYPE_2_0,
- 'openid2.provider', 'openid2.local_id'),
- array(Auth_OpenID_TYPE_1_1,
- 'openid.server', 'openid.delegate')
- );
-
- $services = array();
-
- foreach ($discovery_types as $triple) {
- list($type_uri, $server_rel, $delegate_rel) = $triple;
-
- $urls = Auth_OpenID_legacy_discover($html, $server_rel,
- $delegate_rel);
-
- if ($urls === false) {
- continue;
- }
-
- list($delegate_url, $server_url) = $urls;
-
- $service = new Auth_OpenID_ServiceEndpoint();
- $service->claimed_id = $uri;
- $service->local_id = $delegate_url;
- $service->server_url = $server_url;
- $service->type_uris = array($type_uri);
-
- $services[] = $service;
- }
-
- return $services;
- }
-
- function copy()
- {
- $x = new Auth_OpenID_ServiceEndpoint();
-
- $x->claimed_id = $this->claimed_id;
- $x->server_url = $this->server_url;
- $x->type_uris = $this->type_uris;
- $x->local_id = $this->local_id;
- $x->canonicalID = $this->canonicalID;
- $x->used_yadis = $this->used_yadis;
-
- return $x;
- }
-}
-
-function Auth_OpenID_findOPLocalIdentifier($service, $type_uris)
-{
- // Extract a openid:Delegate value from a Yadis Service element.
- // If no delegate is found, returns null. Returns false on
- // discovery failure (when multiple delegate/localID tags have
- // different values).
-
- $service->parser->registerNamespace('openid',
- Auth_OpenID_XMLNS_1_0);
-
- $service->parser->registerNamespace('xrd',
- Auth_Yadis_XMLNS_XRD_2_0);
-
- $parser =& $service->parser;
-
- $permitted_tags = array();
-
- if (in_array(Auth_OpenID_TYPE_1_1, $type_uris) ||
- in_array(Auth_OpenID_TYPE_1_0, $type_uris)) {
- $permitted_tags[] = 'openid:Delegate';
- }
-
- if (in_array(Auth_OpenID_TYPE_2_0, $type_uris)) {
- $permitted_tags[] = 'xrd:LocalID';
- }
-
- $local_id = null;
-
- foreach ($permitted_tags as $tag_name) {
- $tags = $service->getElements($tag_name);
-
- foreach ($tags as $tag) {
- $content = $parser->content($tag);
-
- if ($local_id === null) {
- $local_id = $content;
- } else if ($local_id != $content) {
- return false;
- }
- }
- }
-
- return $local_id;
-}
-
-function filter_MatchesAnyOpenIDType(&$service)
-{
- $uris = $service->getTypes();
-
- foreach ($uris as $uri) {
- if (in_array($uri, Auth_OpenID_getOpenIDTypeURIs())) {
- return true;
- }
- }
-
- return false;
-}
-
-function Auth_OpenID_bestMatchingService($service, $preferred_types)
-{
- // Return the index of the first matching type, or something
- // higher if no type matches.
- //
- // This provides an ordering in which service elements that
- // contain a type that comes earlier in the preferred types list
- // come before service elements that come later. If a service
- // element has more than one type, the most preferred one wins.
-
- foreach ($preferred_types as $index => $typ) {
- if (in_array($typ, $service->type_uris)) {
- return $index;
- }
- }
-
- return count($preferred_types);
-}
-
-function Auth_OpenID_arrangeByType($service_list, $preferred_types)
-{
- // Rearrange service_list in a new list so services are ordered by
- // types listed in preferred_types. Return the new list.
-
- // Build a list with the service elements in tuples whose
- // comparison will prefer the one with the best matching service
- $prio_services = array();
- foreach ($service_list as $index => $service) {
- $prio_services[] = array(Auth_OpenID_bestMatchingService($service,
- $preferred_types),
- $index, $service);
- }
-
- sort($prio_services);
-
- // Now that the services are sorted by priority, remove the sort
- // keys from the list.
- foreach ($prio_services as $index => $s) {
- $prio_services[$index] = $prio_services[$index][2];
- }
-
- return $prio_services;
-}
-
-// Extract OP Identifier services. If none found, return the rest,
-// sorted with most preferred first according to
-// OpenIDServiceEndpoint.openid_type_uris.
-//
-// openid_services is a list of OpenIDServiceEndpoint objects.
-//
-// Returns a list of OpenIDServiceEndpoint objects."""
-function Auth_OpenID_getOPOrUserServices($openid_services)
-{
- $op_services = Auth_OpenID_arrangeByType($openid_services,
- array(Auth_OpenID_TYPE_2_0_IDP));
-
- $openid_services = Auth_OpenID_arrangeByType($openid_services,
- Auth_OpenID_getOpenIDTypeURIs());
-
- if ($op_services) {
- return $op_services;
- } else {
- return $openid_services;
- }
-}
-
-function Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services)
-{
- $s = array();
-
- if (!$yadis_services) {
- return $s;
- }
-
- foreach ($yadis_services as $service) {
- $type_uris = $service->getTypes();
- $uris = $service->getURIs();
-
- // If any Type URIs match and there is an endpoint URI
- // specified, then this is an OpenID endpoint
- if ($type_uris &&
- $uris) {
- foreach ($uris as $service_uri) {
- $openid_endpoint = new Auth_OpenID_ServiceEndpoint();
- if ($openid_endpoint->parseService($uri,
- $service_uri,
- $type_uris,
- $service)) {
- $s[] = $openid_endpoint;
- }
- }
- }
- }
-
- return $s;
-}
-
-function Auth_OpenID_discoverWithYadis($uri, &$fetcher,
- $endpoint_filter='Auth_OpenID_getOPOrUserServices',
- $discover_function=null)
-{
- // Discover OpenID services for a URI. Tries Yadis and falls back
- // on old-style discovery if Yadis fails.
-
- // Might raise a yadis.discover.DiscoveryFailure if no document
- // came back for that URI at all. I don't think falling back to
- // OpenID 1.0 discovery on the same URL will help, so don't bother
- // to catch it.
- if ($discover_function === null) {
- $discover_function = array('Auth_Yadis_Yadis', 'discover');
- }
-
- $openid_services = array();
-
- $response = call_user_func_array($discover_function,
- array($uri, &$fetcher));
-
- $yadis_url = $response->normalized_uri;
- $yadis_services = array();
-
- if ($response->isFailure()) {
- return array($uri, array());
- }
-
- $openid_services = Auth_OpenID_ServiceEndpoint::fromXRDS(
- $yadis_url,
- $response->response_text);
-
- if (!$openid_services) {
- if ($response->isXRDS()) {
- return Auth_OpenID_discoverWithoutYadis($uri,
- $fetcher);
- }
-
- // Try to parse the response as HTML to get OpenID 1.0/1.1
- //
- $openid_services = Auth_OpenID_ServiceEndpoint::fromHTML(
- $yadis_url,
- $response->response_text);
- }
-
- $openid_services = call_user_func_array($endpoint_filter,
- array(&$openid_services));
-
- return array($yadis_url, $openid_services);
-}
-
-function Auth_OpenID_discoverURI($uri, &$fetcher)
-{
- $parsed = parse_url($uri);
-
- if ($parsed && isset($parsed['scheme']) &&
- isset($parsed['host'])) {
- if (!in_array($parsed['scheme'], array('http', 'https'))) {
- // raise DiscoveryFailure('URI scheme is not HTTP or HTTPS', None)
- return array($uri, array());
- }
- } else {
- $uri = 'http://' . $uri;
- }
-
- $uri = Auth_OpenID::normalizeUrl($uri);
- return Auth_OpenID_discoverWithYadis($uri, $fetcher);
-}
-
-function Auth_OpenID_discoverWithoutYadis($uri, &$fetcher)
-{
- $http_resp = @$fetcher->get($uri);
-
- if ($http_resp->status != 200) {
- return array($uri, array());
- }
-
- $identity_url = $http_resp->final_url;
-
- // Try to parse the response as HTML to get OpenID 1.0/1.1
- $openid_services = Auth_OpenID_ServiceEndpoint::fromHTML(
- $identity_url,
- $http_resp->body);
-
- return array($identity_url, $openid_services);
-}
-
-function Auth_OpenID_discoverXRI($iname, &$fetcher)
-{
- $resolver = new Auth_Yadis_ProxyResolver($fetcher);
- list($canonicalID, $yadis_services) =
- $resolver->query($iname,
- Auth_OpenID_getOpenIDTypeURIs(),
- array('filter_MatchesAnyOpenIDType'));
-
- $openid_services = Auth_OpenID_makeOpenIDEndpoints($iname,
- $yadis_services);
-
- $openid_services = Auth_OpenID_getOPOrUserServices($openid_services);
-
- for ($i = 0; $i < count($openid_services); $i++) {
- $openid_services[$i]->canonicalID = $canonicalID;
- $openid_services[$i]->claimed_id = $canonicalID;
- $openid_services[$i]->display_identifier = $iname;
- }
-
- // FIXME: returned xri should probably be in some normal form
- return array($iname, $openid_services);
-}
-
-function Auth_OpenID_discover($uri, &$fetcher)
-{
- // If the fetcher (i.e., PHP) doesn't support SSL, we can't do
- // discovery on an HTTPS URL.
- if ($fetcher->isHTTPS($uri) && !$fetcher->supportsSSL()) {
- return array($uri, array());
- }
-
- if (Auth_Yadis_identifierScheme($uri) == 'XRI') {
- $result = Auth_OpenID_discoverXRI($uri, $fetcher);
- } else {
- $result = Auth_OpenID_discoverURI($uri, $fetcher);
- }
-
- // If the fetcher doesn't support SSL, we can't interact with
- // HTTPS server URLs; remove those endpoints from the list.
- if (!$fetcher->supportsSSL()) {
- $http_endpoints = array();
- list($new_uri, $endpoints) = $result;
-
- foreach ($endpoints as $e) {
- if (!$fetcher->isHTTPS($e->server_url)) {
- $http_endpoints[] = $e;
- }
- }
-
- $result = array($new_uri, $http_endpoints);
- }
-
- return $result;
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DumbStore.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DumbStore.php
deleted file mode 100755
index ef1a37f..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/DumbStore.php
+++ /dev/null
@@ -1,100 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Import the interface for creating a new store class.
- */
-require_once 'Auth/OpenID/Interface.php';
-require_once 'Auth/OpenID/HMACSHA1.php';
-
-/**
- * This is a store for use in the worst case, when you have no way of
- * saving state on the consumer site. Using this store makes the
- * consumer vulnerable to replay attacks, as it's unable to use
- * nonces. Avoid using this store if it is at all possible.
- *
- * Most of the methods of this class are implementation details.
- * Users of this class need to worry only about the constructor.
- *
- * @package OpenID
- */
-class Auth_OpenID_DumbStore extends Auth_OpenID_OpenIDStore {
-
- /**
- * Creates a new {@link Auth_OpenID_DumbStore} instance. For the security
- * of the tokens generated by the library, this class attempts to
- * at least have a secure implementation of getAuthKey.
- *
- * When you create an instance of this class, pass in a secret
- * phrase. The phrase is hashed with sha1 to make it the correct
- * length and form for an auth key. That allows you to use a long
- * string as the secret phrase, which means you can make it very
- * difficult to guess.
- *
- * Each {@link Auth_OpenID_DumbStore} instance that is created for use by
- * your consumer site needs to use the same $secret_phrase.
- *
- * @param string secret_phrase The phrase used to create the auth
- * key returned by getAuthKey
- */
- function Auth_OpenID_DumbStore($secret_phrase)
- {
- $this->auth_key = Auth_OpenID_SHA1($secret_phrase);
- }
-
- /**
- * This implementation does nothing.
- */
- function storeAssociation($server_url, $association)
- {
- }
-
- /**
- * This implementation always returns null.
- */
- function getAssociation($server_url, $handle = null)
- {
- return null;
- }
-
- /**
- * This implementation always returns false.
- */
- function removeAssociation($server_url, $handle)
- {
- return false;
- }
-
- /**
- * In a system truly limited to dumb mode, nonces must all be
- * accepted. This therefore always returns true, which makes
- * replay attacks feasible.
- */
- function useNonce($server_url, $timestamp, $salt)
- {
- return true;
- }
-
- /**
- * This method returns the auth key generated by the constructor.
- */
- function getAuthKey()
- {
- return $this->auth_key;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Extension.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Extension.php
deleted file mode 100755
index 73b5d50..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Extension.php
+++ /dev/null
@@ -1,58 +0,0 @@
-namespaces->addAlias($this->ns_uri,
- $this->ns_alias) === null) {
- if ($message->namespaces->getAlias($this->ns_uri) !=
- $this->ns_alias) {
- return null;
- }
- }
-
- $message->updateArgs($this->ns_uri,
- $this->getExtensionArgs());
- return $message;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/FileStore.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/FileStore.php
deleted file mode 100755
index f6bf170..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/FileStore.php
+++ /dev/null
@@ -1,618 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Require base class for creating a new interface.
- */
-require_once 'Auth/OpenID.php';
-require_once 'Auth/OpenID/Interface.php';
-require_once 'Auth/OpenID/HMACSHA1.php';
-require_once 'Auth/OpenID/Nonce.php';
-
-/**
- * This is a filesystem-based store for OpenID associations and
- * nonces. This store should be safe for use in concurrent systems on
- * both windows and unix (excluding NFS filesystems). There are a
- * couple race conditions in the system, but those failure cases have
- * been set up in such a way that the worst-case behavior is someone
- * having to try to log in a second time.
- *
- * Most of the methods of this class are implementation details.
- * People wishing to just use this store need only pay attention to
- * the constructor.
- *
- * @package OpenID
- */
-class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
-
- /**
- * Initializes a new {@link Auth_OpenID_FileStore}. This
- * initializes the nonce and association directories, which are
- * subdirectories of the directory passed in.
- *
- * @param string $directory This is the directory to put the store
- * directories in.
- */
- function Auth_OpenID_FileStore($directory)
- {
- if (!Auth_OpenID::ensureDir($directory)) {
- trigger_error('Not a directory and failed to create: '
- . $directory, E_USER_ERROR);
- }
- $directory = realpath($directory);
-
- $this->directory = $directory;
- $this->active = true;
-
- $this->nonce_dir = $directory . DIRECTORY_SEPARATOR . 'nonces';
-
- $this->association_dir = $directory . DIRECTORY_SEPARATOR .
- 'associations';
-
- // Temp dir must be on the same filesystem as the assciations
- // $directory.
- $this->temp_dir = $directory . DIRECTORY_SEPARATOR . 'temp';
-
- $this->max_nonce_age = 6 * 60 * 60; // Six hours, in seconds
-
- if (!$this->_setup()) {
- trigger_error('Failed to initialize OpenID file store in ' .
- $directory, E_USER_ERROR);
- }
- }
-
- function destroy()
- {
- Auth_OpenID_FileStore::_rmtree($this->directory);
- $this->active = false;
- }
-
- /**
- * Make sure that the directories in which we store our data
- * exist.
- *
- * @access private
- */
- function _setup()
- {
- return (Auth_OpenID::ensureDir($this->nonce_dir) &&
- Auth_OpenID::ensureDir($this->association_dir) &&
- Auth_OpenID::ensureDir($this->temp_dir));
- }
-
- /**
- * Create a temporary file on the same filesystem as
- * $this->association_dir.
- *
- * The temporary directory should not be cleaned if there are any
- * processes using the store. If there is no active process using
- * the store, it is safe to remove all of the files in the
- * temporary directory.
- *
- * @return array ($fd, $filename)
- * @access private
- */
- function _mktemp()
- {
- $name = Auth_OpenID_FileStore::_mkstemp($dir = $this->temp_dir);
- $file_obj = @fopen($name, 'wb');
- if ($file_obj !== false) {
- return array($file_obj, $name);
- } else {
- Auth_OpenID_FileStore::_removeIfPresent($name);
- }
- }
-
- function cleanupNonces()
- {
- global $Auth_OpenID_SKEW;
-
- $nonces = Auth_OpenID_FileStore::_listdir($this->nonce_dir);
- $now = time();
-
- $removed = 0;
- // Check all nonces for expiry
- foreach ($nonces as $nonce_fname) {
- $base = basename($nonce_fname);
- $parts = explode('-', $base, 2);
- $timestamp = $parts[0];
- $timestamp = intval($timestamp, 16);
- if (abs($timestamp - $now) > $Auth_OpenID_SKEW) {
- Auth_OpenID_FileStore::_removeIfPresent($nonce_fname);
- $removed += 1;
- }
- }
- return $removed;
- }
-
- /**
- * Create a unique filename for a given server url and
- * handle. This implementation does not assume anything about the
- * format of the handle. The filename that is returned will
- * contain the domain name from the server URL for ease of human
- * inspection of the data directory.
- *
- * @return string $filename
- */
- function getAssociationFilename($server_url, $handle)
- {
- if (!$this->active) {
- trigger_error("FileStore no longer active", E_USER_ERROR);
- return null;
- }
-
- if (strpos($server_url, '://') === false) {
- trigger_error(sprintf("Bad server URL: %s", $server_url),
- E_USER_WARNING);
- return null;
- }
-
- list($proto, $rest) = explode('://', $server_url, 2);
- $parts = explode('/', $rest);
- $domain = Auth_OpenID_FileStore::_filenameEscape($parts[0]);
- $url_hash = Auth_OpenID_FileStore::_safe64($server_url);
- if ($handle) {
- $handle_hash = Auth_OpenID_FileStore::_safe64($handle);
- } else {
- $handle_hash = '';
- }
-
- $filename = sprintf('%s-%s-%s-%s', $proto, $domain, $url_hash,
- $handle_hash);
-
- return $this->association_dir. DIRECTORY_SEPARATOR . $filename;
- }
-
- /**
- * Store an association in the association directory.
- */
- function storeAssociation($server_url, $association)
- {
- if (!$this->active) {
- trigger_error("FileStore no longer active", E_USER_ERROR);
- return false;
- }
-
- $association_s = $association->serialize();
- $filename = $this->getAssociationFilename($server_url,
- $association->handle);
- list($tmp_file, $tmp) = $this->_mktemp();
-
- if (!$tmp_file) {
- trigger_error("_mktemp didn't return a valid file descriptor",
- E_USER_WARNING);
- return false;
- }
-
- fwrite($tmp_file, $association_s);
-
- fflush($tmp_file);
-
- fclose($tmp_file);
-
- if (@rename($tmp, $filename)) {
- return true;
- } else {
- // In case we are running on Windows, try unlinking the
- // file in case it exists.
- @unlink($filename);
-
- // Now the target should not exist. Try renaming again,
- // giving up if it fails.
- if (@rename($tmp, $filename)) {
- return true;
- }
- }
-
- // If there was an error, don't leave the temporary file
- // around.
- Auth_OpenID_FileStore::_removeIfPresent($tmp);
- return false;
- }
-
- /**
- * Retrieve an association. If no handle is specified, return the
- * association with the most recent issue time.
- *
- * @return mixed $association
- */
- function getAssociation($server_url, $handle = null)
- {
- if (!$this->active) {
- trigger_error("FileStore no longer active", E_USER_ERROR);
- return null;
- }
-
- if ($handle === null) {
- $handle = '';
- }
-
- // The filename with the empty handle is a prefix of all other
- // associations for the given server URL.
- $filename = $this->getAssociationFilename($server_url, $handle);
-
- if ($handle) {
- return $this->_getAssociation($filename);
- } else {
- $association_files =
- Auth_OpenID_FileStore::_listdir($this->association_dir);
- $matching_files = array();
-
- // strip off the path to do the comparison
- $name = basename($filename);
- foreach ($association_files as $association_file) {
- $base = basename($association_file);
- if (strpos($base, $name) === 0) {
- $matching_files[] = $association_file;
- }
- }
-
- $matching_associations = array();
- // read the matching files and sort by time issued
- foreach ($matching_files as $full_name) {
- $association = $this->_getAssociation($full_name);
- if ($association !== null) {
- $matching_associations[] = array($association->issued,
- $association);
- }
- }
-
- $issued = array();
- $assocs = array();
- foreach ($matching_associations as $key => $assoc) {
- $issued[$key] = $assoc[0];
- $assocs[$key] = $assoc[1];
- }
-
- array_multisort($issued, SORT_DESC, $assocs, SORT_DESC,
- $matching_associations);
-
- // return the most recently issued one.
- if ($matching_associations) {
- list($issued, $assoc) = $matching_associations[0];
- return $assoc;
- } else {
- return null;
- }
- }
- }
-
- /**
- * @access private
- */
- function _getAssociation($filename)
- {
- if (!$this->active) {
- trigger_error("FileStore no longer active", E_USER_ERROR);
- return null;
- }
-
- $assoc_file = @fopen($filename, 'rb');
-
- if ($assoc_file === false) {
- return null;
- }
-
- $assoc_s = fread($assoc_file, filesize($filename));
- fclose($assoc_file);
-
- if (!$assoc_s) {
- return null;
- }
-
- $association =
- Auth_OpenID_Association::deserialize('Auth_OpenID_Association',
- $assoc_s);
-
- if (!$association) {
- Auth_OpenID_FileStore::_removeIfPresent($filename);
- return null;
- }
-
- if ($association->getExpiresIn() == 0) {
- Auth_OpenID_FileStore::_removeIfPresent($filename);
- return null;
- } else {
- return $association;
- }
- }
-
- /**
- * Remove an association if it exists. Do nothing if it does not.
- *
- * @return bool $success
- */
- function removeAssociation($server_url, $handle)
- {
- if (!$this->active) {
- trigger_error("FileStore no longer active", E_USER_ERROR);
- return null;
- }
-
- $assoc = $this->getAssociation($server_url, $handle);
- if ($assoc === null) {
- return false;
- } else {
- $filename = $this->getAssociationFilename($server_url, $handle);
- return Auth_OpenID_FileStore::_removeIfPresent($filename);
- }
- }
-
- /**
- * Return whether this nonce is present. As a side effect, mark it
- * as no longer present.
- *
- * @return bool $present
- */
- function useNonce($server_url, $timestamp, $salt)
- {
- global $Auth_OpenID_SKEW;
-
- if (!$this->active) {
- trigger_error("FileStore no longer active", E_USER_ERROR);
- return null;
- }
-
- if ( abs($timestamp - time()) > $Auth_OpenID_SKEW ) {
- return False;
- }
-
- if ($server_url) {
- list($proto, $rest) = explode('://', $server_url, 2);
- } else {
- $proto = '';
- $rest = '';
- }
-
- $parts = explode('/', $rest, 2);
- $domain = $this->_filenameEscape($parts[0]);
- $url_hash = $this->_safe64($server_url);
- $salt_hash = $this->_safe64($salt);
-
- $filename = sprintf('%08x-%s-%s-%s-%s', $timestamp, $proto,
- $domain, $url_hash, $salt_hash);
- $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $filename;
-
- $result = @fopen($filename, 'x');
-
- if ($result === false) {
- return false;
- } else {
- fclose($result);
- return true;
- }
- }
-
- /**
- * Remove expired entries from the database. This is potentially
- * expensive, so only run when it is acceptable to take time.
- *
- * @access private
- */
- function _allAssocs()
- {
- $all_associations = array();
-
- $association_filenames =
- Auth_OpenID_FileStore::_listdir($this->association_dir);
-
- foreach ($association_filenames as $association_filename) {
- $association_file = fopen($association_filename, 'rb');
-
- if ($association_file !== false) {
- $assoc_s = fread($association_file,
- filesize($association_filename));
- fclose($association_file);
-
- // Remove expired or corrupted associations
- $association =
- Auth_OpenID_Association::deserialize(
- 'Auth_OpenID_Association', $assoc_s);
-
- if ($association === null) {
- Auth_OpenID_FileStore::_removeIfPresent(
- $association_filename);
- } else {
- if ($association->getExpiresIn() == 0) {
- $all_associations[] = array($association_filename,
- $association);
- }
- }
- }
- }
-
- return $all_associations;
- }
-
- function clean()
- {
- if (!$this->active) {
- trigger_error("FileStore no longer active", E_USER_ERROR);
- return null;
- }
-
- $nonces = Auth_OpenID_FileStore::_listdir($this->nonce_dir);
- $now = time();
-
- // Check all nonces for expiry
- foreach ($nonces as $nonce) {
- if (!Auth_OpenID_checkTimestamp($nonce, $now)) {
- $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $nonce;
- Auth_OpenID_FileStore::_removeIfPresent($filename);
- }
- }
-
- foreach ($this->_allAssocs() as $pair) {
- list($assoc_filename, $assoc) = $pair;
- if ($assoc->getExpiresIn() == 0) {
- Auth_OpenID_FileStore::_removeIfPresent($assoc_filename);
- }
- }
- }
-
- /**
- * @access private
- */
- function _rmtree($dir)
- {
- if ($dir[strlen($dir) - 1] != DIRECTORY_SEPARATOR) {
- $dir .= DIRECTORY_SEPARATOR;
- }
-
- if ($handle = opendir($dir)) {
- while ($item = readdir($handle)) {
- if (!in_array($item, array('.', '..'))) {
- if (is_dir($dir . $item)) {
-
- if (!Auth_OpenID_FileStore::_rmtree($dir . $item)) {
- return false;
- }
- } else if (is_file($dir . $item)) {
- if (!unlink($dir . $item)) {
- return false;
- }
- }
- }
- }
-
- closedir($handle);
-
- if (!@rmdir($dir)) {
- return false;
- }
-
- return true;
- } else {
- // Couldn't open directory.
- return false;
- }
- }
-
- /**
- * @access private
- */
- function _mkstemp($dir)
- {
- foreach (range(0, 4) as $i) {
- $name = tempnam($dir, "php_openid_filestore_");
-
- if ($name !== false) {
- return $name;
- }
- }
- return false;
- }
-
- /**
- * @access private
- */
- function _mkdtemp($dir)
- {
- foreach (range(0, 4) as $i) {
- $name = $dir . strval(DIRECTORY_SEPARATOR) . strval(getmypid()) .
- "-" . strval(rand(1, time()));
- if (!mkdir($name, 0700)) {
- return false;
- } else {
- return $name;
- }
- }
- return false;
- }
-
- /**
- * @access private
- */
- function _listdir($dir)
- {
- $handle = opendir($dir);
- $files = array();
- while (false !== ($filename = readdir($handle))) {
- if (!in_array($filename, array('.', '..'))) {
- $files[] = $dir . DIRECTORY_SEPARATOR . $filename;
- }
- }
- return $files;
- }
-
- /**
- * @access private
- */
- function _isFilenameSafe($char)
- {
- $_Auth_OpenID_filename_allowed = Auth_OpenID_letters .
- Auth_OpenID_digits . ".";
- return (strpos($_Auth_OpenID_filename_allowed, $char) !== false);
- }
-
- /**
- * @access private
- */
- function _safe64($str)
- {
- $h64 = base64_encode(Auth_OpenID_SHA1($str));
- $h64 = str_replace('+', '_', $h64);
- $h64 = str_replace('/', '.', $h64);
- $h64 = str_replace('=', '', $h64);
- return $h64;
- }
-
- /**
- * @access private
- */
- function _filenameEscape($str)
- {
- $filename = "";
- $b = Auth_OpenID::toBytes($str);
-
- for ($i = 0; $i < count($b); $i++) {
- $c = $b[$i];
- if (Auth_OpenID_FileStore::_isFilenameSafe($c)) {
- $filename .= $c;
- } else {
- $filename .= sprintf("_%02X", ord($c));
- }
- }
- return $filename;
- }
-
- /**
- * Attempt to remove a file, returning whether the file existed at
- * the time of the call.
- *
- * @access private
- * @return bool $result True if the file was present, false if not.
- */
- function _removeIfPresent($filename)
- {
- return @unlink($filename);
- }
-
- function cleanupAssociations()
- {
- $removed = 0;
- foreach ($this->_allAssocs() as $pair) {
- list($assoc_filename, $assoc) = $pair;
- if ($assoc->getExpiresIn() == 0) {
- $this->_removeIfPresent($assoc_filename);
- $removed += 1;
- }
- }
- return $removed;
- }
-}
-
-?>
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/HMACSHA1.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/HMACSHA1.php
deleted file mode 100755
index 9fc293e..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/HMACSHA1.php
+++ /dev/null
@@ -1,99 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-require_once 'Auth/OpenID.php';
-
-/**
- * SHA1_BLOCKSIZE is this module's SHA1 blocksize used by the fallback
- * implementation.
- */
-define('Auth_OpenID_SHA1_BLOCKSIZE', 64);
-
-function Auth_OpenID_SHA1($text)
-{
- if (function_exists('hash') &&
- function_exists('hash_algos') &&
- (in_array('sha1', hash_algos()))) {
- // PHP 5 case (sometimes): 'hash' available and 'sha1' algo
- // supported.
- return hash('sha1', $text, true);
- } else if (function_exists('sha1')) {
- // PHP 4 case: 'sha1' available.
- $hex = sha1($text);
- $raw = '';
- for ($i = 0; $i < 40; $i += 2) {
- $hexcode = substr($hex, $i, 2);
- $charcode = (int)base_convert($hexcode, 16, 10);
- $raw .= chr($charcode);
- }
- return $raw;
- } else {
- // Explode.
- trigger_error('No SHA1 function found', E_USER_ERROR);
- }
-}
-
-/**
- * Compute an HMAC/SHA1 hash.
- *
- * @access private
- * @param string $key The HMAC key
- * @param string $text The message text to hash
- * @return string $mac The MAC
- */
-function Auth_OpenID_HMACSHA1($key, $text)
-{
- if (Auth_OpenID::bytes($key) > Auth_OpenID_SHA1_BLOCKSIZE) {
- $key = Auth_OpenID_SHA1($key, true);
- }
-
- $key = str_pad($key, Auth_OpenID_SHA1_BLOCKSIZE, chr(0x00));
- $ipad = str_repeat(chr(0x36), Auth_OpenID_SHA1_BLOCKSIZE);
- $opad = str_repeat(chr(0x5c), Auth_OpenID_SHA1_BLOCKSIZE);
- $hash1 = Auth_OpenID_SHA1(($key ^ $ipad) . $text, true);
- $hmac = Auth_OpenID_SHA1(($key ^ $opad) . $hash1, true);
- return $hmac;
-}
-
-if (function_exists('hash') &&
- function_exists('hash_algos') &&
- (in_array('sha256', hash_algos()))) {
- function Auth_OpenID_SHA256($text)
- {
- // PHP 5 case: 'hash' available and 'sha256' algo supported.
- return hash('sha256', $text, true);
- }
- define('Auth_OpenID_SHA256_SUPPORTED', true);
-} else {
- define('Auth_OpenID_SHA256_SUPPORTED', false);
-}
-
-if (function_exists('hash_hmac') &&
- function_exists('hash_algos') &&
- (in_array('sha256', hash_algos()))) {
-
- function Auth_OpenID_HMACSHA256($key, $text)
- {
- // Return raw MAC (not hex string).
- return hash_hmac('sha256', $key, $text, true);
- }
-
- define('Auth_OpenID_HMACSHA256_SUPPORTED', true);
-} else {
- define('Auth_OpenID_HMACSHA256_SUPPORTED', false);
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Interface.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Interface.php
deleted file mode 100755
index 38fe369..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Interface.php
+++ /dev/null
@@ -1,197 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * This is the interface for the store objects the OpenID library
- * uses. It is a single class that provides all of the persistence
- * mechanisms that the OpenID library needs, for both servers and
- * consumers. If you want to create an SQL-driven store, please see
- * then {@link Auth_OpenID_SQLStore} class.
- *
- * Change: Version 2.0 removed the storeNonce, getAuthKey, and isDumb
- * methods, and changed the behavior of the useNonce method to support
- * one-way nonces.
- *
- * @package OpenID
- * @author JanRain, Inc.
- */
-class Auth_OpenID_OpenIDStore {
- /**
- * This method puts an Association object into storage,
- * retrievable by server URL and handle.
- *
- * @param string $server_url The URL of the identity server that
- * this association is with. Because of the way the server portion
- * of the library uses this interface, don't assume there are any
- * limitations on the character set of the input string. In
- * particular, expect to see unescaped non-url-safe characters in
- * the server_url field.
- *
- * @param Association $association The Association to store.
- */
- function storeAssociation($server_url, $association)
- {
- trigger_error("Auth_OpenID_OpenIDStore::storeAssociation ".
- "not implemented", E_USER_ERROR);
- }
-
- /*
- * Remove expired nonces from the store.
- *
- * Discards any nonce from storage that is old enough that its
- * timestamp would not pass useNonce().
- *
- * This method is not called in the normal operation of the
- * library. It provides a way for store admins to keep their
- * storage from filling up with expired data.
- *
- * @return the number of nonces expired
- */
- function cleanupNonces()
- {
- trigger_error("Auth_OpenID_OpenIDStore::cleanupNonces ".
- "not implemented", E_USER_ERROR);
- }
-
- /*
- * Remove expired associations from the store.
- *
- * This method is not called in the normal operation of the
- * library. It provides a way for store admins to keep their
- * storage from filling up with expired data.
- *
- * @return the number of associations expired.
- */
- function cleanupAssociations()
- {
- trigger_error("Auth_OpenID_OpenIDStore::cleanupAssociations ".
- "not implemented", E_USER_ERROR);
- }
-
- /*
- * Shortcut for cleanupNonces(), cleanupAssociations().
- *
- * This method is not called in the normal operation of the
- * library. It provides a way for store admins to keep their
- * storage from filling up with expired data.
- */
- function cleanup()
- {
- return array($this->cleanupNonces(),
- $this->cleanupAssociations());
- }
-
- /**
- * Report whether this storage supports cleanup
- */
- function supportsCleanup()
- {
- return true;
- }
-
- /**
- * This method returns an Association object from storage that
- * matches the server URL and, if specified, handle. It returns
- * null if no such association is found or if the matching
- * association is expired.
- *
- * If no handle is specified, the store may return any association
- * which matches the server URL. If multiple associations are
- * valid, the recommended return value for this method is the one
- * most recently issued.
- *
- * This method is allowed (and encouraged) to garbage collect
- * expired associations when found. This method must not return
- * expired associations.
- *
- * @param string $server_url The URL of the identity server to get
- * the association for. Because of the way the server portion of
- * the library uses this interface, don't assume there are any
- * limitations on the character set of the input string. In
- * particular, expect to see unescaped non-url-safe characters in
- * the server_url field.
- *
- * @param mixed $handle This optional parameter is the handle of
- * the specific association to get. If no specific handle is
- * provided, any valid association matching the server URL is
- * returned.
- *
- * @return Association The Association for the given identity
- * server.
- */
- function getAssociation($server_url, $handle = null)
- {
- trigger_error("Auth_OpenID_OpenIDStore::getAssociation ".
- "not implemented", E_USER_ERROR);
- }
-
- /**
- * This method removes the matching association if it's found, and
- * returns whether the association was removed or not.
- *
- * @param string $server_url The URL of the identity server the
- * association to remove belongs to. Because of the way the server
- * portion of the library uses this interface, don't assume there
- * are any limitations on the character set of the input
- * string. In particular, expect to see unescaped non-url-safe
- * characters in the server_url field.
- *
- * @param string $handle This is the handle of the association to
- * remove. If there isn't an association found that matches both
- * the given URL and handle, then there was no matching handle
- * found.
- *
- * @return mixed Returns whether or not the given association existed.
- */
- function removeAssociation($server_url, $handle)
- {
- trigger_error("Auth_OpenID_OpenIDStore::removeAssociation ".
- "not implemented", E_USER_ERROR);
- }
-
- /**
- * Called when using a nonce.
- *
- * This method should return C{True} if the nonce has not been
- * used before, and store it for a while to make sure nobody
- * tries to use the same value again. If the nonce has already
- * been used, return C{False}.
- *
- * Change: In earlier versions, round-trip nonces were used and a
- * nonce was only valid if it had been previously stored with
- * storeNonce. Version 2.0 uses one-way nonces, requiring a
- * different implementation here that does not depend on a
- * storeNonce call. (storeNonce is no longer part of the
- * interface.
- *
- * @param string $nonce The nonce to use.
- *
- * @return bool Whether or not the nonce was valid.
- */
- function useNonce($server_url, $timestamp, $salt)
- {
- trigger_error("Auth_OpenID_OpenIDStore::useNonce ".
- "not implemented", E_USER_ERROR);
- }
-
- /**
- * Removes all entries from the store; implementation is optional.
- */
- function reset()
- {
- }
-
-}
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/KVForm.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/KVForm.php
deleted file mode 100755
index 6075c44..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/KVForm.php
+++ /dev/null
@@ -1,112 +0,0 @@
-
- * @copyright 2005 Janrain, Inc.
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Container for key-value/comma-newline OpenID format and parsing
- */
-class Auth_OpenID_KVForm {
- /**
- * Convert an OpenID colon/newline separated string into an
- * associative array
- *
- * @static
- * @access private
- */
- function toArray($kvs, $strict=false)
- {
- $lines = explode("\n", $kvs);
-
- $last = array_pop($lines);
- if ($last !== '') {
- array_push($lines, $last);
- if ($strict) {
- return false;
- }
- }
-
- $values = array();
-
- for ($lineno = 0; $lineno < count($lines); $lineno++) {
- $line = $lines[$lineno];
- $kv = explode(':', $line, 2);
- if (count($kv) != 2) {
- if ($strict) {
- return false;
- }
- continue;
- }
-
- $key = $kv[0];
- $tkey = trim($key);
- if ($tkey != $key) {
- if ($strict) {
- return false;
- }
- }
-
- $value = $kv[1];
- $tval = trim($value);
- if ($tval != $value) {
- if ($strict) {
- return false;
- }
- }
-
- $values[$tkey] = $tval;
- }
-
- return $values;
- }
-
- /**
- * Convert an array into an OpenID colon/newline separated string
- *
- * @static
- * @access private
- */
- function fromArray($values)
- {
- if ($values === null) {
- return null;
- }
-
- ksort($values);
-
- $serialized = '';
- foreach ($values as $key => $value) {
- if (is_array($value)) {
- list($key, $value) = array($value[0], $value[1]);
- }
-
- if (strpos($key, ':') !== false) {
- return null;
- }
-
- if (strpos($key, "\n") !== false) {
- return null;
- }
-
- if (strpos($value, "\n") !== false) {
- return null;
- }
- $serialized .= "$key:$value\n";
- }
- return $serialized;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/MemcachedStore.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/MemcachedStore.php
deleted file mode 100755
index 7f9b180..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/MemcachedStore.php
+++ /dev/null
@@ -1,207 +0,0 @@
-
- * @copyright Open Web Technologies
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Import the interface for creating a new store class.
- */
-require_once 'Auth/OpenID/Interface.php';
-
-/**
- * This is a memcached-based store for OpenID associations and
- * nonces.
- *
- * As memcache has limit of 250 chars for key length,
- * server_url, handle and salt are hashed with sha1().
- *
- * Most of the methods of this class are implementation details.
- * People wishing to just use this store need only pay attention to
- * the constructor.
- *
- * @package OpenID
- */
-class Auth_OpenID_MemcachedStore extends Auth_OpenID_OpenIDStore {
-
- /**
- * Initializes a new {@link Auth_OpenID_MemcachedStore} instance.
- * Just saves memcached object as property.
- *
- * @param resource connection Memcache connection resourse
- */
- function Auth_OpenID_MemcachedStore($connection, $compress = false)
- {
- $this->connection = $connection;
- $this->compress = $compress ? MEMCACHE_COMPRESSED : 0;
- }
-
- /**
- * Store association until its expiration time in memcached.
- * Overwrites any existing association with same server_url and
- * handle. Handles list of associations for every server.
- */
- function storeAssociation($server_url, $association)
- {
- // create memcached keys for association itself
- // and list of associations for this server
- $associationKey = $this->associationKey($server_url,
- $association->handle);
- $serverKey = $this->associationServerKey($server_url);
-
- // get list of associations
- $serverAssociations = $this->connection->get($serverKey);
-
- // if no such list, initialize it with empty array
- if (!$serverAssociations) {
- $serverAssociations = array();
- }
- // and store given association key in it
- $serverAssociations[$association->issued] = $associationKey;
-
- // save associations' keys list
- $this->connection->set(
- $serverKey,
- $serverAssociations,
- $this->compress
- );
- // save association itself
- $this->connection->set(
- $associationKey,
- $association,
- $this->compress,
- $association->issued + $association->lifetime);
- }
-
- /**
- * Read association from memcached. If no handle given
- * and multiple associations found, returns latest issued
- */
- function getAssociation($server_url, $handle = null)
- {
- // simple case: handle given
- if ($handle !== null) {
- // get association, return null if failed
- $association = $this->connection->get(
- $this->associationKey($server_url, $handle));
- return $association ? $association : null;
- }
-
- // no handle given, working with list
- // create key for list of associations
- $serverKey = $this->associationServerKey($server_url);
-
- // get list of associations
- $serverAssociations = $this->connection->get($serverKey);
- // return null if failed or got empty list
- if (!$serverAssociations) {
- return null;
- }
-
- // get key of most recently issued association
- $keys = array_keys($serverAssociations);
- sort($keys);
- $lastKey = $serverAssociations[array_pop($keys)];
-
- // get association, return null if failed
- $association = $this->connection->get($lastKey);
- return $association ? $association : null;
- }
-
- /**
- * Immediately delete association from memcache.
- */
- function removeAssociation($server_url, $handle)
- {
- // create memcached keys for association itself
- // and list of associations for this server
- $serverKey = $this->associationServerKey($server_url);
- $associationKey = $this->associationKey($server_url,
- $handle);
-
- // get list of associations
- $serverAssociations = $this->connection->get($serverKey);
- // return null if failed or got empty list
- if (!$serverAssociations) {
- return false;
- }
-
- // ensure that given association key exists in list
- $serverAssociations = array_flip($serverAssociations);
- if (!array_key_exists($associationKey, $serverAssociations)) {
- return false;
- }
-
- // remove given association key from list
- unset($serverAssociations[$associationKey]);
- $serverAssociations = array_flip($serverAssociations);
-
- // save updated list
- $this->connection->set(
- $serverKey,
- $serverAssociations,
- $this->compress
- );
-
- // delete association
- return $this->connection->delete($associationKey);
- }
-
- /**
- * Create nonce for server and salt, expiring after
- * $Auth_OpenID_SKEW seconds.
- */
- function useNonce($server_url, $timestamp, $salt)
- {
- global $Auth_OpenID_SKEW;
-
- // save one request to memcache when nonce obviously expired
- if (abs($timestamp - time()) > $Auth_OpenID_SKEW) {
- return false;
- }
-
- // returns false when nonce already exists
- // otherwise adds nonce
- return $this->connection->add(
- 'openid_nonce_' . sha1($server_url) . '_' . sha1($salt),
- 1, // any value here
- $this->compress,
- $Auth_OpenID_SKEW);
- }
-
- /**
- * Memcache key is prefixed with 'openid_association_' string.
- */
- function associationKey($server_url, $handle = null)
- {
- return 'openid_association_' . sha1($server_url) . '_' . sha1($handle);
- }
-
- /**
- * Memcache key is prefixed with 'openid_association_' string.
- */
- function associationServerKey($server_url)
- {
- return 'openid_association_server_' . sha1($server_url);
- }
-
- /**
- * Report that this storage doesn't support cleanup
- */
- function supportsCleanup()
- {
- return false;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Message.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Message.php
deleted file mode 100755
index 8a02ab2..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Message.php
+++ /dev/null
@@ -1,895 +0,0 @@
-keys = array();
- $this->values = array();
-
- if (is_array($classic_array)) {
- foreach ($classic_array as $key => $value) {
- $this->set($key, $value);
- }
- }
- }
-
- /**
- * Returns true if $thing is an Auth_OpenID_Mapping object; false
- * if not.
- */
- function isA($thing)
- {
- return (is_object($thing) &&
- strtolower(get_class($thing)) == 'auth_openid_mapping');
- }
-
- /**
- * Returns an array of the keys in the mapping.
- */
- function keys()
- {
- return $this->keys;
- }
-
- /**
- * Returns an array of values in the mapping.
- */
- function values()
- {
- return $this->values;
- }
-
- /**
- * Returns an array of (key, value) pairs in the mapping.
- */
- function items()
- {
- $temp = array();
-
- for ($i = 0; $i < count($this->keys); $i++) {
- $temp[] = array($this->keys[$i],
- $this->values[$i]);
- }
- return $temp;
- }
-
- /**
- * Returns the "length" of the mapping, or the number of keys.
- */
- function len()
- {
- return count($this->keys);
- }
-
- /**
- * Sets a key-value pair in the mapping. If the key already
- * exists, its value is replaced with the new value.
- */
- function set($key, $value)
- {
- $index = array_search($key, $this->keys);
-
- if ($index !== false) {
- $this->values[$index] = $value;
- } else {
- $this->keys[] = $key;
- $this->values[] = $value;
- }
- }
-
- /**
- * Gets a specified value from the mapping, associated with the
- * specified key. If the key does not exist in the mapping,
- * $default is returned instead.
- */
- function get($key, $default = null)
- {
- $index = array_search($key, $this->keys);
-
- if ($index !== false) {
- return $this->values[$index];
- } else {
- return $default;
- }
- }
-
- /**
- * @access private
- */
- function _reflow()
- {
- // PHP is broken yet again. Sort the arrays to remove the
- // hole in the numeric indexes that make up the array.
- $old_keys = $this->keys;
- $old_values = $this->values;
-
- $this->keys = array();
- $this->values = array();
-
- foreach ($old_keys as $k) {
- $this->keys[] = $k;
- }
-
- foreach ($old_values as $v) {
- $this->values[] = $v;
- }
- }
-
- /**
- * Deletes a key-value pair from the mapping with the specified
- * key.
- */
- function del($key)
- {
- $index = array_search($key, $this->keys);
-
- if ($index !== false) {
- unset($this->keys[$index]);
- unset($this->values[$index]);
- $this->_reflow();
- return true;
- }
- return false;
- }
-
- /**
- * Returns true if the specified value has a key in the mapping;
- * false if not.
- */
- function contains($value)
- {
- return (array_search($value, $this->keys) !== false);
- }
-}
-
-/**
- * Maintains a bijective map between namespace uris and aliases.
- *
- * @package OpenID
- */
-class Auth_OpenID_NamespaceMap {
- function Auth_OpenID_NamespaceMap()
- {
- $this->alias_to_namespace = new Auth_OpenID_Mapping();
- $this->namespace_to_alias = new Auth_OpenID_Mapping();
- }
-
- function getAlias($namespace_uri)
- {
- return $this->namespace_to_alias->get($namespace_uri);
- }
-
- function getNamespaceURI($alias)
- {
- return $this->alias_to_namespace->get($alias);
- }
-
- function iterNamespaceURIs()
- {
- // Return an iterator over the namespace URIs
- return $this->namespace_to_alias->keys();
- }
-
- function iterAliases()
- {
- // Return an iterator over the aliases"""
- return $this->alias_to_namespace->keys();
- }
-
- function iteritems()
- {
- return $this->namespace_to_alias->items();
- }
-
- function addAlias($namespace_uri, $desired_alias)
- {
- // Add an alias from this namespace URI to the desired alias
- global $Auth_OpenID_OPENID_PROTOCOL_FIELDS;
-
- // Check that desired_alias is not an openid protocol field as
- // per the spec.
- if (in_array($desired_alias, $Auth_OpenID_OPENID_PROTOCOL_FIELDS)) {
- // "%r is not an allowed namespace alias" % (desired_alias,);
- return null;
- }
-
- // Check that desired_alias does not contain a period as per
- // the spec.
- if (strpos($desired_alias, '.') !== false) {
- // "%r must not contain a dot" % (desired_alias,)
- return null;
- }
-
- // Check that there is not a namespace already defined for the
- // desired alias
- $current_namespace_uri =
- $this->alias_to_namespace->get($desired_alias);
-
- if (($current_namespace_uri !== null) &&
- ($current_namespace_uri != $namespace_uri)) {
- // Cannot map because previous mapping exists
- return null;
- }
-
- // Check that there is not already a (different) alias for
- // this namespace URI
- $alias = $this->namespace_to_alias->get($namespace_uri);
-
- if (($alias !== null) && ($alias != $desired_alias)) {
- // fmt = ('Cannot map %r to alias %r. '
- // 'It is already mapped to alias %r')
- // raise KeyError(fmt % (namespace_uri, desired_alias, alias))
- return null;
- }
-
- assert((Auth_OpenID_NULL_NAMESPACE === $desired_alias) ||
- is_string($desired_alias));
-
- $this->alias_to_namespace->set($desired_alias, $namespace_uri);
- $this->namespace_to_alias->set($namespace_uri, $desired_alias);
-
- return $desired_alias;
- }
-
- function add($namespace_uri)
- {
- // Add this namespace URI to the mapping, without caring what
- // alias it ends up with
-
- // See if this namespace is already mapped to an alias
- $alias = $this->namespace_to_alias->get($namespace_uri);
-
- if ($alias !== null) {
- return $alias;
- }
-
- // Fall back to generating a numerical alias
- $i = 0;
- while (1) {
- $alias = 'ext' . strval($i);
- if ($this->addAlias($namespace_uri, $alias) === null) {
- $i += 1;
- } else {
- return $alias;
- }
- }
-
- // Should NEVER be reached!
- return null;
- }
-
- function contains($namespace_uri)
- {
- return $this->isDefined($namespace_uri);
- }
-
- function isDefined($namespace_uri)
- {
- return $this->namespace_to_alias->contains($namespace_uri);
- }
-}
-
-/**
- * In the implementation of this object, null represents the global
- * namespace as well as a namespace with no key.
- *
- * @package OpenID
- */
-class Auth_OpenID_Message {
-
- function Auth_OpenID_Message($openid_namespace = null)
- {
- // Create an empty Message
- $this->allowed_openid_namespaces = array(
- Auth_OpenID_OPENID1_NS,
- Auth_OpenID_OPENID2_NS);
-
- $this->args = new Auth_OpenID_Mapping();
- $this->namespaces = new Auth_OpenID_NamespaceMap();
- if ($openid_namespace === null) {
- $this->_openid_ns_uri = null;
- } else {
- $this->setOpenIDNamespace($openid_namespace);
- }
- }
-
- function isOpenID1()
- {
- return $this->getOpenIDNamespace() == Auth_OpenID_OPENID1_NS;
- }
-
- function isOpenID2()
- {
- return $this->getOpenIDNamespace() == Auth_OpenID_OPENID2_NS;
- }
-
- function fromPostArgs($args)
- {
- // Construct a Message containing a set of POST arguments
- $obj = new Auth_OpenID_Message();
-
- // Partition into "openid." args and bare args
- $openid_args = array();
- foreach ($args as $key => $value) {
-
- if (is_array($value)) {
- return null;
- }
-
- $parts = explode('.', $key, 2);
-
- if (count($parts) == 2) {
- list($prefix, $rest) = $parts;
- } else {
- $prefix = null;
- }
-
- if ($prefix != 'openid') {
- $obj->args->set(array(Auth_OpenID_BARE_NS, $key), $value);
- } else {
- $openid_args[$rest] = $value;
- }
- }
-
- if ($obj->_fromOpenIDArgs($openid_args)) {
- return $obj;
- } else {
- return null;
- }
- }
-
- function fromOpenIDArgs($openid_args)
- {
- // Takes an array.
-
- // Construct a Message from a parsed KVForm message
- $obj = new Auth_OpenID_Message();
- if ($obj->_fromOpenIDArgs($openid_args)) {
- return $obj;
- } else {
- return null;
- }
- }
-
- /**
- * @access private
- */
- function _fromOpenIDArgs($openid_args)
- {
- global $Auth_OpenID_registered_aliases;
-
- // Takes an Auth_OpenID_Mapping instance OR an array.
-
- if (!Auth_OpenID_Mapping::isA($openid_args)) {
- $openid_args = new Auth_OpenID_Mapping($openid_args);
- }
-
- $ns_args = array();
-
- // Resolve namespaces
- foreach ($openid_args->items() as $pair) {
- list($rest, $value) = $pair;
-
- $parts = explode('.', $rest, 2);
-
- if (count($parts) == 2) {
- list($ns_alias, $ns_key) = $parts;
- } else {
- $ns_alias = Auth_OpenID_NULL_NAMESPACE;
- $ns_key = $rest;
- }
-
- if ($ns_alias == 'ns') {
- if ($this->namespaces->addAlias($value, $ns_key) === null) {
- return false;
- }
- } else if (($ns_alias == Auth_OpenID_NULL_NAMESPACE) &&
- ($ns_key == 'ns')) {
- // null namespace
- if ($this->namespaces->addAlias($value,
- Auth_OpenID_NULL_NAMESPACE) === null) {
- return false;
- }
- } else {
- $ns_args[] = array($ns_alias, $ns_key, $value);
- }
- }
-
- // Ensure that there is an OpenID namespace definition
- $openid_ns_uri =
- $this->namespaces->getNamespaceURI(Auth_OpenID_NULL_NAMESPACE);
-
- if ($openid_ns_uri === null) {
- $openid_ns_uri = Auth_OpenID_OPENID1_NS;
- }
-
- $this->setOpenIDNamespace($openid_ns_uri);
-
- // Actually put the pairs into the appropriate namespaces
- foreach ($ns_args as $triple) {
- list($ns_alias, $ns_key, $value) = $triple;
- $ns_uri = $this->namespaces->getNamespaceURI($ns_alias);
- if ($ns_uri === null) {
- // Only try to map an alias to a default if it's an
- // OpenID 1.x message.
- if ($openid_ns_uri == Auth_OpenID_OPENID1_NS) {
- foreach ($Auth_OpenID_registered_aliases
- as $alias => $uri) {
- if ($alias == $ns_alias) {
- $ns_uri = $uri;
- break;
- }
- }
- }
-
- if ($ns_uri === null) {
- $ns_uri = $openid_ns_uri;
- $ns_key = sprintf('%s.%s', $ns_alias, $ns_key);
- } else {
- $this->namespaces->addAlias($ns_uri, $ns_alias);
- }
- }
-
- $this->setArg($ns_uri, $ns_key, $value);
- }
-
- return true;
- }
-
- function setOpenIDNamespace($openid_ns_uri)
- {
- if (!in_array($openid_ns_uri, $this->allowed_openid_namespaces)) {
- // raise ValueError('Invalid null namespace: %r' % (openid_ns_uri,))
- return false;
- }
-
- $this->namespaces->addAlias($openid_ns_uri,
- Auth_OpenID_NULL_NAMESPACE);
- $this->_openid_ns_uri = $openid_ns_uri;
- }
-
- function getOpenIDNamespace()
- {
- return $this->_openid_ns_uri;
- }
-
- function fromKVForm($kvform_string)
- {
- // Create a Message from a KVForm string
- return Auth_OpenID_Message::fromOpenIDArgs(
- Auth_OpenID_KVForm::toArray($kvform_string));
- }
-
- function copy()
- {
- return $this;
- }
-
- function toPostArgs()
- {
- // Return all arguments with openid. in front of namespaced
- // arguments.
-
- $args = array();
-
- // Add namespace definitions to the output
- foreach ($this->namespaces->iteritems() as $pair) {
- list($ns_uri, $alias) = $pair;
-
- if ($alias == Auth_OpenID_NULL_NAMESPACE) {
- if ($ns_uri != Auth_OpenID_OPENID1_NS) {
- $args['openid.ns'] = $ns_uri;
- } else {
- // drop the default null namespace
- // definition. This potentially changes a message
- // since we have no way of knowing whether it was
- // explicitly specified at the time the message
- // was parsed. The vast majority of the time, this
- // will be the right thing to do. Possibly this
- // could look in the signed list.
- }
- } else {
- if ($this->getOpenIDNamespace() != Auth_OpenID_OPENID1_NS) {
- $ns_key = 'openid.ns.' . $alias;
- $args[$ns_key] = $ns_uri;
- }
- }
- }
-
- foreach ($this->args->items() as $pair) {
- list($ns_parts, $value) = $pair;
- list($ns_uri, $ns_key) = $ns_parts;
- $key = $this->getKey($ns_uri, $ns_key);
- $args[$key] = $value;
- }
-
- return $args;
- }
-
- function toArgs()
- {
- // Return all namespaced arguments, failing if any
- // non-namespaced arguments exist.
- $post_args = $this->toPostArgs();
- $kvargs = array();
- foreach ($post_args as $k => $v) {
- if (strpos($k, 'openid.') !== 0) {
- // raise ValueError(
- // 'This message can only be encoded as a POST, because it '
- // 'contains arguments that are not prefixed with "openid."')
- return null;
- } else {
- $kvargs[substr($k, 7)] = $v;
- }
- }
-
- return $kvargs;
- }
-
- function toFormMarkup($action_url, $form_tag_attrs = null,
- $submit_text = "Continue")
- {
- $form = "\n";
-
- return $form;
- }
-
- function toURL($base_url)
- {
- // Generate a GET URL with the parameters in this message
- // attached as query parameters.
- return Auth_OpenID::appendArgs($base_url, $this->toPostArgs());
- }
-
- function toKVForm()
- {
- // Generate a KVForm string that contains the parameters in
- // this message. This will fail if the message contains
- // arguments outside of the 'openid.' prefix.
- return Auth_OpenID_KVForm::fromArray($this->toArgs());
- }
-
- function toURLEncoded()
- {
- // Generate an x-www-urlencoded string
- $args = array();
-
- foreach ($this->toPostArgs() as $k => $v) {
- $args[] = array($k, $v);
- }
-
- sort($args);
- return Auth_OpenID::httpBuildQuery($args);
- }
-
- /**
- * @access private
- */
- function _fixNS($namespace)
- {
- // Convert an input value into the internally used values of
- // this object
-
- if ($namespace == Auth_OpenID_OPENID_NS) {
- if ($this->_openid_ns_uri === null) {
- // raise UndefinedOpenIDNamespace('OpenID namespace not set')
- return null;
- } else {
- $namespace = $this->_openid_ns_uri;
- }
- }
-
- if (($namespace != Auth_OpenID_BARE_NS) &&
- (!is_string($namespace))) {
- // raise TypeError(
- // "Namespace must be BARE_NS, OPENID_NS or a string. got %r"
- // % (namespace,))
- return null;
- }
-
- if (($namespace != Auth_OpenID_BARE_NS) &&
- (strpos($namespace, ':') === false)) {
- // fmt = 'OpenID 2.0 namespace identifiers SHOULD be URIs. Got %r'
- // warnings.warn(fmt % (namespace,), DeprecationWarning)
-
- if ($namespace == 'sreg') {
- // fmt = 'Using %r instead of "sreg" as namespace'
- // warnings.warn(fmt % (SREG_URI,), DeprecationWarning,)
- return Auth_OpenID_SREG_URI;
- }
- }
-
- return $namespace;
- }
-
- function hasKey($namespace, $ns_key)
- {
- $namespace = $this->_fixNS($namespace);
- if ($namespace !== null) {
- return $this->args->contains(array($namespace, $ns_key));
- } else {
- return false;
- }
- }
-
- function getKey($namespace, $ns_key)
- {
- // Get the key for a particular namespaced argument
- $namespace = $this->_fixNS($namespace);
- if ($namespace == Auth_OpenID_BARE_NS) {
- return $ns_key;
- }
-
- $ns_alias = $this->namespaces->getAlias($namespace);
-
- // No alias is defined, so no key can exist
- if ($ns_alias === null) {
- return null;
- }
-
- if ($ns_alias == Auth_OpenID_NULL_NAMESPACE) {
- $tail = $ns_key;
- } else {
- $tail = sprintf('%s.%s', $ns_alias, $ns_key);
- }
-
- return 'openid.' . $tail;
- }
-
- function getArg($namespace, $key, $default = null)
- {
- // Get a value for a namespaced key.
- $namespace = $this->_fixNS($namespace);
-
- if ($namespace !== null) {
- if ((!$this->args->contains(array($namespace, $key))) &&
- ($default == Auth_OpenID_NO_DEFAULT)) {
- return null;
- } else {
- return $this->args->get(array($namespace, $key), $default);
- }
- } else {
- return null;
- }
- }
-
- function getArgs($namespace)
- {
- // Get the arguments that are defined for this namespace URI
-
- $namespace = $this->_fixNS($namespace);
- if ($namespace !== null) {
- $stuff = array();
- foreach ($this->args->items() as $pair) {
- list($key, $value) = $pair;
- list($pair_ns, $ns_key) = $key;
- if ($pair_ns == $namespace) {
- $stuff[$ns_key] = $value;
- }
- }
-
- return $stuff;
- }
-
- return array();
- }
-
- function updateArgs($namespace, $updates)
- {
- // Set multiple key/value pairs in one call
-
- $namespace = $this->_fixNS($namespace);
-
- if ($namespace !== null) {
- foreach ($updates as $k => $v) {
- $this->setArg($namespace, $k, $v);
- }
- return true;
- } else {
- return false;
- }
- }
-
- function setArg($namespace, $key, $value)
- {
- // Set a single argument in this namespace
- $namespace = $this->_fixNS($namespace);
-
- if ($namespace !== null) {
- $this->args->set(array($namespace, $key), $value);
- if ($namespace !== Auth_OpenID_BARE_NS) {
- $this->namespaces->add($namespace);
- }
- return true;
- } else {
- return false;
- }
- }
-
- function delArg($namespace, $key)
- {
- $namespace = $this->_fixNS($namespace);
-
- if ($namespace !== null) {
- return $this->args->del(array($namespace, $key));
- } else {
- return false;
- }
- }
-
- function getAliasedArg($aliased_key, $default = null)
- {
- $parts = explode('.', $aliased_key, 2);
-
- if (count($parts) != 2) {
- $ns = null;
- } else {
- list($alias, $key) = $parts;
-
- if ($alias == 'ns') {
- // Return the namespace URI for a namespace alias
- // parameter.
- return $this->namespaces->getNamespaceURI($key);
- } else {
- $ns = $this->namespaces->getNamespaceURI($alias);
- }
- }
-
- if ($ns === null) {
- $key = $aliased_key;
- $ns = $this->getOpenIDNamespace();
- }
-
- return $this->getArg($ns, $key, $default);
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/MySQLStore.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/MySQLStore.php
deleted file mode 100755
index f8dc9ae..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/MySQLStore.php
+++ /dev/null
@@ -1,77 +0,0 @@
-sql['nonce_table'] =
- "CREATE TABLE %s (\n".
- " server_url VARCHAR(2047),\n".
- " timestamp INTEGER,\n".
- " salt CHAR(40),\n".
- " UNIQUE (server_url(255), timestamp, salt)\n".
- ") TYPE=InnoDB";
-
- $this->sql['assoc_table'] =
- "CREATE TABLE %s (\n".
- " server_url BLOB,\n".
- " handle VARCHAR(255),\n".
- " secret BLOB,\n".
- " issued INTEGER,\n".
- " lifetime INTEGER,\n".
- " assoc_type VARCHAR(64),\n".
- " PRIMARY KEY (server_url(255), handle)\n".
- ") TYPE=InnoDB";
-
- $this->sql['set_assoc'] =
- "REPLACE INTO %s VALUES (?, ?, !, ?, ?, ?)";
-
- $this->sql['get_assocs'] =
- "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
- "WHERE server_url = ?";
-
- $this->sql['get_assoc'] =
- "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
- "WHERE server_url = ? AND handle = ?";
-
- $this->sql['remove_assoc'] =
- "DELETE FROM %s WHERE server_url = ? AND handle = ?";
-
- $this->sql['add_nonce'] =
- "INSERT INTO %s (server_url, timestamp, salt) VALUES (?, ?, ?)";
-
- $this->sql['clean_nonce'] =
- "DELETE FROM %s WHERE timestamp < ?";
-
- $this->sql['clean_assoc'] =
- "DELETE FROM %s WHERE issued + lifetime < ?";
- }
-
- /**
- * @access private
- */
- function blobEncode($blob)
- {
- return "0x" . bin2hex($blob);
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Nonce.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Nonce.php
deleted file mode 100755
index effecac..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Nonce.php
+++ /dev/null
@@ -1,109 +0,0 @@
-
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/PAPE.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/PAPE.php
deleted file mode 100755
index ba9f9f6..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/PAPE.php
+++ /dev/null
@@ -1,311 +0,0 @@
-preferred_auth_policies = $preferred_auth_policies;
- $this->max_auth_age = $max_auth_age;
- }
-
- /**
- * Add an acceptable authentication policy URI to this request
- *
- * This method is intended to be used by the relying party to add
- * acceptable authentication types to the request.
- *
- * policy_uri: The identifier for the preferred type of
- * authentication.
- */
- function addPolicyURI($policy_uri)
- {
- if (!in_array($policy_uri, $this->preferred_auth_policies)) {
- $this->preferred_auth_policies[] = $policy_uri;
- }
- }
-
- function getExtensionArgs()
- {
- $ns_args = array(
- 'preferred_auth_policies' =>
- implode(' ', $this->preferred_auth_policies)
- );
-
- if ($this->max_auth_age !== null) {
- $ns_args['max_auth_age'] = strval($this->max_auth_age);
- }
-
- return $ns_args;
- }
-
- /**
- * Instantiate a Request object from the arguments in a checkid_*
- * OpenID message
- */
- function fromOpenIDRequest($request)
- {
- $obj = new Auth_OpenID_PAPE_Request();
- $args = $request->message->getArgs(Auth_OpenID_PAPE_NS_URI);
-
- if ($args === null || $args === array()) {
- return null;
- }
-
- $obj->parseExtensionArgs($args);
- return $obj;
- }
-
- /**
- * Set the state of this request to be that expressed in these
- * PAPE arguments
- *
- * @param args: The PAPE arguments without a namespace
- */
- function parseExtensionArgs($args)
- {
- // preferred_auth_policies is a space-separated list of policy
- // URIs
- $this->preferred_auth_policies = array();
-
- $policies_str = Auth_OpenID::arrayGet($args, 'preferred_auth_policies');
- if ($policies_str) {
- foreach (explode(' ', $policies_str) as $uri) {
- if (!in_array($uri, $this->preferred_auth_policies)) {
- $this->preferred_auth_policies[] = $uri;
- }
- }
- }
-
- // max_auth_age is base-10 integer number of seconds
- $max_auth_age_str = Auth_OpenID::arrayGet($args, 'max_auth_age');
- if ($max_auth_age_str) {
- $this->max_auth_age = Auth_OpenID::intval($max_auth_age_str);
- } else {
- $this->max_auth_age = null;
- }
- }
-
- /**
- * Given a list of authentication policy URIs that a provider
- * supports, this method returns the subsequence of those types
- * that are preferred by the relying party.
- *
- * @param supported_types: A sequence of authentication policy
- * type URIs that are supported by a provider
- *
- * @return array The sub-sequence of the supported types that are
- * preferred by the relying party. This list will be ordered in
- * the order that the types appear in the supported_types
- * sequence, and may be empty if the provider does not prefer any
- * of the supported authentication types.
- */
- function preferredTypes($supported_types)
- {
- $result = array();
-
- foreach ($supported_types as $st) {
- if (in_array($st, $this->preferred_auth_policies)) {
- $result[] = $st;
- }
- }
- return $result;
- }
-}
-
-/**
- * A Provider Authentication Policy response, sent from a provider to
- * a relying party
- */
-class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension {
-
- var $ns_alias = 'pape';
- var $ns_uri = Auth_OpenID_PAPE_NS_URI;
-
- function Auth_OpenID_PAPE_Response($auth_policies=null, $auth_age=null,
- $nist_auth_level=null)
- {
- if ($auth_policies) {
- $this->auth_policies = $auth_policies;
- } else {
- $this->auth_policies = array();
- }
-
- $this->auth_age = $auth_age;
- $this->nist_auth_level = $nist_auth_level;
- }
-
- /**
- * Add a authentication policy to this response
- *
- * This method is intended to be used by the provider to add a
- * policy that the provider conformed to when authenticating the
- * user.
- *
- * @param policy_uri: The identifier for the preferred type of
- * authentication.
- */
- function addPolicyURI($policy_uri)
- {
- if (!in_array($policy_uri, $this->auth_policies)) {
- $this->auth_policies[] = $policy_uri;
- }
- }
-
- /**
- * Create an Auth_OpenID_PAPE_Response object from a successful
- * OpenID library response.
- *
- * @param success_response $success_response A SuccessResponse
- * from Auth_OpenID_Consumer::complete()
- *
- * @returns: A provider authentication policy response from the
- * data that was supplied with the id_res response.
- */
- function fromSuccessResponse($success_response)
- {
- $obj = new Auth_OpenID_PAPE_Response();
-
- // PAPE requires that the args be signed.
- $args = $success_response->getSignedNS(Auth_OpenID_PAPE_NS_URI);
-
- if ($args === null || $args === array()) {
- return null;
- }
-
- $result = $obj->parseExtensionArgs($args);
-
- if ($result === false) {
- return null;
- } else {
- return $obj;
- }
- }
-
- /**
- * Parse the provider authentication policy arguments into the
- * internal state of this object
- *
- * @param args: unqualified provider authentication policy
- * arguments
- *
- * @param strict: Whether to return false when bad data is
- * encountered
- *
- * @return null The data is parsed into the internal fields of
- * this object.
- */
- function parseExtensionArgs($args, $strict=false)
- {
- $policies_str = Auth_OpenID::arrayGet($args, 'auth_policies');
- if ($policies_str) {
- $this->auth_policies = explode(" ", $policies_str);
- }
-
- $nist_level_str = Auth_OpenID::arrayGet($args, 'nist_auth_level');
- if ($nist_level_str !== null) {
- $nist_level = Auth_OpenID::intval($nist_level_str);
-
- if ($nist_level === false) {
- if ($strict) {
- return false;
- } else {
- $nist_level = null;
- }
- }
-
- if (0 <= $nist_level && $nist_level < 5) {
- $this->nist_auth_level = $nist_level;
- } else if ($strict) {
- return false;
- }
- }
-
- $auth_age_str = Auth_OpenID::arrayGet($args, 'auth_age');
- if ($auth_age_str !== null) {
- $auth_age = Auth_OpenID::intval($auth_age_str);
- if ($auth_age === false) {
- if ($strict) {
- return false;
- }
- } else {
- if ($auth_age >= 0) {
- $this->auth_age = $auth_age;
- } else if ($strict) {
- return false;
- }
- }
- }
- }
-
- function getExtensionArgs()
- {
- $ns_args = array(
- 'auth_policies' =>
- implode(' ', $this->auth_policies)
- );
-
- if ($this->nist_auth_level !== null) {
- if (!in_array($this->nist_auth_level, range(0, 4), true)) {
- return false;
- }
- $ns_args['nist_auth_level'] = strval($this->nist_auth_level);
- }
-
- if ($this->auth_age !== null) {
- if ($this->auth_age < 0) {
- return false;
- }
-
- $result = Auth_OpenID::intval($this->auth_age);
-
- if ($result === false) {
- return false;
- }
-
- $ns_args['auth_age'] =
- strval($result);
- }
-
- return $ns_args;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Parse.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Parse.php
deleted file mode 100755
index d689f9e..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/Auth/OpenID/Parse.php
+++ /dev/null
@@ -1,352 +0,0 @@
- tags
- * in the head of HTML or XHTML documents and parses out their
- * attributes according to the OpenID spec. It is a liberal parser,
- * but it requires these things from the data in order to work:
- *
- * - There must be an open tag
- *
- * - There must be an open tag inside of the tag
- *
- * - Only s that are found inside of the tag are parsed
- * (this is by design)
- *
- * - The parser follows the OpenID specification in resolving the
- * attributes of the link tags. This means that the attributes DO
- * NOT get resolved as they would by an XML or HTML parser. In
- * particular, only certain entities get replaced, and href
- * attributes do not get resolved relative to a base URL.
- *
- * From http://openid.net/specs.bml:
- *
- * - The openid.server URL MUST be an absolute URL. OpenID consumers
- * MUST NOT attempt to resolve relative URLs.
- *
- * - The openid.server URL MUST NOT include entities other than &,
- * <, >, and ".
- *
- * The parser ignores SGML comments and . Both kinds
- * of quoting are allowed for attributes.
- *
- * The parser deals with invalid markup in these ways:
- *
- * - Tag names are not case-sensitive
- *
- * - The tag is accepted even when it is not at the top level
- *
- * - The tag is accepted even when it is not a direct child of
- * the tag, but a tag must be an ancestor of the
- * tag
- *
- * - tags are accepted even when they are not direct children
- * of the tag, but a tag must be an ancestor of the
- * tag
- *
- * - If there is no closing tag for an open or tag, the
- * remainder of the document is viewed as being inside of the
- * tag. If there is no closing tag for a tag, the link tag is
- * treated as a short tag. Exceptions to this rule are that
- * closes and or closes
- *
- * - Attributes of the tag are not required to be quoted.
- *
- * - In the case of duplicated attribute names, the attribute coming
- * last in the tag will be the value returned.
- *
- * - Any text that does not parse as an attribute within a link tag
- * will be ignored. (e.g. will
- * ignore pumpkin)
- *
- * - If there are more than one or tag, the parser only
- * looks inside of the first one.
- *
- * - The contents of
-
-
- ';
- /*
- wp_enqueue_script('jquery.textnode', '/' . PLUGINDIR . '/openid/files/jquery.textnode.min.js',
- array('jquery'), WPOPENID_PLUGIN_REVISION);
- wp_enqueue_script('jquery.xpath', '/' . PLUGINDIR . '/openid/files/jquery.xpath.min.js',
- array('jquery'), WPOPENID_PLUGIN_REVISION);
- wp_enqueue_script('openid', '/' . PLUGINDIR . '/openid/files/openid.min.js',
- array('jquery','jquery.textnode'), WPOPENID_PLUGIN_REVISION);
- */
- }
- }
-
-
- /**
- * Include internal stylesheet.
- *
- * @action: wp_head, login_head
- **/
- function style() {
- $css_path = get_option('siteurl') . '/' . PLUGINDIR . '/openid/files/openid.css?ver='.WPOPENID_PLUGIN_REVISION;
- echo '
- ';
- }
-
-
- /**
- * Print jQuery call for slylizing profile link.
- *
- * @action: comment_form
- **/
- function comment_profilelink() {
- if (is_user_openid()) {
- echo '';
- }
- }
-
-
- /**
- * Print jQuery call to modify comment form.
- *
- * @action: comment_form
- **/
- function comment_form() {
- if (!is_user_logged_in()) {
- echo '';
- }
- }
-
-
- /**
- * Spam up the admin interface with warnings.
- **/
- function admin_notices_plugin_problem_warning() {
- echo'
'.__('The WordPress OpenID plugin is not active.', 'openid').'';
- printf(_('Check %sOpenID Options%s for a full diagnositic report.', 'openid'), '', '');
- echo '
';
- // TODO: offer to repost without openid
- exit;
- }
-
- function display_openid_redirect_form($form) {
- echo 'Redirecting to OpenID Provider
-
-
Redirecting to OpenID Provider
- ' . $form . '
- ';
- }
-}
-endif;
-
-?>
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/lang/openid.pot b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/lang/openid.pot
deleted file mode 100755
index 180a12a..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/lang/openid.pot
+++ /dev/null
@@ -1,213 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR Will Norris
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR , YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: WP-OpenID trunk\n"
-"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-openid\n"
-"POT-Creation-Date: 2008-05-20 15:18-0700\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME \n"
-"Language-Team: LANGUAGE \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#: interface.php:54
-#, php-format
-msgid "Or login using your %s url:"
-msgstr ""
-
-#: interface.php:54 interface.php:68
-msgid "OpenID"
-msgstr ""
-
-#: interface.php:68
-#, php-format
-msgid "For faster registration, just %s login with %s."
-msgstr ""
-
-#: interface.php:147
-msgid "The WordPress OpenID plugin is not active."
-msgstr ""
-
-#: interface.php:148
-#, php-format
-msgid "Check %sOpenID Options%s for a full diagnositic report."
-msgstr ""
-
-#: interface.php:159
-msgid "OpenID options"
-msgstr ""
-
-#: interface.php:159
-msgid "WP-OpenID"
-msgstr ""
-
-#: interface.php:164 interface.php:305
-msgid "Your Identity URLs"
-msgstr ""
-
-#: interface.php:188
-msgid "OpenID tables rebuilt."
-msgstr ""
-
-#: interface.php:204
-msgid "At least one of OpenID options was NOT updated"
-msgstr ""
-
-#: interface.php:206
-msgid "Open ID options updated"
-msgstr ""
-
-#: interface.php:218
-msgid "WP-OpenID Registration Options"
-msgstr ""
-
-#: interface.php:220 interface.php:272
-msgid "Update Options"
-msgstr ""
-
-#: interface.php:223
-msgid "Behavior"
-msgstr ""
-
-#: interface.php:227
-msgid "Automatic Approval:"
-msgstr ""
-
-#: interface.php:231
-msgid "Enable OpenID comment auto-approval"
-msgstr ""
-
-#: interface.php:233
-msgid ""
-"For now this option will cause comments made with OpenIDs to be "
-"automatically approved. Since most spammers haven't started using OpenID "
-"yet, this is probably pretty safe. More importantly however, this could be "
-"a foundation on which to build more advanced automatic approval such as "
-"whitelists or a third-party trust service."
-msgstr ""
-
-#: interface.php:245
-msgid "Look and Feel"
-msgstr ""
-
-#: interface.php:249
-msgid "Comment Form:"
-msgstr ""
-
-#: interface.php:254
-msgid "Add OpenID text to the WordPress post comment form."
-msgstr ""
-
-#: interface.php:256
-#, php-format
-msgid ""
-"This will work for most themes derived from Kubrick or Sandbox. Template "
-"authors can tweak the comment form as described in the %sreadme%s."
-msgstr ""
-
-#: interface.php:266
-#, php-format
-msgid ""
-"Occasionally, the WP-OpenID tables don't get setup properly, and it may help "
-"to %srebuild the tables%s. Don't worry, this won't cause you to lose any "
-"data... it just rebuilds a couple of tables that hold only temprory data."
-msgstr ""
-
-#: interface.php:293
-msgid "Success:"
-msgstr ""
-
-#: interface.php:296
-msgid "Warning:"
-msgstr ""
-
-#: interface.php:299
-msgid "Error:"
-msgstr ""
-
-#: interface.php:307
-#, php-format
-msgid ""
-"The following Identity URLs %s are tied to this user account. You can login "
-"with equivalent permissions using any of the following identities."
-msgstr ""
-
-#: interface.php:309
-msgid "What is OpenID?"
-msgstr ""
-
-#: interface.php:309
-msgid "?"
-msgstr ""
-
-#: interface.php:321
-msgid "ID"
-msgstr ""
-
-#: interface.php:322
-msgid "Identity Url"
-msgstr ""
-
-#: interface.php:323
-msgid "Action"
-msgstr ""
-
-#: interface.php:335
-msgid "Delete"
-msgstr ""
-
-#: interface.php:345
-msgid "There are no OpenIDs associated with this WordPress user."
-msgstr ""
-
-#: interface.php:349
-msgid "Add identity:"
-msgstr ""
-
-#: interface.php:352
-msgid "Add"
-msgstr ""
-
-#: interface.php:427
-msgid "Status information:"
-msgstr ""
-
-#: interface.php:427
-msgid "All Systems Nominal"
-msgstr ""
-
-#: interface.php:428
-msgid "Toggle More/Less"
-msgstr ""
-
-#: interface.php:430
-msgid ""
-"Plugin is currently disabled. Fix the problem, then Deactivate/Reactivate "
-"the plugin."
-msgstr ""
-
-#: interface.php:437
-msgid "FAIL"
-msgstr ""
-
-#: interface.php:438
-msgid "OK"
-msgstr ""
-
-#: interface.php:439
-msgid "INFO"
-msgstr ""
-
-#: logic.php:818
-msgid "Error: please type a comment."
-msgstr ""
-
-#: logic.php:835
-msgid "Sorry, comments are closed for this item."
-msgstr ""
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/logic.php b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/logic.php
deleted file mode 100755
index 2d59e36..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/logic.php
+++ /dev/null
@@ -1,1096 +0,0 @@
-log->debug('checking if database is up to date');
- if( get_option('oid_db_revision') != WPOPENID_DB_REVISION ) {
- $openid->enabled = false;
- $openid->log->warning('Plugin database is out of date: ' . get_option('oid_db_revision') . ' != ' . WPOPENID_DB_REVISION);
- update_option('oid_plugin_enabled', false);
- return false;
- }
- $openid->enabled = (get_option('oid_plugin_enabled') == true );
- return $openid->enabled;
- }
-
-
- /**
- * Get the internal SQL Store. If it is not already initialized, do so.
- *
- * @return WordPressOpenID_Store internal SQL store
- */
- function getStore() {
- global $openid;
-
- if (!isset($openid->store)) {
- set_include_path( dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
- require_once 'store.php';
-
- $openid->store = new WordPressOpenID_Store($openid);
- if (null === $openid->store) {
- $openid->log->err('OpenID store could not be created properly.');
- $openid->enabled = false;
- }
- }
-
- return $openid->store;
- }
-
-
- /**
- * Get the internal OpenID Consumer object. If it is not already initialized, do so.
- *
- * @return Auth_OpenID_Consumer OpenID consumer object
- */
- function getConsumer() {
- global $openid;
-
- if (!isset($openid->consumer)) {
- set_include_path( dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
- require_once 'Auth/OpenID/Consumer.php';
-
- $store = WordPressOpenID_Logic::getStore();
- $openid->consumer = new Auth_OpenID_Consumer($store);
- if( null === $openid->consumer ) {
- $openid->log->err('OpenID consumer could not be created properly.');
- $openid->enabled = false;
- }
- }
-
- return $openid->consumer;
- }
-
-
- /**
- * Initialize required store and consumer and make a few sanity checks. This method
- * does a lot of the heavy lifting to get everything initialized, so we don't call it
- * until we actually need it.
- */
- function late_bind($reload = false) {
- global $wpdb, $openid;
- openid_init();
-
- $openid->log->debug('beginning late binding');
-
- $openid->enabled = true; // Be Optimistic
- if( $openid->bind_done && !$reload ) {
- $openid->log->debug('we\'ve already done the late bind... moving on');
- return WordPressOpenID_Logic::uptodate();
- }
- $openid->bind_done = true;
-
- $f = @fopen( '/dev/urandom', 'r');
- if ($f === false) {
- define( 'Auth_OpenID_RAND_SOURCE', null );
- }
-
- // include required JanRain OpenID library files
- set_include_path( dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
- $openid->log->debug('temporary include path for importing = ' . get_include_path());
- require_once('Auth/OpenID/Discover.php');
- require_once('Auth/OpenID/DatabaseConnection.php');
- require_once('Auth/OpenID/MySQLStore.php');
- require_once('Auth/OpenID/Consumer.php');
- require_once('Auth/OpenID/SReg.php');
- restore_include_path();
-
- $openid->log->debug("Bootstrap -- checking tables");
- if( $openid->enabled ) {
-
- $store =& WordPressOpenID_Logic::getStore();
- if (!$store) return; // something broke
- $openid->enabled = $store->check_tables();
-
- if( !WordPressOpenID_Logic::uptodate() ) {
- update_option('oid_plugin_enabled', true);
- update_option('oid_plugin_revision', WPOPENID_PLUGIN_REVISION );
- update_option('oid_db_revision', WPOPENID_DB_REVISION );
- WordPressOpenID_Logic::uptodate();
- }
- } else {
- $openid->error = 'WPOpenID Core is Disabled!';
- update_option('oid_plugin_enabled', false);
- }
-
- return $openid->enabled;
- }
-
-
- /**
- * Called on plugin activation.
- *
- * @see register_activation_hook
- */
- function activate_plugin() {
- $start_mem = memory_get_usage();
- global $wp_rewrite, $openid;
- openid_init();
-
- $store =& WordPressOpenID_Logic::getStore();
- $store->create_tables();
-
- //add_filter('generate_rewrite_rules', array('WordPressOpenID_Logic', 'rewrite_rules'));
- //$wp_rewrite->flush_rules();
-
- wp_schedule_event(time(), 'hourly', 'cleanup_openid');
- $openid->log->warning("activation memory usage: " . (int)((memory_get_usage() - $start_mem) / 1000));
- }
-
- function cleanup_nonces() {
- global $openid;
- openid_init();
- $store =& WordPressOpenID_Logic::getStore();
- $store->cleanupNonces();
- }
-
-
- /**
- * Called on plugin deactivation. Cleanup all transient tables.
- *
- * @see register_deactivation_hook
- */
- function deactivate_plugin() {
- set_include_path( dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
- require_once 'store.php';
- WordPressOpenID_Store::destroy_tables();
- }
-
-
- /*
- * Customer error handler for calls into the JanRain library
- */
- function customer_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
- global $openid;
-
- if( (2048 & $errno) == 2048 ) return;
- $openid->log->notice( "Library Error $errno: $errmsg in $filename :$linenum");
- }
-
-
- /**
- * If we're doing openid authentication ($_POST['openid_url'] is set), start the consumer & redirect
- * Otherwise, return and let WordPress handle the login and/or draw the form.
- *
- * @param string $username username provided in login form
- */
- function wp_authenticate( &$username ) {
- global $openid;
-
- if( !empty( $_POST['openid_url'] ) ) {
- if( !WordPressOpenID_Logic::late_bind() ) return; // something is broken
- $redirect_to = '';
- if( !empty( $_REQUEST['redirect_to'] ) ) $redirect_to = $_REQUEST['redirect_to'];
- WordPressOpenID_Logic::start_login( $_POST['openid_url'], 'login', array('redirect_to' => $redirect_to) );
- }
- if( !empty( $openid->error ) ) {
- global $error;
- $error = $openid->error;
- }
- }
-
-
- /**
- * Handle OpenID profile management.
- */
- function openid_profile_management() {
- global $wp_version, $openid;
- openid_init();
-
- if( !isset( $_REQUEST['action'] )) return;
-
- $openid->action = $_REQUEST['action'];
-
- require_once(ABSPATH . 'wp-admin/admin-functions.php');
-
- if ($wp_version < '2.3') {
- require_once(ABSPATH . 'wp-admin/admin-db.php');
- require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
- }
-
- auth_redirect();
- nocache_headers();
- get_currentuserinfo();
-
- if( !WordPressOpenID_Logic::late_bind() ) return; // something is broken
-
- switch( $openid->action ) {
- case 'add_identity':
- check_admin_referer('wp-openid-add_identity');
-
- $user = wp_get_current_user();
-
- $store =& WordPressOpenID_Logic::getStore();
- global $openid_auth_request;
- if ($openid_auth_request == NULL) {
- $consumer = WordPressOpenID_Logic::getConsumer();
- $openid_auth_request = $consumer->begin($_POST['openid_url']);
- }
-
- $userid = $store->get_user_by_identity($openid_auth_request->endpoint->claimed_id);
-
- if ($userid) {
- global $error;
- if ($user->ID == $userid) {
- $error = 'You already have this openid!';
- } else {
- $error = 'This OpenID is already connected to another user.';
- }
- return;
- }
-
- WordPressOpenID_Logic::start_login($_POST['openid_url'], 'verify');
- break;
-
- case 'drop_identity': // Remove a binding.
- WordPressOpenID_Logic::_profile_drop_identity($_REQUEST['id']);
- break;
- }
- }
-
-
- /**
- * Remove identity URL from current user account.
- *
- * @param int $id id of identity URL to remove
- */
- function _profile_drop_identity($id) {
- global $openid;
-
- $user = wp_get_current_user();
-
- if( !isset($id)) {
- $openid->error = 'Identity url delete failed: ID paramater missing.';
- return;
- }
-
- $store =& WordPressOpenID_Logic::getStore();
- $deleted_identity_url = $store->get_identities($user->ID, $id);
- if( FALSE === $deleted_identity_url ) {
- $openid->error = 'Identity url delete failed: Specified identity does not exist.';
- return;
- }
-
- $identity_urls = $store->get_identities($user->ID);
- if (sizeof($identity_urls) == 1 && !$_REQUEST['confirm']) {
- $openid->error = 'This is your last identity URL. Are you sure you want to delete it? Doing so may interfere with your ability to login.
'
- . 'Yes I\'m sure. Delete it '
- . 'No, don\'t delete it.';
- $openid->action = 'warning';
- return;
- }
-
- check_admin_referer('wp-openid-drop-identity_'.$deleted_identity_url);
-
-
- if( $store->drop_identity($user->ID, $id) ) {
- $openid->error = 'Identity url delete successful. ' . $deleted_identity_url
- . ' removed.';
- $openid->action = 'success';
- return;
- }
-
- $openid->error = 'Identity url delete failed: Unknown reason.';
- }
-
-
- /**
- * Send the user to their OpenID provider to authenticate.
- *
- * @param Auth_OpenID_AuthRequest $auth_request OpenID authentication request object
- * @param string $trust_root OpenID trust root
- * @param string $return_to URL where the OpenID provider should return the user
- */
- function doRedirect($auth_request, $trust_root, $return_to) {
- global $openid;
-
- if ($auth_request->shouldSendRedirect()) {
- if (substr($trust_root, -1, 1) != '/') $trust_root .= '/';
- $redirect_url = $auth_request->redirectURL($trust_root, $return_to);
-
- if (Auth_OpenID::isFailure($redirect_url)) {
- $openid->log->error('Could not redirect to server: '.$redirect_url->message);
- } else {
- wp_redirect( $redirect_url );
- }
- } else {
- // Generate form markup and render it
- $form_id = 'openid_message';
- $form_html = $auth_request->formMarkup($trust_root, $return_to, false);
-
- if (Auth_OpenID::isFailure($form_html)) {
- $openid->log->error('Could not redirect to server: '.$form_html->message);
- } else {
- WordPressOpenID_Interface::display_openid_redirect_form($form_html);
- }
- }
- }
-
-
- /**
- * Finish OpenID Authentication.
- *
- * @return String authenticated identity URL, or null if authentication failed.
- */
- function finish_openid_auth() {
- global $openid;
-
- //set_error_handler( array('WordPressOpenID_Logic', 'customer_error_handler'));
- $consumer = WordPressOpenID_Logic::getConsumer();
- echo 'ouh on'.$_SESSION['oid_return_to']; exit;
- $openid->response = $consumer->complete($_SESSION['oid_return_to']);
- //restore_error_handler();
-
- switch( $openid->response->status ) {
- case Auth_OpenID_CANCEL:
- $openid->error = 'OpenID assertion cancelled';
- break;
-
- case Auth_OpenID_FAILURE:
- $openid->error = 'OpenID assertion failed: ' . $openid->response->message;
- break;
-
- case Auth_OpenID_SUCCESS:
- $openid->error = 'OpenID assertion successful';
-
- $identity_url = $openid->response->identity_url;
- $escaped_url = htmlspecialchars($identity_url, ENT_QUOTES);
- $openid->log->notice('Got back identity URL ' . $escaped_url);
-
- if ($openid->response->endpoint->canonicalID) {
- $openid->log->notice('XRI CanonicalID: ' . $openid->response->endpoint->canonicalID);
- }
-
- return $escaped_url;
-
- default:
- $openid->error = 'Unknown Status. Bind not successful. This is probably a bug';
- }
-
- return null;
- }
-
-
- /**
- * Generate a unique WordPress username for the given OpenID URL.
- *
- * @param string $url OpenID URL to generate username for
- * @return string generated username
- */
- function generate_new_username($url) {
- global $openid;
-
- $base = WordPressOpenID_Logic::normalize_username($url);
- $i='';
- while(true) {
- $username = WordPressOpenID_Logic::normalize_username( $base . $i );
- $user = get_userdatabylogin($username);
- if ( $user ) {
- $i++;
- continue;
- }
- return $username;
- }
- }
-
- /**
- * Normalize the OpenID URL into a username. This includes rules like:
- * - remove protocol prefixes like 'http://' and 'xri://'
- * - remove the 'xri.net' domain for i-names
- * - substitute certain characters which are not allowed by WordPress
- *
- * @param string $username username to be normalized
- * @return string normalized username
- */
- function normalize_username($username) {
- $username = preg_replace('|^https?://(xri.net/([^@]!?)?)?|', '', $username);
- $username = preg_replace('|^xri://([^@]!?)?|', '', $username);
- $username = preg_replace('|/$|', '', $username);
- $username = sanitize_user( $username );
- $username = preg_replace('|[^a-z0-9 _.\-@]+|i', '-', $username);
- return $username;
- }
-
-
- /**
- * Start the OpenID authentication process.
- *
- * @param string $claimed_url claimed OpenID URL
- * @param action $action OpenID action being performed
- * @param array $arguments array of additional arguments to be included in the 'return_to' URL
- */
- function start_login( $claimed_url, $action, $arguments = null) {
- global $openid;
-
- if ( empty($claimed_url) ) return; // do nothing.
-
- if( !WordPressOpenID_Logic::late_bind() ) return; // something is broken
-
- if ( null !== $openid_auth_request) {
- $auth_request = $openid_auth_request;
- } else {
- set_error_handler( array('WordPressOpenID_Logic', 'customer_error_handler'));
- $consumer = WordPressOpenID_Logic::getConsumer();
- $auth_request = $consumer->begin( $claimed_url );
- restore_error_handler();
- }
-
- if ( null === $auth_request ) {
- $openid->error = 'Could not discover an OpenID identity server endpoint at the url: '
- . htmlentities( $claimed_url );
- if( strpos( $claimed_url, '@' ) ) {
- $openid->error .= ' The address you specified had an @ sign in it, but OpenID '
- . 'Identities are not email addresses, and should probably not contain an @ sign.';
- }
- $openid->log->debug('OpenIDConsumer: ' . $openid->error );
- return;
- }
-
- $openid->log->debug('OpenIDConsumer: Is an OpenID url. Starting redirect.');
-
-
- // build return_to URL
- $return_to = get_option('home') . '/openid_consumer';
- $auth_request->return_to_args['action'] = $action;
- if (is_array($arguments) && !empty($arguments)) {
- foreach ($arguments as $k => $v) {
- if ($k && $v) {
- $auth_request->return_to_args[urlencode($k)] = urlencode($v);
- }
- }
- }
-
-
- /* If we've never heard of this url before, do attribute query */
- $store =& WordPressOpenID_Logic::getStore();
- if( $store->get_user_by_identity( $auth_request->endpoint->identity_url ) == NULL ) {
- $attribute_query = true;
- }
- if ($attribute_query) {
- // SREG
- $sreg_request = Auth_OpenID_SRegRequest::build(array(),array('nickname','email','fullname'));
- if ($sreg_request) $auth_request->addExtension($sreg_request);
-
- // AX
- }
-
- $_SESSION['oid_return_to'] = $return_to;
- WordPressOpenID_Logic::doRedirect($auth_request, get_option('home'), $return_to);
- exit(0);
- }
-
-
- /**
- * Intercept login requests on wp-login.php if they include an 'openid_url' value and start OpenID
- * authentication.
- */
- function wp_login_openid() {
- $self = basename( $GLOBALS['pagenow'] );
-
- if ($self == 'wp-login.php' && !empty($_POST['openid_url'])) {
- // TODO wp_signon only exists in wp2.5+
- wp_signon(array('user_login'=>'openid', 'user_password'=>'openid'));
- }
- }
-
-
- /**
- * Login user with specified identity URL. This will find the WordPress user account connected to this
- * OpenID and set it as the current user. Only call this function AFTER you've verified the identity URL.
- *
- * @param string $identity_url OpenID to set as current user
- * @param boolean $remember should we set the "remember me" cookie
- * @return void
- */
- function set_current_user($identity_url, $remember = true) {
- global $openid;
-
- $store =& WordPressOpenID_Logic::getStore();
- $user_id = $store->get_user_by_identity( $identity_url );
-
- if (!$user_id) return;
-
- $user = set_current_user($user_id);
-
- if (function_exists('wp_set_auth_cookie')) {
- wp_set_auth_cookie($user->ID, $remember);
- } else {
- wp_setcookie($user->user_login, $user->user_pass, false, '', '', $remember);
- }
-
- do_action('wp_login', $user->user_login);
- }
-
-
- /**
- * Finish OpenID authentication. After doing the basic stuff, the action method is called to complete the
- * process. Action methods are based on the action name passed in and are of the form
- * '_finish_openid_$action'. Action methods are passed the verified identity URL, or null if OpenID
- * authentication failed.
- *
- * @param string $action login action that is being performed
- */
- function finish_openid($action) {
- global $openid;
-
- if( !WordPressOpenID_Logic::late_bind() ) return; // something is broken
-
- $identity_url = WordPressOpenID_Logic::finish_openid_auth();
-
- if (!empty($action) && method_exists('WordPressOpenID_Logic', '_finish_openid_' . $action)) {
- call_user_func(array('WordPressOpenID_Logic', '_finish_openid_' . $action), $identity_url);
- }
-
- global $action;
- $action = $openid->action;
- }
-
-
- /**
- * Action method for completing the 'login' action. This action is used when a user is logging in from
- * wp-login.php.
- *
- * @param string $identity_url verified OpenID URL
- */
- function _finish_openid_login($identity_url) {
- global $openid;
-
- $redirect_to = urldecode($_REQUEST['redirect_to']);
-
- if (empty($identity_url)) {
- // FIXME unable to authenticate OpenID
- WordPressOpenID_Logic::set_error('Unable to authenticate OpenID.');
- wp_safe_redirect(get_option('siteurl') . '/wp-login.php');
- exit;
- }
-
- WordPressOpenID_Logic::set_current_user($identity_url);
-
- if (!is_user_logged_in()) {
- if ( get_option('users_can_register') ) {
- $user_data =& WordPressOpenID_Logic::get_user_data($identity_url);
- $user = WordPressOpenID_Logic::create_new_user($identity_url, $user_data);
- WordPressOpenID_Logic::set_current_user($identity_url); // TODO this does an extra db hit to get user_id
- } else {
- // TODO - Start a registration loop in WPMU.
- WordPressOpenID_Logic::set_error('OpenID authentication valid, but unable '
- . 'to find a WordPress account associated with this OpenID.
'
- . 'Enable "Anyone can register" to allow creation of new accounts via OpenID.');
- wp_safe_redirect(get_option('siteurl') . '/wp-login.php');
- exit;
- }
-
- }
-
- if (empty($redirect_to)) {
- $redirect_to = 'wp-admin/';
- }
- if ($redirect_to == 'wp-admin/') {
- if (!current_user_can('edit_posts')) {
- $redirect_to .= 'profile.php';
- }
- }
- if (!preg_match('#^(http|\/)#', $redirect_to)) {
- $wpp = parse_url(get_option('siteurl'));
- $redirect_to = $wpp['path'] . '/' . $redirect_to;
- }
-
- if (function_exists('wp_safe_redirect')) {
- wp_safe_redirect( $redirect_to );
- } else {
- wp_redirect( $redirect_to );
- }
-
- exit;
- }
-
-
- /**
- * Action method for completing the 'comment' action. This action is used when leaving a comment.
- *
- * @param string $identity_url verified OpenID URL
- */
- function _finish_openid_comment($identity_url) {
- global $openid;
-
- if (empty($identity_url)) {
- // FIXME unable to authenticate OpenID - give option to post anonymously
- WordPressOpenID_Interface::display_error('unable to authenticate OpenID');
- }
-
- WordPressOpenID_Logic::set_current_user($identity_url);
-
- if (is_user_logged_in()) {
- // simulate an authenticated comment submission
- $_SESSION['oid_comment_post']['author'] = null;
- $_SESSION['oid_comment_post']['email'] = null;
- $_SESSION['oid_comment_post']['url'] = null;
- } else {
- // try to get user data from the verified OpenID
- $user_data =& WordPressOpenID_Logic::get_user_data($identity_url);
-
- if (!empty($user_data['display_name'])) {
- $_SESSION['oid_comment_post']['author'] = $user_data['display_name'];
- }
- if ($oid_user_data['user_email']) {
- $_SESSION['oid_comment_post']['email'] = $user_data['user_email'];
- }
- }
-
- // record that we're about to post an OpenID authenticated comment.
- // We can't actually record it in the database until after the repost below.
- $_SESSION['oid_posted_comment'] = true;
-
- $wpp = parse_url(get_option('siteurl'));
- WordPressOpenID_Interface::repost($wpp['path'] . '/wp-comments-post.php',
- array_filter($_SESSION['oid_comment_post']));
- }
-
-
- /**
- * Action method for completing the 'verify' action. This action is used adding an identity URL to a
- * WordPress user through the admin interface.
- *
- * @param string $identity_url verified OpenID URL
- */
- function _finish_openid_verify($identity_url) {
- global $openid;
-
- $user = wp_get_current_user();
- if (empty($identity_url)) {
- // FIXME unable to authenticate OpenID
- WordPressOpenID_Logic::set_error('Unable to authenticate OpenID.');
- } else {
- $store =& WordPressOpenID_Logic::getStore();
- if( !$store->insert_identity($user->ID, $identity_url) ) {
- // TODO should we check for this duplication *before* authenticating the ID?
- WordPressOpenID_Logic::set_error('OpenID assertion successful, but this URL is already claimed by '
- . 'another user on this blog. This is probably a bug. ' . $identity_url);
- } else {
- $openid->action = 'success';
- }
- }
-
- $wpp = parse_url(get_option('siteurl'));
- $redirect_to = $wpp['path'] . '/wp-admin/' . (current_user_can('edit_users') ? 'users.php' : 'profile.php') . '?page=openid';
- if (function_exists('wp_safe_redirect')) {
- wp_safe_redirect( $redirect_to );
- } else {
- wp_redirect( $redirect_to );
- }
- // TODO display success message
- exit;
- }
-
-
- /**
- * If last comment was authenticated by an OpenID, record that in the database.
- *
- * @param string $location redirect location
- * @param object $comment comment that was just left
- * @return string redirect location
- */
- function comment_post_redirect($location, $comment) {
- global $openid;
-
- if ($_SESSION['oid_posted_comment']) {
- WordPressOpenID_Logic::set_comment_openid($comment->comment_ID);
- $_SESSION['oid_posted_comment'] = null;
- }
-
- return $location;
- }
-
-
- /**
- * Create a new WordPress user with the specified identity URL and user data.
- *
- * @param string $identity_url OpenID to associate with the newly
- * created account
- * @param array $user_data array of user data
- */
- function create_new_user($identity_url, &$user_data) {
- global $wpdb, $openid;
-
- // Identity URL is new, so create a user
- @include_once( ABSPATH . 'wp-admin/upgrade-functions.php'); // 2.1
- @include_once( ABSPATH . WPINC . '/registration-functions.php'); // 2.0.4
-
- $user_data['user_login'] = $wpdb->escape( WordPressOpenID_Logic::generate_new_username($identity_url) );
- $user_data['user_pass'] = substr( md5( uniqid( microtime() ) ), 0, 7);
- $user_id = wp_insert_user( $user_data );
-
- $openid->log->debug("wp_create_user( $user_data ) returned $user_id ");
-
- if( $user_id ) { // created ok
-
- $user_data['ID'] = $user_id;
- // XXX this all looks redundant, see WordPressOpenID_Logic::set_current_user
-
- $openid->log->debug("OpenIDConsumer: Created new user $user_id : $username and metadata: "
- . var_export( $user_data, true ) );
-
- $user = new WP_User( $user_id );
-
- if( ! wp_login( $user->user_login, $user_data['user_pass'] ) ) {
- $openid->error = 'User was created fine, but wp_login() for the new user failed. '
- . 'This is probably a bug.';
- $openid->action= 'error';
- $openid->log->err( $openid->error );
- return;
- }
-
- // notify of user creation
- wp_new_user_notification( $user->user_login );
-
- wp_clearcookie();
- wp_setcookie( $user->user_login, md5($user->user_pass), true, '', '', true );
-
- // Bind the provided identity to the just-created user
- global $userdata;
- $userdata = get_userdata( $user_id );
- $store = WordPressOpenID_Logic::getStore();
- $store->insert_identity($user_id, $identity_url);
-
- $openid->action = 'redirect';
-
- if ( !$user->has_cap('edit_posts') ) $redirect_to = '/wp-admin/profile.php';
-
- } else {
- // failed to create user for some reason.
- $openid->error = 'OpenID authentication successful, but failed to create WordPress user. '
- . 'This is probably a bug.';
- $openid->action= 'error';
- $openid->log->error( $openid->error );
- }
-
- }
-
-
- /**
- * Get user data for the given identity URL. Data is returned as an associative array with the keys:
- * ID, user_url, user_nicename, display_name
- *
- * Multiple soures of data may be available and are attempted in the following order:
- * - OpenID Attribute Exchange !! not yet implemented
- * - OpenID Simple Registration
- * - hCard discovery !! not yet implemented
- * - default to identity URL
- *
- * @param string $identity_url OpenID to get user data about
- * @return array user data
- */
- function get_user_data($identity_url) {
- global $openid;
-
- $data = array(
- 'ID' => null,
- 'user_url' => $identity_url,
- 'user_nicename' => $identity_url,
- 'display_name' => $identity_url
- );
-
- // create proper website URL if OpenID is an i-name
- if (preg_match('/^[\=\@\+].+$/', $identity_url)) {
- $data['user_url'] = 'http://xri.net/' . $identity_url;
- }
-
-
- $result = WordPressOpenID_Logic::get_user_data_sreg($identity_url, $data);
-
- return $data;
- }
-
-
- /**
- * Retrieve user data from OpenID Attribute Exchange.
- *
- * @param string $identity_url OpenID to get user data about
- * @param reference $data reference to user data array
- * @see get_user_data
- */
- function get_user_data_ax($identity_url, &$data) {
- // TODO implement attribute exchange
- }
-
-
- /**
- * Retrieve user data from OpenID Simple Registration.
- *
- * @param string $identity_url OpenID to get user data about
- * @param reference $data reference to user data array
- * @see get_user_data
- */
- function get_user_data_sreg($identity_url, &$data) {
- global $openid;
-
- $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($openid->response);
- $sreg = $sreg_resp->contents();
-
- $openid->log->debug(var_export($sreg, true));
- if (!$sreg) return false;
-
- if (array_key_exists('email', $sreg) && $sreg['email']) {
- $data['user_email'] = $sreg['email'];
- }
-
- if (array_key_exists('nickname', $sreg) && $sreg['nickname']) {
- $data['nickname'] = $sreg['nickname'];
- $data['user_nicename'] = $sreg['nickname'];
- $data['display_name'] = $sreg['nickname'];
- }
-
- if (array_key_exists('fullname', $sreg) && $sreg['fullname']) {
- $namechunks = explode( ' ', $sreg['fullname'], 2 );
- if( isset($namechunks[0]) ) $data['first_name'] = $namechunks[0];
- if( isset($namechunks[1]) ) $data['last_name'] = $namechunks[1];
- $data['display_name'] = $sreg['fullname'];
- }
-
- return true;
- }
-
-
- /**
- * Retrieve user data from hCard discovery.
- *
- * @param string $identity_url OpenID to get user data about
- * @param reference $data reference to user data array
- * @see get_user_data
- */
- function get_user_data_hcard($identity_url, &$data) {
- // TODO implement hcard discovery
- }
-
-
- /**
- * For comments that were handled by WordPress normally (not our code), check if the author
- * registered with OpenID and set comment openid flag if so.
- *
- * @action post_comment
- */
- function check_author_openid($comment_ID) {
- global $openid;
-
- $comment = get_comment($comment_ID);
- if ( $comment->user_id && !$comment->openid && is_user_openid($comment->user_id) ) {
- WordPressOpenID_Logic::set_comment_openid($comment_ID);
- }
- }
-
-
- /**
- * Mark the provided comment as an OpenID comment
- *
- * @param int $comment_ID id of comment to set as OpenID
- */
- function set_comment_openid($comment_ID) {
- global $wpdb, $openid;
-
- $comments_table = WordPressOpenID::comments_table_name();
- $wpdb->query("UPDATE $comments_table SET openid='1' WHERE comment_ID='$comment_ID' LIMIT 1");
- }
-
-
- /**
- * If the comment contains a valid OpenID, skip the check for requiring a name and email address. Even if
- * this data is provided in the form, we may get it through other methods, so we don't want to bail out
- * prematurely. After OpenID authentication has completed (and $_SESSION['oid_skip'] is set), we don't
- * interfere so that this data can be required if desired.
- *
- * @param boolean $value existing value of flag, whether to require name and email
- * @return boolean new value of flag, whether to require name and email
- * @see get_user_data
- */
- function bypass_option_require_name_email( $value ) {
- global $openid_auth_request, $openid;
-
- if ($_REQUEST['oid_skip']) {
- return $value;
- }
-
- if (array_key_exists('openid_url', $_POST)) {
- if( !empty( $_POST['openid_url'] ) ) {
- return false;
- }
- } else {
- if (!empty($_POST['url'])) {
- if (WordPressOpenID_Logic::late_bind()) {
- // check if url is valid OpenID by forming an auth request
- set_error_handler( array('WordPressOpenID_Logic', 'customer_error_handler'));
- $consumer = WordPressOpenID_Logic::getConsumer();
- $openid_auth_request = $consumer->begin( $_POST['url'] );
- restore_error_handler();
-
- if (null !== $openid_auth_request) {
- return false;
- }
- }
- }
- }
-
- return $value;
- }
-
-
- /**
- * Intercept comment submission and check if it includes a valid OpenID. If it does, save the entire POST
- * array and begin the OpenID authentication process.
- *
- * regarding comment_type: http://trac.wordpress.org/ticket/2659
- *
- * @param object $comment comment object
- * @return object comment object
- */
- function comment_tagging( $comment ) {
- global $openid;
-
- if (!$openid->enabled) return $comment;
- if ($_REQUEST['oid_skip']) return $comment;
-
- $openid_url = (array_key_exists('openid_url', $_POST) ? $_POST['openid_url'] : $_POST['url']);
-
- if( !empty($openid_url) ) { // Comment form's OpenID url is filled in.
- $_SESSION['oid_comment_post'] = $_POST;
- $_SESSION['oid_comment_post']['comment_author_openid'] = $openid_url;
- $_SESSION['oid_comment_post']['oid_skip'] = 1;
-
- WordPressOpenID_Logic::start_login( $openid_url, 'comment');
-
- // Failure to redirect at all, the URL is malformed or unreachable.
-
- // Display an error message only if an explicit OpenID field was used. Otherwise,
- // just ignore the error... it just means the user entered a normal URL.
- if (array_key_exists('openid_url', $_POST)) {
- // TODO give option to post without OpenID
- global $error;
- $error = $openid->error;
- $_POST['openid_url'] = '';
- include( ABSPATH . 'wp-login.php' );
- exit();
- }
- }
-
- return $comment;
- }
-
-
- /**
- * This filter callback simply approves all OpenID comments, but later it could do more complicated logic
- * like whitelists.
- *
- * @param string $approved comment approval status
- * @return string new comment approval status
- */
- function comment_approval($approved) {
- if ($_SESSION['oid_posted_comment']) {
- return 1;
- }
-
- return $approved;
- }
-
-
- /**
- * Get any additional comments awaiting moderation by this user. WordPress
- * core has been udpated to grab most, but we still do one last check for
- * OpenID comments that have a URL match with the current user.
- *
- * @param array $comments array of comments to display
- * @param int $post_id id of the post to display comments for
- * @return array new array of comments to display
- */
- function comments_awaiting_moderation(&$comments, $post_id) {
- global $wpdb, $openid;
- $user = wp_get_current_user();
-
- $commenter = wp_get_current_commenter();
- extract($commenter);
-
- $author_db = $wpdb->escape($comment_author);
- $email_db = $wpdb->escape($comment_author_email);
- $url_db = $wpdb->escape($comment_author_url);
-
- if ($url_db) {
- $comments_table = WordPressOpenID::comments_table_name();
- $additional = $wpdb->get_results(
- "SELECT * FROM $comments_table"
- . " WHERE comment_post_ID = '$post_id'"
- . " AND openid = '1'" // get OpenID comments
- . " AND comment_author_url = '$url_db'" // where only the URL matches
- . ($user ? " AND user_id != '$user->ID'" : '')
- . ($author_db ? " AND comment_author != '$author_db'" : '')
- . ($email_db ? " AND comment_author_email != '$email_db'" : '')
- . " AND comment_approved = '0'"
- . " ORDER BY comment_date");
-
- if ($additional) {
- $comments = array_merge($comments, $additional);
- usort($comments, create_function('$a,$b',
- 'return strcmp($a->comment_date_gmt, $b->comment_date_gmt);'));
- }
- }
-
- return $comments;
- }
-
-
- /**
- * Make sure that a user's OpenID is stored and retrieved properly. This is important because the OpenID
- * may be an i-name, but WordPress is expecting the comment URL cookie to be a valid URL.
- *
- * @wordpress-action sanitize_comment_cookies
- */
- function sanitize_comment_cookies() {
- if ( isset($_COOKIE['comment_author_openid_'.COOKIEHASH]) ) {
-
- // this might be an i-name, so we don't want to run clean_url()
- remove_filter('pre_comment_author_url', 'clean_url');
-
- $comment_author_url = apply_filters('pre_comment_author_url',
- $_COOKIE['comment_author_openid_'.COOKIEHASH]);
- $comment_author_url = stripslashes($comment_author_url);
- $_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url;
- }
- }
-
-
- /**
- * Parse the WordPress request. If the pagename is 'openid_consumer', then the request
- * is an OpenID response and should be handled accordingly.
- *
- * @param WP $wp WP instance for the current request
- */
- function parse_request($wp) {
- openid_init();
-
- if ($wp->query_vars['pagename'] == 'openid_consumer') {
- WordPressOpenID_Logic::finish_openid($_REQUEST['action']);
- }
- }
-
- function set_error($error) {
- $_SESSION['oid_error'] = $error;
- return;
- }
-
-} // end class definition
-endif; // end if-class-exists test
-
-?>
diff --git a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/readme.txt b/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/readme.txt
deleted file mode 100755
index 26a1ead..0000000
--- a/app/omb/plugins/wp-plugins/plugins/enabled/wp-openid/readme.txt
+++ /dev/null
@@ -1,149 +0,0 @@
-=== WP-OpenID ===
-Contributors: wnorris, alanjcastonguay, factoryjoe
-Tags: openid, authentication
-Requires at least: 2.2
-Tested up to: 2.5.0
-Stable tag: 2.1.9
-
-Allow the use of OpenID for authentication of users and commenters.
-
-
-== Description ==
-
-OpenID is an [open standard][] that lets you sign in to other sites on the Web
-using little more than your blog URL. This means less usernames and passwords
-to remember and less time spent signing up for new sites. This plugin allows
-verified OpenIDs to be linked to existing user accounts for use as an
-alternative means of authentication. Additionally, commenters may use their
-OpenID to assure their identity as the author of the comment and provide a
-framework for future OpenID-based services (reputation and trust, for
-example).
-
-[open standard]: http://openid.net/
-
-
-== Installation ==
-
-This plugin follows the [standard WordPress installation method][]:
-
-1. Upload the `openid` folder to the `/wp-content/plugins/` directory
-1. Activate the plugin through the 'Plugins' menu in WordPress
-1. Configure the plugin through the 'OpenID' section of the 'Options' menu
-
-[standard WordPress installation method]: http://codex.wordpress.org/Managing_Plugins#Installing_Plugins
-
-
-== Frequently Asked Questions ==
-
-= Why do I get blank screens when I activate the plugin? =
-
-In some cases the plugin may have problems if not enough memory has been
-allocated to PHP. Try ensuring that the PHP memory_limit is at least greater
-than 8MB (limits of 64MB are not uncommon).
-
-= Why don't `https` OpenIDs work? =
-
-SSL certificate problems creep up when working with some OpenID providers
-(namely MyOpenID). This is typically due to an outdated CA cert bundle being
-used by libcurl. An explanation of the problem and a couple of solutions
-can be found [here][libcurl].
-
-[libcurl]: http://lists.openidenabled.com/pipermail/dev/2007-August/000784.html
-
-= How do I add an OpenID field to my comment form? =
-
-The easiest way to display the fact that your blog accepts OpenIDs is to enable
-the "Comment Form" option for the plugin. This will allow the normal website
-field to be used for OpenIDs as well. If this doesn't display properly for
-your particular theme or you simply prefer to have a separate OpenID field, you
-can modify your comments.php template to include an "openid_url" text field as
-part of your comment form. For the default theme, this might look like:
-
-
';
- }
- return $result;
- }
-
- protected function finalize_params($method, $params) {
- list($get, $post) = $this->add_standard_params($method, $params);
- // we need to do this before signing the params
- $this->convert_array_values_to_json($post);
- $post['sig'] = Facebook::generate_sig(array_merge($get, $post),
- $this->secret);
- return array($get, $post);
- }
-
- private function convert_array_values_to_json(&$params) {
- foreach ($params as $key => &$val) {
- if (is_array($val)) {
- $val = json_encode($val);
- }
- }
- }
-
- /**
- * Add the generally required params to our request.
- * Params method, api_key, and v should be sent over as get.
- */
- private function add_standard_params($method, $params) {
- $post = $params;
- $get = array();
- if ($this->call_as_apikey) {
- $get['call_as_apikey'] = $this->call_as_apikey;
- }
- $get['method'] = $method;
- $get['session_key'] = $this->session_key;
- $get['api_key'] = $this->api_key;
- $post['call_id'] = microtime(true);
- if ($post['call_id'] <= $this->last_call_id) {
- $post['call_id'] = $this->last_call_id + 0.001;
- }
- $this->last_call_id = $post['call_id'];
- if (isset($post['v'])) {
- $get['v'] = $post['v'];
- unset($post['v']);
- } else {
- $get['v'] = '1.0';
- }
- if (isset($this->use_ssl_resources) &&
- $this->use_ssl_resources) {
- $post['return_ssl_resources'] = true;
- }
- return array($get, $post);
- }
-
- private function create_url_string($params) {
- $post_params = array();
- foreach ($params as $key => &$val) {
- $post_params[] = $key.'='.urlencode($val);
- }
- return implode('&', $post_params);
- }
-
- private function run_multipart_http_transaction($method, $params, $file, $server_addr) {
-
- // the format of this message is specified in RFC1867/RFC1341.
- // we add twenty pseudo-random digits to the end of the boundary string.
- $boundary = '--------------------------FbMuLtIpArT' .
- sprintf("%010d", mt_rand()) .
- sprintf("%010d", mt_rand());
- $content_type = 'multipart/form-data; boundary=' . $boundary;
- // within the message, we prepend two extra hyphens.
- $delimiter = '--' . $boundary;
- $close_delimiter = $delimiter . '--';
- $content_lines = array();
- foreach ($params as $key => &$val) {
- $content_lines[] = $delimiter;
- $content_lines[] = 'Content-Disposition: form-data; name="' . $key . '"';
- $content_lines[] = '';
- $content_lines[] = $val;
- }
- // now add the file data
- $content_lines[] = $delimiter;
- $content_lines[] =
- 'Content-Disposition: form-data; filename="' . $file . '"';
- $content_lines[] = 'Content-Type: application/octet-stream';
- $content_lines[] = '';
- $content_lines[] = file_get_contents($file);
- $content_lines[] = $close_delimiter;
- $content_lines[] = '';
- $content = implode("\r\n", $content_lines);
- return $this->run_http_post_transaction($content_type, $content, $server_addr);
- }
-
- public function post_request($method, $params) {
- list($get, $post) = $this->finalize_params($method, $params);
- $post_string = $this->create_url_string($post);
- $get_string = $this->create_url_string($get);
- $url_with_get = $this->server_addr . '?' . $get_string;
- if ($this->use_curl_if_available && function_exists('curl_init')) {
- $useragent = 'Facebook API PHP5 Client 1.1 (curl) ' . phpversion();
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url_with_get);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- $result = $this->curl_exec($ch);
- curl_close($ch);
- } else {
- $content_type = 'application/x-www-form-urlencoded';
- $content = $post_string;
- $result = $this->run_http_post_transaction($content_type,
- $content,
- $url_with_get);
- }
- return $result;
- }
-
- /**
- * execute a curl transaction -- this exists mostly so subclasses can add
- * extra options and/or process the response, if they wish.
- *
- * @param resource $ch a curl handle
- */
- protected function curl_exec($ch) {
- $result = curl_exec($ch);
- return $result;
- }
-
- private function post_upload_request($method, $params, $file, $server_addr = null) {
- $server_addr = $server_addr ? $server_addr : $this->server_addr;
- list($get, $post) = $this->finalize_params($method, $params);
- $get_string = $this->create_url_string($get);
- $url_with_get = $server_addr . '?' . $get_string;
- if ($this->use_curl_if_available && function_exists('curl_init')) {
- // prepending '@' causes cURL to upload the file; the key is ignored.
- $post['_file'] = '@' . $file;
- $useragent = 'Facebook API PHP5 Client 1.1 (curl) ' . phpversion();
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url_with_get);
- // this has to come before the POSTFIELDS set!
- curl_setopt($ch, CURLOPT_POST, 1);
- // passing an array gets curl to use the multipart/form-data content type
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
- $result = $this->curl_exec($ch);
- curl_close($ch);
- } else {
- $result = $this->run_multipart_http_transaction($method, $post,
- $file, $url_with_get);
- }
- return $result;
- }
-
- private function run_http_post_transaction($content_type, $content, $server_addr) {
-
- $user_agent = 'Facebook API PHP5 Client 1.1 (non-curl) ' . phpversion();
- $content_length = strlen($content);
- $context =
- array('http' =>
- array('method' => 'POST',
- 'user_agent' => $user_agent,
- 'header' => 'Content-Type: ' . $content_type . "\r\n" .
- 'Content-Length: ' . $content_length,
- 'content' => $content));
- $context_id = stream_context_create($context);
- $sock = fopen($server_addr, 'r', false, $context_id);
-
- $result = '';
- if ($sock) {
- while (!feof($sock)) {
- $result .= fgets($sock, 4096);
- }
- fclose($sock);
- }
- return $result;
- }
-
- public static function convert_simplexml_to_array($sxml) {
- $arr = array();
- if ($sxml) {
- foreach ($sxml as $k => $v) {
- if ($sxml['list']) {
- $arr[] = self::convert_simplexml_to_array($v);
- } else {
- $arr[$k] = self::convert_simplexml_to_array($v);
- }
- }
- }
- if (sizeof($arr) > 0) {
- return $arr;
- } else {
- return (string)$sxml;
- }
- }
-
- protected function get_uid($uid) {
- return $uid ? $uid : $this->user;
- }
-}
-
-
-class FacebookRestClientException extends Exception {
-}
-
-// Supporting methods and values------
-
-/**
- * Error codes and descriptions for the Facebook API.
- */
-
-class FacebookAPIErrorCodes {
-
- const API_EC_SUCCESS = 0;
-
- /*
- * GENERAL ERRORS
- */
- const API_EC_UNKNOWN = 1;
- const API_EC_SERVICE = 2;
- const API_EC_METHOD = 3;
- const API_EC_TOO_MANY_CALLS = 4;
- const API_EC_BAD_IP = 5;
- const API_EC_HOST_API = 6;
- const API_EC_HOST_UP = 7;
- const API_EC_SECURE = 8;
- const API_EC_RATE = 9;
- const API_EC_PERMISSION_DENIED = 10;
- const API_EC_DEPRECATED = 11;
- const API_EC_VERSION = 12;
- const API_EC_INTERNAL_FQL_ERROR = 13;
- const API_EC_HOST_PUP = 14;
-
- /*
- * PARAMETER ERRORS
- */
- const API_EC_PARAM = 100;
- const API_EC_PARAM_API_KEY = 101;
- const API_EC_PARAM_SESSION_KEY = 102;
- const API_EC_PARAM_CALL_ID = 103;
- const API_EC_PARAM_SIGNATURE = 104;
- const API_EC_PARAM_TOO_MANY = 105;
- const API_EC_PARAM_USER_ID = 110;
- const API_EC_PARAM_USER_FIELD = 111;
- const API_EC_PARAM_SOCIAL_FIELD = 112;
- const API_EC_PARAM_EMAIL = 113;
- const API_EC_PARAM_USER_ID_LIST = 114;
- const API_EC_PARAM_FIELD_LIST = 115;
- const API_EC_PARAM_ALBUM_ID = 120;
- const API_EC_PARAM_PHOTO_ID = 121;
- const API_EC_PARAM_FEED_PRIORITY = 130;
- const API_EC_PARAM_CATEGORY = 140;
- const API_EC_PARAM_SUBCATEGORY = 141;
- const API_EC_PARAM_TITLE = 142;
- const API_EC_PARAM_DESCRIPTION = 143;
- const API_EC_PARAM_BAD_JSON = 144;
- const API_EC_PARAM_BAD_EID = 150;
- const API_EC_PARAM_UNKNOWN_CITY = 151;
- const API_EC_PARAM_BAD_PAGE_TYPE = 152;
-
- /*
- * USER PERMISSIONS ERRORS
- */
- const API_EC_PERMISSION = 200;
- const API_EC_PERMISSION_USER = 210;
- const API_EC_PERMISSION_NO_DEVELOPERS = 211;
- const API_EC_PERMISSION_OFFLINE_ACCESS = 212;
- const API_EC_PERMISSION_ALBUM = 220;
- const API_EC_PERMISSION_PHOTO = 221;
- const API_EC_PERMISSION_MESSAGE = 230;
- const API_EC_PERMISSION_OTHER_USER = 240;
- const API_EC_PERMISSION_STATUS_UPDATE = 250;
- const API_EC_PERMISSION_PHOTO_UPLOAD = 260;
- const API_EC_PERMISSION_VIDEO_UPLOAD = 261;
- const API_EC_PERMISSION_SMS = 270;
- const API_EC_PERMISSION_CREATE_LISTING = 280;
- const API_EC_PERMISSION_CREATE_NOTE = 281;
- const API_EC_PERMISSION_SHARE_ITEM = 282;
- const API_EC_PERMISSION_EVENT = 290;
- const API_EC_PERMISSION_LARGE_FBML_TEMPLATE = 291;
- const API_EC_PERMISSION_LIVEMESSAGE = 292;
- const API_EC_PERMISSION_RSVP_EVENT = 299;
-
- /*
- * DATA EDIT ERRORS
- */
- const API_EC_EDIT = 300;
- const API_EC_EDIT_USER_DATA = 310;
- const API_EC_EDIT_PHOTO = 320;
- const API_EC_EDIT_ALBUM_SIZE = 321;
- const API_EC_EDIT_PHOTO_TAG_SUBJECT = 322;
- const API_EC_EDIT_PHOTO_TAG_PHOTO = 323;
- const API_EC_EDIT_PHOTO_FILE = 324;
- const API_EC_EDIT_PHOTO_PENDING_LIMIT = 325;
- const API_EC_EDIT_PHOTO_TAG_LIMIT = 326;
- const API_EC_EDIT_ALBUM_REORDER_PHOTO_NOT_IN_ALBUM = 327;
- const API_EC_EDIT_ALBUM_REORDER_TOO_FEW_PHOTOS = 328;
-
- const API_EC_MALFORMED_MARKUP = 329;
- const API_EC_EDIT_MARKUP = 330;
-
- const API_EC_EDIT_FEED_TOO_MANY_USER_CALLS = 340;
- const API_EC_EDIT_FEED_TOO_MANY_USER_ACTION_CALLS = 341;
- const API_EC_EDIT_FEED_TITLE_LINK = 342;
- const API_EC_EDIT_FEED_TITLE_LENGTH = 343;
- const API_EC_EDIT_FEED_TITLE_NAME = 344;
- const API_EC_EDIT_FEED_TITLE_BLANK = 345;
- const API_EC_EDIT_FEED_BODY_LENGTH = 346;
- const API_EC_EDIT_FEED_PHOTO_SRC = 347;
- const API_EC_EDIT_FEED_PHOTO_LINK = 348;
-
- const API_EC_EDIT_VIDEO_SIZE = 350;
- const API_EC_EDIT_VIDEO_INVALID_FILE = 351;
- const API_EC_EDIT_VIDEO_INVALID_TYPE = 352;
- const API_EC_EDIT_VIDEO_FILE = 353;
-
- const API_EC_EDIT_FEED_TITLE_ARRAY = 360;
- const API_EC_EDIT_FEED_TITLE_PARAMS = 361;
- const API_EC_EDIT_FEED_BODY_ARRAY = 362;
- const API_EC_EDIT_FEED_BODY_PARAMS = 363;
- const API_EC_EDIT_FEED_PHOTO = 364;
- const API_EC_EDIT_FEED_TEMPLATE = 365;
- const API_EC_EDIT_FEED_TARGET = 366;
- const API_EC_EDIT_FEED_MARKUP = 367;
-
- /**
- * SESSION ERRORS
- */
- const API_EC_SESSION_TIMED_OUT = 450;
- const API_EC_SESSION_METHOD = 451;
- const API_EC_SESSION_INVALID = 452;
- const API_EC_SESSION_REQUIRED = 453;
- const API_EC_SESSION_REQUIRED_FOR_SECRET = 454;
- const API_EC_SESSION_CANNOT_USE_SESSION_SECRET = 455;
-
-
- /**
- * FQL ERRORS
- */
- const FQL_EC_UNKNOWN_ERROR = 600;
- const FQL_EC_PARSER = 601; // backwards compatibility
- const FQL_EC_PARSER_ERROR = 601;
- const FQL_EC_UNKNOWN_FIELD = 602;
- const FQL_EC_UNKNOWN_TABLE = 603;
- const FQL_EC_NOT_INDEXABLE = 604; // backwards compatibility
- const FQL_EC_NO_INDEX = 604;
- const FQL_EC_UNKNOWN_FUNCTION = 605;
- const FQL_EC_INVALID_PARAM = 606;
- const FQL_EC_INVALID_FIELD = 607;
- const FQL_EC_INVALID_SESSION = 608;
- const FQL_EC_UNSUPPORTED_APP_TYPE = 609;
- const FQL_EC_SESSION_SECRET_NOT_ALLOWED = 610;
- const FQL_EC_DEPRECATED_TABLE = 611;
- const FQL_EC_EXTENDED_PERMISSION = 612;
- const FQL_EC_RATE_LIMIT_EXCEEDED = 613;
- const FQL_EC_UNRESOLVED_DEPENDENCY = 614;
-
- const API_EC_REF_SET_FAILED = 700;
-
- /**
- * DATA STORE API ERRORS
- */
- const API_EC_DATA_UNKNOWN_ERROR = 800;
- const API_EC_DATA_INVALID_OPERATION = 801;
- const API_EC_DATA_QUOTA_EXCEEDED = 802;
- const API_EC_DATA_OBJECT_NOT_FOUND = 803;
- const API_EC_DATA_OBJECT_ALREADY_EXISTS = 804;
- const API_EC_DATA_DATABASE_ERROR = 805;
- const API_EC_DATA_CREATE_TEMPLATE_ERROR = 806;
- const API_EC_DATA_TEMPLATE_EXISTS_ERROR = 807;
- const API_EC_DATA_TEMPLATE_HANDLE_TOO_LONG = 808;
- const API_EC_DATA_TEMPLATE_HANDLE_ALREADY_IN_USE = 809;
- const API_EC_DATA_TOO_MANY_TEMPLATE_BUNDLES = 810;
- const API_EC_DATA_MALFORMED_ACTION_LINK = 811;
- const API_EC_DATA_TEMPLATE_USES_RESERVED_TOKEN = 812;
-
- /*
- * APPLICATION INFO ERRORS
- */
- const API_EC_NO_SUCH_APP = 900;
-
- /*
- * BATCH ERRORS
- */
- const API_EC_BATCH_TOO_MANY_ITEMS = 950;
- const API_EC_BATCH_ALREADY_STARTED = 951;
- const API_EC_BATCH_NOT_STARTED = 952;
- const API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE = 953;
-
- /*
- * EVENT API ERRORS
- */
- const API_EC_EVENT_INVALID_TIME = 1000;
-
- /*
- * INFO BOX ERRORS
- */
- const API_EC_INFO_NO_INFORMATION = 1050;
- const API_EC_INFO_SET_FAILED = 1051;
-
- /*
- * LIVEMESSAGE API ERRORS
- */
- const API_EC_LIVEMESSAGE_SEND_FAILED = 1100;
- const API_EC_LIVEMESSAGE_EVENT_NAME_TOO_LONG = 1101;
- const API_EC_LIVEMESSAGE_MESSAGE_TOO_LONG = 1102;
-
- /*
- * PAYMENTS API ERRORS
- */
- const API_EC_PAYMENTS_UNKNOWN = 1150;
- const API_EC_PAYMENTS_APP_INVALID = 1151;
- const API_EC_PAYMENTS_DATABASE = 1152;
- const API_EC_PAYMENTS_PERMISSION_DENIED = 1153;
- const API_EC_PAYMENTS_APP_NO_RESPONSE = 1154;
- const API_EC_PAYMENTS_APP_ERROR_RESPONSE = 1155;
- const API_EC_PAYMENTS_INVALID_ORDER = 1156;
- const API_EC_PAYMENTS_INVALID_PARAM = 1157;
- const API_EC_PAYMENTS_INVALID_OPERATION = 1158;
- const API_EC_PAYMENTS_PAYMENT_FAILED = 1159;
- const API_EC_PAYMENTS_DISABLED = 1160;
-
- /*
- * CONNECT SESSION ERRORS
- */
- const API_EC_CONNECT_FEED_DISABLED = 1300;
-
- /*
- * Platform tag bundles errors
- */
- const API_EC_TAG_BUNDLE_QUOTA = 1400;
-
- /*
- * SHARE
- */
- const API_EC_SHARE_BAD_URL = 1500;
-
- /*
- * NOTES
- */
- const API_EC_NOTE_CANNOT_MODIFY = 1600;
-
- /*
- * COMMENTS
- */
- const API_EC_COMMENTS_UNKNOWN = 1700;
- const API_EC_COMMENTS_POST_TOO_LONG = 1701;
- const API_EC_COMMENTS_DB_DOWN = 1702;
- const API_EC_COMMENTS_INVALID_XID = 1703;
- const API_EC_COMMENTS_INVALID_UID = 1704;
- const API_EC_COMMENTS_INVALID_POST = 1705;
- const API_EC_COMMENTS_INVALID_REMOVE = 1706;
-
- /**
- * This array is no longer maintained; to view the description of an error
- * code, please look at the message element of the API response or visit
- * the developer wiki at http://wiki.developers.facebook.com/.
- */
- public static $api_error_descriptions = array(
- self::API_EC_SUCCESS => 'Success',
- self::API_EC_UNKNOWN => 'An unknown error occurred',
- self::API_EC_SERVICE => 'Service temporarily unavailable',
- self::API_EC_METHOD => 'Unknown method',
- self::API_EC_TOO_MANY_CALLS => 'Application request limit reached',
- self::API_EC_BAD_IP => 'Unauthorized source IP address',
- self::API_EC_PARAM => 'Invalid parameter',
- self::API_EC_PARAM_API_KEY => 'Invalid API key',
- self::API_EC_PARAM_SESSION_KEY => 'Session key invalid or no longer valid',
- self::API_EC_PARAM_CALL_ID => 'Call_id must be greater than previous',
- self::API_EC_PARAM_SIGNATURE => 'Incorrect signature',
- self::API_EC_PARAM_USER_ID => 'Invalid user id',
- self::API_EC_PARAM_USER_FIELD => 'Invalid user info field',
- self::API_EC_PARAM_SOCIAL_FIELD => 'Invalid user field',
- self::API_EC_PARAM_USER_ID_LIST => 'Invalid user id list',
- self::API_EC_PARAM_FIELD_LIST => 'Invalid field list',
- self::API_EC_PARAM_ALBUM_ID => 'Invalid album id',
- self::API_EC_PARAM_BAD_EID => 'Invalid eid',
- self::API_EC_PARAM_UNKNOWN_CITY => 'Unknown city',
- self::API_EC_PERMISSION => 'Permissions error',
- self::API_EC_PERMISSION_USER => 'User not visible',
- self::API_EC_PERMISSION_NO_DEVELOPERS => 'Application has no developers',
- self::API_EC_PERMISSION_ALBUM => 'Album not visible',
- self::API_EC_PERMISSION_PHOTO => 'Photo not visible',
- self::API_EC_PERMISSION_EVENT => 'Creating and modifying events required the extended permission create_event',
- self::API_EC_PERMISSION_RSVP_EVENT => 'RSVPing to events required the extended permission rsvp_event',
- self::API_EC_EDIT_ALBUM_SIZE => 'Album is full',
- self::FQL_EC_PARSER => 'FQL: Parser Error',
- self::FQL_EC_UNKNOWN_FIELD => 'FQL: Unknown Field',
- self::FQL_EC_UNKNOWN_TABLE => 'FQL: Unknown Table',
- self::FQL_EC_NOT_INDEXABLE => 'FQL: Statement not indexable',
- self::FQL_EC_UNKNOWN_FUNCTION => 'FQL: Attempted to call unknown function',
- self::FQL_EC_INVALID_PARAM => 'FQL: Invalid parameter passed in',
- self::API_EC_DATA_UNKNOWN_ERROR => 'Unknown data store API error',
- self::API_EC_DATA_INVALID_OPERATION => 'Invalid operation',
- self::API_EC_DATA_QUOTA_EXCEEDED => 'Data store allowable quota was exceeded',
- self::API_EC_DATA_OBJECT_NOT_FOUND => 'Specified object cannot be found',
- self::API_EC_DATA_OBJECT_ALREADY_EXISTS => 'Specified object already exists',
- self::API_EC_DATA_DATABASE_ERROR => 'A database error occurred. Please try again',
- self::API_EC_BATCH_ALREADY_STARTED => 'begin_batch already called, please make sure to call end_batch first',
- self::API_EC_BATCH_NOT_STARTED => 'end_batch called before begin_batch',
- self::API_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE => 'This method is not allowed in batch mode'
- );
-}
diff --git a/db/library/facebook-platform/php/jsonwrapper/JSON/JSON.php b/db/library/facebook-platform/php/jsonwrapper/JSON/JSON.php
deleted file mode 100644
index 0cddbdd..0000000
--- a/db/library/facebook-platform/php/jsonwrapper/JSON/JSON.php
+++ /dev/null
@@ -1,806 +0,0 @@
-
- * @author Matt Knapp
- * @author Brett Stimmerman
- * @copyright 2005 Michal Migurski
- * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
- * @license http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
- */
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_SLICE', 1);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_STR', 2);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_ARR', 3);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_OBJ', 4);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_CMT', 5);
-
-/**
- * Behavior switch for Services_JSON::decode()
- */
-define('SERVICES_JSON_LOOSE_TYPE', 16);
-
-/**
- * Behavior switch for Services_JSON::decode()
- */
-define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
-
-/**
- * Converts to and from JSON format.
- *
- * Brief example of use:
- *
- *
- * // create a new instance of Services_JSON
- * $json = new Services_JSON();
- *
- * // convert a complexe value to JSON notation, and send it to the browser
- * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
- * $output = $json->encode($value);
- *
- * print($output);
- * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
- *
- * // accept incoming POST data, assumed to be in JSON notation
- * $input = file_get_contents('php://input', 1000000);
- * $value = $json->decode($input);
- *
- */
-class Services_JSON
-{
- /**
- * constructs a new JSON instance
- *
- * @param int $use object behavior flags; combine with boolean-OR
- *
- * possible values:
- * - SERVICES_JSON_LOOSE_TYPE: loose typing.
- * "{...}" syntax creates associative arrays
- * instead of objects in decode().
- * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
- * Values which can't be encoded (e.g. resources)
- * appear as NULL instead of throwing errors.
- * By default, a deeply-nested resource will
- * bubble up with an error, so all return values
- * from encode() should be checked with isError()
- */
- function Services_JSON($use = 0)
- {
- $this->use = $use;
- }
-
- /**
- * convert a string from one UTF-16 char to one UTF-8 char
- *
- * Normally should be handled by mb_convert_encoding, but
- * provides a slower PHP-only method for installations
- * that lack the multibye string extension.
- *
- * @param string $utf16 UTF-16 character
- * @return string UTF-8 character
- * @access private
- */
- function utf162utf8($utf16)
- {
- // oh please oh please oh please oh please oh please
- if(function_exists('mb_convert_encoding')) {
- return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
- }
-
- $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
-
- switch(true) {
- case ((0x7F & $bytes) == $bytes):
- // this case should never be reached, because we are in ASCII range
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0x7F & $bytes);
-
- case (0x07FF & $bytes) == $bytes:
- // return a 2-byte UTF-8 character
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0xC0 | (($bytes >> 6) & 0x1F))
- . chr(0x80 | ($bytes & 0x3F));
-
- case (0xFFFF & $bytes) == $bytes:
- // return a 3-byte UTF-8 character
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0xE0 | (($bytes >> 12) & 0x0F))
- . chr(0x80 | (($bytes >> 6) & 0x3F))
- . chr(0x80 | ($bytes & 0x3F));
- }
-
- // ignoring UTF-32 for now, sorry
- return '';
- }
-
- /**
- * convert a string from one UTF-8 char to one UTF-16 char
- *
- * Normally should be handled by mb_convert_encoding, but
- * provides a slower PHP-only method for installations
- * that lack the multibye string extension.
- *
- * @param string $utf8 UTF-8 character
- * @return string UTF-16 character
- * @access private
- */
- function utf82utf16($utf8)
- {
- // oh please oh please oh please oh please oh please
- if(function_exists('mb_convert_encoding')) {
- return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
- }
-
- switch(strlen($utf8)) {
- case 1:
- // this case should never be reached, because we are in ASCII range
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return $utf8;
-
- case 2:
- // return a UTF-16 character from a 2-byte UTF-8 char
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0x07 & (ord($utf8{0}) >> 2))
- . chr((0xC0 & (ord($utf8{0}) << 6))
- | (0x3F & ord($utf8{1})));
-
- case 3:
- // return a UTF-16 character from a 3-byte UTF-8 char
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr((0xF0 & (ord($utf8{0}) << 4))
- | (0x0F & (ord($utf8{1}) >> 2)))
- . chr((0xC0 & (ord($utf8{1}) << 6))
- | (0x7F & ord($utf8{2})));
- }
-
- // ignoring UTF-32 for now, sorry
- return '';
- }
-
- /**
- * encodes an arbitrary variable into JSON format
- *
- * @param mixed $var any number, boolean, string, array, or object to be encoded.
- * see argument 1 to Services_JSON() above for array-parsing behavior.
- * if var is a strng, note that encode() always expects it
- * to be in ASCII or UTF-8 format!
- *
- * @return mixed JSON string representation of input var or an error if a problem occurs
- * @access public
- */
- function encode($var)
- {
- switch (gettype($var)) {
- case 'boolean':
- return $var ? 'true' : 'false';
-
- case 'NULL':
- return 'null';
-
- case 'integer':
- return (int) $var;
-
- case 'double':
- case 'float':
- return (float) $var;
-
- case 'string':
- // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
- $ascii = '';
- $strlen_var = strlen($var);
-
- /*
- * Iterate over every character in the string,
- * escaping with a slash or encoding to UTF-8 where necessary
- */
- for ($c = 0; $c < $strlen_var; ++$c) {
-
- $ord_var_c = ord($var{$c});
-
- switch (true) {
- case $ord_var_c == 0x08:
- $ascii .= '\b';
- break;
- case $ord_var_c == 0x09:
- $ascii .= '\t';
- break;
- case $ord_var_c == 0x0A:
- $ascii .= '\n';
- break;
- case $ord_var_c == 0x0C:
- $ascii .= '\f';
- break;
- case $ord_var_c == 0x0D:
- $ascii .= '\r';
- break;
-
- case $ord_var_c == 0x22:
- case $ord_var_c == 0x2F:
- case $ord_var_c == 0x5C:
- // double quote, slash, slosh
- $ascii .= '\\'.$var{$c};
- break;
-
- case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
- // characters U-00000000 - U-0000007F (same as ASCII)
- $ascii .= $var{$c};
- break;
-
- case (($ord_var_c & 0xE0) == 0xC0):
- // characters U-00000080 - U-000007FF, mask 110XXXXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
- $c += 1;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
-
- case (($ord_var_c & 0xF0) == 0xE0):
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}));
- $c += 2;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
-
- case (($ord_var_c & 0xF8) == 0xF0):
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}));
- $c += 3;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
-
- case (($ord_var_c & 0xFC) == 0xF8):
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}),
- ord($var{$c + 4}));
- $c += 4;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
-
- case (($ord_var_c & 0xFE) == 0xFC):
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}),
- ord($var{$c + 4}),
- ord($var{$c + 5}));
- $c += 5;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
- }
- }
-
- return '"'.$ascii.'"';
-
- case 'array':
- /*
- * As per JSON spec if any array key is not an integer
- * we must treat the the whole array as an object. We
- * also try to catch a sparsely populated associative
- * array with numeric keys here because some JS engines
- * will create an array with empty indexes up to
- * max_index which can cause memory issues and because
- * the keys, which may be relevant, will be remapped
- * otherwise.
- *
- * As per the ECMA and JSON specification an object may
- * have any string as a property. Unfortunately due to
- * a hole in the ECMA specification if the key is a
- * ECMA reserved word or starts with a digit the
- * parameter is only accessible using ECMAScript's
- * bracket notation.
- */
-
- // treat as a JSON object
- if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
- $properties = array_map(array($this, 'name_value'),
- array_keys($var),
- array_values($var));
-
- foreach($properties as $property) {
- if(Services_JSON::isError($property)) {
- return $property;
- }
- }
-
- return '{' . join(',', $properties) . '}';
- }
-
- // treat it like a regular array
- $elements = array_map(array($this, 'encode'), $var);
-
- foreach($elements as $element) {
- if(Services_JSON::isError($element)) {
- return $element;
- }
- }
-
- return '[' . join(',', $elements) . ']';
-
- case 'object':
- $vars = get_object_vars($var);
-
- $properties = array_map(array($this, 'name_value'),
- array_keys($vars),
- array_values($vars));
-
- foreach($properties as $property) {
- if(Services_JSON::isError($property)) {
- return $property;
- }
- }
-
- return '{' . join(',', $properties) . '}';
-
- default:
- return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
- ? 'null'
- : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
- }
- }
-
- /**
- * array-walking function for use in generating JSON-formatted name-value pairs
- *
- * @param string $name name of key to use
- * @param mixed $value reference to an array element to be encoded
- *
- * @return string JSON-formatted name-value pair, like '"name":value'
- * @access private
- */
- function name_value($name, $value)
- {
- $encoded_value = $this->encode($value);
-
- if(Services_JSON::isError($encoded_value)) {
- return $encoded_value;
- }
-
- return $this->encode(strval($name)) . ':' . $encoded_value;
- }
-
- /**
- * reduce a string by removing leading and trailing comments and whitespace
- *
- * @param $str string string value to strip of comments and whitespace
- *
- * @return string string value stripped of comments and whitespace
- * @access private
- */
- function reduce_string($str)
- {
- $str = preg_replace(array(
-
- // eliminate single line comments in '// ...' form
- '#^\s*//(.+)$#m',
-
- // eliminate multi-line comments in '/* ... */' form, at start of string
- '#^\s*/\*(.+)\*/#Us',
-
- // eliminate multi-line comments in '/* ... */' form, at end of string
- '#/\*(.+)\*/\s*$#Us'
-
- ), '', $str);
-
- // eliminate extraneous space
- return trim($str);
- }
-
- /**
- * decodes a JSON string into appropriate variable
- *
- * @param string $str JSON-formatted string
- *
- * @return mixed number, boolean, string, array, or object
- * corresponding to given JSON input string.
- * See argument 1 to Services_JSON() above for object-output behavior.
- * Note that decode() always returns strings
- * in ASCII or UTF-8 format!
- * @access public
- */
- function decode($str)
- {
- $str = $this->reduce_string($str);
-
- switch (strtolower($str)) {
- case 'true':
- return true;
-
- case 'false':
- return false;
-
- case 'null':
- return null;
-
- default:
- $m = array();
-
- if (is_numeric($str)) {
- // Lookie-loo, it's a number
-
- // This would work on its own, but I'm trying to be
- // good about returning integers where appropriate:
- // return (float)$str;
-
- // Return float or int, as appropriate
- return ((float)$str == (integer)$str)
- ? (integer)$str
- : (float)$str;
-
- } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
- // STRINGS RETURNED IN UTF-8 FORMAT
- $delim = substr($str, 0, 1);
- $chrs = substr($str, 1, -1);
- $utf8 = '';
- $strlen_chrs = strlen($chrs);
-
- for ($c = 0; $c < $strlen_chrs; ++$c) {
-
- $substr_chrs_c_2 = substr($chrs, $c, 2);
- $ord_chrs_c = ord($chrs{$c});
-
- switch (true) {
- case $substr_chrs_c_2 == '\b':
- $utf8 .= chr(0x08);
- ++$c;
- break;
- case $substr_chrs_c_2 == '\t':
- $utf8 .= chr(0x09);
- ++$c;
- break;
- case $substr_chrs_c_2 == '\n':
- $utf8 .= chr(0x0A);
- ++$c;
- break;
- case $substr_chrs_c_2 == '\f':
- $utf8 .= chr(0x0C);
- ++$c;
- break;
- case $substr_chrs_c_2 == '\r':
- $utf8 .= chr(0x0D);
- ++$c;
- break;
-
- case $substr_chrs_c_2 == '\\"':
- case $substr_chrs_c_2 == '\\\'':
- case $substr_chrs_c_2 == '\\\\':
- case $substr_chrs_c_2 == '\\/':
- if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
- ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
- $utf8 .= $chrs{++$c};
- }
- break;
-
- case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
- // single, escaped unicode character
- $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
- . chr(hexdec(substr($chrs, ($c + 4), 2)));
- $utf8 .= $this->utf162utf8($utf16);
- $c += 5;
- break;
-
- case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
- $utf8 .= $chrs{$c};
- break;
-
- case ($ord_chrs_c & 0xE0) == 0xC0:
- // characters U-00000080 - U-000007FF, mask 110XXXXX
- //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 2);
- ++$c;
- break;
-
- case ($ord_chrs_c & 0xF0) == 0xE0:
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 3);
- $c += 2;
- break;
-
- case ($ord_chrs_c & 0xF8) == 0xF0:
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 4);
- $c += 3;
- break;
-
- case ($ord_chrs_c & 0xFC) == 0xF8:
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 5);
- $c += 4;
- break;
-
- case ($ord_chrs_c & 0xFE) == 0xFC:
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 6);
- $c += 5;
- break;
-
- }
-
- }
-
- return $utf8;
-
- } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
- // array, or object notation
-
- if ($str{0} == '[') {
- $stk = array(SERVICES_JSON_IN_ARR);
- $arr = array();
- } else {
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
- $stk = array(SERVICES_JSON_IN_OBJ);
- $obj = array();
- } else {
- $stk = array(SERVICES_JSON_IN_OBJ);
- $obj = new stdClass();
- }
- }
-
- array_push($stk, array('what' => SERVICES_JSON_SLICE,
- 'where' => 0,
- 'delim' => false));
-
- $chrs = substr($str, 1, -1);
- $chrs = $this->reduce_string($chrs);
-
- if ($chrs == '') {
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
- return $arr;
-
- } else {
- return $obj;
-
- }
- }
-
- //print("\nparsing {$chrs}\n");
-
- $strlen_chrs = strlen($chrs);
-
- for ($c = 0; $c <= $strlen_chrs; ++$c) {
-
- $top = end($stk);
- $substr_chrs_c_2 = substr($chrs, $c, 2);
-
- if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
- // found a comma that is not inside a string, array, etc.,
- // OR we've reached the end of the character list
- $slice = substr($chrs, $top['where'], ($c - $top['where']));
- array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
- //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
- // we are in an array, so just push an element onto the stack
- array_push($arr, $this->decode($slice));
-
- } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
- // we are in an object, so figure
- // out the property name and set an
- // element in an associative array,
- // for now
- $parts = array();
-
- if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
- // "name":value pair
- $key = $this->decode($parts[1]);
- $val = $this->decode($parts[2]);
-
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
- $obj[$key] = $val;
- } else {
- $obj->$key = $val;
- }
- } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
- // name:value pair, where name is unquoted
- $key = $parts[1];
- $val = $this->decode($parts[2]);
-
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
- $obj[$key] = $val;
- } else {
- $obj->$key = $val;
- }
- }
-
- }
-
- } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
- // found a quote, and we are not inside a string
- array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
- //print("Found start of string at {$c}\n");
-
- } elseif (($chrs{$c} == $top['delim']) &&
- ($top['what'] == SERVICES_JSON_IN_STR) &&
- ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
- // found a quote, we're in a string, and it's not escaped
- // we know that it's not escaped becase there is _not_ an
- // odd number of backslashes at the end of the string so far
- array_pop($stk);
- //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
-
- } elseif (($chrs{$c} == '[') &&
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
- // found a left-bracket, and we are in an array, object, or slice
- array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
- //print("Found start of array at {$c}\n");
-
- } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
- // found a right-bracket, and we're in an array
- array_pop($stk);
- //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
- } elseif (($chrs{$c} == '{') &&
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
- // found a left-brace, and we are in an array, object, or slice
- array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
- //print("Found start of object at {$c}\n");
-
- } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
- // found a right-brace, and we're in an object
- array_pop($stk);
- //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
- } elseif (($substr_chrs_c_2 == '/*') &&
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
- // found a comment start, and we are in an array, object, or slice
- array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
- $c++;
- //print("Found start of comment at {$c}\n");
-
- } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
- // found a comment end, and we're in one now
- array_pop($stk);
- $c++;
-
- for ($i = $top['where']; $i <= $c; ++$i)
- $chrs = substr_replace($chrs, ' ', $i, 1);
-
- //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
- }
-
- }
-
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
- return $arr;
-
- } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
- return $obj;
-
- }
-
- }
- }
- }
-
- /**
- * @todo Ultimately, this should just call PEAR::isError()
- */
- function isError($data, $code = null)
- {
- if (class_exists('pear')) {
- return PEAR::isError($data, $code);
- } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
- is_subclass_of($data, 'services_json_error'))) {
- return true;
- }
-
- return false;
- }
-}
-
-if (class_exists('PEAR_Error')) {
-
- class Services_JSON_Error extends PEAR_Error
- {
- function Services_JSON_Error($message = 'unknown error', $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
- parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
- }
- }
-
-} else {
-
- /**
- * @todo Ultimately, this class shall be descended from PEAR_Error
- */
- class Services_JSON_Error
- {
- function Services_JSON_Error($message = 'unknown error', $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
-
- }
- }
-
-}
-
-?>
diff --git a/db/library/facebook-platform/php/jsonwrapper/JSON/LICENSE b/db/library/facebook-platform/php/jsonwrapper/JSON/LICENSE
deleted file mode 100644
index 4ae6bef..0000000
--- a/db/library/facebook-platform/php/jsonwrapper/JSON/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-
-Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
-NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/db/library/facebook-platform/php/jsonwrapper/jsonwrapper.php b/db/library/facebook-platform/php/jsonwrapper/jsonwrapper.php
deleted file mode 100644
index 29509de..0000000
--- a/db/library/facebook-platform/php/jsonwrapper/jsonwrapper.php
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/db/library/facebook-platform/php/jsonwrapper/jsonwrapper_inner.php b/db/library/facebook-platform/php/jsonwrapper/jsonwrapper_inner.php
deleted file mode 100644
index 36a3f28..0000000
--- a/db/library/facebook-platform/php/jsonwrapper/jsonwrapper_inner.php
+++ /dev/null
@@ -1,23 +0,0 @@
-encode($arg);
-}
-
-function json_decode($arg)
-{
- global $services_json;
- if (!isset($services_json)) {
- $services_json = new Services_JSON();
- }
- return $services_json->decode($arg);
-}
-
-?>
diff --git a/db/library/facebook_stream/FacebookStream.php b/db/library/facebook_stream/FacebookStream.php
deleted file mode 100755
index 6320e5c..0000000
--- a/db/library/facebook_stream/FacebookStream.php
+++ /dev/null
@@ -1,335 +0,0 @@
-api = new Services_Facebook();
-
- $this->agent = $agent;
-
- $this->appid = $appid;
-
- }
-
- /**
- * Use an "infinite" key from Facebook
- */
- function setSess($s){
- $this->api->sessionKey = $s;
- }
-
- /**
- * Make a Request token
- */
- function getAccessToken() {
- return $this->api->auth->createToken();
- }
-
- /**
- * Return the API key
- */
- function getApiKey() {
- return Services_Facebook::$apiKey;
- }
-
- /**
- * Return the session Key
- */
- function getSessionKey() {
- return $this->api->sessionKey;
- }
-
- /**
- * Return the API secret
- */
- function getApiSecret() {
- return Services_Facebook::$secret;
- }
-
- /**
- * get a session
- */
- function getSession($token) {
- return $this->api->auth->getSession($token);
- }
-
- /**
- * get a permanent session key
- */
- function permanent_facebook_key($key,$secret){
- add_lib_path('facebook-platform/php');
- require_once "facebook.php";
- $facebook = new Facebook($key, $secret);
- $infinite_key_array = $facebook->api_client->auth_getSession($_GET['key']);
- if ($infinite_key_array['session_key'])
- echo "your permanent session key is ". $infinite_key_array['session_key'];
- else
- echo "sorry there was an error getting your permanent session key";
- exit;
- }
-
- /**
- * Facebook Stream API request
- */
- function streamRequest($userid) {
-
- // requires read_stream
- $hash = md5("app_id=".$this->appid."session_key=".$this->getSessionKey()."source_id=".$userid.$this->getApiSecret());
-
- $url = 'http://www.facebook.com/activitystreams/feed.php';
- $url .= '?source_id=';
- $url .= $userid;
- $url .= '&app_id=';
- $url .= $this->appid;
- $url .= '&session_key=';
- $url .= $this->getSessionKey();
- $url .= '&sig=';
- $url .= $hash;
- $url .= '&v=0.7&read';
-
- return $this->http($url);
-
- }
-
- function getInfo($userid,$fields) {
-
- // http://wiki.developers.facebook.com/index.php/Users.getInfo
-
- $params = array(
- 'api_key' => $this->getApiKey(),
- 'call_id' => microtime(true),
- 'sig' => md5("app_id=".$this->appid."session_key=".$this->getSessionKey()."source_id=".$userid.$this->getApiSecret()),
- 'v' => '1.0',
- 'uids' => $userid,
- 'fields' => $fields,
- 'session_key' => $this->getSessionKey()
- );
-
- return $this->api->users->callMethod( 'users.getInfo', $params );
-
- }
-
- function getPageInfo($pageid,$fields) {
-
- $params = array(
- 'api_key' => $this->getApiKey(),
- 'call_id' => microtime(true),
- 'sig' => md5("app_id=".$this->appid."session_key=".$this->getSessionKey()."source_id=".$userid.$this->getApiSecret()),
- 'v' => '1.0',
- 'page_ids' => $pageid,
- 'fields' => $fields,
- 'session_key' => $this->getSessionKey()
- );
-
- return $this->api->users->callMethod( 'pages.getInfo', $params );
-
- }
-
- function verifyPerms($userid,$perms,$path='',$force=false) {
-
- if (!$force){
- $this->showPopup(implode(',',$perms),$path,$userid);
- return;
- }
-
- $showperms = array();
-
- foreach($perms as $perm){
- $params = array(
- 'ext_perm' => $perm,
- 'uid' => $userid
- );
- $response = $this->api->users->callMethod('users.hasAppPermission', $params);
- $xml = simplexml_load_string($response->asXML());
- if (is_object($xml))
- $xml = (array) $xml;
- if (!$xml[0])
- $showperms[] = $perm;
- }
-
- if (count($showperms) > 0)
- $this->showPopup(implode(',',$showperms),$path,$userid);
-
- }
-
- function setStatus($status,$userid) {
-
- //$this->verifyPerms($userid,array('status_update','photo_upload'));
-
- $params = array(
- 'uid' => $userid,
- 'status_includes_verb' => 'true'
- );
-
- if (is_bool($status) && $status === true) {
- $params['clear'] = 'true';
- } else {
- $params['status'] = $status;
- }
-
- $response = $this->api->users->callMethod('users.setStatus', $params);
-
- return (intval((string)$res) == 1);
-
- }
-
- function photoUpload( $file, $aid=0, $caption='',$userid ) {
-
- //$this->verifyPerms($userid,array('status_update','photo_upload'));
-
- $params = array(
- 'method' => 'photos.upload',
- 'v' => '1.0',
- 'api_key' => $this->getApiKey(),
- 'call_id' => microtime(true),
- 'format' => 'XML',
- 'uid' => $userid
- );
-
- if ($aid > 0)
- $params['aid'] = $aid;
-
- if (strlen($caption))
- $params['caption'] = $caption;
-
- $params = $this->signRequest($params);
- $params[basename($file)] = '@' . realpath($file);
- $url = $this->api->photos->getAPI() . '?method=photos.upload';
-
- return $this->http($url,$params);
-
- }
-
- /**
- * Make an HTTP request
- *
- * @return API results
- */
- function http($url, $post_data = null) {/*{{{*/
- $ch = curl_init();
- if (defined("CURL_CA_BUNDLE_PATH")) curl_setopt($ch, CURLOPT_CAINFO, CURL_CA_BUNDLE_PATH);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- //////////////////////////////////////////////////
- ///// Set to 1 to verify SSL Cert //////
- //////////////////////////////////////////////////
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- if (isset($post_data)) {
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
- }
- curl_setopt($ch, CURLOPT_USERAGENT, $this->agent . phpversion());
- $response = curl_exec($ch);
- $this->http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- $this->last_api_call = $url;
- curl_close ($ch);
- return $response;
- }
-
- function signRequest($params) {
- if (isset($params['sig']))
- unset($params['sig']);
- ksort($params);
- $sig = '';
- foreach ($params as $k => $v)
- $sig .= $k .'=' . $v;
- $sig .= $this->getApiSecret();
- $params['sig'] = md5($sig);
- return $params;
- }
-
- function showJs(){
-
- echo <<
-EOD;
-
- }
-
- function showPopup($perms,$path,$uid=false){
-
- $key = $this->getApiKey();
-
- $path = $path.'xd_receiver.htm';
-
-if ($uid)
-
- echo <<
- function ondone(st) {
- //alert('done '+st);
- }
-
- FB_RequireFeatures(["XFBML"], function(){
- FB.Facebook.init('$key', '$path', null);
- FB.ensureInit(function () {
- FB.Connect.showPermissionDialog('$perms', ondone, true, [$uid] );
- });
- });
-
-EOD;
-
-else
-
- echo <<
-
- FB_RequireFeatures(["XFBML"], function(){
- FB.Facebook.init('$key', '$path', null);
- FB.ensureInit(function () {
- FB.Connect.showPermissionDialog( '$perms', ondone );
- });
- });
-
-EOD;
-
- }
-
-}
-
-function add_lib_path($path,$prepend = false) {
- if (!file_exists($path) OR (file_exists($path) && filetype($path) !== 'dir'))
- {
- trigger_error("Include path '{$path}' not exists", E_USER_WARNING);
- continue;
- }
-
- $paths = explode(PATH_SEPARATOR, get_include_path());
-
- if (array_search($path, $paths) === false && $prepend)
- array_unshift($paths, $path);
- if (array_search($path, $paths) === false)
- array_push($paths, $path);
-
- set_include_path(implode(PATH_SEPARATOR, $paths));
-}
diff --git a/db/library/facebook_stream/README b/db/library/facebook_stream/README
deleted file mode 100755
index b2bbbde..0000000
--- a/db/library/facebook_stream/README
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Facebook Streams
-
-http://facebookstreams.com
-
-Brian Hendrickson | brian@megapump.com | http://brianhendrickson.com | @brianjesse
-
-Basic PHP library for working with Facebook's streams API
-
-Docs: http://docs.google.com/Doc?id=dg9cvb8x_028vf5f6t
-
-4/10/2010 -- updating Facebook Stream library to use an "infinite session key"
-
-
-
-Where to set up your App at Facebook:
-
- http://www.facebook.com/developers/apps.php
-
-Callback URL setting:
-
- 1. click "Edit Settings"
- 2. click "Connect"
-
-
-
-Getting a permanent key from Facebook:
-
-Browse to this URL:
-
- http://www.facebook.com/code_gen.php?v=1.0&api_key=[api key]
-
-That will give you a "one time code".
-
-Visit this URL in the example app to convert the one time code to a permanent session key:
-
- ?key=[one time code]
-
-
-
-Using the pop-up permissions dialogue:
-
-On pages where the popup will show, you'll need the following code at the very beginning of your
-
-
-
diff --git a/db/library/facebook_stream/Services/Facebook.php b/db/library/facebook_stream/Services/Facebook.php
deleted file mode 100644
index 6ef648c..0000000
--- a/db/library/facebook_stream/Services/Facebook.php
+++ /dev/null
@@ -1,265 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-require_once 'Services/Facebook/Exception.php';
-
-/**
- * Services_Facebook
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook
-{
- /**
- * Facebook API URL
- *
- * @var string $apiURL URL that that API calls will be sent to
- * @static
- */
- static public $apiURL = 'http://api.new.facebook.com/restserver.php';
-
- /**
- * Facebok application API key
- *
- * @var string $apiKey 32 character api_key from Facebook
- * @static
- */
- static public $apiKey = '';
-
- /**
- * Facebok application secret
- *
- * The Facebook secret token is used to both sign requests sent to
- * Facebook and to verify requests sent from Facebook to your application.
- *
- * @var string $secret 32 character secret from Facebook
- * @static
- */
- static public $secret = '';
-
- /**
- * Use secret as session secret
- *
- * @var bool $useSessionSecret Use session secret or not
- */
- protected $useSessionSecret = false;
-
- /**
- * Use curl CURLOPT_DNS_USE_GLOBAL_CACHE option
- *
- * @var bool $useDnsCache int switch to use the curl dns cache option
- */
- static public $useDnsCache = 0;
-
- /**
- * Timeout
- *
- * The amount in seconds for the curl http request timeout
- *
- * @var string $timeout Time in seconds for a request to timeout
- * @static
- */
- static public $timeout = 30;
-
- /**
- * Currently logged in user
- *
- * @var string $sessionKey
- */
- public $sessionKey = '';
-
- /**
- * Instances of various drivers
- *
- * @var array $instances
- */
- static protected $instances = array();
-
- /**
- * Instance of Services_Facebook
- *
- * @var Services_Facebook $instance
- * @see Services_Facebook::singleton();
- */
- static protected $instance;
-
- /**
- * Available drivers
- *
- * @var array $drivers
- */
- static protected $drivers = array(
- 'admin' => 'Admin',
- 'application' => 'Application',
- 'auth' => 'Auth',
- 'connect' => 'Connect',
- 'data' => 'Data',
- 'events' => 'Events',
- 'fbml' => 'FBML',
- 'fql' => 'FQL',
- 'feed' => 'Feed',
- 'friends' => 'Friends',
- 'groups' => 'Friends',
- 'marketplace' => 'MarketPlace',
- 'notifications' => 'Notifications',
- 'pages' => 'Pages',
- 'photos' => 'Photos',
- 'profile' => 'Profile',
- 'share' => 'Share',
- 'stream' => 'Stream',
- 'users' => 'Users'
- );
-
- /**
- * Create a facebook service
- *
- * @param string $endPoint Services to create
- *
- * @return object Instance of Facebook endpoint
- * @throws Services_Facebook_Exception
- */
- static protected function factory($endPoint)
- {
- $file = 'Services/Facebook/' . $endPoint . '.php';
- include_once $file;
- $class = 'Services_Facebook_' . $endPoint;
- if (!class_exists($class)) {
- throw new Services_Facebook_Exception('Class not found ' . $class);
- }
-
- $instance = new $class();
- return $instance;
- }
-
- /**
- * Singleton
- *
- * @return Services_Facebook
- */
- static public function singleton()
- {
- if (self::$instance !== null) {
- return self::$instance;
- }
-
- $instance = new Services_Facebook();
- self::$instance = $instance;
-
- return $instance;
- }
-
- /**
- * Lazy loader for Facebook drivers
- *
- * @param string $driver The Facebook driver/endpoint to load
- *
- * @throws Services_Facebook_Exception
- * @return object
- */
- public function __get($driver)
- {
- $driver = strtolower($driver);
- if (!isset(self::$drivers[$driver])) {
- throw new Services_Facebook_Exception(
- 'The driver requested, ' . $driver . ', is not supported'
- );
- } else {
- $driver = self::$drivers[$driver];
- }
-
- if (isset(self::$instances[$driver])) {
- return self::$instances[$driver];
- }
-
- self::$instances[$driver] = self::factory($driver);
- self::$instances[$driver]->sessionKey = $this->sessionKey;
- if ($this->useSessionSecret) {
- self::$instances[$driver]->useSessionSecret = true;
- }
-
- return self::$instances[$driver];
- }
-
- /**
- * Validates requests from Facebook
- *
- * Facebook sends a series of $_POST variables when it requests a canvas
- * page or sends a user to the post removal URL. This function validates
- * that request came from Facebook. This function returns true if the
- * request came from Facebook.
- *
- * Both the signature of the request and the api_key is verified. If the
- * api_key given doesn't match up to the current Services_Facebook::$apiKey
- * then it will return false.
- *
- * @param array $args Normally the $_POST array
- *
- * @return boolean True if the request signature is valid
- */
- static public function isValidRequest($args)
- {
- if ($args['fb_sig_api_key'] != Services_Facebook::$apiKey) {
- return false;
- }
-
- ksort($args);
-
- $sig = '';
- foreach ($args as $k => $v) {
- if ($k == 'fb_sig') {
- continue;
- }
-
- // The signature is based on fb_sig_* fields only. Extra POST
- // args are passed along, but don't alter the signature.
- if (preg_match('/^fb_sig_/', $k)) {
- $sig .= substr($k, 7) . '=' . $v;
- }
- }
-
- return (md5($sig . Services_Facebook::$secret) == $args['fb_sig']);
- }
-
- /**
- * Turn on using secret for session secret
- *
- * @param bool $use Use secret for session secret or not
- *
- * @return bool Using or not using
- */
- public function useSessionSecret($use = true)
- {
- foreach (self::$instances as $instance) {
- $instance->useSessionSecret = $use;
- }
-
- return $this->useSessionSecret = $use;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Admin.php b/db/library/facebook_stream/Services/Facebook/Admin.php
deleted file mode 100644
index de06313..0000000
--- a/db/library/facebook_stream/Services/Facebook/Admin.php
+++ /dev/null
@@ -1,147 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Admin Interface
- *
- *
- * admin->getNotificationsPerDay() . ' ';
- * echo 'Requests that we can send per day, behalf of a user: ' .
- * $api->admin->getRequestsPerDay(). ' ';
- * ?>
- *
- *
- * @category Services
- * @package Services_Facebook
- * @author Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Admin extends Services_Facebook_Common
-{
- /**
- * Default application property fields
- *
- * @link http://wiki.developers.facebook.com/index.php/ApplicationProperties
- */
- protected $applicationFields = array(
- 'application_name', 'callback_url', 'post_install_url', 'edit_url',
- 'dashboard_url', 'uninstall_url', 'ip_list', 'email', 'description',
- 'use_iframe', 'desktop', 'is_mobile', 'default_fbml', 'default_column',
- 'message_url', 'message_action', 'about_url', 'private_install',
- 'installable', 'privacy_url', 'help_url', 'see_all_url', 'tos_url',
- 'dev_mode', 'preload_fql'
- );
-
- /**
- * Gets property values previously set for an application.
- *
- * @param array $properties The properties to get, default is all
- *
- * @return array Array with all requested properties
- *
- * @link http://wiki.developers.facebook.com/index.php/Admin.getAppProperties
- */
- public function getAppProperties($properties = array())
- {
- if (!count($properties)) {
- $properties = $this->applicationFields;
- }
-
- //FB accepts the app properties as a json array
- $jsonProperties = json_encode($properties);
-
- $result = $this->callMethod('admin.getAppProperties', array(
- 'properties' => $jsonProperties
- ));
-
- //The response from Facebook is in JSON
- return json_decode((string)$result);
- }
-
- /**
- * Sets multiple properties for an application.
- *
- * @param array $properties Property / value assocative array of properties
- *
- * @return boolean True on success
- *
- * @link http://wiki.developers.facebook.com/index.php/Admin.setAppProperties
- */
- public function setAppProperties($properties = array())
- {
- $jsonArray = array();
- foreach ($properties as $property => $value) {
- if (in_array($property, $this->applicationFields)) {
- $jsonArray[$property] = $value;
- }
- }
- $jsonProperties = json_encode($jsonArray);
-
- $result = $this->callMethod('admin.setAppProperties', array(
- 'properties' => $jsonProperties
- ));
-
- return (intval((string) $result) == 1);
- }
-
-
- /**
- * Get the number of notifications your application can send on
- * behalf of a user per day.
- *
- * @return int Number of notifications
- *
- * @link http://wiki.developers.facebook.com/index.php/Admin.getAllocation
- */
- public function getNotificationsPerDay()
- {
- return (int)$this->callMethod('admin.getAllocation', array(
- 'session_key' => $this->sessionKey,
- 'integration_point_name' => 'notifications_per_day'
- ));
- }
-
- /**
- * Get the number of requests your application can send on behalf
- * of a user per day.
- *
- * @return int Number of requests
- *
- * @link http://wiki.developers.facebook.com/index.php/Admin.getAllocation
- **/
- public function getRequestsPerDay()
- {
- return (int)$this->callMethod('admin.getAllocation', array(
- 'session_key' => $this->sessionKey,
- 'integration_point_name' => 'requests_per_day'
- ));
- }
-
-}
diff --git a/db/library/facebook_stream/Services/Facebook/Application.php b/db/library/facebook_stream/Services/Facebook/Application.php
deleted file mode 100644
index 8fbcf2c..0000000
--- a/db/library/facebook_stream/Services/Facebook/Application.php
+++ /dev/null
@@ -1,96 +0,0 @@
-
- * @copyright 2007-2008 Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Application Interface
- *
- *
- * application->getPublicInfoById('123');
- * echo 'Canvas name of the app is: ' . $app->canvas_name . ' ';
- * ?>
- *
- *
- * @category Services
- * @package Services_Facebook
- * @author Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Application extends Services_Facebook_Common
-{
- /**
- * Get the public information of an application by it's ID
- *
- * @param string $id Application ID to get info of
- *
- * @return object SimpleXMLObject of the public info
- *
- * @link http://wiki.developers.facebook.com/index.php/Application.getPublicInfo
- **/
- public function getPublicInfoById($id)
- {
- return $this->callMethod('application.getPublicInfo', array(
- 'application_id' => $id
- ));
-
- }
-
- /**
- * Get the public information of an application by it's API key
- *
- * @param string $api_key Application API key to get the info of
- *
- * @return object SimpleXMLObject of the public info
- *
- * @link http://wiki.developers.facebook.com/index.php/Application.getPublicInfo
- **/
- public function getPublicInfoByAPIKey($api_key)
- {
- return $this->callMethod('application.getPublicInfo', array(
- 'application_api_key' => $api_key
- ));
- }
-
- /**
- * Get the public information of an application by it's canvas name
- *
- * @param string $canvas_name Application's canvas name
- *
- * @return object SimpleXMLObject of the public info
- *
- * @link http://wiki.developers.facebook.com/index.php/Application.getPublicInfo
- **/
- public function getPublicInfoByCanvasName($canvas_name)
- {
- return $this->callMethod('application.getPublicInfo', array(
- 'application_canvas_name' => $canvas_name
- ));
-
- }
-
-}
diff --git a/db/library/facebook_stream/Services/Facebook/Auth.php b/db/library/facebook_stream/Services/Facebook/Auth.php
deleted file mode 100644
index f30f680..0000000
--- a/db/library/facebook_stream/Services/Facebook/Auth.php
+++ /dev/null
@@ -1,138 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Authentication Interface
- *
- *
- * auth->getSession($_GET['auth_token']);
- * echo 'uid: ' . (string)$session->uid . ' ';
- * echo 'session_key: ' . (string)$session->session_key . ' ';
- * ?>
- *
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @author Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Auth extends Services_Facebook_Common
-{
- /**
- * Create a token for login
- *
- * @return string
- */
- public function createToken()
- {
- $result = $this->callMethod('auth.createToken');
- return (string)$result;
- }
-
- /**
- * Convert auth_token into a session_key
- *
- * @param string $authToken auth_token from callback
- *
- * @return object SimpleXmlElement of response
- */
- public function getSession($authToken)
- {
- return $this->callMethod('auth.getSession', array(
- 'auth_token' => $authToken
- ));
- }
-
- /**
- * Promote session
- *
- * Creates a temporary session secret for the current (non-infinite)
- * session of a Web application. This session secret will not be used in
- * the signature for the server-side component of an application, it is
- * only meant for use by the application which additionally want to use
- * a client side component. (e.g. Javascript Client Library)
- *
- * @access public
- * @return void
- */
- public function promoteSession()
- {
- $result = (string) $this->callMethod('auth.promoteSession');
- return $result;
- }
-
- /**
- * Expire session
- *
- * Invalidates the current session being used, regardless of whether it
- * is temporary or infinite. After successfully calling this function, no
- * further API calls requiring a session will succeed using this session.
- * If the invalidation is successful, this will return true.
- *
- * @access public
- * @return void
- */
- public function expireSession()
- {
- $result = $this->callMethod('auth.expireSession');
- return (intval((string) $result) == 1);
- }
-
- /**
- * Revoke authorization
- *
- * If this method is called for the logged in user, then no further API
- * calls can be made on that user's behalf until the user decides to
- * authorize the application again.
- *
- * @param string $uid User's id
- *
- * @access public
- * @return void
- */
- public function revokeAuthorization($uid = null)
- {
- $args = array();
- if (isset($this->sessionKey)) {
- $args['session_key'] = $this->sessionKey;
- }
-
- if ($uid !== null) {
- $args['uid'] = $uid;
- }
-
- $result = $this->callMethod('auth.revokeAuthorization', $args);
- return (intval($result) == 1);
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Batch.php b/db/library/facebook_stream/Services/Facebook/Batch.php
deleted file mode 100644
index 0b5b17b..0000000
--- a/db/library/facebook_stream/Services/Facebook/Batch.php
+++ /dev/null
@@ -1,193 +0,0 @@
-
- * @copyright 2009 Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Batch Interface
- *
- *
- * $batch = new Services_Facebook_Batch;
- * $batch->sessionKey = 'fooo';
- * $batch->addCall('restriction', 'admin.getRestrictionInfo');
- * $batch->addCall('friends', 'friends.get', array('uid' => 683226814));
- * $batch->addCall('areFriends', 'friends.areFriends', array('uid1' => 617370918, 'uid2' => 683226814));
- * $batch->run();
- *
- * var_dump($batch['friends']);
- * ?>
- *
- *
- * @category Services
- * @package Services_Facebook
- * @author Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Batch
-extends Services_Facebook_Common
-implements ArrayAccess
-{
-
- /**
- * Calls
- *
- * @var array $calls Calls that will be batched
- */
- protected $calls = array();
-
- /**
- * Results
- *
- * @var array $results Name value pair of results
- */
- protected $results = array();
-
- /**
- * Add call
- *
- * Adds a call to be batched.
- *
- * @param mixed $name Name of the result
- * @param mixed $endpoint Facebook API endpoint. e.g. friends.get
- * @param array $args Arguments for the API call
- *
- * @return void
- * @see Services_Facebook_Batch::run()
- */
- public function addCall($name, $endpoint, $args = array())
- {
- $this->calls[] = array(
- 'name' => $name,
- 'endpoint' => $endpoint,
- 'args' => $args
- );
- }
-
- /**
- * Run
- *
- * Run the calls that were added via Services_Facebook_Batch::addCall()
- * in a batch. If successful the results are stored.
- *
- * @param mixed $serial If true, calls will be ran in order on
- * on Facebook's side.
- *
- * @return void
- * @see Services_Facebook_Batch::addCall()
- * @link http://wiki.developers.facebook.com/index.php/Batch.run
- */
- public function run($serial = false)
- {
- if (empty($this->calls)) {
- return;
- }
-
- $methodFeed = array();
- foreach ($this->calls as $call) {
- $this->updateArgs($call['args'], $call['endpoint']);
- $methodFeed[] = http_build_query($call['args']);
- }
-
- $args = array(
- 'method_feed' => json_encode($methodFeed),
- 'serial_only' => ($serial) ? 'true' : 'false',
- 'session_key' => $this->sessionKey
- );
-
- $result = $this->callMethod('batch.run', $args);
-
- $exception = false;
- for ($i = 0; $i < count($this->calls); $i++) {
- $name = $this->calls[$i]['name'];
- $response = $result->batch_run_response_elt[$i];
- $response = simplexml_load_string((string) $response);
- $this->results[$name] = $response;
- }
- }
-
- /**
- * Get results
- *
- * @return array Results from the batch
- */
- public function getResults()
- {
- return $this->results;
- }
-
- /**
- * Offset exists
- *
- * @param string $offset Offset to check
- *
- * @return bool If element exists
- */
- public function offsetExists($offset)
- {
- return isset($this->results[$offset]);
- }
-
- /**
- * Offset get
- *
- * @param mixed $offset Offset to get
- *
- * @return SimpleXMLElement Result
- */
- public function offsetGet($offset)
- {
- return $this->results[$offset];
- }
-
- /**
- * Offset set
- *
- * We do not allow the batch results to be modified.
- *
- * @param mixed $offset Offset to set
- * @param mixed $value Value to set
- *
- * @return void
- * @throws Services_Facebook_Exception
- */
- public function offsetSet($offset, $value)
- {
- throw new Services_Facebook_Exception('You can not change the ' .
- 'batch results!');
- }
-
- /**
- * Offset unset
- *
- * @param mixed $offset Offset to unset
- *
- * @return void
- */
- public function offsetUnset($offset)
- {
- unset($this->results[$offset]);
- }
-
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Common.php b/db/library/facebook_stream/Services/Facebook/Common.php
deleted file mode 100644
index b12bf41..0000000
--- a/db/library/facebook_stream/Services/Facebook/Common.php
+++ /dev/null
@@ -1,285 +0,0 @@
-
- * @author Jeff Hodsdon
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook.php';
-require_once 'Services/Facebook/Exception.php';
-require_once 'Validate.php';
-
-/**
- * Common class for all Facebook interfaces
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @author Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-abstract class Services_Facebook_Common
-{
- /**
- * URI of Facebook's REST API
- *
- * @var string $api
- */
- protected $api = '';
-
- /**
- * Version of the API to use
- *
- * @var string $version
- */
- protected $version = '1.0';
-
- /**
- * Currently logged in user
- *
- * @var string $sessionKey
- */
- public $sessionKey = '';
-
- /**
- * Use secret as session secret or not
- *
- * @var bool $useSessionSecret
- */
- public $useSessionSecret = false;
-
- /**
- * Construct
- *
- * Construct. Set API URL, something that may change per driver.
- *
- * @return void
- */
- public function __construct()
- {
- $this->setAPI(Services_Facebook::$apiURL);
- }
-
- /**
- * Call method
- *
- * Used by all of the interface classes to send a request to the Facebook
- * API. It builds the standard argument list, munges that with the
- * arguments passed to it, signs the request and sends it along to the
- * API.
- *
- * Once the request has taken place the cURL response is checked to make
- * sure no low level HTTP errors occurred, the XML is parsed using
- * SimpleXml and then checked for Facebook errors.
- *
- * Any formal error encountered is thrown as an exception.
- *
- * @param mixed $method Method to call
- * @param array $args Arguments to send
- *
- * @return mixed Result
- */
- public function callMethod($method, array $args = array())
- {
- $this->updateArgs($args, $method);
-
- $response = $this->sendRequest($args);
- $result = $this->parseResponse($response);
-
- return $result;
- }
-
- /**
- * Send a request to the API
- *
- * @param array $args API arguments passed as GET args
- *
- * @return object Response as an instance of SimleXmlElement
- * @throws Services_Facebook_Exception
- */
- protected function sendRequest(array $args)
- {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $this->api);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_TIMEOUT, Services_Facebook::$timeout);
- curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, Services_Facebook::$useDnsCache);
- $response = curl_exec($ch);
-
- if (curl_errno($ch)) {
- throw new Services_Facebook_Exception(
- curl_error($ch), curl_errno($ch), $args['method'], $this->api
- );
- }
-
- curl_close($ch);
-
- return $response;
- }
-
- /**
- * parseResponse
- *
- * Parses the raw response from Facebook
- *
- * @param mixed $response Response xml
- *
- * @return string Parsed response
- */
- protected function parseResponse($response)
- {
- $xml = simplexml_load_string($response);
- if (!$xml instanceof SimpleXmlElement) {
- throw new Services_Facebook_Exception(
- 'Could not parse XML response', 0, $this->api
- );
- }
-
- $error = $this->checkRequest($xml);
- if (is_array($error) && count($error)) {
- throw new Services_Facebook_Exception($error['message'],
- $error['code'], $this->api);
- }
-
- return $xml;
- }
-
- /**
- * Update arguments
- *
- * Updates the arguments with api_key, version, etc. Then
- * signs it.
- *
- * @param array &$args Arguments being sent
- * @param mixed $method Method being called
- *
- * @return void
- */
- protected function updateArgs(array &$args, $method)
- {
- $args['api_key'] = Services_Facebook::$apiKey;
- $args['v'] = $this->version;
- $args['format'] = 'XML';
- $args['method'] = $method;
- $args['call_id'] = microtime(true);
- $args = $this->signRequest($args);
- }
-
- /**
- * Sign the request
- *
- * @param array $args Arguments for the request to be signed
- *
- * @return array Arguments with the appropriate sig added
- * @see Services_Facebook::$secret
- */
- protected function signRequest(array $args)
- {
- if (isset($args['sig'])) {
- unset($args['sig']);
- }
-
- if ($this->useSessionSecret) {
- $args['ss'] = 1;
- }
-
- ksort($args);
-
- $sig = '';
- foreach ($args as $k => $v) {
- $sig .= $k .'=' . $v;
- }
-
- $sig .= Services_Facebook::$secret;
- $args['sig'] = md5($sig);
- return $args;
- }
-
- /**
- * Check if request resulted in an error
- *
- * @param object $xml Instance of SimpleXmlElement
- *
- * @return Array with code/message or false if no error is present
- */
- protected function checkRequest($xml)
- {
- $message = null;
- $code = 0;
- switch ($this->version) {
- case '1.0':
- if (isset($xml->error_code)) {
- $code = (int)$xml->error_code;
- }
-
- if (isset($xml->error_msg)) {
- $message = $xml->error_msg;
- }
- break;
- default:
- if (isset($xml->fb_error->code)) {
- $code = (int)$xml->fb_error->code;
- }
-
- if (isset($xml->fb_error->msg)) {
- $message = $xml->fb_error->msg;
- }
- break;
- }
-
- if ($code > 0 || !is_null($message)) {
- return array('code' => $code, 'message' => $message);
- }
-
- return false;
- }
-
- /**
- * Get API
- *
- * @return string API url
- */
- public function getAPI()
- {
- return $this->api;
- }
-
- /**
- * Set API
- *
- * @param mixed $api Api url to set
- *
- * @return void
- */
- public function setAPI($api)
- {
- if (!Validate::uri($api)) {
- throw new Services_Facebook_Exception('Invalid API: ' . $api);
- }
-
- $this->api = $api;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Connect.php b/db/library/facebook_stream/Services/Facebook/Connect.php
deleted file mode 100644
index fbcf29b..0000000
--- a/db/library/facebook_stream/Services/Facebook/Connect.php
+++ /dev/null
@@ -1,234 +0,0 @@
-
- * @author Bill Shupp
- * @copyright 2007-2008 Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-require_once 'Services/Facebook/Exception.php';
-require_once 'Validate.php';
-
-/**
- * Facebook Application Interface
- *
- *
- * connect->('');
- * ?>
- *
- *
- * @category Services
- * @package Services_Facebook
- * @author Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Connect extends Services_Facebook_Common
-{
-
- /**
- * Construct
- *
- * Various tasks that should be ran before non-static methods
- *
- * @access public
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
-
- if (!function_exists('json_encode')) {
- throw new Services_Facebook_Exception('PHP Function ' .
- 'json_encode() is required for Services_Facebook_Connect ' .
- ' methods.');
- }
- }
-
- /**
- * Unconnected Friends Count
- *
- * Get the amount of users friends that have not connected their account
- * to your site. NOTE: These are users that you have sent connect.registerUser
- * information.
- *
- * @access public
- * @return int Amount of users
- */
- public function getUnconnectedFriendsCount()
- {
- $result = $this->callMethod('connect.getUnconnectedFriendsCount', array(
- 'session_key' => $this->sessionKey
- ));
-
- return (int) $result;
- }
-
- /**
- * Register Users
- *
- * The accounts array may hold up to 1,000 accounts. Each account should hold
- * these array keys: (account_id and account_url are optional)
- *
- *
- *
- * // Hash the emails
- * $hash1 = Services_Facebook_Connect::hashEmail('joe@example.com');
- * $hash2 = Services_Facebook_Connect::hashEmail('jeff@example.com');
- *
- * $accounts = array();
- *
- * $accounts[] = array(
- * 'email_hash' => $hash1,
- * 'account_id' => 12345678,
- * 'account_url' => 'http://example.com/users?id=12345678'
- * )
- *
- * $accounts[] = array(
- * 'email_hash' => $hash2,
- * )
- *
- * $connect = Services_Facebook::factory('Connect');
- * $result = $connect->registerUsers($accounts);
- *
- *
- * @param array $accounts Information about accounts
- *
- * @access public
- * @throws Services_Facebook_Exception If emash_hash is missing or
- * another field was passed in that is not supported.
- * @return object SimpleXML object from callMethod()
- */
- public function registerUsers(array $accounts)
- {
- $fields = array(
- 'email_hash',
- 'account_id',
- 'account_url'
- );
-
- foreach ($accounts as $account) {
- if (empty($account['email_hash'])) {
- throw new Services_Facebook_Exception('email_hash is ' .
- 'required in each account map passed to ' .
- 'Services_Facebook_Connect::registerUsers()');
- }
-
- $keys = array_keys($account);
- foreach ($keys as $key) {
- if (!in_array($key, $fields)) {
- throw new Services_Facebook_Exception('Field ' . $key .
- ' is not supported.');
- }
- }
- }
-
- $result = $this->callMethod('connect.registerUsers', array(
- 'accounts' => json_encode($accounts)
- ));
-
- $hashes = array();
- foreach ($result->connect_registerUsers_response_elt as $hash) {
- $hashes[] = (string) $hash;
- }
-
- return $hashes;
- }
-
- /**
- * unregisterUsers
- *
- * This method allows a site to unregister a connected account. You should
- * call this method if the user deletes his account on your site.
- *
- *
- *
- * $hashes = array();
- * $hashes[] = Services_Facebook_Connect::hashEmail('joe@example.com');
- * $hashes[] = Services_Facebook_Connect::hashEmail('jeff@example.com');
- *
- * $connect = new Services_Facebook::factory('Connect');
- * $result = $connect->unregisterUsers($hashes);
- *
- *
- * @param array $emailHashes An array of email_hashes to unregister
- *
- * @access public
- * @throws Services_Facebook_Exception if json_decode() is not available
- * @return object SimpleXML object from callMethod()
- */
- public function unregisterUsers(array $emailHashes)
- {
- $result = $this->callMethod('connect.unregisterUsers', array(
- 'email_hashes' => json_encode($emailHashes)
- ));
-
- return (intval((string) $result) == 1);
- }
-
- /**
- * hashEmail
- *
- * @param string $email Email to hash
- *
- * @static
- * @access public
- * @return string Hashed email address
- * @throws Services_Facebook_Exception
- * @see http://www.php.net/crc32
- * @see http://www.php.net/md5
- */
- static public function hashEmail($email)
- {
- if (!Validate::email($email)) {
- throw new Services_Facebook_Exception('Invalid email address passed to'
- . ' Services_Facebook_Connect::hashEmail()');
- }
-
- $email = strtolower(trim($email));
- $crc32 = sprintf("%u", crc32($email));
- $md5 = md5($email);
-
- return $crc32 . '_' . $md5;
- }
-
- /**
- * hashEmails
- *
- * @param array $emails Emails to hash
- *
- * @static
- * @access public
- * @return array Hashed emails
- */
- static public function hashEmails(array $emails)
- {
- foreach ($emails as &$email) {
- $email = self::hashEmail($email);
- }
-
- return $emails;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Data.php b/db/library/facebook_stream/Services/Facebook/Data.php
deleted file mode 100644
index c2f953f..0000000
--- a/db/library/facebook_stream/Services/Facebook/Data.php
+++ /dev/null
@@ -1,257 +0,0 @@
-_prefix . $method, $args);
- }
-
- public function getUserPreference($pref_id)
- {
- return $this->callMethod('getUserPreference', array(
- 'pref_id' => (int)$pref_id,
- ));
- }
-
- public function getUserPreferences()
- {
- return $this->callMethod('getUserPreferences');
- }
-
- public function setUserPreference($pref_id, $value)
- {
- return $this->callMethod(
- 'setUserPreference',
- array(
- 'pref_id' => $pref_id,
- 'value' => $value,
- )
- );
- }
-
- public function setUserPreferences()
- {
- throw new Services_Facebook_Exception('not yet implemented');
- }
-
- public function createObjectType($name) {
- return $this->callMethod(
- 'createObjectType',
- array(
- 'name' => $name,
- )
- );
- }
-
- public function dropObjectType($obj_type) {
- return $this->callMethod(
- 'dropObjectType',
- array(
- 'obj_type' => $obj_type,
- )
- );
- }
-
- public function renameObjectType($obj_type, $new_name) {
- return $this->callMethod(
- 'renameObjectType',
- array(
- 'obj_type' => $obj_type,
- 'new_name' => $new_name,
- )
- );
- }
-
- public function defineObjectProperty($obj_type, $prop_name, $prop_type) {
- // todo refactor into its own testable object
- if (is_int($prop_type)) {
- if (!($prop_type >= 1 && $prop_type <= 3)) {
- throw new Services_Facebook_Exception('prop_type is an invalid integer: ' . $prop_type);
- }
- } else {
- $const_name = 'self::_PROP_TYPE_' . strtoupper($prop_type);
- var_dump($const_name);
- if (!defined($const_name)) {
- throw new Services_Facebook_Exception('prop_type is not a valid string: ' . $prop_type);
- }
- $prop_type = constant($const_name);
- }
-
- return $this->callMethod(
- 'defineObjectProperty',
- array(
- 'obj_type' => $obj_type,
- 'prop_name' => $prop_name,
- 'prop_type' => $prop_type,
- )
- );
- }
-
- public function undefineObjectProperty($obj_type, $prop_name) {
- return $this->callMethod(
- 'undefineObjectProperty',
- array(
- 'obj_type' => $obj_type,
- 'prop_name' => $prop_name,
- )
- );
- }
-
- public function renameObjectProperty($obj_type, $prop_name, $new_name) {
- return $this->callMethod(
- 'renameObjectProperty',
- array(
- 'obj_type' => $obj_type,
- 'prop_name' => $prop_name,
- 'new_name' => $new_name,
- )
- );
- }
-
- public function getObjectTypes() {
- return $this->callMethod('getObjectTypes');
- }
-
- public function getObjectType($obj_type) {
- return $this->callMethod(
- 'getObjectType',
- array(
- 'obj_type' => $obj_type,
- )
- );
- }
-
- public function createObject($obj_type, array $properties = array()) {
- $args = array(
- 'obj_type' => $obj_type,
- );
- if (count($properties) > 0) {
- $args['properties'] = json_encode($properties);
- }
-
- return $this->callMethod('createObject', $args);
- }
-
- public function updateObject($obj_id, array $properties, $replace) {
- return $this->callMethod(
- 'updateObject',
- array(
- 'obj_id' => $obj_id,
- 'properties' => json_encode($properties),
- 'replace' => $replace ? 1 : 0,
- )
- );
- }
-
- public function deleteObject($obj_id) {
- return $this->callMethod(
- 'deleteObject',
- array(
- 'obj_id' => $obj_id,
- )
- );
- }
-
- public function deleteObjects(array $obj_ids) {
- return $this->callMethod(
- 'deleteObjects',
- array(
- 'obj_ids' => json_encode($obj_ids),
- )
- );
- }
-
- public function getObject($obj_id, array $properties = array()) {
- if (count($properties) > 0) {
- throw new Services_Facebook_Exception('filtering by property name doesnot seem to work...');
- }
- $args = array(
- 'obj_id' => $obj_id,
- );
- if (count($properties) > 0) {
- $args['properties'] = json_encode($properties);
- }
- return $this->callMethod('getObject', $args);
- }
-
- public function getObjects(array $obj_ids, array $properties = array()) {
- $args = array(
- 'obj_ids' => json_encode($obj_ids),
- );
- if (count($properties) > 0) {
- $args['properties'] = json_encode($properties);
- }
-
- return $this->callMethod('getObjects', $args);
- }
-
- public function getObjectProperty($obj_id, $prop_name) {
- return $this->callMethod(
- 'getObjectProperty',
- array(
- 'obj_id' => $obj_id,
- 'prop_name' => $prop_name,
- )
- );
- }
-
- public function setObjectProperty($obj_id, $prop_name, $prop_value) {
- return $this->callMethod(
- 'setObjectProperty',
- array(
- 'obj_id' => $obj_id,
- 'prop_name' => $prop_name,
- 'prop_value' => $prop_value,
- )
- );
- }
-
- public function getHashValue() {
- throw new Services_Facebook_Exception(__METHOD__ . ' not yet implemented');
- }
-
- public function setHashValue() {
- throw new Services_Facebook_Exception(__METHOD__ . ' not yet implemented');
- }
-
- public function incHashValue() {
- throw new Services_Facebook_Exception(__METHOD__ . ' not yet implemented');
- }
-
- public function removeHashKey() {
- throw new Services_Facebook_Exception(__METHOD__ . ' not yet implemented');
- }
-
- public function removeHashKeys() {
- throw new Services_Facebook_Exception(__METHOD__ . ' not yet implemented');
- }
-}
-
diff --git a/db/library/facebook_stream/Services/Facebook/Events.php b/db/library/facebook_stream/Services/Facebook/Events.php
deleted file mode 100644
index 6bca41e..0000000
--- a/db/library/facebook_stream/Services/Facebook/Events.php
+++ /dev/null
@@ -1,158 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Events Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Events extends Services_Facebook_Common
-{
- /**
- * Get events based on multiple query terms
- *
- * @param array $params Various terms to query by
- *
- * @return object SimpleXmlElement
- */
- public function get(array $params)
- {
- static $rsvp = array(
- 'attending', 'unsure', 'declined', 'not_replied'
- );
-
- $args = array('session_key' => $this->sessionKey);
-
- if (isset($params['uid'])) {
- $args['uid'] = intval($params['uid']);
- }
-
- if (isset($params['eids'])) {
- if (is_array($params['eids'])) {
- if (count($params['eids'])) {
- $eids = array();
- foreach ($params['eids'] as $eid) {
- $eids[] = intval($eid);
- }
-
- $params['eids'] = implode(',', $eids);
- }
- } else {
- $args['eids'] = intval($params['eids']);
- }
- }
-
- if (isset($params['start_time'])) {
- $args['start_time'] = intval($params['start_time']);
- }
-
- if (isset($params['end_time'])) {
- $args['end_time'] = intval($params['end_time']);
- }
-
- if (isset($params['rsvp_status']) &&
- in_array($params['rsvp_status'], $rsvp)) {
- $args['rsvp_status'] = $params['rsvp_status'];
- }
-
- return $this->callMethod('events.get', $args);
- }
-
- /**
- * Get events by event ID
- *
- * @param mixed $eid Array of eid's or single eid
- *
- * @return object SimpleXmlElement
- */
- public function getEvents($eid)
- {
- if (is_array($eid)) {
- $eid = implode(',', $eid);
- }
-
- return $this->callMethod('events.get', array(
- 'session_key' => $this->sessionKey,
- 'eid' => $eid
- ));
- }
-
- /**
- * Get events for a given user
- *
- * @param int $uid User ID to fetch events for
- *
- * @return SimpleXmlElement
- */
- public function getEventsByUser($uid)
- {
- return $this->callMethod('events.get', array(
- 'session_key' => $this->sessionKey,
- 'uid' => $uid
- ));
- }
-
- /**
- * Get events by date range
- *
- * Use UNIX timestamps to fetch events within a given date/time range. A
- * value of 0 indicates no upper or lower boundary.
- *
- * @param int $start UNIX timestamp of start time
- * @param int $end UNIX timestamp of end time
- *
- * @return object SimpleXmlElement
- */
- public function getEventsByDate($start, $end)
- {
- return $this->callMethod('events.get', array(
- 'session_key' => $this->sessionKey,
- 'start' => $start,
- 'end' => $end
- ));
- }
-
- /**
- * Get members of event
- *
- * @param int $eid Event ID to fetch members of
- *
- * @return object SimpleXmlElement of users attending, etc.
- * @link http://wiki.developers.facebook.com/index.php/Events.getMembers
- */
- public function getMembers($eid)
- {
- return $this->callMethod('events.getMembers', array(
- 'session_key' => $this->sessionKey,
- 'eid' => $eid
- ));
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Exception.php b/db/library/facebook_stream/Services/Facebook/Exception.php
deleted file mode 100644
index 4d2bb1e..0000000
--- a/db/library/facebook_stream/Services/Facebook/Exception.php
+++ /dev/null
@@ -1,74 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-/**
- * Services_Facebook_Exception
- *
- * All calls to the API can result in a few different errors; an HTTP error,
- * an API error or some other random cURL error. In all cases the package will
- * throw a Services_Facebook_Exception.
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Exception extends Exception
-{
- /**
- * Last API call
- *
- * This is the URI of the API call that generated the error. The error
- * message and code from the error is passed as well.
- *
- * @var string $lastCall URI of last API call
- */
- protected $lastCall = '';
-
- /**
- * Constructor
- *
- * @param string $message The exception's message/info
- * @param int $code The error code for the exception
- * @param string $lastCall URI of last API call
- */
- public function __construct($message, $code = 0, $lastCall = '')
- {
- parent::__construct($message, $code);
- $this->lastCall = $lastCall;
- }
-
- /**
- * Returns last API call
- *
- * @return string
- * @see Services_Facebook_Exception::$lastCall
- */
- public function getLastCall()
- {
- return $this->lastCall;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/FBML.php b/db/library/facebook_stream/Services/Facebook/FBML.php
deleted file mode 100644
index 433c9c2..0000000
--- a/db/library/facebook_stream/Services/Facebook/FBML.php
+++ /dev/null
@@ -1,99 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook FBML Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_FBML extends Services_Facebook_Common
-{
- /**
- * Refresh an image cache
- *
- * Facebook caches images from your application. If you want Facebook to
- * refresh your image's cache use this URL to tell Facebook to re-request
- * and re-cache your image.
- *
- * @param string $url URL of image to refresh
- *
- * @return boolean
- */
- public function refreshImgSrc($url)
- {
- $result = $this->callMethod('fbml.refreshImgSrc', array(
- 'session_key' => $this->sessionKey,
- 'url' => $url
- ));
-
- $check = intval((string)$result);
- return ($check == 1);
- }
-
- /**
- * Fetches and re-caches the content stored at the given URL
- *
- * @param string $url The absolute URL from which to fetch content.
- *
- * @return boolean
- */
- public function refreshRefUrl($url)
- {
- $result = $this->callMethod('fbml.refreshRefUrl', array(
- 'session_key' => $this->sessionKey,
- 'url' => $url
- ));
-
- $check = intval((string)$result);
- return ($check == 1);
- }
-
- /**
- * Associates a given "handle" with FBML markup
- *
- * @param string $handle The handle to associate with the given FBML
- * @param string $fbml The FBML to associate with the given handle
- *
- * @return boolean
- * @link http://wiki.developers.facebook.com/index.php/Fbml.setRefHandle
- */
- public function setRefHandle($handle, $fbml)
- {
- $result = $this->callMethod('fbml.setRefHandle', array(
- 'session_key' => $this->sessionKey,
- 'handle' => $handle,
- 'fbml' => $fbml
- ));
-
- $check = intval((string)$result);
- return ($check == 1);
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/FQL.php b/db/library/facebook_stream/Services/Facebook/FQL.php
deleted file mode 100644
index ea26c35..0000000
--- a/db/library/facebook_stream/Services/Facebook/FQL.php
+++ /dev/null
@@ -1,74 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook FQL (Facebook Query Language) Interface
- *
- * Facebook allows you to generically query data from their API in an SQL-like
- * interface that they call FQL. This class allows you to send a raw query to
- * the API and get a raw XML response back in the form of a SimpleXmlElement.
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_FQL extends Services_Facebook_Common
-{
- /**
- * Send a FQL query
- *
- * Senda a query to the Facebook API and returns the response in the form
- * for a SimpleXmlElement.
- *
- *
- * query($fql);
- * foreach ($result->user as $user) {
- * echo (string)$user->first_name;
- * }
- * ?>
- *
- *
- * @param string $query FQL query string
- *
- * @return object Instance of SimpleXMLElement
- */
- public function query($query)
- {
- return $this->callMethod('fql.query', array(
- 'session_key' => $this->sessionKey,
- 'query' => $query
- ));
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Feed.php b/db/library/facebook_stream/Services/Facebook/Feed.php
deleted file mode 100644
index 537dead..0000000
--- a/db/library/facebook_stream/Services/Facebook/Feed.php
+++ /dev/null
@@ -1,454 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Feed Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Feed extends Services_Facebook_Common
-{
- /**
- * Publish a story to a user's feed
- *
- * The $images array should be a numerically indexed array of arrays, where
- * each image has two keys: src and href. The src is the full URI of the
- * image and the href is the link of that image.
- *
- *
- * 'http://example.com/images1.jpg',
- * 'href' => 'http://example.com/images.php?image=1'),
- * array('src' => 'http://example.com/images2.jpg',
- * 'href' => 'http://example.com/images.php?image=2'),
- * array('src' => 'http://example.com/images3.jpg',
- * 'href' => 'http://example.com/images.php?image=3')
- * );
- * ?>
- *
- *
- * @param string $title FBML to post as story title
- * @param string $body FBML to post as story body
- * @param array $images Images to post to story entry
- *
- * @return boolean
- *
- * @link http://wiki.developers.facebook.com/index.php/Feed.publishStoryToUser
- * @link http://wiki.developers.facebook.com/index.php/PublishActionOfUser_vs._PublishStoryToUser
- */
- public function publishStoryToUser($title,
- $body = '',
- array $images = array())
- {
- $args = array(
- 'title' => $title,
- 'session_key' => $this->sessionKey
- );
-
- if (strlen($body)) {
- $args['body'] = $body;
- }
-
- if (count($images)) {
- // Facebook only allows four images so don't send more than that.
- $cnt = count($images);
- if ($cnt > 4) {
- $cnt = 4;
- }
-
- for ($i = 0 ; $i < $cnt ; $i++) {
- $n = ($i + 1);
- $args['image_' . $n] = $images[$i]['src'];
- if (isset($images[$i]['href'])) {
- $args['image_' . $n . '_link'] = $images[$i]['href'];
- } else {
- $args['image_' . $n . '_link'] = $images[$i]['src'];
- }
- }
- }
-
- $result = $this->callMethod('feed.publishStoryToUser', $args);
- $check = intval((string)$result->feed_publishStoryToUser_response_elt);
- return ($check == 1);
- }
-
- /**
- * Publish an action to a user's feed
- *
- * An action differs from a story in that a user's action is sent to all
- * of that user's friends as well.
- *
- * The $images array should be a numerically indexed array of arrays, where
- * each image has two keys: src and href. The src is the full URI of the
- * image and the href is the link of that image.
- *
- *
- * 'http://example.com/images1.jpg',
- * 'href' => 'http://example.com/images.php?image=1'),
- * array('src' => 'http://example.com/images2.jpg',
- * 'href' => 'http://example.com/images.php?image=2'),
- * array('src' => 'http://example.com/images3.jpg',
- * 'href' => 'http://example.com/images.php?image=3')
- * );
- * ?>
- *
- *
- * @param string $title FBML to post as story title
- * @param string $body FBML to post as story body
- * @param array $images Images to post to story entry
- *
- * @return boolean
- *
- * @link http://wiki.developers.facebook.com/index.php/Feed.publishActionOfUser
- * @link http://wiki.developers.facebook.com/index.php/PublishActionOfUser_vs._PublishStoryToUser
- */
- public function publishActionOfUser($title,
- $body = '',
- array $images = array())
- {
- $args = array(
- 'title' => $title,
- 'session_key' => $this->sessionKey
- );
-
- if (strlen($body)) {
- $args['body'] = $body;
- }
-
- if (count($images)) {
- // Facebook only allows four images so don't send more than that.
- $cnt = count($images);
- if ($cnt > 4) {
- $cnt = 4;
- }
-
- for ($i = 0 ; $i < $cnt ; $i++) {
- $n = ($i + 1);
- $args['image_' . $n] = $images[$i]['src'];
- if (isset($images[$i]['href'])) {
- $args['image_' . $n . '_link'] = $images[$i]['href'];
- } else {
- $args['image_' . $n . '_link'] = $images[$i]['src'];
- }
- }
- }
-
- $result = $this->callMethod('feed.publishActionOfUser', $args);
- $check = intval((string)$result->feed_publishActionOfUser_response_elt);
- return ($check == 1);
- }
-
- /**
- * Publish a templatized action to a user's feed
- *
- * An action differs from a story in that a user's action is sent to all
- * of that user's friends as well.
- *
- * An templatized story publishes News Feed stories to the friends of that user.
- * These stories or more likely to appear to the friends of that user depending
- * upon a variety of factors, such as the closeness of the relationship between
- * the users, the interaction data facebook has about that particular story type,
- * and the quality of the content in the story/on the linked page.
- * http://wiki.developers.facebook.com/index.php/FeedRankingFAQ
- *
- * The $images array should be a numerically indexed array of arrays, where
- * each image has two keys: src and href. The src is the full URI of the
- * image and the href is the link of that image.
- *
- *
- * 'http://example.com/images1.jpg',
- * 'href' => 'http://example.com/images.php?image=1'),
- * array('src' => 'http://example.com/images2.jpg',
- * 'href' => 'http://example.com/images.php?image=2'),
- * array('src' => 'http://example.com/images3.jpg',
- * 'href' => 'http://example.com/images.php?image=3')
- * );
- * ?>
- *
- *
- * @param string $titleTemplate FBML to post as the title, must contain {actor}
- * @param array $feedData Array containing optional Feed template, data, and/or actor id
- * @param array $images Images to post to story entry
- *
- * @return boolean
- *
- * @author Jeff Hodsdon
- * @link http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction
- */
- public function publishTemplatizedAction($titleTemplate,
- array $feedData = array(),
- array $images = array())
- {
- $args = array(
- 'title_template' => $titleTemplate,
- 'session_key' => $this->sessionKey
- );
-
- static $options = array('title_data', 'body_template', 'body_data',
- 'body_general', 'page_actor_id');
-
- foreach ($options as $opt) {
- if (isset($feedData[$opt]) && strlen($feedData[$opt])) {
- $args[$opt] = $feedData[$opt];
- }
- }
-
- if (count($images)) {
- // Facebook only allows four images so don't send more than that.
- $cnt = count($images);
- if ($cnt > 4) {
- $cnt = 4;
- }
-
- for ($i = 0 ; $i < $cnt ; $i++) {
- $n = ($i + 1);
- $args['image_' . $n] = $images[$i]['src'];
- if (isset($images[$i]['href'])) {
- $args['image_' . $n . '_link'] = $images[$i]['href'];
- } else {
- $args['image_' . $n . '_link'] = $images[$i]['src'];
- }
- }
- }
-
- $result = $this->callMethod('feed.publishTemplatizedAction', $args);
- return (intval((string)$result) == 1);
- }
-
- /**
- * Builds a template bundle around the specified templates, registers them
- * on Facebook, and responds with a template bundle ID that can be used
- * to identify your template bundle to other Feed-related API calls.
- *
- * A template bundle consists of:
- * - an array of one line story templates
- * - an array of short story templates
- * - a single full story template
- *
- * Each array consists of one or more templates, and each template consists
- * of one or more tokens (for the story actor, friends, items, and so
- * forth), some static text, and some FBML. Tokens must be wrapped in curly
- * braces and asterisks, as in {*actor*}. The {*actor*} token must appear
- * at the beginning of all one line templates and at the beginning of short
- * and full template story titles.
- *
- * The order of templates in an array is very important. In general, the
- * most flexible template should be first in the array. The most flexible
- * template has the most tokens in it. The first template will always be used
- * for feed stories. The last one-line template in the array must be the
- * least flexible of all the template in the bundle. Thus, it should include
- * only tokens that are a strict subset of all other tokens.
- *
- * When considering these templates, the first template makes for the best
- * story, but the last template has the highest aggregation potential. When
- * you publish a story using feed.publishUserAction, you're posting the
- * first version of the story to a user's Mini-Feed, and you're posting one
- * of three different stories to that users friends' News Feeds.
- *
- * Short story each consist of two parts, a template title and a template
- * body. Short stories should be passed as an array of short stories,
- * with each element being an array containing the keys 'template_title'
- * and 'template_body'
- *
- * Full story templates should be passed as an array containing keys
- * 'template_title' and 'template_body'
- *
- * Action links @see http://wiki.developers.facebook.com/index.php/Action_Links
- *
- * @access public
- * @param array $oneLineStoryTpls array of one-line story templates
- * @param array $shortStoryTpls optional array of short story templates
- * @param array $fullStoryTemplate optional full story template
- * @param array $actionLinks optional array of actoin link records
- * @return string template bundle ID of newly registered bundle
- * @link http://wiki.developers.facebook.com/index.php/Feed.registerTemplateBundle
- * @author Matthew Fonda
- */
- public function registerTemplateBundle(array $oneLineStoryTpls,
- array $shortStoryTpls = array(),
- array $fullStoryTpl = array(),
- array $actionLinks = array())
- {
- $args = array();
- if (count($oneLineStoryTpls)) {
- $args['one_line_story_templates'] = json_encode($oneLineStoryTpls);
- } else {
- throw new Services_Facebook_Exception(
- 'Feed.registerTemplateBundle requires at least one one-line story template'
- );
- }
-
- if (count($shortStoryTpls)) {
- $args['short_story_templates'] = json_encode($shortStoryTpls);
- }
-
- if (isset($fullStoryTpl['template_title'], $fullStoryTpl['template_body'])) {
- $args['full_story_template'] = json_encode($fullStoryTpl);
- }
-
- if (count($actionLinks)) {
- $args['action_links'] = json_encode($actionLinks);
- }
-
- $result = $this->callMethod('feed.registerTemplateBundle', $args);
- return (float) (string)$result;
- }
-
- /**
- * Retrieves the full list of all template bundles registered by the
- * requesting application. This does not include any template bundles
- * previously deactivated via calls to feed.deactivateTemplateBundle
- *
- * @access public
- * @return SimpleXMLElement SimpleXMLElement containing templates
- * @link http://wiki.developers.facebook.com/index.php/Feed.getRegisteredTemplateBundles
- * @author Matthew Fonda
- */
- public function getRegisteredTemplateBundles()
- {
- return $this->callMethod('feed.getRegisteredTemplateBundles');
- }
-
- /**
- * Returns information about a specified template bundle previously
- * registered by the requesting application. The result is returned
- * as a SimpleXMLElement.
- *
- * @access public
- * @param int $id ID of template bundle
- * @return SimpleXMLElement SimpleXMLElement representing the bundle
- * @link http://wiki.developers.facebook.com/index.php/Feed.getRegisteredTemplateBundleByID
- * @author Matthew Fonda
- */
- public function getRegisteredTemplateBundleByID($id)
- {
- $args = array('template_bundle_id' => $id);
- return $this->callMethod('feed.getRegisteredTemplateBundleByID', $args);
- }
-
- /**
- * Deactivates a previously registered template bundle. Once a template
- * bundle has been deactivated, it can no longer be used to publish stories
- * via feed.publishUserAction. Stories published agaisnt the template
- * bundle prior to its deactivation are still valid and will show up in the
- * Mini-Feed and News Feed. The response is true if and only if the template
- * bundle, identified by $id, is an active template bundle owned by the
- * requesting application, and is false otherwise.
- *
- * @access public
- * @param int $id ID of template bundle to deactivate
- * @return boolean
- * @link http://wiki.developers.facebook.com/index.php/Feed.deactivateTemplateBundleByID
- * @author Matthew Fonda
- */
- public function deactivateTemplateBundleByID($id)
- {
- $args = array('template_bundle_id' => $id);
- $result = $this->callMethod('feed.deactivateTemplateBundleByID', $args);
- return (intval($result) == 1);
- }
-
- /**
- * Publishes a story on behald of the user owning the session, using the
- * specified template bundle. This method requires an active session key
- * in order to be called. This method returns true if all succeeds, and
- * false of the user never authorized the application to publish to his or
- * her Mini-Feed.
- *
- * This method should be passed a template bundle ID to use, and an array
- * of template data whose keys are the tokens to replace, and values are
- * the desired replacement. 'actor' and 'target' are special tokens and
- * should not be included in this array. If one or more of the templates
- * include tokens other than 'actor' and 'targets', then this array is
- * required. This array can also include exactly one of the following keys:
- * 'images', 'flash', 'mp3', or 'video'.
- *
- * If 'images' is passed, it should map to an array of up to four images,
- * and each array should contain a key 'src', and optionally 'href'
- *
- * If 'flash' is passed, it should map to an array containing two required
- * keys: 'swfsrc', which is the URL of the flash object to be rendered, and
- * 'imgsrc', which is the URL of an image to be displayed until the users
- * clicks the flash object. Optionally, the 'flash' array can contain 'width'
- * and 'height'. The height must be an integer between 30 and 100 (inclusive),
- * and the width must be either 100, 110, or 130.
- *
- * If 'mp3' is passed, it must contain a single required field, 'src', and
- * can optionally contain 'title', 'artist', and 'album'
- *
- * If 'video' is passed, it must contain two required fields: 'video_src'
- * and 'preview_img'. The video array can also contain the following
- * optional fields: 'video_title', 'video_link', and 'video_type'.
- *
- * If the template in questions contains a 'target' token, the userIDs
- * of the target should be passed as an array, $targetIDs.
- *
- * @access public
- * @param int $templateBundleID ID of template bundle to use
- * @param array $templateData array of template data
- * @param array $targetIDs array of target IDs
- * @param string $bodyGeneral additional markup that extends the
- * body of a short story
- * @return boolean
- * @link http://wiki.developers.facebook.com/index.php/Feed.publishUserAction
- * @author Matthew Fonda
- */
- public function publishUserAction($templateBundleID,
- array $templateData = array(),
- array $targetIDs = array(),
- $bodyGeneral = ''
- )
- {
- $args = array('session_key' => $this->sessionKey,
- 'template_bundle_id' => $templateBundleID
- );
- if (count($templateData)) {
- $args['template_data'] = json_encode($templateData);
- }
-
- if (count($targetIDs)) {
- $args['target_ids'] = implode(',', $targetIDs);
- }
-
- if (strlen($bodyGeneral)) {
- $args['body_general'] = $bodyGeneral;
- }
-
- $result = $this->callMethod('feed.publishUserAction', $args);
- return (intval($result->feed_publishUserAction_response_elt) == 1);
- }
-
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Friends.php b/db/library/facebook_stream/Services/Facebook/Friends.php
deleted file mode 100644
index 5a8e254..0000000
--- a/db/library/facebook_stream/Services/Facebook/Friends.php
+++ /dev/null
@@ -1,165 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Friends Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Friends extends Services_Facebook_Common
-{
- /**
- * Are groupings of friends friends?
- *
- * If an array matrix of friend pairings is passed then a SimpleXmlElement
- * is passed back. If it's a single pairing of friends then a boolean is
- * passed back.
- *
- * @param array $uid1 First uid to check
- * @param array $uid2 Second one to see if friends with $uid1
- *
- * @return mixed Instance of SimpleXML response or boolean
- * @link http://wiki.developers.facebook.com/index.php/Friends.areFriends
- */
- public function areFriends($uid1, $uid2)
- {
- if (is_array($uid1)) {
- $uids1 = implode(',', $uid1);
- } else {
- $uids1 = $uid1;
- }
-
- if (is_array($uid2)) {
- $uids2 = implode(',', $uid2);
- } else {
- $uids2 = $uid2;
- }
-
- $res = $this->callMethod('friends.areFriends', array(
- 'session_key' => $this->sessionKey,
- 'uids1' => $uids1,
- 'uids2' => $uids2
- ));
-
- if (!is_array($uid1) && !is_array($uid2)) {
- return (intval((string)$res->friend_info->are_friends) == 1);
- }
-
- return $res;
- }
-
- /**
- * Get the current user's friends
- *
- * @param string $uid FB uid to get a friend list of
- *
- * @return array A list of uid's of current user's friends
- * @link http://wiki.developers.facebook.com/index.php/Friends.get
- */
- public function get($uid = null)
- {
- $args = array();
- if ($uid !== null) {
- $args['uid'] = (string) $uid;
- } elseif (!empty($this->sessionKey)) {
- $args['session_key'] = $this->sessionKey;
- }
-
- $result = $this->callMethod('friends.get', $args);
-
- $ret = array();
- foreach ($result->uid as $uid) {
- $ret[] = (string)$uid;
- }
-
- return $ret;
- }
-
- /**
- * Get the current user's friends by list
- *
- * @param integer $flid The friends list id to fetch
- *
- * @return array A list of uid's of a particular list from the current user
- * @author Jeff Hodsdon
- * @link http://wiki.developers.facebook.com/index.php/Friends.get
- */
- public function getByList($flid)
- {
- $result = $this->callMethod('friends.get', array(
- 'session_key' => $this->sessionKey,
- 'flid' => $flid
- ));
-
- $ret = array();
- foreach ($result->uid as $uid) {
- $ret[] = (string)$uid;
- }
-
- return $ret;
- }
-
- /**
- * Get a user's friends who are using your application
- *
- * @return array A list of Facebook uid's
- * @link http://wiki.developers.facebook.com/index.php/Friends.getAppUsers
- */
- public function getAppUsers()
- {
- $result = $this->callMethod('friends.getAppUsers', array(
- 'session_key' => $this->sessionKey
- ));
-
- $ret = array();
- foreach ($result->uid as $uid) {
- $ret[] = (string)$uid;
- }
-
- return $ret;
- }
-
- /**
- * Get the current user's friend lists
- *
- * @return object SimpleXMLObject with a name and id for each list
- * @author Jeff Hodsdon
- * @link http://wiki.developers.facebook.com/index.php/Friends.getLists
- */
- public function getLists()
- {
- $result = $this->callMethod('friends.getLists', array(
- 'session_key' => $this->sessionKey
- ));
-
- return $result;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Groups.php b/db/library/facebook_stream/Services/Facebook/Groups.php
deleted file mode 100644
index e6365bf..0000000
--- a/db/library/facebook_stream/Services/Facebook/Groups.php
+++ /dev/null
@@ -1,80 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Groups Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Groups extends Services_Facebook_Common
-{
- /**
- * Get a list of groups
- *
- * @param mixed $uid_or_gids An array of groups or uid's
- *
- * @return object A SimpleXmlElement with group information
- */
- public function get($uid_or_gids = null)
- {
- $args = array('session_key' => $this->sessionKey);
- if (!is_null($uid_or_gids)) {
- if (is_array($uid_or_gids)) {
- $args['gids'] = implode(',', $uid_or_gids);
- } else {
- $args['uid'] = (string) $uid_or_gids;
- }
- }
-
- return $this->callMethod('groups.get', $args);
- }
-
- /**
- * Get members of a group
- *
- * @param integer $gid The group id which you want members of
- *
- * @return object An instance of SimleXmlElement
- */
- public function getMembers($gid)
- {
- $result = $this->callMethod('groups.getMembers', array(
- 'session_key' => $this->sessionKey,
- 'guid' => (string)$gid
- ));
-
- $members = array();
- foreach ($result->members->uid as $member) {
- $members[] = (string) $member;
- }
- return $members;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/MarketPlace.php b/db/library/facebook_stream/Services/Facebook/MarketPlace.php
deleted file mode 100644
index 6cd2137..0000000
--- a/db/library/facebook_stream/Services/Facebook/MarketPlace.php
+++ /dev/null
@@ -1,184 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-require_once 'Services/Facebook/Exception.php';
-require_once 'Services/Facebook/MarketPlace/Listing.php';
-
-/**
- * Facebook Marketplace Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_MarketPlace extends Services_Facebook_Common
-{
- /**
- * Create (or Update) a marketplace listing
- *
- * @param object $l Instance of listing object
- *
- * @return object Instance of listing object (with ID)
- * @throws Services_Facebook_Exception
- */
- public function createListing(Services_Facebook_MarketPlace_Listing $l)
- {
- $l->validate();
- $result = $this->callMethod('marketplace.createListing', array(
- 'session_key' => $this->sessionKey,
- 'listing_id' => $l->id,
- 'show_on_profile' => (($l->showInProfile) ? '1' : '0'),
- 'listing_attrs' => json_encode($l->data)
- ));
-
- $id = (float) (string) $result;
- $l->id = $id;
- return $l;
- }
-
- /**
- * Get marketplace categories
- *
- * @return object
- * @throws Services_Facebook_Exception
- */
- public function getCategories()
- {
- $result = $this->callMethod('marketplace.getCategories', array(
- 'session_key' => $this->sessionKey
- ));
-
- $categories = array();
- foreach ($result as $category) {
- $categories[] = (string) $category;
- }
-
- return $categories;
- }
-
- /**
- * Get marketplace subcategories
- *
- * @param string $category Category to fetch subcategories for
- *
- * @return object
- * @throws Services_Facebook_Exception
- */
- public function getSubCategories($category)
- {
- return $this->callMethod('marketplace.getSubCategories', array(
- 'session_key' => $this->sessionKey,
- 'category' => $category
- ));
- }
-
- /**
- * Get marketplace listings, filter by listing ids and user ids
- *
- * @param mixed $listingIds Array or string of List id(s)
- * @param mixed $uids Array or string of User id(s)
- *
- * @return mixed SimpleXML object of the listings
- * @link http://wiki.developers.facebook.com/index.php/Marketplace.getListings
- */
- public function getListings($listingIds = null, $uids = null)
- {
- if ((!$listingIds) && (!$uids)) {
- throw new Services_Facebook_Exception(
- 'Must specifiy at least 1 user or listing id'
- );
- }
-
- if (is_array($listingIds)) {
- $listingIds = implode(',', $listingIds);
- }
-
- if (is_array($uids)) {
- $uids = implode(',', $listingIds);
- }
-
- return $this->callMethod('marketplace.getListings', array(
- 'session_key' => $this->sessionKey,
- 'listing_ids' => $listingIds,
- 'uids' => $uids
- ));
- }
-
- /**
- * Remove marketplace listing
- *
- * Remove a listing by id and setting the status to either 'SUCCESS',
- * 'DEFAULT', 'NOT_SUCCESS'
- *
- * @param string $listingId Listing id
- * @param string $status Status
- *
- * @return bool Success or Failure
- * @author Jeff Hodsdon
- * @link http://wiki.developers.facebook.com/index.php/Marketplace.removeListing
- */
- public function removeListing($listingId, $status = 'DEFAULT')
- {
- $result = $this->callMethod('marketplace.removeListing', array(
- 'session_key' => $this->sessionKey,
- 'listing_id' => $listingId,
- 'status' => $status
- ));
- return ((string)$result == 1);
- }
-
- /**
- * Search marketplace listings
- *
- * @param string $query The query term to search for
- * @param string $category Category to search within
- * @param string $subCategory Subcategory to search within
- *
- * @return object
- * @throws Services_Facebook_Exception
- */
- public function search($query, $category = '', $subCategory = '')
- {
- if (strlen($subCategory) && !strlen($category)) {
- throw new Services_Facebook_Exception(
- 'You must specify a category when searching by subCategory'
- );
- }
-
- $args = array('session_key' => $this->sessionKey);
- if (strlen($category)) {
- $args['category'] = $category;
- }
-
- if (strlen($subCategory)) {
- $args['subcategory'] = $subCategory;
- }
-
- return $this->callMethod('marketplace.search', $args);
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/MarketPlace/Listing.php b/db/library/facebook_stream/Services/Facebook/MarketPlace/Listing.php
deleted file mode 100644
index 10924b2..0000000
--- a/db/library/facebook_stream/Services/Facebook/MarketPlace/Listing.php
+++ /dev/null
@@ -1,135 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Exception.php';
-
-/**
- * Facebook Marketplace listing
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_MarketPlace_Listing
-{
- /**
- * Listing ID (listing_id)
- *
- * @var integer $id
- */
- public $id = 0;
-
- /**
- * Show listing in profile?
- *
- * @var boolean $showInProfile
- */
- public $showInProfile = true;
-
- /**
- * Listing parameters
- *
- * @param array $data
- *
- * @link http://wiki.developers.facebook.com/index.php/Marketplace_Listing_Attributes
- */
- public $data = array();
-
- /**
- * Set listing data
- *
- * @param string $var (e.g. price, condition, etc.)
- * @param string $val Value of attribute
- *
- * @return void
- */
- public function __set($var, $val)
- {
- $this->data[$var] = $val;
- }
-
- /**
- * Get listing data
- *
- * @param string $var (e.g. price, condition, etc.)
- *
- * @return mixed Null if value is not set
- */
- public function __get($var)
- {
- if (isset($this->data[$var])) {
- return $this->data[$var];
- }
-
- return null;
- }
-
- /**
- * Validate listing before posting it
- *
- * @return void
- * @throws Services_Facebook_Exception
- */
- public function validate()
- {
- static $required = array(
- 'category', 'subcategory', 'title', 'description'
- );
-
- foreach ($required as $field) {
- if (!isset($this->data[$field]) || !strlen($this->data[$field])) {
- throw new Services_Facebook_Exception(
- 'Marketplace listing requires ' . $field . ' be set'
- );
- }
- }
-
- foreach ($this->data as $field => $val) {
- $func = 'validate' . ucfirst($field);
- if (method_exists($this, $func)) {
- $this->$func($val);
- }
- }
- }
-
- /**
- * Validate condition value
- *
- * @param string $val The condition to validate against
- *
- * @return void
- * @throws Services_Facebook_Exception
- */
- public function validateCondition($val)
- {
- if (!in_array($val, array('ANY', 'NEW', 'USED'))) {
- throw new Services_Facebook_Exception(
- 'Condition must be ANY, NEW or USED'
- );
- }
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Notifications.php b/db/library/facebook_stream/Services/Facebook/Notifications.php
deleted file mode 100644
index 4225800..0000000
--- a/db/library/facebook_stream/Services/Facebook/Notifications.php
+++ /dev/null
@@ -1,153 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-require_once 'Validate.php';
-
-/**
- * Facebook Notifications Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Notifications extends Services_Facebook_Common
-{
- /**
- * App to user notification type
- *
- * @see self::send()
- */
- const TYPE_APP_TO_USER = 'app_to_user';
-
- /**
- * User to user notification type
- *
- * @see self::send()
- */
- const TYPE_USER_TO_USER = 'user_to_user';
-
- /**
- * Get notifications for current user
- *
- * Returns all of the outstanding notifications for the given user, which
- * include messages, pokes, shares, friend requests, group invites, and
- * event invites.
- *
- * @return object Instance of SimpleXmlElement
- * @link http://wiki.developers.facebook.com/index.php/Notifications.get
- */
- public function get()
- {
- $args = array(
- 'session_key' => $this->sessionKey
- );
-
- return $this->callMethod('notifications.get', $args);
- }
-
- /**
- * Send a notification
- *
- * When you send a notification you can send it to an array of Facebook
- * uids. The notification should be valid FBML. Optionally, you can pass
- *
- * Optionally, you can pass a type parameter. 'general' (default)
- * notifications require an active user session, while 'announcement'
- * does not.
- *
- * The result value can either be true or a string. The string is a valid
- * URI that you should redirect the user to for confirmation.
- *
- * @param array $to Facebook uids to send note to
- * @param string $notification FBML of notification
- * @param string $type Type of notification
- *
- * @return mixed Confirmation URI or true
- * @see self::TYPE_GENERAL, self::TYPE_ANNOUNCEMENT
- * @link http://wiki.developers.facebook.com/index.php/Notifications.send
- */
- public function send(array $to, $notification, $type = self::TYPE_USER_TO_USER)
- {
- $args = array(
- 'to_ids' => implode(',', $to),
- 'notification' => $notification
- );
-
- if ($type == self::TYPE_USER_TO_USER) {
- $args['session_key'] = $this->sessionKey;
- $args['type'] = $type;
- } elseif ($type == self::TYPE_APP_TO_USER) {
- $args['type'] = $type;
- } elseif ($type == 'announcement' || $type == 'general') {
- // Backwards compatiblity
- if ($type == 'general') {
- $args['session_key'] = $this->sessionKey;
- }
- $args['type'] = $type;
- } else {
- // Backwards compatiblity
- $args['email'] = $type;
- }
-
- $result = $this->callMethod('notifications.send', $args);
- $check = (string)$result;
- if (strlen($check) && Validate::uri($check)) {
- return $check;
- }
-
- return true;
- }
-
- /**
- * Send an email out to application users
- *
- * @param array $recipients An array of Facebook uids to send too
- * @param string $subject Subject of the email
- * @param mixed $text Text or FBML and text for the body of the email
- *
- * @return array An array of success uids the email went out too
- * @author Jeff Hodsdon
- * @link http://wiki.developers.facebook.com/index.php/Notifications.sendEmail
- */
- public function sendEmail(array $recipients, $subject, $text = null)
- {
- $args = array(
- 'recipients' => implode(',', $recipients),
- 'subject' => $subject,
- );
-
- if (preg_match('/callMethod('notifications.sendEmail', $args);
- return explode(',', (string)$result);
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Pages.php b/db/library/facebook_stream/Services/Facebook/Pages.php
deleted file mode 100644
index 4af4983..0000000
--- a/db/library/facebook_stream/Services/Facebook/Pages.php
+++ /dev/null
@@ -1,96 +0,0 @@
-
- * @copyright 2007-2008 Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Pages Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Jeff Hodsdon
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Pages extends Services_Facebook_Common
-{
- /**
- * Checks whether the logged-in user is the admin for a given page.
- *
- * @param int $pageId Page ID
- *
- * @return boolean
- *
- * @link http://wiki.developers.facebook.com/index.php/Pages.isAdmin
- **/
- public function isAdmin($pageId = null)
- {
- $result = $this->callMethod('pages.isAdmin', array(
- 'session_key' => $this->sessionKey,
- 'page_id' => $pageId
- ));
- return (intval((string)$result) == 1);
- }
-
- /**
- * Checks whether the page has added the application.
- *
- * @param int $pageId Page ID, optional
- *
- * @return boolean
- *
- * @link http://wiki.developers.facebook.com/index.php/Pages.isAppAdded
- **/
- public function isAppAdded($pageId = null)
- {
- $result = $this->callMethod('pages.isAppAdded', array(
- 'session_key' => $this->sessionKey,
- 'page_id' => $pageId
- ));
- return (intval((string)$result) == 1);
- }
-
- /**
- * Checks whether a user is a fan of a given Page. Doesn't work for
- * Application about Pages.
- *
- * @param int $pageId Page ID
- * @param int $uid User ID of the person to test, defaults to
- * logged-in user
- *
- * @return boolean
- *
- * @link http://wiki.developers.facebook.com/index.php/Pages.isFan
- **/
- public function isFan($pageId = null, $uid = null)
- {
- $result = $this->callMethod('pages.isFan', array(
- 'session_key' => $this->sessionKey,
- 'page_id' => $pageId,
- 'uid' => $uid
- ));
- return (intval((string)$result) == 1);
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Photos.php b/db/library/facebook_stream/Services/Facebook/Photos.php
deleted file mode 100644
index 5d00f8e..0000000
--- a/db/library/facebook_stream/Services/Facebook/Photos.php
+++ /dev/null
@@ -1,297 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-
-/**
- * Facebook Notifications Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Photos extends Services_Facebook_Common
-{
- /**
- * Image types allowed for upload
- *
- * Facebook doesn't specify which types of images you can upload so we
- * restrict file uploads to the "Big Three".
- *
- * @var array $imageTypes
- * @see Services_Facebook_Photos::upload()
- */
- protected $imageTypes = array(
- IMAGETYPE_GIF => 'image/gif',
- IMAGETYPE_JPEG => 'image/jpeg',
- IMAGETYPE_PNG => 'image/png'
- );
-
- /**
- * Add a tag to a photo
- *
- * Adds a tag to a photo. The x/y coordinates are a float based percentage
- * from the left/top of the photo. The tag parameter is either a valid
- * Facebook uid or a simple text string for a tag.
- *
- * @param int $pid Picture ID to add tag to
- * @param float $x Horizontal postion as percentage
- * @param float $y Vertical position as percentage
- * @param mixed $tag Integer = uid, String = textual tag
- *
- * @return boolean True on success, false on failure
- * @link http://wiki.developers.facebook.com/index.php/Photos.addTag
- */
- public function addTag($pid, $x, $y, $tag)
- {
- $args = array(
- 'session_key' => $this->sessionKey,
- 'pid' => $pid,
- 'x' => $x,
- 'y' => $y
- );
-
- if (is_numeric($tag)) {
- $args['tag_uid'] = $tag;
- } else {
- $args['tag_text'] = $tag;
- }
-
- $result = $this->callMethod('photos.addTag', $args);
- return (intval((string)$result) == 1);
- }
-
- /**
- * Add a series of tags to a photo
- *
- * @param int $pid Photo ID to attach tags to
- * @param array $tags Array of tags to add to phot
- *
- * @return boolean True if success, false on failure
- */
- public function addTags($pid, array $tags)
- {
- $result = $this->callMethod('photos.addTag', array(
- 'session_key' => $this->sessionKey,
- 'tags' => json_encode($tags)
- ));
-
- return (intval((string)$result) == 1);
- }
-
- /**
- * Create a photo album
- *
- * @param string $name Name of photo album
- * @param string $location Location of album
- * @param string $description A short description of album
- *
- * @return object An instance of SimpleXMLElement
- * @link http://wiki.developers.facebook.com/index.php/Photos.createAlbums
- */
- public function createAlbum($name, $location = '', $description = '')
- {
- $args = array(
- 'session_key' => $this->sessionKey,
- 'name' => $name
- );
-
- if (strlen($location)) {
- $args['location'] = $location;
- }
-
- if (strlen($description)) {
- $args['description'] = $description;
- }
-
- return $this->callMethod('photos.createAlbum', $args);
- }
-
- /**
- * Get photos
- *
- * @param mixed $pids A single pid or an array of pids
- *
- * @return object Instance of SimpleXmlElement
- * @link http://wiki.developers.facebook.com/index.php/Photos.get
- */
- public function getPhotos($pids)
- {
- if (is_array($pids)) {
- $pids = implode(',', $pids);
- }
-
- return $this->callMethod('photos.get', array(
- 'session_key' => $this->sessionKey,
- 'pids' => $pids
- ));
- }
-
- /**
- * Get photos from a given album
- *
- * @param integer $aid Album ID to fetch photos from
- *
- * @return object Instance of SimpleXmlElement
- * @link http://wiki.developers.facebook.com/index.php/Photos.get
- */
- public function getPhotosByAlbum($aid)
- {
- return $this->callMethod('photos.get', array(
- 'session_key' => $this->sessionKey,
- 'aid' => $aid
- ));
- }
-
- /**
- * Get photos tagged with a specific user
- *
- * @param integer $uid User ID to fetch photos for
- *
- * @return object Instance of SimpleXmlElement
- * @link http://wiki.developers.facebook.com/index.php/Photos.get
- */
- public function getPhotosByUser($uid)
- {
- return $this->callMethod('photos.get', array(
- 'session_key' => $this->sessionKey,
- 'subj_id' => $uid
- ));
- }
-
- /**
- * Get albums from photo ids
- *
- * @param array $pids Array of Facebook pids
- *
- * @return object Instance of SimpleXmlElement
- * @link http://wiki.developers.facebook.com/index.php/Photos.getAlbums
- */
- public function getAlbumsByPhotos(array $pids)
- {
- return $this->callMethod('photos.getAlbums', array(
- 'session_key' => $this->sessionKey,
- 'pids' => implode(',', $pids)
- ));
- }
-
- /**
- * Get uid's photo albums
- *
- * @param int $uid Facebok uid to fetch albums
- *
- * @return object Instance of SimpleXmlElement
- * @link http://wiki.developers.facebook.com/index.php/Photos.getAlbums
- */
- public function getAlbumsByUser($uid)
- {
- return $this->callMethod('photos.getAlbums', array(
- 'session_key' => $this->sessionKey,
- 'uid' => $uid
- ));
- }
-
- /**
- * Get tags for given pids
- *
- * @param array $pids Facebook pids to fetch tags for
- *
- * @return object Instance of SimpleXmlElement
- * @link http://wiki.developers.facebook.com/index.php/Photos.getTags
- */
- public function getTags(array $pids)
- {
- return $this->callMethod('photos.getTags', array(
- 'session_key' => $this->sessionKey,
- 'pids' => implode(',', $pids)
- ));
- }
-
- /**
- * Upload a photo
- *
- * @param string $file Path to file you want to upload
- * @param integer $aid Album to upload photo into
- * @param string $caption A short caption
- *
- * @return object Instance of SimpleXMLElement
- * @link http://us3.php.net/manual/en/ref.curl.php#54150
- * @link http://wiki.developers.facebook.com/index.php/Photos.upload
- */
- public function upload($file, $aid = 0, $caption = '')
- {
- $type = exif_imagetype($file);
- if (!isset($this->imageTypes[$type])) {
- throw new Services_Facebook_Exception(
- 'You cannot upload this type of image', 0, $this->api
- );
- }
-
- $args = array(
- 'method' => 'photos.upload',
- 'v' => $this->version,
- 'api_key' => Services_Facebook::$apiKey,
- 'session_key' => $this->sessionKey,
- 'call_id' => microtime(true),
- 'format' => 'XML'
- );
-
- if ($aid > 0) {
- $args['aid'] = $aid;
- }
-
- if (strlen($caption)) {
- $args['caption'] = $caption;
- }
-
- $args = $this->signRequest($args);
- $args[basename($file)] = '@' . realpath($file);
-
- $ch = curl_init();
- $url = $this->api . '?method=photos.upload';
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
- $data = curl_exec($ch);
- if (curl_errno($ch)) {
- throw new Services_Facebook_Exception(
- curl_error($ch), curl_errno($ch), $url
- );
- }
-
- $xml = simplexml_load_string($data);
- if (!$xml instanceof SimpleXmlElement) {
- throw new Services_Facebook_Exception(
- 'Could not parse XML response', 0, $url
- );
- }
-
- return $xml;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Profile.php b/db/library/facebook_stream/Services/Facebook/Profile.php
deleted file mode 100644
index 3c589b0..0000000
--- a/db/library/facebook_stream/Services/Facebook/Profile.php
+++ /dev/null
@@ -1,98 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-require_once 'Services/Facebook/Exception.php';
-
-/**
- * Facebook Profile Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Profile extends Services_Facebook_Common
-{
- /**
- * Set FBML in a user's profile
- *
- * You are not required to use a session key that belongs to the user whose
- * profile you are changing.
- *
- * @param mixed $markup Profile markup or array of markup
- * @param integer $uid Facebook uid to set FBML for
- *
- * @return boolean True on success, false on unknown error
- * @link http://wiki.developers.facebook.com/index.php/Profile.setFBML
- */
- public function setFBML($markup, $uid = 0)
- {
- $args = array();
-
- if (is_array($markup)) {
- static $options = array('profile', 'profile_action', 'mobile_profile');
- foreach ($options as $opt) {
- if (isset($markup[$opt]) && strlen($markup[$opt])) {
- $args[$opt] = $markup[$opt];
- }
- }
- } elseif (strlen($markup)) {
- $args['profile'] = $markup;
- } else {
- throw new Services_Facebook_Exception(
- 'You must provide valid FBML markup'
- );
- }
-
- if ($uid > 0) {
- $args['uid'] = $uid;
- }
-
- $result = $this->callMethod('profile.setFBML', $args);
- $check = intval((string)$result);
- return ($check == 1);
- }
-
- /**
- * Get the current profile FBML
- *
- * @param integer $uid Facebook uid to fetch FBML for
- *
- * @return object Instance of SimpleXmlElement
- * @link http://wiki.developers.facebook.com/index.php/Profile.getFBML
- */
- public function getFBML($uid = 0)
- {
- $args = array('session_key' => $this->sessionKey);
- if ($uid > 0) {
- $args['uid'] = $uid;
- }
-
- $result = $this->callMethod('profile.getFBML', $args);
- return (string) $result;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Share.php b/db/library/facebook_stream/Services/Facebook/Share.php
deleted file mode 100644
index 533196d..0000000
--- a/db/library/facebook_stream/Services/Facebook/Share.php
+++ /dev/null
@@ -1,97 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-/**
- * Services_Facebook_Share
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Share
-{
- /**
- * Parse the share meta data from body
- *
- * @param string $body HTML code to parse info from
- *
- * @return array Meta information on videos, etc.
- */
- public function parse($body)
- {
- $metas = $links = array();
- preg_match_all('/]+)>/i', $body, $metas);
- preg_match_all('/]+)>/i', $body, $links);
-
- $ret = array();
- foreach ($links[0] as $l) {
- $m = array();
- if (preg_match('/rel="(image_src|audio_src|video_src)"/i', $l, $m)) {
- $type = strtolower(preg_replace('/_src$/i', '', $m[1]));
- if (!isset($ret[$type])) {
- $ret[$type] = array();
- }
-
- if (preg_match('/href="([^"]+)"/i', $l, $m)) {
- $ret[$type]['src'] = $m[1];
- }
- }
- }
-
- foreach ($metas[0] as $meta) {
- $m = array();
- if (preg_match('/name="(title|description)"/i', $meta, $m)) {
- $type = strtolower($m[1]);
- if (preg_match('/content="([^"]+)"/i', $meta, $m)) {
- $ret[$type] = $m[1];
- }
- } elseif (preg_match('/name="medium"/i', $meta, $m)) {
- if (preg_match('/content="(audio|image|video|news|blog|mult)"/i', $meta, $m)) {
- $ret['medium'] = $m[1];
- }
- } elseif (preg_match('/name="(video|image)_(height|width)"/i', $meta, $m)) {
- $type = strtolower($m[1]);
- $val = strtolower($m[2]);
- if (preg_match('/content="([0-9]+)"/i', $meta, $m)) {
- $ret[$type][$val] = $m[1];
- }
- } elseif (preg_match('/name="(video|audio|image)_type"/i', $meta, $m)) {
- $type = strtolower($m[1]);
- if (preg_match('/content="([^"]+)"/i', $meta, $m)) {
- $ret[$type]['type'] = $m[1];
- }
- } elseif (preg_match('/name="audio_(title|artist|album)"/i', $meta, $m)) {
- $val = strtolower($m[1]);
- if (preg_match('/content="([^"]+)"/i', $meta, $m)) {
- $ret['audio'][$val] = $m[1];
- }
- }
- }
-
- return $ret;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/Services/Facebook/Users.php b/db/library/facebook_stream/Services/Facebook/Users.php
deleted file mode 100644
index e680c43..0000000
--- a/db/library/facebook_stream/Services/Facebook/Users.php
+++ /dev/null
@@ -1,259 +0,0 @@
-
- * @copyright 2007-2008 Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Services_Facebook
- */
-
-require_once 'Services/Facebook/Common.php';
-require_once 'Services/Facebook/Exception.php';
-
-/**
- * Facebook Users Interface
- *
- * @category Services
- * @package Services_Facebook
- * @author Joe Stump
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://wiki.developers.facebook.com
- */
-class Services_Facebook_Users extends Services_Facebook_Common
-{
- /**
- * Default user fields
- *
- * @var array $userFields List of allowed getInfo fields
- */
- public $userFields = array(
- 'about_me', 'activities', 'affiliations', 'birthday', 'books',
- 'current_location', 'education_history', 'first_name', 'has_added_app',
- 'hometown_location', 'hs_info', 'interests', 'is_app_user',
- 'last_name', 'meeting_for', 'meeting_sex', 'movies', 'music', 'name',
- 'notes_count', 'pic', 'pic_small', 'pic_square', 'political',
- 'profile_update_time', 'quotes', 'relationship_status', 'religion',
- 'sex', 'significant_other_id', 'status', 'timezone', 'tv',
- 'wall_count', 'work_history'
- );
-
- /**
- * photoSizes
- *
- * @var array $photoSizes Supported photo sizes
- * @see self::getPhoto
- */
- protected $photoSizes = array('big', 'small', 'square');
-
- /**
- * Has the current user added this application?
- *
- * @return boolean
- */
- public function isAppAdded()
- {
- $result = $this->callMethod('users.isAppAdded', array(
- 'session_key' => $this->sessionKey
- ));
-
- return (intval((string)$result) == 1);
- }
-
- /**
- * Is app user
- *
- * Uses the passed in user ID or session key to determine
- * if the user is a user of the application.
- *
- * @param float $uid Facebook user ID
- *
- * @return bool
- */
- public function isAppUser($uid = null)
- {
- $args = array();
- if ($uid !== null) {
- $args['uid'] = $uid;
- } elseif (!empty($this->sessionKey)) {
- $args['session_key'] = $this->sessionKey;
- } else {
- throw new Services_Facebook_Exception('Users.isAppUser ' .
- 'requires a session key or uid, none provided');
- }
-
- $result = $this->callMethod('users.isAppUser', $args);
- return (intval((string)$result) == 1);
- }
-
- /**
- * Set a user's status message
- *
- * Set $status to true to clear the status or a string to change the
- * actual status message.
- *
- * @param mixed $status Set to true to clear status
- *
- * @return boolean True on success, false on failure
- * @link http://wiki.developers.facebook.com/index.php/Users.setStatus
- * @link http://wiki.developers.facebook.com/index.php/Extended_permission
- */
- public function setStatus($status)
- {
- $args = array(
- 'session_key' => $this->sessionKey,
- );
-
- if (is_bool($status) && $status === true) {
- $args['clear'] = 'true';
- } else {
- $args['status'] = $status;
- }
-
- $res = $this->callMethod('users.setStatus', $args);
- return (intval((string)$res) == 1);
- }
-
- /**
- * Get user info
- *
- * @param mixed $uids A single uid or array of uids
- * @param array $fields List of fields to retrieve
- *
- * @return object SimpleXmlElement of result
- * @link http://wiki.developers.facebook.com/index.php/Users.getInfo
- */
- public function getInfo($uids, array $fields = array())
- {
- if (is_array($uids)) {
- $uids = implode(',', $uids);
- }
-
- if (!count($fields)) {
- $fields = $this->userFields;
- }
-
- return $this->callMethod('users.getInfo', array(
- 'session_key' => $this->sessionKey,
- 'uids' => $uids,
- 'fields' => implode(',', $fields)
- ));
- }
-
- /**
- * Get the currently logged in uid
- *
- * Returns the Facebook uid of the person currently "logged in" as
- * specified by $sessionKey.
- *
- * @return string The uid of the person logged in
- * @see Services_Digg::$sessionKey
- * @link http://wiki.developers.facebook.com/index.php/Users.getLoggedInUser
- */
- public function getLoggedInUser()
- {
- $result = $this->callMethod('users.getLoggedInUser', array(
- 'session_key' => $this->sessionKey
- ));
-
- return (string)$result;
- }
-
- /**
- * Has given extended permission
- *
- * @param string $perm Permission to check
- * @param string $uid User's ID, optional if session key present
- *
- * @return boolean True if user has enabled extended permission
- * @link http://wiki.developers.facebook.com/index.php/Users.hasAppPermission
- */
- public function hasAppPermission($perm, $uid = null)
- {
- $valid = array(
- 'email', 'offline_access', 'status_update', 'photo_upload',
- 'create_listing', 'create_event', 'rsvp_event', 'sms'
- );
-
- if (!in_array($perm, $valid)) {
- throw new Services_Facebook_Exception(
- 'Invalid extended permission type supplied: ' . $perm
- );
- }
-
- $params = array(
- 'ext_perm' => $perm
- );
-
- if ($uid !== null) {
- $params['uid'] = $uid;
- } elseif (!empty($this->sessionKey)) {
- $params['session_key'] = $this->sessionKey;
- } else {
- throw new Services_Facebook_Exception('A UID or session key must be ' .
- 'given for hadAppPermission.');
- }
-
- $result = $this->callMethod('users.hasAppPermission', $params);
-
- return (intval((string)$result) == 1);
- }
-
- /**
- * Get photo
- *
- * Get a photo given an user id. Allow different sizes.
- *
- * @param string $uid Id of the user you want to get a photo of
- * @param string $size Size of the photo {@link self::photoSizes}
- *
- * @return mixed Photo data
- */
- public function getPhoto($uid, $size = '')
- {
- $field = 'pic';
- if ($size !== '') {
- if (!in_array($size, $this->photoSizes)) {
- throw new Services_Facebook_Exception('Photo size "' .
- $size . '" is not supported.');
- }
-
- $field .= '_' . $size;
- }
-
- $url = (string) $this->getInfo($uid, array($field))->user->$field;
-
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, Services_Facebook::$timeout);
- $photo = curl_exec($ch);
-
- if (curl_errno($ch)) {
- throw new Services_Facebook_Exception(
- curl_error($ch),
- curl_errno($ch)
- );
- }
- curl_close($ch);
-
- return $photo;
- }
-}
-
-?>
diff --git a/db/library/facebook_stream/example/index.php b/db/library/facebook_stream/example/index.php
deleted file mode 100755
index c4ea212..0000000
--- a/db/library/facebook_stream/example/index.php
+++ /dev/null
@@ -1,132 +0,0 @@
-getAccessToken();
-
- /* Save token for later */
- $_SESSION['fb_request_token'] = $token;
-
- $url = 'http://www.facebook.com/login.php?api_key=';
- $url .= $fs->getApiKey();
- $url .= '&v=1.0&auth_token=';
- $url .= $token;
-
- header('Location:'.$url);
- exit;
-
- case 'returned':
-
- $fs = new FacebookStream($consumer_key,$consumer_secret,$agent);
-
- if ( !empty( $infinite_session ) && ( $_SESSION['fb_userid'] > 0 )) {
-
- /* Infinite session, headless mode, use FB UserID from database to skip to the API call */
- $fs->streamRequest( $_SESSION['fb_userid'] );
-
- } elseif ($_SESSION['fb_session'] === NULL && $_SESSION['fb_userid'] === NULL) {
-
- /* If the access tokens are already set skip to the API call */
-
- /* Create session */
- $session = $fs->getSession($_SESSION['fb_request_token']);
-
- /* Save the session data */
- $_SESSION['fb_session'] = (string)$session->session_key;
- $_SESSION['fb_userid'] = (string)$session->uid;
-
- }
-
- if (isset($_GET['key']))
- $fs->permanent_facebook_key($consumer_key,$consumer_secret);
-
- //$fs->setStatus("updating my status with my new php library called Facebook Streams",$_SESSION['fb_userid']);
- $fs->streamRequest($_SESSION['fb_userid'] );
-
-}
-
-?>
-
-
-
- Facebook Streams
-
-
-
- showJs(); ?>
-
-
Welcome to a Facebook Streams PHP example.
-
This site is a basic showcase of Facebook's new Streams method. Everything is saved in sessions. If you want to start over ?test=clear'>clear sessions.