diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-19 21:45:31 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-19 21:45:31 -0400 |
commit | 2259f8635969a3b409dedda8cc1662486fe12ba4 (patch) | |
tree | 20ff884bd1ceb14ad345c7901a7213b77277967f /lib | |
parent | 4fd557478736c83cc378262754b1a0bb9682398c (diff) |
introduces field userid in the feed table to fix a bug in the update functions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/feedmapper.php | 30 | ||||
-rw-r--r-- | lib/foldermapper.php | 2 | ||||
-rw-r--r-- | lib/itemmapper.php | 5 |
3 files changed, 28 insertions, 9 deletions
diff --git a/lib/feedmapper.php b/lib/feedmapper.php index 80afcb481..7b544c3cf 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -16,18 +16,31 @@ class OC_News_FeedMapper { const tableName = '*PREFIX*news_feeds'; + private $userid; + + public function __construct($userid = null){ + if ($userid !== null) { + $this->userid = $userid; + } + $this->userid = OCP\USER::getUser(); + } + + /** + * @brief + * @param row a row from the feeds table of the database + * @returns an object of the class OC_News_Feed + */ + public function fromRow($row){ + } /** * @brief * @param userid * @returns */ - public function findAll($userid){ - $stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . - ' JOIN ' . OC_News_FolderMapper::tableName . - ' ON ' . self::tableName. '.folder_id=' . OC_News_FolderMapper::tableName . '.id' . - ' WHERE user_id = ?'); - $result = $stmt->execute(array($userid)); + public function findAll(){ + $stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE user_id = ?'); + $result = $stmt->execute(array($this->userid)); $feeds = array(); while ($row = $result->fetchRow()) { $url = $row['url']; @@ -142,8 +155,8 @@ class OC_News_FeedMapper { if ($feedid == null){ $query = OCP\DB::prepare(' INSERT INTO ' . self::tableName . - '(url, title, favicon_link, folder_id, added, lastmodified) - VALUES (?, ?, ?, ?, ?, ?) + '(url, title, favicon_link, folder_id, added, lastmodified, user_id) + VALUES (?, ?, ?, ?, ?, ?, ?) '); $params=array( @@ -153,6 +166,7 @@ class OC_News_FeedMapper { $folderid, $_ut, $_ut, + $this->userid ); $query->execute($params); diff --git a/lib/foldermapper.php b/lib/foldermapper.php index 01dce13d7..19d7e56a5 100644 --- a/lib/foldermapper.php +++ b/lib/foldermapper.php @@ -23,7 +23,7 @@ class OC_News_FolderMapper { if ($userid !== null) { $this->userid = $userid; } - $userid = OCP\USER::getUser(); + $this->userid = OCP\USER::getUser(); } /** diff --git a/lib/itemmapper.php b/lib/itemmapper.php index 8d6a755b1..b20387192 100644 --- a/lib/itemmapper.php +++ b/lib/itemmapper.php @@ -18,6 +18,11 @@ class OC_News_ItemMapper { const tableName = '*PREFIX*news_items'; + /** + * @brief + * @param row a row from the items table of the database + * @returns an object of the class OC_News_Item + */ public function fromRow($row){ $url = $row['url']; $title = $row['title']; |