cmts.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. require_once('./inc/header.inc.php');
  10. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  11. bx_import('BxDolLanguages');
  12. check_logged();
  13. $sSys = isset($_REQUEST['sys']) ? bx_process_input($_REQUEST['sys']) : '';
  14. $iObjectId = isset($_REQUEST['id']) ? bx_process_input($_REQUEST['id'], BX_DATA_INT) : 0;
  15. $sAction = isset($_REQUEST['action']) && preg_match ('/^[A-Za-z_-]+$/', $_REQUEST['action']) ? bx_process_input($_REQUEST['action']) : '';
  16. $oCmts = BxDolCmts::getObjectInstance($sSys, $iObjectId, true);
  17. if ($oCmts && $sSys && $iObjectId) {
  18. if($sAction) {
  19. header('Content-Type: text/html; charset=utf-8');
  20. $sMethod = 'action' . $sAction;
  21. echo $oCmts->$sMethod();
  22. exit;
  23. }
  24. $iCmtId = bx_get('cmt_id');
  25. if($iCmtId !== false) {
  26. $oTemplate = BxDolTemplate::getInstance();
  27. $sComment = $oCmts->getCommentBlock($iCmtId);
  28. if ($sComment) {
  29. $sObjectTitle = $oCmts->getObjectTitle($iObjectId);
  30. $sHeader = _t('_cmt_page_view_header', $sObjectTitle);
  31. $sTitle = _t('_cmt_page_view_title', $oCmts->getBaseUrl(), $sObjectTitle);
  32. $sContent = DesignBoxContent($sTitle, $sComment, BX_DB_PADDING_DEF);
  33. $oTemplate->setPageNameIndex(BX_PAGE_DEFAULT);
  34. $oTemplate->setPageHeader($sHeader);
  35. $oTemplate->setPageContent('page_main_code', $sContent);
  36. $oTemplate->getPageCode();
  37. } else {
  38. $oTemplate->displayPageNotFound();
  39. }
  40. }
  41. }
  42. /** @} */