strClean $_GET['plugin'] and use that

This commit is contained in:
Matt Pass
2014-04-28 08:00:22 +01:00
parent fa40d9dad7
commit b811cfe92f

View File

@@ -34,11 +34,12 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Store the plugin zip to the tmp dir
$target = '../plugins/';
$zipFile = "../tmp/".basename($pluginsData[$_GET['plugin']]['zipURL']);
$zipURL = $pluginsData[strClean($_GET['plugin'])]['zipURL'];
$zipFile = "../tmp/".basename($zipURL);
if (ini_get('allow_url_fopen')) {
$fileData = file_get_contents($pluginsData[$_GET['plugin']]['zipURL'], false, $context);
$fileData = file_get_contents($zipURL, false, $context);
} elseif (function_exists('curl_init')) {
$client = curl_init($pluginsData[$_GET['plugin']]['zipURL']);
$client = curl_init($zipURL);
curl_setopt($client, CURLOPT_RETURNTRANSFER, 1); //fixed this line
$fileData = curl_exec($client);
}
@@ -109,7 +110,7 @@ if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset
// Finally, delete the plugin itself
$target = '../plugins/';
$dirName = basename($pluginsData[$_GET['plugin']]['zipURL'],".zip");
$dirName = basename(strClean($pluginsData[$_GET['plugin']]['zipURL']),".zip");
deletePlugin($target.$dirName."/");
}