Diff for /embedaddon/php/ext/standard/info.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:48:02 version 1.1.1.2, 2012/05/29 12:34:43
Line 38 Line 38
 #include <sys/utsname.h>  #include <sys/utsname.h>
 #endif  #endif
   
   
 #ifdef PHP_WIN32  #ifdef PHP_WIN32
 typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);  typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
 typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);  typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
   
 # include "winver.h"  # include "winver.h"
   
#if _MSC_VER < 1300# if _MSC_VER < 1300
define OSVERSIONINFOEX php_win_OSVERSIONINFOEX#  define OSVERSIONINFOEX php_win_OSVERSIONINFOEX
 # endif
 #endif  #endif
   
 #endif  
   
 #if HAVE_MBSTRING  
 #include "ext/mbstring/mbstring.h"  
 ZEND_EXTERN_MODULE_GLOBALS(mbstring)  
 #endif  
   
 #if HAVE_ICONV  
 #include "ext/iconv/php_iconv.h"  
 ZEND_EXTERN_MODULE_GLOBALS(iconv)  
 #endif  
   
 #define SECTION(name)   if (!sapi_module.phpinfo_as_text) { \  #define SECTION(name)   if (!sapi_module.phpinfo_as_text) { \
                                                        PUTS("<h2>" name "</h2>\n"); \                                                        php_info_print("<h2>" name "</h2>\n"); \
                                                 } else { \                                                  } else { \
                                                         php_info_print_table_start(); \                                                          php_info_print_table_start(); \
                                                         php_info_print_table_header(1, name); \                                                          php_info_print_table_header(1, name); \
Line 71  ZEND_EXTERN_MODULE_GLOBALS(iconv) Line 60  ZEND_EXTERN_MODULE_GLOBALS(iconv)
 PHPAPI extern char *php_ini_opened_path;  PHPAPI extern char *php_ini_opened_path;
 PHPAPI extern char *php_ini_scanned_path;  PHPAPI extern char *php_ini_scanned_path;
 PHPAPI extern char *php_ini_scanned_files;  PHPAPI extern char *php_ini_scanned_files;
        
static int php_info_write_wrapper(const char *str, uint str_length)static int php_info_print_html_esc(const char *str, int len) /* {{{ */
 {  {
        int new_len, written;        size_t new_len;
        char *elem_esc;        int written;
         char *new_str;
         TSRMLS_FETCH();
         
         new_str = php_escape_html_entities((unsigned char *) str, len, &new_len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC);
         written = php_output_write(new_str, new_len TSRMLS_CC);
         efree(new_str);
         return written;
 }
 /* }}} */
   
   static int php_info_printf(const char *fmt, ...) /* {{{ */
   {
           char *buf;
           int len, written;
           va_list argv;
         TSRMLS_FETCH();          TSRMLS_FETCH();
           
           va_start(argv, fmt);
           len = vspprintf(&buf, 0, fmt, argv);
           va_end(argv);
           
           written = php_output_write(buf, len TSRMLS_CC);
           efree(buf);
           return written;
   }
   /* }}} */
   
        elem_esc = php_escape_html_entities((unsigned char *)str, str_length, &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);static void php_info_print_request_uri(TSRMLS_D) /* {{{ */
 {
         if (SG(request_info).request_uri) {
                 php_info_print_html_esc(SG(request_info).request_uri, strlen(SG(request_info).request_uri));
         }
 }
 /* }}} */
   
        written = php_body_write(elem_esc, new_len TSRMLS_CC);static int php_info_print(const char *str) /* {{{ */
 {
         TSRMLS_FETCH();
         return php_output_write(str, strlen(str) TSRMLS_CC);
 }
 /* }}} */
   
        efree(elem_esc);static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC) /* {{{ */
 {
         char *key;
         uint len;
         
         if (ht) {
                 if (zend_hash_num_elements(ht)) {
                         HashPosition pos;
   
        return written;                        if (!sapi_module.phpinfo_as_text) {
                                 php_info_printf("<tr><td class=\"e\">Registered %s</td><td class=\"v\">", name);
                         } else {
                                 php_info_printf("\nRegistered %s => ", name);
                         }
                         
                         zend_hash_internal_pointer_reset_ex(ht, &pos);
                         while (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING)
                         {
                                 php_info_print(key);
                                 zend_hash_move_forward_ex(ht, &pos);
                                 if (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) {
                                         php_info_print(", ");
                                 } else {
                                         break;
                                 }
                         }
                         
                         if (!sapi_module.phpinfo_as_text) {
                                 php_info_print("</td></tr>\n");
                         }
                 } else {
                         char reg_name[128];
                         snprintf(reg_name, sizeof(reg_name), "Registered %s", name);
                         php_info_print_table_row(2, reg_name, "none registered");
                 }
         } else {
                 php_info_print_table_row(2, name, "disabled");
         }
 }  }
   /* }}} */
   
   
 PHPAPI void php_info_print_module(zend_module_entry *zend_module TSRMLS_DC) /* {{{ */  PHPAPI void php_info_print_module(zend_module_entry *zend_module TSRMLS_DC) /* {{{ */
 {  {
         if (zend_module->info_func || zend_module->version) {          if (zend_module->info_func || zend_module->version) {
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        php_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", zend_module->name, zend_module->name);                        php_info_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", zend_module->name, zend_module->name);
                 } else {                  } else {
                         php_info_print_table_start();                          php_info_print_table_start();
                         php_info_print_table_header(1, zend_module->name);                          php_info_print_table_header(1, zend_module->name);
Line 109  PHPAPI void php_info_print_module(zend_module_entry *z Line 168  PHPAPI void php_info_print_module(zend_module_entry *z
                 }                  }
         } else {          } else {
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        php_printf("<tr><td>%s</td></tr>\n", zend_module->name);                        php_info_printf("<tr><td>%s</td></tr>\n", zend_module->name);
                 } else {                  } else {
                        php_printf("%s\n", zend_module->name);                        php_info_printf("%s\n", zend_module->name);
                 }                         }       
         }          }
 }  }
Line 151  static void php_print_gpcse_array(char *name, uint nam Line 210  static void php_print_gpcse_array(char *name, uint nam
                 zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data));                  zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data));
                 while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) {                  while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) {
                         if (!sapi_module.phpinfo_as_text) {                          if (!sapi_module.phpinfo_as_text) {
                                PUTS("<tr>");                                php_info_print("<tr>");
                                PUTS("<td class=\"e\">");                                php_info_print("<td class=\"e\">");
 
                         }                          }
   
                        PUTS(name);                        php_info_print(name);
                        PUTS("[\"");                        php_info_print("[\"");
                                                   
                         switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) {                          switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) {
                                 case HASH_KEY_IS_STRING:                                  case HASH_KEY_IS_STRING:
                                         if (!sapi_module.phpinfo_as_text) {                                          if (!sapi_module.phpinfo_as_text) {
                                                php_info_html_esc_write(string_key, string_len - 1 TSRMLS_CC);                                                php_info_print_html_esc(string_key, string_len-1);
                                         } else {                                          } else {
                                                PHPWRITE(string_key, string_len - 1);                                                php_info_print(string_key);
                                        }                                               }
                                         break;                                          break;
                                 case HASH_KEY_IS_LONG:                                  case HASH_KEY_IS_LONG:
                                        php_printf("%ld", num_key);                                        php_info_printf("%ld", num_key);
                                         break;                                          break;
                         }                          }
                        PUTS("\"]");                        php_info_print("\"]");
                         if (!sapi_module.phpinfo_as_text) {                          if (!sapi_module.phpinfo_as_text) {
                                PUTS("</td><td class=\"v\">");                                php_info_print("</td><td class=\"v\">");
                         } else {                          } else {
                                PUTS(" => ");                                php_info_print(" => ");
                         }                          }
                         if (Z_TYPE_PP(tmp) == IS_ARRAY) {                          if (Z_TYPE_PP(tmp) == IS_ARRAY) {
                                 if (!sapi_module.phpinfo_as_text) {                                  if (!sapi_module.phpinfo_as_text) {
                                        PUTS("<pre>");                                        php_info_print("<pre>");
                                        zend_print_zval_r_ex((zend_write_func_t) php_info_write_wrapper, *tmp, 0 TSRMLS_CC);                                        zend_print_zval_r_ex((zend_write_func_t) php_info_print_html_esc, *tmp, 0 TSRMLS_CC);
                                        PUTS("</pre>");                                        php_info_print("</pre>");
                                 } else {                                  } else {
                                         zend_print_zval_r(*tmp, 0 TSRMLS_CC);                                          zend_print_zval_r(*tmp, 0 TSRMLS_CC);
                                 }                                  }
                        } else if (Z_TYPE_PP(tmp) != IS_STRING) {                        } else {
                                 tmp2 = **tmp;                                  tmp2 = **tmp;
                                zval_copy_ctor(&tmp2);                                if (Z_TYPE_PP(tmp) != IS_STRING) {
                                convert_to_string(&tmp2);                                        tmp = NULL;
                                         zval_copy_ctor(&tmp2);
                                         convert_to_string(&tmp2);
                                 }
 
                                 if (!sapi_module.phpinfo_as_text) {                                  if (!sapi_module.phpinfo_as_text) {
                                         if (Z_STRLEN(tmp2) == 0) {                                          if (Z_STRLEN(tmp2) == 0) {
                                                PUTS("<i>no value</i>");                                                php_info_print("<i>no value</i>");
                                         } else {                                          } else {
                                                php_info_html_esc_write(Z_STRVAL(tmp2), Z_STRLEN(tmp2) TSRMLS_CC);                                                php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2));
                                        }  
                                } else { 
                                        PHPWRITE(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); 
                                }        
                                zval_dtor(&tmp2); 
                        } else { 
                                if (!sapi_module.phpinfo_as_text) { 
                                        if (Z_STRLEN_PP(tmp) == 0) { 
                                                PUTS("<i>no value</i>"); 
                                        } else { 
                                                php_info_html_esc_write(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp) TSRMLS_CC); 
                                         }                                          }
                                 } else {                                  } else {
                                        PHPWRITE(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));                                        php_info_print(Z_STRVAL(tmp2));
                                }                                       }
 
                                 if (!tmp) {
                                         zval_dtor(&tmp2);
                                 }
                         }                          }
                         if (!sapi_module.phpinfo_as_text) {                          if (!sapi_module.phpinfo_as_text) {
                                PUTS("</td></tr>\n");                                php_info_print("</td></tr>\n");
                         } else {                          } else {
                                PUTS("\n");                                php_info_print("\n");
                        }                               }
                         zend_hash_move_forward(Z_ARRVAL_PP(data));                          zend_hash_move_forward(Z_ARRVAL_PP(data));
                 }                  }
         }          }
Line 225  static void php_print_gpcse_array(char *name, uint nam Line 280  static void php_print_gpcse_array(char *name, uint nam
  */   */
 void php_info_print_style(TSRMLS_D)  void php_info_print_style(TSRMLS_D)
 {  {
        php_printf("<style type=\"text/css\">\n");        php_info_printf("<style type=\"text/css\">\n");
         php_info_print_css(TSRMLS_C);          php_info_print_css(TSRMLS_C);
        php_printf("</style>\n");        php_info_printf("</style>\n");
 }  }
 /* }}} */  /* }}} */
   
 /* {{{ php_info_html_esc_write  
  */  
 PHPAPI void php_info_html_esc_write(char *string, int str_len TSRMLS_DC)  
 {  
         int new_len;  
         char *ret = php_escape_html_entities((unsigned char *)string, str_len, &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);  
   
         PHPWRITE(ret, new_len);  
         efree(ret);  
 }  
 /* }}} */  
   
 /* {{{ php_info_html_esc  /* {{{ php_info_html_esc
  */   */
 PHPAPI char *php_info_html_esc(char *string TSRMLS_DC)  PHPAPI char *php_info_html_esc(char *string TSRMLS_DC)
 {  {
        int new_len;        size_t new_len;
        return php_escape_html_entities((unsigned char *)string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);        return php_escape_html_entities(string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
 }  }
 /* }}} */  /* }}} */
   
   
 #ifdef PHP_WIN32  #ifdef PHP_WIN32
 /* {{{  */  /* {{{  */
   
 char* php_get_windows_name()  char* php_get_windows_name()
 {  {
         OSVERSIONINFOEX osvi;          OSVERSIONINFOEX osvi;
Line 281  char* php_get_windows_name() Line 324  char* php_get_windows_name()
         }          }
   
         if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) {          if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) {
                if (osvi.dwMajorVersion == 6) {                if (osvi.dwMajorVersion == 6)   {
                         if( osvi.dwMinorVersion == 0 ) {                          if( osvi.dwMinorVersion == 0 ) {
                                 if( osvi.wProductType == VER_NT_WORKSTATION ) {                                  if( osvi.wProductType == VER_NT_WORKSTATION ) {
                                         major = "Windows Vista";                                          major = "Windows Vista";
Line 296  char* php_get_windows_name() Line 339  char* php_get_windows_name()
                                         major = "Windows Server 2008 R2";                                          major = "Windows Server 2008 R2";
                                 }                                  }
                         } else {                          } else {
                                major = "Unknow Windows version";                                major = "Unknown Windows version";
                         }                          }
   
                         pGPI = (PGPI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetProductInfo");                          pGPI = (PGPI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetProductInfo");
Line 357  char* php_get_windows_name() Line 400  char* php_get_windows_name()
                         }                          }
                 }                  }
   
                if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )     {                if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) {
                         if (GetSystemMetrics(SM_SERVERR2))                          if (GetSystemMetrics(SM_SERVERR2))
                                 major = "Windows Server 2003 R2";                                  major = "Windows Server 2003 R2";
                        else if (osvi.wSuiteMask == VER_SUITE_STORAGE_SERVER)                        else if (osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER)
                                 major = "Windows Storage Server 2003";                                  major = "Windows Storage Server 2003";
                        else if (osvi.wSuiteMask == VER_SUITE_WH_SERVER)                        else if (osvi.wSuiteMask==VER_SUITE_WH_SERVER)
                                 major = "Windows Home Server";                                  major = "Windows Home Server";
                         else if (osvi.wProductType == VER_NT_WORKSTATION &&                          else if (osvi.wProductType == VER_NT_WORKSTATION &&
                                 si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) {                                  si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) {
Line 402  char* php_get_windows_name() Line 445  char* php_get_windows_name()
   
                 if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )     {                  if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )     {
                         major = "Windows XP";                          major = "Windows XP";
                        if( osvi.wSuiteMask & VER_SUITE_PERSONAL )                        if( osvi.wSuiteMask & VER_SUITE_PERSONAL ) {
                                 sub = "Home Edition";                                  sub = "Home Edition";
                        else sub = "Professional";                        } else if (GetSystemMetrics(SM_MEDIACENTER)) {
                                 sub = "Media Center Edition";
                         } else if (GetSystemMetrics(SM_STARTER)) {
                                 sub = "Starter Edition";
                         } else if (GetSystemMetrics(SM_TABLETPC)) {
                                 sub = "Tablet PC Edition";
                         } else {
                                 sub = "Professional";
                         }
                 }                  }
   
                 if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) {                  if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) {
Line 486  PHPAPI char *php_get_uname(char mode) Line 537  PHPAPI char *php_get_uname(char mode)
         GetComputerName(ComputerName, &dwSize);          GetComputerName(ComputerName, &dwSize);
   
         if (mode == 's') {          if (mode == 's') {
                if (dwVersion < 0x80000000) {                php_uname = "Windows NT";
                        php_uname = "Windows NT"; 
                } else { 
                        php_uname = "Windows 9x"; 
                } 
         } else if (mode == 'r') {          } else if (mode == 'r') {
                 snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion);                  snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion);
                 php_uname = tmp_uname;                  php_uname = tmp_uname;
Line 512  PHPAPI char *php_get_uname(char mode) Line 559  PHPAPI char *php_get_uname(char mode)
                 php_get_windows_cpu(tmp_uname, sizeof(tmp_uname));                  php_get_windows_cpu(tmp_uname, sizeof(tmp_uname));
                 php_uname = tmp_uname;                  php_uname = tmp_uname;
         } else { /* assume mode == 'a' */          } else { /* assume mode == 'a' */
                /* Get build numbers for Windows NT or Win95 */                char *winver = php_get_windows_name();
                if (dwVersion < 0x80000000){                char wincpu[20];
                        char *winver = php_get_windows_name(); 
                        char wincpu[20]; 
   
                        php_get_windows_cpu(wincpu, sizeof(wincpu));                php_get_windows_cpu(wincpu, sizeof(wincpu));
                        dwBuild = (DWORD)(HIWORD(dwVersion));                dwBuild = (DWORD)(HIWORD(dwVersion));
                        snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d (%s) %s",                snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d (%s) %s",
                                         "Windows NT", ComputerName,                                 "Windows NT", ComputerName,
                                         dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild, winver?winver:"unknown", wincpu);                                 dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild, winver?winver:"unknown", wincpu);
                        if(winver) {                if(winver) {
                                efree(winver);                        efree(winver);
                        } 
                } else { 
                        snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d", 
                                         "Windows 9x", ComputerName, 
                                         dwWindowsMajorVersion, dwWindowsMinorVersion); 
                 }                  }
                 php_uname = tmp_uname;                  php_uname = tmp_uname;
         }          }
Line 588  PHPAPI char *php_get_uname(char mode) Line 628  PHPAPI char *php_get_uname(char mode)
 }  }
 /* }}} */  /* }}} */
   
   
 /* {{{ php_print_info_htmlhead  /* {{{ php_print_info_htmlhead
  */   */
 PHPAPI void php_print_info_htmlhead(TSRMLS_D)  PHPAPI void php_print_info_htmlhead(TSRMLS_D)
 {  {
        php_info_print("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n");
/*** none of this is needed now ***        php_info_print("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
        php_info_print("<head>\n");
        const char *charset = NULL; 
 
        if (SG(default_charset)) { 
                charset = SG(default_charset); 
        } 
 
#if HAVE_MBSTRING 
        if (php_ob_handler_used("mb_output_handler" TSRMLS_CC)) { 
                if (MBSTRG(current_http_output_encoding) == mbfl_no_encoding_pass) { 
                        charset = "US-ASCII"; 
                } else { 
                        charset = mbfl_no2preferred_mime_name(MBSTRG(current_http_output_encoding)); 
                } 
        } 
#endif    
 
#if HAVE_ICONV 
        if (php_ob_handler_used("ob_iconv_handler" TSRMLS_CC)) { 
                charset = ICONVG(output_encoding); 
        } 
#endif 
 
        if (!charset || !charset[0]) { 
                charset = "US-ASCII"; 
        } 
 
*** none of that is needed now ***/ 
 
 
        PUTS("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n"); 
        PUTS("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); 
        PUTS("<head>\n"); 
         php_info_print_style(TSRMLS_C);          php_info_print_style(TSRMLS_C);
        PUTS("<title>phpinfo()</title>");        php_info_print("<title>phpinfo()</title>");
        PUTS("<meta name=\"ROBOTS\" content=\"NOINDEX,NOFOLLOW,NOARCHIVE\" />");        php_info_print("<meta name=\"ROBOTS\" content=\"NOINDEX,NOFOLLOW,NOARCHIVE\" />");
/*        php_info_print("</head>\n");
        php_printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />\n", charset);        php_info_print("<body><div class=\"center\">\n");
*/ 
        PUTS("</head>\n"); 
        PUTS("<body><div class=\"center\">\n"); 
 }  }
 /* }}} */  /* }}} */
   
Line 661  PHPAPI void php_print_info(int flag TSRMLS_DC) Line 665  PHPAPI void php_print_info(int flag TSRMLS_DC)
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                 php_print_info_htmlhead(TSRMLS_C);                  php_print_info_htmlhead(TSRMLS_C);
         } else {          } else {
                PUTS("phpinfo()\n");                php_info_print("phpinfo()\n");
        }               }
   
         if (flag & PHP_INFO_GENERAL) {          if (flag & PHP_INFO_GENERAL) {
                 char *zend_version = get_zend_version();                  char *zend_version = get_zend_version();
Line 676  PHPAPI void php_print_info(int flag TSRMLS_DC) Line 680  PHPAPI void php_print_info(int flag TSRMLS_DC)
                 }                  }
   
                 if (expose_php && !sapi_module.phpinfo_as_text) {                  if (expose_php && !sapi_module.phpinfo_as_text) {
                        PUTS("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");                        php_info_print("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
                        if (SG(request_info).request_uri) {                        php_info_print_request_uri(TSRMLS_C);
                                char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);                        php_info_print("?=");
                                PUTS(elem_esc); 
                                efree(elem_esc); 
                        } 
                        PUTS("?="); 
                         logo_guid = php_logo_guid();                          logo_guid = php_logo_guid();
                        PUTS(logo_guid);                        php_info_print(logo_guid);
                         efree(logo_guid);                          efree(logo_guid);
                        PUTS("\" alt=\"PHP Logo\" /></a>");                        php_info_print("\" alt=\"PHP Logo\" /></a>");
                 }                  }
   
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        php_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION);                        php_info_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION);
                 } else {                  } else {
                         php_info_print_table_row(2, "PHP Version", PHP_VERSION);                          php_info_print_table_row(2, "PHP Version", PHP_VERSION);
                 }                         }       
Line 747  PHPAPI void php_print_info(int flag TSRMLS_DC) Line 747  PHPAPI void php_print_info(int flag TSRMLS_DC)
                 php_info_print_table_row(2, "Thread Safety", "disabled" );                  php_info_print_table_row(2, "Thread Safety", "disabled" );
 #endif  #endif
   
                php_info_print_table_row(2, "Zend Memory Manager", is_zend_mm(TSRMLS_C) ? "enabled" : "disabled" );#ifdef ZEND_SIGNALS
                php_info_print_table_row(2, "Zend Signal Handling", "enabled" );
#ifdef ZEND_MULTIBYTE 
                php_info_print_table_row(2, "Zend Multibyte Support", "enabled"); 
 #else  #else
                php_info_print_table_row(2, "Zend Multibyte Support", "disabled");                php_info_print_table_row(2, "Zend Signal Handling", "disabled" );
 #endif  #endif
   
#if HAVE_IPV6                php_info_print_table_row(2, "Zend Memory Manager", is_zend_mm(TSRMLS_C) ? "enabled" : "disabled" );
                php_info_print_table_row(2, "IPv6 Support", "enabled" ); 
#else 
                php_info_print_table_row(2, "IPv6 Support", "disabled" ); 
#endif 
                { 
                        HashTable *url_stream_wrappers_hash; 
                        char *stream_protocol, *stream_protocols_buf = NULL; 
                        int stream_protocol_len, stream_protocols_buf_len = 0; 
                        ulong num_key; 
   
                         if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {  
                                 HashPosition pos;  
                                 for (zend_hash_internal_pointer_reset_ex(url_stream_wrappers_hash, &pos);  
                                                 zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, (uint *)&stream_protocol_len, &num_key, 0, &pos) == HASH_KEY_IS_STRING;  
                                                 zend_hash_move_forward_ex(url_stream_wrappers_hash, &pos)) {  
                                         stream_protocols_buf = erealloc(stream_protocols_buf, stream_protocols_buf_len + stream_protocol_len + 2 + 1);  
                                         memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len - 1);  
                                         stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len - 1] = ',';  
                                         stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = ' ';  
                                         stream_protocols_buf_len += stream_protocol_len + 1;  
                                 }  
                                 if (stream_protocols_buf) {  
                                         stream_protocols_buf[stream_protocols_buf_len - 2] = ' ';  
                                         stream_protocols_buf[stream_protocols_buf_len] = 0;  
                                         php_info_print_table_row(2, "Registered PHP Streams", stream_protocols_buf);  
                                         efree(stream_protocols_buf);  
                                 } else {  
                                         /* Any chances we will ever hit this? */  
                                         php_info_print_table_row(2, "Registered PHP Streams", "no streams registered");  
                                 }  
                         } else {  
                                 /* Any chances we will ever hit this? */  
                                 php_info_print_table_row(2, "PHP Streams", "disabled"); /* ?? */  
                         }  
                 }  
   
                 {                  {
                        HashTable *stream_xport_hash;                        const zend_multibyte_functions *functions = zend_multibyte_get_functions(TSRMLS_C);
                        char *xport_name, *xport_buf = NULL;                        char *descr;
                        int xport_name_len, xport_buf_len = 0, xport_buf_size = 0;                        if (functions) {
                        ulong num_key;                                spprintf(&descr, 0, "provided by %s", functions->provider_name);
 
                        if ((stream_xport_hash = php_stream_xport_get_hash())) { 
                                HashPosition pos; 
                                for(zend_hash_internal_pointer_reset_ex(stream_xport_hash, &pos); 
                                        zend_hash_get_current_key_ex(stream_xport_hash, &xport_name, (uint *)&xport_name_len, &num_key, 0, &pos) == HASH_KEY_IS_STRING; 
                                        zend_hash_move_forward_ex(stream_xport_hash, &pos)) { 
                                        if (xport_buf_len + xport_name_len + 2 > xport_buf_size) { 
                                                while (xport_buf_len + xport_name_len + 2 > xport_buf_size) { 
                                                        xport_buf_size += 256; 
                                                } 
                                                if (xport_buf) { 
                                                        xport_buf = erealloc(xport_buf, xport_buf_size); 
                                                } else { 
                                                        xport_buf = emalloc(xport_buf_size); 
                                                } 
                                        } 
                                        if (xport_buf_len > 0) { 
                                                xport_buf[xport_buf_len++] = ','; 
                                                xport_buf[xport_buf_len++] = ' '; 
                                        } 
                                        memcpy(xport_buf + xport_buf_len, xport_name, xport_name_len - 1); 
                                        xport_buf_len += xport_name_len - 1; 
                                        xport_buf[xport_buf_len] = '\0'; 
                                } 
                                if (xport_buf) { 
                                        php_info_print_table_row(2, "Registered Stream Socket Transports", xport_buf); 
                                        efree(xport_buf); 
                                } else { 
                                        /* Any chances we will ever hit this? */ 
                                        php_info_print_table_row(2, "Registered Stream Socket Transports", "no transports registered"); 
                                } 
                         } else {                          } else {
                                /* Any chances we will ever hit this? */                                descr = estrdup("disabled");
                                php_info_print_table_row(2, "Stream Socket Transports", "disabled"); /* ?? */ 
                         }                          }
               php_info_print_table_row(2, "Zend Multibyte Support", descr);
                           efree(descr);
                 }                  }
   
                {#if HAVE_IPV6
                        HashTable *stream_filter_hash;                php_info_print_table_row(2, "IPv6 Support", "enabled" );
                        char *filter_name, *filter_buf = NULL;#else
                        int filter_name_len, filter_buf_len = 0, filter_buf_size = 0;                php_info_print_table_row(2, "IPv6 Support", "disabled" );
                        ulong num_key;#endif
   
                        if ((stream_filter_hash = php_get_stream_filters_hash())) {#if HAVE_DTRACE
                                HashPosition pos;                php_info_print_table_row(2, "DTrace Support", "enabled" );
                                for(zend_hash_internal_pointer_reset_ex(stream_filter_hash, &pos);#else
                                        zend_hash_get_current_key_ex(stream_filter_hash, &filter_name, (uint *)&filter_name_len, &num_key, 0, &pos) == HASH_KEY_IS_STRING;                php_info_print_table_row(2, "DTrace Support", "disabled" );
                                        zend_hash_move_forward_ex(stream_filter_hash, &pos)) {#endif
                                        if (filter_buf_len + filter_name_len + 2 > filter_buf_size) { 
                                                while (filter_buf_len + filter_name_len + 2 > filter_buf_size) { 
                                                        filter_buf_size += 256; 
                                                } 
                                                if (filter_buf) { 
                                                        filter_buf = erealloc(filter_buf, filter_buf_size); 
                                                } else { 
                                                        filter_buf = emalloc(filter_buf_size); 
                                                } 
                                        } 
                                        if (filter_buf_len > 0) { 
                                                filter_buf[filter_buf_len++] = ','; 
                                                filter_buf[filter_buf_len++] = ' '; 
                                        } 
                                        memcpy(filter_buf + filter_buf_len, filter_name, filter_name_len - 1); 
                                        filter_buf_len += filter_name_len - 1; 
                                        filter_buf[filter_buf_len] = '\0'; 
                                } 
                                if (filter_buf) { 
                                        php_info_print_table_row(2, "Registered Stream Filters", filter_buf); 
                                        efree(filter_buf); 
                                } else { 
                                        /* Any chances we will ever hit this? */ 
                                        php_info_print_table_row(2, "Registered Stream Filters", "no filters registered"); 
                                } 
                        } else { 
                                /* Any chances we will ever hit this? */ 
                                php_info_print_table_row(2, "Stream Filters", "disabled"); /* ?? */ 
                        } 
                } 
                                   
                   php_info_print_stream_hash("PHP Streams",  php_stream_get_url_stream_wrappers_hash() TSRMLS_CC);
                   php_info_print_stream_hash("Stream Socket Transports", php_stream_xport_get_hash() TSRMLS_CC);
                   php_info_print_stream_hash("Stream Filters", php_get_stream_filters_hash() TSRMLS_CC);
   
                 php_info_print_table_end();                  php_info_print_table_end();
   
                 /* Suhosin Patch */  
                 php_info_print_box_start(0);  
                 if (expose_php && !sapi_module.phpinfo_as_text) {  
                         PUTS("<a href=\"http://www.suhosin.org\"><img border=\"0\" src=\"");  
                         if (SG(request_info).request_uri) {  
                                 char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);  
                                 PUTS(elem_esc);  
                                 efree(elem_esc);  
                         }  
                         PUTS("?="SUHOSIN_LOGO_GUID"\" alt=\"Suhosin logo\" /></a>\n");  
                 }  
                 PUTS("This server is protected with the Suhosin Patch ");  
                 if (sapi_module.phpinfo_as_text) {  
                         PUTS(SUHOSIN_PATCH_VERSION);  
                 } else {  
                         zend_html_puts(SUHOSIN_PATCH_VERSION, strlen(SUHOSIN_PATCH_VERSION) TSRMLS_CC);  
                 }  
                 PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");  
                 if (sapi_module.phpinfo_as_text) {  
                         PUTS("Copyright (c) 2006-2007 Hardened-PHP Project\n");  
                         PUTS("Copyright (c) 2007-2012 SektionEins GmbH\n");  
                 } else {  
                         PUTS("Copyright (c) 2006-2007 <a href=\"http://www.hardened-php.net/\">Hardened-PHP Project</a>\n");  
                         PUTS("Copyright (c) 2007-2012 <a href=\"http://www.sektioneins.de/\">SektionEins GmbH</a>\n");  
                 }  
                 php_info_print_box_end();  
   
                 /* Zend Engine */                  /* Zend Engine */
                 php_info_print_box_start(0);                  php_info_print_box_start(0);
                 if (expose_php && !sapi_module.phpinfo_as_text) {                  if (expose_php && !sapi_module.phpinfo_as_text) {
                        PUTS("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");                        php_info_print("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");
                        if (SG(request_info).request_uri) {                        php_info_print_request_uri(TSRMLS_C);
                                char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);                        php_info_print("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n");
                                PUTS(elem_esc); 
                                efree(elem_esc); 
                        } 
                        PUTS("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n"); 
                 }                  }
                PUTS("This program makes use of the Zend Scripting Language Engine:");                php_info_print("This program makes use of the Zend Scripting Language Engine:");
                PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");                php_info_print(!sapi_module.phpinfo_as_text?"<br />":"\n");
                 if (sapi_module.phpinfo_as_text) {                  if (sapi_module.phpinfo_as_text) {
                        PUTS(zend_version);                        php_info_print(zend_version);
                 } else {                  } else {
                         zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC);                          zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC);
                 }                  }
Line 929  PHPAPI void php_print_info(int flag TSRMLS_DC) Line 805  PHPAPI void php_print_info(int flag TSRMLS_DC)
   
         if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) {            if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) {  
                 php_info_print_hr();                  php_info_print_hr();
                PUTS("<h1><a href=\"");                php_info_print("<h1><a href=\"");
                if (SG(request_info).request_uri) {                php_info_print_request_uri(TSRMLS_C);
                        char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);                php_info_print("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
                        PUTS(elem_esc);                php_info_print("PHP Credits");
                        efree(elem_esc);                php_info_print("</a></h1>\n");
                } 
                PUTS("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">"); 
                PUTS("PHP Credits"); 
                PUTS("</a></h1>\n"); 
         }          }
   
         zend_ini_sort_entries(TSRMLS_C);          zend_ini_sort_entries(TSRMLS_C);
Line 945  PHPAPI void php_print_info(int flag TSRMLS_DC) Line 817  PHPAPI void php_print_info(int flag TSRMLS_DC)
         if (flag & PHP_INFO_CONFIGURATION) {          if (flag & PHP_INFO_CONFIGURATION) {
                 php_info_print_hr();                  php_info_print_hr();
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        PUTS("<h1>Configuration</h1>\n");                        php_info_print("<h1>Configuration</h1>\n");
                 } else {                  } else {
                         SECTION("Configuration");                          SECTION("Configuration");
                 }                         }       
Line 1011  PHPAPI void php_print_info(int flag TSRMLS_DC) Line 883  PHPAPI void php_print_info(int flag TSRMLS_DC)
                 if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {                  if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
                         php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data));                          php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data));
                 }                  }
                php_print_gpcse_array("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC);                php_print_gpcse_array(ZEND_STRL("_REQUEST") TSRMLS_CC);
                php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC);                php_print_gpcse_array(ZEND_STRL("_GET") TSRMLS_CC);
                php_print_gpcse_array("_POST", sizeof("_POST")-1 TSRMLS_CC);                php_print_gpcse_array(ZEND_STRL("_POST") TSRMLS_CC);
                php_print_gpcse_array("_FILES", sizeof("_FILES")-1 TSRMLS_CC);                php_print_gpcse_array(ZEND_STRL("_FILES") TSRMLS_CC);
                php_print_gpcse_array("_COOKIE", sizeof("_COOKIE")-1 TSRMLS_CC);                php_print_gpcse_array(ZEND_STRL("_COOKIE") TSRMLS_CC);
                php_print_gpcse_array("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);                php_print_gpcse_array(ZEND_STRL("_SERVER") TSRMLS_CC);
                php_print_gpcse_array("_ENV", sizeof("_ENV")-1 TSRMLS_CC);                php_print_gpcse_array(ZEND_STRL("_ENV") TSRMLS_CC);
                 php_info_print_table_end();                  php_info_print_table_end();
         }          }
   
Line 1025  PHPAPI void php_print_info(int flag TSRMLS_DC) Line 897  PHPAPI void php_print_info(int flag TSRMLS_DC)
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                         SECTION("PHP License");                          SECTION("PHP License");
                         php_info_print_box_start(0);                          php_info_print_box_start(0);
                        PUTS("<p>\n");                        php_info_print("<p>\n");
                        PUTS("This program is free software; you can redistribute it and/or modify ");                        php_info_print("This program is free software; you can redistribute it and/or modify ");
                        PUTS("it under the terms of the PHP License as published by the PHP Group ");                        php_info_print("it under the terms of the PHP License as published by the PHP Group ");
                        PUTS("and included in the distribution in the file:  LICENSE\n");                        php_info_print("and included in the distribution in the file:  LICENSE\n");
                        PUTS("</p>\n");                        php_info_print("</p>\n");
                        PUTS("<p>");                        php_info_print("<p>");
                        PUTS("This program is distributed in the hope that it will be useful, ");                        php_info_print("This program is distributed in the hope that it will be useful, ");
                        PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of ");                        php_info_print("but WITHOUT ANY WARRANTY; without even the implied warranty of ");
                        PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");                        php_info_print("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
                        PUTS("</p>\n");                        php_info_print("</p>\n");
                        PUTS("<p>");                        php_info_print("<p>");
                        PUTS("If you did not receive a copy of the PHP license, or have any questions about ");                        php_info_print("If you did not receive a copy of the PHP license, or have any questions about ");
                        PUTS("PHP licensing, please contact license@php.net.\n");                        php_info_print("PHP licensing, please contact license@php.net.\n");
                        PUTS("</p>\n");                        php_info_print("</p>\n");
                         php_info_print_box_end();                          php_info_print_box_end();
                 } else {                  } else {
                        PUTS("\nPHP License\n");                        php_info_print("\nPHP License\n");
                        PUTS("This program is free software; you can redistribute it and/or modify\n");                        php_info_print("This program is free software; you can redistribute it and/or modify\n");
                        PUTS("it under the terms of the PHP License as published by the PHP Group\n");                        php_info_print("it under the terms of the PHP License as published by the PHP Group\n");
                        PUTS("and included in the distribution in the file:  LICENSE\n");                        php_info_print("and included in the distribution in the file:  LICENSE\n");
                        PUTS("\n");                        php_info_print("\n");
                        PUTS("This program is distributed in the hope that it will be useful,\n");                        php_info_print("This program is distributed in the hope that it will be useful,\n");
                        PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");                        php_info_print("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
                        PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");                        php_info_print("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
                        PUTS("\n");                        php_info_print("\n");
                        PUTS("If you did not receive a copy of the PHP license, or have any\n");                        php_info_print("If you did not receive a copy of the PHP license, or have any\n");
                        PUTS("questions about PHP licensing, please contact license@php.net.\n");                        php_info_print("questions about PHP licensing, please contact license@php.net.\n");
                 }                  }
         }          }
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                PUTS("</div></body></html>");                php_info_print("</div></body></html>");
         }                 }       
 }  }
 /* }}} */  /* }}} */
   
PHPAPI void php_info_print_table_start(void) /* {{{ */
PHPAPI void php_info_print_table_start(void) 
 {  {
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n");                php_info_print("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n");
         } else {          } else {
                php_printf("\n");                php_info_print("\n");
         }                 }       
 }  }
   /* }}} */
   
PHPAPI void php_info_print_table_end(void)PHPAPI void php_info_print_table_end(void) /* {{{ */
 {  {
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("</table><br />\n");                php_info_print("</table><br />\n");
         }          }
   
 }  }
   /* }}} */
   
PHPAPI void php_info_print_box_start(int flag)PHPAPI void php_info_print_box_start(int flag) /* {{{ */
 {  {
         php_info_print_table_start();          php_info_print_table_start();
         if (flag) {          if (flag) {
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        php_printf("<tr class=\"h\"><td>\n");                        php_info_print("<tr class=\"h\"><td>\n");
                 }                  }
         } else {          } else {
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        php_printf("<tr class=\"v\"><td>\n");                        php_info_print("<tr class=\"v\"><td>\n");
                 } else {                  } else {
                        php_printf("\n");                        php_info_print("\n");
                 }                         }       
         }          }
 }  }
   /* }}} */
   
PHPAPI void php_info_print_box_end(void)PHPAPI void php_info_print_box_end(void) /* {{{ */
 {  {
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("</td></tr>\n");                php_info_print("</td></tr>\n");
         }          }
         php_info_print_table_end();          php_info_print_table_end();
 }  }
   /* }}} */
   
PHPAPI void php_info_print_hr(void)PHPAPI void php_info_print_hr(void) /* {{{ */
 {  {
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("<hr />\n");                php_info_print("<hr />\n");
         } else {          } else {
                php_printf("\n\n _______________________________________________________________________\n\n");                php_info_print("\n\n _______________________________________________________________________\n\n");
         }          }
 }  }
   /* }}} */
   
PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header)PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) /* {{{ */
 {  {
         int spaces;          int spaces;
   
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header );                php_info_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header );
         } else {          } else {
                 spaces = (74 - strlen(header));                  spaces = (74 - strlen(header));
                php_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " ");                php_info_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " ");
         }                 }       
 }  }
   /* }}} */
   
 /* {{{ php_info_print_table_header  /* {{{ php_info_print_table_header
  */   */
Line 1131  PHPAPI void php_info_print_table_header(int num_cols,  Line 1008  PHPAPI void php_info_print_table_header(int num_cols, 
         va_list row_elements;          va_list row_elements;
         char *row_element;          char *row_element;
   
         TSRMLS_FETCH();  
   
         va_start(row_elements, num_cols);          va_start(row_elements, num_cols);
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("<tr class=\"h\">");                php_info_print("<tr class=\"h\">");
         }                 }       
         for (i=0; i<num_cols; i++) {          for (i=0; i<num_cols; i++) {
                 row_element = va_arg(row_elements, char *);                  row_element = va_arg(row_elements, char *);
Line 1143  PHPAPI void php_info_print_table_header(int num_cols,  Line 1018  PHPAPI void php_info_print_table_header(int num_cols, 
                         row_element = " ";                          row_element = " ";
                 }                  }
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        PUTS("<th>");                        php_info_print("<th>");
                        PUTS(row_element);                        php_info_print(row_element);
                        PUTS("</th>");                        php_info_print("</th>");
                 } else {                  } else {
                        PUTS(row_element);                        php_info_print(row_element);
                         if (i < num_cols-1) {                          if (i < num_cols-1) {
                                PUTS(" => ");                                php_info_print(" => ");
                         } else {                          } else {
                                PUTS("\n");                                php_info_print("\n");
                        }                               }
                }                       }
         }          }
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("</tr>\n");                php_info_print("</tr>\n");
        }               }
   
         va_end(row_elements);          va_end(row_elements);
 }  }
Line 1170  static void php_info_print_table_row_internal(int num_ Line 1045  static void php_info_print_table_row_internal(int num_
 {  {
         int i;          int i;
         char *row_element;          char *row_element;
         char *elem_esc = NULL;  
 /*  
         int elem_esc_len;  
 */  
   
         TSRMLS_FETCH();  
   
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("<tr>");                php_info_print("<tr>");
         }                 }       
         for (i=0; i<num_cols; i++) {          for (i=0; i<num_cols; i++) {
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        php_printf("<td class=\"%s\">",                        php_info_printf("<td class=\"%s\">",
                            (i==0 ? "e" : value_class )                             (i==0 ? "e" : value_class )
                         );                          );
                 }                         }       
                 row_element = va_arg(row_elements, char *);                  row_element = va_arg(row_elements, char *);
                 if (!row_element || !*row_element) {                  if (!row_element || !*row_element) {
                         if (!sapi_module.phpinfo_as_text) {                          if (!sapi_module.phpinfo_as_text) {
                                PUTS( "<i>no value</i>" );                                php_info_print( "<i>no value</i>" );
                         } else {                          } else {
                                PUTS( " " );                                php_info_print( " " );
                         }                          }
                 } else {                  } else {
                         if (!sapi_module.phpinfo_as_text) {                          if (!sapi_module.phpinfo_as_text) {
                                elem_esc = php_info_html_esc(row_element TSRMLS_CC);                                php_info_print_html_esc(row_element, strlen(row_element));
                                PUTS(elem_esc); 
                                efree(elem_esc); 
                         } else {                          } else {
                                PUTS(row_element);                                php_info_print(row_element);
                                 if (i < num_cols-1) {                                  if (i < num_cols-1) {
                                        PUTS(" => ");                                        php_info_print(" => ");
                                 }                                         }       
                         }                          }
                 }                  }
                 if (!sapi_module.phpinfo_as_text) {                  if (!sapi_module.phpinfo_as_text) {
                        php_printf(" </td>");                        php_info_print(" </td>");
                 } else if (i == (num_cols - 1)) {                  } else if (i == (num_cols - 1)) {
                        PUTS("\n");                        php_info_print("\n");
                 }                  }
         }          }
         if (!sapi_module.phpinfo_as_text) {          if (!sapi_module.phpinfo_as_text) {
                php_printf("</tr>\n");                php_info_print("</tr>\n");
         }          }
 }  }
 /* }}} */  /* }}} */
Line 1276  PHP_FUNCTION(phpinfo) Line 1143  PHP_FUNCTION(phpinfo)
         }          }
   
         /* Andale!  Andale!  Yee-Hah! */          /* Andale!  Andale!  Yee-Hah! */
        php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC);        php_output_start_default(TSRMLS_C);
         php_print_info(flag TSRMLS_CC);          php_print_info(flag TSRMLS_CC);
        php_end_ob_buffer(1, 0 TSRMLS_CC);        php_output_end(TSRMLS_C);
   
         RETURN_TRUE;          RETURN_TRUE;
 }  }
Line 1289  PHP_FUNCTION(phpinfo) Line 1156  PHP_FUNCTION(phpinfo)
    Return the current PHP version */     Return the current PHP version */
 PHP_FUNCTION(phpversion)  PHP_FUNCTION(phpversion)
 {  {
        zval **arg;        char *ext_name = NULL;
        const char *version;        int ext_name_len = 0;
        int argc = ZEND_NUM_ARGS(); 
   
        if (argc == 0) {        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ext_name, &ext_name_len) == FAILURE) {
                 return;
         }
 
         if (!ext_name) {
                 RETURN_STRING(PHP_VERSION, 1);                  RETURN_STRING(PHP_VERSION, 1);
         } else {          } else {
                if (zend_parse_parameters(argc TSRMLS_CC, "Z", &arg) == FAILURE) {                const char *version;
                        return;                version = zend_get_module_version(ext_name);
                } 
                         
                convert_to_string_ex(arg); 
                version = zend_get_module_version(Z_STRVAL_PP(arg)); 
                 
                 if (version == NULL) {                  if (version == NULL) {
                         RETURN_FALSE;                          RETURN_FALSE;
                 }                  }
Line 1326  PHP_FUNCTION(phpcredits) Line 1191  PHP_FUNCTION(phpcredits)
 }  }
 /* }}} */  /* }}} */
   
   
 /* {{{ php_logo_guid  /* {{{ php_logo_guid
  */   */
 PHPAPI char *php_logo_guid(void)  PHPAPI char *php_logo_guid(void)
Line 1354  PHPAPI char *php_logo_guid(void) Line 1218  PHPAPI char *php_logo_guid(void)
    Return the special ID used to request the PHP logo in phpinfo screens*/     Return the special ID used to request the PHP logo in phpinfo screens*/
 PHP_FUNCTION(php_logo_guid)  PHP_FUNCTION(php_logo_guid)
 {  {
   
         if (zend_parse_parameters_none() == FAILURE) {          if (zend_parse_parameters_none() == FAILURE) {
                 return;                  return;
         }          }
Line 1367  PHP_FUNCTION(php_logo_guid) Line 1230  PHP_FUNCTION(php_logo_guid)
    Return the special ID used to request the PHP logo in phpinfo screens*/     Return the special ID used to request the PHP logo in phpinfo screens*/
 PHP_FUNCTION(php_real_logo_guid)  PHP_FUNCTION(php_real_logo_guid)
 {  {
   
         if (zend_parse_parameters_none() == FAILURE) {          if (zend_parse_parameters_none() == FAILURE) {
                 return;                  return;
         }          }
Line 1423  PHP_FUNCTION(php_uname) Line 1285  PHP_FUNCTION(php_uname)
 {  {
         char *mode = "a";          char *mode = "a";
         int modelen = sizeof("a")-1;          int modelen = sizeof("a")-1;
   
         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) {          if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) {
                 return;                  return;
         }          }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>