1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
| <?php
set_time_limit(0);
$kinopoisk['login'] = 'login';
$kinopoisk['password'] = 'pass';
$vk['login'] = 'login';
$vk['password'] = 'pass';
$settings['page'] = 8; # Количество фильмов на страницу:
###################################################################################################
# Функция парсинга кинопоиска:
###################################################################################################
function get_content($url){
global $kinopoisk;
# Авторизуемся на кинопоиске:
/*
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.kinopoisk.ru/level/30/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash','Accept-Language: ru','Accept-Encoding: deflate,sdch','Connection: Keep-Alive'));
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, './kinopoisk.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, './kinopoisk.txt');
curl_setopt($ch, CURLOPT_REFERER,"http://www.kinopoisk.ru/level/30/");
curl_setopt($ch, CURLOPT_POSTFIELDS, "shop_user[login]=".$login['']."&shop_user[pass]=".$password."&auth=войти на сайт");
curl_setopt($ch, CURLOPT_PORT, 80);
curl_exec($ch);
curl_close($ch);
*/
# Парсим содержимое страницы:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash','Accept-Language: ru','Accept-Encoding: deflate,sdch','Connection: Keep-Alive'));
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/kinopoisk.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/kinopoisk.txt');
curl_setopt($ch, CURLOPT_REFERER, "http://www.kinopoisk.ru/");
curl_setopt($ch, CURLOPT_PORT, 80);
$content = curl_exec($ch);
curl_close($ch);
# Выводим информацию:
return $content;
}
# Функция перекодировки UTF-8 в WINDOWS-1251:
function utf_win($string){
$string = iconv('utf-8','windows-1251',$string);
return $string;
}
function win_utf($string){
$string = iconv('windows-1251','utf-8',$string);
return $string;
}
# Функция формирования тэгов:
function str_tag($string){
$tags = ''; $string = explode(",", $string);
for($i=0;$i<count($string);$i++){
$tags .= '<a href="/tags/'.trim($string[$i]).'/">'.trim($string[$i]).'</a>, ';}
$tags = substr($tags,0,-2);
return $tags;
}
# Функция формирования пагинации:
function pagebar($url,$count,$page){
$url = utf_win($url);
$pagebar = '';
for($i=1;$i<=$count;$i++){
if($i == $page){$pagebar .= $i.', ';}
elseif($i==1){$pagebar .= '<a href="'.$url.'">'.$i.'</a>, ';}
else{$pagebar .= '<a href="'.$url.'?page='.$i.'">'.$i.'</a>, ';}
}
$pagebar = substr($pagebar,0,-2);
return $pagebar;
}
# Функция сортировки листинга дирректории по дате файлов:
function sortbydate($a, $b) {
if($a['date'] == $b['date']){return 0;}
return ($a['date'] > $b['date']) ? -1 : 1;
}
# Функция авторизации вконтакте:
function get_hash(){
global $vk;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://vk.com/login.php?m=1");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/vk.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/vk.txt');
curl_setopt($ch, CURLOPT_REFERER, "http://vk.com/");
curl_setopt($ch, CURLOPT_POSTFIELDS, "email=".$vk['login']."&pass=".$vk['password']."&vk=&al_test=1");
curl_setopt($ch, CURLOPT_PORT, 80);
$response = curl_exec($ch);
curl_close($ch);
preg_match_all('#remixsid=([0-9a-f]+)\;#isU', $response, $hash);
if(isset($hash[1][0]) && $hash[1][0] != ''){$fp = fopen('./vk.txt',"w+"); fwrite($fp,$hash[1][0]); fclose($fp);}
}
# Функция получения онлайн видео:
function get_video($query){
global $vk;
$hash = file_get_contents('./vk.txt');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://vk.com/search?c%5Bq%5D=".urlencode($query)."&c%5Bsection%5D=video&c%5Bsort%5D=1");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; rev1.1; Windows NT 5.1;)");
curl_setopt($ch, CURLOPT_COOKIE, "remixsid=".$hash);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER,"http://vk.com/id".rand(100000,999999));
curl_setopt($ch, CURLOPT_PORT, 80);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
if($info['http_code'] != '200'){get_hash(); return false;}
else{return $response;}
return $response;
}
# Функция вывода плеера:
function get_player($id){
$hash = file_get_contents('./vk.txt');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://vk.com/video".str_replace('-','_',$id)."?noiphone");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; rev1.1; Windows NT 5.1;)");
curl_setopt($ch, CURLOPT_COOKIE, "remixsid=".$hash);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER,"http://vk.com/id".rand(100000,999999));
curl_setopt($ch, CURLOPT_PORT, 80);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
$response = str_replace("\\","",$response);
curl_close($ch);
if($info['http_code'] != '200'){get_hash(); return false;}
else{
preg_match_all("#\"hash2\":\"([a-z0-9]+)\"#isU", $response, $hash);
preg_match_all("#<iframe(.*)src=\"(.*)\"#isU", $response, $frame);
return 'http://vk.com/video_ext.php?oid='.str_replace('-','&id=',$id).'&hash='.$hash[1][0];
}
}
###################################################################################################
# API динамического контента:
###################################################################################################
if(isset($_GET['api'])){
# Поиск фильмов по базе кинопоиска:
if($_GET['api'] == 'search'){
# Если пользователь не ввел название фильма:
if(!isset($_POST['query'])){die(json_encode(array('error'=>win_utf('Введите название фильма.'))));}
# Пользователь ввел название фильма:
else{
# Парсим страницу кинопоиска:
$content = get_content("http://www.kinopoisk.ru/s/type/film/list/1/find/".urlencode(utf_win($_POST['query']))."/");
# Парсим информацию по фильмам:
preg_match_all('#<p class="name"><a href="/level/1/film/([0-9]+)/sr/1/">(.*)</a> <span class="year">([0-9]{4})</span></p>#isU', $content, $result);
# Если фильмы не были найдены:
if(!isset($result[2]) or count($result[2]) == 0){die(json_encode(array('error'=>win_utf('Фильмы не найдены'))));}
# Если фильмы были успешно найдены:
else{
$response = array();
for($i=0;$i<count($result[2]);$i++){
if(strpos($result[2][$i], "\n") !== false){continue;}
$response[] = array($result[3][$i],$result[1][$i],win_utf($result[2][$i]));
}
die(json_encode(array('success'=>$response)));
}
}
}
# Парсинг описания фильма:
elseif($_GET['api'] == 'parsing'){
# Проверяем идентификатор фильма:
if(!array_key_exists('id', $_POST)){die(json_encode(array('error'=>true)));}
elseif(!preg_match('/^([0-9]+)$/', $_POST['id'])){die(json_encode(array('error'=>true)));}
# Проверяем, не был фильм спарсен ранее:
elseif(file_exists('./base/'.$_POST['id'].'.xml')){die(json_encode(array('error'=>true)));}
else{
# Получаем содержимое страницы:
$content = get_content("http://www.kinopoisk.ru/level/1/film/".$_POST['id']."/");
# Парсим информацию по фильму:
preg_match_all('#<title>(.*)</title>#isU', $content, $title);
preg_match_all('#<table class="info">(.*)</table>#isU', $content, $result);
preg_match_all('#<tr>(.*)</td>(.*)</tr>#isU', $result[0][0], $result);
preg_match_all('#<span class="_reachbanner_">(.*)</span>#isU', $content, $anonce);
$write['title'] = $title[1][0];
$write['title'] = iconv('windows-1251','utf-8',$write['title']);
$write['anonce'] = str_replace(' ', ' ', strip_tags($anonce[1][0]));
$write['anonce'] = iconv('windows-1251','utf-8',$write['anonce']);
# Сохраняем данные в xml:
$xml = new DOMDocument('1.0','UTF-8');
$film = $xml->appendChild($xml->createElement('film'));
$title = $film->appendChild($xml->createElement('title'));
$title->appendChild($xml->createCDATASection($write['title']));
$date = $film->appendChild($xml->createElement('date'));
$date->appendChild($xml->createCDATASection(time()));
for($i=0;$i<count($result[0]);$i++){
$write['key'] = trim(strip_tags($result[1][$i]));
$write['value'] = trim(str_replace(' ','',strip_tags($result[2][$i])));
if($write['key'] == 'год'){$write['value'] = substr($write['value'],0,4);}
$write['key'] = iconv('windows-1251','utf-8', $write['key']);
$write['value'] = iconv('windows-1251','utf-8', $write['value']);
$buffer = '';
$write['value'] = explode(",",$write['value']);
for($o=0;$o<count($write['value']);$o++){
$buffer .= trim($write['value'][$o]).', ';
}
$buffer = str_replace('..., ','', $buffer);
$buffer = substr($buffer,0,-2);
$write['value'] = $buffer;
$info = $film->appendChild($xml->createElement('info'));
$key = $info->appendChild($xml->createElement('key'));
$key->appendChild($xml->createCDATASection($write['key']));
$value = $info->appendChild($xml->createElement('value'));
$value->appendChild($xml->createCDATASection($write['value']));
}
$anonce = $film->appendChild($xml->createElement('anonce'));
$anonce->appendChild($xml->createCDATASection($write['anonce']));
$xml->formatOutput = true;
$xml->save('./base/'.$_POST['id'].'.xml');
# Сохраняем постер на сервер:
$headers = get_headers('http://st.kinopoisk.ru/images/film/'.$_POST['id'].'.jpg');
if($headers[0] == 'HTTP/1.1 200 OK'){@copy('http://st.kinopoisk.ru/images/film/'.$_POST['id'].'.jpg','./poster/'.$_POST['id'].'.jpg');}
# Обновляем кэш базы данных:
if($write['anonce'] != ''){
$filelist = array();
if($handle = opendir('./base/')){
while(false !== ($entry = readdir($handle))){
if($entry != "." && $entry != ".."){
if(substr($entry,-4) == '.xml'){
$xml = simplexml_load_file('./base/'.$entry);
$filelist[] = array('id'=>substr($entry,0,-4),'date'=>filemtime('./base/'.$entry));
}
}
}
closedir($handle);
}
usort($filelist, "sortbydate");
$base = new DOMDocument('1.0','UTF-8');
$films = $base->appendChild($base->createElement('films'));
foreach($filelist as $key=>$value){
$xml = simplexml_load_file('./base/'.$value['id'].'.xml');
if($xml->anonce == ''){continue;}
$film = $films->appendChild($base->createElement('film'));
$id = $film->appendChild($base->createElement('id'));
$id->appendChild($base->createCDATASection($value['id']));
$date = $film->appendChild($base->createElement('date'));
$date->appendChild($base->createCDATASection($xml->date));
$title = $film->appendChild($base->createElement('title'));
$title->appendChild($base->createCDATASection($xml->title));
foreach($xml->info as $info){
$key = iconv('utf-8','windows-1251',$info->key);
if($key == 'год'){$i_year = $info->value;}
elseif($key == 'страна'){$i_country = $info->value;}
elseif($key == 'жанр'){$i_genre = $info->value;}
}
$str = $i_year.', '.$i_country.', '.$i_genre;
$str = explode(',',$str);
$str = array_map('trim',$str);
$str = serialize($str);
$data = $film->appendChild($base->createElement('data'));
$data->appendChild($base->createCDATASection($str));
}
$base->formatOutput = true;
$base->save('./base.xml');
}
# Возвращаем успешный ответ:
die(json_encode(array('success'=>true)));
}
}
# Парсинг результатов поиска видео:
elseif($_GET['api'] == 'video'){
#sleep(1);
# Проверяем поисковый запрос:
if(!isset($_POST['query'])){die(json_encode(array('error'=>utf_win($_POST['query']))));}
else{
# Получаем результат поиска видео:
$result = get_video($_POST['query']);
# Если результат был успешно получен:
if($result == false){die(json_encode(array('error'=>win_utf('Возникла ошибка. Повторите Ваш запрос позднее.'))));}
else{
preg_match_all("#<a href=\"video([0-9]+)_([0-9]+)\?noiphone\"(.*)>(.*)</a></div>#isU", $result, $films);
preg_match_all("#<div class=\"duration\">([0-9:]+)</div>#", $result, $times);
# Формируем список фильмов:
if(count($films[4]) == 0){die(json_encode(array('error'=>win_utf('Не удалось найти видео.'))));}
$online = array();
for($i=0;$i<count($films[4]);$i++){
$name = strip_tags($films[4][$i]);
if(strlen($name) > 70){$name = substr($name, 0, 70);}
$name = strip_tags($name);
$name = iconv('windows-1251','utf-8', $name);
$online[] = array(trim($times[1][$i]),$films[1][$i]."-".$films[2][$i],$name);
}
die(json_encode(array('success'=>$online)));
}
}
}
# Вывод онлайн фильма:
elseif($_GET['api'] == 'player'){
# Проверяем идентификатор плеера:
if(!isset($_POST['id'])){die(json_encode(array('error'=>true)));}
# Идентификатор верный, выводим плеер:
else{
$player = get_player($_POST['id']);
if($player === false){die(json_encode(array('error'=>true)));}
else{die(json_encode(array('success'=>$player)));}
}
}
}
###################################################################################################
# Определяем текущую страницу сайта:
###################################################################################################
if(array_key_exists('do', $_GET)){$do = $_GET['do'];}else{$do = 'index';}
# Главная страница:
if($do == 'index'){
# Формируем список фильмов:
$base = array();
$xml = simplexml_load_file('./base.xml');
foreach($xml->film as $film){array_push($base,(int)$film->id);}
$base = array_chunk($base, $settings['page']);
# Определяем текущую страницу:
if(!array_key_exists('page',$_GET)){$page = 1;}
elseif(!preg_match('/^([0-9]+)$/', $_GET['page'])){$page = 1;}
elseif($_GET['page']<1){$page=1;}
else{$page = $_GET['page'];}
# Формируем список фильмов:
for($i=0;$i<count($base[($page-1)]);$i++){
$xml = simplexml_load_file('./base/'.$base[($page-1)][$i].'.xml');
foreach($xml->info as $info){
foreach($xml->info as $info){
$key = iconv('utf-8','windows-1251',$info->key);
if($key == 'год'){$i_year = $info->value;}
elseif($key == 'жанр'){$i_genre = $info->value;}
}
}
if(!file_exists('./poster/'.$base[($page-1)][$i].'.jpg')){$poster = 'none.gif';}else{$poster = $base[($page-1)][$i].'.jpg';}
$anonce = utf_win($xml->anonce);
if($anonce == ''){$anonce = 'Описание отсутствует.';}
$short .= file_get_contents('./template/info_short.tpl');
$short = str_replace('{id}', $base[($page-1)][$i], $short);
$short = str_replace('{title}',utf_win($xml->title),$short);
$short = str_replace('{anonce}',$anonce,$short);
$short = str_replace('{date}', date('d.m.y H:i:s', (int)$xml->date),$short);
$short = str_replace('{poster}', $poster, $short);
$short = str_replace('{year}', str_tag($i_year), $short);
$short = str_replace('{genre}', str_tag(utf_win($i_genre)), $short);
}
# Формируем навигацию:
$pagebar = pagebar('/',count($base),$page);
# Формируем текущую страницу:
if($page > 1){$title = 'Страница '.$page.' » Поисковик онлайн фильмов';}
else{$title = 'Поисковик онлайн фильмов';}
$content = file_get_contents('./template/index.tpl');
$content = str_replace('{short}',$short,$content);
$content = str_replace('{pagebar}',$pagebar,$content);
}
# Страница с фильмом:
elseif($do == 'online'){
# Проверяем идентификатор фильма:
if(!array_key_exists('id', $_GET)){header('Location: /');}
elseif(!preg_match('/^([0-9]+)$/', $_GET['id'])){header('Location: /');}
# Проверяем, был ли сохранен фильм ранее:
if(!file_exists('./base/'.$_GET['id'].'.xml')){
$content = file_get_contents('./template/info_wait.tpl');
$content = str_replace('{id}', $_GET['id'], $content);
die($content);
}
# Получаем информацию по фильму:
$xml = simplexml_load_file('./base/'.$_GET['id'].'.xml');
$detail = '';
foreach($xml->info as $info){
$detail .= file_get_contents('./template/info_detail.tpl');
$key = utf_win($info->key);
$value = utf_win($info->value);
if($key == 'год'){$year = $value;}
if($key == 'год' or $key == 'страна'){$value = str_tag($value);}
elseif($key == 'жанр'){$value = str_tag($value);}
$detail = str_replace('{key}', $key, $detail);
$detail = str_replace('{value}', $value, $detail);
}
# Формируем ананс:
$anonce = utf_win($xml->anonce);
if(strlen($anonce) == 0){$anonce = 'Описание отсутствует.';}
# Проверяем, есть ли постер:
if(!file_exists('./poster/'.$_GET['id'].'.jpg')){$poster = 'none.gif';}else{$poster = $_GET['id'].'.jpg';}
# Формируем заголовок страницы:
$title = utf_win($xml->title).' ('.$year.') смотреть онлайн, '.utf_win($xml->title).' ('.$year.') бесплатно и без регистрации.';
# Формируем текущую страницу:
$content = file_get_contents('./template/info_main.tpl');
$content = str_replace('{year}', $year, $content);
$content = str_replace('{title}', utf_win($xml->title), $content);
$content = str_replace('{date}', date('d.m.y H:i:s', (int)$xml->date), $content);
$content = str_replace('{anonce}', $anonce, $content);
$content = str_replace('{detail}', $detail, $content);
$content = str_replace('{poster}', $poster, $content);
}
# Страница тэгов:
elseif($do == 'tags'){
# Проверяем значение тэга:
if(!array_key_exists('query', $_GET)){header('Location: /');}
elseif(strlen($_GET['query']) < 3){header('Location: /');}
# Значение тэга верно:
$base = array();
# Осуществляем поиск по базе:
$xml = simplexml_load_file('./base.xml');
foreach($xml->film as $film){
$data = unserialize($film->data);
if(in_array($_GET['query'],$data)){array_push($base,(int)$film->id);}
}
# Если фильмы не были найдены:
if(count($base) == 0){header('Location: /');}
# Если фильмы были успешно найдены:
$base = array_chunk($base, $settings['page']);
# Определяем текущую страницу:
if(!array_key_exists('page',$_GET)){$page = 1;}
elseif(!preg_match('/^([0-9]+)$/', $_GET['page'])){$page = 1;}
elseif($_GET['page']<1){$page=1;}
else{$page = $_GET['page'];}
$short = '';
for($i=0;$i<count($base[($page-1)]);$i++){
$xml = simplexml_load_file('./base/'.$base[($page-1)][$i].'.xml');
foreach($xml->info as $info){
$key = utf_win($info->key);
$value = utf_win($info->value);
if($key == 'год'){$i_year = str_tag($value);}
elseif($key == 'жанр'){$i_genre = str_tag($value);}
}
if(!file_exists('./poster/'.$base[($page-1)][$i].'.jpg')){$poster = 'none.gif';}else{$poster = $base[($page-1)][$i].'.jpg';}
$anonce = utf_win($xml->anonce);
if($anonce == ''){$anonce = 'Описание отсутствует.';}
$short .= file_get_contents('./template/info_short.tpl');
$short = str_replace('{id}',$base[($page-1)][$i], $short);
$short = str_replace('{date}',date('d.m.y H:i:s', (int)$xml->date), $short);
$short = str_replace('{title}',utf_win($xml->title), $short);
$short = str_replace('{anonce}',$anonce, $short);
$short = str_replace('{year}',$i_year, $short);
$short = str_replace('{genre}',$i_genre, $short);
$short = str_replace('{poster}',$poster, $short);
}
if($page > 1){$title = 'Страница '.$page.' » Фильмы с тэгом: '.utf_win($_GET['query']);}
else{$title = 'Фильмы с тэгом: '.utf_win($_GET['query']);}
# Формируем навигацию:
$pagebar = pagebar('/tags/'.$_GET['query'].'/',count($base),$page);
# Формируем текущую страницу:
$content = file_get_contents('./template/tags.tpl');
$content = str_replace('{tag}', utf_win($_GET['query']), $content);
$content = str_replace('{short}', $short, $content);
$content = str_replace('{pagebar}', $pagebar, $content);
}
# Страница не найдена:
else{
$title = 'Страница не найдена';
$content = 'Страница не найдена';
}
# Формируем текущую страницу:
$tpl = file_get_contents('./template/main.tpl');
$tpl = str_replace('{title}', $title, $tpl);
$tpl = str_replace('{content}', $content, $tpl);
# Выводим текущую страницу:
echo $tpl;
?> |