cvs: php4 /sapi/pi3web pi3web_sapi.c pi3web_sapi.h

From: Date: Fri, 20 Jul 2001 21:00:17 +0000
Subject: cvs: php4 /sapi/pi3web pi3web_sapi.c pi3web_sapi.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-6293@lists.php.net to get a copy of this message
holger Fri Jul 20 17:00:17 2001 EDT Modified files: /php4/sapi/pi3web pi3web_sapi.c pi3web_sapi.h Log: Updated PHP mode, fixed indent mode, added syntax check mode Index: php4/sapi/pi3web/pi3web_sapi.c diff -u php4/sapi/pi3web/pi3web_sapi.c:1.17 php4/sapi/pi3web/pi3web_sapi.c:1.18 --- php4/sapi/pi3web/pi3web_sapi.c:1.17 Sun Apr 8 06:49:07 2001 +++ php4/sapi/pi3web/pi3web_sapi.c Fri Jul 20 17:00:14 2001 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pi3web_sapi.c,v 1.17 2001/04/08 10:49:07 holger Exp $ */ +/* $Id: pi3web_sapi.c,v 1.18 2001/07/20 21:00:14 holger Exp $ */ #include "pi3web_sapi.h" #include "php.h" @@ -31,6 +31,7 @@ #include "ext/standard/info.h" #include "zend_highlight.h" #include "zend_indent.h" +#include "zend_alloc.h" #include "ext/standard/basic_functions.h" #include "TSRM/TSRM.h" #include "PiAPI.h" @@ -77,7 +78,7 @@ PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n"); PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">Pi3Web Server Information</th></tr>\n"); php_info_print_table_header(2, "Information Field", "Value"); - php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c,v 1.17 2001/04/08 10:49:07 holger Exp $"); + php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id: pi3web_sapi.c,v 1.18 2001/07/20 21:00:14 holger Exp $"); php_info_print_table_row(2, "Server Name Stamp", HTTPCore_getServerStamp()); snprintf(variable_buf, 511, "%d", HTTPCore_debugEnabled()); php_info_print_table_row(2, "Debug Enabled", variable_buf); @@ -276,7 +277,6 @@ return NULL; } - static sapi_module_struct pi3web_sapi_module = { "pi3web", /* name */ "PI3WEB", /* pretty name */ @@ -303,7 +303,6 @@ STANDARD_SAPI_MODULE_PROPERTIES }; - static void init_request_info(sapi_globals_struct *sapi_globals, LPCONTROL_BLOCK lpCB) { char *path_end = strrchr(lpCB->lpszFileName, PHP_DIR_SEPARATOR); @@ -376,6 +375,8 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) { zend_file_handle file_handle; + char *header_line; + int iRet = PIAPI_COMPLETED; SLS_FETCH(); CLS_FETCH(); ELS_FETCH(); @@ -396,31 +397,49 @@ switch ( lpCB->dwBehavior ) { case PHP_MODE_STANDARD: - php_execute_script( &file_handle CLS_CC ELS_CC PLS_CC ); + iRet = ( php_execute_script( &file_handle CLS_CC ELS_CC PLS_CC ) == SUCCESS ) ? + PIAPI_COMPLETED : PIAPI_ERROR; break; case PHP_MODE_HIGHLIGHT: { - 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 ); - /* fclose( file_handle.handle.fp ); */ + 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 ); + } + else + { + iRet = PIAPI_ERROR; }; }; break; case PHP_MODE_INDENT: - if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) { + header_line = (char *)estrdup("Content-Type: text/plain"); + sapi_add_header_ex(header_line, strlen(header_line), TRUE, TRUE); + if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) + { zend_indent(); - }; - /* fclose( file_handle.handle.fp ); */ + } + else + { + iRet = PIAPI_ERROR; + }; break; - } + case PHP_MODE_LINT: + iRet = (php_lint_script(&file_handle CLS_CC ELS_CC PLS_CC) == SUCCESS) ? + PIAPI_COMPLETED : PIAPI_ERROR; + break; + default: + iRet = PIAPI_ERROR;; + } if (SG(request_info).cookie_data) { efree(SG(request_info).cookie_data); }; + efree(header_line); php_request_shutdown(NULL); - return PIAPI_COMPLETED; + return iRet; } BOOL PHP4_startup() { Index: php4/sapi/pi3web/pi3web_sapi.h diff -u php4/sapi/pi3web/pi3web_sapi.h:1.2 php4/sapi/pi3web/pi3web_sapi.h:1.3 --- php4/sapi/pi3web/pi3web_sapi.h:1.2 Sun Apr 8 06:49:07 2001 +++ php4/sapi/pi3web/pi3web_sapi.h Fri Jul 20 17:00:17 2001 @@ -28,9 +28,10 @@ extern "C" { #endif -#define PHP_MODE_STANDARD 0 -#define PHP_MODE_HIGHLIGHT 1 -#define PHP_MODE_INDENT 2 +#define PHP_MODE_STANDARD 1 +#define PHP_MODE_HIGHLIGHT 2 +#define PHP_MODE_INDENT 3 +#define PHP_MODE_LINT 4 // // passed to the procedure on a new request @@ -79,9 +80,9 @@ } CONTROL_BLOCK, *LPCONTROL_BLOCK; -MODULE_API DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB); -MODULE_API BOOL PHP4_startup(); -MODULE_API BOOL PHP4_shutdown(); +DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB); +BOOL PHP4_startup(); +BOOL PHP4_shutdown(); // the following type declaration is for the server side typedef DWORD ( * PFN_WRAPPERFUNC )( CONTROL_BLOCK *pCB );

« previous php.cvs (#6293) next »