From ad25e9355760acb12a1839ea52221ca85cc19c9d Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 6 Jan 2018 19:09:07 +0100 Subject: [PATCH] Can get the ID of the owner of a movie. --- classes/components/movies.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/classes/components/movies.php b/classes/components/movies.php index c53d202..72f7399 100644 --- a/classes/components/movies.php +++ b/classes/components/movies.php @@ -60,10 +60,26 @@ class Movies { * @param int $movieID The ID of the movie to check * @return bool TRUE if the movie exists / false else */ - function exist(int $movieID) : bool { + public function exist(int $movieID) : bool { return CS::get()->db->count($this::MOVIES_TABLE, "WHERE ID = ?", array($movieID)) > 0; } + /** + * Get the ID of the owner of a movie + * + * @param int $movieID The ID of the target movie + * @return int The ID of the owner of the movie / 0 if none found + */ + public function get_owner(int $movieID) : int { + + //Get infos about the movie + $movieInfos = $this->get_infos($movieID); + + //Return the ID of the owner of the movie + return isset($movieInfos["userID"]) ? $movieInfos["userID"] : 0; + + } + /** * Parse a video informations *