- Apache auth plugin is working again

- LDAP auth plugin now supports OpenLDAP
- fixed Authentication settings in ACP
- preparatory ACP changes for the search


git-svn-id: file:///svn/phpbb/trunk@5340 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann 2005-12-16 19:05:51 +00:00
parent 67dfce31a9
commit 7342652804
5 changed files with 114 additions and 51 deletions

View file

@ -139,9 +139,6 @@ class acp_board
'limit_load' => array('lang' => 'LIMIT_LOAD', 'type' => 'text:4:4', 'explain' => true),
'session_length' => array('lang' => 'SESSION_LENGTH', 'type' => 'text:5:5', 'explain' => true),
'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'type' => 'text:4:4', 'explain' => true),
'search_interval' => array('lang' => 'SEARCH_INTERVAL', 'type' => 'text:3:4', 'explain' => true),
'min_search_chars' => array('lang' => 'MIN_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true),
'max_search_chars' => array('lang' => 'MAX_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true),
'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'type' => 'text:4:3', 'explain' => true),
'legend2' => 'GENERAL_OPTIONS',
@ -152,10 +149,15 @@ class acp_board
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false),
'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false),
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false),
'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true),
'legend3' => 'SEARCH_SETTINGS',
'load_search' => array('lang' => 'YES_SEARCH', 'type' => 'radio:yes_no', 'explain' => true),
'search_interval' => array('lang' => 'SEARCH_INTERVAL', 'type' => 'text:3:4', 'explain' => true),
'search_type' => array('lang' => 'SEARCH_TYPE', 'type' => 'select', 'method' => 'select_search_type', 'explain' => true),
'load_search_upd' => array('lang' => 'YES_SEARCH_UPDATE', 'type' => 'radio:yes_no', 'explain' => true),
// 'load_search_phr' => array('lang' => 'YES_SEARCH_PHRASE', 'type' => 'radio:yes_no', 'explain' => true),
'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true)
'min_search_chars' => array('lang' => 'MIN_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true),
'max_search_chars' => array('lang' => 'MAX_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true)
)
);
break;
@ -284,6 +286,61 @@ class acp_board
}
}
if ($mode == 'auth')
{
// Retrieve a list of auth plugins and check their config values
$auth_plugins = array();
$dp = opendir($phpbb_root_path . 'includes/auth');
while ($file = readdir($dp))
{
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
{
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
}
}
sort($auth_plugins);
foreach ($auth_plugins as $method)
{
if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
{
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
$method = 'admin_' . $method;
if (function_exists($method))
{
if ($fields = $method($this->new_config))
{
// Check if we need to create config fields for this plugin and save config when submit was pressed
foreach ($fields['config'] as $field)
{
if (!isset($config[$field]))
{
set_config($field, '');
}
if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false)
{
continue;
}
$config_value = $cfg_array[$field];
$this->new_config[$field] = $config_value;
if ($submit)
{
set_config($field, $config_value);
}
}
}
unset($fields);
}
}
}
}
if ($submit)
{
add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
@ -336,40 +393,15 @@ class acp_board
if ($mode == 'auth')
{
$template->assign_var('S_AUTH', true);
$auth_plugins = array();
$dp = opendir($phpbb_root_path . 'includes/auth');
while ($file = readdir($dp))
{
if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
{
$auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
}
}
sort($auth_plugins);
foreach ($auth_plugins as $method)
{
if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
{
include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
$method = 'admin_' . $method;
if (function_exists($method))
{
if ($fields = $method($this->new_config))
{
// Check if we need to create config fields for this plugin
foreach ($fields['config'] as $field)
{
if (!isset($config[$field]))
{
set_config($field, '');
}
}
}
$fields = $method($this->new_config);
if ($fields['tpl'])
{
@ -520,6 +552,33 @@ class acp_board
return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />';
}
function select_search_type($selected_type, $key = '')
{
global $phpbb_root_path, $phpEx;
$search_plugins = array();
$dp = opendir($phpbb_root_path . 'includes/search');
while ($file = readdir($dp))
{
if (preg_match('#\.' . $phpEx . '$#', $file))
{
$search_plugins[] = preg_replace('#^(.*?)\.' . $phpEx . '$#', '\1', $file);
}
}
sort($search_plugins);
$search_select = '';
foreach ($search_plugins as $type)
{
$selected = ($selected_type == $type) ? ' selected="selected"' : '';
$search_select .= '<option value="' . $type . '"' . $selected . '>' . ucfirst(strtolower(str_replace('_', ' ', $type))) . '</option>';
}
return $search_select;
}
}
/**

View file

@ -25,12 +25,12 @@ function login_apache(&$username, &$password)
{
global $db;
$php_auth_user = (!empty($_SERVER['PHP_AUTH_USER'])) ? $_SERVER['PHP_AUTH_USER'] : $_GET['PHP_AUTH_USER'];
$php_auth_pw = (!empty($_SERVER['PHP_AUTH_PW'])) ? $_SERVER['PHP_AUTH_PW'] : $_GET['PHP_AUTH_PW'];
$php_auth_user = $_SERVER['PHP_AUTH_USER'];
$php_auth_pw = $_SERVER['PHP_AUTH_PW'];
if ($php_auth_user && $php_auth_pw)
if ((!empty($php_auth_user)) && (!empty($php_auth_pw)))
{
$sql = ' user_id, username, user_password, user_passchg, user_email, user_type
$sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
FROM ' . USERS_TABLE . "
WHERE username = '" . $db->sql_escape($username) . "'";
$result = $db->sql_query($sql);

View file

@ -36,6 +36,8 @@ function login_ldap(&$username, &$password)
return 'Could not connect to LDAP server';
}
@ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
$search = @ldap_search($ldap, $config['ldap_base_dn'], $config['ldap_uid'] . '=' . $username, array($config['ldap_uid']));
$result = @ldap_get_entries($ldap, $search);
@ -79,15 +81,15 @@ function admin_ldap(&$new)
<dl>
<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="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>
<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="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>
</dl>
<dl>
<dt><label for="ldap_uid">' . $user->lang['LDAP_UID'] . ':</label><br /><span>' . $user->lang['LDAP_UID_EXPLAIN'] . '</span></dt>
<dd><input type="text" id="ldap_uid" size="40" name="ldap_uid" value="' . $new['ldap_uid'] . '" /></dd>
<dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="' . $new['ldap_uid'] . '" /></dd>
</dl>
';

View file

@ -158,6 +158,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('save_passwd', '3')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', 'fulltext_phpbb');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_deny', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_empty_referer', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_downloads', '0');

View file

@ -145,7 +145,8 @@ $lang = array_merge($lang, array(
// Load settings
$lang = array_merge($lang, array(
'ACP_LOAD_SETTINGS_EXPLAIN' => 'Here you can enable and disable certain board functions to reduce the amount of processing required. On most servers there is no need to disable any functions. However on certain systems or in shared hosting environments it may be beneficial to disable capabilities you do not really need. You can also specify limits for system load and active sessions beyond which the board will go offline.',
'SEARCH_SETTINGS' => 'Search Settings',
'ACP_LOAD_SETTINGS_EXPLAIN' => 'Here you can enable and disable certain board functions to reduce the amount of processing required. On most servers there is no need to disable any functions. However on certain systems or in shared hosting environments it may be beneficial to disable capabilities you do not really need. You can also specify limits for system load and active sessions beyond which the board will go offline.',
'LIMIT_LOAD' => 'Limit system load',
'LIMIT_LOAD_EXPLAIN' => 'If the 1 minute system load exceeds this value the board will go offline, 1.0 equals ~100% utilisation of one processor. This only functions on UNIX based servers.',
'LIMIT_SESSIONS' => 'Limit sessions',
@ -167,14 +168,20 @@ $lang = array_merge($lang, array(
'YES_BIRTHDAYS' => 'Enable birthday listing',
'YES_MODERATORS' => 'Enable display of Moderators',
'YES_JUMPBOX' => 'Enable display of Jumpbox',
'YES_SEARCH' => 'Enable search facilities',
'YES_SEARCH_EXPLAIN' => 'User and backend search functions including fulltext updates when posting.',
'YES_SEARCH_UPDATE' => 'Enable fulltext updating',
'YES_SEARCH_UPDATE_EXPLAIN' => 'Updating of fulltext indexes when posting, overriden if search is disabled.',
'YES_SEARCH_PHRASE' => 'Enable phrase searching',
'YES_SEARCH_PHRASE_EXPLAIN' => 'Searching for phrases requires additional processing.',
'RECOMPILE_TEMPLATES' => 'Recompile stale templates',
'RECOMPILE_TEMPLATES_EXPLAIN'=> 'Check for updated template files on filesystem and recompile.',
'YES_SEARCH' => 'Enable search facilities',
'YES_SEARCH_EXPLAIN' => 'User and backend search functions including fulltext updates when posting.',
'SEARCH_INTERVAL' => 'Search Flood Interval',
'SEARCH_INTERVAL_EXPLAIN' => 'Number of seconds users must wait between searches.',
'SEARCH_TYPE' => 'Search Backend',
'SEARCH_TYPE_EXPLAIN' => 'phpBB allows you to choose the backend that is used for searching text in post contents. By default the search will use phpBB\'s own fulltext search.',
'YES_SEARCH_UPDATE' => 'Enable fulltext updating',
'YES_SEARCH_UPDATE_EXPLAIN' => 'Updating of fulltext indexes when posting, overriden if search is disabled.',
'MIN_SEARCH_CHARS' => 'Min characters indexed by search',
'MIN_SEARCH_CHARS_EXPLAIN' => 'Words with at least this many characters will be indexed for searching.',
'MAX_SEARCH_CHARS' => 'Max characters indexed by search',
'MAX_SEARCH_CHARS_EXPLAIN' => 'Words with no more than this many characters will be indexed for searching.'
));
// Email settings
@ -284,12 +291,6 @@ $lang = array_merge($lang, array(
'FLOOD_INTERVAL_EXPLAIN' => 'Number of seconds a user must wait between posting new messages. To enable users to ignore this alter their permissions.',
'BUMP_INTERVAL' => 'Bump Interval',
'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump this topic.',
'SEARCH_INTERVAL' => 'Search Flood Interval',
'SEARCH_INTERVAL_EXPLAIN' => 'Number of seconds users must wait between searches.',
'MIN_SEARCH_CHARS' => 'Min characters indexed by search',
'MIN_SEARCH_CHARS_EXPLAIN' => 'Words with at least this many characters will be indexed for searching.',
'MAX_SEARCH_CHARS' => 'Max characters indexed by search',
'MAX_SEARCH_CHARS_EXPLAIN' => 'Words with no more than this many characters will be indexed for searching.',
'TOPICS_PER_PAGE' => 'Topics Per Page',
'POSTS_PER_PAGE' => 'Posts Per Page',
'HOT_THRESHOLD' => 'Posts for Popular Threshold',