aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-08 12:33:02 +0200
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-08 12:33:02 +0200
commit07ee09f49ad3a6ac567f123b338ccb75b1464164 (patch)
treed2400edbcd933751618a3c3d4f8e91e2b41002ed
parent25b5caeed1022b385b29d626c2266bccb4ceac40 (diff)
downloadwallabag-07ee09f49ad3a6ac567f123b338ccb75b1464164.tar.gz
wallabag-07ee09f49ad3a6ac567f123b338ccb75b1464164.tar.zst
wallabag-07ee09f49ad3a6ac567f123b338ccb75b1464164.zip
comments
-rw-r--r--TODO.md10
-rw-r--r--inc/poche/Poche.class.php55
-rw-r--r--inc/poche/config.inc.php2
-rw-r--r--index.php3
4 files changed, 64 insertions, 6 deletions
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 00000000..94288381
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,10 @@
1# TODO
2
3pouvoir annuler la suppression
4conventions codage ? phing ? vérifier error_log qui trainent
5phpDocumentor
6minifier css
7revoir tous les css
8barre fixe d'admin sur la page d'un billet ?
9revoir export (export vers pocket &cie ? )
10raccourcis clavier \ No newline at end of file
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 0439f301..fecb1616 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -232,6 +232,13 @@ class Poche
232 return $tpl_vars; 232 return $tpl_vars;
233 } 233 }
234 234
235 /**
236 * update the password of the current user.
237 * if MODE_DEMO is TRUE, the password can't be updated.
238 * @todo add the return value
239 * @todo set the new password in function header like this updatePassword($newPassword)
240 * @return boolean
241 */
235 public function updatePassword() 242 public function updatePassword()
236 { 243 {
237 if (MODE_DEMO) { 244 if (MODE_DEMO) {
@@ -256,6 +263,13 @@ class Poche
256 } 263 }
257 } 264 }
258 265
266 /**
267 * checks if login & password are correct and save the user in session.
268 * it redirects the user to the $referer link
269 * @param string $referer the url to redirect after login
270 * @todo add the return value
271 * @return boolean
272 */
259 public function login($referer) 273 public function login($referer)
260 { 274 {
261 if (!empty($_POST['login']) && !empty($_POST['password'])) { 275 if (!empty($_POST['login']) && !empty($_POST['password'])) {
@@ -286,6 +300,11 @@ class Poche
286 } 300 }
287 } 301 }
288 302
303 /**
304 * log out the poche user. It cleans the session.
305 * @todo add the return value
306 * @return boolean
307 */
289 public function logout() 308 public function logout()
290 { 309 {
291 $this->user = array(); 310 $this->user = array();
@@ -295,6 +314,11 @@ class Poche
295 Tools::redirect(); 314 Tools::redirect();
296 } 315 }
297 316
317 /**
318 * import from Instapaper. poche needs a ./instapaper-export.html file
319 * @todo add the return value
320 * @return boolean
321 */
298 private function importFromInstapaper() 322 private function importFromInstapaper()
299 { 323 {
300 # TODO gestion des articles favs 324 # TODO gestion des articles favs
@@ -329,6 +353,11 @@ class Poche
329 Tools::redirect(); 353 Tools::redirect();
330 } 354 }
331 355
356 /**
357 * import from Pocket. poche needs a ./ril_export.html file
358 * @todo add the return value
359 * @return boolean
360 */
332 private function importFromPocket() 361 private function importFromPocket()
333 { 362 {
334 # TODO gestion des articles favs 363 # TODO gestion des articles favs
@@ -363,6 +392,11 @@ class Poche
363 Tools::redirect(); 392 Tools::redirect();
364 } 393 }
365 394
395 /**
396 * import from Readability. poche needs a ./readability file
397 * @todo add the return value
398 * @return boolean
399 */
366 private function importFromReadability() 400 private function importFromReadability()
367 { 401 {
368 # TODO gestion des articles lus / favs 402 # TODO gestion des articles lus / favs
@@ -398,19 +432,29 @@ class Poche
398 Tools::redirect(); 432 Tools::redirect();
399 } 433 }
400 434
435 /**
436 * import datas into your poche
437 * @param string $from name of the service to import : pocket, instapaper or readability
438 * @todo add the return value
439 * @return boolean
440 */
401 public function import($from) 441 public function import($from)
402 { 442 {
403 if ($from == 'pocket') { 443 if ($from == 'pocket') {
404 $this->importFromPocket(); 444 return $this->importFromPocket();
405 } 445 }
406 else if ($from == 'readability') { 446 else if ($from == 'readability') {
407 $this->importFromReadability(); 447 return $this->importFromReadability();
408 } 448 }
409 else if ($from == 'instapaper') { 449 else if ($from == 'instapaper') {
410 $this->importFromInstapaper(); 450 return $this->importFromInstapaper();
411 } 451 }
412 } 452 }
413 453
454 /**
455 * export poche entries in json
456 * @return json all poche entries
457 */
414 public function export() 458 public function export()
415 { 459 {
416 $entries = $this->store->retrieveAll($this->user->getId()); 460 $entries = $this->store->retrieveAll($this->user->getId());
@@ -420,6 +464,11 @@ class Poche
420 Tools::logm('export view'); 464 Tools::logm('export view');
421 } 465 }
422 466
467 /**
468 * Check online the latest version of poche and cache it
469 * @param string $which 'prod' or 'dev'
470 * @return string latest $which version
471 */
423 private function getPocheVersion($which = 'prod') 472 private function getPocheVersion($which = 'prod')
424 { 473 {
425 $cache_file = CACHE . '/' . $which; 474 $cache_file = CACHE . '/' . $which;
diff --git a/inc/poche/config.inc.php b/inc/poche/config.inc.php
index 321784d7..0958600f 100644
--- a/inc/poche/config.inc.php
+++ b/inc/poche/config.inc.php
@@ -18,7 +18,7 @@ define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite
18 18
19define ('POCHE_VERSION', '1.0-beta1'); 19define ('POCHE_VERSION', '1.0-beta1');
20define ('MODE_DEMO', FALSE); 20define ('MODE_DEMO', FALSE);
21define ('DEBUG_POCHE', FALSE); 21define ('DEBUG_POCHE', TRUE);
22define ('CONVERT_LINKS_FOOTNOTES', FALSE); 22define ('CONVERT_LINKS_FOOTNOTES', FALSE);
23define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); 23define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
24define ('DOWNLOAD_PICTURES', FALSE); 24define ('DOWNLOAD_PICTURES', FALSE);
diff --git a/index.php b/index.php
index 353df873..a60e4e94 100644
--- a/index.php
+++ b/index.php
@@ -32,7 +32,7 @@ elseif (isset($_GET['config'])) {
32 $poche->updatePassword(); 32 $poche->updatePassword();
33} 33}
34elseif (isset($_GET['import'])) { 34elseif (isset($_GET['import'])) {
35 $poche->import($_GET['from']); 35 $import = $poche->import($_GET['from']);
36} 36}
37elseif (isset($_GET['export'])) { 37elseif (isset($_GET['export'])) {
38 $poche->export(); 38 $poche->export();
@@ -53,7 +53,6 @@ if (Session::isLogged()) {
53 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id)); 53 $tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
54} 54}
55else { 55else {
56 # login
57 $tpl_file = 'login.twig'; 56 $tpl_file = 'login.twig';
58} 57}
59 58