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
Running custom scripts when users perform various actions
Viewed 3449 times since Thu, Mar 6, 2014
External Login Form
Viewed 3986 times since Wed, Nov 22, 2017
Custom "Open with" actions
Viewed 2176 times since Wed, Nov 22, 2017
Custom even scripts
Viewed 2607 times since Wed, Nov 22, 2017
File reference
Viewed 2500 times since Tue, Jun 10, 2014
Automatic Login
Viewed 2380 times since Wed, Nov 22, 2017
Custom file actions
Viewed 2507 times since Wed, Mar 5, 2014
Counting file downloads
Viewed 3991 times since Thu, Mar 6, 2014
Hiding options from the "Open with..." menu
Viewed 2316 times since Thu, Mar 6, 2014
Forcing certain file types to download
Viewed 2753 times since Thu, Mar 6, 2014
Recently Viewed
SuperOffice - Store
MENU