diff --git a/includes/oauth-php/LICENSE b/includes/oauth-php/LICENSE
new file mode 100644
index 00000000..fbdcc373
--- /dev/null
+++ b/includes/oauth-php/LICENSE
@@ -0,0 +1,22 @@
+The MIT License
+
+Copyright (c) 2007-2009 Mediamatic Lab
+Copyright (c) 2010 Corollarium Technologies
+
+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.
\ No newline at end of file
diff --git a/includes/oauth-php/README b/includes/oauth-php/README
new file mode 100644
index 00000000..ecd68156
--- /dev/null
+++ b/includes/oauth-php/README
@@ -0,0 +1 @@
+Please see http://code.google.com/p/oauth-php/ for documentation and help.
diff --git a/includes/oauth-php/example/client/googledocs.php b/includes/oauth-php/example/client/googledocs.php
new file mode 100644
index 00000000..6e9cf3af
--- /dev/null
+++ b/includes/oauth-php/example/client/googledocs.php
@@ -0,0 +1,109 @@
+ GOOGLE_CONSUMER_KEY,
+ 'consumer_secret' => GOOGLE_CONSUMER_SECRET,
+ 'server_uri' => GOOGLE_OAUTH_HOST,
+ 'request_token_uri' => GOOGLE_REQUEST_TOKEN_URL,
+ 'authorize_uri' => GOOGLE_AUTHORIZE_URL,
+ 'access_token_uri' => GOOGLE_ACCESS_TOKEN_URL
+);
+// Note: do not use "Session" storage in production. Prefer a database
+// storage, such as MySQL.
+OAuthStore::instance("Session", $options);
+
+try
+{
+ // STEP 1: If we do not have an OAuth token yet, go get one
+ if (empty($_GET["oauth_token"]))
+ {
+ $getAuthTokenParams = array('scope' =>
+ 'http://docs.google.com/feeds/',
+ 'xoauth_displayname' => 'Oauth test',
+ 'oauth_callback' => 'http://likeorhate.local/google.php');
+
+ // get a request token
+ $tokenResultParams = OAuthRequester::requestRequestToken(GOOGLE_CONSUMER_KEY, 0, $getAuthTokenParams);
+
+ // redirect to the google authorization page, they will redirect back
+ header("Location: " . GOOGLE_AUTHORIZE_URL . "?btmpl=mobile&oauth_token=" . $tokenResultParams['token']);
+ }
+ else {
+ // STEP 2: Get an access token
+ $oauthToken = $_GET["oauth_token"];
+
+ // echo "oauth_verifier = '" . $oauthVerifier . "'
";
+ $tokenResultParams = $_GET;
+
+ try {
+ OAuthRequester::requestAccessToken(GOOGLE_CONSUMER_KEY, $oauthToken, 0, 'POST', $_GET);
+ }
+ catch (OAuthException2 $e)
+ {
+ var_dump($e);
+ // Something wrong with the oauth_token.
+ // Could be:
+ // 1. Was already ok
+ // 2. We were not authorized
+ return;
+ }
+
+ // make the docs requestrequest.
+ $request = new OAuthRequester("http://docs.google.com/feeds/documents/private/full", 'GET', $tokenResultParams);
+ $result = $request->doRequest(0);
+ if ($result['code'] == 200) {
+ var_dump($result['body']);
+ }
+ else {
+ echo 'Error';
+ }
+ }
+}
+catch(OAuthException2 $e) {
+ echo "OAuthException: " . $e->getMessage();
+ var_dump($e);
+}
+?>
\ No newline at end of file
diff --git a/includes/oauth-php/example/client/twolegged.php b/includes/oauth-php/example/client/twolegged.php
new file mode 100644
index 00000000..a22c4fda
--- /dev/null
+++ b/includes/oauth-php/example/client/twolegged.php
@@ -0,0 +1,67 @@
+ $key, 'consumer_secret' => $secret);
+OAuthStore::instance("2Leg", $options);
+
+$method = "GET";
+$params = null;
+
+try
+{
+ // Obtain a request object for the request we want to make
+ $request = new OAuthRequester($url, $method, $params);
+
+ // Sign the request, perform a curl request and return the results,
+ // throws OAuthException2 exception on an error
+ // $result is an array of the form: array ('code'=>int, 'headers'=>array(), 'body'=>string)
+ $result = $request->doRequest();
+
+ $response = $result['body'];
+ var_dump($response);
+}
+catch(OAuthException2 $e)
+{
+ echo "Exception";
+}
+
+?>
diff --git a/includes/oauth-php/example/client/twoleggedtest.php b/includes/oauth-php/example/client/twoleggedtest.php
new file mode 100644
index 00000000..0fc866b0
--- /dev/null
+++ b/includes/oauth-php/example/client/twoleggedtest.php
@@ -0,0 +1,78 @@
+ $key, 'consumer_secret' => $secret);
+OAuthStore::instance("2Leg", $options);
+
+$method = "GET";
+$params = null;
+
+try
+{
+ // Obtain a request object for the request we want to make
+ $request = new OAuthRequester($url, $method, $params);
+
+ // Sign the request, perform a curl request and return the results,
+ // throws OAuthException2 exception on an error
+ // $result is an array of the form: array ('code'=>int, 'headers'=>array(), 'body'=>string)
+ $result = $request->doRequest();
+
+ $response = $result['body'];
+
+ if ($response != 'oauth_token=requestkey&oauth_token_secret=requestsecret')
+ {
+ echo 'Error! $response ' . $response;
+ }
+ else
+ {
+ }
+
+
+ var_dump($response);
+}
+catch(OAuthException2 $e)
+{
+ echo "Exception" . $e->getMessage();
+}
+
+?>
diff --git a/includes/oauth-php/example/client/twoleggedtwitter.php b/includes/oauth-php/example/client/twoleggedtwitter.php
new file mode 100644
index 00000000..a97b4636
--- /dev/null
+++ b/includes/oauth-php/example/client/twoleggedtwitter.php
@@ -0,0 +1,69 @@
+ TWITTER_CONSUMER_KEY, 'consumer_secret' => TWITTER_CONSUMER_SECRET);
+OAuthStore::instance("2Leg", $options);
+
+try
+{
+ // Obtain a request object for the request we want to make
+ $request = new OAuthRequester(TWITTER_REQUEST_TOKEN_URL, "POST");
+ $result = $request->doRequest(0);
+ parse_str($result['body'], $params);
+
+ echo "aa";
+
+ // now make the request.
+ $request = new OAuthRequester(TWITTER_PUBLIC_TIMELINE_API, 'GET', $params);
+ $result = $request->doRequest();
+}
+catch(OAuthException2 $e)
+{
+ echo "Exception" . $e->getMessage();
+}
+
+?>
\ No newline at end of file
diff --git a/includes/oauth-php/example/server/INSTALL b/includes/oauth-php/example/server/INSTALL
new file mode 100644
index 00000000..249c85e9
--- /dev/null
+++ b/includes/oauth-php/example/server/INSTALL
@@ -0,0 +1,53 @@
+In this example I assume that oauth-php lives in /home/john/src/oauth-php
+
+
+1) Create a virtual host and set the DB_DSN VARIABLE to the DSN of your (mysql) database.
+
+Example
+
+ ServerAdmin admin@localhost
+ ServerName hello.local
+ DocumentRoot /home/john/src/oauth-php/example/server/www
+
+ UseCanonicalName Off
+ ServerSignature On
+
+ SetEnv DB_DSN mysql://foo:bar@localhost/oauth_example_server_db
+
+
+ Options Indexes FollowSymLinks MultiViews
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+
+
+ php_value magic_quotes_gpc 0
+ php_value register_globals 0
+ php_value session.auto_start 0
+
+
+
+
+
+
+2) Create the database structure for the server:
+
+# mysql -u foo -p bar -h localhost < /home/john/src/oauth-php/library/store/mysql/mysql.sql
+
+
+
+3) Download and install smarty into the smarty/core/smarty directory:
+
+# cd /home/john/src/oauth-php/example/server/core
+# wget 'http://www.smarty.net/do_download.php?download_file=Smarty-2.6.19.tar.gz'
+# tar zxf Smarty-2.6.19.tar.gz
+# mv Smarty-2.6.19 smarty
+
+
+4) That's it! Point your browser to
+
+ http://hello.local/
+
+To get started.
+
+Arjan Scherpenisse , July 2008
diff --git a/includes/oauth-php/example/server/core/init.php b/includes/oauth-php/example/server/core/init.php
new file mode 100644
index 00000000..82c65db0
--- /dev/null
+++ b/includes/oauth-php/example/server/core/init.php
@@ -0,0 +1,128 @@
+
+ *
+ *
+ * The MIT License
+ *
+ * Copyright (c) 2007-2008 Mediamatic Lab
+ *
+ * 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.
+ */
+
+
+/*
+ * Simple 'user management'
+ */
+define ('USERNAME', 'sysadmin');
+define ('PASSWORD', 'sysadmin');
+
+
+/*
+ * Always announce XRDS OAuth discovery
+ */
+header('X-XRDS-Location: http://' . $_SERVER['SERVER_NAME'] . '/services.xrds');
+
+
+/*
+ * Initialize the database connection
+ */
+$info = parse_url(getenv('DB_DSN'));
+($GLOBALS['db_conn'] = mysql_connect($info['host'], $info['user'], $info['pass'])) || die(mysql_error());
+mysql_select_db(basename($info['path']), $GLOBALS['db_conn']) || die(mysql_error());
+unset($info);
+
+
+require_once '../../../library/OAuthServer.php';
+
+/*
+ * Initialize OAuth store
+ */
+require_once '../../../library/OAuthStore.php';
+OAuthStore::instance('MySQL', array('conn' => $GLOBALS['db_conn']));
+
+
+/*
+ * Session
+ */
+session_start();
+
+
+/*
+ * Template handling
+ */
+require_once 'smarty/libs/Smarty.class.php';
+function session_smarty()
+{
+ if (!isset($GLOBALS['smarty']))
+ {
+ $GLOBALS['smarty'] = new Smarty;
+ $GLOBALS['smarty']->template_dir = dirname(__FILE__) . '/templates/';
+ $GLOBALS['smarty']->compile_dir = dirname(__FILE__) . '/../cache/templates_c';
+ }
+
+ return $GLOBALS['smarty'];
+}
+
+function assert_logged_in()
+{
+ if (empty($_SESSION['authorized']))
+ {
+ $uri = $_SERVER['REQUEST_URI'];
+ header('Location: /logon?goto=' . urlencode($uri));
+ exit();
+ }
+}
+
+function assert_request_vars()
+{
+ foreach(func_get_args() as $a)
+ {
+ if (!isset($_REQUEST[$a]))
+ {
+ header('HTTP/1.1 400 Bad Request');
+ echo 'Bad request.';
+ exit;
+ }
+ }
+}
+
+function assert_request_vars_all()
+{
+ foreach($_REQUEST as $row)
+ {
+ foreach(func_get_args() as $a)
+ {
+ if (!isset($row[$a]))
+ {
+ header('HTTP/1.1 400 Bad Request');
+ echo 'Bad request.';
+ exit;
+ }
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/includes/oauth-php/example/server/core/templates/inc/footer.tpl b/includes/oauth-php/example/server/core/templates/inc/footer.tpl
new file mode 100644
index 00000000..308b1d01
--- /dev/null
+++ b/includes/oauth-php/example/server/core/templates/inc/footer.tpl
@@ -0,0 +1,2 @@
+