PageRenderTime 54ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/source/include/portalcp/portalcp_block.php

https://github.com/kuaileshike/upload
PHP | 1044 lines | 928 code | 110 blank | 6 comment | 297 complexity | 377d56a7dcc272834c11801e9792562d MD5 | raw file
  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: portalcp_block.php 31516 2012-09-04 09:19:42Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. include_once libfile('function/block');
  12. $oparr = array('block', 'data', 'style', 'itemdata', 'setting', 'remove', 'item', 'additem', 'blockclass',
  13. 'getblock', 'thumbsetting', 'push', 'recommend', 'verifydata', 'managedata',
  14. 'saveblockclassname', 'saveblocktitle', 'convert', 'favorite', 'banids', 'delrecommend', 'moreurl');
  15. $op = in_array($_GET['op'], $oparr, true) ? $_GET['op'] : 'block';
  16. $_GET['from'] = $_GET['from'] == 'cp' ? 'cp' : null;
  17. $allowmanage = $allowdata = 0;
  18. $block = array();
  19. $bid = !empty($_GET['bid']) ? intval($_GET['bid']) : 0;
  20. if($bid) {
  21. if(!($block = C::t('common_block')->fetch($bid))) {
  22. showmessage('block_not_exist');
  23. }
  24. $blockstyle = array();
  25. if(!empty($block['styleid'])) {
  26. $blockstyle = block_getstyle($block['styleid']);
  27. } else {
  28. $blockstyle = dunserialize($block['blockstyle']);
  29. }
  30. $block['moreurl'] = $blockstyle['moreurl'] && in_array($block['blockclass'], array('forum_thread', 'portal_article', 'group_thread'), true) ? 1 : 0;
  31. $_G['block'][$bid] = $block;
  32. $blockperm = getblockperm($bid);
  33. if($blockperm['allowmanage']) {
  34. $allowmanage = 1;
  35. $allowdata = 1;
  36. }
  37. if ($blockperm['allowrecommend'] && !$blockperm['needverify']) {
  38. $allowdata = 1;
  39. }
  40. }
  41. if(empty($block['bid'])) {
  42. $bid = 0;
  43. }
  44. $_GET['classname'] = !empty($_GET['classname']) ? $_GET['classname'] : ($block ? $block['blockclass'] : 'html_html');
  45. $theclass = block_getclass($_GET['classname'], true);
  46. $theclass['script'] = isset($theclass['script']) ? $theclass['script'] : array();
  47. if(!empty($_GET['styleid']) && isset($theclass['style'][$_GET['styleid']])) {
  48. $thestyle = $theclass['style'][$_GET['styleid']];
  49. } elseif(isset($theclass['style'][$block['styleid']])) {
  50. $_GET['styleid'] = intval($block['styleid']);
  51. $thestyle = $theclass['style'][$_GET['styleid']];
  52. } else {
  53. $_GET['styleid'] = 0;
  54. $thestyle = (array)dunserialize($block['blockstyle']);
  55. }
  56. $_GET['script'] = !empty($_GET['script']) && isset($theclass['script'][$_GET['script']])
  57. ? $_GET['script']
  58. : (!empty($block['script']) ? $block['script'] : key($theclass['script']));
  59. $blocktype = (!empty($_GET['blocktype']) || !empty($block['blocktype'])) ? 1 : 0;
  60. $nocachetime = in_array($_GET['script'], array('blank', 'line', 'banner', 'vedio', 'google')) ? true : false;
  61. $is_htmlblock = ($_GET['classname'] == 'html_html') ? 1 : 0;
  62. $showhtmltip = false;
  63. if($op == 'data' && $is_htmlblock) {
  64. $op = 'block';
  65. $showhtmltip = true;
  66. }
  67. $block['blockclass'] = empty($block['blockclass']) ? $_GET['classname'] : $block['blockclass'];
  68. $is_recommendable = block_isrecommendable($block);
  69. if($op == 'block') {
  70. if($bid && !$allowmanage) {
  71. showmessage('block_edit_nopermission');
  72. }
  73. if(!$bid) {
  74. list($tpl, $id) = explode(':', $_GET['tpl']);
  75. if(trim($tpl)=='portal/portal_topic_content') {
  76. if(!$_G['group']['allowaddtopic'] && !$_G['group']['allowmanagetopic']) {
  77. showmessage('block_topic_nopermission');
  78. }
  79. } elseif(!$_G['group']['allowdiy']) {
  80. showmessage('block_add_nopermission');
  81. }
  82. }
  83. if(submitcheck('blocksubmit')) {
  84. $_POST['cachetime'] = intval($_POST['cachetime']) * 60;
  85. $_POST['styleid'] = intval($_POST['styleid']);
  86. $_POST['shownum'] = intval($_POST['shownum']);
  87. $_POST['picwidth'] = $_POST['picwidth'] ? intval($_POST['picwidth']) : 0;
  88. $_POST['picheight'] = $_POST['picheight'] ? intval($_POST['picheight']) : 0;
  89. $_POST['script'] = isset($theclass['script'][$_POST['script']]) ? $_POST['script'] : key($theclass['script']);
  90. $_POST['a_target'] = in_array($_POST['a_target'], array('blank', 'top', 'self')) ? $_POST['a_target'] : 'blank';
  91. $_POST['dateformat'] = in_array($_POST['dateformat'], array('Y-m-d', 'm-d', 'H:i', 'Y-m-d H:i')) ? $_POST['dateformat'] : 'Y-m-d';
  92. $_POST['isblank'] = intval($_POST['isblank']);
  93. $_POST['cachetimerangestart'] = intval($_POST['cachetimerangestart']);
  94. $_POST['cachetimerangeend'] = intval($_POST['cachetimerangeend']);
  95. $summary = getstr($_POST['summary'], '', 0, 0, 0, 1);
  96. if($summary) {
  97. $tag = block_ckeck_summary($summary);
  98. if($tag != $summary) {
  99. $msg = lang('portalcp', 'block_diy_summary_html_tag').$tag.lang('portalcp', 'block_diy_summary_not_closed');
  100. showmessage($msg);
  101. }
  102. }
  103. $_POST['shownum'] = $_POST['shownum'] > 0 ? $_POST['shownum'] : 10;
  104. $_POST['parameter']['items'] = $_POST['shownum'];
  105. $cachetimerange = $_POST['cachetimerangestart'].','.$_POST['cachetimerangeend'];
  106. if(empty($_G['setting']['blockcachetimerange'])) {
  107. $cachetimerange = $cachetimerange == '0,23' ? '' : $cachetimerange;
  108. } else {
  109. $cachetimerange = $cachetimerange == $_G['setting']['blockcachetimerange'] ? '' : $cachetimerange;
  110. }
  111. include_once libfile('function/home');
  112. $setarr = array(
  113. 'name' => getstr($_POST['name'], 255),
  114. 'summary' => $summary,
  115. 'styleid' => $_POST['styleid'],
  116. 'script' => $_POST['script'],
  117. 'cachetime' => intval($_POST['cachetime']),
  118. 'cachetimerange' => $cachetimerange,
  119. 'punctualupdate' => !empty($_POST['punctualupdate']) ? '1' : '0',
  120. 'shownum' => $_POST['shownum'],
  121. 'picwidth' => $_POST['picwidth'] && $_POST['picwidth'] > 8 && $_POST['picwidth'] < 1960 ? $_POST['picwidth'] : 0,
  122. 'picheight' => $_POST['picheight'] && $_POST['picheight'] > 8 && $_POST['picheight'] < 1960 ? $_POST['picheight'] : 0,
  123. 'target' => $_POST['a_target'],
  124. 'dateuformat' => !empty($_POST['dateuformat']) ? '1' : '0',
  125. 'dateformat' => $_POST['dateformat'],
  126. 'hidedisplay' => $_POST['hidedisplay'] ? '1' : '0',
  127. 'dateline' => TIMESTAMP,
  128. 'isblank' => $_POST['isblank']
  129. );
  130. $picdata = array();
  131. if(!empty($_FILES)) {
  132. foreach($_FILES as $varname => $file) {
  133. if($file['tmp_name']) {
  134. $result = pic_upload($file, 'portal');
  135. $pic = 'portal/'.$result['pic'];
  136. $picdata[] = array('bid' => $bid, 'pic' => $pic, 'picflag' =>$result['remote'] , 'type' => '1');
  137. $pic = $result['remote'] ? $_G['setting']['ftp']['attachurl'].$pic : $_G['setting']['attachurl'].$pic;
  138. $_POST['parameter'][$varname] = $pic;
  139. }
  140. }
  141. }
  142. if(($block['blockclass'] == 'html_html' || $_GET['classname'] == 'html_html') && $_POST['script'] == 'blank' && isset($_POST['parameter']['content'])) {
  143. $_POST['parameter']['content'] = addslashes($_POST['parameter']['content']);
  144. }
  145. $parameter = $_POST['parameter'];
  146. if(isset($block['param'])) {
  147. $parameter = $parameter + $block['param'];
  148. }
  149. $setarr['param'] = serialize($parameter);
  150. if($bid) {
  151. C::t('common_block')->update($bid, $setarr);
  152. } else {
  153. $setarr['blockclass'] = $_GET['classname'];
  154. $setarr['uid'] = $_G['uid'];
  155. $setarr['username'] = $_G['username'];
  156. $setarr['notinherited'] = 0;
  157. if($blocktype == 1) {
  158. $setarr['blocktype'] = '1';
  159. }
  160. $bid = C::t('common_block')->insert($setarr, true);
  161. }
  162. if(!empty($picdata)) {
  163. C::t('common_block_pic')->insert_by_bid($bid, $picdata);
  164. }
  165. $_G['block'][$bid] = C::t('common_block')->fetch($bid);
  166. block_updatecache($bid, true);
  167. showmessage('do_success', 'portal.php?mod=portalcp&ac=block&op=block&bid='.$bid, array('bid'=>$bid, 'eleid'=> $_GET['eleid']));
  168. }
  169. loadcache('blockconvert');
  170. $block['script'] = isset($block['script']) ? $block['script'] : $_GET['script'];
  171. if($block['blockclass'] == 'html_html' && $block['script'] == 'blank'){
  172. $block['param']['content'] = stripslashes($block['param']['content']);
  173. }
  174. $settings = block_setting($_GET['classname'], $block['script'], $block['param']);
  175. $scriptarr = array($block['script'] => ' selected');
  176. $stylearr = array($_GET['styleid'] => ' selected');
  177. $block = block_checkdefault($block);
  178. $cachetimearr = array($block['cachetime'] =>' selected="selected"');
  179. $block['cachetime_min'] = intval($block['cachetime'] / 60);
  180. $targetarr[$block['target']] = ' selected';
  181. $block['cachetimerange'] = empty($block['cachetimerange']) ? (isset($_G['setting']['blockcachetimerange']) ? $_G['setting']['blockcachetimerange'] : '') : $block['cachetimerange'];
  182. $block['cachetimerange'] = empty($block['cachetimerange']) ? array('0', '23') : explode(',', $block['cachetimerange']);
  183. $cachetimerange = range(0, 23);
  184. $dateformats = block_getdateformats($block['dateformat']);
  185. $block['summary'] = dhtmlspecialchars($block['summary']);
  186. $blockclassname = '';
  187. $blockclass = $block['blockclass'] ? $block['blockclass'] : $_GET['classname'];
  188. $arr = explode('_', $blockclass);
  189. if(count($arr) == 2) {
  190. $blockclassname = $_G['cache']['blockclass'][$arr[0]]['subs'][$blockclass]['name'];
  191. }
  192. $blockclassname = empty($blockclassname) ? $blockclass : $blockclassname;
  193. } elseif($op == 'banids') {
  194. if(!$bid || (!$allowmanage && !$allowdata)) {
  195. showmessage('block_edit_nopermission');
  196. }
  197. if(isset($_GET['bannedids']) && $block['param']['bannedids'] != $_GET['bannedids']) {
  198. $arr = explode(',', $_GET['bannedids']);
  199. $arr = array_map('intval', $arr);
  200. $arr = array_filter($arr);
  201. $_GET['bannedids'] = implode(',', $arr);
  202. $block['param']['bannedids'] = $_GET['bannedids'];
  203. C::t('common_block')->update($bid, array('param'=>serialize($block['param'])));
  204. $_G['block'][$bid] = $block;
  205. block_updatecache($bid, true);
  206. }
  207. showmessage('do_success', 'portal.php?mod=portalcp&ac=block&op=data&bid='.$bid, array('bid'=>$bid, 'eleid'=> $_GET['eleid']));
  208. } elseif($op == 'data') {
  209. if(!$bid || (!$allowmanage && !$allowdata)) {
  210. showmessage('block_edit_nopermission');
  211. }
  212. if(submitcheck('updatesubmit')) {
  213. if($_POST['displayorder']) {
  214. asort($_POST['displayorder']);
  215. $orders = $ids = array();
  216. $order = 1;
  217. foreach($_POST['displayorder'] as $k=>$v) {
  218. $k = intval($k);
  219. $ids[] = $k;
  220. $orders[$k] = $order;
  221. $order++;
  222. }
  223. $items = array();
  224. foreach(C::t('common_block_item')->fetch_all($ids) as $value) {
  225. if($value['bid'] == $bid) {
  226. $items[$value['itemid']] = $value;
  227. }
  228. }
  229. foreach($items as $key=>$value) {
  230. $itemtype = !empty($_POST['locked'][$key]) ? '1' : '0';
  231. if($orders[$key] != $value['displayorder'] || $itemtype != $value['itemtype']) {
  232. C::t('common_block_item')->update($key, array('displayorder'=>$orders[$key], 'itemtype'=>$itemtype));
  233. }
  234. }
  235. }
  236. showmessage('do_success', 'portal.php?mod=portalcp&ac=block&op=data&bid='.$bid, array('bid'=>$bid, 'eleid'=> $_GET['eleid']));
  237. }
  238. $itemlist = array();
  239. if($bid) {
  240. $preorders = array();
  241. foreach(C::t('common_block_item')->fetch_all_by_bid($bid, true) as $value) {
  242. if($value['itemtype']==1 && $value['enddate'] && $value['enddate'] <= TIMESTAMP) {
  243. continue;
  244. }
  245. $value['ispreorder'] = false;
  246. if($value['itemtype']==1) {
  247. if($value['startdate'] > TIMESTAMP) {
  248. $value['ispreorder'] = true;
  249. } else {
  250. $preorders[$value['displayorder']] = $value['itemid'];
  251. }
  252. }
  253. $value['itemtypename'] = lang('portalcp', 'itemtypename'.$value['itemtype']);
  254. $itemlist[$value['itemid']] = $value;
  255. }
  256. if($preorders) {
  257. foreach($itemlist as $key=>$value) {
  258. if(isset($preorders[$value['displayorder']]) && $value['itemid'] != $preorders[$value['displayorder']]) {
  259. unset($itemlist[$key]);
  260. }
  261. }
  262. }
  263. }
  264. $block['param']['bannedids'] = !empty($block['param']['bannedids']) ? $block['param']['bannedids'] : '';
  265. } elseif($op == 'style') {
  266. if(!$bid || !$allowmanage) {
  267. showmessage('block_edit_nopermission');
  268. }
  269. if(submitcheck('stylesubmit')) {
  270. $_POST['name'] = trim($_POST['name']);
  271. $arr = array(
  272. 'name' => $_POST['name'],
  273. 'blockclass' => $_GET['classname'],
  274. );
  275. $_POST['template'] = $_POST['template'];
  276. include_once libfile('function/block');
  277. block_parse_template($_POST['template'], $arr);
  278. if(!empty($_POST['name'])) {
  279. $styleid = C::t('common_block_style')->insert($arr, true);
  280. }
  281. $arr['fields'] = dunserialize($arr['fields']);
  282. $arr['template'] = dunserialize($arr['template']);
  283. $arr = serialize($arr);
  284. C::t('common_block')->update($bid, array('blockstyle'=>$arr, 'styleid'=>'0'));
  285. showmessage('do_success', 'portal.php?mod=portalcp&ac=block&op=style&bid='.$bid, array('bid'=>$bid, 'eleid'=> $_GET['eleid']));
  286. }
  287. $template = block_build_template($blockstyle['template']);
  288. $samplecode = '';
  289. if($block['hidedisplay']) {
  290. $samplecode = '<ul>\n'
  291. .'<!--{loop $_G[block_1] $key $value}-->\n'
  292. .'<li><a href="$value[url]">$value[title]</a></li>\n'
  293. .'<!--{/loop}-->\n'
  294. .'</ul>';
  295. $samplecode = dhtmlspecialchars($samplecode);
  296. $samplecode = str_replace('\n', '<br />', $samplecode);
  297. }
  298. } elseif($op == 'itemdata') {
  299. if(!$bid || (!$allowmanage && !$allowdata)) {
  300. showmessage('block_edit_nopermission');
  301. }
  302. if(!$is_recommendable) {
  303. showmessage('block_no_recommend_library');
  304. }
  305. $theurl = 'portal.php?mod=portalcp&ac=block&op=itemdata';
  306. $perpage = 20;
  307. $page = max(1,intval($_GET['page']));
  308. $start = ($page-1)*$perpage;
  309. if($start<0) $start = 0;
  310. if(submitcheck('deletesubmit')) {
  311. if(!empty($_POST['ids'])) {
  312. C::t('common_block_item_data')->delete_by_dataid_bid($_POST['ids'], $bid);
  313. }
  314. showmessage('do_success', "portal.php?mod=portalcp&ac=block&op=itemdata&bid=$bid&page=$page");
  315. }
  316. $count = C::t('common_block_item_data')->count_by_bid($bid);
  317. $multi = '';
  318. $datalist = array();
  319. if($count) {
  320. $datalist = C::t('common_block_item_data')->fetch_all_by_bid($bid, 1, $start, $perpage);
  321. $multi = multi($count, $perpage, $page, "portal.php?mod=portalcp&ac=block&bid=$bid&op=itemdata");
  322. }
  323. } elseif($op == 'setting') {
  324. if(($bid && !$allowmanage)) {
  325. showmessage('block_edit_nopermission');
  326. }
  327. $settings = array();
  328. if($theclass['script'][$_GET['script']]) {
  329. $settings = block_setting($_GET['classname'], $_GET['script'], $block['param']);
  330. }
  331. $block['script'] = isset($block['script']) ? $block['script'] : $_GET['script'];
  332. $scriptarr = array($block['script'] => ' selected');
  333. $stylearr = array($_GET['styleid'] => ' selected');
  334. $block = block_checkdefault($block);
  335. $cachetimearr = array($block['cachetime'] =>' selected="selected"');
  336. $block['cachetime_min'] = intval($block['cachetime'] / 60);
  337. $targetarr[$block['target']] = ' selected';
  338. } elseif($op == 'thumbsetting') {
  339. if(($bid && !$allowmanage)) {
  340. showmessage('block_edit_nopermission');
  341. }
  342. $block = block_checkdefault($block);
  343. $cachetimearr = array($block['cachetime'] =>' selected="selected"');
  344. $block['cachetime_min'] = intval($block['cachetime'] / 60);
  345. $targetarr[$block['target']] = ' selected';
  346. $dateformats = block_getdateformats($block['dateformat']);
  347. } elseif($op == 'remove') {
  348. if(!$bid || (!$allowmanage && !$allowdata)) {
  349. showmessage('block_edit_nopermission');
  350. }
  351. if($_GET['itemid']) {
  352. $_GET['itemid'] = intval($_GET['itemid']);
  353. if(($item = C::t('common_block_item')->fetch($_GET['itemid'])) && $item['bid'] == $bid) {
  354. C::t('common_block_item')->delete($_GET['itemid']);
  355. if($item['itemtype'] != '1') {
  356. block_ban_item($block, $item);
  357. }
  358. block_updatecache($bid, true);
  359. }
  360. }
  361. showmessage('do_success', "portal.php?mod=portalcp&ac=block&op=data&bid=$bid", array('bid'=>$bid));
  362. } elseif( in_array($op, array('item', 'additem', 'push', 'recommend', 'verifydata', 'managedata'))) {
  363. if(!$bid) {
  364. showmessage('block_edit_nopermission');
  365. }
  366. $itemid = $_GET['itemid'] ? intval($_GET['itemid']) : 0;
  367. $dataid = $_GET['dataid'] ? intval($_GET['dataid']) : 0;
  368. $_GET['id'] = intval($_GET['id']);
  369. $_GET['idtype'] = preg_replace('/[^\w]/', '', $_GET['idtype']);
  370. $item = $perm = array();
  371. if($op == 'item' || $op == 'additem') {
  372. if(!$allowmanage && !$allowdata) {
  373. showmessage('block_edit_nopermission');
  374. }
  375. if($itemid && ($item = C::t('common_block_item')->fetch($itemid))) {
  376. $item['fields'] = dunserialize($item['fields']);
  377. }
  378. } elseif($op == 'push') {
  379. $item = get_push_item($block, $thestyle, $_GET['id'], $_GET['idtype']);
  380. if($itemid) {
  381. $item['itemid'] = $itemid;
  382. }
  383. } elseif($op == 'recommend') {
  384. $perm = getblockperm($bid);
  385. if(!$perm['allowmanage'] && !$perm['allowrecommend']) {
  386. showmessage('block_no_right_recommend');
  387. }
  388. $isrepeatrecommend = false;
  389. $idtype = $_GET['idtype'] == 'gtid' ? 'tid' : $_GET['idtype'];
  390. if(($item = C::t('common_block_item_data')->fetch_by_bid_id_idtype($bid, $_GET['id'], $idtype))) {
  391. $item['fields'] = dunserialize($item['fields']);
  392. $isrepeatrecommend = true;
  393. if(!$perm['allowmanage'] && $item['uid'] != $_G['uid']) {
  394. showmessage('data_in_mod_library', null, null, array('striptags' => false));
  395. }
  396. } else {
  397. if(in_array($_GET['idtype'],array('tid', 'gtid', 'aid', 'picid', 'blogid'))) {
  398. $_GET['idtype'] = $_GET['idtype'] == 'gtid' ? 'tids' : $_GET['idtype'].'s';
  399. }
  400. $item = get_push_item($block, $thestyle, $_GET['id'], $_GET['idtype'], $block['blockclass'], $block['script']);
  401. if(empty($item)) showmessage('block_data_type_invalid', null, null, array('msgtype'=>3));
  402. }
  403. } elseif($op=='verifydata' || $op=='managedata') {
  404. if(!$allowmanage && !$allowdata) {
  405. showmessage('no_right_manage_data');
  406. }
  407. if($dataid) {
  408. $item = C::t('common_block_item_data')->fetch($dataid);
  409. $item['fields'] = dunserialize($item['fields']);
  410. }
  411. }
  412. if(!$item && $op != 'additem') {
  413. showmessage('block_edit_nopermission');
  414. }
  415. $item['oldpic'] = $item['pic'];
  416. if($item['picflag'] == '1') {
  417. $item['pic'] = $item['pic'] ? $_G['setting']['attachurl'].$item['pic'] : '';
  418. } elseif($item['picflag'] == '2') {
  419. $item['pic'] = $item['pic'] ? $_G['setting']['ftp']['attachurl'].$item['pic'] : '';
  420. }
  421. $item['startdate'] = $item['startdate'] ? dgmdate($item['startdate']) : dgmdate(TIMESTAMP);
  422. $item['enddate'] = $item['enddate'] ? dgmdate($item['enddate']) : '';
  423. $orders = range(1, $block['shownum']);
  424. $orderarr[$item['displayorder']] = ' selected="selected"';
  425. $item['showstyle'] = !empty($item['showstyle']) ? (array)(dunserialize($item['showstyle'])) : (!empty($item['fields']['showstyle']) ? $item['fields']['showstyle'] : array());
  426. $showstylearr = array();
  427. foreach(array('title_b', 'title_i', 'title_u', 'title_c', 'summary_b', 'summary_i', 'summary_u', 'title_c') as $value) {
  428. if(!empty($item['showstyle'][$value])) {
  429. $showstylearr[$value] = 'class="a"';
  430. }
  431. }
  432. $itemfields = $blockitem = $item;
  433. unset($itemfields['fields']);
  434. $item['fields'] = (array)$item['fields'];
  435. foreach($item['fields'] as $key=>$value) {
  436. if($theclass['fields'][$key]) {
  437. switch($theclass['fields'][$key]['datatype']) {
  438. case 'date':
  439. $itemfields[$key] = dgmdate($value, 'Y-m-d H:i:s');
  440. break;
  441. case 'int':
  442. $itemfields[$key] = intval($value);
  443. break;
  444. case 'string':
  445. $itemfields[$key] = dhtmlspecialchars($value);
  446. break;
  447. default:
  448. $itemfields[$key] = $value;
  449. }
  450. }
  451. }
  452. $showfields = array();
  453. if(empty($thestyle['fields'])) {
  454. $template = block_build_template($thestyle['template']);
  455. $thestyle['fields'] = block_parse_fields($template);
  456. C::t('common_block_style')->update(intval($thestyle['styleid']), array('fields'=>serialize($thestyle['fields'])));
  457. }
  458. foreach($thestyle['fields'] as $fieldname) {
  459. $showfields[$fieldname] = "1";
  460. }
  461. if(submitcheck('itemsubmit') || submitcheck('recommendsubmit') || submitcheck('verifydatasubmit') || submitcheck('managedatasubmit')) {
  462. $item['bid'] = $block['bid'];
  463. $item['displayorder'] = intval($_POST['displayorder']);
  464. $item['startdate'] = !empty($_POST['startdate']) ? strtotime($_POST['startdate']) : 0;
  465. $item['enddate'] = !empty($_POST['enddate']) ? strtotime($_POST['enddate']) : 0;
  466. $item['itemtype'] = !empty($_POST['locked']) ? '1' : '2';
  467. $item['title'] = dhtmlspecialchars($_POST['title']);
  468. $item['url'] = $_POST['url'];
  469. $block['param']['summarylength'] = empty($block['param']['summarylength']) ? 80 : $block['param']['summarylength'];
  470. $block['param']['titlelength'] = empty($block['param']['titlelength']) ? 40 : $block['param']['titlelength'];
  471. $item['summary'] = cutstr($_POST['summary'], $block['param']['summarylength'], '');
  472. if($_FILES['pic']['tmp_name']) {
  473. $result = pic_upload($_FILES['pic'], 'portal');
  474. $item['pic'] = 'portal/'.$result['pic'];
  475. $item['picflag'] = $result['remote'] ? '2' : '1';
  476. $item['makethumb'] = 0;
  477. $item['thumbpath'] = '';
  478. $thumbdata = array('bid' => $block['bid'], 'itemid' => $item['itemid'], 'pic' => $item['pic'], 'picflag' => $result['remote'], 'type' => '1');
  479. C::t('common_block_pic')->insert($thumbdata);
  480. } elseif($_POST['pic']) {
  481. $pic = dhtmlspecialchars($_POST['pic']);
  482. $urls = parse_url($pic);
  483. if(!empty($urls['scheme']) && !empty($urls['host'])) {
  484. $item['picflag'] = '0';
  485. $item['thumbpath'] = '';
  486. } else {
  487. $item['picflag'] = intval($_POST['picflag']);
  488. }
  489. if($item['pic'] != $pic) {
  490. $item['pic'] = $pic;
  491. $item['makethumb'] = 0;
  492. $item['thumbpath'] = block_thumbpath($block, $item);
  493. }
  494. }
  495. unset($item['oldpic']);
  496. $item['showstyle'] = $_POST['showstyle']['title_b'] || $_POST['showstyle']['title_i'] || $_POST['showstyle']['title_u'] || $_POST['showstyle']['title_c'] ? $_POST['showstyle'] : array();
  497. $item['showstyle'] = empty($item['showstyle']) ? '' : serialize($item['showstyle']);
  498. foreach($theclass['fields'] as $key=>$value) {
  499. if(!isset($item[$key]) && isset($_POST[$key])) {
  500. if($value['datatype'] == 'int') {
  501. $_POST[$key] = intval($_POST[$key]);
  502. } elseif($value['datatype'] == 'date') {
  503. $_POST[$key] = strtotime($_POST[$key]);
  504. } else {
  505. $_POST[$key] = $_POST[$key];
  506. }
  507. $item['fields'][$key] = $_POST[$key];
  508. }
  509. }
  510. if(isset($item['fields']['fulltitle'])) {
  511. $item['fields']['fulltitle'] = $item['title'];
  512. }
  513. $item['fields'] = serialize($item['fields']);
  514. $item['title'] = cutstr($item['title'], $block['param']['titlelength'], '');
  515. if($_POST['icflag']) {
  516. $item['makethumb'] = 1;
  517. $item['thumbpath'] = block_thumbpath($block, $item);
  518. }
  519. if(submitcheck('itemsubmit')) {
  520. if($op == 'additem' && !$item['id']) {
  521. $item['id'] = ($pushid = intval($_POST['push_id'])) ? $pushid : mt_rand(1,9999);
  522. $item['idtype'] = 'rand';
  523. }
  524. if($item['startdate'] > $_G['timestamp']) {
  525. C::t('common_block_item')->insert($item, false, true);
  526. } elseif(empty($item['enddate']) || $item['enddate'] > $_G['timestamp']) {
  527. C::t('common_block_item')->delete_by_bid_displayorder($bid, $item['displayorder']);
  528. C::t('common_block_item')->insert($item, false, true);
  529. } else {
  530. C::t('common_block_item')->delete_by_itemid_bid($item['itemid'], $bid);
  531. }
  532. block_updatecache($bid, true);
  533. showmessage('do_success', 'portal.php?mod=portalcp&ac=block&op=data&bid='.$block['bid'], array('bid'=>$bid));
  534. } elseif(submitcheck('recommendsubmit')) {
  535. include_once libfile('function/home');
  536. $thumbpath = $item['thumbpath'];
  537. unset($item['itemid']);
  538. unset($item['thumbpath']);
  539. $item['itemtype'] = '0';
  540. $item['uid'] = $_G['uid'];
  541. $item['username'] = $_G['username'];
  542. $item['dateline'] = TIMESTAMP;
  543. $item['isverified'] = empty($_POST['needverify']) && ($perm['allowmanage'] || empty($perm['needverify'])) ? '1' : '0';
  544. $item['verifiedtime'] = TIMESTAMP;
  545. C::t('common_block_item_data')->insert($item, false, true);
  546. if($_GET['showrecommendtip'] && (in_array($_GET['idtype'], array('tids', 'tid', 'gtid')))) {
  547. $modarr = array(
  548. 'tid' => $item['id'],
  549. 'uid' => $item['uid'],
  550. 'username' => $item['username'],
  551. 'dateline' => TIMESTAMP,
  552. 'action' => 'REB',
  553. 'status' => '1',
  554. 'stamp' => '',
  555. 'reason' => getstr($_GET['recommendto'], 20),
  556. );
  557. C::t('forum_threadmod')->insert($modarr);
  558. $data = array('moderated' => 1);
  559. loadcache('stamptypeid');
  560. if(array_key_exists(4, $_G['cache']['stamptypeid'])) {
  561. $data['stamp'] = $_G['cache']['stamptypeid']['4'];
  562. }
  563. C::t('forum_thread')->update($item['id'], $data);
  564. }
  565. if($_POST['icflag'] && !(C::t('common_block_pic')->count_by_bid_pic($block['bid'], $thumbpath))) {
  566. $picflag = 0; //common_block_pic表中的picflag标识(0本地,1远程)
  567. if($_G['setting']['ftp']['on']) {
  568. $ftp = & discuz_ftp::instance();
  569. $ftp->connect();
  570. if($ftp->connectid && $ftp->ftp_size($thumbpath) > 0 || $ftp->upload($_G['setting']['attachurl'].'/'.$thumbpath, $thumbpath)) {
  571. $picflag = 1; //common_block_pic表中的picflag标识(0本地,1远程)
  572. @unlink($_G['setting']['attachdir'].'./'.$thumbpath);
  573. }
  574. }
  575. $thumbdata = array('bid' => $block['bid'], 'itemid' => 0, 'pic' => $thumbpath, 'picflag' => $picflag, 'type' => '0');
  576. C::t('common_block_pic')->insert($thumbdata);
  577. }
  578. if(!empty($_POST['updateblock'])) {
  579. block_updatecache($bid, true);
  580. }
  581. if(($_G['group']['reasonpm'] == 2 || $_G['group']['reasonpm'] == 3) || !empty($_GET['sendreasonpm'])) {
  582. $sendreasonpm = 1;
  583. } else {
  584. $sendreasonpm = 0;
  585. }
  586. if($sendreasonpm) {
  587. require_once libfile('function/misc');
  588. if((in_array($_GET['idtype'], array('tids', 'tid', 'gtid')))) {
  589. $sendreasonpmcontent = C::t('forum_thread')->fetch($item['id']);
  590. sendreasonpm($sendreasonpmcontent, 'recommend_note_post', array(
  591. 'tid' => $item['id'],
  592. 'subject' => $sendreasonpmcontent['subject'],
  593. 'from_id' => 0,
  594. 'from_idtype' => 'recommend'
  595. ));
  596. }
  597. }
  598. $showrecommendrate = '';
  599. if($_G['group']['raterange'] && (in_array($_GET['idtype'], array('tids', 'tid', 'gtid')))) {
  600. $showrecommendrate = 1;
  601. }
  602. if($showrecommendrate) {
  603. showmessage('do_success', dreferer('portal.php'), array(), array('showdialog' => true, 'closetime' => 0.01, 'extrajs' =>
  604. '<script type="text/javascript" reload="1">
  605. showWindow("rate", "forum.php?mod=misc&action=rate&tid='.$item[id].'&pid='.$_GET[recommend_thread_pid].'&showratetip=1", "get", -1);
  606. </script>'));
  607. } elseif($_GET['showrecommendtip']) {
  608. showmessage('do_success', dreferer('portal.php'), array(), array('showdialog' => true, 'closetime' => true, 'extrajs' =>
  609. '<script type="text/javascript" reload="1">
  610. window.location.reload();
  611. </script>'));
  612. } else {
  613. showmessage('do_success', dreferer('portal.php'), array(), array('showdialog' => true, 'closetime' => true));
  614. }
  615. } elseif(submitcheck('verifydatasubmit')) {
  616. unset($item['thumbpath']);
  617. $item['isverified'] = '1';
  618. $item['verifiedtime'] = TIMESTAMP;
  619. C::t('common_block_item_data')->update($dataid, $item);
  620. if(!empty($_POST['updateblock'])) {
  621. block_updatecache($bid, true);
  622. }
  623. showmessage('do_success', dreferer('portal.php?mod=portalcp&ac=portalblock&op=verifieddata&searchkey=%23'.$bid));
  624. } elseif(submitcheck('managedatasubmit')) {
  625. unset($item['thumbpath']);
  626. $item['stickgrade'] = intval($_POST['stickgrade']);
  627. C::t('common_block_item_data')->update($dataid, $item);
  628. showmessage('do_success', dreferer('portal.php?mod=portalcp&ac=block&op=itemdata&bid='.$bid));
  629. }
  630. }
  631. if(in_array($block['blockclass'], array('forum_thread', 'portal_article', 'group_thread', 'space_blog'), true)) {
  632. $picdatas = array();
  633. $prefix = ($item['picflag'] == 2 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']);
  634. $itemfields['pics'] = array();
  635. $first = true;
  636. if(empty($_GET['idtype'])) {
  637. $_GET['idtype'] = $itemfields['idtype'].'s';
  638. $_GET['id'] = $itemfields['id'];
  639. }
  640. if(in_array($_GET['idtype'], array('tids', 'tid'))) {
  641. $prefix .= 'forum/';
  642. $firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_GET['id']);
  643. foreach(C::t('forum_attachment_n')->fetch_all_by_pid_width('pid:'.$firstpost['pid'], $firstpost['pid'], $block['picwidth']) as $pic) {
  644. if($first) {
  645. $first = false;
  646. $itemfields['pics'][0] = '';
  647. if(strpos($itemfields['oldpic'], 'nophoto.gif') !== false) {
  648. $itemfields['oldpic'] = 'forum/'.$pic['attachment'];
  649. }
  650. }
  651. $thumb = $prefix.($pic['thumb'] ? getimgthumbname($pic['attachment']) : $pic['attachment']);
  652. if('forum/'.$pic['attachment'] == $itemfields['oldpic']) {
  653. $itemfields['pics'][0] = array('big' => $prefix.$pic['attachment'], 'thumb' => $thumb, 'attachment' => 'forum/'.$pic['attachment'], 'first' => 1);
  654. } else {
  655. $itemfields['pics'][] = array('big' => $prefix.$pic['attachment'], 'thumb' => $thumb, 'attachment' => 'forum/'.$pic['attachment'], 'first' => 0);
  656. }
  657. }
  658. if(empty($itemfields['pics'][0])) {
  659. unset($itemfields['pics'][0]);
  660. }
  661. } elseif($_GET['idtype'] == 'aids') {
  662. $prefix .= 'portal/';
  663. foreach(C::t('portal_attachment')->fetch_all_by_aid($_GET['id']) as $pic) {
  664. if($first) {
  665. $first = false;
  666. $itemfields['pics'][0] = '';
  667. if(strpos($itemfields['oldpic'], 'nophoto.gif') !== false) {
  668. $itemfields['oldpic'] = 'portal/'.$pic['attachment'];
  669. }
  670. }
  671. $thumb = $prefix.($pic['thumb'] ? getimgthumbname($pic['attachment']) : $pic['attachment']);
  672. if('portal/'.$pic['attachment'] == $itemfields['oldpic']) {
  673. $itemfields['pics'][0] = array('big' => $prefix.$pic['attachment'], 'thumb' => $thumb, 'attachment' => 'portal/'.$pic['attachment'], 'first' => 1);
  674. } else {
  675. $itemfields['pics'][] = array('big' => $prefix.$pic['attachment'], 'thumb' => $thumb, 'attachment' => 'portal/'.$pic['attachment'], 'first' => 0);
  676. }
  677. }
  678. if(empty($itemfields['pics'][0])) {
  679. unset($itemfields['pics'][0]);
  680. }
  681. } elseif($_GET['idtype'] == 'blogids') {
  682. $itemfields['pics'][] = array('big' => $itemfields['pic'], 'thumb' => 1, 'attachment' => $itemfields['oldpic']);
  683. }
  684. }
  685. } elseif ($op == 'getblock') {
  686. if(!$bid || (!$allowmanage && !$allowdata)) {
  687. showmessage('block_edit_nopermission');
  688. }
  689. block_get_batch($bid);
  690. if(!empty($_GET['forceupdate'])) block_updatecache($bid, !empty($_GET['forceupdate']));
  691. if(strexists($block['summary'], '<script')) {
  692. $block['summary'] = lang('portalcp', 'block_diy_nopreview');
  693. $_G['block'][$bid] = $block;
  694. $_G['block'][$bid]['cachetime'] = 0;
  695. $_G['block'][$bid]['nocache'] = true;
  696. }
  697. $html = block_fetch_content($bid, $block['blocktype']);
  698. } elseif ($op == 'saveblockclassname') {
  699. if(!$bid || !$allowmanage) {
  700. showmessage('block_edit_nopermission');
  701. }
  702. if (submitcheck('saveclassnamesubmit')) {
  703. $setarr = array('classname'=>getstr($_POST['classname'], 100, 0, 0, 0, -1));
  704. C::t('common_block')->update($bid, $setarr);
  705. }
  706. C::t('common_block')->clear_cache($bid);
  707. showmessage('do_success');
  708. } elseif ($op == 'saveblocktitle') {
  709. if(!$bid || !$allowmanage) {
  710. showmessage('block_edit_nopermission');
  711. }
  712. if (submitcheck('savetitlesubmit')) {
  713. $_POST['title'] = preg_replace('/\<script|\<iframe|\<\/iframe\>/is', '', $_POST['title']);
  714. $title = $_POST['title'];
  715. $title = preg_replace('/url\([\'"](.*?)[\'"]\)/','url($1)',$title);
  716. $_G['siteurl'] = str_replace(array('/','.'),array('\/','\.'),$_G['siteurl']);
  717. $title = preg_replace('/\"'.$_G['siteurl'].'(.*?)\"/','"$1"',$title);
  718. $setarr = array('title'=>$title);
  719. C::t('common_block')->update($bid, $setarr);
  720. }
  721. C::t('common_block')->clear_cache($bid);
  722. showmessage('do_success');
  723. } elseif ($op == 'convert') {
  724. if(!$bid || !$allowmanage) {
  725. showmessage('block_edit_nopermission');
  726. }
  727. block_convert($bid, $_GET['toblockclass']);
  728. } elseif ($op == 'favorite') {
  729. $perm = getblockperm($bid);
  730. if(!$perm['allowmanage'] && !$perm['allowrecommend']) {
  731. showmessage('block_no_right_recommend');
  732. }
  733. $favoriteop = '';
  734. if(!block_check_favorite($_G['uid'], $bid)) {
  735. $setarr = array(
  736. 'uid' => $_G['uid'],
  737. 'bid' => $bid,
  738. );
  739. block_add_favorite($setarr);
  740. $favoriteop = 'add';
  741. } else {
  742. block_delete_favorite($_G['uid'], $bid);
  743. $favoriteop = 'del';
  744. }
  745. } elseif($op == 'delrecommend') {
  746. $perm = getblockperm($bid);
  747. if(!$perm['allowmanage'] && !$perm['allowrecommend']) {
  748. showmessage('block_no_right_recommend');
  749. }
  750. if(($_GET['dataid'] = dintval($_GET['dataid']))) {
  751. C::t('common_block_item_data')->delete($_GET['dataid']);
  752. block_updatecache($bid, true);
  753. }
  754. showmessage('do_success');
  755. } elseif($op == 'moreurl') {
  756. if(!$bid || !$allowmanage) {
  757. showmessage('block_edit_nopermission');
  758. }
  759. if(submitcheck('moreurlsubmit')) {
  760. $arr = array(
  761. 'perpage' => max(1, intval($_POST['perpage'])),
  762. 'seotitle' => $_POST['seotitle'],
  763. 'seokeywords' => $_POST['seokeywords'],
  764. 'seodescription' => $_POST['seodescription'],
  765. );
  766. $block['param']['moreurl'] = $arr;
  767. C::t('common_block')->update($bid, array('param' => serialize($block['param'])));
  768. showmessage('do_success', 'portal.php?mod=portalcp&ac=block&op=moreurl&bid='.$bid, array('bid'=>$bid));
  769. }
  770. $block['param']['moreurl'] = !empty($block['param']['moreurl']) ? $block['param']['moreurl'] :
  771. array('perpage' => 20, 'seotitle' => $block['name'], 'keywords' => '', 'description' => '');
  772. }
  773. include_once template("portal/portalcp_block");
  774. function block_checkdefault($block) {
  775. if(empty($block['shownum'])) {
  776. $block['shownum'] = 10;
  777. }
  778. if(!isset($block['cachetime'])) {
  779. $block['cachetime'] = '3600';
  780. }
  781. if(empty($block['picwidth'])) {
  782. $block['picwidth'] = "200";
  783. }
  784. if(empty($block['picheight'])) {
  785. $block['picheight'] = "200";
  786. }
  787. if(empty($block['target'])) {
  788. $block['target'] = "blank";
  789. }
  790. return $block;
  791. }
  792. function block_getdateformats($format='') {
  793. $formats = array('Y-m-d', 'm-d', 'H:i', 'Y-m-d H:i');
  794. $return = array();
  795. foreach($formats as $value) {
  796. $return[] = array(
  797. 'format' => $value,
  798. 'selected' => $format==$value ? ' selected="selected"' : '',
  799. 'time' => dgmdate(TIMESTAMP, $value)
  800. );
  801. }
  802. return $return;
  803. }
  804. function block_ban_item($block, $item) {
  805. global $_G;
  806. $parameters = !empty($block['param']) ? $block['param'] : array();
  807. $bannedids = !empty($parameters['bannedids']) ? explode(',', $parameters['bannedids']) : array();
  808. $bannedids[] = intval($item['id']);
  809. $bannedids = array_unique($bannedids);
  810. $parameters['bannedids'] = implode(',', $bannedids);
  811. $_G['block'][$block['bid']]['param'] = $parameters;
  812. $parameters = serialize($parameters);
  813. C::t('common_block')->update($block['bid'], array('param'=>$parameters));
  814. }
  815. function get_push_item($block, $blockstyle, $id, $idtype, $blockclass = '', $script = '') {
  816. $item = array();
  817. $obj = null;
  818. if(empty($blockclass) || empty($script)) {
  819. if($idtype == 'tids') {
  820. $obj = block_script('forum', 'thread');
  821. } elseif($idtype == 'gtids') {
  822. $obj = block_script('group', 'groupthread');
  823. } elseif($idtype == 'aids') {
  824. $obj = block_script('portal', 'article');
  825. } elseif($idtype == 'picids') {
  826. $obj = block_script('space', 'pic');
  827. } elseif($idtype == 'blogids') {
  828. $obj = block_script('space', 'blog');
  829. }
  830. } else {
  831. list($blockclass) = explode('_', $blockclass);
  832. $obj = block_script($blockclass, $script);
  833. }
  834. if($obj && is_object($obj)) {
  835. $paramter = array($idtype => intval($id));
  836. if(isset($block['param']['picrequired'])) {
  837. $paramter['picrequired'] = $block['param']['picrequired'];
  838. }
  839. $return = $obj->getData($blockstyle, $paramter);
  840. if($return['data']) {
  841. $item = array_shift($return['data']);
  842. }
  843. }
  844. return $item;
  845. }
  846. function block_convert($bid, $toblockclass) {
  847. global $_G;
  848. $bid = intval($bid);
  849. if(empty($bid) || empty($toblockclass)) return false;
  850. if(($block = C::t('common_block')->fetch($bid))) {
  851. loadcache('blockconvert');
  852. $fromblockclass = $block['blockclass'];
  853. list($bigclass) = explode('_', $fromblockclass);
  854. $convertrule = null;
  855. if(!empty($_G['cache']['blockconvert']) && !empty($_G['cache']['blockconvert'][$bigclass][$fromblockclass][$toblockclass])) {
  856. $convertrule = $_G['cache']['blockconvert'][$bigclass][$fromblockclass][$toblockclass];
  857. }
  858. if(!empty($convertrule)) {
  859. $blockstyle = array();
  860. if($block['styleid']) {
  861. if(($blockstyle = C::t('common_block_style')->fetch(intval($block['styleid'])))) {
  862. unset($blockstyle['styleid']);
  863. $blockstyle['fields'] = dunserialize($blockstyle['fields']);
  864. $blockstyle['template'] = dunserialize($blockstyle['template']);
  865. }
  866. } elseif($block['blockstyle']) {
  867. $blockstyle = dunserialize($block['blockstyle']);
  868. }
  869. if($blockstyle) {
  870. $blockstyle['name'] = '';
  871. $blockstyle['blockclass'] = $toblockclass;
  872. foreach($blockstyle['fields'] as $key => $value) {
  873. $blockstyle['fields'][$key] = str_replace($convertrule['searchkeys'], $convertrule['replacekeys'], $value);
  874. }
  875. $fun = create_function('&$v','$v = "{".$v."}";');
  876. array_walk($convertrule['searchkeys'], $fun);
  877. array_walk($convertrule['replacekeys'], $fun);
  878. foreach($blockstyle['template'] as $key => $value) {
  879. $blockstyle['template'][$key] = str_replace($convertrule['searchkeys'], $convertrule['replacekeys'], $value);
  880. }
  881. unset($block['bid']);
  882. $block['styleid'] = '0';
  883. $block['script'] = $convertrule['script'];
  884. $block['blockclass'] = $toblockclass;
  885. $block['blockstyle'] = serialize($blockstyle);
  886. $block['param'] = serialize($block['param']);
  887. C::t('common_block')->update($bid, $block);
  888. }
  889. }
  890. }
  891. }
  892. function block_check_favorite($uid, $bid){
  893. $uid = intval($uid);
  894. $bid = intval($bid);
  895. if($uid && $bid) {
  896. return C::t('common_block_favorite')->count_by_uid_bid($uid, $bid);
  897. } else {
  898. return false;
  899. }
  900. }
  901. function block_add_favorite($setarr){
  902. $arr = array(
  903. 'uid' => intval($setarr['uid']),
  904. 'bid' => intval($setarr['bid']),
  905. 'dateline' => TIMESTAMP
  906. );
  907. return C::t('common_block_favorite')->insert($arr, true);
  908. }
  909. function block_delete_favorite($uid, $bid){
  910. $uid = intval($uid);
  911. $bid = intval($bid);
  912. if($uid && $bid) {
  913. return C::t('common_block_favorite')->delete_by_uid_bid($uid, $bid);
  914. } else {
  915. return false;
  916. }
  917. }
  918. function block_ckeck_summary($summary){
  919. if($summary) {
  920. $tags = array('div', 'table', 'tbody', 'tr', 'td', 'th');
  921. foreach($tags as $tag) {
  922. preg_match_all('/(<'.$tag.')|(<\/'.$tag.'>)/i', $summary, $all);
  923. if(!empty($all[1]) && !empty($all[2])) {
  924. $all[1] = array_filter($all[1]);
  925. $all[2] = array_filter($all[2]);
  926. if(count($all[1]) !== count($all[2])) {
  927. return $tag;
  928. }
  929. }
  930. }
  931. }
  932. return $summary;
  933. }
  934. ?>