<?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>
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); }
public function video_info() { if (!$this->isAjax || $this->method != 'POST' || empty($this->postData['videoid']) || !is_numeric($this->postData['videoid'])) { $this->app->abort(404, $this->setlocalization('Page not found')); } if ($no_auth = $this->checkAuth()) { return $no_auth; } $media_id = intval($this->postData['videoid']); $video = $this->db->getVideoById($media_id); $data = array(); $data['action'] = 'videoinfo'; $data['title'] = $this->setLocalization('Information about the video source'); $data['base_info'] = $this->setLocalization('information not available'); $data['add_info'] = array(); $error = ''; // $error = 'Информация отсутствует'; if (empty($video['rtsp_url'])) { $path = $video['path']; if (empty($_SERVER['TARGET'])) { $_SERVER['TARGET'] = 'ADM'; } $master = new \VideoMaster(); $good_storages = $master->getAllGoodStoragesForMediaFromNet($media_id, true); if (!empty($good_storages)) { $data['base_info'] = array(); } foreach ($good_storages as $name => $data_s) { $data['base_info'][] = array('storage_name' => $name, 'path' => $path, 'series' => count($data_s['series']), 'files' => $data_s['files'], 'for_moderator' => $data_s['for_moderator']); } } $response = $this->generateAjaxResponse($data, $error); return new Response(json_encode($response), empty($error) ? 200 : 500); }
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; } } }