You are here

function gallery_assist_init in Gallery Assist 6

Same name and namespace in other branches
  1. 7 gallery_assist.module \gallery_assist_init()

Implementation of hook_init().

File

./gallery_assist.module, line 33
Drupal content type with gallery functionality.

Code

function gallery_assist_init() {
  global $user, $language;
  gallery_assist_add_css('gallery_assist');

  // Create the user gallery_assist directory if the user has the right permission.
  $gallery_assist_paths[] = variable_get('gallery_assist_directory', file_directory_path() . '/gallery_assist');
  $gallery_assist_paths[] = $user->uid;
  if (file_check_directory($gallery_assist_paths[0], 1)) {
    $gallery_assist_user_upload_path = implode('/', $gallery_assist_paths);
    if (!is_dir($gallery_assist_user_upload_path)) {
      $types = node_get_types();
      foreach ($types as $v) {
        if (user_access('create gallery_assist content') || user_access('create gallery_assist_' . $v->type . ' content')) {
          file_check_directory($gallery_assist_user_upload_path, 1);
        }
      }
    }
  }
}