* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Author(s): * Miguel Julián <*****@*****.**> */ require "modules/samba4/includes/shares-xmlrpc.inc.php"; if (isset($_POST["bdeleteshare"])) { $share = $_POST["share"]; $deleteFiles = isset($_POST["deleteFiles"]) ? True : False; $deletionSuccess = deleteShare($share, $deleteFiles); if (!isXMLRPCError() and $deletionSuccess) { $successMessage = sprintf(_T("Share %s deleted", "samba4"), $share); new NotifyWidgetSuccess($successMessage); } else { $failureMessage = sprintf(_T("An error has occured during delete process on %s", "samba4"), $share); new NotifyWidgetFailure($failureMessage); } redirectTo(urlStrRedirect('samba4/shares/index')); exit; } else { $share = urldecode($_GET["share"]); $form = new PopupForm(_T("Delete a share", "samba4")); $form->addText(sprintf(_T("You will delete the share <b>%s</b>", "samba4"), $share)); $form->push(new Table()); $tr = new TrFormElement(_T("Delete data", "samba4"), new CheckboxTpl("deleteFiles"));
switch ($policyType) { case 'qiniu': Qiniu_SetKeys($ak, $sk); $client = new Qiniu_MacHttpClient(null); $err = Qiniu_RS_Delete($client, $bucketName, $ming); if ($err !== null) { echo "bad.删除失败"; } else { echo "ok.删除成功"; deleteShare($key1, $con); } break; case 'local': $deleteAction = @unlink(dirname(dirname(__FILE__)) . "/" . $fileDir . "/" . $ming); if ($deleteAction) { echo "ok.删除成功"; deleteShare($key1, $con); } else { echo "bad.删除失败"; } break; case 'server': $deleteToken = md5($ming . 'delete' . $ak); $postResult = curl_post($serverUrl, array('action' => 'delete', 'filedir' => $fileDir, 'filename' => $ming, 'token' => $deleteToken)); if ($postResult == "ok") { echo "ok.删除成功"; deleteShare($key1, $con); } else { echo "bad.删除失败"; } }
} else { $_SESSION['first'] = $first; } } } $userinfo = get_info($conn, $_SESSION['id']); if (isset($userinfo['errors'])) { $error = $userinfo['errors']; } else { $username = $userinfo['username']; $lastname = $userinfo['last']; $bio = $userinfo['bio']; } $firstname = $_SESSION['first']; if (isset($_POST['shareid']) && $_POST['shareid'] != "") { $error = deleteShare($_SESSION['id'], $_POST['shareid']); } if (isset($_FILES['upl'])) { if ($_FILES['upl']['error'] != 0) { $error = "There was an error uploading the file. Please try again."; } else { if (!isset($_FILES['upl']['name']) || $_FILES['upl']['name'] == "" || !isset($_FILES['upl']['type']) || $_FILES['upl']['type'] == "" || !isset($_FILES['upl']['size']) || $_FILES['upl']['size'] == "" || !isset($_FILES['upl']['tmp_name']) || $_FILES['upl']['tmp_name'] == "") { $error = "You cannot upload a file without all of the " . "required attributes. Please try again."; } else { if (intval($_FILES['upl']['size']) > $UPLOAD_LIMIT) { $error = "XML file cannot exceed 1 MB in size."; } } } if (!$error) { //change some ini settings to make us less vulnerable to DoS attacks via XXE