private function _parseEmotion($message)
 {
     Wind::import('LIB:ubb.PwUbbCode');
     $message = $this->_parseUrl($message);
     $message = Pw::substrs($message, 36);
     return PwUbbCode::parseEmotion($message);
 }
Beispiel #2
0
 protected function _bulidBbsSign($sign, $groupRight, $userstatus)
 {
     if (!$groupRight['allow_sign'] || Pw::getstatus($userstatus, PwUser::STATUS_BAN_SIGN)) {
         return '';
     }
     $sign = WindSecurity::escapeHTML($sign);
     if ($groupRight['sign_ubb'] && Pw::getstatus($userstatus, PwUser::STATUS_SIGN_USEUBB)) {
         $ubb = new PwUbbCodeConvertConfig();
         $ubb->isConverImg = $groupRight['sign_ubb_img'] ? true : false;
         $sign = PwUbbCode::convert($sign, $ubb);
     }
     return $sign;
 }
Beispiel #3
0
 public function analyse($attach)
 {
     if ($attach['type'] == 'img' && $attach['cost'] == 0) {
         $atype = 'pic';
         $url = Pw::getPath($attach['path']);
         $img = PwUbbCode::createImg(Pw::getPath($attach['path'], $attach['ifthumb'] & 1), $this->imgWidth, $this->imgHeight, $url, $this->imgLazy);
         $attr = '';
         if ($this->imgLazy && ($tmp = $this->_compare($attach['width'], $attach['height'], $this->imgWidth, $this->imgHeight))) {
             $attr .= ' width="' . $tmp[0] . '"';
             $attr .= ' height="' . $tmp[1] . '"';
         }
         $attach['descrip'] && ($attr .= ' alt="' . WindSecurity::escapeHTML($attach['descrip']) . '"');
         $attr && ($img = substr($img, 0, -3) . $attr . ' />');
         $attach += array('url' => $url, 'img' => $img, 'miniUrl' => Pw::getPath($attach['path'], $attach['ifthumb']));
     } else {
         $atype = 'downattach';
         $attach += array('cname' => '', 'ext' => strtolower(substr(strrchr($attach['name'], '.'), 1)));
     }
     return array($atype, $attach);
 }
Beispiel #4
0
 /**
  * 生成表情html标签
  *
  * @param int $key 表情序号
  * @return string 表情html
  */
 public static function createEmotion($key)
 {
     is_null(self::$_emotion) && (self::$_emotion = Wekit::cache()->get('all_emotions'));
     isset(self::$_emotion['name'][$key]) && ($key = self::$_emotion['name'][$key]);
     $emotion = isset(self::$_emotion['emotion'][$key]) ? self::$_emotion['emotion'][$key] : current(self::$_emotion['emotion']);
     $html = "<img src=\"" . Wekit::url()->images . "/emotion/" . $emotion['emotion_folder'] . '/' . $emotion['emotion_icon'] . "\" />";
     return self::_pushCode($html);
 }
Beispiel #5
0
 /**
  * 按用户ID发送私信
  * 
  * @param int $uid
  * @param string $content
  * @return PwError|boolean
  */
 public function sendMessageByUid($uid, $content, $fromUid = 0)
 {
     if (!$uid) {
         return new PwError('MESSAGE:user.empty');
     }
     $fromUid or $fromUid = $this->_getLoginUserId();
     if ($uid == $fromUid) {
         return new PwError('MESSAGE:send.to.myself');
     }
     Wind::import('LIB:ubb.PwUbbCode');
     $content = PwUbbCode::autoUrl($content, true);
     // 发消息前hook
     if (($result = $this->_getHook()->runWithVerified('check', $fromUid, $content, $uid)) instanceof PwError) {
         return $result;
     }
     $result = $this->_getWindid()->send($uid, $content, $fromUid);
     if ($result < 1) {
         return new PwError('WINDID:code.' . $result);
     }
     /* @var $creditBo PwCreditBo */
     Wind::import('SRV:credit.bo.PwCreditBo');
     $creditBo = PwCreditBo::getInstance();
     $creditBo->operate('sendmsg', new PwUserBo($fromUid));
     // 发消息扩展
     $this->_getHook()->runDo('addMessage', $uid, $fromUid, $content);
     if ($result) {
         //发件人通知
         $params = array('from_uid' => $uid, 'to_uid' => $fromUid, 'content' => $content, 'is_send' => 1);
         $this->_getNoticeService()->sendNotice($fromUid, 'message', $uid, $params, false);
         //收件人通知
         $params = array('from_uid' => $fromUid, 'to_uid' => $uid, 'content' => $content);
         $this->_getNoticeService()->sendNotice($uid, 'message', $fromUid, $params, false);
         //更新用户表未读数
         $this->updateUserMessage($uid);
     }
     //记录每天发送数量
     $this->_getUserBehaviorDs()->replaceDayBehavior($fromUid, 'message_today', Pw::getTime());
     return $result;
 }
Beispiel #6
0
 protected function _dateFormat()
 {
     if (isset($this->_data['content'])) {
         $this->_data['content'] = PwUbbCode::autoUrl($this->_data['content'], true);
         $useubb = 0;
         if ($this->hide) {
             $this->_data['content'] = "[post]" . str_replace(array('[post]', '[/post]'), "", $this->_data['content']) . "[/post]";
             $useubb = 1;
         }
         if ($this->user && preg_match('/\\[sell=(\\d+)(\\,(\\d+))?\\].+?\\[\\/sell\\]/is', $this->_data['content'], $matchs)) {
             $this->_data['content'] = $this->_formatSell($this->_data['content'], $matchs);
             $useubb = 1;
         }
         if ($this->_data['reminds']) {
             $useubb = 1;
         }
         if (!$useubb) {
             $useubb = $this->_data['content'] == PwUbbCode::convert($this->_data['content'], new PwUbbCodeConvertThread()) ? 0 : 1;
         }
         $this->_setUseubb($useubb);
     }
 }
Beispiel #7
0
 /**
  * 阅读更多
  * 
  */
 public function readAction()
 {
     Wind::import('SRV:forum.bo.PwThreadBo');
     $id = (int) $this->getInput('id');
     $fresh = Wekit::load('attention.PwFresh')->getFresh($id);
     if ($fresh['type'] == 1) {
         $thread = new PwThreadBo($fresh['src_id']);
         $array = $thread->info;
         $array['pid'] = 0;
     } else {
         $array = Wekit::load('forum.PwThread')->getPost($fresh['src_id']);
         $thread = new PwThreadBo($array['tid']);
     }
     Wind::import('LIB:ubb.PwUbbCode');
     Wind::import('LIB:ubb.config.PwUbbCodeConvertThread');
     $array['content'] = WindSecurity::escapeHTML($array['content']);
     $array['content'] = str_replace("\n", '<br />', $array['content']);
     $array['useubb'] && ($array['content'] = PwUbbCode::convert($array['content'], new PwUbbCodeConvertThread($thread, $array, $this->loginUser)));
     echo $array['content'];
     $this->setTemplate('');
 }
Beispiel #8
0
 /** 
  * 编辑用户信息
  */
 public function dorunAction()
 {
     $userDm = new PwUserInfoDm($this->loginUser->uid);
     $userDm->setRealname($this->getInput('realname', 'post'));
     $userDm->setByear($this->getInput('byear', 'post'));
     $userDm->setBmonth($this->getInput('bmonth', 'post'));
     $userDm->setBday($this->getInput('bday', 'post'));
     $userDm->setGender($this->getInput('gender', 'post'));
     $userDm->setHomepage($this->getInput('homepage', 'post'));
     $userDm->setProfile($this->getInput('profile', 'post'));
     list($hometown, $location) = $this->getInput(array('hometown', 'location'), 'post');
     /* @var $srv PwAreaService */
     $srv = Wekit::load('area.srv.PwAreaService');
     $areas = $srv->fetchAreaInfo(array($hometown, $location));
     $userDm->setHometown($hometown, isset($areas[$hometown]) ? $areas[$hometown] : '');
     $userDm->setLocation($location, isset($areas[$location]) ? $areas[$location] : '');
     //没有禁止签名的时候方可编辑签名
     if ($this->loginUser->getPermission('allow_sign')) {
         $bbsSign = $this->getInput('bbs_sign', 'post');
         if (($len = $this->loginUser->getPermission('sign_max_length')) && Pw::strlen($bbsSign) > $len) {
             //仅在此限制签名字数
             $this->showError(array('USER:user.edit.sign.length.over', array('{max}' => $len)));
         }
         Wind::import('LIB:ubb.PwUbbCode');
         Wind::import('LIB:ubb.config.PwUbbCodeConvertConfig');
         $ubb = new PwUbbCodeConvertConfig();
         $ubb->isConverImg = $this->loginUser->getPermission('sign_ubb_img') ? true : false;
         $userDm->setBbsSign($bbsSign)->setSignUseubb($bbsSign != PwUbbCode::convert($bbsSign, $ubb) ? 1 : 0);
     }
     $result = $this->_editUser($userDm, PwUser::FETCH_MAIN + PwUser::FETCH_INFO);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     } else {
         $this->loginUser->info = array_merge($this->loginUser->info, $userDm->getData());
         $this->showMessage('USER:user.edit.profile.success');
     }
 }
 public function readAction()
 {
     Wind::import('SRV:forum.bo.PwThreadBo');
     $id = $this->getInput('id');
     $fresh = $this->_getService()->getFresh($id);
     if ($fresh['type'] == 1) {
         $thread = new PwThreadBo($fresh['src_id']);
         $array = $thread->info;
         $array['pid'] = 0;
     } else {
         $array = $this->_getThread()->getPost($fresh['src_id']);
         $thread = new PwThreadBo($array['tid']);
     }
     Wind::import('LIB:ubb.PwUbbCode');
     Wind::import('LIB:ubb.config.PwUbbCodeConvertThread');
     $array['content'] = WindSecurity::escapeHTML($array['content']);
     $array['content'] = str_replace("\n", '<br />', $array['content']);
     $array['useubb'] && ($array['content'] = PwUbbCode::convert($array['content'], new PwUbbCodeConvertThread($thread, $array, $this->loginUser)));
     echo $array['content'];
     $this->setTemplate('');
     //$this->setOutPut($array['content'], 'data');
     //$this->showMessage('success');
 }