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
Forcing certain file types to download
Viewed 1740 times since Thu, Mar 6, 2014
External Login Form
Viewed 1546 times since Wed, Nov 22, 2017
Counting file downloads
Viewed 2556 times since Thu, Mar 6, 2014
Calculating MD5 Checksums
Viewed 1541 times since Thu, Mar 6, 2014
The API
Viewed 3373 times since Wed, Nov 22, 2017
Adding links to the menu
Viewed 1611 times since Thu, Mar 6, 2014
Running custom scripts when users perform various actions
Viewed 2316 times since Thu, Mar 6, 2014
Automatic Login
Viewed 1267 times since Wed, Nov 22, 2017
Custom file actions
Viewed 1579 times since Wed, Mar 5, 2014
Custom even scripts
Viewed 1485 times since Wed, Nov 22, 2017
MENU