profile.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 getVerifiedMobile($userid = 0)
  32. {
  33. if (!isset($userid))
  34. return FALSE;
  35. return $this->uprofile->getOne(array('where' => 'userid=? and isnotice=1', 'param' => array($userid), 'asArray' => TRUE));
  36. }
  37. public function setAvatar($userid = 0, $avaurl)
  38. {
  39. if (!isset($userid))
  40. return FALSE;
  41. $this->uprofile->avatar = $avaurl;
  42. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  43. }
  44. public function upProfile($userid, $proArray)
  45. {
  46. $this->uprofile->name = $proArray['name'];
  47. $this->uprofile->company = $proArray['company'];
  48. $this->uprofile->jobs = $proArray['jobs'];
  49. $this->uprofile->phone = $proArray['phone'];
  50. $this->uprofile->mobile = $proArray['mobile'];
  51. if (isset($proArray['qq']) && $proArray['qq'])
  52. $this->uprofile->qq = $proArray['qq'];
  53. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  54. }
  55. public function updateMobile($userid, $mobile)
  56. {
  57. $this->uprofile->mobile = $mobile;
  58. $this->uprofile->isnotice = 1;
  59. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  60. }
  61. public function checkMobile($number)
  62. {
  63. return $this->uprofile->count(array('where' => 'mobile=?', 'param' => array($number), 'asArray' => TRUE));
  64. }
  65. }
  66. ?>