public function get_kinopoisk_info_by_name() { if ($no_auth = $this->checkAuth()) { return $no_auth; } $data = array(); $data['action'] = 'getKinopoiskInfoByName'; $error = $this->setLocalization('No data'); try { $data['result'] = \Vclubinfo::getInfoByName($this->postData['data']); $error = ''; } catch (\KinopoiskException $e) { $error = $e->getMessage(); $logger = new \Logger(); $logger->setPrefix("kinopoisk_"); // format: [date] - error_message - [base64 encoded response]; $logger->error(sprintf("[%s] - %s - \"%s\"\n", date("r"), $e->getMessage(), base64_encode($e->getResponse()))); } $response = $this->generateAjaxResponse($data, $error); return new Response(json_encode($response), empty($error) ? 200 : 500); }
<?php session_start(); include "./common.php"; Admin::checkAuth(); ob_start(); $response = array(); if ($_GET['get'] == 'kinopoisk_info' || $_GET['get'] == 'kinopoisk_rating' || $_GET['get'] == 'kinopoisk_info_by_id') { try { if ($_GET['get'] == 'kinopoisk_info') { $response['result'] = Vclubinfo::getInfoByName($_GET['oname']); } else { if ($_GET['get'] == 'kinopoisk_rating') { $response['result'] = Vclubinfo::getRatingByName($_GET['oname']); } else { if ($_GET['get'] == 'kinopoisk_info_by_id') { $response['result'] = Vclubinfo::getInfoById($_GET['kinopoisk_id']); } } } } catch (KinopoiskException $e) { echo $e->getMessage(); $logger = new Logger(); $logger->setPrefix("vclubinfo_"); // format: [date] - error_message - [base64 encoded response]; $logger->error(sprintf("[%s] - %s - \"%s\"\n", date("r"), $e->getMessage(), base64_encode($e->getResponse()))); } } elseif ($_GET['get'] == 'tv_services') { $response['result'] = Itv::getServices(); } elseif ($_GET['get'] == 'video_services') { $response['result'] = Video::getServices();