Пример #1
0
    $upload = new upload_file_class();
    $upload->save_dir = '/upload/news/';
    $news->video_photo_src = '/upload/news/' . $upload->handle('news_pic', 'filter_pic');
}
$table_change = array('<p>' => '');
$table_change += array('</p>' => '');
$news->title = strtr($news->title, $table_change);
$news->short_title = strtr($news->short_title, $table_change);
$news->last_edited_at = date("Y-m-d H:i:s");
if (!$news->id) {
    //insert news
    $news->created_at = date("Y-m-d H:i:s");
    $news->click_count = 0;
}
if ($news->is_adopt) {
    publish_news($news);
} else {
    $news->save();
}
/*
 * news saved
 */
//handle the keywords
$keywords = explode('||', $news->keywords);
if ($keywords) {
    foreach ($keywords as $val) {
        if (empty($val)) {
            continue;
        }
        $db->execute("insert into eb_news_keywords (name) values('{$val}') on duplicate key update name='{$val}'");
    }
Пример #2
0
<?php

include_once '../../frame.php';
#if(!is_ajax())die();
$allow_ops = array('publish', 'unpublish', 'delete');
$op = strtolower($_GET['operation']);
if (!in_array($op, $allow_ops)) {
    die;
}
$id = intval($_GET['news_id']);
switch ($op) {
    case 'publish':
        publish_news($id);
        break;
    case 'unpublish':
        unpublish_news($id);
        break;
    default:
        break;
}