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
File reference
Viewed 2448 times since Tue, Jun 10, 2014
Automatic Login
Viewed 2316 times since Wed, Nov 22, 2017
The API
Viewed 4295 times since Wed, Nov 22, 2017
Hiding options from the "Open with..." menu
Viewed 2263 times since Thu, Mar 6, 2014
Adding links to the menu
Viewed 2498 times since Thu, Mar 6, 2014
Counting file downloads
Viewed 3924 times since Thu, Mar 6, 2014
Running custom scripts when users perform various actions
Viewed 3314 times since Thu, Mar 6, 2014
External Login Form
Viewed 3929 times since Wed, Nov 22, 2017
Calculating MD5 Checksums
Viewed 2639 times since Thu, Mar 6, 2014
Translating Web File Share
Viewed 20061 times since Wed, Mar 5, 2014
MENU