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,$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($id,$search,$search,$search);
+ $query = $this->executeQuery($sql_action, $params_action);
+ return $query->fetchAll();
}
public function retrieveAllTags($user_id, $term = null) {
);
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']);
- }
+ 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 (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 <a href="http://wllbg.org/vendor">download it manually<∕a> and unzip it in your wallabag folder.';
+ $errors[] = 'Impossible to download vendor.zip. Please <a href="http://wllbg.org/vendor">download it manually</a> and unzip it in your wallabag folder.';
}
else {
if (extension_loaded('zip')) {
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<![endif]-->
- <title>wallabag — installation</title>
+ <title>wallabag - installation</title>
<link rel="shortcut icon" type="image/x-icon" href="themes/baggy/img/favicon.ico" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="themes/baggy/img/apple-touch-icon-144x144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="themes/baggy/img/apple-touch-icon-72x72-precomposed.png">
<link rel="stylesheet" href="themes/baggy/css/main.css" media="all">
<link rel="stylesheet" href="themes/baggy/css/messages.css" media="all">
<link rel="stylesheet" href="themes/baggy/css/print.css" media="print">
- <script src="themes/baggy/js/jquery-2.0.3.min.js"></script>
+ <script src="themes/default/js/jquery-2.0.3.min.js"></script>
<script src="themes/baggy/js/init.js"></script>
</head>
<body>
{% block pager %}
{% if nb_results > 1 %}
<div class="results">
- <div class="nb-results">{{ nb_results }} {% trans "results" %}</div>
+ <div class="nb-results">{{ nb_results }} {% trans "results" %}{% if search_term is defined %}{% trans " found for « " %} {{ search_term }} »{% endif %}</div>
{{ page_links | raw }}
</div>
+ {% elseif nb_results == 1 %}
+ {% if search_term is defined %}
+ <div class="results">
+ <div class="nb-results">{% trans "Only one result found for " %} « {{ search_term }} »</div>
+ </div>
+ {% endif %}
{% endif %}
{% endblock %}
<div id="list-entries" class="list-entries">
{% block pager %}
{% if nb_results > 1 %}
<div class="results">
- <div class="nb-results">{{ nb_results }} {% trans "results" %}</div>
+ <div class="nb-results">{{ nb_results }} {% trans "results" %}{% if search_term is defined %}{% trans " found for « " %} {{ search_term }} »{% endif %}</div>
{{ page_links | raw }}
</div>
+ {% elseif nb_results == 1 %}
+ {% if search_term is defined %}
+ <div class="results">
+ <div class="nb-results">{% trans "Only one result found for " %} « {{ search_term }} »</div>
+ </div>
+ {% endif %}
{% endif %}
{% endblock %}
{% for entry in entries %}
{% if entries|length > 1 %}
<ul id="sort">
- <li><a href="./?sort=ia&view={{ view }}&id={{ id }}"><img src="{{ poche_url }}themes/{{ theme }}/img/{{ theme }}/top.png" alt="{% trans "by date asc" %}" title="{% trans "by date asc" %}" /></a> {% trans "by date" %} <a href="./?sort=id&view={{ view }}&id={{ id }}"><img src="{{ poche_url }}themes/{{ theme }}/img/{{ theme }}/down.png" alt="{% trans "by date desc" %}" title="{% trans "by date desc" %}" /></a></li>
- <li><a href="./?sort=ta&view={{ view }}&id={{ id }}"><img src="{{ poche_url }}themes/{{ theme }}/img/{{ theme }}/top.png" alt="{% trans "by title asc" %}" title="{% trans "by title asc" %}" /></a> {% trans "by title" %} <a href="./?sort=td&view={{ view }}&id={{ id }}"><img src="{{ poche_url }}themes/{{ theme }}/img/{{ theme }}/down.png" alt="{% trans "by title desc" %}" title="{% trans "by title desc" %}" /></a></li>
+ <li><a href="./?sort=ia&view={{ view }}{% if search_term is defined %}&search={{ search_term }}{% endif %}&id={{ id }}"><img src="{{ poche_url }}themes/{{ theme }}/img/{{ theme }}/top.png" alt="{% trans "by date asc" %}" title="{% trans "by date asc" %}" /></a> {% trans "by date" %} <a href="./?sort=id&view={{ view }}{% if search_term is defined %}&search={{ search_term }}{% endif %}&id={{ id }}"><img src="{{ poche_url }}themes/{{ theme }}/img/{{ theme }}/down.png" alt="{% trans "by date desc" %}" title="{% trans "by date desc" %}" /></a></li>
+ <li><a href="./?sort=ta&view={{ view }}{% if search_term is defined %}&search={{ search_term }}{% endif %}&id={{ id }}"><img src="{{ poche_url }}themes/{{ theme }}/img/{{ theme }}/top.png" alt="{% trans "by title asc" %}" title="{% trans "by title asc" %}" /></a> {% trans "by title" %} <a href="./?sort=td&view={{ view }}{% if search_term is defined %}&search={{ search_term }}{% endif %}&id={{ id }}"><img src="{{ poche_url }}themes/{{ theme }}/img/{{ theme }}/down.png" alt="{% trans "by title desc" %}" title="{% trans "by title desc" %}" /></a></li>
</ul>
{% endif %}
{% block pager %}
{% if nb_results > 1 %}
<div class="results">
- <div class="nb-results">{{ nb_results }} {% trans "results" %}</div>
+ <div class="nb-results">{{ nb_results }} {% trans "results" %}{% if search_term is defined %}{% trans " found for « " %} {{ search_term }} »{% endif %}</div>
{{ page_links | raw }}
</div>
+ {% elseif nb_results == 1 %}
+ {% if search_term is defined %}
+ <div class="results">
+ <div class="nb-results">{% trans "Only one result found for " %} « {{ search_term }} »</div>
+ </div>
+ {% endif %}
{% endif %}
{% endblock %}
{% for entry in entries %}