Exemplo n.º 1
0
<?php

include_once "includes/functions.inc.php";
$imdb = new Imdb();
$file = cleanWAMP(getDataFileName("{$_GET['raw']}"));
if (!file_exists($dataFolder . $file)) {
    exit;
}
//error
$handle = fopen($dataFolder . $file, "r");
$cleanTitle = clean_title($file);
if (isset($_GET['tab']) && $_GET['tab'] == "photos") {
    $movieArray = $imdb->getMovieInfo($cleanTitle, 3);
} else {
    if ($settings_data['imdb_mode'] == 'false') {
        $movieArray = arrayFile("{$dataFolder}/{$file}");
    } else {
        $movieArray = $imdb->getMovieInfo($cleanTitle, 2);
    }
}
if ($handle) {
    $videodata = explode("\n", file_get_contents("{$dataFolder}/{$file}"));
    $toggle = cleanWAMP($videodata[2]);
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php 
echo $template->videoTitle($movieArray['title'], $movieArray['year']);
Exemplo n.º 2
0
 protected function saveNewMovie($id)
 {
     $imdb = new Imdb();
     $movie_new = $imdb->getMovieInfo($id);
     if ($movie_new['response'] != 'ok') {
         return $movie_new['response'];
     } else {
         $model = new Movie();
         $movie_new['votes'] = intval(str_replace(',', '', $movie_new['votes']));
         $movie_new['release_date'] = date('Y-m-d', strtotime($movie_new['release_date']));
         $model->setAttributes($movie_new, false);
         $model->created_at = $model->updated_at = time();
         $model->save();
     }
 }
Exemplo n.º 3
0
    echo '<table cellpadding="3" cellspacing="2" border="1" width="80%" align="center">';
    echo '<tr><th>ID</th><td>' . $row['id'] . '</td></tr>';
    echo '<tr><th>Movie URL</th><td>' . $row['movie_url'] . '</td></tr>';
    echo '<tr><th>Movie Title</th><td>' . $row['movie_title'] . '</td></tr>';
    echo '<tr><th>Movie Year</th><td>' . $row['movie_year'] . '</td></tr>';
    echo '<tr><th>Movie Rating</th><td>' . $row['movie_rating'] . '</td></tr>';
    echo '<tr><th>Movie Release</th><td>' . $row['movie_release'] . '</td></tr>';
    echo '<tr><th>Movie Plot</th><td>' . $row['movie_plot'] . '</td></tr>';
    echo '<tr><th>Movie Poster</th><td><img src="' . $row['movie_poster'] . '"></td></tr>';
    echo '<tr><th>Runtime</th><td>' . $row['runtime'] . '</td></tr>';
    echo '<tr><th>Cost</th><td>' . $row['cost'] . '</td></tr>';
    echo '</table>';
    $_SESSION['id'] = $row['id'];
    echo $_SESSION['id'];
} else {
    $movieArray = $imdb->getMovieInfo($cars[0]);
    echo '<table cellpadding="3" cellspacing="2" border="1" width="80%" align="center">';
    foreach ($movieArray as $key => $value) {
        $value = is_array($value) ? implode("<br />", $value) : $value;
        echo '<tr>';
        echo '<th align="left" valign="top">' . strtoupper($key) . '</th><td>' . $value . '</td>';
        echo '</tr>';
    }
    echo '</table>';
    $result = mysql_query("select * from movie where movie_title='{$cars['0']}'");
    while ($row = mysql_fetch_array($result)) {
        $_SESSION['id'] = $row['id'];
        echo $_SESSION['id'];
    }
}
header('Location: http://localhost/MovieShopper/product-details.php');
Exemplo n.º 4
0
 $onlyFileName = strrchr($value, '/');
 $file_date = date("m/d/Y H:i:s", filectime($value));
 $file_type = file_type($onlyFileName);
 $clean_title = clean_title($onlyFileName);
 $datafile = $prefix . 'data' . $onlyFileName . '.txt';
 if (file_exists($datafile)) {
     continue;
 }
 debugWrite('[DEBUG] <b>Name:</b>' . $clean_title . ' <b>File:</b>' . $onlyFileName . ' <b>Type:</b>' . $file_type);
 if ($settings_data['imdb_mode'] == 'false') {
     touch($datafile);
     continue;
 }
 debugWrite(' [' . $lang_check_debugCreateFile . ']<BR>');
 $fh = fopen($datafile, 'a') or die($lang_check_notWritable);
 $movieArray = $imdb->getMovieInfo($clean_title, 2);
 $genres = implode(',', $movieArray['genres']);
 $stringData = $file_date . PHP_EOL . $movieArray['title'] . PHP_EOL . $file_type . PHP_EOL . $movieArray['title_id'] . PHP_EOL . $genres . PHP_EOL . $movieArray['rating'] . PHP_EOL . $dirPath . PHP_EOL . $movieArray['movie_rating'] . PHP_EOL . $movieArray['plot'];
 fwrite($fh, $stringData);
 fclose($fh);
 if (!isset($movieArray['title_id']) || stristr($movieArray['poster'], 'ad.doubleclick.net')) {
     continue;
 }
 if (checkPosterExists($movieArray['title_id']) == false) {
     //create movie poster
     file_put_contents($prefix . 'pics/' . $movieArray['title_id'] . '.jpg', file_get_contents($movieArray['poster']));
 }
 debugWrite('[DEBUG] <b>stringData:</b>' . $stringData . ' [' . $lang_check_debugContinue . ']');
 debugStop();
 echo $value . "<br>";
 flush();
Exemplo n.º 5
0
// Author: Abhinay Rathore
// Website: http://www.AbhinayRathore.com
// Blog: http://web3o.blogspot.com
// Demo: http://lab.abhinayrathore.com/imdb/
// More Info: http://web3o.blogspot.com/2010/10/php-imdb-scraper-for-new-imdb-template.html
// Last Updated: July 3, 2011
/////////////////////////////////////////////////////////////////////////////////////////////////////////
include "imdb.php";
$movieName = $_REQUEST["m"];
$output = strtolower($_REQUEST["o"]);
if ($output != "xml" && $output != "json" && $output != "jsonp") {
    $output = "xml";
    //Set default to XML
}
$i = new Imdb();
$mArr = array_change_key_case($i->getMovieInfo($movieName), CASE_UPPER);
///////////////[ XML Output ]/////////////////
if ($output == "xml") {
    header("Content-Type: text/xml");
    $doc = new DomDocument('1.0');
    $doc->formatOutput = true;
    $movie = $doc->createElement('MOVIE');
    $movie = $doc->appendChild($movie);
    foreach ($mArr as $k => $v) {
        if (is_array($v)) {
            $node = $doc->createElement($k);
            $node = $movie->appendChild($node);
            $c = 0;
            foreach ($v as $a) {
                $c++;
                $child = $doc->createElement($k . "_");
Exemplo n.º 6
0
 public function updateMovieInfoFromTitle($id, $title, $code)
 {
     $del = array('2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2002', '2001', '2000', '(', '[', 'DVD', 'BR', 'CAM', 'TS', '1080', '720', 'BlueRay', 'S0', 'S1', 'S2', 'S3', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x');
     $titleArray = explode($del[0], str_replace($del, $del[0], $title));
     $searchTitle = trim($titleArray[0]);
     $imdb = new Imdb();
     $movieArray = $imdb->getMovieInfo($searchTitle);
     if (isset($movieArray['title_id'])) {
         $title_id = $movieArray['title_id'];
         $bad = array(':', ' -', "'");
         $y = str_replace($bad, '', $movieArray['title']);
         //                        $title = urlencode($y);
         $title = $y;
         //strip everything for image title
         $bad = array(':', '-', "'", " ");
         $z = str_replace($bad, '', $movieArray['title']);
         $imageTitle = urlencode($z);
         $year = $movieArray['year'];
         $rating = $movieArray['rating'];
         $mpaa_rating = $movieArray['mpaa_rating'];
         $plot = $movieArray['plot'];
         $imdb_url = $movieArray['imdb_url'];
         $poster = NULL;
         //SAVE THE IMAGES
         //@todo: do we need all of these images
         if ($movieArray['poster'] !== '') {
             if (strstr($movieArray['poster'], 'b.scorecardresearch.com')) {
                 $title_id = NULL;
             } else {
                 $content = file_get_contents($movieArray['poster']);
                 $poster = $code . "-" . $id . "-" . $title_id . ".jpg";
                 $filename = "../media/imdb/" . $poster;
                 $x = file_put_contents($filename, $content);
             }
         }
         //                        var_dump($movieArray);
         //now we need to process the attributes for the db
         foreach ($movieArray as $attrName => $attrVal) {
             //check if movie attribute is an array of string
             if (is_array($attrVal)) {
                 //check to see if an empty array
                 if (count($attrVal) == 0) {
                     ${$attrName} = NULL;
                 } else {
                     $y = NULL;
                     foreach ($attrVal as $x) {
                         str_replace('"', "", $y);
                         $y[] = $x;
                     }
                     ${$attrName} = serialize($y);
                     $y = NULL;
                 }
             }
         }
         $imdbTable = "pbay_" . $code . "_imdb";
         $sql = "INSERT INTO {$imdbTable} (media_id, imdb_id, imdb_title, year, rating, genres, directors, writers, stars, cast, mpaa_rating, plot, poster, imdb_url) VALUES ('{$id}', '{$title_id}', '{$title}', '{$year}', '{$rating}', '{$genres}', '{$directors}', '{$writers}', '{$stars}', '{$cast}', '{$mpaa_rating}', '{$plot}', '{$poster}', '{$imdb_url}')";
         $query = $this->dbUpdate($sql);
         return true;
     } else {
         return false;
     }
 }