public function main() { switch ($_GET['action']) { case "add": $this->add(); break; case "show": $this->show(); break; case "state": $this->state(); break; case "deleteAll": $this->deleteAll(); break; case "delete": $this->delete(); break; case "update": $this->update(); break; } if (Tools::isSession("username")) { header("Location:index.php?a=admin&action=admin_login"); } $permission = new permissionModel(); $data = $permission->getPID("广告管理"); if (!strstr($_SESSION['oneAdmin']->permission, $data->id)) { exit("权限不够"); } $this->smarty->display("admin/ad.html"); }
public function updateDownloadNum() { if (Tools::isSession("oneUser")) { $this->smarty->display("home/download.html"); Tools::Redirect("只有本站注册会员才可以下载", "?", 2, 1); return false; } $this->model->id = $_GET['id']; $this->model->updateDownloadNum(); header("location:public/uploads/download/" . $_GET['name']); }
public function main() { switch ($_GET['action']) { case "catalogoue": $this->catalogoue(); break; case "func": $this->func(); break; case "feature": $this->feature(); break; } if (Tools::isSession("username")) { header("Location:index.php?a=admin&action=admin_login"); } $this->smarty->display("admin/readme.html"); }
public function main() { //Tools::dump($this->model->getAllSubject()); switch ($_GET['action']) { case "addMainNav": $this->addMainNav(); break; case "addSubNav": $this->addSubNav(); break; case "showMainNav": $this->showMainNav(); break; case "showSubNav": $this->showSubNav(); break; case "state": $this->state(); break; case "delete": $this->delete(); break; case "update": $this->update(); break; case "deleteAll": $this->deleteAll(); break; } if (Tools::isSession("username")) { header("Location:index.php?a=admin&action=admin_login"); } $permission = new permissionModel(); $data = $permission->getPID("导航管理"); if (!strstr($_SESSION['oneAdmin']->permission, $data->id)) { exit("权限不够"); } $this->smarty->display("admin/nav.html"); }
public function main() { //Tools::dump($_SESSION); switch ($_GET['action']) { case "admin_login": $this->admin_login(); break; case "logout": $this->logout(); break; case "setAdmin_login": $this->setAdmin_login(); break; case "welcome": $this->welcome(); break; } if (Tools::isSession("username")) { header("Location:index.php?a=index&action=admin_login"); exit; } $this->smarty->display("admin/index.html"); }
private function cart() { $product = new productModel(); if (Tools::isSession("oneUser")) { Tools::Redirect("只有注册会员才可以购买", "?", 2, 1); return false; } if (isset($_POST['send'])) { $product->id = $_POST["id"]; $oneProduct = $product->getOneProduct(); $oneProduct->num = 1; if (isset($_SESSION['cart'][$oneProduct->id])) { //id号是cart下的一件商品; $_SESSION['cart'][$oneProduct->id]->num++; } else { //以商品的id为键名保存的对象 $_SESSION['cart'][$oneProduct->id] = $oneProduct; } } $cart = $_SESSION['cart']; $this->smarty->assign("cart", $cart); $sum = 0; foreach ($cart as $k => $v) { $sum += $v->price * $v->num; } $this->smarty->assign("sum", $sum); $_SESSION['sum'] = $sum; //Tools::dump($_POST); //Tools::dump($_SESSION); }
private function detail() { if (Tools::isSession("oneUser")) { Tools::Redirect("只有注册会员才可以回复", "?", 2, 1); } if ($_GET['id']) { $user = new userModel(); $this->model->id = $_GET["id"]; $oneAsk = $this->model->getOneAsk(); //Tools::dump($oneAsk); //Tools::dump($this->model->getAllAnswersTotal()); parent::page($this->model->getAllAnswersTotal()); //$AllAnswers=$this->model->getAllAnswers(); $data = $this->model->getAllAnswers(); //Tools::dump($data); foreach ($data as $key => $value) { $user->id = $value->aid; $oneUser = $user->getOneUserByID(); //Tools::dump($oneUser); $value->username = $oneUser->username; $value->icon = $oneUser->icon; } /* $data=array(); foreach ($AllAnswers as $key=>$value){ $this->model->id=$value->id; $SubAllAnswers=$this->model->getAllAnswers(); //Tools::dump($this->model->getAllAnswers()); $data[$value->content]=$SubAllAnswers; } */ //Tools::dump($oneAsk); $askLeaderboard = $this->model->askLeaderboard(); $this->smarty->assign("askLeaderboard", $askLeaderboard); $this->smarty->assign("data", $data); //Tools::dump($data); $this->smarty->assign("oneAsk", $oneAsk); } $this->smarty->display("home/ask.html"); }
private function show() { if (Tools::isSession("username")) { header("Location:index.php?a=admin&action=admin_login"); } $nav = new navModel(); $AllSubNav = $nav->getAllSubNav(); //Tools::dump($AllSubNav); $str = null; foreach ($AllSubNav as $kk => $vv) { $str .= $vv->id . ","; } $str = rtrim($str, ","); //echo $str; if (empty($_GET['nid'])) { $this->model->nid = $str; } else { $this->model->nid = $_GET['nid']; $this->nav($_GET['nid']); } parent::page($this->model->getAllArticleTotal(), 10); $data = $this->model->getAllArticle(); foreach ($data as $key => $value) { $nav->id = $value->nid; //Tools::dump($nav->getOneNav()); $value->nid = $nav->getOneNav()->name; $attrArr = explode(",", $value->attr); $attrStr = null; foreach ($attrArr as $v) { switch ($v) { case "headline": $attrStr .= "头条,"; break; case "recommend": $attrStr .= "推荐,"; break; case "focus": $attrStr .= "焦点,"; break; case "topic": $attrStr .= "专题"; break; case "pickup": $attrStr .= "精选"; break; } } switch ($value->state) { case 0: $value->state = "<span style='color:red;'>[否]</span>\r\n\t\t\t\t\t\t\t<a href='?a=article&action=state&type=item&flag=show&id=" . $value->id . "'>显示</a>"; break; case 1: $value->state = "<span style='color:green;'>[是]</span>\r\n\t\t\t\t\t\t\t<a href='?a=article&action=state&type=item&flag=hide&id=" . $value->id . "'>隐藏</a>\t"; break; } $attrStr = rtrim($attrStr, ","); $value->attr = $attrStr; } $this->nav($_GET['nid']); $this->smarty->assign("data", $data); $this->smarty->assign("show", true); }
private function show() { if (Tools::isSession("oneUser")) { Tools::Redirect("只有注册会员才可以考试", "?", 2, 1); } else { $user = new userModel(); $user->id = $_SESSION['oneUser']->id; $oneUser = $user->getOneUserByID(); $this->smarty->assign("oneUser", $oneUser); if ($oneUser->countdown <= 0) { Tools::Redirect("您积分不够,请充值!", "?", 2, 1); } } $this->smarty->assign("id", $_SESSION['oneUser']->id); $course = new courseModel(); $course->id = $_GET['cid']; $oneCourse = $course->getOneCourse(); $this->smarty->assign("oneCourse", $oneCourse); $choices = $this->model->getChoice($_GET['cid']); $judges = $this->model->getJudge($_GET['cid']); //Tools::dump($judges); $this->smarty->assign("show", true); $this->smarty->assign("choices", $choices); $this->smarty->assign("judges", $judges); }