' .'' .''.cplang('hide_search').'' .''; } $catid = $_GET['catid'] = intval($_GET['catid']); showsubmenu('article', array( array('list', 'article&catid='.$catid, $operation == 'list'), array('article_trash', 'article&operation=trash&catid='.$catid, $operation == 'trash'), array('article_tag', 'article&operation=tag', $operation == 'tag'), array('article_add', 'portal.php?mod=portalcp&ac=article', false, 1, 1) ), $searchctrl); if($operation == 'tag') { showtips('article_tag_tip'); if(submitcheck('articletagsubmit')) { C::t('common_setting')->update('article_tags', $_POST['tag']); updatecache('setting'); cpmsg('update_articletag_succeed', 'action=article&operation=tag', 'succeed'); } require_once libfile('function/portalcp'); $tag_names = article_tagnames(); showformheader('article&operation=tag'); showtableheader('article_tag_setting'); for($i=1; $i<=8; $i++) { showtablerow('', array('width=80', ''), array(lang('portalcp', 'article_tag').$i, "")); } showsubmit('articletagsubmit', 'submit'); showtablefooter(); showformfooter(); } elseif($operation == 'trash') { if(submitcheck('batchsubmit', true)) { $_POST['optype'] = empty($_POST['optype']) ? $_GET['optype'] : $_POST['optype']; if(empty($_POST['ids']) && $_POST['optype'] != 'clear') { cpmsg('article_choose_at_least_one_article', 'action=article&operation=trash', 'error'); } if($_POST['optype'] == 'recover') { $inserts = $ids = $catids = array(); foreach(C::t('portal_article_trash')->fetch_all($_POST['ids']) as $value) { $ids[] = intval($value['aid']); $article = dunserialize($value['content']); $catids[] = intval($article['catid']); $inserts[] = array ( 'aid' => $article['aid'], 'catid' => $article['catid'], 'uid' => $article['uid'], 'username' => $article['username'], 'title' => $article['title'], 'url' => $article['url'], 'summary' => $article['summary'], 'pic' => $article['pic'], 'id' => $article['id'], 'idtype' => $article['idtype'], 'contents' => $article['contents'], 'dateline' => $article['dateline'], 'thumb' => $article['thumb'], 'remote' => $article['remote'], 'click1' => $article['click1'], 'click2' => $article['click2'], 'click3' => $article['click3'], 'click4' => $article['click4'], 'click5' => $article['click5'], 'click6' => $article['click6'], 'click7' => $article['click7'], 'click8' => $article['click8'], 'author' => $article['author'], 'from' => $article['from'], 'fromurl' => $article['fromurl'], 'bid' => $article['bid'], 'allowcomment' => $article['allowcomment'], 'tag' => $article['tag'], 'owncomment' => $article['owncomment'], 'status' => $article['status'], 'highlight' => $article['highlight'], 'showinnernav' => $article['showinnernav'], 'preaid' => $article['preaid'], 'nextaid' => $article['nextaid'], 'htmlmade' => $article['htmlmade'], 'htmlname' => $article['htmlname'], 'htmldir' => $article['htmldir'], ); } if($inserts) { foreach($inserts as $data) { C::t('portal_article_title')->insert($data, 0, 1); } C::t('portal_article_trash')->delete($ids); } $catids = array_unique($catids); if($catids) { foreach($catids as $catid) { $cnt = C::t('portal_article_title')->fetch_count_for_cat($catid); C::t('portal_category')->update($catid, array('articles'=>dintval($cnt))); } } cpmsg('article_trash_recover_succeed', 'action=article&operation=trash', 'succeed'); } elseif($_POST['optype'] == 'delete') { require_once libfile('function/delete'); deletetrasharticle($_POST['ids']); cpmsg('article_trash_delete_succeed', 'action=article&operation=trash', 'succeed'); } elseif($_POST['optype'] == 'clear') { $aids = array(); foreach(C::t('portal_article_trash')->range(50) as $value) { $aids[$value['aid']] = $value['aid']; } if(!empty($aids)) { require_once libfile('function/delete'); deletetrasharticle($aids); cpmsg('article_trash_is_clearing', 'action=article&operation=trash&optype=clear&batchsubmit=yes&formhash='.FORMHASH); } else { cpmsg('article_trash_is_empty', 'action=article'); } } else { cpmsg('article_choose_at_least_one_operation', 'action=article&operation=trash', 'error'); } } else { $perpage = 50; $start = ($page-1)*$perpage; $mpurl .= '&perpage='.$perpage; $perpages = array($perpage => ' selected'); $mpurl = ADMINSCRIPT.'?mod=portal&action=article&operation='.$operation; showformheader('article&operation=trash'); showtableheader('article_trash_list'); showsubtitle(array('', 'article_title', 'article_category', 'article_username', 'article_dateline')); $multipage = ''; $count = C::t('portal_article_trash')->count(); if($count) { foreach(C::t('portal_article_trash')->range($start, $perpage) as $value) { $value = dunserialize($value['content']); showtablerow('', array('class="td25"', 'class=""', 'class="td28"'), array( "", $value[title], $category[$value['catid']]['catname'], "$value[username]", dgmdate($value[dateline]) )); } $multipage = multi($count, $perpage, $page, $mpurl); } $batchradio = '  '; $batchradio .= '  '; $batchradio .= ''; showsubmit('', '', '', '  ' .$batchradio.' ', $multipage); showtablefooter(); showformfooter(); } } else { if(submitcheck('articlesubmit')) { $perpage = intval($_GET['hiddenperpage']); $page = intval($_GET['hiddenpage']); $catid = intval($_GET['hiddencatid']); $articles = $catids = array(); $aids = !empty($_GET['ids']) && is_array($_GET['ids']) ? $_GET['ids'] : array(); if($aids) { $query = C::t('portal_article_title')->fetch_all($aids); foreach($query as $value) { $articles[$value['aid']] = array('aid' => $value['aid'], 'catid' => $value['catid']); $catids[] = intval($value['catid']); } } if(empty($articles)) { cpmsg('article_choose_at_least_one_article', 'action=article&catid='.$catid.'&perpage='.$perpage.'&page='.$page, 'error'); } $aids = array_keys($articles); if($_POST['optype'] == 'trash') { require_once libfile('function/delete'); deletearticle($aids, true); cpmsg('article_trash_succeed', 'action=article&catid='.$catid.'&perpage='.$perpage.'&page='.$page, 'succeed'); } elseif($_POST['optype'] == 'move') { $tocatid = intval($_POST['tocatid']); $catids[] = $tocatid; $catids = array_merge($catids); C::t('portal_article_title')->update($aids, array('catid'=>$tocatid)); foreach($catids as $catid) { $catid = intval($catid); $cnt = C::t('portal_article_title')->fetch_count_for_cat($catid); C::t('portal_category')->update($catid, array('articles'=>dintval($cnt))); } cpmsg('article_move_succeed', 'action=article&catid='.$catid.'&perpage='.$perpage.'&page='.$page, 'succeed'); } else { cpmsg('article_choose_at_least_one_operation', 'action=article&catid='.$catid.'&perpage='.$perpage.'&page='.$page, 'error'); } } else { include_once libfile('function/portalcp'); $mpurl = ADMINSCRIPT.'?action=article&operation='.$operation; $intkeys = array('aid', 'uid'); $strkeys = array(); $randkeys = array(); $likekeys = array('title', 'username'); $results = getwheres($intkeys, $strkeys, $randkeys, $likekeys); foreach($likekeys as $k) { $_GET[$k] = dhtmlspecialchars($_GET[$k]); } $wherearr = $results['wherearr']; $mpurl .= '&'.implode('&', $results['urls']); if(!empty($_GET['catid'])) { $catid = intval($_GET['catid']); $mpurl .= '&catid='.$catid; $catids = category_get_childids('portal', $_GET['catid']); $catids[] = $_GET['catid']; $wherearr[] = 'catid IN ('.dimplode($catids).')'; } if(!empty($_GET['tag'])) { $tag = article_make_tag($_GET['tag']); $wherearr[] = "(tag & '$tag' = '$tag')"; foreach($_GET['tag'] as $k=>$v) { $mpurl .= "&tag[$k]=$v"; } } $wheresql = empty($wherearr)?'1':implode(' AND ', $wherearr); $orders = getorders(array('dateline'), 'aid'); $ordersql = $orders['sql']; if($orders['urls']) $mpurl .= '&'.implode('&', $orders['urls']); $orderby = array($_GET['orderby']=>' selected'); $ordersc = array($_GET['ordersc']=>' selected'); $perpage = empty($_GET['perpage'])?0:intval($_GET['perpage']); if(!in_array($perpage, array(10,20,50,100))) $perpage = 10; $categoryselect = category_showselect('portal', 'catid', true, $_GET['catid']); $searchlang = array(); $keys = array('search', 'likesupport', 'resultsort', 'defaultsort', 'orderdesc', 'orderasc', 'perpage_10', 'perpage_20', 'perpage_50', 'perpage_100', 'article_dateline', 'article_id', 'article_title', 'article_uid', 'article_username', 'article_category', 'article_tag'); foreach ($keys as $key) { $searchlang[$key] = cplang($key); } $articletagcheckbox = ''; $article_tags = article_tagnames(); foreach($article_tags as $k=>$v) { $checked = !empty($_GET['tag']) && !empty($_GET['tag'][$k]) ? 'checked="checked"' : ''; $articletagcheckbox .= ""; $articletagcheckbox .= ""; } $start = ($page-1)*$perpage; $mpurl .= '&perpage='.$perpage; $perpages = array($perpage => ' selected'); $adminscript = ADMINSCRIPT; echo <<
$searchlang[article_id] $searchlang[article_title]**$searchlang[likesupport]
$searchlang[article_uid] $searchlang[article_username]*
$searchlang[article_category]$categoryselect   
$searchlang[article_tag]$articletagcheckbox
$searchlang[resultsort]
SEARCH; $makehtmlflag = !empty($_G['setting']['makehtml']['flag']); showformheader('article&operation=list'); showtableheader('article_list'); $subtitle = array('', 'article_title', 'article_category', 'article_username', 'article_dateline'); if($makehtmlflag) { $subtitle[] = 'HTML'; } $subtitle[] = 'operation'; showsubtitle($subtitle); $multipage = ''; $count = C::t('portal_article_title')->fetch_all_by_sql($wheresql, '', 0, 0, 1); if($count) { $repairs = array(); $query = C::t('portal_article_title')->fetch_all_by_sql($wheresql, $ordersql, $start, $perpage); foreach($query as $value) { $htmlname = $value['htmldir'].$value['htmlname'].'.'.$_G['setting']['makehtml']['extendname']; if($makehtmlflag && $value['htmlmade'] && !file_exists(DISCUZ_ROOT.'./'.$htmlname)) { $value['htmlmade'] = 0; $repairs[$value['aid']] = $value['aid']; } $tags = article_parse_tags($value['tag']); $taghtml = ''; foreach($tags as $k=>$v) { if($v) { $taghtml .= ' ['.$article_tags[$k].'] '; } } $tablerow = array( "", "$value[title]".($taghtml ? $taghtml : ''), ''.$category[$value['catid']]['catname'].'', "$value[username]", dgmdate($value[dateline]), ); if($makehtmlflag) { $tablerow[] = "".cplang('setting_functions_makehtml_made') : "red;'>".cplang('setting_functions_makehtml_dismake')).""; } $tablerow[] = ($makehtmlflag ? ($category[$value['catid']]['fullfoldername'] ? "".cplang('setting_functions_makehtml_make')."" : cplang('setting_functions_makehtml_make_has_no_foldername')) : '') ." ".cplang('edit').""; showtablerow('', array('class="td25"', 'width="480"', 'class="td28"'), $tablerow); } $multipage = multi($count, $perpage, $page, $mpurl); if($repairs) { C::t('portal_article_title')->repair_htmlmade($repairs); } } $optypehtml = '' .'  ' .' ' .category_showselect('portal', 'tocatid', false) .'  '; showsubmit('', '', '', '  '.$optypehtml.'', $multipage); showtablefooter(); showformfooter(); } } function showcategoryrow($key, $type = '', $last = '') { global $category, $lang; $forum = $forums[$key]; $showedforums[] = $key; if($last == '') { $return = ''; if($type == 'group') { $return .= '
'; } elseif($type == '') { $return .= '
'; } elseif($type == 'sub') { $return .= '
'; } $boardattr = ''; if(!$forum['status'] || $forum['password'] || $forum['redirect']) { $boardattr = '
'; $boardattr .= $forum['status'] ? '' : $lang['forums_admin_hidden']; $boardattr .= !$forum['password'] ? '' : ' '.$lang['forums_admin_password']; $boardattr .= !$forum['redirect'] ? '' : ' '.$lang['forums_admin_url']; $boardattr .= '
'; } $return .= ''. ($type == '' ? ''.$lang['forums_admin_add_sub'].'' : ''). '
'.$boardattr. ''.showforum_moderators($forum).' '.$lang['edit'].''. ($type != 'group' ? ''.$lang['forums_copy'].'' : ''). ''.$lang['delete'].''; } else { if($last == 'lastboard') { $return = ''; } elseif($last == 'lastchildboard' && $type) { $return = ''; } elseif($last == 'last') { $return = '
'.$lang['forums_admin_add_category'].'
'; } } return $return; } ?>