diff --git a/cronjob.php b/cronjob.php index 8c8ebd5..892c6ad 100644 --- a/cronjob.php +++ b/cronjob.php @@ -16,8 +16,8 @@ foreach($roots as $root) { $groups = $sub->subChannelList(); $groupCount = count($groups); - - $availablechannel = false; + + $delete = false; $i = 0; foreach($groups as $group) { if(catchExceptions($group['channel_name'], $exceptions)) { @@ -25,10 +25,13 @@ foreach($roots as $root) { continue; } $i++; - if($group['total_clients'] == 0) { - $availablechannel = true; + if($delete == true AND $group['total_clients'] == 0) { + $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'; $replacement = '("$1" + 1)'; $newName = preg_replace($regex, $replacement, $group['channel_name']); @@ -41,15 +44,12 @@ foreach($roots as $root) { } } -function createChannel($server, $name, $parent, $options, $addparam = array()) { - $parameters = array( - 'channel_name' => $name, +function createChannel($server, $name, $parent, $options) { + $id = $server->channelCreate(array( + 'channel_name' => $name, + 'channel_flag_permanent' => TRUE, 'cpid' => $parent->getId() - ); - $parameters = array_merge($parameters, $addparam); - - $id = $server->channelCreate($parameters); - + )); if($options['inherit_icons']) { $channel = $server->channelGetById($id); $channel->modify(array('channel_icon_id' => $parent->getProperty('channel_icon_id'))); diff --git a/images/live.jpg b/images/live.jpg new file mode 100644 index 0000000..32496d8 Binary files /dev/null and b/images/live.jpg differ diff --git a/images/reference.jpg b/images/reference.jpg new file mode 100644 index 0000000..321a27d Binary files /dev/null and b/images/reference.jpg differ