Exemplo n.º 1
0
function createIPv6Prefix($range = '', $name = '', $is_connected = FALSE, $taglist = array(), $vlan_ck = NULL)
{
    // $range is in aaa0:b::c:d/x format, split into ip/mask vars
    $rangeArray = explode('/', $range);
    if (count($rangeArray) != 2) {
        throw new InvalidRequestArgException('range', $range, 'Invalid IPv6 prefix');
    }
    $ip = $rangeArray[0];
    $mask = $rangeArray[1];
    $net = constructIPRange(ip6_parse($ip), $mask);
    usePreparedInsertBlade('IPv6Network', array('ip' => $net['ip_bin'], 'last_ip' => ip_last($net), 'mask' => $mask, 'name' => $name));
    $network_id = lastInsertID();
    # RFC3513 2.6.1 - Subnet-Router anycast
    if ($is_connected) {
        updateV6Address($net['ip_bin'], 'Subnet-Router anycast', 'yes');
    }
    produceTagsForNewRecord('ipv6net', $taglist, $network_id);
    if ($vlan_ck != NULL) {
        $ctx = getContext();
        fixContext(spotEntity('ipv6net', $network_id));
        if (permitted('ipv6net', '8021q', 'bind')) {
            commitSupplementVLANIPv6($vlan_ck, $network_id);
        }
        restoreContext($ctx);
    }
    return $network_id;
}
Exemplo n.º 2
0
function addFileWithoutLink()
{
    assertStringArg('comment', TRUE);
    // Make sure the file can be uploaded
    if (get_cfg_var('file_uploads') != 1) {
        throw new RackTablesError('file uploads not allowed, change "file_uploads" parameter in php.ini', RackTablesError::MISCONFIGURED);
    }
    $fp = fopen($_FILES['file']['tmp_name'], 'rb');
    global $sic;
    $file_id = commitAddFile($_FILES['file']['name'], $_FILES['file']['type'], $fp, $sic['comment']);
    if (isset($_REQUEST['taglist'])) {
        produceTagsForNewRecord('file', $_REQUEST['taglist'], $file_id);
    }
    showFuncMessage(__FUNCTION__, 'OK', array(htmlspecialchars($_FILES['file']['name'])));
}
Exemplo n.º 3
0
function commitCreateRSPool($name = '', $vsconfig = '', $rsconfig = '', $tagidlist = array())
{
    usePreparedInsertBlade('IPv4RSPool', array('name' => !strlen($name) ? NULL : $name, 'vsconfig' => !strlen($vsconfig) ? NULL : $vsconfig, 'rsconfig' => !strlen($rsconfig) ? NULL : $rsconfig));
    $new_pool_id = lastInsertID();
    lastCreated('ipv4rspool', $new_pool_id);
    produceTagsForNewRecord('ipv4rspool', $tagidlist, $new_pool_id);
    return $new_pool_id;
}