Esempio n. 1
0
             if ($service->save(v('title'), v('abstract'), v('content'), v('cid'), v('type'))) {
                 // 静态化文章,及更新列表
                 $service->staticArticle($id);
                 $category = $categoryService->findById(v('cid'));
                 $service->staticArticleList($category);
                 $service->staticIndex();
             }
         }
         forward('article_list.php?status=0');
     } else {
         send_result(0, 'request does not have title,abstract,content,id,cid parames');
     }
 } else {
     if ($method == 'edit') {
         if (v('id')) {
             $article = $service->findById(v('id'));
             $result = $categoryService->getAll();
             $data = array('category_data' => $result);
             if ($article) {
                 // 避免pre中的<>字符与编辑器冲突
                 $article['content'] = str_replace('&gt;', '&amp;gt;', $article['content']);
                 $article['content'] = str_replace('&lt;', '&amp;lt;', $article['content']);
                 $data['article'] = $article;
             }
             render('article.edit', $data);
         } else {
             $result = $categoryService->getAll();
             $data = array('category_data' => $result);
             render('article.edit', $data);
         }
     } else {
Esempio n. 2
0
<?php

include '..' . DIRECTORY_SEPARATOR . 'init.php';
include SROOT . 'articleService.class.php';
$service = new ArticleService();
if (v('id')) {
    $data = $service->findById(v('id'));
    render($GLOBALS['config']['article']['detail_template'], $data);
} else {
    send_result(0, 'request does not have id parames');
}