forked from wallabag/wallabag
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a9e4bfc90 | |||
| 15493df62d | |||
| 82051a6a6a | |||
| 5bf30b0060 | |||
| baea9b6de5 | |||
| fa0483b361 | |||
| b58e261db9 | |||
| d8d1542e52 | |||
| 56ab22d02c | |||
| 6c15854448 | |||
| d91787589b | |||
| 3d8bded89e | |||
| 5f9bff0f71 | |||
| 301e4c5acb | |||
| 572e758bf2 | |||
| 64f8970215 | |||
| a3436d4cba | |||
| 07ee09f49a | |||
| 25b5caeed1 | |||
| 313f4ca785 | |||
| ed06f04077 | |||
| 7aa8ccc47d |
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
vendor
|
||||
composer.phar
|
||||
db/poche.sqlite
|
||||
db/poche.sqlite
|
||||
output
|
||||
phpdoc*
|
||||
15
.travis.yml
Normal file
15
.travis.yml
Normal file
@ -0,0 +1,15 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.4
|
||||
|
||||
branches:
|
||||
only:
|
||||
- dev
|
||||
|
||||
before_script:
|
||||
- composer install
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- nicolas.loeuillet@gmail.com
|
||||
2
CREDITS
2
CREDITS
@ -1,5 +1,5 @@
|
||||
poche is based on :
|
||||
* PHP Readability http://www.keyvan.net/2010/08/php-readability/
|
||||
* PHP Readability https://bitbucket.org/fivefilters/php-readability
|
||||
* Encoding https://github.com/neitanod/forceutf8
|
||||
* logo by Brightmix http://www.iconfinder.com/icondetails/43256/128/jeans_monotone_pocket_icon
|
||||
* icons http://icomoon.io
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Installing poche
|
||||
|
||||
Get the [latest dev version](https://github.com/inthepoche/poche/archive/dev.zip) of poche on github. Unzip it and upload it on your server.
|
||||
Get the [latest version](https://github.com/inthepoche/poche/archive/1.0-beta1.zip) of poche on github. Unzip it and upload it on your server.
|
||||
|
||||
your datas can be stored on sqlite, postgres or mysql databases.
|
||||
|
||||
|
||||
@ -11,6 +11,10 @@ To get news from poche, [follow us on twitter](http://twitter.com/getpoche) or [
|
||||
|
||||
[](http://flattr.com/thing/1265480/poche-a-read-it-later-open-source-system)
|
||||
|
||||
## Installation
|
||||
|
||||
Read the INSTALL.md file.
|
||||
|
||||
## Security
|
||||
You **have** to protect your db/poche.sqlite file. Modify the virtual host of your website to add this condition :
|
||||
```apache
|
||||
@ -31,6 +35,9 @@ location ~ /(db) {
|
||||
## Usage
|
||||
See the documentation on our website : [inthepoche.com](http://inthepoche.com).
|
||||
|
||||
## Travis
|
||||
[](http://travis-ci.org/#!/inthepoche/poche)
|
||||
|
||||
## License
|
||||
Copyright © 2010-2013 Nicolas Lœuillet <nicolas.loeuillet@gmail.com>
|
||||
This work is free. You can redistribute it and/or modify it under the
|
||||
|
||||
11
TODO.md
Normal file
11
TODO.md
Normal file
@ -0,0 +1,11 @@
|
||||
# TODO
|
||||
|
||||
pouvoir annuler la suppression
|
||||
conventions codage ? phing ? vérifier error_log qui trainent
|
||||
phpDocumentor
|
||||
minifier css
|
||||
revoir tous les css
|
||||
barre fixe d'admin sur la page d'un billet ?
|
||||
revoir export (export vers pocket &cie ? )
|
||||
raccourcis clavier
|
||||
date d'ajout d'un lien
|
||||
3
inc/3rdparty/Readability.php
vendored
3
inc/3rdparty/Readability.php
vendored
@ -810,7 +810,8 @@ class Readability
|
||||
return $this->grabArticle($this->body);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
# this line was commented by Nicolas Lœuillet 8/8/13 due to some urls not parsed
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
return $articleContent;
|
||||
|
||||
@ -184,6 +184,13 @@ class Database {
|
||||
return $entries;
|
||||
}
|
||||
|
||||
public function updateContent($id, $content, $user_id) {
|
||||
$sql_action = 'UPDATE entries SET content = ? WHERE id=? AND user_id=?';
|
||||
$params_action = array($content, $id, $user_id);
|
||||
$query = $this->executeQuery($sql_action, $params_action);
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function add($url, $title, $content, $user_id) {
|
||||
$sql_action = 'INSERT INTO entries ( url, title, content, user_id ) VALUES (?, ?, ?, ?)';
|
||||
$params_action = array($url, $title, $content, $user_id);
|
||||
|
||||
@ -18,6 +18,11 @@ class Poche
|
||||
|
||||
function __construct()
|
||||
{
|
||||
if (file_exists('./install') && !DEBUG_POCHE) {
|
||||
Tools::logm('folder /install exists');
|
||||
die('To install your poche with sqlite, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.');
|
||||
}
|
||||
|
||||
$this->store = new Database();
|
||||
$this->init();
|
||||
$this->messages = new Messages();
|
||||
@ -64,6 +69,10 @@ class Poche
|
||||
$filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain');
|
||||
$this->tpl->addFilter($filter);
|
||||
|
||||
# filter for reading time
|
||||
$filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime');
|
||||
$this->tpl->addFilter($filter);
|
||||
|
||||
# Pagination
|
||||
$this->pagination = new Paginator($this->user->getConfigValue('pager'), 'p');
|
||||
}
|
||||
@ -117,6 +126,8 @@ class Poche
|
||||
$last_id = $this->store->getLastId($sequence);
|
||||
if (DOWNLOAD_PICTURES) {
|
||||
$content = filtre_picture($parametres_url['content'], $url->getUrl(), $last_id);
|
||||
Tools::logm('updating content article');
|
||||
$this->store->updateContent($last_id, $content, $this->user->getId());
|
||||
}
|
||||
if (!$import) {
|
||||
$this->messages->add('s', _('the link has been added successfully'));
|
||||
@ -208,7 +219,7 @@ class Poche
|
||||
);
|
||||
}
|
||||
else {
|
||||
Tools::logm('error in view call : entry is NULL');
|
||||
Tools::logm('error in view call : entry is null');
|
||||
}
|
||||
break;
|
||||
default: # home view
|
||||
@ -227,6 +238,13 @@ class Poche
|
||||
return $tpl_vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* update the password of the current user.
|
||||
* if MODE_DEMO is TRUE, the password can't be updated.
|
||||
* @todo add the return value
|
||||
* @todo set the new password in function header like this updatePassword($newPassword)
|
||||
* @return boolean
|
||||
*/
|
||||
public function updatePassword()
|
||||
{
|
||||
if (MODE_DEMO) {
|
||||
@ -251,6 +269,13 @@ class Poche
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if login & password are correct and save the user in session.
|
||||
* it redirects the user to the $referer link
|
||||
* @param string $referer the url to redirect after login
|
||||
* @todo add the return value
|
||||
* @return boolean
|
||||
*/
|
||||
public function login($referer)
|
||||
{
|
||||
if (!empty($_POST['login']) && !empty($_POST['password'])) {
|
||||
@ -281,6 +306,11 @@ class Poche
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* log out the poche user. It cleans the session.
|
||||
* @todo add the return value
|
||||
* @return boolean
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
$this->user = array();
|
||||
@ -290,6 +320,11 @@ class Poche
|
||||
Tools::redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* import from Instapaper. poche needs a ./instapaper-export.html file
|
||||
* @todo add the return value
|
||||
* @return boolean
|
||||
*/
|
||||
private function importFromInstapaper()
|
||||
{
|
||||
# TODO gestion des articles favs
|
||||
@ -324,6 +359,11 @@ class Poche
|
||||
Tools::redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* import from Pocket. poche needs a ./ril_export.html file
|
||||
* @todo add the return value
|
||||
* @return boolean
|
||||
*/
|
||||
private function importFromPocket()
|
||||
{
|
||||
# TODO gestion des articles favs
|
||||
@ -358,6 +398,11 @@ class Poche
|
||||
Tools::redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* import from Readability. poche needs a ./readability file
|
||||
* @todo add the return value
|
||||
* @return boolean
|
||||
*/
|
||||
private function importFromReadability()
|
||||
{
|
||||
# TODO gestion des articles lus / favs
|
||||
@ -393,19 +438,29 @@ class Poche
|
||||
Tools::redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* import datas into your poche
|
||||
* @param string $from name of the service to import : pocket, instapaper or readability
|
||||
* @todo add the return value
|
||||
* @return boolean
|
||||
*/
|
||||
public function import($from)
|
||||
{
|
||||
if ($from == 'pocket') {
|
||||
$this->importFromPocket();
|
||||
return $this->importFromPocket();
|
||||
}
|
||||
else if ($from == 'readability') {
|
||||
$this->importFromReadability();
|
||||
return $this->importFromReadability();
|
||||
}
|
||||
else if ($from == 'instapaper') {
|
||||
$this->importFromInstapaper();
|
||||
return $this->importFromInstapaper();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* export poche entries in json
|
||||
* @return json all poche entries
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
$entries = $this->store->retrieveAll($this->user->getId());
|
||||
@ -415,9 +470,16 @@ class Poche
|
||||
Tools::logm('export view');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks online the latest version of poche and cache it
|
||||
* @param string $which 'prod' or 'dev'
|
||||
* @return string latest $which version
|
||||
*/
|
||||
private function getPocheVersion($which = 'prod')
|
||||
{
|
||||
$cache_file = CACHE . '/' . $which;
|
||||
|
||||
# checks if the cached version file exists
|
||||
if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 86400 ))) {
|
||||
$version = file_get_contents($cache_file);
|
||||
} else {
|
||||
|
||||
@ -170,6 +170,7 @@ class Tools
|
||||
preg_match('#charset="?(.*)"#si', $meta[0], $encoding);
|
||||
# if charset is found set it otherwise, set it to utf-8
|
||||
$html_charset = (!empty($encoding[1])) ? strtolower($encoding[1]) : 'utf-8';
|
||||
if (empty($encoding[1])) $encoding[1] = 'utf-8';
|
||||
} else {
|
||||
$html_charset = 'utf-8';
|
||||
$encoding[1] = '';
|
||||
@ -223,4 +224,13 @@ class Tools
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public static function getReadingTime($text) {
|
||||
$word = str_word_count(strip_tags($text));
|
||||
$minutes = floor($word / 200);
|
||||
$seconds = floor($word % 200 / (200 / 60));
|
||||
$time = array('minutes' => $minutes, 'seconds' => $seconds);
|
||||
|
||||
return $minutes;
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@ define ('STORAGE_SQLITE', './db/poche.sqlite');
|
||||
define ('STORAGE_USER', 'postgres'); # leave blank for sqlite
|
||||
define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite
|
||||
|
||||
define ('POCHE_VERSION', '1.0-beta1');
|
||||
define ('POCHE_VERSION', '1.0-beta2');
|
||||
define ('MODE_DEMO', FALSE);
|
||||
define ('DEBUG_POCHE', FALSE);
|
||||
define ('CONVERT_LINKS_FOOTNOTES', FALSE);
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
include dirname(__FILE__).'/inc/poche/config.inc.php';
|
||||
|
||||
# Parse GET & REFERER vars
|
||||
$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
|
||||
$view = Tools::checkVar('view', 'home');
|
||||
$action = Tools::checkVar('action');
|
||||
@ -17,6 +18,7 @@ $id = Tools::checkVar('id');
|
||||
$_SESSION['sort'] = Tools::checkVar('sort', 'id');
|
||||
$url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
|
||||
|
||||
# poche actions
|
||||
if (isset($_GET['login'])) {
|
||||
# hello you
|
||||
$poche->login($referer);
|
||||
@ -30,12 +32,13 @@ elseif (isset($_GET['config'])) {
|
||||
$poche->updatePassword();
|
||||
}
|
||||
elseif (isset($_GET['import'])) {
|
||||
$poche->import($_GET['from']);
|
||||
$import = $poche->import($_GET['from']);
|
||||
}
|
||||
elseif (isset($_GET['export'])) {
|
||||
$poche->export();
|
||||
}
|
||||
|
||||
# vars to send to templates
|
||||
$tpl_vars = array(
|
||||
'referer' => $referer,
|
||||
'view' => $view,
|
||||
@ -57,5 +60,5 @@ else {
|
||||
$messages = $poche->messages->display('all', FALSE);
|
||||
$tpl_vars = array_merge($tpl_vars, array('messages' => $messages));
|
||||
|
||||
# Aaaaaaand action !
|
||||
# display poche
|
||||
echo $poche->tpl->render($tpl_file, $tpl_vars);
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
# import script to upgrade from poche 0.3
|
||||
$db_path = 'sqlite:../db/poche.sqlite';
|
||||
$handle = new PDO($db_path);
|
||||
$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
0
phpunit.xml.dist
Normal file
0
phpunit.xml.dist
Normal file
@ -6,4 +6,6 @@
|
||||
<link rel="stylesheet" href="./tpl/css/style.css" media="all">
|
||||
<link rel="stylesheet" href="./tpl/css/style-{{ constant('THEME') }}.css" media="all" title="{{ constant('THEME') }} theme">
|
||||
<link rel="stylesheet" href="./tpl/css/messages.css" media="all">
|
||||
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
||||
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
||||
<script src="./tpl/js/jquery-2.0.3.min.js"></script>
|
||||
<script type="text/javascript">$(document).ready(function(){$("body").prepend('<a href="#top" class="top_link" title="{% trans "back to top" %}"><img src="./tpl/img/{{ constant("THEME") }}/backtotop.png" alt={% trans "back to top" %}"/></a>');$(".top_link").css({position:"fixed",right:"15px",bottom:"15px",display:"none",padding:"20px",background:"#ccc","-moz-border-radius":"40px","-webkit-border-radius":"40px","border-radius":"40px",opacity:"0.9","z-index":"2000"});$(window).scroll(function(){posScroll=$(document).scrollTop();if(posScroll>=400)$(".top_link").fadeIn(600);else $(".top_link").fadeOut(600)})})</script>
|
||||
@ -20,7 +20,7 @@
|
||||
<p><ul>
|
||||
<li>{% trans "your version" %} : <strong>{{ constant('POCHE_VERSION') }}</strong></li>
|
||||
<li>{% trans "latest stable version" %} : {{ prod }}. {% if compare_prod == -1 %}<strong><a href="http://inthepoche.com/?pages/T%C3%A9l%C3%A9charger-poche">{% trans "a more recent stable version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>
|
||||
<li>{% trans "latest dev version" %} : {{ dev }}. {% if compare_dev == -1 %}<strong><a href="http://inthepoche.com/?pages/T%C3%A9l%C3%A9charger-poche">{% trans "a more recent development version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>
|
||||
{% if constant('DEBUG_POCHE') == 1 %}<li>{% trans "latest dev version" %} : {{ dev }}. {% if compare_dev == -1 %}<strong><a href="http://inthepoche.com/?pages/T%C3%A9l%C3%A9charger-poche">{% trans "a more recent development version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>{% endif %}
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
@ -120,11 +120,6 @@ header h1 {
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
#main .entrie .url {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
/*** ***/
|
||||
/*** ARTICLE PAGE ***/
|
||||
|
||||
@ -241,4 +236,8 @@ a, a:hover, a:visited {
|
||||
|
||||
footer {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.reading-time {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
@ -19,6 +19,7 @@
|
||||
<a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" href="./?action=toggle_archive&id={{ entry.id|e }}"><span></span></a></li>
|
||||
<li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" href="./?action=toggle_fav&id={{ entry.id|e }}"><span></span></a></li>
|
||||
<li><a title="{% trans "delete" %}" class="tool delete" href="./?action=delete&id={{ entry.id|e }}"><span></span></a></li>
|
||||
<li class="reading-time">{{ entry.content| getReadingTime }} min</li>
|
||||
</li>
|
||||
</ul>
|
||||
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
|
||||
|
||||
BIN
tpl/img/light/backtotop.png
Executable file
BIN
tpl/img/light/backtotop.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 326 B |
BIN
tpl/img/logo.png
BIN
tpl/img/logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 1.3 KiB |
6
tpl/js/jquery-2.0.3.min.js
vendored
Normal file
6
tpl/js/jquery-2.0.3.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -5,12 +5,12 @@
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<meta name="viewport" content="initial-scale=1.0">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=10">
|
||||
<title>{% block title %}{% endblock %} - poche</title>
|
||||
{% include '_head.twig' %}
|
||||
{% include '_bookmarklet.twig' %}
|
||||
{% include '_head.twig' %}
|
||||
{% include '_bookmarklet.twig' %}
|
||||
</head>
|
||||
<body>
|
||||
{% include '_top.twig' %}
|
||||
@ -24,6 +24,6 @@
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
{% include '_footer.twig' %}
|
||||
{% include '_footer.twig' %}
|
||||
</body>
|
||||
</html>
|
||||
@ -5,7 +5,7 @@
|
||||
<div class="tools">
|
||||
<ul class="tools">
|
||||
<li>
|
||||
<li><a href="{{ referer }}" title="{% trans "back to home" %}" class="tool back"><span></span></a></li>
|
||||
<li><a href="./" title="{% trans "back to home" %}" class="tool back"><span></span></a></li>
|
||||
<a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" href="./?action=toggle_archive&id={{ entry.id|e }}"><span></span></a></li>
|
||||
<li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" href="./?action=toggle_fav&id={{ entry.id|e }}"><span></span></a></li>
|
||||
<li><a title="{% trans "delete" %}" class="tool delete" href="./?action=delete&id={{ entry.id|e }}"><span></span></a></li>
|
||||
@ -25,8 +25,8 @@
|
||||
<div class="tools">
|
||||
<ul class="tools">
|
||||
<li>
|
||||
<li><a href="{{ referer }}" title="{% trans "back to home" %}" class="tool back"><span></span></a></li>
|
||||
<li><a href="#" title="{% trans "back to top" %}" class="tool top"><span></span></a></li>
|
||||
<li><a href="./?" title="{% trans "back to home" %}" class="tool back"><span></span></a></li>
|
||||
<li><a href="#top" title="{% trans "back to top" %}" class="tool top"><span></span></a></li>
|
||||
<a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" href="./?action=toggle_archive&id={{ entry.id|e }}"><span></span></a></li>
|
||||
<li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" href="./?action=toggle_fav&id={{ entry.id|e }}"><span></span></a></li>
|
||||
<li><a title="{% trans "delete" %}" class="tool delete" href="./?action=delete&id={{ entry.id|e }}"><span></span></a></li>
|
||||
|
||||
Reference in New Issue
Block a user