Symfony + ckeditor + kcfinder : no route found to browse server - symfony

I have added ckeditor to offer a nice WYSIWYG editor to my user. To allow them to upload pictures directly into this editor, I've installed kcfinder. I've put the following lines in my ckeditor's config :
config.filebrowserBrowseUrl = 'ckeditor/plugins/kcfinder/browse.php?type=files';
config.filebrowserImageBrowseUrl = 'ckeditor/plugins/kcfinder/browse.php?type=images';
config.filebrowserFlashBrowseUrl = 'ckeditor/plugins/kcfinder/browse.php?type=flash';
config.filebrowserUploadUrl = 'ckeditor/plugins/kcfinder/upload.php?type=files';
config.filebrowserImageUploadUrl = 'ckeditor/plugins/kcfinder/upload.php?type=images';
config.filebrowserFlashUploadUrl = 'ckeditor/plugins/kcfinder/upload.php?type=flash';
My problem : when I try to browse files on the server with kcfinder, Symfony tells me that there is no routes for "GET /admin/news_post_admin/ckeditor/plugins/kcfinder/browse.php". It looks like it tries to reach browse.php from my controller, which is not correct.
Any ideas how I could make Symfony find the correct path of browse.php ?

I was working on the integration between Symfony2 and KCFinder and recently finished a simple bundle. Main purpose of the bundle was the possibility to control access to the KCFinder (for logged in users only).
You can find instructions and download the bundle from here (page created on the fly):
http://avaer.net/stuff/KCFinderBundle/
Hope you find this helpful.

Related

Is there a way to access Doctrine repositories from stand-alone code?

I have a Symfony 4 app which is complete and working. Any uploaded files are put inside an upload folder outside the doc root and accessed via a separate cdn url.
Inside the upload folder I have a htaccess file that redirects any request, let’s say for example an image, to a php file which then serves the image.
What I want to be able to do is send an auth key along with the image request so that the standalone index.php file can check the user is valid from the database.
This means I need some way of accessing the symfony entity manager from outside of symfony, by including it. The other option would be a curl request to a symfony controller, but I’d rather not add additional network requests if possible. The third option is a separate pdo direct to the database and make sql queries... but again I’d prefer to use the symfony entity manager by including symfony somehow so I can use other features if needed.
I actually tried including the symfony bootstrap in the index.php but that then drags in the need for routing to work which isn’t needed in this case.
You can access EntityManager like that:
require __DIR__.'/../vendor/autoload.php';
(new Dotenv())->load(__DIR__.'/../.env');
$kernel = new Kernel('dev', true);
$kernel->boot();
$user = $kernel->getContainer()->get('doctrine.orm.entity_manager')->getRepository(Repo::class)->find(id);
dd($user->getRoles());

silverstripe fluent locale configuration

I need help to understand the documentation for Fluent, from here Fluent config documentation
The documentation says:
"You can create locales via the /admin/locales CMS section."
When I create a locale, for example english, and then click on it I get at popup saying "Not Found".
Do I need to install the locale somewhere else before using it?
Did you run dev/build?flush=1 when you installed the module? After installation you should have everything read to go, and can start adding locales in the CMS.
Note that when you add your first locale in the CMS, the existing pages you have will not be available in that locale and you'll need to go into the Pages section and publish the pages you want to show up in your default locale.
I ran into this aswell.
The problem were missing files in the resouces folder. The 'Not found.' message in the admin panel refers to missing static assets like js and css files from the resouces folder. Open up your dev tools and inspect the 404'd requests. There you can see which files exactly are missing.

how to install securefiles in silverstripe 3

i'm trying to install the securefiles module https://github.com/hamishcampbell/silverstripe-securefiles on my silverstripe 3 installation.
After renaming, uploading and dev/build
i get two checkboxes in security>groups>groupname>permissions named Access to Secured Files and Manage File Security Settings.
But that's all.
and when i want to access the files section in silverstripe i get a server error.
Can someone tell me what i need to modify that secure files is working?
That extension seems to be only compatible with SS2.x so for SS3 you might need to find another extension, update it for 3.x (http://doc.silverstripe.org/framework/en/trunk/changelogs/3.1.0) or try a custom approach like Silverstripe - google picks links on members only page

Allowing file extensions in MVC3

Hello fellow programmers
I am sitting trying to do something with MVC3. Just exploring the library. Not doing anything fancy. I have created a project and a controller. Now I am trying to let MVC3 to allow me to do fx http://localhost/MyController.json, http://localhost/MyController.xml or just http://localhost/MyController. In the .json and .xml examples I get errors. The third is of course allowed. I have tried to google this, but I do not get anything that helps me.
Can anyone here tell me how to allow file extension in MVC3?
Thanks.
EDIT
I have not made any changes to the IIS like mapped file extensions.
You should add a route that includes an extension:
routes.MapRoute("ExtensionRoute",
"/{controller}.{extension}",
new { action="Index", extension = UrlParameter.Optional
);
This example maps the extension to a parameter in the action.
You can also make a route with a hard-coded extension.

How do I download an msi file via an asp.net button?

So, I've created my wonderful winforms app that I want to unleash upon the world, and now I am trying to create a simple website to host some basic information and link to the setup file (msi installer file )....
I have a button on the asp.net page and the setup file setupApp.msi in same folder as the asp.net page. I am currently trying the following:
Response.Redirect("http://./SetupApp.msi");
But this best guess at what to do is not working. Is there something wrong with Mime types here? What do I need to put in the click event to allow users to download this file?
The path you are passing in to the method is not valid (there's no server name called ".").
You can pass in a relative path and it should work fine because ASP.NET will resolve the path:
Response.Redirect("SetupApp.msi")
Or if it's not in the same folder, try one of these:
Response.Redirect("../Downloads/SetupApp.msi")
Response.Redirect("~/SomeFolder/SetupApp.msi")
Keep in mind that you don't necessarily have to do the whole redirect at all. Instead of writing code in an ASPX file you could just have a link to your MSI:
Download my app!

Resources