From: Max Semenik Date: Tue, 20 Aug 2013 15:58:12 +0000 (+0400) Subject: New hook, UserRequiresHTTPS X-Git-Tag: 1.31.0-rc.0~18927^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=1f64960d83f4ef220e454491a29b6d5839192ce7;p=lhc%2Fweb%2Fwiklou.git New hook, UserRequiresHTTPS Intended for situations where current user can't technically access the site over a secure connection, e.g. due to a terribly obsolete browser or WP Zero carrier that provides only insecure free access to the site. Change-Id: I343985092c49a21fa347ca4dc0e5ec27774ad11d --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 9d3da1c83c..e776d4cd8b 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2675,6 +2675,12 @@ $user : User object that was changed $add : Array of strings corresponding to groups added $remove: Array of strings corresponding to groups removed +'UserRequiresHTTPS': Called to determine whether a user needs +to be switched to HTTPS. +$user: User in question. +&$https: Boolean whether $user should be switched to HTTPS. + + 'UserRetrieveNewTalks': Called when retrieving "You have new messages!" message(s). $user: user retrieving new talks messages diff --git a/includes/User.php b/includes/User.php index dcfc5115da..29230265ad 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2610,7 +2610,9 @@ class User { if ( !$wgSecureLogin ) { return false; } else { - return $this->getBoolOption( 'prefershttps' ); + $https = $this->getBoolOption( 'prefershttps' ); + wfRunHooks( 'UserRequiresHTTPS', array( $this, &$https ) ); + return $https; } }