!defined('DEBUG') and exit('Access Denied.'); include './xiunophp/image.func.php'; include './xiunophp/xn_html_safe.func.php'; include './model/article.func.php'; $action = param(1); if ($action == 'list') { $header['title'] = '文章管理'; $cateid = param(2, 0); $keyword = trim(urldecode(param(3))); $page = param(4, 0); $pagesize = 20; $cond = array(); $cateid and $cond['cateid'] = $cateid; $keyword and $cond['subject'] = array('LIKE' => $keyword); $n = article_count($cond); $page = page($page, $n, $pagesize); $articlelist = article_find($cond, array('articleid' => -1), $page, $pagesize); $pages = pages("admin/article-list-{$cateid}-" . urlencode($keyword) . '-{page}.htm', $n, $page, $pagesize); include "./admin/view/article_list.htm"; } elseif ($action == 'create') { if ($method == 'GET') { $header['title'] = '创建文章'; $articleid = article_maxid() + 1; include "./admin/view/article_create.htm"; } elseif ($method == 'POST') { $articleid = param(2, 0); $cateid = param('cateid', 0); $subject = param('subject'); $brief = param('brief'); $message = param('message', '', FALSE);
function article_batch() { global $_G; $aid_arr = $_GET['aid']; $is_public_del = $_GET['is_public_del']; if (!VIP) { $today_arr = dunserialize(pick_common_get('', 'pick_today')); if ($today_arr['day'] != date('md', $_G['timestamp'])) { $c_set['pick_today'] = array(); pick_common_set($c_set); } else { $article_public_num = $today_arr['article_public_num']; if ($article_public_num > 10000) { cpmsg_error(milu_lang('article_public_limit', array('n' => 10000))); } } } extract($_GET); extract($set); $public_start_time = strtotime($public_start_time); $public_end_time = strtotime($public_end_time); $args_arr = array('optype', 'pid', 'is_public_del', 'article_public_sort', 'is_public_del', 'public_start_time', 'public_end_time', 'status', 's', 'ordersc', 'orderby', 'time_public', 'portal', 'forums', 'threadtypeid', 'blog', 'perpage', 'oparea', 'article_batch_num', 'move_pid', 'p'); $args_url = ''; foreach ($args_arr as $k => $v) { $args_url .= '&' . $v . '=' . ${$v}; } //$args_url .= '&myac=' //echo $args_url;exit(); $from_url = PICK_GO . "picker_manage&myac=article_manage&finished=1" . $args_url; if ($_GET['finished']) { cpmsg(milu_lang('run_finsh'), $from_url, 'succeed'); } if (!$_GET['confirmed']) { $article_batch_num = $setrr['article_batch_num'] = $article_batch_num ? $article_batch_num : 15; pick_common_set($setrr); if (!$optype) { cpmsg_error(milu_lang('must_select_optype')); } if ($oparea == 'selected') { if (!$aid_arr) { cpmsg_error(milu_lang('must_select_data')); } $aid_str = base64_encode(serialize($aid_arr)); $total = count($aid_arr); } else { if ($oparea == 'all') { $total = article_count($pid, $status, array('s' => $s)); } } pcpmsg_loading(milu_lang('bat_import_article', array('a' => $article_batch_num, 't' => $total)), $from_url, 'loadingform', '', '<div id="percent">0%</div>', FALSE); $ajax_url = "admin.php?" . PICK_GO . "picker_manage&myac=ajax_func&inajax=1&af=" . $myac . "&tpl=no&confirmed=1&oparea={$oparea}&aid={$aid_str}" . $args_url; $finsh_url = "admin.php?" . PICK_GO . "picker_manage&myac=article_manage&finished=1" . $args_url; //echo $ajax_url;exit(); echo pick_loading($ajax_url, $finsh_url, $total, array('bat_num' => $article_batch_num)); } else { ob_end_clean(); $total = intval($_GET['total']); $pp = intval($_GET['pp']); $pid = intval($_GET['pid']); $currow = intval($_GET['currow']); $oparea = $_GET['oparea']; $public_sort = $_GET['public_sort']; $public_sort = $public_sort == 1 ? 'asc' : 'desc'; if ($oparea == 'selected') { $aid_arr = unserialize(base64_decode($aid)); $where = $optype == 'timing_delete' ? " AND t.id IN (" . dimplode($aid_arr) . ") " : " AND aid IN (" . dimplode($aid_arr) . ") "; } else { if ($oparea == 'all') { $where = $optype == 'timing_delete' ? " AND a.title like '%" . $_GET['s'] . "%' " : " AND title like '%" . $_GET['s'] . "%' "; } } $aid_arr = array(); if ($is_public_del == 1 && ($optype == 'move_portal' || $optype == 'move_forums' || $optype == 'move_blog') || $optype == 'delete') { $currow = 0; } if ($optype == 'timing_delete') { $query = DB::query("SELECT a.aid,t.id, t.data_id FROM " . DB::table('strayer_timing') . " t Inner Join " . DB::table('strayer_article_title') . " a ON a.aid = t.data_id WHERE t.pid='{$pid}' {$where} ORDER by t.data_id LIMIT {$currow},{$pp}"); while ($rs = DB::fetch($query)) { if ($rs['aid']) { DB::update('strayer_article_title', array('status' => 1), array('aid' => $rs['aid'])); } $aid_arr[] = $rs['id']; } } else { $query = DB::query("SELECT aid FROM " . DB::table('strayer_article_title') . " WHERE pid='{$pid}' {$where} ORDER by dateline " . $public_sort . " LIMIT {$currow},{$pp}"); while ($rs = DB::fetch($query)) { $aid_arr[] = $rs['aid']; } } if ($optype == 'move_portal' || $optype == 'move_forums' || $optype == 'move_blog') { article_import($_GET['optype'], array('aid' => $aid_arr)); } else { $action = 'article_' . $optype; $action($aid_arr, $pid); } if ($currow + $pp > $total) { echo 'TRUE'; exit; } echo 'GO'; exit; } }
function article_list($arr) { global $_G; include_once libfile('function/portalcp'); if (!$arr) { return; } $status = $arr['status'] ? $arr['status'] : intval($_GET['status']); $pid = $arr['pid'] ? $arr['pid'] : intval($_GET['pid']); $perpage = $arr['perpage'] ? $arr['perpage'] : 45; if ($pid) { if ($status == 4) { $json_sql = "Inner Join " . DB::table('strayer_timing') . " AS t ON a.aid = t.data_id Inner Join " . DB::table('strayer_picker') . " AS p ON t.pid = p.pid WHERE t.pid='{$pid}' "; $p_field = ',t.*,p.name'; } else { $json_sql = "Inner Join " . DB::table('strayer_picker') . " AS p ON p.pid = a.pid WHERE a.pid='{$pid}' "; $p_field = ',p.pid,p.pick_cid,p.name'; } } else { $json_sql = ''; $s_sql .= ' WHERE 1=1 '; } if ($status == 0) { $s_sql .= 'AND a.status < 3'; } else { if ($status == 1) { $s_sql .= 'AND a.status < 2'; } else { if ($status != 4) { $s_sql .= " AND a.status=" . $status; } } } if ($arr['s']) { $s_sql .= " AND a.title like '%" . $arr['s'] . "%' "; } $arr['orderby'] = $arr['orderby'] != 'default' && $arr['orderby'] ? $arr['orderby'] : 'aid'; $order_sql = ' ORDER BY a.' . $arr['orderby'] . ' ' . $arr['ordersc']; $page = $_GET['page'] ? intval($_GET['page']) : 1; $start = ($page - 1) * $perpage; $perpages = array($perpage => ' selected'); $mpurl = $arr['mpurl'] ? $arr['mpurl'] . '&pid=' . $pid : '?' . PICK_GO . 'picker_manage&myaction=article_manage&pid=' . $pid . '&status=' . $status; $mpurl .= '&p=' . $_GET['p'] . '&perpage=' . $perpage; $count = article_count($pid, $arr['status'], $arr); if ($count) { $query = DB::query("SELECT a.*" . $p_field . " FROM " . DB::table('strayer_article_title') . " AS a " . $json_sql . $s_sql . $order_sql . " LIMIT {$start},{$perpage} "); while ($v = DB::fetch($query)) { $v['full_title'] = $v['title']; $v['title'] = cutstr(trim($v['title']), 60); if ($v['pic'] > 0) { $v['title'] = $v['title'] . ' <img src="static/image/filetype/image_s.gif" alt="attach_img" title="' . milu_lang('img_article') . '" align="absmiddle">'; } if ($arr['s']) { $v['title'] = str_replace($arr['s'], '<span style="color:red">' . $arr['s'] . '</span>', $v['title']); } $v['dateline'] = dgmdate($v['dateline']); $v['last_modify'] = $v['last_modify'] ? dgmdate($v['last_modify']) : milu_lang('no_modify'); $v['public_time'] = $v['public_time'] ? dgmdate($v['public_time']) : milu_lang('no_public'); $v['public_dateline'] = $v['public_dateline'] ? dgmdate($v['public_dateline']) : ''; if (!$v['name']) { $pick_info = article_get_picker_info($v['pid']); $v['name'] = $pick_info['name']; } $data['rs'][] = $v; } } $data['multipage'] = multi($count, $perpage, $page, $mpurl); return $data; }