1/*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2014 The PHP Group                                |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Authors: Rasmus Lerdorf <rasmus@php.net>                             |
16   |          Zeev Suraski <zeev@zend.com>                                |
17   |          Colin Viebrock <colin@viebrock.ca>                          |
18   +----------------------------------------------------------------------+
19*/
20
21/* $Id$ */
22
23#include "php.h"
24#include "php_ini.h"
25#include "php_globals.h"
26#include "ext/standard/head.h"
27#include "ext/standard/html.h"
28#include "info.h"
29#include "credits.h"
30#include "css.h"
31#include "SAPI.h"
32#include <time.h>
33#include "php_main.h"
34#include "zend_globals.h"       /* needs ELS */
35#include "zend_extensions.h"
36#include "zend_highlight.h"
37#ifdef HAVE_SYS_UTSNAME_H
38#include <sys/utsname.h>
39#endif
40
41
42#ifdef PHP_WIN32
43typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
44typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
45# include "winver.h"
46
47# if _MSC_VER < 1300
48#  define OSVERSIONINFOEX php_win_OSVERSIONINFOEX
49# endif
50#endif
51
52#define SECTION(name)   if (!sapi_module.phpinfo_as_text) { \
53                            php_info_print("<h2>" name "</h2>\n"); \
54                        } else { \
55                            php_info_print_table_start(); \
56                            php_info_print_table_header(1, name); \
57                            php_info_print_table_end(); \
58                        } \
59
60PHPAPI extern char *php_ini_opened_path;
61PHPAPI extern char *php_ini_scanned_path;
62PHPAPI extern char *php_ini_scanned_files;
63
64static int php_info_print_html_esc(const char *str, int len) /* {{{ */
65{
66    size_t new_len;
67    int written;
68    char *new_str;
69    TSRMLS_FETCH();
70
71    new_str = php_escape_html_entities((unsigned char *) str, len, &new_len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC);
72    written = php_output_write(new_str, new_len TSRMLS_CC);
73    str_efree(new_str);
74    return written;
75}
76/* }}} */
77
78static int php_info_printf(const char *fmt, ...) /* {{{ */
79{
80    char *buf;
81    int len, written;
82    va_list argv;
83    TSRMLS_FETCH();
84
85    va_start(argv, fmt);
86    len = vspprintf(&buf, 0, fmt, argv);
87    va_end(argv);
88
89    written = php_output_write(buf, len TSRMLS_CC);
90    efree(buf);
91    return written;
92}
93/* }}} */
94
95static int php_info_print(const char *str) /* {{{ */
96{
97    TSRMLS_FETCH();
98    return php_output_write(str, strlen(str) TSRMLS_CC);
99}
100/* }}} */
101
102static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC) /* {{{ */
103{
104    char *key;
105    uint len;
106
107    if (ht) {
108        if (zend_hash_num_elements(ht)) {
109            HashPosition pos;
110
111            if (!sapi_module.phpinfo_as_text) {
112                php_info_printf("<tr><td class=\"e\">Registered %s</td><td class=\"v\">", name);
113            } else {
114                php_info_printf("\nRegistered %s => ", name);
115            }
116
117            zend_hash_internal_pointer_reset_ex(ht, &pos);
118            while (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING)
119            {
120                if (!sapi_module.phpinfo_as_text) {
121                    php_info_print_html_esc(key, len-1);
122                } else {
123                    php_info_print(key);
124                }
125                zend_hash_move_forward_ex(ht, &pos);
126                if (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) {
127                    php_info_print(", ");
128                } else {
129                    break;
130                }
131            }
132
133            if (!sapi_module.phpinfo_as_text) {
134                php_info_print("</td></tr>\n");
135            }
136        } else {
137            char reg_name[128];
138            snprintf(reg_name, sizeof(reg_name), "Registered %s", name);
139            php_info_print_table_row(2, reg_name, "none registered");
140        }
141    } else {
142        php_info_print_table_row(2, name, "disabled");
143    }
144}
145/* }}} */
146
147PHPAPI void php_info_print_module(zend_module_entry *zend_module TSRMLS_DC) /* {{{ */
148{
149    if (zend_module->info_func || zend_module->version) {
150        if (!sapi_module.phpinfo_as_text) {
151            php_info_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", zend_module->name, zend_module->name);
152        } else {
153            php_info_print_table_start();
154            php_info_print_table_header(1, zend_module->name);
155            php_info_print_table_end();
156        }
157        if (zend_module->info_func) {
158            zend_module->info_func(zend_module TSRMLS_CC);
159        } else {
160            php_info_print_table_start();
161            php_info_print_table_row(2, "Version", zend_module->version);
162            php_info_print_table_end();
163            DISPLAY_INI_ENTRIES();
164        }
165    } else {
166        if (!sapi_module.phpinfo_as_text) {
167            php_info_printf("<tr><td class=\"v\">%s</td></tr>\n", zend_module->name);
168        } else {
169            php_info_printf("%s\n", zend_module->name);
170        }
171    }
172}
173/* }}} */
174
175static int _display_module_info_func(zend_module_entry *module TSRMLS_DC) /* {{{ */
176{
177    if (module->info_func || module->version) {
178        php_info_print_module(module TSRMLS_CC);
179    }
180    return ZEND_HASH_APPLY_KEEP;
181}
182/* }}} */
183
184static int _display_module_info_def(zend_module_entry *module TSRMLS_DC) /* {{{ */
185{
186    if (!module->info_func && !module->version) {
187        php_info_print_module(module TSRMLS_CC);
188    }
189    return ZEND_HASH_APPLY_KEEP;
190}
191/* }}} */
192
193/* {{{ php_print_gpcse_array
194 */
195static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
196{
197    zval **data, **tmp, tmp2;
198    char *string_key;
199    uint string_len;
200    ulong num_key;
201
202    zend_is_auto_global(name, name_length TSRMLS_CC);
203
204    if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE
205        && (Z_TYPE_PP(data)==IS_ARRAY)) {
206        zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data));
207        while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) &tmp) == SUCCESS) {
208            if (!sapi_module.phpinfo_as_text) {
209                php_info_print("<tr>");
210                php_info_print("<td class=\"e\">");
211            }
212
213            php_info_print(name);
214            php_info_print("[\"");
215
216            switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) {
217                case HASH_KEY_IS_STRING:
218                    if (!sapi_module.phpinfo_as_text) {
219                        php_info_print_html_esc(string_key, string_len-1);
220                    } else {
221                        php_info_print(string_key);
222                    }
223                    break;
224                case HASH_KEY_IS_LONG:
225                    php_info_printf("%ld", num_key);
226                    break;
227            }
228            php_info_print("\"]");
229            if (!sapi_module.phpinfo_as_text) {
230                php_info_print("</td><td class=\"v\">");
231            } else {
232                php_info_print(" => ");
233            }
234            if (Z_TYPE_PP(tmp) == IS_ARRAY) {
235                if (!sapi_module.phpinfo_as_text) {
236                    php_info_print("<pre>");
237                    zend_print_zval_r_ex((zend_write_func_t) php_info_print_html_esc, *tmp, 0 TSRMLS_CC);
238                    php_info_print("</pre>");
239                } else {
240                    zend_print_zval_r(*tmp, 0 TSRMLS_CC);
241                }
242            } else {
243                tmp2 = **tmp;
244                if (Z_TYPE_PP(tmp) != IS_STRING) {
245                    tmp = NULL;
246                    zval_copy_ctor(&tmp2);
247                    convert_to_string(&tmp2);
248                }
249
250                if (!sapi_module.phpinfo_as_text) {
251                    if (Z_STRLEN(tmp2) == 0) {
252                        php_info_print("<i>no value</i>");
253                    } else {
254                        php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2));
255                    }
256                } else {
257                    php_info_print(Z_STRVAL(tmp2));
258                }
259
260                if (!tmp) {
261                    zval_dtor(&tmp2);
262                }
263            }
264            if (!sapi_module.phpinfo_as_text) {
265                php_info_print("</td></tr>\n");
266            } else {
267                php_info_print("\n");
268            }
269            zend_hash_move_forward(Z_ARRVAL_PP(data));
270        }
271    }
272}
273/* }}} */
274
275/* {{{ php_info_print_style
276 */
277void php_info_print_style(TSRMLS_D)
278{
279    php_info_printf("<style type=\"text/css\">\n");
280    php_info_print_css(TSRMLS_C);
281    php_info_printf("</style>\n");
282}
283/* }}} */
284
285/* {{{ php_info_html_esc
286 */
287PHPAPI char *php_info_html_esc(char *string TSRMLS_DC)
288{
289    size_t new_len;
290    return php_escape_html_entities((unsigned char *) string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
291}
292/* }}} */
293
294#ifdef PHP_WIN32
295/* {{{  */
296
297char* php_get_windows_name()
298{
299    OSVERSIONINFOEX osvi;
300    SYSTEM_INFO si;
301    PGNSI pGNSI;
302    PGPI pGPI;
303    BOOL bOsVersionInfoEx;
304    DWORD dwType;
305    char *major = NULL, *sub = NULL, *retval;
306
307    ZeroMemory(&si, sizeof(SYSTEM_INFO));
308    ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
309    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
310
311    if (!(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi))) {
312        return NULL;
313    }
314
315    pGNSI = (PGNSI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetNativeSystemInfo");
316    if(NULL != pGNSI) {
317        pGNSI(&si);
318    } else {
319        GetSystemInfo(&si);
320    }
321
322    if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) {
323        if (osvi.dwMajorVersion == 6) {
324            if( osvi.dwMinorVersion == 0 ) {
325                if( osvi.wProductType == VER_NT_WORKSTATION ) {
326                    major = "Windows Vista";
327                } else {
328                    major = "Windows Server 2008";
329                }
330            } else
331            if ( osvi.dwMinorVersion == 1 ) {
332                if( osvi.wProductType == VER_NT_WORKSTATION )  {
333                    major = "Windows 7";
334                } else {
335                    major = "Windows Server 2008 R2";
336                }
337            } else if ( osvi.dwMinorVersion == 2 ) {
338                if( osvi.wProductType == VER_NT_WORKSTATION )  {
339                    major = "Windows 8";
340                } else {
341                    major = "Windows Server 2012";
342                }
343            } else {
344                major = "Unknown Windows version";
345            }
346
347            pGPI = (PGPI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetProductInfo");
348            pGPI(6, 0, 0, 0, &dwType);
349
350            switch (dwType) {
351                case PRODUCT_ULTIMATE:
352                    sub = "Ultimate Edition";
353                    break;
354                case PRODUCT_HOME_PREMIUM:
355                    sub = "Home Premium Edition";
356                    break;
357                case PRODUCT_HOME_BASIC:
358                    sub = "Home Basic Edition";
359                    break;
360                case PRODUCT_ENTERPRISE:
361                    sub = "Enterprise Edition";
362                    break;
363                case PRODUCT_BUSINESS:
364                    sub = "Business Edition";
365                    break;
366                case PRODUCT_STARTER:
367                    sub = "Starter Edition";
368                    break;
369                case PRODUCT_CLUSTER_SERVER:
370                    sub = "Cluster Server Edition";
371                    break;
372                case PRODUCT_DATACENTER_SERVER:
373                    sub = "Datacenter Edition";
374                    break;
375                case PRODUCT_DATACENTER_SERVER_CORE:
376                    sub = "Datacenter Edition (core installation)";
377                    break;
378                case PRODUCT_ENTERPRISE_SERVER:
379                    sub = "Enterprise Edition";
380                    break;
381                case PRODUCT_ENTERPRISE_SERVER_CORE:
382                    sub = "Enterprise Edition (core installation)";
383                    break;
384                case PRODUCT_ENTERPRISE_SERVER_IA64:
385                    sub = "Enterprise Edition for Itanium-based Systems";
386                    break;
387                case PRODUCT_SMALLBUSINESS_SERVER:
388                    sub = "Small Business Server";
389                    break;
390                case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
391                    sub = "Small Business Server Premium Edition";
392                    break;
393                case PRODUCT_STANDARD_SERVER:
394                    sub = "Standard Edition";
395                    break;
396                case PRODUCT_STANDARD_SERVER_CORE:
397                    sub = "Standard Edition (core installation)";
398                    break;
399                case PRODUCT_WEB_SERVER:
400                    sub = "Web Server Edition";
401                    break;
402            }
403        }
404
405        if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) {
406            if (GetSystemMetrics(SM_SERVERR2))
407                major = "Windows Server 2003 R2";
408            else if (osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER)
409                major = "Windows Storage Server 2003";
410            else if (osvi.wSuiteMask==VER_SUITE_WH_SERVER)
411                major = "Windows Home Server";
412            else if (osvi.wProductType == VER_NT_WORKSTATION &&
413                si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) {
414                major = "Windows XP Professional x64 Edition";
415            } else {
416                major = "Windows Server 2003";
417            }
418
419            /* Test for the server type. */
420            if ( osvi.wProductType != VER_NT_WORKSTATION ) {
421                if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64 ) {
422                    if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
423                        sub = "Datacenter Edition for Itanium-based Systems";
424                    else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
425                        sub = "Enterprise Edition for Itanium-based Systems";
426                }
427
428                else if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) {
429                    if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
430                        sub = "Datacenter x64 Edition";
431                    else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
432                        sub = "Enterprise x64 Edition";
433                    else sub = "Standard x64 Edition";
434                } else {
435                    if ( osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER )
436                        sub = "Compute Cluster Edition";
437                    else if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
438                        sub = "Datacenter Edition";
439                    else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
440                        sub = "Enterprise Edition";
441                    else if ( osvi.wSuiteMask & VER_SUITE_BLADE )
442                        sub = "Web Edition";
443                    else sub = "Standard Edition";
444                }
445            }
446        }
447
448        if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) {
449            major = "Windows XP";
450            if( osvi.wSuiteMask & VER_SUITE_PERSONAL ) {
451                sub = "Home Edition";
452            } else if (GetSystemMetrics(SM_MEDIACENTER)) {
453                sub = "Media Center Edition";
454            } else if (GetSystemMetrics(SM_STARTER)) {
455                sub = "Starter Edition";
456            } else if (GetSystemMetrics(SM_TABLETPC)) {
457                sub = "Tablet PC Edition";
458            } else {
459                sub = "Professional";
460            }
461        }
462
463        if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) {
464            major = "Windows 2000";
465
466            if (osvi.wProductType == VER_NT_WORKSTATION ) {
467                sub = "Professional";
468            } else {
469                if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
470                    sub = "Datacenter Server";
471                else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
472                    sub = "Advanced Server";
473                else sub = "Server";
474            }
475        }
476    } else {
477        return NULL;
478    }
479
480    spprintf(&retval, 0, "%s%s%s%s%s", major, sub?" ":"", sub?sub:"", osvi.szCSDVersion[0] != '\0'?" ":"", osvi.szCSDVersion);
481    return retval;
482}
483/* }}}  */
484
485/* {{{  */
486void php_get_windows_cpu(char *buf, int bufsize)
487{
488    SYSTEM_INFO SysInfo;
489    GetSystemInfo(&SysInfo);
490    switch (SysInfo.wProcessorArchitecture) {
491        case PROCESSOR_ARCHITECTURE_INTEL :
492            snprintf(buf, bufsize, "i%d", SysInfo.dwProcessorType);
493            break;
494        case PROCESSOR_ARCHITECTURE_MIPS :
495            snprintf(buf, bufsize, "MIPS R%d000", SysInfo.wProcessorLevel);
496            break;
497        case PROCESSOR_ARCHITECTURE_ALPHA :
498            snprintf(buf, bufsize, "Alpha %d", SysInfo.wProcessorLevel);
499            break;
500        case PROCESSOR_ARCHITECTURE_PPC :
501            snprintf(buf, bufsize, "PPC 6%02d", SysInfo.wProcessorLevel);
502            break;
503        case PROCESSOR_ARCHITECTURE_IA64 :
504            snprintf(buf, bufsize,  "IA64");
505            break;
506#if defined(PROCESSOR_ARCHITECTURE_IA32_ON_WIN64)
507        case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 :
508            snprintf(buf, bufsize, "IA32");
509            break;
510#endif
511#if defined(PROCESSOR_ARCHITECTURE_AMD64)
512        case PROCESSOR_ARCHITECTURE_AMD64 :
513            snprintf(buf, bufsize, "AMD64");
514            break;
515#endif
516        case PROCESSOR_ARCHITECTURE_UNKNOWN :
517        default:
518            snprintf(buf, bufsize, "Unknown");
519            break;
520    }
521}
522/* }}}  */
523#endif
524
525/* {{{ php_get_uname
526 */
527PHPAPI char *php_get_uname(char mode)
528{
529    char *php_uname;
530    char tmp_uname[256];
531#ifdef PHP_WIN32
532    DWORD dwBuild=0;
533    DWORD dwVersion = GetVersion();
534    DWORD dwWindowsMajorVersion =  (DWORD)(LOBYTE(LOWORD(dwVersion)));
535    DWORD dwWindowsMinorVersion =  (DWORD)(HIBYTE(LOWORD(dwVersion)));
536    DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
537    char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
538
539    GetComputerName(ComputerName, &dwSize);
540
541    if (mode == 's') {
542        php_uname = "Windows NT";
543    } else if (mode == 'r') {
544        snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d", dwWindowsMajorVersion, dwWindowsMinorVersion);
545        php_uname = tmp_uname;
546    } else if (mode == 'n') {
547        php_uname = ComputerName;
548    } else if (mode == 'v') {
549        char *winver = php_get_windows_name();
550        dwBuild = (DWORD)(HIWORD(dwVersion));
551        if(winver == NULL) {
552            snprintf(tmp_uname, sizeof(tmp_uname), "build %d", dwBuild);
553        } else {
554            snprintf(tmp_uname, sizeof(tmp_uname), "build %d (%s)", dwBuild, winver);
555        }
556        php_uname = tmp_uname;
557        if(winver) {
558            efree(winver);
559        }
560    } else if (mode == 'm') {
561        php_get_windows_cpu(tmp_uname, sizeof(tmp_uname));
562        php_uname = tmp_uname;
563    } else { /* assume mode == 'a' */
564        char *winver = php_get_windows_name();
565        char wincpu[20];
566
567        php_get_windows_cpu(wincpu, sizeof(wincpu));
568        dwBuild = (DWORD)(HIWORD(dwVersion));
569        snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d build %d (%s) %s",
570                 "Windows NT", ComputerName,
571                 dwWindowsMajorVersion, dwWindowsMinorVersion, dwBuild, winver?winver:"unknown", wincpu);
572        if(winver) {
573            efree(winver);
574        }
575        php_uname = tmp_uname;
576    }
577#else
578#ifdef HAVE_SYS_UTSNAME_H
579    struct utsname buf;
580    if (uname((struct utsname *)&buf) == -1) {
581        php_uname = PHP_UNAME;
582    } else {
583#ifdef NETWARE
584        if (mode == 's') {
585            php_uname = buf.sysname;
586        } else if (mode == 'r') {
587            snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d",
588                     buf.netware_major, buf.netware_minor, buf.netware_revision);
589            php_uname = tmp_uname;
590        } else if (mode == 'n') {
591            php_uname = buf.servername;
592        } else if (mode == 'v') {
593            snprintf(tmp_uname, sizeof(tmp_uname), "libc-%d.%d.%d #%d",
594                     buf.libmajor, buf.libminor, buf.librevision, buf.libthreshold);
595            php_uname = tmp_uname;
596        } else if (mode == 'm') {
597            php_uname = buf.machine;
598        } else { /* assume mode == 'a' */
599            snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d.%d libc-%d.%d.%d #%d %s",
600                     buf.sysname, buf.servername,
601                     buf.netware_major, buf.netware_minor, buf.netware_revision,
602                     buf.libmajor, buf.libminor, buf.librevision, buf.libthreshold,
603                     buf.machine);
604            php_uname = tmp_uname;
605        }
606#else
607        if (mode == 's') {
608            php_uname = buf.sysname;
609        } else if (mode == 'r') {
610            php_uname = buf.release;
611        } else if (mode == 'n') {
612            php_uname = buf.nodename;
613        } else if (mode == 'v') {
614            php_uname = buf.version;
615        } else if (mode == 'm') {
616            php_uname = buf.machine;
617        } else { /* assume mode == 'a' */
618            snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %s %s %s",
619                     buf.sysname, buf.nodename, buf.release, buf.version,
620                     buf.machine);
621            php_uname = tmp_uname;
622        }
623#endif /* NETWARE */
624    }
625#else
626    php_uname = PHP_UNAME;
627#endif
628#endif
629    return estrdup(php_uname);
630}
631/* }}} */
632
633/* {{{ php_print_info_htmlhead
634 */
635PHPAPI void php_print_info_htmlhead(TSRMLS_D)
636{
637    php_info_print("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n");
638    php_info_print("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
639    php_info_print("<head>\n");
640    php_info_print_style(TSRMLS_C);
641    php_info_print("<title>phpinfo()</title>");
642    php_info_print("<meta name=\"ROBOTS\" content=\"NOINDEX,NOFOLLOW,NOARCHIVE\" />");
643    php_info_print("</head>\n");
644    php_info_print("<body><div class=\"center\">\n");
645}
646/* }}} */
647
648/* {{{ module_name_cmp */
649static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
650{
651    Bucket *f = *((Bucket **) a);
652    Bucket *s = *((Bucket **) b);
653
654    return strcasecmp(((zend_module_entry *)f->pData)->name,
655                  ((zend_module_entry *)s->pData)->name);
656}
657/* }}} */
658
659/* {{{ php_print_info
660 */
661PHPAPI void php_print_info(int flag TSRMLS_DC)
662{
663    char **env, *tmp1, *tmp2;
664    char *php_uname;
665
666    if (!sapi_module.phpinfo_as_text) {
667        php_print_info_htmlhead(TSRMLS_C);
668    } else {
669        php_info_print("phpinfo()\n");
670    }
671
672    if (flag & PHP_INFO_GENERAL) {
673        char *zend_version = get_zend_version();
674        char temp_api[10];
675
676        php_uname = php_get_uname('a');
677
678        if (!sapi_module.phpinfo_as_text) {
679            php_info_print_box_start(1);
680        }
681
682        if (!sapi_module.phpinfo_as_text) {
683            time_t the_time;
684            struct tm *ta, tmbuf;
685
686            the_time = time(NULL);
687            ta = php_localtime_r(&the_time, &tmbuf);
688
689            php_info_print("<a href=\"http://www.php.net/\"><img border=\"0\" src=\"");
690            if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) {
691                php_info_print(PHP_EGG_LOGO_DATA_URI "\" alt=\"PHP logo\" /></a>");
692            } else {
693                php_info_print(PHP_LOGO_DATA_URI "\" alt=\"PHP logo\" /></a>");
694            }
695        }
696
697        if (!sapi_module.phpinfo_as_text) {
698            php_info_printf("<h1 class=\"p\">PHP Version %s</h1>\n", PHP_VERSION);
699        } else {
700            php_info_print_table_row(2, "PHP Version", PHP_VERSION);
701        }
702        php_info_print_box_end();
703        php_info_print_table_start();
704        php_info_print_table_row(2, "System", php_uname );
705        php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ );
706#ifdef COMPILER
707        php_info_print_table_row(2, "Compiler", COMPILER);
708#endif
709#ifdef ARCHITECTURE
710        php_info_print_table_row(2, "Architecture", ARCHITECTURE);
711#endif
712#ifdef CONFIGURE_COMMAND
713        php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
714#endif
715
716        if (sapi_module.pretty_name) {
717            php_info_print_table_row(2, "Server API", sapi_module.pretty_name );
718        }
719
720#ifdef VIRTUAL_DIR
721        php_info_print_table_row(2, "Virtual Directory Support", "enabled" );
722#else
723        php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
724#endif
725
726        php_info_print_table_row(2, "Configuration File (php.ini) Path", PHP_CONFIG_FILE_PATH);
727        php_info_print_table_row(2, "Loaded Configuration File", php_ini_opened_path ? php_ini_opened_path : "(none)");
728        php_info_print_table_row(2, "Scan this dir for additional .ini files", php_ini_scanned_path ? php_ini_scanned_path : "(none)");
729        php_info_print_table_row(2, "Additional .ini files parsed", php_ini_scanned_files ? php_ini_scanned_files : "(none)");
730
731        snprintf(temp_api, sizeof(temp_api), "%d", PHP_API_VERSION);
732        php_info_print_table_row(2, "PHP API", temp_api);
733
734        snprintf(temp_api, sizeof(temp_api), "%d", ZEND_MODULE_API_NO);
735        php_info_print_table_row(2, "PHP Extension", temp_api);
736
737        snprintf(temp_api, sizeof(temp_api), "%d", ZEND_EXTENSION_API_NO);
738        php_info_print_table_row(2, "Zend Extension", temp_api);
739
740        php_info_print_table_row(2, "Zend Extension Build", ZEND_EXTENSION_BUILD_ID);
741        php_info_print_table_row(2, "PHP Extension Build", ZEND_MODULE_BUILD_ID);
742
743#if ZEND_DEBUG
744        php_info_print_table_row(2, "Debug Build", "yes" );
745#else
746        php_info_print_table_row(2, "Debug Build", "no" );
747#endif
748
749#ifdef ZTS
750        php_info_print_table_row(2, "Thread Safety", "enabled" );
751#else
752        php_info_print_table_row(2, "Thread Safety", "disabled" );
753#endif
754
755#ifdef ZEND_SIGNALS
756        php_info_print_table_row(2, "Zend Signal Handling", "enabled" );
757#else
758        php_info_print_table_row(2, "Zend Signal Handling", "disabled" );
759#endif
760
761        php_info_print_table_row(2, "Zend Memory Manager", is_zend_mm(TSRMLS_C) ? "enabled" : "disabled" );
762
763        {
764            const zend_multibyte_functions *functions = zend_multibyte_get_functions(TSRMLS_C);
765            char *descr;
766            if (functions) {
767                spprintf(&descr, 0, "provided by %s", functions->provider_name);
768            } else {
769                descr = estrdup("disabled");
770            }
771            php_info_print_table_row(2, "Zend Multibyte Support", descr);
772            efree(descr);
773        }
774
775#if HAVE_IPV6
776        php_info_print_table_row(2, "IPv6 Support", "enabled" );
777#else
778        php_info_print_table_row(2, "IPv6 Support", "disabled" );
779#endif
780
781#if HAVE_DTRACE
782        php_info_print_table_row(2, "DTrace Support", "enabled" );
783#else
784        php_info_print_table_row(2, "DTrace Support", "disabled" );
785#endif
786
787        php_info_print_stream_hash("PHP Streams",  php_stream_get_url_stream_wrappers_hash() TSRMLS_CC);
788        php_info_print_stream_hash("Stream Socket Transports", php_stream_xport_get_hash() TSRMLS_CC);
789        php_info_print_stream_hash("Stream Filters", php_get_stream_filters_hash() TSRMLS_CC);
790
791        php_info_print_table_end();
792
793        /* Zend Engine */
794        php_info_print_box_start(0);
795        if (!sapi_module.phpinfo_as_text) {
796            php_info_print("<a href=\"http://www.zend.com/\"><img border=\"0\" src=\"");
797            php_info_print(ZEND_LOGO_DATA_URI "\" alt=\"Zend logo\" /></a>\n");
798        }
799        php_info_print("This program makes use of the Zend Scripting Language Engine:");
800        php_info_print(!sapi_module.phpinfo_as_text?"<br />":"\n");
801        if (sapi_module.phpinfo_as_text) {
802            php_info_print(zend_version);
803        } else {
804            zend_html_puts(zend_version, strlen(zend_version) TSRMLS_CC);
805        }
806        php_info_print_box_end();
807        efree(php_uname);
808    }
809
810    zend_ini_sort_entries(TSRMLS_C);
811
812    if (flag & PHP_INFO_CONFIGURATION) {
813        php_info_print_hr();
814        if (!sapi_module.phpinfo_as_text) {
815            php_info_print("<h1>Configuration</h1>\n");
816        } else {
817            SECTION("Configuration");
818        }
819        if (!(flag & PHP_INFO_MODULES)) {
820            SECTION("PHP Core");
821            display_ini_entries(NULL);
822        }
823    }
824
825    if (flag & PHP_INFO_MODULES) {
826        HashTable sorted_registry;
827        zend_module_entry tmp;
828
829        zend_hash_init(&sorted_registry, zend_hash_num_elements(&module_registry), NULL, NULL, 1);
830        zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, sizeof(zend_module_entry));
831        zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
832
833        zend_hash_apply(&sorted_registry, (apply_func_t) _display_module_info_func TSRMLS_CC);
834
835        SECTION("Additional Modules");
836        php_info_print_table_start();
837        php_info_print_table_header(1, "Module Name");
838        zend_hash_apply(&sorted_registry, (apply_func_t) _display_module_info_def TSRMLS_CC);
839        php_info_print_table_end();
840
841        zend_hash_destroy(&sorted_registry);
842    }
843
844    if (flag & PHP_INFO_ENVIRONMENT) {
845        SECTION("Environment");
846        php_info_print_table_start();
847        php_info_print_table_header(2, "Variable", "Value");
848        for (env=environ; env!=NULL && *env !=NULL; env++) {
849            tmp1 = estrdup(*env);
850            if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
851                efree(tmp1);
852                continue;
853            }
854            *tmp2 = 0;
855            tmp2++;
856            php_info_print_table_row(2, tmp1, tmp2);
857            efree(tmp1);
858        }
859        php_info_print_table_end();
860    }
861
862    if (flag & PHP_INFO_VARIABLES) {
863        zval **data;
864
865        SECTION("PHP Variables");
866
867        php_info_print_table_start();
868        php_info_print_table_header(2, "Variable", "Value");
869        if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) {
870            php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_PP(data));
871        }
872        if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
873            php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_PP(data));
874        }
875        if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
876            php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_PP(data));
877        }
878        if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
879            php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data));
880        }
881        php_print_gpcse_array(ZEND_STRL("_REQUEST") TSRMLS_CC);
882        php_print_gpcse_array(ZEND_STRL("_GET") TSRMLS_CC);
883        php_print_gpcse_array(ZEND_STRL("_POST") TSRMLS_CC);
884        php_print_gpcse_array(ZEND_STRL("_FILES") TSRMLS_CC);
885        php_print_gpcse_array(ZEND_STRL("_COOKIE") TSRMLS_CC);
886        php_print_gpcse_array(ZEND_STRL("_SERVER") TSRMLS_CC);
887        php_print_gpcse_array(ZEND_STRL("_ENV") TSRMLS_CC);
888        php_info_print_table_end();
889    }
890
891
892    if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) {
893        php_info_print_hr();
894        php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE TSRMLS_CC);
895    }
896
897    if (flag & PHP_INFO_LICENSE) {
898        if (!sapi_module.phpinfo_as_text) {
899            SECTION("PHP License");
900            php_info_print_box_start(0);
901            php_info_print("<p>\n");
902            php_info_print("This program is free software; you can redistribute it and/or modify ");
903            php_info_print("it under the terms of the PHP License as published by the PHP Group ");
904            php_info_print("and included in the distribution in the file:  LICENSE\n");
905            php_info_print("</p>\n");
906            php_info_print("<p>");
907            php_info_print("This program is distributed in the hope that it will be useful, ");
908            php_info_print("but WITHOUT ANY WARRANTY; without even the implied warranty of ");
909            php_info_print("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
910            php_info_print("</p>\n");
911            php_info_print("<p>");
912            php_info_print("If you did not receive a copy of the PHP license, or have any questions about ");
913            php_info_print("PHP licensing, please contact license@php.net.\n");
914            php_info_print("</p>\n");
915            php_info_print_box_end();
916        } else {
917            php_info_print("\nPHP License\n");
918            php_info_print("This program is free software; you can redistribute it and/or modify\n");
919            php_info_print("it under the terms of the PHP License as published by the PHP Group\n");
920            php_info_print("and included in the distribution in the file:  LICENSE\n");
921            php_info_print("\n");
922            php_info_print("This program is distributed in the hope that it will be useful,\n");
923            php_info_print("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
924            php_info_print("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
925            php_info_print("\n");
926            php_info_print("If you did not receive a copy of the PHP license, or have any\n");
927            php_info_print("questions about PHP licensing, please contact license@php.net.\n");
928        }
929    }
930
931    if (!sapi_module.phpinfo_as_text) {
932        php_info_print("</div></body></html>");
933    }
934}
935/* }}} */
936
937PHPAPI void php_info_print_table_start(void) /* {{{ */
938{
939    if (!sapi_module.phpinfo_as_text) {
940        php_info_print("<table>\n");
941    } else {
942        php_info_print("\n");
943    }
944}
945/* }}} */
946
947PHPAPI void php_info_print_table_end(void) /* {{{ */
948{
949    if (!sapi_module.phpinfo_as_text) {
950        php_info_print("</table>\n");
951    }
952
953}
954/* }}} */
955
956PHPAPI void php_info_print_box_start(int flag) /* {{{ */
957{
958    php_info_print_table_start();
959    if (flag) {
960        if (!sapi_module.phpinfo_as_text) {
961            php_info_print("<tr class=\"h\"><td>\n");
962        }
963    } else {
964        if (!sapi_module.phpinfo_as_text) {
965            php_info_print("<tr class=\"v\"><td>\n");
966        } else {
967            php_info_print("\n");
968        }
969    }
970}
971/* }}} */
972
973PHPAPI void php_info_print_box_end(void) /* {{{ */
974{
975    if (!sapi_module.phpinfo_as_text) {
976        php_info_print("</td></tr>\n");
977    }
978    php_info_print_table_end();
979}
980/* }}} */
981
982PHPAPI void php_info_print_hr(void) /* {{{ */
983{
984    if (!sapi_module.phpinfo_as_text) {
985        php_info_print("<hr />\n");
986    } else {
987        php_info_print("\n\n _______________________________________________________________________\n\n");
988    }
989}
990/* }}} */
991
992PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) /* {{{ */
993{
994    int spaces;
995
996    if (!sapi_module.phpinfo_as_text) {
997        php_info_printf("<tr class=\"h\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header );
998    } else {
999        spaces = (74 - strlen(header));
1000        php_info_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " ");
1001    }
1002}
1003/* }}} */
1004
1005/* {{{ php_info_print_table_header
1006 */
1007PHPAPI void php_info_print_table_header(int num_cols, ...)
1008{
1009    int i;
1010    va_list row_elements;
1011    char *row_element;
1012
1013    va_start(row_elements, num_cols);
1014    if (!sapi_module.phpinfo_as_text) {
1015        php_info_print("<tr class=\"h\">");
1016    }
1017    for (i=0; i<num_cols; i++) {
1018        row_element = va_arg(row_elements, char *);
1019        if (!row_element || !*row_element) {
1020            row_element = " ";
1021        }
1022        if (!sapi_module.phpinfo_as_text) {
1023            php_info_print("<th>");
1024            php_info_print(row_element);
1025            php_info_print("</th>");
1026        } else {
1027            php_info_print(row_element);
1028            if (i < num_cols-1) {
1029                php_info_print(" => ");
1030            } else {
1031                php_info_print("\n");
1032            }
1033        }
1034    }
1035    if (!sapi_module.phpinfo_as_text) {
1036        php_info_print("</tr>\n");
1037    }
1038
1039    va_end(row_elements);
1040}
1041/* }}} */
1042
1043/* {{{ php_info_print_table_row_internal
1044 */
1045static void php_info_print_table_row_internal(int num_cols,
1046        const char *value_class, va_list row_elements)
1047{
1048    int i;
1049    char *row_element;
1050
1051    if (!sapi_module.phpinfo_as_text) {
1052        php_info_print("<tr>");
1053    }
1054    for (i=0; i<num_cols; i++) {
1055        if (!sapi_module.phpinfo_as_text) {
1056            php_info_printf("<td class=\"%s\">",
1057               (i==0 ? "e" : value_class )
1058            );
1059        }
1060        row_element = va_arg(row_elements, char *);
1061        if (!row_element || !*row_element) {
1062            if (!sapi_module.phpinfo_as_text) {
1063                php_info_print( "<i>no value</i>" );
1064            } else {
1065                php_info_print( " " );
1066            }
1067        } else {
1068            if (!sapi_module.phpinfo_as_text) {
1069                php_info_print_html_esc(row_element, strlen(row_element));
1070            } else {
1071                php_info_print(row_element);
1072                if (i < num_cols-1) {
1073                    php_info_print(" => ");
1074                }
1075            }
1076        }
1077        if (!sapi_module.phpinfo_as_text) {
1078            php_info_print(" </td>");
1079        } else if (i == (num_cols - 1)) {
1080            php_info_print("\n");
1081        }
1082    }
1083    if (!sapi_module.phpinfo_as_text) {
1084        php_info_print("</tr>\n");
1085    }
1086}
1087/* }}} */
1088
1089/* {{{ php_info_print_table_row
1090 */
1091PHPAPI void php_info_print_table_row(int num_cols, ...)
1092{
1093    va_list row_elements;
1094
1095    va_start(row_elements, num_cols);
1096    php_info_print_table_row_internal(num_cols, "v", row_elements);
1097    va_end(row_elements);
1098}
1099/* }}} */
1100
1101/* {{{ php_info_print_table_row_ex
1102 */
1103PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class,
1104        ...)
1105{
1106    va_list row_elements;
1107
1108    va_start(row_elements, value_class);
1109    php_info_print_table_row_internal(num_cols, value_class, row_elements);
1110    va_end(row_elements);
1111}
1112/* }}} */
1113
1114/* {{{ register_phpinfo_constants
1115 */
1116void register_phpinfo_constants(INIT_FUNC_ARGS)
1117{
1118    REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS);
1119    REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS);
1120    REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS);
1121    REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS);
1122    REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS);
1123    REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS);
1124    REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS);
1125    REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS);
1126    REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS);
1127    REGISTER_LONG_CONSTANT("CREDITS_GENERAL",   PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS);
1128    REGISTER_LONG_CONSTANT("CREDITS_SAPI",  PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS);
1129    REGISTER_LONG_CONSTANT("CREDITS_MODULES",   PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS);
1130    REGISTER_LONG_CONSTANT("CREDITS_DOCS",  PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS);
1131    REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE",  PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS);
1132    REGISTER_LONG_CONSTANT("CREDITS_QA",    PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS);
1133    REGISTER_LONG_CONSTANT("CREDITS_ALL",   PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS);
1134}
1135/* }}} */
1136
1137/* {{{ proto void phpinfo([int what])
1138   Output a page of useful information about PHP and the current request */
1139PHP_FUNCTION(phpinfo)
1140{
1141    long flag = PHP_INFO_ALL;
1142
1143    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
1144        return;
1145    }
1146
1147    /* Andale!  Andale!  Yee-Hah! */
1148    php_output_start_default(TSRMLS_C);
1149    php_print_info(flag TSRMLS_CC);
1150    php_output_end(TSRMLS_C);
1151
1152    RETURN_TRUE;
1153}
1154
1155/* }}} */
1156
1157/* {{{ proto string phpversion([string extension])
1158   Return the current PHP version */
1159PHP_FUNCTION(phpversion)
1160{
1161    char *ext_name = NULL;
1162    int ext_name_len = 0;
1163
1164    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ext_name, &ext_name_len) == FAILURE) {
1165        return;
1166    }
1167
1168    if (!ext_name) {
1169        RETURN_STRING(PHP_VERSION, 1);
1170    } else {
1171        const char *version;
1172        version = zend_get_module_version(ext_name);
1173        if (version == NULL) {
1174            RETURN_FALSE;
1175        }
1176        RETURN_STRING(version, 1);
1177    }
1178}
1179/* }}} */
1180
1181/* {{{ proto void phpcredits([int flag])
1182   Prints the list of people who've contributed to the PHP project */
1183PHP_FUNCTION(phpcredits)
1184{
1185    long flag = PHP_CREDITS_ALL;
1186
1187    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
1188        return;
1189    }
1190
1191    php_print_credits(flag TSRMLS_CC);
1192    RETURN_TRUE;
1193}
1194/* }}} */
1195
1196/* {{{ proto string php_sapi_name(void)
1197   Return the current SAPI module name */
1198PHP_FUNCTION(php_sapi_name)
1199{
1200    if (zend_parse_parameters_none() == FAILURE) {
1201        return;
1202    }
1203
1204    if (sapi_module.name) {
1205        RETURN_STRING(sapi_module.name, 1);
1206    } else {
1207        RETURN_FALSE;
1208    }
1209}
1210
1211/* }}} */
1212
1213/* {{{ proto string php_uname(void)
1214   Return information about the system PHP was built on */
1215PHP_FUNCTION(php_uname)
1216{
1217    char *mode = "a";
1218    int modelen = sizeof("a")-1;
1219
1220    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) {
1221        return;
1222    }
1223    RETURN_STRING(php_get_uname(*mode), 0);
1224}
1225
1226/* }}} */
1227
1228/* {{{ proto string php_ini_scanned_files(void)
1229   Return comma-separated string of .ini files parsed from the additional ini dir */
1230PHP_FUNCTION(php_ini_scanned_files)
1231{
1232    if (zend_parse_parameters_none() == FAILURE) {
1233        return;
1234    }
1235
1236    if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) {
1237        RETURN_STRING(php_ini_scanned_files, 1);
1238    } else {
1239        RETURN_FALSE;
1240    }
1241}
1242/* }}} */
1243
1244/* {{{ proto string php_ini_loaded_file(void)
1245   Return the actual loaded ini filename */
1246PHP_FUNCTION(php_ini_loaded_file)
1247{
1248    if (zend_parse_parameters_none() == FAILURE) {
1249        return;
1250    }
1251
1252    if (php_ini_opened_path) {
1253        RETURN_STRING(php_ini_opened_path, 1);
1254    } else {
1255        RETURN_FALSE;
1256    }
1257}
1258/* }}} */
1259
1260/*
1261 * Local variables:
1262 * tab-width: 4
1263 * c-basic-offset: 4
1264 * End:
1265 * vim600: sw=4 ts=4 fdm=marker
1266 * vim<600: sw=4 ts=4
1267 */
1268