User_openid.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Table Definition for user_openid
  4. */
  5. if (!defined('STATUSNET')) {
  6. exit(1);
  7. }
  8. class User_openid extends Managed_DataObject
  9. {
  10. ###START_AUTOCODE
  11. /* the code below is auto generated do not remove the above tag */
  12. public $__table = 'user_openid'; // table name
  13. public $canonical; // varchar(191) primary_key not_null
  14. public $display; // varchar(191) unique_key not_null
  15. public $user_id; // int(4) not_null
  16. public $created; // datetime() not_null
  17. public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
  18. /* the code above is auto generated do not remove the tag below */
  19. ###END_AUTOCODE
  20. public static function schemaDef()
  21. {
  22. return array(
  23. 'fields' => array(
  24. 'canonical' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'OpenID canonical string'),
  25. 'display' => array('type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'OpenID display string'),
  26. 'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'User ID for OpenID owner'),
  27. 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
  28. 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
  29. ),
  30. 'primary key' => array('canonical'),
  31. 'unique keys' => array(
  32. 'user_openid_display_key' => array('display'),
  33. ),
  34. 'indexes' => array(
  35. 'user_openid_user_id_idx' => array('user_id'),
  36. ),
  37. 'foreign keys' => array(
  38. 'user_openid_user_id_fkey' => array('user', array('user_id' => 'id')),
  39. ),
  40. );
  41. }
  42. static function hasOpenID($user_id)
  43. {
  44. $oid = new User_openid();
  45. $oid->user_id = $user_id;
  46. $cnt = $oid->find();
  47. return ($cnt > 0);
  48. }
  49. }