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.

110 lines
3.2 KiB

24 years ago
24 years ago
25 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 4 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2002 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.02 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available at through the world-wide-web at |
  10. | http://www.php.net/license/2_02.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@fast.no> |
  20. +----------------------------------------------------------------------+
  21. */
  22. /* $Id$ */
  23. #define NO_REGEX_EXTRA_H
  24. #ifdef WIN32
  25. #include <winsock2.h>
  26. #include <stddef.h>
  27. #endif
  28. #include "php.h"
  29. #include "httpd.h"
  30. #include "http_config.h"
  31. #if MODULE_MAGIC_NUMBER > 19980712
  32. # include "ap_compat.h"
  33. #else
  34. # if MODULE_MAGIC_NUMBER > 19980324
  35. # include "compat.h"
  36. # endif
  37. #endif
  38. #include "http_core.h"
  39. #include "http_main.h"
  40. #include "http_protocol.h"
  41. #include "http_request.h"
  42. #include "http_log.h"
  43. #include "zend.h"
  44. #include "php_ini.h"
  45. #include "php_globals.h"
  46. #include "SAPI.h"
  47. #include "php_main.h"
  48. #include "zend_compile.h"
  49. #include "zend_execute.h"
  50. #include "zend_highlight.h"
  51. #include "zend_indent.h"
  52. #include "ext/standard/php_standard.h"
  53. #include "util_script.h"
  54. #include "php_version.h"
  55. #include "mod_php4.h"
  56. /* {{{ apache_php_module_main
  57. */
  58. int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC)
  59. {
  60. zend_file_handle file_handle;
  61. if (php_request_startup(TSRMLS_C) == FAILURE) {
  62. return FAILURE;
  63. }
  64. /* sending a file handle to another dll is not working
  65. // so let zend open it.
  66. */
  67. if (display_source_mode) {
  68. zend_syntax_highlighter_ini syntax_highlighter_ini;
  69. php_get_highlight_struct(&syntax_highlighter_ini);
  70. if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC)){
  71. return OK;
  72. } else {
  73. return NOT_FOUND;
  74. }
  75. } else {
  76. file_handle.type = ZEND_HANDLE_FILENAME;
  77. file_handle.handle.fd = 0;
  78. file_handle.filename = SG(request_info).path_translated;
  79. file_handle.opened_path = NULL;
  80. file_handle.free_filename = 0;
  81. (void) php_execute_script(&file_handle TSRMLS_CC);
  82. }
  83. AP(in_request) = 0;
  84. zend_try {
  85. php_request_shutdown(NULL);
  86. } zend_end_try();
  87. return (OK);
  88. }
  89. /* }}} */
  90. /*
  91. * Local variables:
  92. * tab-width: 4
  93. * c-basic-offset: 4
  94. * End:
  95. * vim600: sw=4 ts=4 fdm=marker
  96. * vim<600: sw=4 ts=4
  97. */