1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2013 The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 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_01.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 24 #include "php_apache_http.h" 25 26 /* {{{ apache_php_module_main 27 */ apache_php_module_main(request_rec * r,int display_source_mode TSRMLS_DC)28int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC) 29 { 30 int retval = OK; 31 zend_file_handle file_handle; 32 33 if (php_request_startup(TSRMLS_C) == FAILURE) { 34 return FAILURE; 35 } 36 /* sending a file handle to another dll is not working 37 so let zend open it. */ 38 39 if (display_source_mode) { 40 zend_syntax_highlighter_ini syntax_highlighter_ini; 41 42 php_get_highlight_struct(&syntax_highlighter_ini); 43 if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC) != SUCCESS) { 44 retval = NOT_FOUND; 45 } 46 } else { 47 file_handle.type = ZEND_HANDLE_FILENAME; 48 file_handle.handle.fd = 0; 49 file_handle.filename = SG(request_info).path_translated; 50 file_handle.opened_path = NULL; 51 file_handle.free_filename = 0; 52 53 (void) php_execute_script(&file_handle TSRMLS_CC); 54 } 55 56 AP(in_request) = 0; 57 58 zend_try { 59 php_request_shutdown(NULL); 60 } zend_end_try(); 61 62 return retval; 63 } 64 /* }}} */ 65 66 /* 67 * Local variables: 68 * tab-width: 4 69 * c-basic-offset: 4 70 * End: 71 * vim600: sw=4 ts=4 fdm=marker 72 * vim<600: sw=4 ts=4 73 */ 74