$pluginInfo = json_decode($pluginInfo, true); if (isset($pluginInfo['file']) && !empty($pluginInfo['file'])) { $data = base64_decode($pluginInfo['file'], true); if ($data === false) { $pluginInfo['md5'] = md5($pluginInfo['file']); } else { $pluginInfo['md5'] = md5($data); } } if (isset($pluginInfo['location']) && !empty($pluginInfo['location'])) { $pluginInfo['location'] = base64_encode($pluginInfo['location']); } } elseif (preg_match("/form-(data|urlencoded)/", $contentType)) { $controller = new Controller(); $pluginInfo['name'] = $request->post('name'); $pluginInfo['file'] = $controller->fetchUploadedFile('file'); $pluginInfo['desc'] = $request->post('desc'); $pluginInfo['location'] = $request->post('location'); if (isset($pluginInfo['file']) && !empty($pluginInfo['file'])) { $pluginInfo['md5'] = md5($pluginInfo['file']); $pluginInfo['file'] = base64_encode($pluginInfo['file']); } if (isset($pluginInfo['location']) && !empty($pluginInfo['location'])) { $pluginInfo['location'] = base64_encode($pluginInfo['location']); } } if (!isset($pluginInfo['name']) || empty($pluginInfo['name'])) { $apiResponse = new APIViewData(1, $deployment, "Unable to detect name parameter (plugin name)"); $app->halt(404, $apiResponse->returnJson()); } elseif (preg_match_all("/[^\\w.-]/", $pluginInfo['name'], $forbidden)) { $apiResponse = new APIViewData(1, $deployment, "Unable to use plugin name specified, detected forbidden characters " . implode('', array_unique($forbidden[0])));