legal_webbie() now provides different character rules depending on whether you federate or not. Added some comments in a few places that needed them.
This commit is contained in:
parent
d6c23486d5
commit
a92256e1cb
@ -2000,23 +2000,40 @@ function legal_webbie($s) {
|
||||
if(! strlen($s))
|
||||
return '';
|
||||
|
||||
|
||||
// Has to start with a lowercase alphabetic character - not a number.
|
||||
// This is so we can differentiate between something like channel=123
|
||||
// and channel=foo and lookup the first by numeric id and the second
|
||||
// by nickname.
|
||||
|
||||
$x = $s;
|
||||
do {
|
||||
$s = $x;
|
||||
$x = preg_replace('/^([^a-z])(.*?)/',"$2",$s);
|
||||
} while($x != $s);
|
||||
|
||||
return preg_replace('/([^a-z0-9\-\_])/','',$x);
|
||||
// Use the lowest common denominator rules (letters, numbers, and underscore)
|
||||
// if the site configuration allows federation with other networks
|
||||
|
||||
if(Zlib\System::get_server_role() === 'pro') {
|
||||
return preg_replace('/([^a-z0-9\-\_\.])/','',$x);
|
||||
}
|
||||
else {
|
||||
return preg_replace('/([^a-z0-9\_])/','',$x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function check_webbie($arr) {
|
||||
|
||||
|
||||
// These names conflict with the CalDAV server
|
||||
$taken = [ 'principals', 'addressbooks', 'calendars' ];
|
||||
|
||||
$reservechan = get_config('system','reserved_channels');
|
||||
if(strlen($reservechan))
|
||||
$taken = explode(',', $reservechan);
|
||||
else
|
||||
$taken = array('principals','addressbooks','calendars');
|
||||
if(strlen($reservechan)) {
|
||||
$taken = array_merge($taken,explode(',', $reservechan));
|
||||
}
|
||||
|
||||
$str = '';
|
||||
if(count($arr)) {
|
||||
|
Reference in New Issue
Block a user