mirror of
https://github.com/phpbb/phpbb.git
synced 2025-10-15 17:04:29 +02:00
remove global and change $user-> to phpbb::$user->
git-svn-id: file:///svn/phpbb/trunk@9334 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -28,11 +28,9 @@ if (!defined('IN_PHPBB'))
|
||||
*/
|
||||
function init_apache()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if (!isset($_SERVER['PHP_AUTH_USER']) || $user->data['username'] !== $_SERVER['PHP_AUTH_USER'])
|
||||
if (!isset($_SERVER['PHP_AUTH_USER']) || phpbb::$user->data['username'] !== $_SERVER['PHP_AUTH_USER'])
|
||||
{
|
||||
return $user->lang['APACHE_SETUP_BEFORE_USE'];
|
||||
return phpbb::$user->lang['APACHE_SETUP_BEFORE_USE'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -42,8 +40,6 @@ function init_apache()
|
||||
*/
|
||||
function login_apache(&$username, &$password)
|
||||
{
|
||||
global $db;
|
||||
|
||||
// do not allow empty password
|
||||
if (!$password)
|
||||
{
|
||||
@@ -136,8 +132,6 @@ function login_apache(&$username, &$password)
|
||||
*/
|
||||
function autologin_apache()
|
||||
{
|
||||
global $db;
|
||||
|
||||
if (!isset($_SERVER['PHP_AUTH_USER']))
|
||||
{
|
||||
return array();
|
||||
@@ -192,7 +186,6 @@ function autologin_apache()
|
||||
*/
|
||||
function user_row_apache($username, $password)
|
||||
{
|
||||
global $db, $user;
|
||||
// first retrieve default group id
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
@@ -214,7 +207,7 @@ function user_row_apache($username, $password)
|
||||
'user_email' => '',
|
||||
'group_id' => (int) $row['group_id'],
|
||||
'user_type' => phpbb::USER_NORMAL,
|
||||
'user_ip' => $user->ip,
|
||||
'user_ip' => phpbb::$user->ip,
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -27,11 +27,9 @@ if (!defined('IN_PHPBB'))
|
||||
*/
|
||||
function init_ldap()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if (!@extension_loaded('ldap'))
|
||||
{
|
||||
return $user->lang['LDAP_NO_LDAP_EXTENSION'];
|
||||
return phpbb::$user->lang['LDAP_NO_LDAP_EXTENSION'];
|
||||
}
|
||||
|
||||
phpbb::$config['ldap_port'] = (int) phpbb::$config['ldap_port'];
|
||||
@@ -46,7 +44,7 @@ function init_ldap()
|
||||
|
||||
if (!$ldap)
|
||||
{
|
||||
return $user->lang['LDAP_NO_SERVER_CONNECTION'];
|
||||
return phpbb::$user->lang['LDAP_NO_SERVER_CONNECTION'];
|
||||
}
|
||||
|
||||
@ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
@@ -56,7 +54,7 @@ function init_ldap()
|
||||
{
|
||||
if (!@ldap_bind($ldap, htmlspecialchars_decode(phpbb::$config['ldap_user']), htmlspecialchars_decode(phpbb::$config['ldap_password'])))
|
||||
{
|
||||
return $user->lang['LDAP_INCORRECT_USER_PASSWORD'];
|
||||
return phpbb::$user->lang['LDAP_INCORRECT_USER_PASSWORD'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +62,7 @@ function init_ldap()
|
||||
$search = @ldap_search(
|
||||
$ldap,
|
||||
phpbb::$config['ldap_base_dn'],
|
||||
ldap_user_filter($user->data['username']),
|
||||
ldap_user_filter(phpbb::$user->data['username']),
|
||||
(empty(phpbb::$config['ldap_email'])) ? array(phpbb::$config['ldap_uid']) : array(phpbb::$config['ldap_uid'], phpbb::$config['ldap_email']),
|
||||
0,
|
||||
1
|
||||
@@ -72,7 +70,7 @@ function init_ldap()
|
||||
|
||||
if ($search === false)
|
||||
{
|
||||
return $user->lang['LDAP_NO_SERVER_CONNECTION'];
|
||||
return phpbb::$user->lang['LDAP_NO_SERVER_CONNECTION'];
|
||||
}
|
||||
|
||||
$result = @ldap_get_entries($ldap, $search);
|
||||
@@ -82,12 +80,12 @@ function init_ldap()
|
||||
|
||||
if (!is_array($result) || sizeof($result) < 2)
|
||||
{
|
||||
return sprintf($user->lang['LDAP_NO_IDENTITY'], $user->data['username']);
|
||||
return sprintf(phpbb::$user->lang['LDAP_NO_IDENTITY'], phpbb::$user->data['username']);
|
||||
}
|
||||
|
||||
if (!empty(phpbb::$config['ldap_email']) && !isset($result[0][phpbb::$config['ldap_email']]))
|
||||
{
|
||||
return $user->lang['LDAP_NO_EMAIL'];
|
||||
return phpbb::$user->lang['LDAP_NO_EMAIL'];
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -98,8 +96,6 @@ function init_ldap()
|
||||
*/
|
||||
function login_ldap(&$username, &$password)
|
||||
{
|
||||
global $db, $user;
|
||||
|
||||
// do not allow empty password
|
||||
if (!$password)
|
||||
{
|
||||
@@ -154,7 +150,7 @@ function login_ldap(&$username, &$password)
|
||||
{
|
||||
if (!@ldap_bind($ldap, phpbb::$config['ldap_user'], htmlspecialchars_decode(phpbb::$config['ldap_password'])))
|
||||
{
|
||||
return $user->lang['LDAP_NO_SERVER_CONNECTION'];
|
||||
return phpbb::$user->lang['LDAP_NO_SERVER_CONNECTION'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +222,7 @@ function login_ldap(&$username, &$password)
|
||||
'user_email' => (!empty(phpbb::$config['ldap_email'])) ? $ldap_result[0][phpbb::$config['ldap_email']][0] : '',
|
||||
'group_id' => (int) $row['group_id'],
|
||||
'user_type' => phpbb::USER_NORMAL,
|
||||
'user_ip' => $user->ip,
|
||||
'user_ip' => phpbb::$user->ip,
|
||||
);
|
||||
|
||||
unset($ldap_result);
|
||||
@@ -293,40 +289,38 @@ function ldap_escape($string)
|
||||
*/
|
||||
function acp_ldap(&$new)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$tpl = '
|
||||
|
||||
<dl>
|
||||
<dt><label for="ldap_server">' . $user->lang['LDAP_SERVER'] . ':</label><br /><span>' . $user->lang['LDAP_SERVER_EXPLAIN'] . '</span></dt>
|
||||
<dt><label for="ldap_server">' . phpbb::$user->lang['LDAP_SERVER'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_SERVER_EXPLAIN'] . '</span></dt>
|
||||
<dd><input type="text" id="ldap_server" size="40" name="config[ldap_server]" value="' . $new['ldap_server'] . '" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="ldap_port">' . $user->lang['LDAP_PORT'] . ':</label><br /><span>' . $user->lang['LDAP_PORT_EXPLAIN'] . '</span></dt>
|
||||
<dt><label for="ldap_port">' . phpbb::$user->lang['LDAP_PORT'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_PORT_EXPLAIN'] . '</span></dt>
|
||||
<dd><input type="text" id="ldap_port" size="40" name="config[ldap_port]" value="' . $new['ldap_port'] . '" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="ldap_dn">' . $user->lang['LDAP_DN'] . ':</label><br /><span>' . $user->lang['LDAP_DN_EXPLAIN'] . '</span></dt>
|
||||
<dt><label for="ldap_dn">' . phpbb::$user->lang['LDAP_DN'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_DN_EXPLAIN'] . '</span></dt>
|
||||
<dd><input type="text" id="ldap_dn" size="40" name="config[ldap_base_dn]" value="' . $new['ldap_base_dn'] . '" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="ldap_uid">' . $user->lang['LDAP_UID'] . ':</label><br /><span>' . $user->lang['LDAP_UID_EXPLAIN'] . '</span></dt>
|
||||
<dt><label for="ldap_uid">' . phpbb::$user->lang['LDAP_UID'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_UID_EXPLAIN'] . '</span></dt>
|
||||
<dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="' . $new['ldap_uid'] . '" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="ldap_user_filter">' . $user->lang['LDAP_USER_FILTER'] . ':</label><br /><span>' . $user->lang['LDAP_USER_FILTER_EXPLAIN'] . '</span></dt>
|
||||
<dt><label for="ldap_user_filter">' . phpbb::$user->lang['LDAP_USER_FILTER'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_USER_FILTER_EXPLAIN'] . '</span></dt>
|
||||
<dd><input type="text" id="ldap_user_filter" size="40" name="config[ldap_user_filter]" value="' . $new['ldap_user_filter'] . '" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="ldap_email">' . $user->lang['LDAP_EMAIL'] . ':</label><br /><span>' . $user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt>
|
||||
<dt><label for="ldap_email">' . phpbb::$user->lang['LDAP_EMAIL'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt>
|
||||
<dd><input type="text" id="ldap_email" size="40" name="config[ldap_email]" value="' . $new['ldap_email'] . '" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="ldap_user">' . $user->lang['LDAP_USER'] . ':</label><br /><span>' . $user->lang['LDAP_USER_EXPLAIN'] . '</span></dt>
|
||||
<dt><label for="ldap_user">' . phpbb::$user->lang['LDAP_USER'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_USER_EXPLAIN'] . '</span></dt>
|
||||
<dd><input type="text" id="ldap_user" size="40" name="config[ldap_user]" value="' . $new['ldap_user'] . '" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="ldap_password">' . $user->lang['LDAP_PASSWORD'] . ':</label><br /><span>' . $user->lang['LDAP_PASSWORD_EXPLAIN'] . '</span></dt>
|
||||
<dt><label for="ldap_password">' . phpbb::$user->lang['LDAP_PASSWORD'] . ':</label><br /><span>' . phpbb::$user->lang['LDAP_PASSWORD_EXPLAIN'] . '</span></dt>
|
||||
<dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="' . $new['ldap_password'] . '" /></dd>
|
||||
</dl>
|
||||
';
|
||||
|
Reference in New Issue
Block a user