123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- Doo::loadModel('uprofile');
- class Profile {
- private $uprofile;
- public function __construct() {
- $this->uprofile = new Uprofile();
- }
- public function insertProfile($intp = array()) {
- if (!isset($intp['userid']))
- return FALSE;
- $this->uprofile->userid = filter_var($intp['userid'], FILTER_VALIDATE_INT);
- $this->uprofile->name = filter_var($intp['realname'], FILTER_SANITIZE_STRING);
- $this->uprofile->company = filter_var($intp['company'], FILTER_SANITIZE_STRING);
- $this->uprofile->jobs = filter_var($intp['jobs'], FILTER_SANITIZE_STRING);
- $this->uprofile->phone = filter_var($intp['phone'], FILTER_SANITIZE_STRING);
- $this->uprofile->mobile = filter_var($intp['mobile'], FILTER_SANITIZE_STRING);
- if (isset($intp['qq']))
- $this->uprofile->qq = filter_var($intp['qq'], FILTER_SANITIZE_STRING);
- $this->uprofile->groups = 'vip';
- return $this->uprofile->insert();
- }
- public function getProWithUid($userid = 0) {
- if (!isset($userid))
- return FALSE;
- return $this->uprofile->getOne(array('where' => 'userid=?', 'param' => array($userid), 'asArray' => TRUE));
- }
- public function setAvatar($userid = 0, $avaurl) {
- if (!isset($userid))
- return FALSE;
- $this->uprofile->avatar = $avaurl;
- return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
- }
- public function upProfile($userid, $proArray) {
- $this->uprofile->name = $proArray['name'];
- $this->uprofile->company = $proArray['company'];
- $this->uprofile->jobs = $proArray['jobs'];
- $this->uprofile->phone = $proArray['phone'];
- $this->uprofile->mobile = $proArray['mobile'];
- if (isset($proArray['qq']) && $proArray['qq'])
- $this->uprofile->qq = $proArray['qq'];
- return $this->uprofile->update(array('where' => 'userid=?', 'param' => array($userid)));
- }
- }
- ?>
|