Ejemplo n.º 1
0
         break;
 }
 if (file_exists("{$basepath}/cachefiles/" . $data['image'] . ".jpg")) {
     unlink("{$basepath}/cachefiles/" . $data['image'] . ".jpg");
 }
 if ($text) {
     $url = $baseurl . "/show" . $show['url'];
     $data['recaptcha_response_field'] = $text;
     $data['link[url]'] = $url;
     $message = $sidereel->submit($show['showtitle'], $show['season'], $show['episode'], $data);
     $link = $data['sidereel_url'] . "/season-{$show['season']}/episode-{$show['episode']}/search";
     if (substr_count($message, "Thanks for adding a link.")) {
         $response['status'] = 1;
         $response['link'] = $link;
         print json_encode($response);
         $shows->addSubmit($id, 2, $link);
     } else {
         if (substr_count($message, "Thanks, but we already have this link!")) {
             // already have
             $response['status'] = 5;
             $response['link'] = $link;
             print json_encode($response);
             $shows->addSubmit($id, 2, $link);
         } elseif (substr_count($message, "try the word verification response again")) {
             // invalid captcha
             $response['status'] = 4;
             print json_encode($response);
         } elseif (strlen($message) > 300) {
             $response['status'] = 98;
             $response['debug'] = $message;
             print json_encode($response);
Ejemplo n.º 2
0
$settings = new Settings();
$shows = new Show();
$curl = new Curl();
$curl->setCookieFile($basepath . "/cachefiles/tvlinkscookie.txt");
$tv = new TVlinks($curl);
sleep(2);
$return = array();
if (isset($id) && $id && is_numeric($id)) {
    $show = $shows->getEpisodeById($id, "en");
    if (count($show)) {
        $sr = $settings->getSetting("tvlinks");
        if ($tv->login($sr->username, $sr->password)) {
            $url = $baseurl . $show['url'];
            $link = $tv->submit($show['showtitle'], $show['season'], $show['episode'], $url);
            if ($link) {
                $shows->addSubmit($id, 7, $link);
                $return['status'] = 1;
                $return['link'] = $link;
            } else {
                $return['status'] = 2;
            }
        } else {
            $return['status'] = 0;
        }
    } else {
        $return['status'] = 99;
    }
} else {
    $return['status'] = 99;
}
print json_encode($return);