- added an option to specify a port for the LDAP server

- restricted access to "Recent searches" to admins who are allowed to configure search [Bug #14085]


git-svn-id: file:///svn/phpbb/trunk@8064 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann 2007-08-23 13:41:34 +00:00
parent 382fe7cab4
commit 35b45cdff1
7 changed files with 74 additions and 38 deletions

View file

@ -26,7 +26,17 @@ function init_ldap()
return $user->lang['LDAP_NO_LDAP_EXTENSION']; return $user->lang['LDAP_NO_LDAP_EXTENSION'];
} }
if (!($ldap = @ldap_connect($config['ldap_server']))) $config['ldap_port'] = (int) $config['ldap_port'];
if ($config['ldap_port'])
{
$ldap = @ldap_connect($config['ldap_server'], $config['ldap_port']);
}
else
{
$ldap = @ldap_connect($config['ldap_server']);
}
if (!$ldap)
{ {
return $user->lang['LDAP_NO_SERVER_CONNECTION']; return $user->lang['LDAP_NO_SERVER_CONNECTION'];
} }
@ -91,7 +101,17 @@ function login_ldap(&$username, &$password)
); );
} }
if (!($ldap = @ldap_connect($config['ldap_server']))) $config['ldap_port'] = (int) $config['ldap_port'];
if ($config['ldap_port'])
{
$ldap = @ldap_connect($config['ldap_server'], $config['ldap_port']);
}
else
{
$ldap = @ldap_connect($config['ldap_server']);
}
if (!$ldap)
{ {
return array( return array(
'status' => LOGIN_ERROR_EXTERNAL_AUTH, 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
@ -256,6 +276,10 @@ function acp_ldap(&$new)
<dt><label for="ldap_server">' . $user->lang['LDAP_SERVER'] . ':</label><br /><span>' . $user->lang['LDAP_SERVER_EXPLAIN'] . '</span></dt> <dt><label for="ldap_server">' . $user->lang['LDAP_SERVER'] . ':</label><br /><span>' . $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> <dd><input type="text" id="ldap_server" size="40" name="config[ldap_server]" value="' . $new['ldap_server'] . '" /></dd>
</dl> </dl>
<dl>
<dt><label for="ldap_port">' . $user->lang['LDAP_PORT'] . ':</label><br /><span>' . $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> <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">' . $user->lang['LDAP_DN'] . ':</label><br /><span>' . $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> <dd><input type="text" id="ldap_dn" size="40" name="config[ldap_base_dn]" value="' . $new['ldap_base_dn'] . '" /></dd>
@ -285,7 +309,7 @@ function acp_ldap(&$new)
// These are fields required in the config table // These are fields required in the config table
return array( return array(
'tpl' => $tpl, 'tpl' => $tpl,
'config' => array('ldap_server', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password') 'config' => array('ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password')
); );
} }

View file

@ -1496,6 +1496,7 @@ if (version_compare($current_version, '3.0.RC4', '<='))
// Setting this here again because new installations may not have it... // Setting this here again because new installations may not have it...
set_config('cron_lock', '0', true); set_config('cron_lock', '0', true);
set_config('ldap_port', '');
set_config('ldap_user_filter', ''); set_config('ldap_user_filter', '');
$no_updates = false; $no_updates = false;

View file

@ -120,6 +120,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_username', '')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_base_dn', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_base_dn', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_email', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_email', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_password', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_password', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_port', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user', '');

View file

@ -305,6 +305,8 @@ $lang = array_merge($lang, array(
'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.', 'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.',
'LDAP_PASSWORD' => 'LDAP password', 'LDAP_PASSWORD' => 'LDAP password',
'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers. <strong>WARNING:</strong> This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers. <strong>WARNING:</strong> This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.',
'LDAP_PORT' => 'LDAP server port',
'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.',
'LDAP_SERVER' => 'LDAP server name', 'LDAP_SERVER' => 'LDAP server name',
'LDAP_SERVER_EXPLAIN' => 'If using LDAP this is the hostname or IP address of the LDAP server. Alternatively you can specify an URL like ldap://hostname:port/', 'LDAP_SERVER_EXPLAIN' => 'If using LDAP this is the hostname or IP address of the LDAP server. Alternatively you can specify an URL like ldap://hostname:port/',
'LDAP_UID' => 'LDAP <var>uid</var>', 'LDAP_UID' => 'LDAP <var>uid</var>',

View file

@ -1042,6 +1042,9 @@ $template->assign_vars(array(
'S_IN_SEARCH' => true, 'S_IN_SEARCH' => true,
)); ));
// only show recent searches to search administrators
if ($auth->acl_get('a_search'))
{
// Handle large objects differently for Oracle and MSSQL // Handle large objects differently for Oracle and MSSQL
switch ($db->sql_layer) switch ($db->sql_layer)
{ {
@ -1081,6 +1084,7 @@ while ($row = $db->sql_fetchrow($result))
)); ));
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
}
// Output the basic page // Output the basic page
page_header($user->lang['SEARCH']); page_header($user->lang['SEARCH']);

View file

@ -91,6 +91,7 @@
</form> </form>
<!-- IF .recentsearch -->
<div class="forumbg"> <div class="forumbg">
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
@ -116,5 +117,6 @@
<span class="corners-bottom"><span></span></span></div> <span class="corners-bottom"><span></span></span></div>
</div> </div>
<!-- ENDIF -->
<!-- INCLUDE overall_footer.html --> <!-- INCLUDE overall_footer.html -->

View file

@ -50,6 +50,7 @@
<br clear="all" /> <br clear="all" />
<!-- IF .recentsearch -->
<table class="tablebg" width="100%" cellspacing="1"> <table class="tablebg" width="100%" cellspacing="1">
<tr> <tr>
<th colspan="2">{L_RECENT_SEARCHES}</th> <th colspan="2">{L_RECENT_SEARCHES}</th>
@ -68,6 +69,7 @@
</table> </table>
<br clear="all" /> <br clear="all" />
<!-- ENDIF -->
</div> </div>