diff --git a/ChangeLog b/ChangeLog index d09b38351..4c80caf95 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-06-19 Alexander M. Turek + * libraries/common.lib.php3, libraries/config_import.lib.php3: + Rewrote the whole backwards compatibility code for old config files. + * config.inc.php3: Beautified code. + 2002-06-19 Marc Delisle * index.php3: missing header, thanks to Michal Cihar * lang/japanese* updates, thanks to Yukihiro Kawada @@ -14,7 +19,7 @@ $Source$ * lang/galician updates, thanks to Xosé Calvo 2002-06-19 Robin Johnson - * libraries/charset_conversion.lib.php3, + * libraries/charset_conversion.lib.php3, libraries/common.lib.php3, main.php3 - added isset() before some configuration variables diff --git a/config.inc.php3 b/config.inc.php3 index 7ff6f2993..5fe1c69ff 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -61,7 +61,8 @@ $cfg['Servers'][$i]['table_info'] = ''; // table to describe the dis // - leave blank for no display fields support $cfg['Servers'][$i]['table_coords'] = ''; // table to describe the tables position for the PDF // schema - leave blank for no PDF schema support -$cfg['Servers'][$i]['column_comments']=''; // table to store columncomments +$cfg['Servers'][$i]['column_comments'] // table to store columncomments + = ''; // - leave blank if you don't want to use this $cfg['Servers'][$i]['pdf_pages'] = ''; // table to describe pages of relationpdf $cfg['Servers'][$i]['AllowDeny']['order'] // Host authentication order, leave blank to not use @@ -198,8 +199,8 @@ $cfg['DefaultLang'] = 'en'; /** * Charset conversion settings */ -// Default charset to use for recoding of MySQL queries, does not take -// any effect when charsets recoding is switched off by +// Default charset to use for recoding of MySQL queries, does not take +// any effect when charsets recoding is switched off by // $cfg['AllowAnywhereRecoding'] or in language file // (see $cfg['AvailableCharsets'] to possible choices, you can add your own) $cfg['DefaultCharset'] = 'iso-8859-1'; diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index 2fdd07118..c2a90060f 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -120,12 +120,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} * Include MySQL wrappers. */ include('./libraries/mysql_wrappers.lib.php3'); - + /** * Include charset conversion. */ include('./libraries/charset_conversion.lib.php3'); - + /** * Gets constants that defines the PHP, MySQL... releases. * This include must be located physically before any code that needs to @@ -136,12 +136,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} include('./libraries/defines.lib.php3'); // For compatibility with old config.inc.php3 - if (!isset($cfg)) { - include('./libraries/config_import.lib.php3'); - } - if (!isset($cfg['UseDbSearch'])) { - $cfg['UseDbSearch'] = TRUE; - } + include('./libraries/config_import.lib.php3'); // If zlib output compression is set in the php configuration file, no // output buffering should be run @@ -556,18 +551,6 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} ? '' : ':' . $cfg['Server']['socket']; - // Ensures compatibility with old config files - if (!isset($cfg['Server']['auth_type'])) { - $cfg['Server']['auth_type'] = (isset($cfg['Server']['adv_auth']) && $cfg['Server']['adv_auth']) - ? 'http' - : 'config'; - } - - if (isset($cfg['Server']['stduser'])) { - $cfg['Server']['controluser'] = $cfg['Server']['stduser']; - $cfg['Server']['controlpass'] = $cfg['Server']['stdpass']; - } - // Gets the authentication library that fits the $cfg['Server'] settings // and run authentication include('./libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php3'); @@ -937,7 +920,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} if ($do_it && PMA_MYSQL_INT_VERSION >= 32306 && !empty($a_name) && $a_name != '*') { - + if (is_array($a_name)) { $result = array(); reset($a_name); diff --git a/libraries/config_import.lib.php3 b/libraries/config_import.lib.php3 index 49c681e94..f64196187 100644 --- a/libraries/config_import.lib.php3 +++ b/libraries/config_import.lib.php3 @@ -1,261 +1,701 @@ - '', + 'rules' => array()); + } + } + } -$cfg['ColumnTypes'] = $cfgColumnTypes; -unset($cfgColumnTypes); -$cfg['AttributeTypes'] = $cfgAttributeTypes; -unset($cfgAttributeTypes); + if (!isset($cfg['ServerDefault'])) { + if (isset($cfgServerDefault)) { + $cfg['ServerDefault'] = $cfgServerDefault; + unset($cfgServerDefault); + } else { + $cfg['ServerDefault'] = 1; + } + } -if (isset($cfgFunctions)) { - $cfg['Functions'] = $cfgFunctions; - unset($cfgFunctions); -} + if (!isset($cfg['OBGzip'])) { + if (isset($cfgOBGzip)) { + $cfg['OBGzip'] = $cfgOBGzip; + unset($cfgOBGzip); + } else { + $cfg['OBGzip'] = TRUE; + } + } -?> \ No newline at end of file + if (!isset($cfg['PersistentConnections'])) { + if (isset($cfgPersistentConnections)) { + $cfg['PersistentConnections'] = $cfgPersistentConnections; + unset($cfgPersistentConnections); + } else { + $cfg['PersistentConnections'] = FALSE; + } + } + + if (!isset($cfg['ExecTimeLimit'])) { + if (isset($cfgExecTimeLimit)) { + $cfg['ExecTimeLimit'] = $cfgExecTimeLimit; + unset($cfgExecTimeLimit); + } else { + $cfg['ExecTimeLimit'] = 300; + } + } + + if (!isset($cfg['SkipLockedTables'])) { + if (isset($cfgSkipLockedTables)) { + $cfg['SkipLockedTables'] = $cfgSkipLockedTables; + unset($cfgSkipLockedTables); + } else { + $cfg['SkipLockedTables'] = FALSE; + } + } + + if (!isset($cfg['ShowSQL'])) { + if (isset($cfgShowSQL)) { + $cfg['ShowSQL'] = $cfgShowSQL; + unset($cfgShowSQL); + } else { + $cfg['ShowSQL'] = TRUE; + } + } + + if (!isset($cfg['AllowUserDropDatabase'])) { + if (isset($cfgAllowUserDropDatabase)) { + $cfg['AllowUserDropDatabase'] = $cfgAllowUserDropDatabase; + unset($cfgAllowUserDropDatabase); + } else { + $cfg['AllowUserDropDatabase'] = FALSE; + } + } + + if (!isset($cfg['Confirm'])) { + if (isset($cfgConfirm)) { + $cfg['Confirm'] = $cfgConfirm; + unset($cfgConfirm); + } else { + $cfg['Confirm'] = TRUE; + } + } + + if (!isset($cfg['LoginCookieRecall'])) { + if (isset($cfgLoginCookieRecall)) { + $cfg['LoginCookieRecall'] = $cfgLoginCookieRecall; + unset($cfgLoginCookieRecall); + } else { + $cfg['LoginCookieRecall'] = TRUE; + } + } + + if (!isset($cfg['UseDbSearch']) { + $cfg['UseDbSearch'] = TRUE; + } + + if (!isset($cfg['LeftFrameLight'])) { + if (isset($cfgLeftFrameLight)) { + $cfg['LeftFrameLight'] = $cfgLeftFrameLight; + unset($cfgLeftFrameLight); + } else { + $cfg['LeftFrameLight'] = TRUE; + } + } + + if (!isset($cfg['ShowTooltip'])) { + if (isset($cfgShowTooltip)) { + $cfg['ShowTooltip'] = $cfgShowTooltip; + } else { + $cfg['ShowTooltip'] = TRUE; + } + } + + if (!isset($cfg['ShowStats'])) { + if (isset($cfgShowStats)) { + $cfg['ShowStats'] = $cfgShowStats; + unset($cfgShowStats); + } else { + $cfg['ShowStats'] = TRUE; + } + } + + if (!isset($cfg['ShowMysqlInfo'])) { + if (isset($cfgShowMysqlInfo)) { + $cfg['ShowMysqlInfo'] = $cfgShowMysqlInfo; + unset($cfgShowMysqlInfo); + } else { + $cfg['ShowMysqlInfo'] = FALSE; + } + } + + if (!isset($cfg['ShowMysqlVars'])) { + if (isset($cfgShowMysqlVars)) { + $cfg['ShowMysqlVars'] = $cfgShowMysqlVars; + unset($cfgShowMysqlVars); + } else { + $cfg['ShowMysqlVars'] = FALSE; + } + } + + if (!isset($cfg['ShowPhpInfo'])) { + if (isset($cfgShowPhpInfo)) { + $cfg['ShowPhpInfo'] = $cfgShowPhpInfo; + unset($cfgShowPhpInfo); + } else { + $cfg['ShowPhpInfo'] = FALSE; + } + } + + if (!isset($cfg['ShowChgPassword'])) { + if (isset($cfgShowChgPassword)) { + $cfg['ShowChgPassword'] = $cfgShowChgPassword; + unset($cfgShowChgPassword); + } else { + $cfg['ShowChgPassword'] = FALSE; + } + } + + if (!isset($cfg['ShowBlob'])) { + if (isset($cfgShowBlob)) { + $cfg['ShowBlob'] = $cfgShowBlob; + unset($cfgShowBlob); + } else { + $cfg['ShowBlob'] = FALSE; + } + } + + if (!isset($cfg['NavigationBarIconic'])) { + if (isset($cfgNavigationBarIconic)) { + $cfg['NavigationBarIconic'] = $cfgNavigationBarIconic; + unset($cfgNavigationBarIconic); + } else { + $cfg['NavigationBarIconic'] = TRUE; + } + } + + if (!isset($cfg['ShowAll'])) { + if (isset($cfgShowAll)) { + $cfg['ShowAll'] = $cfgShowAll; + unset($cfgShowAll); + } else { + $cfg['ShowAll'] = FALSE; + } + } + + if (!isset($cfg['MaxRows'])) { + if (isset($cfgMaxRows)) { + $cfg['MaxRows'] = $cfgMaxRows; + unset($cfgMaxRows); + } else { + $cfg['MaxRows'] = 30; + } + } + + if (!isset($cfg['Order'])) { + if (isset($cfgOrder)) { + $cfg['Order'] = $cfgOrder; + unset($cfgOrder); + } else { + $cfg['Order'] = 'ASC'; + } + } + + if (!isset($cfg['ProtectBinary'])) { + if (isset($cfgProtectBinary)) { + $cfg['ProtectBinary'] = $cfgProtectBinary; + unset($cfgProtectBinary); + } else if (isset($cfg['ProtectBlob'])) { + $cfg['ProtectBinary'] = ($cfg['ProtectBlob'] ? 'blob' : FALSE); + unset($cfg['ProtectBlob']); + } else if (isset($cfgProtectBlob)) { + $cfg['ProtectBinary'] = ($cfgProtectBlob ? 'blob' : FALSE); + unset($cfgProtectBlob); + } else { + $cfg['ProtectBinary'] = 'blob'; + } + } + + if (!isset($cfg['ShowFunctionFields'])) { + if (isset($cfgShowFunctionFields)) { + $cfg['ShowFunctionFields'] = $cfgShowFunctionFields; + unset($cfgShowFunctionFields); + } else { + $cfg['ShowFunctionFields'] = TRUE; + } + } + + if (!isset($cfg['ZipDump'])) { + if (isset($cfgZipDump)) { + $cfg['ZipDump'] = $cfgZipDump; + unset($cfgZipDump); + } else { + $cfg['ZipDump'] = TRUE; + } + } + + if (!isset($cfg['GZipDump'])) { + if (isset($cfgGZipDump)) { + $cfg['GZipDump'] = $cfgGZipDump; + unset($cfgGZipDump); + } else { + $cfg['GZipDump'] = TRUE; + } + } + + if (!isset($cfg['BZipDump'])) { + if (isset($cfgBZipDump)) { + $cfg['BZipDump'] = $cfgBZipDump; + unset($cfgBZipDump); + } else { + $cfg['BZipDump'] = TRUE; + } + } + + if (!isset($cfg['ManualBaseShort'])) { + if (isset($cfgManualBaseShort)) { + $cfg['ManualBaseShort'] = $cfgManualBaseShort; + unset($cfgManualBaseShort); + } else { + $cfg['ManualBaseShort'] = 'http://www.mysql.com/doc'; + } + } + + if (!isset($cfg['DefaultLang'])) { + if (isset($cfgDefaultLang)) { + $cfg['DefaultLang'] = $cfgDefaultLang; + unset($cfgDefaultLang); + } else { + $cfg['DefaultLang'] = 'en'; + } + } + + if (!isset($cfg['DefaultCharset'])) { + $cfg['DefaultCharset'] = 'iso-8859-1'; + } + + if (!isset($cfg['AllowAnywhereRecoding'])) { + $cfg['AllowAnywhereRecoding'] = TRUE; + } + + if (!isset($cfg['Lang']) &&isset($cfgLang)) { + $cfg['Lang'] = $cfgLang; + unset($cfgLang); + } + + if (!isset($cfg['LeftWidth'])) { + if (isset($cfgLeftWidth)) { + $cfg['LeftWidth'] = $cfgLeftWidth; + unset($cfgLeftWidth); + } else { + $cfg['LeftWidth'] = 150; + } + } + + if (!isset($cfg['LeftBgColor'])) { + if (isset($cfgLeftBgColor)) { + $cfg['LeftBgColor'] = $cfgLeftBgColor; + unset($cfgLeftBgColor); + } else { + $cfg['LeftBgColor'] = '#D0DCE0'; + } + } + + if (!isset($cfg['LeftPointerColor'])) { + if (isset($cfgLeftPointerColor)) { + $cfg['LeftPointerColor'] = $cfgLeftPointerColor; + unset($cfgLeftPointerColor); + } else { + $cfg['LeftPointerColor'] = '#CCFFCC'; + } + } + + if (!isset($cfg['RightBgColor'])) { + if (isset($cfgRightBgColor)) { + $cfg['RightBgColor'] = $cfgRightBgColor; + unset($cfgRightBgColor); + } else { + $cfg['RightBgColor'] = '#F5F5F5'; + } + } + + if (!isset($cfg['RightBgImage'])) { + $cfg['RightBgImage'] = ''; + } + + if (!isset($cfg['Border'])) { + if (isset($cfgBorder)) { + $cfg['Border'] = $cfgBorder; + unset($cfgBorder); + } else { + $cfg['Border'] = 0; + } + } + + if (!isset($cfg['ThBgcolor'])) { + if (isset($cfgThBgcolor)) { + $cfg['ThBgcolor'] = $cfgThBgcolor; + unset($cfgThBgcolor); + } else { + $cfg['ThBgcolor'] = '#D3DCE3'; + } + } + + if (!isset($cfg['BgcolorOne'])) { + if (isset($cfgBgcolorOne)) { + $cfg['BgcolorOne'] = $cfgBgcolorOne; + unset($cfgBgcolorOne); + } else { + $cfg['BgcolorOne'] = '#CCCCCC'; + } + } + + if (!isset($cfg['BgcolorTwo'])) { + if (isset($cfgBgcolorTwo)) { + $cfg['BgcolorTwo'] = $cfgBgcolorTwo; + unset($cfgBgcolorTwo); + } else { + $cfg['BgcolorTwo'] = '#DDDDDD'; + } + } + + if (!isset($cfg['BrowsePointerColor'])) { + if (isset($cfgBrowsePointerColor)) { + $cfg['BrowsePointerColor'] = $cfgBrowsePointerColor; + unset($cfgBrowsePointerColor); + } else { + $cfg['BrowsePointerColor'] = '#CCFFCC'; + } + } + + if (!isset($cfg['BrowseMarkerColor'])) { + if (isset($cfgBrowseMarkerColor) { + $cfg['BrowseMarkerColor'] = $cfgBrowseMarkerColor; + unset($cfgBrowseMarkerColor); + } else if (isset($cfg['BrowseMarkRow'])) { + $cfg['BrowseMarkerColor'] = (!empty($cfg['BrowsePointerColor']) && !empty($cfg['BrowseMarkRow'])) + ? '#FFCC99' + : ''; + unset($cfg['BrowseMarkRow']); + } else if (isset($cfgBrowseMarkRow)) { + $cfg['BrowseMarkerColor'] = (!empty($cfg['BrowsePointerColor']) && !empty($cfgBrowseMarkRow)) + ? '#FFCC99' + : ''; + unset($cfgBrowseMarkRow); + } else { + $cfg['BrowseMarkerColor'] = ''; + } + } + + if (!isset($cfg['TextareaCols'])) { + if (isset($cfgTextareaCols)) { + $cfg['TextareaCols'] = $cfgTextareaCols; + unset($cfgTextareaCols); + } else { + $cfg['TextareaCols'] = 40; + } + } + + if (!isset($cfg['TextareaRows'])) { + if (isset($cfgTextareaRows)) { + $cfg['TextareaRows'] = $cfgTextareaRows; + unset($cfgTextareaRows); + } else { + $cfg['TextareaRows'] = 7; + } + } + + if (!isset($cfg['LimitChars'])) { + if (isset($cfgLimitChars)) { + $cfg['LimitChars'] = $cfgLimitChars; + unset($cfgLimitChars); + } else { + $cfg['LimitChars'] = 50; + } + } + + if (!isset($cfg['ModifyDeleteAtLeft'])) { + if (isset($cfgModifyDeleteAtLeft)) { + $cfg['ModifyDeleteAtLeft'] = $cfgModifyDeleteAtLeft; + unset($cfgModifyDeleteAtLeft); + } else { + $cfg['ModifyDeleteAtLeft'] = TRUE; + } + } + + if (!isset($cfg['ModifyDeleteAtRight'])) { + if (isset($cfgModifyDeleteAtRight)) { + $cfg['ModifyDeleteAtRight'] = $cfgModifyDeleteAtRight; + unset($cfgModifyDeleteAtRight); + } else { + $cfg['ModifyDeleteAtRight'] = FALSE; + } + } + + if (!isset($cfg['DefaultDisplay'])) { + if (isset($cfgDefaultDisplay)) { + $cfg['DefaultDisplay'] = $cfgDefaultDisplay; + unset($cfgDefaultDisplay); + } else { + $cfg['DefaultDisplay'] = 'horizontal'; + } + } + + if (!isset($cfg['RepeatCells'])) { + if (isset($cfgRepeatCells)) { + $cfg['RepeatCells'] = $cfgRepeatCells; + unset($cfgRepeatCells); + } else { + $cfg['RepeatCells'] = 100; + } + } + + if (!isset($cfg['UseSyntaxColoring'])) { + $cfg['UseSyntaxColoring'] = TRUE; + } + + if (!isset($cfg['colorFunctions'])) { + $cfg['colorFunctions'] = '#FF0000'; + } + + if (!isset($cfg['colorKeywords'])) { + $cfg['colorKeywords'] = '#990099'; + } + + if (!isset($cfg['colorStrings'])) { + $cfg['colorStrings'] = '#008000'; + } + + if (!isset($cfg['colorColType'])) { + $cfg['colorColType'] = '#FF9900'; + } + + if (!isset($cfg['colorAdd'])) { + $cfg['colorAdd'] = '#0000FF'; + } + + if (!isset($cfg['AvailableCharsets'])) { + $cfg['AvailableCharsets'] = array( + 'iso-8859-1', + 'iso-8859-2', + 'iso-8859-3', + 'iso-8859-4', + 'iso-8859-5', + 'iso-8859-6', + 'iso-8859-7', + 'iso-8859-8', + 'iso-8859-9', + 'iso-8859-10', + 'iso-8859-11', + 'iso-8859-12', + 'iso-8859-13', + 'iso-8859-14', + 'iso-8859-15', + 'windows-1250', + 'windows-1251', + 'windows-1252', + 'windows-1257', + 'koi8-r', + 'big5', + 'gb2312', + 'utf-8', + 'utf-7', + 'x-user-defined', + 'euc-jp', + 'ks_c_5601-1987', + 'tis-620', + 'SHIFT_JIS' + ); + } + + if (!isset($cfg['ColumnTypes'])) { + if (isset($cfgColumnTypes)) { + $cfg['ColumnTypes'] = $cfgColumnTypes; + unset($cfgColumnTypes); + } else { + $cfg['ColumnTypes'] = array( + 'VARCHAR', + 'TINYINT', + 'TEXT', + 'DATE', + 'SMALLINT', + 'MEDIUMINT', + 'INT', + 'BIGINT', + 'FLOAT', + 'DOUBLE', + 'DECIMAL', + 'DATETIME', + 'TIMESTAMP', + 'TIME', + 'YEAR', + 'CHAR', + 'TINYBLOB', + 'TINYTEXT', + 'BLOB', + 'MEDIUMBLOB', + 'MEDIUMTEXT', + 'LONGBLOB', + 'LONGTEXT', + 'ENUM', + 'SET' + ); + } + } + + if (!isset($cfg['AttributeTypes'])) { + if (isset($cfgAttributeTypes)) { + $cfg['AttributeTypes'] = $cfgAttributeTypes; + unset($cfgAttributeTypes); + } else { + $cfg['AttributeTypes'] = array( + '', + 'BINARY', + 'UNSIGNED', + 'UNSIGNED ZEROFILL' + ); + } + } + + if (!isset($cfg['Functions']) && $cfg['ShowFunctionFields']) { + if (isset($cfgFunctions)) { + $cfg['Functions'] = $cfgFunctions; + } else { + $cfg['Functions'] = array( + 'ASCII', + 'CHAR', + 'SOUNDEX', + 'LCASE', + 'UCASE', + 'NOW', + 'PASSWORD', + 'MD5', + 'ENCRYPT', + 'RAND', + 'LAST_INSERT_ID', + 'COUNT', + 'AVG', + 'SUM', + 'CURDATE', + 'CURTIME', + 'FROM_DAYS', + 'FROM_UNIXTIME', + 'PERIOD_ADD', + 'PERIOD_DIFF', + 'TO_DAYS', + 'UNIX_TIMESTAMP', + 'USER', + 'WEEKDAY', + 'CONCAT' + ); + } + } +} // $__PMA_CONFIG_IMPORT_LIB__ + +?>