You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rcube_session_php.php 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. +-----------------------------------------------------------------------+
  4. | This file is part of the Roundcube Webmail client |
  5. | Copyright (C) 2005-2014, The Roundcube Dev Team |
  6. | Copyright (C) 2011, Kolab Systems AG |
  7. | |
  8. | Licensed under the GNU General Public License version 3 or |
  9. | any later version with exceptions for skins & plugins. |
  10. | See the README file for a full license statement. |
  11. | |
  12. | PURPOSE: |
  13. | Provide database supported session management |
  14. +-----------------------------------------------------------------------+
  15. | Author: Thomas Bruederli <roundcube@gmail.com> |
  16. | Author: Aleksander Machniak <alec@alec.pl> |
  17. | Author: Cor Bosman <cor@roundcu.be> |
  18. +-----------------------------------------------------------------------+
  19. */
  20. /**
  21. * Class to provide native php session storage
  22. *
  23. * @package Framework
  24. * @subpackage Core
  25. * @author Thomas Bruederli <roundcube@gmail.com>
  26. * @author Aleksander Machniak <alec@alec.pl>
  27. * @author Cor Bosman <cor@roundcu.be>
  28. */
  29. class rcube_session_php extends rcube_session {
  30. /**
  31. * native php sessions don't need a save handler
  32. * we do need to define abstract function implementations but they are not used.
  33. */
  34. public function open($save_path, $session_name) {}
  35. public function close() {}
  36. public function destroy($key) {}
  37. public function read($key) {}
  38. public function write($key, $vars) {}
  39. public function update($key, $newvars, $oldvars) {}
  40. /**
  41. * @param Object $config
  42. */
  43. public function __construct($config)
  44. {
  45. parent::__construct($config);
  46. }
  47. /**
  48. * Wrapper for session_write_close()
  49. */
  50. public function write_close()
  51. {
  52. $_SESSION['__IP'] = $this->ip;
  53. $_SESSION['__MTIME'] = time();
  54. parent::write_close();
  55. }
  56. /**
  57. * Wrapper for session_start()
  58. */
  59. public function start()
  60. {
  61. parent::start();
  62. $this->key = session_id();
  63. $this->ip = $_SESSION['__IP'];
  64. $this->changed = $_SESSION['__MTIME'];
  65. }
  66. }