You are here

function node_gallery_check_directory in Node Gallery 6.2

Same name and namespace in other branches
  1. 6 node_gallery.pages.inc \node_gallery_check_directory()
1 call to node_gallery_check_directory()
node_gallery_upload_images in ./node_gallery.pages.inc

File

./node_gallery.pages.inc, line 251
Node gallery pages.

Code

function node_gallery_check_directory($gallery) {
  global $user;
  $gallery_directory = strtr($gallery->config['gallery_directory'], array(
    '%uid' => $user->uid,
    '%username' => $user->name,
    '%gid' => $gallery->nid,
    '%gallery_name' => $gallery->title,
  ));
  $gallery_directory = node_gallery_validate_filesystem_path($gallery_directory);
  $directory = rtrim(file_directory_path() . '/' . $gallery_directory, '/\\');

  //recursive mkdir;
  if (!is_dir($directory)) {
    mkdir($directory, 0777, TRUE);
  }
  file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
  return $directory;
}