]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #582 from mariroz/fix-session-livetime
authorNicolas Lœuillet <nicolas@loeuillet.org>
Mon, 24 Mar 2014 10:12:56 +0000 (11:12 +0100)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Mon, 24 Mar 2014 10:12:56 +0000 (11:12 +0100)
fix of localhost cookie related to nginx binding to 0.0.0.0

inc/poche/Database.class.php
inc/poche/Poche.class.php
inc/poche/global.inc.php
themes/baggy/_menu.twig
themes/baggy/_search-form.twig [new file with mode: 0644]
themes/baggy/css/main.css
themes/default/_menu.twig
themes/default/_search-form.twig [new file with mode: 0644]
themes/default/home.twig

index 5b51b507abb62348fb2f8cfc92e5d528e22a233a..6aad16c11e16d3e0ac6f71d1a110cf42ecdfee45 100755 (executable)
@@ -388,6 +388,14 @@ class Database {
     public function getLastId($column = '') {
         return $this->getHandle()->lastInsertId($column);
     }
+       
+       public function search($term){
+               $search = '%'.$term.'%';
+               $query = $this->getHandle()->prepare("SELECT * FROM entries WHERE content LIKE ?");
+               $query->execute(array($search));
+               $entries = $query->fetchAll();
+               return $entries;
+       }
 
     public function retrieveAllTags($user_id, $term = null) {
         $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags
index b1143d0b584a4c1a968fd0352676dafa877e42ca..c7aa71e8f77af35737822a573432dd290a7280d9 100755 (executable)
@@ -603,6 +603,14 @@ class Poche
                     'tags' => $tags,
                 );
                 break;
+                               
+                       case 'search':
+                               if (isset($_GET['search'])){
+                                       $search = $_GET['search'];
+                                       $tpl_vars['entries'] = $this->store->search($search);
+                                       $tpl_vars['nb_results'] = count($tpl_vars['entries']);
+                               }
+                               break;
             case 'view':
                 $entry = $this->store->retrieveOneById($id, $this->user->getId());
                 if ($entry != NULL) {
@@ -772,8 +780,7 @@ class Poche
         $this->emptyCache();
         
         Tools::redirect('?view=config');
-    }
-
+    }  
     /**
      * get credentials from differents sources
      * it redirects the user to the $referer link
index d22b05887e8ea85f86017a763d4ecaeef2a7d940..15091387390e05cc5f3c0a9ad03de26c7976c626 100644 (file)
@@ -38,7 +38,7 @@ if (! file_exists(ROOT . '/vendor/autoload.php')) {
     require_once ROOT . '/vendor/autoload.php';
 }
 
-# system configuration; database credentials et cetera
+# system configuration; database credentials et caetera
 if (! file_exists(INCLUDES . '/poche/config.inc.php')) {
     Poche::$configFileAvailable = false;
 } else {
index 5226728bb194599d5893acd0e642f22c32fee212..f1b75cd50056099c333fe48970ca90c8479a7b48 100644 (file)
@@ -6,6 +6,9 @@
                 <li><a href="./?view=tags" {% if view == 'tags' %}class="current"{% endif %}>{% trans "tags" %}</a></li>
                 <li style="position: relative;"><a href="javascript: void(null);" id="bagit">{% trans "save a link" %}</a>
                     {% include '_pocheit-form.twig' %}
+                </li>
+                               <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans "search" %}</a>
+                    {% include '_search-form.twig' %}
                 </li>
                 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
                 <li><a class="icon icon-power" href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
diff --git a/themes/baggy/_search-form.twig b/themes/baggy/_search-form.twig
new file mode 100644 (file)
index 0000000..1fd4154
--- /dev/null
@@ -0,0 +1,21 @@
+<div id="search-form" class="messages info">                   
+<form method="get" action="index.php">
+               <input type="hidden" name="view" value="search"></input>
+        <label><a href="javascript: void(null);" id="search-form-close">X</a>{% trans "Search" %}</label> : <input type="text" name="search" />
+               <input id="submit-search" type="submit" value="{% trans "Search" %} !"></input>
+</form>
+</div>
+<script type="text/javascript">
+    $(document).ready(function() {
+
+        $("#search-form").hide();
+
+        $("#search").click(function(){
+            $("#search-form").toggle();
+            $("#search").toggleClass("current");
+            $("#search-arrow").toggleClass("arrow-down");
+        });
+
+
+    });
+</script>
\ No newline at end of file
index 61e0b47e6b6ec3b06a7d832ff72ab620b60cdd42..6e328ba1e4addd810571cac3e736824e0432b80c 100755 (executable)
@@ -612,6 +612,56 @@ a#bagit-form-close:hover {
   margin-top: 10px;
 }
 
+/* ==========================================================================
+  2.2 = "search for articles" popup div related styles
+  ========================================================================== */
+#search-form {
+  background: rgba(0,0,0,0.5);
+  position: absolute;
+  top: 0;
+  left: 10em;
+  z-index: 20;
+  height: 100%;
+  width: 100%;
+  margin: 0;
+  margin-top: -30%;
+  padding: 2em;
+  display: none;
+  border-left: 1px #EEE solid;
+}
+
+#search-form form {
+  background: #FFF;
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index: 20;
+  border: 10px solid #000;
+  width: 400px;
+  height: 200px;
+  /* margin: -150px 0 0 -300px; */
+  padding: 2em;
+}
+
+a#search-form-close {
+  background: #000;
+  color: #FFF;
+  padding: 0.2em 0.5em;
+  text-decoration: none;
+  display: inline-block;
+  float: right;
+  font-size: 1.2em;
+}
+a#search-form-close:hover {
+  background: #999;
+  color: #000;
+}
+
+#submit-search{
+margin-left: 4em;
+margin-top:1em;
+}
+
 /* ==========================================================================
    3 = Pictos
    ========================================================================== */
index 55583b3d1947769864bcdd9ad504a7ba45ea0bc1..0e7dd0a7a82ffe395ffdad988a6625ba88cc34da 100644 (file)
@@ -4,8 +4,10 @@
                 <li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
                 <li><a href="./?view=tags" {% if view == 'tags' %}class="current"{% endif %}>{% trans "tags" %}</a></li>
                 <li><a href="javascript: void(null);" id="pocheit">{% trans "save a link" %}</a><span id="pocheit-arrow"></span></li>
+                               <li><a href="javascript: void(null);" id="search">{% trans "search" %}</a><span id="search-arrow"></span></li>
                 <li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
                 <li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
             </ul>
             {% include '_pocheit-form.twig' %}
+                       {% include '_search-form.twig' %}
 
diff --git a/themes/default/_search-form.twig b/themes/default/_search-form.twig
new file mode 100644 (file)
index 0000000..74f420d
--- /dev/null
@@ -0,0 +1,23 @@
+<div id="search-form" class="messages info">                   
+<form method="get" action="index.php">
+    <p>
+               <input type="hidden" name="view" value="search"></input>
+        <label>{% trans "Search" %}</label> : <input type="text" placeholder="{% trans "Enter your search here" %}" name="search" />
+               <input type="submit" value="{% trans "Search" %} !"></input>
+    </p>
+</form>
+</div>
+<script type="text/javascript">
+    $(document).ready(function() {
+
+        $("#search-form").hide();
+
+        $("#search").click(function(){
+            $("#search-form").toggle();
+            $("#search").toggleClass("current");
+            $("#search-arrow").toggleClass("arrow-down");
+        });
+
+
+    });
+</script>
\ No newline at end of file
index bd5fc2d6ed1a8749f2a467dc60136f77ac3c359b..b6185df18ba6c57285e30bc4c866119df1275b78 100755 (executable)
@@ -12,7 +12,8 @@
 {% include '_menu.twig' %}
 {% endblock %}
 {% block precontent %}
-            {% include '_sorting.twig' %}
+
+{% include '_sorting.twig' %}
 {% endblock %}
 {% block content %}
             {% if tag %}