public function actionFolders() {
		$sources = [];
		foreach ($this->config->sources as $key => $source) {
			if ($this->request->source && $this->request->source !== 'default' && $key !== $this->request->source && $this->request->path !== './') {
				continue;
			}

			$path = $source->getPath();

			try {
				$this->accessControl->checkPermission($this->getUserRole(), $this->action, $path);
			} catch (\Exception $e) {
				continue;
			}

			$sourceData = (object)[
				'baseurl' => $source->baseurl,
				'path' =>  str_replace(realpath($source->getRoot()) . Consts::DS, '', $path),
				'folders' => [],
			];

			$sourceData->folders[] = $path == $source->getRoot() ? '.' : '..';

			$dir = opendir($path);
			while ($file = readdir($dir)) {
				if (
					$file != '.' &&
					$file != '..' &&
					is_dir($path . $file) and
					(
						!$this->config->createThumb ||
						$file !== $this->config->thumbFolderName
					) and
					!in_array($file, $this->config->excludeDirectoryNames)
				) {
					$sourceData->folders[] = $file;
				}
			}

			$sources[$key] = $sourceData;
		}

		return [
			'sources' => $sources
		];
	}
public function actionFolders() {
		$sources = [];
		foreach ($this->config->sources as $key => $source) {
			if ($this->request->source && $this->request->source !== 'default' && $key !== $this->request->source && $this->request->path !== './') {
				continue;
			}

			$path = $source->getPath();

			try {
				$this->accessControl->checkPermission($this->getUserRole(), $this->action, $path);
			} catch (\Exception $e) {
				continue;
			}

			$sourceData = (object)[
				'baseurl' => $source->baseurl,
				'path' =>  str_replace(realpath($source->getRoot()) . Consts::DS, '', $path),
				'folders' => [],
			];

			$sourceData->folders[] = $path == $source->getRoot() ? '.' : '..';

			$dir = opendir($path);
			while ($file = readdir($dir)) {
				if (
					$file != '.' &&
					$file != '..' &&
					is_dir($path . $file) and
					(
						!$this->config->createThumb ||
						$file !== $this->config->thumbFolderName
					) and
					!in_array($file, $this->config->excludeDirectoryNames)
				) {
					$sourceData->folders[] = $file;
				}
			}

			$sources[$key] = $sourceData;
		}

		return [
			'sources' => $sources
		];
	}
public function actionFolders ( ) { $ sources = [ ] ; foreach ( $ this -> config -> sources as $ key => $ source ) { if ( $ this -> request -> source && $ this -> request -> source !== 'default' && $ key !== $ this -> request -> source && $ this -> request -> path !== './' ) { continue ; } $ path = $ source -> getPath ( ) ; try { $ this -> accessControl -> checkPermission ( $ this -> getUserRole ( ) , $ this -> action , $ path ) ; } catch ( \ Exception $ e ) { continue ; } $ sourceData = ( object ) [ 'baseurl' => $ source -> baseurl , 'path' => str_replace ( realpath ( $ source -> getRoot ( ) ) . Consts :: DS , '' , $ path ) , 'folders' => [ ] , ] ; $ sourceData -> folders [ ] = $ path == $ source -> getRoot ( ) ? '.' : '..' ; $ dir = opendir ( $ path ) ; while ( $ file = readdir ( $ dir ) ) { if ( $ file != '.' && $ file != '..' && is_dir ( $ path . $ file ) and ( ! $ this -> config -> createThumb || $ file !== $ this -> config -> thumbFolderName ) and ! in_array ( $ file , $ this -> config -> excludeDirectoryNames ) ) { $ sourceData -> folders [ ] = $ file ; } } $ sources [ $ key ] = $ sourceData ; } return [ 'sources' => $ sources ] ; }
Load all folders from folder ore source or sources
Load all folders from folder ore source or sources