コード例 #1
0
ファイル: local.php プロジェクト: knigherrant/decopatio
 /**
  * Allows caller to create a new folder
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function createFolder($uri, $folderName)
 {
     $place = EBMM::getPlace($uri);
     $path = EBMM::getPath($uri);
     // Ensure that the user has access to create folder
     if (!$place->acl->canCreateFolder) {
         return EB::exception('You are not allowed to create folder here');
     }
     // Ensure that the current folder really exists on the site
     $exists = JFolder::exists($path);
     if (!$exists) {
         $state = JFolder::create($path);
         if (!$state) {
             return EB::exception('The current folder does not exist on the site');
         }
     }
     // Construct the new path
     $path = $path . '/' . $folderName;
     // Try to create the new folder now
     $state = JFolder::create($path);
     if (!$state) {
         return EB::exception('Unable to create folder on the site. This is probably due to permission issues.');
     }
     // Return the new uri
     $uri = $uri . '/' . $folderName;
     return $uri;
 }