aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--app/check_essentials.php14
-rwxr-xr-xapp/config/config.inc.default.php78
-rw-r--r--app/config/config.inc.php78
-rwxr-xr-xbin/install72
-rw-r--r--src/Wallabag/CoreBundle/Controller/WallabagRestController.php5
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntriesRepository.php10
7 files changed, 11 insertions, 248 deletions
diff --git a/README.md b/README.md
index 13e730c9..1e33940a 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ More informations on our website: [wallabag.org](http://wallabag.org)
9Keep in mind it's an **instable** branch, everything can be broken :) 9Keep in mind it's an **instable** branch, everything can be broken :)
10 10
11``` 11```
12git clone https://github.com/wallabag/wallabag.git -b refactor 12git clone https://github.com/wallabag/wallabag.git -b v2
13cd wallabag 13cd wallabag
14composer install 14composer install
15php app/console wallabag:install 15php app/console wallabag:install
diff --git a/app/check_essentials.php b/app/check_essentials.php
deleted file mode 100644
index 073b6032..00000000
--- a/app/check_essentials.php
+++ /dev/null
@@ -1,14 +0,0 @@
1<?php
2if (!file_exists(__DIR__ . '/config/config.inc.php')) {
3 die('wallabag seems to be not installed. Please execute ./bin/install before.');
4}
5
6if (version_compare(PHP_VERSION, '5.3.3', '<')) {
7 die('This software require PHP 5.3.3 minimum');
8}
9
10if (version_compare(PHP_VERSION, '5.4.0', '<')) {
11 if (! ini_get('short_open_tag')) {
12 die('This software require to have short tags enabled, check your php.ini => "short_open_tag = On"');
13 }
14} \ No newline at end of file
diff --git a/app/config/config.inc.default.php b/app/config/config.inc.default.php
deleted file mode 100755
index bbce4eab..00000000
--- a/app/config/config.inc.default.php
+++ /dev/null
@@ -1,78 +0,0 @@
1<?php
2/**
3 * wallabag, self hostable application allowing you to not miss any content anymore
4 *
5 * @category wallabag
6 * @author Nicolas Lœuillet <nicolas@loeuillet.org>
7 * @copyright 2013
8 * @license http://opensource.org/licenses/MIT see COPYING file
9 */
10
11@define ('SALT', ''); # put a strong string here
12@define ('LANG', 'en_EN.utf8');
13
14@define ('STORAGE', 'sqlite'); # postgres, mysql or sqlite
15
16@define ('STORAGE_SQLITE', ROOT . '/data/db/poche.sqlite'); # if you are using sqlite, where me database file is located
17
18# only for postgres & mysql
19@define ('STORAGE_SERVER', 'localhost');
20@define ('STORAGE_DB', 'poche');
21@define ('STORAGE_USER', 'poche');
22@define ('STORAGE_PASSWORD', 'poche');
23
24#################################################################################
25# Do not trespass unless you know what you are doing
26#################################################################################
27// Change this if http is running on nonstandard port - i.e is behind cache proxy
28@define ('HTTP_PORT', 80);
29
30// Change this if not using the standart port for SSL - i.e you server is behind sslh
31@define ('SSL_PORT', 443);
32
33@define ('MODE_DEMO', FALSE);
34@define ('DEBUG_POCHE', FALSE);
35
36//default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL.
37@define ('ERROR_REPORTING', E_ALL & ~E_NOTICE);
38
39@define ('DOWNLOAD_PICTURES', FALSE); # This can slow down the process of adding articles
40@define ('REGENERATE_PICTURES_QUALITY', 75);
41@define ('CONVERT_LINKS_FOOTNOTES', FALSE);
42@define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
43@define ('SHARE_TWITTER', TRUE);
44@define ('SHARE_MAIL', TRUE);
45@define ('SHARE_SHAARLI', FALSE);
46@define ('SHAARLI_URL', 'http://myshaarliurl.com');
47@define ('SHARE_DIASPORA', FALSE);
48@define ('DIASPORA_URL', 'http://diasporapod.com'); # Don't add a / at the end
49@define ('FLATTR', TRUE);
50@define ('FLATTR_API', 'https://api.flattr.com/rest/v2/things/lookup/?url=');
51@define ('NOT_FLATTRABLE', '0');
52@define ('FLATTRABLE', '1');
53@define ('FLATTRED', '2');
54@define ('CARROT', FALSE);
55
56// ebook
57@define ('EPUB', TRUE);
58@define ('MOBI', FALSE);
59@define ('PDF', FALSE);
60
61// display or not print link in article view
62@define ('SHOW_PRINTLINK', '1');
63// display or not percent of read in article view. Affects only default theme.
64@define ('SHOW_READPERCENT', '1');
65@define ('ABS_PATH', ROOT . '/data/assets/');
66
67@define ('DEFAULT_THEME', 'baggy');
68
69@define ('THEME', ROOT . '/src/Wallabag/Wallabag/Resources/views');
70@define ('LOCALE', ROOT . '/src/Wallabag/Wallabag/Resources/translations');
71@define ('CACHE', ROOT . '/app/cache');
72
73@define ('PAGINATION', '12');
74
75//limit for download of articles during import
76@define ('IMPORT_LIMIT', 5);
77//delay between downloads (in sec)
78@define ('IMPORT_DELAY', 5);
diff --git a/app/config/config.inc.php b/app/config/config.inc.php
deleted file mode 100644
index 405b9537..00000000
--- a/app/config/config.inc.php
+++ /dev/null
@@ -1,78 +0,0 @@
1<?php
2/**
3 * wallabag, self hostable application allowing you to not miss any content anymore
4 *
5 * @category wallabag
6 * @author Nicolas Lœuillet <nicolas@loeuillet.org>
7 * @copyright 2013
8 * @license http://opensource.org/licenses/MIT see COPYING file
9 */
10
11@define ('SALT', 'ThisTokenIsNotSoSecretChangeIt'); # put a strong string here
12@define ('LANG', 'en_EN.utf8');
13
14@define ('STORAGE', 'sqlite'); # postgres, mysql or sqlite
15
16@define ('STORAGE_SQLITE', ROOT . '/data/db/poche.sqlite'); # if you are using sqlite, where me database file is located
17
18# only for postgres & mysql
19@define ('STORAGE_SERVER', 'localhost');
20@define ('STORAGE_DB', 'poche');
21@define ('STORAGE_USER', 'poche');
22@define ('STORAGE_PASSWORD', 'poche');
23
24#################################################################################
25# Do not trespass unless you know what you are doing
26#################################################################################
27// Change this if http is running on nonstandard port - i.e is behind cache proxy
28@define ('HTTP_PORT', 80);
29
30// Change this if not using the standart port for SSL - i.e you server is behind sslh
31@define ('SSL_PORT', 443);
32
33@define ('MODE_DEMO', FALSE);
34@define ('DEBUG_POCHE', FALSE);
35
36//default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL.
37@define ('ERROR_REPORTING', E_ALL & ~E_NOTICE);
38
39@define ('DOWNLOAD_PICTURES', FALSE); # This can slow down the process of adding articles
40@define ('REGENERATE_PICTURES_QUALITY', 75);
41@define ('CONVERT_LINKS_FOOTNOTES', FALSE);
42@define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
43@define ('SHARE_TWITTER', TRUE);
44@define ('SHARE_MAIL', TRUE);
45@define ('SHARE_SHAARLI', FALSE);
46@define ('SHAARLI_URL', 'http://myshaarliurl.com');
47@define ('SHARE_DIASPORA', FALSE);
48@define ('DIASPORA_URL', 'http://diasporapod.com'); # Don't add a / at the end
49@define ('FLATTR', TRUE);
50@define ('FLATTR_API', 'https://api.flattr.com/rest/v2/things/lookup/?url=');
51@define ('NOT_FLATTRABLE', '0');
52@define ('FLATTRABLE', '1');
53@define ('FLATTRED', '2');
54@define ('CARROT', FALSE);
55
56// ebook
57@define ('EPUB', TRUE);
58@define ('MOBI', FALSE);
59@define ('PDF', FALSE);
60
61// display or not print link in article view
62@define ('SHOW_PRINTLINK', '1');
63// display or not percent of read in article view. Affects only default theme.
64@define ('SHOW_READPERCENT', '1');
65@define ('ABS_PATH', ROOT . '/data/assets/');
66
67@define ('DEFAULT_THEME', 'baggy');
68
69@define ('THEME', ROOT . '/src/Wallabag/Wallabag/Resources/views');
70@define ('LOCALE', ROOT . '/src/Wallabag/Wallabag/Resources/translations');
71@define ('CACHE', ROOT . '/app/cache');
72
73@define ('PAGINATION', '12');
74
75//limit for download of articles during import
76@define ('IMPORT_LIMIT', 5);
77//delay between downloads (in sec)
78@define ('IMPORT_DELAY', 5);
diff --git a/bin/install b/bin/install
deleted file mode 100755
index ed2c2d91..00000000
--- a/bin/install
+++ /dev/null
@@ -1,72 +0,0 @@
1#!/usr/bin/php
2<?php
3require_once __DIR__. '/../vendor/autoload.php';
4
5use Symfony\Component\Yaml\Yaml;
6
7$parameters = Yaml::parse(file_get_contents('app/config/parameters.yml'));
8
9echo 'Okay, you want to install wallabag, let\'s go!';
10echo "\r\n";
11
12function executeQuery($handle, $sql, $params) {
13 try
14 {
15 $query = $handle->prepare($sql);
16 $query->execute($params);
17 return $query->fetchAll();
18 }
19 catch (Exception $e)
20 {
21 return false;
22 }
23}
24
25$configFile = 'app/config/config.inc.php';
26$dbFile = 'data/db/poche.sqlite';
27$username = 'wallabag';
28$password = 'wallabag';
29$salt = $parameters['parameters']['secret'];
30$defaultLanguage = 'en_EN.UTF8';
31
32if (!copy('app/config/config.inc.default.php', $configFile)) {
33 die('Installation aborted, impossible to create ' . $configFile . ' file. Maybe you don\'t have write access to create it.');
34}
35
36$content = file_get_contents($configFile);
37$content = str_replace("define ('SALT', '');", "define ('SALT', '".$salt."');", $content);
38file_put_contents($configFile, $content);
39
40if (!copy('bin/poche.sqlite', $dbFile)) {
41 die('Impossible to create ' . $dbFile . ' file.');
42}
43
44chmod($dbFile, 0777);
45
46$dbPath = 'sqlite:' . realpath('') . '/' . $dbFile;
47
48$handle = new PDO($dbPath);
49
50$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
51
52$saltedPassword = sha1($password . $username . $salt);
53
54$sql = "INSERT INTO users (username, password, name, email) VALUES (?, ?, ?, '')";
55$params = array($username, $saltedPassword, $username);
56$query = executeQuery($handle, $sql, $params);
57
58$idUser = (int)$handle->lastInsertId('users_id_seq');
59
60$sql = 'INSERT INTO users_config ( user_id, name, value ) VALUES (?, ?, ?)';
61$params = array($idUser, 'pager', '10');
62$query = executeQuery($handle, $sql, $params);
63
64$sql = 'INSERT INTO users_config ( user_id, name, value ) VALUES (?, ?, ?)';
65$params = array($idUser, 'language', $defaultLanguage);
66$query = executeQuery($handle, $sql, $params);
67
68echo 'wallabag is now installed';
69echo "\r\n";
70echo 'Just execute `php app/console server:run` for using wallabag:';
71echo "\r\n";
72echo 'http://localhost:8000'; \ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
index fae633fa..f14f821b 100644
--- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
@@ -80,17 +80,14 @@ class WallabagRestController extends Controller
80 */ 80 */
81 public function postEntriesAction(Request $request) 81 public function postEntriesAction(Request $request)
82 { 82 {
83 //TODO la récup ne marche pas
84 //TODO gérer si on passe le titre
85 //TODO gérer si on passe les tags 83 //TODO gérer si on passe les tags
86 //TODO ne pas avoir du code comme ça qui doit se trouver dans le Repository
87 $url = $request->request->get('url'); 84 $url = $request->request->get('url');
88 85
89 $content = Extractor::extract($url); 86 $content = Extractor::extract($url);
90 $entry = new Entries(); 87 $entry = new Entries();
91 $entry->setUserId(1); 88 $entry->setUserId(1);
92 $entry->setUrl($url); 89 $entry->setUrl($url);
93 $entry->setTitle($content->getTitle()); 90 $entry->setTitle($request->request->get('title') ?: $content->getTitle());
94 $entry->setContent($content->getBody()); 91 $entry->setContent($content->getBody());
95 $em = $this->getDoctrine()->getManager(); 92 $em = $this->getDoctrine()->getManager();
96 $em->persist($entry); 93 $em->persist($entry);
diff --git a/src/Wallabag/CoreBundle/Repository/EntriesRepository.php b/src/Wallabag/CoreBundle/Repository/EntriesRepository.php
index dd92d520..ae854e5a 100644
--- a/src/Wallabag/CoreBundle/Repository/EntriesRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntriesRepository.php
@@ -26,6 +26,7 @@ class EntriesRepository extends EntityRepository
26 ->where('e.isRead = 0') 26 ->where('e.isRead = 0')
27 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 27 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
28 ->andWhere('e.isDeleted=0') 28 ->andWhere('e.isDeleted=0')
29 ->orderBy('e.createdAt', 'desc')
29 ->getQuery(); 30 ->getQuery();
30 31
31 $paginator = new Paginator($qb); 32 $paginator = new Paginator($qb);
@@ -50,6 +51,7 @@ class EntriesRepository extends EntityRepository
50 ->where('e.isRead = 1') 51 ->where('e.isRead = 1')
51 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 52 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
52 ->andWhere('e.isDeleted=0') 53 ->andWhere('e.isDeleted=0')
54 ->orderBy('e.createdAt', 'desc')
53 ->getQuery(); 55 ->getQuery();
54 56
55 $paginator = new Paginator($qb); 57 $paginator = new Paginator($qb);
@@ -74,6 +76,7 @@ class EntriesRepository extends EntityRepository
74 ->where('e.isFav = 1') 76 ->where('e.isFav = 1')
75 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 77 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
76 ->andWhere('e.isDeleted=0') 78 ->andWhere('e.isDeleted=0')
79 ->orderBy('e.createdAt', 'desc')
77 ->getQuery(); 80 ->getQuery();
78 81
79 $paginator = new Paginator($qb); 82 $paginator = new Paginator($qb);
@@ -83,7 +86,6 @@ class EntriesRepository extends EntityRepository
83 86
84 public function findEntries($userId, $isArchived, $isStarred, $isDeleted, $sort, $order) 87 public function findEntries($userId, $isArchived, $isStarred, $isDeleted, $sort, $order)
85 { 88 {
86 //TODO tous les paramètres ne sont pas utilisés, à corriger
87 $qb = $this->createQueryBuilder('e') 89 $qb = $this->createQueryBuilder('e')
88 ->select('e') 90 ->select('e')
89 ->where('e.userId =:userId')->setParameter('userId', $userId); 91 ->where('e.userId =:userId')->setParameter('userId', $userId);
@@ -100,6 +102,12 @@ class EntriesRepository extends EntityRepository
100 $qb->andWhere('e.isDeleted =:isDeleted')->setParameter('isDeleted', $isDeleted); 102 $qb->andWhere('e.isDeleted =:isDeleted')->setParameter('isDeleted', $isDeleted);
101 } 103 }
102 104
105 if ('created' === $sort) {
106 $qb->orderBy('e.createdAt', $order);
107 } elseif ('updated' === $sort) {
108 $qb->orderBy('e.updatedAt', $order);
109 }
110
103 return $qb 111 return $qb
104 ->getQuery() 112 ->getQuery()
105 ->getResult(Query::HYDRATE_ARRAY); 113 ->getResult(Query::HYDRATE_ARRAY);