1
0

design.inc.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 DolphinCore Dolphin 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. bx_import('BxTemplFunctions');
  64. return BxTemplFunctions::getInstance()->designBoxContent ($sTitle, $sContent, $iTemplateNum, $mixedMenu);
  65. }
  66. /**
  67. * Use this function in pages if you want to not cache it.
  68. **/
  69. function send_headers_page_changed()
  70. {
  71. $now = gmdate('D, d M Y H:i:s') . ' GMT';
  72. header("Expires: $now");
  73. header("Last-Modified: $now");
  74. header("Cache-Control: no-cache, must-revalidate");
  75. header("Pragma: no-cache");
  76. }
  77. function MsgBox($sText, $iTimer = 0)
  78. {
  79. bx_import('BxTemplFunctions');
  80. return BxTemplFunctions::getInstance()->msgBox($sText, $iTimer);
  81. }
  82. function PopupBox($sName, $sTitle, $sContent, $isHiddenByDefault = false)
  83. {
  84. bx_import('BxTemplFunctions');
  85. return BxTemplFunctions::getInstance()->popupBox($sName, $sTitle, $sContent, $isHiddenByDefault);
  86. }
  87. function getVersionComment()
  88. {
  89. $aVer = explode('.', getParam('sys_version'));
  90. // version output made for debug possibilities.
  91. // randomizing made for security issues. do not change it...
  92. $aVerR[0] = $aVer[0];
  93. $aVerR[1] = rand( 0, 100 );
  94. $aVerR[2] = $aVer[1];
  95. $aVerR[3] = rand( 0, 100 );
  96. $aVerR[4] = $aVer[2];
  97. return '<!-- ' . implode(' ', $aVerR) . ' -->';
  98. }
  99. function getSiteStatUser()
  100. {
  101. $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`";
  102. $aStat = BxDolDb::getInstance()->fromCache('sys_stat_site', 'getAllWithKey', $sqlQuery, 'name');
  103. return "<pre>TODO: nice output\n" . print_r($aStat, true) . '</pre>';
  104. }
  105. /**
  106. * Output time wrapped in <time> tag in HTML.
  107. * Then time is autoformatted using JS upon page load, this is aumatically converted to user's timezone and
  108. * updated in realtime in case of short periods of 'from now' time format.
  109. *
  110. * This is just short version for:
  111. * @see BxTemplFunctions::timeForJs
  112. *
  113. * @param $iUnixTimestamp time as unixtimestamp
  114. * @param $sFormatIdentifier output format identifier
  115. * @see BX_FORMAT_DATE
  116. * @see BX_FORMAT_TIME
  117. * @see BX_FORMAT_DATE_TIME
  118. * @param $bForceFormat force provided format and don't use "from now" time autoformat.
  119. */
  120. function bx_time_js ($iUnixTimestamp, $sFormatIdentifier = BX_FORMAT_DATE, $bForceFormat = false)
  121. {
  122. bx_import('BxTemplFunctions');
  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. bx_import('BxDolAlerts');
  135. $oZ = new BxDolAlerts('system', 'design_included', 0);
  136. $oZ->alert();
  137. /** @} */