/** * Delete a Country */ public function deleteAction() { $Video = Video::getById($this->getRequest()->getParam('id')); if ($Video) { if ($this->getRequest()->isPost()) { $Video->delete(); $this->Member->log('Video: ' . $Video->name . '(' . $this->getRequest()->getParam('id') . ')', 'Xóa'); My_Plugin_Libs::setSplash('Video: <b>' . $Video->name . '</b> đã được xóa khỏi hệ thống.'); $this->_redirect($this->_helper->url('index', 'video', 'admin')); } $this->view->Video = $Video; } }
function get_selected_cat_genres(){ $cat_genre_id = array(); if (!empty($_GET['id'])){ $video = Video::getById((int) $_GET['id']); $cat_genre_id[1] = $video['cat_genre_id_1'] ? $video['cat_genre_id_1'] : 0; $cat_genre_id[2] = $video['cat_genre_id_2'] ? $video['cat_genre_id_2'] : 0; $cat_genre_id[3] = $video['cat_genre_id_3'] ? $video['cat_genre_id_3'] : 0; $cat_genre_id[4] = $video['cat_genre_id_4'] ? $video['cat_genre_id_4'] : 0; $k=0; for ($i = 1; $i <= 4; $i++){ if ($cat_genre_id[$i] > 0){ $k ++; } } $str = "var sel_cat_genre_id_1 = ".$cat_genre_id[1]."\n"; $str .= "var sel_cat_genre_id_2 = ".$cat_genre_id[2]."\n"; $str .= "var sel_cat_genre_id_3 = ".$cat_genre_id[3]."\n"; $str .= "var sel_cat_genre_id_4 = ".$cat_genre_id[4]."\n"; $str .= "var total_cat_genres = ".$k."\n"; }else{ $str = "var sel_cat_genre_id_1\n"; $str .= "var sel_cat_genre_id_2\n"; $str .= "var sel_cat_genre_id_3\n"; $str .= "var sel_cat_genre_id_4\n"; } return $str; }
function parse_param($action, $param) { if ($action == 'play') { $sub_param = substr($param, 0, 3); if ($sub_param == 'rtp') { $channel = Mysql::getInstance()->from('itv')->where(array('cmd' => $param))->get()->first(); $name = '[' . _('Channel') . '] ' . $channel['name']; } else { if ($sub_param == 'aut') { preg_match("/(\\d+)\\.[a-z]*\$/", $param, $tmp_arr); $media_id = $tmp_arr[1]; $video = Video::getById($media_id); $name = '[' . _('Video') . '] ' . $video['name']; } else { $name = ''; } } } else { if ($param == '""') { $name = ''; } else { $name = $param; } } return $name; }
/** * Main claim method. * * @param string $media_type */ protected function setClaimGlobal($media_type) { $id = intval($_REQUEST['id']); $type = $_REQUEST['real_type']; $this->db->insert('media_claims_log', array('media_type' => $media_type, 'media_id' => $id, 'type' => $type, 'uid' => $this->stb->id, 'added' => 'NOW()')); $total_media_claims = $this->db->from('media_claims')->where(array('media_type' => $media_type, 'media_id' => $id))->get()->first(); $sound_counter = 0; $video_counter = 0; $no_epg_counter = 0; $wrong_epg_counter = 0; if ($type == 'video') { $video_counter++; } else { if ($type == 'sound') { $sound_counter++; } else { if ($type == 'no_epg') { $no_epg_counter++; } else { if ($type == 'wrong_epg') { $wrong_epg_counter++; } } } } if (!empty($total_media_claims)) { $this->db->update('media_claims', array('sound_counter' => $total_media_claims['sound_counter'] + $sound_counter, 'video_counter' => $total_media_claims['video_counter'] + $video_counter, 'no_epg' => $total_media_claims['no_epg'] + $no_epg_counter, 'wrong_epg' => $total_media_claims['wrong_epg'] + $wrong_epg_counter), array('media_type' => $media_type, 'media_id' => $id)); } else { $this->db->insert('media_claims', array('sound_counter' => $sound_counter, 'video_counter' => $video_counter, 'no_epg' => $no_epg_counter, 'wrong_epg' => $wrong_epg_counter, 'media_type' => $media_type, 'media_id' => $id)); } $total_daily_claims = $this->db->from('daily_media_claims')->where(array('date' => 'CURDATE()'))->get()->first(); $media_name = 'undefined'; if ($media_type == 'itv') { $media = Itv::getById($id); if (!empty($media['name'])) { $media_name = $media['name']; } } elseif ($media_type == 'vclub') { $media = Video::getById($id); if (!empty($media['name'])) { $media_name = $media['name']; } } elseif ($media_type == 'karaoke') { $media = Karaoke::getById($id); if (!empty($media['name'])) { $media_name = $media['name']; } } if (Config::exist('administrator_email')) { $message = sprintf(_("New claim on %s - %s (%s, id: %s). From %s"), $media_type, $type, $media_name, $id, $this->stb->mac); mail(Config::get('administrator_email'), 'New claim on ' . $media_type . ' - ' . $type, $message, "Content-type: text/html; charset=UTF-8\r\n"); } if (!empty($total_daily_claims)) { return $this->db->update('daily_media_claims', array($media_type . '_sound' => $total_daily_claims[$media_type . '_sound'] + $sound_counter, $media_type . '_video' => $total_daily_claims[$media_type . '_video'] + $video_counter, 'no_epg' => $total_daily_claims['no_epg'] + $no_epg_counter, 'wrong_epg' => $total_daily_claims['wrong_epg'] + $wrong_epg_counter), array('date' => 'CURDATE()'))->result(); } else { return $this->db->insert('daily_media_claims', array($media_type . '_sound' => $sound_counter, $media_type . '_video' => $video_counter, 'no_epg' => $no_epg_counter, 'wrong_epg' => $wrong_epg_counter, 'date' => 'CURDATE()'))->insert_id(); } }
function get_media_length_by_id($id) { $video = Video::getById($id); return $video['time']; }
public function getUrlByVideoId($video_id, $series = 0, $forced_storage = "") { $video = Video::getById($video_id); if (empty($video)) { throw new Exception("Video not found"); } if (!empty($video['rtsp_url'])) { return $video['rtsp_url']; } $link = $this->getLinkByVideoId($video_id, $series, $forced_storage); if (empty($link['cmd'])) { throw new Exception("Obtaining url failed"); } if (!empty($link['storage_id'])) { $storage = Master::getStorageById($link['storage_id']); if (!empty($storage)) { $cache = Cache::getInstance(); $cache->set($this->stb->id . '_playback', array('type' => 'video', 'id' => $link['id'], 'storage' => $storage['storage_name']), 0, 10); } } else { $cache = Cache::getInstance(); $cache->del($this->stb->id . '_playback'); } return $link['cmd']; }
private function check_video_status($id) { $video = \Video::getById($id); if (!empty($video['rtsp_url'])) { return 2; } return $video['status']; }
function parse_param($action, $param, $type){ if($action == 'play'){ switch ($type){ case 1: // TV $channel = Mysql::getInstance() ->from('itv') ->where(array( 'cmd' => $param, 'status' => 1 )) ->get()->first(); if (!empty($channel)){ $ch_name = $channel['name']; }else{ $ch_name = htmlspecialchars($param); } $name = '['._('Channel').'] '.$ch_name; break; case 2: // Video Club if (!preg_match("/(\d+)\.[a-z0-9]*$/", $param, $tmp_arr)){ $name = $param; break; } $media_id = $tmp_arr[1]; $video = Video::getById($media_id); if (!empty($video)){ $video_name = $video['name']; }else{ $video_name = htmlspecialchars($param); } $name = '['._('Video').'] '.$video_name; break; case 3: // Karaoke preg_match("/(\d+)\.[a-z]*$/", $param, $tmp_arr); $karaoke_id = $tmp_arr[1]; $karaoke = Karaoke::getById($karaoke_id); if (!empty($karaoke)){ $karaoke_name = $karaoke['name']; }else{ $karaoke_name = htmlspecialchars($param); } $name = '['._('Karaoke').'] '.$karaoke_name; break; case 4: // Audio Club preg_match("/(\d+).mp3$/", $param, $tmp_arr); $audio_id = $tmp_arr[1]; $audio = Mysql::getInstance()->from('audio')->where(array('id' => $audio_id))->get()->first(); if (!empty($audio)){ $audio_name = $audio['name']; }else{ $audio_name = htmlspecialchars($param); } $name = '['._('Audio').'] '.$audio_name; break; case 5: // Radio $radio = Mysql::getInstance()->from('radio')->where(array('cmd' => $param, 'status' => 1))->get()->first(); if (empty($radio)){ $ch_name = $radio['name']; }else{ $ch_name = htmlspecialchars($param); } $name = '['._('Radio').'] '.$ch_name; break; case 6: // My Records preg_match("/\/(\d+).mpg/", $param, $tmp_arr); $my_record_id = $tmp_arr[1]; $record = Mysql::getInstance() ->select('t_start, itv.name') ->from('users_rec') ->join('itv', 'users_rec.ch_id', 'itv.id', 'INNER') ->where(array( 'users_rec.id' => $my_record_id )) ->get() ->first(); if (!empty($record)){ $my_record_name = $record['t_start'].' '.$record['name']; }else{ $my_record_name = htmlspecialchars($param); } $name = '['._('My records').'] '.$my_record_name; break; case 7: // Shared Records preg_match("/(\d+).mpg$/", $param, $tmp_arr); $shared_record_id = $tmp_arr[1]; $record = Mysql::getInstance() ->from('video_records') ->where(array( 'id' => $shared_record_id )) ->get() ->first(); if (!empty($record)){ $shared_record_name = $record['descr']; }else{ $shared_record_name = htmlspecialchars($param); } $name = '['._('Records').'] '.$shared_record_name; break; case 8: // Video clips preg_match("/(\d+).mpg$/", $param, $tmp_arr); $media_id = $tmp_arr[1]; $video = Mysql::getInstance()->from('video_clips')->where(array('id' => $media_id))->get()->first(); if (!empty($video)){ $video_name = $video['name']; }else{ $video_name = htmlspecialchars($param); } $name = '['._('Clip').'] '.$video_name; break; default: $name = 'unknown media'; } }else{ if($param == '""'){ $name = ''; }else{ $name = htmlspecialchars($param); } } return $name; }
$genre_id_3 = @$_POST['genre_id_3'] ? @$_POST['genre_id_3'] : 0; $genre_id_4 = @$_POST['genre_id_4'] ? @$_POST['genre_id_4'] : 0; $cat_genre_id_1 = @$_POST['cat_genre_id_1'] ? @$_POST['cat_genre_id_1'] : 0; $cat_genre_id_2 = @$_POST['cat_genre_id_2'] ? @$_POST['cat_genre_id_2'] : 0; $cat_genre_id_3 = @$_POST['cat_genre_id_3'] ? @$_POST['cat_genre_id_3'] : 0; $cat_genre_id_4 = @$_POST['cat_genre_id_4'] ? @$_POST['cat_genre_id_4'] : 0; $category_id = @$_POST['category_id'] ? @intval($_POST['category_id']) : 0; $protocol = $_POST['protocol']; if ($protocol == 'custom') { $rtsp_url = @trim($_POST['rtsp_url']); } else { $rtsp_url = ''; } $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'; } $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 {
function get_video_name($id) { $video = Video::getById($id); return $video['name']; }
function get_video_name() { $id = intval($_GET['id']); $video = Video::getById($id); return $video['name']; }
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; } } }
function get_status($id) { $video = Video::getById($id); return $video['status']; }
public function getUrlByVideoId($video_id, $series = 0, $forced_storage = "") { $video = Video::getById($video_id); if (empty($video)) { throw new Exception("Video not found"); } if (!empty($video['rtsp_url'])) { return $video['rtsp_url']; } $link = $this->getLinkByVideoId($video_id, $series, $forced_storage); if (empty($link['cmd'])) { throw new Exception("Obtaining url failed"); } return $link['cmd']; }
function get_sended_video() { $video = Video::getById(intval($_GET['id'])); return $video['name']; }
<?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; }