diff options
| -rw-r--r-- | blob/keywords.txt | 12 | ||||
| -rw-r--r-- | www/browse.php | 7 | ||||
| -rw-r--r-- | www/class.user.php | 40 | ||||
| -rw-r--r-- | www/config.php | 20 | ||||
| -rwxr-xr-x | www/functions/func_register.php | 6 | ||||
| -rwxr-xr-x | www/functions/func_upload.php | 29 |
6 files changed, 99 insertions, 15 deletions
diff --git a/blob/keywords.txt b/blob/keywords.txt new file mode 100644 index 0000000..17701f7 --- /dev/null +++ b/blob/keywords.txt @@ -0,0 +1,12 @@ +login +logout +register +invite +user +download +password_recover +banned +httperror +robots.txt +favicon.ico +static diff --git a/www/browse.php b/www/browse.php index b72bac5..929600f 100644 --- a/www/browse.php +++ b/www/browse.php @@ -8,7 +8,12 @@ function print_browser($content){ if($_SERVER['REQUEST_METHOD'] == 'POST'){ //echo "created_folder : ". $_POST["foldername"] . " in ". $_GET["folder"]; if($_POST["task"]=="new-folder"){ - create_folder($_POST["path"], $_POST["foldername"], /*$_POST["public"]?*/"PUBLIC"/*:"PRIVATE"*/); + if(isset($_POST["share"])){ + $share = "PUBLIC"; + } else { + $share= "PRIVATE"; + } + create_folder($_POST["path"], $_POST["foldername"], $share); }elseif($_POST["task"]=="upload"){ upload($_POST["path"]); } diff --git a/www/class.user.php b/www/class.user.php new file mode 100644 index 0000000..2de15e2 --- /dev/null +++ b/www/class.user.php @@ -0,0 +1,40 @@ +<?php + +class user { + + public $name; + public $id; + public $login = false; + public $banned = false; + + private $db = $GLOBALS["db"]; + + __construct(){ + $db=$this->$db; + $query = $db->prepare("SELECT * FROM user WHERE name=?"); + $query->set("s", $_GET["name"]); + $result = $query->exec(); + + $this->name= + $this->id= + + if(!isset($_SESSION["login"])){ + $_SESSION["login"] = false; + $this->login=false; + } else { + $this->login=$_SESSION["login"]; + } + } + + getName(){ + return $this->name; + } + + getId(){ + return $this->id; + } + + checkLogin(){ + return $this->login; + } +} diff --git a/www/config.php b/www/config.php new file mode 100644 index 0000000..322ca53 --- /dev/null +++ b/www/config.php @@ -0,0 +1,20 @@ +<?php + +# Database + $dbname = 'vfs'; + $dbuser = 'vfs-user'; + $dbhost = 'localhost'; + $dbpassword = 'secretpassword'; + +# set preferred HTTP scheme, changes to https if set + $SCHEME="http://"; + + if(isset($_SERVER["HTTPS"])){ + if($_SERVER["HTTPS"] == "on"){ + $SCHEME="https://"; + } + } + +# host name + $HOST = $_SERVER["HTTP_HOST"]; + $DOMAIN = $SCHEME.$HOST."/"; diff --git a/www/functions/func_register.php b/www/functions/func_register.php index b848866..cc2b8a3 100755 --- a/www/functions/func_register.php +++ b/www/functions/func_register.php @@ -46,6 +46,12 @@ function register($db){ return REGISTER_USERNAME; } + # check for key words + if($name == "login" || $name == "logout" || $name == "register" || $name == "invite" || $name == "user" || $name == "download" || $name == "password_recover" || $name == "banned" || $name == "httperror" || $name == "robots.txt" || $name == "favicon.ico" || $name == "static"){ + return REGISTER_USERNAME; + } + + $id_db = $db->query("SELECT id FROM user WHERE email='" . $safe_email . "';"); $id_ar = $id_db->fetchArray(SQLITE3_NUM); $id = $id_ar[0]; diff --git a/www/functions/func_upload.php b/www/functions/func_upload.php index f4f9b82..6f39ad3 100755 --- a/www/functions/func_upload.php +++ b/www/functions/func_upload.php @@ -175,18 +175,19 @@ function upload($path){ //not used atm -//function web_upload($db){ -// $url = $_POST["url"]; +function web_upload($db){ + $url = $_POST["url"]; // if(!preg_match("/^((https?|ftp)?://|www\.|ftp\.)?([-a-z0-9+&@#/%?=~_|!:,.;]+\.)+[a-z]{2}[a-z]*/i", $url)){ -// echo "no hyperlink"; -// return false; -// } -// if(!preg_match("/^[a-zA-Z]+://", $url){ -// $url = "http://".$url; -// } -// $file = file_get_contents($url); -// if(!$file){ -// echo "Couldn't download ".$url; -// return false; -// } -//} + if(!preg_match("/^((https?|ftp)://|www\.|ftp\.)([-a-z0-9+&@#/%?=~_|!:,.;]+\.)+[a-z]{2}[a-z]*/i", $url)){ + echo "no hyperlink"; + return false; + } + if(!preg_match("/^[a-zA-Z]+://", $url){ + $url = "http://".$url; + } + $file = file_get_contents($url); + if(!$file){ + echo "Couldn't download ".$url; + return false; + } +} |
