From: Nicolas LÅ“uillet Date: Mon, 24 Mar 2014 10:12:56 +0000 (+0100) Subject: Merge pull request #582 from mariroz/fix-session-livetime X-Git-Tag: 1.6.0^2~20 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=d619120fc45693b73d14e4f2c8b98fc5b5489b7c;hp=03832b45e1d29fe2c301ba34412e1de0ae4c57c0;p=github%2Fwallabag%2Fwallabag.git Merge pull request #582 from mariroz/fix-session-livetime fix of localhost cookie related to nginx binding to 0.0.0.0 --- diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 5b51b507..6aad16c1 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -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 diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index b1143d0b..c7aa71e8 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -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 diff --git a/inc/poche/global.inc.php b/inc/poche/global.inc.php index d22b0588..15091387 100644 --- a/inc/poche/global.inc.php +++ b/inc/poche/global.inc.php @@ -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 { diff --git a/themes/baggy/_menu.twig b/themes/baggy/_menu.twig index 5226728b..f1b75cd5 100644 --- a/themes/baggy/_menu.twig +++ b/themes/baggy/_menu.twig @@ -6,6 +6,9 @@
  • {% trans "tags" %}
  • {% trans "save a link" %} {% include '_pocheit-form.twig' %} +
  • +
  • {% trans "search" %} + {% include '_search-form.twig' %}
  • {% trans "config" %}
  • {% trans "logout" %}
  • diff --git a/themes/baggy/_search-form.twig b/themes/baggy/_search-form.twig new file mode 100644 index 00000000..1fd4154e --- /dev/null +++ b/themes/baggy/_search-form.twig @@ -0,0 +1,21 @@ +
    +
    + + : + +
    +
    + \ No newline at end of file diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index 61e0b47e..6e328ba1 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@ -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 ========================================================================== */ diff --git a/themes/default/_menu.twig b/themes/default/_menu.twig index 55583b3d..0e7dd0a7 100644 --- a/themes/default/_menu.twig +++ b/themes/default/_menu.twig @@ -4,8 +4,10 @@
  • {% trans "archive" %}
  • {% trans "tags" %}
  • {% trans "save a link" %}
  • +
  • {% trans "search" %}
  • {% trans "config" %}
  • {% trans "logout" %}
  • {% 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 index 00000000..74f420d0 --- /dev/null +++ b/themes/default/_search-form.twig @@ -0,0 +1,23 @@ +
    +
    +

    + + : + +

    +
    +
    + \ No newline at end of file diff --git a/themes/default/home.twig b/themes/default/home.twig index bd5fc2d6..b6185df1 100755 --- a/themes/default/home.twig +++ b/themes/default/home.twig @@ -12,7 +12,8 @@ {% include '_menu.twig' %} {% endblock %} {% block precontent %} - {% include '_sorting.twig' %} + +{% include '_sorting.twig' %} {% endblock %} {% block content %} {% if tag %}