$video, 'view' => $view, 'sort' => $sort));
} else {
$output['url_delete_filter'] = create_url($setting, array('video' => $video, 'view' => $view, 'sort' => $sort, 'filter' => $filter, 'filterid' => $filterid));
}
/* ################
* # SELECT MEDIA #
*/################
if ($video == 'tvshows') {
$mysql_table = 'tvshows';
} else {
$mysql_table = 'movies';
}
$output['select_media'] = '' . mb_strtoupper($lang['i_movies']) . '' . mb_strtoupper($lang['i_tvshows']) . '';
if ($setting['select_media_header'] == 1) {
$count_movies = mysql_result(mysql_q('SELECT COUNT( * ) FROM movies'), 0);
$count_tvshows = mysql_result(mysql_q('SELECT COUNT( * ) FROM tvshows'), 0);
if ($count_movies == 0 or $count_tvshows == 0) {
$output['select_media'] = '';
}
}
/* #############
* # TOP PANEL #
*/#############
$show['panel_top'] = $setting['panel_top'];
if ($setting['panel_top'] == 1) {
$top_panel_sql = array(
'top_item_last_added' => 'SELECT id, title, date_added, hide FROM ' . $mysql_table . ' WHERE hide=0 ORDER BY date_added DESC LIMIT ' . $setting['panel_top_limit'],
'top_item_most_watched' => 'SELECT id, title, hide FROM ' . $mysql_table . ' WHERE hide=0 ORDER BY play_count DESC LIMIT ' . $setting['panel_top_limit'],
'top_item_last_played' => 'SELECT id, title, last_played, hide FROM ' . $mysql_table . ' WHERE hide=0 ORDER BY last_played DESC LIMIT ' . $setting['panel_top_limit'],
'top_item_top_rated' => 'SELECT id, title, rating, hide FROM ' . $mysql_table . ' WHERE hide=0 ORDER BY rating DESC LIMIT ' . $setting['panel_top_limit']
);
foreach ($top_panel_sql as $name => $item_top_sql) {
$output[$name] = '';
$item_top_result = mysql_q($item_top_sql);
while ($item_top = mysql_fetch_array($item_top_result)) {
if (file_exists('cache/' . $mysql_table . '_' . $item_top['id'] . '.jpg')) {
$output[$name].= '
';
}
}
}
}
/* ####################
* # ARRAYS FOR PANEL #
*/####################
if ($video == 'tvshows') {
$columns = array('actor', 'genre', 'premiered');
} else {
$columns = array('actor', 'genre', 'country', 'year', 'director', 'set', 'studio');
}
$panels_array = panels_array($columns, $mysql_table);
$filter_array = array('actor', 'genre', 'country', 'studio', 'director');
if ($filter == '') {
$mysql_table2 = '';
$filter_mysql = '';
} else if (in_array($filter, $filter_array)) {
$mysql_table2 = ', ' . $mysql_table . '_' . $filter;
$filter_mysql = $mysql_table . '_' . $filter . '.' . $filter . 'id = '. $filterid . ' AND ' . $mysql_table . '.id = ' . $mysql_table . '_' . $filter . '.id AND';
} else {
$mysql_table2 = '';
$filter_mysql = $mysql_table . '.' . $filter . ' LIKE "%' . $panels_array[$filter][$filterid] . '%" AND';
}
/* ##############
* # LEFT PANEL #
*/##############
// overall panel
$show['panel_overall'] = $setting['panel_overall'];
if ($setting['panel_overall'] > 0) {
$overall_sql = 'SELECT play_count, hide FROM ' . $mysql_table . ' WHERE hide=0';
$overall_result = mysql_q($overall_sql);
$overall_all = mysql_num_rows($overall_result);
$overall_watched = 0;
while($overall = mysql_fetch_array($overall_result)) {
if ($overall['play_count'] > 0) {
$overall_watched++;
}
}
$output['overall_all'] = $overall_all;
$output['overall_watched'] = $overall_watched;
$output['overall_unwatched'] = $overall_all - $overall_watched;
}
// menu panel
$menu_array = array('genre', 'year', 'country', 'set', 'studio');
foreach ($menu_array as $menu_name) {
$output['panel_' . $menu_name] = '';
if ($setting['panel_' . $menu_name] <> 0 && isset($panels_array[$menu_name]) && count($panels_array[$menu_name]) > 0) {
$show['panel_' . $menu_name] = 1;
foreach ($panels_array[$menu_name] as $key => $val) {
if ($filter == $menu_name && $filterid == $key) {
$output['panel_' . $menu_name].= '
' . $val . '';
} else {
$output['panel_' . $menu_name].= '' . $val . '';
}
}
}
}
/* ########
* # SORT #
*/########
$sort_array = array(
1 => array($lang['i_title'], 'title ASC'),
2 => array($lang['i_premiered'], 'premiered DESC'),
3 => array($lang['i_year'], 'year DESC'),
4 => array($lang['i_rating'], 'rating DESC'),
5 => array($lang['i_added'], 'date_added DESC'),
6 => array($lang['i_runtime'], ' CAST( runtime AS DECIMAL( 10, 2 ) ) DESC'),
7 => array($lang['i_last_played'], 'last_played DESC'),
8 => array($lang['i_most_watched'], 'play_count DESC')
);
if ($video == 'tvshows') {
unset($sort_array[3], $sort_array[6]);
} else {
unset($sort_array[2]);
}
$output['panel_sort'] = '';
foreach ($sort_array as $key => $val) {
$output['panel_sort'].= ($sort == $key ?
'' . $val[0] . '' :
'' . $val[0] . '');
}
/* #########
* # WATCH #
*/#########
$show['panel_watch'] = 1;
$watch_arr = array(0 => 'all', 1 => 'watched', 2 => 'unwatched');
$output['panel_watch'].= '';
/* ########
* # VIEW #
*/########
if ($setting['panel_view'] > 0) {
$show['panel_view'] = 1;
$output['panel_view'].= '';
}
/* ##########
* # SEARCH #
*/##########
$show['panel_live_search'] = $setting['live_search'];
$search_mysql = '%';
if ($search !== '') {
$search_mysql = $search;
}
/* #############
* # PANEL NAV #
*/#############
$id_mysql = ($id == 0 ? '%' : $id);
$nav_sql = 'SELECT ' . $mysql_table . '.id FROM ' . $mysql_table . $mysql_table2 . ' WHERE
' . $filter_mysql . '
' . $mysql_table . '.title LIKE "%' . $search_mysql . '%" AND
' . $mysql_table . '.id LIKE "' . $id_mysql . '" AND
' . $mysql_table . '.play_count ' . $watch_mysql . ' AND
' . $mysql_table . '.hide=0
ORDER BY ' . $sort_array[$sort][1];
$nav_result = mysql_q($nav_sql);
$row = mysql_num_rows($nav_result);
if ($setting['per_page'] == 0) {
$i_pages = 1;
$output['panel_nav'] = '';
} else {
$i_pages = (ceil($row / $setting['per_page']));
$output['panel_nav'] = ($page == 1 ? '' . $lang['i_previous'] . '' : '' . $lang['i_previous'] . '')
. ' ' . $lang['i_page'] . ' ' . $page . ' / ' . $i_pages . ' ' .
($page == $i_pages ? '' . $lang['i_next'] . '' : '' . $lang['i_next'] . '');
if ($row == 0) {
$output['panel_nav'] = '';
}
}
/* ################
* # PANEL FILTER #
*/################
if ($filter !== '') {
$output['panel_filter'] = '' . $lang['i_filter'] . ': ' . $lang['i_' . $filter] . ' » ' . $panels_array[$filter][$filterid];
$show['panel_filter'] = 1;
}
if ($search !== '') {
$output['panel_filter'] = '' . $lang['i_search'] . ': ' . $lang['i_result'] . ' » ' . $search;
$show['panel_filter'] = 1;
}
if ($id > 0) {
$output['panel_filter'] = '' . $lang['i_filter'] . ': ' . $lang['i_title'];
$show['panel_filter'] = 1;
}
/* ##################
* # CONTROL REMOTE #
*/##################
if (isset($_SESSION['logged_admin']) && $_SESSION['logged_admin'] == true) {
$show['panel_remote'] = 1;
}
/* ##############
* # MOVIE LIST #
*/##############
if ($setting['per_page'] == 0) {
$limit_sql = '';
} else {
$start = ($page - 1) * $setting['per_page'];
$limit_sql = ' LIMIT ' . $start . ', ' . $setting['per_page'];
}
$list_sql = 'SELECT ' . $mysql_table . '.* FROM ' . $mysql_table . $mysql_table2 . ' WHERE
' . $filter_mysql . '
' . $mysql_table . '.title LIKE "%' . $search_mysql . '%" AND
' . $mysql_table . '.id LIKE "' . $id_mysql . '" AND
' . $mysql_table . '.play_count ' . $watch_mysql . ' AND
' . $mysql_table . '.hide=0
ORDER BY ' . $sort_array[$sort][1] . $limit_sql;
$list_result = mysql_q($list_sql);
// get date for last added
$new_sql = 'SELECT ' . $mysql_table . '.date_added FROM ' . $mysql_table . ' ORDER BY ' . $mysql_table . '.date_added DESC LIMIT 0, 1';
$new_result = mysql_q($new_sql);
$new_date = mysql_fetch_assoc($new_result);
$new_date = substr($new_date['date_added'], 0, 10);
$output_panel_list = '';
while ($list = mysql_fetch_assoc($list_result)) {
// output and show desc arrays
$output_desc = array();
$show_desc = array();
foreach ($item_desc as $val) {
$output_desc[$val] = '';
$show_desc[$val] = 0;
}
$output_desc['mysql_table'] = $mysql_table;
$output_desc['id'] = $list['id'];
$output_desc['video'] = $video;
$output_desc['view'] = $view;
$output_desc['sort'] = $sort;
$output_desc['title'] = $list['title'];
$show_desc['mysql_table'] = 1;
$show_desc['id'] = 1;
$show_desc['video'] = 1;
$show_desc['title'] = 1;
if (isset($_SESSION['logged_admin']) && $_SESSION['logged_admin'] == true && $video == 'movies') {
$show_desc['xbmc'] = 1;
}
// link title
$output_desc['url_title'] = create_url($setting, array('id' => $list['id'], 'video' => $video, 'view' => $view, 'sort' => $sort, 'filter' => $filter, 'filterid' => $filterid));
// originaltitle
if ($list['originaltitle'] !== '') {
$show_desc['originaltitle'] = 1;
$output_desc['originaltitle'] = $list['originaltitle'];
}
// file
if ($video == 'movies') {
$output_desc['file'] = 'http://' . $setting['xbmc_login'] . ':' . $setting['xbmc_pass'] . '@' . $setting['xbmc_host'] . ':' . $setting['xbmc_port'] . '/vfs/' . urlencode($list['file']);
}
// poster
$poster = 'cache/' . $mysql_table . '_' . $list['id'] . '.jpg';
if (!file_exists($poster)) {
$output_desc['poster'] = 'templates/' . $setting['theme'] . '/img/d_poster.jpg';
} else {
$output_desc['poster'] = $poster;
}
// wached status
if ($setting['watched_status'] == 1 && $list['play_count'] > 0) {
$output_desc['watched_img'] = '
';
}
// play count
if ($setting['show_playcount'] == 1 && $list['play_count'] > 0) {
$playcount_array = str_split($list['play_count']);
$output_desc['playcount_img'] = '';
foreach ($playcount_array as $int) {
$output_desc['playcount_img'].= '
![' . $lang['i_last_played'] . ': ' . $list['last_played'] . '](templates/' . $setting['theme'] . '/img/' . $int . '.png)
';
}
$output_desc['playcount_img'].= '
';
}
// genre
$output_genre_array = array();
$genre_sql = 'SELECT genre.id, genre.genre FROM genre, ' . $video . '_genre WHERE ' . $video . '_genre.id = "' . $list['id'] . '" AND genre.id = ' . $video . '_genre.genreid';
$genre_res = mysql_q($genre_sql);
while ($val = mysql_fetch_assoc($genre_res)) {
$output_genre_array[] = '' . $val['genre'] . '';
}
if (count($output_genre_array) > 0) {
$show_desc['genre'] = 1;
$output_desc['genre'] = implode(' / ', $output_genre_array);
}
// rating
if ($list['rating'] !== '') {
$show_desc['rating'] = 1;
$output_desc['rating'] = $list['rating'];
$show_desc['rating_star'] = 1;
$output_desc['rating_star'] = '';
$r = $output_desc['rating'];
for ($s = 1; $s <= 10; $s++) {
if ($r >= 1) {
$output_desc['rating_star'].= '
';
} else if ($r >= 0.5) {
$output_desc['rating_star'].= '
';
} else {
$output_desc['rating_star'].= '
';
}
$r--;
}
}
// actors
$output_actor_array = array();
$actor_sql = 'SELECT actor.id, actor.actor FROM actor, ' . $video . '_actor WHERE ' . $video . '_actor.id = "' . $list['id'] . '" AND actor.id = ' . $video . '_actor.actorid ORDER BY ' . $video . '_actor.order';
$actor_res = mysql_q($actor_sql);
while ($val = mysql_fetch_assoc($actor_res)) {
if ($val['actor'] !== '') {
if (file_exists('cache/actors/' . substr(md5($val['actor']), 0, 10) . '.jpg')) {
$actor_thumb = '
';
} else {
$actor_thumb = '';
}
$output_actor_array[] = '' . $actor_thumb . $val['actor'] . '';
}
}
if (count($output_actor_array) > 0) {
$show_desc['actor'] = 1;
$output_desc['actor'] = implode(' / ', $output_actor_array);
}
// plot
if ($list['plot'] !== '') {
$show_desc['plot'] = 1;
$output_desc['plot'] = $list['plot'];
}
// only movies
if ($video == 'movies') {
// year
if ($list['year'] !== '') {
$show_desc['year'] = 1;
$output_desc['year'] = '' . $list['year'] . '';
}
// country
$output_country_array = array();
$country_sql = 'SELECT country.id, country.country FROM country, ' . $video . '_country WHERE ' . $video . '_country.id = "' . $list['id'] . '" AND country.id = ' . $video . '_country.countryid';
$country_res = mysql_q($country_sql);
while ($val = mysql_fetch_assoc($country_res)) {
$output_country_array[] = '' . $val['country'] . '';
}
if (count($output_country_array) > 0) {
$show_desc['country'] = 1;
$output_desc['country'] = implode(' / ', $output_country_array);
}
// runtime
if ($list['runtime'] !== NULL) {
$show_desc['runtime'] = 1;
$output_desc['runtime'] = $list['runtime'];
}
// director
$director_sql = 'SELECT director.id, director.director FROM director, ' . $video . '_director WHERE ' . $video . '_director.id = "' . $list['id'] . '" AND director.id = ' . $video . '_director.directorid';
$director_res = mysql_q($director_sql);
$val = mysql_fetch_assoc($director_res);
if (isset($val['director'])) {
$show_desc['director'] = 1;
$output_desc['director'] = '' . $val['director'] . '';
}
// set
if ($list['set'] !== '') {
$show_desc['set'] = 1;
$output_desc['set'] = '' . $list['set'] . '';
}
// imdb id
if ($list['imdbid'] !== '' && $list['imdbid']{0} == 't') {
$output_desc['imdb_url'] = '
';
}
// studio
$studio_sql = 'SELECT studio.id, studio.studio FROM studio, ' . $video . '_studio WHERE ' . $video . '_studio.id = "' . $list['id'] . '" AND studio.id = ' . $video . '_studio.studioid';
$studio_res = mysql_q($studio_sql);
$val = mysql_fetch_assoc($studio_res);
if (isset($val['studio'])) {
$show_desc['studio'] = 1;
$output_desc['studio'] = '' . $val['studio'] . '';
if (file_exists('templates/' . $setting['theme'] . '/img/studios/' . $val['studio'] . '.png')) {
$show_desc['studio_art'] = 1;
$output_desc['studio_art'] = '
';
}
}
// ribbon new
if (substr($list['date_added'], 0, 10) == $new_date) {
$show_desc['ribbon_new'] = 1;
$output_desc['ribbon_new'] = '' . mb_strtoupper($lang['i_ribbon_new']) . '
';
}
// streams
$stream_sql = 'SELECT * FROM `movies_stream` WHERE id = "' . $list['id'] . '"';
$stream_res = mysql_q($stream_sql);
if (mysql_num_rows($stream_res) > 0) {
$str = array('v' => array(), 'a' => array(), 's' => array());
while ($stream = mysql_fetch_assoc($stream_res)) {
$str[$stream['type']][] = $stream;
}
}
$img_flag_vres = '';
$img_flag_vtype = '';
$img_flag_vq = '';
if (isset($str['v'])) {
foreach ($str['v'] as $s) {
// video resolution
foreach ($vres_assoc as $key => $val) {
if (is_numeric($s['v_width']) && $s['v_width'] >= $key) {
$img_flag_vres = '
';
}
}
// video codec
foreach ($vtype_assoc as $key => $val) {
if (in_array($s['v_codec'], $vtype_assoc[$key])) {
$img_flag_vtype = '
';
}
}
// video sd, hd or uhd
$img_flag_vq = '
';
if (is_numeric($s['v_width']) && $s['v_width'] >= 1280) {
$img_flag_vq = '
';
}
if (is_numeric($s['v_width']) && $s['v_width'] >= 3000) {
$img_flag_vq = '
';
}
$output_desc['img_flag_v'].= '' . $img_flag_vres . $img_flag_vtype . $img_flag_vq . '
';
}
}
if (isset($str['a'])) {
foreach ($str['a'] as $s) {
// audio codec
foreach ($atype_assoc as $key => $val) {
if(in_array($s['a_codec'], $atype_assoc[$key])) {
$img_flag_atype = '
';
}
}
// audio channel
foreach ($achan_assoc as $val) {
if (is_numeric($s['a_chan']) && $s['a_chan'] >= $val) {
$img_flag_achan = '
';
}
}
// audio language
if (file_exists('templates/' . $setting['theme'] . '/img/flags/l_' . check_flag($s['a_lang'], $iso_lang) . '.png')) {
$img_flag_alang = '
';
} else {
$img_flag_alang = $s['a_lang'];
}
$output_desc['img_flag_a'].= '' . $img_flag_atype . $img_flag_achan . $img_flag_alang . '
';
}
}
// subtitles
if (isset($str['s'])) {
foreach ($str['s'] as $s) {
if (file_exists('templates/' . $setting['theme'] . '/img/flags/l_' . check_flag($s['s_lang'], $iso_lang) . '.png')) {
$img_flag_slang = '
';
} else {
$img_flag_slang = $s['s_lang'];
}
$output_desc['img_flag_s'].= '' . $img_flag_slang . '
';
}
}
// extra thumbs
$ex_thumb_array = array();
for ($c=1;$c<10;$c++) {
$ex_t = 'cache/movies_' . $list['id'] . '_t' . $c . 'm.jpg';
if (file_exists($ex_t)) {
$ex_thumb_array[] = '
';
}
}
if (count($ex_thumb_array) > 0) {
$show_desc['extra_thumbs'] = 1;
$output_desc['extra_thumbs'] = '' . implode('', $ex_thumb_array) . '
';
}
// trailer
if ($list['trailer'] !== '' && $setting['show_trailer'] == 1) {
$output_desc['trailer_img'] = '
';
}
if ($list['trailer'] !== '' && $setting['show_trailer'] == 1 && $id <> 0) {
$show_desc['trailer'] = 1;
if (substr($list['trailer'], 0, 18) == 'http://www.youtube') {
$output_desc['trailer'].= '
';
} else {
$ext = substr($list['trailer'], strrpos($list['trailer'], '.')+1, strlen($list['trailer']));
foreach ($mimetype_assoc as $key => $val) {
if(in_array($ext, $val)) {
$mimetype = $key;
break;
} else {
$mimetype = '';
}
}
if ($ext == 'mov') {
$output_desc['trailer'].= '
';
} else {
$output_desc['trailer'].= '
';
}
}
}
}
// only tvshows
if ($video == 'tvshows') {
// premiered
if ($list['premiered'] !== '') {
$show_desc['premiered'] = 1;
$output_desc['premiered'] = '' . $list['premiered'] . '';
}
// seasons
$season_array = array();
$seasons_sql = 'SELECT season FROM episodes WHERE tvshow = "' . $list['id'] . '" ORDER BY season';
$seasons_result = mysql_q($seasons_sql);
while ($seasons = mysql_fetch_array($seasons_result)) {
if (!array_key_exists($seasons['season'], $season_array)) {
$season_array[$seasons['season']] = '' . $lang['i_season'] . ' ' . $seasons['season'] . '';
}
}
if (count($season_array) <> 0) {
$show_desc['seasons'] = 1;
$output_desc['seasons'] = implode(' / ', $season_array);
}
// episodes
if ($id <> 0) {
// get date for last added episode
$new_episode_sql = 'SELECT date_added FROM episodes ORDER BY date_added DESC LIMIT 0, 1';
$new_episode_result = mysql_q($new_episode_sql);
$new_episode_date = mysql_fetch_assoc($new_episode_result);
$new_episode_date = substr($new_episode_date['date_added'], 0, 10);
$show_desc['episodes'] = 1;
$episodes_sql = 'SELECT id, title, episode, season, plot, firstaired, file, play_count, date_added, last_played FROM episodes WHERE tvshow = "' . $list['id'] . '" ORDER BY season, episode ASC';
$episodes_result = mysql_q($episodes_sql);
$i = -1;
$output_epiosde_list = '';
while ($episodes = mysql_fetch_assoc($episodes_result)) {
// output and show episodes arrays
$output_episode = array();
$show_episode = array();
foreach ($item_episode as $val) {
$output_episode[$val] = '';
$show_episode[$val] = 0;
}
if (isset($_SESSION['logged_admin']) && $_SESSION['logged_admin'] == true && $video == 'tvshows') {
$show_episode['xbmc'] = 1;
}
$output_episode['episode'] = $episodes['id'];
$output_episode['season'] = $episodes['season'];
$output_episode['plot'] = $episodes['plot'];
$output_episode['aired'] = $episodes['firstaired'];
// title
$output_episode['title'] = $episodes['episode'] . '. ' . ($episodes['title'] == '' ? $lang['i_episode'] . ' ' . $episodes['episode'] : $episodes['title']);
// file
$output_episode['file'] = 'http://' . $setting['xbmc_login'] . ':' . $setting['xbmc_pass'] . '@' . $setting['xbmc_host'] . ':' . $setting['xbmc_port'] . '/vfs/' . urlencode($episodes['file']);
// thumbnail
if (file_exists('cache/episodes_' . $episodes['id'] . '.jpg')) {
$output_episode['thumbnail'] = '
';
} else {
$output_episode['thumbnail'] = '
';
}
// wached status
if ($setting['watched_status'] == 1 && $episodes['play_count'] > 0) {
$output_episode['watched_img'] = '
';
}
// episode ribbon new
if (substr($episodes['date_added'], 0, 10) == $new_episode_date) {
$output_episode['ribbon_new'] = '' . mb_strtoupper($lang['i_ribbon_new']) . '
';
}
// episode streams
$stream_sql = 'SELECT * FROM `episodes_stream` WHERE id = "' . $episodes['id'] . '"';
$stream_res = mysql_q($stream_sql);
if (mysql_num_rows($stream_res) > 0) {
$str = array('v' => array(), 'a' => array(), 's' => array());
while ($stream = mysql_fetch_assoc($stream_res)) {
$str[$stream['type']][] = $stream;
}
}
$img_flag_vres = '';
$img_flag_vtype = '';
$img_flag_vq = '';
if (isset($str['v'])) {
foreach ($str['v'] as $s) {
// episode video resolution
foreach ($vres_assoc as $key => $val) {
if (is_numeric($s['v_width']) && $s['v_width'] >= $key) {
$img_flag_vres = '
';
}
}
// episode video codec
foreach ($vtype_assoc as $key => $val) {
if (in_array($s['v_codec'], $vtype_assoc[$key])) {
$img_flag_vtype = '
';
}
}
// episode video sd, hd or uhd
$img_flag_vq = '
';
if (is_numeric($s['v_width']) && $s['v_width'] >= 1280) {
$img_flag_vq = '
';
}
if (is_numeric($s['v_width']) && $s['v_width'] >= 3000) {
$img_flag_vq = '
';
}
$output_episode['img_flag_v'].= $img_flag_vres . $img_flag_vtype . $img_flag_vq;
}
}
if (isset($str['a'])) {
foreach ($str['a'] as $s) {
// episode audio codec
foreach ($atype_assoc as $key => $val) {
if(in_array($s['a_codec'], $atype_assoc[$key])) {
$img_flag_atype = '
';
}
}
// episode audio channel
foreach ($achan_assoc as $val) {
if (is_numeric($s['a_chan']) && $s['a_chan'] >= $val) {
$img_flag_achan = '
';
}
}
// episode audio language
if (file_exists('templates/' . $setting['theme'] . '/img/flags/l_' . check_flag($s['a_lang'], $iso_lang) . '.png')) {
$img_flag_alang = '
';
} else {
$img_flag_alang = $s['a_lang'];
}
$output_episode['img_flag_a'].= $img_flag_atype . $img_flag_achan . $img_flag_alang;
}
}
if (isset($str['s'])) {
foreach ($str['s'] as $s) {
// episode subtitles
if (file_exists('templates/' . $setting['theme'] . '/img/flags/l_' . check_flag($s['s_lang'], $iso_lang) . '.png')) {
$img_flag_slang = '
';
} else {
$img_flag_slang = $s['s_lang'];
}
$output_episode['img_flag_s'].= $img_flag_slang ;
}
}
if ($episodes['season'] <> $i) {
$show_episode['season_title'] = 1;
}
$i = $episodes['season'];
$episode_list = new Teamplate('episodes.tpl', $setting, $lang);
foreach ($output_episode as $key => $val) {
$episode_list->tpl($key, $val);
}
foreach ($show_episode as $key => $val) {
$episode_list->show($key, $val);
}
$output_epiosde_list.= $episode_list->init();
$output_desc['episodes'] = $output_epiosde_list;
}
}
}
// facebook meta data
if ($setting['show_facebook'] == 1) {
$show_desc['facebook_button'] = 1;
}
$url = 'http://' . $_SERVER['SERVER_NAME'] . implode('/', array_slice(explode('/', $_SERVER['REQUEST_URI']), 0, -1)) . '/';
$output_desc['fb_url'] = $url . 'index.php?video=' . $video . '&fb_link=' . urlencode($list['title']) . ($video == 'movies' ? $list['year'] : '');
if ($id <> 0) {
$output['meta_img'] = (file_exists('cache/' . $mysql_table . '_' . $id . '.jpg') ? $url . 'cache/' . $mysql_table . '_' . $id . '.jpg' : 'templates/' . $setting['theme'] . '/img/d_poster.jpg');
$output['meta_title'] = htmlspecialchars($list['title']);
$output['meta_desc'] = htmlspecialchars($list['plot']);
$output['meta_url'] = $output_desc['fb_url'];
$output['meta_type'] = ($video == 'tvshows' ? 'video.tv_show' : 'video.movie');
}
// panel movie
$panel_list = new Teamplate($views[$include_view] . '.tpl', $setting, $lang);
foreach ($output_desc as $key => $val) {
$panel_list->tpl($key, $val);
}
foreach ($show_desc as $key => $val) {
$panel_list->show($key, $val);
}
$output_panel_list.= $panel_list->init();
}
$output['panel_list'] = $output_panel_list;
$output['sort'] = $sort;
// faccebok meta data
if ($id == 0) {
$url = 'http://' . $_SERVER['SERVER_NAME'] . implode('/', array_slice(explode('/', $_SERVER['REQUEST_URI']), 0, -1)) . '/';
$output['meta_title'] = $setting['site_name'];
$output['meta_url'] = $url . 'index.php';
$output['meta_img'] = $url . ('templates/' . $setting['theme'] . '/img/logo.jpg');
$output['meta_type'] = 'website';
$output['meta_desc'] = 'Page whereby using XBMC can present your library of movies and TV series.';
}
if ($setting['show_facebook'] == 1) {
$show['facebook'] = 1;
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$get_lang = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
} else {
$get_lang = 'en';
}
if (array_key_exists ($get_lang , $lang_fb_assoc)) {
$lang_fb = $lang_fb_assoc[$get_lang];
} else {
$lang_fb = $lang_fb_assoc['en'];
}
$output['facebook'] = '
';
}
// create page
$index = new Teamplate('index.tpl', $setting, $lang);
foreach ($output as $key => $val) {
$index->tpl($key, $val);
}
foreach ($show as $key => $val) {
$index->show($key, $val);
}
$site = $index->init();
print $site;
?>