summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-06-18 07:43:10 -0400
committerEvan Prodromou <evan@prodromou.name>2008-06-18 07:43:10 -0400
commit4a0b1a9ea9d288e42ac03c43ef904b0565a7087f (patch)
tree2e18913f029cd0b696b7d80504b5277867f4ea5c /lib
parentdc2e7f4225acb216ec715d6c960dd53c7a318e54 (diff)
consolidate linking a user to an OpenID
darcs-hash:20080618114310-84dde-15b224bb16d434150af457bc3b08de58e3833abd.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/openid.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/openid.php b/lib/openid.php
index 9128ecddc..c41b3424c 100644
--- a/lib/openid.php
+++ b/lib/openid.php
@@ -41,4 +41,21 @@ function oid_consumer() {
$store = oid_store();
$consumer = new Auth_OpenID_Consumer($store);
return $consumer;
-} \ No newline at end of file
+}
+
+function oid_link_user($id, $canonical, $display) {
+
+ $oid = new User_openid();
+ $oid->user_id = $id;
+ $oid->canonical = $canonical;
+ $oid->display = $display;
+ $oid->created = DB_DataObject_Cast::dateTime();
+
+ if (!$oid->insert()) {
+ $err = PEAR::getStaticProperty('DB_DataObject','lastError');
+ common_debug('DB error ' . $err->code . ': ' . $err->message, __FILE__);
+ return false;
+ }
+
+ return true;
+}