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.

74 lines
2.5 KiB

25 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2004 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.0 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_0.txt. |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Rasmus Lerdorf <rasmus@php.net> |
  16. | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
  17. | PHP 4.0 patches by: |
  18. | Zeev Suraski <zeev@zend.com> |
  19. | Stig Bakken <ssb@php.net> |
  20. +----------------------------------------------------------------------+
  21. */
  22. /* $Id$ */
  23. #include "php_apache_http.h"
  24. /* {{{ apache_php_module_main
  25. */
  26. int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC)
  27. {
  28. int retval = OK;
  29. zend_file_handle file_handle;
  30. if (php_request_startup(TSRMLS_C) == FAILURE) {
  31. return FAILURE;
  32. }
  33. /* sending a file handle to another dll is not working
  34. // so let zend open it.
  35. */
  36. if (display_source_mode) {
  37. zend_syntax_highlighter_ini syntax_highlighter_ini;
  38. php_get_highlight_struct(&syntax_highlighter_ini);
  39. if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC) != SUCCESS) {
  40. retval = NOT_FOUND;
  41. }
  42. } else {
  43. file_handle.type = ZEND_HANDLE_FILENAME;
  44. file_handle.handle.fd = 0;
  45. file_handle.filename = SG(request_info).path_translated;
  46. file_handle.opened_path = NULL;
  47. file_handle.free_filename = 0;
  48. (void) php_execute_script(&file_handle TSRMLS_CC);
  49. }
  50. AP(in_request) = 0;
  51. zend_try {
  52. php_request_shutdown(NULL);
  53. } zend_end_try();
  54. return retval;
  55. }
  56. /* }}} */
  57. /*
  58. * Local variables:
  59. * tab-width: 4
  60. * c-basic-offset: 4
  61. * End:
  62. * vim600: sw=4 ts=4 fdm=marker
  63. * vim<600: sw=4 ts=4
  64. */