[Phpmyadmin-devel] Two problems...

Ignacio Vazquez-Abrams ignacio at openservices.net
Thu Oct 11 23:24:11 CEST 2001


On Thu, 11 Oct 2001, Ignacio Vazquez-Abrams wrote:

> It won't necessarily be used by the users, but by the ISPs techs instead so
> that they can have one copy of pMA and instead have a
> config_<hostname>.inc.php3 per virtual host.
>
> And you're right about other web server software not under standing Apache
> directives ;) I'm fairly certain, however, that they have methods for setting
> environment variables. And if not, then they'll have to use multiple copies of
> pMA as they do now, so there's nothing to lose by implementing that
> functionality.

Here, this patch should implement this functionality. Feel free to poke, prod,
and otherwise destory it.

How it works is that, well, it's short enough that I shouldn't need to tell
you ;) In order to implement the multiconfig functionality, the sysadmin has
to copy config_single.inc.php3 to config_<whatever>.inc.php3 and then set the
environment variable PMAMULTICONFIG for the virtual host to <whatever>.

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>

   "As far as I can tell / It doesn't matter who you are /
    If you can believe there's something worth fighting for."
       - "Parade", Garbage
-------------- next part --------------
diff -Naur phpMyAdmin.orig/config.inc.php3 phpMyAdmin/config.inc.php3
--- phpMyAdmin.orig/config.inc.php3	Thu Oct 11 18:47:24 2001
+++ phpMyAdmin/config.inc.php3	Fri Oct 12 02:15:58 2001
@@ -3,236 +3,21 @@
 
 
 /**
- * phpMyAdmin Configuration File
- *
- * All directives are explained in Documentation.html
+ * phpMyAdmin Primary Configuration File
  */
 
+$multiconfig='PMAMULTICONFIG';
 
-/**
- * Bookmark Table Structure
- *
- * CREATE TABLE bookmark (
- *  id int(11) DEFAULT '0' NOT NULL auto_increment,
- *  dbase varchar(255) NOT NULL,
- *  user varchar(255) NOT NULL,
- *  label varchar(255) NOT NULL,
- *  query text NOT NULL,
- *  PRIMARY KEY (id)
- * );
- *
- */
-
-
-/**
- * Your phpMyAdmin url
- *
- * Complete the variable below with the full url ie
- *    http://www.your_web.net/path_to_your_phpMyAdmin_directory/
- */
-$cfgPmaAbsoluteUri = '';
-
-
-/**
- * Server(s) configuration
- */
-// The $cfgServers array starts with $cfgServers[1].  Do not use $cfgServers[0].
-// You can disable a server config entry by setting host to ''.
-$cfgServers[1]['host']          = 'localhost'; // MySQL hostname
-$cfgServers[1]['port']          = '';          // MySQL port - leave blank for default port
-$cfgServers[1]['socket']        = '';          // Path to the socket - leave blank for default socket
-$cfgServers[1]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
-$cfgServers[1]['adv_auth']      = FALSE;       // Use advanced authentication?
-$cfgServers[1]['stduser']       = '';          // MySQL standard user (only needed with advanced auth)
-$cfgServers[1]['stdpass']       = '';          // MySQL standard password (only needed with advanced auth)
-$cfgServers[1]['user']          = 'root';      // MySQL user (only needed with basic auth)
-$cfgServers[1]['password']      = '';          // MySQL password (only needed with basic auth)
-$cfgServers[1]['only_db']       = '';          // If set to a db-name, only this db is displayed at left frame
-                                               // It may also be an array of db-names
-$cfgServers[1]['verbose']       = '';          // Verbose name for this host - leave blank to show the hostname
-$cfgServers[1]['bookmarkdb']    = '';          // Bookmark db - leave blank for no bookmark support
-$cfgServers[1]['bookmarktable'] = '';          // Bookmark table - leave blank for no bookmark support
-
-$cfgServers[2]['host']          = '';
-$cfgServers[2]['port']          = '';
-$cfgServers[2]['socket']        = '';
-$cfgServers[2]['connect_type']  = 'tcp';
-$cfgServers[2]['adv_auth']      = FALSE;
-$cfgServers[2]['stduser']       = '';
-$cfgServers[2]['stdpass']       = '';
-$cfgServers[2]['user']          = 'root';
-$cfgServers[2]['password']      = '';
-$cfgServers[2]['only_db']       = '';
-$cfgServers[2]['verbose']       = '';
-$cfgServers[2]['bookmarkdb']    = '';
-$cfgServers[2]['bookmarktable'] = '';
-
-$cfgServers[3]['host']          = '';
-$cfgServers[3]['port']          = '';
-$cfgServers[3]['socket']        = '';
-$cfgServers[3]['connect_type']  = 'tcp';
-$cfgServers[3]['adv_auth']      = FALSE;
-$cfgServers[3]['stduser']       = '';
-$cfgServers[3]['stdpass']       = '';
-$cfgServers[3]['user']          = 'root';
-$cfgServers[3]['password']      = '';
-$cfgServers[3]['only_db']       = '';
-$cfgServers[3]['verbose']       = '';
-$cfgServers[3]['bookmarkdb']    = '';
-$cfgServers[3]['bookmarktable'] = '';
-
-// If you have more than one server configured, you can set $cfgServerDefault
-// to any one of them to autoconnect to that server when phpMyAdmin is started,
-// or set it to 0 to be given a list of servers without logging in
-// If you have only one server configured, $cfgServerDefault *MUST* be
-// set to that server.
-$cfgServerDefault = 1;                         // Default server (0 = no default server)
-$cfgServer        = '';
-unset($cfgServers[0]);
-
-
-/**
- * Other core phpMyAdmin settings
- */
-$cfgOBGzip 		          = TRUE;   // use GZIP output buffering if possible
-$cfgPersistentConnections = FALSE;  // use persistent connections to MySQL database
-$cfgSkipLockedTables      = FALSE;  // mark used tables, make possible to show
-                                    // locked tables (since MySQL 3.23.30)
-$cfgShowSQL               = TRUE;   // show SQL queries as run
-$cfgAllowUserDropDatabase = FALSE;  // disallow users to delete their own database
-$cfgConfirm               = TRUE;   // confirm 'DROP TABLE' & 'DROP DATABASE'
-
-$cfgShowStats             = TRUE;   // allow to display statistics and space usage in
-                                    // the pages about database details and table
-                                    // properties
-$cfgShowTooltip	          = TRUE;	// display table comment as tooltip in left frame
-
-$cfgShowBlob              = FALSE;  // display blob field contents in browse mode
-$cfgShowAll               = FALSE;  // allows to display all the rows in browse mode
-$cfgMaxRows               = 30;     // maximum number of rows to display in browse mode
-$cfgOrder                 = 'ASC';  // default for 'ORDER BY' clause (valid
-                                    // values are 'ASC', 'DESC' or 'SMART' -ie
-                                    // descending order for fields of type
-                                    // TIME, DATE, DATETIME & TIMESTAMP,
-                                    // ascending order else-)
-
-$cfgProtectBinary         = 'blob'; // disallow editing of binary fields in edit mode
-                                    // valid values are:
-                                    //   FALSE  allow editing
-                                    //   'blob' allow editing except for BLOB fields
-                                    //   'all'  disallow editing
-
-$cfgZipDump               = TRUE;   // Allow the use of zip/gzip/bzip
-$cfgGZipDump              = TRUE;   // compression for
-$cfgBZipDump              = TRUE;   // dump files
-
-
-/**
- * Link to the official MySQL documentation
- * Be sure to include no trailing slash on the path
- */
-$cfgManualBase = 'http://www.mysql.com/documentation/mysql/bychapter';
-
-
-/**
- * Language settings
- */
-// Default language to use, if not browser-defined or user-defined
-$cfgDefaultLang = 'en';
-// Force: always use this language - must be defined in
-//        libraries/select_lang.lib.php3
-// $cfgLang     = 'en';
-// Loads language file
-require('./libraries/select_lang.lib.php3');
-
-
-/**
- * Customization & design
- */
-$cfgLeftBgColor         = '#D0DCE0';    // background color for the left frame
-$cfgRightBgColor        = '#F5F5F5';    // background color for the right frame
-$cfgBorder              = 0;            // border width on tables
-$cfgThBgcolor           = '#D3DCE3';    // table header row colour
-$cfgBgcolorOne          = '#CCCCCC';    // table data row colour
-$cfgBgcolorTwo          = '#DDDDDD';    // table data row colour, alternate
-$cfgTextareaCols        = 40;           // textarea size (columns) in edit mode
-$cfgTextareaRows        = 7;            // textarea size (rows) in edit mode
-$cfgLimitChars          = 50;           // max field data length in browse mode
-$cfgModifyDeleteAtLeft  = TRUE;         // show edit/delete links on left side of browse
-$cfgModifyDeleteAtRight = FALSE;        // show edit/delete links on right side of browse
-$cfgLeftWidth           = 150;          // left frame width
-
-
-/**
- * MySQL settings
- */
-// Column types
-$cfgColumnTypes = array(
-   'TINYINT',
-   'SMALLINT',
-   'MEDIUMINT',
-   'INT',
-   'BIGINT',
-   'FLOAT',
-   'DOUBLE',
-   'DECIMAL',
-   'DATE',
-   'DATETIME',
-   'TIMESTAMP',
-   'TIME',
-   'YEAR',
-   'CHAR',
-   'VARCHAR',
-   'TINYBLOB',
-   'TINYTEXT',
-   'TEXT',
-   'BLOB',
-   'MEDIUMBLOB',
-   'MEDIUMTEXT',
-   'LONGBLOB',
-   'LONGTEXT',
-   'ENUM',
-   'SET'
-);
-
-// Atributes
-$cfgAttributeTypes = array(
-   '',
-   'BINARY',
-   'UNSIGNED',
-   'UNSIGNED ZEROFILL'
-);
-
-// Available functions
-$cfgFunctions = array(
-   'ASCII',
-   'CHAR',
-   'SOUNDEX',
-   'ENCRYPT',
-   'LCASE',
-   'UCASE',
-   'NOW',
-   'PASSWORD',
-   'ENCODE',
-   'DECODE',
-   'MD5',
-   'RAND',
-   'LAST_INSERT_ID',
-   'COUNT',
-   'AVG',
-   'SUM',
-   'CURDATE',
-   'CURTIME',
-   'FROM_DAYS',
-   'FROM_UNIXTIME',
-   'PERIOD_ADD',
-   'PERIOD_DIFF',
-   'TO_DAYS',
-   'UNIX_TIMESTAMP',
-   'USER',
-   'WEEKDAY'
-);
-
+// Apache sets HTTP_SERVER_VARS on a SetEnv if PHP is running as a module
+if (isset($HTTP_SERVER_VARS) and isset($HTTP_SERVER_VARS[$multiconfig])
+{
+   include('config_'.$HTTP_SERVER_VARS[$multiconfig].'.inc.php3');
+}
+else if (isset($HTTP_ENV_VARS) and isset($HTTP_ENV_VARS[$multiconfig])
+{
+   include('config_'.$HTTP_ENV_VARS[$multiconfig].'.inc.php3');
+}
+else include('config_single.inc.php3');
 
 /**
  * Unset magic_quotes_runtime - do not change!
diff -Naur phpMyAdmin.orig/config_single.inc.php3 phpMyAdmin/config_single.inc.php3
--- phpMyAdmin.orig/config_single.inc.php3	Wed Dec 31 19:00:00 1969
+++ phpMyAdmin/config_single.inc.php3	Fri Oct 12 02:15:51 2001
@@ -0,0 +1,236 @@
+<?php
+/* $Id: config.inc.php3,v 1.41 2001/10/11 22:47:24 loic1 Exp $ */
+
+
+/**
+ * phpMyAdmin Configuration File
+ *
+ * All directives are explained in Documentation.html
+ */
+
+
+/**
+ * Bookmark Table Structure
+ *
+ * CREATE TABLE bookmark (
+ *  id int(11) DEFAULT '0' NOT NULL auto_increment,
+ *  dbase varchar(255) NOT NULL,
+ *  user varchar(255) NOT NULL,
+ *  label varchar(255) NOT NULL,
+ *  query text NOT NULL,
+ *  PRIMARY KEY (id)
+ * );
+ *
+ */
+
+
+/**
+ * Your phpMyAdmin url
+ *
+ * Complete the variable below with the full url ie
+ *    http://www.your_web.net/path_to_your_phpMyAdmin_directory/
+ */
+$cfgPmaAbsoluteUri = '';
+
+
+/**
+ * Server(s) configuration
+ */
+// The $cfgServers array starts with $cfgServers[1].  Do not use $cfgServers[0].
+// You can disable a server config entry by setting host to ''.
+$cfgServers[1]['host']          = 'localhost'; // MySQL hostname
+$cfgServers[1]['port']          = '';          // MySQL port - leave blank for default port
+$cfgServers[1]['socket']        = '';          // Path to the socket - leave blank for default socket
+$cfgServers[1]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
+$cfgServers[1]['adv_auth']      = FALSE;       // Use advanced authentication?
+$cfgServers[1]['stduser']       = '';          // MySQL standard user (only needed with advanced auth)
+$cfgServers[1]['stdpass']       = '';          // MySQL standard password (only needed with advanced auth)
+$cfgServers[1]['user']          = 'root';      // MySQL user (only needed with basic auth)
+$cfgServers[1]['password']      = '';          // MySQL password (only needed with basic auth)
+$cfgServers[1]['only_db']       = '';          // If set to a db-name, only this db is displayed at left frame
+                                               // It may also be an array of db-names
+$cfgServers[1]['verbose']       = '';          // Verbose name for this host - leave blank to show the hostname
+$cfgServers[1]['bookmarkdb']    = '';          // Bookmark db - leave blank for no bookmark support
+$cfgServers[1]['bookmarktable'] = '';          // Bookmark table - leave blank for no bookmark support
+
+$cfgServers[2]['host']          = '';
+$cfgServers[2]['port']          = '';
+$cfgServers[2]['socket']        = '';
+$cfgServers[2]['connect_type']  = 'tcp';
+$cfgServers[2]['adv_auth']      = FALSE;
+$cfgServers[2]['stduser']       = '';
+$cfgServers[2]['stdpass']       = '';
+$cfgServers[2]['user']          = 'root';
+$cfgServers[2]['password']      = '';
+$cfgServers[2]['only_db']       = '';
+$cfgServers[2]['verbose']       = '';
+$cfgServers[2]['bookmarkdb']    = '';
+$cfgServers[2]['bookmarktable'] = '';
+
+$cfgServers[3]['host']          = '';
+$cfgServers[3]['port']          = '';
+$cfgServers[3]['socket']        = '';
+$cfgServers[3]['connect_type']  = 'tcp';
+$cfgServers[3]['adv_auth']      = FALSE;
+$cfgServers[3]['stduser']       = '';
+$cfgServers[3]['stdpass']       = '';
+$cfgServers[3]['user']          = 'root';
+$cfgServers[3]['password']      = '';
+$cfgServers[3]['only_db']       = '';
+$cfgServers[3]['verbose']       = '';
+$cfgServers[3]['bookmarkdb']    = '';
+$cfgServers[3]['bookmarktable'] = '';
+
+// If you have more than one server configured, you can set $cfgServerDefault
+// to any one of them to autoconnect to that server when phpMyAdmin is started,
+// or set it to 0 to be given a list of servers without logging in
+// If you have only one server configured, $cfgServerDefault *MUST* be
+// set to that server.
+$cfgServerDefault = 1;                         // Default server (0 = no default server)
+$cfgServer        = '';
+unset($cfgServers[0]);
+
+
+/**
+ * Other core phpMyAdmin settings
+ */
+$cfgOBGzip 		          = TRUE;   // use GZIP output buffering if possible
+$cfgPersistentConnections = FALSE;  // use persistent connections to MySQL database
+$cfgSkipLockedTables      = FALSE;  // mark used tables, make possible to show
+                                    // locked tables (since MySQL 3.23.30)
+$cfgShowSQL               = TRUE;   // show SQL queries as run
+$cfgAllowUserDropDatabase = FALSE;  // disallow users to delete their own database
+$cfgConfirm               = TRUE;   // confirm 'DROP TABLE' & 'DROP DATABASE'
+
+$cfgShowStats             = TRUE;   // allow to display statistics and space usage in
+                                    // the pages about database details and table
+                                    // properties
+$cfgShowTooltip	          = TRUE;	// display table comment as tooltip in left frame
+
+$cfgShowBlob              = FALSE;  // display blob field contents in browse mode
+$cfgShowAll               = FALSE;  // allows to display all the rows in browse mode
+$cfgMaxRows               = 30;     // maximum number of rows to display in browse mode
+$cfgOrder                 = 'ASC';  // default for 'ORDER BY' clause (valid
+                                    // values are 'ASC', 'DESC' or 'SMART' -ie
+                                    // descending order for fields of type
+                                    // TIME, DATE, DATETIME & TIMESTAMP,
+                                    // ascending order else-)
+
+$cfgProtectBinary         = 'blob'; // disallow editing of binary fields in edit mode
+                                    // valid values are:
+                                    //   FALSE  allow editing
+                                    //   'blob' allow editing except for BLOB fields
+                                    //   'all'  disallow editing
+
+$cfgZipDump               = TRUE;   // Allow the use of zip/gzip/bzip
+$cfgGZipDump              = TRUE;   // compression for
+$cfgBZipDump              = TRUE;   // dump files
+
+
+/**
+ * Link to the official MySQL documentation
+ * Be sure to include no trailing slash on the path
+ */
+$cfgManualBase = 'http://www.mysql.com/documentation/mysql/bychapter';
+
+
+/**
+ * Language settings
+ */
+// Default language to use, if not browser-defined or user-defined
+$cfgDefaultLang = 'en';
+// Force: always use this language - must be defined in
+//        libraries/select_lang.lib.php3
+// $cfgLang     = 'en';
+// Loads language file
+require('./libraries/select_lang.lib.php3');
+
+
+/**
+ * Customization & design
+ */
+$cfgLeftBgColor         = '#D0DCE0';    // background color for the left frame
+$cfgRightBgColor        = '#F5F5F5';    // background color for the right frame
+$cfgBorder              = 0;            // border width on tables
+$cfgThBgcolor           = '#D3DCE3';    // table header row colour
+$cfgBgcolorOne          = '#CCCCCC';    // table data row colour
+$cfgBgcolorTwo          = '#DDDDDD';    // table data row colour, alternate
+$cfgTextareaCols        = 40;           // textarea size (columns) in edit mode
+$cfgTextareaRows        = 7;            // textarea size (rows) in edit mode
+$cfgLimitChars          = 50;           // max field data length in browse mode
+$cfgModifyDeleteAtLeft  = TRUE;         // show edit/delete links on left side of browse
+$cfgModifyDeleteAtRight = FALSE;        // show edit/delete links on right side of browse
+$cfgLeftWidth           = 150;          // left frame width
+
+
+/**
+ * MySQL settings
+ */
+// Column types
+$cfgColumnTypes = array(
+   'TINYINT',
+   'SMALLINT',
+   'MEDIUMINT',
+   'INT',
+   'BIGINT',
+   'FLOAT',
+   'DOUBLE',
+   'DECIMAL',
+   'DATE',
+   'DATETIME',
+   'TIMESTAMP',
+   'TIME',
+   'YEAR',
+   'CHAR',
+   'VARCHAR',
+   'TINYBLOB',
+   'TINYTEXT',
+   'TEXT',
+   'BLOB',
+   'MEDIUMBLOB',
+   'MEDIUMTEXT',
+   'LONGBLOB',
+   'LONGTEXT',
+   'ENUM',
+   'SET'
+);
+
+// Atributes
+$cfgAttributeTypes = array(
+   '',
+   'BINARY',
+   'UNSIGNED',
+   'UNSIGNED ZEROFILL'
+);
+
+// Available functions
+$cfgFunctions = array(
+   'ASCII',
+   'CHAR',
+   'SOUNDEX',
+   'ENCRYPT',
+   'LCASE',
+   'UCASE',
+   'NOW',
+   'PASSWORD',
+   'ENCODE',
+   'DECODE',
+   'MD5',
+   'RAND',
+   'LAST_INSERT_ID',
+   'COUNT',
+   'AVG',
+   'SUM',
+   'CURDATE',
+   'CURTIME',
+   'FROM_DAYS',
+   'FROM_UNIXTIME',
+   'PERIOD_ADD',
+   'PERIOD_DIFF',
+   'TO_DAYS',
+   'UNIX_TIMESTAMP',
+   'USER',
+   'WEEKDAY'
+);
+
+?>


More information about the Developers mailing list