profile.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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->remark = filter_var($intp['remark'], FILTER_SANITIZE_STRING);
  19. $this->uprofile->phone = filter_var($intp['phone'], FILTER_SANITIZE_STRING);
  20. // $this->uprofile->mobile = filter_var($intp['mobile'], FILTER_SANITIZE_STRING);
  21. if (isset($intp['qq']))
  22. $this->uprofile->qq = filter_var($intp['qq'], FILTER_SANITIZE_STRING);
  23. $this->uprofile->groups = 'vip';
  24. return $this->uprofile->insert();
  25. }
  26. public function ZGinsertProfile($uid = 0, $realname)
  27. {
  28. if (!isset($uid))
  29. return FALSE;
  30. $this->uprofile->userid = $uid;
  31. $this->uprofile->name = $realname;
  32. $this->uprofile->company = '';
  33. $this->uprofile->jobs = '';
  34. $this->uprofile->phone = '';
  35. $this->uprofile->mobile = '';
  36. $this->uprofile->qq = '';
  37. $this->uprofile->groups = 'vip';
  38. return $this->uprofile->insert();
  39. }
  40. public function getProWithUid($userid = 0)
  41. {
  42. if (!isset($userid))
  43. return FALSE;
  44. return $this->uprofile->getOne(array('where' => 'userid=?', 'param' => array($userid), 'asArray' => TRUE));
  45. }
  46. public function getVerifiedMobile($userid = 0)
  47. {
  48. if (!isset($userid))
  49. return FALSE;
  50. return $this->uprofile->getOne(array('where' => 'userid=? and isnotice=1', 'param' => array($userid), 'asArray' => TRUE));
  51. }
  52. public function setAvatar($userid = 0, $avaurl)
  53. {
  54. if (!isset($userid))
  55. return FALSE;
  56. $this->uprofile->avatar = $avaurl;
  57. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  58. }
  59. public function setSignPath($userid = 0, $avaurl)
  60. {
  61. if (!isset($userid))
  62. return FALSE;
  63. $this->uprofile->signpath = $avaurl;
  64. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  65. }
  66. public function upProfile($userid, $proArray)
  67. {
  68. $this->uprofile->name = $proArray['name'];
  69. $this->uprofile->company = $proArray['company'];
  70. $this->uprofile->jobs = $proArray['jobs'];
  71. $this->uprofile->remark = $proArray['remark'];
  72. $this->uprofile->phone = $proArray['phone'];
  73. $this->uprofile->mobile = $proArray['mobile'];
  74. if (isset($proArray['qq']) && $proArray['qq'])
  75. $this->uprofile->qq = $proArray['qq'];
  76. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  77. }
  78. public function updateMobile($userid, $mobile)
  79. {
  80. $this->uprofile->mobile = $mobile;
  81. $this->uprofile->isnotice = 1;
  82. return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
  83. }
  84. public function checkMobile($number)
  85. {
  86. return $this->uprofile->count(array('where' => 'mobile=?', 'param' => array($number), 'asArray' => TRUE));
  87. }
  88. public function checkUserName($name)
  89. {
  90. return $this->uprofile->getOne(array('select' => 'userid,name,company,jobs', 'where' => 'name LIKE "%'.$name.'%"', 'userid' => 'asc', 'limit' => 1, 'asArray' => TRUE));
  91. }
  92. }
  93. ?>