Update website
This commit is contained in:
parent
bb4b0f9be8
commit
011b183e28
4263 changed files with 3014 additions and 720369 deletions
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This example configuration shows how to configure phpMyAdmin for
|
||||
* many hosts that all have identical configuration otherwise. To add
|
||||
* a new host, just drop it into $hosts below. Contributed by
|
||||
* Matthew Hawkins.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$i = 0;
|
||||
$hosts = [
|
||||
'foo.example.com',
|
||||
'bar.example.com',
|
||||
'baz.example.com',
|
||||
'quux.example.com',
|
||||
];
|
||||
|
||||
foreach ($hosts as $host) {
|
||||
$i++;
|
||||
$cfg['Servers'][$i]['host'] = $host;
|
||||
$cfg['Servers'][$i]['port'] = '';
|
||||
$cfg['Servers'][$i]['socket'] = '';
|
||||
$cfg['Servers'][$i]['compress'] = false;
|
||||
$cfg['Servers'][$i]['controluser'] = 'pma';
|
||||
$cfg['Servers'][$i]['controlpass'] = 'pmapass';
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
$cfg['Servers'][$i]['user'] = '';
|
||||
$cfg['Servers'][$i]['password'] = '';
|
||||
$cfg['Servers'][$i]['only_db'] = '';
|
||||
$cfg['Servers'][$i]['verbose'] = '';
|
||||
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
|
||||
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
|
||||
$cfg['Servers'][$i]['relation'] = 'pma__relation';
|
||||
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
|
||||
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
|
||||
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
|
||||
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
|
||||
$cfg['Servers'][$i]['history'] = 'pma__history';
|
||||
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
|
||||
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
|
||||
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
|
||||
$cfg['Servers'][$i]['recent'] = 'pma__recent';
|
||||
$cfg['Servers'][$i]['users'] = 'pma__users';
|
||||
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
|
||||
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
|
||||
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
|
||||
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
|
||||
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
|
||||
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Single signon for phpMyAdmin using OpenID
|
||||
*
|
||||
* This is just example how to use single signon with phpMyAdmin, it is
|
||||
* not intended to be perfect code and look, only shows how you can
|
||||
* integrate this functionality in your application.
|
||||
*
|
||||
* It uses OpenID pear package, see https://pear.php.net/package/OpenID
|
||||
*
|
||||
* User first authenticates using OpenID and based on content of $AUTH_MAP
|
||||
* the login information is passed to phpMyAdmin in session data.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
if (false === @include_once 'OpenID/RelyingParty.php') {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Change this to true if using phpMyAdmin over https */
|
||||
$secure_cookie = false;
|
||||
|
||||
/**
|
||||
* Map of authenticated users to MySQL user/password pairs.
|
||||
*/
|
||||
$AUTH_MAP = [
|
||||
'https://launchpad.net/~username' => [
|
||||
'user' => 'root',
|
||||
'password' => '',
|
||||
],
|
||||
];
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects,Squiz.Functions.GlobalFunction
|
||||
|
||||
/**
|
||||
* Simple function to show HTML page with given content.
|
||||
*
|
||||
* @param string $contents Content to include in page
|
||||
*/
|
||||
function Show_page($contents): void
|
||||
{
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
|
||||
echo '<!DOCTYPE HTML>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<link rel="icon" href="../favicon.ico" type="image/x-icon">
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
|
||||
<meta charset="utf-8">
|
||||
<title>phpMyAdmin OpenID signon example</title>
|
||||
</head>
|
||||
<body>';
|
||||
|
||||
if (isset($_SESSION['PMA_single_signon_error_message'])) {
|
||||
echo '<p class="error">' . $_SESSION['PMA_single_signon_message'] . '</p>';
|
||||
unset($_SESSION['PMA_single_signon_message']);
|
||||
}
|
||||
|
||||
echo $contents;
|
||||
echo '</body></html>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display error and exit
|
||||
*
|
||||
* @param Exception $e Exception object
|
||||
*/
|
||||
function Die_error($e): void
|
||||
{
|
||||
$contents = "<div class='relyingparty_results'>\n";
|
||||
$contents .= '<pre>' . htmlspecialchars($e->getMessage()) . "</pre>\n";
|
||||
$contents .= "</div class='relyingparty_results'>";
|
||||
Show_page($contents);
|
||||
exit;
|
||||
}
|
||||
|
||||
// phpcs:enable
|
||||
|
||||
/* Need to have cookie visible from parent directory */
|
||||
session_set_cookie_params(0, '/', '', $secure_cookie, true);
|
||||
/* Create signon session */
|
||||
$session_name = 'SignonSession';
|
||||
session_name($session_name);
|
||||
@session_start();
|
||||
|
||||
// Determine realm and return_to
|
||||
$base = 'http';
|
||||
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
|
||||
$base .= 's';
|
||||
}
|
||||
|
||||
$base .= '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'];
|
||||
|
||||
$realm = $base . '/';
|
||||
$returnTo = $base . dirname($_SERVER['PHP_SELF']);
|
||||
if ($returnTo[strlen($returnTo) - 1] !== '/') {
|
||||
$returnTo .= '/';
|
||||
}
|
||||
|
||||
$returnTo .= 'openid.php';
|
||||
|
||||
/* Display form */
|
||||
if ((! count($_GET) && ! count($_POST)) || isset($_GET['phpMyAdmin'])) {
|
||||
/* Show simple form */
|
||||
$content = '<form action="openid.php" method="post">
|
||||
OpenID: <input type="text" name="identifier"><br>
|
||||
<input type="submit" name="start">
|
||||
</form>';
|
||||
Show_page($content);
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Grab identifier */
|
||||
$identifier = null;
|
||||
if (isset($_POST['identifier']) && is_string($_POST['identifier'])) {
|
||||
$identifier = $_POST['identifier'];
|
||||
} elseif (isset($_SESSION['identifier']) && is_string($_SESSION['identifier'])) {
|
||||
$identifier = $_SESSION['identifier'];
|
||||
}
|
||||
|
||||
/* Create OpenID object */
|
||||
try {
|
||||
$o = new OpenID_RelyingParty($returnTo, $realm, $identifier);
|
||||
} catch (Throwable $e) {
|
||||
Die_error($e);
|
||||
}
|
||||
|
||||
/* Redirect to OpenID provider */
|
||||
if (isset($_POST['start'])) {
|
||||
try {
|
||||
$authRequest = $o->prepare();
|
||||
} catch (Throwable $e) {
|
||||
Die_error($e);
|
||||
}
|
||||
|
||||
$url = $authRequest->getAuthorizeURL();
|
||||
|
||||
header('Location: ' . $url);
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Grab query string */
|
||||
if (! count($_POST)) {
|
||||
[, $queryString] = explode('?', $_SERVER['REQUEST_URI']);
|
||||
} else {
|
||||
// Fetch the raw query body
|
||||
$queryString = file_get_contents('php://input');
|
||||
}
|
||||
|
||||
/* Check reply */
|
||||
try {
|
||||
$message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP);
|
||||
} catch (Throwable $e) {
|
||||
Die_error($e);
|
||||
}
|
||||
|
||||
$id = $message->get('openid.claimed_id');
|
||||
|
||||
if (empty($id) || ! isset($AUTH_MAP[$id])) {
|
||||
Show_page('<p>User not allowed!</p>');
|
||||
exit;
|
||||
}
|
||||
|
||||
$_SESSION['PMA_single_signon_user'] = $AUTH_MAP[$id]['user'];
|
||||
$_SESSION['PMA_single_signon_password'] = $AUTH_MAP[$id]['password'];
|
||||
$_SESSION['PMA_single_signon_HMAC_secret'] = hash('sha1', uniqid(strval(random_int(0, mt_getrandmax())), true));
|
||||
session_write_close();
|
||||
/* Redirect to phpMyAdmin (should use absolute URL here!) */
|
||||
header('Location: ../index.php');
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Single signon for phpMyAdmin
|
||||
*
|
||||
* This is just example how to use script based single signon with
|
||||
* phpMyAdmin, it is not intended to be perfect code and look, only
|
||||
* shows how you can integrate this functionality in your application.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// phpcs:disable Squiz.Functions.GlobalFunction
|
||||
|
||||
/**
|
||||
* This function returns username and password.
|
||||
*
|
||||
* It can optionally use configured username as parameter.
|
||||
*
|
||||
* @param string $user User name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_login_credentials($user)
|
||||
{
|
||||
/* Optionally we can use passed username */
|
||||
if (! empty($user)) {
|
||||
return [
|
||||
$user,
|
||||
'password',
|
||||
];
|
||||
}
|
||||
|
||||
/* Here we would retrieve the credentials */
|
||||
return [
|
||||
'root',
|
||||
'',
|
||||
];
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Single signon for phpMyAdmin
|
||||
*
|
||||
* This is just example how to use session based single signon with
|
||||
* phpMyAdmin, it is not intended to be perfect code and look, only
|
||||
* shows how you can integrate this functionality in your application.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/* Use cookies for session */
|
||||
ini_set('session.use_cookies', 'true');
|
||||
/* Change this to true if using phpMyAdmin over https */
|
||||
$secure_cookie = false;
|
||||
/* Need to have cookie visible from parent directory */
|
||||
session_set_cookie_params(0, '/', '', $secure_cookie, true);
|
||||
/* Create signon session */
|
||||
$session_name = 'SignonSession';
|
||||
session_name($session_name);
|
||||
// Uncomment and change the following line to match your $cfg['SessionSavePath']
|
||||
//session_save_path('/foobar');
|
||||
@session_start();
|
||||
|
||||
/* Was data posted? */
|
||||
if (isset($_POST['user'])) {
|
||||
/* Store there credentials */
|
||||
$_SESSION['PMA_single_signon_user'] = $_POST['user'];
|
||||
$_SESSION['PMA_single_signon_password'] = $_POST['password'];
|
||||
$_SESSION['PMA_single_signon_host'] = $_POST['host'];
|
||||
$_SESSION['PMA_single_signon_port'] = $_POST['port'];
|
||||
/* Update another field of server configuration */
|
||||
$_SESSION['PMA_single_signon_cfgupdate'] = ['verbose' => 'Signon test'];
|
||||
$_SESSION['PMA_single_signon_HMAC_secret'] = hash('sha1', uniqid(strval(random_int(0, mt_getrandmax())), true));
|
||||
$id = session_id();
|
||||
/* Close that session */
|
||||
@session_write_close();
|
||||
/* Redirect to phpMyAdmin (should use absolute URL here!) */
|
||||
header('Location: ../index.php');
|
||||
} else {
|
||||
/* Show simple form */
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
|
||||
echo '<!DOCTYPE HTML>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<link rel="icon" href="../favicon.ico" type="image/x-icon">
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
|
||||
<meta charset="utf-8">
|
||||
<title>phpMyAdmin single signon example</title>
|
||||
</head>
|
||||
<body>';
|
||||
|
||||
if (isset($_SESSION['PMA_single_signon_error_message'])) {
|
||||
echo '<p class="error">';
|
||||
echo $_SESSION['PMA_single_signon_error_message'];
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
echo '<form action="signon.php" method="post">
|
||||
Username: <input type="text" name="user" autocomplete="username" spellcheck="false"><br>
|
||||
Password: <input type="password" name="password" autocomplete="current-password" spellcheck="false"><br>
|
||||
Host: (will use the one from config.inc.php by default)
|
||||
<input type="text" name="host"><br>
|
||||
Port: (will use the one from config.inc.php by default)
|
||||
<input type="text" name="port"><br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue