示例#1
0
 function pagecategory($inPath)
 {
     $url = $this->getUrlParams($inPath);
     $catid = (int) $url['catid'] > 0 ? (int) $url['catid'] : (int) $_POST['cat_id'];
     $categoryObj = new m_category($catid);
     $this->params['categorylist'] = $categoryObj->getOrderCate('    ');
     if ($_POST) {
         $post = base_Utils::shtmlspecialchars($_POST);
         if ($catid) {
             if ($categoryObj->isErrorPid($post['pid'], $post['cat_id']) === false) {
                 $this->ShowMsg("不能将父分类修改为它的子分类");
             }
             if ($categoryObj->create($post)) {
                 $this->ShowMsg("修改成功!", $this->createUrl("/category/index"), '', 1);
             }
             $this->ShowMsg("修改失败" . $categoryObj->getError());
         } else {
             if ($categoryObj->isHasPid($post['pid']) === false) {
                 $this->ShowMsg("你选择的上级分类不存在");
             }
             if ($categoryObj->create($post)) {
                 $this->ShowMsg("添加成功!", $this->createUrl("/category/index"), '', 1);
             }
             $this->ShowMsg("添加失败,原因:" . $categoryObj->getError());
         }
     } else {
         if ($catid) {
             $this->params['category'] = $categoryObj->get();
         }
         return $this->render('category/category.html', $this->params);
     }
 }
示例#2
0
 function pageaddmember($inPath)
 {
     $url = $this->getUrlParams($inPath);
     $mid = (int) $url['mid'] > 0 ? (int) $url['mid'] : (int) $_POST['mid'];
     $memberObj = new m_member($mid);
     if ($_POST) {
         $post = base_Utils::shtmlspecialchars($_POST);
         if ($mid) {
             if ($memberObj->create($post)) {
                 $this->ShowMsg("修改成功!", $this->createUrl("/member/index"), '', 1);
             }
             $this->ShowMsg("修改失败" . $memberObj->getError());
         } else {
             if ($memberObj->create($post)) {
                 $this->ShowMsg("添加成功!", $this->createUrl("/member/index"), '', 1);
             }
             $this->ShowMsg("添加失败,原因:" . $memberObj->getError());
         }
     } else {
         if ($mid) {
             $this->params['member'] = $memberObj->get();
         }
         $mbgroupObj = new m_mbgroup();
         $this->params['group'] = $mbgroupObj->select()->items;
         return $this->render('member/addmember.html', $this->params);
     }
 }
示例#3
0
 function pagelogin($inPath)
 {
     $kv = new SaeKV();
     $ret = $kv->init();
     if (!$ret) {
         $this->ShowMsg("你没有初始化KVDB!");
     }
     if (!file_exists('saekv://' . $_SERVER['HTTP_APPVERSION'] . '/install.lock')) {
         $this->ShowMsg("你还没有安装smpss!", base_Constant::ROOT_DIR . '/install/index.php');
     }
     $urlParams = $this->getUrlParams($inPath);
     if (!$_POST) {
         $this->params['head_title'] = "管理登录-" . $this->params['head_title'];
         return $this->render("main/login.html", $this->params);
     } else {
         $_POST = base_Utils::shtmlspecialchars($_POST);
         //session_start();
         //if(!SCaptcha::check($_POST['captcha'])){
         $modelAdmin = new m_admin();
         $loginInfo = $modelAdmin->checkLogin($_POST['username'], $_POST['pwd'], (int) $_POST['timeout']);
         if ($loginInfo) {
             $this->redirect($this->createUrl('/'));
         } else {
             $this->ShowMsg("用户名或者密码错误!");
         }
         //}else{
         //$this->ShowMsg("验证码错误!");
         //}
     }
 }
示例#4
0
 function pageaddgoods($inPath)
 {
     $url = $this->getUrlParams($inPath);
     $goods_id = (int) $url['gid'] > 0 ? (int) $url['gid'] : (int) $_POST['goods_id'];
     $goodsObj = new m_goods($goods_id);
     if ($_POST) {
         $post = base_Utils::shtmlspecialchars($_POST);
         if ($goodsObj->create($post)) {
             base_Utils::ssetcookie(array('cat_id' => $post['cat_id']));
             $this->ShowMsg("操作成功!", $this->createUrl("/goods/addgoods"), 2, 1);
         }
         $this->ShowMsg("操作失败" . $goodsObj->getError());
     }
     $categoryObj = new m_category();
     $this->params['cat_id'] = (int) $_COOKIE['cat_id'];
     $this->params['catelist'] = $categoryObj->getOrderCate('    ');
     $this->params['goods'] = $goodsObj->selectOne("goods_id={$goods_id}");
     return $this->render('goods/addgoods.html', $this->params);
 }
示例#5
0
 function pagemodifypwd($inPath)
 {
     $admin_id = (int) $_COOKIE['admin_id'];
     if ($_POST) {
         $adminObj = new m_admin();
         $post = base_Utils::shtmlspecialchars($_POST);
         $resPwd = $adminObj->get("admin_id = {$admin_id}", 'admin_pwd');
         if ($resPwd['admin_pwd'] == md5($post['old_pwd']) and $post['new_pwd'] == $post['new_pwd2'] and $post['new_pwd']) {
             $pwd = md5($post['new_pwd']);
             $rs = $adminObj->update("admin_id = {$admin_id}", "admin_pwd = '{$pwd}'");
             if ($rs) {
                 $this->ShowMsg('修改成功', $this->createUrl('/account/modifypwd'), '', 1);
             } else {
                 $this->ShowMsg('修改失败,请重试!错误原因:' . $adminObj->getError());
             }
         } else {
             $this->ShowMsg('原密码错误或者两次新密码不一致!');
         }
     }
     return $this->render('account/modifypwd.html', $this->params);
 }
示例#6
0
 function pagelogin($inPath)
 {
     $urlParams = $this->getUrlParams($inPath);
     if (!$_POST) {
         $this->params['head_title'] = "管理登录-" . $this->params['head_title'];
         return $this->render("main/login.html", $this->params);
     } else {
         $_POST = base_Utils::shtmlspecialchars($_POST);
         //session_start();
         if (!SCaptcha::check($_POST['captcha'])) {
             $modelAdmin = new m_admin();
             $loginInfo = $modelAdmin->checkLogin($_POST['username'], $_POST['pwd'], (int) $_POST['timeout']);
             if ($loginInfo) {
                 $this->redirect($this->createUrl('/'));
             } else {
                 $this->ShowMsg("用户名或者密码错误!");
             }
         } else {
             $this->ShowMsg("验证码错误!");
         }
     }
 }
示例#7
0
 private function creatRights($post)
 {
     $post = (array) base_Utils::shtmlspecialchars($post);
     $action = $menu = array();
     foreach ($post as $key => $val) {
         if (in_array($key, array('system', 'account', 'member', 'category', 'goods', 'purchase', 'sales', 'statistics'))) {
             $_temp = array();
             foreach ($val as $v) {
                 $vArr = explode(':', $v);
                 $_temp[$vArr[1]] = $vArr[0];
                 $action[] = $key . '_' . $vArr[1];
             }
             $menu[$key] = $_temp;
         }
     }
     return serialize(array('all' => 0, 'action' => $action, 'menu' => $menu));
 }