1
0

functions.cache.session.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /* $Id: functions.cache.session.php 1977 2006-12-25 15:01:52Z b4rt $ */
  3. /*******************************************************************************
  4. LICENSE
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License (GPL)
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  14. *******************************************************************************/
  15. /*******************************************************************************
  16. * config
  17. ******************************************************************************/
  18. /**
  19. * check if cache set
  20. *
  21. * @param $username
  22. * @return boolean
  23. */
  24. function cacheIsSet($username) {
  25. return isset($_SESSION['cache'][$username]);
  26. }
  27. /**
  28. * init cfg from cache
  29. *
  30. * @param $username
  31. */
  32. function cacheInit($username) {
  33. global $cfg;
  34. $cfg = $_SESSION['cache'][$username];
  35. }
  36. /**
  37. * set the cache
  38. *
  39. * @param $username
  40. */
  41. function cacheSet($username) {
  42. global $cfg;
  43. $_SESSION['cache'][$username] = $cfg;
  44. }
  45. /**
  46. * flush the cache
  47. *
  48. * @param $username
  49. */
  50. function cacheFlush($username = "") {
  51. if (empty($username))
  52. unset($_SESSION['cache']);
  53. else
  54. unset($_SESSION['cache'][$username]);
  55. }
  56. /*******************************************************************************
  57. * transfers
  58. ******************************************************************************/
  59. /**
  60. * check if cache set
  61. *
  62. * @return boolean
  63. */
  64. function cacheTransfersIsSet() {
  65. return isset($_SESSION['cache_transfers']);
  66. }
  67. /**
  68. * init transfers from cache
  69. */
  70. function cacheTransfersInit() {
  71. global $transfers;
  72. $transfers = $_SESSION['cache_transfers'];
  73. }
  74. /**
  75. * set the cache
  76. */
  77. function cacheTransfersSet() {
  78. global $transfers;
  79. initGlobalTransfersArray();
  80. // add to cache
  81. $_SESSION['cache_transfers'] = $transfers;
  82. }
  83. /**
  84. * flush the cache
  85. */
  86. function cacheTransfersFlush() {
  87. unset($_SESSION['cache_transfers']);
  88. }
  89. ?>