aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Database.class.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-07-10 13:17:04 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-07-10 13:17:04 +0200
commit6400371ff93782d25cdbd50aa224c70145b3890a (patch)
tree93e09a9851eb04d55b6b77d209ea8c0331b88950 /inc/poche/Database.class.php
parentc710f977b2659e866aba0e6a436485649834f2c4 (diff)
downloadwallabag-6400371ff93782d25cdbd50aa224c70145b3890a.tar.gz
wallabag-6400371ff93782d25cdbd50aa224c70145b3890a.tar.zst
wallabag-6400371ff93782d25cdbd50aa224c70145b3890a.zip
I removed my previous commit. We have to create a new branch for that.
Diffstat (limited to 'inc/poche/Database.class.php')
-rwxr-xr-xinc/poche/Database.class.php22
1 files changed, 2 insertions, 20 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index a222ed39..11cccb72 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -398,21 +398,6 @@ class Database {
398 return $query; 398 return $query;
399 } 399 }
400 400
401
402 private function _getDomain($url)
403 {
404 return parse_url($url, PHP_URL_HOST);
405 }
406
407 private function _getReadingTime($text) {
408 $word = str_word_count(strip_tags($text));
409 $minutes = floor($word / 200);
410 $seconds = floor($word % 200 / (200 / 60));
411 $time = array('minutes' => $minutes, 'seconds' => $seconds);
412
413 return $minutes;
414 }
415
416 /** 401 /**
417 * 402 *
418 * @param string $url 403 * @param string $url
@@ -422,12 +407,9 @@ class Database {
422 * @return integer $id of inserted record 407 * @return integer $id of inserted record
423 */ 408 */
424 public function add($url, $title, $content, $user_id, $isFavorite=0, $isRead=0) { 409 public function add($url, $title, $content, $user_id, $isFavorite=0, $isRead=0) {
425 $readingTime = $this->_getReadingTime($content); 410 $sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read ) VALUES (?, ?, ?, ?, ?, ?)';
426 $domainName = $this->_getDomain($url); 411 $params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead);
427 $date = date('Y-m-d H:i:s');
428 412
429 $sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read, date, reading_time, domain_name ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
430 $params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead, $date, $readingTime, $domainName);
431 if ( !$this->executeQuery($sql_action, $params_action) ) { 413 if ( !$this->executeQuery($sql_action, $params_action) ) {
432 $id = null; 414 $id = null;
433 } 415 }