diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index 1e90aebe7e..a4e6365183 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -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)

' . $user->lang['LDAP_SERVER_EXPLAIN'] . '
+
+

' . $user->lang['LDAP_PORT_EXPLAIN'] . '
+
+

' . $user->lang['LDAP_DN_EXPLAIN'] . '
@@ -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') ); } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 393d1d3082..4c15a4700f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -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; diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index abb15d08ee..279837a698 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -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', ''); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 8c1f502b09..a1f311ff75 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -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. WARNING: 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 uid', diff --git a/phpBB/search.php b/phpBB/search.php index 9acad880d2..dfeb76e946 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -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']); diff --git a/phpBB/styles/prosilver/template/search_body.html b/phpBB/styles/prosilver/template/search_body.html index 95390c2545..f785fcf50a 100644 --- a/phpBB/styles/prosilver/template/search_body.html +++ b/phpBB/styles/prosilver/template/search_body.html @@ -91,6 +91,7 @@ +
@@ -116,5 +117,6 @@
+ \ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/search_body.html b/phpBB/styles/subsilver2/template/search_body.html index a914e5f38d..82cb691c10 100644 --- a/phpBB/styles/subsilver2/template/search_body.html +++ b/phpBB/styles/subsilver2/template/search_body.html @@ -50,6 +50,7 @@
+ @@ -68,6 +69,7 @@
{L_RECENT_SEARCHES}

+