I am developing a Joomla Component which will allow visitors to download a sound file (be it mp3, or wave, does not matter). Those files are managed in the admin interface and can be unpublished in there.
Therefore, it seems that placing them in the assets section is not an option, as it would make them accessible directly from the server. I want to avoid direct access and only serve them through my MVC structure (usnig RAW document type) after verifying that the requested file is published.
Are there any conventions on the placement of those files inside my component's directory structure?
My first idea is to create a folder inside the administrator/components/com_mycomponent and keep the files there. Do I need to restrict access to this new folder with a new .htaccess file, or is it already taken care of by Joomla with a global .htaccess?
you should place the files in the media directory. It is supported by the installer and is much better place. The logic is to have code in com_mycomponent for site and admin and both of those will share media (images/css/js), downloads, etc...
/media/com_mycomponent/
Restrictions are up to you.
Here is Joomla installation structure, http://docs.joomla.org/Components:xml_installfile
Related
Let's say I have a Job that generates an avatar image through Intervention with the username on top of a static default background image. This background image should be available for each project member, so it should life somewhere in the repo.
My question is: where does this static background image life?
When I take a look at the Laravel docs about the Directory Structure I conclude that:
It should not life in the public directory, since it does not have to be publicly accessible (the image itself is never used without the username on it)
The public directory contains the index.php file, which is the entry point for all requests entering your application and configures autoloading. This directory also houses your assets such as images, JavaScript, and CSS.
It should not life in the storage directory, since this folder seems to be for generated stuff (and is subject to overwrites)
The storage directory contains your compiled Blade templates, file based sessions, file caches, and other files generated by the framework. [...]
It could maybe life in the resources directory, since this directory contains "raw, un-compiled assets". But the fact that images are not used as an example it makes me doubt.
The resources directory contains your views as well as your raw, un-compiled assets such as LESS, SASS, or JavaScript. This directory also houses all of your language files.
What are your opinions on this question?
First off, your application shouldn't depend on the file being in the same filesystem. You should use the Laravel Storage API, since that way you can easily store the files on a third party storage solution such as Amazon S3 without having to change anything other than a config setting.
With the local driver, the files would default to being stored under storage/app, which I would consider the correct location. It's actually recommended that if a file needs to be publicly accessible, it should be stored in storage/app/public/, which should be symlinked to public/.
As you have observed, the public directory is for anything that needs to be publicly accessible, including compiled Less/Sass, JavaScript and images. The resources directory is for their uncompiled counterparts, so your Less/Sass files and JavaScript should go there before being processed by Mix. The storage folder is for more general file storage use, but I would have a look at the possibility of storing these files with a third party service.
I got thrown this task because no one in my company understands websites, but I have only worked with very basic sites before, so I need help please. I haven't found another question quite like this one.
My company has an established site, running on Joomla 2.5, hosted on GoDaddy. They recently commissioned a company to build them a new site (not Joomla based), but want me to put it up on GoDaddy (saves money). The design company sent me a zip file, and GoDaddy told me to just move all the current site folders into one single folder, then unzip the site in the Public folder.
This is what I'm seeing in cPanel.
And this is what I see in FileZilla.
Do they really mean for me to move ALL these files to one folder? Or are there some I shouldn't touch, like the public_ftp folder? Or only move the files in the Public_html subfolder? Or only move files that are not in any folder?
Please be descriptive, I'm very new. Thanks in advance.
Joomla directories names are very intuitive. For most of them, you can guess the folder content just seeing it name. Basically we have these folders:
Any folder or file does not belong to joomla and therefore you should not move to the new subdirectory.
No changes are required in the database, so that all continue working on www.domain.com/oldweb
root: this is the directory where you made your Joomla pack extraction. When you first place Joomla on your web site, the root directory contains an index.php file that will run the Joomla installer. Once installed Joomla, this index.php page will detect your settings in the configuration.php file and execute your main Joomla engine.
administrator: In this directory you find all files for your Joomla administrator web interface (components, templates, modules, plugins, etc). The Administrator interface itself is a Joomla web site, and has a complete user interface that can be augmented by administrative extensions.
cache: This folder holds Joomla cache files. To accelerate performance, Joomla will cache popular pages requested in this directory, so they don’t have to be re-downloaded by PHP and MySQL for each time it is requested.
components: This directory holds all Joomla components, accept those for your administrator interface. By default, Joomla has some components available, such as login, newsfeeds, poll, registration, search, and others. They are ready to go, and can already displayed them in your website front-end.
images: This folder by default holds images used for your extensions. It contains all bitmaps used by the administrator interface as well as images that have been uploaded to present with article content. Within it you find the \smiles folder that contains emoticons; the \stories folder that has images; and the \banners folder that holds some sample banner files.
includes: In this directory you find core files of Joomla. It contains PHP execution files that automate inclusion of content.
installation: This folder contains needed files for Joomla installation. It should be deleted after installed Joomla.
language: This folder holds all language files. Joomla stores translations in a simple INI-based file format. All languages files are contained in it own folder and have filename prefix that matches the folder name. For example, all language files for English template from the country Great Britain are stored in a folder named eng-GB and all of them has a prefix eng-GB.
libraries: this directory holds your entire Joomla system and third-party libraries used in your website. A Joomla website uses the core libraries contained inside the \libraries folder. Within this folder you find the \joomla folder where you will see different implementations areas (such as file system, application, database, etc). These implementations make up the functional parts of your application. Its library has its own subfolder in this folder to aid in organization.
logs: Where Joomla stores its log files.
media: Default folder to store media files. It may contains files related with user interfaces, such as: JavaScript libraries, flash files, etc.
modules: This folder contains all installed front-end modules. It holds the modules available for display by a template. By default Joomla comes some modules, such as banners, breadcrumbs, latest news, login, newsflash, poll, random image, others. Modules are placed like panels into a Joomla template. They often encapsulate or provide the front-end display for related component. Like a component, a module is a type of add-on extension.
plugins: It contains all your plugins files. As well as components and modules, plugins are a type of add-on extension. However, they work at a lower level than components.
templates: This directory has all your frontend template files. You can notice that the name of each template subfolder must match the template it contains. By default Joomla brings some templates already done, and ready for use.
tmp: This folder stores temporary files and cookies that are used by the administrator and user interface of Joomla. Most of time, extensions’ files are copied to this folder during Joomla installation process.
I'm creating a new plugin for WordPress that requires an outside website to use a web service. For instance, if there are two sites, A and B, the plugin will be installed on A with all associated data stored in the WordPress database for Site A. Site B will use the web service to grab data in XML format from Site A.
Is this possible? What would be the most secure way of pulling this off?
I could just have the web service as a PHP file in my plugin, but that's going to require the outside domain to hit something like:
http://www.example.com/wp-content/plugins/plugin-folder/web-service.php. It seems like a bad idea to expose the level of depth of the WordPress setup.
I could have my plugin create a few files in the root so that the web service call would be to http://www.example.com/web-service.php, but having my plugin install stuff outside of the plugin directory also seems like a bad practice.
Another thought: Could I put the file in my plugin folder, but add a line in file .htaccess to make http://www.example.com/web-service.php go to it?
What is the best, most secure way to go about this?
I would set up a rewrite rule in .htaccess to let the user get to your code without knowing where it is. I don't think there is an easy way to add specific routes to the WordPress front controller, but you could see if there is an action or filter to do that.
Here's a post on adding routes: How can I create custom URL routes?
In my personal opinion, if I installed a WP plugin and you created a new file in my root directory, I would either delete the file or the plugin all together. I would also try to avoid adding a .htaccess file. This would again make me suspicious.
What I would do is, upon install ping a file on Site B (your site) that captures the location of the plugin folder on Site A (their site), because WP might be installed inside of a directory and not at the root. Then you know where the "web-service.php" file is located. Then you can just hit that file whenever you need. There is no reason for .htaccess rules, or creation of new files.
Just a suggestion :)
I am trying to deploy a PHP Yii app to Orchestra (https://www.engineyard.com/products/orchestra/). The platform, like I think many cloud-based platform, doesn't allow write permissions.
I've managed to get around the 'runtime' directory that Yii requires by putting it in the system's tmp folder. However I'm stuck with the 'assets' folder. Yii requires a writable AND publicly accessible folder.
Is there a way around this?
Yii requires somewhere to put the files from within the core or modules to be publicly accessible.
If this isn't possible you might have to go through and manually grab each js/css file your going to want, place them in the folders required and use scriptMap to map these back or block them and include them yourself.
There's lots of documentation around Client Script which is what handles all this.
I'm looking for a sort of directory engine (preferably in PHP) which allows to serve files from that directory to the clients. The directory may contain files of different types. The files may be organized in a hierarchy using sub-directories.
The solution I'm looking for should be able to build a view from such a directory structure with downloadable links to the files, file descriptions, custom thumbnails. The thumbnails could be possible to assign manually for files and directories, they shouldn't be generated automatically. The sub-directories treated as the categories so it should allow some kind of navigation between them.
The view should be highly customizable, allowing to change layout and look & feel.
I like how the information is presented at the following page:
http://www.doctohelp.com/SuperProducts/ChartWinForms/Chart+Types/
I searched the web but haven't found any appropriate solution at the moment. Mostly there are flat file managers which don't support meta-data or lack for customization.
Is someone aware of such a thing? I would be thankful for any link to already existent solution or some advise on of what components the solution can be built.
I'd put a vote in for ResourceSpace. I've not used it yet, but am considering integrating it into one of my projects. It appears to have meta data, has a customisable look and feel, and contains previewers for a lot of file types.
Have a look at http://gallery.sf.net
Its an image library in php but can be used for any kind of files. Gallery will not directly use your directory structure, but you can for example upload from server. Gallery is highly extendable and you can customize the views.
http://codex.gallery2.org/Category:Gallery_3:Modules
With native directory views (coming with nearly any webservers) you will not have a file description or thumbnails.