Example #1
0
 $_POST['author'] = $author;
 $_POST['authoren'] = $authoren;
 $_POST['institution'] = $institution;
 $_POST['institutionen'] = $institutionen;
 $_POST['keywords'] = $keywords;
 $data = filter_array($_POST, 'periodsAndpage,DOI,reference,file_name,classnum,name!,name_en,time,html,description,keywords,intval:category_id!,intval:order_id,author,authoren,institution,institutionen');
 $publish_time = mktime($data['time']['hour'], $data['time']['minute'], 0, $data['time']['month'], $data['time']['day'], $data['time']['year']);
 $item_arr = $item->get_one($item_id);
 if ($data) {
     unset($data['time']);
     $data['pic_url'] = get_first_image_url($data['description']);
     $data['has_pic'] = $data['pic_url'] ? 1 : 0;
     $data['update_time'] = time();
     $data['publish_time'] = $publish_time;
     $data['update_user_id'] = $_SESSION['login_user']['user_id'];
     if ($item->update($item_id, $data)) {
         if ($page_type == 'category') {
             $this_category = $category->get_one($data['category_id']);
             $return_to = 'admin.php?p=category&category_id=' . $this_category['parent_id'];
         } else {
             if ($page_type == 'preview') {
                 $return_to = 'index.php?p=item&item_id=' . $item_id . '&preview=true';
             } else {
                 $return_to = 'admin.php?p=item&category_id=' . $data['category_id'];
             }
         }
         lz_exit(lang('ITEM_EDIT_SUCCESS'), $return_to, 1);
     } else {
         $action = 'edit_item';
         $err_msg = lang('ITEM_UNKNOWN_ERROR');
     }
Example #2
0
<?php

LZ_MODULE != 'admin' && die('Access Denied');
include_once 'model/category.php';
$category = new LZ_Category();
include_once 'model/item.php';
$item = new LZ_Item();
$result = $item->update($_POST['id'], array("recommend" => $_POST['recommend']));
if ($result) {
    lz_exit(lang('提交成功'), 'admin.php?p=item', 1);
} else {
    lz_exit(lang('提交失败'), 'admin.php?p=item', 1);
}