temp channels aren't possible... broken by design

master
lub 10 years ago
parent 295c75b65b
commit 191e215776

@ -16,8 +16,8 @@ foreach($roots as $root) {
$groups = $sub->subChannelList(); $groups = $sub->subChannelList();
$groupCount = count($groups); $groupCount = count($groups);
$availablechannel = false; $delete = false;
$i = 0; $i = 0;
foreach($groups as $group) { foreach($groups as $group) {
if(catchExceptions($group['channel_name'], $exceptions)) { if(catchExceptions($group['channel_name'], $exceptions)) {
@ -25,10 +25,13 @@ foreach($roots as $root) {
continue; continue;
} }
$i++; $i++;
if($group['total_clients'] == 0) { if($delete == true AND $group['total_clients'] == 0) {
$availablechannel = true; $group->delete();
} }
if($i == $groupCount AND $availablechannel = false) { if($group['total_clients'] == 0) {
$delete = true;
}
if($i == $groupCount AND $delete == false) {
$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']);
@ -41,15 +44,12 @@ foreach($roots as $root) {
} }
} }
function createChannel($server, $name, $parent, $options, $addparam = array()) { function createChannel($server, $name, $parent, $options) {
$parameters = array( $id = $server->channelCreate(array(
'channel_name' => $name, 'channel_name' => $name,
'channel_flag_permanent' => TRUE,
'cpid' => $parent->getId() 'cpid' => $parent->getId()
); ));
$parameters = array_merge($parameters, $addparam);
$id = $server->channelCreate($parameters);
if($options['inherit_icons']) { if($options['inherit_icons']) {
$channel = $server->channelGetById($id); $channel = $server->channelGetById($id);
$channel->modify(array('channel_icon_id' => $parent->getProperty('channel_icon_id'))); $channel->modify(array('channel_icon_id' => $parent->getProperty('channel_icon_id')));

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Loading…
Cancel
Save