Esempio n. 1
0
<?php

include '../init.php';
require_once SROOT . 'articleService.class.php';
require_once SROOT . 'categoryService.class.php';
$as = new ArticleService();
$as->staticIndex();
$cs = new CategoryService();
$cs->staticCategoryJs();
$cList = $cs->getAll();
foreach ($cList as $row) {
    $as->staticArticleList($row);
}
$aList = $as->getAll(1);
foreach ($aList as $row) {
    $as->staticArticle($row['id']);
}
Esempio n. 2
0
    send_result(0, "request does not have method parame");
}
$service = new ArticleService();
$categoryService = new CategoryService();
if ($method == 'delete') {
    if (v('id') && isset($_REQUEST['status'])) {
        if ($_REQUEST['status'] == -1) {
            $flag = $service->delete(v('id'));
        } else {
            $flag = $service->trash(v('id'));
        }
        if ($flag) {
            // 静态化文章,及更新列表
            $service->staticArticle($id);
            $category = $categoryService->findById(v('cid'));
            $service->staticArticleList($category);
            $service->staticIndex();
        }
        forward('article_list.php?status=' . $_REQUEST['status']);
    } else {
        send_result(0, 'request does not have id ro status parame');
    }
} else {
    if ($method == 'draft') {
        if (v('cid') && v('type') && v('title') && v('content') && v('abstract')) {
            if (v('id')) {
                // 文章更新
                $id = v('id');
                if ($service->update($id, v('title'), v('abstract'), v('content'), v('cid'), v('type'))) {
                    if ($service->draft($id)) {
                        // 静态化文章,及更新列表
Esempio n. 3
0
        $service->staticCategoryJs();
        forward('category_list.php');
    } else {
        send_result(0, 'request does not have id parame');
    }
} else {
    if ($method == 'add') {
        if (v('name') && v('description')) {
            $service->insert(v('name'), v('description'));
            $service->staticCategoryJs();
            forward('category_list.php');
        } else {
            send_result(0, 'request does not have name or description parames');
        }
    } else {
        if ($method == 'update') {
            if (v('id') && v('name') && v('description')) {
                if ($service->update(v('id'), v('name'), v('description'))) {
                    $service->staticCategoryJs();
                    $categoryData = array('id' => v('id'), 'name' => v('name'), 'description' => v('description'));
                    $articleService = new ArticleService();
                    $articleService->staticArticleList($categoryData);
                }
                forward('category_list.php');
            } else {
                send_result(0, 'request does not have name or description or id parames');
            }
        }
    }
}
send_result(0, "request does not have correct method parame");