@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @var string |
| 44 | 44 | */ |
| 45 | - private $_pnf='pageNotFound'; |
|
| 45 | + private $_pnf = 'pageNotFound'; |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * App constructor. |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | private function getClass() |
| 66 | 66 | { |
| 67 | 67 | |
| 68 | - if (isset($this->_params[0]) && ! empty($this->_params[0])) { |
|
| 69 | - $this->_class = CONTROLLER_PATH . $this->_params[0]; |
|
| 68 | + if (isset($this->_params[0]) && !empty($this->_params[0])) { |
|
| 69 | + $this->_class = CONTROLLER_PATH.$this->_params[0]; |
|
| 70 | 70 | unset($this->_params[0]); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | private function getMethod() |
| 83 | 83 | { |
| 84 | - if (isset($this->_params[1]) && ! empty($this->_params[1])) { |
|
| 84 | + if (isset($this->_params[1]) && !empty($this->_params[1])) { |
|
| 85 | 85 | $this->_method = $this->_params[1]; |
| 86 | 86 | unset($this->_params[1]); |
| 87 | 87 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | if ($url = Input::get("url")) { |
| 110 | 110 | $this->_params = explode("/", filter_var(rtrim($url, "/"), FILTER_SANITIZE_URL)); |
| 111 | - $this->_params=array_slice($this->_params, 1); |
|
| 111 | + $this->_params = array_slice($this->_params, 1); |
|
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -136,14 +136,14 @@ |
||
| 136 | 136 | */ |
| 137 | 137 | public function clearSQLParam($AParam) |
| 138 | 138 | { |
| 139 | - $result = str_replace( "'", "", $AParam ); |
|
| 140 | - $result = str_replace( '"', '', $result ); |
|
| 141 | - $result = str_replace( '\\', '', $result ); |
|
| 142 | - $result = str_replace( '/', '', $result ); |
|
| 143 | - $result = str_replace( '&', '', $result ); |
|
| 144 | - $result = str_replace( '$', '', $result ); |
|
| 145 | - $result = str_replace( '@', '', $result ); |
|
| 146 | - $result = str_replace( '-', '', $result ); |
|
| 139 | + $result = str_replace("'", "", $AParam); |
|
| 140 | + $result = str_replace('"', '', $result); |
|
| 141 | + $result = str_replace('\\', '', $result); |
|
| 142 | + $result = str_replace('/', '', $result); |
|
| 143 | + $result = str_replace('&', '', $result); |
|
| 144 | + $result = str_replace('$', '', $result); |
|
| 145 | + $result = str_replace('@', '', $result); |
|
| 146 | + $result = str_replace('-', '', $result); |
|
| 147 | 147 | return $result; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $stringsJson = json_decode(file_get_contents(VDIR.'/strings_'.APP_LANG.'.json'), true); |
| 38 | 38 | |
| 39 | 39 | if (empty(self::$_texts)) { |
| 40 | - $texts=$stringsJson['TEXTS']; |
|
| 40 | + $texts = $stringsJson['TEXTS']; |
|
| 41 | 41 | self::$_texts = is_array($texts) ? $texts : []; |
| 42 | 42 | } |
| 43 | 43 | if (array_key_exists($key, self::$_texts)) { |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $token = (new self)->getToken(); |
| 33 | 33 | |
| 34 | - if(!$token) { |
|
| 34 | + if (!$token) { |
|
| 35 | 35 | return null; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $client = new Client(); |
| 39 | 39 | $headers = [ |
| 40 | - 'Authorization' => 'Bearer ' . $token, |
|
| 40 | + 'Authorization' => 'Bearer '.$token, |
|
| 41 | 41 | 'Accept' => 'application/json', |
| 42 | 42 | ]; |
| 43 | 43 | $res = $client->request('GET', 'http://user_management_nginx_1/user/checkToken', |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | ] |
| 48 | 48 | ); |
| 49 | 49 | $httpCode = $res->getStatusCode(); |
| 50 | - if($httpCode!=200) |
|
| 50 | + if ($httpCode != 200) |
|
| 51 | 51 | { |
| 52 | 52 | return null; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - return json_decode($res->getBody(),1); |
|
| 55 | + return json_decode($res->getBody(), 1); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -38,11 +38,11 @@ |
||
| 38 | 38 | http_response_code($httpCode); |
| 39 | 39 | |
| 40 | 40 | if ($succes) { |
| 41 | - $outPut=array('success'=>'true', 'data'=>$data); |
|
| 41 | + $outPut = array('success'=>'true', 'data'=>$data); |
|
| 42 | 42 | |
| 43 | 43 | } else { |
| 44 | 44 | |
| 45 | - $outPut=array('success'=>'false', 'error'=>$data); |
|
| 45 | + $outPut = array('success'=>'false', 'error'=>$data); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | echo json_encode($outPut, JSON_UNESCAPED_UNICODE); |
@@ -239,7 +239,7 @@ |
||
| 239 | 239 | if ($x < count($fields)) { |
| 240 | 240 | $set .= ", "; |
| 241 | 241 | } |
| 242 | - $x ++; |
|
| 242 | + $x++; |
|
| 243 | 243 | } |
| 244 | 244 | if (!$this->query("UPDATE {$table} SET {$set} WHERE $where = {$recordID}", $params)->error()) { |
| 245 | 245 | return true; |
@@ -28,25 +28,25 @@ |
||
| 28 | 28 | * @param null $errCode |
| 29 | 29 | * @param null $replaceMessage |
| 30 | 30 | */ |
| 31 | - public static function to($location = "", $errCode=null, $replaceMessage=null) |
|
| 31 | + public static function to($location = "", $errCode = null, $replaceMessage = null) |
|
| 32 | 32 | { |
| 33 | 33 | if ($location) { |
| 34 | 34 | if ($location === 404) { |
| 35 | 35 | |
| 36 | 36 | http_response_code(404); |
| 37 | 37 | $errorStrings = json_decode(file_get_contents(VDIR.'/errorStrings.json'), true); |
| 38 | - $errorString = $errorStrings[$errCode]; |
|
| 38 | + $errorString = $errorStrings[$errCode]; |
|
| 39 | 39 | $errorString = str_replace('@errMessage', $replaceMessage, $errorString); |
| 40 | 40 | |
| 41 | 41 | extract($errorString); |
| 42 | 42 | |
| 43 | 43 | ob_start(); |
| 44 | 44 | |
| 45 | - require VDIR . '/template/404.php'; |
|
| 45 | + require VDIR.'/template/404.php'; |
|
| 46 | 46 | |
| 47 | 47 | echo ob_get_clean(); |
| 48 | 48 | } else { |
| 49 | - header("Location: " . $location); |
|
| 49 | + header("Location: ".$location); |
|
| 50 | 50 | // header("Location: /index.php?url=login"); |
| 51 | 51 | } |
| 52 | 52 | exit; |
@@ -30,20 +30,20 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public static function check(array $source, array $inputs, $recordID = null) |
| 32 | 32 | { |
| 33 | - $_return=true; |
|
| 33 | + $_return = true; |
|
| 34 | 34 | |
| 35 | 35 | if (!Input::exists()) { |
| 36 | - $_return=false; |
|
| 36 | + $_return = false; |
|
| 37 | 37 | } |
| 38 | - if (!isset($source["csrf_token"]) && ! Token::check($source["csrf_token"])) { |
|
| 38 | + if (!isset($source["csrf_token"]) && !Token::check($source["csrf_token"])) { |
|
| 39 | 39 | Flash::danger(Text::getText("INPUT_INCORRECT_CSRF_TOKEN")); |
| 40 | - $_return=false; |
|
| 40 | + $_return = false; |
|
| 41 | 41 | } |
| 42 | 42 | $valid = new Validate($source, $recordID); |
| 43 | 43 | $validation = $valid->check($inputs); |
| 44 | 44 | if (!$validation->passed()) { |
| 45 | 45 | Session::put(SESSION_ERRORS, $validation->errors()); |
| 46 | - $_return=false; |
|
| 46 | + $_return = false; |
|
| 47 | 47 | } |
| 48 | 48 | return $_return; |
| 49 | 49 | } |
@@ -50,11 +50,11 @@ |
||
| 50 | 50 | $user = Utility\Request::getUser(); |
| 51 | 51 | |
| 52 | 52 | // Die if user is not admin |
| 53 | - if(!$user['user']['is_admin']) { |
|
| 53 | + if (!$user['user']['is_admin']) { |
|
| 54 | 54 | return Utility\Response::write(true, ['error'=>'authentication error!']); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $params = json_decode(file_get_contents('php://input'),true); |
|
| 57 | + $params = json_decode(file_get_contents('php://input'), true); |
|
| 58 | 58 | |
| 59 | 59 | $db = new \App\Model\Product(); |
| 60 | 60 | $product = $db->query( |