Change linefeed property to LF
authorMartin Kutschker <martin.t.kutschker@blackbox.net>
Wed, 29 Oct 2008 12:32:03 +0000 (12:32 +0000)
committerMartin Kutschker <martin.t.kutschker@blackbox.net>
Wed, 29 Oct 2008 12:32:03 +0000 (12:32 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4381 709f56b5-9817-0410-a4d7-c38de5d9e867

12 files changed:
typo3/sysext/openid/TODO
typo3/sysext/openid/class.tx_openid_eid.php
typo3/sysext/openid/ext_emconf.php
typo3/sysext/openid/ext_localconf.php
typo3/sysext/openid/ext_tables.php
typo3/sysext/openid/ext_tables.sql
typo3/sysext/openid/lib/php-openid/Auth/Yadis/ParanoidHTTPFetcher.php
typo3/sysext/openid/lib/php-openid/README.txt
typo3/sysext/openid/lib/php-openid/php-openid-typo3.patch
typo3/sysext/openid/locallang_csh.xml
typo3/sysext/openid/locallang_db.xml
typo3/sysext/openid/sv1/class.tx_openid_sv1.php

index cb1d5f7..4eef3a8 100644 (file)
@@ -1,4 +1,2 @@
 
-* add AJAX interface to BE login
-
-* use DB (or the caching framework) instead of the filesystem to store OpenID data (class.tx_openid_sv1.php)
+* use DB (the sessions or the caching framework) instead of the filesystem to store OpenID data (class.tx_openid_sv1.php)
index 2b8acb0..663bcae 100644 (file)
@@ -1,78 +1,78 @@
-<?php\r
-/***************************************************************\r
-*  Copyright notice\r
-*\r
-*  (c) 2008 Dmitry Dulepov <dmitry@typo3.org>\r
-*  All rights reserved\r
-*\r
-*  This script is part of the TYPO3 project. The TYPO3 project is\r
-*  free software; you can redistribute it and/or modify\r
-*  it under the terms of the GNU General Public License as published by\r
-*  the Free Software Foundation; either version 2 of the License, or\r
-*  (at your option) any later version.\r
-*\r
-*  The GNU General Public License can be found at\r
-*  http://www.gnu.org/copyleft/gpl.html.\r
-*\r
-*  This script is distributed in the hope that it will be useful,\r
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-*  GNU General Public License for more details.\r
-*\r
-*  This copyright notice MUST APPEAR in all copies of the script!\r
-***************************************************************/\r
-/**\r
- * [CLASS/FUNCTION INDEX of SCRIPT]\r
- *\r
- *\r
- *\r
- *   44: class tx_openid_eID\r
- *   50:     public function main()\r
- *\r
- * TOTAL FUNCTIONS: 1\r
- * (This index is automatically created/updated by the extension "extdeveval")\r
- *\r
- */\r
-\r
-/**\r
- * This class is the OpenID return script for the TYPO3 Frontend.\r
- *\r
- * $Id: $\r
- *\r
- * @author     Dmitry Dulepov <dmitry@typo3.org>\r
- */\r
-class tx_openid_eID {\r
-       /**\r
-       * Processes eID request.\r
-       *\r
-       * @return       void\r
-       */\r
-       public function main() {\r
-               // Due to the nature of OpenID (redrections, etc) we need to force user\r
-               // session fetching if there is no session around. This ensures that\r
-               // our service is called even if there is no login data in the request.\r
-               // Inside the service we will process OpenID response and authenticate\r
-               // the user.\r
-               $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['FE_fetchUserIfNoSession'] = true;\r
-\r
-               // Initialize Frontend user\r
-               tslib_eidtools::connectDB();\r
-               tslib_eidtools::initFeUser();\r
-\r
-               // Redirect to the original location in any case (authenticated or not)\r
-               @ob_end_clean();\r
-               header(t3lib_div::HTTP_STATUS_303);\r
-               header('Location: ' . t3lib_div::locationHeaderUrl(t3lib_div::GPvar('tx_openid_location')));\r
-               exit;\r
-       }\r
-}\r
-\r
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_eid.php'])     {\r
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_eid.php']);\r
-}\r
-\r
-$module = t3lib_div::makeInstance('tx_openid_eID');\r
-/* @var tx_openid_eID $module */\r
-$module->main();\r
-\r
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Dmitry Dulepov <dmitry@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   44: class tx_openid_eID
+ *   50:     public function main()
+ *
+ * TOTAL FUNCTIONS: 1
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+/**
+ * This class is the OpenID return script for the TYPO3 Frontend.
+ *
+ * $Id: $
+ *
+ * @author     Dmitry Dulepov <dmitry@typo3.org>
+ */
+class tx_openid_eID {
+       /**
+       * Processes eID request.
+       *
+       * @return       void
+       */
+       public function main() {
+               // Due to the nature of OpenID (redrections, etc) we need to force user
+               // session fetching if there is no session around. This ensures that
+               // our service is called even if there is no login data in the request.
+               // Inside the service we will process OpenID response and authenticate
+               // the user.
+               $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['FE_fetchUserIfNoSession'] = true;
+
+               // Initialize Frontend user
+               tslib_eidtools::connectDB();
+               tslib_eidtools::initFeUser();
+
+               // Redirect to the original location in any case (authenticated or not)
+               @ob_end_clean();
+               header(t3lib_div::HTTP_STATUS_303);
+               header('Location: ' . t3lib_div::locationHeaderUrl(t3lib_div::GPvar('tx_openid_location')));
+               exit;
+       }
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_eid.php'])     {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_eid.php']);
+}
+
+$module = t3lib_div::makeInstance('tx_openid_eID');
+/* @var tx_openid_eID $module */
+$module->main();
+
 ?>
\ No newline at end of file
index 503beef..2961c4a 100644 (file)
@@ -3,7 +3,7 @@
 ########################################################################
 # Extension Manager/Repository config file for ext: "openid"
 #
-# Auto generated 28-10-2008 21:24
+# Auto generated 29-10-2008 13:30
 #
 # Manual updates:
 # Only the data in the array - anything else is removed by next write.
@@ -42,9 +42,9 @@ $EM_CONF[$_EXTKEY] = array(
                'suggests' => array(
                ),
        ),
-       '_md5_values_when_last_written' => 'a:54:{s:4:"TODO";s:4:"d3a1";s:23:"class.tx_openid_eid.php";s:4:"4938";s:26:"class.tx_openid_return.php";s:4:"4bca";s:12:"ext_icon.gif";s:4:"f1e1";s:17:"ext_localconf.php";s:4:"cad0";s:14:"ext_tables.php";s:4:"65b0";s:14:"ext_tables.sql";s:4:"8a3e";s:17:"locallang_csh.xml";s:4:"5c81";s:16:"locallang_db.xml";s:4:"39ff";s:14:"doc/manual.sxw";s:4:"05d1";s:22:"lib/php-openid/COPYING";s:4:"3b83";s:25:"lib/php-openid/README.txt";s:4:"953e";s:37:"lib/php-openid/php-openid-typo3.patch";s:4:"3375";s:30:"lib/php-openid/Auth/OpenID.php";s:4:"3be9";s:33:"lib/php-openid/Auth/OpenID/AX.php";s:4:"b68e";s:42:"lib/php-openid/Auth/OpenID/Association.php";s:4:"9b1e";s:38:"lib/php-openid/Auth/OpenID/BigMath.php";s:4:"a56d";s:39:"lib/php-openid/Auth/OpenID/Consumer.php";s:4:"ec57";s:40:"lib/php-openid/Auth/OpenID/CryptUtil.php";s:4:"6276";s:49:"lib/php-openid/Auth/OpenID/DatabaseConnection.php";s:4:"660d";s:44:"lib/php-openid/Auth/OpenID/DiffieHellman.php";s:4:"1a0b";s:39:"lib/php-openid/Auth/OpenID/Discover.php";s:4:"1a9b";s:40:"lib/php-openid/Auth/OpenID/DumbStore.php";s:4:"c1e9";s:40:"lib/php-openid/Auth/OpenID/Extension.php";s:4:"5aae";s:40:"lib/php-openid/Auth/OpenID/FileStore.php";s:4:"69da";s:35:"lib/php-openid/Auth/OpenID/HMAC.php";s:4:"a0a3";s:40:"lib/php-openid/Auth/OpenID/Interface.php";s:4:"421b";s:37:"lib/php-openid/Auth/OpenID/KVForm.php";s:4:"3c7c";s:45:"lib/php-openid/Auth/OpenID/MemcachedStore.php";s:4:"db8c";s:38:"lib/php-openid/Auth/OpenID/Message.php";s:4:"413e";s:41:"lib/php-openid/Auth/OpenID/MySQLStore.php";s:4:"4607";s:36:"lib/php-openid/Auth/OpenID/Nonce.php";s:4:"2738";s:35:"lib/php-openid/Auth/OpenID/PAPE.php";s:4:"e586";s:36:"lib/php-openid/Auth/OpenID/Parse.php";s:4:"28c9";s:46:"lib/php-openid/Auth/OpenID/PostgreSQLStore.php";s:4:"cd44";s:39:"lib/php-openid/Auth/OpenID/SQLStore.php";s:4:"29d2";s:42:"lib/php-openid/Auth/OpenID/SQLiteStore.php";s:4:"4855";s:35:"lib/php-openid/Auth/OpenID/SReg.php";s:4:"ae70";s:37:"lib/php-openid/Auth/OpenID/Server.php";s:4:"2006";s:44:"lib/php-openid/Auth/OpenID/ServerRequest.php";s:4:"d29d";s:40:"lib/php-openid/Auth/OpenID/TrustRoot.php";s:4:"002d";s:38:"lib/php-openid/Auth/OpenID/URINorm.php";s:4:"e4fb";s:41:"lib/php-openid/Auth/Yadis/HTTPFetcher.php";s:4:"c2ed";s:37:"lib/php-openid/Auth/Yadis/Manager.php";s:4:"ee7d";s:34:"lib/php-openid/Auth/Yadis/Misc.php";s:4:"65f6";s:49:"lib/php-openid/Auth/Yadis/ParanoidHTTPFetcher.php";s:4:"86ea";s:39:"lib/php-openid/Auth/Yadis/ParseHTML.php";s:4:"1d59";s:46:"lib/php-openid/Auth/Yadis/PlainHTTPFetcher.php";s:4:"6d0f";s:33:"lib/php-openid/Auth/Yadis/XML.php";s:4:"09f1";s:34:"lib/php-openid/Auth/Yadis/XRDS.php";s:4:"4bcd";s:33:"lib/php-openid/Auth/Yadis/XRI.php";s:4:"5eca";s:36:"lib/php-openid/Auth/Yadis/XRIRes.php";s:4:"9b44";s:35:"lib/php-openid/Auth/Yadis/Yadis.php";s:4:"d6ee";s:27:"sv1/class.tx_openid_sv1.php";s:4:"ab2a";}',
        'suggests' => array(
        ),
+       '_md5_values_when_last_written' => 'a:56:{s:4:"TODO";s:4:"977e";s:23:"class.tx_openid_eid.php";s:4:"4938";s:26:"class.tx_openid_return.php";s:4:"ce0d";s:19:"ext_emconf.php.mine";s:4:"5bb6";s:20:"ext_emconf.php.r4368";s:4:"4780";s:20:"ext_emconf.php.r4380";s:4:"03fd";s:12:"ext_icon.gif";s:4:"ef0a";s:17:"ext_localconf.php";s:4:"cad0";s:14:"ext_tables.php";s:4:"65b0";s:14:"ext_tables.sql";s:4:"8a3e";s:17:"locallang_csh.xml";s:4:"5c81";s:16:"locallang_db.xml";s:4:"39ff";s:22:"lib/php-openid/COPYING";s:4:"3b83";s:25:"lib/php-openid/README.txt";s:4:"953e";s:37:"lib/php-openid/php-openid-typo3.patch";s:4:"3375";s:30:"lib/php-openid/Auth/OpenID.php";s:4:"3be9";s:33:"lib/php-openid/Auth/OpenID/AX.php";s:4:"b68e";s:42:"lib/php-openid/Auth/OpenID/Association.php";s:4:"9b1e";s:38:"lib/php-openid/Auth/OpenID/BigMath.php";s:4:"a56d";s:39:"lib/php-openid/Auth/OpenID/Consumer.php";s:4:"ec57";s:40:"lib/php-openid/Auth/OpenID/CryptUtil.php";s:4:"6276";s:49:"lib/php-openid/Auth/OpenID/DatabaseConnection.php";s:4:"660d";s:44:"lib/php-openid/Auth/OpenID/DiffieHellman.php";s:4:"1a0b";s:39:"lib/php-openid/Auth/OpenID/Discover.php";s:4:"1a9b";s:40:"lib/php-openid/Auth/OpenID/DumbStore.php";s:4:"c1e9";s:40:"lib/php-openid/Auth/OpenID/Extension.php";s:4:"5aae";s:40:"lib/php-openid/Auth/OpenID/FileStore.php";s:4:"69da";s:35:"lib/php-openid/Auth/OpenID/HMAC.php";s:4:"a0a3";s:40:"lib/php-openid/Auth/OpenID/Interface.php";s:4:"421b";s:37:"lib/php-openid/Auth/OpenID/KVForm.php";s:4:"3c7c";s:45:"lib/php-openid/Auth/OpenID/MemcachedStore.php";s:4:"db8c";s:38:"lib/php-openid/Auth/OpenID/Message.php";s:4:"413e";s:41:"lib/php-openid/Auth/OpenID/MySQLStore.php";s:4:"4607";s:36:"lib/php-openid/Auth/OpenID/Nonce.php";s:4:"2738";s:35:"lib/php-openid/Auth/OpenID/PAPE.php";s:4:"e586";s:36:"lib/php-openid/Auth/OpenID/Parse.php";s:4:"28c9";s:46:"lib/php-openid/Auth/OpenID/PostgreSQLStore.php";s:4:"cd44";s:39:"lib/php-openid/Auth/OpenID/SQLStore.php";s:4:"29d2";s:42:"lib/php-openid/Auth/OpenID/SQLiteStore.php";s:4:"4855";s:35:"lib/php-openid/Auth/OpenID/SReg.php";s:4:"ae70";s:37:"lib/php-openid/Auth/OpenID/Server.php";s:4:"2006";s:44:"lib/php-openid/Auth/OpenID/ServerRequest.php";s:4:"d29d";s:40:"lib/php-openid/Auth/OpenID/TrustRoot.php";s:4:"002d";s:38:"lib/php-openid/Auth/OpenID/URINorm.php";s:4:"e4fb";s:41:"lib/php-openid/Auth/Yadis/HTTPFetcher.php";s:4:"c2ed";s:37:"lib/php-openid/Auth/Yadis/Manager.php";s:4:"ee7d";s:34:"lib/php-openid/Auth/Yadis/Misc.php";s:4:"65f6";s:49:"lib/php-openid/Auth/Yadis/ParanoidHTTPFetcher.php";s:4:"86ea";s:39:"lib/php-openid/Auth/Yadis/ParseHTML.php";s:4:"1d59";s:46:"lib/php-openid/Auth/Yadis/PlainHTTPFetcher.php";s:4:"6d0f";s:33:"lib/php-openid/Auth/Yadis/XML.php";s:4:"09f1";s:34:"lib/php-openid/Auth/Yadis/XRDS.php";s:4:"4bcd";s:33:"lib/php-openid/Auth/Yadis/XRI.php";s:4:"5eca";s:36:"lib/php-openid/Auth/Yadis/XRIRes.php";s:4:"9b44";s:35:"lib/php-openid/Auth/Yadis/Yadis.php";s:4:"d6ee";s:27:"sv1/class.tx_openid_sv1.php";s:4:"ab2a";}',
 );
 
 ?>
\ No newline at end of file
index d61cd0a..c9d3435 100644 (file)
@@ -1,26 +1,26 @@
-<?php\r
-// Make sure that we are executed only from the inside of TYPO3\r
-if (!defined ('TYPO3_MODE')) {\r
-       die ('Access denied.');\r
-}\r
-\r
-// Register OpenID authentication service with TYPO3\r
-t3lib_extMgm::addService($_EXTKEY, 'auth' /* sv type */,  'tx_openid_sv1' /* sv key */,\r
-       array(\r
-               'title' => 'OpenID Authentication',\r
-               'description' => 'OpenID authentication service for Frontend and Backend',\r
-               'subtype' => 'getUserFE,authUserFE,getUserBE,authUserBE',\r
-               'available' => true,\r
-               'priority' => 75, // Must be higher than for tx_sv_auth (50) or tx_sv_auth will deny request unconditionally\r
-               'quality' => 50,\r
-               'os' => '',\r
-               'exec' => '',\r
-               'classFile' => t3lib_extMgm::extPath($_EXTKEY).'sv1/class.tx_openid_sv1.php',\r
-               'className' => 'tx_openid_sv1',\r
-       )\r
-);\r
-\r
-// Register eID script that performs final FE user authentication. It will be called by the OpenID provider\r
-$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_openid'] = 'EXT:openid/class.tx_openid_eid.php';\r
-\r
+<?php
+// Make sure that we are executed only from the inside of TYPO3
+if (!defined ('TYPO3_MODE')) {
+       die ('Access denied.');
+}
+
+// Register OpenID authentication service with TYPO3
+t3lib_extMgm::addService($_EXTKEY, 'auth' /* sv type */,  'tx_openid_sv1' /* sv key */,
+       array(
+               'title' => 'OpenID Authentication',
+               'description' => 'OpenID authentication service for Frontend and Backend',
+               'subtype' => 'getUserFE,authUserFE,getUserBE,authUserBE',
+               'available' => true,
+               'priority' => 75, // Must be higher than for tx_sv_auth (50) or tx_sv_auth will deny request unconditionally
+               'quality' => 50,
+               'os' => '',
+               'exec' => '',
+               'classFile' => t3lib_extMgm::extPath($_EXTKEY).'sv1/class.tx_openid_sv1.php',
+               'className' => 'tx_openid_sv1',
+       )
+);
+
+// Register eID script that performs final FE user authentication. It will be called by the OpenID provider
+$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_openid'] = 'EXT:openid/class.tx_openid_eid.php';
+
 ?>
\ No newline at end of file
index 2b65fd6..22b51b3 100644 (file)
@@ -1,47 +1,47 @@
-<?php\r
-// Make sure that we are executed only from the inside of TYPO3\r
-if (!defined ('TYPO3_MODE')) {\r
-       die ('Access denied.');\r
-}\r
-\r
-// Prepare new columns for be_users table\r
-$tempColumns = array (\r
-       'tx_openid_openid' => array (\r
-               'exclude' => 0,\r
-               'label' => 'LLL:EXT:openid/locallang_db.xml:be_users.tx_openid_openid',\r
-               'config' => array (\r
-                       'type' => 'input',\r
-                       'size' => '30',\r
-                       // Requirement: unique (BE users are unique in the whole system)\r
-                       'eval' => 'trim,nospace,unique',\r
-               )\r
-       ),\r
-);\r
-\r
-// Add new columns to be_users table\r
-t3lib_div::loadTCA('be_users');\r
-t3lib_extMgm::addTCAcolumns('be_users', $tempColumns, false);\r
-t3lib_extMgm::addToAllTCAtypes('be_users','tx_openid_openid;;;;1-1-1', '', 'after:username');\r
-t3lib_extMgm::addLLrefForTCAdescr('be_users', 'EXT:' . $_EXTKEY . '/locallang_csh.xml');\r
-\r
-// Prepare new columns for fe_users table\r
-$tempColumns = array (\r
-       'tx_openid_openid' => array (\r
-               'exclude' => 0,\r
-               'label' => 'LLL:EXT:openid/locallang_db.xml:fe_users.tx_openid_openid',\r
-               'config' => array (\r
-                       'type' => 'input',\r
-                       'size' => '30',\r
-                       // Requirement: uniqueInPid (FE users are pid-specific)\r
-                       'eval' => 'trim,nospace,uniqueInPid',\r
-               )\r
-       ),\r
-);\r
-\r
-// Add new columns to fe_users table\r
-t3lib_div::loadTCA('fe_users');\r
-t3lib_extMgm::addTCAcolumns('fe_users', $tempColumns, false);\r
-t3lib_extMgm::addFieldsToAllPalettesOfField('fe_users', 'username', 'tx_openid_openid');\r
-t3lib_extMgm::addLLrefForTCAdescr('fe_users', 'EXT:' . $_EXTKEY . '/locallang_csh.xml');\r
-\r
+<?php
+// Make sure that we are executed only from the inside of TYPO3
+if (!defined ('TYPO3_MODE')) {
+       die ('Access denied.');
+}
+
+// Prepare new columns for be_users table
+$tempColumns = array (
+       'tx_openid_openid' => array (
+               'exclude' => 0,
+               'label' => 'LLL:EXT:openid/locallang_db.xml:be_users.tx_openid_openid',
+               'config' => array (
+                       'type' => 'input',
+                       'size' => '30',
+                       // Requirement: unique (BE users are unique in the whole system)
+                       'eval' => 'trim,nospace,unique',
+               )
+       ),
+);
+
+// Add new columns to be_users table
+t3lib_div::loadTCA('be_users');
+t3lib_extMgm::addTCAcolumns('be_users', $tempColumns, false);
+t3lib_extMgm::addToAllTCAtypes('be_users','tx_openid_openid;;;;1-1-1', '', 'after:username');
+t3lib_extMgm::addLLrefForTCAdescr('be_users', 'EXT:' . $_EXTKEY . '/locallang_csh.xml');
+
+// Prepare new columns for fe_users table
+$tempColumns = array (
+       'tx_openid_openid' => array (
+               'exclude' => 0,
+               'label' => 'LLL:EXT:openid/locallang_db.xml:fe_users.tx_openid_openid',
+               'config' => array (
+                       'type' => 'input',
+                       'size' => '30',
+                       // Requirement: uniqueInPid (FE users are pid-specific)
+                       'eval' => 'trim,nospace,uniqueInPid',
+               )
+       ),
+);
+
+// Add new columns to fe_users table
+t3lib_div::loadTCA('fe_users');
+t3lib_extMgm::addTCAcolumns('fe_users', $tempColumns, false);
+t3lib_extMgm::addFieldsToAllPalettesOfField('fe_users', 'username', 'tx_openid_openid');
+t3lib_extMgm::addLLrefForTCAdescr('fe_users', 'EXT:' . $_EXTKEY . '/locallang_csh.xml');
+
 ?>
\ No newline at end of file
index d4caf88..0607ca5 100644 (file)
@@ -1,13 +1,13 @@
-#\r
-# Table structure for table 'be_users'\r
-#\r
-CREATE TABLE be_users (\r
-       tx_openid_openid varchar(255) DEFAULT '' NOT NULL\r
-);\r
-\r
-#\r
-# Table structure for table 'fe_users'\r
-#\r
-CREATE TABLE fe_users (\r
-       tx_openid_openid varchar(255) DEFAULT '' NOT NULL\r
+#
+# Table structure for table 'be_users'
+#
+CREATE TABLE be_users (
+       tx_openid_openid varchar(255) DEFAULT '' NOT NULL
+);
+
+#
+# Table structure for table 'fe_users'
+#
+CREATE TABLE fe_users (
+       tx_openid_openid varchar(255) DEFAULT '' NOT NULL
 );
\ No newline at end of file
index e9197a1..192dd1e 100644 (file)
-<?php\r
-\r
-/**\r
- * This module contains the CURL-based HTTP fetcher implementation.\r
- *\r
- * PHP versions 4 and 5\r
- *\r
- * LICENSE: See the COPYING file included in this distribution.\r
- *\r
- * @package OpenID\r
- * @author JanRain, Inc. <openid@janrain.com>\r
- * @copyright 2005-2008 Janrain, Inc.\r
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache\r
- */\r
-\r
-/**\r
- * Interface import\r
- */\r
-require_once "Auth/Yadis/HTTPFetcher.php";\r
-\r
-require_once "Auth/OpenID.php";\r
-\r
-/**\r
- * A paranoid {@link Auth_Yadis_HTTPFetcher} class which uses CURL\r
- * for fetching.\r
- *\r
- * @package OpenID\r
- */\r
-class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher {\r
-    function Auth_Yadis_ParanoidHTTPFetcher()\r
-    {\r
-        $this->reset();\r
-    }\r
-\r
-    function reset()\r
-    {\r
-        $this->headers = array();\r
-        $this->data = "";\r
-    }\r
-\r
-    /**\r
-     * @access private\r
-     */\r
-    function _writeHeader($ch, $header)\r
-    {\r
-        array_push($this->headers, rtrim($header));\r
-        return strlen($header);\r
-    }\r
-\r
-    /**\r
-     * @access private\r
-     */\r
-    function _writeData($ch, $data)\r
-    {\r
-        if (strlen($this->data) > 1024*Auth_OpenID_FETCHER_MAX_RESPONSE_KB) {\r
-            return 0;\r
-        } else {\r
-            $this->data .= $data;\r
-            return strlen($data);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Does this fetcher support SSL URLs?\r
-     */\r
-    function supportsSSL()\r
-    {\r
-        $v = curl_version();\r
-        if(is_array($v)) {\r
-            return in_array('https', $v['protocols']);\r
-        } elseif (is_string($v)) {\r
-            return preg_match('/OpenSSL/i', $v);\r
-        } else {\r
-            return 0;\r
-        }\r
-    }\r
-\r
-    function get($url, $extra_headers = null)\r
-    {\r
-        if (!$this->canFetchURL($url)) {\r
-            return null;\r
-        }\r
-\r
-        $stop = time() + $this->timeout;\r
-        $off = $this->timeout;\r
-\r
-        $redir = true;\r
-\r
-        while ($redir && ($off > 0)) {\r
-            $this->reset();\r
-\r
-            $c = curl_init();\r
-\r
-            if ($c === false) {\r
-                Auth_OpenID::log(\r
-                    "curl_init returned false; could not " .\r
-                    "initialize for URL '%s'", $url);\r
-                return null;\r
-            }\r
-\r
-            if (defined('CURLOPT_NOSIGNAL')) {\r
-                curl_setopt($c, CURLOPT_NOSIGNAL, true);\r
-            }\r
-\r
-            if (!$this->allowedURL($url)) {\r
-                Auth_OpenID::log("Fetching URL not allowed: %s",\r
-                                 $url);\r
-                return null;\r
-            }\r
-\r
-            curl_setopt($c, CURLOPT_WRITEFUNCTION,\r
-                        array(&$this, "_writeData"));\r
-            curl_setopt($c, CURLOPT_HEADERFUNCTION,\r
-                        array(&$this, "_writeHeader"));\r
-\r
-            if ($extra_headers) {\r
-                curl_setopt($c, CURLOPT_HTTPHEADER, $extra_headers);\r
-            }\r
-\r
-            $cv = curl_version();\r
-            if(is_array($cv)) {\r
-              $curl_user_agent = 'curl/'.$cv['version'];\r
-            } else {\r
-              $curl_user_agent = $cv;\r
-            }\r
-            curl_setopt($c, CURLOPT_USERAGENT,\r
-                        Auth_OpenID_USER_AGENT.' '.$curl_user_agent);\r
-            curl_setopt($c, CURLOPT_TIMEOUT, $off);\r
-            curl_setopt($c, CURLOPT_URL, $url);\r
-            curl_setopt($c, CURLOPT_RANGE, \r
-                        "0-".(1024 * Auth_OpenID_FETCHER_MAX_RESPONSE_KB));\r
-\r
-                       // <TYPO3-specific>\r
-                       if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {\r
-                               curl_setopt($c, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);\r
-\r
-                               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']) {\r
-                                       curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']);\r
-                               }\r
-                               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']) {\r
-                                       curl_setopt($c, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);\r
-                               }\r
-                       }\r
-                       // </TYPO3-specific>\r
-\r
-            curl_exec($c);\r
-\r
-            $code = curl_getinfo($c, CURLINFO_HTTP_CODE);\r
-            $body = $this->data;\r
-            $headers = $this->headers;\r
-\r
-            if (!$code) {\r
-                Auth_OpenID::log("Got no response code when fetching %s", $url);\r
-                Auth_OpenID::log("CURL error (%s): %s",\r
-                                 curl_errno($c), curl_error($c));\r
-                return null;\r
-            }\r
-\r
-            if (in_array($code, array(301, 302, 303, 307))) {\r
-                $url = $this->_findRedirect($headers);\r
-                $redir = true;\r
-            } else {\r
-                $redir = false;\r
-                curl_close($c);\r
-\r
-                $new_headers = array();\r
-\r
-                foreach ($headers as $header) {\r
-                    if (strpos($header, ': ')) {\r
-                        list($name, $value) = explode(': ', $header, 2);\r
-                        $new_headers[$name] = $value;\r
-                    }\r
-                }\r
-\r
-                Auth_OpenID::log(\r
-                    "Successfully fetched '%s': GET response code %s",\r
-                    $url, $code);\r
-\r
-                return new Auth_Yadis_HTTPResponse($url, $code,\r
-                                                    $new_headers, $body);\r
-            }\r
-\r
-            $off = $stop - time();\r
-        }\r
-\r
-        return null;\r
-    }\r
-\r
-    function post($url, $body, $extra_headers = null)\r
-    {\r
-        if (!$this->canFetchURL($url)) {\r
-            return null;\r
-        }\r
-\r
-        $this->reset();\r
-\r
-        $c = curl_init();\r
-\r
-        if (defined('CURLOPT_NOSIGNAL')) {\r
-            curl_setopt($c, CURLOPT_NOSIGNAL, true);\r
-        }\r
-\r
-        curl_setopt($c, CURLOPT_POST, true);\r
-        curl_setopt($c, CURLOPT_POSTFIELDS, $body);\r
-        curl_setopt($c, CURLOPT_TIMEOUT, $this->timeout);\r
-        curl_setopt($c, CURLOPT_URL, $url);\r
-        curl_setopt($c, CURLOPT_WRITEFUNCTION,\r
-                    array(&$this, "_writeData"));\r
-\r
-               // <TYPO3-specific>\r
-               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {\r
-                       curl_setopt($c, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);\r
-\r
-                       if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']) {\r
-                               curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']);\r
-                       }\r
-                       if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']) {\r
-                               curl_setopt($c, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);\r
-                       }\r
-               }\r
-               // </TYPO3-specific>\r
-\r
-        curl_exec($c);\r
-\r
-        $code = curl_getinfo($c, CURLINFO_HTTP_CODE);\r
-\r
-        if (!$code) {\r
-            Auth_OpenID::log("Got no response code when fetching %s", $url);\r
-            return null;\r
-        }\r
-\r
-        $body = $this->data;\r
-\r
-        curl_close($c);\r
-\r
-        $new_headers = $extra_headers;\r
-\r
-        foreach ($this->headers as $header) {\r
-            if (strpos($header, ': ')) {\r
-                list($name, $value) = explode(': ', $header, 2);\r
-                $new_headers[$name] = $value;\r
-            }\r
-\r
-        }\r
-\r
-        Auth_OpenID::log("Successfully fetched '%s': POST response code %s",\r
-                         $url, $code);\r
-\r
-        return new Auth_Yadis_HTTPResponse($url, $code,\r
-                                           $new_headers, $body);\r
-    }\r
-}\r
-\r
+<?php
+
+/**
+ * This module contains the CURL-based HTTP fetcher implementation.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: See the COPYING file included in this distribution.
+ *
+ * @package OpenID
+ * @author JanRain, Inc. <openid@janrain.com>
+ * @copyright 2005-2008 Janrain, Inc.
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache
+ */
+
+/**
+ * Interface import
+ */
+require_once "Auth/Yadis/HTTPFetcher.php";
+
+require_once "Auth/OpenID.php";
+
+/**
+ * A paranoid {@link Auth_Yadis_HTTPFetcher} class which uses CURL
+ * for fetching.
+ *
+ * @package OpenID
+ */
+class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher {
+    function Auth_Yadis_ParanoidHTTPFetcher()
+    {
+        $this->reset();
+    }
+
+    function reset()
+    {
+        $this->headers = array();
+        $this->data = "";
+    }
+
+    /**
+     * @access private
+     */
+    function _writeHeader($ch, $header)
+    {
+        array_push($this->headers, rtrim($header));
+        return strlen($header);
+    }
+
+    /**
+     * @access private
+     */
+    function _writeData($ch, $data)
+    {
+        if (strlen($this->data) > 1024*Auth_OpenID_FETCHER_MAX_RESPONSE_KB) {
+            return 0;
+        } else {
+            $this->data .= $data;
+            return strlen($data);
+        }
+    }
+
+    /**
+     * Does this fetcher support SSL URLs?
+     */
+    function supportsSSL()
+    {
+        $v = curl_version();
+        if(is_array($v)) {
+            return in_array('https', $v['protocols']);
+        } elseif (is_string($v)) {
+            return preg_match('/OpenSSL/i', $v);
+        } else {
+            return 0;
+        }
+    }
+
+    function get($url, $extra_headers = null)
+    {
+        if (!$this->canFetchURL($url)) {
+            return null;
+        }
+
+        $stop = time() + $this->timeout;
+        $off = $this->timeout;
+
+        $redir = true;
+
+        while ($redir && ($off > 0)) {
+            $this->reset();
+
+            $c = curl_init();
+
+            if ($c === false) {
+                Auth_OpenID::log(
+                    "curl_init returned false; could not " .
+                    "initialize for URL '%s'", $url);
+                return null;
+            }
+
+            if (defined('CURLOPT_NOSIGNAL')) {
+                curl_setopt($c, CURLOPT_NOSIGNAL, true);
+            }
+
+            if (!$this->allowedURL($url)) {
+                Auth_OpenID::log("Fetching URL not allowed: %s",
+                                 $url);
+                return null;
+            }
+
+            curl_setopt($c, CURLOPT_WRITEFUNCTION,
+                        array(&$this, "_writeData"));
+            curl_setopt($c, CURLOPT_HEADERFUNCTION,
+                        array(&$this, "_writeHeader"));
+
+            if ($extra_headers) {
+                curl_setopt($c, CURLOPT_HTTPHEADER, $extra_headers);
+            }
+
+            $cv = curl_version();
+            if(is_array($cv)) {
+              $curl_user_agent = 'curl/'.$cv['version'];
+            } else {
+              $curl_user_agent = $cv;
+            }
+            curl_setopt($c, CURLOPT_USERAGENT,
+                        Auth_OpenID_USER_AGENT.' '.$curl_user_agent);
+            curl_setopt($c, CURLOPT_TIMEOUT, $off);
+            curl_setopt($c, CURLOPT_URL, $url);
+            curl_setopt($c, CURLOPT_RANGE, 
+                        "0-".(1024 * Auth_OpenID_FETCHER_MAX_RESPONSE_KB));
+
+                       // <TYPO3-specific>
+                       if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {
+                               curl_setopt($c, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);
+
+                               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']) {
+                                       curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']);
+                               }
+                               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']) {
+                                       curl_setopt($c, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);
+                               }
+                       }
+                       // </TYPO3-specific>
+
+            curl_exec($c);
+
+            $code = curl_getinfo($c, CURLINFO_HTTP_CODE);
+            $body = $this->data;
+            $headers = $this->headers;
+
+            if (!$code) {
+                Auth_OpenID::log("Got no response code when fetching %s", $url);
+                Auth_OpenID::log("CURL error (%s): %s",
+                                 curl_errno($c), curl_error($c));
+                return null;
+            }
+
+            if (in_array($code, array(301, 302, 303, 307))) {
+                $url = $this->_findRedirect($headers);
+                $redir = true;
+            } else {
+                $redir = false;
+                curl_close($c);
+
+                $new_headers = array();
+
+                foreach ($headers as $header) {
+                    if (strpos($header, ': ')) {
+                        list($name, $value) = explode(': ', $header, 2);
+                        $new_headers[$name] = $value;
+                    }
+                }
+
+                Auth_OpenID::log(
+                    "Successfully fetched '%s': GET response code %s",
+                    $url, $code);
+
+                return new Auth_Yadis_HTTPResponse($url, $code,
+                                                    $new_headers, $body);
+            }
+
+            $off = $stop - time();
+        }
+
+        return null;
+    }
+
+    function post($url, $body, $extra_headers = null)
+    {
+        if (!$this->canFetchURL($url)) {
+            return null;
+        }
+
+        $this->reset();
+
+        $c = curl_init();
+
+        if (defined('CURLOPT_NOSIGNAL')) {
+            curl_setopt($c, CURLOPT_NOSIGNAL, true);
+        }
+
+        curl_setopt($c, CURLOPT_POST, true);
+        curl_setopt($c, CURLOPT_POSTFIELDS, $body);
+        curl_setopt($c, CURLOPT_TIMEOUT, $this->timeout);
+        curl_setopt($c, CURLOPT_URL, $url);
+        curl_setopt($c, CURLOPT_WRITEFUNCTION,
+                    array(&$this, "_writeData"));
+
+               // <TYPO3-specific>
+               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {
+                       curl_setopt($c, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);
+
+                       if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']) {
+                               curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']);
+                       }
+                       if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']) {
+                               curl_setopt($c, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);
+                       }
+               }
+               // </TYPO3-specific>
+
+        curl_exec($c);
+
+        $code = curl_getinfo($c, CURLINFO_HTTP_CODE);
+
+        if (!$code) {
+            Auth_OpenID::log("Got no response code when fetching %s", $url);
+            return null;
+        }
+
+        $body = $this->data;
+
+        curl_close($c);
+
+        $new_headers = $extra_headers;
+
+        foreach ($this->headers as $header) {
+            if (strpos($header, ': ')) {
+                list($name, $value) = explode(': ', $header, 2);
+                $new_headers[$name] = $value;
+            }
+
+        }
+
+        Auth_OpenID::log("Successfully fetched '%s': POST response code %s",
+                         $url, $code);
+
+        return new Auth_Yadis_HTTPResponse($url, $code,
+                                           $new_headers, $body);
+    }
+}
+
 ?>
\ No newline at end of file
index 2e4cdf0..da83cbe 100644 (file)
@@ -1,11 +1,11 @@
-This directory contains a modified version of the PHP OpenID library\r
-(http://www.openidenabled.com/). We use only "Auth" directory from the library\r
-and include also a copy of COPYING file to conform to the license requirements.\r
-\r
-Current version of the library is 2.1.2.\r
-\r
-The following modifications are made:\r
-- added cURL proxy settings from TYPO3 to the Auth/Yadis/ParanoidHTTPFetcher.php\r
-\r
-See also the patch to the library. If the library is updated, the patch should\r
+This directory contains a modified version of the PHP OpenID library
+(http://www.openidenabled.com/). We use only "Auth" directory from the library
+and include also a copy of COPYING file to conform to the license requirements.
+
+Current version of the library is 2.1.2.
+
+The following modifications are made:
+- added cURL proxy settings from TYPO3 to the Auth/Yadis/ParanoidHTTPFetcher.php
+
+See also the patch to the library. If the library is updated, the patch should
 be applied to a new version.
\ No newline at end of file
index 510010e..efefa6f 100644 (file)
@@ -1,43 +1,43 @@
-diff -b -r -u Auth/Yadis/ParanoidHTTPFetcher.php Auth/Yadis/ParanoidHTTPFetcher.php\r
---- Auth/Yadis/ParanoidHTTPFetcher.php 2008-09-09 21:12:13.000000000 +0200\r
-+++ Auth/Yadis/ParanoidHTTPFetcher.php 2008-09-24 22:24:11.000000000 +0200\r
-@@ -130,6 +130,19 @@\r
-             curl_setopt($c, CURLOPT_RANGE, \r
-                         "0-".(1024 * Auth_OpenID_FETCHER_MAX_RESPONSE_KB));\r
\r
-+                      // <TYPO3-specific>\r
-+                      if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {\r
-+                              curl_setopt($c, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);\r
-+\r
-+                              if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']) {\r
-+                                      curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']);\r
-+                              }\r
-+                              if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']) {\r
-+                                      curl_setopt($c, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);\r
-+                              }\r
-+                      }\r
-+                      // </TYPO3-specific>\r
-+\r
-             curl_exec($c);\r
\r
-             $code = curl_getinfo($c, CURLINFO_HTTP_CODE);\r
-@@ -194,6 +207,19 @@\r
-         curl_setopt($c, CURLOPT_WRITEFUNCTION,\r
-                     array(&$this, "_writeData"));\r
\r
-+              // <TYPO3-specific>\r
-+              if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {\r
-+                      curl_setopt($c, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);\r
-+\r
-+                      if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']) {\r
-+                              curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']);\r
-+                      }\r
-+                      if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']) {\r
-+                              curl_setopt($c, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);\r
-+                      }\r
-+              }\r
-+              // </TYPO3-specific>\r
-+\r
-         curl_exec($c);\r
\r
-         $code = curl_getinfo($c, CURLINFO_HTTP_CODE);\r
+diff -b -r -u Auth/Yadis/ParanoidHTTPFetcher.php Auth/Yadis/ParanoidHTTPFetcher.php
+--- Auth/Yadis/ParanoidHTTPFetcher.php 2008-09-09 21:12:13.000000000 +0200
++++ Auth/Yadis/ParanoidHTTPFetcher.php 2008-09-24 22:24:11.000000000 +0200
+@@ -130,6 +130,19 @@
+             curl_setopt($c, CURLOPT_RANGE, 
+                         "0-".(1024 * Auth_OpenID_FETCHER_MAX_RESPONSE_KB));
++                      // <TYPO3-specific>
++                      if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {
++                              curl_setopt($c, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);
++
++                              if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']) {
++                                      curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']);
++                              }
++                              if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']) {
++                                      curl_setopt($c, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);
++                              }
++                      }
++                      // </TYPO3-specific>
++
+             curl_exec($c);
+             $code = curl_getinfo($c, CURLINFO_HTTP_CODE);
+@@ -194,6 +207,19 @@
+         curl_setopt($c, CURLOPT_WRITEFUNCTION,
+                     array(&$this, "_writeData"));
++              // <TYPO3-specific>
++              if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {
++                      curl_setopt($c, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);
++
++                      if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']) {
++                              curl_setopt($c, CURLOPT_HTTPPROXYTUNNEL, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyTunnel']);
++                      }
++                      if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']) {
++                              curl_setopt($c, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);
++                      }
++              }
++              // </TYPO3-specific>
++
+         curl_exec($c);
+         $code = curl_getinfo($c, CURLINFO_HTTP_CODE);
index ca8711e..756c391 100644 (file)
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>\r
-<!-- $Id: locallang_csh.xml 200 2007-09-29 20:49:42Z dima $ -->\r
-<T3locallang>\r
-    <meta type="array">\r
-        <description>CSH labels</description>\r
-        <type>CSH</type>\r
-        <csh_table>openid</csh_table>\r
-        <fileId>EXT:openid/locallang_csh.xml</fileId>\r
-        <labelContext type="array">\r
-        </labelContext>\r
-    </meta>\r
-    <data type="array">\r
-        <languageKey index="default" type="array">\r
-            <label index="tx_openid_openid.description">OpenID identifier</label>\r
-            <label index="tx_openid_openid.details">This field contains option OpenID identifier. If the field is not empty, users can login to the system using their OpenID identifier.</label>\r
-            <label index="tx_openid_openid.seeAlso">http://openid.net/</label>\r
-        </languageKey>\r
-    </data>\r
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!-- $Id: locallang_csh.xml 200 2007-09-29 20:49:42Z dima $ -->
+<T3locallang>
+    <meta type="array">
+        <description>CSH labels</description>
+        <type>CSH</type>
+        <csh_table>openid</csh_table>
+        <fileId>EXT:openid/locallang_csh.xml</fileId>
+        <labelContext type="array">
+        </labelContext>
+    </meta>
+    <data type="array">
+        <languageKey index="default" type="array">
+            <label index="tx_openid_openid.description">OpenID identifier</label>
+            <label index="tx_openid_openid.details">This field contains option OpenID identifier. If the field is not empty, users can login to the system using their OpenID identifier.</label>
+            <label index="tx_openid_openid.seeAlso">http://openid.net/</label>
+        </languageKey>
+    </data>
 </T3locallang>
\ No newline at end of file
index 85f09c5..b069aef 100644 (file)
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>\r
-<T3locallang>\r
-       <meta type="array">\r
-               <type>database</type>\r
-               <description>Language labels for database tables/fields belonging to extension 'openid'</description>\r
-       </meta>\r
-       <data type="array">\r
-               <languageKey index="default" type="array">\r
-                       <label index="be_users.tx_openid_openid">OpenID identifier:</label>\r
-                       <label index="fe_users.tx_openid_openid">OpenID identifier:</label>\r
-               </languageKey>\r
-       </data>\r
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>database</type>
+               <description>Language labels for database tables/fields belonging to extension 'openid'</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="be_users.tx_openid_openid">OpenID identifier:</label>
+                       <label index="fe_users.tx_openid_openid">OpenID identifier:</label>
+               </languageKey>
+       </data>
 </T3locallang>
\ No newline at end of file
index fd75d9b..d59b324 100644 (file)
-<?php\r
-/***************************************************************\r
-*  Copyright notice\r
-*\r
-*  (c) 2008 Dmitry Dulepov <dmitry@typo3.org>\r
-*  All rights reserved\r
-*\r
-*  This script is part of the TYPO3 project. The TYPO3 project is\r
-*  free software; you can redistribute it and/or modify\r
-*  it under the terms of the GNU General Public License as published by\r
-*  the Free Software Foundation; either version 2 of the License, or\r
-*  (at your option) any later version.\r
-*\r
-*  The GNU General Public License can be found at\r
-*  http://www.gnu.org/copyleft/gpl.html.\r
-*\r
-*  This script is distributed in the hope that it will be useful,\r
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-*  GNU General Public License for more details.\r
-*\r
-*  This copyright notice MUST APPEAR in all copies of the script!\r
-***************************************************************/\r
-/**\r
- * [CLASS/FUNCTION INDEX of SCRIPT]\r
- *\r
- *\r
- *\r
- *   57: class tx_openid_sv1 extends t3lib_svbase\r
- *   92:     public function init()\r
- *  119:     public function initAuth($subType, array $loginData, array $authenticationInformation, t3lib_userAuth &$parentObject)\r
- *  139:     public function getUser()\r
- *  176:     public function authUser(array $userRecord)\r
- *  221:     protected function includePHPOpenIDLibrary()\r
- *  250:     protected function getUserRecord($openIDIdentifier)\r
- *  273:     protected function getOpenIDConsumer()\r
- *  300:     protected function sendOpenIDRequest()\r
- *  368:     protected function getReturnURL()\r
- *  414:     protected function writeLog($message)\r
- *\r
- * TOTAL FUNCTIONS: 10\r
- * (This index is automatically created/updated by the extension "extdeveval")\r
- *\r
- */\r
-\r
-require_once(PATH_t3lib . 'class.t3lib_svbase.php');\r
-\r
-/**\r
- * Service "OpenID Authentication" for the "openid" extension.\r
- *\r
- * $Id: $\r
- *\r
- * @author     Dmitry Dulepov <dmitry@typo3.org>\r
- * @package    TYPO3\r
- * @subpackage tx_openid\r
- */\r
-class tx_openid_sv1 extends t3lib_svbase {\r
-       /** Class name */\r
-       public $prefixId = 'tx_openid_sv1';             // Same as class name\r
-\r
-       /** Path to this script relative to the extension directory */\r
-       public $scriptRelPath = 'sv1/class.tx_openid_sv1.php';\r
-\r
-       /** The extension key */\r
-       public $extKey = 'openid';\r
-\r
-       /** Login data as passed to initAuth() */\r
-       protected $loginData = array();\r
-\r
-       /**\r
-        * Additional authentication information provided by t3lib_userAuth. We use\r
-        * it to decide what database table contains user records.\r
-        */\r
-       protected $authenticationInformation = array();\r
-\r
-       /**\r
-        * OpenID response object. It is initialized when OpenID provider returns\r
-        * with success/failure response to us.\r
-        *\r
-        * @var Auth_OpenID_ConsumerResponse\r
-        */\r
-       protected $openIDResponse = null;\r
-\r
-       /**\r
-        * A reference to the calling object\r
-        *\r
-        * @var t3lib_userAuth\r
-        */\r
-       protected $parentObject;\r
-\r
-       /**\r
-        * If set to true, than libraries are already included.\r
-        */\r
-       protected static $openIDLibrariesIncluded = false;\r
-\r
-       /**\r
-        * Checks if service is available,. In case of this service we check that\r
-        * prerequesties for "PHP OpenID" libraries are fulfilled:\r
-        * - GMP or BCMATH PHP extensions are installed and functional\r
-        * - set_include_path() PHP function is available\r
-        *\r
-        * @return      boolean         true if service is available\r
-        */\r
-       public function init() {\r
-               $available = false;\r
-               if (extension_loaded('gmp')) {\r
-                       $available = is_callable('gmp_init');\r
-               } elseif (extension_loaded('bcmath')) {\r
-                       $available = is_callable('bcadd');\r
-               } else {\r
-                       $this->writeLog('Neither bcmath, nor gmp PHP extension found. OpenID authentication will not be available.');\r
-               }\r
-               // We also need set_include_path() PHP function\r
-               if (!is_callable('set_include_path')) {\r
-                       $available = false;\r
-                       $this->writeDevLog('set_include_path() PHP function is not available. OpenID authentication is disabled.');\r
-               }\r
-               return $available ? parent::init() : false;\r
-       }\r
-\r
-       /**\r
-        * Initializes authentication for this service.\r
-        *\r
-        * @param       string                  $subType: Subtype for authentication (either "getUserFE" or "getUserBE")\r
-        * @param       array                   $loginData: Login data submitted by user and preprocessed by t3lib/class.t3lib_userauth.php\r
-        * @param       array                   $authenticationInformation: Additional TYPO3 information for authentication services (unused here)\r
-        * @param       t3lib_userAuth  $parentObject: Calling object\r
-        * @return      void\r
-        */\r
-       public function initAuth($subType, array $loginData, array $authenticationInformation, t3lib_userAuth &$parentObject) {\r
-               // Store login and authetication data\r
-               $this->loginData = $loginData;\r
-               $this->authenticationInformation = $authenticationInformation;\r
-               // If we are here after authentication by the OpenID server, get its response.\r
-               if (t3lib_div::GPvar('tx_openid_mode') == 'finish' && $this->openIDResponse == null) {\r
-                       $this->includePHPOpenIDLibrary();\r
-                       $openIDConsumer = $this->getOpenIDConsumer();\r
-                       $this->openIDResponse = $openIDConsumer->complete($this->getReturnURL());\r
-               }\r
-               $this->parentObject = $parentObject;\r
-       }\r
-\r
-       /**\r
-        * This function returns the user record back to the t3lib_userAuth. it does not\r
-        * mean that user is authenticated, it means only that user is found. This\r
-        * function makes sure that user cannot be authenticated by any other service\r
-        * if user tries to use OpenID to authenticate.\r
-        *\r
-        * @return      mixed           User record (content of fe_users/be_users as appropriate for the current mode)\r
-        */\r
-       public function getUser() {\r
-               $userRecord = null;\r
-               if ($this->loginData['status'] == 'login') {\r
-                       if ($this->openIDResponse instanceof Auth_OpenID_ConsumerResponse) {\r
-                               // We are running inside the OpenID return script\r
-                               // Note: we cannot use $this->openIDResponse->getDisplayIdentifier()\r
-                               // because it may return a different identifier. For example,\r
-                               // LiveJournal server converts all underscore characters in the\r
-                               // original identfier to dashes.\r
-                               if ($this->openIDResponse->status == Auth_OpenID_SUCCESS) {\r
-                                       $claimedOpenIDIdentifier = t3lib_div::GPvar('tx_openid_claimed');\r
-                                       if ($claimedOpenIDIdentifier) {\r
-                                               $userRecord = $this->getUserRecord($claimedOpenIDIdentifier);\r
-                                               $this->writeLog('User \'%s\' logged in with OpenID \'%s\'',\r
-                                                       $userRecord[$this->parentObject->formfield_uname], $claimedOpenIDIdentifier);\r
-                                       }\r
-                               }\r
-                       } else {\r
-                               // Here if user just started authentication\r
-                               $userRecord = $this->getUserRecord($this->loginData['uname']);\r
-                       }\r
-                       // The above function will return user record from the OpenID. It means that\r
-                       // user actually tried to authenticate using his OpenID. In this case\r
-                       // we must change the password in the record to a long random string so\r
-                       // that this user cannot be authenticated with other service.\r
-                       if (is_array($userRecord)) {\r
-                               $userRecord[$this->authenticationInformation['db_user']['userident_column']] = uniqid($this->prefixId . chr(10), true);\r
-                       }\r
-               }\r
-               return $userRecord;\r
-       }\r
-\r
-       /**\r
-        * Authenticates user using OpenID.\r
-        *\r
-        * @param       array           $userRecord     User record\r
-        * @return      int             Code that shows if user is really authenticated.\r
-        * @see t3lib_userAuth::checkAuthentication()\r
-        */\r
-       public function authUser(array $userRecord) {\r
-               $result = 0;    // 0 means authentication failure\r
-\r
-               if ($userRecord['tx_openid_openid'] == '') {\r
-                       // If user does not have OpenID, let other services to try (code 100)\r
-                       $result = 100;\r
-               } else {\r
-                       // Check if user is identified by the OpenID\r
-                       if ($this->openIDResponse instanceof Auth_OpenID_ConsumerResponse) {\r
-                               // If we have a response, it means OpenID server tried to authenticate\r
-                               // the user. Now we just look what is the status and provide\r
-                               // corresponding response to the caller\r
-                               if ($this->openIDResponse->status == Auth_OpenID_SUCCESS) {\r
-                                       // Success (code 200)\r
-                                       $result = 200;\r
-                               } else {\r
-                                       $this->writeDevLog('OpenID authentication failed with code \'%s\'.',\r
-                                                       $this->openIDResponse->status);\r
-                               }\r
-                       } else {\r
-                               // We may need to send a request to the OpenID server.\r
-                               // Check if the user identifier looks like OpenID user identifier first.\r
-                               // Prevent PHP warning in case if identifiers is not an OpenID identifier\r
-                               // (not an URL).\r
-                               $urlParts = @parse_url($this->loginData['uname']);\r
-                               if (is_array($urlParts) && $urlParts['scheme'] != '' && $urlParts['host']) {\r
-                                       // Yes, this looks like a good OpenID. Ask OpenID server (should not return)\r
-                                       $this->sendOpenIDRequest();\r
-                                       // If we are here, it means we have a valid OpenID but failed to\r
-                                       // contact the server. We stop authentication process.\r
-                                       // Alternatively it may mean that OpenID format is not correct.\r
-                                       // In both cases we return code 0 (complete failure)\r
-                               } else {\r
-                                       $result = 100;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               return $result;\r
-       }\r
-\r
-       /**\r
-        * Includes necessary files for the PHP OpenID library\r
-        *\r
-        * @return      void\r
-        */\r
-       protected function includePHPOpenIDLibrary() {\r
-               if (!self::$openIDLibrariesIncluded) {\r
-\r
-                       // Prevent further calls\r
-                       self::$openIDLibrariesIncluded = true;\r
-\r
-                       // PHP OpenID libraries requires adjustments of path settings\r
-                       $oldIncludePath = get_include_path();\r
-                       $phpOpenIDLibPath = t3lib_extMgm::extPath('openid') . 'lib/php-openid';\r
-                       @set_include_path($phpOpenIDLibPath . PATH_SEPARATOR .\r
-                                                       $phpOpenIDLibPath . PATH_SEPARATOR . 'Auth' .\r
-                                                       PATH_SEPARATOR . $oldIncludePath);\r
-\r
-                       // Make sure that random generator is properly set up. Constant could be\r
-                       // defined by the previous inclusion of the file\r
-                       if (!defined('Auth_OpenID_RAND_SOURCE')) {\r
-                               if (TYPO3_OS == 'WIN') {\r
-                                       // No random generator on Windows!\r
-                                       define('Auth_OpenID_RAND_SOURCE', null);\r
-                               } elseif (!is_readable('/dev/urandom')) {\r
-                                       if (is_readable('/dev/random')) {\r
-                                               define('Auth_OpenID_RAND_SOURCE', '/dev/random');\r
-                                       } else {\r
-                                               define('Auth_OpenID_RAND_SOURCE', null);\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       // Include files\r
-                       require_once($phpOpenIDLibPath . '/Auth/OpenID/Consumer.php');\r
-                       require_once($phpOpenIDLibPath . '/Auth/OpenID/FileStore.php');\r
-\r
-                       // Restore path\r
-                       @set_include_path($oldIncludePath);\r
-\r
-                       if (!is_array($_SESSION)) {\r
-                               // Yadis requires session but session is not initialized when\r
-                               // processing Backend authentication\r
-                               @session_start();\r
-                               $this->writeLog('Session is initialized');\r
-                       }\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Gets user record for the user with the OpenID provided by the user\r
-        *\r
-        * @param       string          $openIDIdentifier       OpenID identifier to search for\r
-        * @return      array           Database fields from the table that corresponds to the current login mode (FE/BE)\r
-        */\r
-       protected function getUserRecord($openIDIdentifier) {\r
-               $record = null;\r
-               if ($openIDIdentifier) {\r
-                       list($record) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*',\r
-                               $this->authenticationInformation['db_user']['table'],\r
-                               'tx_openid_openid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($openIDIdentifier, $this->authenticationInformation['db_user']['table']) .\r
-                                       $this->authenticationInformation['db_user']['check_pid_clause'] .\r
-                                       $this->authenticationInformation['db_user']['enable_clause']);\r
-               } else {\r
-                       // This should never happen and generally means hack attempt.\r
-                       // We just log it and do not return any records.\r
-                       $this->writeLog('getUserRecord is called with the empty OpenID');\r
-               }\r
-               return $record;\r
-       }\r
-\r
-       /**\r
-        * Creates OpenID Consumer object with a TYPO3-specific store. This function\r
-        * is almost identical to the example from the PHP OpenID library.\r
-        * @todo use DB (or the caching framework) instead of the filesystem to store OpenID data\r
-        * @return      Auth_OpenID_Consumer            Consumer instance\r
-        */\r
-       protected function getOpenIDConsumer() {\r
-               // TODO Change this to a TYPO3-specific database-based store in future.\r
-               // File-based store is ineffective and insecure. After changing\r
-               // get rid of the FileStore include in includePHPOpenIDLibrary()\r
-               $openIDStorePath = PATH_site . 'typo3temp/tx_openid';\r
-               // For now we just prevent any web access to these files\r
-               if (!file_exists($openIDStorePath . '/.htaccess')) {\r
-                       file_put_contents($openIDStorePath . '/.htaccess', 'deny from all');\r
-               }\r
-               $openIDStore = new Auth_OpenID_FileStore($openIDStorePath);\r
-               return new Auth_OpenID_Consumer($openIDStore);\r
-       }\r
-\r
-       /**\r
-        * Sends request to the OpenID server to authenticate the user with the\r
-        * given ID. This function is almost identical to the example from the PHP\r
-        * OpenID library. Due to the OpenID specification we cannot do a slient login.\r
-        * Sometimes we have to redirect to the OpenID provider web site so that\r
-        * user can enter his password there. In this case we will redirect and provide\r
-        * a return adress to the special script inside this directory, which will\r
-        * handle the result appropriately.\r
-        *\r
-        * This function does not return on success. If it returns, it means something\r
-        * went totally wrong with OpenID.\r
-        *\r
-        * @return      void\r
-        */\r
-       protected function sendOpenIDRequest() {\r
-               $this->includePHPOpenIDLibrary();\r
-\r
-               $openIDIdentifier = $this->loginData['uname'];\r
-\r
-               // Initialize OpenID client system, get the consumer\r
-               $openIDConsumer = $this->getOpenIDConsumer();\r
-\r
-               // Begin the OpenID authentication process\r
-               $authenticationRequest = $openIDConsumer->begin($openIDIdentifier);\r
-               if (!$authenticationRequest) {\r
-                       // Not a valid OpenID. Since it can be some other ID, we just return\r
-                       // and let other service handle it.\r
-                       $this->writeLog('Could not create authentication request for OpenID identifier \'%s\'', $openIDIdentifier);\r
-                       return;\r
-               }\r
-\r
-               // Redirect the user to the OpenID server for authentication.\r
-               // Store the token for this authentication so we can verify the\r
-               // response.\r
-\r
-               // For OpenID version 1, we *should* send a redirect. For OpenID version 2,\r
-               // we should use a Javascript form to send a POST request to the server.\r
-               $returnURL = $this->getReturnURL();\r
-               $trustedRoot = t3lib_div::getIndpEnv('TYPO3_SITE_URL');\r
-\r
-           if ($authenticationRequest->shouldSendRedirect()) {\r
-                       $redirectURL = $authenticationRequest->redirectURL($trustedRoot, $returnURL);\r
-\r
-                       // If the redirect URL can't be built, return. We can only return.\r
-                       if (Auth_OpenID::isFailure($redirectURL)) {\r
-                               $this->writeLog('Authentication request could not create redirect URL for OpenID identifier \'%s\'', $openIDIdentifier);\r
-                               return;\r
-                       }\r
-\r
-                       // Send redirect. We use 303 code because it allows to redirect POST\r
-                       // requests without resending the form. This is exactly what we need here.\r
-                       // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4\r
-                       @ob_end_clean();\r
-                       header(t3lib_div::HTTP_STATUS_303);\r
-                       header('Location: ' . $redirectURL);\r
-               } else {\r
-                       $formHtml = $authenticationRequest->htmlMarkup($trustedRoot,\r
-                                                       $returnURL, false, array('id' => 'openid_message'));\r
-\r
-                       // Display an error if the form markup couldn't be generated;\r
-                       // otherwise, render the HTML.\r
-                       if (Auth_OpenID::isFailure($formHtml)) {\r
-                               // Form markup cannot be generated\r
-                               $this->writeLog('Could not create form markup for OpenID identifier \'%s\'', $openIDIdentifier);\r
-                               return;\r
-                       } else {\r
-                               @ob_end_clean();\r
-                               echo $formHtml;\r
-                       }\r
-               }\r
-               // If we reached this point, we must not return!\r
-               exit;\r
-       }\r
-\r
-       /**\r
-        * Creates return URL for the OpenID server. When a user is authenticated by\r
-        * the OpenID server, the user will be sent to this URL to complete\r
-        * authentication process with the current site. We send it to our script.\r
-        *\r
-        * @return      string          Return URL\r
-        */\r
-       protected function getReturnURL() {\r
-               if ($this->authenticationInformation['loginType'] == 'FE') {\r
-                       // We will use eID to send user back, create session data and\r
-                       // return to the calling page.\r
-                       // Notice: 'pid' and 'logintype' parameter names cannot be changed!\r
-                       // They are essential for FE user authentication.\r
-                       $returnURL = 'index.php?eID=tx_openid&' .\r
-                                               'pid=' . $this->authenticationInformation['db_user']['checkPidList'] . '&' .\r
-                                               'logintype=login&';\r
-               } else {\r
-                       // In the Backend we will use dedicated script to create session.\r
-                       // It is much easier for the Backend to manage users.\r
-                       // Notice: 'login_status' parameter name cannot be changed!\r
-                       // It is essential for BE user authentication.\r
-                       $absoluteSiteURL = substr(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), strlen(t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST')));\r
-                       $returnURL = $absoluteSiteURL . TYPO3_mainDir . 'sysext/' . $this->extKey . '/class.tx_openid_return.php?login_status=login&';\r
-               }\r
-               if (t3lib_div::GPvar('tx_openid_mode') == 'finish') {\r
-                       $requestURL = t3lib_div::GPvar('tx_openid_location');\r
-                       $claimedIdentifier = t3lib_div::GPvar('tx_openid_claimed');\r
-               } else {\r
-                       $requestURL = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL');\r
-                       $claimedIdentifier = $this->loginData['uname'];\r
-               }\r
-               $returnURL .= 'tx_openid_location=' . rawurlencode($requestURL) . '&' .\r
-                                               'tx_openid_mode=finish&' .\r
-                                               'tx_openid_claimed=' . rawurlencode($claimedIdentifier);\r
-               return t3lib_div::locationHeaderUrl($returnURL);\r
-       }\r
-\r
-       /**\r
-        * Writes log message. Destination log depends on the current system mode.\r
-        * For FE the function writes to the admin panel log. For BE messages are\r
-        * sent to the system log. If developer log is enabled, messages are also\r
-        * sent there.\r
-        *\r
-        * This function accepts variable number of arguments and can format\r
-        * parameters. The syntax is the same as for sprintf()\r
-        *\r
-        * @param       string          $message        Message to output\r
-        * @return      void\r
-        * @see sprintf()\r
-        * @see t3lib::divLog()\r
-        * @see t3lib_div::sysLog()\r
-        * @see t3lib_timeTrack::setTSlogMessage()\r
-        */\r
-       protected function writeLog($message) {\r
-               if (func_num_args() > 1) {\r
-                       $params = func_get_args();\r
-                       array_shift($params);\r
-                       $message = vsprintf($message, $params);\r
-               }\r
-               if (TYPO3_MODE == 'BE') {\r
-                       t3lib_div::sysLog($message, $this->extKey, 1);\r
-               } else {\r
-                       $GLOBALS['TT']->setTSlogMessage($message);\r
-               }\r
-               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']) {\r
-                       t3lib_div::devLog($message, $this->extKey, 1);\r
-               }\r
-       }\r
-}\r
-\r
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/sv1/class.tx_openid_sv1.php']) {\r
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/sv1/class.tx_openid_sv1.php']);\r
-}\r
-\r
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Dmitry Dulepov <dmitry@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   57: class tx_openid_sv1 extends t3lib_svbase
+ *   92:     public function init()
+ *  119:     public function initAuth($subType, array $loginData, array $authenticationInformation, t3lib_userAuth &$parentObject)
+ *  139:     public function getUser()
+ *  176:     public function authUser(array $userRecord)
+ *  221:     protected function includePHPOpenIDLibrary()
+ *  250:     protected function getUserRecord($openIDIdentifier)
+ *  273:     protected function getOpenIDConsumer()
+ *  300:     protected function sendOpenIDRequest()
+ *  368:     protected function getReturnURL()
+ *  414:     protected function writeLog($message)
+ *
+ * TOTAL FUNCTIONS: 10
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+
+require_once(PATH_t3lib . 'class.t3lib_svbase.php');
+
+/**
+ * Service "OpenID Authentication" for the "openid" extension.
+ *
+ * $Id: $
+ *
+ * @author     Dmitry Dulepov <dmitry@typo3.org>
+ * @package    TYPO3
+ * @subpackage tx_openid
+ */
+class tx_openid_sv1 extends t3lib_svbase {
+       /** Class name */
+       public $prefixId = 'tx_openid_sv1';             // Same as class name
+
+       /** Path to this script relative to the extension directory */
+       public $scriptRelPath = 'sv1/class.tx_openid_sv1.php';
+
+       /** The extension key */
+       public $extKey = 'openid';
+
+       /** Login data as passed to initAuth() */
+       protected $loginData = array();
+
+       /**
+        * Additional authentication information provided by t3lib_userAuth. We use
+        * it to decide what database table contains user records.
+        */
+       protected $authenticationInformation = array();
+
+       /**
+        * OpenID response object. It is initialized when OpenID provider returns
+        * with success/failure response to us.
+        *
+        * @var Auth_OpenID_ConsumerResponse
+        */
+       protected $openIDResponse = null;
+
+       /**
+        * A reference to the calling object
+        *
+        * @var t3lib_userAuth
+        */
+       protected $parentObject;
+
+       /**
+        * If set to true, than libraries are already included.
+        */
+       protected static $openIDLibrariesIncluded = false;
+
+       /**
+        * Checks if service is available,. In case of this service we check that
+        * prerequesties for "PHP OpenID" libraries are fulfilled:
+        * - GMP or BCMATH PHP extensions are installed and functional
+        * - set_include_path() PHP function is available
+        *
+        * @return      boolean         true if service is available
+        */
+       public function init() {
+               $available = false;
+               if (extension_loaded('gmp')) {
+                       $available = is_callable('gmp_init');
+               } elseif (extension_loaded('bcmath')) {
+                       $available = is_callable('bcadd');
+               } else {
+                       $this->writeLog('Neither bcmath, nor gmp PHP extension found. OpenID authentication will not be available.');
+               }
+               // We also need set_include_path() PHP function
+               if (!is_callable('set_include_path')) {
+                       $available = false;
+                       $this->writeDevLog('set_include_path() PHP function is not available. OpenID authentication is disabled.');
+               }
+               return $available ? parent::init() : false;
+       }
+
+       /**
+        * Initializes authentication for this service.
+        *
+        * @param       string                  $subType: Subtype for authentication (either "getUserFE" or "getUserBE")
+        * @param       array                   $loginData: Login data submitted by user and preprocessed by t3lib/class.t3lib_userauth.php
+        * @param       array                   $authenticationInformation: Additional TYPO3 information for authentication services (unused here)
+        * @param       t3lib_userAuth  $parentObject: Calling object
+        * @return      void
+        */
+       public function initAuth($subType, array $loginData, array $authenticationInformation, t3lib_userAuth &$parentObject) {
+               // Store login and authetication data
+               $this->loginData = $loginData;
+               $this->authenticationInformation = $authenticationInformation;
+               // If we are here after authentication by the OpenID server, get its response.
+               if (t3lib_div::GPvar('tx_openid_mode') == 'finish' && $this->openIDResponse == null) {
+                       $this->includePHPOpenIDLibrary();
+                       $openIDConsumer = $this->getOpenIDConsumer();
+                       $this->openIDResponse = $openIDConsumer->complete($this->getReturnURL());
+               }
+               $this->parentObject = $parentObject;
+       }
+
+       /**
+        * This function returns the user record back to the t3lib_userAuth. it does not
+        * mean that user is authenticated, it means only that user is found. This
+        * function makes sure that user cannot be authenticated by any other service
+        * if user tries to use OpenID to authenticate.
+        *
+        * @return      mixed           User record (content of fe_users/be_users as appropriate for the current mode)
+        */
+       public function getUser() {
+               $userRecord = null;
+               if ($this->loginData['status'] == 'login') {
+                       if ($this->openIDResponse instanceof Auth_OpenID_ConsumerResponse) {
+                               // We are running inside the OpenID return script
+                               // Note: we cannot use $this->openIDResponse->getDisplayIdentifier()
+                               // because it may return a different identifier. For example,
+                               // LiveJournal server converts all underscore characters in the
+                               // original identfier to dashes.
+                               if ($this->openIDResponse->status == Auth_OpenID_SUCCESS) {
+                                       $claimedOpenIDIdentifier = t3lib_div::GPvar('tx_openid_claimed');
+                                       if ($claimedOpenIDIdentifier) {
+                                               $userRecord = $this->getUserRecord($claimedOpenIDIdentifier);
+                                               $this->writeLog('User \'%s\' logged in with OpenID \'%s\'',
+                                                       $userRecord[$this->parentObject->formfield_uname], $claimedOpenIDIdentifier);
+                                       }
+                               }
+                       } else {
+                               // Here if user just started authentication
+                               $userRecord = $this->getUserRecord($this->loginData['uname']);
+                       }
+                       // The above function will return user record from the OpenID. It means that
+                       // user actually tried to authenticate using his OpenID. In this case
+                       // we must change the password in the record to a long random string so
+                       // that this user cannot be authenticated with other service.
+                       if (is_array($userRecord)) {
+                               $userRecord[$this->authenticationInformation['db_user']['userident_column']] = uniqid($this->prefixId . chr(10), true);
+                       }
+               }
+               return $userRecord;
+       }
+
+       /**
+        * Authenticates user using OpenID.
+        *
+        * @param       array           $userRecord     User record
+        * @return      int             Code that shows if user is really authenticated.
+        * @see t3lib_userAuth::checkAuthentication()
+        */
+       public function authUser(array $userRecord) {
+               $result = 0;    // 0 means authentication failure
+
+               if ($userRecord['tx_openid_openid'] == '') {
+                       // If user does not have OpenID, let other services to try (code 100)
+                       $result = 100;
+               } else {
+                       // Check if user is identified by the OpenID
+                       if ($this->openIDResponse instanceof Auth_OpenID_ConsumerResponse) {
+                               // If we have a response, it means OpenID server tried to authenticate
+                               // the user. Now we just look what is the status and provide
+                               // corresponding response to the caller
+                               if ($this->openIDResponse->status == Auth_OpenID_SUCCESS) {
+                                       // Success (code 200)
+                                       $result = 200;
+                               } else {
+                                       $this->writeDevLog('OpenID authentication failed with code \'%s\'.',
+                                                       $this->openIDResponse->status);
+                               }
+                       } else {
+                               // We may need to send a request to the OpenID server.
+                               // Check if the user identifier looks like OpenID user identifier first.
+                               // Prevent PHP warning in case if identifiers is not an OpenID identifier
+                               // (not an URL).
+                               $urlParts = @parse_url($this->loginData['uname']);
+                               if (is_array($urlParts) && $urlParts['scheme'] != '' && $urlParts['host']) {
+                                       // Yes, this looks like a good OpenID. Ask OpenID server (should not return)
+                                       $this->sendOpenIDRequest();
+                                       // If we are here, it means we have a valid OpenID but failed to
+                                       // contact the server. We stop authentication process.
+                                       // Alternatively it may mean that OpenID format is not correct.
+                                       // In both cases we return code 0 (complete failure)
+                               } else {
+                                       $result = 100;
+                               }
+                       }
+               }
+
+               return $result;
+       }
+
+       /**
+        * Includes necessary files for the PHP OpenID library
+        *
+        * @return      void
+        */
+       protected function includePHPOpenIDLibrary() {
+               if (!self::$openIDLibrariesIncluded) {
+
+                       // Prevent further calls
+                       self::$openIDLibrariesIncluded = true;
+
+                       // PHP OpenID libraries requires adjustments of path settings
+                       $oldIncludePath = get_include_path();
+                       $phpOpenIDLibPath = t3lib_extMgm::extPath('openid') . 'lib/php-openid';
+                       @set_include_path($phpOpenIDLibPath . PATH_SEPARATOR .
+                                                       $phpOpenIDLibPath . PATH_SEPARATOR . 'Auth' .
+                                                       PATH_SEPARATOR . $oldIncludePath);
+
+                       // Make sure that random generator is properly set up. Constant could be
+                       // defined by the previous inclusion of the file
+                       if (!defined('Auth_OpenID_RAND_SOURCE')) {
+                               if (TYPO3_OS == 'WIN') {
+                                       // No random generator on Windows!
+                                       define('Auth_OpenID_RAND_SOURCE', null);
+                               } elseif (!is_readable('/dev/urandom')) {
+                                       if (is_readable('/dev/random')) {
+                                               define('Auth_OpenID_RAND_SOURCE', '/dev/random');
+                                       } else {
+                                               define('Auth_OpenID_RAND_SOURCE', null);
+                                       }
+                               }
+                       }
+
+                       // Include files
+                       require_once($phpOpenIDLibPath . '/Auth/OpenID/Consumer.php');
+                       require_once($phpOpenIDLibPath . '/Auth/OpenID/FileStore.php');
+
+                       // Restore path
+                       @set_include_path($oldIncludePath);
+
+                       if (!is_array($_SESSION)) {
+                               // Yadis requires session but session is not initialized when
+                               // processing Backend authentication
+                               @session_start();
+                               $this->writeLog('Session is initialized');
+                       }
+               }
+       }
+
+       /**
+        * Gets user record for the user with the OpenID provided by the user
+        *
+        * @param       string          $openIDIdentifier       OpenID identifier to search for
+        * @return      array           Database fields from the table that corresponds to the current login mode (FE/BE)
+        */
+       protected function getUserRecord($openIDIdentifier) {
+               $record = null;
+               if ($openIDIdentifier) {
+                       list($record) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*',
+                               $this->authenticationInformation['db_user']['table'],
+                               'tx_openid_openid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($openIDIdentifier, $this->authenticationInformation['db_user']['table']) .
+                                       $this->authenticationInformation['db_user']['check_pid_clause'] .
+                                       $this->authenticationInformation['db_user']['enable_clause']);
+               } else {
+                       // This should never happen and generally means hack attempt.
+                       // We just log it and do not return any records.
+                       $this->writeLog('getUserRecord is called with the empty OpenID');
+               }
+               return $record;
+       }
+
+       /**
+        * Creates OpenID Consumer object with a TYPO3-specific store. This function
+        * is almost identical to the example from the PHP OpenID library.
+        * @todo use DB (or the caching framework) instead of the filesystem to store OpenID data
+        * @return      Auth_OpenID_Consumer            Consumer instance
+        */
+       protected function getOpenIDConsumer() {
+               // TODO Change this to a TYPO3-specific database-based store in future.
+               // File-based store is ineffective and insecure. After changing
+               // get rid of the FileStore include in includePHPOpenIDLibrary()
+               $openIDStorePath = PATH_site . 'typo3temp/tx_openid';
+               // For now we just prevent any web access to these files
+               if (!file_exists($openIDStorePath . '/.htaccess')) {
+                       file_put_contents($openIDStorePath . '/.htaccess', 'deny from all');
+               }
+               $openIDStore = new Auth_OpenID_FileStore($openIDStorePath);
+               return new Auth_OpenID_Consumer($openIDStore);
+       }
+
+       /**
+        * Sends request to the OpenID server to authenticate the user with the
+        * given ID. This function is almost identical to the example from the PHP
+        * OpenID library. Due to the OpenID specification we cannot do a slient login.
+        * Sometimes we have to redirect to the OpenID provider web site so that
+        * user can enter his password there. In this case we will redirect and provide
+        * a return adress to the special script inside this directory, which will
+        * handle the result appropriately.
+        *
+        * This function does not return on success. If it returns, it means something
+        * went totally wrong with OpenID.
+        *
+        * @return      void
+        */
+       protected function sendOpenIDRequest() {
+               $this->includePHPOpenIDLibrary();
+
+               $openIDIdentifier = $this->loginData['uname'];
+
+               // Initialize OpenID client system, get the consumer
+               $openIDConsumer = $this->getOpenIDConsumer();
+
+               // Begin the OpenID authentication process
+               $authenticationRequest = $openIDConsumer->begin($openIDIdentifier);
+               if (!$authenticationRequest) {
+                       // Not a valid OpenID. Since it can be some other ID, we just return
+                       // and let other service handle it.
+                       $this->writeLog('Could not create authentication request for OpenID identifier \'%s\'', $openIDIdentifier);
+                       return;
+               }
+
+               // Redirect the user to the OpenID server for authentication.
+               // Store the token for this authentication so we can verify the
+               // response.
+
+               // For OpenID version 1, we *should* send a redirect. For OpenID version 2,
+               // we should use a Javascript form to send a POST request to the server.
+               $returnURL = $this->getReturnURL();
+               $trustedRoot = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
+
+           if ($authenticationRequest->shouldSendRedirect()) {
+                       $redirectURL = $authenticationRequest->redirectURL($trustedRoot, $returnURL);
+
+                       // If the redirect URL can't be built, return. We can only return.
+                       if (Auth_OpenID::isFailure($redirectURL)) {
+                               $this->writeLog('Authentication request could not create redirect URL for OpenID identifier \'%s\'', $openIDIdentifier);
+                               return;
+                       }
+
+                       // Send redirect. We use 303 code because it allows to redirect POST
+                       // requests without resending the form. This is exactly what we need here.
+                       // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4
+                       @ob_end_clean();
+                       header(t3lib_div::HTTP_STATUS_303);
+                       header('Location: ' . $redirectURL);
+               } else {
+                       $formHtml = $authenticationRequest->htmlMarkup($trustedRoot,
+                                                       $returnURL, false, array('id' => 'openid_message'));
+
+                       // Display an error if the form markup couldn't be generated;
+                       // otherwise, render the HTML.
+                       if (Auth_OpenID::isFailure($formHtml)) {
+                               // Form markup cannot be generated
+                               $this->writeLog('Could not create form markup for OpenID identifier \'%s\'', $openIDIdentifier);
+                               return;
+                       } else {
+                               @ob_end_clean();
+                               echo $formHtml;
+                       }
+               }
+               // If we reached this point, we must not return!
+               exit;
+       }
+
+       /**
+        * Creates return URL for the OpenID server. When a user is authenticated by
+        * the OpenID server, the user will be sent to this URL to complete
+        * authentication process with the current site. We send it to our script.
+        *
+        * @return      string          Return URL
+        */
+       protected function getReturnURL() {
+               if ($this->authenticationInformation['loginType'] == 'FE') {
+                       // We will use eID to send user back, create session data and
+                       // return to the calling page.
+                       // Notice: 'pid' and 'logintype' parameter names cannot be changed!
+                       // They are essential for FE user authentication.
+                       $returnURL = 'index.php?eID=tx_openid&' .
+                                               'pid=' . $this->authenticationInformation['db_user']['checkPidList'] . '&' .
+                                               'logintype=login&';
+               } else {
+                       // In the Backend we will use dedicated script to create session.
+                       // It is much easier for the Backend to manage users.
+                       // Notice: 'login_status' parameter name cannot be changed!
+                       // It is essential for BE user authentication.
+                       $absoluteSiteURL = substr(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), strlen(t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST')));
+                       $returnURL = $absoluteSiteURL . TYPO3_mainDir . 'sysext/' . $this->extKey . '/class.tx_openid_return.php?login_status=login&';
+               }
+               if (t3lib_div::GPvar('tx_openid_mode') == 'finish') {
+                       $requestURL = t3lib_div::GPvar('tx_openid_location');
+                       $claimedIdentifier = t3lib_div::GPvar('tx_openid_claimed');
+               } else {
+                       $requestURL = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL');
+                       $claimedIdentifier = $this->loginData['uname'];
+               }
+               $returnURL .= 'tx_openid_location=' . rawurlencode($requestURL) . '&' .
+                                               'tx_openid_mode=finish&' .
+                                               'tx_openid_claimed=' . rawurlencode($claimedIdentifier);
+               return t3lib_div::locationHeaderUrl($returnURL);
+       }
+
+       /**
+        * Writes log message. Destination log depends on the current system mode.
+        * For FE the function writes to the admin panel log. For BE messages are
+        * sent to the system log. If developer log is enabled, messages are also
+        * sent there.
+        *
+        * This function accepts variable number of arguments and can format
+        * parameters. The syntax is the same as for sprintf()
+        *
+        * @param       string          $message        Message to output
+        * @return      void
+        * @see sprintf()
+        * @see t3lib::divLog()
+        * @see t3lib_div::sysLog()
+        * @see t3lib_timeTrack::setTSlogMessage()
+        */
+       protected function writeLog($message) {
+               if (func_num_args() > 1) {
+                       $params = func_get_args();
+                       array_shift($params);
+                       $message = vsprintf($message, $params);
+               }
+               if (TYPO3_MODE == 'BE') {
+                       t3lib_div::sysLog($message, $this->extKey, 1);
+               } else {
+                       $GLOBALS['TT']->setTSlogMessage($message);
+               }
+               if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']) {
+                       t3lib_div::devLog($message, $this->extKey, 1);
+               }
+       }
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/sv1/class.tx_openid_sv1.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/sv1/class.tx_openid_sv1.php']);
+}
+
 ?>
\ No newline at end of file