private function do_get_control_defs(&$plugin_cookies) { $defs = array(); $user_name = isset($plugin_cookies->user_name) ? $plugin_cookies->user_name : ''; $logged_in = $this->session->is_logged_in(); hd_print('Packet name: ' . ($logged_in ? $this->session->get_account()->packet_name : 'unset')); if ($user_name === '') { $login_str = 'unset'; } else { if (!$logged_in || !isset($this->session->get_account()->packet_name)) { $login_str = $user_name; } else { $login_str = $user_name . ' (' . $this->session->get_account()->packet_name . ')'; } } hd_print('Packet expire: ' . ($logged_in ? $this->session->get_account()->packet_expire : 'unset')); if (!$logged_in || !isset($this->session->get_account()->packet_expire) || $this->session->get_account()->packet_expire <= 0) { $expires_str = 'not available'; } else { $tm = $this->session->get_account()->packet_expire; $expires_str = HD::format_date_time_date($tm) . ', ' . HD::format_date_time_time($tm); } $this->add_label($defs, 'Subscription:', $login_str); $this->add_label($defs, 'Expires:', $expires_str); $this->add_button($defs, 'edit_subscription', null, 'Edit Subscription...', 0); $settings = $this->session->get_settings(); $stream_server_caption = 'not available'; $bitrate_caption = 'not available'; $http_caching_caption = 'not available'; $timeshift_caption = 'not available'; if (isset($settings)) { $stream_server = $settings->stream_server->value; foreach ($settings->stream_server->list as $pair) { if ($pair->ip === $stream_server) { $stream_server_caption = $pair->descr; break; } } $bitrate = $settings->bitrate->value; $bitrate_caption = $bitrate; $http_caching = $settings->http_caching->value; $http_caching_caption = $this->get_http_caching_caption($http_caching); $timeshift = $settings->timeshift->value; $timeshift_caption = $timeshift; } if ($logged_in) { $this->add_button($defs, 'edit_pcode', 'Code for protected channels:', 'Edit...', 0); $stream_server_ops = array(); foreach ($settings->stream_server->list as $pair) { $stream_server_ops[$pair->ip] = $pair->descr; } $this->add_combobox($defs, 'stream_server', 'Streaming server:', $stream_server, $stream_server_ops, 0, true); $bitrate_ops = array(); foreach ($settings->bitrate->list as $v) { $bitrate_ops[$v] = $v; } $this->add_combobox($defs, 'bitrate', 'Bitrate:', $bitrate, $bitrate_ops, 0, true); $http_caching_ops = array(); foreach ($settings->http_caching->{'0'} as $v) { $http_caching_ops[$v] = $this->get_http_caching_caption($v); } $this->add_combobox($defs, 'http_caching', 'Buffering period:', $http_caching, $http_caching_ops, 0, true); $timeshift_ops = array(); foreach ($settings->timeshift->list as $v) { $timeshift_ops[$v] = $v; } $this->add_combobox($defs, 'timeshift', 'Time shift (hours):', $timeshift, $timeshift_ops, 0, true); } else { $this->add_label($defs, 'Code for protected channels:', 'not available'); $this->add_label($defs, 'Streaming server:', $stream_server_caption); $this->add_label($defs, 'Bitrate:', $bitrate_caption); $this->add_label($defs, 'Buffering period:', $http_caching_caption); $this->add_label($defs, 'Time shift (hours):', $timeshift_caption); } if (isset($plugin_cookies->show_in_main_screen)) { $show_in_main_screen = $plugin_cookies->show_in_main_screen; } else { $show_in_main_screen = 'auto'; } $show_ops = array(); $show_ops['auto'] = 'Auto'; $show_ops['yes'] = 'Yes'; $show_ops['no'] = 'No'; $this->add_combobox($defs, 'show_in_main_screen', 'Show in main screen:', $show_in_main_screen, $show_ops, 0, true); return $defs; }