2000-02-24 09:32:50 +00:00
|
|
|
/*
|
1999-04-17 00:37:12 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2019-01-30 09:03:12 +00:00
|
|
|
| Copyright (c) The PHP Group |
|
1999-04-17 00:37:12 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 12:51:34 +00:00
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
1999-07-16 13:13:16 +00:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-10 20:04:29 +00:00
|
|
|
| available through the world-wide-web at the following url: |
|
2006-01-01 12:51:34 +00:00
|
|
|
| http://www.php.net/license/3_01.txt |
|
1999-07-16 13:13:16 +00: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 00:37:12 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2002-02-28 08:29:35 +00:00
|
|
|
| Author: Thies C. Arntzen <thies@thieso.net> |
|
1999-04-17 00:37:12 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
1999-10-05 14:36:00 +00:00
|
|
|
/* {{{ includes/startup/misc */
|
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
#include "php.h"
|
2001-02-23 22:07:16 +00:00
|
|
|
#include "fopen_wrappers.h"
|
2002-04-16 22:14:27 +00:00
|
|
|
#include "file.h"
|
1999-12-04 19:19:57 +00:00
|
|
|
#include "php_dir.h"
|
2007-06-12 12:53:08 +00:00
|
|
|
#include "php_string.h"
|
2003-02-19 09:27:29 +00:00
|
|
|
#include "php_scandir.h"
|
2008-08-11 22:38:31 +00:00
|
|
|
#include "basic_functions.h"
|
2020-03-29 18:24:16 +00:00
|
|
|
#include "dir_arginfo.h"
|
1999-04-17 00:37:12 +00:00
|
|
|
|
|
|
|
#if HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
2000-02-11 15:59:30 +00:00
|
|
|
#ifdef PHP_WIN32
|
1999-04-17 00:37:12 +00:00
|
|
|
#include "win32/readdir.h"
|
|
|
|
#endif
|
|
|
|
|
2003-01-28 01:48:57 +00:00
|
|
|
|
2002-03-21 19:18:13 +00:00
|
|
|
#ifdef HAVE_GLOB
|
2002-05-19 14:32:24 +00:00
|
|
|
#ifndef PHP_WIN32
|
2002-03-21 19:18:13 +00:00
|
|
|
#include <glob.h>
|
2002-05-19 14:32:24 +00:00
|
|
|
#else
|
|
|
|
#include "win32/glob.h"
|
|
|
|
#endif
|
2002-03-21 19:18:13 +00:00
|
|
|
#endif
|
|
|
|
|
1999-10-05 14:36:00 +00:00
|
|
|
typedef struct {
|
2014-02-13 13:54:23 +00:00
|
|
|
zend_resource *default_dir;
|
1999-10-05 14:36:00 +00:00
|
|
|
} php_dir_globals;
|
|
|
|
|
|
|
|
#ifdef ZTS
|
2014-10-05 17:49:41 +00:00
|
|
|
#define DIRG(v) ZEND_TSRMG(dir_globals_id, php_dir_globals *, v)
|
reworked the patch, less new stuff but worky
TLS is already used in TSRM, the way exporting the tsrm cache through
a thread local variable is not portable. Additionally, the current
patch suffers from bugs which are hard to find, but prevent it to
be worky with apache. What is done here is mainly uses the idea
from the RFC patch, but
- __thread variable is removed
- offset math and declarations are removed
- extra macros and definitions are removed
What is done merely is
- use an inline function to access the tsrm cache. The function uses
the portable tsrm_tls_get macro which is cheap
- all the TSRM_* macros are set to placebo. Thus this opens the way
remove them later
Except that, the logic is old. TSRMLS_FETCH will have to be done once
per thread, then tsrm_get_ls_cache() can be used. Things seeming to be
worky are cli, cli server and apache. I also tried to enable bz2
shared and it has worked out of the box. The change is yet minimal
diffing to the current master bus is a worky start, IMHO. Though will
have to recheck the other previously done SAPIs - embed and cgi.
The offsets can be added to the tsrm_resource_type struct, then
it'll not be needed to declare them in the userspace. Even the
"done" member type can be changed to int16 or smaller, then adding
the offset as int16 will not change the struct size. As well on the
todo might be removing the hashed storage, thread_id != thread_id and
linked list logic in favour of the explicit TLS operations.
2014-09-25 16:48:27 +00:00
|
|
|
int dir_globals_id;
|
1999-10-05 14:36:00 +00:00
|
|
|
#else
|
2000-06-27 18:44:30 +00:00
|
|
|
#define DIRG(v) (dir_globals.v)
|
1999-10-05 14:36:00 +00:00
|
|
|
php_dir_globals dir_globals;
|
|
|
|
#endif
|
|
|
|
|
1999-05-28 11:09:39 +00:00
|
|
|
static zend_class_entry *dir_class_entry_ptr;
|
1999-04-17 00:37:12 +00:00
|
|
|
|
1999-10-05 14:36:00 +00:00
|
|
|
#define FETCH_DIRP() \
|
2020-09-29 12:48:31 +00:00
|
|
|
myself = getThis(); \
|
|
|
|
if (!myself) { \
|
|
|
|
ZEND_PARSE_PARAMETERS_START(0, 1) \
|
|
|
|
Z_PARAM_OPTIONAL \
|
|
|
|
Z_PARAM_RESOURCE_OR_NULL(id) \
|
|
|
|
ZEND_PARSE_PARAMETERS_END(); \
|
|
|
|
if (id) { \
|
|
|
|
if ((dirp = (php_stream *)zend_fetch_resource(Z_RES_P(id), "Directory", php_file_le_stream())) == NULL) { \
|
2020-01-03 18:16:51 +00:00
|
|
|
RETURN_THROWS(); \
|
2015-02-02 05:23:16 +00:00
|
|
|
} \
|
1999-10-05 14:36:00 +00:00
|
|
|
} else { \
|
2020-01-28 11:33:58 +00:00
|
|
|
if (!DIRG(default_dir)) { \
|
|
|
|
zend_type_error("No resource supplied"); \
|
|
|
|
RETURN_THROWS(); \
|
2020-09-29 12:48:31 +00:00
|
|
|
} \
|
|
|
|
if ((dirp = (php_stream *)zend_fetch_resource(DIRG(default_dir), "Directory", php_file_le_stream())) == NULL) { \
|
2020-01-03 18:16:51 +00:00
|
|
|
RETURN_THROWS(); \
|
2015-02-02 05:23:16 +00:00
|
|
|
} \
|
1999-10-05 14:36:00 +00:00
|
|
|
} \
|
|
|
|
} else { \
|
2020-09-29 12:48:31 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_NONE(); \
|
|
|
|
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(myself), "handle", sizeof("handle")-1)) == NULL) { \
|
|
|
|
zend_throw_error(NULL, "Unable to find my handle property"); \
|
|
|
|
RETURN_THROWS(); \
|
|
|
|
} \
|
|
|
|
if ((dirp = (php_stream *)zend_fetch_resource_ex(tmp, "Directory", php_file_le_stream())) == NULL) { \
|
2020-01-03 18:16:51 +00:00
|
|
|
RETURN_THROWS(); \
|
2015-02-02 05:23:16 +00:00
|
|
|
} \
|
2015-01-03 09:22:58 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 11:09:39 +00:00
|
|
|
|
2014-12-13 22:06:14 +00:00
|
|
|
static void php_set_default_dir(zend_resource *res)
|
2000-06-27 18:44:30 +00:00
|
|
|
{
|
2014-02-13 13:54:23 +00:00
|
|
|
if (DIRG(default_dir)) {
|
2002-09-11 14:21:39 +00:00
|
|
|
zend_list_delete(DIRG(default_dir));
|
|
|
|
}
|
2000-11-04 14:58:50 +00:00
|
|
|
|
2014-02-13 13:54:23 +00:00
|
|
|
if (res) {
|
2017-10-26 22:28:58 +00:00
|
|
|
GC_ADDREF(res);
|
2000-11-04 14:58:50 +00:00
|
|
|
}
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2014-02-13 13:54:23 +00:00
|
|
|
DIRG(default_dir) = res;
|
2000-06-27 18:44:30 +00:00
|
|
|
}
|
|
|
|
|
2000-06-29 21:51:40 +00:00
|
|
|
PHP_RINIT_FUNCTION(dir)
|
1999-10-05 14:36:00 +00:00
|
|
|
{
|
2014-02-13 13:54:23 +00:00
|
|
|
DIRG(default_dir) = NULL;
|
2000-06-29 21:51:40 +00:00
|
|
|
return SUCCESS;
|
1999-10-05 14:36:00 +00:00
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
|
1999-07-26 20:09:08 +00:00
|
|
|
PHP_MINIT_FUNCTION(dir)
|
1999-04-17 00:37:12 +00:00
|
|
|
{
|
2002-11-14 22:50:01 +00:00
|
|
|
static char dirsep_str[2], pathsep_str[2];
|
1999-05-28 11:09:39 +00:00
|
|
|
zend_class_entry dir_class_entry;
|
|
|
|
|
2020-04-13 14:28:55 +00:00
|
|
|
INIT_CLASS_ENTRY(dir_class_entry, "Directory", class_Directory_methods);
|
2014-12-13 22:06:14 +00:00
|
|
|
dir_class_entry_ptr = zend_register_internal_class(&dir_class_entry);
|
1999-10-05 14:36:00 +00:00
|
|
|
|
|
|
|
#ifdef ZTS
|
reworked the patch, less new stuff but worky
TLS is already used in TSRM, the way exporting the tsrm cache through
a thread local variable is not portable. Additionally, the current
patch suffers from bugs which are hard to find, but prevent it to
be worky with apache. What is done here is mainly uses the idea
from the RFC patch, but
- __thread variable is removed
- offset math and declarations are removed
- extra macros and definitions are removed
What is done merely is
- use an inline function to access the tsrm cache. The function uses
the portable tsrm_tls_get macro which is cheap
- all the TSRM_* macros are set to placebo. Thus this opens the way
remove them later
Except that, the logic is old. TSRMLS_FETCH will have to be done once
per thread, then tsrm_get_ls_cache() can be used. Things seeming to be
worky are cli, cli server and apache. I also tried to enable bz2
shared and it has worked out of the box. The change is yet minimal
diffing to the current master bus is a worky start, IMHO. Though will
have to recheck the other previously done SAPIs - embed and cgi.
The offsets can be added to the tsrm_resource_type struct, then
it'll not be needed to declare them in the userspace. Even the
"done" member type can be changed to int16 or smaller, then adding
the offset as int16 will not change the struct size. As well on the
todo might be removing the hashed storage, thread_id != thread_id and
linked list logic in favour of the explicit TLS operations.
2014-09-25 16:48:27 +00:00
|
|
|
ts_allocate_id(&dir_globals_id, sizeof(php_dir_globals), NULL, NULL);
|
1999-10-05 14:36:00 +00:00
|
|
|
#endif
|
2003-07-14 16:23:14 +00:00
|
|
|
|
2002-11-14 22:50:01 +00:00
|
|
|
dirsep_str[0] = DEFAULT_SLASH;
|
|
|
|
dirsep_str[1] = '\0';
|
|
|
|
REGISTER_STRING_CONSTANT("DIRECTORY_SEPARATOR", dirsep_str, CONST_CS|CONST_PERSISTENT);
|
2003-07-14 16:23:14 +00:00
|
|
|
|
2002-11-15 07:21:33 +00:00
|
|
|
pathsep_str[0] = ZEND_PATHS_SEPARATOR;
|
|
|
|
pathsep_str[1] = '\0';
|
2002-11-14 22:50:01 +00:00
|
|
|
REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str, CONST_CS|CONST_PERSISTENT);
|
1999-10-05 14:36:00 +00:00
|
|
|
|
2014-08-25 17:24:55 +00:00
|
|
|
REGISTER_LONG_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT);
|
|
|
|
REGISTER_LONG_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT);
|
|
|
|
REGISTER_LONG_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT);
|
2010-11-26 09:52:28 +00:00
|
|
|
|
2002-09-26 07:15:33 +00:00
|
|
|
#ifdef HAVE_GLOB
|
2007-08-22 14:59:45 +00:00
|
|
|
|
2002-11-13 13:31:33 +00:00
|
|
|
#ifdef GLOB_BRACE
|
2014-08-25 17:24:55 +00:00
|
|
|
REGISTER_LONG_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT);
|
2007-08-22 14:59:45 +00:00
|
|
|
#else
|
|
|
|
# define GLOB_BRACE 0
|
2002-11-13 13:31:33 +00:00
|
|
|
#endif
|
2007-08-22 14:59:45 +00:00
|
|
|
|
2002-09-27 12:40:31 +00:00
|
|
|
#ifdef GLOB_MARK
|
2014-08-25 17:24:55 +00:00
|
|
|
REGISTER_LONG_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT);
|
2007-08-22 14:59:45 +00:00
|
|
|
#else
|
|
|
|
# define GLOB_MARK 0
|
2002-09-27 12:40:31 +00:00
|
|
|
#endif
|
2007-08-22 14:59:45 +00:00
|
|
|
|
2002-09-27 12:40:31 +00:00
|
|
|
#ifdef GLOB_NOSORT
|
2014-08-25 17:24:55 +00:00
|
|
|
REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT);
|
2015-01-03 09:22:58 +00:00
|
|
|
#else
|
2007-08-22 14:59:45 +00:00
|
|
|
# define GLOB_NOSORT 0
|
2002-09-27 12:40:31 +00:00
|
|
|
#endif
|
2007-08-22 14:59:45 +00:00
|
|
|
|
2002-09-27 12:40:31 +00:00
|
|
|
#ifdef GLOB_NOCHECK
|
2014-08-25 17:24:55 +00:00
|
|
|
REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT);
|
2015-01-03 09:22:58 +00:00
|
|
|
#else
|
2007-08-22 14:59:45 +00:00
|
|
|
# define GLOB_NOCHECK 0
|
2002-09-27 12:40:31 +00:00
|
|
|
#endif
|
2007-08-22 14:59:45 +00:00
|
|
|
|
2002-09-27 12:40:31 +00:00
|
|
|
#ifdef GLOB_NOESCAPE
|
2014-08-25 17:24:55 +00:00
|
|
|
REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT);
|
2015-01-03 09:22:58 +00:00
|
|
|
#else
|
2007-08-22 14:59:45 +00:00
|
|
|
# define GLOB_NOESCAPE 0
|
2002-09-26 11:19:26 +00:00
|
|
|
#endif
|
2007-08-22 14:59:45 +00:00
|
|
|
|
2005-06-12 07:53:24 +00:00
|
|
|
#ifdef GLOB_ERR
|
2014-08-25 17:24:55 +00:00
|
|
|
REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT);
|
2015-01-03 09:22:58 +00:00
|
|
|
#else
|
2007-08-22 14:59:45 +00:00
|
|
|
# define GLOB_ERR 0
|
2005-06-12 07:53:24 +00:00
|
|
|
#endif
|
2003-07-03 14:34:02 +00:00
|
|
|
|
|
|
|
#ifndef GLOB_ONLYDIR
|
2007-08-22 14:59:45 +00:00
|
|
|
# define GLOB_ONLYDIR (1<<30)
|
|
|
|
# define GLOB_EMULATE_ONLYDIR
|
|
|
|
# define GLOB_FLAGMASK (~GLOB_ONLYDIR)
|
2003-07-03 14:34:02 +00:00
|
|
|
#else
|
2007-08-22 14:59:45 +00:00
|
|
|
# define GLOB_FLAGMASK (~0)
|
2003-07-03 14:34:02 +00:00
|
|
|
#endif
|
|
|
|
|
2007-08-22 14:59:45 +00:00
|
|
|
/* This is used for checking validity of passed flags (passing invalid flags causes segfault in glob()!! */
|
|
|
|
#define GLOB_AVAILABLE_FLAGS (0 | GLOB_BRACE | GLOB_MARK | GLOB_NOSORT | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ERR | GLOB_ONLYDIR)
|
|
|
|
|
2014-08-25 17:24:55 +00:00
|
|
|
REGISTER_LONG_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT);
|
|
|
|
REGISTER_LONG_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT);
|
2003-07-03 14:34:02 +00:00
|
|
|
|
2003-07-14 16:23:14 +00:00
|
|
|
#endif /* HAVE_GLOB */
|
2002-09-26 00:27:52 +00:00
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
return SUCCESS;
|
|
|
|
}
|
1999-10-05 14:36:00 +00:00
|
|
|
/* }}} */
|
|
|
|
|
2003-07-14 16:23:14 +00:00
|
|
|
/* {{{ internal functions */
|
1999-10-05 14:36:00 +00:00
|
|
|
static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
|
1999-04-17 00:37:12 +00:00
|
|
|
{
|
2004-03-01 05:40:14 +00:00
|
|
|
char *dirname;
|
2014-08-27 13:31:48 +00:00
|
|
|
size_t dir_len;
|
2004-03-01 05:40:14 +00:00
|
|
|
zval *zcontext = NULL;
|
|
|
|
php_stream_context *context = NULL;
|
2002-04-16 22:14:27 +00:00
|
|
|
php_stream *dirp;
|
2004-03-01 05:40:14 +00:00
|
|
|
|
2016-12-30 21:21:11 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_START(1, 2)
|
|
|
|
Z_PARAM_PATH(dirname, dir_len)
|
|
|
|
Z_PARAM_OPTIONAL
|
2020-08-20 22:42:44 +00:00
|
|
|
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
2016-12-30 21:21:11 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_END();
|
2004-03-01 05:40:14 +00:00
|
|
|
|
2008-12-09 09:03:38 +00:00
|
|
|
context = php_stream_context_from_zval(zcontext, 0);
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2010-04-26 23:53:30 +00:00
|
|
|
dirp = php_stream_opendir(dirname, REPORT_ERRORS, context);
|
2001-04-29 17:57:23 +00:00
|
|
|
|
2002-04-16 22:14:27 +00:00
|
|
|
if (dirp == NULL) {
|
1999-04-17 00:37:12 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2008-07-23 11:25:14 +00:00
|
|
|
|
|
|
|
dirp->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2014-12-13 22:06:14 +00:00
|
|
|
php_set_default_dir(dirp->res);
|
1999-10-05 14:36:00 +00:00
|
|
|
|
|
|
|
if (createobject) {
|
|
|
|
object_init_ex(return_value, dir_class_entry_ptr);
|
2014-04-15 11:40:40 +00:00
|
|
|
add_property_stringl(return_value, "path", dirname, dir_len);
|
2014-02-13 13:54:23 +00:00
|
|
|
add_property_resource(return_value, "handle", dirp->res);
|
2002-04-16 22:14:27 +00:00
|
|
|
php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug */
|
1999-10-05 14:36:00 +00:00
|
|
|
} else {
|
2002-04-16 22:14:27 +00:00
|
|
|
php_stream_to_zval(dirp, return_value);
|
1999-10-05 14:36:00 +00:00
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
}
|
|
|
|
/* }}} */
|
2003-07-14 16:23:14 +00:00
|
|
|
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Open a directory and return a dir_handle */
|
1999-10-05 14:36:00 +00:00
|
|
|
PHP_FUNCTION(opendir)
|
|
|
|
{
|
2001-08-11 17:03:37 +00:00
|
|
|
_php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
1999-10-05 14:36:00 +00:00
|
|
|
}
|
|
|
|
/* }}} */
|
2003-07-14 16:23:14 +00:00
|
|
|
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Directory class with properties, handle and class and methods read, rewind and close */
|
1999-10-05 14:36:00 +00:00
|
|
|
PHP_FUNCTION(getdir)
|
|
|
|
{
|
2001-08-11 17:03:37 +00:00
|
|
|
_php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
1999-10-05 14:36:00 +00:00
|
|
|
}
|
|
|
|
/* }}} */
|
2003-07-14 16:23:14 +00:00
|
|
|
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Close directory connection identified by the dir_handle */
|
1999-05-16 11:19:26 +00:00
|
|
|
PHP_FUNCTION(closedir)
|
1999-04-17 00:37:12 +00:00
|
|
|
{
|
2014-02-13 13:54:23 +00:00
|
|
|
zval *id = NULL, *tmp, *myself;
|
2002-04-16 22:14:27 +00:00
|
|
|
php_stream *dirp;
|
2014-02-13 13:54:23 +00:00
|
|
|
zend_resource *res;
|
1999-10-05 14:36:00 +00:00
|
|
|
|
|
|
|
FETCH_DIRP();
|
|
|
|
|
2008-06-11 09:01:56 +00:00
|
|
|
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
|
2020-04-13 08:41:23 +00:00
|
|
|
zend_argument_type_error(1, "must be a valid Directory resource");
|
2020-01-01 13:23:21 +00:00
|
|
|
RETURN_THROWS();
|
2008-06-11 09:01:56 +00:00
|
|
|
}
|
|
|
|
|
2014-02-13 13:54:23 +00:00
|
|
|
res = dirp->res;
|
2014-03-09 12:08:06 +00:00
|
|
|
zend_list_close(dirp->res);
|
2008-03-05 12:10:02 +00:00
|
|
|
|
2014-02-13 13:54:23 +00:00
|
|
|
if (res == DIRG(default_dir)) {
|
2014-12-13 22:06:14 +00:00
|
|
|
php_set_default_dir(NULL);
|
2000-11-04 14:58:50 +00:00
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
}
|
2001-02-14 10:48:48 +00:00
|
|
|
/* }}} */
|
2001-02-15 00:43:44 +00:00
|
|
|
|
2001-09-12 02:07:46 +00:00
|
|
|
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Change root directory */
|
2001-02-14 10:48:48 +00:00
|
|
|
PHP_FUNCTION(chroot)
|
|
|
|
{
|
2001-12-30 09:50:41 +00:00
|
|
|
char *str;
|
2014-08-27 13:31:48 +00:00
|
|
|
int ret;
|
|
|
|
size_t str_len;
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2016-12-30 21:21:11 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_START(1, 1)
|
|
|
|
Z_PARAM_PATH(str, str_len)
|
2019-10-07 08:02:18 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_END();
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2002-09-11 14:21:39 +00:00
|
|
|
ret = chroot(str);
|
2001-02-14 10:48:48 +00:00
|
|
|
if (ret != 0) {
|
2014-12-13 22:06:14 +00:00
|
|
|
php_error_docref(NULL, E_WARNING, "%s (errno %d)", strerror(errno), errno);
|
2001-02-14 10:48:48 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-12-13 22:06:14 +00:00
|
|
|
php_clear_stat_cache(1, NULL, 0);
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2001-02-14 11:02:54 +00:00
|
|
|
ret = chdir("/");
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2001-02-14 11:02:54 +00:00
|
|
|
if (ret != 0) {
|
2014-12-13 22:06:14 +00:00
|
|
|
php_error_docref(NULL, E_WARNING, "%s (errno %d)", strerror(errno), errno);
|
2001-02-14 11:02:54 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
|
2001-02-14 10:48:48 +00:00
|
|
|
RETURN_TRUE;
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
/* }}} */
|
2001-02-15 00:43:44 +00:00
|
|
|
#endif
|
|
|
|
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Change the current directory */
|
1999-05-16 11:19:26 +00:00
|
|
|
PHP_FUNCTION(chdir)
|
1999-04-17 00:37:12 +00:00
|
|
|
{
|
2001-12-30 10:13:08 +00:00
|
|
|
char *str;
|
2014-08-27 13:31:48 +00:00
|
|
|
int ret;
|
|
|
|
size_t str_len;
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2016-12-30 21:21:11 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_START(1, 1)
|
|
|
|
Z_PARAM_PATH(str, str_len)
|
2019-10-07 08:02:18 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_END();
|
1999-04-17 00:37:12 +00:00
|
|
|
|
2014-12-13 22:06:14 +00:00
|
|
|
if (php_check_open_basedir(str)) {
|
2001-06-20 14:47:26 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2001-12-30 10:13:08 +00:00
|
|
|
ret = VCWD_CHDIR(str);
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2000-06-04 07:57:40 +00:00
|
|
|
if (ret != 0) {
|
2014-12-13 22:06:14 +00:00
|
|
|
php_error_docref(NULL, E_WARNING, "%s (errno %d)", strerror(errno), errno);
|
1999-04-17 00:37:12 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
1999-10-05 14:36:00 +00:00
|
|
|
|
2008-08-11 22:38:31 +00:00
|
|
|
if (BG(CurrentStatFile) && !IS_ABSOLUTE_PATH(BG(CurrentStatFile), strlen(BG(CurrentStatFile)))) {
|
|
|
|
efree(BG(CurrentStatFile));
|
|
|
|
BG(CurrentStatFile) = NULL;
|
|
|
|
}
|
|
|
|
if (BG(CurrentLStatFile) && !IS_ABSOLUTE_PATH(BG(CurrentLStatFile), strlen(BG(CurrentLStatFile)))) {
|
|
|
|
efree(BG(CurrentLStatFile));
|
|
|
|
BG(CurrentLStatFile) = NULL;
|
|
|
|
}
|
|
|
|
|
1999-04-17 00:37:12 +00:00
|
|
|
RETURN_TRUE;
|
|
|
|
}
|
1999-10-20 16:17:30 +00:00
|
|
|
/* }}} */
|
2003-07-14 16:23:14 +00:00
|
|
|
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Gets the current directory */
|
1999-10-20 16:17:30 +00:00
|
|
|
PHP_FUNCTION(getcwd)
|
|
|
|
{
|
|
|
|
char path[MAXPATHLEN];
|
1999-10-20 18:09:44 +00:00
|
|
|
char *ret=NULL;
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2019-12-29 20:14:36 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_NONE();
|
1999-10-20 16:17:30 +00:00
|
|
|
|
|
|
|
#if HAVE_GETCWD
|
2001-04-30 12:45:02 +00:00
|
|
|
ret = VCWD_GETCWD(path, MAXPATHLEN);
|
1999-10-20 16:17:30 +00:00
|
|
|
#elif HAVE_GETWD
|
2001-04-30 12:45:02 +00:00
|
|
|
ret = VCWD_GETWD(path);
|
1999-10-20 16:17:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (ret) {
|
2014-02-13 13:54:23 +00:00
|
|
|
RETURN_STRING(path);
|
1999-10-20 16:17:30 +00:00
|
|
|
} else {
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
}
|
1999-04-17 00:37:12 +00:00
|
|
|
/* }}} */
|
2003-07-14 16:23:14 +00:00
|
|
|
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Rewind dir_handle back to the start */
|
1999-05-16 11:19:26 +00:00
|
|
|
PHP_FUNCTION(rewinddir)
|
1999-04-17 00:37:12 +00:00
|
|
|
{
|
2014-02-13 13:54:23 +00:00
|
|
|
zval *id = NULL, *tmp, *myself;
|
2002-04-16 22:14:27 +00:00
|
|
|
php_stream *dirp;
|
2015-01-03 09:22:58 +00:00
|
|
|
|
1999-10-05 14:36:00 +00:00
|
|
|
FETCH_DIRP();
|
|
|
|
|
2008-06-11 09:01:56 +00:00
|
|
|
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
|
2020-04-13 08:41:23 +00:00
|
|
|
zend_argument_type_error(1, "must be a valid Directory resource");
|
2020-01-01 13:23:21 +00:00
|
|
|
RETURN_THROWS();
|
2008-06-11 09:01:56 +00:00
|
|
|
}
|
|
|
|
|
2002-04-16 22:14:27 +00:00
|
|
|
php_stream_rewinddir(dirp);
|
1999-04-17 00:37:12 +00:00
|
|
|
}
|
|
|
|
/* }}} */
|
2002-03-21 19:18:13 +00:00
|
|
|
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Read directory entry from dir_handle */
|
2020-02-21 14:33:58 +00:00
|
|
|
PHP_FUNCTION(readdir)
|
1999-04-17 00:37:12 +00:00
|
|
|
{
|
2014-02-13 13:54:23 +00:00
|
|
|
zval *id = NULL, *tmp, *myself;
|
2002-04-16 22:14:27 +00:00
|
|
|
php_stream *dirp;
|
|
|
|
php_stream_dirent entry;
|
1999-10-05 14:36:00 +00:00
|
|
|
|
|
|
|
FETCH_DIRP();
|
2000-05-23 15:13:16 +00:00
|
|
|
|
2008-06-11 09:01:56 +00:00
|
|
|
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
|
2020-04-16 22:09:15 +00:00
|
|
|
zend_argument_type_error(1, "must be a valid Directory resource");
|
2020-01-01 13:23:21 +00:00
|
|
|
RETURN_THROWS();
|
2008-06-11 09:01:56 +00:00
|
|
|
}
|
|
|
|
|
2002-04-16 22:14:27 +00:00
|
|
|
if (php_stream_readdir(dirp, &entry)) {
|
2014-02-13 13:54:23 +00:00
|
|
|
RETURN_STRINGL(entry.d_name, strlen(entry.d_name));
|
1999-04-17 00:37:12 +00:00
|
|
|
}
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
2002-03-21 19:18:13 +00:00
|
|
|
#ifdef HAVE_GLOB
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ Find pathnames matching a pattern */
|
2002-03-21 19:18:13 +00:00
|
|
|
PHP_FUNCTION(glob)
|
|
|
|
{
|
2016-12-22 13:56:47 +00:00
|
|
|
size_t cwd_skip = 0;
|
2002-10-04 18:03:29 +00:00
|
|
|
#ifdef ZTS
|
2007-06-12 13:42:32 +00:00
|
|
|
char cwd[MAXPATHLEN];
|
2002-09-26 00:27:52 +00:00
|
|
|
char work_pattern[MAXPATHLEN];
|
|
|
|
char *result;
|
2002-10-04 18:03:29 +00:00
|
|
|
#endif
|
2002-03-21 19:18:13 +00:00
|
|
|
char *pattern = NULL;
|
2014-08-27 13:31:48 +00:00
|
|
|
size_t pattern_len;
|
2014-08-25 17:24:55 +00:00
|
|
|
zend_long flags = 0;
|
2002-03-21 19:18:13 +00:00
|
|
|
glob_t globbuf;
|
2016-06-23 09:47:06 +00:00
|
|
|
size_t n;
|
2003-09-26 08:09:56 +00:00
|
|
|
int ret;
|
2021-01-15 11:30:54 +00:00
|
|
|
bool basedir_limit = 0;
|
2002-03-21 19:18:13 +00:00
|
|
|
|
2016-12-30 21:21:11 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_START(1, 2)
|
|
|
|
Z_PARAM_PATH(pattern, pattern_len)
|
|
|
|
Z_PARAM_OPTIONAL
|
|
|
|
Z_PARAM_LONG(flags)
|
|
|
|
ZEND_PARSE_PARAMETERS_END();
|
2007-08-22 14:59:45 +00:00
|
|
|
|
2007-09-04 12:51:49 +00:00
|
|
|
if (pattern_len >= MAXPATHLEN) {
|
2014-12-13 22:06:14 +00:00
|
|
|
php_error_docref(NULL, E_WARNING, "Pattern exceeds the maximum allowed length of %d characters", MAXPATHLEN);
|
2007-09-04 12:51:49 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
|
2007-08-22 14:59:45 +00:00
|
|
|
if ((GLOB_AVAILABLE_FLAGS & flags) != flags) {
|
2014-12-13 22:06:14 +00:00
|
|
|
php_error_docref(NULL, E_WARNING, "At least one of the passed flags is invalid or not supported on this platform");
|
2007-08-22 14:59:45 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2002-03-21 19:18:13 +00:00
|
|
|
|
2015-01-03 09:22:58 +00:00
|
|
|
#ifdef ZTS
|
2003-07-14 16:23:14 +00:00
|
|
|
if (!IS_ABSOLUTE_PATH(pattern, pattern_len)) {
|
2015-01-03 09:22:58 +00:00
|
|
|
result = VCWD_GETCWD(cwd, MAXPATHLEN);
|
2002-09-26 00:27:52 +00:00
|
|
|
if (!result) {
|
|
|
|
cwd[0] = '\0';
|
|
|
|
}
|
2003-09-20 02:51:20 +00:00
|
|
|
#ifdef PHP_WIN32
|
2004-06-07 18:30:16 +00:00
|
|
|
if (IS_SLASH(*pattern)) {
|
2003-09-20 02:51:20 +00:00
|
|
|
cwd[2] = '\0';
|
|
|
|
}
|
|
|
|
#endif
|
2016-12-22 13:56:47 +00:00
|
|
|
cwd_skip = strlen(cwd)+1;
|
2004-06-07 18:30:16 +00:00
|
|
|
|
2003-01-27 16:29:47 +00:00
|
|
|
snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern);
|
2002-09-26 00:27:52 +00:00
|
|
|
pattern = work_pattern;
|
2015-01-03 09:22:58 +00:00
|
|
|
}
|
2002-09-26 00:27:52 +00:00
|
|
|
#endif
|
|
|
|
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2007-07-16 20:29:21 +00:00
|
|
|
memset(&globbuf, 0, sizeof(glob_t));
|
2002-03-21 19:18:13 +00:00
|
|
|
globbuf.gl_offs = 0;
|
2003-07-03 14:34:02 +00:00
|
|
|
if (0 != (ret = glob(pattern, flags & GLOB_FLAGMASK, NULL, &globbuf))) {
|
2002-05-18 13:31:31 +00:00
|
|
|
#ifdef GLOB_NOMATCH
|
|
|
|
if (GLOB_NOMATCH == ret) {
|
2005-06-12 07:53:24 +00:00
|
|
|
/* Some glob implementation simply return no data if no matches
|
|
|
|
were found, others return the GLOB_NOMATCH error code.
|
|
|
|
We don't want to treat GLOB_NOMATCH as an error condition
|
2015-01-03 09:22:58 +00:00
|
|
|
so that PHP glob() behaves the same on both types of
|
2005-06-12 07:53:24 +00:00
|
|
|
implementations and so that 'foreach (glob() as ...'
|
|
|
|
can be used for simple glob() calls without further error
|
|
|
|
checking.
|
|
|
|
*/
|
2007-09-19 22:37:58 +00:00
|
|
|
goto no_results;
|
2002-05-18 13:31:31 +00:00
|
|
|
}
|
|
|
|
#endif
|
2002-03-21 19:18:13 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
|
2003-06-04 05:45:54 +00:00
|
|
|
/* now catch the FreeBSD style of "no matches" */
|
2003-10-29 18:48:37 +00:00
|
|
|
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
|
2017-11-17 17:46:57 +00:00
|
|
|
#ifdef GLOB_NOMATCH
|
2007-09-19 22:37:58 +00:00
|
|
|
no_results:
|
2017-11-17 17:46:57 +00:00
|
|
|
#endif
|
2013-08-19 12:21:16 +00:00
|
|
|
#ifndef PHP_WIN32
|
|
|
|
/* Paths containing '*', '?' and some other chars are
|
|
|
|
illegal on Windows but legit on other platforms. For
|
|
|
|
this reason the direct basedir check against the glob
|
|
|
|
query is senseless on windows. For instance while *.txt
|
|
|
|
is a pretty valid filename on EXT3, it's invalid on NTFS. */
|
2010-04-26 23:53:30 +00:00
|
|
|
if (PG(open_basedir) && *PG(open_basedir)) {
|
2014-12-13 22:06:14 +00:00
|
|
|
if (php_check_open_basedir_ex(pattern, 0)) {
|
2007-09-19 22:37:58 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
}
|
2013-08-19 12:21:16 +00:00
|
|
|
#endif
|
2003-06-04 05:45:54 +00:00
|
|
|
array_init(return_value);
|
|
|
|
return;
|
2003-06-03 11:01:16 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 19:18:13 +00:00
|
|
|
array_init(return_value);
|
2017-08-23 23:36:14 +00:00
|
|
|
for (n = 0; n < (size_t)globbuf.gl_pathc; n++) {
|
2010-04-26 23:53:30 +00:00
|
|
|
if (PG(open_basedir) && *PG(open_basedir)) {
|
2014-12-13 22:06:14 +00:00
|
|
|
if (php_check_open_basedir_ex(globbuf.gl_pathv[n], 0)) {
|
2007-09-19 22:37:58 +00:00
|
|
|
basedir_limit = 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2014-11-20 20:00:07 +00:00
|
|
|
/* we need to do this every time since GLOB_ONLYDIR does not guarantee that
|
2003-07-23 21:41:44 +00:00
|
|
|
* all directories will be filtered. GNU libc documentation states the
|
2015-01-03 09:22:58 +00:00
|
|
|
* following:
|
|
|
|
* If the information about the type of the file is easily available
|
|
|
|
* non-directories will be rejected but no extra work will be done to
|
|
|
|
* determine the information for each file. I.e., the caller must still be
|
|
|
|
* able to filter directories out.
|
2003-07-23 21:41:44 +00:00
|
|
|
*/
|
2003-07-03 14:34:02 +00:00
|
|
|
if (flags & GLOB_ONLYDIR) {
|
2014-08-25 18:22:49 +00:00
|
|
|
zend_stat_t s;
|
2003-07-03 14:34:02 +00:00
|
|
|
|
2003-07-03 14:54:03 +00:00
|
|
|
if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) {
|
2003-07-03 14:34:02 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-07-04 13:24:47 +00:00
|
|
|
if (S_IFDIR != (s.st_mode & S_IFMT)) {
|
2003-07-03 14:34:02 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2014-04-15 11:40:40 +00:00
|
|
|
add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip);
|
2002-03-21 19:18:13 +00:00
|
|
|
}
|
2002-09-26 00:27:52 +00:00
|
|
|
|
2002-03-21 19:18:13 +00:00
|
|
|
globfree(&globbuf);
|
2007-09-19 22:37:58 +00:00
|
|
|
|
|
|
|
if (basedir_limit && !zend_hash_num_elements(Z_ARRVAL_P(return_value))) {
|
2018-07-04 16:22:24 +00:00
|
|
|
zend_array_destroy(Z_ARR_P(return_value));
|
2007-09-19 22:37:58 +00:00
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2002-03-21 19:18:13 +00:00
|
|
|
}
|
|
|
|
/* }}} */
|
2015-01-03 09:22:58 +00:00
|
|
|
#endif
|
1999-10-05 14:36:00 +00:00
|
|
|
|
2020-07-01 13:32:55 +00:00
|
|
|
/* {{{ List files & directories inside the specified path */
|
2003-01-28 01:48:57 +00:00
|
|
|
PHP_FUNCTION(scandir)
|
|
|
|
{
|
|
|
|
char *dirn;
|
2014-08-27 13:31:48 +00:00
|
|
|
size_t dirn_len;
|
2020-10-24 12:15:07 +00:00
|
|
|
zend_long flags = PHP_SCANDIR_SORT_ASCENDING;
|
2014-03-02 14:47:59 +00:00
|
|
|
zend_string **namelist;
|
2003-01-28 01:48:57 +00:00
|
|
|
int n, i;
|
2004-01-28 22:21:54 +00:00
|
|
|
zval *zcontext = NULL;
|
|
|
|
php_stream_context *context = NULL;
|
2003-01-28 01:48:57 +00:00
|
|
|
|
2016-12-30 21:21:11 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_START(1, 3)
|
|
|
|
Z_PARAM_PATH(dirn, dirn_len)
|
|
|
|
Z_PARAM_OPTIONAL
|
|
|
|
Z_PARAM_LONG(flags)
|
2020-08-20 22:42:44 +00:00
|
|
|
Z_PARAM_RESOURCE_OR_NULL(zcontext)
|
2016-12-30 21:21:11 +00:00
|
|
|
ZEND_PARSE_PARAMETERS_END();
|
2003-01-28 01:48:57 +00:00
|
|
|
|
2007-06-14 23:28:06 +00:00
|
|
|
if (dirn_len < 1) {
|
2020-04-01 21:32:39 +00:00
|
|
|
zend_argument_value_error(1, "cannot be empty");
|
2019-12-29 19:54:57 +00:00
|
|
|
RETURN_THROWS();
|
2007-06-14 23:28:06 +00:00
|
|
|
}
|
|
|
|
|
2009-07-30 12:06:40 +00:00
|
|
|
if (zcontext) {
|
|
|
|
context = php_stream_context_from_zval(zcontext, 0);
|
|
|
|
}
|
2003-01-28 01:48:57 +00:00
|
|
|
|
2010-11-26 09:52:28 +00:00
|
|
|
if (flags == PHP_SCANDIR_SORT_ASCENDING) {
|
2004-01-28 22:21:54 +00:00
|
|
|
n = php_stream_scandir(dirn, &namelist, context, (void *) php_stream_dirent_alphasort);
|
2010-11-26 09:52:28 +00:00
|
|
|
} else if (flags == PHP_SCANDIR_SORT_NONE) {
|
|
|
|
n = php_stream_scandir(dirn, &namelist, context, NULL);
|
2003-01-28 01:48:57 +00:00
|
|
|
} else {
|
2004-01-28 22:21:54 +00:00
|
|
|
n = php_stream_scandir(dirn, &namelist, context, (void *) php_stream_dirent_alphasortr);
|
2003-01-28 01:48:57 +00:00
|
|
|
}
|
|
|
|
if (n < 0) {
|
2014-12-13 22:06:14 +00:00
|
|
|
php_error_docref(NULL, E_WARNING, "(errno %d): %s", errno, strerror(errno));
|
2004-01-28 22:21:54 +00:00
|
|
|
RETURN_FALSE;
|
2003-01-28 01:48:57 +00:00
|
|
|
}
|
2015-01-03 09:22:58 +00:00
|
|
|
|
2003-01-28 01:48:57 +00:00
|
|
|
array_init(return_value);
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
2014-03-02 14:47:59 +00:00
|
|
|
add_next_index_str(return_value, namelist[i]);
|
2003-01-28 01:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (n) {
|
2004-01-28 22:21:54 +00:00
|
|
|
efree(namelist);
|
2003-01-28 01:48:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* }}} */
|