Example #1
1
 public function batchtrashAction()
 {
     $referer = isset($_SERVER["HTTP_REFERER"]) ? str_replace('http://' . $_SERVER['HTTP_HOST'], '', $_SERVER["HTTP_REFERER"]) : '/admin/document/index';
     if ($this->getRequest()->isPost()) {
         if (empty($this->getRequest()->getPost())) {
             Alert::warning('没有选中任何文章!');
         } else {
             $data = $this->getRequest()->getPost();
             //删除db
             $ret = $this->db_document->batch_trash(['id' => $data['id']]);
             //删除缓存
             foreach ($data['id'] as $id) {
                 $memkey = MEMPREFIX . 'article:detail' . $id;
                 $this->memcache->delete($memkey);
             }
             if ($ret) {
                 Alert::success('删除成功!');
             } else {
                 Alert::success('删除失败!');
             }
         }
     } else {
         Alert::warning('删除失败!');
     }
     $this->redirect($referer);
 }
Example #2
0
 /**
  * 新建页面
  * @author zhangteng
  */
 public function createAction()
 {
     //判断是否有值提交
     if ($this->getRequest()->isPost()) {
         //内容插入数据库
         $ret = $this->Keyword->replace_keywords_add(['id' => $this->getRequest()->getPost('id', 0), 'description' => trim($this->getRequest()->getPost('desc', '')), 'keywords' => trim($this->getRequest()->getPost('keywords', '')), 'replace_words' => trim($this->getRequest()->getPost('replace', ''))]);
         if ($ret) {
             Alert::success('添加成功!');
             Yaf_Controller_Abstract::redirect("/admin/replace/index");
             exit;
         } else {
             Alert::warning('关键词已存在或非法字符');
             $referer = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '/admin/replace/index';
             $this->redirect($referer);
             exit;
         }
     }
     $this->getView()->assign('data', $data);
 }
Example #3
0
 /**
  * 新建页面
  * @author zhangteng
  */
 public function createAction()
 {
     //判断是否有值提交
     if ($this->getRequest()->isPost()) {
         //内容插入数据库
         $ret = $this->Keyword->content_keywords_add(['id' => intval($this->getRequest()->getPost('id', 0)), 'description' => trim($this->getRequest()->getPost('desc', '')), 'keywords' => trim($this->getRequest()->getPost('keywords', '')), 'href_url' => filter_var($this->getRequest()->getPost('href_url'), FILTER_VALIDATE_URL) ? $this->getRequest()->getPost('href_url') : '#']);
         if ($ret) {
             Alert::success('添加成功!');
             Yaf_Controller_Abstract::redirect("/admin/keyword/index");
             exit;
         } else {
             Alert::warning('关键词已存在或非法字符');
             $referer = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '/admin/keyword/index';
             $this->redirect($referer);
             exit;
         }
     }
     $this->getView()->assign('data', $data);
 }
        <?php 
Action::run('admin_header');
?>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
      <script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
    <![endif]-->
    </head>
    <body class="login-body">

        <?php 
// Monstra Notifications
Notification::get('success') and Alert::success(Notification::get('success'));
Notification::get('warning') and Alert::warning(Notification::get('warning'));
Notification::get('error') and Alert::error(Notification::get('error'));
?>

        <div class="container form-signin">

            <div class="text-center"><a class="brand" href="<?php 
echo Option::get('siteurl');
?>
/admin"><img src="<?php 
echo Option::get('siteurl');
?>
/public/assets/img/monstra-logo-256px.png" alt="monstra" /></a></div>
            <div class="administration-area well">
                <div>
                    <form method="post">