src/Ffcms/Apps/Api/Ckeditor/Editor.php
public function actionBrowse($type)
    {
        $files = null;
        $relative = null;
        // check if request type is defined
        if ($this->allowedExt[$type] === null || !Any::isArray($this->allowedExt[$type])) {
            throw new NativeException('Hack attempt');
        }
        // list files in directory
        $files = File::listFiles('/upload/' . $type, $this->allowedExt[$type]);

        // absolute path to relative URI
        foreach ($files as $file) {
            $newName = Str::sub($file, Str::length(root)+1);
            $relative[] = trim(Str::replace(DIRECTORY_SEPARATOR, '/', $newName), '/');
        }

        // generate response
        return App::$View->render('editor/browse', [
            'callbackName' => App::$Security->strip_tags(App::$Request->query->get('CKEditor')),
            'callbackId' => (int)App::$Request->query->get('CKEditorFuncNum'),
            'files' => $relative,
            'type' => $type
        ], __DIR__);
    }
public function actionBrowse($type)
    {
        $files = null;
        $relative = null;
        // check if request type is defined
        if ($this->allowedExt[$type] === null || !Any::isArray($this->allowedExt[$type])) {
            throw new NativeException('Hack attempt');
        }
        // list files in directory
        $files = File::listFiles('/upload/' . $type, $this->allowedExt[$type]);

        // absolute path to relative URI
        foreach ($files as $file) {
            $newName = Str::sub($file, Str::length(root)+1);
            $relative[] = trim(Str::replace(DIRECTORY_SEPARATOR, '/', $newName), '/');
        }

        // generate response
        return App::$View->render('editor/browse', [
            'callbackName' => App::$Security->strip_tags(App::$Request->query->get('CKEditor')),
            'callbackId' => (int)App::$Request->query->get('CKEditorFuncNum'),
            'files' => $relative,
            'type' => $type
        ], __DIR__);
    }
public function actionBrowse ( $ type ) { $ files = null ; $ relative = null ; // check if request type is defined if ( $ this -> allowedExt [ $ type ] === null || ! Any :: isArray ( $ this -> allowedExt [ $ type ] ) ) { throw new NativeException ( 'Hack attempt' ) ; } // list files in directory $ files = File :: listFiles ( '/upload/' . $ type , $ this -> allowedExt [ $ type ] ) ; // absolute path to relative URI foreach ( $ files as $ file ) { $ newName = Str :: sub ( $ file , Str :: length ( root ) + 1 ) ; $ relative [ ] = trim ( Str :: replace ( DIRECTORY_SEPARATOR , '/' , $ newName ) , '/' ) ; } // generate response return App :: $ View -> render ( 'editor/browse' , [ 'callbackName' => App :: $ Security -> strip_tags ( App :: $ Request -> query -> get ( 'CKEditor' ) ) , 'callbackId' => ( int ) App :: $ Request -> query -> get ( 'CKEditorFuncNum' ) , 'files' => $ relative , 'type' => $ type ] , __DIR__ ) ; }
Browse files from ckeditor
@param string $type
@throws NativeException
@throws \Ffcms\Core\Exception\SyntaxException
@return string
Browse files from ckeditor