예제 #1
0
파일: item.php 프로젝트: TopGrd/newxb
 function get_list($data = array())
 {
     if ($data['category_id'] == 0) {
         unset($data['category_id']);
     }
     if (isset($data['status'])) {
         !$data['where'] && ($data['where'] = ' 1=1 ');
         $data['where'] .= " AND status IN ({$data['status']}) ";
         unset($data['status']);
     } else {
         $data['status'] = '1';
     }
     if ($data['with_children_category']) {
         include_once LZ_BASEPATH . '/model/category.php';
         if ($data['category_id']) {
             $category = new LZ_Category();
             $tree = $category->tree_category($data['category_id']);
             $arr = array();
             $category->flat_tree($tree, $arr);
             $ids = array();
             foreach ($arr as $_arr) {
                 $ids[] = $_arr['category_id'];
             }
             $ids[] = $data['category_id'];
             if ($data['where']) {
                 $data['where'] .= ' AND ';
             }
             $data['where'] .= ' category_id IN (' . join(',', $ids) . ')';
         }
         unset($data['with_children_category']);
         unset($data['category_id']);
     }
     if (LZ_MODULE == 'admin' && $_SESSION['login_user']['rights']['limit_category_id'] && $_SESSION['login_user']['allowed_categories']) {
         $data['where'] && ($data['where'] .= ' AND ');
         $data['where'] .= 'category_id IN (' . $_SESSION['login_user']['allowed_categories'] . ')';
     }
     !$data['order'] && ($data['order'] = "order_id DESC,publish_time DESC");
     return parent::get_list($data);
 }
예제 #2
0
파일: item.php 프로젝트: TopGrd/newxb
if ($this_category['parent_id'] > 0) {
    $view_data['parent_category'] = $category->get_one($this_category['parent_id']);
}
$position = $category->position_category($category_id);
$url = $position[count($position) - 1]['url'];
$lz_make_html_total_page = $info['total_page'];
$view_data['item'] = $this_item;
$view_data['title'] = $this_item['name'] . ' ' . $config['site_name'];
$view_data['description'] = $this_item['metadescription'];
$view_data['download'] = $this_item['file_name'];
$view_data['keywords'] = $this_item['keywords'];
$view_data['item_keywords'] = $item_keywords;
$view_data['item_id'] = $item_id;
$view_data['category_id'] = $category_id;
$view_data['position'] = $position;
$view_data['category_tree'] = $category->tree_category($category_id);
$view_data['category_tree'] = $category->tree_category($category_id);
$view_data['this_category'] = $this_category;
// set revelant articles
$RAs = $item->get_revelant_articles($item_id);
$view_data['article'] = $RAs;
// set authors revelant articles
$authorArticles = $item->get_same_author_articles($item_id);
$view_data['author_articles'] = $authorArticles;
if (count($view_data['category_tree']) <= 0) {
    $view_data['sibling_category'] = $category->tree_category($this_category['parent_id']);
} else {
    $view_data['sibling_category'] = $view_data['category_tree'];
}
if ($this_category['parent_id'] == "0") {
    $view_data['sibling_category'] = array($this_category);
예제 #3
0
파일: item.php 프로젝트: TopGrd/newxb
        if ($m == 'status') {
            $status = intval($_GET['status']);
            $this_item = $item->get_one($item_id);
            if ($item->update($item_id, array('status' => $status))) {
                lz_exit(LANG_PUBLISHED, 'admin.php?p=item&category_id=' . $this_item['category_id']);
            } else {
                lz_exit(LANG_PUBLISHED_ERROR, "javascript:history.go(-1);");
            }
        }
    }
}
//添加项目
if ($action == 'new_item') {
    include_once 'plugin/fckeditor/fckeditor.php';
    $temp = template('item_new.html');
    $temp->assign(array('item' => $_POST, 'categories' => $category->get_list(), 'publish_time' => time(), 'category_id' => $category_id, 'login_user' => $_SESSION['login_user'], 'category_tree' => print_category_tree($category->tree_category(0, 1), $category_id)));
    $view_data['page_description'] = lang('NEW_ITEM');
    $view_data['page_content'] = $temp->result();
} else {
    if ($action == 'edit_item') {
        if (!$item_id) {
            lz_exit("need item_id!", 'javascript:history.go(-1)', 5);
        }
        include_once 'plugin/fckeditor/fckeditor.php';
        $temp = template('item_new.html');
        $_item = count($_POST) > 0 ? $_POST : $item->get_one($item_id);
        if ($category_id) {
            $_category = $category->get_one($category_id);
        }
        $author = $db->get_all("select * from lz_author where aid={$item_id}");
        $keywords = $db->get_all("select * from lz_keyword where aid={$item_id}");
예제 #4
0
파일: category.php 프로젝트: TopGrd/newxb
    if ($data) {
        if ($category->add($data)) {
            lz_exit(lang('CATEGORY_NEW_SUCCESS'), 'admin.php?p=category&category_id=' . $data['parent_id'], 1);
        } else {
            $action = 'new_category';
            $err_msg = lang('CATEGOTY_NEW_ERROR');
        }
    } else {
        $action = 'new_category';
        $err_msg = lang('CATEGOTY_FILL_ALL');
        $view_data['category'] = $_POST;
    }
}
//显示分类和项目列表
$categories = $category->get_list(array('parent_id' => $category_id));
$_tree = $category->tree_category(0);
$view_data['all_category'] = print_category_tree_link('admin.php?p=category&category_id=', $_tree, $category_id);
$view_data['categories'] = $categories;
$view_data['page_description'] = lang('CATEGORIES_LIST');
$view_data['err_msg'] = $err_msg;
$view_data['success_msg'] = $success_msg;
$view_data['category_id'] = $category_id;
$view_data['position'] = $category->position_category($category_id);
$view_data['this_category'] = $category->get_one($category_id);
$statuses = array();
foreach ($category_status as $key => $val) {
    $statuses[] = array('index' => $key, 'value' => $val);
}
$view_data['statuses'] = $statuses;
function show_status($s)
{
예제 #5
0
파일: sidebar.php 프로젝트: TopGrd/newxb
<?php

if (!$view_data['categories']) {
    include_once 'model/category.php';
    $category = new LZ_Category();
    $view_data['categories'] = $category->tree_category(0);
}
예제 #6
0
파일: rights.php 프로젝트: TopGrd/newxb
    $data = filter_array($_POST, 'name!');
    if ($data && $rights->add($data)) {
        lz_exit(lang('rights_add_success'), 'admin.php?p=rights');
    } else {
        lz_exit(lang('rights_add_failed'), 'admin.php?p=rights');
    }
} elseif ($m == 'config' && $rights_id) {
    $r = array();
    foreach ($_POST as $key => $val) {
        if (strtolower($val) == 'on') {
            $r[] = $key;
        }
    }
    $data['rights'] = join(',', $r);
    if ($rights->update($rights_id, $data)) {
        lz_exit(lang('rights_updated'), 'admin.php?p=rights');
    }
}
if ($rights_id) {
    $_SESSION['login_user']['rights']['limit_category_id'] = false;
    $view_data['rights'] = $lz_rights;
    $arr = $rights->get_one($rights_id);
    $view_data['this_group'] = $arr;
    $category->flat_tree($category->tree_category(0), $view_data['categories']);
    $r = explode(',', $arr['rights']);
    foreach ($r as $val) {
        $view_data['this_rights'][$val] = true;
    }
}
$view_data['groups'] = $rights->get_list();
$view_data['page_description'] = lang('rights');
예제 #7
0
파일: html.php 프로젝트: TopGrd/newxb
$content = $_POST['content'];
$_GET = array();
$_POST = array();
$_REQUEST = array();
list($_usec, $_sec) = explode(' ', microtime());
$_make_html_time_start = (double) $_usec + (double) $_sec;
if ($make == 'index') {
    $lz_make_html_path = LZ_TOPPATH . 'index.html';
    include LZ_BASEPATH . 'index.php';
    echo $lz_make_html_status ? 'success ' . $lz_time_used : 'error';
} else {
    if ($make == 'category') {
        include_once LZ_BASEPATH . 'model/category.php';
        $category = new LZ_Category();
        $category_id = intval($_GET['category_id']);
        $tree = $category->tree_category($category_id);
        $categories = array();
        $category->flat_tree($tree, $categories);
        $_html_out = '';
        foreach ($categories as $c) {
            $_GET = array();
            $_POST = array();
            $_REQUEST = array();
            $_GET['p'] = 'category';
            $_GET['category_id'] = $c['category_id'];
            $lz_make_html_total_page = 0;
            $lz_make_html_path = str_replace('//', '/', LZ_TOPPATH . $c['url'] . 'index.html');
            include LZ_BASEPATH . 'index.php';
            $_html_out .= 'make ' . $c['name'] . ' ';
            if ($lz_make_html_total_page > 1) {
                for ($_lz_i_ = 2; $_lz_i_ <= $lz_make_html_total_page; $_lz_i_++) {