示例#1
0
    if ($_POST["hasAv"]) {
        $av = 1;
    } else {
        $av = 0;
    }
    if ($_POST["browseable"]) {
        $browseable = 1;
    } else {
        $browseable = 0;
    }
    if (!preg_match("/^[a-zA-Z][a-zA-Z0-9.]*\$/", $shareName)) {
        new NotifyWidgetFailure(_T("Invalid share name"));
    } else {
        $add = True;
        if (strlen($sharePath)) {
            if (!isAuthorizedSharePath($sharePath)) {
                new NotifyWidgetFailure(_T("The share path is not authorized by configuration"));
                $add = False;
            }
        }
        if ($add) {
            $params = array($shareName, $sharePath, $shareDesc, $shareGroup, $shareUser, $permAll, $adminGroups, $browseable, $av, $customParameters);
            add_share($params);
            if (!isXMLRPCError()) {
                new NotifyWidgetSuccess(sprintf(_T("Share %s successfully added"), $shareName));
                header("Location: " . urlStrRedirect("samba/shares/index"));
                exit;
            }
        }
    }
}
示例#2
0
文件: edit.php 项目: psyray/mmc
function _shareNameAndPathCheckings($name, $path)
{
    if ($name and !preg_match("/^[a-zA-Z][a-zA-Z0-9.]*\$/", $name)) {
        new NotifyWidgetFailure(_T("Invalid share name"));
    } else {
        if (!isAuthorizedSharePath($path)) {
            new NotifyWidgetFailure(_T("The share path is not authorized by configuration"));
        } else {
            return True;
        }
    }
    return False;
}