Exemple #1
0
 public function run()
 {
     $this->setCurrentLeft('avatar');
     $isAvatarBan = false;
     if (Pw::getstatus($this->loginUser->info['status'], PwUser::STATUS_BAN_AVATAR)) {
         Wind::import('SRV:user.srv.PwBanBp');
         $banBp = new PwBanBp($this->loginUser->uid);
         if (false === $banBp->checkIfBanAvatar()) {
             $banBp->recoveryBanAvatarError();
         } elseif ($banBp->endDateTimeBanAvatar()) {
             $this->loginUser->info['status'] = $banBp->callEndDateTimeBanAvatar();
         } else {
             $isAvatarBan = true;
             $info = $banBp->getBanAvatarInfo();
             if ($info['created_userid'] == 0) {
                 $info['operator'] = 'system';
             } else {
                 $operatorInfo = Wekit::load('user.PwUser')->getUserByUid($info['created_userid']);
                 $info['operator'] = $operatorInfo['username'];
             }
             $this->setOutput($info, 'banInfo');
         }
     }
     $windidApi = $this->_getWindid();
     $this->setOutput($windidApi->showFlash($this->loginUser->uid), 'avatarFlash');
     $this->setOutput($windidApi->showFlash($this->loginUser->uid, 0), 'avatarArr');
     $this->setOutput($isAvatarBan, 'isAvatarBan');
     $this->setOutput($this->getInput('type'), 'type');
     $this->setLayout('');
     $this->setTemplate('profile_avatar');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     PwSeoBo::setCustomSeo($lang->getMessage('SEO:profile.avatar.run.title'), '', '');
 }
 public function welcome(PwUserBo $userBo, $ip)
 {
     Wind::import('SRV:user.srv.PwBanBp');
     $banBp = new PwBanBp($userBo->uid);
     if ($banBp->checkIfBan()) {
         if (Pw::getstatus($userBo->info['status'], PwUser::STATUS_BAN_AVATAR) && false === $banBp->checkIfBanAvatar()) {
             $banBp->recoveryBanAvatarError();
         } else {
             $banBp->endDateTimeBanAvatar();
         }
         if (Pw::getstatus($userBo->info['status'], PwUser::STATUS_BAN_SIGN) && false === $banBp->checkIfBanSign()) {
             $banBp->recoveryBanSignError();
         } else {
             $banBp->endDateTimeBanSign();
         }
         if ($userBo->gid == 6 && false == $banBp->checkIfBanSpeak()) {
             $banBp->recoveryBanSpeaKError();
         } else {
             $banBp->endDateTimeBanSpeak();
         }
         $userBo->info = array_merge($userBo->info, Wekit::load('user.PwUser')->getUserByUid($userBo->uid));
         $userBo->gid = $userBo->info['groupid'] == 0 ? $userBo->info['memberid'] : $userBo->info['groupid'];
         if ($userBo->info['groups']) {
             $userBo->groups = explode(',', $userBo->info['groups']);
         }
         $userBo->groups[] = $this->gid;
     }
     return $userBo;
 }
Exemple #3
0
 public function bulidThread($thread)
 {
     if ($thread['issort'] && $thread['topped']) {
         $thread['icon'] = 'headtopic_' . $thread['topped'];
     } elseif ($thread['digest']) {
         $thread['icon'] = 'digest';
     } elseif (Pw::getstatus($thread['tpcstatus'], PwThread::STATUS_LOCKED)) {
         $thread['icon'] = 'lock';
     } elseif ($thread['special'] && isset($this->specialIcon[$thread['special']])) {
         $thread['icon'] = $this->specialIcon[$thread['special']];
     } elseif ($thread['replies'] > $this->_iconHot) {
         $thread['icon'] = 'topichot';
     } elseif (Pw::getTime() - $thread['created_time'] < $this->_iconNew) {
         $thread['icon'] = 'topicnew';
     } else {
         $thread['icon'] = 'topic';
     }
     if ($thread['overtime'] && $thread['overtime'] < Pw::getTime()) {
         $overtimeService = Wekit::load("SRV:forum.srv.PwOvertimeService");
         $overtimeService->updateOvertime($thread['tid']);
     }
     if ($thread['highlight']) {
         $highlight = Wekit::load("Lib:utility.PwHighlight");
         $thread['highlight_style'] = $highlight->getStyle($thread['highlight']);
     }
     if ($thread['inspect']) {
         $thread['inspect'] = explode("\t", $thread['inspect']);
     }
     if ($thread['ifshield']) {
         $thread['highlight_style'] = 'text-decoration: line-through';
         $thread['subject'] = '此帖已被屏蔽';
     }
     return $this->runWithFilters('bulidThread', $thread);
 }
 public function updateUserStatus($uid, $status)
 {
     $userDs = $this->loadUser();
     $user = $userDs->getUserByUid($uid, PwUser::FETCH_MAIN);
     if ($user && !Pw::getstatus($user['status'], PwUser::STATUS_ALLOW_LOGIN_ADMIN)) {
         Wind::import('SRV:user.dm.PwUserInfoDm');
         $dm = new PwUserInfoDm($uid);
         $dm->setAllowLoginAdmin($status);
         $userDs->editUser($dm, PwUser::FETCH_MAIN);
     }
     return true;
 }
 public function synLogin($uid)
 {
     Wind::import('SRC:service.user.bo.PwUserBo');
     Wind::import('SRC:service.user.srv.PwLoginService');
     $userBo = new PwUserBo($uid);
     if ($userBo->isExists() && !Pw::getstatus($userBo->info['status'], PwUser::STATUS_UNACTIVE)) {
         $srv = new PwLoginService();
         $ip = Wind::getApp()->getRequest()->getClientIp();
         $srv->setLoginCookie($userBo, $ip, 1);
     }
     exit;
     //return true;
 }
 public function createHtml($left, $tab)
 {
     $verify = $this->_getDs()->getVerify($this->user->uid);
     $types = $this->_getService()->getOpenVerifyType();
     $typeNames = $this->_getService()->getVerifyTypeName();
     $haveVerify = $noVerify = array();
     foreach ($types as $k => $v) {
         if (Pw::getstatus($verify['type'], $k)) {
             $haveVerify[$typeNames[$k]] = $v;
         } else {
             $noVerify[$typeNames[$k]] = $v;
         }
     }
     $conf = Wekit::C('app_verify');
     $rightType = $this->_getService()->getRightType();
     PwHook::template('displayAppProfileVerify', 'EXT:verify.template.index_run', true, $rightType, $types, $haveVerify, $noVerify, $conf);
 }
 public function deleteBan($uid)
 {
     /* @var $userDs PwUser */
     $userDs = Wekit::load('SRV:user.PwUser');
     $info = $userDs->getUserByUid($uid, PwUser::FETCH_MAIN);
     if (!Pw::getstatus($info['status'], PwUser::STATUS_BAN_SIGN)) {
         return $info['status'];
     }
     //已经解禁不需要再次更改
     $userDm = new PwUserInfoDm($uid);
     $userDm->setBanSign(false);
     //		->setBbsSign('')
     /* @var $userDs PwUser */
     $userDs = Wekit::load('SRV:user.PwUser');
     $userDs->editUser($userDm, PwUser::FETCH_MAIN | PwUser::FETCH_INFO);
     $s = 1 << PwUser::STATUS_BAN_SIGN - 1;
     return intval($info['status'] - $s);
 }
 public function run()
 {
     $userInfo = Wekit::load('user.PwUser')->getUserByUid($this->loginUser->uid, PwUser::FETCH_INFO);
     $userInfo = array_merge($this->loginUser->info, $userInfo);
     list($year, $month, $day) = PwUserHelper::getBirthDay();
     $this->setOutput($this->_buildArea($userInfo['location']), 'location');
     $this->setOutput($this->_buildArea($userInfo['hometown']), 'hometown');
     $isAllowSign = false;
     if ($this->loginUser->getPermission('allow_sign')) {
         $isAllowSign = true;
         $isSignBan = false;
         if (Pw::getstatus($this->loginUser->info['status'], PwUser::STATUS_BAN_SIGN)) {
             Wind::import('SRV:user.srv.PwBanBp');
             $banBp = new PwBanBp($this->loginUser->uid);
             if (false === $banBp->checkIfBanSign()) {
                 $banBp->recoveryBanSignError();
             } elseif ($banBp->endDateTimeBanSign()) {
                 $s = 1 << PwUser::STATUS_BAN_SIGN - 1;
                 $this->loginUser->info['status'] = $this->loginUser->info['status'] - $s;
             } else {
                 $isSignBan = true;
             }
         }
     }
     $extendsSrv = new PwUserProfileExtends($this->loginUser);
     list($_left, $_tab) = $this->getMenuService()->getCurrentTab($this->getInput('_left'), $this->getInput('_tab'));
     $extendsSrv->setCurrent($_left, $_tab);
     $this->runHook('c_profile_foot_run', $extendsSrv);
     $this->setOutput($extendsSrv, 'hookSrc');
     $this->setOutput($isAllowSign, 'isAllowSign');
     $this->setOutput($isSignBan, 'isSignBan');
     $this->setOutput($this->loginUser->getPermission('sign_max_length'), 'signMaxLength');
     $this->setOutput($year, 'years');
     $this->setOutput($month, 'months');
     $this->setOutput($day, 'days');
     $this->setOutput($userInfo, 'userinfo');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:profile.index.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 public function deleteBan($uid)
 {
     /* @var $userDs PwUser */
     $userDs = Wekit::load('SRV:user.PwUser');
     $info = $userDs->getUserByUid($uid, PwUser::FETCH_MAIN);
     if (!Pw::getstatus($info['status'], PwUser::STATUS_BAN_AVATAR)) {
         return $info['status'];
     }
     //已经解禁不需要再次更改
     $userDm = new PwUserInfoDm($uid);
     $userDm->setBanAvatar(false);
     /* @var $userDs PwUser */
     $userDs = Wekit::load('SRV:user.PwUser');
     $userDs->editUser($userDm, PwUser::FETCH_MAIN);
     /* @var $userSrv PwUserService */
     $userSrv = Wekit::load('SRV:user.srv.PwUserService');
     $userSrv->restoreDefualtAvatar($uid);
     $p = 1 << PwUser::STATUS_BAN_AVATAR - 1;
     return intval($info['status'] - $p);
 }
 /** 
  * 批量激活用户
  *
  */
 public function doactiveAction()
 {
     $uids = $this->getInput('uid', 'post');
     if (!$uids) {
         $this->showError('operate.select');
     }
     /* @var $userDs PwUser */
     $userDs = Wekit::load('user.PwUser');
     $infos = $userDs->fetchUserByUid($uids, PwUser::FETCH_MAIN);
     /* @var $groupService PwUserGroupsService */
     $groupService = Wekit::load('usergroup.srv.PwUserGroupsService');
     $strategy = Wekit::C('site', 'upgradestrategy');
     $clearUid = array();
     foreach ($infos as $_temp) {
         $clearUid[] = $_temp['uid'];
         if (Pw::getstatus($_temp['status'], PwUser::STATUS_UNACTIVE)) {
             $userDm = new PwUserInfoDm($_temp['uid']);
             $userDm->setUnactive(false);
             if (!Pw::getstatus($_temp['status'], PwUser::STATUS_UNCHECK)) {
                 $userDm->setGroupid(0);
                 $_credit = $userDs->getUserByUid($_temp['uid'], PwUser::FETCH_DATA);
                 $credit = $groupService->calculateCredit($strategy, $_credit);
                 $memberid = $groupService->calculateLevel($credit, 'member');
                 $userDm->setMemberid($memberid);
             }
             $userDs->editUser($userDm, PwUser::FETCH_MAIN);
         }
     }
     $this->_getDs()->batchActiveUser($clearUid);
     $this->showMessage('operate.success');
 }
 protected function _getLockManage($manage)
 {
     Wind::import('SRV:forum.srv.manage.PwThreadManageDoLock');
     $do = new PwThreadManageDoLock($manage);
     if (!$this->doAction) {
         if ($this->singleData) {
             $defaultLocked = Pw::getstatus($this->singleData['tpcstatus'], PwThread::STATUS_CLOSED) ? 2 : 1;
         } else {
             $defaultLocked = 1;
         }
         $this->setOutput($defaultLocked, 'defaultLocked');
     } else {
         $locked = $this->getInput('locked', 'post');
         $do->setLocked($locked)->setReason($this->getInput('reason', 'post'));
         !$locked && ($this->doCancel[] = 'dolock');
     }
     return $do;
 }
 /**
  * 提示信息
  */
 public function showAction()
 {
     if (Pw::getstatus($this->loginUser->info['status'], PwUser::STATUS_UNCHECK)) {
         $this->showError('USER:login.active.check');
     }
     $this->forwardRedirect($this->_filterUrl());
 }
 /**
  * 用户引导页面
  *
  */
 public function guideAction()
 {
     if (!$this->loginUser->isExists()) {
         $this->forwardRedirect(Wekit::url()->base);
     }
     $key = $this->getInput('key');
     /* @var $guideService PwUserRegisterGuideService */
     $guideService = Wekit::load('APPS:u.service.PwUserRegisterGuideService');
     $next = $guideService->getNextGuide($key);
     if (!$next) {
         if (Wekit::C('register', 'active.check')) {
             $this->setOutput(1, 'check');
             if (!Pw::getstatus($this->loginUser->info['status'], PwUser::STATUS_UNCHECK)) {
                 $this->forwardRedirect(Wekit::url()->base);
             }
         }
         $synLogin = $this->_getWindid()->synLogin($this->loginUser->uid);
         $this->setOutput($this->loginUser->info['username'], 'username');
         $this->setOutput('success', 'type');
         $this->setOutput($synLogin, 'synLogin');
         $this->setTemplate('register_about');
     } else {
         $this->forwardRedirect(WindUrlHelper::createUrl($next['guide']));
     }
 }
Exemple #14
0
 /**
  * 帖子阅读页
  */
 public function run()
 {
     $tid = intval($this->getInput('tid'));
     list($page, $uid, $desc) = $this->getInput(array('page', 'uid', 'desc'), 'get');
     $threadDisplay = new PwThreadDisplay($tid, $this->loginUser);
     $this->runHook('c_read_run', $threadDisplay);
     if (($result = $threadDisplay->check()) !== true) {
         $this->showError($result->getError());
     }
     $_cache = Wekit::cache()->fetch(array('level', 'group_right'));
     $pwforum = $threadDisplay->getForum();
     if ($pwforum->foruminfo['password']) {
         if (!$this->loginUser->isExists()) {
             $this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/cate/run', array('fid' => ${$pwforum}->fid))));
         } elseif (Pw::getPwdCode($pwforum->foruminfo['password']) != Pw::getCookie('fp_' . $pwforum->fid)) {
             $this->forwardAction('bbs/forum/password', array('fid' => $pwforum->fid));
         }
     }
     if ($uid) {
         Wind::import('SRV:forum.srv.threadDisplay.PwUserRead');
         $dataSource = new PwUserRead($threadDisplay->thread, $uid);
     } else {
         Wind::import('SRV:forum.srv.threadDisplay.PwCommonRead');
         $dataSource = new PwCommonRead($threadDisplay->thread);
     }
     $dataSource->setPage($page)->setPerpage($pwforum->forumset['readperpage'] ? $pwforum->forumset['readperpage'] : Wekit::C('bbs', 'read.perpage'))->setDesc($desc);
     $threadDisplay->setImgLazy(Wekit::C('bbs', 'read.image_lazy'));
     $threadDisplay->execute($dataSource);
     $operateReply = $operateThread = array();
     $isBM = $pwforum->isBM($this->loginUser->username);
     if ($threadPermission = $this->loginUser->getPermission('operate_thread', $isBM, array())) {
         $operateReply = Pw::subArray($threadPermission, array('toppedreply', 'remind', 'shield', 'delete', 'ban', 'inspect', 'read'));
         $operateThread = Pw::subArray($threadPermission, array('digest', 'topped', 'up', 'highlight', 'copy', 'type', 'move', 'lock', 'down', 'delete', 'ban'));
     }
     $threadInfo = $threadDisplay->getThreadInfo();
     $this->setOutput($threadDisplay, 'threadDisplay');
     $this->setOutput($tid, 'tid');
     $this->setOutput($threadDisplay->fid, 'fid');
     $this->setOutput($threadInfo, 'threadInfo');
     $this->setOutput($threadDisplay->getList(), 'readdb');
     $this->setOutput($threadDisplay->getUsers(), 'users');
     $this->setOutput($pwforum, 'pwforum');
     $this->setOutput(PwCreditBo::getInstance(), 'creditBo');
     $this->setOutput($threadDisplay->getHeadguide(), 'headguide');
     $this->setOutput(Wekit::C('bbs', 'read.display_member_info'), 'displayMemberInfo');
     $this->setOutput(Wekit::C('bbs', 'read.display_info'), 'displayInfo');
     $this->setOutput(Wekit::C('bbs', 'thread.hotthread_replies'), 'hotIcon');
     $this->setOutput($threadPermission, 'threadPermission');
     $this->setOutput($operateThread, 'operateThread');
     $this->setOutput($operateReply, 'operateReply');
     $this->setOutput(!$this->loginUser->uid && !$this->allowPost($pwforum) ? ' J_qlogin_trigger' : '', 'postNeedLogin');
     $this->setOutput(!$this->loginUser->uid && !$this->allowReply($pwforum) ? ' J_qlogin_trigger' : '', 'replyNeedLogin');
     $this->setOutput($_cache['level']['ltitle'], 'ltitle');
     $this->setOutput($_cache['level']['lpic'], 'lpic');
     $this->setOutput($_cache['level']['lneed'], 'lneed');
     $this->setOutput($_cache['group_right'], 'groupRight');
     $this->setOutput($threadDisplay->page, 'page');
     $this->setOutput($threadDisplay->perpage, 'perpage');
     $this->setOutput($threadDisplay->total, 'count');
     $this->setOutput($threadDisplay->maxpage, 'totalpage');
     $this->setOutput($threadDisplay->getUrlArgs(), 'urlargs');
     $this->setOutput($threadDisplay->getUrlArgs('desc'), 'urlDescArgs');
     $this->setOutput($this->loginUser->getPermission('look_thread_log', $isBM, array()), 'canLook');
     $this->setOutput($this->_getFpage($threadDisplay->fid), 'fpage');
     //版块风格
     if ($pwforum->foruminfo['style']) {
         $this->setTheme('forum', $pwforum->foruminfo['style']);
         //$this->addCompileDir($pwforum->foruminfo['style']);
     }
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $threadDisplay->page <= 1 && $seoBo->setDefaultSeo($lang->getMessage('SEO:bbs.read.run.title'), '', $lang->getMessage('SEO:bbs.read.run.description'));
     $seoBo->init('bbs', 'read');
     $seoBo->set(array('{forumname}' => $threadDisplay->forum->foruminfo['name'], '{title}' => $threadDisplay->thread->info['subject'], '{description}' => Pw::substrs($threadDisplay->thread->info['content'], 100, 0, false), '{classfication}' => $threadDisplay->thread->info['topic_type'], '{tags}' => $threadInfo['tags'], '{page}' => $threadDisplay->page));
     Wekit::setV('seo', $seoBo);
     //是否显示回复
     $showReply = true;
     //锁定时间
     if ($pwforum->forumset['locktime'] && $threadInfo['created_time'] + $pwforum->forumset['locktime'] * 86400 < Pw::getTime()) {
         $showReply = false;
     } elseif (Pw::getstatus($threadInfo['tpcstatus'], PwThread::STATUS_LOCKED) && !$this->loginUser->getPermission('reply_locked_threads')) {
         $showReply = false;
     }
     $this->setOutput($showReply, 'showReply');
     $this->runReadDesign($threadDisplay->fid);
     $this->updateReadOnline($threadDisplay->fid, $tid);
 }
 /** 
  * 激活email
  *
  * @param int $uid 用户ID
  * @param string $email 用户Email
  * @param string $code 激活码
  * @return boolean
  */
 public function activeEmail($uid, $email, $code)
 {
     /* @var $activeCodeDs PwUserActiveCode */
     $activeCodeDs = Wekit::load('user.PwUserActiveCode');
     $info = $activeCodeDs->getInfoByUid($uid);
     if (!$info || $info['email'] != $email || $info['code'] != $code) {
         return new PwError("USER:illegal.request");
     }
     if ($info['active_time'] > 0) {
         return new PwError('USER:active.email.dumplicate');
     }
     $validTime = $this->activeCodeValidTime * 3600;
     if ($info['send_time'] + $validTime < Pw::getTime()) {
         return new PwError('USER:active.email.overtime');
     }
     $activeCodeDs->activeCode($uid, Pw::getTime());
     $info = $this->_getUserDs()->getUserByUid($uid, PwUser::FETCH_MAIN);
     if (Pw::getstatus($info['status'], PwUser::STATUS_UNACTIVE)) {
         $userDm = new PwUserInfoDm($info['uid']);
         $userDm->setUnactive(false);
         !Pw::getstatus($info['status'], PwUser::STATUS_UNCHECK) && $userDm->setGroupid(0);
         $this->_getUserDs()->editUser($userDm, PwUser::FETCH_MAIN);
     }
     /* @var $registerCheckDs PwUserRegisterCheck */
     $registerCheckDs = Wekit::load('user.PwUserRegisterCheck');
     $registerCheckDs->activeUser($uid);
     return true;
 }
Exemple #16
0
 /**
  * 回帖后续操作<更新版块、缓存等信息>
  */
 public function afterPost()
 {
     if ($rpid = $this->postDm->getField('rpid')) {
         Wekit::load('forum.PwPostsReply')->add($this->pid, $rpid);
     }
     if ($this->postDm->getIscheck()) {
         $title = $this->postDm->getTitle() ? $this->postDm->getTitle() : 'Re:' . $this->info['subject'];
         $this->forum->addPost($this->tid, $this->user->username, $title);
         Wind::import('SRV:forum.dm.PwTopicDm');
         $dm = new PwTopicDm($this->tid);
         $timestamp = Pw::getTime();
         if ($this->info['lastpost_time'] > $timestamp || Pw::getstatus($this->info['tpcstatus'], PwThread::STATUS_DOWNED)) {
             $timestamp = null;
         }
         $dm->addReplies(1)->addHits(1)->setLastpost($this->user->uid, $this->user->username, $timestamp);
         $this->_getThreadsService()->updateThread($dm, PwThread::FETCH_MAIN);
         if ($rpid) {
             Wind::import('SRV:forum.dm.PwReplyDm');
             $dm = new PwReplyDm($rpid);
             $dm->addReplies(1);
             $this->_getThreadsService()->updatePost($dm);
         }
     }
 }
Exemple #17
0
 /**
  * @see PwPostAction.dataProcessing
  */
 public function dataProcessing(PwPostDm $postDm)
 {
     $_gtime = $this->user->getPermission('post_modify_time');
     $modifyTime = $_gtime && Pw::getTime() - $this->info['created_time'] > $_gtime * 60 ? Pw::getTime() : 0;
     $postDm->setDisabled($this->isDisabled())->setModifyInfo($this->user->uid, $this->user->username, $this->user->ip, $modifyTime);
     if (!Pw::getstatus($this->info['tpcstatus'], PwThread::STATUS_OPERATORLOG) && $this->info['created_userid'] != $this->user->uid) {
         $postDm->setOperatorLog(true);
     }
     if (($result = $this->checkTopictype($postDm)) !== true) {
         return $result;
     }
     if (($postDm = $this->runWithFilters('dataProcessing', $postDm)) instanceof PwError) {
         return $postDm;
     }
     $this->postDm = $postDm;
     return true;
 }
 private function _getPassVerify($type)
 {
     $types = $this->_getService()->getVerifyType();
     $array = array();
     foreach ($types as $k => $v) {
         Pw::getstatus($type, $k) && ($array[] = $v);
     }
     return implode('、', $array);
 }
Exemple #19
0
 protected function checkVerifyExist($uid, $type)
 {
     $info = $this->_getDs()->getVerify($uid);
     if (Pw::getstatus($info['type'], $type)) {
         return true;
     }
     return false;
 }
 public function deleteAction()
 {
     $aid = $this->getInput('aid', 'post');
     if (!$aid) {
         $this->showError('operate.fail');
     }
     if (!($attach = Wekit::load('attach.PwThreadAttach')->getAttach($aid))) {
         $this->showError('data.error');
     }
     Wind::import('SRV:forum.bo.PwForumBo');
     $forum = new PwForumBo($attach['fid']);
     if (!$forum->isForum()) {
         $this->showError('data.error');
     }
     if ($this->loginUser->uid != $attach['created_userid']) {
         if (!$this->loginUser->getPermission('operate_thread.deleteatt', $forum->isBM($this->loginUser->username))) {
             $this->showError('permission.attach.delete.deny');
         }
         if (!$this->loginUser->comparePermission($attach['created_userid'])) {
             $this->showError(array('permission.level.deleteatt', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
         }
     }
     Wekit::load('attach.PwThreadAttach')->deleteAttach($aid);
     Pw::deleteAttach($attach['path'], $attach['ifthumb']);
     if ($this->loginUser->uid != $attach['created_userid']) {
         Wekit::load('log.srv.PwLogService')->addDeleteAtachLog($this->loginUser, $attach);
     }
     if ($attach['tid']) {
         if (!$attach['pid']) {
             $thread = Wekit::load('forum.PwThread')->getThread($attach['tid'], PwThread::FETCH_ALL);
             Wind::import('SRV:forum.dm.PwTopicDm');
             $dm = new PwTopicDm($attach['tid']);
             if (!Wekit::load('attach.PwThreadAttach')->countType($attach['tid'], 0, $attach['type'])) {
                 $dm->setHasAttach($attach['type'], false);
             }
             if (!Pw::getstatus($thread['tpcstatus'], PwThread::STATUS_OPERATORLOG) && $this->loginUser->uid != $attach['created_userid']) {
                 $dm->setOperatorLog(true);
             }
         } else {
             $thread = Wekit::load('forum.PwThread')->getPost($attach['pid']);
             Wind::import('SRV:forum.dm.PwReplyDm');
             $dm = new PwReplyDm($attach['pid']);
         }
         if ($thread['aids'] > 0) {
             $thread['aids']--;
         }
         $dm->setAids($thread['aids']);
         if (($content = str_replace('[attachment=' . $aid . ']', '', $thread['content'])) != $thread['content']) {
             $dm->setContent($content);
         }
         if (!$attach['pid']) {
             Wekit::load('forum.PwThread')->updateThread($dm);
         } else {
             Wekit::load('forum.PwThread')->updatePost($dm);
         }
     }
     $this->showMessage('success');
 }
 public function checkVerifyOpen($type)
 {
     if (!Wekit::C('app_verify', 'verify.isopen')) {
         return false;
     }
     $openType = Wekit::C('app_verify', 'verify.type');
     if (!Pw::getstatus($openType, $type)) {
         return false;
     }
     return true;
 }
Exemple #22
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;
 }
Exemple #23
0
 /**
  * 添加前台帖子管理的相关日志
  *
  * @param PwUserBo $user 操作者
  * @param string $type 操作类型
  * @param array $threads 被操作的帖子列表
  * @param string $reason 操作原因
  * @param string $extends 
  * @param boolean $useReplyMsg 是否使用回复的管理日志格式
  */
 public function addThreadManageLog(PwUserBo $user, $type, $threads, $reason, $extends = '', $useReplyMsg = false)
 {
     if (!$threads) {
         return false;
     }
     $typeid = $this->getOperatTypeid($type);
     $typeTitle = $this->getOperatTypeTitle($type);
     $_logDms = $langArgs = array();
     $langArgs['{operattype}'] = $typeTitle;
     $langArgs['{reason}'] = $reason ? $this->_buildSecurity($reason) : '无';
     $_logMsg = $useReplyMsg ? 'LOG:thread.reply.message' : 'LOG:thread.manage.message';
     Wind::import('SRV:forum.dm.PwTopicDm');
     foreach ($threads as $thread) {
         $langArgs['{title}'] = sprintf('<a href="%s" target="_blank">%s</a>', WindUrlHelper::createUrl('bbs/read/run', array('tid' => $thread['tid'])), $this->_buildSecurity($thread['subject']));
         $langArgs['{createdUser}'] = sprintf('<a href="%s" target="_blank">%s</a>', WindUrlHelper::createUrl('space/index/run', array('uid' => $user->uid)), $user->username);
         $_dm = new PwLogDm();
         $_dm->setCreatedTime(Pw::getTime())->setCreatedUser($user->uid, $user->username)->setOperatedUser($thread['created_userid'], $thread['created_username'])->setIp(Wind::getComponent('request')->getClientIp())->setExtends($extends)->setFid($thread['fid'])->setTid($thread['tid'])->setPid(isset($thread['pid']) && $thread['pid'] ? $thread['pid'] : 0)->setTypeid($typeid)->setContent($this->getLogMsg($_logMsg, $langArgs));
         if (!isset($thread['pid']) && !Pw::getstatus($thread['tpcstatus'], PwThread::STATUS_OPERATORLOG)) {
             $topicDm = new PwTopicDm($thread['tid']);
             $topicDm->setOperatorLog(true);
             Wekit::load('forum.PwThread')->updateThread($topicDm, PwThread::FETCH_MAIN);
         }
         $_logDms[] = $_dm;
     }
     $this->_getLogDs()->batchAddLog($_logDms);
     return true;
 }