Adding custom functionality

Custom Modules

This page provides some details on how to add a custom PHP script to Web File Share's framework. The benefits are that the page can be protected by Web File Share's authentication system and that your script can use Web File Share's API. The API has no public documentation, but if you contact us, we'll help you with the required information.

Creating a custom module


To create a module, simply start by creating a new folder "MyModule" (or a name of your choice) inside "/path-to-Web File Share/system/modules/".

This module can be accessed using the following URL: http://your-site/WebFileShare/?module=MyModule

The above URL will run the file "/path-to-WebFileShare/system/modules/MyModule/sections/default/php/default.php".

Each module is split in sections, so create a folder named "sections" inside "/path-to-WebFileShare/system/modules/MyModule/".

You can specify a section like this: http://your-site/WebFileShare/?module=MyModule&section=MySection

The above URL will run the file "/path-to-Web File Share/system/modules/MyModule/sections/MySection/php/default.php".

Each section can have multiple pages. To call a different script file than "default.php", you can specify a page like this: http://your-site/WebFileShare/?module=MyModule&section=MySection&page=MyPage

The above URL will run the file "/path-to-WebFileShare/system/modules/MyModule/sections/MySection/php/MyPage.php".

Inside "MyPage.php" you can execute any PHP code you wish to.

Password protecting the pages


Inside "/path-to-WebFileShare/system/modules/MyModule/", create a file named "config.php".

Pasting the following code inside, will allow only authenticated users to access the page "MyPage" ("/path-to-WebFileShare/system/modules/MyModule/sections/MySection/php/MyPage.php").

<?php

$config['modules'][$moduleName]['sections']['MySection']['perms'] = array(

                'MyPage' => array('must_be_logged' => true)

);

 

(Make sure you don't include in the file any space character before the "<?php " part.)

You can protect as many pages as you want. Simply add more items to the above Array.

 

Attached Files
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Name
Email
Security Code Security Code
Related Articles RSS Feed
Automatic Login
Viewed 2375 times since Wed, Nov 22, 2017
Hiding options from the "Open with..." menu
Viewed 2313 times since Thu, Mar 6, 2014
Custom "Open with" actions
Viewed 2173 times since Wed, Nov 22, 2017
Adding links to the menu
Viewed 2567 times since Thu, Mar 6, 2014
File reference
Viewed 2499 times since Tue, Jun 10, 2014
The API
Viewed 4364 times since Wed, Nov 22, 2017
Custom file actions
Viewed 2501 times since Wed, Mar 5, 2014
Translating Web File Share
Viewed 20117 times since Wed, Mar 5, 2014
Forcing certain file types to download
Viewed 2752 times since Thu, Mar 6, 2014
Running custom scripts when users perform various actions
Viewed 3440 times since Thu, Mar 6, 2014
Recently Viewed
Flow module
MENU