public function create(RESTRequest $request)
 {
     $stb_list = $request->getConvertedIdentifiers();
     $identifiers = $request->getIdentifiers();
     if (empty($stb_list) && !empty($identifiers)) {
         throw new RESTCommandException('STB not found');
     }
     $event = new SysEvent();
     if (empty($identifiers)) {
         $event->setUserListByMac('all');
     } else {
         $event->setUserListById($stb_list);
     }
     if ($request->getData('ttl')) {
         $event->setTtl($request->getData('ttl'));
     }
     switch ($request->getData('event')) {
         case 'send_msg':
             if ($request->getData('need_reboot')) {
                 $event->sendMsgAndReboot($request->getData('msg'));
             } else {
                 $event->sendMsg($request->getData('msg'));
             }
             if ($request->getData('auto_hide_timeout')) {
                 $event->setAutoHideTimeout($request->getData('auto_hide_timeout'));
             }
             break;
         case 'send_msg_with_video':
             $event->sendMsgWithVideo($request->getData('msg'), $request->getData('video'));
             break;
         case 'reboot':
             $event->sendReboot();
             break;
         case 'reload_portal':
             $event->sendReloadPortal();
             break;
         case 'update_channels':
             $event->sendUpdateChannels();
             break;
         case 'play_channel':
             $event->sendPlayChannel($request->getData('channel'));
             break;
         case 'play_radio_channel':
             $event->sendPlayRadioChannel($request->getData('channel'));
             break;
         case 'update_image':
             $event->sendUpdateImage();
             break;
         case 'cut_off':
             $event->sendCutOff();
             break;
         case 'show_menu':
             $event->sendShowMenu();
             break;
         default:
             return false;
     }
     return true;
 }
 public function create(RESTRequest $request)
 {
     $stb_list = $request->getConvertedIdentifiers();
     if (empty($stb_list)) {
         throw new RESTCommandException('Empty stb list');
     }
     $msg = $request->getData("msg");
     if (empty($msg)) {
         throw new RESTCommandException('Empty msg');
     }
     $event = new SysEvent();
     $ttl = (int) $request->getData("ttl");
     if (!empty($ttl)) {
         $event->setTtl($ttl);
     }
     $auto_hide_timeout = (int) $request->getData('auto_hide_timeout');
     if ($auto_hide_timeout) {
         $event->setAutoHideTimeout($auto_hide_timeout);
     }
     $event->setUserListById($stb_list);
     $event->sendMsg($msg);
     return true;
 }
Ejemplo n.º 3
0
     }
 }
 if ($_POST['event'] == 'cut_off') {
     if (!is_array($user_list)) {
         $user_list = array($user_list);
     }
     $sql = "update users set status=1, last_change_status=NOW() where id in (" . implode(",", $user_list) . ")";
     Mysql::getInstance()->query($sql);
     $event->sendCutOff();
 }
 switch ($_POST['event']) {
     case 'send_msg':
         if (@$_POST['need_reboot']) {
             $event->sendMsgAndReboot(@$_POST['msg']);
         } else {
             $event->sendMsg(@$_POST['msg']);
         }
         break;
     case 'send_msg_with_video':
         $event->sendMsgWithVideo(@$_POST['msg'], @$_POST['video_url']);
         break;
     case 'reboot':
         $event->sendReboot();
         break;
     case 'reload_portal':
         $event->sendReloadPortal();
         break;
     case 'update_channels':
         $event->sendUpdateChannels();
         break;
     case 'play_channel':
Ejemplo n.º 4
0
 public function getProfile()
 {
     $debug_key = $this->getDebugKey();
     if (Config::getSafe('disable_portal', false) && (empty($debug_key) || !$this->checkDebugKey($debug_key))) {
         try {
             Mysql::getInstance()->update('users', array('access_token' => $this->access_token), array('id' => $this->id));
             if (\Config::getSafe('bind_stb_auth_and_oauth', true)) {
                 $this->resetOauthToken();
             }
         } catch (MysqlException $e) {
             echo $e->getMessage() . PHP_EOL;
         }
         return array('status' => 1, 'block_msg' => _('The portal is temporarily unavailable.<br>Please try again later.<br>Sorry for the inconvenience.'), 'portal_disabled' => true);
     }
     if (function_exists('geoip_country_code_by_name')) {
         $country = @geoip_country_code_by_name($this->ip);
         if (!$country) {
             error_log('geoip_country_code_by_name(): Host ' . $this->ip . ' not found');
         }
     } else {
         $country = '';
     }
     $model = isset($_REQUEST['stb_type']) ? $_REQUEST['stb_type'] : '';
     $serial_number = isset($_REQUEST['sn']) ? $_REQUEST['sn'] : '';
     $version = isset($_REQUEST['ver']) ? $_REQUEST['ver'] : '';
     $device_id = isset($_REQUEST['device_id']) ? $_REQUEST['device_id'] : '';
     $device_id2 = isset($_REQUEST['device_id2']) ? $_REQUEST['device_id2'] : '';
     $signature = isset($_REQUEST['signature']) ? $_REQUEST['signature'] : '';
     $force_auth = null;
     $filter_response = $this->passAccessFilter($country, $model, $this->mac, $serial_number, $version, $device_id2, $signature, $force_auth);
     $this->params['stb_type'] = $model;
     if (is_array($filter_response)) {
         $filter_result = $filter_response['result'];
     } else {
         $filter_result = $filter_response;
     }
     if (!$filter_result) {
         $this->logDeniedByFilter($country, $model, $this->mac, $version);
         $profile = array('status' => 1, 'msg' => 'access denied');
         if (!empty($filter_response['message'])) {
             $profile['block_msg'] = _($filter_response['message']);
         }
         return $profile;
     }
     if ((empty($_SERVER['TARGET']) || $_SERVER['TARGET'] != 'API' && $_SERVER['TARGET'] != 'ADM') && Config::getSafe('enable_mac_format_validation', true) && !Middleware::isValidMAC($this->mac)) {
         $this->logNotValidMAC(isset($_REQUEST['sn']) ? $_REQUEST['sn'] : '', isset($_REQUEST['stb_type']) ? $_REQUEST['stb_type'] : '');
         return array('status' => 1);
     }
     $debug_key = $this->getDebugKey();
     if (!empty($debug_key) && $this->checkDebugKey($debug_key)) {
         // emulation
     } elseif (Config::getSafe('enable_device_id_validation', true)) {
         if ($device_id2) {
             $device = Mysql::getInstance()->from('users')->where(array('device_id2' => $device_id2))->get()->first();
             if (!empty($device) && strtoupper($device['mac']) != $this->mac) {
                 $this->logDeviceConflict($device_id2, $this->mac, $serial_number, $model, 'MAC address mismatch, reason - device_id2');
                 return array('status' => 1, 'msg' => 'device conflict - MAC address mismatch');
             }
         }
         if ($this->id) {
             $update = array();
             if (!$this->getParam('device_id') && $device_id) {
                 $update['device_id'] = $device_id;
             }
             if (!$this->getParam('device_id2') && $device_id2) {
                 $update['device_id2'] = $device_id2;
             }
             if (!empty($update)) {
                 Mysql::getInstance()->update('users', $update, array('id' => $this->id));
             }
             if ($this->getParam('device_id') && $this->getParam('device_id') != $device_id) {
                 $this->logDeviceConflict($device_id, $this->mac, $serial_number, $model, 'device_id mismatch');
                 return array('status' => 1, 'msg' => 'device conflict - device_id mismatch', 'block_msg' => _('Your STB is damaged.<br/> Call the provider.'));
             }
             if ($this->getParam('device_id2') && $this->getParam('device_id2') != $device_id2) {
                 $this->logDeviceConflict($device_id2, $this->mac, $serial_number, $model, 'device_id2 mismatch');
                 return array('status' => 1, 'msg' => 'device conflict - device_id mismatch', 'block_msg' => _('Your STB is damaged.<br/> Call the provider.'));
             }
         }
     }
     if ($model != 'MAG200' && $model != 'MAG260' && (empty($debug_key) || !$this->checkDebugKey($debug_key))) {
         preg_match("/Player Engine version: (\\S+)/", $version, $match);
         if (!empty($match[1])) {
             $player_version = hexdec($match[1]);
         }
         if (empty($player_version) || empty($match) || $player_version < 1382) {
             $auto_update_setting = ImageAutoUpdate::getSettingByStbType($this->params['stb_type']);
             return array('status' => 1, 'msg' => 'old firmware', 'block_msg' => _('Firmware of your STB is outdated.<br>Please update it.'), 'autoupdate' => empty($auto_update_setting) ? false : $auto_update_setting, 'update_url' => self::getImageUpdateUrl($this->params['stb_type']));
         }
     }
     $valid_saved_auth = $this->getParam('access_token') && $this->access_token == $this->getParam('access_token') && !intval($_REQUEST['not_valid_token']);
     if (!$this->id) {
         $disable_auth_for_models = Config::exist('disable_auth_for_models') ? preg_split("/\\s*,\\s*/", trim(Config::get('disable_auth_for_models'))) : array();
         if (!$valid_saved_auth && Config::exist('auth_url') && (!in_array($model, $disable_auth_for_models) || $force_auth === true)) {
             if (Config::getSafe('init_device_before_auth', false)) {
                 $this->initProfile(null, null, $device_id, $device_id2);
                 $this->getInfoFromOss(!$force_auth);
             }
             return array('status' => 2, 'template' => $this->getUserPortalTheme(), 'info' => Config::exist('registration_url') ? sprintf(_('Use your username and password to login or register on %s'), Config::get('registration_url')) : '');
         } else {
             if (!Config::getSafe('auto_add_stb', true)) {
                 return array('status' => 1, 'block_msg' => str_replace('.', '!', _('Please contact your provider<br>to register this device.')));
             } else {
                 $this->initProfile(null, null, $device_id, $device_id2);
                 $this->params['stb_type'] = $model;
             }
         }
     } else {
         Mysql::getInstance()->update('users', array('access_token' => $this->access_token), array('id' => $this->id));
         if (\Config::getSafe('bind_stb_auth_and_oauth', true)) {
             $this->resetOauthToken();
         }
         if (!$valid_saved_auth && intval($_REQUEST['auth_second_step']) === 0 && Config::exist('auth_url') && (strpos(Config::get('auth_url'), 'auth_every_load') || $force_auth === true)) {
             $this->getInfoFromOss(!$force_auth);
             return array('status' => 2, 'template' => $this->getUserPortalTheme(), 'info' => Config::exist('registration_url') ? sprintf(_('Use your username and password to login or register on %s'), Config::get('registration_url')) : '');
         }
     }
     $this->db->update('users', array('last_start' => 'NOW()', 'keep_alive' => 'NOW()', 'version' => @$_REQUEST['ver'], 'hd' => @$_REQUEST['hd'], 'stb_type' => $model, 'video_out' => isset($_REQUEST['video_out']) ? $_REQUEST['video_out'] : '', 'serial_number' => isset($_REQUEST['sn']) ? $_REQUEST['sn'] : '', 'num_banks' => isset($_REQUEST['num_banks']) ? (int) $_REQUEST['num_banks'] : 0, 'image_version' => isset($_REQUEST['image_version']) ? $_REQUEST['image_version'] : '', 'locale' => $this->locale, 'country' => $country, 'verified' => (int) ($force_auth === false), 'hw_version' => isset($_REQUEST['hw_version']) ? $_REQUEST['hw_version'] : ''), array('id' => $this->id));
     $info = $this->getInfoFromOss(!$force_auth);
     if (self::$just_created == true && Config::getSafe('enable_welcome_message', false)) {
         $event = new SysEvent();
         $event->setUserListById($this->id);
         $event->sendMsg(sprintf(_('Welcome %s<br>We are glad to see you on the Stalker portal!'), $this->getParam('fname')));
     }
     $master = new VideoMaster();
     $profile = $this->params;
     if ($info && array_key_exists('error_msg', $info)) {
         $profile['block_msg'] = $info['error_msg'];
     }
     $profile['storages'] = $master->getStoragesForStb();
     $itv = Itv::getInstance();
     $profile['last_itv_id'] = $itv->getLastId();
     $profile['updated'] = $this->getUpdatedPlaces();
     $profile['rtsp_type'] = Config::get('rtsp_type');
     $profile['rtsp_flags'] = Config::get('rtsp_flags');
     $profile['locale'] = $this->locale;
     $profile['stb_lang'] = $this->stb_lang;
     $profile['display_menu_after_loading'] = empty($this->params['show_after_loading']) ? Config::getSafe('display_menu_after_loading', false) : $this->params['show_after_loading'] == 'main_menu';
     $profile['record_max_length'] = intval(Config::get('record_max_length'));
     $profile['web_proxy_host'] = Config::exist('stb_http_proxy_host') ? Config::get('stb_http_proxy_host') : '';
     $profile['web_proxy_port'] = Config::exist('stb_http_proxy_port') ? Config::get('stb_http_proxy_port') : '';
     $profile['web_proxy_user'] = Config::exist('stb_http_proxy_user') ? Config::get('stb_http_proxy_user') : '';
     $profile['web_proxy_pass'] = Config::exist('stb_http_proxy_pass') ? Config::get('stb_http_proxy_pass') : '';
     $profile['web_proxy_exclude_list'] = Config::exist('stb_http_proxy_exclude_list') ? Config::get('stb_http_proxy_exclude_list') : '';
     $profile['update_url'] = self::getImageUpdateUrl(empty($_REQUEST['stb_type']) ? 'mag250' : $_REQUEST['stb_type']);
     if (!in_array($this->mac, Config::getSafe('playback_limit_whitelist', array()))) {
         $profile['playback_limit'] = (int) Config::get('enable_playback_limit', 0);
     } else {
         $profile['playback_limit'] = 0;
     }
     $profile['demo_video_url'] = Config::getSafe('demo_video_url', '');
     $profile['tv_quality_filter'] = Config::get('enable_tv_quality_filter');
     $profile['use_embedded_settings'] = Config::getSafe('use_embedded_settings', false);
     $profile['test_download_url'] = Config::getSafe('test_download_url', '');
     $profile['is_moderator'] = $this->isModerator();
     $profile['watchdog_timeout'] = Config::getSafe('watchdog_timeout', 30000);
     $max_id = Mysql::getInstance()->select('max(id) as max_id')->from('users')->get()->first('max_id');
     $profile['timeslot_ratio'] = $this->id / $max_id;
     $profile['timeslot'] = $profile['timeslot_ratio'] * $profile['watchdog_timeout'];
     $profile['kinopoisk_rating'] = Config::getSafe('kinopoisk_rating', true);
     $profile['enable_tariff_plans'] = Config::getSafe('enable_tariff_plans', false);
     $profile['enable_buffering_indication'] = Config::getSafe('enable_buffering_indication', false);
     $profile['default_timezone'] = Config::getSafe('default_timezone', '');
     $profile['default_locale'] = Config::getSafe('default_locale', '');
     $profile['allowed_stb_types'] = array_map(function ($item) {
         return strtolower(trim($item));
     }, explode(',', Config::getSafe('allowed_stb_types', 'MAG200,MAG245,MAG245D,MAG250,MAG254,MAG255,MAG260,MAG270,MAG275,AuraHD,WR320,IP_STB_HD')));
     $profile['allowed_stb_types_for_local_recording'] = array_map(function ($item) {
         return strtolower(trim($item));
     }, explode(',', Config::getSafe('allowed_stb_types_for_local_recording', 'MAG245,MAG245D,MAG250,MAG254,MAG255,MAG260,MAG270,MAG275,AuraHD,WR320,IP_STB_HD')));
     $auto_update_setting = ImageAutoUpdate::getSettingByStbType($this->params['stb_type']);
     if ($auto_update_setting) {
         $profile['autoupdate'] = $auto_update_setting;
     }
     $profile['strict_stb_type_check'] = Config::getSafe('strict_stb_type_check', false);
     $profile['cas_type'] = Config::getSafe('cas_type', 0);
     $profile['cas_params'] = Config::getSafe('cas_params', null);
     $profile['cas_web_params'] = Config::getSafe('cas_web_params', null);
     $profile['cas_additional_params'] = Config::getSafe('cas_additional_params', array());
     $profile['cas_hw_descrambling'] = Config::getSafe('cas_hw_descrambling', 0);
     $profile['cas_ini_file'] = Config::getSafe('cas_ini_file', "");
     $profile['logarithm_volume_control'] = Config::getSafe('logarithm_volume_control', false);
     $profile['allow_subscription_from_stb'] = Config::getSafe('allow_subscription_from_stb', true);
     $profile['deny_720p_gmode_on_mag200'] = Config::getSafe('deny_720p_gmode_on_mag200', false);
     $profile['enable_arrow_keys_setpos'] = Config::getSafe('enable_arrow_keys_setpos', false);
     $profile['show_purchased_filter'] = Config::getSafe('show_purchased_filter', false);
     $profile['timezone_diff'] = $this->timezone_diff;
     $profile['enable_connection_problem_indication'] = Config::getSafe('enable_connection_problem_indication', true);
     $profile['invert_channel_switch_direction'] = Config::getSafe('invert_channel_switch_direction', false);
     $profile['play_in_preview_only_by_ok'] = $this->params['play_in_preview_by_ok'] === null ? (bool) Config::getSafe('play_in_preview_only_by_ok', false) : (bool) $this->params['play_in_preview_by_ok'];
     $profile['enable_stream_error_logging'] = Config::getSafe('enable_stream_error_logging', false);
     $profile['always_enabled_subtitles'] = Config::getSafe('always_enabled_subtitles', false);
     $profile['enable_service_button'] = Config::getSafe('enable_service_button', false);
     $profile['enable_setting_access_by_pass'] = Config::getSafe('enable_setting_access_by_pass', false);
     $profile['show_tv_channel_logo'] = Config::getSafe('show_tv_channel_logo', true);
     $profile['tv_archive_continued'] = Config::getSafe('tv_archive_continued', false);
     $profile['plasma_saving_timeout'] = Config::getSafe('plasma_saving_timeout', false);
     $profile['show_tv_only_hd_filter_option'] = Config::getSafe('show_tv_only_hd_filter_option', false);
     $profile['tv_playback_retry_limit'] = Config::getSafe('tv_playback_retry_limit', 0);
     $profile['fading_tv_retry_timeout'] = Config::getSafe('fading_tv_retry_timeout', true);
     $profile['epg_update_time_range'] = floatval(Config::getSafe('epg_update_delay_per_user', 0.2)) * $max_id;
     $profile['store_auth_data_on_stb'] = Config::getSafe('store_auth_data_on_stb', true) && Config::exist('auth_url') && $force_auth !== false;
     if (Config::getSafe('enable_tariff_plans', false)) {
         $profile['additional_services_on'] = '1';
     }
     $profile['hdmi_event_reaction'] = $profile['hdmi_event_reaction'] === null ? (int) Config::getSafe('enable_hdmi_events_handler', true) : (int) $profile['hdmi_event_reaction'];
     $profile['account_page_by_password'] = Config::getSafe('account_page_by_password', false);
     $profile['tester'] = Mysql::getInstance()->from('testers')->where(array('mac' => $this->mac, 'status' => 1))->get()->first() != null;
     $profile['show_channel_logo_in_preview'] = Config::getSafe('show_channel_logo_in_preview', false);
     $profile['enable_stream_losses_logging'] = Config::getSafe('enable_stream_losses_logging', false);
     $profile['external_payment_page_url'] = sprintf(Config::getSafe('external_payment_page_url', ''), $this->getParam('ls'), $this->mac);
     $profile['max_local_recordings'] = Config::getSafe('max_local_recordings', 10);
     $profile['tv_channel_default_aspect'] = Config::getSafe('tv_channel_default_aspect', 'fit');
     $profile['default_led_level'] = Config::getSafe('default_led_level', 10);
     $profile['standby_led_level'] = Config::getSafe('standby_led_level', 90);
     if (Config::exist('portal_logo_url')) {
         $profile['portal_logo_url'] = Config::get('portal_logo_url');
     }
     $profile['show_version_in_main_menu'] = Config::getSafe('show_version_in_main_menu', true);
     $profile['check_ssl_certificate'] = (int) Config::getSafe('check_ssl_certificate', false);
     $profile['disable_youtube_for_mag200'] = Config::getSafe('disable_youtube_for_mag200', true);
     $profile['hls_fast_start'] = Config::getSafe('hls_fast_start', true);
     $profile['auth_access'] = Config::exist('auth_url');
     $profile['epg_data_block_period_for_stb'] = Config::getSafe('epg_data_block_period_for_stb', 5);
     $profile['standby_on_hdmi_off'] = Config::getSafe('standby_on_hdmi_off', false);
     $profile['force_ch_link_check'] = Config::getSafe('force_ch_link_check', false);
     unset($profile['device_id']);
     unset($profile['device_id2']);
     unset($profile['access_token']);
     unset($profile['serial_number']);
     return $profile;
 }
include "./common.php";
if (Config::getSafe('enable_internal_billing', false) && Config::getSafe('number_of_days_to_send_message', false) !== FALSE) {
    $locales = array();
    $allowed_locales = Config::get("allowed_locales");
    $default_locale = Config::get("default_locale");
    bindtextdomain('stb', PROJECT_PATH . '/locale');
    textdomain('stb');
    bind_textdomain_codeset('stb', 'UTF-8');
    $end_billing_interval = Config::getSafe('number_of_days_to_send_message', false);
    $users = Mysql::getInstance()->select(array('id', '(TO_DAYS(`expire_billing_date`) - TO_DAYS(NOW())) as `end_billing_days`', 'locale'))->from("`users`")->where(array("(TO_DAYS(`expire_billing_date`) - TO_DAYS(NOW())) <= {$end_billing_interval} AND CAST(`expire_billing_date` AS CHAR) <> '0000-00-00 00:00:00' AND 1=" => 1, 'status' => 0))->get()->all();
    $event = new SysEvent();
    $event->setTtl(86340);
    $msg_more = 'Dear Subscriber! Your payment term will expire in "%s" days. Please refill a personal account in order to avoid tripping of services.';
    $msg_today = "Dear Subscriber! Your payment term will expire today. Please refill a personal account in order to avoid tripping of services.";
    $msg = '';
    $locale = $default_locale;
    foreach ($users as $user) {
        $current_local = setlocale(LC_MESSAGES, 0);
        $event->setUserListById($user['id']);
        if (in_array($user['locale'], $allowed_locales)) {
            $locale = $user['locale'];
        } else {
            $locale = $default_locale;
        }
        putenv("LC_MESSAGES={$locale}");
        putenv("LANGUAGE={$locale}");
        setlocale(LC_MESSAGES, $locale);
        $msg = $user['end_billing_days'] > 0 ? sprintf(_($msg_more), $user['end_billing_days']) : _($msg_today);
        $event->sendMsg($msg);
    }
}
Ejemplo n.º 6
0
 /*if (count($sub) == 18){
       $bonus = array_unique(array_merge($bonus, $all_ch_bonus));
   }*/
 //var_dump($sub); exit;
 $bonus_str = base64_encode(serialize($bonus));
 if (array_key_exists($uid, $subscription_map)) {
     $sql = "update itv_subscription set sub_ch='{$sub_str}', bonus_ch='{$bonus_str}', addtime=NOW() where uid={$uid}";
 } else {
     $sql = "insert into itv_subscription (uid, sub_ch, bonus_ch, addtime) value ({$uid}, '{$sub_str}', '{$bonus_str}', NOW())";
 }
 $event = new SysEvent();
 $event->setUserListById($uid);
 $event->sendUpdateSubscription();
 $event = new SysEvent();
 $event->setUserListById($uid);
 $event->sendMsg('Каналы обновлены согласно подписке.');
 $result = Mysql::getInstance()->query($sql)->result();
 if ($result) {
     $updated++;
     if ((bool) Config::get('enable_subscription') && $update_fav) {
         $fav_channels = array_unique(array_merge($sub, $bonus, $base_channels));
         //$fav_channels = array();
         $data_str = base64_encode(serialize($fav_channels));
         $id = Mysql::getInstance()->from('fav_itv')->where(array('uid' => $uid))->get()->first('id');
         if ($id) {
             $sql = "update fav_itv set fav_ch='" . $data_str . "', addtime=NOW() where uid='" . $uid . "'";
         } else {
             $sql = "insert into fav_itv (uid, fav_ch, addtime) values ('" . $uid . "', '" . $data_str . "', NOW())";
         }
         Mysql::getInstance()->query($sql);
     }
 /**
  * @deprecated
  * @param $user_rec_id
  * @return bool
  */
 public function stopAndUsrMsg($user_rec_id)
 {
     $stopped = $this->stop($user_rec_id);
     if ($stopped) {
         $user_record = Mysql::getInstance()->from('users_rec')->where(array('id' => $user_rec_id))->get()->first();
         $channel = Itv::getChannelById($user_record['ch_id']);
         $event = new SysEvent();
         $event->setUserListById($user_record['uid']);
         $user = User::getInstance((int) $user_record['uid']);
         $event->sendMsg($user->getLocalizedText('Stopped recording') . ' — ' . $user_record['program'] . ' ' . $user->getLocalizedText('on channel') . ' ' . $channel['name']);
     }
     return $stopped;
 }
Ejemplo n.º 8
0
          $bonus = array();
      }*/
    $bonus_str = base64_encode(serialize($bonus));
    $itv_subscription = Mysql::getInstance()->from('itv_subscription')->where(array('uid' => $uid))->get()->first();
    if (!empty($itv_subscription)) {
        $result = Mysql::getInstance()->update('itv_subscription', array('sub_ch' => $sub_str, 'bonus_ch' => $bonus_str, 'addtime' => 'NOW()'), array('uid' => $uid))->result();
    } else {
        $result = Mysql::getInstance()->insert('itv_subscription', array('uid' => $uid, 'sub_ch' => $sub_str, 'bonus_ch' => $bonus_str, 'addtime' => 'NOW()'))->insert_id();
    }
    if ($result) {
        $event = new SysEvent();
        $event->setUserListById($uid);
        $event->sendUpdateSubscription();
        $event = new SysEvent();
        $event->setUserListById($uid);
        $event->sendMsg(_('Updated according to the subscription channels.'));
        js_redirect('profile.php?id=' . $uid, _('Subscription saved'));
    } else {
        echo _('error');
    }
    exit;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">

body {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;