design.inc.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 UnaCore UNA Core
  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. define('BX_DB_HIDDEN_PHONE', 1);
  46. define('BX_DB_HIDDEN_TABLET', 2);
  47. define('BX_DB_HIDDEN_DESKTOP', 3);
  48. define('BX_DB_HIDDEN_MOBILE', 4);
  49. define('BX_FORMAT_DATE', 'sys_format_date'); ///< date format identifier for use in @see bx_time_js function
  50. define('BX_FORMAT_TIME', 'sys_format_time'); ///< time format identifier for use in @see bx_time_js function
  51. define('BX_FORMAT_DATE_TIME', 'sys_format_datetime'); ///< datetime format identifier for use in @see bx_time_js function
  52. /**
  53. * Display "design box" HTML code
  54. *
  55. * @see BxBaseFunctions::DesignBoxContent
  56. *
  57. * @see BX_DB_CONTENT_ONLY
  58. * @see BX_DB_DEF
  59. * @see BX_DB_EMPTY
  60. * @see BX_DB_NO_CAPTION
  61. * @see BX_DB_PADDING_CONTENT_ONLY
  62. * @see BX_DB_PADDING_DEF
  63. * @see BX_DB_PADDING_NO_CAPTION
  64. */
  65. function DesignBoxContent ($sTitle, $sContent, $iTemplateNum = BX_DB_DEF, $mixedMenu = false)
  66. {
  67. return BxTemplFunctions::getInstance()->designBoxContent ($sTitle, $sContent, $iTemplateNum, $mixedMenu);
  68. }
  69. /**
  70. * Use this function in pages if you want to not cache it.
  71. **/
  72. function send_headers_page_changed()
  73. {
  74. $now = gmdate('D, d M Y H:i:s') . ' GMT';
  75. header("Expires: $now");
  76. header("Last-Modified: $now");
  77. header("Cache-Control: no-cache, must-revalidate");
  78. header("Pragma: no-cache");
  79. }
  80. function MsgBox($sText, $iTimer = 0)
  81. {
  82. return BxTemplFunctions::getInstance()->msgBox($sText, $iTimer);
  83. }
  84. function PopupBox($sName, $sTitle, $sContent, $isHiddenByDefault = false)
  85. {
  86. return BxTemplFunctions::getInstance()->popupBox($sName, $sTitle, $sContent, $isHiddenByDefault);
  87. }
  88. function getVersionComment()
  89. {
  90. $aVer = explode('.', bx_get_ver());
  91. // version output made for debug possibilities.
  92. // randomizing made for security issues. do not change it...
  93. $aVerR[0] = $aVer[0];
  94. $aVerR[1] = rand( 0, 100 );
  95. $aVerR[2] = $aVer[1];
  96. $aVerR[3] = rand( 0, 100 );
  97. $aVerR[4] = $aVer[2];
  98. return '<!-- ' . implode(' ', $aVerR) . ' -->';
  99. }
  100. function getSiteStatUser()
  101. {
  102. $sqlQuery = "SELECT * FROM `sys_statistics` ORDER BY `order`";
  103. $aStat = BxDolDb::getInstance()->fromCache('sys_statistics', 'getAllWithKey', $sqlQuery, 'name');
  104. return "<pre>TODO: nice output\n" . print_r($aStat, true) . '</pre>';
  105. }
  106. /**
  107. * Output time wrapped in &lt;time&gt; tag in HTML.
  108. * Then time is autoformatted using JS upon page load, this is aumatically converted to user's timezone and
  109. * updated in realtime in case of short periods of 'from now' time format.
  110. *
  111. * This is just short version for:
  112. * @see BxTemplFunctions::timeForJs
  113. *
  114. * @param $iUnixTimestamp time as unixtimestamp
  115. * @param $sFormatIdentifier output format identifier
  116. * @see BX_FORMAT_DATE
  117. * @see BX_FORMAT_TIME
  118. * @see BX_FORMAT_DATE_TIME
  119. * @param $bForceFormat force provided format and don't use "from now" time autoformat.
  120. */
  121. function bx_time_js ($iUnixTimestamp, $sFormatIdentifier = BX_FORMAT_DATE, $bForceFormat = false)
  122. {
  123. return BxTemplFunctions::getInstance()->timeForJs ($iUnixTimestamp, $sFormatIdentifier, $bForceFormat);
  124. }
  125. /**
  126. * Get UTC/GMT time string in ISO8601 date format from provided unix timestamp
  127. * @param $iUnixTimestamp - unix timestamp
  128. * @return ISO8601 formatted date/time string
  129. */
  130. function bx_time_utc ($iUnixTimestamp)
  131. {
  132. return gmdate(DATE_ISO8601, (int)$iUnixTimestamp);
  133. }
  134. $oZ = new BxDolAlerts('system', 'design_included', 0);
  135. $oZ->alert();
  136. /** @} */