Source for file core.create_dir_structure.php
Documentation is available at core.create_dir_structure.php
* create full directory structure
$_open_basedir_ini = ini_get('open_basedir');
if (DIRECTORY_SEPARATOR== '/') {
$_dir_parts = preg_split('!/+!', $_dir, - 1, PREG_SPLIT_NO_EMPTY);
$_new_dir = ($_dir{0}== '/') ? '/' : getcwd(). '/';
if($_use_open_basedir = !empty($_open_basedir_ini)) {
$_open_basedirs = explode(':', $_open_basedir_ini);
$_dir_parts = preg_split('!/+!', $_dir, - 1, PREG_SPLIT_NO_EMPTY);
if (preg_match('!^((//)|([a-zA-Z]:/))!', $_dir, $_root_dir)) {
/* leading "//" for network volume, or "[letter]:/" for full path */
$_new_dir = $_root_dir[1];
/* remove drive-letter from _dir_parts */
if($_use_open_basedir = !empty($_open_basedir_ini)) {
/* all paths use "/" only from here */
foreach ($_dir_parts as $_dir_part) {
if ($_use_open_basedir) {
// do not attempt to test or make directories outside of open_basedir
foreach ($_open_basedirs as $_open_basedir) {
if (substr($_new_dir, 0, strlen($_open_basedir)) == $_open_basedir) {
if ($_make_new_dir && !file_exists($_new_dir) && !@mkdir($_new_dir, $smarty->_dir_perms) && !is_dir($_new_dir)) {
$smarty->trigger_error("problem creating directory '" . $_new_dir . "'");
/* vim: set expandtab: */
|