@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $articleResult = $article->where("hash", $articleHash)->first(); |
| 22 | 22 | |
| 23 | 23 | if ($articleResult != null) { |
| 24 | - $articleResult["comments"] = $comment->where("articleHash", $articleHash)->orderBy("created_at")->get(); |
|
| 24 | + $articleResult[ "comments" ] = $comment->where("articleHash", $articleHash)->orderBy("created_at")->get(); |
|
| 25 | 25 | |
| 26 | 26 | return FormatHelper::formatData($articleResult); |
| 27 | 27 | } else { |
@@ -112,19 +112,19 @@ discard block |
||
| 112 | 112 | $dataArray = array(); |
| 113 | 113 | |
| 114 | 114 | if ($authorName != null) { |
| 115 | - $dataArray["authorName"] = $authorName; |
|
| 115 | + $dataArray[ "authorName" ] = $authorName; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if ($authorMail != null) { |
| 119 | - $dataArray["authorMail"] = $authorMail; |
|
| 119 | + $dataArray[ "authorMail" ] = $authorMail; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if ($title != null) { |
| 123 | - $dataArray["title"] = $title; |
|
| 123 | + $dataArray[ "title" ] = $title; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if ($content != null) { |
| 127 | - $dataArray["content"] = $content; |
|
| 127 | + $dataArray[ "content" ] = $content; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $comment->where("hash", $commentHash)->update($dataArray); |
@@ -40,5 +40,5 @@ |
||
| 40 | 40 | 'content' |
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | - protected $hidden = []; |
|
| 43 | + protected $hidden = [ ]; |
|
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -37,5 +37,5 @@ |
||
| 37 | 37 | 'url' |
| 38 | 38 | ]; |
| 39 | 39 | |
| 40 | - protected $hidden = []; |
|
| 40 | + protected $hidden = [ ]; |
|
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | $spam = $request->input("computer"); |
| 33 | 33 | |
| 34 | 34 | if ($spam != null) { |
| 35 | - $returnArray["error-code"] = "bot-detected"; |
|
| 35 | + $returnArray[ "error-code" ] = "bot-detected"; |
|
| 36 | 36 | $returnStatus = 403; |
| 37 | 37 | } else if ($captcha == null) { |
| 38 | - $returnArray["error-code"] = "captcha-missing"; |
|
| 38 | + $returnArray[ "error-code" ] = "captcha-missing"; |
|
| 39 | 39 | $returnStatus = 400; |
| 40 | 40 | } else if ($captcha != getenv("CAPTCHA_SECRET")) { |
| 41 | - $returnArray["error-code"] = "captcha-wrong"; |
|
| 41 | + $returnArray[ "error-code" ] = "captcha-wrong"; |
|
| 42 | 42 | $returnStatus = 400; |
| 43 | 43 | } else if ($method == "POST" && $requestPath == "/api/comment/add") { |
| 44 | 44 | $blogHash = $request->input("blogHash"); |
@@ -50,21 +50,21 @@ discard block |
||
| 50 | 50 | $articleUrl = $request->input("articleUrl"); |
| 51 | 51 | |
| 52 | 52 | if ($blogHash == null && $articleHash == null && $articleTitle == null && $articleAuthor == null && $articleUrl == null && $authorName == null && $content == null) { |
| 53 | - $returnArray["error-code"] = "invalid-request"; |
|
| 53 | + $returnArray[ "error-code" ] = "invalid-request"; |
|
| 54 | 54 | $returnStatus = 400; |
| 55 | 55 | } else if ($blogResult == null) { |
| 56 | - $returnArray["error-code"] = "blog-not-found"; |
|
| 56 | + $returnArray[ "error-code" ] = "blog-not-found"; |
|
| 57 | 57 | $returnStatus = 404; |
| 58 | 58 | } |
| 59 | 59 | } else if ($method == "PUT" && strpos($requestPath, "/api/comment/edit/") !== false) { |
| 60 | - $hash = $request->route()[2]["hash"]; |
|
| 60 | + $hash = $request->route()[ 2 ][ "hash" ]; |
|
| 61 | 61 | $commentResult = $comment->where("hash", $hash)->first(); |
| 62 | 62 | if ($commentResult == null) { |
| 63 | - $returnArray["error-code"] = "comment-not-found"; |
|
| 63 | + $returnArray[ "error-code" ] = "comment-not-found"; |
|
| 64 | 64 | $returnStatus = 404; |
| 65 | 65 | } |
| 66 | 66 | } else { |
| 67 | - $returnArray["error-code"] = "request-not-found"; |
|
| 67 | + $returnArray[ "error-code" ] = "request-not-found"; |
|
| 68 | 68 | $returnStatus = 400; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | if ($blogResult != null) { |
| 27 | 27 | $blogArticle = new BlogArticle(); |
| 28 | - $blogResult["articles"] = $blogArticle->where("blogHash", $blogHash)->orderBy("created_at")->get(); |
|
| 28 | + $blogResult[ "articles" ] = $blogArticle->where("blogHash", $blogHash)->orderBy("created_at")->get(); |
|
| 29 | 29 | |
| 30 | 30 | return FormatHelper::formatData($blogResult); |
| 31 | 31 | } else { |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | $dataArray = array(); |
| 75 | 75 | |
| 76 | 76 | if ($name != null) { |
| 77 | - $dataArray["name"] = $name; |
|
| 77 | + $dataArray[ "name" ] = $name; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | if ($description != null) { |
| 81 | - $dataArray["description"] = $description; |
|
| 81 | + $dataArray[ "description" ] = $description; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ($url != null) { |
| 85 | - $dataArray["url"] = $url; |
|
| 85 | + $dataArray[ "url" ] = $url; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $blog->where("hash", $blogHash)->update($dataArray); |
@@ -32,18 +32,18 @@ |
||
| 32 | 32 | $url = $request->input("url"); |
| 33 | 33 | |
| 34 | 34 | if ($name == null || $description == null || $url == null) { |
| 35 | - $returnArray["error-code"] = "invalid-request"; |
|
| 35 | + $returnArray[ "error-code" ] = "invalid-request"; |
|
| 36 | 36 | $returnStatus = 400; |
| 37 | 37 | } |
| 38 | 38 | } else if ($method == "PUT" && $requestPath == "/api/blog") { |
| 39 | 39 | $hash = $request->input("hash"); |
| 40 | 40 | $blogResult = $blog->where("hash", $hash)->first(); |
| 41 | 41 | if ($blogResult == null) { |
| 42 | - $returnArray["error-code"] = "blog-not-found"; |
|
| 42 | + $returnArray[ "error-code" ] = "blog-not-found"; |
|
| 43 | 43 | $returnStatus = 404; |
| 44 | 44 | } |
| 45 | 45 | } else { |
| 46 | - $returnArray["error-code"] = "request-not-found"; |
|
| 46 | + $returnArray[ "error-code" ] = "request-not-found"; |
|
| 47 | 47 | $returnStatus = 400; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | $returnArray = array(); |
| 24 | 24 | |
| 25 | 25 | if (!$request->hasHeader('Authorization')) { |
| 26 | - $returnArray["error-code"] = "authorization-header-not-found"; |
|
| 26 | + $returnArray[ "error-code" ] = "authorization-header-not-found"; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $token = $request->bearerToken(); |
| 30 | 30 | |
| 31 | 31 | if ($request->header('Authorization') == null || $token == null) { |
| 32 | - $returnArray["error-code"] = "no-token-provided"; |
|
| 32 | + $returnArray[ "error-code" ] = "no-token-provided"; |
|
| 33 | 33 | } else if (!$this->retrieveAndValidateToken($token)) { |
| 34 | - $returnArray["error-code"] = "token-is-not-valid"; |
|
| 34 | + $returnArray[ "error-code" ] = "token-is-not-valid"; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if (!empty($returnArray)) { |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | try { |
| 54 | 54 | $verifier = new JWTVerifier([ |
| 55 | - 'supported_algs' => ["RS256"], |
|
| 56 | - 'valid_audiences' => ['https://comment.eynet.xyz/'], |
|
| 57 | - 'authorized_iss' => ['https://comment-server.eu.auth0.com/'], |
|
| 55 | + 'supported_algs' => [ "RS256" ], |
|
| 56 | + 'valid_audiences' => [ 'https://comment.eynet.xyz/' ], |
|
| 57 | + 'authorized_iss' => [ 'https://comment-server.eu.auth0.com/' ], |
|
| 58 | 58 | ]); |
| 59 | 59 | |
| 60 | 60 | $verifier->verifyAndDecode($token); |
@@ -37,5 +37,5 @@ |
||
| 37 | 37 | 'url' |
| 38 | 38 | ]; |
| 39 | 39 | |
| 40 | - protected $hidden = []; |
|
| 40 | + protected $hidden = [ ]; |
|
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |