You are here

function node_gallery_check_directory in Node Gallery 6

Same name and namespace in other branches
  1. 6.2 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 183
Node gallery pages.

Code

function node_gallery_check_directory($gallery) {
  global $user;
  $gallery_directory = strtr($gallery
    ->get_config()->gallery_directory, array(
    '%uid' => $user->uid,
    '%username' => $user->name,
    '%gid' => $gallery->nid,
    '%gallery_name' => str_replace(' ', '_', $gallery->title),
  ));
  $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;
}