Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: config.auth.lib.php,v 2.18.8.1 2006/08/11 16:41:26 lem9 Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4  
5 // +--------------------------------------------------------------------------+
6 // | Set of functions used to run config authentication (ie no |
7 // | authentication). |
8 // +--------------------------------------------------------------------------+
9  
10  
11 /**
12 * Displays authentication form
13 *
14 * @return boolean always true
15 *
16 * @access public
17 */
18 function PMA_auth()
19 {
20 return TRUE;
21 } // end of the 'PMA_auth()' function
22  
23  
24 /**
25 * Gets advanced authentication settings
26 *
27 * @return boolean always true
28 *
29 * @access public
30 */
31 function PMA_auth_check()
32 {
33 return TRUE;
34 } // end of the 'PMA_auth_check()' function
35  
36  
37 /**
38 * Set the user and password after last checkings if required
39 *
40 * @return boolean always true
41 *
42 * @access public
43 */
44 function PMA_auth_set_user()
45 {
46 return TRUE;
47 } // end of the 'PMA_auth_set_user()' function
48  
49  
50 /**
51 * User is not allowed to login to MySQL -> authentication failed
52 *
53 * @global string the MySQL error message PHP returns
54 * @global string the connection type (persistent or not)
55 * @global string the MySQL server port to use
56 * @global string the MySQL socket port to use
57 * @global array the current server settings
58 * @global string the font face to use in case of failure
59 * @global string the default font size to use in case of failure
60 * @global string the big font size to use in case of failure
61 * @global boolean tell the "PMA_mysqlDie()" function headers have been
62 * sent
63 *
64 * @return boolean always true (no return indeed)
65 *
66 * @access public
67 */
68 function PMA_auth_fails()
69 {
70 global $php_errormsg, $cfg;
71  
72 $conn_error = PMA_DBI_getError();
73 if (!$conn_error) {
74 if (isset($php_errormsg)) {
75 $conn_error = $php_errormsg;
76 } else {
77 $conn_error = $GLOBALS['strConnectionError'];
78 }
79 }
80  
81 // Defines the charset to be used
82 header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
83 /* HTML header */
84 $page_title = $GLOBALS['strAccessDenied'];
85 require('./libraries/header_meta_style.inc.php');
86 ?>
87 </head>
88  
89 <body>
90 <br /><br />
91 <center>
92 <h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>
93 </center>
94 <br />
95 <table border="0" cellpadding="0" cellspacing="3" align="center" width="80%">
96 <tr>
97 <td>
98 <?php
99 echo "\n";
100 $GLOBALS['is_header_sent'] = TRUE;
101  
102 //TODO: I have included this div from libraries/header.inc.php to work around
103 // an undefined variable in tooltip.js, when the server
104 // is not responding. Work has to be done to merge all code that
105 // starts the page (DOCTYPE and this div) to one place
106 ?>
107 <div id="TooltipContainer" onmouseover="holdTooltip();" onmouseout="swapTooltip('default');"></div>
108 <?php
109  
110 if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
111 echo '<p>' . $GLOBALS['strAccessDenied'] . '</p>' . "\n";
112 } else {
113 // Check whether user has configured something
114 if ($_SESSION['PMA_Config']->source_mtime == 0) {
115 echo '<p>' . sprintf($GLOBALS['strAccessDeniedCreateConfig'], '<a href="scripts/setup.php">', '</a>') . '</p>' . "\n";
116 } elseif (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) {
117 // if we display the "Server not responding" error, do not confuse users
118 // by telling them they have a settings problem
119 // (note: it's true that they could have a badly typed host name, but
120 // anyway the current $strAccessDeniedExplanation tells that the server
121 // rejected the connection, which is not really what happened)
122 // 2002 is the error given by mysqli
123 // 2003 is the error given by mysql
124 echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
125 }
126 PMA_mysqlDie($conn_error, '');
127 }
128 ?>
129 </td>
130 </tr>
131 </table>
132 <?php
133 require_once('./libraries/footer.inc.php');
134 return TRUE;
135 } // end of the 'PMA_auth_fails()' function
136  
137 ?>