if (!isset($_FILES['userfile']) || !isset($_REQUEST['pkgType'])) { stopError($conf['l']['admin:msg:PkgError']); } if ($_REQUEST['pkgType'] != 'theme' && $_REQUEST['pkgType'] != 'extension') { stopError($conf['l']['admin:msg:PkgError']); } if (!$_FILES['userfile']['tmp_name']) { stopError($conf['l']['admin:msg:PkgError']); } if (pathinfo($_FILES["userfile"]["name"], PATHINFO_EXTENSION) != 'pkg') { stopError($conf['l']['admin:msg:PkgError']); } $fName = P . 'storage/theme_' . rand(100000, 999999) . '.pkg'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $fName)) { include P . 'inc/zip.inc.php'; bwZip::zipRead($fName, true, false, P . $_REQUEST['pkgType'] . '/'); if ($_REQUEST['pkgType'] == 'extension') { if (file_exists(P . "extension/autoinstall.txt")) { $extID = file_get_contents(P . "extension/autoinstall.txt"); unlink(P . "extension/autoinstall.txt"); clearCache(); header("Location: {$conf['siteURL']}/{$conf['linkPrefixAdmin']}/extensions/add/{$conf['linkConj']}extID={$extID}&CSRFCode=" . $admin->getCSRFCode('newext')); exit; } } } header("Location: {$conf['siteURL']}/{$conf['linkPrefixAdmin']}/extensions/{$conf['linkConj']}CSRFCode=" . $admin->getCSRFCode('navibar')); } elseif ($canonical->currentArgs['subAction'] == 'selecttheme') { if (!isset($_REQUEST['themeID'])) { stopError($conf['l']['admin:msg:NoData']); }