From: Banana Date: Sun, 12 Feb 2017 10:00:40 +0000 (+0100) Subject: edit a link and simple http auth. Should work for now... X-Git-Tag: 2.1-alpha-2019-0-29~42 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=732373c939d31834bb37da165b9ac2ea3dfb1dcd;p=insipid.git edit a link and simple http auth. Should work for now... --- diff --git a/ChangeLog b/ChangeLog index 61ae0c3..ead926a 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,10 @@ -verion 2.0alpha - Bright Crucible - (2017-01-05) +version 2.1alpha - Bright Crucible - (tba) + * cleanups + +version 2.0alpha - Bright Crucible - (2017-01-05) * This is a not prodction ready version of the complete rewrite. * It is now written in PHP based on the idea from Luke Reeves -version 1.6 (tba) - * code fixes - * new options in htaccess file - version 1.5 (30 Nov. 2012) * support phantomjs as a screenshot tool for a bookmark * code updates and cleanup diff --git a/TODO b/TODO index f602ef8..ec5a58a 100755 --- a/TODO +++ b/TODO @@ -6,4 +6,4 @@ TODO / Feature list + bookmark js snippet + snapshots + stats -+ \ No newline at end of file ++ private links \ No newline at end of file diff --git a/webroot/lib/summoner.class.php b/webroot/lib/summoner.class.php index de03bd6..588168a 100644 --- a/webroot/lib/summoner.class.php +++ b/webroot/lib/summoner.class.php @@ -377,6 +377,20 @@ class Summoner { return $ret; } + + /** + * a very simple HTTP_AUTH authentication. + */ + static function simpleAuth() { + if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) + || $_SERVER['PHP_AUTH_USER'] !== FRONTEND_USERNAME || $_SERVER['PHP_AUTH_PW'] !== FRONTEND_PASSWORD + ) { + header('WWW-Authenticate: Basic realm="Insipid edit area"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'No Access.'; + exit; + } + } } ?> diff --git a/webroot/view/_head.php b/webroot/view/_head.php index 2789346..320d9ff 100644 --- a/webroot/view/_head.php +++ b/webroot/view/_head.php @@ -32,7 +32,7 @@ - Insipid. Personal bookmarks. + Your personal bookmarks - Insipid diff --git a/webroot/view/edit.inc.php b/webroot/view/edit.inc.php new file mode 100644 index 0000000..c4fe973 --- /dev/null +++ b/webroot/view/edit.inc.php @@ -0,0 +1,56 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0. + * + */ +$submitFeedback = false; +$formData = false; + +# very simple security check. +# can be extended in the future. +Summoner::simpleAuth(); + +$_requestMode = false; +if(isset($_GET['m']) && !empty($_GET['m'])) { + $_requestMode = trim($_GET['m']); + $_requestMode = Summoner::validate($_requestMode,'nospace') ? $_requestMode : "all"; +} + +$_id = false; +if(isset($_GET['id']) && !empty($_GET['id'])) { + $_id = trim($_GET['id']); + $_id = Summoner::validate($_id,'nospace') ? $_id : false; +} + +switch ($_requestMode) { + case 'link': + default: + $linkObj = new Link($DB); + $link = $linkObj->load($_id); + if(empty($link)) { + header("HTTP/1.0 404 Not Found"); + } +} + diff --git a/webroot/view/edit.php b/webroot/view/edit.php new file mode 100644 index 0000000..d449879 --- /dev/null +++ b/webroot/view/edit.php @@ -0,0 +1,28 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0. + * + */ +?> diff --git a/webroot/view/linkinfo.php b/webroot/view/linkinfo.php index 624fc9b..e9b10f2 100644 --- a/webroot/view/linkinfo.php +++ b/webroot/view/linkinfo.php @@ -25,7 +25,7 @@ * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0. * */ - ?> +?>
Error
@@ -39,7 +39,7 @@
-

+

@@ -111,4 +111,9 @@ ?>
+
+
+ edit +
+
diff --git a/webroot/view/overview.php b/webroot/view/overview.php index 011fd94..4e34837 100644 --- a/webroot/view/overview.php +++ b/webroot/view/overview.php @@ -37,9 +37,9 @@

- - - + + +