|
|
@ -35,23 +35,25 @@ foreach($roots as $root) {
|
|
|
|
$regex = '#([0-9]{1,3})#e';
|
|
|
|
$regex = '#([0-9]{1,3})#e';
|
|
|
|
$replacement = '("$1" + 1)';
|
|
|
|
$replacement = '("$1" + 1)';
|
|
|
|
$newName = preg_replace($regex, $replacement, $group['channel_name']);
|
|
|
|
$newName = preg_replace($regex, $replacement, $group['channel_name']);
|
|
|
|
createChannel($server, $newName, $sub);
|
|
|
|
createChannel($server, $newName, $sub, $options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($groups) OR $i == 0) {
|
|
|
|
if(empty($groups) OR $i == 0) {
|
|
|
|
createChannel($server, $default, $sub);
|
|
|
|
createChannel($server, $default, $sub, $options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function createChannel($server, $name, $parent) {
|
|
|
|
function createChannel($server, $name, $parent, $options) {
|
|
|
|
return $server->channelCreate(
|
|
|
|
$id = $server->channelCreate(array(
|
|
|
|
array(
|
|
|
|
|
|
|
|
'channel_name' => $name,
|
|
|
|
'channel_name' => $name,
|
|
|
|
'channel_flag_permanent' => TRUE,
|
|
|
|
'channel_flag_permanent' => TRUE,
|
|
|
|
'cpid' => $parent->getId()
|
|
|
|
'cpid' => $parent->getId()
|
|
|
|
)
|
|
|
|
));
|
|
|
|
);
|
|
|
|
if($options['inherit_icons']) {
|
|
|
|
|
|
|
|
$channel = $server->channelGetById($id);
|
|
|
|
|
|
|
|
$channel->modify(array('channel_icon_id' => $parent->getProperty('channel_icon_id')));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function catchExceptions($name, $excpetions) {
|
|
|
|
function catchExceptions($name, $excpetions) {
|
|
|
|
foreach($excpetions as $exception) {
|
|
|
|
foreach($excpetions as $exception) {
|
|
|
|