Running custom scripts when users perform various actions
From FileRun Documentation
Custom PHP scripts can be automatically executed when the users perform one of the 57 monitored actions (E-mail_notification_system#Actions_keynames).
For example, to automatically run custom PHP code whenever a file is uploaded, you can simply place a PHP file named "upload.php" inside the folder "/path-to-filerun/customizables/events/"
Here's a list of useful scripts:
Antivirus check on upload:
<?php global $auth; $data = unserialize($data['data']); $info = array( "username" => $auth->currentUserInfo['username'], "fullPath" => $data['full_path'] ); $pathToShellScript = "virus_scan.sh"; //virus_scan.sh will be executed with the username and the file's path @system($pathToShellScript." ".escapeshellarg($info['username'])." ".escapeshellarg($info['fullPath']); ?>
Filter uploaded files by extension:
<?php $extensions = array("exe", "dll"); //customize the list of banned extensions /*************************************************************/ global $fm; $data = unserialize($data['data']); $ext = $fm->getExtension($data['filename']); if (in_array($ext, $extensions)) { unlink($data['full_path']); } ?>
