aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Poche.class.php')
-rw-r--r--inc/poche/Poche.class.php55
1 files changed, 52 insertions, 3 deletions
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;