diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 9adb16440..6244df887 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -407,14 +407,15 @@ 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 ? OR title LIKE ? OR url LIKE ?"); //searches in content, title and URL - $query->execute(array($search,$search,$search)); - $entries = $query->fetchAll(); - return $entries; - } + + public function search($term, $user_id, $limit = '') { + $search = '%'.$term.'%'; + $sql_action = "SELECT * FROM entries WHERE user_id=? AND (content LIKE ? OR title LIKE ? OR url LIKE ?) "; //searches in content, title and URL + $sql_action .= $this->getEntriesOrder().' ' . $limit; + $params_action = array($user_id, $search, $search, $search); + $query = $this->executeQuery($sql_action, $params_action); + return $query->fetchAll(); + } 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 d1b0c945b..ee3b2ac26 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -597,14 +597,19 @@ 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 'search': + if (isset($_GET['search'])) { + $search = filter_var($_GET['search'], FILTER_SANITIZE_STRING); + $tpl_vars['entries'] = $this->store->search($search, $this->user->getId()); + $count = count($tpl_vars['entries']); + $this->pagination->set_total($count); + $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), + $this->pagination->page_links('?view=' . $view . '?search=' . $search . '&sort=' . $_SESSION['sort'] . '&' )); + $tpl_vars['page_links'] = $page_links; + $tpl_vars['nb_results'] = $count; + $tpl_vars['search_term'] = $search; + } + break; case 'view': $entry = $this->store->retrieveOneById($id, $this->user->getId()); if ($entry != NULL) { diff --git a/install/index.php b/install/index.php index e63b24239..e02952e01 100644 --- a/install/index.php +++ b/install/index.php @@ -24,7 +24,7 @@ if (isset($_GET['clean'])) { if (isset($_POST['download'])) { if (!file_put_contents("cache/vendor.zip", fopen("http://static.wallabag.org/files/vendor.zip", 'r'))) { - $errors[] = 'Impossible to download vendor.zip. Please download it manually<∕a> and unzip it in your wallabag folder.'; + $errors[] = 'Impossible to download vendor.zip. Please download it manually and unzip it in your wallabag folder.'; } else { if (extension_loaded('zip')) { @@ -165,7 +165,7 @@ else if (isset($_POST['install'])) { - wallabag — installation + wallabag - installation @@ -176,7 +176,7 @@ else if (isset($_POST['install'])) { - + diff --git a/themes/baggy/config.twig b/themes/baggy/config.twig old mode 100644 new mode 100755 index a13af0c81..fc7890ec9 --- a/themes/baggy/config.twig +++ b/themes/baggy/config.twig @@ -105,37 +105,20 @@ {% endif %}

{% trans "Import" %}

-

{% trans "Importing from other services can be quite long, and webservers default configuration often prevents long scripts execution time, so it must be done in multiple parts." %}

-

1. {% trans "First, select the export file on your computer and upload it." %}

-
+

{% trans "You can import your Pocket, Readability, Instapaper, Wallabag or any data in appropriate json or html format." %}

+

{% trans "Please select export file on your computer:" %}

+
- +
- -
-

2. {% trans "Then, click on the right link below." %}

- - - {% if token == '' %} -

{% trans "3. Your feed token is currently empty and must first be generated to fetch content. Click here to generate it." %}

- {% else %} -

3. {% trans "Finally, you have to fetch content for imported items." %} {% trans "Click here" %} {% trans "to fetch content for 10 articles" %}.

-

{% trans "If you have console access to your server, you can also create a cron task:" %}

-
0 */4 * * *  cd /path/to/wallabag && php cron.php --limit=10 --user-id={{user_id}} --token={{token}} >/dev/null 2>&1
- {% endif %} - +

{% trans "Export your wallabag data" %}

{% if constant('STORAGE') == 'sqlite' %}

{% trans "Click here" %} {% trans "to download your database." %}

{% endif %} diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index 6e328ba1e..9a45544be 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@ -777,7 +777,7 @@ margin-top:1em; } .warning { - font-size: 3em; + /* font-size: 3em; color: #999; font-style: italic; position: absolute; @@ -786,7 +786,10 @@ margin-top:1em; width: 100%; text-align: center; padding-right: 5%; - margin-top: -2em; + margin-top: -2em;*/ + font-weight: bold; + display: block; + width: 100%; } /* ========================================================================== diff --git a/themes/baggy/home.twig b/themes/baggy/home.twig index e34897fa8..5dd913077 100755 --- a/themes/baggy/home.twig +++ b/themes/baggy/home.twig @@ -25,9 +25,15 @@ {% block pager %} {% if nb_results > 1 %}
-
{{ nb_results }} {% trans "results" %}
+
{{ nb_results }} {% trans "results" %}{% if search_term is defined %}{% trans " found for « " %} {{ search_term }} »{% endif %}
{{ page_links | raw }}
+ {% elseif nb_results == 1 %} + {% if search_term is defined %} +
+
{% trans "Only one result found for " %} « {{ search_term }} »
+
+ {% endif %} {% endif %} {% endblock %}
diff --git a/themes/baggy/layout.twig b/themes/baggy/layout.twig old mode 100644 new mode 100755 index dfebc3eac..8de12749f --- a/themes/baggy/layout.twig +++ b/themes/baggy/layout.twig @@ -21,6 +21,9 @@ {% block precontent %}{% endblock %} {% block messages %} {% include '_messages.twig' %} + {% if includeImport %} + {% include '_import.twig' %} + {% endif %} {% endblock %}
{% block content %}{% endblock %} diff --git a/themes/courgette/home.twig b/themes/courgette/home.twig index 5b229ce9e..6ba72d353 100755 --- a/themes/courgette/home.twig +++ b/themes/courgette/home.twig @@ -26,9 +26,15 @@ {% block pager %} {% if nb_results > 1 %}
-
{{ nb_results }} {% trans "results" %}
+
{{ nb_results }} {% trans "results" %}{% if search_term is defined %}{% trans " found for « " %} {{ search_term }} »{% endif %}
{{ page_links | raw }}
+ {% elseif nb_results == 1 %} + {% if search_term is defined %} +
+
{% trans "Only one result found for " %} « {{ search_term }} »
+
+ {% endif %} {% endif %} {% endblock %} {% for entry in entries %} diff --git a/themes/default/_sorting.twig b/themes/default/_sorting.twig index dfa5cfe40..ce3d38bc9 100755 --- a/themes/default/_sorting.twig +++ b/themes/default/_sorting.twig @@ -1,6 +1,6 @@ {% if entries|length > 1 %} {% endif %} diff --git a/themes/default/home.twig b/themes/default/home.twig index e06d65ab4..d6cb98e8f 100755 --- a/themes/default/home.twig +++ b/themes/default/home.twig @@ -31,9 +31,15 @@ {% block pager %} {% if nb_results > 1 %}
-
{{ nb_results }} {% trans "results" %}
+
{{ nb_results }} {% trans "results" %}{% if search_term is defined %}{% trans " found for « " %} {{ search_term }} »{% endif %}
{{ page_links | raw }}
+ {% elseif nb_results == 1 %} + {% if search_term is defined %} +
+
{% trans "Only one result found for " %} « {{ search_term }} »
+
+ {% endif %} {% endif %} {% endblock %} {% for entry in entries %}