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.

105 lines
3.2 KiB

26 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP version 4.0 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2001 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. int apache_php_module_main(request_rec *r, int display_source_mode CLS_DC ELS_DC PLS_DC SLS_DC)
  57. {
  58. zend_file_handle file_handle;
  59. if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
  60. return FAILURE;
  61. }
  62. /* sending a file handle to another dll is not working
  63. // so let zend open it.
  64. */
  65. if (display_source_mode) {
  66. zend_syntax_highlighter_ini syntax_highlighter_ini;
  67. php_get_highlight_struct(&syntax_highlighter_ini);
  68. if (highlight_file(SG(request_info).path_translated,&syntax_highlighter_ini)){
  69. return OK;
  70. } else {
  71. return NOT_FOUND;
  72. }
  73. } else {
  74. file_handle.type = ZEND_HANDLE_FILENAME;
  75. file_handle.handle.fd = 0;
  76. file_handle.filename = SG(request_info).path_translated;
  77. file_handle.opened_path = NULL;
  78. file_handle.free_filename = 0;
  79. (void) php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
  80. }
  81. if (setjmp(EG(bailout))!=0) {
  82. return OK;
  83. }
  84. php_end_ob_buffers(1);
  85. php_header(); /* Make sure headers have been sent */
  86. return (OK);
  87. }
  88. /*
  89. * Local variables:
  90. * tab-width: 4
  91. * c-basic-offset: 4
  92. * End:
  93. */