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.

 



Article ID: 598
Created On: Thu, Mar 6, 2014 at 7:45 AM
Last Updated On: Tue, Nov 21, 2017 at 4:05 PM
Authored by: KB Admin01 [[email protected]]

Online URL: https://kb.quikbox.com/article.php?id=598