@@ -147,7 +147,7 @@ |
||
| 147 | 147 | public function getIdentity($accessToken, $accessSecret) |
| 148 | 148 | { |
| 149 | 149 | |
| 150 | - global $toolUserAgent; |
|
| 150 | + global $toolUserAgent; |
|
| 151 | 151 | |
| 152 | 152 | $endpoint = $this->baseUrlInternal . '/identify&format=json'; |
| 153 | 153 | |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected $dbObject; |
| 21 | 21 | |
| 22 | - protected static $getByIdStatement = array(); |
|
| 22 | + protected static $getByIdStatement = array(); |
|
| 23 | 23 | |
| 24 | - protected static $getByIdResults = array(); |
|
| 24 | + protected static $getByIdResults = array(); |
|
| 25 | 25 | |
| 26 | 26 | public function setDatabase(PdoDatabase $db) |
| 27 | 27 | { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public static function getById($id, PdoDatabase $database) |
| 46 | 46 | { |
| 47 | 47 | if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) return self::$getByIdResults[strtolower(get_called_class())][$id]; |
| 48 | - if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;"); |
|
| 48 | + if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;"); |
|
| 49 | 49 | self::$getByIdStatement[strtolower(get_called_class())]->bindValue(":id", $id); |
| 50 | 50 | |
| 51 | 51 | self::$getByIdStatement[strtolower(get_called_class())]->execute(); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | if ($resultObject != false) { |
| 56 | 56 | $resultObject->isNew = false; |
| 57 | 57 | $resultObject->setDatabase($database); |
| 58 | - self::$getByIdResults[strtolower(get_called_class())][$id] = $resultObject; |
|
| 58 | + self::$getByIdResults[strtolower(get_called_class())][$id] = $resultObject; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | return $resultObject; |
@@ -44,8 +44,8 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public static function getById($id, PdoDatabase $database) |
| 46 | 46 | { |
| 47 | - if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) return self::$getByIdResults[strtolower(get_called_class())][$id]; |
|
| 48 | - if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;"); |
|
| 47 | + if (isset(self::$getByIdResults[strtolower(get_called_class())][$id])) return self::$getByIdResults[strtolower(get_called_class())][$id]; |
|
| 48 | + if (!isset(self::$getByIdStatement[strtolower(get_called_class())])) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;"); |
|
| 49 | 49 | self::$getByIdStatement[strtolower(get_called_class())]->bindValue(":id", $id); |
| 50 | 50 | |
| 51 | 51 | self::$getByIdStatement[strtolower(get_called_class())]->execute(); |
@@ -44,8 +44,12 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public static function getById($id, PdoDatabase $database) |
| 46 | 46 | { |
| 47 | - if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) return self::$getByIdResults[strtolower(get_called_class())][$id]; |
|
| 48 | - if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;"); |
|
| 47 | + if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) { |
|
| 48 | + return self::$getByIdResults[strtolower(get_called_class())][$id]; |
|
| 49 | + } |
|
| 50 | + if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) { |
|
| 51 | + self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;"); |
|
| 52 | + } |
|
| 49 | 53 | self::$getByIdStatement[strtolower(get_called_class())]->bindValue(":id", $id); |
| 50 | 54 | |
| 51 | 55 | self::$getByIdStatement[strtolower(get_called_class())]->execute(); |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | private $blacklistCache = null; |
| 33 | 33 | |
| 34 | - private static $commentsQuery = null; |
|
| 35 | - private static $commentsResults = array(); |
|
| 34 | + private static $commentsQuery = null; |
|
| 35 | + private static $commentsResults = array(); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * This function removes all old requests which are not yet email-confirmed |
@@ -260,10 +260,10 @@ discard block |
||
| 260 | 260 | return $this->hasComments; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - if (isset(self::$commentsResults[$this->id])) { |
|
| 264 | - $this->hasCommentsResolved = true; |
|
| 265 | - return $this->hasComments = self::$commentsResults[$this->id]; |
|
| 266 | - } |
|
| 263 | + if (isset(self::$commentsResults[$this->id])) { |
|
| 264 | + $this->hasCommentsResolved = true; |
|
| 265 | + return $this->hasComments = self::$commentsResults[$this->id]; |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | 268 | if ($this->comment != "") { |
| 269 | 269 | $this->hasComments = true; |
@@ -271,7 +271,9 @@ |
||
| 271 | 271 | return true; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if (is_null(self::$commentsQuery)) self::$commentsQuery = $this->dbObject->prepare("SELECT COUNT(*) as num FROM comment where request = :id;"); |
|
| 274 | + if (is_null(self::$commentsQuery)) { |
|
| 275 | + self::$commentsQuery = $this->dbObject->prepare("SELECT COUNT(*) as num FROM comment where request = :id;"); |
|
| 276 | + } |
|
| 275 | 277 | self::$commentsQuery->bindValue(":id", $this->id); |
| 276 | 278 | |
| 277 | 279 | self::$commentsQuery->execute(); |