function doSaveWeibo($uid, $data, $from = 0, $type = 0, $type_data, $sync, $from_data) { if (!$data['content']) { return false; } $save['uid'] = $uid; $save['transpond_id'] = intval($data['transpond_id']); $save['from'] = intval($from); //0网站 1手机网页版 2 android 3 iphone $save['content'] = preg_replace_callback('/((?:https?|mailto).*?)(\\s| | |<br|\'|\\"|$)/', getContentUrl, $data['content']); $save['from_data'] = $from_data; if (mb_strlen($save['content'], 'UTF8') > 140) { return false; } if ($type) { $save = array_merge($save, $this->checkWeiboType($type, $type_data)); } else { if ($data['type']) { $save['type'] = intval($data['type']); } } $save['ctime'] = time(); if ($id = $this->add($save)) { if ($save['transpond_id']) { $this->setInc('transpond', 'weibo_id=' . $save['transpond_id']); } if (in_array('sina', $sync)) { $opt = M('login')->where("uid=" . $uid . " AND type='sina'")->field('oauth_token,oauth_token_secret,is_sync')->find(); //if($opt['is_sync']){ include_once SITE_PATH . '/addons/plugins/login/sina.class.php'; $sina = new sina(); if ($type == 1) { $sina->upload($save['content'], SITE_URL . '/data/uploads/' . $type_data, $opt); } elseif ($type == 0) { $sina->update($save['content'], $opt); } //} } //话题处理 D('Topic', 'weibo')->addTopic($save['content']); return $id; } else { return false; } }