forked from GNUsocial/gnu-social
Merge commit 'refs/merge-requests/1900' of git://gitorious.org/statusnet/mainline into integration
This commit is contained in:
commit
86560eeb3d
19
lib/util.php
19
lib/util.php
@ -1370,9 +1370,28 @@ function common_memcache()
|
||||
}
|
||||
}
|
||||
|
||||
function common_license_terms($uri)
|
||||
{
|
||||
if(preg_match('/creativecommons.org\/licenses\/([^\/]+)/', $uri, $matches)) {
|
||||
return explode('-',$matches[1]);
|
||||
}
|
||||
return array($uri);
|
||||
}
|
||||
|
||||
function common_compatible_license($from, $to)
|
||||
{
|
||||
$from_terms = common_license_terms($from);
|
||||
// public domain and cc-by are compatible with everything
|
||||
if(count($from_terms) == 1 && ($from_terms[0] == 'publicdomain' || $from_terms[0] == 'by')) {
|
||||
return true;
|
||||
}
|
||||
$to_terms = common_license_terms($to);
|
||||
// sa is compatible across versions. IANAL
|
||||
if(in_array('sa',$from_terms) || in_array('sa',$to_terms)) {
|
||||
return count(array_diff($from_terms, $to_terms)) == 0;
|
||||
}
|
||||
// XXX: better compatibility check needed here!
|
||||
// Should at least normalise URIs
|
||||
return ($from == $to);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user