Авторизуйтесь по паролю
dreamer 20.04.2014 Все вопросы » Общие вопросы 2904
dj-avtosh - 2015-03-0121 апреля 2014 10:49 - #27377
vitnet - 2015-03-0121 апреля 2014 11:30 - #27380
dreamer - 2015-03-0121 апреля 2014 21:36 - #27409
vitnet - 2015-03-0121 апреля 2014 22:59 - #27419
<?php/*===================================================== Модуль Rating KinoPoisk IMDB===================================================== Автор: D0Gmatist===================================================== Файл: rating_kp_imdb.php=====================================================*/define( 'DATALIFEENGINE', true );define( 'ROOT_DIR', dirname(__FILE__) );header( 'Content-type: image/png' );ob_start();function show_error_image($error_text = "Error with the image!") { $error_picture_width = strlen($error_text) * 7 + 12; $img = @imagecreatetruecolor($error_picture_width, 30) or die("Not true test data!"); $text_color = imagecolorallocate($img, 255, 0, 0); imagestring($img, 3, 7, 8, $error_text, $text_color); header("Content-type: image/png"); imagepng($img); imagedestroy($img); exit;}if(strlen($_GET['id']) > 7) show_error_image("A maximum of 7 characters!");if(!ctype_digit($_GET['id'])) show_error_image("Wrong characters in the query!");$file = ROOT_DIR . "/rating/{$_GET['id']}.png";if( file_exists($file) ) { $modif = time() - @filemtime($file); if( $modif < 86400 ) { readfile($file); exit; }}$doc = new DOMDocument();$doc->load("http://rating.kinopoisk.ru/{$_GET['id']}.xml");$kp = $doc->getElementsByTagName('kp_rating');$kino_rating = $kp->item(0)->nodeValue;$kino_votes = ($kino_rating) ? $kp->item(0)->getAttribute('num_vote') : 0;$kino_votes = number_format($kino_votes);$imdb = $doc->getElementsByTagName('imdb_rating');$imdb_rating = $imdb->item(0)->nodeValue;$imdb_votes = ($imdb_rating) ? $imdb->item(0)->getAttribute('num_vote') : 0;$imdb_votes = number_format($imdb_votes);$pic = imagecreatefrompng("img/rating.png");$pic = imagecreatefrompng("img/rating.png");$colorOne = ImageColorAllocate($pic, 46, 195, 238);$colorTwo = ImageColorAllocate($pic, 98, 97, 97);imagealphablending($pic, true);$kino_rating = ($kino_rating > 10) ? 10 : ( $kino_rating == 0 ) ? "0.00" : $kino_rating;imagettftext($pic, 25, 0, 8, 35, $colorOne, "fonts/comicbd.TTF", $kino_rating);$imdb_rating = ($imdb_rating > 10) ? 10 : ( $imdb_rating == 0 ) ? "0.00" : $imdb_rating;imagettftext($pic, 25, 0, 114, 35, $colorTwo, "fonts/comicbd.TTF", $imdb_rating);imagesavealpha($pic, true);imagepng($pic);imagedestroy($pic);$cache = ob_get_contents();ob_end_clean();echo $cache;$fp = @fopen ($file, "w");@fwrite($fp, $cache);@fclose($fp);?>
dreamer - 2015-03-0122 апреля 2014 12:51 - #27436
vitnet - 2015-03-0122 апреля 2014 13:11 - #27437
http://demo.quantum-soft.ru/rating_kp_imdb/rating_kp_imdb.php?id=661938
dreamer - 2015-03-0122 апреля 2014 18:54 - #27457
.ui-dialog {
z-index: 9999;
$tpl->set( '{short-story}', $row['short_story'] );
$tpl->set( '{short-story}', $row['short_story'] ); $tpl->set_block("'\\[short_story\\](.*?)\\[/short_story\\]'si", $row['short_story'] ? '\\1' : '');
[short-story]Показать этот текст, если есть краткая новость[/short-story]
[not-short-story]Показать этот текст, если краткой новости нет[/not-short-story]