design.inc.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php defined('BX_DOL') or defined('BX_DOL_INSTALL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCoreFunctions UNA Core Functions
  7. * @{
  8. */
  9. /**
  10. * design box with content only - no borders, no background, no caption
  11. * @see DesignBoxContent
  12. */
  13. define('BX_DB_CONTENT_ONLY', 0);
  14. /**
  15. * default design box with content, borders and caption
  16. * @see DesignBoxContent
  17. */
  18. define('BX_DB_DEF', 1);
  19. /**
  20. * just empty design box, without anything
  21. * @see DesignBoxContent
  22. */
  23. define('BX_DB_EMPTY', 2);
  24. /**
  25. * design box with content, like BX_DB_DEF but without caption
  26. * @see DesignBoxContent
  27. */
  28. define('BX_DB_NO_CAPTION', 3);
  29. /**
  30. * design box with content only wrapped with default padding - no borders, no background, no caption
  31. * it can be used to just wrap content with default padding
  32. * @see DesignBoxContent
  33. */
  34. define('BX_DB_PADDING_CONTENT_ONLY', 10);
  35. /**
  36. * default design box with content wrapped with default padding, borders and caption
  37. * @see DesignBoxContent
  38. */
  39. define('BX_DB_PADDING_DEF', 11);
  40. /**
  41. * design box with content wrapped with default padding, like BX_DB_DEF but without caption
  42. * @see DesignBoxContent
  43. */
  44. define('BX_DB_PADDING_NO_CAPTION', 13);
  45. /*
  46. * Menu template IDs for block submenu
  47. */
  48. define('BX_DB_MENU_TEMPLATE_TABS', 25);
  49. define('BX_DB_MENU_TEMPLATE_POPUP', 26);
  50. define('BX_DB_HIDDEN_PHONE', 1);
  51. define('BX_DB_HIDDEN_TABLET', 2);
  52. define('BX_DB_HIDDEN_DESKTOP', 3);
  53. define('BX_DB_HIDDEN_MOBILE', 4);
  54. define('BX_FORMAT_DATE', 'sys_format_date'); ///< date format identifier for use in @see bx_time_js function
  55. define('BX_FORMAT_TIME', 'sys_format_time'); ///< time format identifier for use in @see bx_time_js function
  56. define('BX_FORMAT_DATE_TIME', 'sys_format_datetime'); ///< datetime format identifier for use in @see bx_time_js function
  57. /*
  58. * Menu template IDs for page submenus
  59. */
  60. define('BX_MENU_TEMPLATE_SUBMENU', 8);
  61. define('BX_MENU_TEMPLATE_SUBMENU_MORE_AUTO', 18);
  62. /*
  63. * Menu template IDs for Custom menu
  64. */
  65. define('BX_MENU_TEMPLATE_CUSTOM_HOR', 15);
  66. define('BX_MENU_TEMPLATE_CUSTOM_VER', 20);
  67. /**
  68. * Display "design box" HTML code
  69. *
  70. * @see BxBaseFunctions::DesignBoxContent
  71. *
  72. * @see BX_DB_CONTENT_ONLY
  73. * @see BX_DB_DEF
  74. * @see BX_DB_EMPTY
  75. * @see BX_DB_NO_CAPTION
  76. * @see BX_DB_PADDING_CONTENT_ONLY
  77. * @see BX_DB_PADDING_DEF
  78. * @see BX_DB_PADDING_NO_CAPTION
  79. */
  80. function DesignBoxContent ($sTitle, $sContent, $iTemplateNum = BX_DB_DEF, $mixedMenu = false)
  81. {
  82. return BxTemplFunctions::getInstance()->designBoxContent ($sTitle, $sContent, $iTemplateNum, $mixedMenu);
  83. }
  84. /**
  85. * Use this function in pages if you want to not cache it.
  86. **/
  87. function send_headers_page_changed()
  88. {
  89. $now = gmdate('D, d M Y H:i:s') . ' GMT';
  90. header("Expires: $now");
  91. header("Last-Modified: $now");
  92. header("Cache-Control: no-cache, must-revalidate");
  93. header("Pragma: no-cache");
  94. }
  95. function MsgBox($sText, $iTimer = 0)
  96. {
  97. return BxTemplFunctions::getInstance()->msgBox($sText, $iTimer);
  98. }
  99. function PopupBox($sName, $sTitle, $sContent, $isHiddenByDefault = false)
  100. {
  101. return BxTemplFunctions::getInstance()->popupBox($sName, $sTitle, $sContent, $isHiddenByDefault);
  102. }
  103. function getVersionComment()
  104. {
  105. $aVer = explode('.', bx_get_ver());
  106. // version output made for debug possibilities.
  107. // randomizing made for security issues. do not change it...
  108. $aVerR[0] = $aVer[0];
  109. $aVerR[1] = rand( 0, 100 );
  110. $aVerR[2] = $aVer[1];
  111. $aVerR[3] = rand( 0, 100 );
  112. $aVerR[4] = $aVer[2];
  113. return '<!-- ' . implode(' ', $aVerR) . ' -->';
  114. }
  115. function getSiteStatUser()
  116. {
  117. $sqlQuery = "SELECT * FROM `sys_statistics` ORDER BY `order`";
  118. $aStat = BxDolDb::getInstance()->fromCache('sys_statistics', 'getAllWithKey', $sqlQuery, 'name');
  119. return "<pre>TODO: nice output\n" . print_r($aStat, true) . '</pre>';
  120. }
  121. /**
  122. * Output time wrapped in &lt;time&gt; tag in HTML.
  123. * Then time is autoformatted using JS upon page load, this is aumatically converted to user's timezone and
  124. * updated in realtime in case of short periods of 'from now' time format.
  125. *
  126. * This is just short version for:
  127. * @see BxTemplFunctions::timeForJs
  128. *
  129. * @param $iUnixTimestamp time as unixtimestamp
  130. * @param $sFormatIdentifier output format identifier
  131. * @see BX_FORMAT_DATE
  132. * @see BX_FORMAT_TIME
  133. * @see BX_FORMAT_DATE_TIME
  134. * @param $bForceFormat force provided format and don't use "from now" time autoformat.
  135. */
  136. function bx_time_js ($iUnixTimestamp, $sFormatIdentifier = BX_FORMAT_DATE, $bForceFormat = false)
  137. {
  138. return BxTemplFunctions::getInstance()->timeForJs ($iUnixTimestamp, $sFormatIdentifier, $bForceFormat);
  139. }
  140. /**
  141. * Get UTC/GMT time string in ISO8601 date format from provided unix timestamp
  142. * @param $iUnixTimestamp - unix timestamp
  143. * @return ISO8601 formatted date/time string
  144. */
  145. function bx_time_utc ($iUnixTimestamp)
  146. {
  147. return gmdate(DATE_ISO8601, (int)$iUnixTimestamp);
  148. }
  149. $oZ = new BxDolAlerts('system', 'design_included', 0);
  150. $oZ->alert();
  151. /** @} */