Added lot of junk laying around on harvie.cz
[mirrors/Programs.git] / php / encfs / php-encfs.php
diff --git a/php/encfs/php-encfs.php b/php/encfs/php-encfs.php
new file mode 100755 (executable)
index 0000000..fb15064
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/*
+       Harvie 2oo9 - http://blog.harvie.cz/
+
+       This simple script allows you to encrypt you webpages/etc.
+       using EncFS (you need to have EncFS installed of course).
+
+       You need write permissions to mountpoint for www server
+       and maybe add www server's user to the fuse group:
+
+       gpasswd fuse -a www-data
+       or
+       gpasswd fuse -a http
+
+       If you want this script to mount EncFS to be accessible by
+       other users, you can add user_allow_other to /etc/fuse.conf
+*/
+
+if(trim($_SERVER['HTTPS']) == '') {
+       die('<h1>Error: Cannot use EncFS without TLS!</h1>Use https:// instead of http://');
+}
+
+function encfs_mount($what, $where, $password, $arguments='') {
+       system('/bin/echo '.escapeshellarg($password).' | /usr/bin/encfs -S '.escapeshellarg($what).' '.escapeshellarg($where)." $arguments".' 2>&1');
+       flush();
+}
+
+function encfs_unmount($where) {
+       system('/usr/bin/fusermount -zu '.escapeshellarg($where).' 2>&1');
+       flush();
+}
+
This page took 0.103606 seconds and 4 git commands to generate.