From cafcc2165f00c9540ae41ee1d2651d1536dd65a0 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 30 Jan 2016 01:06:21 +0100 Subject: [PATCH] Removed unnecessary self::dependencies checks --- php/Modules/Album.php | 5 +---- php/Modules/Photo.php | 27 +++------------------------ php/Modules/Session.php | 6 ------ 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/php/Modules/Album.php b/php/Modules/Album.php index bdd540b..000df47 100644 --- a/php/Modules/Album.php +++ b/php/Modules/Album.php @@ -43,15 +43,12 @@ final class Album extends Module { } - public static function prepareData($data) { + public static function prepareData(array $data) { # This function requires the following album-attributes and turns them # into a front-end friendly format: id, title, public, sysstamp, password # Note that some attributes remain unchanged - # Check dependencies - self::dependencies(isset($data)); - # Init $album = null; diff --git a/php/Modules/Photo.php b/php/Modules/Photo.php index 637f635..b862d78 100755 --- a/php/Modules/Photo.php +++ b/php/Modules/Photo.php @@ -28,14 +28,11 @@ final class Photo extends Module { } - public function add($files, $albumID = 0, $description = '', $tags = '', $returnOnError = false) { + public function add(array $files, $albumID = 0, $description = '', $tags = '', $returnOnError = false) { # Use $returnOnError if you want to handle errors by your own # e.g. when calling this functions inside an if-condition - # Check dependencies - self::dependencies(isset($files)); - # Check permissions if (hasPermissions(LYCHEE_UPLOADS)===false|| hasPermissions(LYCHEE_UPLOADS_BIG)===false|| @@ -255,9 +252,6 @@ final class Photo extends Module { private function exists($checksum, $photoID = null) { - # Check dependencies - self::dependencies(isset($checksum)); - # Exclude $photoID from select when $photoID is set if (isset($photoID)) $query = Database::prepare(Database::get(), "SELECT id, url, thumbUrl, medium FROM ? WHERE checksum = '?' AND id <> '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $checksum, $photoID)); else $query = Database::prepare(Database::get(), "SELECT id, url, thumbUrl, medium FROM ? WHERE checksum = '?' LIMIT 1", array(LYCHEE_TABLE_PHOTOS, $checksum)); @@ -290,9 +284,6 @@ final class Photo extends Module { private function createThumb($url, $filename, $type, $width, $height) { - # Check dependencies - self::dependencies(isset($url, $filename, $type, $width, $height)); - # Call plugins Plugins::get()->activate(__METHOD__, 0, func_get_args()); @@ -389,9 +380,6 @@ final class Photo extends Module { # (boolean) true = Success # (boolean) false = Failure - # Check dependencies - self::dependencies(isset($url, $filename, $width, $height)); - # Call plugins Plugins::get()->activate(__METHOD__, 0, func_get_args()); @@ -457,7 +445,7 @@ final class Photo extends Module { } - public function adjustFile($path, $info) { + public function adjustFile($path, array $info) { # Function rotates and flips a photo based on its EXIF orientation # Excepts the following: @@ -467,9 +455,6 @@ final class Photo extends Module { # (array) $info = ['orientation', 'width', 'height'] = Success # (boolean) false = Failure - # Check dependencies - self::dependencies(isset($path, $info)); - # Call plugins Plugins::get()->activate(__METHOD__, 0, func_get_args()); @@ -591,7 +576,7 @@ final class Photo extends Module { } - public static function prepareData($data) { + public static function prepareData(array $data) { # Function turns photo-attributes into a front-end friendly format. Note that some attributes remain unchanged. # Excepts the following: @@ -599,9 +584,6 @@ final class Photo extends Module { # Returns the following: # (array) $photo - # Check dependencies - self::dependencies(isset($data)); - # Init $photo = null; @@ -703,9 +685,6 @@ final class Photo extends Module { # Returns the following: # (array) $return - # Check dependencies - self::dependencies(isset($url)); - # Call plugins Plugins::get()->activate(__METHOD__, 0, func_get_args()); diff --git a/php/Modules/Session.php b/php/Modules/Session.php index be3e115..b5ef689 100755 --- a/php/Modules/Session.php +++ b/php/Modules/Session.php @@ -6,9 +6,6 @@ final class Session extends Module { public function init($public) { - # Check dependencies - self::dependencies(isset($public)); - # Call plugins Plugins::get()->activate(__METHOD__, 0, func_get_args()); @@ -65,9 +62,6 @@ final class Session extends Module { public function login($username, $password) { - # Check dependencies - self::dependencies(isset($username, $password)); - # Call plugins Plugins::get()->activate(__METHOD__, 0, func_get_args());