public function top() { $id = request::getParam('menuid', 0); $menuList = $this->adminMenuObj->getChildMenuByIdCache($id); $adminUserObj = new adminUserModel(); $adminId = utils::getSessionVal('user'); $adminUserInfo = $adminUserObj->find($adminId); $adminGroup = $adminUserObj->group; $nowTime = time(); $data = array('menuList' => $menuList, 'nowTime' => $nowTime, 'adminUser' => $adminUserInfo, 'adminGroup' => $adminGroup); $this->setView($data); }
public function grid() { $this->actionMenu = array(array('name' => '添加社区', 'url' => utils::getUrl('admin/home/add/' . base64_encode($this->url)))); $this->menuTitle = '社区管理列表'; $page = request::getParam('page', 1); $pageSize = request::getParam('pageSize', 10); $tableParam = array('page' => $page, 'pageSize' => $pageSize, 'isCount' => true); $homeList = $this->homeModel->select($tableParam); $pageObj = new page(); $pageStr = $pageObj->showpage($homeList['count'], $page, $pageSize); $data = array('homeList' => $homeList, 'pageStr' => $pageStr); $this->setView($data); }
public function grid() { $this->menuTitle = '店铺列表'; $page = request::getParam('page', 1); $pageSize = request::getParam('pagesize', 20); $shopParam = array('page' => $page, 'pageSize' => $pageSize, 'isCount' => true); $shopList = $this->shopObj->select($shopParam); //获取店铺类型 $shopTypeObj = new shopTypeModel(); $shopTypeList = $shopTypeObj->getAllShopType(); $pageObj = new page(); $pageStr = $pageObj->showpage($shopList['count'], $page, $pageSize); $data = array('shopList' => $shopList, 'shopTypeList' => $shopTypeList, 'pageStr' => $pageStr); $this->setView($data); }
public function detail() { $this->menuTitle = '用户详情'; $backurl = request::getParam('backurl'); $this->actionMenu = array(array('name' => '返回', 'url' => base64_decode($backurl))); $userId = request::getParam('id'); $userService = utils::getService('user'); $userInfo = $userService->getUserInfoById($userId); $userExtService = utils::getService('userExt'); $userExtInfo = $userExtService->getUserExtInfoByUserId($userId); $userAllType = $userService->utype; $userAllStatus = $userService->pstatus; $data = array('userInfo' => $userInfo, 'userExtInfo' => $userExtInfo, 'userAllType' => $userAllType, 'userAllStatus' => $userAllStatus, 'backurl' => $backurl); $this->setView($data); }
public function grid() { $this->actionMenu = array(array('name' => '所有订单', 'url' => utils::getUrl('admin/order/grid/'))); $this->menuTitle = '订单管理'; $page = request::getParam('page', 1); $pageSize = request::getParam('pageSize', 20); $tableParam = array('page' => $page, 'pageSize' => $pageSize, 'isCount' => true); $orderResult = $this->orderObj->select($tableParam); $pageObj = new page(); $pageStr = $pageObj->showpage($orderResult['count'], $page, $pageSize); $payStatusArr = orderService::$orderPayStatus; $orderStatusArr = orderService::$orderStatus; $data = array('orderResult' => $orderResult, 'payStatusArr' => $payStatusArr, 'orderStatusArr' => $orderStatusArr, 'pageStr' => $pageStr); $this->setView($data); }
public function grid() { $page = request::getParam('page', 1); $pageSize = request::getParam('pagesize', 20); $pageObj = new page(); $whereParam = array('page' => $page, 'pageSize' => $pageSize, 'isCount' => true); $applicationList = $this->userApplicationObj->select($whereParam); if ($applicationList) { $userObj = new userModel(); foreach ($applicationList['resultList'] as &$appUser) { $userInfo = $userObj->find($appUser['user_id']); $appUser['userInfo'] = $userInfo; } } $pageStr = $pageObj->showpage($applicationList['count'], $page, $pageSize); $businessAppService = utils::getService('businessApp'); $pstatusList = $businessAppService->status; $data = array('pageStr' => $pageStr, 'applicationList' => $applicationList['resultList'], 'pstatusList' => $pstatusList); $this->setView($data); }
public function ajaxGetChild() { $id = request::getParam('id'); $addressList = $this->addressObj->getChildAddressByIdCache($id); utils::resposeJson(array('code' => 200, 'mobileaddress' => $addressList)); }
/** * Store new paste or comment * * POST contains one or both: * data = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct) * attachment = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct) * * All optional data will go to meta information: * expire (optional) = expiration delay (never,5min,10min,1hour,1day,1week,1month,1year,burn) (default:never) * formatter (optional) = format to display the paste as (plaintext,syntaxhighlighting,markdown) (default:syntaxhighlighting) * burnafterreading (optional) = if this paste may only viewed once ? (0/1) (default:0) * opendiscusssion (optional) = is the discussion allowed on this paste ? (0/1) (default:0) * attachmentname = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct) * nickname (optional) = in discussion, encoded SJCL encrypted text nickname of author of comment (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct) * parentid (optional) = in discussion, which comment this comment replies to. * pasteid (optional) = in discussion, which paste this comment belongs to. * * @access private * @return string */ private function _create() { $error = false; // Ensure last paste from visitors IP address was more than configured amount of seconds ago. trafficlimiter::setConfiguration($this->_conf); if (!trafficlimiter::canPass()) { return $this->_return_message(1, i18n::_('Please wait %d seconds between each post.', $this->_conf->getKey('limit', 'traffic'))); } $data = $this->_request->getParam('data'); $attachment = $this->_request->getParam('attachment'); $attachmentname = $this->_request->getParam('attachmentname'); // Ensure content is not too big. $sizelimit = $this->_conf->getKey('sizelimit'); if (strlen($data) + strlen($attachment) + strlen($attachmentname) > $sizelimit) { return $this->_return_message(1, i18n::_('Paste is limited to %s of encrypted data.', filter::size_humanreadable($sizelimit))); } // The user posts a comment. $pasteid = $this->_request->getParam('pasteid'); $parentid = $this->_request->getParam('parentid'); if (!empty($pasteid) && !empty($parentid)) { $paste = $this->_model->getPaste($pasteid); if ($paste->exists()) { try { $comment = $paste->getComment($parentid); $nickname = $this->_request->getParam('nickname'); if (!empty($nickname)) { $comment->setNickname($nickname); } $comment->setData($data); $comment->store(); } catch (Exception $e) { return $this->_return_message(1, $e->getMessage()); } $this->_return_message(0, $comment->getId()); } else { $this->_return_message(1, 'Invalid data.'); } } else { $paste = $this->_model->getPaste(); try { $paste->setData($data); if (!empty($attachment)) { $paste->setAttachment($attachment); if (!empty($attachmentname)) { $paste->setAttachmentName($attachmentname); } } $expire = $this->_request->getParam('expire'); if (!empty($expire)) { $paste->setExpiration($expire); } $burnafterreading = $this->_request->getParam('burnafterreading'); if (!empty($burnafterreading)) { $paste->setBurnafterreading($burnafterreading); } $opendiscussion = $this->_request->getParam('opendiscussion'); if (!empty($opendiscussion)) { $paste->setOpendiscussion($opendiscussion); } $formatter = $this->_request->getParam('formatter'); if (!empty($formatter)) { $paste->setFormatter($formatter); } $paste->store(); } catch (Exception $e) { return $this->_return_message(1, $e->getMessage()); } $this->_return_message(0, $paste->getId(), array('deletetoken' => $paste->getDeleteToken())); } }
public function testApiDelete() { $this->reset(); $_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['QUERY_STRING'] = 'foo'; $_POST['deletetoken'] = 'bar'; $request = new request(); $this->assertTrue($request->isJsonApiCall(), 'is JSON Api call'); $this->assertEquals('delete', $request->getOperation()); $this->assertEquals('foo', $request->getParam('pasteid')); $this->assertEquals('bar', $request->getParam('deletetoken')); }
/** * Store new paste or comment * * POST contains one or both: * data = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct) * attachment = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct) * * All optional data will go to meta information: * expire (optional) = expiration delay (never,5min,10min,1hour,1day,1week,1month,1year,burn) (default:never) * formatter (optional) = format to display the paste as (plaintext,syntaxhighlighting,markdown) (default:syntaxhighlighting) * burnafterreading (optional) = if this paste may only viewed once ? (0/1) (default:0) * opendiscusssion (optional) = is the discussion allowed on this paste ? (0/1) (default:0) * attachmentname = json encoded SJCL encrypted text (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct) * nickname (optional) = in discussion, encoded SJCL encrypted text nickname of author of comment (containing keys: iv,v,iter,ks,ts,mode,adata,cipher,salt,ct) * parentid (optional) = in discussion, which comment this comment replies to. * pasteid (optional) = in discussion, which paste this comment belongs to. * * @access private * @return string */ private function _create() { // Ensure last paste from visitors IP address was more than configured amount of seconds ago. TrafficLimiter::setConfiguration($this->_conf); if (!TrafficLimiter::canPass()) { return $this->_return_message(1, I18n::_('Please wait %d seconds between each post.', $this->_conf->getKey('limit', 'traffic'))); } $data = $this->_request->getParam('data'); $attachment = $this->_request->getParam('attachment'); $attachmentname = $this->_request->getParam('attachmentname'); // Ensure content is not too big. $sizelimit = $this->_conf->getKey('sizelimit'); if (strlen($data) + strlen($attachment) + strlen($attachmentname) > $sizelimit) { return $this->_return_message(1, I18n::_('Paste is limited to %s of encrypted data.', Filter::formatHumanReadableSize($sizelimit))); } // Ensure attachment did not get lost due to webserver limits or Suhosin if (strlen($attachmentname) > 0 && strlen($attachment) == 0) { return $this->_return_message(1, 'Attachment missing in data received by server. Please check your webserver or suhosin configuration for maximum POST parameter limitations.'); } // The user posts a comment. $pasteid = $this->_request->getParam('pasteid'); $parentid = $this->_request->getParam('parentid'); if (!empty($pasteid) && !empty($parentid)) { $paste = $this->_model->getPaste($pasteid); if ($paste->exists()) { try { $comment = $paste->getComment($parentid); $nickname = $this->_request->getParam('nickname'); if (!empty($nickname)) { $comment->setNickname($nickname); } $comment->setData($data); $comment->store(); } catch (Exception $e) { return $this->_return_message(1, $e->getMessage()); } $this->_return_message(0, $comment->getId()); } else { $this->_return_message(1, 'Invalid data.'); } } else { $this->_model->purge(); $paste = $this->_model->getPaste(); try { $paste->setData($data); if (!empty($attachment)) { $paste->setAttachment($attachment); if (!empty($attachmentname)) { $paste->setAttachmentName($attachmentname); } } $expire = $this->_request->getParam('expire'); if (!empty($expire)) { $paste->setExpiration($expire); } $burnafterreading = $this->_request->getParam('burnafterreading'); if (!empty($burnafterreading)) { $paste->setBurnafterreading($burnafterreading); } $opendiscussion = $this->_request->getParam('opendiscussion'); if (!empty($opendiscussion)) { $paste->setOpendiscussion($opendiscussion); } $formatter = $this->_request->getParam('formatter'); if (!empty($formatter)) { $paste->setFormatter($formatter); } $paste->store(); } catch (Exception $e) { return $this->_return_message(1, $e->getMessage()); } $this->_return_message(0, $paste->getId(), array('deletetoken' => $paste->getDeleteToken())); } }