예제 #1
0
function getimdb($imdb_id, $cache_stamp, $mode = 'minor')
{
    global $lang_functions;
    global $showextinfo;
    $thenumbers = $imdb_id;
    $movie = new imdb($thenumbers);
    $movieid = $thenumbers;
    $movie->setid($movieid);
    $target = array('Title', 'Credits', 'Plot');
    switch ($movie->cachestate($target)) {
        case "0":
            return false;
            break;
        case "1":
            $title = $movie->title();
            $year = $movie->year();
            $country = $movie->country();
            $countries = "";
            $temp = "";
            for ($i = 0; $i < count($country); $i++) {
                $temp .= "{$country[$i]}, ";
            }
            $countries = rtrim(trim($temp), ",");
            $director = $movie->director();
            $director_or_creator = "";
            if ($director) {
                $temp = "";
                for ($i = 0; $i < count($director); $i++) {
                    $temp .= $director[$i]["name"] . ", ";
                }
                $director_or_creator = "<strong><font color=\"DarkRed\">" . $lang_functions['text_director'] . ": </font></strong>" . rtrim(trim($temp), ",");
            } else {
                //for tv series
                $creator = $movie->creator();
                $director_or_creator = "<strong><font color=\"DarkRed\">" . $lang_functions['text_creator'] . ": </font></strong>" . $creator;
            }
            $cast = $movie->cast();
            $temp = "";
            for ($i = 0; $i < count($cast); $i++) {
                if ($i > 2) {
                    break;
                }
                $temp .= $cast[$i]["name"] . ", ";
            }
            $casts = rtrim(trim($temp), ",");
            $gen = $movie->genres();
            $genres = $gen[0] . (count($gen) > 1 ? ", " . $gen[1] : "");
            //get first two genres;
            $rating = $movie->rating();
            $votes = $movie->votes();
            if ($votes) {
                $imdbrating = "<b>" . $rating . "</b>/10 (" . $votes . $lang_functions['text_votes'] . ")";
            } else {
                $imdbrating = $lang_functions['text_awaiting_five_votes'];
            }
            $tagline = $movie->tagline();
            switch ($mode) {
                case 'minor':
                    $autodata = "<font class=\"big\"><b>" . $title . "</b></font> (" . $year . ") <br /><strong><font color=\"DarkRed\">" . $lang_functions['text_imdb'] . ": </font></strong>" . $imdbrating . " <strong><font color=\"DarkRed\">" . $lang_functions['text_country'] . ": </font></strong>" . $countries . " <strong><font color=\"DarkRed\">" . $lang_functions['text_genres'] . ": </font></strong>" . $genres . "<br />" . $director_or_creator . "<strong><font color=\"DarkRed\"> " . $lang_functions['text_starring'] . ": </font></strong>" . $casts . "<br /><p><strong>" . $tagline . "</strong></p>";
                    break;
                case 'median':
                    if (($photo_url = $movie->photo_localurl()) != FALSE) {
                        $smallth = "<img src=\"" . $photo_url . "\" width=\"105\" alt=\"poster\" />";
                    } else {
                        $smallth = "";
                    }
                    $runtime = $movie->runtime();
                    $language = $movie->language();
                    $plot = $movie->plot();
                    $plots = "";
                    if (count($plot) != 0) {
                        //get plots from plot page
                        $plots .= "<font color=\"DarkRed\">*</font> " . strip_tags($plot[0], '<br /><i>');
                        $plots = mb_substr($plots, 0, 300, "UTF-8") . (mb_strlen($plots, "UTF-8") > 300 ? " ..." : "");
                        $plots .= strpos($plots, "<i>") == true && strpos($plots, "</i>") == false ? "</i>" : "";
                        //sometimes <i> is open and not ended because of mb_substr;
                        $plots = "<font class=\"small\">" . $plots . "</font>";
                    } elseif ($plotoutline = $movie->plotoutline()) {
                        //get plot from title page
                        $plots .= "<font color=\"DarkRed\">*</font> " . strip_tags($plotoutline, '<br /><i>');
                        $plots = mb_substr($plots, 0, 300, "UTF-8") . (mb_strlen($plots, "UTF-8") > 300 ? " ..." : "");
                        $plots .= strpos($plots, "<i>") == true && strpos($plots, "</i>") == false ? "</i>" : "";
                        //sometimes <i> is open and not ended because of mb_substr;
                        $plots = "<font class=\"small\">" . $plots . "</font>";
                    }
                    $autodata = "<table style=\"background-color: transparent;\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n" . ($smallth ? "<td class=\"clear\" valign=\"top\" align=\"right\">\n{$smallth}\n</td>" : "") . "<td class=\"clear\" valign=\"top\" align=\"left\">\n<table style=\"background-color: transparent;\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"350\">\n<tr><td class=\"clear\" colspan=\"2\"><img class=\"imdb\" src=\"pic/trans.gif\" alt=\"imdb\" /> <font class=\"big\"><b>" . $title . "</b></font> (" . $year . ") </td></tr>\n<tr><td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_imdb'] . ": </font></strong>" . $imdbrating . "</td>\n" . ($runtime ? "<td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_runtime'] . ": </font></strong>" . $runtime . $lang_functions['text_min'] . "</td>" : "<td class=\"clear\"></td>") . "</tr>\n<tr><td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_country'] . ": </font></strong>" . $countries . "</td>\n" . ($language ? "<td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_language'] . ": </font></strong>" . $language . "</td>" : "<td class=\"clear\"></td>") . "</tr>\n<tr><td class=\"clear\">" . $director_or_creator . "</td>\n<td class=\"clear\"><strong><font color=\"DarkRed\">" . $lang_functions['text_genres'] . ": </font></strong>" . $genres . "</td></tr>\n<tr><td class=\"clear\" colspan=\"2\"><strong><font color=\"DarkRed\">" . $lang_functions['text_starring'] . ": </font></strong>" . $casts . "</td></tr>\n" . ($plots ? "<tr><td class=\"clear\" colspan=\"2\">" . $plots . "</td></tr>" : "") . "\n</table>\n</td>\n</table>";
                    break;
            }
            return $autodata;
        case "2":
            return false;
            break;
        case "3":
            return false;
            break;
    }
}
예제 #2
0
 if (get_user_class() >= $viewnfo_class && $CURUSER['shownfo'] != 'no' && $row["nfosz"] > 0) {
     if (!($nfo = $Cache->get_value('nfo_block_torrent_id_' . $id))) {
         $nfo = code($row["nfo"], $view == "magic");
         $Cache->cache_value('nfo_block_torrent_id_' . $id, $nfo, 604800);
     }
     tr("<a href=\"javascript: klappe_news('nfo')\"><img class=\"plus\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picnfo\" title=\"" . $lang_detail['title_show_or_hide'] . "\" /> " . $lang_details['text_nfo'] . "</a><br /><a href=\"viewnfo.php?id=" . $row[id] . "\" class=\"sublink\">" . $lang_details['text_view_nfo'] . "</a>", "<div id='knfo' style=\"display: none;\"><pre style=\"font-size:10pt; font-family: 'Courier New', monospace;\">" . $nfo . "</pre></div>\n", 1);
 }
 if ($imdb_id && $showextinfo['imdb'] == 'yes' && $CURUSER['showimdb'] != 'no') {
     $thenumbers = $imdb_id;
     $Cache->new_page('imdb_id_' . $thenumbers . '_large', 1296000, true);
     if (!$Cache->get_page()) {
         $movie = new imdb($thenumbers);
         $movieid = $thenumbers;
         $movie->setid($movieid);
         $target = array('Title', 'Credits', 'Plot');
         switch ($movie->cachestate($target)) {
             case "0":
                 if ($row['cache_stamp'] == 0 || $row['cache_stamp'] != 0 && time() - $row['cache_stamp'] > $auto_obj->timeout) {
                     //not exist or timed out
                     tr($lang_details['text_imdb'] . $lang_details['row_info'], $lang_details['text_imdb'] . $lang_details['text_not_ready'] . "<a href=\"retriver.php?id=" . $id . "&amp;type=1&amp;siteid=1\">" . $lang_details['text_here_to_retrieve'] . $lang_details['text_imdb'], 1);
                 } else {
                     tr($lang_details['text_imdb'] . $lang_details['row_info'], "<img src=\"pic/progressbar.gif\" alt=\"\" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $lang_details['text_someone_has_requested'] . $lang_details['text_imdb'] . " " . min(max(time() - $row['cache_stamp'], 0), $auto_obj->timeout) . $lang_details['text_please_be_patient'], 1);
                 }
                 break;
             case "1":
                 reset_cachetimestamp($row['id']);
                 $country = $movie->country();
                 $director = $movie->director();
                 $creator = $movie->creator();
                 // For TV series
                 $write = $movie->writing();