--- ../../drupal-orig/modules/user.module 2004-11-15 12:16:39.000000000 +0100 +++ user.module 2004-11-21 00:12:40.000000000 +0100 @@ -525,7 +525,9 @@ function user_block($op = 'list', $delta $output .= form_submit(t('Log in')); $output .= "\n"; - $output = form($output, 'post', url('user/login')); + $action = variable_get('user_https_login', 0) ? url('user/login', NULL, NULL, TRUE, TRUE) : url('user/login'); + + $output = form($output, 'post', $action); if (variable_get('user_register', 1)) { $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.'))); @@ -783,7 +785,7 @@ function user_auth_help_links() { /*** User features *********************************************************/ function user_login($edit = array(), $msg = '') { - global $user, $base_url; + global $user; // If we are already logged on, go to the user page instead. if ($user->uid) { @@ -843,7 +845,8 @@ function user_login($edit = array(), $ms $output .= form_password(t('Password'), 'pass', $pass, 30, 64, t('Enter the password that accompanies your username.')); $output .= form_submit(t('Log in')); - return form($output, 'post', url('user/login')); + $action = variable_get('user_https_login', 0) ? url('user/login', NULL, NULL, TRUE, TRUE) : url('user/login'); + return form($output, 'post', $action); } function user_authenticate($name, $pass) { @@ -1293,6 +1296,9 @@ function user_configure_settings() { $output .= form_group(t('Pictures'), $group); + global $base_url; + $output .= form_group(t('Login settings'),form_checkbox(t('Use HTTPS for login'), 'user_https_login', 1, variable_get('user_https_login', 0), t('Whether to use %url for login', array('%url' => preg_replace('/http:/i','https:',$base_url))))); + return $output; } --- ../../drupal-orig/includes/common.inc 2004-11-19 20:18:52.000000000 +0100 +++ common.inc 2004-11-20 23:31:08.000000000 +0100 @@ -1446,13 +1446,15 @@ function form_weight($title = NULL, $nam * @param $absolute * Whether to force the output to be an absolute link (beginning with http:). * Useful for links that will be displayed outside the site, such as in an RSS feed. + * @param $https + * Whether to change the URL into HTTPS * @return * an HTML string containing a link to the given path. * * When creating links in modules, consider whether l() could be a better * alternative than url(). */ -function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) { +function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE, $https = FALSE) { global $base_url; static $script; @@ -1470,7 +1472,15 @@ function url($path = NULL, $query = NULL $fragment = '#'. $fragment; } - $base = ($absolute ? $base_url . '/' : ''); + if ($absolute) { + $base = $base_url . '/'; + if ($https) { + $base = preg_replace('/http:/i', 'https:', $base); + } + } + else { + $base = ''; + } if (variable_get('clean_url', '0') == '0') { if (isset($path)) {