Beispiel #1
0
 public function getLinkByVideoId($video_id, $series = 0, $forced_storage = "")
 {
     $video_id = intval($video_id);
     if (Config::get('enable_tariff_plans')) {
         $user = User::getInstance($this->stb->id);
         $all_user_video_ids = $user->getServicesByType('video', 'single');
         if ($all_user_video_ids === null) {
             $all_user_video_ids = array();
         }
         if ($all_user_video_ids != 'all') {
             $all_user_video_ids = array_flip($all_user_video_ids);
         }
         $all_user_rented_video_ids = $user->getAllRentedVideo();
         if ((array_key_exists($video_id, $all_user_video_ids) || $all_user_video_ids == 'all') && !array_key_exists($video_id, $all_user_rented_video_ids)) {
             return array('id' => $video_id, 'error' => 'access_denied');
         }
         $video = Video::getById($video_id);
         if (!empty($video['rtsp_url'])) {
             return array('id' => $video_id, 'cmd' => $this->changeSeriesOnCustomURL($video['rtsp_url'], $series));
         }
     }
     $master = new VideoMaster();
     try {
         $res = $master->play($video_id, intval($series), true, $forced_storage);
         $res['cmd'] = $this->changeSeriesOnCustomURL($res['cmd'], $series);
     } catch (Exception $e) {
         trigger_error($e->getMessage());
     }
     return $res;
 }
<?php

set_time_limit(0);
session_start();
ob_start();
include "./common.php";
Admin::checkAuth();
Admin::checkAccess(AdminAccess::ACCESS_VIEW);
$updated_video = 0;
$updated_karaoke = 0;
$not_custom_video = Mysql::getInstance()->from('video')->where(array('protocol!=' => 'custom'))->get();
while ($item = $not_custom_video->next()) {
    $master = new VideoMaster();
    $master->getAllGoodStoragesForMediaFromNet($item['id'], true);
    unset($master);
    $updated_video++;
}
$not_custom_karaoke = Mysql::getInstance()->from('karaoke')->where(array('protocol!=' => 'custom'))->get();
while ($item = $not_custom_video->next()) {
    $master = new KaraokeMaster();
    $master->getAllGoodStoragesForMediaFromNet($item['id']);
    unset($master);
    $updated_karaoke++;
}
$error = sprintf(_('Updated %s videos and %s karaokes'), $updated_video, $updated_karaoke);
$debug = '<!--' . ob_get_contents() . '-->';
ob_clean();
echo $debug;
?>
<html>
<head>
Beispiel #3
0
 }
 $status = $rtsp_url ? 1 : 0;
 if (!empty($_GET['id'])) {
     $video = Video::getById($_GET['id']);
 }
 if (@$_GET['save']) {
     $trans_name = transliterate(@urldecode($_POST['name']));
     if ($hd) {
         $trans_name .= '_HD';
     }
     $existed = Mysql::getInstance()->from('video')->where(array('path' => $trans_name))->get()->first();
     if (!empty($existed)) {
         $error = _('Error: The folder with that name already exists');
     }
     if (@$_GET['name'] && !$error) {
         $master = new VideoMaster();
         try {
             $master->createMediaDir($trans_name, !empty($_POST['year']) ? $_POST['year'] : '');
         } catch (MasterException $e) {
             //var_dump($e->getMessage(), $e->getStorageName()); exit;
             $moderator_storages = $master->getModeratorStorages();
             if (!empty($moderator_storages[$e->getStorageName()])) {
                 $error = _('Error creating the folder on moderator storage');
             }
         }
     }
     if (@$_GET['name'] && !$error) {
         Admin::checkAccess(AdminAccess::ACCESS_CREATE);
         $video_id = Mysql::getInstance()->insert('video', array('name' => trim($_POST['name']), 'series' => serialize($series), 'o_name' => trim($_POST['o_name']), 'censored' => $censored, 'hd' => $hd, 'for_sd_stb' => $for_sd_stb, 'protocol' => $protocol, 'rtsp_url' => $rtsp_url, 'time' => @$_POST['time'], 'description' => $_POST['description'], 'genre_id_1' => $genre_id_1, 'genre_id_2' => $genre_id_2, 'genre_id_3' => $genre_id_3, 'genre_id_4' => $genre_id_4, 'cat_genre_id_1' => $cat_genre_id_1, 'cat_genre_id_2' => $cat_genre_id_2, 'cat_genre_id_3' => $cat_genre_id_3, 'cat_genre_id_4' => $cat_genre_id_4, 'category_id' => $category_id, 'director' => $_POST['director'], 'actors' => $_POST['actors'], 'status' => $status, 'year' => $_POST['year'], 'volume_correction' => (int) $_POST['volume_correction'], 'kinopoisk_id' => $_POST['kinopoisk_id'], 'rating_kinopoisk' => $_POST['rating_kinopoisk'], 'rating_count_kinopoisk' => $_POST['rating_count_kinopoisk'], 'rating_imdb' => $_POST['rating_imdb'], 'rating_count_imdb' => $_POST['rating_count_imdb'], 'age' => $_POST['age'], 'rating_mpaa' => $_POST['rating_mpaa'], 'path' => $trans_name . (!empty($_POST['year']) ? "_{$_POST['year']}" : ''), 'high_quality' => $high_quality, 'low_quality' => $low_quality, 'comments' => $_POST['comments'], 'country' => $_POST['country'], 'added' => 'NOW()'))->insert_id();
         if (!empty($_SESSION['upload'])) {
             Mysql::getInstance()->query('DELETE from screenshots where media_id=' . intval($video_id) . ' and id not IN (' . @implode(',', $_SESSION['upload']) . ')');
 private function createMediaStorage($trans_name, $additional = '')
 {
     $existed = $this->db->getVideoByParam(array('path' => $trans_name));
     if (!empty($existed)) {
         $error = $this->setlocalization('Error: The folder with that name already exists');
     } else {
         $_SERVER['TARGET'] = 'ADM';
         $master = new \VideoMaster();
         try {
             $master->createMediaDir($trans_name, $additional);
         } catch (\MasterException $e) {
             //var_dump($e->getMessage(), $e->getStorageName()); exit;
             $moderator_storages = $master->getModeratorStorages();
             if (!empty($moderator_storages[$e->getStorageName()])) {
                 $error = $this->setlocalization('Error creating the folder on moderator storage');
             }
         }
     }
 }
 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;
 }
 public function refresh_cache()
 {
     if (!$this->isAjax || $this->method != 'POST' || empty($this->postData['id'])) {
         $this->app->abort(404, $this->setLocalization('Page not found'));
     }
     if ($no_auth = $this->checkAuth()) {
         return $no_auth;
     }
     ob_start();
     ob_implicit_flush(TRUE);
     header('Content-Type: application/json');
     ob_flush();
     sleep(1);
     $data = array();
     $data['action'] = 'listMsg';
     $updated_video = 0;
     $updated_karaoke = 0;
     $not_custom_video = $this->db->getNoCustomVideo();
     $data['msg'] = $this->setlocalization('Updated') . ": " . count($not_custom_video) . " - " . $this->setLocalization('movies') . "; ";
     $_SERVER['TARGET'] = 'ADM';
     foreach ($not_custom_video as $row) {
         set_time_limit(30);
         ob_start();
         ob_implicit_flush(FALSE);
         $master = new \VideoMaster();
         $master->getAllGoodStoragesForMediaFromNet($row, true);
         ob_end_clean();
         unset($master);
         $updated_video++;
     }
     $not_custom_karaoke = $this->db->getNoCustomKaraoke();
     $data['msg'] .= count($not_custom_karaoke) . " - " . $this->setLocalization('karaoke');
     foreach ($not_custom_karaoke as $row) {
         set_time_limit(30);
         ob_start();
         ob_implicit_flush(FALSE);
         $master = new \KaraokeMaster();
         $master->getAllGoodStoragesForMediaFromNet($row);
         ob_end_clean();
         unset($master);
         $updated_karaoke++;
     }
     ob_end_clean();
     $error = '';
     $response = $this->generateAjaxResponse($data, $error);
     return new Response(json_encode($response), empty($error) ? 200 : 500);
 }
Beispiel #7
0
 if (!empty($_GET['id'])) {
     $video = Video::getById($_GET['id']);
 }
 if (@$_GET['save']) {
     $trans_name = transliterate(@urldecode($_POST['name']));
     if ($hd) {
         $trans_name .= '_HD';
     }
     $sql = "select * from video where path='" . $trans_name . "'";
     $rs = $db->executeQuery($sql);
     $rows = @$rs->getRowCount();
     if ($rows > 0) {
         $error = _('Error: The folder with that name already exists');
     }
     if (@$_GET['name'] && !$error) {
         $master = new VideoMaster();
         try {
             $master->createMediaDir($trans_name);
         } catch (MasterException $e) {
             //var_dump($e->getMessage(), $e->getStorageName()); exit;
             $moderator_storages = $master->getModeratorStorages();
             if (!empty($moderator_storages[$e->getStorageName()])) {
                 $error = _('Error creating the folder on moderator storage');
             }
         }
     }
     if (@$_GET['name'] && !$error) {
         $name = mysql_escape_string(@$_POST['name']);
         $o_name = mysql_escape_string(@$_POST['o_name']);
         $director = mysql_escape_string(@$_POST['director']);
         $year = @$_POST['year'];
 /**
  * Send "mount all storages" event
  */
 public function sendMountAllStorages()
 {
     $this->setEvent('mount_all_storages');
     $master = new VideoMaster();
     $this->setMsg(json_encode($master->getStoragesForStb()));
     $this->send();
 }
Beispiel #9
0
function get_data()
{
    $get = @$_GET['get'];
    $data = @$_POST['data'];
    $arr = array();
    if ($data) {
        switch ($get) {
            case 'del_tv_logo':
                if (!Admin::isEditAllowed('add_itv')) {
                    header($_SERVER["SERVER_PROTOCOL"] . ' 405 Method Not Allowed');
                    echo _('Action "edit" denied for page "add_itv"');
                    exit;
                }
                return Itv::delLogoById(intval($_GET['id']));
            case 'vclub_info':
                $media_id = intval($data);
                $video = Video::getById($media_id);
                $path = $video['path'];
                $rtsp_url = $video['rtsp_url'];
                if (!empty($rtsp_url)) {
                    $result['data'] = array();
                    return $result;
                }
                $master = new VideoMaster();
                $good_storages = $master->getAllGoodStoragesForMediaFromNet($media_id, true);
                foreach ($good_storages as $name => $data) {
                    $arr[] = array('storage_name' => $name, 'path' => $path, 'series' => count($data['series']), 'files' => $data['files'], 'for_moderator' => $data['for_moderator']);
                }
                $result['data'] = $arr;
                return $result;
                break;
            case 'startmd5sum':
                $resp = array();
                if (Admin::isPageActionAllowed('add_video')) {
                    $master = new VideoMaster();
                    try {
                        $master->startMD5Sum($data['storage_name'], $data['media_name']);
                    } catch (Exception $exception) {
                        $resp['error'] = $exception->getMessage();
                    }
                    return $resp;
                } else {
                    $resp['error'] = 'У Вас нет прав на это действие';
                    return $resp;
                }
                break;
            case 'karaoke_info':
                $media_id = intval($data);
                $master = new KaraokeMaster();
                $good_storages = $master->getAllGoodStoragesForMediaFromNet($media_id, true);
                if (count($good_storages) > 0) {
                    set_karaoke_status($media_id, 1);
                } else {
                    set_karaoke_status($media_id, 0);
                }
                foreach ($good_storages as $name => $data) {
                    $arr[] = array('storage_name' => $name, 'file' => $media_id . '.mpg');
                }
                $result['data'] = $arr;
                return $result;
                break;
            case 'chk_name':
                return $result['data'] = Mysql::getInstance()->count()->from('video')->where(array('name' => $data))->get()->counter();
                break;
            case 'org_name_chk':
                return $result['data'] = Mysql::getInstance()->count()->from('permitted_video')->where(array('o_name' => $data['o_name'], 'year' => $data['year']))->get()->counter();
                break;
            case 'get_cat_genres':
                $category_alias = Mysql::getInstance()->from('media_category')->where(array('id' => $data))->get()->first('category_alias');
                $genres = Mysql::getInstance()->from('cat_genre')->where(array('category_alias' => $category_alias))->orderby('title')->get()->all();
                $genres = array_map(function ($genre) {
                    return array('id' => $genre['id'], 'title' => _($genre['title']));
                }, $genres);
                return array('data' => $genres);
                break;
        }
    }
}
 private function changeStateModeratorTasks($param)
 {
     $text = array('task' => $param['taskid'], 'event' => "task {$param['apply']}");
     $task = $this->db->getSimpleTasks($param['taskid'], 'moderator_tasks');
     $video = $this->db->getVideoById($task['media_id']);
     $task_params = array('ended' => 1, 'end_time' => 'NOW()');
     if ($param["apply"] == "ended") {
         $moderator_id = $task['to_usr'];
         $_SERVER['TARGET'] = 'ADM';
         $master = new \VideoMaster();
         ob_start();
         try {
             $master->startMD5SumInAllStorages($video['path']);
         } catch (Exception $exception) {
         }
         ob_end_clean();
     } else {
         $moderator_id = $this->uid;
         $task_params['rejected'] = 1;
     }
     if ($this->db->updateSimpleTasks($param['taskid'], 'moderator_tasks', $task_params) && $this->db->videoLogWrite($video, serialize($text), $moderator_id)) {
         return TRUE;
     }
     return FALSE;
 }
Beispiel #11
0
<?php

session_start();
ob_start();
include "./common.php";
include "./lib/tasks.php";
$error = '';
Admin::checkAuth();
Admin::checkAccess(AdminAccess::ACCESS_VIEW);
if (@$_GET['id']) {
    $task_id = intval($_GET['id']);
    Admin::checkAccess(AdminAccess::ACCESS_EDIT);
    $task = Mysql::getInstance()->from('moderator_tasks')->where(array('id' => $task_id))->get()->first();
    $moderator_id = $task['to_usr'];
    $video_id = $task['media_id'];
    $action = "<a href=\\'msgs.php?task={$task_id}\\'>" . _('task done') . "</a>";
    Mysql::getInstance()->insert('video_log', array('action' => $action, 'video_id' => $video_id, 'moderator_id' => $moderator_id, 'actiontime' => 'NOW()'));
    Mysql::getInstance()->update('moderator_tasks', array('ended' => 1, 'end_time' => 'NOW()'), array('id' => intval($_GET['id'])));
    $video = Video::getById($video_id);
    $path = $video['path'];
    $master = new VideoMaster();
    try {
        $master->startMD5SumInAllStorages($path);
    } catch (Exception $exception) {
    }
    header("Location: tasks.php");
    exit;
}