From 580cd62f0a4fac5dba37a8a152afaecd99e8c767 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 15 Dec 2011 20:07:48 -0500 Subject: removed old libraries - depends on openid_api now --- .../examples/server/setup.php | 558 --------------------- 1 file changed, 558 deletions(-) delete mode 100644 models/openid-php-openid-782224d/examples/server/setup.php (limited to 'models/openid-php-openid-782224d/examples/server/setup.php') diff --git a/models/openid-php-openid-782224d/examples/server/setup.php b/models/openid-php-openid-782224d/examples/server/setup.php deleted file mode 100644 index e25ef341a..000000000 --- a/models/openid-php-openid-782224d/examples/server/setup.php +++ /dev/null @@ -1,558 +0,0 @@ - - * @copyright 2005-2008 Janrain, Inc. - * @license http://www.apache.org/licenses/LICENSE-2.0 Apache - */ - -$path_extra = dirname(dirname(dirname(__FILE__))); -$path = ini_get('include_path'); -$path = $path_extra . PATH_SEPARATOR . $path; -ini_set('include_path', $path); -require_once "Auth/OpenID.php"; - -/** - * Data. - */ - -$store_types = array("Filesystem" => "Auth_OpenID_FileStore", - "MySQL" => "Auth_OpenID_MySQLStore", - "PostgreSQL" => "Auth_OpenID_PostgreSQLStore", - "SQLite" => "Auth_OpenID_SQLiteStore"); - -/** - * Main. - */ - -$messages = array(); - -session_start(); -init_session(); - -if (!check_session() || - isset($_GET['add_openid'])) { - render_form(); -} else { - print generate_config(isset($_GET['download'])); -} - -/** - * Functions. - */ - -function check_url($url) { - return (Auth_OpenID::normalizeUrl($url) !== null); -} - -function build_url() { - $port = (($_SERVER['SERVER_PORT'] == 80) ? null : $_SERVER['SERVER_PORT']); - - $parts = explode("/", $_SERVER['SERVER_PROTOCOL']); - $scheme = strtolower($parts[0]); - - if ($port) { - return sprintf("%s://%s:%s%s/server.php", $scheme, $_SERVER['SERVER_NAME'], - $port, dirname($_SERVER['PHP_SELF'])); - } else { - return sprintf("%s://%s%s/server.php", $scheme, $_SERVER['SERVER_NAME'], - dirname($_SERVER['PHP_SELF'])); - } -} - -function check_open_basedir($path) { - if (ini_get('open_basedir')) { - $parts = explode(PATH_SEPARATOR, ini_get('open_basedir')); - - $found = false; - - foreach ($parts as $p) { - if (strpos($path, $p) === 0) { - $found = true; - break; - } - } - - return $found; - } else { - return true; - } -} - -function check_session() { - - global $messages; - - if ($_GET && isset($_GET['clear'])) { - session_destroy(); - $_SESSION = array(); - init_session(); - return false; - } - - $bad_path = false; - - if (isset($_GET['generate'])) { - if (!$_SESSION['server_url']) { - $messages[] = "Please enter a server URL."; - } - - if (!isset($_SESSION['store_type'])) { - $messages[] = "No store type chosen."; - } else { - switch ($_SESSION['store_type']) { - case "Filesystem": - if (!@$_SESSION['store_data']['fs_path']) { - $messages[] = "Please specify a filesystem store path."; - } else { - if (!check_open_basedir($_SESSION['store_data']['fs_path'])) { - $messages[] = "The filesystem store path violates PHP's open_basedir setting."; - $bad_path = true; - } - } - break; - - case "SQLite": - if (!@$_SESSION['store_data']['sqlite_path']) { - $messages[] = "Please specify a SQLite database path."; - } else { - if (!check_open_basedir($_SESSION['store_data']['sqlite_path'])) { - $messages[] = "The SQLite store path violates PHP's open_basedir setting."; - $bad_path = true; - } - } - break; - - default: - if (!($_SESSION['store_data']['host'] && - $_SESSION['store_data']['database'] && - $_SESSION['store_data']['username'] && - $_SESSION['store_data']['password'])) { - $messages[] = "Please specify database connection details."; - } - } - } - } - - if ($_SESSION['store_type'] && - $_SESSION['server_url'] && - (parse_url($_SESSION['server_url']) !== false) && - ((($_SESSION['store_type'] == 'Filesystem') && - $_SESSION['store_data']['fs_path']) || - (($_SESSION['store_type'] == 'SQLite') && - $_SESSION['store_data']['sqlite_path']) || - ($_SESSION['store_data']['host'] && - $_SESSION['store_data']['username'] && - $_SESSION['store_data']['database'] && - $_SESSION['store_data']['password'])) && - !$bad_path) { - - return true; - } - - return false; -} - -function render_form() { - - global $store_types, $fields, $messages; - - $basedir_msg = ""; - - if (ini_get('open_basedir')) { - $basedir_msg = "
Note: Due to the ". - "open_basedir php.ini setting, be sure to ". - "choose a path in one of the following directories:"; - } - - $sqlite_found = false; - if (extension_loaded('sqlite') || - @dl('sqlite.' . PHP_SHLIB_SUFFIX)) { - $sqlite_found = true; - } - - $mysql_found = false; - if (extension_loaded('mysql') || - @dl('mysql.' . PHP_SHLIB_SUFFIX)) { - $mysql_found = true; - } - - $pgsql_found = false; - if (extension_loaded('pgsql') || - @dl('pgsql.' . PHP_SHLIB_SUFFIX)) { - $pgsql_found = true; - } - -?> - - - - - - -

OpenID Example Server Configuration

- -"; - foreach ($messages as $m) { - print "
$m
"; - } - print ""; - -} -?> - -

-Your browser has been redirected to this page so you can configure the -server example. This form will auto-generate an OpenID example server -configuration for use with the OpenID server example. -

- -
-
- -

- The server URL is the URL that points to the "server.php" file. It - looks like your server URL should be . -

- - - - - -
- -
- -

- If this package isn't installed in the PHP include path, the package's - directory should be added. For example, if the package is in - /home/me/PHP-OpenID/, you should enter that directory here. -

- - - - - - - -
- -
- -

- The server needs to store OpenID information in a "store". The - following store types are available on your PHP installation: -

- - Store method: -
- -
- > - -
- - - -
-
- - -
- > - -
- - - -
-
- - - - -
- - - > - - - - - > - - - -
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
- - -
- - - - - - -

OpenID Example Server Configuration

- -

-Put the following text into config.php. -

- -

-Back to form (resets settings) -

- -

-Download this configuration -

- -
-
-
-/**
- * Set any extra include paths needed to use the library
- */
-set_include_path(get_include_path() . PATH_SEPARATOR . "");
-
-
-/**
- * The URL for the server.
- *
- * This is the location of server.php. For example:
- *
- * $server_url = 'http://example.com/~user/server.php';
- *
- * This must be a full URL.
- */
-$server_url = "";
-
-/**
- * Initialize an OpenID store
- *
- * @return object $store an instance of OpenID store (see the
- * documentation for how to create one)
- */
-function getOpenIDStore()
-{
-    createTables();\n    ";
-        print "return \$s;\n";
-        break;
-
-    case "MySQL":
-
-        ?>require_once 'Auth/OpenID/MySQLStore.php';
-    require_once 'DB.php';
-
-    $dsn = array(
-                 'phptype'  => 'mysql',
-                 'username' => '',
-                 'password' => '',
-                 'hostspec' => ''
-                 );
-
-    $db =& DB::connect($dsn);
-
-    if (PEAR::isError($db)) {
-        return null;
-    }
-
-    $db->query("USE ");
-        
-    $s =& new Auth_OpenID_MySQLStore($db);
-
-    $s->createTables();
-
-    return $s;
-require_once 'Auth/OpenID/PostgreSQLStore.php';
-    require_once 'DB.php';
-
-    $dsn = array(
-                 'phptype'  => 'pgsql',
-                 'username' => '',
-                 'password' => '',
-                 'hostspec' => '',
-                 'database' => ''
-                 );
-
-    $db =& DB::connect($dsn);
-
-    if (PEAR::isError($db)) {
-        return null;
-    }
-
-    $s =& new Auth_OpenID_PostgreSQLStore($db);
-
-    $s->createTables();
-
-    return $s;
-
-}
-
-";
-    if (!$download) {
-?>
-
- - - -- cgit v1.2.3