frontend/modules/elfind/src/elFinderVolumeLocalFileSystem.class.php
/**
     *  ShareDialog for file or directory
     *
     * @param string $path
     * @return array
     */
ShareDialog for file or directory
@param string $path
@return array
ShareDialog for file or directory @param string $path @return array
protected function shareDialogCE($path, $is_collaborate=false)
    {
        if (is_dir($path)) {
            $InfoFile = $path . '/' . UserFiles::DIR_INFO_FILE;
        } else {
            $InfoFile = $path;
        }
        if (!file_exists($InfoFile)) {
            return ['status' => false, 'info' => 'File info disabled.'];
        }
        try {
            $tmp = @unserialize(file_get_contents($InfoFile));
            if (!isset($tmp['file_uuid'], $tmp['file_id'])) {
                return ['status' => false, 'info' => self::ERROR_SYNCHRONIZATION];
            }
        } catch (Exception $e) {
            return ['status' => false, 'info' => self::ERROR_SYNCHRONIZATION];
        }
        $ret['hash'] = $this->encode($path);
        $User = Yii::$app->user->identity;
        $ret['payed'] = (!in_array($User->license_type, [Licenses::TYPE_FREE_DEFAULT])) ? true : false;
        $ret = $ret + UserFiles::getFileShareInfo($path);
        if ((!isset($ret['file_parent_id']) || $ret['file_parent_id']) && $is_collaborate) {
            return ['status' => false, 'info' => "Can't collaborate non-root folder."];
        }
        return ['status' => true, 'data' => $ret];
    }
protected function shareDialogCE ( $ path , $ is_collaborate = false ) { if ( is_dir ( $ path ) ) { $ InfoFile = $ path . '/' . UserFiles :: DIR_INFO_FILE ; } else { $ InfoFile = $ path ; } if ( ! file_exists ( $ InfoFile ) ) { return [ 'status' => false , 'info' => 'File info disabled.' ] ; } try { $ tmp = @ unserialize ( file_get_contents ( $ InfoFile ) ) ; if ( ! isset ( $ tmp [ 'file_uuid' ] , $ tmp [ 'file_id' ] ) ) { return [ 'status' => false , 'info' => self :: ERROR_SYNCHRONIZATION ] ; } } catch ( Exception $ e ) { return [ 'status' => false , 'info' => self :: ERROR_SYNCHRONIZATION ] ; } $ ret [ 'hash' ] = $ this -> encode ( $ path ) ; $ User = Yii :: $ app -> user -> identity ; $ ret [ 'payed' ] = ( ! in_array ( $ User -> license_type , [ Licenses :: TYPE_FREE_DEFAULT ] ) ) ? true : false ; $ ret = $ ret + UserFiles :: getFileShareInfo ( $ path ) ; if ( ( ! isset ( $ ret [ 'file_parent_id' ] ) || $ ret [ 'file_parent_id' ] ) && $ is_collaborate ) { return [ 'status' => false , 'info' => " Can't collaborate non-root folder. " ] ; } return [ 'status' => true , 'data' => $ ret ] ; }
ShareDialog for file or directory
 @param string $path
 @return array
ShareDialog for file or directory @param string $path @return array
//sleep(5); //return $this->setError("File info disabled."); //return $this->setError("Sync file error. Source folder_uuid does not exist."); /** @var \common\models\Users $User */