예제 #1
0
//
//function times($number) {
//    return $number * 2;
//}
//
//echo times(3);
//
//function square($number) {
//    return $number * $number;
//}
//
//echo square(4);
//
//$id = $_GET['id'];
//echo square($id);
//echo pow(2,8);
function drink($whatever = '7 up')
{
    return "I like to drink " . $whatever . '<br>';
}
//echo drink("7 up");
echo drink();
echo drink(null);
echo drink('pepsi');
// I like to make blank (v1) with blank (v2)
function want($first, $second = "my friends")
{
    return 'I like to ' . $first . ' with ' . $second . '.';
}
echo want('eat sandwiches');
function adjustAccessRights($accessRights)
{
    global $newSite;
    $accessRights->identifier->path->path = getPath($accessRights->identifier->path->path);
    if ($newSite == '') {
        $accessRights->identifier->path->siteName = "";
    } else {
        $accessRights->identifier->path->siteName = $newSite;
    }
    unset($accessRights->identifier->path->siteId);
    unset($accessRights->identifier->id);
    #
    # See http://issues.hannonhill.com/browse/CSI-219
    #
    if ($accessRights->identifier->type == 'structureddatadefinition') {
        $accessRights->identifier->type = 'datadefinition';
    }
    if ($accessRights->identifier->type == 'structureddatadefinitioncontainer') {
        $accessRights->identifier->type = 'datadefinitioncontainer';
    }
    if (isset($accessRights->aclEntries) && isset($accessRights->aclEntries->aclEntry)) {
        $nodes = $accessRights->aclEntries->aclEntry;
        if (!is_array($nodes)) {
            $nodes = array($nodes);
        }
        $newnodes = array();
        foreach ($nodes as &$node) {
            if ($node->type == 'group') {
                if (want($node->name, 'group')) {
                    checkGroup($node->name);
                    $node->name = getName($node->name);
                    array_push($newnodes, $node);
                }
            } else {
                if ($node->type == 'user') {
                    checkUser($node->name);
                    array_push($newnodes, $node);
                }
            }
        }
        $accessRights->aclEntries->aclEntry = $newnodes;
    }
    return $accessRights;
}