Notifies the sender when a moderated message to a ML is accepted (I forgot the text...
[platal.git] / modules / openid / openid.inc.php
index e4a7b12..5c3cab0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -78,6 +78,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)) {
@@ -103,6 +109,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