<?php
/**
 * [UQcms System] Copyright uqcms.com
 * QQ: 2200631718
 * Author: gj.name
 * This is NOT a freeware
*/
defined('IN_UQ') or exit('Access Denied'); class seo_uqcms extends control { function __construct(){ $this->aid = $_SESSION['admin']['aid']; parent::__construct(); } public function index(){ $page = isset($_GET['page'])?$_GET['page']:'1'; $page_size = isset($_GET['page_size'])?$_GET['page_size']:'20'; $list = $this->db->get_all("select * from ".table('seo')." limit ".($page-1)*$page_size.",".$page_size); if($list){ $data['list'] = $list; $total = $this->db->get_one("select count(id) as total from ".table('seo')); if($page_size < $total['total']){ $data['page'] = $this->uqcms_page(array('page'=>$page,'page_size'=>$page_size,'total'=>$total['total'])); } $this->assign('data',$data); } $this->display(); } public function add(){ $this->display('seo/edit'); } public function update(){ $id = isset($_GET['id'])?$_GET['id']:exit('ID IS NOT NULL'); $this->assign('row',$this->db->get_one("select * from ".table('seo')." where id = ".$id)); $this->display('seo/edit'); } function save(){ if($_POST){ $data['alias'] = $_POST['alias']; $data['name'] = $_POST['name']; $data['title'] = $_POST['title']; $data['keyword'] = $_POST['keyword']; $data['describe'] = $_POST['describe']; $id = $_POST['id']; if($id){ $query = $this->db->update(table('seo'),$data,'id = '.$id); }else{ $query = $this->db->add(table('seo'),$data); } if($query){ showmsg('保存成功','','-1'); }else{ showmsg('保存失败'); } } } public function del(){ $id = isset($_GET['id'])?$_GET['id']:showmsg('提交错误'); $query = $this->db->delete(table('seo'),'id = '.$id); if($query){ showmsg('删除成功'); }else{ showmsg('删除失败'); } } public function navigate(){ $page = isset($_GET['page'])?$_GET['page']:'1'; $page_size = isset($_GET['page_size'])?$_GET['page_size']:'20'; $list = $this->db->get_all("select * from ".table('navigate')." order by px desc limit ".($page-1)*$page_size.",".$page_size); if($list){ $data['list'] = $list; $total = $this->db->get_one("select count(id) as total from ".table('navigate')); if($page_size < $total['total']){ $data['page'] = $this->uqcms_page(array('page'=>$page,'page_size'=>$page_size,'total'=>$total['total'])); } $this->assign('data',$data); } $this->display(); } public function navigate_edit(){ $id = isset($_GET['id'])?intval($_GET['id']):false; if($id){ $row = $this->db->get_one("select * from ".table('navigate')." where id = ".$id); $this->assign('row', $row); } $this->display(); } function navigate_save(){ if($_POST){ $setsql['name'] = P('name', '名称不能为空'); $setsql['link'] = P('link', '链接不能为空'); $setsql['px'] = P('px', '', '0'); $setsql['addtime'] = time(); $id = P('id', 0); if($id){ $query = $this->db->update(table('navigate'), $setsql,'id = '.$id); }else{ $query = $this->db->add(table('navigate'), $setsql); } if($query){ right_json(); }else{ error_json('保存失败'); } }else{ error_json('提交错误'); } } public function navigate_del(){ $id = isset($_GET['id'])?$_GET['id']:showmsg('ID不能为空'); $query = $this->db->delete(table('navigate'),'id = '.$id); if($query){ showmsg('删除成功'); }else{ showmsg('删除失败'); } } }