diff --git a/ChangeLog b/ChangeLog index 6161d2f51..f76b4c3bb 100755 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,12 @@ $Source$ * Documentation.html, line 282: the suggested statement to create a new user and give him grants on a db was invalid. * Documentation.txt: updated. + * config.inc.php3; main.php3; lang/*; libraris/common.lib.php3; + libraries/auth/*: + - moved all the authentication work in libraries so it will be easier to + add new authentication modes; + - started merging patch #463127 - Cookie based authentication, thanks to + Piotr Roszatycki and Dan Wilson. 2001-12-08 Loïc Chapeaux * libraries/left.js, lines 234-240: fixed a js bug with empty databases. diff --git a/config.inc.php3 b/config.inc.php3 index 2e0691e1b..9480e1349 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -44,7 +44,7 @@ $cfgServers[1]['socket'] = ''; // Path to the socket - leave bla $cfgServers[1]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket') $cfgServers[1]['stduser'] = ''; // MySQL standard user settings (this user must have read-only $cfgServers[1]['stdpass'] = ''; // access to the "mysql/user" and "mysql/db" tables) -$cfgServers[1]['adv_auth'] = FALSE; // Use advanced authentication? +$cfgServers[1]['auth_type'] = 'basic'; // Authentication method (basic, http or cookie based)? $cfgServers[1]['user'] = 'root'; // MySQL user $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 @@ -59,7 +59,7 @@ $cfgServers[2]['socket'] = ''; $cfgServers[2]['connect_type'] = 'tcp'; $cfgServers[2]['stduser'] = ''; $cfgServers[2]['stdpass'] = ''; -$cfgServers[2]['adv_auth'] = FALSE; +$cfgServers[2]['auth_type'] = 'basic'; $cfgServers[2]['user'] = 'root'; $cfgServers[2]['password'] = ''; $cfgServers[2]['only_db'] = ''; @@ -73,7 +73,7 @@ $cfgServers[3]['socket'] = ''; $cfgServers[3]['connect_type'] = 'tcp'; $cfgServers[3]['stduser'] = ''; $cfgServers[3]['stdpass'] = ''; -$cfgServers[3]['adv_auth'] = FALSE; +$cfgServers[3]['auth_type'] = 'basic'; $cfgServers[3]['user'] = 'root'; $cfgServers[3]['password'] = ''; $cfgServers[3]['only_db'] = ''; diff --git a/lang/arabic.inc.php3 b/lang/arabic.inc.php3 index 08e89930e..8f621facc 100644 --- a/lang/arabic.inc.php3 +++ b/lang/arabic.inc.php3 @@ -174,7 +174,6 @@ $strLineFeed = ' $strLines = 'ÎØæØ'; $strLinesTerminatedBy = 'ÎØæØ ãÝÕæáå ÈÜ'; $strLocationTextfile = 'ãßÇä ãáÝ ÇáäÕæÕ'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'ÊÓÌíá ÎÑæÌ'; $strModifications = 'ÊãÊ ÇáÊÚÏíáÇÊ'; @@ -342,4 +341,8 @@ $strZip = '"zipped" " // To translate $strCardinality = 'Cardinality'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/brazilian_portuguese.inc.php3 b/lang/brazilian_portuguese.inc.php3 index a71c7294f..5a842c546 100644 --- a/lang/brazilian_portuguese.inc.php3 +++ b/lang/brazilian_portuguese.inc.php3 @@ -153,7 +153,6 @@ $strLineFeed = 'Caracter de Alimenta $strLines = 'Linhas'; $strLinesTerminatedBy = 'Linhas terminadas por'; $strLocationTextfile = 'Localização do arquivo texto'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Sair'; $strModifications = 'Modificações foram salvas'; @@ -302,12 +301,16 @@ $strYes = 'Sim'; $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strFlushTable = 'Flush the table ("FLUSH")'; $strIdxFulltext = 'Fulltext'; //to translate $strInvalidName = '"%s" is a reserved word, you can\'t use it as a database/table/field name.'; //to translate $strKeepPass = 'Do not change the password';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/bulgarian-koi8.inc.php3 b/lang/bulgarian-koi8.inc.php3 index 02b6c7e92..a0e0c0cdf 100644 --- a/lang/bulgarian-koi8.inc.php3 +++ b/lang/bulgarian-koi8.inc.php3 @@ -170,7 +170,7 @@ $strLineFeed = ' $strLines = 'òÅÄÏ×Å'; $strLinesTerminatedBy = 'ìÉÎÉÉÔÅ ÚÁ×ßÒÛ×ÁÔ Ó'; $strLocationTextfile = 'íÅÓÔÏÐÏÌÏÖÅÎÉÅ ÎÁ ÔÅËÓÔÏ×ÉÑ ÆÁÊÌ'; -$strLogin = '÷ÈÏÄ'; //keep it, even if its not in use ... +$strLogin = '÷ÈÏÄ'; $strLogout = 'éÚÈÏÄ ÏÔ ÓÉÓÔÅÍÁÔÁ'; $strModifications = 'ðÒÏÍÅÎÉÔÅ ÂÑÈÁ ÓßÈÒÁÎÅÎÉ'; @@ -338,5 +338,7 @@ $strYes = ' $strZip = '"zip-ÎÁÔÏ"'; // To translate - +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/bulgarian-win1251.inc.php3 b/lang/bulgarian-win1251.inc.php3 index 7eba76d7a..1c6c13cbd 100644 --- a/lang/bulgarian-win1251.inc.php3 +++ b/lang/bulgarian-win1251.inc.php3 @@ -170,7 +170,7 @@ $strLineFeed = ' $strLines = 'Ðåäîâå'; $strLinesTerminatedBy = 'Ëèíèèòå çàâúðøâàò ñ'; $strLocationTextfile = 'Ìåñòîïîëîæåíèå íà òåêñòîâèÿ ôàéë'; -$strLogin = 'Âõîä'; //keep it, even if its not in use ... +$strLogin = 'Âõîä'; $strLogout = 'Èçõîä îò ñèñòåìàòà'; $strModifications = 'Ïðîìåíèòå áÿõà ñúõðàíåíè'; @@ -338,5 +338,7 @@ $strYes = ' $strZip = '"zip-íàòî"'; // To translate - +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/catala.inc.php3 b/lang/catala.inc.php3 index a370e9126..097247792 100644 --- a/lang/catala.inc.php3 +++ b/lang/catala.inc.php3 @@ -133,7 +133,6 @@ $strLimitNumRows = 'registres per plana'; $strLineFeed = 'Salt de línia: \\n'; $strLines = 'Línies'; $strLocationTextfile = 'Ubicació del fitxer de text'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Sortir'; $strModifications = 'Les modificacions han estat guardades'; @@ -270,6 +269,7 @@ $strAfterInsertNewInsert = 'Insert a new record'; $strAnIndex = 'An index has been added on %s';//to translate $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strDatabasesStats = 'Databases statistics';//to translate @@ -293,6 +293,9 @@ $strInvalidName = '"%s" is a reserved word, you can\'t use it as a database/tabl $strKeepPass = 'Do not change the password';//to translate $strLengthSet = 'Length/Values*'; //to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/chinese_big5.inc.php3 b/lang/chinese_big5.inc.php3 index ebd703b6f..0be4586cf 100644 --- a/lang/chinese_big5.inc.php3 +++ b/lang/chinese_big5.inc.php3 @@ -134,7 +134,6 @@ $strLimitNumRows = ' $strLineFeed = '´«¦æ: \\n'; $strLines = '¦æ¼Æ'; $strLocationTextfile = '¤å¦rÀɮתº¦ì¸m'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'µn¥X¨t²Î'; $strModifications = '­×§ï¤wÀx¦s'; @@ -269,6 +268,7 @@ $strAfterInsertNewInsert = 'Insert a new record'; $strAnIndex = 'An index has been added on %s';//to translate $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strDatabasesStats = 'Databases statistics';//to translate @@ -292,6 +292,9 @@ $strInstructions = 'Instructions';//to translate $strInvalidName = '"%s" is a reserved word, you can\'t use it as a database/table/field name.'; //to translate $strKeepPass = 'Do not change the password';//to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/chinese_gb.inc.php3 b/lang/chinese_gb.inc.php3 index bbe204ecd..c35d1e1a0 100644 --- a/lang/chinese_gb.inc.php3 +++ b/lang/chinese_gb.inc.php3 @@ -128,7 +128,6 @@ $strLimitNumRows = 'records per page'; //to translate $strLineFeed = '»»ÐУº\\n'; $strLines = 'ÐÐÊý '; $strLocationTextfile = 'Îı¾ÎļþµÄλÖÃ'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Í˳öϵͳ'; $strModifications = 'Ð޸ĺóµÄÊý¾ÝÒѾ­´æÅÌ¡£'; @@ -271,6 +270,7 @@ $strAfterInsertNewInsert = 'Insert a new record'; $strAnIndex = 'An index has been added on %s';//to translate $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strDatabasesStats = 'Databases statistics';//to translate @@ -294,6 +294,9 @@ $strInstructions = 'Instructions';//to translate $strInvalidName = '"%s" is a reserved word, you can\'t use it as a database/table/field name.'; //to translate $strKeepPass = 'Do not change the password';//to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/czech-iso.inc.php3 b/lang/czech-iso.inc.php3 index 9317a5d63..d73331e0b 100644 --- a/lang/czech-iso.inc.php3 +++ b/lang/czech-iso.inc.php3 @@ -170,7 +170,6 @@ $strLineFeed = 'Ukon $strLines = 'Øádek'; $strLinesTerminatedBy = 'Øádky ukonèené'; $strLocationTextfile = 'Umístìní textového souboru'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Odhlásit se'; $strModifications = 'Zmìny byly ulo¾eny'; @@ -336,4 +335,10 @@ $strYes = 'Ano'; $strZip = '"zazipováno"'; +// To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; + ?> diff --git a/lang/czech-win1250.inc.php3 b/lang/czech-win1250.inc.php3 index a03dfdad5..1b72fd9b9 100644 --- a/lang/czech-win1250.inc.php3 +++ b/lang/czech-win1250.inc.php3 @@ -171,7 +171,6 @@ $strLineFeed = 'Ukon $strLines = 'Øádek'; $strLinesTerminatedBy = 'Øádky ukonèené'; $strLocationTextfile = 'Umístìní textového souboru'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Odhlásit se'; $strModifications = 'Zmìny byly uloženy'; @@ -338,4 +337,9 @@ $strYes = 'Ano'; $strZip = '"zazipováno"'; +// To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/danish.inc.php3 b/lang/danish.inc.php3 index cf1f11548..32a7e47ab 100644 --- a/lang/danish.inc.php3 +++ b/lang/danish.inc.php3 @@ -132,7 +132,8 @@ $strHomepageOfficial = 'Officiel phpMyAdmin hjemmeside '; $strHomepageSourceforge = 'Ny phpMyAdmin hjemmeside '; $strHost = 'Vært'; $strHostEmpty = 'Der er intet værtsnavn!'; -$strIdxFulltext = 'Fuldtekst'; + +$strIdxFulltext = 'Fuldtekst'; $strIfYouWish = 'Hvis du kun ønsker at importere nogle af tabellens kolonner, angives de med en kommasepareret felt liste.'; $strIndex = 'Indeks'; $strIndexes = 'Indekser'; @@ -157,7 +158,6 @@ $strLineFeed = 'Linefeed: \\n'; $strLines = 'Linier'; $strLinesTerminatedBy = 'Linier afsluttet med'; $strLocationTextfile = 'Tekstfilens placering'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Log af'; $strModifications = 'Rettelserne er gemt!'; @@ -319,7 +319,11 @@ $strZip = '"zipped"'; //to translate $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strFlushTable = 'Flush the table ("FLUSH")'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strNoFrames = 'phpMyAdmin is more friendly with a frames-capable browser.'; $strTableHasBeenFlushed = 'Table %s has been flushed'; diff --git a/lang/dutch.inc.php3 b/lang/dutch.inc.php3 index 516a48447..9e5a5e645 100644 --- a/lang/dutch.inc.php3 +++ b/lang/dutch.inc.php3 @@ -141,7 +141,7 @@ $strLimitNumRows = 'records per pagina'; $strLineFeed = 'Linefeed: \\n'; $strLines = 'Regels'; $strLocationTextfile = 'Locatie van het tekstbestand'; -$strLogin = 'Inloggen'; //to translate, but its not in use ... +$strLogin = 'Inloggen'; $strLogout = 'Uitloggen'; $strModifications = 'Wijzigingen opgeslagen.'; @@ -287,6 +287,7 @@ $strAnIndex = 'An index has been added on %s';//to translate $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; $strBzip = '"bzipped"'; //to translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strDeleteUserMessage = 'You have deleted the user %s.';//to translate @@ -301,6 +302,8 @@ $strIdxFulltext = 'Fulltext'; //to translate $strIndexHasBeenDropped = 'Index %s has been dropped';//to translate $strKeepPass = 'Do not change the password';//to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/english.inc.php3 b/lang/english.inc.php3 index 18ee06cc4..fe19772a2 100644 --- a/lang/english.inc.php3 +++ b/lang/english.inc.php3 @@ -71,6 +71,7 @@ $strColumn = 'Column'; $strColumnNames = 'Column names'; $strCompleteInserts = 'Complete inserts'; $strConfirm = 'Do you really want to do it?'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strCopyTableOK = 'Table %s has been copied to %s.'; $strCreate = 'Create'; @@ -170,8 +171,10 @@ $strLineFeed = 'Linefeed: \\n'; $strLines = 'Lines'; $strLinesTerminatedBy = 'Lines terminated by'; $strLocationTextfile = 'Location of the textfile'; -$strLogin = ''; //to translate, but its not in use ... +$strLogin = 'Login'; $strLogout = 'Log out'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strModifications = 'Modifications have been saved'; $strModify = 'Modify'; diff --git a/lang/finnish.inc.php3 b/lang/finnish.inc.php3 index c6a6379a4..e71fe5e17 100644 --- a/lang/finnish.inc.php3 +++ b/lang/finnish.inc.php3 @@ -174,7 +174,6 @@ $strLineFeed = 'LF-rivinvaihto: \\n'; $strLines = 'Rivit'; $strLinesTerminatedBy = 'Rivien erotinmerkki'; $strLocationTextfile = 'Tiedoston sijainti'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Poistu'; $strModifications = 'Muutokset tallennettu'; @@ -341,5 +340,9 @@ $strYes = 'Kyll $strZip = '"zip-pakattu"'; // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/french.inc.php3 b/lang/french.inc.php3 index 9ee6c865d..d9ccad0e5 100644 --- a/lang/french.inc.php3 +++ b/lang/french.inc.php3 @@ -71,6 +71,7 @@ $strColumn = 'Colonne'; $strColumnNames = 'Nom des colonnes'; $strCompleteInserts = 'Insertions complètes'; $strConfirm = 'Veuillez confirmer'; +$strCookiesRequired = 'Vous devez accepter les cookies pour poursuivre.'; $strCopyTable = 'Copier la table vers (base.table) :'; $strCopyTableOK = 'La table %s a été copiée vers %s.'; $strCreate = 'Créer'; @@ -170,8 +171,10 @@ $strLineFeed = 'Saut de ligne : \\n'; $strLines = 'Lignes'; $strLinesTerminatedBy = 'Lignes terminées par'; $strLocationTextfile = 'Emplacement du fichier texte'; -$strLogin = ''; //to translate, but its not in use ... +$strLogin = 'Entrer'; $strLogout = 'Quitter'; +$strLogUsername = 'Nom d\'utilisateur :'; +$strLogPassword = 'Mot de passe :'; $strModifications = 'Les modifications ont été sauvegardées.'; $strModify = 'Modifier'; diff --git a/lang/galician.inc.php3 b/lang/galician.inc.php3 index d699cc348..e716e6b22 100644 --- a/lang/galician.inc.php3 +++ b/lang/galician.inc.php3 @@ -170,7 +170,6 @@ $strLineFeed = 'Car $strLines = 'Liñas'; $strLinesTerminatedBy = 'As liñas rematan por'; $strLocationTextfile = 'Localización do arquivo de texto'; -$strLogin = 'Login'; //to translate, but its not in use ... $strLogout = 'Sair'; $strModifications = 'As modificacións foron gardadas'; @@ -337,5 +336,9 @@ $strYes = 'Si'; $strZip = 'comprimido no formato "zipped"'; // To translate +$strCardinality = 'Cardinality'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/german.inc.php3 b/lang/german.inc.php3 index 3fdbdd4e7..1f249e5e1 100644 --- a/lang/german.inc.php3 +++ b/lang/german.inc.php3 @@ -169,7 +169,6 @@ $strLineFeed = 'Zeilenvorschub: \\n'; $strLines = 'Zeilen'; $strLinesTerminatedBy = 'Zeilen getrennt mit'; $strLocationTextfile = 'Datei'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Neu einloggen'; $strModifications = 'Änderungen gespeichert.'; @@ -334,9 +333,11 @@ $strYes = 'Ja'; $strZip = '"Zip komprimiert"'; // To translate +$strCardinality = 'Cardinality'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strShowCols = 'Show columns'; $strShowTables = 'Show tables'; - -// Indexes -$strCardinality = 'Cardinality'; ?> \ No newline at end of file diff --git a/lang/greek.inc.php3 b/lang/greek.inc.php3 index 9da36a741..7bdb210b0 100644 --- a/lang/greek.inc.php3 +++ b/lang/greek.inc.php3 @@ -146,7 +146,6 @@ $strLimitNumRows = ' $strLineFeed = '×áñáêôÞñáò ðñïþèçóçò ãñáììÞò: \\n'; $strLines = 'ÃñáììÝò'; $strLocationTextfile = 'Ôïðïèåóßá ôïõ áñ÷åßïõ êåéìÝíïõ'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Áðïóýíäåóç'; $strModifications = 'Ïé áëëáãÝò áðïèçêåýôçêáí'; @@ -295,6 +294,7 @@ $strAfterInsertNewInsert = 'Insert a new record'; $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strAnIndex = 'An index has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strDeleteUserMessage = 'You have deleted the user %s.';//to translate @@ -306,6 +306,9 @@ $strFlushTable = 'Flush the table ("FLUSH")'; $strIndexHasBeenDropped = 'Index %s has been dropped';//to translate $strKeepPass = 'Do not change the password';//to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/italian.inc.php3 b/lang/italian.inc.php3 index b38ad467a..4a13a09b1 100644 --- a/lang/italian.inc.php3 +++ b/lang/italian.inc.php3 @@ -172,7 +172,6 @@ $strLineFeed = 'Fine riga: \\n'; $strLines = 'Record'; $strLinesTerminatedBy = 'Linee terminate da'; $strLocationTextfile = 'Percorso del file'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Disconnetti'; $strModifications = 'Le modifiche sono state salvate'; @@ -339,4 +338,8 @@ $strYes = ' Si '; $strZip = '"compresso con zip"'; // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/japanese.inc.php3 b/lang/japanese.inc.php3 index 302b682b8..20bae3ed8 100644 --- a/lang/japanese.inc.php3 +++ b/lang/japanese.inc.php3 @@ -337,5 +337,8 @@ $strYes = ' $strZip = '"zip¤µ¤ì¤ë"'; // To translate +$strCardinality = 'Cardinality'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/korean.inc.php3 b/lang/korean.inc.php3 index c75419bdd..14bada536 100644 --- a/lang/korean.inc.php3 +++ b/lang/korean.inc.php3 @@ -128,7 +128,6 @@ $strLimitNumRows = ' $strLineFeed = '°³Çà ¹®ÀÚ: \\n'; $strLines = 'ÁÙ(ú¼)'; $strLocationTextfile = 'SQL ´ýÇÁ µ¥ÀÌÅÍ ÅØ½ºÆ® ÆÄÀÏ'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = '·Î±× ¾Æ¿ô'; $strModifications = 'À» ¹Ù¸£°Ô ¼öÁ¤ÇÏ¿´½À´Ï´Ù.'; @@ -271,6 +270,7 @@ $strAfterInsertNewInsert = 'Insert a new record'; $strAnIndex = 'An index has been added on %s';//to translate $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strDatabasesStats = 'Databases statistics';//to translate @@ -293,6 +293,9 @@ $strInstructions = 'Instructions';//to translate $strInvalidName = '"%s" is a reserved word, you can\'t use it as a database/table/field name.'; //to translate $strKeepPass = 'Do not change the password';//to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password :'; +$strLogUsername = 'Username :'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/norwegian.inc.php3 b/lang/norwegian.inc.php3 index 2d03bb730..5a3f4459b 100644 --- a/lang/norwegian.inc.php3 +++ b/lang/norwegian.inc.php3 @@ -169,7 +169,6 @@ $strLineFeed = 'Linjeskift: \\n'; $strLines = 'Linjer'; $strLinesTerminatedBy = 'Linker avsluttet med'; $strLocationTextfile = 'Plassering av filen'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Logg ut'; $strModifications = 'Endringene er lagret'; @@ -336,4 +335,8 @@ $strYes = 'Ja'; $strZip = '"komprimert (zip)"'; // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/polish.inc.php3 b/lang/polish.inc.php3 index 71a37fed3..b88ce651f 100644 --- a/lang/polish.inc.php3 +++ b/lang/polish.inc.php3 @@ -337,5 +337,8 @@ $strYes = 'Tak'; $strZip = '".zip"'; // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogPassword = 'Password :'; +$strLogUsername = 'Username :'; ?> diff --git a/lang/portuguese.inc.php3 b/lang/portuguese.inc.php3 index cc9c46b31..759c0a58f 100644 --- a/lang/portuguese.inc.php3 +++ b/lang/portuguese.inc.php3 @@ -128,7 +128,6 @@ $strLimitNumRows = 'records per page'; //to translate $strLineFeed = 'Linefeed: \\n'; $strLines = 'Linhas'; $strLocationTextfile = 'Localização do arquivo textos'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Log out'; $strModifications = 'Modificações foram salvas'; @@ -271,6 +270,7 @@ $strAfterInsertNewInsert = 'Insert a new record'; $strAnIndex = 'An index has been added on %s';//to translate $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strDatabasesStats = 'Databases statistics';//to translate @@ -293,6 +293,9 @@ $strInstructions = 'Instructions';//to translate $strInvalidName = '"%s" is a reserved word, you can\'t use it as a database/table/field name.'; //to translate $strKeepPass = 'Do not change the password';//to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password :'; +$strLogUsername = 'Username :'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/romanian.inc.php3 b/lang/romanian.inc.php3 index 9279d4274..957afe5e0 100644 --- a/lang/romanian.inc.php3 +++ b/lang/romanian.inc.php3 @@ -170,7 +170,6 @@ $strLineFeed = 'Dezvoltare linie: \\n'; $strLines = 'Linii'; $strLinesTerminatedBy = 'Linii terminate de'; $strLocationTextfile = 'Locatia fisierului text'; -$strLogin = ''; $strLogout = 'Deconectare'; $strModifications = 'Modificarile au fost salvate'; @@ -337,5 +336,9 @@ $strYes = 'Da'; $strZip = '"zipped"'; // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password :'; +$strLogUsername = 'Username :'; ?> diff --git a/lang/russian-koi8.inc.php3 b/lang/russian-koi8.inc.php3 index d3849019f..15931cb3f 100644 --- a/lang/russian-koi8.inc.php3 +++ b/lang/russian-koi8.inc.php3 @@ -170,7 +170,7 @@ $strLineFeed = ' $strLines = 'ìÉÎÉÉ'; $strLinesTerminatedBy = 'óÔÒÏËÉ ÒÁÚÄÅÌÅÎÙ'; $strLocationTextfile = 'íÅÓÔÏÒÁÓÐÏÌÏÖÅÎÉÅ ÔÅËÓÔÏ×ÏÇÏ ÆÁÊÌÁ'; -$strLogin = '÷ÈÏÄ × ÓÉÓÔÅÍÕ'; // To translate, but its not in use ... +$strLogin = '÷ÈÏÄ × ÓÉÓÔÅÍÕ'; $strLogout = '÷ÙÊÔÉ ÉÚ ÓÉÓÔÅÍÙ'; $strModifications = 'íÏÄÉÆÉËÁÃÉÉ ÂÙÌÉ ÓÏÈÒÁÎÅÎÙ'; @@ -337,4 +337,7 @@ $strYes = ' $strZip = 'ÕÐÁËÏ×ÁÔØ × "zip"'; // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/russian-win1251.inc.php3 b/lang/russian-win1251.inc.php3 index ba11841be..b5c03b5d5 100644 --- a/lang/russian-win1251.inc.php3 +++ b/lang/russian-win1251.inc.php3 @@ -170,7 +170,7 @@ $strLineFeed = ' $strLines = 'Ëèíèè'; $strLinesTerminatedBy = 'Ñòðîêè ðàçäåëåíû'; $strLocationTextfile = 'Ìåñòîðàñïîëîæåíèå òåêñòîâîãî ôàéëà'; -$strLogin = 'Âõîä â ñèñòåìó'; // To translate, but its not in use ... +$strLogin = 'Âõîä â ñèñòåìó'; $strLogout = 'Âûéòè èç ñèñòåìû'; $strModifications = 'Ìîäèôèêàöèè áûëè ñîõðàíåíû'; @@ -337,4 +337,7 @@ $strYes = ' $strZip = 'óïàêîâàòü â "zip"'; // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/slovak-iso.inc.php3 b/lang/slovak-iso.inc.php3 index ed70d6713..1dc6761d5 100644 --- a/lang/slovak-iso.inc.php3 +++ b/lang/slovak-iso.inc.php3 @@ -172,7 +172,6 @@ $strLineFeed = 'Ukon $strLines = 'Riadky'; $strLinesTerminatedBy = 'Riadky ukonèené'; $strLocationTextfile = 'Lokácia textového súboru'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Odhlási» sa'; $strModifications = 'Zmeny boli ulo¾ené'; @@ -340,5 +339,9 @@ $strZip = '"zo zipovan // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/spanish.inc.php3 b/lang/spanish.inc.php3 index 00c1d64f4..f30441b08 100644 --- a/lang/spanish.inc.php3 +++ b/lang/spanish.inc.php3 @@ -142,7 +142,6 @@ $strLimitNumRows = 'registros por pagina'; $strLineFeed = 'Retorno de carro: \\n'; $strLines = 'Lineas'; $strLocationTextfile = 'Localización del archivo de texto'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Salir'; $strModifications = 'Se han guardado las modificaciones'; @@ -288,6 +287,7 @@ $strAfterInsertNewInsert = 'Insert a new record'; $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; $strBzip = '"bzipped"'; //to translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strFieldHasBeenDropped = 'Field %s has been dropped';//to translate @@ -302,6 +302,9 @@ $strIndexHasBeenDropped = 'Index %s has been dropped';//to translate $strInvalidName = '"%s" is a reserved word, you can\'t use it as a database/table/field name.'; //to translate $strKeepPass = 'Do not change the password';//to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/swedish.inc.php3 b/lang/swedish.inc.php3 index 84dbf59da..a1c5a339a 100644 --- a/lang/swedish.inc.php3 +++ b/lang/swedish.inc.php3 @@ -170,7 +170,7 @@ $strLineFeed = 'Radframmatning: \\n'; $strLines = 'Rader'; $strLinesTerminatedBy = 'Raderna avslutas med'; $strLocationTextfile = 'Textfilens plats'; -$strLogin = 'Logga in'; //to translate, but its not in use ... +$strLogin = 'Logga in'; $strLogout = 'Logga ut'; $strModifications = 'Ändringarna har sparats'; @@ -336,4 +336,8 @@ $strYes = 'Ja'; $strZip = '"zippad"'; +// To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/lang/thai.inc.php3 b/lang/thai.inc.php3 index abe69c842..cb304c127 100644 --- a/lang/thai.inc.php3 +++ b/lang/thai.inc.php3 @@ -128,7 +128,6 @@ $strLimitNumRows = ' $strLineFeed = 'Linefeed: \\n'; //to translate $strLines = 'ºÃ÷Ѵ'; $strLocationTextfile = 'µÓá˹觢ͧ text file'; -$strLogin = ''; //to translate, but its not in use ... $strLogout = 'Log out'; //to translate $strModifications = 'ºÑ¹·Ö¡¡ÒÃá¡éä¢àÃÕºÃéÍÂáÅéÇ'; @@ -271,6 +270,7 @@ $strAfterInsertNewInsert = 'Insert a new record'; $strAnIndex = 'An index has been added on %s';//to translate $strAPrimaryKey = 'A primary key has been added on %s';//to translate $strBookmarkDeleted = 'The bookmark has been deleted.'; +$strCookiesRequired = 'Cookies must be enabled past this point.'; $strCopyTable = 'Copy table to (database.table):'; $strDatabaseHasBeenDropped = 'Database %s has been dropped.'; //to translate $strDatabasesStats = 'Databases statistics';//to translate @@ -294,6 +294,9 @@ $strInstructions = 'Instructions';//to translate $strInvalidName = '"%s" is a reserved word, you can\'t use it as a database/table/field name.'; //to translate $strKeepPass = 'Do not change the password';//to translate $strLinesTerminatedBy = 'Lines terminated by';//to translate +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLServerProcess = 'MySQL %pma_s1% running on %pma_s2% as %pma_s3%'; diff --git a/lang/turkish.inc.php3 b/lang/turkish.inc.php3 index b66790a27..8ea37b0fc 100644 --- a/lang/turkish.inc.php3 +++ b/lang/turkish.inc.php3 @@ -170,7 +170,6 @@ $strLineFeed = 'Sat $strLines = 'Satýrlar'; $strLinesTerminatedBy = 'Satýr sonu'; $strLocationTextfile = 'Dosyadan yükle'; -$strLogin = ''; //to translate, but its not in use ... (so why here :P ) $strLogout = 'Çýkýþ'; $strModifications = 'Deðiþiklikler kaydedildi'; @@ -337,4 +336,8 @@ $strYes = 'Evet'; $strZip = '"ziplenmiþ"'; // To translate +$strCookiesRequired = 'Cookies must be enabled past this point.'; +$strLogin = 'Login'; +$strLogPassword = 'Password:'; +$strLogUsername = 'Username:'; ?> diff --git a/libraries/auth/basic.auth.lib.php3 b/libraries/auth/basic.auth.lib.php3 new file mode 100644 index 000000000..b356da2e5 --- /dev/null +++ b/libraries/auth/basic.auth.lib.php3 @@ -0,0 +1,115 @@ + authentication failed + * + * @global string the MySQL error message PHP returns + * @global string the connection type (persitent or not) + * @global string the MySQL server port to use + * @global string the MySQL socket port to use + * @global array the current server settings + * @global string the font face to use in case of failure + * @global string the default font size to use in case of failure + * @global string the big font size to use in case of failure + * + * @return boolean always true (no return indeed) + * + * @access public + */ + function PMA_auth_fails() + { + global $php_errormsg; + global $connect_func, $server_port, $server_socket, $cfgServer; + global $right_font_family, $font_size, $font_bigger; + + if (mysql_error()) { + $conn_error = mysql_error(); + } else if (isset($php_errormsg)) { + $conn_error = $php_errormsg; + } else { + $conn_error = 'Cannot connect: invalid settings.'; + } + $local_query = $connect_func . '(' + . $cfgServer['host'] . $server_port . $server_socket . ', ' + . $cfgServer['user'] . ', ' + . $cfgServer['password'] . ')'; + ?> + + + + +<?php echo $GLOBALS['strAccessDenied']; ?> + + + + +

+
+

+
+
+ ?> + echo "\n"; + PMA_mysqlDie($conn_error, $local_query, FALSE); + + return TRUE; + } // end of the 'PMA_auth()' function + +} // $__PMA_BASIC_AUTH_LIB__ +?> diff --git a/libraries/auth/cookie.auth.lib.php3 b/libraries/auth/cookie.auth.lib.php3 new file mode 100644 index 000000000..2dc40ed94 --- /dev/null +++ b/libraries/auth/cookie.auth.lib.php3 @@ -0,0 +1,354 @@ + and | +// | Dan Wilson who builds this patch for the Debian package. | +// +--------------------------------------------------------------------------+ + + +if (!defined('PMA_COOKIE_AUTH_INCLUDED')) { + define('PMA_COOKIE_AUTH_INCLUDED', 1); + + /** + * Sorts available languages by their true names + * + * @param array the array to be sorted + * @param mixed a required parameter + * + * @return the sorted array + * + * @access private + */ + function PMA_cookie_cmp(&$a, $b) + { + return (strcmp($a[1], $b[1])); + } // end of the 'PMA_cmp()' function + + + /** + * Displays authentication form + * + * @global string the font face to use + * @global string the default font size to use + * @global string the big font size to use + * @global array the list of servers settings + * @global array the list of available translations + * @global string the current language + * @global integer the current server id + * @global array the array of cookie variables if register_globals is + * off + * + * @return boolean always true (no return indeed) + * + * @access public + */ + function PMA_auth() + { + global $right_font_family, $font_size, $font_bigger; + global $cfgServers, $available_languages; + global $lang, $server; + global $HTTP_COOKIE_VARS; + + // Tries to get the username from cookie whatever are the values of the + // 'register_globals' and the 'variables_order' directives + if (!empty($GLOBALS['pma_cookie_username'])) { + $default_user = $GLOBALS['pma_cookie_username']; + } + else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username'])) { + $default_user = $_COOKIE['pma_cookie_username']; + } + else if (!empty($HTTP_COOKIE_VARS) && isset($HTTP_COOKIE_VARS['pma_cookie_username'])) { + $default_user = $HTTP_COOKIE_VARS['pma_cookie_username']; + } + + $cell_align = ($GLOBALS['text_dir'] == 'ltr') ? 'left' : 'right'; + // Title + ?> + + + + +<?php echo 'phpMyAdmin ' . PMA_VERSION . ' - ' . $GLOBALS['strLogin']; ?> + + + + +
+

+
+ + + +
+ + Language: + + +
+
+ +

+
+ + + +
+ + + + + + + + + + + + + + + + +
  + +
  + +
 :  + +
+ + +
+
+
+ + + + delete password cookie + if (!empty($old_usr)) { + setcookie('pma_cookie_password', ''); + } + + // The user just logged in + else if (!empty($pma_username)) { + $PHP_AUTH_USER = $pma_username; + $PHP_AUTH_PW = (empty($pma_password)) ? '' : $pma_password; + } + + // At the end, try to set the $PHP_AUTH_USER & $PHP_AUTH_PW variables + // from cookies whatever are the values of the 'register_globals' and + // the 'variables_order' directives + else { + if (!empty($pma_cookie_username)) { + $PHP_AUTH_USER = $pma_cookie_username; + } + else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username'])) { + $PHP_AUTH_USER = $_COOKIE['pma_cookie_username']; + } + else if (!empty($HTTP_COOKIE_VARS) && isset($HTTP_COOKIE_VARS['pma_cookie_username'])) { + $PHP_AUTH_USER = $HTTP_COOKIE_VARS['pma_cookie_username']; + } + if (!empty($pma_cookie_password)) { + $PHP_AUTH_PW = $pma_cookie_password; + $from_cookie = TRUE; + } + else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_password'])) { + $PHP_AUTH_PW = $_COOKIE['pma_cookie_password']; + $from_cookie = TRUE; + } + else if (!empty($HTTP_COOKIE_VARS) && isset($HTTP_COOKIE_VARS['pma_cookie_password'])) { + $PHP_AUTH_PW = $HTTP_COOKIE_VARS['pma_cookie_password']; + $from_cookie = TRUE; + } + } + + // Returns whether we get authentication settings or not + if (empty($PHP_AUTH_USER)) { + return FALSE; + } else { + if (get_magic_quotes_gpc()) { + $PHP_AUTH_USER = stripslashes($PHP_AUTH_USER); + $PHP_AUTH_PW = stripslashes($PHP_AUTH_PW); + } + return TRUE; + } + } // end of the 'PMA_auth_check()' function + + + /** + * Set the user and password after last checkings if required + * + * @global array the valid servers settings + * @global integer the id of the current server + * @global array the current server settings + * @global string the current username + * @global string the current password + * @global boolean whether the login/password pair has been grabbed from + * a cookie or not + * + * @return boolean always true + * + * @access public + */ + function PMA_auth_set_user() + { + global $cfgServers, $server, $cfgServer; + global $PHP_AUTH_USER, $PHP_AUTH_PW; + global $from_cookie; + + // Ensures the valid 'only_db' setting is used + if ($cfgServer['user'] != $PHP_AUTH_USER) { + $servers_cnt = count($cfgServers); + for ($i = 1; $i <= $servers_cnt; $i++) { + if (isset($cfgServers[$i]) + && ($cfgServers[$i]['host'] == $cfgServer['host'] && $cfgServers[$i]['user'] == $PHP_AUTH_USER)) { + $server = $i; + $cfgServer = $cfgServers[$i]; + break; + } + } // end for + } // end if + + $cfgServer['user'] = $PHP_AUTH_USER; + $cfgServer['password'] = $PHP_AUTH_PW; + + // Set cookies if required (once per session) + if (!$from_cookie) { + // Duration = one month for username + setcookie('pma_cookie_username', $cfgServer['user'], time() + (60 * 60 * 24 * 30)); + // Duration = till the browser is closed for password + setcookie('pma_cookie_password', $cfgServer['password']); + } + + return TRUE; + } // end of the 'PMA_auth_set_user()' function + + + /** + * User is not allowed to login to MySQL -> authentication failed + * + * @return boolean always true (no return indeed) + * + * @access public + */ + function PMA_auth_fails() + { + // Deletes password cookie and displays the login form + setcookie('pma_cookie_password', ''); + PMA_auth(); + + return TRUE; + } // end of the 'PMA_auth()' function + +} // $__PMA_COOKIE_AUTH_LIB__ +?> diff --git a/libraries/auth/http.auth.lib.php3 b/libraries/auth/http.auth.lib.php3 new file mode 100644 index 000000000..99703d8ba --- /dev/null +++ b/libraries/auth/http.auth.lib.php3 @@ -0,0 +1,236 @@ + + + + + +<?php echo $GLOBALS['strAccessDenied']; ?> + + + + +

+
+

+
+
+

+ + + + ensure the new username is not the same + if (!empty($old_usr) + && (isset($PHP_AUTH_USER) && $old_usr == $PHP_AUTH_USER)) { + $PHP_AUTH_USER = ''; + } + + // Returns whether we get authentication settings or not + if (empty($PHP_AUTH_USER)) { + return FALSE; + } else { + if (get_magic_quotes_gpc()) { + $PHP_AUTH_USER = stripslashes($PHP_AUTH_USER); + $PHP_AUTH_PW = stripslashes($PHP_AUTH_PW); + } + return TRUE; + } + } // end of the 'PMA_auth_check()' function + + + /** + * Set the user and password after last checkings if required + * + * @global array the valid servers settings + * @global integer the id of the current server + * @global array the current server settings + * @global string the current username + * @global string the current password + * + * @return boolean always true + * + * @access public + */ + function PMA_auth_set_user() + { + global $cfgServers, $server, $cfgServer; + global $PHP_AUTH_USER, $PHP_AUTH_PW; + + // Ensures the valid 'only_db' setting is used + if ($cfgServer['user'] != $PHP_AUTH_USER) { + $servers_cnt = count($cfgServers); + for ($i = 1; $i <= $servers_cnt; $i++) { + if (isset($cfgServers[$i]) + && ($cfgServers[$i]['host'] == $cfgServer['host'] && $cfgServers[$i]['user'] == $PHP_AUTH_USER)) { + $server = $i; + $cfgServer = $cfgServers[$i]; + break; + } + } // end for + } // end if + + $cfgServer['user'] = $PHP_AUTH_USER; + $cfgServer['password'] = $PHP_AUTH_PW; + + return TRUE; + } // end of the 'PMA_auth_set_user()' function + + + /** + * User is not allowed to login to MySQL -> authentication failed + * + * @return boolean always true (no return indeed) + * + * @access public + */ + function PMA_auth_fails() + { + PMA_auth(); + + return TRUE; + } // end of the 'PMA_auth()' function + +} // $__PMA_HTTP_AUTH_LIB__ +?> diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index 4d338b75e..4b4f3485d 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -25,15 +25,14 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){ * * the PMA_sqlAddslashes() function must be before the connection to db * - * the PMA_auth() function must be before the connection to db but after - * the PMA_isInto() function + * the authentication libraries must be before the connection to db but + * after the PMA_isInto() function * * the PMA_mysqlDie() function must be before the connection to db but after * mysql extension has been loaded * * ... so the required order is: * - * - definition of PMA_auth() * - parsing of the configuration file * - first load of the libraries/define.lib.php3 library (won't get the * MySQL release number) @@ -41,8 +40,9 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){ * - definition of PMA_sqlAddslashes() * - definition of PMA_mysqlDie() * - definition of PMA_isInto() + * - loading of an authentication library * - db connection - * - advanced authentication work if required + * - authentication work * - second load of the libraries/define.lib.php3 library to get the MySQL * release number) * - other functions, respecting dependencies @@ -60,43 +60,6 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){ } - /** - * Advanced authentication work - * - * Requires Apache loaded as a php module. - * - * @access public - */ - function PMA_auth() - { -// header('WWW-Authenticate: Basic realm="phpMyAdmin ' . trim($GLOBALS['strRunning']) . ' ' . $GLOBALS['cfgServer']['host'] . '"'); - header('WWW-Authenticate: Basic realm="phpMyAdmin ' . sprintf($GLOBALS['strRunning'], (empty($GLOBALS['cfgServer']['verbose']) ? str_replace('\'', '\\\'',$GLOBALS['cfgServer']['host']) : str_replace('\'', '\\\'', $GLOBALS['cfgServer']['verbose']))) . '"'); - header('HTTP/1.0 401 Unauthorized'); - header('status: 401 Unauthorized'); - ?> - - - - -<?php echo $GLOBALS['strAccessDenied']; ?> - - - -

-
-

-
- - - - checks if authentication is required - if (!isset($old_usr)) { - if (empty($PHP_AUTH_USER)) { - $do_auth = TRUE; - } else { - $do_auth = FALSE; - } - } - // Else ensure the username is not the same - else { - // force user to enter a different username - if (isset($PHP_AUTH_USER) && $old_usr == $PHP_AUTH_USER) { - $do_auth = TRUE; - } else { - $do_auth = FALSE; - } - } - - // Calls the authentication window or store user's login/password - if ($do_auth) { - PMA_auth(); - } else { - if (get_magic_quotes_gpc()) { - $PHP_AUTH_USER = stripslashes($PHP_AUTH_USER); - $PHP_AUTH_PW = stripslashes($PHP_AUTH_PW); - } - // Ensures the valid 'only_db' setting is used - if ($cfgServer['user'] != $PHP_AUTH_USER) { - $servers_cnt = count($cfgServers); - for ($i = 1; $i <= $servers_cnt; $i++) { - if (isset($cfgServers[$i]) - && ($cfgServers[$i]['host'] == $cfgServer['host'] && $cfgServers[$i]['user'] == $PHP_AUTH_USER)) { - $server = $i; - $cfgServer = $cfgServers[$i]; - break; - } - } // end for - } // end if - $cfgServer['user'] = $PHP_AUTH_USER; - $cfgServer['password'] = $PHP_AUTH_PW; - } // end else - } // end advanced authentication + // Gets the authentication library that fits the cfgServer settings + // and run authentication + include('./libraries/auth/' . $cfgServer['auth_type'] . '.auth.lib.php3'); + if (!PMA_auth_check()) { + PMA_auth(); + } else { + PMA_auth_set_user(); + } // The user can work with only some databases if (isset($cfgServer['only_db']) && $cfgServer['only_db'] != '') { @@ -535,23 +374,7 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){ $cfgServer['password'] ); if ($userlink == FALSE) { - // Advanced authentication case - if ($cfgServer['adv_auth']) { - PMA_auth(); - } - // Standard authentication case - else if (mysql_error()) { - $conn_error = mysql_error(); - } else if (isset($php_errormsg)) { - $conn_error = $php_errormsg; - } else { - $conn_error = 'Cannot connect: invalid settings.'; - } - $local_query = $connect_func . '(' - . $cfgServer['host'] . $server_port . $server_socket . ', ' - . $cfgServer['user'] . ', ' - . $cfgServer['password'] . ')'; - PMA_mysqlDie($conn_error, $local_query, FALSE); + PMA_auth_fails(); } // end if if (PMA_PHP_INT_VERSION >= 40000) { diff --git a/main.php3 b/main.php3 index a1c05f368..e534f0015 100755 --- a/main.php3 +++ b/main.php3 @@ -94,15 +94,13 @@ if ($server == 0 || count($cfgServers) > 1) { -
+