Create empty file and return its info

@param  string   $dst  destination directory
@param  string   $name file name
@return array|false
@author Dmitry (dio) Levashov
1207
public function mkfile($dst, $name) {
		if ($this->commandDisabled('mkfile')) {
			return $this->setError(elFinder::ERROR_PERM_DENIED);
		}
		
		if (!$this->nameAccepted($name)) {
			return $this->setError(elFinder::ERROR_INVALID_NAME);
		}
		
		if (($dir = $this->dir($dst)) == false) {
			return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst);
		}
		
		if (!$dir['write']) {
			return $this->setError(elFinder::ERROR_PERM_DENIED);
		}
		
		$path = $this->decode($dst);

		if ($this->stat($this->_joinPath($path, $name))) {
			return $this->setError(elFinder::ERROR_EXISTS, $name);
		}
		$this->clearcache();
		return ($path = $this->_mkfile($path, $name)) ? $this->stat($path) : false;
	}
1321224
public function file($name = null, $default = null)
    {
        $files = $this->request['files'];

        if (isset($name)) {
            return !empty($files[$name]['name']) ? $files[$name] : $default;
        }

        return $files;
    }
780518
private function findFile($name, $ext)
	{
		if (null === $ext)
			$ext = $this->default_ext;
		$basename = basename($name);
		$type = $this->getTypeForExt($ext);

		if (isset(self::$files[$this->prefix][$type][$name])
		 && file_exists($file = self::$files[$this->prefix][$type][$name]))
			return $file;

		foreach ($this->paths as $path)
		{
			$prefixes = isset($path['prefixes']) ? $path['prefixes'] : array();
			$prefix = isset($prefixes[$type]) ? $prefixes[$type] . '/' : '';

			foreach ($path['directories'] as $directory)
			{
				$files = glob(rtrim($directory, '/') . '/' . $prefix . $name . '.*');
				if (!$files) // no file found
					continue;

				foreach ($files as $file)
				{
					list($found_name, $found_ext) = $this->getNameAndExtension($file);
					
					if ($basename != basename($found_name) || $ext != $found_ext)
						continue;

					self::$files[$this->prefix][$ext][$name] = $file;
					self::$file_added = true;

					return self::$files[$this->prefix][$ext][$name];
				}
			}
		}

		return null;
	}
612057
public static function copyr($src, $dst)
    {
        $dir = opendir($src);
        GeneratorHelper::createDir($dst);
        while (false !== ($file = readdir($dir))) {
            if (($file != '.') && ($file != '..')) {
                if (is_dir($src . '/' . $file)) {
                    self::copyr($src . '/' . $file, $dst . '/' . $file);
                } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) {
                    throw new ConfigException("Can't copy " . $src . " to " . $dst);
                }
            }
        }
        closedir($dir);
    }
229721
public function createEmpty($name, $attr = array())
    {
        $p = clone $this->p_empty;
        $p->__construct($name, $attr);
        return $p;
    }
508540
public function newFileFromName($path, $name, $hashName = false){
        $info = pathinfo($name);
        $ext = isset($info['extension'])? ".{$info['extension']}":"";
        $name = $info['filename'];
        $n = $hashName?md5($name):$name;
        $file = new FileImpl("$path/$n$ext");
        $i = 0;
        while($file->exists()){
            $i++;
            $n = $hashName?md5($name.$i):"$name ($i)";
            $file = new FileImpl("$path/$n$ext");
        }
        return $file;

    }
574327
public function _get($name)
    {
        $name = $this->createFileName($name);
        $data = $this->redis->get($name);
        if ($data) {
            $data = $this->unpackData($data);
        }

        return $data;
    }
89355
public function mkdir($dsthash, $name) {
		if ($this->commandDisabled('mkdir')) {
			return $this->setError(elFinder::ERROR_PERM_DENIED);
		}
		
		if (!$this->nameAccepted($name)) {
			return $this->setError(elFinder::ERROR_INVALID_NAME);
		}
		
		if (($dir = $this->dir($dsthash)) == false) {
			return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dsthash);
		}
		
		$path = $this->decode($dsthash);
		
		if (!$dir['write'] || !$this->allowCreate($path, $name, true)) {
			return $this->setError(elFinder::ERROR_PERM_DENIED);
		}
		
		$dst  = $this->joinPathCE($path, $name);
		$stat = $this->stat($dst); 
		if (!empty($stat)) { 
			return $this->setError(elFinder::ERROR_EXISTS, $name);
		}
		$this->clearcache();
		return ($path = $this->convEncOut($this->_mkdir($this->convEncIn($path), $this->convEncIn($name)))) ? $this->stat($path) : false;
	}
131152
public function getUploadedFile($name) {
        if(!isset($_FILES[$name])) return false;

        if(is_array($_FILES[$name]['name'])) {
            $result = array();
            foreach($_FILES[$name]['name'] as $key => $name) {
                $file = new UploadedFile($name, $_FILES[$name]['tmp_name'][$key], $_FILES[$name]['size'][$key], $_FILES[$name]['type'][$key], $_FILES[$name]['error'][$key] );
                $result[] = $file;
            }
            return $result;
        }else {
            $file = new UploadedFile($_FILES[$name]['name'], $_FILES[$name]['tmp_name'], $_FILES[$name]['size'], $_FILES[$name]['type'], $_FILES[$name]['error']);
            return $file;
        }
    }
1217137
public function getFiles(string $name = null) : array
    {
        if ($name === null) {
            return $this->files;
        }

        $files = $this->resolvePath($this->files, $name);

        if ($files instanceof UploadedFile) {
            return [$files];
        }

        if (is_array($files)) {
            return array_filter($files, static function ($file) {
                return $file instanceof UploadedFile;
            });
        }

        return [];
    }
960963
protected function copyDir($src, $dst) {
		$r = true;
		$dir = opendir($src);
		\Asgard\File\FileSystem::mkdir($dst);
		while(false !== ($file = readdir($dir))) {
			if(($file != '.') && ($file != '..'))
				$r = $r && $this->copy($src.'/'.$file, $dst.'/'.$file);
		}
		closedir($dir);

		if($r !== false)
			return $dst;
		return false;
	}
49560
public static function file(string $name, array $attributes = null) : string
    {
        // Set the input type
        $attributes['type'] = 'file';

        return Form::input($name, '', $attributes);
    }
1230881
private function createFile(
        $name,
        $type = 'controller'
    ) {
    
        //$name = $type == 'html'?strtolower($name):$name;
        $path = $this->phpRoot.'/'.ucfirst($type).'/';
        $ext = $type == 'html'?'.html':'.php';

        $fileName = $this->phpRoot.'/'.$name.$ext;

        if (file_exists($fileName)) {
            return "\n\n  WARNNING: this file already exists!\n  ".$fileName."\n\n";
        }


        if (!Main::checkAndOrCreateDir(dirname($fileName), true)) {
            return "\n\n  WARNNING: access denied in directory '".dirname($fileName)."'\n\n";
        }

        //get template
        $file = file_get_contents($this->configTemplate.'/'.$type.'.tpl');

        //replace %namespace% and %name%
        $file = str_replace('%name%', ucfirst(basename($name)), $file);
        $namespace = '';
        foreach (explode('/', dirname($name)) as $namespc) {
            if ($namespc == '.') {
                break;
            }
            $namespace .= ucfirst($namespc).'\\';
        }
        $file = str_replace('%namespace%', trim($namespace, '\\'), $file);

        //saving the file
        $ok = file_put_contents($fileName, $file);

        if ($ok) {
            return "\n\n  Arquivo '".$fileName."' criado com sucesso!\n\n";
        } else {
            return "\n\n  Não foi possível criar '".$name."'!\n\n";
        }
    }
811193
public static function getOrCreate($name)
    {
        $db = Loader::db();
        $u = new User();
        $v = array($name, $u->getUserID());
        $q = "select pID from Piles where name = ? and uID = ?";
        $pID = $db->getOne($q, $v);

        if ($pID > 0) {
            return self::get($pID);
        }

        $v = array($u->getUserID(), 0, $name, 'READY');
        $q = "insert into Piles (uID, isDefault, name, state) values (?, ?, ?, ?)";
        $r = $db->query($q, $v);
        if ($r) {
            $pID = $db->Insert_ID();

            return self::get($pID);
        }
    }
839455
public function dump($dst) {
		$host = $this->config['host'];
		$user = $this->config['user'];
		$pwd = $this->config['password'];
		$db = $this->config['database'];

		\Asgard\File\FileSystem::mkdir(dirname($dst));
		$cmd = 'mysqldump --user='.$user.' --password='.$pwd.' --host='.$host.' '.$db.' > '.$dst;
		$process = proc_open($cmd,
			[
				0 => ["pipe", "r"],
				1 => ["pipe", "w"],
				2 => ["pipe", "w"],
			],
			$pipes
		);
		return proc_close($process) === 0;
	}
653868
public function getLoadedFile(string $name)
    {
        $properties                     = $this->getProperties();
        $loadedFiles                    = $properties['loadedFiles'];
        $names                          = array_column($loadedFiles, 'name');
        if (in_array($name, $names)) {
            $key = array_search($name, array_column($loadedFiles, 'name'));
            return $loadedFiles[$key];
        }
        return false;
    }
564570
public function find( $name )
    {
        $name = (string) $name;
        $path = $this->getSavePath();

        if ( ! is_file( $path . $name ) )
        {
            return null;
        }

        return $this->createStructure( array(
            'name' => $name,
            'code' => @ file_get_contents( $path . $name ),
        ) );
    }