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))
|
if(! strlen($s))
|
||||||
return '';
|
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;
|
$x = $s;
|
||||||
do {
|
do {
|
||||||
$s = $x;
|
$s = $x;
|
||||||
$x = preg_replace('/^([^a-z])(.*?)/',"$2",$s);
|
$x = preg_replace('/^([^a-z])(.*?)/',"$2",$s);
|
||||||
} while($x != $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) {
|
function check_webbie($arr) {
|
||||||
|
|
||||||
|
|
||||||
|
// These names conflict with the CalDAV server
|
||||||
|
$taken = [ 'principals', 'addressbooks', 'calendars' ];
|
||||||
|
|
||||||
$reservechan = get_config('system','reserved_channels');
|
$reservechan = get_config('system','reserved_channels');
|
||||||
if(strlen($reservechan))
|
if(strlen($reservechan)) {
|
||||||
$taken = explode(',', $reservechan);
|
$taken = array_merge($taken,explode(',', $reservechan));
|
||||||
else
|
}
|
||||||
$taken = array('principals','addressbooks','calendars');
|
|
||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
if(count($arr)) {
|
if(count($arr)) {
|
||||||
|
Reference in New Issue
Block a user