admincp_tag.php 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: admincp_tag.php 25889 2011-11-24 09:52:20Z monkey $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  9. exit('Access Denied');
  10. }
  11. cpheader();
  12. $operation = in_array($operation, array('admin')) ? $operation : 'admin';
  13. $current = array($operation => 1);
  14. shownav('global', 'tag');
  15. showsubmenu('tag', array(
  16. array('search', 'tag&operation=admin', $current['admin']),
  17. ));
  18. if($operation == 'admin') {
  19. $tagarray = array();
  20. if(submitcheck('submit') && !empty($_GET['tagidarray']) && is_array($_GET['tagidarray']) && !empty($_GET['operate_type'])) {
  21. $class_tag = new tag();
  22. $tagidarray = array();
  23. $operate_type = $newtag = $thread = '';
  24. $tagidarray = $_GET['tagidarray'];
  25. $operate_type = $_GET['operate_type'];
  26. if($operate_type == 'delete') {
  27. $class_tag->delete_tag($tagidarray);
  28. } elseif($operate_type == 'open') {
  29. C::t('common_tag')->update($tagidarray, array('status' => 0));
  30. } elseif($operate_type == 'close') {
  31. C::t('common_tag')->update($tagidarray, array('status' => 1));
  32. } elseif($operate_type == 'merge') {
  33. $data = $class_tag->merge_tag($tagidarray, $_GET['newtag']);
  34. if($data != 'succeed') {
  35. cpmsg($data);
  36. }
  37. }
  38. cpmsg('tag_admin_updated', 'action=tag&operation=admin&searchsubmit=yes&tagname='.$_GET['tagname'].'&perpage='.$_GET['perpage'].'&status='.$_GET['status'].'&page='.$_GET['page'], 'succeed');
  39. }
  40. if(!submitcheck('searchsubmit', 1)) {
  41. showformheader('tag&operation=admin');
  42. showtableheader();
  43. showsetting('tagname', 'tagname', $tagname, 'text');
  44. showsetting('feed_search_perpage', '', $_GET['perpage'], "<select name='perpage'><option value='20'>$lang[perpage_20]</option><option value='50'>$lang[perpage_50]</option><option value='100'>$lang[perpage_100]</option></select>");
  45. showsetting('misc_tag_status', array('status', array(
  46. array('', cplang('unlimited')),
  47. array(0, cplang('misc_tag_status_0')),
  48. array(1, cplang('misc_tag_status_1')),
  49. ), TRUE), '', 'mradio');
  50. showsubmit('searchsubmit');
  51. showtablefooter();
  52. showformfooter();
  53. showtagfooter('div');
  54. } else {
  55. $tagname = trim($_GET['tagname']);
  56. $status = $_GET['status'];
  57. if(!$status) {
  58. $table_status = NULL;
  59. } else {
  60. $table_status = $status;
  61. }
  62. $ppp = $_GET['perpage'];
  63. $startlimit = ($page - 1) * $ppp;
  64. $multipage = '';
  65. $totalcount = C::t('common_tag')->fetch_all_by_status($table_status, $tagname, 0, 0, 1);
  66. $multipage = multi($totalcount, $ppp, $page, ADMINSCRIPT."?action=tag&operation=admin&searchsubmit=yes&tagname=$tagname&perpage=$ppp&status=$status");
  67. $query = C::t('common_tag')->fetch_all_by_status($table_status, $tagname, $startlimit, $ppp);
  68. showformheader('tag&operation=admin');
  69. showtableheader(cplang('tag_result').' '.$totalcount.' <a href="###" onclick="location.href=\''.ADMINSCRIPT.'?action=tag&operation=admin;\'" class="act lightlink normal">'.cplang('research').'</a>', 'nobottom');
  70. showhiddenfields(array('page' => $_GET['page'], 'tagname' => $tagname, 'status' => $status, 'perpage' => $ppp));
  71. showsubtitle(array('', 'tagname', 'misc_tag_status'));
  72. foreach($query as $result) {
  73. if($result['status'] == 0) {
  74. $tagstatus = cplang('misc_tag_status_0');
  75. } elseif($result['status'] == 1) {
  76. $tagstatus = cplang('misc_tag_status_1');
  77. }
  78. showtablerow('', array('class="td25"', 'width=400', ''), array(
  79. "<input class=\"checkbox\" type=\"checkbox\" name=\"tagidarray[]\" value=\"$result[tagid]\" />",
  80. $result['tagname'],
  81. $tagstatus
  82. ));
  83. }
  84. showtablerow('', array('class="td25" colspan="3"'), array('<input name="chkall" id="chkall" type="checkbox" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'tagidarray\', \'chkall\')" /><label for="chkall">'.cplang('select_all').'</label>'));
  85. showtablerow('', array('class="td25"', 'colspan="2"'), array(
  86. cplang('operation'),
  87. '<input class="radio" type="radio" name="operate_type" value="open" checked> '.cplang('misc_tag_status_0').' &nbsp; &nbsp;<input class="radio" type="radio" name="operate_type" value="close"> '.cplang('misc_tag_status_1').' &nbsp; &nbsp;<input class="radio" type="radio" name="operate_type" value="delete"> '.cplang('delete').' &nbsp; &nbsp;<input class="radio" type="radio" name="operate_type" value="merge"> '.cplang('mergeto').' <input name="newtag" value="" class="txt" type="text">'
  88. ));
  89. showsubmit('submit', 'submit', '', '', $multipage);
  90. showtablefooter();
  91. showformfooter();
  92. }
  93. }
  94. ?>