mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 23:25:30 +02:00
- 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:
parent
382fe7cab4
commit
35b45cdff1
@ -26,7 +26,17 @@ function init_ldap()
|
||||
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'];
|
||||
}
|
||||
@ -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(
|
||||
'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>
|
||||
<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>
|
||||
<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>
|
||||
<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
|
||||
return array(
|
||||
'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')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1496,6 +1496,7 @@ if (version_compare($current_version, '3.0.RC4', '<='))
|
||||
|
||||
// Setting this here again because new installations may not have it...
|
||||
set_config('cron_lock', '0', true);
|
||||
set_config('ldap_port', '');
|
||||
set_config('ldap_user_filter', '');
|
||||
|
||||
$no_updates = false;
|
||||
|
@ -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_email', '');
|
||||
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_uid', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user', '');
|
||||
|
@ -305,6 +305,8 @@ $lang = array_merge($lang, array(
|
||||
'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.',
|
||||
'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_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_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>',
|
||||
|
@ -1042,45 +1042,49 @@ $template->assign_vars(array(
|
||||
'S_IN_SEARCH' => true,
|
||||
));
|
||||
|
||||
// Handle large objects differently for Oracle and MSSQL
|
||||
switch ($db->sql_layer)
|
||||
// only show recent searches to search administrators
|
||||
if ($auth->acl_get('a_search'))
|
||||
{
|
||||
case 'oracle':
|
||||
$sql = 'SELECT search_time, search_keywords
|
||||
FROM ' . SEARCH_RESULTS_TABLE . '
|
||||
WHERE dbms_lob.getlength(search_keywords) > 0
|
||||
ORDER BY search_time DESC';
|
||||
break;
|
||||
// Handle large objects differently for Oracle and MSSQL
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'oracle':
|
||||
$sql = 'SELECT search_time, search_keywords
|
||||
FROM ' . SEARCH_RESULTS_TABLE . '
|
||||
WHERE dbms_lob.getlength(search_keywords) > 0
|
||||
ORDER BY search_time DESC';
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
$sql = 'SELECT search_time, search_keywords
|
||||
FROM ' . SEARCH_RESULTS_TABLE . '
|
||||
WHERE DATALENGTH(search_keywords) > 0
|
||||
ORDER BY search_time DESC';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql = 'SELECT search_time, search_keywords
|
||||
FROM ' . SEARCH_RESULTS_TABLE . '
|
||||
WHERE search_keywords <> \'\'
|
||||
ORDER BY search_time DESC';
|
||||
break;
|
||||
}
|
||||
$result = $db->sql_query_limit($sql, 5);
|
||||
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
$sql = 'SELECT search_time, search_keywords
|
||||
FROM ' . SEARCH_RESULTS_TABLE . '
|
||||
WHERE DATALENGTH(search_keywords) > 0
|
||||
ORDER BY search_time DESC';
|
||||
break;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$keywords = $row['search_keywords'];
|
||||
|
||||
default:
|
||||
$sql = 'SELECT search_time, search_keywords
|
||||
FROM ' . SEARCH_RESULTS_TABLE . '
|
||||
WHERE search_keywords <> \'\'
|
||||
ORDER BY search_time DESC';
|
||||
break;
|
||||
$template->assign_block_vars('recentsearch', array(
|
||||
'KEYWORDS' => $keywords,
|
||||
'TIME' => $user->format_date($row['search_time']),
|
||||
|
||||
'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(htmlspecialchars_decode($keywords)))
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
$result = $db->sql_query_limit($sql, 5);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$keywords = $row['search_keywords'];
|
||||
|
||||
$template->assign_block_vars('recentsearch', array(
|
||||
'KEYWORDS' => $keywords,
|
||||
'TIME' => $user->format_date($row['search_time']),
|
||||
|
||||
'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(htmlspecialchars_decode($keywords)))
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Output the basic page
|
||||
page_header($user->lang['SEARCH']);
|
||||
|
@ -91,6 +91,7 @@
|
||||
|
||||
</form>
|
||||
|
||||
<!-- IF .recentsearch -->
|
||||
<div class="forumbg">
|
||||
<div class="inner"><span class="corners-top"><span></span></span>
|
||||
|
||||
@ -116,5 +117,6 @@
|
||||
|
||||
<span class="corners-bottom"><span></span></span></div>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
@ -50,6 +50,7 @@
|
||||
|
||||
<br clear="all" />
|
||||
|
||||
<!-- IF .recentsearch -->
|
||||
<table class="tablebg" width="100%" cellspacing="1">
|
||||
<tr>
|
||||
<th colspan="2">{L_RECENT_SEARCHES}</th>
|
||||
@ -68,6 +69,7 @@
|
||||
</table>
|
||||
|
||||
<br clear="all" />
|
||||
<!-- ENDIF -->
|
||||
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user