profile.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. Doo::loadModel('uprofile');
  3. class Profile
  4. {
  5. private $uprofile;
  6. public function __construct()
  7. {
  8. $this->uprofile = new Uprofile();
  9. }
  10. public function insertProfile($intp = array())
  11. {
  12. if (!isset($intp['userid']))
  13. return FALSE;
  14. $this->uprofile->userid = filter_var($intp['userid'], FILTER_VALIDATE_INT);
  15. $this->uprofile->name = filter_var($intp['realname'], FILTER_SANITIZE_STRING);
  16. $this->uprofile->company = filter_var($intp['company'], FILTER_SANITIZE_STRING);
  17. $this->uprofile->jobs = filter_var($intp['jobs'], FILTER_SANITIZE_STRING);
  18. $this->uprofile->phone = filter_var($intp['phone'], FILTER_SANITIZE_STRING);
  19. $this->uprofile->mobile = filter_var($intp['mobile'], FILTER_SANITIZE_STRING);
  20. if (isset($intp['qq']))
  21. $this->uprofile->qq = filter_var($intp['qq'], FILTER_SANITIZE_STRING);
  22. $this->uprofile->groups = 'vip';
  23. return $this->uprofile->insert();
  24. }
  25. public function getProWithUid($userid = 0)
  26. {
  27. if (!isset($userid))
  28. return FALSE;
  29. return $this->uprofile->getOne(array('where' => 'userid=?', 'param' => array($userid), 'asArray' => TRUE));
  30. }
  31. public function setAvatar($userid = 0, $avaurl)
  32. {
  33. if (!isset($userid))
  34. return FALSE;
  35. $this->uprofile->avatar = $avaurl;
  36. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  37. }
  38. public function upProfile($userid, $proArray)
  39. {
  40. $this->uprofile->name = $proArray['name'];
  41. $this->uprofile->company = $proArray['company'];
  42. $this->uprofile->jobs = $proArray['jobs'];
  43. $this->uprofile->phone = $proArray['phone'];
  44. $this->uprofile->mobile = $proArray['mobile'];
  45. if (isset($proArray['qq']) && $proArray['qq'])
  46. $this->uprofile->qq = $proArray['qq'];
  47. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  48. }
  49. public function updateMobile($userid, $mobile)
  50. {
  51. $this->uprofile->mobile = $mobile;
  52. $this->uprofile->isnotice = 1;
  53. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  54. }
  55. public function checkMobile($number)
  56. {
  57. return $this->uprofile->count(array('where' => 'mobile=?', 'param' => array($number), 'asArray' => TRUE));
  58. }
  59. }
  60. ?>