Source for file open_basedir.php

Documentation is available at open_basedir.php

  1. <?php
  2. /**
  3. * Test Class for open_basedir
  4. *
  5. * @package PhpSecInfo
  6. * @author Ed Finkler <coj@funkatron.com>
  7. */
  8.  
  9.  
  10. /**
  11. * require the PhpSecInfo_Test_Core class
  12. */
  13. require_once('PhpSecInfo/Test/Test_Core.php');
  14.  
  15. /**
  16. * Test Class for open_basedir
  17. *
  18. * @package PhpSecInfo
  19. */
  20. class PhpSecInfo_Test_Core_Open_Basedir extends PhpSecInfo_Test_Core
  21. {
  22.  
  23. /**
  24. * This should be a <b>unique</b>, human-readable identifier for this test
  25. *
  26. * @var string
  27. */
  28. var $test_name = "open_basedir";
  29. var $_messages = array(
  30. PHPSECINFO_TEST_RESULT_OK => array(
  31. 'en' => 'open_basedir is enabled, which is the recommended setting. Keep in mind that other web
  32. applications not written in PHP will not be restricted by this setting.',
  33. ),
  34. PHPSECINFO_TEST_RESULT_NOTICE => array(
  35. 'en' => 'open_basedir is disabled. When this is enabled, only files that are in the given directory/directories and
  36. their subdirectories can be read by PHP scripts. You should consider turning this on. Keep in mind that other web
  37. applications not written in PHP will not be restricted by this setting.',
  38. ),
  39. );
  40.  
  41. /**
  42. * Check to see if the open_basedir setting is enabled.
  43. *
  44. */
  45. function _execTest() {
  46. if ($this->getBooleanIniValue('open_basedir')) {
  47. return PHPSECINFO_TEST_RESULT_OK;
  48. }
  49. return PHPSECINFO_TEST_RESULT_NOTICE;
  50. }
  51. /**
  52. * Set the messages specific to this test
  53. *
  54. */
  55. function _setMessages() {
  56. parent::_setMessages();
  57. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'open_basedir is enabled, which is the
  58. recommended setting. Keep in mind that other web applications not written in PHP will not
  59. be restricted by this setting.');
  60. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'open_basedir is disabled. When
  61. this is enabled, only files that are in the
  62. given directory/directories and their subdirectories can be read by PHP scripts.
  63. You should consider turning this on. Keep in mind that other web applications not
  64. written in PHP will not be restricted by this setting.');
  65. }
  66.  
  67. }

Documentation generated on Tue, 24 Oct 2006 10:53:37 -0400 by phpDocumentor 1.3.0RC3