BxForumModule.php 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Forum Forum
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxForumModule extends BxBaseModTextModule
  12. {
  13. function __construct(&$aModule)
  14. {
  15. parent::__construct($aModule);
  16. }
  17. public function sortParticipants ($aParticipants, $iProfileIdLastComment, $iProfileIdAuthor, $iProfileIdCurrent = 0)
  18. {
  19. if (!$iProfileIdCurrent)
  20. $iProfileIdCurrent = bx_get_logged_profile_id();
  21. $aMoveUp = array($iProfileIdCurrent, $iProfileIdLastComment, $iProfileIdAuthor);
  22. asort($aParticipants, SORT_NUMERIC);
  23. foreach ($aMoveUp as $iProfileId) {
  24. if (!isset($aParticipants[$iProfileId]))
  25. continue;
  26. $a = array($iProfileId => $aParticipants[$iProfileId]);
  27. unset($aParticipants[$iProfileId]);
  28. $aParticipants = $a + $aParticipants;
  29. }
  30. return $aParticipants;
  31. }
  32. /**
  33. * Action methods
  34. */
  35. public function actionUpdateStatus($sAction = '', $iContentId = 0)
  36. {
  37. if(empty($sAction) && bx_get('action') !== false)
  38. $sAction = bx_process_input(bx_get('action'));
  39. if(empty($iContentId) && bx_get('id') !== false)
  40. $iContentId = (int)bx_get('id');
  41. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  42. if(empty($aContentInfo) || !is_array($aContentInfo))
  43. return echoJson(array('code' => 1, 'message' => _t('_bx_forum_err_not_found')));
  44. $sMethodCheck = 'checkAllowed' . bx_gen_method_name($sAction) . 'AnyEntry';
  45. $sResult = $this->$sMethodCheck($aContentInfo);
  46. if($sResult !== CHECK_ACTION_RESULT_ALLOWED)
  47. return echoJson(array('code' => 2, 'message' => $sResult));
  48. bx_audit(
  49. $iContentId,
  50. $this->getName(),
  51. '_sys_audit_action_' . $sAction,
  52. $this->_prepareAuditParams($aContentInfo, false)
  53. );
  54. if(!$this->_oDb->updateStatus($sAction, $aContentInfo))
  55. return echoJson(array('code' => 3, 'message' => _t('_error occured')));
  56. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  57. $this->alertAfterEdit($aContentInfo);
  58. echoJson(array('code' => 0, 'id' => $iContentId, 'reload' => 1));
  59. }
  60. public function actionAjaxGetAuthors()
  61. {
  62. $aResult = BxDolService::call('system', 'profiles_search', array(bx_get('term')), 'TemplServiceProfiles');
  63. header('Content-Type:text/javascript; charset=utf-8');
  64. echo json_encode($aResult);
  65. }
  66. /**
  67. * Service methods
  68. */
  69. public function serviceGetSafeServices()
  70. {
  71. $a = parent::serviceGetSafeServices();
  72. return array_merge($a, array (
  73. 'BrowseNew' => '',
  74. 'BrowseLatest' => '',
  75. 'BrowseTop' => '',
  76. 'BrowsePopular' => '',
  77. 'BrowseUpdated' => '',
  78. 'BrowsePartaken' => '',
  79. 'BrowseIndex' => '',
  80. 'Search' => '',
  81. ));
  82. }
  83. /**
  84. * @page service Service Calls
  85. * @section bx_forum Discussions
  86. * @subsection bx_forum-other Other
  87. * @subsubsection bx_forum-get_searchable_fields get_searchable_fields
  88. *
  89. * @code bx_srv('bx_forum', 'get_searchable_fields', [...]); @endcode
  90. *
  91. * Get searchable fields for Studio settings.
  92. *
  93. * @return an array with key-value pairs to be used in settings dropdown field.
  94. *
  95. * @see BxForumModule::serviceGetSearchableFields
  96. */
  97. /**
  98. * @ref bx_forum-get_searchable_fields "get_searchable_fields"
  99. */
  100. public function serviceGetSearchableFields ($aInputsAdd = array())
  101. {
  102. $CNF = &$this->_oConfig->CNF;
  103. $aResult = parent::serviceGetSearchableFields($aInputsAdd);
  104. $aResult[$CNF['FIELD_TEXT_COMMENTS']] = _t('_bx_forum_form_entry_input_text_comments');
  105. return $aResult;
  106. }
  107. /**
  108. * Service methods
  109. */
  110. /**
  111. * @page service Service Calls
  112. * @section bx_forum Discussions
  113. * @subsection bx_forum-other Other
  114. * @subsubsection bx_forum-get_info get_info
  115. *
  116. * @code bx_srv('bx_forum', 'get_info', [...]); @endcode
  117. *
  118. * Get content info by content ID. Is used in "Content Info Objects" system.
  119. *
  120. * @param $iContentId integer value with content ID.
  121. * @param $bSearchableFieldsOnly (optional) boolean value determining all info or "searchable fields" only will be returned.
  122. * @return an array with content info. Empty array is returned if something is wrong.
  123. *
  124. * @see BxForumModule::serviceGetInfo
  125. */
  126. /**
  127. * @ref bx_forum-get_info "get_info"
  128. */
  129. public function serviceGetInfo ($iContentId, $bSearchableFieldsOnly = true)
  130. {
  131. $aContentInfo = $this->_getFields($iContentId);
  132. if(empty($aContentInfo))
  133. return array();
  134. return $aContentInfo;
  135. }
  136. /**
  137. * @page service Service Calls
  138. * @section bx_forum Discussions
  139. * @subsection bx_forum-page_blocks Page Blocks
  140. * @subsubsection bx_forum-categories_list categories_list
  141. *
  142. * @code bx_srv('bx_forum', 'categories_list', [...]); @endcode
  143. *
  144. * Get reviews rating for particular content
  145. * @param $aParams additional params array, such as 'show_empty'
  146. *
  147. * @see BxForumModule::serviceCategoriesList
  148. */
  149. /**
  150. * @ref bx_forum-categories_list "categories_list"
  151. */
  152. public function serviceCategoriesList($aParams = array())
  153. {
  154. $aCategoriest = bx_srv('system', 'categories_list', ['bx_forum_cats', ['show_empty' => true]],'TemplServiceCategory');
  155. $bShowEmpty = isset($aParams['show_empty']) ? (bool)$aParams['show_empty'] : false;
  156. $bShowEmptyCategories = isset($aParams['show_empty_categories']) ? (bool)$aParams['show_empty_categories'] : false;
  157. if (!($o = BxDolCategory::getObjectInstance('bx_forum_cats')))
  158. return $bShowEmpty ? MsgBox(_t('_Empty')) : '';
  159. $aCategories = $o->getCategoriesList($bShowEmptyCategories, true);
  160. if(!isset($aCategories['bx_repeat:cats']))
  161. return $bShowEmpty ? MsgBox(_t('_Empty')) : '';
  162. foreach ($aCategories['bx_repeat:cats'] as $sKey => $aCategory) {
  163. $aCategories['bx_repeat:cats'][$sKey]['icon'] = '';
  164. $aCategories['bx_repeat:cats'][$sKey]['class'] = $aCategory['value'] == bx_get('category') ? 'bx-forum-category-list-item-selected' : '';
  165. $aCategoryData = $this->_oDb->getCategories(array('type' => 'by_category', 'category' => $aCategory['value']));
  166. if(isset($aCategoryData['icon']))
  167. $aCategories['bx_repeat:cats'][$sKey]['icon'] = $this->_oTemplate->getImage($aCategoryData['icon'], array('class' => 'sys-icon sys-colored'));
  168. if(isset($aCategoryData['visible_for_levels']) && $aCategoryData['visible_for_levels'] != '' && !BxDolAcl::getInstance()->isMemberLevelInSet($aCategoryData['visible_for_levels'])){
  169. unset($aCategories['bx_repeat:cats'][$sKey]);
  170. }
  171. }
  172. return $this->_oTemplate->parseHtmlByName('category_list.html', $aCategories);
  173. }
  174. /**
  175. * @page service Service Calls
  176. * @section bx_forum Discussions
  177. * @subsection bx_forum-page_blocks Page Blocks
  178. * @subsubsection bx_forum-browse_new browse_new
  179. *
  180. * @code bx_srv('bx_forum', 'browse_new', [...]); @endcode
  181. *
  182. * Get page block with a list of items ordered by newness and represented as table.
  183. *
  184. * @param $sUnitView (optional) string with unit view type.
  185. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  186. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  187. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  188. *
  189. * @see BxForumModule::serviceBrowseNew
  190. */
  191. /**
  192. * @ref bx_forum-browse_new "browse_new"
  193. */
  194. public function serviceBrowseNew ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  195. {
  196. $sType = 'new';
  197. if($sUnitView != 'table')
  198. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  199. return $this->_serviceBrowseTable(array(
  200. 'type' => $sType,
  201. 'empty_message' => $bEmptyMessage,
  202. 'ajax_paginate' => $bAjaxPaginate
  203. ), $bShowHeader);
  204. }
  205. /**
  206. * @page service Service Calls
  207. * @section bx_forum Discussions
  208. * @subsection bx_forum-page_blocks Page Blocks
  209. * @subsubsection bx_forum-browse_latest browse_latest
  210. *
  211. * @code bx_srv('bx_forum', 'browse_latest', [...]); @endcode
  212. *
  213. * Get page block with a list of items ordered by Recent Posts in them and represented as table.
  214. *
  215. * @param $sUnitView (optional) string with unit view type.
  216. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  217. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  218. * @param $bShowHeader (optional) boolean value determining whether a resulting table should have Header section or not.
  219. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  220. *
  221. * @see BxForumModule::serviceBrowseNew
  222. */
  223. /**
  224. * @ref bx_forum-browse_latest "browse_latest"
  225. */
  226. public function serviceBrowseLatest($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = true)
  227. {
  228. $sType = 'latest';
  229. if($sUnitView != 'table')
  230. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  231. return $this->_serviceBrowseTable(array(
  232. 'type' => $sType,
  233. 'empty_message' => $bEmptyMessage,
  234. 'ajax_paginate' => $bAjaxPaginate
  235. ), $bShowHeader);
  236. }
  237. /**
  238. * @page service Service Calls
  239. * @section bx_forum Discussions
  240. * @subsection bx_forum-page_blocks Page Blocks
  241. * @subsubsection bx_forum-browse_featured browse_featured
  242. *
  243. * @code bx_srv('bx_forum', 'browse_featured', [...]); @endcode
  244. *
  245. * Get page block with a list of featured items represented as table.
  246. *
  247. * @param $sUnitView (optional) string with unit view type.
  248. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  249. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  250. * @param $bShowHeader (optional) boolean value determining whether a resulting table should have Header section or not.
  251. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  252. *
  253. * @see BxForumModule::serviceBrowseFeatured
  254. */
  255. /**
  256. * @ref bx_forum-browse_featured "browse_featured"
  257. */
  258. public function serviceBrowseFeatured($sUnitView = false, $bEmptyMessage = false, $bAjaxPaginate = true, $bShowHeader = false)
  259. {
  260. $CNF = &$this->_oConfig->CNF;
  261. $sType = 'featured';
  262. if($sUnitView != 'table')
  263. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  264. return $this->_serviceBrowseTable(array(
  265. 'type' => $sType,
  266. 'empty_message' => $bEmptyMessage,
  267. 'ajax_paginate' => $bAjaxPaginate
  268. ), $bShowHeader);
  269. }
  270. /**
  271. * @page service Service Calls
  272. * @section bx_forum Discussions
  273. * @subsection bx_forum-page_blocks Page Blocks
  274. * @subsubsection bx_forum-browse_top browse_top
  275. *
  276. * @code bx_srv('bx_forum', 'browse_top', [...]); @endcode
  277. *
  278. * Get page block with a list of items ordered by a number of comments and represented as table.
  279. *
  280. * @param $sUnitView (optional) string with unit view type.
  281. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  282. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  283. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  284. *
  285. * @see BxForumModule::serviceBrowseTop
  286. */
  287. /**
  288. * @ref bx_forum-browse_top "browse_top"
  289. */
  290. public function serviceBrowseTop($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = true)
  291. {
  292. $sType = 'top';
  293. if($sUnitView != 'table')
  294. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  295. return $this->_serviceBrowseTable(array(
  296. 'type' => $sType,
  297. 'empty_message' => $bEmptyMessage,
  298. 'ajax_paginate' => $bAjaxPaginate
  299. ), $bShowHeader);
  300. }
  301. /**
  302. * @page service Service Calls
  303. * @section bx_forum Discussions
  304. * @subsection bx_forum-page_blocks Page Blocks
  305. * @subsubsection bx_forum-browse_popular browse_popular
  306. *
  307. * @code bx_srv('bx_forum', 'browse_popular', [...]); @endcode
  308. *
  309. * Get page block with a list of items ordered by a number of views and represented as table.
  310. *
  311. * @param $sUnitView (optional) string with unit view type.
  312. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  313. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  314. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  315. *
  316. * @see BxForumModule::serviceBrowsePopular
  317. */
  318. /**
  319. * @ref bx_forum-browse_popular "browse_popular"
  320. */
  321. public function serviceBrowsePopular ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  322. {
  323. $sType = 'popular';
  324. if($sUnitView != 'table')
  325. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  326. return $this->_serviceBrowseTable(array(
  327. 'type' => $sType,
  328. 'empty_message' => $bEmptyMessage,
  329. 'ajax_paginate' => $bAjaxPaginate
  330. ), $bShowHeader);
  331. }
  332. /**
  333. * @page service Service Calls
  334. * @section bx_forum Discussions
  335. * @subsection bx_forum-page_blocks Page Blocks
  336. * @subsubsection bx_forum-browse_updated browse_updated
  337. *
  338. * @code bx_srv('bx_forum', 'browse_updated', [...]); @endcode
  339. *
  340. * Get page block with a list of updated items represented as table.
  341. *
  342. * @param $sUnitView (optional) string with unit view type.
  343. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  344. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  345. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  346. *
  347. * @see BxForumModule::serviceBrowseUpdated
  348. */
  349. /**
  350. * @ref bx_forum-browse_updated "browse_updated"
  351. */
  352. public function serviceBrowseUpdated ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  353. {
  354. $sType = 'updated';
  355. if($sUnitView != 'table')
  356. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  357. return $this->_serviceBrowseTable(array(
  358. 'type' => $sType,
  359. 'empty_message' => $bEmptyMessage,
  360. 'ajax_paginate' => $bAjaxPaginate
  361. ), $bShowHeader);
  362. }
  363. /**
  364. * @page service Service Calls
  365. * @section bx_forum Discussions
  366. * @subsection bx_forum-page_blocks Page Blocks
  367. * @subsubsection bx_forum-browse_partaken browse_partaken
  368. *
  369. * @code bx_srv('bx_forum', 'browse_partaken', [...]); @endcode
  370. *
  371. * Get page block with a list of partaken items represented as table.
  372. *
  373. * @param $sUnitView (optional) string with unit view type.
  374. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  375. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  376. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  377. *
  378. * @see BxForumModule::serviceBrowsePartaken
  379. */
  380. /**
  381. * @ref bx_forum-browse_partaken "browse_partaken"
  382. */
  383. public function serviceBrowsePartaken ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = true)
  384. {
  385. $sType = 'partaken';
  386. if($sUnitView != 'table')
  387. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  388. return $this->_serviceBrowseTable(array(
  389. 'type' => $sType,
  390. 'empty_message' => $bEmptyMessage,
  391. 'ajax_paginate' => $bAjaxPaginate
  392. ), $bShowHeader);
  393. }
  394. /**
  395. * @page service Service Calls
  396. * @section bx_forum Discussions
  397. * @subsection bx_forum-page_blocks Page Blocks
  398. * @subsubsection bx_forum-browse_index browse_index
  399. *
  400. * @code bx_srv('bx_forum', 'browse_index', [...]); @endcode
  401. *
  402. * Get page block for Site's Home page with a list of items ordered by newness and represented as table.
  403. *
  404. * @param $sUnitView (optional) string with unit view type.
  405. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  406. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  407. * @param $bShowHeader (optional) boolean value determining whether a resulting table should have Header section or not.
  408. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  409. *
  410. * @see BxForumModule::serviceBrowseIndex
  411. */
  412. /**
  413. * @ref bx_forum-browse_index "browse_index"
  414. */
  415. public function serviceBrowseIndex($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  416. {
  417. $sType = 'index';
  418. if($sUnitView != 'table')
  419. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  420. return $this->_serviceBrowseTable(array(
  421. 'type' => $sType,
  422. 'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_index'),
  423. 'empty_message' => $bEmptyMessage,
  424. 'ajax_paginate' => $bAjaxPaginate
  425. ), $bShowHeader);
  426. }
  427. /**
  428. * @page service Service Calls
  429. * @section bx_forum Discussions
  430. * @subsection bx_forum-page_blocks Page Blocks
  431. * @subsubsection bx_forum-browse_author browse_author
  432. *
  433. * @code bx_srv('bx_forum', 'browse_author', [...]); @endcode
  434. *
  435. * Get page block with a list of items filtered by Author and represented as table.
  436. *
  437. * @param $iProfileId (optional) integer value with author ID. If empty value is provided, an attempt to get it from GET/POST arrays will be performed.
  438. * @param $aParams (optional) an array of additional params. It's not used for now.
  439. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  440. *
  441. * @see BxForumModule::serviceBrowseAuthor
  442. */
  443. /**
  444. * @ref bx_forum-browse_author "browse_author"
  445. */
  446. public function serviceBrowseAuthor ($iProfileId = 0, $aParams = array())
  447. {
  448. if(!$iProfileId)
  449. $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
  450. if(!$iProfileId)
  451. return '';
  452. $bEmptyMessage = true;
  453. if(isset($aParams['empty_message'])) {
  454. $bEmptyMessage = (bool)$aParams['empty_message'];
  455. unset($aParams['empty_message']);
  456. }
  457. $bAjaxPaginate = true;
  458. if(isset($aParams['ajax_paginate'])) {
  459. $bAjaxPaginate = (bool)$aParams['ajax_paginate'];
  460. unset($aParams['ajax_paginate']);
  461. }
  462. if(isset($aParams['unit_view']) && $aParams['unit_view'] != 'table')
  463. return $this->_serviceBrowse('author', array_merge(array('author' => $iProfileId), $aParams), BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  464. return $this->_serviceBrowseTable(array(
  465. 'type' => 'author',
  466. 'author' => $iProfileId,
  467. 'where' => array('fld' => 'author', 'val' => $iProfileId, 'opr' => '='),
  468. 'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_profile'),
  469. 'empty_message' => $bEmptyMessage,
  470. 'ajax_paginate' => $bAjaxPaginate
  471. ), false);
  472. }
  473. /**
  474. * @page service Service Calls
  475. * @section bx_forum Discussions
  476. * @subsection bx_forum-page_blocks Page Blocks
  477. * @subsubsection bx_forum-browse_favorite browse_favorite
  478. *
  479. * @code bx_srv('bx_forum', 'browse_favorite', [...]); @endcode
  480. *
  481. * Get page block with a list of favorited items by some profile and represented as table.
  482. *
  483. * @param $iProfileId (optional) integer value with profile ID. If empty value is provided, an attempt to get it from GET/POST arrays will be performed.
  484. * @param $aParams (optional) an array of additional params. It's not used for now.
  485. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  486. *
  487. * @see BxForumModule::serviceBrowseFavorite
  488. */
  489. /**
  490. * @ref bx_forum-browse_favorite "browse_favorite"
  491. */
  492. public function serviceBrowseFavorite ($iProfileId = 0, $aParams = array())
  493. {
  494. $CNF = &$this->_oConfig->CNF;
  495. $bEmptyMessage = false;
  496. if(isset($aParams['empty_message'])) {
  497. $bEmptyMessage = (bool)$aParams['empty_message'];
  498. unset($aParams['empty_message']);
  499. }
  500. $bAjaxPaginate = true;
  501. if(isset($aParams['ajax_paginate'])) {
  502. $bAjaxPaginate = (bool)$aParams['ajax_paginate'];
  503. unset($aParams['ajax_paginate']);
  504. }
  505. return $this->_serviceBrowseTable(array(
  506. 'type' => 'favorite',
  507. 'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_profile'),
  508. 'empty_message' => $bEmptyMessage,
  509. 'ajax_paginate' => $bAjaxPaginate
  510. ), false);
  511. }
  512. /**
  513. * @page service Service Calls
  514. * @section bx_forum Discussions
  515. * @subsection bx_forum-page_blocks Page Blocks
  516. * @subsubsection bx_forum-browse_category browse_category
  517. *
  518. * @code bx_srv('bx_forum', 'browse_category', [...]); @endcode
  519. *
  520. * Get page block with a list of items filter by some category and represented as table.
  521. *
  522. * @param $sUnitView (optional) string with unit view type.
  523. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  524. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  525. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  526. *
  527. * @see BxForumModule::serviceBrowseCategory
  528. */
  529. /**
  530. * @ref bx_forum-browse_category "browse_category"
  531. */
  532. public function serviceBrowseCategory($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = true)
  533. {
  534. $sType = 'category';
  535. $iCategory = bx_process_input(bx_get('category'), BX_DATA_INT);
  536. $aCategory = $this->_oDb->getCategories(array('type' => 'by_category', 'category' => $iCategory));
  537. if(!empty($aCategory['visible_for_levels']) && !BxDolAcl::getInstance()->isMemberLevelInSet($aCategory['visible_for_levels']))
  538. return $bEmptyMessage ? MsgBox(_t('_sys_txt_access_denied')) : '';
  539. if($sUnitView != 'table') {
  540. $aParams = array('category' => $iCategory);
  541. if ($sUnitView)
  542. $aParams['unit_view'] = $sUnitView;
  543. return $this->_serviceBrowse($sType, $aParams, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  544. }
  545. return $this->_serviceBrowseTable(array(
  546. 'type' => $sType,
  547. 'where' => array('fld' => 'cat', 'val' => $iCategory, 'opr' => '='),
  548. 'empty_message' => $bEmptyMessage,
  549. 'ajax_paginate' => $bAjaxPaginate
  550. ), $bShowHeader);
  551. }
  552. /**
  553. * @page service Service Calls
  554. * @section bx_forum Discussions
  555. * @subsection bx_forum-page_blocks Page Blocks
  556. * @subsubsection bx_forum-browse_keyword browse_keyword
  557. *
  558. * @code bx_srv('bx_forum', 'browse_keyword', [...]); @endcode
  559. *
  560. * Get page block with a list of items filter by some keyword and represented as table.
  561. *
  562. * @param $sUnitView (optional) string with unit view type.
  563. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  564. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  565. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  566. *
  567. * @see BxForumModule::serviceBrowseKeyword
  568. */
  569. /**
  570. * @ref bx_forum-browse_keyword "browse_keyword"
  571. */
  572. public function serviceBrowseKeyword($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  573. {
  574. $sType = 'keyword';
  575. $sKeyword = bx_process_input(bx_get('keyword'));
  576. if($sUnitView != 'table')
  577. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  578. return $this->_serviceBrowseTable(array(
  579. 'type' => $sType,
  580. 'where' => $this->_getSearchKeywordDescriptor('#' . $sKeyword),
  581. 'empty_message' => $bEmptyMessage,
  582. 'ajax_paginate' => $bAjaxPaginate
  583. ), $bShowHeader);
  584. }
  585. /**
  586. * @page service Service Calls
  587. * @section bx_forum Discussions
  588. * @subsection bx_forum-page_blocks Page Blocks
  589. * @subsubsection bx_forum-browse_search_results browse_search_results
  590. *
  591. * @code bx_srv('bx_forum', 'browse_search_results', [...]); @endcode
  592. *
  593. * Get page block with search results by Author(s), Category, Keyword represented as table.
  594. *
  595. * @param $sUnitView (optional) string with unit view type.
  596. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  597. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  598. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  599. *
  600. * @see BxForumModule::serviceBrowseSearchResults
  601. */
  602. /**
  603. * @ref bx_forum-browse_search_results "browse_search_results"
  604. */
  605. public function serviceBrowseSearchResults($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true)
  606. {
  607. $sType = 'search';
  608. $aAuthors = bx_process_input(bx_get('author'));
  609. $iCategory = bx_process_input(bx_get('category'), BX_DATA_INT);
  610. $sKeyword = bx_process_input(bx_get('keyword'));
  611. $aCategory = $this->_oDb->getCategories(array('type' => 'by_category', 'category' => $iCategory));
  612. if(!empty($aCategory['visible_for_levels']) && !BxDolAcl::getInstance()->isMemberLevelInSet($aCategory['visible_for_levels']))
  613. return $bEmptyMessage ? MsgBox(_t('_sys_txt_access_denied')) : '';
  614. if($sUnitView != 'table')
  615. return $this->_serviceBrowse('', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  616. $aWhereGroupAnd = array('grp' => true, 'opr' => 'AND', 'cnds' => array());
  617. if(!empty($aAuthors) && is_array($aAuthors))
  618. $aWhereGroupAnd['cnds'][] = $this->_getSearchAuthorDescriptor($aAuthors);
  619. if(!empty($iCategory))
  620. $aWhereGroupAnd['cnds'][] = array('fld' => 'cat', 'val' => $iCategory, 'opr' => '=');
  621. if(!empty($sKeyword))
  622. $aWhereGroupAnd['cnds'][] = $this->_getSearchKeywordDescriptor($sKeyword);
  623. return $this->_serviceBrowseTable(array(
  624. 'type' => $sType,
  625. 'where' => $aWhereGroupAnd,
  626. 'empty_message' => $bEmptyMessage,
  627. 'ajax_paginate' => $bAjaxPaginate
  628. ), false);
  629. }
  630. /**
  631. * @page service Service Calls
  632. * @section bx_forum Discussions
  633. * @subsection bx_forum-other Other
  634. * @subsubsection bx_forum-get_discussions_num get_discussions_num
  635. *
  636. * @code bx_srv('bx_forum', 'get_discussions_num', [...]); @endcode
  637. *
  638. * Get number of discussions for some profile.
  639. *
  640. * @param $iProfileId (optional) profile to get discussions for, if omitted then currently logged in profile is used.
  641. * @return integer value with a number of discussions.
  642. *
  643. * @see BxForumModule::serviceGetDiscussionsNum
  644. */
  645. /**
  646. * @ref bx_forum-get_discussions_num "get_discussions_num"
  647. */
  648. public function serviceGetDiscussionsNum ($iProfileId = 0)
  649. {
  650. if (!$iProfileId)
  651. $iProfileId = bx_get_logged_profile_id();
  652. return $this->_oDb->getEntriesNumByAuthor((int)$iProfileId);
  653. }
  654. /**
  655. * @page service Service Calls
  656. * @section bx_forum Discussions
  657. * @subsection bx_forum-other Other
  658. * @subsubsection bx_forum-get_unreplied_discussions_num get_unreplied_discussions_num
  659. *
  660. * @code bx_srv('bx_forum', 'get_unreplied_discussions_num', [...]); @endcode
  661. *
  662. * Get number of unreplied discussions for some profile.
  663. *
  664. * @param $iProfileId (optional) profile to get unreplied discussions for, if omitted then currently logged is profile is used.
  665. * @return integer value with a number of discussions.
  666. *
  667. * @see BxForumModule::serviceGetUnrepliedDiscussionsNum
  668. */
  669. /**
  670. * @ref bx_forum-get_unreplied_discussions_num "get_unreplied_discussions_num"
  671. */
  672. public function serviceGetUnrepliedDiscussionsNum ($iProfileId = 0)
  673. {
  674. if (!$iProfileId)
  675. $iProfileId = bx_get_logged_profile_id();
  676. return $this->_oDb->getUnrepliedDiscussionsNum((int)$iProfileId);
  677. }
  678. /**
  679. *
  680. */
  681. /**
  682. * @page service Service Calls
  683. * @section bx_forum Discussions
  684. * @subsection bx_forum-other Other
  685. * @subsubsection bx_forum-trigger_comment_post trigger_comment_post
  686. *
  687. * @code bx_srv('bx_forum', 'trigger_comment_post', [...]); @endcode
  688. *
  689. * Update last comment time and author when new comment was added in the discussion.
  690. *
  691. * @param $iContentId integer value with content ID.
  692. * @param $iProfileId integer value with profile ID.
  693. * @param $iCommentId integer value with comment ID.
  694. * @param $iTimestamp (optional) date in UNIX Timestamp format, if omitted then current date is used.
  695. * @param $sCommentText (optional) string value with text of comment.
  696. * @return boolean value determining where the operation is successful or not.
  697. *
  698. * @see BxForumModule::serviceTriggerCommentPost
  699. */
  700. /**
  701. * @ref bx_forum-trigger_comment_post "trigger_comment_post"
  702. */
  703. public function serviceTriggerCommentPost ($iContentId, $iProfileId, $iCommentId, $iTimestamp = 0, $sCommentText = '')
  704. {
  705. $CNF = $this->_oConfig->CNF;
  706. $iContentId = (int)$iContentId;
  707. if(!$iContentId)
  708. return false;
  709. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  710. if(!$aContentInfo)
  711. return false;
  712. $oCmts = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
  713. if(!$oCmts)
  714. return false;
  715. if(!$iTimestamp)
  716. $iTimestamp = time();
  717. if(!$this->_oDb->updateLastCommentTimeProfile((int)$iContentId, (int)$iProfileId, $iCommentId, $iTimestamp))
  718. return false;
  719. // send notification to author
  720. if($iProfileId != $aContentInfo[$CNF['FIELD_AUTHOR']]) {
  721. $oProfile = BxDolProfile::getInstanceMagic($iProfileId);
  722. if($oProfile)
  723. sendMailTemplate('bx_forum_new_reply', 0, $aContentInfo[$CNF['FIELD_AUTHOR']], array(
  724. 'SenderDisplayName' => $oProfile->getDisplayName(),
  725. 'SenderUrl' => $oProfile->getUrl(),
  726. 'PageUrl' => $oCmts->getItemUrl($iCommentId),
  727. 'PageTitle' => $oCmts->getObjectTitle(),
  728. 'Message' => $sCommentText,
  729. ), BX_EMAIL_NOTIFY);
  730. }
  731. return true;
  732. }
  733. /**
  734. * @page service Service Calls
  735. * @section bx_forum Discussions
  736. * @subsection bx_forum-page_blocks Page Blocks
  737. * @subsubsection bx_forum-entity_participants entity_participants
  738. *
  739. * @code bx_srv('bx_forum', 'entity_participants', [...]); @endcode
  740. *
  741. * Get page block with discussion's collaborators.
  742. *
  743. * @param $iContentId (optional) content ID. If empty value is provided, an attempt to get it from GET/POST arrays will be performed.
  744. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  745. *
  746. * @see BxForumModule::serviceEntityParticipants
  747. */
  748. /**
  749. * @ref bx_forum-entity_participants "entity_participants"
  750. */
  751. public function serviceEntityParticipants ($iContentId = 0)
  752. {
  753. if (!$iContentId)
  754. $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
  755. if (!$iContentId)
  756. return false;
  757. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  758. if (!$aContentInfo)
  759. return false;
  760. return $this->_oTemplate->entryParticipants ($aContentInfo, 5, 'right');
  761. }
  762. /**
  763. * @page service Service Calls
  764. * @section bx_forum Discussions
  765. * @subsection bx_forum-page_blocks Page Blocks
  766. * @subsubsection bx_forum-search search
  767. *
  768. * @code bx_srv('bx_forum', 'search', [...]); @endcode
  769. *
  770. * Get page block with search form.
  771. *
  772. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  773. *
  774. * @see BxForumModule::serviceSearch
  775. */
  776. /**
  777. * @ref bx_forum-search "search"
  778. */
  779. public function serviceSearch()
  780. {
  781. $CNF = $this->_oConfig->CNF;
  782. $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_SEARCH'], $CNF['OBJECT_FORM_SEARCH_DISPLAY_FULL'], $this->_oTemplate);
  783. $oForm->initChecker();
  784. return $oForm->getCode();
  785. }
  786. public function checkAllowedSubscribe(&$aDataEntry, $isPerformAction = false)
  787. {
  788. $CNF = &$this->_oConfig->CNF;
  789. $sMsg = $this->checkAllowedView($aDataEntry);
  790. if($sMsg !== CHECK_ACTION_RESULT_ALLOWED)
  791. return $sMsg;
  792. return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $CNF['OBJECT_CONNECTION_SUBSCRIBERS'], false, false);
  793. }
  794. public function checkAllowedUnsubscribe(&$aDataEntry, $isPerformAction = false)
  795. {
  796. $CNF = &$this->_oConfig->CNF;
  797. return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $CNF['OBJECT_CONNECTION_SUBSCRIBERS'], false, true);
  798. }
  799. public function checkAllowedStickAnyEntry($aDataEntry, $isPerformAction = false)
  800. {
  801. $CNF = &$this->_oConfig->CNF;
  802. if((int)$aDataEntry[$CNF['FIELD_STICK']] != 0)
  803. return false;
  804. return $this->_checkAllowedAction('stick any entry', $aDataEntry, $isPerformAction);
  805. }
  806. public function checkAllowedUnstickAnyEntry($aDataEntry, $isPerformAction = false)
  807. {
  808. $CNF = $this->_oConfig->CNF;
  809. if((int)$aDataEntry[$CNF['FIELD_STICK']] != 1)
  810. return false;
  811. return $this->_checkAllowedAction('stick any entry', $aDataEntry, $isPerformAction);
  812. }
  813. public function checkAllowedResolveAnyEntry($aDataEntry, $isPerformAction = false)
  814. {
  815. $CNF = &$this->_oConfig->CNF;
  816. if((int)$aDataEntry[$CNF['FIELD_RESOLVABLE']] != 1 || (int)$aDataEntry[$CNF['FIELD_RESOLVE']] != 0)
  817. return false;
  818. if($aDataEntry[$CNF['FIELD_AUTHOR']] == bx_get_logged_profile_id())
  819. return true;
  820. return $this->_checkAllowedAction('resolve any entry', $aDataEntry, $isPerformAction);
  821. }
  822. public function checkAllowedUnresolveAnyEntry($aDataEntry, $isPerformAction = false)
  823. {
  824. $CNF = $this->_oConfig->CNF;
  825. if((int)$aDataEntry[$CNF['FIELD_RESOLVABLE']] != 1 || (int)$aDataEntry[$CNF['FIELD_RESOLVE']] != 1)
  826. return false;
  827. if($aDataEntry[$CNF['FIELD_AUTHOR']] == bx_get_logged_profile_id())
  828. return true;
  829. return $this->_checkAllowedAction('resolve any entry', $aDataEntry, $isPerformAction);
  830. }
  831. public function checkAllowedLockAnyEntry($aDataEntry, $isPerformAction = false)
  832. {
  833. $CNF = $this->_oConfig->CNF;
  834. if((int)$aDataEntry[$CNF['FIELD_LOCK']] != 0)
  835. return false;
  836. return $this->_checkAllowedAction('lock any entry', $aDataEntry, $isPerformAction);
  837. }
  838. public function checkAllowedUnlockAnyEntry($aDataEntry, $isPerformAction = false)
  839. {
  840. $CNF = $this->_oConfig->CNF;
  841. if((int)$aDataEntry[$CNF['FIELD_LOCK']] != 1)
  842. return false;
  843. return $this->_checkAllowedAction('lock any entry', $aDataEntry, $isPerformAction);
  844. }
  845. public function checkAllowedHideAnyEntry($aDataEntry, $isPerformAction = false)
  846. {
  847. $CNF = $this->_oConfig->CNF;
  848. if($aDataEntry[$CNF['FIELD_STATUS_ADMIN']] == 'hidden')
  849. return false;
  850. return $this->_checkAllowedAction('hide any entry', $aDataEntry, $isPerformAction);
  851. }
  852. public function checkAllowedUnhideAnyEntry($aDataEntry, $isPerformAction = false)
  853. {
  854. $CNF = &$this->_oConfig->CNF;
  855. if($aDataEntry[$CNF['FIELD_STATUS_ADMIN']] != 'hidden')
  856. return false;
  857. return $this->_checkAllowedAction('hide any entry', $aDataEntry, $isPerformAction);
  858. }
  859. protected function _checkAllowedConnect (&$aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult)
  860. {
  861. $CNF = &$this->_oConfig->CNF;
  862. if(!$this->_iProfileId)
  863. return _t('_sys_txt_access_denied');
  864. $isConnected = BxDolConnection::getObjectInstance($sObjConnection)->isConnected($this->_iProfileId, $aDataEntry[$CNF['FIELD_ID']], $isMutual);
  865. if($isInvertResult)
  866. $isConnected = !$isConnected;
  867. return $isConnected ? _t('_sys_txt_access_denied') : CHECK_ACTION_RESULT_ALLOWED;
  868. }
  869. /**
  870. * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
  871. */
  872. protected function _checkAllowedAction($sAction, $aDataEntry, $isPerformAction = false)
  873. {
  874. if($this->_isModerator($isPerformAction))
  875. return CHECK_ACTION_RESULT_ALLOWED;
  876. $aCheck = checkActionModule($this->_iProfileId, $sAction, $this->getName(), $isPerformAction);
  877. if($aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED)
  878. return CHECK_ACTION_RESULT_ALLOWED;
  879. return _t('_sys_txt_access_denied');
  880. }
  881. protected function _serviceBrowseTable($aParams, $isDisplayHeader = true)
  882. {
  883. $sGrid = $this->_oConfig->CNF['OBJECT_GRID'];
  884. if(!empty($aParams['grid'])) {
  885. $sGrid = $aParams['grid'];
  886. unset($aParams['grid']);
  887. }
  888. $oGrid = BxDolGrid::getObjectInstance($sGrid);
  889. if(!$oGrid)
  890. return false;
  891. $oGrid->setBrowseParams($aParams);
  892. $this->_oTemplate->addJsTranslation(array('_sys_grid_search'));
  893. $this->_oTemplate->addCss(array('grid_tools.css'));
  894. return $oGrid->getCode($isDisplayHeader);
  895. }
  896. protected function _getSearchAuthorDescriptor($aAutor)
  897. {
  898. return array('grp' => true, 'opr' => 'OR', 'cnds' => array(
  899. array('fld' => 'author', 'val' => $aAutor, 'opr' => 'IN'),
  900. array('fld' => 'author_comment', 'val' => $aAutor, 'opr' => 'IN'),
  901. ));
  902. }
  903. protected function _getSearchKeywordDescriptor($sKeyword)
  904. {
  905. return array('grp' => true, 'opr' => 'OR', 'cnds' => array(
  906. array('fld' => 'title', 'val' => $sKeyword, 'opr' => 'LIKE'),
  907. array('fld' => 'text', 'val' => $sKeyword, 'opr' => 'LIKE'),
  908. array('fld' => 'text_comments', 'val' => $sKeyword, 'opr' => 'LIKE')
  909. ));
  910. }
  911. }
  912. /** @} */