Пример #1
0
 private function Get_ALLComment()
 {
     global $templates;
     $this->model->cid = $_GET['cid'];
     parent::Page($this->model->Get_Commentnum());
     $object = $this->model->Get_All();
     foreach ($object as $value) {
         if (empty($value->face)) {
             $value->face = 'face/00.gif';
         }
     }
     $templates->assgin('all_comment', $object);
     $templates->assgin('cid', $this->model->cid);
 }
Пример #2
0
 private function Search_Title()
 {
     global $templates;
     if (empty($_GET['input_keyword'])) {
         Tool::alertClose('关键字不能为空');
     }
     $this->model->input_keyword = $_GET['input_keyword'];
     parent::Page($this->model->Search_Title_Num()->c_count);
     $object = $this->model->Search_Title();
     foreach ($object as $value) {
         if (empty($value->thumbnail)) {
             $value->thumbnail = 'images/none.jpg';
         }
         $value->title = str_replace($_GET['input_keyword'], '<span style="color:red;">' . $_GET['input_keyword'] . '</span>', $value->title);
     }
     $templates->assgin('search', $object);
 }
Пример #3
0
 private function Comment_Show()
 {
     global $templates;
     $templates->assgin('title', '评论列表');
     $templates->assgin('show', true);
     parent::Page($this->model->All_Comment_Num());
     $object = $this->model->Get_ALL_List();
     if (!empty($object)) {
         foreach ($object as $value) {
             $value->content_full = $value->content;
             $value->content = Tool::Sub_Str($value->content, 50);
             if ($value->state == 0) {
                 $value->state_num = $value->state;
                 $value->state = '<span style="color:red;">[未审核]</span>|<a href="comment.php?id=' . $value->id . '&action=agree"><span style="color:blue;">通过</span></a>';
             } else {
                 if ($value->state == 1) {
                     $value->state_num = $value->state;
                     $value->state = '<span style="color:blue">[已审核]</span>';
                 }
             }
         }
     }
     $templates->assgin('all_comment_list', $object);
 }
Пример #4
0
 public function Action()
 {
     global $templates;
     switch ($_GET['action']) {
         case 'show':
             $templates->assgin('title', '会员列表');
             $templates->assgin('show', true);
             parent::Page($this->model->Get_User_Num());
             $all_user = $this->model->Get_ALL_User();
             foreach ($all_user as $value) {
                 if ($value->state == 1) {
                     $value->state = '仅可以登入';
                 }
                 if ($value->state == 0) {
                     $value->state = '封杀会员';
                 }
                 if ($value->state == 2) {
                     $value->state = '初级会员';
                 }
                 if ($value->state == 3) {
                     $value->state = '中级会员';
                 }
                 if ($value->state == 4) {
                     $value->state = '高级会员';
                 }
                 if ($value->state == 5) {
                     $value->state = 'VIP会员';
                 }
             }
             $templates->assgin('ALL_user', $all_user);
             break;
         case 'update':
             if ($_POST['send'] == '修改') {
                 $this->model->id = $_POST['id'];
                 $this->model->password = $_POST['password'];
                 $this->model->face = $_POST['face'];
                 $this->model->question = $_POST['question'];
                 $this->model->answer = $_POST['answer'];
                 $this->model->email = $_POST['email'];
                 $this->model->state = $_POST['state'];
                 if ($this->model->Update_User()) {
                     Tool::alertLocation('修改成功', '?action=show');
                 } else {
                     Tool::alertBack('修改失败');
                 }
             }
             if (isset($_GET['id'])) {
                 $templates->assgin('id', $_GET['id']);
                 $templates->assgin('prev_url', PREV_URL);
                 $templates->assgin('title', '修改会员');
                 $templates->assgin('update', true);
                 $this->model->id = $_GET['id'];
                 $object = $this->model->Get_One_User();
                 $face = $this->face($object->face);
                 $question = $this->question($object->question);
                 $state = $this->state($object->state);
                 $templates->assgin('all_state', $state);
                 $templates->assgin('all_question', $question);
                 $templates->assgin('all_face', $face);
                 $templates->assgin('face', $object->face);
                 $templates->assgin('answer', $object->answer);
                 $templates->assgin('username', $object->username);
                 $templates->assgin('email', $object->email);
                 $templates->assgin('id', $object->id);
                 $templates->assgin('level_info', $object->level_info);
             }
             break;
         case 'add':
             $templates->assgin('title', '新增会员');
             break;
         case 'delete':
             if ($_GET['action'] == 'delete') {
                 $this->model->id = $_GET['id'];
                 if ($this->model->Delete_User()) {
                     Tool::alertLocation('会员删除成功', PREV_URL);
                 } else {
                     Tool::alertBack('会员删除失败');
                 }
             }
             break;
         default:
             echo '非法操作';
             break;
     }
 }
Пример #5
0
 public function Action()
 {
     global $templates;
     switch ($_GET['action']) {
         case 'show':
             Validate::Check_Login();
             $templates->assgin('title', '导航列表');
             $templates->assgin('show', true);
             parent::Page($this->model->Get_Nav_Num());
             $all_Nav = $this->model->selectNav();
             $templates->assgin('ALLNav', $all_Nav);
             break;
         case 'showchild':
             if (isset($_GET['id'])) {
                 $templates->assgin('title', '子导航列表');
                 $templates->assgin('showchild', true);
                 $templates->assgin('par_name', $_GET['par_name']);
                 parent::Page($this->model->Get_childNav_Num());
                 $all_childNav = $this->model->selectchildNav();
                 $templates->assgin('all_childNav', $all_childNav);
             }
             break;
         case 'sort':
             if (isset($_POST['send'])) {
                 $sort = $_POST['sort'];
                 foreach ($sort as $key => $value) {
                     if (!is_numeric($key)) {
                         continue;
                     }
                     $sql .= "update nav set sort='{$value}' where id='{$key}';";
                 }
                 $this->model->Sort($sql);
                 Tool::alertLocation(null, PREV_URL);
             }
             break;
         case 'addchild':
             if (isset($_GET['id'])) {
                 $templates->assgin('PREV_URL', PREV_URL);
                 $templates->assgin('title', '新增子导航');
                 $templates->assgin('addchild', true);
                 $templates->assgin('parid', $_GET['id']);
                 $templates->assgin('par_name', $_GET['par_name']);
             }
             if ($_POST['send'] == '新增子导航') {
                 if ($this->model->Get_One_childNav()) {
                     Tool::alertBack('导航名称已经存在');
                 }
                 $this->model->Add_Nav();
             }
             break;
         case 'update':
             if ($_POST['send'] == '修改导航') {
                 $this->model->Update_Nav();
             }
             if (isset($_GET['id'])) {
                 $templates->assgin('title', '修改导航');
                 $templates->assgin('update', true);
                 $object = $this->model->Get_One_Nav();
                 $templates->assgin('PREV_URL', PREV_URL);
                 $templates->assgin('nav_name', $object->name);
                 $templates->assgin('id', $object->id);
                 $templates->assgin('nav_info', $object->info);
             }
             break;
         case 'add':
             if ($_POST['send'] == '新增导航') {
                 if ($this->model->Get_One_Nav()) {
                     Tool::alertBack('导航名称已经存在');
                 }
                 $this->model->Add_Nav();
             }
             $templates->assgin('PREV_URL', PREV_URL);
             $templates->assgin('title', '新增导航');
             $templates->assgin('add', true);
             break;
         case 'delete':
             $templates->assgin('title', '删除导航');
             $templates->assgin('delete', true);
             if ($_GET['action'] == 'delete') {
                 $this->model->Delete_Nav();
             }
         default:
             Tool::alertBack('非法操作');
             break;
     }
 }
Пример #6
0
 public function Action()
 {
     global $templates;
     switch ($_GET['action']) {
         case 'show':
             Validate::Check_Login();
             $templates->assgin('title', '管理员列表');
             $templates->assgin('show', true);
             parent::Page($this->model->Get_Manage_Num());
             $all_Manage = $this->model->selectManage();
             $templates->assgin('ALLManage', $all_Manage);
             break;
         case 'update':
             Validate::Check_Login();
             if (isset($_GET['id'])) {
                 $templates->assgin('title', '修改管理员');
                 $templates->assgin('update', true);
                 $templates->assgin('prev_url', PREV_URL);
                 //注入一个变量,用户得到上次的url
                 $object = $this->model->selectOneManage();
                 $templates->assgin('username', $object->username);
                 $templates->assgin('id', $object->id);
                 $templates->assgin('level', $object->level);
                 $templates->assgin('All_level', $this->model->getAllLevel());
                 //得到所有的等级
                 if ($_POST['send'] == '修改管理员') {
                     //先验证数据
                     if (Validate::Check_Null($_POST['admin_user'])) {
                         Tool::alertBack('用户名不能为空');
                     }
                     if (Validate::Check_Length($_POST['admin_user'], 2, 'min')) {
                         Tool::alertBack('用户名不能少于2位');
                     }
                     if (Validate::Check_Length($_POST['admin_user'], 20, 'max')) {
                         Tool::alertBack('用户名不能多于20位');
                     }
                     if (!empty($_POST['admin_pass'])) {
                         //密码不为空的时候开始验证
                         if (Validate::Check_Length($_POST['admin_pass'], 6, 'min')) {
                             Tool::alertBack('密码不能少于6位');
                         }
                         if (Validate::Check_Length($_POST['admin_pass'], 20, 'max')) {
                             Tool::alertBack('密码不能多于20位');
                         }
                     }
                     $this->model->updateManage();
                 }
             }
             break;
         case 'add':
             Validate::Check_Login();
             $templates->assgin('title', '新增管理员');
             $templates->assgin('add', true);
             $templates->assgin('All_level', $this->model->getAllLevel());
             if ($_POST['send'] == '新增管理员') {
                 //先验证数据
                 if (Validate::Check_Null($_POST['admin_user'])) {
                     Tool::alertBack('用户名不能为空');
                 }
                 if (Validate::Check_Length($_POST['admin_user'], 2, 'min')) {
                     Tool::alertBack('用户名不能少于2位');
                 }
                 if (Validate::Check_Length($_POST['admin_user'], 20, 'max')) {
                     Tool::alertBack('用户名不能多于20位');
                 }
                 if (Validate::Check_Length($_POST['admin_pass'], 6, 'min')) {
                     Tool::alertBack('密码不能少于6位');
                 }
                 if (Validate::Check_Length($_POST['admin_pass'], 20, 'max')) {
                     Tool::alertBack('密码不能多于20位');
                 }
                 if (!Validate::Check_Equals($_POST['admin_pass'], $_POST['admin_repass'])) {
                     Tool::alertBack('密码不一致');
                 }
                 if ($this->model->selectOneManage()) {
                     Tool::alertBack('用户名已经存在');
                 }
                 $this->model->addManage();
             }
             break;
         case 'delete':
             Validate::Check_Login();
             $templates->assgin('title', '删除管理员');
             $templates->assgin('delete', true);
             if ($_GET['action'] == 'delete') {
                 $this->model->deleteManage();
             }
             break;
         default:
             Tool::alertBack('非法操作');
             break;
     }
 }