public function get_kinopoisk_info_by_id()
 {
     if (!$this->isAjax || $this->method != 'POST' || empty($this->postData['data'])) {
         $this->app->abort(404, $this->setlocalization('Page not found'));
     }
     if ($no_auth = $this->checkAuth()) {
         return $no_auth;
     }
     $data = array();
     $data['action'] = 'getKinopoiskInfoById';
     $error = $this->setLocalization('No data');
     try {
         $data['result'] = \Vclubinfo::getInfoById($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);
 }
Exemplo n.º 2
0
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();
} elseif ($_GET['get'] == 'radio_services') {