aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/3rdparty/FlattrItem.class.php12
-rw-r--r--inc/3rdparty/site_config/README.md6
-rw-r--r--inc/3rdparty/site_config/custom/bfmtv.com.txt6
-rw-r--r--inc/3rdparty/site_config/custom/inthepoche.com.txt7
-rw-r--r--inc/3rdparty/site_config/custom/palkeo.com.txt0
-rw-r--r--inc/3rdparty/site_config/custom/tldp.org.txt6
-rw-r--r--inc/3rdparty/site_config/index.php3
-rw-r--r--inc/3rdparty/site_config/standard/.wikipedia.org.txt19
-rw-r--r--inc/3rdparty/site_config/standard/index.php3
-rw-r--r--inc/3rdparty/site_config/standard/version.php2
-rw-r--r--inc/poche/Database.class.php14
-rw-r--r--inc/poche/Poche.class.php40
-rwxr-xr-xinc/poche/config.inc.php.new14
-rw-r--r--inc/poche/define.inc.php39
14 files changed, 100 insertions, 71 deletions
diff --git a/inc/3rdparty/FlattrItem.class.php b/inc/3rdparty/FlattrItem.class.php
index c940fcd6..0d3e69d0 100644
--- a/inc/3rdparty/FlattrItem.class.php
+++ b/inc/3rdparty/FlattrItem.class.php
@@ -9,9 +9,9 @@ class FlattrItem {
9 public $flattrItemURL; 9 public $flattrItemURL;
10 public $numflattrs; 10 public $numflattrs;
11 11
12 public function checkItem($urltoflattr) { 12 public function checkItem($urltoflattr,$id) {
13 $this->cacheflattrfile($urltoflattr); 13 $this->cacheflattrfile($urltoflattr, $id);
14 $flattrResponse = file_get_contents(CACHE . "/flattr/".base64_encode($urltoflattr).".cache"); 14 $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache");
15 if($flattrResponse != FALSE) { 15 if($flattrResponse != FALSE) {
16 $result = json_decode($flattrResponse); 16 $result = json_decode($flattrResponse);
17 if (isset($result->message)){ 17 if (isset($result->message)){
@@ -33,15 +33,15 @@ class FlattrItem {
33 } 33 }
34 } 34 }
35 35
36 private function cacheflattrfile($urltoflattr) { 36 private function cacheflattrfile($urltoflattr, $id) {
37 if (!is_dir(CACHE . '/flattr')) { 37 if (!is_dir(CACHE . '/flattr')) {
38 mkdir(CACHE . '/flattr', 0777); 38 mkdir(CACHE . '/flattr', 0777);
39 } 39 }
40 40
41 // if a cache flattr file for this url already exists and it's been less than one day than it have been updated, see in /cache 41 // if a cache flattr file for this url already exists and it's been less than one day than it have been updated, see in /cache
42 if ((!file_exists(CACHE . "/flattr/".base64_encode($urltoflattr).".cache")) || (time() - filemtime(CACHE . "/flattr/".base64_encode($urltoflattr).".cache") > 86400)) { 42 if ((!file_exists(CACHE . "/flattr/".$id.".cache")) || (time() - filemtime(CACHE . "/flattr/".$id.".cache") > 86400)) {
43 $askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr); 43 $askForFlattr = Tools::getFile(FLATTR_API . $urltoflattr);
44 $flattrCacheFile = fopen(CACHE . "/flattr/".base64_encode($urltoflattr).".cache", 'w+'); 44 $flattrCacheFile = fopen(CACHE . "/flattr/".$id.".cache", 'w+');
45 fwrite($flattrCacheFile, $askForFlattr); 45 fwrite($flattrCacheFile, $askForFlattr);
46 fclose($flattrCacheFile); 46 fclose($flattrCacheFile);
47 } 47 }
diff --git a/inc/3rdparty/site_config/README.md b/inc/3rdparty/site_config/README.md
new file mode 100644
index 00000000..0aff456b
--- /dev/null
+++ b/inc/3rdparty/site_config/README.md
@@ -0,0 +1,6 @@
1Full-Text RSS Site Patterns
2---------------------------
3
4Site patterns allow you to specify what should be extracted from specific sites.
5
6Please see http://help.fivefilters.org/customer/portal/articles/223153-site-patterns for more information. \ No newline at end of file
diff --git a/inc/3rdparty/site_config/custom/bfmtv.com.txt b/inc/3rdparty/site_config/custom/bfmtv.com.txt
new file mode 100644
index 00000000..0ff28d56
--- /dev/null
+++ b/inc/3rdparty/site_config/custom/bfmtv.com.txt
@@ -0,0 +1,6 @@
1title: //title
2body: //h2 | //span[@class='masque'] | //article[@class='corps_article_right']
3prune: no
4tidy: no
5
6test_url: http://www.bfmtv.com/societe/cigarette-electronique-dangers-588622.html \ No newline at end of file
diff --git a/inc/3rdparty/site_config/custom/inthepoche.com.txt b/inc/3rdparty/site_config/custom/inthepoche.com.txt
new file mode 100644
index 00000000..ede74b97
--- /dev/null
+++ b/inc/3rdparty/site_config/custom/inthepoche.com.txt
@@ -0,0 +1,7 @@
1title: //title
2body: //div[@class='post-content']
3
4prune: no
5tidy: no
6
7test_url: http://www.inthepoche.com/?post/poche-hosting \ No newline at end of file
diff --git a/inc/3rdparty/site_config/custom/palkeo.com.txt b/inc/3rdparty/site_config/custom/palkeo.com.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/inc/3rdparty/site_config/custom/palkeo.com.txt
diff --git a/inc/3rdparty/site_config/custom/tldp.org.txt b/inc/3rdparty/site_config/custom/tldp.org.txt
new file mode 100644
index 00000000..7dd5cdb5
--- /dev/null
+++ b/inc/3rdparty/site_config/custom/tldp.org.txt
@@ -0,0 +1,6 @@
1title: //title
2body: //h2 | //p | //ul
3prune: no
4tidy: no
5
6test_url: http://www.tldp.org/HOWTO/Plug-and-Play-HOWTO-7.html \ No newline at end of file
diff --git a/inc/3rdparty/site_config/index.php b/inc/3rdparty/site_config/index.php
new file mode 100644
index 00000000..a3d5f739
--- /dev/null
+++ b/inc/3rdparty/site_config/index.php
@@ -0,0 +1,3 @@
1<?php
2// this is here to prevent directory listing over the web
3?> \ No newline at end of file
diff --git a/inc/3rdparty/site_config/standard/.wikipedia.org.txt b/inc/3rdparty/site_config/standard/.wikipedia.org.txt
new file mode 100644
index 00000000..8b98ae4b
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/.wikipedia.org.txt
@@ -0,0 +1,19 @@
1title: //h1[@id='firstHeading']
2body: //div[@id = 'bodyContent']
3strip_id_or_class: editsection
4#strip_id_or_class: toc
5strip_id_or_class: vertical-navbox
6strip: //table[@id='toc']
7strip: //div[@id='catlinks']
8strip: //div[@id='jump-to-nav']
9strip: //div[@class='thumbcaption']//div[@class='magnify']
10strip: //table[@class='navbox']
11strip: //table[contains(@class, 'infobox')]
12strip: //div[@class='dablink']
13strip: //div[@id='contentSub']
14strip: //table[contains(@class, 'metadata')]
15strip: //*[contains(@class, 'noprint')]
16strip: //span[@title='pronunciation:']
17prune: no
18tidy: no
19test_url: http://en.wikipedia.org/wiki/Christopher_Lloyd \ No newline at end of file
diff --git a/inc/3rdparty/site_config/standard/index.php b/inc/3rdparty/site_config/standard/index.php
new file mode 100644
index 00000000..a3d5f739
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/index.php
@@ -0,0 +1,3 @@
1<?php
2// this is here to prevent directory listing over the web
3?> \ No newline at end of file
diff --git a/inc/3rdparty/site_config/standard/version.php b/inc/3rdparty/site_config/standard/version.php
new file mode 100644
index 00000000..e61807ed
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/version.php
@@ -0,0 +1,2 @@
1<?php
2return 1; \ No newline at end of file
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 4d664992..0662581b 100644
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -113,9 +113,17 @@ class Database {
113 } 113 }
114 114
115 public function updateUserConfig($userId, $key, $value) { 115 public function updateUserConfig($userId, $key, $value) {
116 $sql_update = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?"; 116 $config = $this->getConfigUser($userId);
117 $params_update = array($value, $userId, $key); 117
118 $query = $this->executeQuery($sql_update, $params_update); 118 if (!isset ($user_config[$key])) {
119 $sql = "INSERT INTO users_config (`value`, `user_id`, `name`) VALUES (?, ?, ?)";
120 }
121 else {
122 $sql = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?";
123 }
124
125 $params = array($value, $userId, $key);
126 $query = $this->executeQuery($sql, $params);
119 } 127 }
120 128
121 private function executeQuery($sql, $params) { 129 private function executeQuery($sql, $params) {
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 18860ddc..1ba8e7c1 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -105,10 +105,18 @@ class Poche
105 public function themeIsInstalled() { 105 public function themeIsInstalled() {
106 # Twig is an absolute requirement for Poche to function. Abort immediately if the Composer installer hasn't been run yet 106 # Twig is an absolute requirement for Poche to function. Abort immediately if the Composer installer hasn't been run yet
107 if (! self::$canRenderTemplates) { 107 if (! self::$canRenderTemplates) {
108 $this->notInstalledMessage = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. Have a look at <a href="http://inthepoche.com/?pages/Documentation">the documentation.</a>'; 108 $this->notInstalledMessage = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. Have a look at <a href="http://doc.inthepoche.com/doku.php?id=users:begin:install">the documentation.</a>';
109 109
110 return false; 110 return false;
111 } 111 }
112
113 if (! is_writable(CACHE)) {
114 $this->notInstalledMessage = '<h1>error</h1><p>You don\'t have write access on cache directory.</p>';
115
116 self::$canRenderTemplates = false;
117
118 return false;
119 }
112 120
113 # Check if the selected theme and its requirements are present 121 # Check if the selected theme and its requirements are present
114 if (! is_dir(THEME . '/' . $this->getTheme())) { 122 if (! is_dir(THEME . '/' . $this->getTheme())) {
@@ -145,16 +153,11 @@ class Poche
145 153
146 if (empty($configSalt)) { 154 if (empty($configSalt)) {
147 $msg = '<h1>error</h1><p>You have not yet filled in the SALT value in the config.inc.php file.</p>'; 155 $msg = '<h1>error</h1><p>You have not yet filled in the SALT value in the config.inc.php file.</p>';
148 } else if (! is_writable(CACHE)) {
149 Tools::logm('you don\'t have write access on cache directory');
150 $msg = '<h1>error</h1><p>You don\'t have write access on cache directory.</p>';
151 } else if (STORAGE == 'sqlite' && ! file_exists(STORAGE_SQLITE)) { 156 } else if (STORAGE == 'sqlite' && ! file_exists(STORAGE_SQLITE)) {
152 Tools::logm('sqlite file doesn\'t exist'); 157 Tools::logm('sqlite file doesn\'t exist');
153 $msg = '<h1>error</h1><p>sqlite file doesn\'t exist, you can find it in install folder. Copy it in /db folder.</p>'; 158 $msg = '<h1>error</h1><p>sqlite file doesn\'t exist, you can find it in install folder. Copy it in /db folder.</p>';
154 } else if (file_exists(ROOT . '/install/update.php') && ! DEBUG_POCHE) {
155 $msg = '<h1>setup</h1><p><strong>It\'s your first time here?</strong> Please copy /install/poche.sqlite in db folder. Then, delete install folder.<br /><strong>If you have already installed poche</strong>, an update is needed <a href="install/update.php">by clicking here</a>.</p>';
156 } else if (is_dir(ROOT . '/install') && ! DEBUG_POCHE) { 159 } else if (is_dir(ROOT . '/install') && ! DEBUG_POCHE) {
157 $msg = '<h1>setup</h1><p><strong>If you want to update your poche</strong>, you just have to delete /install folder. <br /><strong>To install your poche with sqlite</strong>, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.</p>'; 160 $msg = '<h1>install folder</h1><p>you have to delete the /install folder before using poche.</p>';
158 } else if (STORAGE == 'sqlite' && ! is_writable(STORAGE_SQLITE)) { 161 } else if (STORAGE == 'sqlite' && ! is_writable(STORAGE_SQLITE)) {
159 Tools::logm('you don\'t have write access on sqlite file'); 162 Tools::logm('you don\'t have write access on sqlite file');
160 $msg = '<h1>error</h1><p>You don\'t have write access on sqlite file.</p>'; 163 $msg = '<h1>error</h1><p>You don\'t have write access on sqlite file.</p>';
@@ -255,7 +258,7 @@ class Poche
255 while (($theme = readdir($handle)) !== false) { 258 while (($theme = readdir($handle)) !== false) {
256 # Themes are stored in a directory, so all directory names are themes 259 # Themes are stored in a directory, so all directory names are themes
257 # @todo move theme installation data to database 260 # @todo move theme installation data to database
258 if (! is_dir(THEME . '/' . $theme) || in_array($theme, array('..', '.'))) { 261 if (! is_dir(THEME . '/' . $theme) || in_array($theme, array('..', '.', '.git'))) {
259 continue; 262 continue;
260 } 263 }
261 264
@@ -330,7 +333,7 @@ class Poche
330 $msg = 'error : can\'t delete link #' . $id; 333 $msg = 'error : can\'t delete link #' . $id;
331 } 334 }
332 Tools::logm($msg); 335 Tools::logm($msg);
333 Tools::redirect('?'); 336 Tools::redirect();
334 break; 337 break;
335 case 'toggle_fav' : 338 case 'toggle_fav' :
336 $this->store->favoriteById($id, $this->user->getId()); 339 $this->store->favoriteById($id, $this->user->getId());
@@ -381,17 +384,17 @@ class Poche
381 $tidy = tidy_parse_string($content, array('indent'=>true, 'show-body-only' => true), 'UTF8'); 384 $tidy = tidy_parse_string($content, array('indent'=>true, 'show-body-only' => true), 'UTF8');
382 $tidy->cleanRepair(); 385 $tidy->cleanRepair();
383 $content = $tidy->value; 386 $content = $tidy->value;
387 }
384 388
385 # flattr checking 389 # flattr checking
386 $flattr = new FlattrItem(); 390 $flattr = new FlattrItem();
387 $flattr->checkItem($entry['url']); 391 $flattr->checkItem($entry['url'],$entry['id']);
388 392
389 $tpl_vars = array( 393 $tpl_vars = array(
390 'entry' => $entry, 394 'entry' => $entry,
391 'content' => $content, 395 'content' => $content,
392 'flattr' => $flattr 396 'flattr' => $flattr
393 ); 397 );
394 }
395 } 398 }
396 else { 399 else {
397 Tools::logm('error in view call : entry is null'); 400 Tools::logm('error in view call : entry is null');
@@ -404,6 +407,7 @@ class Poche
404 'page_links' => '', 407 'page_links' => '',
405 'nb_results' => '', 408 'nb_results' => '',
406 ); 409 );
410
407 if (count($entries) > 0) { 411 if (count($entries) > 0) {
408 $this->pagination->set_total(count($entries)); 412 $this->pagination->set_total(count($entries));
409 $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&'); 413 $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&');
diff --git a/inc/poche/config.inc.php.new b/inc/poche/config.inc.php.new
index 48cc5783..255b97e6 100755
--- a/inc/poche/config.inc.php.new
+++ b/inc/poche/config.inc.php.new
@@ -26,7 +26,7 @@ define ('STORAGE_PASSWORD', 'poche');
26################################################################################# 26#################################################################################
27 27
28define ('MODE_DEMO', FALSE); 28define ('MODE_DEMO', FALSE);
29define ('DEBUG_POCHE', true); 29define ('DEBUG_POCHE', FALSE);
30define ('DOWNLOAD_PICTURES', FALSE); 30define ('DOWNLOAD_PICTURES', FALSE);
31define ('CONVERT_LINKS_FOOTNOTES', FALSE); 31define ('CONVERT_LINKS_FOOTNOTES', FALSE);
32define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); 32define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
@@ -49,8 +49,12 @@ define ('CACHE', ROOT . '/cache');
49 49
50define ('PAGINATION', '10'); 50define ('PAGINATION', '10');
51 51
52define ('POCHE_VERSION', '1.0-beta5'); 52define ('POCHE_VERSION', '1.0.0');
53 53
54define ('IMPORT_POCKET_FILE', ROOT . '/ril_export.html'); 54define ('POCKET_FILE', '/ril_export.html');
55define ('IMPORT_READABILITY_FILE', ROOT . '/readability'); 55define ('READABILITY_FILE', '/readability');
56define ('IMPORT_INSTAPAPER_FILE', ROOT . '/instapaper-export.html'); \ No newline at end of file 56define ('INSTAPAPER_FILE', '/instapaper-export.html');
57
58define ('IMPORT_POCKET_FILE', ROOT . POCKET_FILE);
59define ('IMPORT_READABILITY_FILE', ROOT . READABILITY_FILE);
60define ('IMPORT_INSTAPAPER_FILE', ROOT . INSTAPAPER_FILE); \ No newline at end of file
diff --git a/inc/poche/define.inc.php b/inc/poche/define.inc.php
deleted file mode 100644
index 40f77b5c..00000000
--- a/inc/poche/define.inc.php
+++ /dev/null
@@ -1,39 +0,0 @@
1<?php
2/**
3 * poche, a read it later open source system
4 *
5 * @category poche
6 * @author Nicolas LÅ“uillet <support@inthepoche.com>
7 * @copyright 2013
8 * @license http://www.wtfpl.net/ see COPYING file
9 */
10
11define ('STORAGE','sqlite'); # postgres, mysql, sqlite
12define ('STORAGE_SERVER', 'localhost'); # leave blank for sqlite
13define ('STORAGE_DB', 'poche'); # only for postgres & mysql
14define ('STORAGE_SQLITE', __DIR__ . '/../../db/poche.sqlite');
15define ('STORAGE_USER', 'postgres'); # leave blank for sqlite
16define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite
17
18define ('MODE_DEMO', FALSE);
19define ('DEBUG_POCHE', FALSE);
20define ('DOWNLOAD_PICTURES', FALSE);
21define ('SHARE_TWITTER', TRUE);
22define ('SHARE_MAIL', TRUE);
23define ('SHARE_SHAARLI', FALSE);
24define ('SHAARLI_URL', 'http://myshaarliurl.com');
25define ('FLATTR', TRUE);
26define ('FLATTR_API', 'https://api.flattr.com/rest/v2/things/lookup/?url=');
27define ('NOT_FLATTRABLE', '0');
28define ('FLATTRABLE', '1');
29define ('FLATTRED', '2');
30define ('ABS_PATH', 'assets/');
31define ('TPL', __DIR__ . '/../../tpl');
32define ('LOCALE', __DIR__ . '/../../locale');
33define ('CACHE', __DIR__ . '/../../cache');
34define ('PAGINATION', '10');
35define ('THEME', 'light');
36
37define ('IMPORT_POCKET_FILE', './ril_export.html');
38define ('IMPORT_READABILITY_FILE', './readability');
39define ('IMPORT_INSTAPAPER_FILE', './instapaper-export.html'); \ No newline at end of file