X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fopenid%2Fopenid.inc.php;h=d5f7c5ce3f490400b60805f8423fbe4d56f74c48;hb=c52d86d1d876e6def108e1d458604cc9714c252d;hp=2ab06ffc415fcfd3ae0ab46c1e758e7fe41b5c17;hpb=2d8779e2808c8071eaea64420f553812e992bdce;p=platal.git diff --git a/modules/openid/openid.inc.php b/modules/openid/openid.inc.php index 2ab06ff..d5f7c5c 100644 --- a/modules/openid/openid.inc.php +++ b/modules/openid/openid.inc.php @@ -1,6 +1,6 @@ fetchOneRow()) { - $user = User::getSilent($uid); - } + global $globals; + // Should we check the publicity of the alias? + $user = User::getSilent($x . '@' . $globals->mail->alias_dom); return $user ? $user : null; } @@ -75,6 +68,12 @@ function get_user_openid_url($user) return $globals->baseurl . '/openid/' . $user->hruid; } +function get_idp_xrds_url() +{ + global $globals; + return $globals->baseurl . '/openid/idp_xrds'; +} + function get_user_xrds_url($user) { if (is_null($user)) { @@ -100,6 +99,22 @@ function get_sreg_data($user) 'timezone' => null); } +function is_trusted_site($user, $url) +{ + $res = XDB::query('SELECT COUNT(*) + FROM openid_trusted + WHERE (user_id = {?} OR user_id IS NULL) + AND url = {?}', + $user->id(), $url); + return $res->fetchOneCell() > 0; +} + +function add_trusted_site($user, $url) +{ + XDB::execute("INSERT IGNORE INTO openid_trusted + SET user_id={?}, url={?}", + $user->id(), $url); +} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: -?> \ No newline at end of file +?>