public function postComment() { global $smarty; session_start(); if ($_SESSION['validate_code'] == strtolower(Tools::getRequest('validate_code'))) { $comment = new CMSComment(); $comment->copyFromPost(); if ($comment->add()) { $this->_success = '添加评论成功,请等待管理员审核哟!'; } else { $this->_errors = $comment->_errors; } } else { $this->_errors[] = '验证码错误!'; } }
} if (is_array($object->_errors) and count($object->_errors) > 0) { $errors = $object->_errors; } else { UIAdminAlerts::conf('评论已删除'); } } elseif (Tools::isSubmit('subDelete')) { $select_cat = Tools::P('categoryBox'); $cmscomment = new CMSComment(); if ($cmscomment->deleteSelection($select_cat)) { UIAdminAlerts::conf('评论已删除'); } } elseif (Tools::isSubmit('subActiveON') or Tools::isSubmit('subActiveOFF')) { $select_cat = Tools::P('itemBox'); $action = Tools::isSubmit('subActiveON') ? 1 : 0; $object = new CMSComment(); if (is_array($select_cat)) { if ($object->statusSelection($select_cat, $action)) { UIAdminAlerts::conf('文章已更新'); } } } $table = new UIAdminTable('cms_comment', 'CMSComment', 'id_cms_comment'); $table->header = array(array('sort' => false, 'isCheckAll' => 'itemBox[]'), array('name' => 'id_cms_comment', 'title' => 'ID', 'edit' => false, 'filter' => 'string'), array('name' => 'name', 'title' => '访客', 'edit' => false, 'filter' => 'string'), array('name' => 'email', 'title' => '邮箱', 'edit' => false, 'filter' => 'string'), array('name' => 'active', 'title' => '状态', 'edit' => false, 'filter' => 'bool'), array('name' => 'comment', 'title' => '内容', 'edit' => false), array('name' => 'add_date', 'title' => '时间', 'edit' => false), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('delete'))); $filter = $table->initFilter(); $orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'id_cms_comment'; $orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'desc'; $limit = $cookie->getPost('pagination') ? $cookie->getPost('pagination') : '50'; $p = Tools::G('p') ? Tools::G('p') == 0 ? 1 : Tools::G('p') : 1; $result = CMSComment::loadData($p, $limit, $orderBy, $orderWay, $filter); //导航