summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2008-08-28 03:22:05 -0400
committerZach Copley <zach@controlyourself.ca>2008-08-28 03:22:05 -0400
commitbf14709fe2ed18f5a2641f841cb000a4856290fd (patch)
tree508497b61ec9a4b98e21d27511c0b4928f50c4f1 /classes
parent8ff52da16927c37462e32b24307dae5bd689fd1a (diff)
Twitter integration - support for new foreign_link table and prefs now save/update
darcs-hash:20080828072205-7b5ce-16510357343f1d9a3acc696f39a28a723005f3a4.gz
Diffstat (limited to 'classes')
-rw-r--r--classes/Foreign_link.php18
-rw-r--r--classes/Foreign_user.php34
2 files changed, 23 insertions, 29 deletions
diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php
index a93f30f2c..4fcad4b17 100644
--- a/classes/Foreign_link.php
+++ b/classes/Foreign_link.php
@@ -25,4 +25,22 @@ class Foreign_link extends DB_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
+
+ // XXX: This only returns a 1->1 single obj mapping. Change? Or make
+ // a getForeignUsers() that returns more than one? --Zach
+ static function getForeignLink($user_id, $service) {
+
+ $flink = new Foreign_link();
+ $flink->whereAdd("service = $service");
+ $flink->whereAdd("user_id = $user_id");
+ $flink->limit(1);
+
+ if ($flink->find()) {
+ $flink->fetch();
+ return $flink;
+ }
+
+ return NULL;
+ }
+
}
diff --git a/classes/Foreign_user.php b/classes/Foreign_user.php
index 6dbad9aa2..2b6e81015 100644
--- a/classes/Foreign_user.php
+++ b/classes/Foreign_user.php
@@ -23,11 +23,12 @@ class Foreign_user extends DB_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
- function getForeignUser($user_id, $service) {
-
- $fuser = DB_DataObject::factory('foreign_user');
+ // XXX: This only returns a 1->1 single obj mapping. Change? Or make
+ // a getForeignUsers() that returns more than one? --Zach
+ static function getForeignUser($id, $service) {
+ $fuser = new Foreign_user();
$fuser->whereAdd("service = $service");
- $fuser->whereAdd("user_id = $user_id");
+ $fuser->whereAdd("id = $id");
$fuser->limit(1);
if ($fuser->find()) {
@@ -38,29 +39,4 @@ class Foreign_user extends DB_DataObject
return NULL;
}
-
- static function save($fields) {
-
- extract($fields);
-
- $fuser = new Foreign_user();
-
- $fuser->id = $id;
- $fuser->service = $service;
- $fuser->uri = $uri;
- $fuser->nickname = $nickname;
- $fuser->user_id = $user_id;
- $fuser->credentials = $credentials;
- $fuser->created = common_sql_now();
-
- $result = $fuser->insert();
-
- if (!$result) {
- common_log_db_error($fuser, 'INSERT', __FILE__);
- return FALSE;
- }
-
- return $fuser;
- }
-
}