1999-09-29 15:17:02 +00:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| PHP version 4.0 |
|
|
|
|
+----------------------------------------------------------------------+
|
2000-01-01 01:32:05 +00:00
|
|
|
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
1999-09-29 15:17:02 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2000-02-19 23:41:32 +00:00
|
|
|
| This source file is subject to version 2.01 of the PHP license, |
|
1999-09-29 15:17:02 +00:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available at through the world-wide-web at |
|
2000-02-19 23:41:32 +00:00
|
|
|
| http://www.php.net/license/2_01.txt. |
|
1999-09-29 15:17:02 +00:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Rasmus Lerdorf <rasmus@php.net> |
|
|
|
|
| (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
|
|
|
|
| PHP 4.0 patches by: |
|
|
|
|
| Zeev Suraski <zeev@zend.com> |
|
|
|
|
| Stig Bakken <ssb@fast.no> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
/* $Id$ */
|
|
|
|
|
2000-02-18 10:13:15 +00:00
|
|
|
#define NO_REGEX_EXTRA_H
|
2000-04-30 04:15:26 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#endif
|
2000-02-16 17:46:14 +00:00
|
|
|
|
1999-10-30 14:22:10 +00:00
|
|
|
#include "php.h"
|
|
|
|
|
1999-09-29 15:17:02 +00:00
|
|
|
#include "httpd.h"
|
|
|
|
#include "http_config.h"
|
|
|
|
#if MODULE_MAGIC_NUMBER > 19980712
|
|
|
|
# include "ap_compat.h"
|
|
|
|
#else
|
|
|
|
# if MODULE_MAGIC_NUMBER > 19980324
|
|
|
|
# include "compat.h"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#include "http_core.h"
|
|
|
|
#include "http_main.h"
|
|
|
|
#include "http_protocol.h"
|
|
|
|
#include "http_request.h"
|
|
|
|
#include "http_log.h"
|
|
|
|
|
|
|
|
#include "zend.h"
|
|
|
|
#include "php_ini.h"
|
|
|
|
#include "php_globals.h"
|
|
|
|
#include "SAPI.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "zend_compile.h"
|
|
|
|
#include "zend_execute.h"
|
|
|
|
#include "zend_highlight.h"
|
|
|
|
#include "zend_indent.h"
|
1999-12-04 19:19:57 +00:00
|
|
|
#include "ext/standard/php_standard.h"
|
1999-09-29 15:17:02 +00:00
|
|
|
#include "util_script.h"
|
|
|
|
#include "php_version.h"
|
|
|
|
/*#include "mod_php4.h"*/
|
|
|
|
|
2000-04-30 04:15:26 +00:00
|
|
|
|
2000-05-04 03:28:34 +00:00
|
|
|
int apache_php_module_main(request_rec *r, int fd, int display_source_mode CLS_DC ELS_DC PLS_DC SLS_DC)
|
1999-09-29 15:17:02 +00:00
|
|
|
{
|
|
|
|
zend_file_handle file_handle;
|
|
|
|
|
|
|
|
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
2000-05-04 03:28:34 +00:00
|
|
|
#ifdef PHP_WIN32
|
|
|
|
/* sending a file handle to another dll is not working
|
|
|
|
// so let zend open it.
|
|
|
|
*/
|
|
|
|
file_handle.type = ZEND_HANDLE_FILENAME;
|
|
|
|
file_handle.handle.fd = 0;
|
|
|
|
#else
|
1999-09-29 15:17:02 +00:00
|
|
|
file_handle.type = ZEND_HANDLE_FD;
|
|
|
|
file_handle.handle.fd = fd;
|
2000-05-04 03:28:34 +00:00
|
|
|
#endif
|
1999-09-29 15:17:02 +00:00
|
|
|
file_handle.filename = SG(request_info).path_translated;
|
1999-12-04 13:25:41 +00:00
|
|
|
file_handle.free_filename = 0;
|
1999-09-29 15:17:02 +00:00
|
|
|
|
|
|
|
if (display_source_mode) {
|
|
|
|
zend_syntax_highlighter_ini syntax_highlighter_ini;
|
|
|
|
|
|
|
|
if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
|
|
|
|
php_get_highlight_struct(&syntax_highlighter_ini);
|
|
|
|
zend_highlight(&syntax_highlighter_ini);
|
|
|
|
return OK;
|
|
|
|
} else {
|
|
|
|
return NOT_FOUND;
|
|
|
|
}
|
|
|
|
} else {
|
1999-12-17 14:24:39 +00:00
|
|
|
(void) php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
|
1999-09-29 15:17:02 +00:00
|
|
|
}
|
|
|
|
|
1999-12-17 19:51:39 +00:00
|
|
|
php_header(); /* Make sure headers have been sent */
|
1999-09-29 15:17:02 +00:00
|
|
|
php_end_ob_buffering(1);
|
|
|
|
return (OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
*/
|