1999-04-17 08:37:12 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2004-01-08 16:18:22 +08:00
|
|
|
| PHP Version 5 |
|
1999-04-17 08:37:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 21:10:10 +08:00
|
|
|
| Copyright (c) 1997-2006 The PHP Group |
|
1999-04-17 08:37:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 21:10:10 +08:00
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
1999-07-16 21:13:16 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
2006-01-01 21:10:10 +08:00
|
|
|
| http://www.php.net/license/3_01.txt |
|
1999-07-16 21:13:16 +08: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. |
|
1999-04-17 08:37:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2002-02-28 16:29:35 +08:00
|
|
|
| Authors: Rasmus Lerdorf <rasmus@php.net> |
|
1999-04-17 08:37:12 +08:00
|
|
|
| Zeev Suraski <zeev@zend.com> |
|
2002-09-20 05:57:25 +08:00
|
|
|
| Colin Viebrock <colin@easydns.com> |
|
1999-04-17 08:37:12 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2000-07-24 09:40:02 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
1999-04-24 04:06:01 +08:00
|
|
|
|
1999-04-17 08:37:12 +08:00
|
|
|
#include "php.h"
|
|
|
|
#include "php_ini.h"
|
|
|
|
#include "php_globals.h"
|
1999-04-22 08:25:57 +08:00
|
|
|
#include "ext/standard/head.h"
|
2002-09-27 03:33:23 +08:00
|
|
|
#include "ext/standard/html.h"
|
1999-04-17 08:37:12 +08:00
|
|
|
#include "info.h"
|
2000-11-20 18:05:57 +08:00
|
|
|
#include "credits.h"
|
2002-09-20 05:57:25 +08:00
|
|
|
#include "css.h"
|
1999-04-27 01:26:37 +08:00
|
|
|
#include "SAPI.h"
|
2000-04-20 07:17:02 +08:00
|
|
|
#include <time.h>
|
2002-03-05 04:14:52 +08:00
|
|
|
#include "php_main.h"
|
1999-04-17 08:37:12 +08:00
|
|
|
#include "zend_globals.h" /* needs ELS */
|
2002-05-02 20:33:03 +08:00
|
|
|
#include "zend_extensions.h"
|
2003-02-03 02:50:42 +08:00
|
|
|
#include "zend_highlight.h"
|
2002-03-29 18:19:23 +08:00
|
|
|
#ifdef HAVE_SYS_UTSNAME_H
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
#endif
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2002-08-24 09:19:28 +08:00
|
|
|
#if HAVE_MBSTRING
|
|
|
|
#include "ext/mbstring/mbstring.h"
|
|
|
|
ZEND_EXTERN_MODULE_GLOBALS(mbstring)
|
|
|
|
#endif
|
|
|
|
|
2002-08-06 03:00:09 +08:00
|
|
|
#if HAVE_ICONV
|
|
|
|
#include "ext/iconv/php_iconv.h"
|
|
|
|
ZEND_EXTERN_MODULE_GLOBALS(iconv)
|
|
|
|
#endif
|
|
|
|
|
2005-08-12 07:36:07 +08:00
|
|
|
#include <unicode/uversion.h>
|
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
#define SECTION(name) if (!sapi_module.phpinfo_as_text) { \
|
2002-09-27 01:54:54 +08:00
|
|
|
PUTS("<h2>" name "</h2>\n"); \
|
2002-08-29 06:31:51 +08:00
|
|
|
} else { \
|
|
|
|
php_info_print_table_start(); \
|
|
|
|
php_info_print_table_header(1, name); \
|
|
|
|
php_info_print_table_end(); \
|
|
|
|
} \
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2001-01-03 06:49:31 +08:00
|
|
|
PHPAPI extern char *php_ini_opened_path;
|
2002-10-04 12:47:35 +08:00
|
|
|
PHPAPI extern char *php_ini_scanned_files;
|
1999-05-09 16:48:05 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ _display_module_info
|
|
|
|
*/
|
2001-07-31 12:53:54 +08:00
|
|
|
static int _display_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
|
1999-04-17 08:37:12 +08:00
|
|
|
{
|
1999-08-08 01:52:11 +08:00
|
|
|
int show_info_func = *((int *) arg);
|
|
|
|
|
|
|
|
if (show_info_func && module->info_func) {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", module->name, module->name);
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
php_info_print_table_start();
|
|
|
|
php_info_print_table_header(1, module->name);
|
|
|
|
php_info_print_table_end();
|
|
|
|
}
|
2001-07-30 14:18:13 +08:00
|
|
|
module->info_func(module TSRMLS_CC);
|
1999-08-08 01:52:11 +08:00
|
|
|
} else if (!show_info_func && !module->info_func) {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-20 05:57:25 +08:00
|
|
|
php_printf("<tr>");
|
2002-08-29 06:31:51 +08:00
|
|
|
php_printf("<td>");
|
|
|
|
php_printf("%s", module->name);
|
|
|
|
php_printf("</td></tr>\n");
|
|
|
|
} else {
|
2003-09-22 12:18:24 +08:00
|
|
|
php_printf("%s", module->name);
|
2002-08-29 07:19:59 +08:00
|
|
|
php_printf("\n");
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_print_gpcse_array
|
|
|
|
*/
|
2001-07-27 18:16:41 +08:00
|
|
|
static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
|
2000-02-06 06:58:59 +08:00
|
|
|
{
|
2001-03-04 23:49:38 +08:00
|
|
|
zval **data, **tmp, tmp2;
|
2006-02-22 04:12:43 +08:00
|
|
|
zstr string_key;
|
2002-05-12 22:48:22 +08:00
|
|
|
uint string_len;
|
2000-02-06 06:58:59 +08:00
|
|
|
ulong num_key;
|
2002-10-12 11:11:28 +08:00
|
|
|
char *elem_esc = NULL;
|
2000-02-06 06:58:59 +08:00
|
|
|
|
2003-03-02 21:35:01 +08:00
|
|
|
zend_is_auto_global(name, name_length TSRMLS_CC);
|
|
|
|
|
2000-02-06 06:58:59 +08:00
|
|
|
if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE
|
2001-09-26 05:58:48 +08:00
|
|
|
&& (Z_TYPE_PP(data)==IS_ARRAY)) {
|
|
|
|
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data));
|
|
|
|
while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-20 05:57:25 +08:00
|
|
|
PUTS("<tr>");
|
2002-09-27 01:54:54 +08:00
|
|
|
PUTS("<td class=\"e\">");
|
2002-08-29 06:31:51 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-02-06 06:58:59 +08:00
|
|
|
PUTS(name);
|
2002-08-09 04:19:33 +08:00
|
|
|
PUTS("[\"");
|
2002-08-29 06:31:51 +08:00
|
|
|
|
2002-05-12 22:48:22 +08:00
|
|
|
switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) {
|
2000-02-06 06:58:59 +08:00
|
|
|
case HASH_KEY_IS_STRING:
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2006-02-22 04:12:43 +08:00
|
|
|
elem_esc = php_info_html_esc(string_key.s TSRMLS_CC);
|
2002-10-12 11:11:28 +08:00
|
|
|
PUTS(elem_esc);
|
|
|
|
efree(elem_esc);
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
2006-02-22 04:12:43 +08:00
|
|
|
PUTS(string_key.s);
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
2000-02-06 06:58:59 +08:00
|
|
|
break;
|
|
|
|
case HASH_KEY_IS_LONG:
|
2001-08-12 01:03:37 +08:00
|
|
|
php_printf("%ld", num_key);
|
2000-02-06 06:58:59 +08:00
|
|
|
break;
|
|
|
|
}
|
2002-08-29 06:31:51 +08:00
|
|
|
PUTS("\"]");
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
PUTS("</td><td class=\"v\">");
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
PUTS(" => ");
|
|
|
|
}
|
2001-09-26 05:58:48 +08:00
|
|
|
if (Z_TYPE_PP(tmp) == IS_ARRAY) {
|
2005-08-16 00:01:43 +08:00
|
|
|
zval *tmp3;
|
|
|
|
|
|
|
|
MAKE_STD_ZVAL(tmp3);
|
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-08-29 06:31:51 +08:00
|
|
|
PUTS("<pre>");
|
|
|
|
}
|
2005-08-16 07:24:47 +08:00
|
|
|
php_start_ob_buffer(NULL, 4096, 1 TSRMLS_CC);
|
2005-08-16 00:01:43 +08:00
|
|
|
|
2003-01-12 22:47:18 +08:00
|
|
|
zend_print_zval_r(*tmp, 0 TSRMLS_CC);
|
2005-08-16 00:01:43 +08:00
|
|
|
|
|
|
|
php_ob_get_buffer(tmp3 TSRMLS_CC);
|
|
|
|
php_end_ob_buffer(0, 0 TSRMLS_CC);
|
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2005-08-28 09:02:54 +08:00
|
|
|
elem_esc = php_info_html_esc(Z_STRVAL_P(tmp3) TSRMLS_CC);
|
|
|
|
PUTS(elem_esc);
|
|
|
|
efree(elem_esc);
|
2002-08-29 06:31:51 +08:00
|
|
|
PUTS("</pre>");
|
2005-08-28 09:02:54 +08:00
|
|
|
} else {
|
|
|
|
PUTS(Z_STRVAL_P(tmp3));
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
2005-08-28 09:02:54 +08:00
|
|
|
zval_ptr_dtor(&tmp3);
|
|
|
|
|
2001-09-26 05:58:48 +08:00
|
|
|
} else if (Z_TYPE_PP(tmp) != IS_STRING) {
|
2001-03-04 23:49:38 +08:00
|
|
|
tmp2 = **tmp;
|
|
|
|
zval_copy_ctor(&tmp2);
|
|
|
|
convert_to_string(&tmp2);
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
if (Z_STRLEN(tmp2) == 0) {
|
|
|
|
PUTS("<i>no value</i>");
|
|
|
|
} else {
|
2002-10-12 11:11:28 +08:00
|
|
|
elem_esc = php_info_html_esc(Z_STRVAL(tmp2) TSRMLS_CC);
|
|
|
|
PUTS(elem_esc);
|
|
|
|
efree(elem_esc);
|
2002-09-27 01:54:54 +08:00
|
|
|
}
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
PUTS(Z_STRVAL(tmp2));
|
|
|
|
}
|
2001-03-04 23:49:38 +08:00
|
|
|
zval_dtor(&tmp2);
|
2000-02-06 06:58:59 +08:00
|
|
|
} else {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
if (Z_STRLEN_PP(tmp) == 0) {
|
|
|
|
PUTS("<i>no value</i>");
|
|
|
|
} else {
|
2002-10-12 11:11:28 +08:00
|
|
|
elem_esc = php_info_html_esc(Z_STRVAL_PP(tmp) TSRMLS_CC);
|
|
|
|
PUTS(elem_esc);
|
|
|
|
efree(elem_esc);
|
2002-09-27 01:54:54 +08:00
|
|
|
}
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
PUTS(Z_STRVAL_PP(tmp));
|
|
|
|
}
|
2000-02-06 06:58:59 +08:00
|
|
|
}
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-20 05:57:25 +08:00
|
|
|
PUTS("</td></tr>\n");
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
PUTS("\n");
|
|
|
|
}
|
2001-09-26 05:58:48 +08:00
|
|
|
zend_hash_move_forward(Z_ARRVAL_PP(data));
|
2000-02-06 06:58:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
2000-02-06 06:58:59 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_info_print_style
|
|
|
|
*/
|
2003-03-25 16:07:13 +08:00
|
|
|
void php_info_print_style(TSRMLS_D)
|
2000-04-06 04:17:02 +08:00
|
|
|
{
|
2005-11-23 08:15:26 +08:00
|
|
|
php_printf("<style type=\"text/css\">\n");
|
2003-03-25 16:07:13 +08:00
|
|
|
php_info_print_css(TSRMLS_C);
|
2005-11-23 08:15:26 +08:00
|
|
|
php_printf("</style>\n");
|
2000-04-06 04:17:02 +08:00
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
2000-04-06 04:17:02 +08:00
|
|
|
|
2002-09-27 03:33:23 +08:00
|
|
|
|
|
|
|
/* {{{ php_info_html_esc
|
|
|
|
*/
|
2002-09-27 03:48:56 +08:00
|
|
|
PHPAPI char *php_info_html_esc(char *string TSRMLS_DC)
|
2002-09-27 03:33:23 +08:00
|
|
|
{
|
|
|
|
int new_len;
|
2005-08-16 08:25:21 +08:00
|
|
|
return php_escape_html_entities(string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
|
2002-09-27 03:33:23 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_get_uname
|
|
|
|
*/
|
2002-03-29 18:19:23 +08:00
|
|
|
PHPAPI char *php_get_uname(char mode)
|
1999-04-17 08:37:12 +08:00
|
|
|
{
|
1999-12-18 12:01:20 +08:00
|
|
|
char *php_uname;
|
2002-03-29 18:19:23 +08:00
|
|
|
char tmp_uname[256];
|
2000-02-11 23:59:30 +08:00
|
|
|
#ifdef PHP_WIN32
|
1999-04-17 08:37:12 +08:00
|
|
|
DWORD dwBuild=0;
|
|
|
|
DWORD dwVersion = GetVersion();
|
|
|
|
DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
|
|
|
DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
|
2003-01-28 13:02:12 +08:00
|
|
|
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
|
|
|
|
char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
|
|
|
SYSTEM_INFO SysInfo;
|
|
|
|
|
|
|
|
GetComputerName(ComputerName, &dwSize);
|
|
|
|
GetSystemInfo(&SysInfo);
|
2000-08-28 03:42:45 +08:00
|
|
|
|
2002-09-11 22:21:39 +08:00
|
|
|
if (mode == 's') {
|
|
|
|
if (dwVersion < 0x80000000) {
|
|
|
|
php_uname = "Windows NT";
|
|
|
|
} else {
|
|
|
|
php_uname = "Windows 9x";
|
|
|
|
}
|
|
|
|
} else if (mode == 'r') {
|
|
|
|
snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion);
|
|
|
|
php_uname = tmp_uname;
|
|
|
|
} else if (mode == 'n') {
|
2003-01-28 13:02:12 +08:00
|
|
|
php_uname = ComputerName;
|
2002-09-11 22:21:39 +08:00
|
|
|
} else if (mode == 'v') {
|
|
|
|
dwBuild = (DWORD)(HIWORD(dwVersion));
|
|
|
|
snprintf(tmp_uname, sizeof(tmp_uname), "build %d", dwBuild);
|
|
|
|
php_uname = tmp_uname;
|
|
|
|
} else if (mode == 'm') {
|
2003-01-28 13:02:12 +08:00
|
|
|
switch (SysInfo.wProcessorArchitecture) {
|
|
|
|
case PROCESSOR_ARCHITECTURE_INTEL :
|
|
|
|
snprintf(tmp_uname, sizeof(tmp_uname), "i%d", SysInfo.dwProcessorType);
|
|
|
|
php_uname = tmp_uname;
|
|
|
|
break;
|
|
|
|
case PROCESSOR_ARCHITECTURE_MIPS :
|
|
|
|
php_uname = "MIPS R4000";
|
|
|
|
php_uname = tmp_uname;
|
|
|
|
break;
|
|
|
|
case PROCESSOR_ARCHITECTURE_ALPHA :
|
|
|
|
snprintf(tmp_uname, sizeof(tmp_uname), "Alpha %d", SysInfo.wProcessorLevel);
|
|
|
|
php_uname = tmp_uname;
|
|
|
|
break;
|
|
|
|
case PROCESSOR_ARCHITECTURE_PPC :
|
|
|
|
snprintf(tmp_uname, sizeof(tmp_uname), "PPC 6%02d", SysInfo.wProcessorLevel);
|
|
|
|
php_uname = tmp_uname;
|
|
|
|
break;
|
|
|
|
case PROCESSOR_ARCHITECTURE_IA64 :
|
|
|
|
php_uname = "IA64";
|
|
|
|
break;
|
|
|
|
#if defined(PROCESSOR_ARCHITECTURE_IA32_ON_WIN64)
|
|
|
|
case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 :
|
|
|
|
php_uname = "IA32";
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if defined(PROCESSOR_ARCHITECTURE_AMD64)
|
|
|
|
case PROCESSOR_ARCHITECTURE_AMD64 :
|
|
|
|
php_uname = "AMD64";
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case PROCESSOR_ARCHITECTURE_UNKNOWN :
|
|
|
|
default :
|
|
|
|
php_uname = "Unknown";
|
|
|
|
break;
|
|
|
|
}
|
2002-09-11 22:21:39 +08:00
|
|
|
} else { /* assume mode == 'a' */
|
|
|
|
/* Get build numbers for Windows NT or Win95 */
|
|
|
|
if (dwVersion < 0x80000000){
|
|
|
|
dwBuild = (DWORD)(HIWORD(dwVersion));
|
|
|
|
snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d",
|
2003-01-28 13:02:12 +08:00
|
|
|
"Windows NT", ComputerName,
|
2002-09-11 22:21:39 +08:00
|
|
|
dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild);
|
|
|
|
} else {
|
|
|
|
snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d",
|
2003-01-28 13:02:12 +08:00
|
|
|
"Windows 9x", ComputerName,
|
2002-09-11 22:21:39 +08:00
|
|
|
dwWindowsMajorVersion, dwWindowsMinorVersion);
|
|
|
|
}
|
|
|
|
php_uname = tmp_uname;
|
|
|
|
}
|
2002-03-29 18:19:23 +08:00
|
|
|
#else
|
|
|
|
#ifdef HAVE_SYS_UTSNAME_H
|
2002-09-11 22:21:39 +08:00
|
|
|
struct utsname buf;
|
|
|
|
if (uname((struct utsname *)&buf) == -1) {
|
|
|
|
php_uname = PHP_UNAME;
|
|
|
|
} else {
|
|
|
|
if (mode == 's') {
|
|
|
|
php_uname = buf.sysname;
|
|
|
|
} else if (mode == 'r') {
|
|
|
|
php_uname = buf.release;
|
|
|
|
} else if (mode == 'n') {
|
|
|
|
php_uname = buf.nodename;
|
|
|
|
} else if (mode == 'v') {
|
|
|
|
php_uname = buf.version;
|
|
|
|
} else if (mode == 'm') {
|
|
|
|
php_uname = buf.machine;
|
|
|
|
} else { /* assume mode == 'a' */
|
|
|
|
snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %s %s %s",
|
|
|
|
buf.sysname, buf.nodename, buf.release, buf.version,
|
|
|
|
buf.machine);
|
|
|
|
php_uname = tmp_uname;
|
|
|
|
}
|
|
|
|
}
|
2000-08-28 03:42:45 +08:00
|
|
|
#else
|
2002-09-11 22:21:39 +08:00
|
|
|
php_uname = PHP_UNAME;
|
2002-03-29 18:19:23 +08:00
|
|
|
#endif
|
1999-04-17 08:37:12 +08:00
|
|
|
#endif
|
2000-08-28 03:42:45 +08:00
|
|
|
return estrdup(php_uname);
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
2000-08-28 03:42:45 +08:00
|
|
|
|
2002-09-27 03:33:23 +08:00
|
|
|
|
|
|
|
/* {{{ php_print_info_htmlhead
|
2001-06-06 21:06:12 +08:00
|
|
|
*/
|
2002-09-27 03:48:56 +08:00
|
|
|
PHPAPI void php_print_info_htmlhead(TSRMLS_D)
|
2000-08-28 03:42:45 +08:00
|
|
|
{
|
2002-10-09 22:39:39 +08:00
|
|
|
|
|
|
|
/*** none of this is needed now ***
|
|
|
|
|
2002-08-06 03:00:09 +08:00
|
|
|
const char *charset = NULL;
|
|
|
|
|
2002-09-27 03:33:23 +08:00
|
|
|
if (SG(default_charset)) {
|
|
|
|
charset = SG(default_charset);
|
|
|
|
}
|
1999-08-08 02:21:35 +08:00
|
|
|
|
2002-08-24 09:19:28 +08:00
|
|
|
#if HAVE_MBSTRING
|
2002-09-27 03:33:23 +08:00
|
|
|
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));
|
2002-08-24 09:19:28 +08:00
|
|
|
}
|
2002-09-27 03:33:23 +08:00
|
|
|
}
|
2002-08-29 06:31:51 +08:00
|
|
|
#endif
|
2002-09-27 03:33:23 +08:00
|
|
|
|
2002-08-06 03:00:09 +08:00
|
|
|
#if HAVE_ICONV
|
|
|
|
if (php_ob_handler_used("ob_iconv_handler" TSRMLS_CC)) {
|
|
|
|
charset = ICONVG(output_encoding);
|
|
|
|
}
|
|
|
|
#endif
|
2002-09-27 03:33:23 +08:00
|
|
|
|
2002-08-05 06:49:48 +08:00
|
|
|
if (!charset || !charset[0]) {
|
|
|
|
charset = "US-ASCII";
|
|
|
|
}
|
2000-06-09 09:50:44 +08:00
|
|
|
|
2002-10-09 22:39:39 +08:00
|
|
|
*** none of that is needed now ***/
|
|
|
|
|
|
|
|
|
2002-09-27 03:33:23 +08:00
|
|
|
PUTS("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n");
|
|
|
|
PUTS("<html>");
|
|
|
|
PUTS("<head>\n");
|
2003-03-25 16:07:13 +08:00
|
|
|
php_info_print_style(TSRMLS_C);
|
2002-09-27 03:33:23 +08:00
|
|
|
PUTS("<title>phpinfo()</title>");
|
2002-10-09 22:39:39 +08:00
|
|
|
/*
|
2002-09-27 03:33:23 +08:00
|
|
|
php_printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />\n", charset);
|
2002-10-09 22:39:39 +08:00
|
|
|
*/
|
2002-09-27 03:33:23 +08:00
|
|
|
PUTS("</head>\n");
|
2002-10-10 12:28:15 +08:00
|
|
|
PUTS("<body><div class=\"center\">\n");
|
2002-09-27 03:33:23 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
2002-11-15 05:15:42 +08:00
|
|
|
/* {{{ module_name_cmp */
|
|
|
|
static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
|
|
|
|
{
|
|
|
|
Bucket *f = *((Bucket **) a);
|
|
|
|
Bucket *s = *((Bucket **) b);
|
|
|
|
|
2004-05-02 21:23:30 +08:00
|
|
|
return strcasecmp(((zend_module_entry *)f->pData)->name,
|
2002-11-15 05:15:42 +08:00
|
|
|
((zend_module_entry *)s->pData)->name);
|
|
|
|
}
|
|
|
|
/* }}} */
|
2002-09-27 03:33:23 +08:00
|
|
|
|
|
|
|
/* {{{ php_print_info
|
|
|
|
*/
|
|
|
|
PHPAPI void php_print_info(int flag TSRMLS_DC)
|
|
|
|
{
|
|
|
|
char **env, *tmp1, *tmp2;
|
|
|
|
char *php_uname;
|
|
|
|
int expose_php = INI_INT("expose_php");
|
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 03:48:56 +08:00
|
|
|
php_print_info_htmlhead(TSRMLS_C);
|
2002-08-29 17:11:22 +08:00
|
|
|
} else {
|
2002-09-27 18:17:52 +08:00
|
|
|
PUTS("phpinfo()\n");
|
2002-08-29 17:11:22 +08:00
|
|
|
}
|
2002-08-29 06:31:51 +08:00
|
|
|
|
1999-07-15 00:02:10 +08:00
|
|
|
if (flag & PHP_INFO_GENERAL) {
|
2000-05-19 16:28:53 +08:00
|
|
|
char *zend_version = get_zend_version();
|
2004-04-23 21:28:25 +08:00
|
|
|
char temp_api[10];
|
2003-05-30 20:28:48 +08:00
|
|
|
char *logo_guid;
|
2000-05-19 16:28:53 +08:00
|
|
|
|
2002-03-29 18:19:23 +08:00
|
|
|
php_uname = php_get_uname('a');
|
2002-08-29 06:31:51 +08:00
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-08-29 06:31:51 +08:00
|
|
|
php_info_print_box_start(1);
|
|
|
|
}
|
1999-04-17 08:37:12 +08:00
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if (expose_php && !sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
PUTS("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
|
1999-08-08 02:21:35 +08:00
|
|
|
if (SG(request_info).request_uri) {
|
2005-05-09 01:24:38 +08:00
|
|
|
char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);
|
|
|
|
PUTS(elem_esc);
|
|
|
|
efree(elem_esc);
|
1999-08-08 02:21:35 +08:00
|
|
|
}
|
2003-04-03 00:51:40 +08:00
|
|
|
PUTS("?=");
|
2003-05-30 20:28:48 +08:00
|
|
|
logo_guid = php_logo_guid();
|
|
|
|
PUTS(logo_guid);
|
|
|
|
efree(logo_guid);
|
2003-04-03 00:51:40 +08:00
|
|
|
PUTS("\" alt=\"PHP Logo\" /></a>");
|
1999-07-15 00:02:10 +08:00
|
|
|
}
|
2002-08-29 06:31:51 +08:00
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION);
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
php_info_print_table_row(2, "PHP Version", PHP_VERSION);
|
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_box_end();
|
|
|
|
php_info_print_table_start();
|
|
|
|
php_info_print_table_row(2, "System", php_uname );
|
2001-08-16 06:37:31 +08:00
|
|
|
php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ );
|
1999-12-04 04:08:24 +08:00
|
|
|
#ifdef CONFIGURE_COMMAND
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
|
1999-12-04 04:08:24 +08:00
|
|
|
#endif
|
2000-06-27 02:05:55 +08:00
|
|
|
if (sapi_module.pretty_name) {
|
|
|
|
php_info_print_table_row(2, "Server API", sapi_module.pretty_name );
|
2000-04-07 23:30:47 +08:00
|
|
|
}
|
|
|
|
|
2000-04-22 00:20:11 +08:00
|
|
|
#ifdef VIRTUAL_DIR
|
|
|
|
php_info_print_table_row(2, "Virtual Directory Support", "enabled" );
|
|
|
|
#else
|
|
|
|
php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
|
|
|
|
#endif
|
|
|
|
|
2001-04-22 09:09:14 +08:00
|
|
|
php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:PHP_CONFIG_FILE_PATH);
|
2002-10-04 12:47:35 +08:00
|
|
|
|
2002-12-30 23:03:50 +08:00
|
|
|
if (strlen(PHP_CONFIG_FILE_SCAN_DIR)) {
|
2002-10-04 12:47:35 +08:00
|
|
|
php_info_print_table_row(2, "Scan this dir for additional .ini files", PHP_CONFIG_FILE_SCAN_DIR);
|
2002-12-30 23:03:50 +08:00
|
|
|
if (php_ini_scanned_files) {
|
2002-10-04 12:47:35 +08:00
|
|
|
php_info_print_table_row(2, "additional .ini files parsed", php_ini_scanned_files);
|
|
|
|
}
|
|
|
|
}
|
2002-06-19 21:24:01 +08:00
|
|
|
|
2002-09-28 00:05:47 +08:00
|
|
|
snprintf(temp_api, sizeof(temp_api), "%d", PHP_API_VERSION);
|
|
|
|
php_info_print_table_row(2, "PHP API", temp_api);
|
|
|
|
|
|
|
|
snprintf(temp_api, sizeof(temp_api), "%d", ZEND_MODULE_API_NO);
|
|
|
|
php_info_print_table_row(2, "PHP Extension", temp_api);
|
|
|
|
|
|
|
|
snprintf(temp_api, sizeof(temp_api), "%d", ZEND_EXTENSION_API_NO);
|
|
|
|
php_info_print_table_row(2, "Zend Extension", temp_api);
|
2002-05-02 20:33:03 +08:00
|
|
|
|
2000-04-07 06:54:33 +08:00
|
|
|
#if ZEND_DEBUG
|
2002-03-15 02:39:53 +08:00
|
|
|
php_info_print_table_row(2, "Debug Build", "yes" );
|
2000-04-06 05:03:30 +08:00
|
|
|
#else
|
2002-03-15 02:39:53 +08:00
|
|
|
php_info_print_table_row(2, "Debug Build", "no" );
|
2000-04-06 05:03:30 +08:00
|
|
|
#endif
|
2000-04-06 04:29:20 +08:00
|
|
|
|
1999-05-20 20:06:45 +08:00
|
|
|
#ifdef ZTS
|
2000-04-08 00:41:19 +08:00
|
|
|
php_info_print_table_row(2, "Thread Safety", "enabled" );
|
1999-05-20 20:06:45 +08:00
|
|
|
#else
|
2000-04-08 00:41:19 +08:00
|
|
|
php_info_print_table_row(2, "Thread Safety", "disabled" );
|
1999-05-20 20:06:45 +08:00
|
|
|
#endif
|
2001-04-18 01:06:06 +08:00
|
|
|
|
2005-06-07 21:36:08 +08:00
|
|
|
#if USE_ZEND_ALLOC
|
|
|
|
php_info_print_table_row(2, "Zend Memory Manager", "enabled" );
|
|
|
|
#else
|
|
|
|
php_info_print_table_row(2, "Zend Memory Manager", "disabled" );
|
|
|
|
#endif
|
|
|
|
|
2005-08-12 07:36:07 +08:00
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
snprintf(buf, sizeof(buf), "Based on%s. ICU Version %s.", U_COPYRIGHT_STRING, U_ICU_VERSION);
|
|
|
|
php_info_print_table_row(2, "Unicode Support", buf);
|
|
|
|
}
|
2003-12-06 08:00:31 +08:00
|
|
|
#if HAVE_IPV6
|
|
|
|
php_info_print_table_row(2, "IPv6 Support", "enabled" );
|
|
|
|
#else
|
|
|
|
php_info_print_table_row(2, "IPv6 Support", "disabled" );
|
|
|
|
#endif
|
2002-06-08 18:25:44 +08:00
|
|
|
{
|
|
|
|
HashTable *url_stream_wrappers_hash;
|
2006-02-22 04:12:43 +08:00
|
|
|
zstr stream_protocol;
|
|
|
|
char *stream_protocols_buf = NULL;
|
2006-03-02 21:12:45 +08:00
|
|
|
uint stream_protocol_len, stream_protocols_buf_len = 0;
|
2003-06-20 00:10:54 +08:00
|
|
|
ulong num_key;
|
2002-06-08 18:25:44 +08:00
|
|
|
|
|
|
|
if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
|
|
|
|
for (zend_hash_internal_pointer_reset(url_stream_wrappers_hash);
|
2003-06-20 00:10:54 +08:00
|
|
|
zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING;
|
2002-06-08 18:25:44 +08:00
|
|
|
zend_hash_move_forward(url_stream_wrappers_hash)) {
|
2003-01-19 04:01:46 +08:00
|
|
|
stream_protocols_buf = erealloc(stream_protocols_buf, stream_protocols_buf_len + stream_protocol_len + 2 + 1);
|
2006-02-22 04:12:43 +08:00
|
|
|
memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol.s, stream_protocol_len);
|
2002-08-30 02:28:11 +08:00
|
|
|
stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = ',';
|
|
|
|
stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len + 1] = ' ';
|
|
|
|
stream_protocols_buf_len += stream_protocol_len + 2;
|
2002-06-08 18:25:44 +08:00
|
|
|
}
|
|
|
|
if (stream_protocols_buf) {
|
2002-08-30 02:28:11 +08:00
|
|
|
stream_protocols_buf[stream_protocols_buf_len - 2] = ' ';
|
2002-06-08 18:25:44 +08:00
|
|
|
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 {
|
2002-07-02 02:52:30 +08:00
|
|
|
/* Any chances we will ever hit this? */
|
2002-06-08 18:25:44 +08:00
|
|
|
php_info_print_table_row(2, "Registered PHP Streams", "no streams registered");
|
|
|
|
}
|
|
|
|
} else {
|
2002-07-02 02:52:30 +08:00
|
|
|
/* Any chances we will ever hit this? */
|
|
|
|
php_info_print_table_row(2, "PHP Streams", "disabled"); /* ?? */
|
2002-06-08 18:25:44 +08:00
|
|
|
}
|
|
|
|
}
|
2004-02-18 13:07:13 +08:00
|
|
|
|
|
|
|
{
|
|
|
|
HashTable *stream_xport_hash;
|
2006-02-22 04:12:43 +08:00
|
|
|
zstr xport_name;
|
|
|
|
char *xport_buf = NULL;
|
2006-03-02 21:12:45 +08:00
|
|
|
uint xport_name_len, xport_buf_len = 0, xport_buf_size = 0;
|
2004-02-18 13:07:13 +08:00
|
|
|
ulong num_key;
|
|
|
|
|
|
|
|
if ((stream_xport_hash = php_stream_xport_get_hash())) {
|
|
|
|
for(zend_hash_internal_pointer_reset(stream_xport_hash);
|
|
|
|
zend_hash_get_current_key_ex(stream_xport_hash, &xport_name, &xport_name_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING;
|
|
|
|
zend_hash_move_forward(stream_xport_hash)) {
|
|
|
|
if (xport_buf_len + xport_name_len + 3 > xport_buf_size) {
|
|
|
|
while (xport_buf_len + xport_name_len + 3 > 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++] = ' ';
|
|
|
|
}
|
2006-02-22 04:12:43 +08:00
|
|
|
memcpy(xport_buf + xport_buf_len, xport_name.s, xport_name_len);
|
2004-02-18 13:07:13 +08:00
|
|
|
xport_buf_len += xport_name_len;
|
|
|
|
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 {
|
|
|
|
/* Any chances we will ever hit this? */
|
|
|
|
php_info_print_table_row(2, "Stream Socket Transports", "disabled"); /* ?? */
|
|
|
|
}
|
|
|
|
}
|
2005-02-27 16:12:12 +08:00
|
|
|
|
|
|
|
{
|
|
|
|
HashTable *stream_filter_hash;
|
2006-02-22 04:12:43 +08:00
|
|
|
zstr filter_name;
|
|
|
|
char *filter_buf = NULL;
|
2006-03-02 21:12:45 +08:00
|
|
|
uint filter_name_len, filter_buf_len = 0, filter_buf_size = 0;
|
2005-02-27 16:12:12 +08:00
|
|
|
ulong num_key;
|
|
|
|
|
|
|
|
if ((stream_filter_hash = php_get_stream_filters_hash())) {
|
|
|
|
for(zend_hash_internal_pointer_reset(stream_filter_hash);
|
|
|
|
zend_hash_get_current_key_ex(stream_filter_hash, &filter_name, &filter_name_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING;
|
|
|
|
zend_hash_move_forward(stream_filter_hash)) {
|
|
|
|
if (filter_buf_len + filter_name_len + 3 > filter_buf_size) {
|
|
|
|
while (filter_buf_len + filter_name_len + 3 > 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++] = ' ';
|
|
|
|
}
|
2006-02-22 04:12:43 +08:00
|
|
|
memcpy(filter_buf + filter_buf_len, filter_name.s, filter_name_len);
|
2005-02-27 16:12:12 +08:00
|
|
|
filter_buf_len += filter_name_len;
|
|
|
|
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"); /* ?? */
|
|
|
|
}
|
|
|
|
}
|
2001-04-18 01:06:06 +08:00
|
|
|
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_end();
|
|
|
|
|
1999-07-15 00:02:10 +08:00
|
|
|
/* Zend Engine */
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_box_start(0);
|
2003-03-19 04:52:52 +08:00
|
|
|
if (expose_php && !sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
PUTS("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");
|
1999-08-08 02:21:35 +08:00
|
|
|
if (SG(request_info).request_uri) {
|
2005-05-09 01:24:38 +08:00
|
|
|
char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);
|
|
|
|
PUTS(elem_esc);
|
|
|
|
efree(elem_esc);
|
1999-08-08 02:21:35 +08:00
|
|
|
}
|
2002-09-20 05:57:25 +08:00
|
|
|
PUTS("?="ZEND_LOGO_GUID"\" alt=\"Zend logo\" /></a>\n");
|
1999-07-15 00:02:10 +08:00
|
|
|
}
|
2002-08-29 06:31:51 +08:00
|
|
|
PUTS("This program makes use of the Zend Scripting Language Engine:");
|
2003-03-19 04:52:52 +08:00
|
|
|
PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");
|
2003-04-09 23:19:07 +08:00
|
|
|
if (sapi_module.phpinfo_as_text) {
|
|
|
|
PUTS(zend_version);
|
|
|
|
} else {
|
|
|
|
zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC);
|
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_box_end();
|
2000-08-28 03:42:45 +08:00
|
|
|
efree(php_uname);
|
1999-05-09 16:48:05 +08:00
|
|
|
}
|
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if ((flag & PHP_INFO_CREDITS) && expose_php && !sapi_module.phpinfo_as_text) {
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_hr();
|
2002-09-20 05:57:25 +08:00
|
|
|
PUTS("<h1><a href=\"");
|
1999-07-18 03:17:42 +08:00
|
|
|
if (SG(request_info).request_uri) {
|
2005-05-09 01:24:38 +08:00
|
|
|
char *elem_esc = php_info_html_esc(SG(request_info).request_uri TSRMLS_CC);
|
|
|
|
PUTS(elem_esc);
|
|
|
|
efree(elem_esc);
|
1999-07-18 03:17:42 +08:00
|
|
|
}
|
2002-08-09 04:19:33 +08:00
|
|
|
PUTS("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
|
2002-09-27 01:54:54 +08:00
|
|
|
PUTS("PHP Credits");
|
2000-08-28 06:46:40 +08:00
|
|
|
PUTS("</a></h1>\n");
|
1999-07-15 00:02:10 +08:00
|
|
|
}
|
|
|
|
|
2001-07-27 18:16:41 +08:00
|
|
|
zend_ini_sort_entries(TSRMLS_C);
|
1999-07-15 00:02:10 +08:00
|
|
|
|
|
|
|
if (flag & PHP_INFO_CONFIGURATION) {
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_hr();
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-20 05:57:25 +08:00
|
|
|
PUTS("<h1>Configuration</h1>\n");
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
SECTION("Configuration");
|
|
|
|
}
|
2002-09-20 05:57:25 +08:00
|
|
|
SECTION("PHP Core");
|
1999-07-15 00:02:10 +08:00
|
|
|
display_ini_entries(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag & PHP_INFO_MODULES) {
|
1999-08-08 01:52:11 +08:00
|
|
|
int show_info_func;
|
2002-11-15 05:15:42 +08:00
|
|
|
HashTable sorted_registry;
|
|
|
|
zend_module_entry tmp;
|
|
|
|
|
|
|
|
zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
|
|
|
|
zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry));
|
|
|
|
zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
|
1999-08-08 01:52:11 +08:00
|
|
|
|
|
|
|
show_info_func = 1;
|
2002-11-15 05:15:42 +08:00
|
|
|
zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC);
|
1999-08-08 01:52:11 +08:00
|
|
|
|
|
|
|
SECTION("Additional Modules");
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_start();
|
2002-09-27 01:54:54 +08:00
|
|
|
php_info_print_table_header(1, "Module Name");
|
1999-08-08 01:52:11 +08:00
|
|
|
show_info_func = 0;
|
2002-11-15 05:15:42 +08:00
|
|
|
zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC);
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_end();
|
2002-11-15 05:15:42 +08:00
|
|
|
|
|
|
|
zend_hash_destroy(&sorted_registry);
|
1999-07-15 00:02:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flag & PHP_INFO_ENVIRONMENT) {
|
|
|
|
SECTION("Environment");
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_start();
|
1999-07-15 00:02:10 +08:00
|
|
|
php_info_print_table_header(2, "Variable", "Value");
|
|
|
|
for (env=environ; env!=NULL && *env !=NULL; env++) {
|
|
|
|
tmp1 = estrdup(*env);
|
|
|
|
if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
|
|
|
|
efree(tmp1);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
*tmp2 = 0;
|
|
|
|
tmp2++;
|
|
|
|
php_info_print_table_row(2, tmp1, tmp2);
|
1999-04-17 08:37:12 +08:00
|
|
|
efree(tmp1);
|
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_end();
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
|
|
|
|
1999-07-15 00:02:10 +08:00
|
|
|
if (flag & PHP_INFO_VARIABLES) {
|
2005-12-06 06:53:34 +08:00
|
|
|
zval **data;
|
1999-04-17 08:37:12 +08:00
|
|
|
|
|
|
|
SECTION("PHP Variables");
|
|
|
|
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_start();
|
1999-05-09 16:48:05 +08:00
|
|
|
php_info_print_table_header(2, "Variable", "Value");
|
1999-08-03 03:17:14 +08:00
|
|
|
if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) {
|
2001-09-26 05:58:48 +08:00
|
|
|
php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_PP(data));
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
1999-08-03 03:17:14 +08:00
|
|
|
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
|
2001-09-26 05:58:48 +08:00
|
|
|
php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_PP(data));
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
2002-09-08 16:08:35 +08:00
|
|
|
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
|
2001-09-26 05:58:48 +08:00
|
|
|
php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_PP(data));
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
1999-08-03 03:17:14 +08:00
|
|
|
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
|
2001-09-26 05:58:48 +08:00
|
|
|
php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data));
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
2003-04-10 01:46:42 +08:00
|
|
|
php_print_gpcse_array("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC);
|
2001-08-09 01:16:20 +08:00
|
|
|
php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC);
|
|
|
|
php_print_gpcse_array("_POST", sizeof("_POST")-1 TSRMLS_CC);
|
|
|
|
php_print_gpcse_array("_FILES", sizeof("_FILES")-1 TSRMLS_CC);
|
|
|
|
php_print_gpcse_array("_COOKIE", sizeof("_COOKIE")-1 TSRMLS_CC);
|
|
|
|
php_print_gpcse_array("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
|
|
|
|
php_print_gpcse_array("_ENV", sizeof("_ENV")-1 TSRMLS_CC);
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_end();
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
|
|
|
|
1999-07-15 00:02:10 +08:00
|
|
|
if (flag & PHP_INFO_LICENSE) {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-08-29 06:31:51 +08:00
|
|
|
SECTION("PHP License");
|
|
|
|
php_info_print_box_start(0);
|
|
|
|
PUTS("<p>\n");
|
|
|
|
PUTS("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 ");
|
|
|
|
PUTS("and included in the distribution in the file: LICENSE\n");
|
|
|
|
PUTS("</p>\n");
|
|
|
|
PUTS("<p>");
|
|
|
|
PUTS("This program is distributed in the hope that it will be useful, ");
|
|
|
|
PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of ");
|
|
|
|
PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
|
|
|
|
PUTS("</p>\n");
|
|
|
|
PUTS("<p>");
|
|
|
|
PUTS("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");
|
|
|
|
PUTS("</p>\n");
|
|
|
|
php_info_print_box_end();
|
|
|
|
} else {
|
|
|
|
PUTS("\nPHP License\n");
|
|
|
|
PUTS("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");
|
|
|
|
PUTS("and included in the distribution in the file: LICENSE\n");
|
|
|
|
PUTS("\n");
|
|
|
|
PUTS("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");
|
|
|
|
PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
|
|
|
|
PUTS("\n");
|
|
|
|
PUTS("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");
|
|
|
|
}
|
1999-07-15 00:02:10 +08:00
|
|
|
}
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-10-10 12:28:15 +08:00
|
|
|
PUTS("</div></body></html>");
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-05-09 16:48:05 +08:00
|
|
|
|
1999-07-18 03:17:42 +08:00
|
|
|
|
2000-04-06 04:17:02 +08:00
|
|
|
PHPAPI void php_info_print_table_start()
|
|
|
|
{
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf("<table border=\"0\" cellpadding=\"3\" width=\"600\">\n");
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
php_printf("\n");
|
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
PHPAPI void php_info_print_table_end()
|
2002-08-29 17:11:22 +08:00
|
|
|
{
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf("</table><br />\n");
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
PHPAPI void php_info_print_box_start(int flag)
|
|
|
|
{
|
|
|
|
php_info_print_table_start();
|
|
|
|
if (flag) {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf("<tr class=\"h\"><td>\n");
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
} else {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf("<tr class=\"v\"><td>\n");
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
php_printf("\n");
|
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PHPAPI void php_info_print_box_end()
|
|
|
|
{
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-08-29 06:31:51 +08:00
|
|
|
php_printf("</td></tr>\n");
|
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
php_info_print_table_end();
|
|
|
|
}
|
|
|
|
|
|
|
|
PHPAPI void php_info_print_hr()
|
|
|
|
{
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-20 05:57:25 +08:00
|
|
|
php_printf("<hr />\n");
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
php_printf("\n\n _______________________________________________________________________\n\n");
|
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
}
|
|
|
|
|
2000-04-08 00:41:19 +08:00
|
|
|
PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header)
|
|
|
|
{
|
2002-08-29 06:31:51 +08:00
|
|
|
int spaces;
|
2002-08-29 17:11:22 +08:00
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header );
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
spaces = (74 - strlen(header));
|
|
|
|
php_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " ");
|
|
|
|
}
|
2000-04-08 00:41:19 +08:00
|
|
|
}
|
2000-04-06 04:17:02 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ php_info_print_table_header
|
|
|
|
*/
|
1999-05-09 16:48:05 +08:00
|
|
|
PHPAPI void php_info_print_table_header(int num_cols, ...)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
va_list row_elements;
|
|
|
|
char *row_element;
|
|
|
|
|
2002-08-29 17:11:22 +08:00
|
|
|
TSRMLS_FETCH();
|
|
|
|
|
1999-05-09 16:48:05 +08:00
|
|
|
va_start(row_elements, num_cols);
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf("<tr class=\"h\">");
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
1999-05-09 16:48:05 +08:00
|
|
|
for (i=0; i<num_cols; i++) {
|
|
|
|
row_element = va_arg(row_elements, char *);
|
|
|
|
if (!row_element || !*row_element) {
|
2002-09-20 05:57:25 +08:00
|
|
|
row_element = " ";
|
1999-05-09 16:48:05 +08:00
|
|
|
}
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 03:33:23 +08:00
|
|
|
PUTS("<th>");
|
2002-10-02 22:27:32 +08:00
|
|
|
PUTS(row_element);
|
2002-09-27 03:33:23 +08:00
|
|
|
PUTS("</th>");
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
PUTS(row_element);
|
|
|
|
if (i < num_cols-1) {
|
|
|
|
PUTS(" => ");
|
|
|
|
} else {
|
|
|
|
PUTS("\n");
|
|
|
|
}
|
|
|
|
}
|
1999-05-09 16:48:05 +08:00
|
|
|
}
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-08-29 06:31:51 +08:00
|
|
|
php_printf("</tr>\n");
|
|
|
|
}
|
1999-05-09 16:48:05 +08:00
|
|
|
|
|
|
|
va_end(row_elements);
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-05-09 16:48:05 +08:00
|
|
|
|
2003-04-20 01:40:19 +08:00
|
|
|
/* {{{ php_info_print_table_row_internal
|
2001-06-06 21:06:12 +08:00
|
|
|
*/
|
2003-04-20 01:40:19 +08:00
|
|
|
static void php_info_print_table_row_internal(int num_cols,
|
|
|
|
const char *value_class, va_list row_elements)
|
1999-05-09 16:48:05 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char *row_element;
|
2002-10-12 11:11:28 +08:00
|
|
|
char *elem_esc = NULL;
|
2002-09-27 03:33:23 +08:00
|
|
|
/*
|
|
|
|
int elem_esc_len;
|
|
|
|
*/
|
2002-08-29 17:11:22 +08:00
|
|
|
|
2002-03-05 02:46:55 +08:00
|
|
|
TSRMLS_FETCH();
|
1999-05-09 16:48:05 +08:00
|
|
|
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-20 05:57:25 +08:00
|
|
|
php_printf("<tr>");
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
1999-05-09 16:48:05 +08:00
|
|
|
for (i=0; i<num_cols; i++) {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-20 05:57:25 +08:00
|
|
|
php_printf("<td class=\"%s\">",
|
2003-04-20 01:40:19 +08:00
|
|
|
(i==0 ? "e" : value_class )
|
2002-09-20 05:57:25 +08:00
|
|
|
);
|
2002-08-29 06:31:51 +08:00
|
|
|
}
|
1999-05-09 16:48:05 +08:00
|
|
|
row_element = va_arg(row_elements, char *);
|
|
|
|
if (!row_element || !*row_element) {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
PUTS( "<i>no value</i>" );
|
|
|
|
} else {
|
|
|
|
PUTS( " " );
|
|
|
|
}
|
2001-05-06 23:20:56 +08:00
|
|
|
} else {
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-10-12 11:11:28 +08:00
|
|
|
elem_esc = php_info_html_esc(row_element TSRMLS_CC);
|
|
|
|
PUTS(elem_esc);
|
|
|
|
efree(elem_esc);
|
2002-08-29 06:31:51 +08:00
|
|
|
} else {
|
|
|
|
PUTS(row_element);
|
|
|
|
if (i < num_cols-1) {
|
|
|
|
PUTS(" => ");
|
|
|
|
}
|
|
|
|
}
|
1999-05-09 16:48:05 +08:00
|
|
|
}
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-09-27 01:54:54 +08:00
|
|
|
php_printf(" </td>");
|
2003-01-18 02:07:10 +08:00
|
|
|
} else if (i == (num_cols - 1)) {
|
|
|
|
PUTS("\n");
|
|
|
|
}
|
1999-05-09 16:48:05 +08:00
|
|
|
}
|
2003-03-19 04:52:52 +08:00
|
|
|
if (!sapi_module.phpinfo_as_text) {
|
2002-08-29 06:31:51 +08:00
|
|
|
php_printf("</tr>\n");
|
|
|
|
}
|
2003-04-20 01:40:19 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
/* {{{ php_info_print_table_row
|
|
|
|
*/
|
|
|
|
PHPAPI void php_info_print_table_row(int num_cols, ...)
|
|
|
|
{
|
|
|
|
va_list row_elements;
|
|
|
|
|
|
|
|
va_start(row_elements, num_cols);
|
|
|
|
php_info_print_table_row_internal(num_cols, "v", row_elements);
|
|
|
|
va_end(row_elements);
|
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
/* {{{ php_info_print_table_row_ex
|
|
|
|
*/
|
|
|
|
PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
va_list row_elements;
|
2002-08-29 06:31:51 +08:00
|
|
|
|
2003-04-20 01:40:19 +08:00
|
|
|
va_start(row_elements, value_class);
|
|
|
|
php_info_print_table_row_internal(num_cols, value_class, row_elements);
|
1999-05-09 16:48:05 +08:00
|
|
|
va_end(row_elements);
|
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-05-09 16:48:05 +08:00
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
/* {{{ register_phpinfo_constants
|
|
|
|
*/
|
1999-07-15 00:02:10 +08:00
|
|
|
void register_phpinfo_constants(INIT_FUNC_ARGS)
|
|
|
|
{
|
|
|
|
REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS);
|
2000-02-19 01:59:44 +08:00
|
|
|
REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS);
|
|
|
|
REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS);
|
2000-12-20 06:59:14 +08:00
|
|
|
REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS);
|
2000-02-19 01:59:44 +08:00
|
|
|
REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS);
|
1999-07-15 00:02:10 +08:00
|
|
|
}
|
2001-06-06 21:06:12 +08:00
|
|
|
/* }}} */
|
1999-07-15 00:02:10 +08:00
|
|
|
|
2000-06-17 02:24:02 +08:00
|
|
|
/* {{{ proto void phpinfo([int what])
|
1999-04-17 08:37:12 +08:00
|
|
|
Output a page of useful information about PHP and the current request */
|
1999-07-18 03:17:42 +08:00
|
|
|
PHP_FUNCTION(phpinfo)
|
1999-04-17 08:37:12 +08:00
|
|
|
{
|
2001-08-13 14:43:47 +08:00
|
|
|
int argc = ZEND_NUM_ARGS();
|
|
|
|
long flag;
|
1999-07-15 00:02:10 +08:00
|
|
|
|
2001-08-14 03:31:18 +08:00
|
|
|
if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) {
|
2001-08-13 14:43:47 +08:00
|
|
|
return;
|
2001-08-14 03:31:18 +08:00
|
|
|
}
|
1999-07-15 00:02:10 +08:00
|
|
|
|
2001-08-13 14:43:47 +08:00
|
|
|
if(!argc) {
|
2001-12-06 21:31:34 +08:00
|
|
|
flag = PHP_INFO_ALL;
|
1999-07-15 00:02:10 +08:00
|
|
|
}
|
2001-08-13 14:43:47 +08:00
|
|
|
|
2002-05-13 16:46:24 +08:00
|
|
|
/* Andale! Andale! Yee-Hah! */
|
|
|
|
php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC);
|
2001-08-13 15:28:57 +08:00
|
|
|
php_print_info(flag TSRMLS_CC);
|
2002-05-13 16:46:24 +08:00
|
|
|
php_end_ob_buffer(1, 0 TSRMLS_CC);
|
2001-08-13 15:28:57 +08:00
|
|
|
|
1999-04-17 08:37:12 +08:00
|
|
|
RETURN_TRUE;
|
|
|
|
}
|
1999-12-14 11:48:46 +08:00
|
|
|
|
1999-04-17 08:37:12 +08:00
|
|
|
/* }}} */
|
|
|
|
|
2001-10-12 07:33:59 +08:00
|
|
|
/* {{{ proto string phpversion([string extension])
|
1999-04-17 08:37:12 +08:00
|
|
|
Return the current PHP version */
|
1999-07-18 03:17:42 +08:00
|
|
|
PHP_FUNCTION(phpversion)
|
1999-04-17 08:37:12 +08:00
|
|
|
{
|
2002-09-11 22:21:39 +08:00
|
|
|
zval **arg;
|
|
|
|
int argc = ZEND_NUM_ARGS();
|
2001-10-12 07:33:59 +08:00
|
|
|
|
|
|
|
if (argc == 0) {
|
2005-08-23 20:53:31 +08:00
|
|
|
RETURN_ASCII_STRING(PHP_VERSION, 1);
|
2001-10-12 07:33:59 +08:00
|
|
|
} else if (argc == 1 && zend_get_parameters_ex(1, &arg) == SUCCESS) {
|
2002-09-11 22:21:39 +08:00
|
|
|
char *version;
|
|
|
|
convert_to_string_ex(arg);
|
|
|
|
version = zend_get_module_version(Z_STRVAL_PP(arg));
|
|
|
|
if (version == NULL) {
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2005-08-23 20:53:31 +08:00
|
|
|
RETURN_ASCII_STRING(version, 1);
|
2002-09-11 22:21:39 +08:00
|
|
|
} else {
|
2001-08-13 15:55:39 +08:00
|
|
|
WRONG_PARAM_COUNT;
|
2002-09-11 22:21:39 +08:00
|
|
|
}
|
1999-04-17 08:37:12 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
2000-07-09 03:31:16 +08:00
|
|
|
/* {{{ proto void phpcredits([int flag])
|
1999-07-18 03:17:42 +08:00
|
|
|
Prints the list of people who've contributed to the PHP project */
|
|
|
|
PHP_FUNCTION(phpcredits)
|
|
|
|
{
|
2001-08-13 14:43:47 +08:00
|
|
|
int argc = ZEND_NUM_ARGS();
|
|
|
|
long flag;
|
1999-07-18 03:17:42 +08:00
|
|
|
|
2001-08-14 03:31:18 +08:00
|
|
|
if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) {
|
2001-08-13 14:43:47 +08:00
|
|
|
return;
|
2001-08-14 03:31:18 +08:00
|
|
|
}
|
2001-08-13 14:43:47 +08:00
|
|
|
|
|
|
|
if(!argc) {
|
2001-12-06 21:31:34 +08:00
|
|
|
flag = PHP_CREDITS_ALL;
|
2001-08-13 14:43:47 +08:00
|
|
|
}
|
1999-07-18 03:17:42 +08:00
|
|
|
|
2003-03-25 16:07:13 +08:00
|
|
|
php_print_credits(flag TSRMLS_CC);
|
1999-07-18 03:17:42 +08:00
|
|
|
RETURN_TRUE;
|
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
2003-04-03 00:51:40 +08:00
|
|
|
|
|
|
|
/* {{{ php_logo_guid
|
|
|
|
*/
|
|
|
|
PHPAPI char *php_logo_guid()
|
|
|
|
{
|
|
|
|
char *logo_guid;
|
|
|
|
|
|
|
|
time_t the_time;
|
|
|
|
struct tm *ta, tmbuf;
|
|
|
|
|
|
|
|
the_time = time(NULL);
|
|
|
|
ta = php_localtime_r(&the_time, &tmbuf);
|
|
|
|
|
|
|
|
if ((ta->tm_mon==3) && (ta->tm_mday==1)) {
|
|
|
|
logo_guid = PHP_EGG_LOGO_GUID;
|
|
|
|
} else {
|
|
|
|
logo_guid = PHP_LOGO_GUID;
|
|
|
|
}
|
|
|
|
|
|
|
|
return estrdup(logo_guid);
|
|
|
|
|
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
2000-10-11 19:40:29 +08:00
|
|
|
/* {{{ proto string php_logo_guid(void)
|
|
|
|
Return the special ID used to request the PHP logo in phpinfo screens*/
|
1999-12-22 04:35:43 +08:00
|
|
|
PHP_FUNCTION(php_logo_guid)
|
|
|
|
{
|
2003-04-03 00:51:40 +08:00
|
|
|
|
|
|
|
if (ZEND_NUM_ARGS() != 0) {
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
|
|
|
|
2005-08-23 20:53:31 +08:00
|
|
|
RETURN_ASCII_STRING(php_logo_guid(), 0);
|
2003-04-03 00:51:40 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
/* {{{ proto string php_real_logo_guid(void)
|
|
|
|
Return the special ID used to request the PHP logo in phpinfo screens*/
|
|
|
|
PHP_FUNCTION(php_real_logo_guid)
|
|
|
|
{
|
|
|
|
|
2001-08-13 15:55:39 +08:00
|
|
|
if (ZEND_NUM_ARGS() != 0) {
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
2001-08-13 14:43:47 +08:00
|
|
|
|
2005-08-23 20:53:31 +08:00
|
|
|
RETURN_ASCII_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);
|
1999-12-22 04:35:43 +08:00
|
|
|
}
|
2000-10-11 19:40:29 +08:00
|
|
|
/* }}} */
|
1999-12-22 04:35:43 +08:00
|
|
|
|
2000-10-11 21:51:32 +08:00
|
|
|
/* {{{ proto string php_egg_logo_guid(void)
|
2000-10-11 19:40:29 +08:00
|
|
|
Return the special ID used to request the PHP logo in phpinfo screens*/
|
2000-04-20 07:17:02 +08:00
|
|
|
PHP_FUNCTION(php_egg_logo_guid)
|
|
|
|
{
|
2001-08-13 15:55:39 +08:00
|
|
|
if (ZEND_NUM_ARGS() != 0) {
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
2001-08-13 14:43:47 +08:00
|
|
|
|
2005-08-23 20:53:31 +08:00
|
|
|
RETURN_ASCII_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);
|
2000-04-20 07:17:02 +08:00
|
|
|
}
|
2000-10-11 19:40:29 +08:00
|
|
|
/* }}} */
|
2000-04-20 07:17:02 +08:00
|
|
|
|
2000-10-11 21:51:32 +08:00
|
|
|
/* {{{ proto string zend_logo_guid(void)
|
2000-10-11 19:40:29 +08:00
|
|
|
Return the special ID used to request the Zend logo in phpinfo screens*/
|
1999-12-22 04:35:43 +08:00
|
|
|
PHP_FUNCTION(zend_logo_guid)
|
|
|
|
{
|
2001-08-13 15:55:39 +08:00
|
|
|
if (ZEND_NUM_ARGS() != 0) {
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
2001-08-13 14:43:47 +08:00
|
|
|
|
2005-08-23 20:53:31 +08:00
|
|
|
RETURN_ASCII_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);
|
1999-12-22 04:35:43 +08:00
|
|
|
}
|
2000-10-11 19:40:29 +08:00
|
|
|
/* }}} */
|
1999-12-22 04:35:43 +08:00
|
|
|
|
2000-08-28 03:42:45 +08:00
|
|
|
/* {{{ proto string php_sapi_name(void)
|
2000-06-26 22:43:37 +08:00
|
|
|
Return the current SAPI module name */
|
|
|
|
PHP_FUNCTION(php_sapi_name)
|
|
|
|
{
|
2001-08-13 15:55:39 +08:00
|
|
|
if (ZEND_NUM_ARGS() != 0) {
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
2001-08-13 14:43:47 +08:00
|
|
|
|
2000-06-26 22:55:38 +08:00
|
|
|
if (sapi_module.name) {
|
2005-08-23 20:53:31 +08:00
|
|
|
RETURN_ASCII_STRING(sapi_module.name, 1);
|
2000-06-26 22:55:38 +08:00
|
|
|
} else {
|
2000-06-26 22:43:37 +08:00
|
|
|
RETURN_FALSE;
|
2000-06-26 22:55:38 +08:00
|
|
|
}
|
2000-06-26 22:43:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* }}} */
|
|
|
|
|
2000-08-28 03:42:45 +08:00
|
|
|
/* {{{ proto string php_uname(void)
|
|
|
|
Return information about the system PHP was built on */
|
|
|
|
PHP_FUNCTION(php_uname)
|
|
|
|
{
|
2002-09-11 22:21:39 +08:00
|
|
|
char *mode = "a";
|
|
|
|
int modelen;
|
2005-08-23 20:53:31 +08:00
|
|
|
char *tmp;
|
|
|
|
|
2002-03-29 18:19:23 +08:00
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) {
|
|
|
|
return;
|
2001-08-13 15:55:39 +08:00
|
|
|
}
|
2005-08-23 20:53:31 +08:00
|
|
|
tmp = php_get_uname(*mode);
|
|
|
|
RETVAL_RT_STRING(tmp, 0);
|
|
|
|
if (UG(unicode)) {
|
|
|
|
efree(tmp);
|
|
|
|
}
|
2000-08-28 03:42:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* }}} */
|
|
|
|
|
2002-10-07 01:04:10 +08:00
|
|
|
/* {{{ proto string php_ini_scanned_files(void)
|
|
|
|
Return comma-separated string of .ini files parsed from the additional ini dir */
|
2002-12-30 23:03:50 +08:00
|
|
|
PHP_FUNCTION(php_ini_scanned_files)
|
|
|
|
{
|
2004-03-15 15:45:25 +08:00
|
|
|
if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) {
|
2005-08-23 20:53:31 +08:00
|
|
|
RETURN_RT_STRING(php_ini_scanned_files, 1);
|
2002-12-30 23:03:50 +08:00
|
|
|
} else {
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2002-10-07 01:04:10 +08:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
1999-04-17 08:37:12 +08:00
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
2001-09-09 21:29:31 +08:00
|
|
|
* vim600: sw=4 ts=4 fdm=marker
|
|
|
|
* vim<600: sw=4 ts=4
|
1999-04-17 08:37:12 +08:00
|
|
|
*/
|