]> 91.132.146.200 Git - insipid.git/commitdiff
edit a link and simple http auth. Should work for now...
authorBanana <banana@optimus.de>
Sun, 12 Feb 2017 10:00:40 +0000 (11:00 +0100)
committerBanana <banana@optimus.de>
Sun, 12 Feb 2017 10:00:40 +0000 (11:00 +0100)
ChangeLog
TODO
webroot/lib/summoner.class.php
webroot/view/_head.php
webroot/view/edit.inc.php [new file with mode: 0644]
webroot/view/edit.php [new file with mode: 0644]
webroot/view/linkinfo.php
webroot/view/overview.php

index 61ae0c3a132b676ae77e049482a58050027d15d9..ead926ae2b2e2c8ecc31d01b6ccf71f8c2ab7e83 100755 (executable)
--- 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 f602ef85193358a34059e51115e22995aabeea6e..ec5a58ad7cc9ca44e36d2994f9804431ce00dedf 100755 (executable)
--- 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
index de03bd61e2bdb8f072adf89e851f073dad086dc4..588168a14ec476e1fdbbe33a8ade0ef4682b2b9d 100644 (file)
@@ -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;
+           }
+       }
 }
 
 ?>
index 2789346b9fc2c5dc0a2b91ca2553e32aa734ea34..320d9ffa702168f34833ef752e611c78450f505e 100644 (file)
@@ -32,7 +32,7 @@
     <meta charset="utf-8">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Insipid. Personal bookmarks.</title>
+    <title>Your personal bookmarks - Insipid</title>
     <link rel="stylesheet" href="asset/css/foundation.min.css">
     <link rel="stylesheet" href="asset/foundation-icons/foundation-icons.css">
     <link rel="stylesheet" href="asset/flexdatalist/jquery.flexdatalist.min.css">
diff --git a/webroot/view/edit.inc.php b/webroot/view/edit.inc.php
new file mode 100644 (file)
index 0000000..c4fe973
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Insipid
+ * Personal web-bookmark-system
+ *
+ * Copyright 2016-2017 Johannes Keßler
+ *
+ * Development starting from 2011: Johannes Keßler
+ * https://www.bananas-playground.net/projekt/insipid/
+ *
+ * creator:
+ * Luke Reeves <luke@neuro-tech.net>
+ *
+ * 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 (file)
index 0000000..d449879
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Insipid
+ * Personal web-bookmark-system
+ *
+ * Copyright 2016-2017 Johannes Keßler
+ *
+ * Development starting from 2011: Johannes Keßler
+ * https://www.bananas-playground.net/projekt/insipid/
+ *
+ * creator:
+ * Luke Reeves <luke@neuro-tech.net>
+ *
+ * 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.
+ *
+ */
+?>
index 624fc9bfa6a7df77706da770764df682b7fca8ad..e9b10f267286378bb6de0c064487c00115181035 100644 (file)
@@ -25,7 +25,7 @@
  * along with this program.  If not, see http://www.gnu.org/licenses/gpl-3.0.
  *
  */
- ?>
+?>
 <?php if(empty($link)) { ?>
 <div class="callout alert">
        <h5>Error</h5>
@@ -39,7 +39,7 @@
 </div>
 <div class="row expanded">
        <div class="large-12 columns">
-               <p class="text-right"><a href="index.php" title="... back to home"><i class="fi-home"></i></a></p>
+               <p class="text-right"><a href="index.php" title="... back to home" class="tiny button"><i class="fi-home"></i></a></p>
        </div>
 </div>
 <div class="row">
            ?>
        </div>
 </div>
+<div class="row">
+       <div class="small-12 medium-12 columns text-right">
+        <a href="index.php?p=edit&m=link&id=<?php echo $link['hash']; ?>" class="button tiny alert"><i class="fi-page-edit"></i> edit</a>
+       </div>
+</div>
 
index 011fd948b869d99d2cb7522bdd80366f00f96d3b..4e348375be8357e810ba36211196f3e5c630f99b 100644 (file)
@@ -37,9 +37,9 @@
 <div class="row expanded">
        <div class="large-12 columns">
                <p class="text-right">
-                       <a href="index.php?p=overview&m=tag" title="all tags"><i class="fi-price-tag"></i></a>
-                       <a href="index.php?p=overview&m=category" title="all categories"><i class="fi-ticket"></i></a>
-                       <a href="index.php" title="... back to home"><i class="fi-home"></i></a>
+                       <a href="index.php?p=overview&m=tag" title="all tags" class="tiny button"><i class="fi-price-tag"></i></a>
+                       <a href="index.php?p=overview&m=category" title="all categories" class="tiny button"><i class="fi-ticket"></i></a>
+                       <a href="index.php" title="... back to home" class="tiny button"><i class="fi-home"></i></a>
                </p>
        </div>
 </div>