09 Auto Imdb Mod

Started by Mindless, October 20, 2012, 01:56:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0day



Mindless

Expand, do not diss without valid proof =]

Kristoffer

Quote from: Mindless on October 20, 2012, 11:11:49 PM
Cant you read code ? Cant you see the obvious eregi replaced by preg_replace -- I'm no here to hold yer hand dude, i will however piss you right off with my sharpness. Tbdev 09, its now 12, would it not be reasonable to presume that the developers @ u-232 have already fixed most little stupid bug's from those days...

Good point, however..
using preg_replace makes all the information messed up.

Mindless

#5
Cant you read code ? Cant you see the obvious eregi replaced by preg_replace -- I'm no here to hold yer hand dude, i will however piss you right off with my sharpness. Tbdev 09, its now 12, would it not be reasonable to presume that the developers @ u-232 have already fixed most little stupid bug's from those days...


Mindless


Kristoffer

#2
Thanks for this!

But got this error:

Deprecated: Function ereg_replace() is deprecated in /opt/lampp/htdocs/details.php on line 155

Mindless

#1
Auto imdb mod updated for 09
Credits to the original coder MaSTeRMinD for the autoimdb and MelvinMeow for posting the url mod
Xhtml valid :)

Code (sql) Select
ALTER TABLE `torrents` ADD `url` VARCHAR( 80 );

First download the latest imdb release from here : http://sourceforge.net/projects/imdbphp/  - If you do that make sure you rename the content folder to imdb :)

Or use the one i attached thats all configured for a server - Extract upload the imdb folder to root and chmod it to 777 add index.html files into the folders - Note it will be imdb/imdb_config.class.php you need to alter filepaths for cache and images - Chmod cache folder and images also img to chmod 777

@file upload.php find

Code (php) Select
$HTMLOUT .= "<table border='1' cellspacing='0' cellpadding='10'>

right after add

Code (php) Select
<tr>
    <td class='heading' valign='top' align='right'>{$lang['upload_imdb_url']}</td>
    <td valign='top' align='left'><input type='text' name='url' size='80' /><br />{$lang['upload_imdb_tfi']}{$lang['upload_imdb_rfmo']}</td>
    </tr>


@file lang/en/lang_upload.php add :

Code (php) Select
'upload_imdb_url' => "Imdb Url",
'upload_imdb_tfi' => "Taken from Imdb - ",
'upload_imdb_rfmo' => "Add the Imdb url to display Imdb data on details.",


@file takeupload.php find

Code (php) Select
if (!isset($_FILES["file"]))
      stderr($lang['takeupload_failed'], $lang['takeupload_no_formdata']);


after add

Code (php) Select
if (!empty($_POST['url']))
    $url = unesc($_POST['url']);


find

Code (php) Select
$torrent = str_replace("_", " ", $torrent);

after add

Code (php) Select
$url = unesc($_POST['url']);

Find the update query and add url so this :

Code (sql) Select
$ret = mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, info_hash, name, size, numfiles, type,

Becomes :

Code (sql) Select
$ret = mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, info_hash, name, size, numfiles, type, url,

And add $url - so this :

Code (sql) Select
implode(",", array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname, $CURUSER["id"], "no", $anonymous, $infohash, $torrent, $totallen, count($filelist), $type,

Becomes

Code (sql) Select
implode(",", array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname, $CURUSER["id"], "no", $anonymous, $infohash, $torrent, $totallen, count($filelist), $type, $url

@file edit.php find

Code (php) Select
$HTMLOUT  .= tr($lang['edit_torrent_name'], "<input type='text' name='name' value='" . htmlspecialchars($row["name"]) . "' size='80' />", 1);

And before add :

Code (php) Select
$HTMLOUT  .= tr("{$lang['edit_imdb_url']}", "<input type='text' name='url' size='80' value='".$row["url"]."' />", 1);

In takeedit.php find :

Code (php) Select
$dname = $row['save_as'];

after add

Code (php) Select
$url = $_POST['url'];

find

Code (php) Select
$updateset[] = 'nfo = ""';

after add

Code (php) Select
$updateset[] = "url = " . sqlesc($url);

@file lang/en/lang_edit.php add :

Code (php) Select
'edit_imdb_url' => "Imdb Url",

@ file details.php at the top beside the other require_once add :

Code (php) Select
require_once ROOT_PATH.'/imdb/imdb.class.php';

Find the large torrents query and add torrents.url :

Code (sql) Select
$res = mysql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.url, LENGTH(torrents.nfo) AS nfosz, torrents.last_action AS lastseed, torrents.numratings, torrents.name, IF(torrents.numratings < {$TBDEV['minvotes']}, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.comments, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, categories.name AS cat_name, users.username FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id")

Find :

Code (php) Select
$HTMLOUT .= "<tr><td class='rowhead'>{$lang['details_nfo']}</td><td align='left'><a href='viewnfo.php?id=$row[id]'><b>{$lang['details_view_nfo']}</b></a> (" .mksize($row["nfosz"]) . ")</td></tr>\n";

After that add :

Code (php) Select
//auto imdb mod
  $smallth = '';
  if (($row["url"] != "")AND(strpos($row["url"], 'imdb'))AND(strpos($row["url"], 'title')))
  {
  $thenumbers = ltrim(strrchr($row["url"],'tt'),'tt');
  $thenumbers = ereg_replace("[^A-Za-z0-9]", "", $thenumbers);
  $movie = new imdb ($thenumbers);
  $movieid = $thenumbers;
  $movie->setid ($movieid);
  $country = $movie->country ();
  $director = $movie->director();
  $write = $movie->writing();
  $produce = $movie->producer();
  $cast = $movie->cast();
  $plot = $movie->plot ();
  $compose = $movie->composer();
  $gen = $movie->genres();
  $plotoutline = $movie->plotoutline();
  $trailers = $movie->trailers();
  $mvlang = $movie->language();
  $mvrating = $movie->rating();

  if (($photo_url = $movie->photo_localurl() ) != FALSE) {
  $smallth = '<img src="'.$photo_url.'" alt="Imdb Picture" />';
  }

  $imdb= "<strong><font color=\"blue\">#######################################################################</font><br />\n";
  $imdb.= "<font color=\"red\" size=\"3\">Information:</font><br />\n";
  $imdb.= "<font color=\"blue\">#######################################################################</font></strong><br />\n";
  $imdb.= "<strong><font color=\"red\"> Title: </font></strong>" . "".$movie->title()."<br />\n";
  $imdb.= "<strong><font color=\"red\"> Year: </font></strong>" . "".$movie->year()."<br />\n";
  $imdb.= "<strong><font color=\"red\"> Runtime: </font></strong>" . "".$movie->runtime()."" . " mins<br />\n";
  $imdb.= "<strong><font color=\"red\"> Votes: </font></strong>" . "".$movie->votes()."<br />\n";

  if (!empty($mvrating)) {
$imdb.= "<strong><font color=\"red\"> Rating: </font></strong>" . "$mvrating<br />\n";
  }

  if (!empty($mvlang)) {
$imdb.= "<strong><font color=\"red\"> Language: </font></strong>" . "$mvlang<br />\n";
  }

  if (!empty($country)) {
$imdb.= "<strong><font color=\"red\"> Country: </font></strong>";
for ($i = 0; $i + 1 < count ($country); $i++) {
$imdb.="$country[$i], ";
}
$imdb.= "$country[$i]<br />\n";
  }

  if (!empty($gen)) {
$imdb.= "<strong><font color=\"red\"> All Genres: </font></strong>";
for ($i = 0; $i + 1 < count($gen); $i++) {
$imdb.= "$gen[$i], ";
}
$imdb.= "$gen[$i]<br />\n";
  }

  if (!empty($plotoutline)) {
$imdb.= "<strong><font color=\"red\"> Plot Outline: </font></strong>" . "$plotoutline</div><br />\n";
  }

  if (!empty($director)) {
$imdb.= "<strong><font color=\"red\"> Director: </font></strong>";
for ($i = 0; $i < count ($director); $i++) {
$imdb.= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$director[$i]["imdb"]."" ."\">" . "".$director[$i]["name"]."" . "</a><br />\n";
}
  }

  if (!empty($write)) {
$imdb.= "<strong><font color=\"red\"> Writing By: </font></strong>";
for ($i = 0; $i < count ($write); $i++) {
$imdb.= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$write[$i]["imdb"]."" ."\">" . "".$write[$i]["name"]."" . "</a> ";
}
  }

  if (!empty($produce)) {
$imdb.= "<br />\n<strong><font color=\"red\"> Produced By: </font></strong>";
for ($i = 0; $i < count ($produce); $i++) {
$imdb.= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$produce[$i]["imdb"]."" ." \">" . "".$produce[$i]["name"]."" . "</a> ";
}
  }

  if (!empty($compose)) {
$imdb.= "<br />\n<strong><font color=\"red\"> Music: </font></strong>";
for ($i = 0; $i < count($compose); $i++) {
$imdb.= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$compose[$i]["imdb"]."" ." \">" . "".$compose[$i]["name"]."" . "</a> ";
}
}

  if (!empty($plot)) {
$imdb.= "<br /><br />\n\n<strong><font color=\"blue\">#######################################################################</font><br />\n";
$imdb.= "<font color=\"red\" size=\"3\"> Description:</font><br />\n";
$imdb.= "<font color=\"blue\">#######################################################################</font></strong>";
for ($i = 0; $i < count ($plot); $i++) {
$imdb.= "<br />\n<font color=\"red\">º</font> ";
  $imdb.= "$plot[$i]";
}
  }

  $imdb.= "<br /><br />\n\n<strong><font color=\"blue\">#######################################################################</font><br />\n";
  $imdb.= "<font color=\"red\" size=\"3\"> Cast:</font><br />\n";
  $imdb.= "<font color=\"blue\">#######################################################################</font></strong><br />\n";

  for ($i = 0; $i < count ($cast); $i++) {
if ($i > 9) {
  break;
}
  $imdb.= "<font color=\"red\">º</font> " . "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$cast[$i]["imdb"]."" ."\">" . "".$cast[$i]["name"]."" . "</a> " . " as <strong><font color=\"red\">" . "".$cast[$i]["role"]."" . " </font></strong><br />\n";
  }

  if (!empty($trailers)) {
  $imdb.= "<br /><br />\n\n<strong><font color=\"blue\">#######################################################################</font><br />\n";
  $imdb.= "<font color=\"red\" size=\"3\"> Trailers:</font><br />\n";
  $imdb.= "<font color=\"blue\">#######################################################################</font></strong><br />\n";

for ($i=0;$i<count($trailers);++$i) {
if ($i > 14) {
break;
}
$imdb.= "<a target=\"_blank\" href='".$trailers[$i]."'>".$trailers[$i]."</a><br />\n";
}
  }
  $HTMLOUT .= tr("Auto imdb$smallth", $imdb, 1);
  }
  //end auto imdb


And thats all - Tested and working fine from what i see - Enjoy :)

[attachment deleted by admin]