~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to sapi/apache/sapi_apache.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: sapi_apache.c,v 1.45 2004/01/08 08:18:03 andi Exp $ */
 
23
 
 
24
#include "php_apache_http.h"
 
25
 
 
26
/* {{{ apache_php_module_main
 
27
 */
 
28
int 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
        
 
40
        if (display_source_mode) {
 
41
                zend_syntax_highlighter_ini syntax_highlighter_ini;
 
42
 
 
43
                php_get_highlight_struct(&syntax_highlighter_ini);
 
44
                if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC) != SUCCESS) {
 
45
                        retval = NOT_FOUND;
 
46
                }
 
47
        } else {
 
48
                file_handle.type = ZEND_HANDLE_FILENAME;
 
49
                file_handle.handle.fd = 0;
 
50
                file_handle.filename = SG(request_info).path_translated;
 
51
                file_handle.opened_path = NULL;
 
52
                file_handle.free_filename = 0;
 
53
 
 
54
                (void) php_execute_script(&file_handle TSRMLS_CC);
 
55
        }
 
56
 
 
57
        AP(in_request) = 0;
 
58
        
 
59
        zend_try {
 
60
                php_request_shutdown(NULL);
 
61
        } zend_end_try();
 
62
        
 
63
        return retval;
 
64
}
 
65
/* }}} */
 
66
 
 
67
/*
 
68
 * Local variables:
 
69
 * tab-width: 4
 
70
 * c-basic-offset: 4
 
71
 * End:
 
72
 * vim600: sw=4 ts=4 fdm=marker
 
73
 * vim<600: sw=4 ts=4
 
74
 */