示例#1
0
 public function anyIndex()
 {
     new WidgetsContainer(\ArticleModel::find(1));
 }
 public function articleEdit()
 {
     if ($_GET) {
         $id = $_GET['id'];
         $article = new ArticleModel();
         $article_res = $article->find($id);
         $this->assign('article_res', $article_res);
         $this->display();
     } else {
         if ($_POST) {
             $article = new ArticleModel();
             $article_id = $_POST['article_id'];
             $article_title = $_POST['article_title'];
             $article_content = $_POST['article_content'];
             $article_intro = $_POST['article_intro'];
             $article_keywords = $_POST['article_keywords'];
             $sql = "update article set article_title = '" . mysql_escape_string($article_title) . "',\r\n\t\t\tarticle_content = '{$article_content}',\r\n\t\t\tarticle_intro = '" . mysql_escape_string($article_intro) . "',\r\n\t\t\tarticle_keywords = '" . mysql_escape_string($article_keywords) . "' where article_id = {$article_id}";
             if ($article->execute($sql)) {
                 $this->success('修改成功!');
             } else {
                 $this->error('修改失败');
             }
         } else {
             $this->error("非法访问!");
         }
     }
 }