1
0

design.inc.php 4.6 KB

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