Beispiel #1
0
 public function indexAction()
 {
     $alias_id = Comm\Arg::post('alias_id', FILTER_VALIDATE_INT);
     $name = Comm\Arg::post('name');
     $id = Model\Theme\Main::create($alias_id, $name);
     Comm\Response::json(100000, '操作成功', ['id' => $id], false);
 }
Beispiel #2
0
 public function indexAction()
 {
     $id = Comm\Arg::post('id', FILTER_VALIDATE_INT);
     $content = Comm\Arg::post('content');
     $result = Model\Theme\Resource::update($id, $content);
     Comm\Response::json(100000, '保存成功', ['result' => $result], false);
 }
Beispiel #3
0
 public function indexAction()
 {
     $name = Comm\Arg::post('name');
     $alias = Comm\Arg::post('alias');
     Model\Category::create($name, $alias);
     Comm\Response::json(100000, '操作成功', null, false);
 }
Beispiel #4
0
 public function indexAction()
 {
     $tpl_id = Comm\Arg::post('tpl_id', FILTER_VALIDATE_INT);
     $resource_name = Comm\Arg::post('resource_name');
     $result = Model\Theme\Resource::addResource($tpl_id, $resource_name);
     Comm\Response::json(100000, '保存成功', ['result' => $result], false);
 }
Beispiel #5
0
 public function indexAction()
 {
     $category_id = Comm\Arg::post('category_id');
     $title = Comm\Arg::post('title');
     $content = Comm\Arg::post('content');
     Model\Article::create($category_id, $title, $content);
     Comm\Response::json(100000, '发表成功', ['href' => Comm\View::path('manage/article/index')], false);
 }
Beispiel #6
0
 public function indexAction()
 {
     $id = Comm\Arg::post('id', FILTER_VALIDATE_INT);
     $article = Model\Article::show($id);
     if (!$article) {
         throw new Exception\Msg('发布文章为空');
     }
     $result = Model\Publish::article($article);
     Comm\Response::json(100000, 'succ', ['result' => $result], false);
 }
Beispiel #7
0
 public function indexAction()
 {
     $name = Comm\Arg::post('name');
     $desc = Comm\Arg::post('desc');
     $page_count = Comm\Arg::post('page_count', FILTER_VALIDATE_INT);
     $comment_duoshuo = Comm\Arg::post('comment_duoshuo');
     $timezone = Comm\Arg::post('timezone');
     Model\Blog::save(array('name' => $name, 'desc' => $desc, 'page_count' => $page_count, 'comment_duoshuo' => $comment_duoshuo, 'timezone' => $timezone));
     Comm\Response::json(100000, '操作成功', null, false);
 }
Beispiel #8
0
 public function indexAction()
 {
     $publishs = Comm\Arg::post('publish', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
     $datas = array();
     foreach ($publishs as $publish) {
         $publis_arr = explode('-', $publish);
         if (isset($publis_arr[1]) && ctype_digit($publis_arr[0]) && ctype_digit($publis_arr[1])) {
             $type = $publis_arr[0];
             $connection_id = $publis_arr[1];
         }
         $datas[] = array('type' => $type, 'connection_id' => $connection_id);
     }
     $result = Model\Publish\Task::createBatch($datas);
     $msg = _('添加发布任务成功');
     Comm\Response::json(100000, $msg, ['result' => $result], false);
 }
Beispiel #9
0
 public function indexAction()
 {
     $id = Comm\Arg::get('id', FILTER_VALIDATE_INT);
     $result = Model\Theme\Resource::show($id);
     if (empty($result)) {
         throw new Exception\Msg('指定模板资源不存在');
     }
     //判断是否为只读
     $main = Model\Theme\Main::show($result['tpl_id']);
     try {
         Model\User::validateAuth($main['user_id']);
         $readonly = false;
     } catch (Exception $e) {
         $readonly = true;
     }
     Comm\Response::json(100000, 'succ', array('content' => $result['content'], 'readonly' => $readonly), false);
 }
Beispiel #10
0
 public function indexAction()
 {
     $theme = Comm\Arg::get('theme', FILTER_VALIDATE_INT, ['min_range' => 0], true);
     $resource = Comm\Arg::get('resource', FILTER_DEFAULT, null, true);
     Yaf_Registry::set('tpl_id', $theme);
     switch ($resource) {
         //预览首页
         case 'home':
             $pager = new Comm\Pager(1000, 20, 1);
             $articles = Model\Article::showUserList($pager);
             Model\Publish::home($articles, $pager, null, false);
             break;
             //预览分类下的文章列表
         //预览分类下的文章列表
         case 'article-list':
             $pager = new Comm\Pager(1000, 20, 1);
             $articles = Model\Article::showUserList(new Comm\Pager(1, 1, 1));
             if (!$articles) {
                 throw new Exception\Msg(_('至少发表一篇文章才可预览'));
             }
             $article = reset($articles['result']);
             $category = Model\Category::show($article['category_id']);
             $articles = Model\Article::showUserList($pager, false, $category['id']);
             $articles = isset($articles['result']) ? $articles['result'] : array();
             Model\Publish::categoryArticleList($category, $articles, $pager, null, false);
             break;
             //预览文章
         //预览文章
         case 'article':
             $articles = Model\Article::showUserList(new Comm\Pager(1, 1, 1));
             $article = reset($articles['result']);
             Model\Publish::article($article, false);
             break;
             //预览导航
         //预览导航
         case 'sidebar':
             Model\Publish::sidebar(false, false);
             break;
         default:
             throw new \Exception\Msg('本资源不支持预览');
     }
 }
Beispiel #11
0
 public function indexAction()
 {
     $last_page = Comm\Arg::get('last_page', FILTER_VALIDATE_INT, ['min_range' => 1]) ?: 0;
     $page = Comm\Arg::get('p', FILTER_VALIDATE_INT, ['min_range' => 1]) ?: 1;
     $uid = Yaf_Registry::get('current_uid');
     //获取总数
     $total = Model\Counter\Article::get(0, $uid);
     //获取用户的博客配置中的分页设置
     $blog = Model\Blog::show();
     empty($blog['data']['page_count']) || ($this->_limit = $blog['data']['page_count']);
     //获取分页参数
     $pager = new \Comm\Pager($total, $this->_limit);
     //获取数据
     $articles = Model\Article::showUserList($pager);
     //获取分类内容
     $categorys = Model\Category::showUserAll();
     $categorys = Comm\Arr::hashmap($categorys, 'id');
     //获取用户博客基本地址
     $blog_url = 'http://' . \Model\Github::showDefaultBlogRepoName();
     $this->viewDisplay(array('articles' => $articles, 'categorys' => $categorys, 'pager' => $pager, 'blog_url' => $blog_url));
 }
Beispiel #12
0
 public function indexAction()
 {
     $theme_id = Comm\Arg::post('theme_id');
     $result = Model\Blog::save(array('theme_id' => $theme_id));
     Comm\Response::json(100000, '操作成功', ['result' => $result], false);
 }
Beispiel #13
0
 public function indexAction()
 {
     $id = Comm\Arg::post('id', FILTER_VALIDATE_INT);
     $result = Model\Theme\Resource::unlock($id);
     Comm\Response::json(100000, 'succ', null, false);
 }
Beispiel #14
0
 public function indexAction()
 {
     $id = Comm\Arg::post('id', FILTER_VALIDATE_INT);
     $result = Model\Theme\Resource::destory($id);
     Comm\Response::json(100000, _('操作成功'), ['result' => $result], false);
 }
Beispiel #15
0
 public function indexAction()
 {
     $theme_id = Comm\Arg::post('id');
     $result = Model\Theme\Main::destory($theme_id);
     Comm\Response::json(100000, '操作成功', ['result' => $result], false);
 }
Beispiel #16
0
 public function indexAction()
 {
     $domain = Comm\Arg::post('domain');
     Model\Publish::domain($domain);
     Comm\Response::json(100000, '操作成功', null, false);
 }
Beispiel #17
0
 public function indexAction()
 {
     $id = Comm\Arg::post('id');
     $result = Model\Article::destory($id);
     Comm\Response::json(100000, _('删除成功'), null, false);
 }