Unneeded wrapping of a jQuery object
[phpmyadmin/ammar_yasir.git] / libraries / auth / config.auth.lib.php
blob3a9f82b8f66b45d5acfa08e560e1c6f0b4a9a9a3
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Set of functions used to run config authentication (ie no authentication).
6 * @package phpMyAdmin-Auth-Config
7 */
10 /**
11 * Displays authentication form
13 * @return boolean always true
15 * @access public
17 function PMA_auth()
19 return TRUE;
20 } // end of the 'PMA_auth()' function
23 /**
24 * Gets advanced authentication settings
26 * @return boolean always true
28 * @access public
30 function PMA_auth_check()
32 return TRUE;
33 } // end of the 'PMA_auth_check()' function
36 /**
37 * Set the user and password after last checkings if required
39 * @return boolean always true
41 * @access public
43 function PMA_auth_set_user()
45 return TRUE;
46 } // end of the 'PMA_auth_set_user()' function
49 /**
50 * User is not allowed to login to MySQL -> authentication failed
52 * @global string the MySQL error message PHP returns
53 * @global string the connection type (persistent or not)
54 * @global string the MySQL server port to use
55 * @global string the MySQL socket port to use
56 * @global array the current server settings
57 * @global string the font face to use in case of failure
58 * @global string the default font size to use in case of failure
59 * @global string the big font size to use in case of failure
60 * @global boolean tell the "PMA_mysqlDie()" function headers have been
61 * sent
63 * @return boolean always true (no return indeed)
65 * @access public
67 function PMA_auth_fails()
69 global $php_errormsg, $cfg;
71 $conn_error = PMA_DBI_getError();
72 if (!$conn_error) {
73 if (isset($php_errormsg)) {
74 $conn_error = $php_errormsg;
75 } else {
76 $conn_error = __('Cannot connect: invalid settings.');
80 // Defines the charset to be used
81 header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
82 /* HTML header */
83 $page_title = __('Access denied');
84 require './libraries/header_meta_style.inc.php';
86 </head>
88 <body>
89 <br /><br />
90 <center>
91 <h1><?php echo sprintf(__('Welcome to %s'), ' phpMyAdmin '); ?></h1>
92 </center>
93 <br />
94 <table border="0" cellpadding="0" cellspacing="3" align="center" width="80%">
95 <tr>
96 <td>
98 <?php
99 $GLOBALS['is_header_sent'] = TRUE;
101 if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
102 trigger_error(__('Access denied'), E_USER_NOTICE);
103 } else {
104 // Check whether user has configured something
105 if ($GLOBALS['PMA_Config']->source_mtime == 0) {
106 echo '<p>' . sprintf(__('You probably did not create a configuration file. You might want to use the %1$ssetup script%2$s to create one.'), '<a href="setup/">', '</a>') . '</p>' . "\n";
107 } elseif (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) {
108 // if we display the "Server not responding" error, do not confuse users
109 // by telling them they have a settings problem
110 // (note: it's true that they could have a badly typed host name, but
111 // anyway the current message tells that the server
112 // rejected the connection, which is not really what happened)
113 // 2002 is the error given by mysqli
114 // 2003 is the error given by mysql
115 trigger_error(__('phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.'), E_USER_WARNING);
117 PMA_mysqlDie($conn_error, '', true, '', false);
119 $GLOBALS['error_handler']->dispUserErrors();
121 </td>
122 </tr>
123 <?php
124 if (count($GLOBALS['cfg']['Servers']) > 1) {
125 // offer a chance to login to other servers if the current one failed
126 require_once './libraries/select_server.lib.php';
127 echo '<tr>' . "\n";
128 echo ' <td>' . "\n";
129 PMA_select_server(TRUE, TRUE);
130 echo ' </td>' . "\n";
131 echo '</tr>' . "\n";
133 echo '</table>' . "\n";
134 require './libraries/footer.inc.php';
135 return TRUE;
136 } // end of the 'PMA_auth_fails()' function