function webfm_mkdir in Web File Manager 5
Same name and namespace in other branches
- 5.2 webfm_file.inc \webfm_mkdir()
webfm_mkdir -called from the ajax action - switch case 'mkdir':
@ret string -name of directory if created FALSE -if unsuccessful
Parameters
string $source - the source directory path:
string $dest - the destination directory name:
1 call to webfm_mkdir()
- webfm_ajax in ./
webfm.module - Ajax post requests
File
- ./
webfm_file.inc, line 12
Code
function webfm_mkdir($source, $dest, $rename = FALSE, &$error) {
$mkdir_path = $source . '/' . $dest;
if (!is_dir($mkdir_path)) {
if (@mkdir($mkdir_path)) {
chmod($mkdir_path, 0775);
if (!is_writable($mkdir_path)) {
$error = t('The directory ') . $mkdir_path . t(' is not writable');
}
else {
return $mkdir_path;
}
}
}
else {
if ($rename == TRUE) {
$count = 0;
while (is_dir($munge_path = $mkdir_path . '_' . $count)) {
$count++;
}
if (@mkdir($munge_path)) {
chmod($munge_path, 0775);
if (!is_writable($munge_path)) {
$error = t('The directory ') . $munge_path . t(' is not writable');
}
else {
return $munge_path;
}
}
else {
$error = t('mkdir for ') . $munge_path . t(' failed');
}
}
else {
$error = t('The directory ') . $mkdir_path . t(' already exists');
}
}
return FALSE;
}