summaryrefslogtreecommitdiff
path: root/hugo/examples
diff options
context:
space:
mode:
Diffstat (limited to 'hugo/examples')
-rw-r--r--hugo/examples/config.manyhosts.inc.php46
-rw-r--r--hugo/examples/create_tables.sql241
-rw-r--r--hugo/examples/create_tables_drizzle.sql227
-rw-r--r--hugo/examples/openid.php158
-rw-r--r--hugo/examples/signon-script.php29
-rw-r--r--hugo/examples/signon.php65
-rw-r--r--hugo/examples/swekey.sample.conf44
-rw-r--r--hugo/examples/upgrade_tables_mysql_4_1_2+.sql144
8 files changed, 954 insertions, 0 deletions
diff --git a/hugo/examples/config.manyhosts.inc.php b/hugo/examples/config.manyhosts.inc.php
new file mode 100644
index 0000000..ad29c3a
--- /dev/null
+++ b/hugo/examples/config.manyhosts.inc.php
@@ -0,0 +1,46 @@
+<?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.
+ */
+
+$i=0;
+$hosts = array (
+ "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]['connect_type'] = 'tcp';
+ $cfg['Servers'][$i]['extension'] = 'mysql';
+ $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]['designer_coords'] = 'pma__designer_coords';
+ $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
+ $cfg['Servers'][$i]['recent'] = 'pma__recent';
+}
diff --git a/hugo/examples/create_tables.sql b/hugo/examples/create_tables.sql
new file mode 100644
index 0000000..723334c
--- /dev/null
+++ b/hugo/examples/create_tables.sql
@@ -0,0 +1,241 @@
+-- --------------------------------------------------------
+-- SQL Commands to set up the pmadb as described in the documentation.
+--
+-- This file is meant for use with MySQL 5 and above!
+--
+-- This script expects the user pma to already be existing. If we would put a
+-- line here to create him too many users might just use this script and end
+-- up with having the same password for the controluser.
+--
+-- This user "pma" must be defined in config.inc.php (controluser/controlpass)
+--
+-- Please don't forget to set up the tablenames in config.inc.php
+--
+
+-- --------------------------------------------------------
+
+--
+-- Database : `phpmyadmin`
+--
+CREATE DATABASE IF NOT EXISTS `phpmyadmin`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+USE phpmyadmin;
+
+-- --------------------------------------------------------
+
+--
+-- Privileges
+--
+-- (activate this statement if necessary)
+-- GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO
+-- 'pma'@localhost;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__bookmark`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__bookmark` (
+ `id` int(11) NOT NULL auto_increment,
+ `dbase` varchar(255) NOT NULL default '',
+ `user` varchar(255) NOT NULL default '',
+ `label` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
+ `query` text NOT NULL,
+ PRIMARY KEY (`id`)
+)
+ COMMENT='Bookmarks'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__column_info`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__column_info` (
+ `id` int(5) unsigned NOT NULL auto_increment,
+ `db_name` varchar(64) NOT NULL default '',
+ `table_name` varchar(64) NOT NULL default '',
+ `column_name` varchar(64) NOT NULL default '',
+ `comment` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
+ `mimetype` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
+ `transformation` varchar(255) NOT NULL default '',
+ `transformation_options` varchar(255) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)
+)
+ COMMENT='Column information for phpMyAdmin'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__history`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__history` (
+ `id` bigint(20) unsigned NOT NULL auto_increment,
+ `username` varchar(64) NOT NULL default '',
+ `db` varchar(64) NOT NULL default '',
+ `table` varchar(64) NOT NULL default '',
+ `timevalue` timestamp NOT NULL,
+ `sqlquery` text NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `username` (`username`,`db`,`table`,`timevalue`)
+)
+ COMMENT='SQL history for phpMyAdmin'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__pdf_pages`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__pdf_pages` (
+ `db_name` varchar(64) NOT NULL default '',
+ `page_nr` int(10) unsigned NOT NULL auto_increment,
+ `page_descr` varchar(50) COLLATE utf8_general_ci NOT NULL default '',
+ PRIMARY KEY (`page_nr`),
+ KEY `db_name` (`db_name`)
+)
+ COMMENT='PDF relation pages for phpMyAdmin'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__recent`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__recent` (
+ `username` varchar(64) NOT NULL,
+ `tables` text NOT NULL,
+ PRIMARY KEY (`username`)
+)
+ COMMENT='Recently accessed tables'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__table_uiprefs`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__table_uiprefs` (
+ `username` varchar(64) NOT NULL,
+ `db_name` varchar(64) NOT NULL,
+ `table_name` varchar(64) NOT NULL,
+ `prefs` text NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`username`,`db_name`,`table_name`)
+)
+ COMMENT='Tables'' UI preferences'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__relation`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__relation` (
+ `master_db` varchar(64) NOT NULL default '',
+ `master_table` varchar(64) NOT NULL default '',
+ `master_field` varchar(64) NOT NULL default '',
+ `foreign_db` varchar(64) NOT NULL default '',
+ `foreign_table` varchar(64) NOT NULL default '',
+ `foreign_field` varchar(64) NOT NULL default '',
+ PRIMARY KEY (`master_db`,`master_table`,`master_field`),
+ KEY `foreign_field` (`foreign_db`,`foreign_table`)
+)
+ COMMENT='Relation table'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__table_coords`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__table_coords` (
+ `db_name` varchar(64) NOT NULL default '',
+ `table_name` varchar(64) NOT NULL default '',
+ `pdf_page_number` int(11) NOT NULL default '0',
+ `x` float unsigned NOT NULL default '0',
+ `y` float unsigned NOT NULL default '0',
+ PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`)
+)
+ COMMENT='Table coordinates for phpMyAdmin PDF output'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__table_info`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__table_info` (
+ `db_name` varchar(64) NOT NULL default '',
+ `table_name` varchar(64) NOT NULL default '',
+ `display_field` varchar(64) NOT NULL default '',
+ PRIMARY KEY (`db_name`,`table_name`)
+)
+ COMMENT='Table information for phpMyAdmin'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__designer_coords`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__designer_coords` (
+ `db_name` varchar(64) NOT NULL default '',
+ `table_name` varchar(64) NOT NULL default '',
+ `x` INT,
+ `y` INT,
+ `v` TINYINT,
+ `h` TINYINT,
+ PRIMARY KEY (`db_name`,`table_name`)
+)
+ COMMENT='Table coordinates for Designer'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__tracking`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__tracking` (
+ `db_name` varchar(64) NOT NULL,
+ `table_name` varchar(64) NOT NULL,
+ `version` int(10) unsigned NOT NULL,
+ `date_created` datetime NOT NULL,
+ `date_updated` datetime NOT NULL,
+ `schema_snapshot` text NOT NULL,
+ `schema_sql` text,
+ `data_sql` longtext,
+ `tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') default NULL,
+ `tracking_active` int(1) unsigned NOT NULL default '1',
+ PRIMARY KEY (`db_name`,`table_name`,`version`)
+)
+ COMMENT='Database changes tracking for phpMyAdmin'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__userconfig`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__userconfig` (
+ `username` varchar(64) NOT NULL,
+ `timevalue` timestamp NOT NULL,
+ `config_data` text NOT NULL,
+ PRIMARY KEY (`username`)
+)
+ COMMENT='User preferences storage for phpMyAdmin'
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
diff --git a/hugo/examples/create_tables_drizzle.sql b/hugo/examples/create_tables_drizzle.sql
new file mode 100644
index 0000000..92de90a
--- /dev/null
+++ b/hugo/examples/create_tables_drizzle.sql
@@ -0,0 +1,227 @@
+-- --------------------------------------------------------
+-- SQL Commands to set up the pmadb as described in the documentation.
+--
+-- This file is meant for use with Drizzle 2011.03.13 and above!
+--
+-- This script expects that you take care of database permissions.
+--
+-- Please don't forget to set up the tablenames in config.inc.php
+--
+
+-- --------------------------------------------------------
+
+--
+-- Database : `phpmyadmin`
+--
+CREATE DATABASE IF NOT EXISTS `phpmyadmin`
+ COLLATE utf8_bin;
+USE phpmyadmin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__bookmark`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__bookmark` (
+ `id` int(11) NOT NULL auto_increment,
+ `dbase` varchar(255) NOT NULL default '',
+ `user` varchar(255) NOT NULL default '',
+ `label` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
+ `query` text NOT NULL,
+ PRIMARY KEY (`id`)
+)
+ COMMENT='Bookmarks'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__column_info`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__column_info` (
+ `id` int(5) NOT NULL auto_increment,
+ `db_name` varchar(64) NOT NULL default '',
+ `table_name` varchar(64) NOT NULL default '',
+ `column_name` varchar(64) NOT NULL default '',
+ `comment` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
+ `mimetype` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
+ `transformation` varchar(255) NOT NULL default '',
+ `transformation_options` varchar(255) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)
+)
+ COMMENT='Column information for phpMyAdmin'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__history`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__history` (
+ `id` bigint(20) NOT NULL auto_increment,
+ `username` varchar(64) NOT NULL default '',
+ `db` varchar(64) NOT NULL default '',
+ `table` varchar(64) NOT NULL default '',
+ `timevalue` timestamp NOT NULL,
+ `sqlquery` text NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `username` (`username`,`db`,`table`,`timevalue`)
+)
+ COMMENT='SQL history for phpMyAdmin'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__pdf_pages`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__pdf_pages` (
+ `db_name` varchar(64) NOT NULL default '',
+ `page_nr` int(10) NOT NULL auto_increment,
+ `page_descr` varchar(50) COLLATE utf8_general_ci NOT NULL default '',
+ PRIMARY KEY (`page_nr`),
+ KEY `db_name` (`db_name`)
+)
+ COMMENT='PDF relation pages for phpMyAdmin'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__recent`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__recent` (
+ `username` varchar(64) NOT NULL,
+ `tables` text NOT NULL,
+ PRIMARY KEY (`username`)
+)
+ COMMENT='Recently accessed tables'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__table_uiprefs`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__table_uiprefs` (
+ `username` varchar(64) NOT NULL,
+ `db_name` varchar(64) NOT NULL,
+ `table_name` varchar(64) NOT NULL,
+ `prefs` text NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`username`,`db_name`,`table_name`)
+)
+ COMMENT='Tables'' UI preferences'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__relation`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__relation` (
+ `master_db` varchar(64) NOT NULL default '',
+ `master_table` varchar(64) NOT NULL default '',
+ `master_field` varchar(64) NOT NULL default '',
+ `foreign_db` varchar(64) NOT NULL default '',
+ `foreign_table` varchar(64) NOT NULL default '',
+ `foreign_field` varchar(64) NOT NULL default '',
+ PRIMARY KEY (`master_db`,`master_table`,`master_field`),
+ KEY `foreign_field` (`foreign_db`,`foreign_table`)
+)
+ COMMENT='Relation table'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__table_coords`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__table_coords` (
+ `db_name` varchar(64) NOT NULL default '',
+ `table_name` varchar(64) NOT NULL default '',
+ `pdf_page_number` int(11) NOT NULL default '0',
+ `x` float NOT NULL default '0',
+ `y` float NOT NULL default '0',
+ PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`)
+)
+ COMMENT='Table coordinates for phpMyAdmin PDF output'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__table_info`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__table_info` (
+ `db_name` varchar(64) NOT NULL default '',
+ `table_name` varchar(64) NOT NULL default '',
+ `display_field` varchar(64) NOT NULL default '',
+ PRIMARY KEY (`db_name`,`table_name`)
+)
+ COMMENT='Table information for phpMyAdmin'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__designer_coords`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__designer_coords` (
+ `db_name` varchar(64) NOT NULL default '',
+ `table_name` varchar(64) NOT NULL default '',
+ `x` INT,
+ `y` INT,
+ `v` INT,
+ `h` INT,
+ PRIMARY KEY (`db_name`,`table_name`)
+)
+ COMMENT='Table coordinates for Designer'
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__tracking`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__tracking` (
+ `db_name` varchar(64) NOT NULL,
+ `table_name` varchar(64) NOT NULL,
+ `version` int(10) NOT NULL,
+ `date_created` datetime NOT NULL,
+ `date_updated` datetime NOT NULL,
+ `schema_snapshot` text NOT NULL,
+ `schema_sql` text,
+ `data_sql` text,
+ `tracking` varchar(15) default NULL,
+ `tracking_active` int(1) NOT NULL default '1',
+ PRIMARY KEY (`db_name`,`table_name`,`version`)
+)
+ COLLATE utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__userconfig`
+--
+
+CREATE TABLE IF NOT EXISTS `pma__userconfig` (
+ `username` varchar(64) NOT NULL,
+ `timevalue` timestamp NOT NULL,
+ `config_data` text NOT NULL,
+ PRIMARY KEY (`username`)
+)
+ COMMENT='User preferences storage for phpMyAdmin'
+ COLLATE utf8_bin;
diff --git a/hugo/examples/openid.php b/hugo/examples/openid.php
new file mode 100644
index 0000000..563b230
--- /dev/null
+++ b/hugo/examples/openid.php
@@ -0,0 +1,158 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * 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 http://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.
+ *
+ * @package PhpMyAdmin
+ * @subpackage Example
+ */
+
+if (false === @include_once 'OpenID/RelyingParty.php') {
+ exit;
+}
+
+/**
+ * Map of authenticated users to MySQL user/password pairs.
+ */
+$AUTH_MAP = array(
+ 'http://launchpad.net/~username' => array(
+ 'user' => 'root',
+ 'password' => '',
+ ),
+ );
+
+/**
+ * Simple function to show HTML page with given content.
+ *
+ * @return void
+ */
+function show_page($contents)
+{
+ header('Content-Type: text/html; charset=utf-8');
+ echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
+ ?>
+<!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>
+<?php
+if (isset($_SESSION) && 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;
+?>
+</body>
+</html>
+<?php
+}
+
+/* Need to have cookie visible from parent directory */
+session_set_cookie_params(0, '/', '', 0);
+/* 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>
+</body>
+</html>';
+ show_page($content);
+ exit;
+}
+
+/* Grab identifier */
+if (isset($_POST['identifier'])) {
+ $identifier = $_POST['identifier'];
+} else if (isset($_SESSION['identifier'])) {
+ $identifier = $_SESSION['identifier'];
+} else {
+ $identifier = null;
+}
+
+/* Create OpenID object */
+try {
+ $o = new OpenID_RelyingParty($returnTo, $realm, $identifier);
+} catch (OpenID_Exception $e) {
+ $contents = "<div class='relyingparty_results'>\n";
+ $contents .= "<pre>" . $e->getMessage() . "</pre>\n";
+ $contents .= "</div class='relyingparty_results'>";
+ show_page($contents);
+ exit;
+}
+
+/* Redirect to OpenID provider */
+if (isset($_POST['start'])) {
+ try {
+ $authRequest = $o->prepare();
+ } catch (OpenID_Exception $e) {
+ $contents = "<div class='relyingparty_results'>\n";
+ $contents .= "<pre>" . $e->getMessage() . "</pre>\n";
+ $contents .= "</div class='relyingparty_results'>";
+ show_page($contents);
+ exit;
+ }
+
+ $url = $authRequest->getAuthorizeURL();
+
+ header("Location: $url");
+ exit;
+} else {
+ /* Grab query string */
+ if (!count($_POST)) {
+ list(, $queryString) = explode('?', $_SERVER['REQUEST_URI']);
+ } else {
+ // I hate php sometimes
+ $queryString = file_get_contents('php://input');
+ }
+
+ /* Check reply */
+ $message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP);
+
+ $id = $message->get('openid.claimed_id');
+
+ if (!empty($id) && isset($AUTH_MAP[$id])) {
+ $_SESSION['PMA_single_signon_user'] = $AUTH_MAP[$id]['user'];
+ $_SESSION['PMA_single_signon_password'] = $AUTH_MAP[$id]['password'];
+ session_write_close();
+ /* Redirect to phpMyAdmin (should use absolute URL here!) */
+ header('Location: ../index.php');
+ } else {
+ show_page('<p>User not allowed!</p>');
+ exit;
+ }
+}
diff --git a/hugo/examples/signon-script.php b/hugo/examples/signon-script.php
new file mode 100644
index 0000000..0ef9734
--- /dev/null
+++ b/hugo/examples/signon-script.php
@@ -0,0 +1,29 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * 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.
+ *
+ * @package PhpMyAdmin
+ * @subpackage Example
+ */
+
+
+/**
+ * This function returns username and password.
+ *
+ * It can optionally use configured username as parameter.
+ *
+ * @param string $user
+ *
+ * @return array
+ */
+function get_login_credentials($user)
+{
+ return array('root', '');
+}
+
+?>
diff --git a/hugo/examples/signon.php b/hugo/examples/signon.php
new file mode 100644
index 0000000..6ab9e24
--- /dev/null
+++ b/hugo/examples/signon.php
@@ -0,0 +1,65 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * 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.
+ *
+ * @package PhpMyAdmin
+ * @subpackage Example
+ */
+
+/* Need to have cookie visible from parent directory */
+session_set_cookie_params(0, '/', '', 0);
+/* Create signon session */
+$session_name = 'SignonSession';
+session_name($session_name);
+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'] = array('verbose' => 'Signon test');
+ $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";
+ ?>
+<!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>
+<?php
+if (isset($_SESSION['PMA_single_signon_error_message'])) {
+ echo '<p class="error">' . $_SESSION['PMA_single_signon_error_message'] . '</p>';
+}
+?>
+<form action="signon.php" method="post">
+Username: <input type="text" name="user" /><br />
+Password: <input type="password" name="password" /><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>
+<?php
+}
+?>
diff --git a/hugo/examples/swekey.sample.conf b/hugo/examples/swekey.sample.conf
new file mode 100644
index 0000000..ebf1aed
--- /dev/null
+++ b/hugo/examples/swekey.sample.conf
@@ -0,0 +1,44 @@
+# This is a typical file used to enable Swekey hardware authentication.
+#
+# To activate the Swekey authentication add the following line to your config.inc.php file.
+# $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';
+# Then rename this file "swekey-pma.conf" and copy it to the /etc directory.
+# Add all the Swekey ids you want to grant access to in the file.
+# After each Swekey id put the corresponding user name.
+#
+# If you don't know the id of a Swekey just visit http://www.swekey.com?sel=support
+# while your Swekey is connected.
+#
+# If you need to purchase a Swekey please visit http://phpmyadmin.net/auth_key
+# since this link provides funding to PhpMyAdmin.
+#
+
+0000000000000000000000000000763A:root
+000000000000000000000000000089E4:steve
+0000000000000000000000000000231E:scott
+
+#
+# It is recommended to include the following lines to contact the
+# authentication servers in SSL mode.
+#
+
+SERVER_CHECK=https://auth-check-ssl.musbe.net
+SERVER_RNDTOKEN=https://auth-rnd-gen-ssl.musbe.net
+SERVER_STATUS=https://auth-status-ssl.musbe.net
+
+#
+# The path of the root certificate file used to ensure a secure
+# communication with the authentication servers in SSL mode.
+# If not specified, will use musbe-ca.crt found in your
+# phpMyAdmin/libraries/auth/swekey.
+#
+
+#CA_FILE=/var/http-root/phpmyadmin/libraries/auth/swekey/musbe-ca.crt
+
+#
+# If your server receives many login requests, you can enable the random
+# token caching to accelerate the authentication process.
+# Token caching is enabled by default.
+#
+
+#ENABLE_TOKEN_CACHE=0
diff --git a/hugo/examples/upgrade_tables_mysql_4_1_2+.sql b/hugo/examples/upgrade_tables_mysql_4_1_2+.sql
new file mode 100644
index 0000000..df4046a
--- /dev/null
+++ b/hugo/examples/upgrade_tables_mysql_4_1_2+.sql
@@ -0,0 +1,144 @@
+-- -------------------------------------------------------------
+-- SQL Commands to upgrade pmadb for normal phpMyAdmin operation
+-- with MySQL 4.1.2 and above.
+--
+-- This file is meant for use with MySQL 4.1.2 and above!
+-- For older MySQL releases, please use create_tables.sql
+--
+-- If you are running one MySQL 4.1.0 or 4.1.1, please create the tables using
+-- create_tables.sql, then use this script.
+--
+-- Please don't forget to set up the tablenames in config.inc.php
+--
+
+-- --------------------------------------------------------
+
+--
+-- Database : `phpmyadmin`
+--
+ALTER DATABASE `phpmyadmin`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+USE phpmyadmin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__bookmark`
+--
+ALTER TABLE `pma__bookmark`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE `pma__bookmark`
+ CHANGE `dbase` `dbase` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__bookmark`
+ CHANGE `user` `user` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__bookmark`
+ CHANGE `label` `label` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
+ALTER TABLE `pma__bookmark`
+ CHANGE `query` `query` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__column_info`
+--
+
+ALTER TABLE `pma__column_info`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE `pma__column_info`
+ CHANGE `db_name` `db_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__column_info`
+ CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__column_info`
+ CHANGE `column_name` `column_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__column_info`
+ CHANGE `comment` `comment` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
+ALTER TABLE `pma__column_info`
+ CHANGE `mimetype` `mimetype` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
+ALTER TABLE `pma__column_info`
+ CHANGE `transformation` `transformation` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__column_info`
+ CHANGE `transformation_options` `transformation_options` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__history`
+--
+ALTER TABLE `pma__history`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE `pma__history`
+ CHANGE `username` `username` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__history`
+ CHANGE `db` `db` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__history`
+ CHANGE `table` `table` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__history`
+ CHANGE `sqlquery` `sqlquery` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__pdf_pages`
+--
+
+ALTER TABLE `pma__pdf_pages`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE `pma__pdf_pages`
+ CHANGE `db_name` `db_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__pdf_pages`
+ CHANGE `page_descr` `page_descr` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '';
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__relation`
+--
+ALTER TABLE `pma__relation`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE `pma__relation`
+ CHANGE `master_db` `master_db` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__relation`
+ CHANGE `master_table` `master_table` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__relation`
+ CHANGE `master_field` `master_field` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__relation`
+ CHANGE `foreign_db` `foreign_db` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__relation`
+ CHANGE `foreign_table` `foreign_table` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__relation`
+ CHANGE `foreign_field` `foreign_field` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__table_coords`
+--
+
+ALTER TABLE `pma__table_coords`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE `pma__table_coords`
+ CHANGE `db_name` `db_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__table_coords`
+ CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `pma__table_info`
+--
+
+ALTER TABLE `pma__table_info`
+ DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+
+ALTER TABLE `pma__table_info`
+ CHANGE `db_name` `db_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__table_info`
+ CHANGE `table_name` `table_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';
+ALTER TABLE `pma__table_info`
+ CHANGE `display_field` `display_field` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';