From 7c1299521f31d6eb733e29455ccad8c92cbc0a7b Mon Sep 17 00:00:00 2001 From: moehm Date: Mon, 28 Apr 2014 11:12:38 +0200 Subject: Unimportant changes #2 --- blob/keywords.txt | 12 ++++++++++++ www/browse.php | 7 ++++++- www/class.user.php | 40 ++++++++++++++++++++++++++++++++++++++++ www/config.php | 20 ++++++++++++++++++++ www/functions/func_register.php | 6 ++++++ www/functions/func_upload.php | 29 +++++++++++++++-------------- 6 files changed, 99 insertions(+), 15 deletions(-) create mode 100644 blob/keywords.txt create mode 100644 www/class.user.php create mode 100644 www/config.php 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 @@ +$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 @@ +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; + } +} -- cgit v1.2.3