public function setOvertime($overtime)
 {
     if ($overtime) {
         $this->overtime = is_numeric($overtime) ? $overtime : Pw::str2time($overtime) + 86399;
     }
     return $this;
 }
 public function run()
 {
     list($page, $perpage, $username, $starttime, $endtime, $keyword) = $this->getInput(array('page', 'perpage', 'username', 'starttime', 'endtime', 'keyword'));
     $starttime && ($pwStartTime = Pw::str2time($starttime));
     $endtime && ($pwEndTime = Pw::str2time($endtime));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     if ($username) {
         $userinfo = $this->_getUserDs()->getUserByName($username);
         $fromUid = $userinfo['uid'] ? $userinfo['uid'] : 0;
     }
     Wind::import('WINDID:service.message.srv.vo.WindidMessageSo');
     $vo = new WindidMessageSo();
     $endtime && $vo->setEndTime($endtime);
     $fromUid && $vo->setFromUid($fromUid);
     $keyword && $vo->setKeyword($keyword);
     $starttime && $vo->setStarttime($starttime);
     $messages = $this->_getMessageDs()->searchMessage($vo, $start, $limit);
     $count = $this->_getMessageDs()->countMessage($vo);
     foreach ($messages as $k => $v) {
         $uids[] = $v['from_uid'];
     }
     $users = $this->_getUserDs()->fetchUserByUid($uids);
     foreach ($messages as $k => $v) {
         $messages[$k]['username'] = $users[$v['from_uid']]['username'];
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(array('keyword' => $keyword, 'username' => $username, 'starttime' => $starttime, 'endtime' => $endtime), 'args');
     $this->setOutput($messages, 'messages');
 }
 public function getMyAnnounceBySchoolIdAction()
 {
     $schoolid = $this->getInput('schoolid', 'get');
     if (empty($schoolid)) {
         $this->output(-1);
         return;
     }
     $result = $this->_getPwAnnounceDs()->getAnnounceBySchoolId($schoolid, Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), 9, 0);
     $this->output($result);
 }
Exemple #4
0
 public function doeditAction()
 {
     $dataid = (int) $this->getInput('dataid', 'post');
     $info = $this->_getDataDs()->getData($dataid);
     if (!$info) {
         $this->showError("operate.fail");
     }
     $orderid = $info['vieworder'];
     $start = $this->getInput('start_time', 'post');
     $end = $this->getInput('end_time', 'post');
     $data = $this->getInput('data', 'post');
     $images = $this->getInput('images', 'post');
     $bold = $this->getInput('bold', 'post');
     $italic = $this->getInput('italic', 'post');
     $underline = $this->getInput('underline', 'post');
     $color = $this->getInput('color', 'post');
     $standard = $this->_getDesignService()->getStandardSignkey($this->bo->getModel());
     if (!$data[$standard['sTitle']]) {
         $this->showError("operate.fail");
     }
     foreach ($images as $k => $v) {
         if ($_FILES[$k]['name'] && ($image = $this->_uploadFile($k, $this->bo->moduleid))) {
             $data[$k] = $image;
         } else {
             $data[$k] = $v;
         }
     }
     $time = Pw::getTime();
     $startTime = $start ? Pw::str2time($start) : $time;
     $endTime = $end ? Pw::str2time($end) : $end;
     if ($end && $endTime < $time) {
         $this->showError("DESIGN:endtimd.error");
     }
     Wind::import('SRV:design.dm.PwDesignDataDm');
     $dm = new PwDesignDataDm($dataid);
     $dm->setStyle($bold, $underline, $italic, $color)->setExtend($data)->setStarttime($startTime)->setEndtime($endTime);
     //推送的数据,不打修改标识
     if ($info['from_type'] == PwDesignData::FROM_AUTO) {
         $dm->setEdited(1);
     }
     if ($startTime > $time) {
         $dm->setReservation(1);
     }
     $this->_getDataDs()->updateData($dm);
     if ($info['from_type'] == PwDesignData::FROM_PUSH) {
         Wind::import('SRV:design.dm.PwDesignPushDm');
         $pushDm = new PwDesignPushDm($info['from_id']);
         $pushDm->setStyle($bold, $underline, $italic, $color)->setExtend($data)->setStartTime($startTime)->setEndTime($endTime)->setModuleId($info['module_id']);
         $this->_getPushDs()->updatePush($pushDm);
     }
     $this->showMessage("operate.success", 'design/data/run?moduleid=' . $this->bo->moduleid, true);
 }
 /**
  * 通过公告记录组装前台显示效果
  * 帖子列表滚动展示标题用
  *
  * @return array
  */
 public function getAnnounceForBbsScroll()
 {
     $announces = array();
     $announceInfos = $this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), 9, 0);
     foreach ($announceInfos as $value) {
         $announces[$value['aid']] = $value;
         $announces[$value['aid']]['start_date'] = Pw::time2str($value['start_date'], 'Y-m-d');
         if (Pw::strlen($value['subject']) > 18) {
             $announces[$value['aid']]['subject'] = Pw::substrs($value['subject'], 18);
         }
     }
     return $announces;
 }
Exemple #6
0
 public function run()
 {
     $aid = $this->getInput('aid', 'get');
     $page = $this->getInput('page');
     $this->page = $page < 1 ? 1 : intval($page);
     list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
     $total = $this->_getPwAnnounceDs()->countAnnounceByTime(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')));
     $list = $total ? $this->_getPwAnnounceService()->formatAnnouncesUsername($this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), $limit, $start)) : array();
     $this->setOutput($total, 'total');
     $this->setOutput($list, 'list');
     $this->setOutput($aid, 'aid');
     $this->setOutput($this->page, 'page');
     $this->setOutput($this->perpage, 'perpage');
 }
 /**
  * 禁止用户
  */
 public function dorunAction()
 {
     $this->getRequest()->isPost() || $this->showError('operate.fail');
     $key = $this->getInput('key', 'post');
     if (!in_array($key, array('1', '2'))) {
         $this->showError('USER:ban.error.data.format');
     }
     $array = array();
     list($end_time, $reason, $types) = $this->getInput(array('end_time', 'reason', 'type'), 'post');
     $userInfos = $this->_getUids(explode(',', $this->getInput('value', 'post')), intval($key));
     if (!$userInfos) {
         $this->showError('USER:ban.user.illegal');
     }
     //如果是创始人  则自动设置为system
     $_uid = $this->loginUser->uid;
     $_operator = $this->loginUser->username;
     if ($this->isFounder($_operator)) {
         $_operator = 'system';
         $_uid = 0;
     }
     if ($end_time > 0) {
         $end_time = Pw::str2time($end_time);
     }
     Wind::import('SRV:user.dm.PwUserBanInfoDm');
     $_notice = array();
     $rightTypes = array_keys($this->_getService()->getBanType());
     foreach ($types as $type) {
         if (!in_array($type, $rightTypes)) {
             continue;
         }
         foreach ($userInfos as $uid => $info) {
             $dm = new PwUserBanInfoDm();
             $dm->setUid($uid)->setEndTime(intval($end_time))->setTypeid($type)->setReason($reason)->setOperator($_operator)->setCreatedUid($_uid);
             $array[] = $dm;
             isset($_notice[$uid]) || ($_notice[$uid] = array());
             $_notice[$uid]['end_time'] = $end_time;
             $_notice[$uid]['reason'] = $reason;
             $_notice[$uid]['type'][] = $type;
             $_notice[$uid]['operator'] = $_operator;
         }
     }
     $r = $this->_getService()->banUser($array);
     if ($r instanceof PwError) {
         $this->showError($r->getError(), 'u/forbidden/run');
     }
     $this->_getService()->sendNotice($_notice, 1);
     $this->showMessage('USER:ban.success', 'u/forbidden/run');
 }
Exemple #8
0
	public function doaddAction() {
		$pageid = (int)$this->getInput('pageid', 'post');
		$moduleid = (int)$this->getInput('moduleid', 'post');
		$isnotice = (int)$this->getInput('isnotice', 'post');
		$fromid = (int)$this->getInput('fromid', 'post');
		$fromtype = $this->getInput('fromtype', 'post');
		$start = $this->getInput('start_time', 'post');
		$end = $this->getInput('end_time', 'post');
		if ($moduleid < 1) $this->showError("operate.fail");
		$permiss = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid, $pageid);
		$pushService = $this->_getPushService();
		$data = $pushService->getDataByFromid($fromtype, $fromid);
		
		Wind::import('SRV:design.bo.PwDesignModuleBo');
		$bo = new PwDesignModuleBo($moduleid);
		$time = Pw::getTime();
		$startTime = $start ? Pw::str2time($start) : $time;
		$endTime = $end ? Pw::str2time($end) : $end;
		if ($end && $endTime < $time) $this->showError("DESIGN:endtimd.error");
		$pushDs = $this->_getPushDs();
		Wind::import('SRV:design.dm.PwDesignPushDm');
 		$dm = new PwDesignPushDm();
 		$dm->setFromid($fromid)
 			->setModuleId($moduleid)
 			->setCreatedUserid($this->loginUser->uid)
 			->setCreatedTime($time)
 			->setStartTime($startTime)
 			->setEndTime($endTime)
 			->setAuthorUid($data['uid']);
 		if ($isnotice) $dm->setNeedNotice(1);
 		if ($permiss <= PwDesignPermissions::NEED_CHECK) {
 			$dm->setStatus(PwDesignPush::NEEDCHECK);
 			$isdata = false;
 		} else {
 			$isdata = true;
 		}
		$resource = $pushService->addPushData($dm);
		if ($resource instanceof PwError) $this->showError($resource->getError());
		
		if ($isdata) {
			$pushService->pushToData((int)$resource);
			$pushService->afterPush((int)$resource);
		}
		$this->showMessage("operate.success");
	}
 public function run()
 {
     if ($this->regist['type'] != 2) {
         $this->forwardRedirect(WindUrlHelper::createUrl('my/invite/inviteFriend'));
         //			$this->showError('USER:invite.close');
     }
     Wind::import('SRV:credit.bo.PwCreditBo');
     /* @var $pwCreditBo PwCreditBo */
     $pwCreditBo = PwCreditBo::getInstance();
     $startTime = Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d'));
     $readyBuy = $this->_getDs()->countByUidAndTime($this->loginUser->uid, $startTime);
     $gidLimit = abs(ceil($this->loginUser->getPermission('invite_limit_24h')));
     $price = abs(ceil($this->loginUser->getPermission('invite_buy_credit_num')));
     $_tmpId = $this->regist['invite.credit.type'];
     $_credit = array('id' => $_tmpId, 'name' => $pwCreditBo->cType[$_tmpId], 'unit' => $pwCreditBo->cUnit[$_tmpId]);
     $this->setOutput($_credit, 'creditWithBuy');
     //用于购买的积分信息
     $_tmpId = $this->regist['invite.reward.credit.type'];
     $_credit = array('id' => $_tmpId, 'name' => $pwCreditBo->cType[$_tmpId], 'unit' => $pwCreditBo->cUnit[$_tmpId]);
     $this->setOutput($_credit, 'rewardCredit');
     //奖励的积分信息
     $this->setOutput($readyBuy > $gidLimit ? 0 : $gidLimit - $readyBuy, 'canBuyNum');
     //还能购买的邀请数
     $this->setOutput($price, 'pricePerCode');
     //每个邀请码需要积分的单价
     $this->setOutput($this->loginUser->info['credit' . $this->regist['invite.credit.type']], 'myCredit');
     //我拥有的积分
     $this->setOutput($this->regist['invite.reward.credit.num'], 'rewardNum');
     //奖励积分数
     $this->setOutput($this->regist['invite.expired'], 'codeExpired');
     //邀请码有效期
     $this->setOutput($this->loginUser->getPermission('invite_allow_buy'), 'canInvite');
     //该用户组是否可以购买邀请码
     $this->setOutput($this->regist['invite.pay.money'], 'money');
     $this->setOutput(false, 'canBuyWithMoney');
     $this->listCode();
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.invite.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
Exemple #10
0
 public function run()
 {
     list($page, $perpage, $username, $starttime, $endtime, $keyword) = $this->getInput(array('page', 'perpage', 'username', 'starttime', 'endtime', 'keyword'));
     $starttime && ($pwStartTime = Pw::str2time($starttime));
     $endtime && ($pwEndTime = Pw::str2time($endtime));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     if ($username) {
         $userinfo = $this->_getUserDs()->getUserByName($username);
         $fromUid = $userinfo['uid'] ? $userinfo['uid'] : 0;
     }
     list($count, $messages) = $this->_getMessageService()->getMessagesByUid($start, $limit, $fromUid, $pwStartTime, $pwEndTime, $keyword);
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(array('keyword' => $keyword, 'username' => $username, 'starttime' => $starttime, 'endtime' => $endtime), 'args');
     $this->setOutput($messages, 'messages');
 }
 /**
  * 清除三个月前操作
  */
 public function clearAction()
 {
     if (!$this->isFounder($this->adminUser->getUsername())) {
         $this->showError('fail');
     }
     $step = $this->getInput('step', 'post');
     if ($step != 2) {
         $this->showError('fail');
     }
     list($year, $month) = explode('-', Pw::time2str(Pw::getTime(), 'Y-n'));
     if ($month > 3) {
         $month = $month - 3;
     } else {
         $month = 9 - $month;
         $year = $year - 1;
     }
     Wekit::load('log.PwLoginLog')->clearLogBeforeDatetime(Pw::str2time($year . '-' . $month . '-1'));
     $this->showMessage('success');
 }
 /**
  * 构建禁止的对象
  * 
  * @return array
  */
 private function _buildBanDm()
 {
     Wind::import('SRV:user.dm.PwUserBanInfoDm');
     Wind::import('SRV:user.PwUserBan');
     $rightTypes = array(PwUserBan::BAN_AVATAR, PwUserBan::BAN_SIGN, PwUserBan::BAN_SPEAK);
     if ($this->banInfo->end_time > 0) {
         $this->banInfo->end_time = Pw::str2time($this->banInfo->end_time);
     }
     $data = $_notice = array();
     foreach ($this->banInfo->types as $type) {
         if (!in_array($type, $rightTypes)) {
             continue;
         }
         foreach ($this->selectBanUsers as $uid => $_item) {
             $dm = new PwUserBanInfoDm();
             $dm->setUid($uid)->setBanAllAccount($this->banInfo->ban_others)->setCreateTime(Pw::getTime())->setCreatedUid($this->loginUser->uid)->setOperator($this->loginUser->username)->setEndTime(intval($this->banInfo->end_time))->setTypeid($type)->setReason($this->banInfo->reason)->setFid(0);
             $data[] = $dm;
             isset($_notice[$uid]) || ($_notice[$uid] = array());
             $_notice[$uid]['end_time'] = $this->banInfo->end_time;
             $_notice[$uid]['reason'] = $this->banInfo->reason;
             $_notice[$uid]['type'][] = $type;
             $_notice[$uid]['operator'] = $this->loginUser->username;
         }
     }
     return array($data, $_notice);
 }
 /**
  * 允许数据更新的时间
  * 
  * @return 允许更新的开始时间,允许更新的结束时间,更新的时间
  * 
  */
 public function refreshTime($time)
 {
     $expired = $this->getCache();
     if ($expired['expired'] < 1) {
         return array($time, 0, 0);
     }
     list($y, $m, $d) = explode('-', Pw::time2str($time, 'Y-m-d'));
     $start = Pw::str2time($y . '-' . $m . '-' . $d . ' ' . $expired['start_hour'] . ':' . $expired['start_minute'] . ':0');
     if ($expired['end_hour'] < $expired['start_hour']) {
         $d++;
     }
     $end = Pw::str2time($y . '-' . $m . '-' . $d . ' ' . $expired['end_hour'] . ':' . $expired['end_minute'] . ':0');
     if ($start == $end) {
         $end += 86400;
     }
     if ($time < $start) {
         $refreshTime = $start;
     } elseif ($time > $start && $time < $end) {
         $refreshTime = $time + (int) $expired['expired'] * 60;
     } else {
         $refreshTime = $start + 86400;
     }
     return array($start, $end, $refreshTime);
 }
 public function replyAction()
 {
     $page = intval($this->getInput('page'));
     list($author, $fid, $createdTimeStart, $createdTimeEnd) = $this->getInput(array('author', 'fid', 'created_time_start', 'created_time_end'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:forum.vo.PwPostSo');
     $so = new PwPostSo();
     $so->setDisabled(1)->orderbyCreatedTime(0);
     $args = array();
     if ($author) {
         $so->setAuthor($author);
         $args['author'] = $author;
     }
     if ($fid) {
         $forum = Wekit::load('forum.PwForum')->getForum($fid);
         if ($forum['type'] != 'category') {
             $so->setFid($fid);
         } else {
             $srv = Wekit::load('forum.srv.PwForumService');
             $fids = array(0);
             $forums = $srv->getForumsByLevel($fid, $srv->getForumMap());
             foreach ($forums as $value) {
                 $fids[] = $value['fid'];
             }
             $so->setFid($fids);
         }
     }
     if ($createdTimeStart) {
         $so->setCreateTimeStart(Pw::str2time($createdTimeStart));
         $args['created_time_start'] = $createdTimeStart;
     }
     if ($createdTimeEnd) {
         $so->setCreateTimeEnd(Pw::str2time($createdTimeEnd));
         $args['created_time_end'] = $createdTimeEnd;
     }
     $count = Wekit::load('forum.PwThread')->countSearchPost($so);
     $postdb = Wekit::load('forum.PwThread')->searchPost($so, $limit, $start);
     $this->setOutput($postdb, 'postdb');
     $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumList($fid), 'forumlist');
     $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumOption($fid), 'option_html');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($args, 'args');
 }
 /**
  * 设置dm
  *
  * @return PwTaskDm
  */
 private function setDm($id)
 {
     $condition = $this->getInput('condition');
     $dm = PwTaskDmFactory::getInstance($condition['type'], $condition['child']);
     PwTaskDmFactory::addRewardDecoration($dm, $this->getInput('reward'));
     $icon = $this->saveIcon();
     $user_groups = $this->getInput('user_groups');
     $is_display_all = $this->getInput('is_display_all');
     /*如果全选用户组,则设置该用户组为-1*/
     /* @var $userGroup PwUserGroups */
     $userGroup = Wekit::load('usergroup.PwUserGroups');
     $groups = $userGroup->getAllGroups();
     if (!$user_groups || !array_diff(array_keys($groups), $user_groups)) {
         $user_groups = array(-1);
     }
     $startTime = $this->getInput('start_time');
     $endTime = $this->getInput('end_time');
     $dm->setTaskId($id)->setTitle($this->getInput('title'))->setDescription($this->getInput('description'))->setIcon($icon)->setStartTime($startTime ? Pw::str2time($startTime) : 0)->setEndTime($endTime ? Pw::str2time($endTime . ' 23:59:59') : PwTaskDm::MAXENDTIME)->setPeriod($this->getInput('period'))->setPreTask($this->getInput('pre_task'))->setUserGroups($user_groups)->setIsAuto($this->getInput('is_auto'))->setIsDisplayAll($is_display_all)->setConditions($condition);
     return $dm;
 }
Exemple #16
0
 /**
  * 设置公告结束时间
  *
  * @param int $endDate
  * @return object
  */
 public function setEndDate($endDate)
 {
     $time = $endDate ? Pw::str2time($endDate) : 9999999999;
     $this->_data['end_date'] = (int) $time;
     return $this;
 }
Exemple #17
0
 /**
  * 初始话当前用户
  */
 protected function _initUser()
 {
     $requestUri = Wind::getComponent('request')->getRequestUri();
     $_cOnlinetime = Wekit::C('site', 'onlinetime') * 60;
     if (!($lastvisit = Pw::getCookie('lastvisit'))) {
         $onlinetime = 0;
         $lastvisit = WEKIT_TIMESTAMP;
         $lastRequestUri = '';
     } else {
         list($onlinetime, $lastvisit, $lastRequestUri) = explode("\t", $lastvisit);
         ($thistime = WEKIT_TIMESTAMP - $lastvisit) < $_cOnlinetime && ($onlinetime += $thistime);
     }
     $user = $this->getLoginUser();
     if ($user->isExists()) {
         $today = Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d'));
         if ($user->info['lastvisit'] && $today > $user->info['lastvisit']) {
             /* @var $loginSrv PwLoginService */
             $loginSrv = Wekit::load('SRV:user.srv.PwLoginService');
             $loginSrv->welcome($user, Wind::getComponent('request')->getClientIp());
         } elseif (WEKIT_TIMESTAMP - $user->info['lastvisit'] > min(1800, $_cOnlinetime)) {
             Wind::import('SRV:user.dm.PwUserInfoDm');
             $dm = new PwUserInfoDm($user->uid);
             $dm->setLastvisit(WEKIT_TIMESTAMP)->setLastActiveTime(WEKIT_TIMESTAMP);
             if ($onlinetime > 0) {
                 $dm->addOnline($onlinetime > $_cOnlinetime * 1.2 ? $_cOnlinetime : $onlinetime);
             }
             Wekit::load('user.PwUser')->editUser($dm, PwUser::FETCH_DATA);
             $onlinetime = 0;
         }
     }
     Pw::setCookie('lastvisit', $onlinetime . "\t" . WEKIT_TIMESTAMP . "\t" . $requestUri, 31536000);
     $obj = new stdClass();
     $obj->lastvisit = $lastvisit;
     $obj->requestUri = $requestUri;
     $obj->lastRequestUri = $lastRequestUri;
     Wekit::setV('lastvist', $obj);
 }
Exemple #18
0
 /**
  * 设置搜索条件-搜索时间结束
  *
  * @param string $time
  * @return PwLogSo
  */
 public function setEndTime($time)
 {
     if (!($time = trim($time))) {
         return $this;
     }
     $this->_data['end_time'] = Pw::str2time($time);
     $this->_orderData['end_time'] = $time;
     return $this;
 }
Exemple #19
0
 public function replyAction()
 {
     $threaddb = $params = array();
     list($keyword, $fid, $author, $createdTimeStart, $createdTimeEnd, $operator, $operateTimeStart, $operateTimeEnd) = $this->getInput(array('keyword', 'fid', 'author', 'created_time_start', 'created_time_end', 'operator', 'operate_time_start', 'operate_time_end'));
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:recycle.vo.PwRecycleReplySo');
     $so = new PwRecycleReplySo();
     $so->orderbyCreatedTime(0);
     $url = array();
     if ($keyword) {
         $so->setKeywordOfTitle($keyword);
         $url['keyword'] = $keyword;
     }
     if ($author) {
         $so->setAuthor($author);
         $url['author'] = $author;
     }
     if ($fid) {
         $so->setFid($fid);
         $url['fid'] = $fid;
     }
     if ($createdTimeStart) {
         $so->setCreateTimeStart(Pw::str2time($createdTimeStart));
         $url['created_time_start'] = $createdTimeStart;
     }
     if ($createdTimeEnd) {
         $so->setCreateTimeEnd(Pw::str2time($createdTimeEnd));
         $url['created_time_end'] = $createdTimeEnd;
     }
     if ($operator) {
         $so->setOperator($operator);
         $url['operator'] = $operator;
     }
     if ($operateTimeStart) {
         $so->setOperatorTimeStart(Pw::str2time($operateTimeStart));
         $url['operate_time_start'] = $operateTimeStart;
     }
     if ($operateTimeEnd) {
         $so->setOperatorTimeEnd(Pw::str2time($operateTimeEnd));
         $url['operate_time_end'] = $operateTimeEnd;
     }
     $service = Wekit::load('recycle.PwReplyRecycle');
     $count = $service->countSearchRecord($so);
     $threaddb = $service->searchRecord($so);
     $this->setOutput($this->_getFroumService()->getForumList($fid), 'forumList');
     $this->setOutput($this->_getFroumService()->getForumOption($fid), 'option_html');
     $this->setOutput($threaddb, 'threaddb');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'url');
 }
 /**
  * 积分日志
  */
 public function logAction()
 {
     list($ctype, $timeStart, $timeEnd, $award) = $this->getInput(array('ctype', 'time_start', 'time_end', 'award'));
     $page = $this->getInput('page');
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($offset, $limit) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:credit.srv.PwCreditOperationConfig');
     Wind::import('SRV:credit.vo.PwCreditLogSc');
     $sc = new PwCreditLogSc();
     $url = array();
     if ($ctype) {
         $sc->setCtype($ctype);
         $url['ctype'] = $ctype;
     }
     if ($timeStart) {
         $sc->setCreateTimeStart(Pw::str2time($timeStart));
         $url['time_start'] = $timeStart;
     }
     if ($timeEnd) {
         $sc->setCreateTimeEnd(Pw::str2time($timeEnd));
         $url['time_end'] = $timeEnd;
     }
     if ($award) {
         $sc->setAward($award);
         $url['award'] = $award;
     }
     if ($sc->hasData()) {
         $sc->setUserid($this->loginUser->uid);
         $count = Wekit::load('credit.PwCreditLog')->countBySearch($sc);
         $log = Wekit::load('credit.PwCreditLog')->searchLog($sc, $limit, $offset);
     } else {
         $count = Wekit::load('credit.PwCreditLog')->countLogByUid($this->loginUser->uid);
         $log = Wekit::load('credit.PwCreditLog')->getLogByUid($this->loginUser->uid, $limit, $offset);
     }
     $this->setOutput($log, 'log');
     $this->setOutput(PwCreditBo::getInstance(), 'creditBo');
     $this->setOutput(PwCreditOperationConfig::getInstance(), 'coc');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'url');
     $this->setOutput($ctype, 'ctype');
     $this->setOutput($timeStart, 'timeStart');
     $this->setOutput($timeEnd, 'timeEnd');
     $this->setOutput($award, 'award');
     $this->setTemplate('profile_credit_log');
 }
 /** 
  * 操作用户组设置
  * 
  * @return void
  */
 public function doEditGroupAction()
 {
     $info = $this->checkUser();
     list($groupid, $groups, $endtime) = $this->getInput(array('groupid', 'groups', 'endtime'), 'post');
     /* @var $groupDs PwUserGroups */
     $groupDs = Wekit::load('usergroup.PwUserGroups');
     $banGids = array_keys($groupDs->getGroupsByType('default'));
     //默认用户组
     $clearGids = array();
     //如果用户原先的用户组是在默认组中,则该用户组不允许被修改
     if (in_array($info['groupid'], $banGids) && $info['groupid'] != $groupid) {
         switch ($info['groupid']) {
             case 6:
                 $this->showError('USER:user.belong.delban.error');
                 break;
             case 7:
                 $this->showError('USER:user.belong.delactive.error');
                 break;
             default:
                 $this->showError('USER:user.belong.default.error');
                 break;
         }
     }
     //如果用户原先的用户组是不在默认组中,新设置的用户组在默认组中,则抛错
     if (!in_array($info['groupid'], $banGids) && in_array($groupid, $banGids) && $info['groupid'] != $groupid) {
         switch ($groupid) {
             case 6:
                 $this->showError('USER:user.belong.ban.error');
                 break;
             case 7:
                 $this->showError('USER:user.belong.active.error');
                 break;
             default:
                 $this->showError('USER:user.belong.default.error');
                 break;
         }
     }
     if (($if = in_array($groupid, $banGids)) || ($r = array_intersect($banGids, $groups))) {
         $this->showError('USER:user.belong.default.error');
         // 			(!$if && $r) && $groupid = array_shift($r);
     } else {
         foreach ($groups as $value) {
             $clearGids[$value] = isset($endtime[$value]) && $endtime[$value] ? Pw::str2time($endtime[$value]) : 0;
         }
         if ($groupid == 0) {
             /* @var $userService PwUserService */
             $userService = Wekit::load('user.srv.PwUserService');
             list($groupid, $clearGids) = $userService->caculateUserGroupid($groupid, $clearGids);
         } elseif (!isset($clearGids[$groupid])) {
             $clearGids[$groupid] = 0;
         }
     }
     $oldGid = explode(',', $info['groups']);
     $info['groupid'] && array_push($oldGid, $info['groupid']);
     //总版主处理
     if (in_array(5, $oldGid) && !isset($clearGids[5])) {
         $this->showError('USER:user.forumadmin.delete.error');
     }
     if (!in_array(5, $oldGid) && isset($clearGids[5])) {
         $this->showError('USER:user.forumadmin.add.error');
     }
     Wind::import('SRV:user.dm.PwUserInfoDm');
     $dm = new PwUserInfoDm($info['uid']);
     $dm->setGroupid($groupid)->setGroups($clearGids);
     /* @var $userDs PwUser */
     $userDs = Wekit::load('user.PwUser');
     $result = $userDs->editUser($dm, PwUser::FETCH_MAIN);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     }
     /* if (in_array($groupid, $banGids)) {
     			Wekit::load('SRV:forum.srv.PwForumMiscService')->updateDataByUser($info['username']);
     		} */
     $this->showMessage('USER:update.success', 'u/manage/editGroup?uid=' . $info['uid']);
 }
 public function searchreplyAction()
 {
     list($page, $perpage, $keyword, $fid, $created_username, $created_time_start, $created_time_end, $created_userid, $created_ip, $tid) = $this->getInput(array('page', 'perpage', 'keyword', 'fid', 'created_username', 'created_time_start', 'created_time_end', 'created_userid', 'created_ip', 'tid'));
     if ($created_username) {
         $user = $this->_getUserDs()->getUserByName($created_username);
         if (!$user) {
             $this->showError('USER:username.empty');
         }
         if ($created_userid) {
             $created_userid != $user['uid'] && $this->showError('USER:username.notequal.uid');
         }
         $created_userid = $user['uid'];
     }
     // dm条件
     Wind::import('SRV:forum.vo.PwPostSo');
     $dm = new PwPostSo();
     $dm->setDisabled(0)->orderbyCreatedTime(false);
     $keyword && $dm->setKeywordOfTitleOrContent($keyword);
     if ($fid) {
         $forum = Wekit::load('forum.PwForum')->getForum($fid);
         if ($forum['type'] != 'category') {
             $dm->setFid($fid);
         } else {
             $srv = Wekit::load('forum.srv.PwForumService');
             $fids = array(0);
             $forums = $srv->getForumsByLevel($fid, $srv->getForumMap());
             foreach ($forums as $value) {
                 $fids[] = $value['fid'];
             }
             $dm->setFid($fids);
         }
     }
     $created_userid && $dm->setAuthorId($created_userid);
     $created_time_start && $dm->setCreateTimeStart(Pw::str2time($created_time_start));
     $created_time_end && $dm->setCreateTimeEnd(Pw::str2time($created_time_end));
     $tid && $dm->setTid($tid);
     $created_ip && $dm->setCreatedIp($created_ip);
     $count = $this->_getThreadDs()->countSearchPost($dm);
     if ($count) {
         $page = $page ? $page : 1;
         $perpage = $perpage ? $perpage : $this->perpage;
         list($start, $limit) = Pw::page2limit($page, $perpage);
         $posts = $this->_getThreadDs()->searchPost($dm, $limit, $start);
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(array('keyword' => $keyword, 'created_username' => $created_username, 'created_time_start' => $created_time_start, 'created_time_end' => $created_time_end, 'fid' => $fid, 'created_userid' => $created_userid, 'created_ip' => $created_ip, 'tid' => $tid), 'args');
     $this->setOutput($this->_getFroumService()->getForumList($fid), 'forumList');
     $this->setOutput($this->_getFroumService()->getForumOption($fid), 'option_html');
     $this->setOutput($posts, 'posts');
 }
 /**
  * 积分日志页面
  */
 public function logAction()
 {
     list($ctype, $time_start, $time_end, $award, $username, $uid) = $this->getInput(array('ctype', 'time_start', 'time_end', 'award', 'username', 'uid'));
     $page = $this->getInput('page');
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($offset, $limit) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:credit.bo.PwCreditBo');
     Wind::import('SRV:credit.vo.PwCreditLogSc');
     Wind::import('SRV:credit.srv.PwCreditOperationConfig');
     $sc = new PwCreditLogSc();
     $url = array();
     if ($ctype) {
         $sc->setCtype($ctype);
         $url['ctype'] = $ctype;
     }
     if ($time_start) {
         $sc->setCreateTimeStart(Pw::str2time($time_start));
         $url['time_start'] = $time_start;
     }
     if ($time_end) {
         $sc->setCreateTimeEnd(Pw::str2time($time_end));
         $url['time_end'] = $time_end;
     }
     if ($award) {
         $sc->setAward($award);
         $url['award'] = $award;
     }
     if ($username) {
         $user = Wekit::load('user.PwUser')->getUserByName($username);
         $sc->setUserid($user['uid']);
         // 			$url['uid'] = $user['uid'];
         $url['username'] = $username;
     }
     if ($uid) {
         $sc->setUserid($uid);
         $url['uid'] = $uid;
     }
     $count = Wekit::load('credit.PwCreditLog')->countBySearch($sc);
     $log = Wekit::load('credit.PwCreditLog')->searchLog($sc, $limit, $offset);
     $this->setCurrentTab('log');
     $this->setOutput(PwCreditBo::getInstance(), 'creditBo');
     $this->setOutput(PwCreditOperationConfig::getInstance(), 'coc');
     $this->setOutput($log, 'log');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'args');
 }
Exemple #24
0
 public function replyAction()
 {
     $page = intval($this->getInput('page'));
     list($author, $fid, $createdTimeStart, $createdTimeEnd) = $this->getInput(array('author', 'fid', 'created_time_start', 'created_time_end'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:forum.vo.PwPostSo');
     $so = new PwPostSo();
     $so->setDisabled(1)->orderbyCreatedTime(0);
     $url = array();
     if ($author) {
         $so->setAuthor($author);
         $url['author'] = $author;
     }
     if ($fid) {
         $so->setFid($fid);
         $url['fid'] = $fid;
     }
     if ($createdTimeStart) {
         $so->setCreateTimeStart(Pw::str2time($createdTimeStart));
         $url['created_time_start'] = $createdTimeStart;
     }
     if ($createdTimeEnd) {
         $so->setCreateTimeEnd(Pw::str2time($createdTimeEnd));
         $url['created_time_end'] = $createdTimeEnd;
     }
     $count = Wekit::load('forum.PwThread')->countSearchPost($so);
     $postdb = Wekit::load('forum.PwThread')->searchPost($so, $limit, $start);
     $this->setOutput($postdb, 'postdb');
     $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumOption($fid), 'option_html');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'url');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     PwSeoBo::setCustomSeo($lang->getMessage('SEO:manage.content.reply.title'), '', '');
 }
Exemple #25
0
 /** 
  * 编辑用户信息操作
  * 
  * @return voido
  */
 public function doEditAction()
 {
     $uid = (int) $this->getInput('uid', 'post');
     if (!$uid) {
         $this->showError('WINDID:fail');
     }
     Wind::import('WINDID:service.user.dm.WindidUserDm');
     $dm = new WindidUserDm($uid);
     //用户信息
     $dm->setUsername($this->getInput('username', 'post'));
     list($password, $repassword) = $this->getInput(array('password', 'repassword'), 'post');
     if ($password) {
         if ($password != $repassword) {
             $this->showError('USER:user.error.-20');
         }
         $dm->setPassword($password);
     }
     $dm->setEmail($this->getInput('email', 'post'));
     list($question, $answer) = $this->getInput(array('question', 'answer'), 'post');
     switch ($question) {
         case '-2':
             $dm->setQuestion('', '');
             break;
         case '-1':
         default:
             break;
     }
     $dm->setRegdate(Pw::str2time($this->getInput('regdate', 'post')));
     $dm->setRegip($this->getInput('regip', 'post'));
     //基本资料
     $dm->setRealname($this->getInput('realname', 'post'));
     $dm->setGender($this->getInput('gender', 'post'));
     $birthday = $this->getInput('birthday', 'post');
     if ($birthday) {
         $bir = explode('-', $birthday);
         isset($bir[0]) && $dm->setByear($bir[0]);
         isset($bir[1]) && $dm->setBmonth($bir[1]);
         isset($bir[2]) && $dm->setBday($bir[2]);
     } else {
         $dm->setBday('')->setByear('')->setBmonth('');
     }
     list($hometown, $location) = $this->getInput(array('hometown', 'location'), 'post');
     /* @var $srv PwAreaService */
     $srv = Wekit::load('area.srv.PwAreaService');
     $areas = $srv->fetchAreaInfo(array($hometown, $location));
     $dm->setLocation($location, isset($areas[$location]) ? $areas[$location] : '');
     $dm->setHometown($hometown, isset($areas[$hometown]) ? $areas[$hometown] : '');
     $dm->setHomepage($this->getInput('homepage', 'post'));
     $dm->setProfile($this->getInput('profile', 'post'));
     //交易信息
     $dm->setAlipay($this->getInput('alipay', 'post'));
     $dm->setMobile($this->getInput('mobile', 'post'));
     //联系信息
     $dm->setEmail($this->getInput('email', 'post'));
     $dm->setAliww($this->getInput('aliww', 'post'));
     $dm->setQq($this->getInput('qq', 'post'));
     $dm->setMsn($this->getInput('msn', 'post'));
     $ds = Windid::load('user.WindidUser');
     $result = $ds->editUser($dm);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     }
     $srv = Windid::load('notify.srv.WindidNotifyClient');
     $srv->send('202', $dm->getData(), true);
     $this->showMessage('WINDID:success', 'windid/user/edit?uid=' . $uid);
 }
 public function doaddAction()
 {
     $pageid = (int) $this->getInput('pageid', 'post');
     $moduleid = (int) $this->getInput('moduleid', 'post');
     $isnotice = (int) $this->getInput('isnotice', 'post');
     $fromid = (int) $this->getInput('fromid', 'post');
     $fromtype = $this->getInput('fromtype', 'post');
     $start = $this->getInput('start_time', 'post');
     $end = $this->getInput('end_time', 'post');
     /* 增加推送帖子到移动版start */
     if ($pageid === 0 && $moduleid === 0) {
         //推送移动端热帖
         $tid = (int) $this->getInput('tid');
         $tid || $this->showError("operate.fail");
         //                    $this->forwardRedirect(WindUrlHelper::createUrl('native/dynamic/sethot'));
         $threadsWeightDao = Wekit::loadDao('native.dao.PwThreadsWeightDao');
         //获取帖子最高权重,将其作为管理员推送帖子的初始权重置顶
         $weightData = $threadsWeightDao->getMaxWeight();
         isset($weightData['weight']) ? $max_weight = intval($weightData['weight']) + 1 : 1;
         //
         $data = array('create_time' => time(), 'weight' => $max_weight, 'create_userid' => $this->loginUser->uid, 'create_username' => $this->loginUser->username, 'tid' => $tid);
         $threadWeight = $threadsWeightDao->getByTid($tid);
         if ($threadWeight) {
             //更新数据
             $res = $threadsWeightDao->updateValue($data);
         } else {
             //新增数据
             $res = $threadsWeightDao->insertValue($data);
         }
         if ($res) {
             $thread = Wekit::load('forum.PwThread')->getThread($tid);
             $push_msg = '《' . $thread['subject'] . '》已被推荐热贴';
             Wekit::load("APPS:native.service.PwLaiWangSerivce");
             PwLaiWangSerivce::pushMessage($thread['created_userid'], $push_msg, $push_msg);
             //
             $this->showMessage('NATIVE:sethot.success');
         } else {
             $this->showMessage('NATIVE:sethot.failed');
         }
     }
     /* 增加推送帖子到移动版end */
     if ($moduleid < 1) {
         $this->showError("operate.fail");
     }
     $permiss = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid, $pageid);
     $pushService = $this->_getPushService();
     $data = $pushService->getDataByFromid($fromtype, $fromid);
     Wind::import('SRV:design.bo.PwDesignModuleBo');
     $bo = new PwDesignModuleBo($moduleid);
     $time = Pw::getTime();
     $startTime = $start ? Pw::str2time($start) : $time;
     $endTime = $end ? Pw::str2time($end) : $end;
     if ($end && $endTime < $time) {
         $this->showError("DESIGN:endtimd.error");
     }
     $pushDs = $this->_getPushDs();
     Wind::import('SRV:design.dm.PwDesignPushDm');
     $dm = new PwDesignPushDm();
     $dm->setFromid($fromid)->setModuleId($moduleid)->setCreatedUserid($this->loginUser->uid)->setCreatedTime($time)->setStartTime($startTime)->setEndTime($endTime)->setAuthorUid($data['uid']);
     if ($isnotice) {
         $dm->setNeedNotice(1);
     }
     if ($permiss <= PwDesignPermissions::NEED_CHECK) {
         $dm->setStatus(PwDesignPush::NEEDCHECK);
         $isdata = false;
     } else {
         $isdata = true;
     }
     $resource = $pushService->addPushData($dm);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     if ($isdata) {
         $pushService->pushToData((int) $resource);
         $pushService->afterPush((int) $resource);
     }
     $this->showMessage("operate.success");
 }
 private function _getBehavior($time, $number)
 {
     $time = $time + 86400 * 2;
     $time = Pw::str2time(Pw::time2str($time, 'Y-m-d'));
     if ($time > 0 && $time < Pw::getTime()) {
         $number = 0;
     }
     return $number;
 }
Exemple #28
0
 /**
  * 设置禁止结束的时间
  * 
  * @param string $end_time
  * @return PwUserBanSo
  */
 public function setEndTime($end_time)
 {
     $this->argsUrl['end_time'] = $end_time;
     $this->data['end_time'] = $end_time ? Pw::str2time($end_time) : '';
     return $this;
 }
 /**
  * 回收站-回复
  */
 public function replyAction()
 {
     $threaddb = $params = array();
     list($keyword, $fid, $author, $createdTimeStart, $createdTimeEnd, $operator, $operateTimeStart, $operateTimeEnd) = $this->getInput(array('keyword', 'fid', 'author', 'created_time_start', 'created_time_end', 'operator', 'operate_time_start', 'operate_time_end'));
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:recycle.vo.PwRecycleReplySo');
     $so = new PwRecycleReplySo();
     $so->orderbyCreatedTime(0);
     $url = array();
     if ($keyword) {
         $so->setKeywordOfTitle($keyword);
         $url['keyword'] = $keyword;
     }
     if ($author) {
         $so->setAuthor($author);
         $url['author'] = $author;
     }
     if ($fid) {
         $so->setFid($fid);
         $url['fid'] = $fid;
     }
     if ($createdTimeStart) {
         $so->setCreateTimeStart(Pw::str2time($createdTimeStart));
         $url['created_time_start'] = $createdTimeStart;
     }
     if ($createdTimeEnd) {
         $so->setCreateTimeEnd(Pw::str2time($createdTimeEnd));
         $url['created_time_end'] = $createdTimeEnd;
     }
     if ($operator) {
         $so->setOperator($operator);
         $url['operator'] = $operator;
     }
     if ($operateTimeStart) {
         $so->setOperatorTimeStart(Pw::str2time($operateTimeStart));
         $url['operate_time_start'] = $operateTimeStart;
     }
     if ($operateTimeEnd) {
         $so->setOperatorTimeEnd(Pw::str2time($operateTimeEnd));
         $url['operate_time_end'] = $operateTimeEnd;
     }
     $service = Wekit::load('recycle.PwReplyRecycle');
     $count = $service->countSearchRecord($so);
     $threaddb = $service->searchRecord($so);
     $this->setOutput($threaddb, 'threaddb');
     $this->setOutput(Wekit::load('forum.srv.PwForumService')->getForumOption($fid), 'option_html');
     $this->setOutput(Wekit::load('forum.PwForum')->getForumList(), 'forumname');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'url');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:manage.recycle.reply.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 /**
  * 用户(每天)的行为,次日重新计数 | $num幅度
  * 
  * @param int $uid
  * @param string $behavior
  * @param int $time
  */
 public function replaceDayNumBehavior($uid, $behavior, $time, $num = 1)
 {
     if ($uid < 1 || !$behavior || $time < 0) {
         return false;
     }
     $number = $num ? $num : 1;
     $yesterday = Pw::str2time(Pw::time2str($time, 'Y-m-d'));
     $expired = $yesterday + 86400;
     $info = $this->getBehavior($uid, $behavior);
     if ($info) {
         $_time = (int) $info['extend_info'];
         $number = (int) $info['number'];
         if ($_time >= $yesterday) {
             $number = $number + $num;
         }
     }
     $data['uid'] = $uid;
     $data['behavior'] = $behavior;
     $data['number'] = $number;
     $data['extend_info'] = $time;
     $data['expired_time'] = $expired;
     if ($this->_getdao()->replaceInfo($data)) {
         return $number;
     }
 }