Ejemplo n.º 1
0
function save_custom_box($post_id)
{
    if (!wp_verify_nonce($_POST['vnnews_noncename'], plugin_basename(__FILE__))) {
        return $post_id;
    }
    if (!current_user_can('edit_post', $post_id)) {
        return $post_id;
    }
    global $wpdb, $post;
    if (check_fiml_meta($post->ID) == false) {
        add_film_meta($post->ID);
    }
    $meta_value = $_POST['vnn_thumbnail'];
    $data = explode('|', $meta_value);
    if ($meta_value != "") {
        $episode_post = $_POST['vnn_thumbnail'];
        $episode_film = $post->ID;
        $list_episode = explode("\n", $episode_post);
        $count_ep = count($list_episode);
        for ($i = 0; $i < $count_ep; $i++) {
            $tap[$i] = explode('#', trim($list_episode[$i]));
            $ten_tap[$i] = trim($tap[$i][0]);
            $link_tap[$i] = trim($tap[$i][1]);
            $thu_tu[$i] = trim($tap[$i][2]);
            if (FilmEpisodeNewEpisode($ten_tap[$i], $post->ID, $_POST['episode_server'], $link_tap[$i], $thu_tu[$i], time())) {
                $tb .= $ten_tap[$i] . ' - ';
            } else {
                echo '<div id="message" class="error fade" style="background-color: rgb(218, 79, 33);"><br/><b>L?i ! t?p ' . $ten_tap[$i] . ' server ' . $_POST['episode_server'] . ' d� t?n t?i</b><br/><br/></div>';
            }
        }
    }
    return $meta_value;
}
Ejemplo n.º 2
0
function save_custom_box($post_id)
{
    if (!wp_verify_nonce($_POST['vnnews_noncename'], plugin_basename(__FILE__))) {
        return $post_id;
    }
    if ('page' == $_POST['post_type']) {
        if (!current_user_can('edit_page', $post_id)) {
            return $post_id;
        }
    } else {
        if (!current_user_can('edit_post', $post_id)) {
            return $post_id;
        }
    }
    global $wpdb, $post;
    $meta_value = $_POST['vnn_thumbnail'];
    $data = explode('|', $meta_value);
    if ($meta_value != "") {
        $episode_post = $_POST['vnn_thumbnail'];
        $episode_film = $post->ID;
        $list_episode = explode("\n", $episode_post);
        $count_ep = count($list_episode);
        for ($i = 0; $i < $count_ep; $i++) {
            $tap[$i] = explode('#', trim($list_episode[$i]));
            $ten_tap[$i] = trim($tap[$i][0]);
            $link_tap[$i] = trim($tap[$i][1]);
            $thu_tu[$i] = trim($tap[$i][2]);
            if (FilmEpisodeNewEpisode($ten_tap[$i], $post->ID, $_POST['episode_server'], $link_tap[$i], $thu_tu[$i], time())) {
                $tb .= $ten_tap[$i] . ' - ';
            } else {
                echo '<div id="message" class="error fade" style="background-color: rgb(218, 79, 33);"><br/><b>L?i ! t?p ' . $ten_tap[$i] . ' server ' . $_POST['episode_server'] . ' dã t?n t?i</b><br/><br/></div>';
            }
        }
        echo '<div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"><b><br/>Các T?p ' . $tb . ' du?c thêm thành công !</b><br/><br/></div>';
        $_acc = "addEpisode";
    }
    wp_cache_delete($post_id, 'post_meta');
    return $meta_value;
}
Ejemplo n.º 3
0
function auto_post($url, $post_id, $type = '')
{
    $url = curl($url);
    $url = explode('<ul class="episodelist">', $url);
    $url = explode('</ul>', $url[1]);
    $url = str_replace('<blink>', '<b>', $url);
    $url = str_replace('</a></blink>', '</b>', $url);
    $url = explode('href="', $url[0]);
    $dem = count($url) - 1;
    ?>
<fieldset>

<?php 
    for ($i = 1; $i <= $dem; $i++) {
        $vip = getStr('"', $url[$i]);
        $vip = $vip[0];
        $name = getStr('<b>', $url[$i]);
        $name = getStr('</b>', $name[1]);
        $name = $name[0];
        $link = curl($vip);
        $link = str_replace('proxy.list', 'proxy.link', $link);
        $url1 = getStr('proxy.link=', $link);
        $url1 = getStr('&', $url1[1]);
        $url1 = $url1[0];
        $url2 = curl($url1);
        $url2 = getStr('<location><![CDATA[', $url2);
        $url2 = getStr(']]></location>', $url2[1]);
        $url2 = $url2[0];
        if (FilmEpisodeNewEpisode($name, $post_id, $_POST['episode_server'], $url2, $i, time(), $sub)) {
            $tb .= $ten_tap[$j] . ' - ';
        }
        echo $tb;
    }
    ?>
</fieldset>
<?php 
}
Ejemplo n.º 4
0
function gnarty_menu_page_cb()
{
    global $wpdb;
    if (isset($_POST['ok'])) {
        if ($_POST['webgrab'] == 'phimletvn') {
            $info_url_html = xem_web($_POST['urlgrab']);
            $url_play = explode('<a rel="nofollow" href="/xem-', $info_url_html);
            $total_play = count($url_play);
            $total_plays = $total_play - 1;
            $info_name = explode('<h1 class="title">', $info_url_html);
            $info_name = explode('</h1>', $info_name[1]);
            $info_name_en = explode('<h2 class="title gray maggin_bottom_10">', $info_url_html);
            $info_name_en = explode('</h2>', $info_name_en[1]);
            $info_dienvien = explode('<div class="grid_2 omega label">Diễn viên:</div><div class="grid_7 alpha">', $info_url_html);
            $info_dienvien = explode('</div>', $info_dienvien[1]);
            $info_nam = explode('Phát hành: <strong>', $info_url_html);
            $info_nam = explode('</strong></li>', $info_nam[1]);
            $info_sx = explode('Sản xuất: <strong>', $info_url_html);
            $info_sx = explode('</strong></li>', $info_sx[1]);
            $info_time = explode('<div class="row bg_2 clearfix"><div class="grid_2 omega label">Tập:</div><div class="grid_7 alpha">', $info_url_html);
            $info_time = explode('</div>', $info_time[1]);
            $info_tt = explode('<div class="grid_2 omega label">Giới thiệu:</div>', $info_url_html);
            $info_tt = explode('</div>', $info_tt[1]);
            $info_tag = get_ascii($info_name[0] . ", " . $info_name_en[0]);
        } else {
            if ($_POST['webgrab'] == 'tvphimhd') {
                $info_url_html = $html = xem_web($_POST['urlgrab']);
                $vantoan = explode('[id]', $info_url_html);
                $vantoan = explode('|[/id]', $vantoan[1]);
                $vantoan = $vantoan[0];
                $s = explode('|', $vantoan);
                $total_plays = count($s);
                $info_name[0] = explode_by("<title>Xem phim ", "-", $html, true);
                $info_name_en = explode('<div class="mota-right"><h2>', $info_url_html);
                $info_name_en = explode('</h2>', $info_name_en[1]);
                $info_img = explode('<img class="poster" src="', $info_url_html);
                $info_img = explode('"', $info_img[1]);
                $info_daodien[0] = explode_by("Thời lượng:", "Diễn viên:", $html, true);
                $info_dienvien[0] = explode_by("Diễn viên:", "Thời lượng:", $html, true);
                $info_time[0] = explode_by("Thời lượng:", "Từ khóa:", $html, true);
                $info_nam[0] = explode_by("Năm phát hành:", "Đạo diễn:", $html, true);
                $info_tt[0] = explode_by('<div class="description">', "</div>", $html, true);
            } else {
                if ($_POST['webgrab'] == 'phim3s') {
                    $info_url_html = $html = file_get_contents($_POST['urlgrab']);
                    $link_watch = explode_by('</div></div><a href="', '" class="btn-watch"', $info_url_html);
                    $link_watch = 'http://phim3s.net/' . $link_watch;
                    $link_watch = file_get_contents($link_watch);
                    $ep_list = explode_by('<div class="serverlist">', '</ul></div></div>', $link_watch);
                    $url_play = explode('<a', $ep_list);
                    $total_play = count($url_play);
                    $total_plays = $total_play - 1;
                    $info_name[0] = explode_by("<title>Xem phim", " | ", $html);
                    $info_name_en[0] = explode_by(" | ", "full HD</title>", $html);
                    $info_img[0] = explode_by('<img class="photo" src="', '" alt', $html);
                    $info_daodien[0] = explode_by("<dt>Đạo diễn:</dt>", "<dt>Diễn viên:</dt>", $html, true);
                    $info_dienvien[0] = explode_by("<dt>Diễn viên:</dt>", "<dt>Thể loại:</dt>", $html, true);
                    $info_time[0] = explode_by("<dt>Thời lượng:</dt>", "<dt>Lượt xem:</dt>", $html, true);
                    $info_nam[0] = explode_by("<p>Năm phát hành: ", "</p", $html, true);
                    $info_tt[0] = explode_by('<div class="tabs-content" id="info-film">', '<div class="tags">', $html, true);
                    $info_tag = get_ascii($info_name[0] . ", " . $info_name_en[0]);
                } else {
                    if ($_POST['webgrab'] == 'xemphimfullhd') {
                        $info_url_html = $html = xem_web($_POST['urlgrab']);
                        $link_watch = explode_by('<a class="xem w-bt" href="', '"', $html, false);
                        $link_watch = xem_web($link_watch);
                        $ep_list = explode_by('<div class="list_episodes content">', '<br class="clr"/>', $link_watch, false);
                        $url_play = explode('<a ', $ep_list);
                        $total_play = count($url_play);
                        $total_plays = $total_play - 1;
                        $info_name[0] = explode_by("<title>Phim ", " | ", $html, false);
                        $info_name_en[0] = explode_by(" | ", " | ", $html, false);
                        $info_img[0] = explode_by('<link href="', '"', $html, false);
                        $info_daodien[0] = explode_by("<p>Đạo diễn:", "</p", $html, true);
                        $info_dienvien[0] = explode_by("<p>Diễn viên:", "</p", $html, true);
                        $info_time[0] = explode_by("<p>Thời lượng:", "</p", $html, true);
                        $info_nam[0] = explode_by("<p>Năm phát hành: ", "</p", $html, true);
                        $info_tt[0] = explode_by('<div id="movie_description" class="tab_click entry">', "</div>", $html, true);
                    } else {
                        if ($_POST['webgrab'] == 'phim1k') {
                            $info_url_html = $html = curl_by($_POST['urlgrab']);
                            //$link_watch = 'http://phim1k.net'.explode_by('href="http://adf.ly/2397534/','"',$html);
                            $link_watch = explode_by('href="http://adf.ly/2397534/', '"', $html);
                            if (substr($link_watch, 0, 7) != 'http://') {
                                $link_watch = 'http://phim1k.net' . $link_watch;
                            }
                            $link_watch = curl_by($link_watch);
                            $ep_list = explode_by('<div class="server_content">', '<div class="f_i_desc">', $link_watch, false);
                            $url_play = explode('<a ', $ep_list);
                            $total_play = count($url_play);
                            $total_plays = $total_play - 1;
                            $info_name[0] = explode_by("<h1>", "</h1>", $html, true);
                            $info_name_en[0] = explode_by("<span class=\"f_i_title_en\">", "</span>", $html, false);
                            $info_img[0] = explode_by('<meta property="og:image" content="', '" />', $html, false);
                            $info_daodien[0] = explode_by("<strong>Đạo diễn:</strong>", "</span", $html, true);
                            $info_dienvien[0] = explode_by("<strong>Diễn viên:</strong>", "</span", $html, true);
                            //$info_time[0] = explode_by("<p>Thời lượng:","</p",$html,true);
                            $info_nam[0] = explode_by("<strong>Năm phát hành:</strong>", "</span", $html, true);
                            $info_tt[0] = explode_by('<div class="content" style="line-height: 20px;">', "</div>", $html, true);
                        } else {
                            if ($_POST['webgrab'] == 'phim14') {
                                $info_url_html = $html = curl_by($_POST['urlgrab']);
                                $link_watch = explode_by('<a class="watch_button now" href="', '"', $html, false);
                                $link_watch = curl_by($link_watch);
                                $ep_list = explode_by('<ul id="server_list">', '<div class="blockrow blockinfo">', $link_watch, false);
                                $url_play = explode('<a ', $ep_list);
                                $total_play = count($url_play);
                                $total_plays = $total_play - 1;
                                $info_name[0] = explode_by("<title>Phim ", "(", $html, false);
                                $info_name_en[0] = explode_by("(", ")", $html, false);
                                $info_img[0] = explode_by('<div class="thumbnail"><img src="', '"', $html, false);
                                $info_daodien[0] = explode_by('div class="alt1">Đạo diễn:', "Diễn viên:", $html, true);
                                $info_dienvien[0] = explode_by('Diễn viên:', "Thể loại:", $html, true);
                                $info_time[0] = explode_by('<div class="alt1">Thời lượng:', "</div", $html, true);
                                $info_nam[0] = explode_by('<div class="alt2">Năm phát hành:', "</div", $html, true);
                                $info_tt[0] = explode_by('</a></span></div>', '<div class="title hr"><span>', $html, true);
                            } elseif ($_POST['webgrab'] == 'animefc') {
                                $info_url_html = xem_web($_POST['urlgrab']);
                                $url_play_phim = explode('<a href="http://animefc.info/xem-phim', $info_url_html);
                                $url_play_phim = explode('"', $url_play_phim[1]);
                                $url_play_phim = 'http://animefc.info/xem-phim' . $url_play_phim[0];
                                $url_play_phim_html = xem_web($url_play_phim);
                                $url_play_phim_html = explode_by('<div id="servers" class="serverlist">', '<!-- / server -->', $url_play_phim_html, false);
                                $url_play = explode('data-type="watch" class="" href="', $url_play_phim_html);
                                //print_r($url_play);exit();
                                $total_play = count($url_play);
                                $total_plays = $total_play - 1;
                                $info_img[0] = explode_by('<meta property="og:image" content="', '"', $info_url_html, false);
                                $info_name = explode('title="Phim ', $info_url_html);
                                $info_name = explode('"', $info_name[1]);
                                $info_name_en = explode('<h3>', $info_url_html);
                                $info_name_en = explode('</h3>', $info_name_en[1]);
                                $info_nam = explode('<p>Năm Sản Xuất: <strong>', $info_url_html);
                                $info_nam = explode('</strong></p>', $info_nam[1]);
                                $info_time = explode('<p>Thời lượng: <strong>', $info_url_html);
                                $info_time = explode('</strong></p>', $info_time[1]);
                                $info_tt = explode('<div id="noidung" class="tabs_content">', $info_url_html);
                                $info_tt = explode('<div class="f_d_tag">', $info_tt[1]);
                                $info_tag = explode('<div class="f_d_tag">', $info_url_html);
                                $info_tag = explode('</div>', $info_tag[1]);
                                $info_tag = str_replace('Tags:', '', $info_tag);
                                $info_tag = multi_between('rel="tag">', '</a>', $info_tag);
                                $info_tag = implode(', ', $info_tag);
                            } else {
                                if ($_POST['webgrab'] == 'phimbb') {
                                    $info_url_html = $html = curl_by($_POST['urlgrab']);
                                    $link_watch = 'http://phimbb.net/xem-phim/' . explode_by('<a href="xem-phim/', '"', $html, true);
                                    $link_watch = curl_by($link_watch);
                                    $ep_list = explode_by('<div id="servers">', '</div>', $link_watch, false);
                                    $url_play = explode('<a ', $ep_list);
                                    $total_play = count($url_play);
                                    $total_plays = $total_play - 1;
                                    $info_name[0] = explode_by("<h1>»", "</h1>", $html, false);
                                    $info_name_en[0] = explode_by("<p class=\"tt-en\">»", "</p>", $html, false);
                                    $info_img = explode('<div class="cover">', $html);
                                    $info_img = explode('"></a>', $info_img[1]);
                                    $info_img = explode('<img src="', $info_img[0]);
                                    $info_img = explode('"', $info_img[1]);
                                    $info_img[0] = $info_img[0];
                                    $info_daodien[0] = explode_by('<p class="half">» Đạo diễn:', '</p>', $html, true);
                                    $info_dienvien[0] = explode_by('<p>» Diễn viên: ', '</p>', $html, true);
                                    //$info_time[0] = explode_by('<div class="alt1">Thời lượng:',"</div",$html,true);
                                    //$info_nam[0] = explode_by('<div class="alt2">Năm phát hành:',"</div",$html,true);
                                    $info_tt[0] = explode_by('id="movie_description">', '</div>', $html, false);
                                    $info_tt[0] = str_replace('PhimBB.Net', '', $info_tt[0]);
                                } else {
                                    if ($_POST['webgrab'] == 'phimkk') {
                                        $info_url_html = $html = curl_by($_POST['urlgrab']);
                                        $link_watch = 'http://phimkk.com/xem-phim/' . explode_by('<a href="xem-phim/', '"', $html, true);
                                        $link_watch = curl_by($link_watch);
                                        $ep_list = explode_by('<div id="servers">', '</div>', $link_watch, false);
                                        $url_play = explode('<a ', $ep_list);
                                        $total_play = count($url_play);
                                        $total_plays = $total_play - 1;
                                        $info_name[0] = explode_by("<h1>»", "</h1>", $html, false);
                                        $info_name_en[0] = explode_by("<p class=\"tt-en\">»", "</p>", $html, false);
                                        $info_img = explode('<div class="cover">', $html);
                                        $info_img = explode('"></a>', $info_img[1]);
                                        $info_img = explode('<img src="', $info_img[0]);
                                        $info_img = explode('"', $info_img[1]);
                                        $info_img[0] = $info_img[0];
                                        $info_daodien[0] = explode_by('<p class="half">» Đạo diễn:', '</p>', $html, true);
                                        $info_dienvien[0] = explode_by('<p>» Diễn viên: ', '</p>', $html, true);
                                        //$info_time[0] = explode_by('<div class="alt1">Thời lượng:',"</div",$html,true);
                                        //$info_nam[0] = explode_by('<div class="alt2">Năm phát hành:',"</div",$html,true);
                                        $info_tt[0] = explode_by('id="movie_description">', '</div>', $html, false);
                                        $info_tt[0] = str_replace('Phimkk.com', '', $info_tt[0]);
                                    } elseif ($_POST['webgrab'] == 'phim85') {
                                        $info_url_html = xem_web($_POST['urlgrab']);
                                        $url_play_phim = explode('<a href="http://www.phim85.com/xem-phim/', $info_url_html);
                                        $url_play_phim = explode('" alt="', $url_play_phim[1]);
                                        $url_play_html_phim = 'http://www.phim85.com/xem-phim/' . $url_play_phim[0];
                                        $url_play_phim = xem_web($url_play_html_phim);
                                        $url_play = explode('<li class=""><a href="xem-', $url_play_phim);
                                        $total_play = count($url_play);
                                        $total_plays = $total_play - 1;
                                        $info_name = explode('<h1>PHIM', $info_url_html);
                                        $info_name = explode(' - ', $info_name[1]);
                                        $info_name_en = explode('<a href="year/', $info_name[1]);
                                        $info_daodien = explode('<dt>Đạo diễn - Director:</dt>', $info_url_html);
                                        $info_daodien = explode('</dd>', $info_daodien[1]);
                                        $info_dienvien = explode('<dt>Diễn viên - Stars:</dt>', $info_url_html);
                                        $info_dienvien = explode('</dd>', $info_dienvien[1]);
                                        $info_nam = explode('<dt>Năm phát hành - Year:</dt>', $info_url_html);
                                        $info_nam = explode('</dd>', $info_nam[1]);
                                        $info_sx = explode('<p class="m-l">Nhà sản xuất: ', $info_url_html);
                                        $info_sx = explode('</p>', $info_sx[1]);
                                        $info_time = explode('<dt>Thời lượng - Runtime:</dt>', $info_url_html);
                                        $info_time = explode('</dd>', $info_time[1]);
                                        $info_tt = explode('<div style="margin-top:5px;" class="title hr"><span>Nội dung phim:</span></div>', $info_url_html);
                                        $info_tt = explode('<div class="blocktitle">Phim cùng thể loại</div>', $info_tt[1]);
                                        $info_tag = get_ascii($info_name[0] . ", " . $info_name_en[0]);
                                    } elseif ($_POST['webgrab'] == 'congdongvip') {
                                        $info_url_html = xem_web($_POST['urlgrab']);
                                        $url_play_phim = explode('<p class="play"><a href="http://phim.congdongvip.com/', $info_url_html);
                                        $url_play_phim = explode('" title="', $url_play_phim[1]);
                                        $url_play_html_phim = 'http://phim.congdongvip.com/' . $url_play_phim[0];
                                        $url_play_phim = xem_web($url_play_html_phim);
                                        $url_play = explode('" onclick="setupplayer', $url_play_phim);
                                        $total_play = count($url_play);
                                        $total_plays = $total_play - 1;
                                        $info_name = explode('<h1><a property="v:title" rel="v:url" title="Phim ', $info_url_html);
                                        $info_name = explode('" href="/phim/', $info_name[1]);
                                        $info_name_en = explode('" href="/phim/', $info_name[0]);
                                        $info_daodien = explode('<p>Đạo diễn: ', $info_url_html);
                                        $info_daodien = explode('</a></p>', $info_daodien[1]);
                                        $info_dienvien = explode('<p>Diễn viên:', $info_url_html);
                                        $info_dienvien = explode('</a></p>', $info_dienvien[1]);
                                        $info_nam = explode('<p class="m-l">Năm phát hành: ', $info_url_html);
                                        $info_nam = explode('</p>', $info_nam[1]);
                                        $info_sx = explode('<p class="m-l">Nhà sản xuất: ', $info_url_html);
                                        $info_sx = explode('</p>', $info_sx[1]);
                                        $info_time = explode('<p class="m-l">Thời lượng: ', $info_url_html);
                                        $info_time = explode('</span></p>', $info_time[1]);
                                        $info_tt = explode('<div class="icontents row-content">', $info_url_html);
                                        $info_tt = explode('<div class="xt"><a href="#" id="show-movie-info">', $info_tt[1]);
                                        $info_tag = get_ascii($info_name[0] . ", " . $info_name_en[0]);
                                    } elseif ($_POST['webgrab'] == 'phim8') {
                                        $info_url_html = xem_web($_POST['urlgrab']);
                                        $url_play_phim = explode('<a href="http://phim8.info/xem-phim/', $info_url_html);
                                        $url_play_phim = explode('" alt="Xem phim trực tuyến"', $url_play_phim[1]);
                                        $url_play_html_phim = 'http://phim8.info/xem-phim/' . $url_play_phim[0];
                                        $url_play_phim = xem_web($url_play_html_phim);
                                        $url_play = explode('<a href="xem-', $url_play_phim);
                                        $total_play = count($url_play);
                                        $total_plays = $total_play - 1;
                                        $info_name = explode('<dt>Tên Phim:</dt>', $info_url_html);
                                        $info_name = explode(' - ', $info_name[1]);
                                        $info_name_en = explode(' 2', $info_name[1]);
                                        $info_daodien = explode('<dt>Đạo diễn:</dt>', $info_url_html);
                                        $info_daodien = explode('</a></dd>', $info_daodien[1]);
                                        $info_dienvien = explode('<dt>Diễn viên:</dt>', $info_url_html);
                                        $info_dienvien = explode('</a></dd>', $info_dienvien[1]);
                                        $info_nam = explode('<dt>Năm phát hành:</dt>', $info_url_html);
                                        $info_nam = explode('</a></dd>', $info_nam[1]);
                                        $info_sx = explode('<dt>Sản xuất:</dt>', $info_url_html);
                                        $info_sx = explode('</dd>', $info_sx[1]);
                                        $info_time = explode('<dt>Thời lượng:</dt>', $info_url_html);
                                        $info_time = explode('</dd>', $info_time[1]);
                                        $info_tt = explode('NỘI DUNG PHIM</span></div>', $info_url_html);
                                        $info_tt = explode('<span>Tags:</span>', $info_tt[1]);
                                        $info_tag = get_ascii($info_name[0] . ", " . $info_name_en[0]);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        $info_tag = get_ascii($info_name[0] . ", " . $info_name_en[0]) . ", Phim " . $info_name[0] . ", Phim " . $info_name_en[0] . ", " . $info_name[0] . " vietsub" . ", " . $info_name_en[0] . " vietsub";
        $phimid = $_GET['phimid'];
        if (!$phimid) {
            $phimid = 0;
        } else {
            ?>
		    <script type="text/javascript">$(document).ready(function () {$('#addfilm_new').hide();});</script>
		    <?php 
        }
        $begin = $_POST['episode_begin'];
        $end = $_POST['episode_end'];
        ////BEGIN CHECK EPISODE
        if (!is_numeric($begin) && !is_numeric($end)) {
            $episode_begin = 1;
            $episode_end = $total_plays;
        } elseif (!is_numeric($begin) && !is_numeric($end)) {
            $episode_begin = 1;
            $episode_end = 10;
        } elseif (!is_numeric($begin)) {
            $episode_begin = $episode_end = $end;
        } else {
            $episode_begin = $begin;
            $episode_end = $end;
        }
        ////END CHECK EPISODE
        if (!$_POST['last-submit']) {
            ?>
				<form name="themeform" enctype="multipart/form-data" method="post"  class="gnarty-grab">
			                    <!-- thong tin bo phim -->
			                    <h1 style="padding: 16px 0px 16px 0px;">Thêm tập phim vào phim có sắn</h1>
			                    <div class="form_item">
										<label>Chọn phim:</label>
										<?php 
            echo gnarty_acp_film($phimid);
            ?>
								</div>
			                    
			                    <div id="addfilm_new">
			                        <h1 style="padding: 16px 0px 16px 0px;">Thêm phim mới</h1>
			                    <div class="form_item">
			                                <label>Tên bộ phim:</label>
			                                <input type="text" class="flat" size="30" name="tenphim" value="<?php 
            echo htmltxt($info_name[0]);
            ?>
"  maxlength="250">
			                        </div>
			                        <div class="form_item">
                                <label>Tên tiếng anh:</label>
                                <input class="flat" size="30" name="tentienganh" value="<?php 
            echo htmltxt($info_name_en[0]);
            ?>
"  maxlength="250">
                        </div>
			                        
			                        <div class="form_item">
			                                <label>Đạo diễn:</label>
			                                <input type="text" class="flat" size="30" name="daodien" value="<?php 
            echo htmltxt($info_daodien[0]);
            ?>
" maxlength="250">
			                        </div>
			                        <div class="form_item">
			                                <label>Diễn viên:</label>
			                                <input type="text" class="flat" size="30" name="dienvien" value="<?php 
            echo htmltxt($info_dienvien[0]);
            ?>
" maxlength="250">
			                        </div>
			                        
			                        <div class="form_item">
			                                <label>Thời lượng:</label>
			                                <input class="flat" size="30" name="thoiluong" value="<?php 
            echo htmltxt($info_time[0]);
            ?>
" maxlength="250">
			                        </div>
			                        <div class="form_item">
			                                <label>Năm sản xuất:</label>
			                                <input class="flat" size="30" name="namsanxuat" value="<?php 
            echo htmltxt($info_nam[0]);
            ?>
" maxlength="250">
			                        </div>
			                        <div class="form_item">
			                                <label>Chất lượng:</label>
			                                <input class="flat" size="30" name="chatluong" value="HD" maxlength="250">
			                        </div>
			                       <div class="form_item">
										<label>Ảnh </label>
		                                <input value="<?php 
            echo $info_img[0];
            ?>
" id="phimimg_name" name="phimimg_name" type="text" />
		                                <img width="120" height="180" src="<?php 
            echo $info_img[0];
            ?>
" alt="" />
		                        </div>

			                        <table cellpadding="0" cellspacing="0" width="100%">
			                        	<!--
			                        <tr>
			                            <td class="form_item" width="180">Thể loại:</td>
			                            <td class="form_item"><?php 
            //echo ipos_category($theloai);
            ?>
</td>
			                        </tr>-->
			                        </table>
			                        <div class="form_item">
			                                <label>Giới thiệu phim:</label>
			                                <textarea name="phimtxt" style="width:630px; height: 130px;"><?php 
            echo htmltxt($info_tt[0]);
            ?>
</textarea>
			                        </div>
			                        <div class="form_item">
			                                <label>Từ khóa tìm kiếm:</label>
			                                <textarea name="phimtag" style="width:630px; height: 70px;"><?php 
            echo htmltxt($info_tag);
            ?>
</textarea>
			                        </div>
			                    </div>
			                    <?php 
            if (isset($url_play)) {
                ?>
			                    	<div class="form_item">
			                        	<strong>Link debug (cho dễ xem số tập)</strong>
			                        	<pre><?php 
                print_r($url_play);
                ?>
</pre>
			                        </div>
			                    <?php 
            }
            ?>
			                    <!--
			                   <div class="form_item">
			                                <label>Server chưa phim:</label>
			                               	<?php 
            // echo ipos_set_type();
            ?>
			                    </div>-->
			                    <table cellpadding="0" cellspacing="0" width="100%">
			                    <tr><td colspan="3"><h1 style="padding: 16px 0px 16px 0px;">Danh sách tập phim</h1></td></tr>
								<?php 
            if (isset($_POST['webgrab'])) {
                $from = (int) $_POST['from'];
                $to = (int) $_POST['to'];
                if (!($from == -1 && $to == -1)) {
                    $episode_begin = $from;
                    $episode_end = $to;
                }
            }
            /*
            var_dump($episode_begin);
            var_dump($episode_end);
            exit();
            */
            for ($i = $episode_begin; $i <= $episode_end; $i++) {
                if ($_POST['webgrab'] == 'phimletvn') {
                    $play_url = explode('phim-', $url_play[$i]);
                    $play_url = explode('.let" class="button">', $play_url[1]);
                    $play_url = 'http://phim.let.vn/xem-phim-' . $play_url[0] . '.let';
                    $html_link_play = xem_web($play_url);
                    $link_phim = explode('<div class="maggin_top_5"><a href="', $html_link_play);
                    $link_phim = explode('"', $link_phim[1]);
                    $link_phim = $link_phim[0];
                    $play_embed[$i] = $link_phim;
                    $name = explode('class="button"><span>', $url_play[$i]);
                    $name = explode('</span></a>', $name[1]);
                } else {
                    if ($_POST['webgrab'] == 'tvphimhd') {
                        $num = $i - 1;
                        $play_url = explode(';', $s[$num]);
                        $play_embed[$i] = trim($play_url[1]);
                        $name[0] = trim($play_url[0]);
                    } else {
                        if ($_POST['webgrab'] == 'xemphimfullhd') {
                            $name[0] = explode_by('">', '</a>', $url_play[$i], true);
                            $link_m = explode_by('href="', '"', $url_play[$i], true);
                            $link_m = str_replace("http://xemphimfullhd.com/", "http://m.xemphimfullhd.com/", $link_m);
                            $html_link = curl_by($link_m);
                            $link_m = explode_by('http://xemphimfullhd.com/play.php?url=', "'", $html_link, false);
                            if (!$link_m) {
                                $link_m = explode_by('?file=', "'", $html_link);
                            }
                            $play_embed[$i] = $link_m;
                        } else {
                            if ($_POST['webgrab'] == 'phim1k') {
                                $name[0] = explode_by('class="">', '</a>', $url_play[$i], true);
                                $link_m = "http://phim1k.net" . explode_by('href="', '"', $url_play[$i], false);
                                $html_link = curl_by($link_m);
                                $link_m = explode_by('proxy.link=', "&", $html_link, false);
                                if (!$link_m) {
                                    $idytb = explode_by('allowfullscreen="" src="', '&', $html_link, false);
                                    $idytb = explode_by('embed/', '?s', $idytb, false);
                                    if ($idytb) {
                                        $link_m = "http://www.youtube.com/v/{$idytb}";
                                    } else {
                                        $link_m = explode_by('<embed src="', '"', $html_link);
                                    }
                                }
                                $play_embed[$i] = $link_m;
                            } elseif ($_POST['webgrab'] == 'phim14') {
                                $name[0] = explode_by('">', '</a>', $url_play[$i], true);
                                $link_m = explode_by('href="', '"', $url_play[$i], false);
                                $html_link = curl_by(str_replace("phim14.net", "m.phim14.net", $link_m));
                                $link_m = explode_by('vantoan|||', ".mp4", $html_link, false);
                                $link_m = base64_decode($link_m);
                                $play_embed[$i] = $link_m;
                            } elseif ($_POST['webgrab'] == 'phim85') {
                                $play_url = explode('phim', $url_play[$i]);
                                $play_url = explode('">', $play_url[1]);
                                $play_url = 'http://www.phim85.com/xem-phim' . $play_url[0];
                                $html_link_play = xem_web($play_url);
                                $link_phim = explode('proxy.link=', $html_link_play);
                                $link_phim = explode('&', $link_phim[1]);
                                $link_phim = $link_phim[0];
                                $html_link_play_2 = xem_web($url_play_html_phim);
                                $link_phim_2 = explode('proxy.link=', $html_link_play_2);
                                $link_phim_2 = explode('&', $link_phim_2[1]);
                                $link_phim_2 = $link_phim_2[0];
                                if ($i == 1) {
                                    $play_embed[$i] = $link_phim_2;
                                    $name = explode('"><font color="#00FF00">[', $url_play[$i]);
                                    $name = explode(']</font>', $name[1]);
                                } else {
                                    $play_embed[$i] = $link_phim;
                                    $name = explode('.html"><b>', $url_play[$i]);
                                    $name = explode('</b></a>', $name[1]);
                                }
                            } elseif ($_POST['webgrab'] == 'phim8') {
                                $play_url = explode('phim/', $url_play[$i]);
                                $play_url = explode('">', $play_url[1]);
                                $play_url = 'http://phim8.info/xem-phim/' . $play_url[0];
                                $html_link_play = xem_web($play_url);
                                $link_phim = explode('proxy.link=', $html_link_play);
                                $link_phim = explode('&', $link_phim[1]);
                                $link_phim = $link_phim[0];
                                $html_link_play_2 = xem_web($url_play_html_phim);
                                $link_phim_2 = explode('proxy.link=', $html_link_play_2);
                                $link_phim_2 = explode('&', $link_phim_2[1]);
                                $link_phim_2 = $link_phim_2[0];
                                if ($i == 1) {
                                    $play_embed[$i] = $link_phim_2;
                                    $name = explode('<font color="#00FF00">[', $url_play[$i]);
                                    $name = explode(']</font>', $name[1]);
                                } else {
                                    $play_embed[$i] = $link_phim;
                                    $name = explode('.html"><b>', $url_play[$i]);
                                    $name = explode('</b></a>', $name[1]);
                                }
                            } else {
                                if ($_POST['webgrab'] == 'animefc') {
                                    $name[0] = explode_by('">', '</a>', $url_play[$i], true);
                                    $link = explode('"', $url_play[$i]);
                                    $html_link = xem_web($link[0]);
                                    $linkphim = explode('"proxy.link":"', $html_link);
                                    $linkphim = explode('"', $linkphim[1]);
                                    $play_embed[$i] = $linkphim[0];
                                } elseif ($_POST['webgrab'] == 'congdongvip') {
                                    $play_url = explode('(', $url_play[$i]);
                                    $play_url = explode(',', $play_url[1]);
                                    $play_url = 'http://phim.congdongvip.com/xml/' . $play_url[0] . '.xml';
                                    $html_link_play = xem_web($play_url);
                                    $link_phim = explode('<location>', $html_link_play);
                                    $link_phim = explode('</location>', $link_phim[1]);
                                    $link_phim = $link_phim[0];
                                    $play_embed[$i] = $link_phim;
                                    $name_play = explode('<title>', $html_link_play);
                                    $name = explode('</title>', $name_play[1]);
                                } elseif ($_POST['webgrab'] == 'phimkk') {
                                    $name[0] = explode_by('html">', '</a>', $url_play[$i], false);
                                    //exit('aaaaa' . $url_play[$i]);exit();
                                    $name[0] = strip_tags($name[0]);
                                    $name[0] = str_replace(array('[', ']'), '', $name[0]);
                                    $link_m = 'http://phimkk.com/' . str_replace(' ', '%20', explode_by('href="', '"', $url_play[$i], false));
                                    $html_link = curl_by($link_m);
                                    $play_embed[$i] = explode_by('&file=', "&amp;", $html_link, false);
                                    if (empty($play_embed[$i])) {
                                        $url = explode_by('<div id="mediaplayer"', '</div>', $html_link, false);
                                        $play_embed[$i] = explode_by('src=\'', '\'', $url, false);
                                    }
                                } elseif ($_POST['webgrab'] == 'phimbb') {
                                    $name[0] = explode_by('html">', '</a>', $url_play[$i], false);
                                    //exit('aaaaa' . $url_play[$i]);exit();
                                    $name[0] = strip_tags($name[0]);
                                    $name[0] = str_replace(array('[', ']'), '', $name[0]);
                                    $link_m = 'http://phimbb.net/' . str_replace(' ', '%20', explode_by('href="', '"', $url_play[$i], false));
                                    $html_link = curl_by($link_m);
                                    $play_embed[$i] = explode_by('&file=', "&amp;", $html_link, false);
                                    if (empty($play_embed[$i])) {
                                        $url = explode_by('<div id="mediaplayer"', '</div>', $html_link, false);
                                        $play_embed[$i] = explode_by('src=\'', '\'', $url, false);
                                    }
                                }
                            }
                        }
                    }
                }
                $sub = htmlchars(stripslashes(trim(urldecode($sub))));
                $is_sub = preg_match("#no_sub([^/]+)#", $sub);
                if ($is_sub) {
                    $linksub = '';
                } else {
                    $linksub = $sub;
                }
                $play_embed[$i] = htmlchars(stripslashes(trim(urldecode($play_embed[$i]))));
                ?>
			                    <tr>
			                    <td class="form_item" width="12%">
			                    TẬP <input onclick="this.select()" type="text" name="name[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $name[0];
                ?>
" size="2" style="text-align:center; width: 40px;">
			                    </td>
			                    <td class="form_item"  width="50%">
			                   
			                    <p class="url"><span>FULL</span><input type="text" name="url[<?php 
                echo $i;
                ?>
]" size="50" value="<?php 
                echo $play_embed[$i];
                ?>
"></p>
			                    </td>
			                    <td class="form_item"  width="32%">SUB <input type="text" name="sub[<?php 
                echo $i;
                ?>
]" style="width:210px;" value="<?php 
                echo $linksub;
                ?>
"></td>
			                    </tr>
			                    <?php 
            }
            ?>
			                    </table>
								<div class="form_item">
										 <input type="hidden" name="episode_begin" value="<?php 
            echo $episode_begin;
            ?>
">
			                                <input type="hidden" name="episode_end" value="<?php 
            echo $episode_end;
            ?>
">
			                                <input type="hidden" name="from" value="<?php 
            echo $from;
            ?>
">
                                			<input type="hidden" name="to" value="<?php 
            echo $to;
            ?>
">
			                                <input type="hidden" name="ok" value="SUBMIT">
											<button class="button button-primary" value="Submit" name="last-submit" type="submit">Gửi đi</button>
									</div>
								</form>
			<?php 
        }
        $currentUser = wp_get_current_user();
        //Thêm phim mới
        if ($_POST['film'] == 'dont_edit') {
            $arr = array('post_title' => $_POST['tenphim'], 'post_content' => $_POST['phimtxt'], 'post_status' => 'draft', 'post_author' => $currentUser->ID);
            $newPostID = wp_insert_post($arr);
            $linkphim = array();
            $stt = 0;
            foreach ($_POST['name'] as $k => $val) {
                if (isset($_POST['url'][$k]) && !empty($_POST['url'][$k])) {
                    $linkphim[$stt] = $val . '#' . $_POST['url'][$k] . '#' . $stt;
                    $stt++;
                }
            }
            update_post_meta($newPostID, 'phim_en', $_POST['tentienganh']);
            update_post_meta($newPostID, 'phim_tl', $_POST['thoiluong']);
            update_post_meta($newPostID, 'phim_nsx', $_POST['namsanxuat']);
            update_post_meta($newPostID, 'phim_hd', $_POST['chatluong']);
            update_post_meta($newPostID, 'Image', $_POST['phimimg_name']);
            //update tags, dien vien
            wp_set_object_terms($newPostID, explode(',', $_POST['phimtag']), 'post_tag', true);
            wp_set_object_terms($newPostID, explode(',', $_POST['dienvien']), 'dien-vien', true);
            //end update tags, dien vien
            if (check_fiml_meta($newPostID) == false) {
                add_film_meta($newPostID);
            }
            $meta_value = implode("\n", $linkphim);
            $data = explode('|', $meta_value);
            if ($meta_value != "") {
                $episode_post = implode("\n", $linkphim);
                $episode_film = $newPostID;
                $list_episode = explode("\n", $episode_post);
                $count_ep = count($list_episode);
                for ($i = 0; $i < $count_ep; $i++) {
                    $tap[$i] = explode('#', trim($list_episode[$i]));
                    $ten_tap[$i] = trim($tap[$i][0]);
                    $link_tap[$i] = trim($tap[$i][1]);
                    $thu_tu[$i] = trim($tap[$i][2]);
                    if (FilmEpisodeNewEpisode($ten_tap[$i], $newPostID, 0, $link_tap[$i], $thu_tu[$i], time())) {
                        //$tb .= $ten_tap [$i] . ' - ';
                    } else {
                        echo '<div id="message" class="error fade" style="background-color: rgb(218, 79, 33);"><br/><b>L?i ! t?p ' . $ten_tap[$i] . ' server ' . $_POST['episode_server'] . ' d� t?n t?i</b><br/><br/></div>';
                    }
                }
            }
            wp_safe_redirect(admin_url('post.php?post=' . $newPostID . '&action=edit', 'Đã thêm xong'));
        } else {
            $postID = $_POST['film'];
            $linkphim = array();
            $stt = 0;
            foreach ($_POST['name'] as $k => $val) {
                if (isset($_POST['url'][$k]) && !empty($_POST['url'][$k])) {
                    $linkphim[$stt] = $val . '#' . $_POST['url'][$k] . '#' . $stt;
                    $stt++;
                }
            }
            $from = $_POST['from'];
            $to = $_POST['to'];
            //xóa tập phim cũ
            if ($from == -1 && $to == -1) {
                $wpdb->delete($wpdb->prefix . 'film_episode', array('episode_film' => $postID));
            }
            if (check_fiml_meta($postID) == false) {
                add_film_meta($postID);
            }
            $meta_value = implode("\n", $linkphim);
            $data = explode('|', $meta_value);
            if ($meta_value != "") {
                $episode_post = implode("\n", $linkphim);
                $episode_film = $postID;
                $list_episode = explode("\n", $episode_post);
                $count_ep = count($list_episode);
                for ($i = 0; $i < $count_ep; $i++) {
                    $tap[$i] = explode('#', trim($list_episode[$i]));
                    $ten_tap[$i] = trim($tap[$i][0]);
                    $link_tap[$i] = trim($tap[$i][1]);
                    $thu_tu[$i] = trim($tap[$i][2]);
                    if (FilmEpisodeNewEpisode($ten_tap[$i], $postID, 0, $link_tap[$i], $thu_tu[$i], time())) {
                        //$tb .= $ten_tap [$i] . ' - ';
                    } else {
                        echo '<div id="message" class="error fade" style="background-color: rgb(218, 79, 33);"><br/><b>L?i ! t?p ' . $ten_tap[$i] . ' server ' . $_POST['episode_server'] . ' d� t?n t?i</b><br/><br/></div>';
                    }
                }
            }
            wp_update_post(array('ID' => $postID));
            wp_safe_redirect(admin_url('post.php?post=' . $postID . '&action=edit', 'Đã thêm xong'));
        }
        //end update link phim
    } else {
        ?>
	<form action="" method="post" class="gnarty-grab">
					<h1 style="padding: 16px 0px 16px 0px;">Grab link</h1>
					<div class="form_item">
							<label>Website:</label>
							<select name="webgrab">
									<option value="phim3s">Phim3s.net</option>
									<option value="phimletvn">Phim.Let.Vn</option>
									<option value="tvphimhd">tvphimhd.Com</option>
									<option value="xemphimfullhd">xemphimfullhd.com</option>
									<option value="phim1k">phim1k.net</option>
									<option value="phim14">phim14.net</option>	
									<option value="phimbb">phimbb.net</option>	
									<option value="phimkk">phimkk.com</option>
									<option value="phim85">phim85.com</option>	
									<option value="phim8">phim8.info</option>
									<option value="congdongvip">phim.congdongvip.com</option>
									<option value="animefc">animefc.info</option>
									
							</select>  
						</div>
					
						<div class="form_item">
							<label>Link:</label>
							<input maxlength="250" onclick="this.select()" value="Điền link vào đây" name="urlgrab" size="30" class="flat" type="text" />
						</div>
						<div class="form_item">
							<label>Get từ tập : </label>
							<input type="text" name="from" value="-1" size="5" style="width:50px;" />
						</div>
						<div class="form_item">
							<label>Đến tập : </label>
							<input type="text" name="to" value="-1" size="5" style="width:50px;" /><br />
							<i>Nếu để cả 2 ô là <strong>-1</strong> thì sẽ lấy tất cả tập phim,sau đó xóa hết các tập phim cũ và thêm mới.</i>
						</div>
 						<div class="form_item">
							<input class="button button-primary button-large" type="submit" name="ok" value="Submit" />
						</div>
	</form>
	<?php 
    }
}
Ejemplo n.º 5
0
function update_film_meta($film_id)
{
    global $wpdb;
    if ($_POST['film_drama'] != '') {
        $drama = $_POST['film_drama'];
    } else {
        $drama = '0';
    }
    $q = "UPDATE " . DATA_FILM_META . " SET \n\t\t\t\t\tfilm_thumbnail = '" . $_POST['film_thumbnail'] . "'\n\t\t\t\t\t, film_ads_img = '" . $_POST['film_ads_img'] . "'\n\t\t\t\t\t, film_decu = '" . $_POST['film_decu'] . "'\n\t\t\t\t\t, film_hot = '" . $_POST['film_hot'] . "'\n\t\t\t\t\t, film_cinema = '" . $_POST['film_cinema'] . "'\n\t\t\t\t\t, film_drama = '" . $drama . "'\n\t\t\t\t\t, film_length = '" . $_POST['film_length'] . "'\n\t\t\t\t\t, film_year = '" . $_POST['film_year'] . "'\n\t\t\t\t\t, film_hd_download = '" . $_POST['film_hd_download'] . "'\n\t\t\t\t\t, film_trailer = '" . $_POST['film_trailer'] . "'\n\t\t\t\tWHERE film_id = '" . $film_id . "'";
    $r = $wpdb->query($q);
    if ($r) {
        if ($_POST['film_thumbnail'] != '') {
            if (get_post_meta($film_id, 'vietpro_thumb', true) != '') {
                $q_post_meta = "UPDATE " . DATA_POSTMETA . " SET meta_value = '" . $_POST['film_thumbnail'] . "' \n\t\t\t\t\t\t\t\t\tWHERE post_id = '" . $film_id . "' AND  meta_key =  'vietpro_thumb'";
                $r_post_meta = $wpdb->query($q_post_meta);
            } else {
                $q_post_meta = "INSERT INTO " . DATA_POSTMETA . " (post_id, meta_key, meta_value) VALUES ('" . $film_id . "', 'vietpro_thumb', '" . $_POST['film_thumbnail'] . "')";
                $r_post_meta = $wpdb->query($q_post_meta);
            }
        }
        if ($_POST['film_episode'] != '') {
            $episode_post = $_POST['film_episode'];
            $list_episode = explode("\n", $episode_post);
            $count_ep = count($list_episode);
            for ($i = 0; $i < $count_ep; $i++) {
                $tap[$i] = explode('#', trim($list_episode[$i]));
                $ten_tap[$i] = trim($tap[$i][0]);
                $link_tap[$i] = trim($tap[$i][1]);
                $thu_tu[$i] = trim($tap[$i][2]);
                if ($link_tap[$i] != '' && $ten_tap[$i] != '') {
                    FilmEpisodeNewEpisode($ten_tap[$i], $film_id, $_POST['episode_server'], $link_tap[$i], $thu_tu[$i], time());
                }
            }
        }
        return "Cập nhật film meta thành công";
    } else {
        return "Éo Cập nhật dc film meta";
    }
}
Ejemplo n.º 6
0
function FilmEpisodeMenu()
{
    global $wpdb;
    $film_list = GetFilmToSelectBox();
    $server_list = GetServerToSelectBox();
    isset($_GET['acc']) ? $_acc = $_GET['acc'] : ($_acc = "showEpisode");
    if ($_POST['episode_name'] != "" || $_POST['episode_info'] != "" || $_POST['edit_multi_ep'] != '') {
        if ($_POST['episode_id'] != "") {
            if (FilmEpisodeUpdateEpisode($_POST['episode_id'], $_POST['episode_name'], $_POST['film_episode'], $_POST['episode_server'], $_POST['episode_url'], $_POST['episode_order'], time())) {
                echo '<div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"><b><br/>Cập nhật thành công!</b><br/><br/></div>';
            }
            $_acc = "showEpisode";
        } elseif ($_POST['edit_multi_ep'] == '1') {
            $arr = $_POST['chkName'];
            $in_sql = implode(',', $arr);
            $query = "UPDATE " . DATA_FILM_EPISODE . " \n\t\t\t\tset `episode_film` = '" . mysql_real_escape_string($_POST['film_episode']) . "' ,\n\t\t\t\t\t`episode_server` = '" . mysql_real_escape_string($_POST['episode_server']) . "' \n\t\t\t\twhere episode_id IN(" . $in_sql . ")";
            $wpdb->query($query);
            echo '<div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"><b><br/>Cập nhật thành công!</b><br/><br/></div>';
        } elseif ($_POST['multipostep'] != "") {
            $episode_post = $_POST['episode_info'];
            $list_episode = explode("\n", $episode_post);
            $count_ep = count($list_episode);
            for ($i = 0; $i < $count_ep; $i++) {
                $tap[$i] = explode('#', trim($list_episode[$i]));
                $ten_tap[$i] = trim($tap[$i][0]);
                $link_tap[$i] = trim($tap[$i][1]);
                $thu_tu[$i] = trim($tap[$i][2]);
                if (FilmEpisodeNewEpisode($ten_tap[$i], $_POST['film_episode'], $_POST['episode_server'], $link_tap[$i], $thu_tu[$i], time())) {
                    $tb .= $ten_tap[$i] . ' - ';
                } else {
                    echo '<div id="message" class="error fade" style="background-color: rgb(218, 79, 33);"><br/><b>Lỗi ! tập ' . $ten_tap[$i] . ' server ' . $_POST['episode_server'] . ' đã tồn tại</b><br/><br/></div>';
                }
            }
            echo '<div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"><b><br/>Các Tập ' . $tb . ' được thêm thành công !</b><br/><br/></div>';
            $_acc = "addEpisode";
        } elseif ($_POST['multipostep2'] != "") {
            $meta_value = $_POST['episode_info'];
            $data = explode('|', $meta_value);
            foreach ($data as $value) {
                $value = explode(';', $value);
                $url = stripslashes($value[1]);
                $type = acp_type($value[1]);
                if (FilmEpisodeNewEpisode($value[0], $_POST['film_episode'], $_POST['episode_server'], $url, '', time())) {
                }
            }
        } else {
            if (FilmEpisodeNewEpisode($_POST['episode_name'], $_POST['film_episode'], $_POST['episode_server'], $_POST['episode_url'], $_POST['episode_order'], time())) {
                echo '<div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"><b><br/>Thêm tập phim mới thành công!</b><br/><br/></div>';
            } else {
                echo '<div id="message" class="error fade" style="background-color: rgb(218, 79, 33);"><br/><b>Lỗi ! Tập phim đã tồn tại</b><br/><br/></div>';
            }
            $_acc = "addEpisode";
        }
    } else {
        if ($_GET['acc'] == "del") {
            FilmEpisodeDeleteEpisode($_GET['episode_id']);
            echo '<br><div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"> <br/>Xóa tập phim thành công!<br/><br/></div>';
            $_acc = "showEpisode";
        } else {
            if ($_GET['acc'] == "delBD") {
                //FilmEpisodeDeleteBD();
                echo '<br><div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"> <br/>Hiện tại không cho phép xóa DB Episode<br/><br/></div>';
                $_acc = "dataBase";
            } else {
                if ($_GET['acc'] == "fixed") {
                    FilmEpisodeFixError($_GET['episode_id']);
                    echo '<br><div id="message" class="updated fade" style="background-color: rgb(255, 251, 204);"> <br/>Sửa lỗi thành công<br/><br/></div>';
                    echo '<meta http-equiv="Refresh" Content="1; url=' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&orderBy=episode_broken&order=asc">';
                    $_acc = "showEpisode";
                }
            }
        }
    }
    echo '<div class="wrap">
		<h2>Danh sách tất cả các tập phim</h2>';
    echo '<ul class="subsubsub">	
		<li><a class="button" href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode">Danh sách Episode</a></li>
		<li><a class="button" href="' . $PHP_SELF . '?page=film_episode.php&acc=addEpisode">Thêm Episode</a></li>
		<li><a class="button" href="' . $PHP_SELF . '?page=film_episode.php&acc=addMultiEpisode">Thêm nhiều Episode</a></li>
		<li><a class="button" href="' . $PHP_SELF . '?page=film_episode.php&acc=addMultiEpisode2">Thêm Episode</a></li>
		<li><a class="button" href="' . $PHP_SELF . '?page=film_episode.php&acc=dataBase">Database</a></li>
	</ul>	
	<br/>
	<br/>
	<hr/>
	<div>
	<div style="float:left; width:40%;"> <b>Tìm kiếm:</b><br/>
	<div>
	Nhập Ep ID:
		<form action="' . $PHP_SELF . '?page=film_episode.php&acc=search" method="post" name="sepid">
			<input name="epid" value=""/> <input name="epsubmit" value="Tìm" type="submit" class="button"/>
		</form><br/>
	Hoặc xem danh sách tập phim của: <br/>
		<form action="' . $PHP_SELF . '?page=film_episode.php&acc=search" method="post" name="svandfilm">
			Chọn phim: ' . $film_list . ' <br/>
			
			<input name="svsubmit" value="Tìm" type="submit" class="button"/>
		</form><br/>
	</div>
	<script>
	function deleteLink(episode_id){
		var opc = confirm("Bạn muốn xóa tập phim này ?");
		if (opc==true) window.location.href="' . $PHP_SELF . '?page=film_episode.php&acc=del&episode_id="+episode_id;
	}
	</script>
	<br/></div>
	<div style="float:left; width:55%">
	<b>Hướng dẫn post tập phim:</b><br/>
	Với mỗi server phim thì ID post (Episode URL) có dạng khác nhau (Phần chữ đỏ):<br/>
	
	<b>- Youtube:</b> Link dạng http://www.youtube.com/watch?v=<span style="color:#ff0000;">CbGxVcC3EZE</span><br/>
	<b>- Googlevideo:</b> http://video.google.com/googleplayer.swf?docId=<span style="color:#ff0000;">-5807528166426334307</span><br/>
	<b>- Go.vn:</b> http://content.go.vn/may-tinh/chi-tiet/<span style="color:#ff0000;">thu-gian-cuoi-tuan-hoi-xoay-dap-xoay-23072011-24229</span>.htm<br/>
	<b>- cyworld.vn:</b> http://kine.cyworld.vn/detail/12000984119/1725  -> <span style="color:#ff0000;">12000984119/post/1725</span><br/>
	<b>- 4shared.com</b> http://www.4shared.com/get/<span style="color:#ff0000;">Fjy78IUO</span>/Very_Funny_Cats_31-__.html hoặc lấy trong embed <span style="color:#ff0000;">436592759/9266a2e8</span> <br/>
	<b>- Dailymotion:</b> http://www.dailymotion.com/video/<span style="color:#ff0000;">x1bgid</span>_tom-jerry-jerry-and-the-lion_people<br/>
	<b>- Veoh:</b> http://www.veoh.com/watch/<span style="color:#ff0000;">v6434084aKzQBMKs</span><br/>
	<b>- Megavideo:</b> http://www.megavideo.com/v/<span style="color:#ff0000;">YAQ86O7K3a778f6f8355a1760698d05219ac9e78</span><br/>
	</div>
	<div style="clear:both"></div>
	</div>
	<hr/>
';
    if ($_acc == "search") {
        if (isset($_POST['epid'])) {
            echo "Vui lòng chờ trong giây lát";
            echo '<meta http-equiv="Refresh" Content="1; url=' . $PHP_SELF . '?page=film_episode.php&acc=edit&episode_id=' . $_POST['epid'] . '">';
        } elseif (isset($_POST['film_episode'])) {
            $film_list = GetFilmToSelectBox($_POST['film_episode']);
            $server_list = GetServerToSelectBox($_POST['episode_server']);
            echo ' 
	 <h3>Các tập phim search</h3>
	 <script>
var fieldName="chkName[]";

function selectall(){
  var i=document.frm.elements.length;
  var e=document.frm.elements;
  var name=new Array();
  var value=new Array();
  var j=0;
  for(var k=0;k<i;k++)
  {
    if(document.frm.elements[k].name==fieldName)
    {
      if(document.frm.elements[k].checked==true){
        value[j]=document.frm.elements[k].value;
        j++;
      }
    }
  }
  checkSelect();
}
function selectCheck(obj)
{
 var i=document.frm.elements.length;
  for(var k=0;k<i;k++)
  {
    if(document.frm.elements[k].name==fieldName)
    {
      document.frm.elements[k].checked=obj;
    }
  }
  selectall();
}

function selectallMe()
{
  if(document.frm.allCheck.checked==true)
  {
   selectCheck(true);
  }
  else
  {
    selectCheck(false);
  }
}
function checkSelect()
{
 var i=document.frm.elements.length;
 var berror=true;
  for(var k=0;k<i;k++)
  {
    if(document.frm.elements[k].name==fieldName)
    {
      if(document.frm.elements[k].checked==false)
      {
        berror=false;
        break;
      }
    }
  }
  if(berror==false)
  {
    document.frm.allCheck.checked=false;
  }
  else
  {
    document.frm.allCheck.checked=true;
  }
}
</script>
	 <form name="frm" action="" method="post">
	 <input name="edit_multi_ep" value="1" type="hidden"/>
	 <table class="widefat">
		<thead>
			<tr>
				<th><input type="checkbox" name="allCheck" onClick="selectallMe();"> Chọn tất cả</th>
				<th scope="col">Tập phim (<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_id&order=asc">Cũ</a>|<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_id&order=desc">Mới</a>)</th>
				<th scope="col">Phim</th>
				<th scope="col">Server(<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_server&order=asc">+</a>|<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_server&order=desc">-</a>)</th>
				<th scope="col">URL</th>
				<th scope="col">Ngày đăng</th>
				<th scope="col">Thứ tự tập(<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_order&order=asc">+</a>|<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_order&order=desc">-</a>)</th>
				<th scope="col">Báo lỗi (<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_broken&order=asc">Ko</a>|<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_broken&order=desc">Lỗi</a>)</th>
				<th scope="col">Edit</th>
				<th scope="col">Delete</th>
			</tr>
		</thead>
				';
            if ($_GET['orderBy'] == "") {
                $_GET['orderBy'] = "episode_id";
            }
            if ($_GET['order'] == "") {
                $_GET['order'] = "desc";
            }
            $p = $_GET['p'];
            FilmEpisodeGetEpisode($_POST['film_episode'], $_POST['episode_server'], $_GET['orderBy'], $_GET['order'], $p, 500);
            echo '
		</table>
		Chọn phim: ' . $film_list . ' <br/>
		
		<input name="editmultiep" value="Cập nhật" type="submit" class="button"/>
		</form>

</div>';
        }
    } elseif ($_acc == "addEpisode") {
        if (FilmEpisodeInfoDB() == false) {
            echo "<br/><b>Dữ liệu và database tập phim đã bị xóa</b>! Bạn cần active lại plugin trước khi thêm tập phim mới.";
        } else {
            echo '<h3>Thêm Episode</h3>
	<form method="post" action ="">
		<table class="form-table">
			<tbody>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Episode name</label>
					</th>
					<td>
						<input type="text" name="episode_name" />
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Phim</label>
					</th>
					<td>
						' . $film_list . '
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Episode Url</label>
					</th>
					<td>
						<input type="text" name="episode_url"/>
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Episode order</label>
					</th>
					<td>
						<input type="text" name="episode_order"/>
					</td>
				</tr>
			</tbody>
		</table>
		<p class="submit"><input type="submit" name="FilmEpisode" value="Thêm tập phim" /></p>
	</form>';
        }
    } elseif ($_acc == "addMultiEpisode") {
        $film_list = GetFilmToSelectBox();
        $server_list = GetServerToSelectBox();
        if (FilmEpisodeInfoDB() == false) {
            echo "<br/><b>Dữ liệu và database tập phim đã bị xóa</b>! Bạn cần active lại plugin trước khi thêm tập phim mới.";
        } else {
            echo '<h3>Thêm nhiều Episode</h3>
	Nhập tập bắt đầu:
	<input name="start" value="" id="ep_start"/><br/>
	Nhập tập kết thúc
	<input name="end" value="" id="ep_end"/><br/>
	<input type="submit" class="nhap_ep" value="nhập"/>
	<form method="post" action ="">
		<table class="form-table">
			<tbody>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Episode info</label>
					</th>
					<td>
						<input type="hidden" name="multipostep" value="1"/>
						<textarea name="episode_info" style="width:500px; height:150px;" id="multi_ep"></textarea>
						<p>
							(Mỗi tên tập, link, thứ tự ưu tiên viết cách nhau bởi dấu thăng (#), mỗi link ở một dòng.)<br/>
							Ví dụ: <br/>
							Tập 1#link1#1<br/>
							Tập 2#link2#2
						</p>
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Phim</label>
					</th>
					<td>
						' . $film_list . '
					</td>
				</tr>
				
			</tbody>
		</table>
		<p class="submit"><input type="submit" name="FilmEpisode" value="Thêm tập phim" /></p>
	</form>
	<script type="text/javascript">
	var $j = jQuery.noConflict();
	$j(function(){
	
	    $j(".nhap_ep").click(function(){
			var i,cont;
			var ep_start = parseInt($j("#ep_start").attr("value"));
			var ep_end = parseInt($j("#ep_end").attr("value")) + 1;
			for (i=ep_start;i<ep_end;i++) {
				var areaValue = $j("#multi_ep").val();
				if(i==(ep_end -1)) {
					$j("#multi_ep").val(areaValue+i+"##"+i);
				} else {
					$j("#multi_ep").val(areaValue+i+"##"+i+"\\n");
				}
				
			}
				
		});
	
	});
</script>
	';
        }
    } elseif ($_acc == "addMultiEpisode2") {
        $film_list = GetFilmToSelectBox();
        $server_list = GetServerToSelectBox();
        if (FilmEpisodeInfoDB() == false) {
            echo "<br/><b>Dữ liệu và database tập phim đã bị xóa</b>! Bạn cần active lại plugin trước khi thêm tập phim mới.";
        } else {
            echo '<h3>Thêm nhiều Episode kiểu blogspot</h3>
	<form method="post" action ="">
		<table class="form-table">
			<tbody>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Episode info</label>
					</th>
					<td>
					<input type="hidden" name="multipostep2" value="1"/>
						<input type="text" name="episode_info" value="" style="width:400px"/>
						
						<p>
							(viết theo mẫu dưới)<br/>
							teentap1;linktap|tentap2;link2|....|tentapn;linkn
							Ví dụ: <br/>
							Tập 1#link1#1<br/>
							1;http://www.youtube.com/watch?v=kAd78piJ_WU|2;http://www.youtube.com/watch?v=tT_AvKl73qY|3;http://www.youtube.com/watch?v=HsqMhiSBDes
						</p>
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Phim</label>
					</th>
					<td>
						' . $film_list . '
					</td>
				</tr>
				
			</tbody>
		</table>
		<p class="submit"><input type="submit" name="FilmEpisode" value="Thêm tập phim" /></p>
	</form>
	';
        }
    } else {
        if ($_acc == "edit") {
            if (FilmEpisodeInfoDB() == false) {
                echo "<br/><b>Dữ liệu và database tập phim đã bị xóa</b>! Bạn cần active lại plugin trước khi thêm tập phim mới.";
            } else {
                $episode_id = $_GET['episode_id'];
                $q = "select * from " . DATA_FILM_EPISODE . " WHERE episode_id = '" . $episode_id . "'";
                $row = $wpdb->get_results($q);
                foreach ($row as $r) {
                    $episode_name = $r->episode_name;
                    $episode_film = $r->episode_film;
                    $episode_url = $r->episode_url;
                    $episode_server = $r->episode_server;
                    $episode_time = $r->episode_time;
                    $episode_order = $r->episode_order;
                    $episode_broken = $r->episode_broken;
                    $film_list = GetFilmToSelectBox($episode_film);
                    $server_list = GetServerToSelectBox($episode_server);
                    echo '<h3>Sửa tập phim</h3>

	<fieldset>

	<form method="post" action ="">
		<table class="form-table">
			<tbody>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Episode name</label>
					</th>
					<td>
						<input type="hidden" name="episode_id" value="' . $episode_id . '" />	
						<input type="text" value="' . $episode_name . '" name="episode_name" />
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Phim</label>
					</th>
					<td>
						' . $film_list . '
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Episode Url</label>
					</th>
					<td>
						<input type="text" name="episode_url" value="' . $episode_url . '"/>
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">
						<label for="default_post_edit_rows"> Episode order</label>
					</th>
					<td>
						<input type="text" name="episode_order" value="' . $episode_order . '"/>
					</td>
				</tr>
			</tbody>
		</table>

		<p class="submit"><input type="submit" name="FilmEpisode" value="Cập nhật" /></p>
	</form>
	</fieldset>';
                }
            }
        } else {
            if ($_acc == "showEpisode") {
                if (FilmEpisodeInfoDB() == false) {
                    echo "<br/><b>Dữ liệu và database tập phim đã bị xóa</b>! Bạn cần active lại plugin trước khi thêm tập phim mới.";
                } else {
                    echo ' 
	 <h3>Các tập phim search</h3>
	 <script>
var fieldName="chkName[]";

function selectall(){
  var i=document.frm.elements.length;
  var e=document.frm.elements;
  var name=new Array();
  var value=new Array();
  var j=0;
  for(var k=0;k<i;k++)
  {
    if(document.frm.elements[k].name==fieldName)
    {
      if(document.frm.elements[k].checked==true){
        value[j]=document.frm.elements[k].value;
        j++;
      }
    }
  }
  checkSelect();
}
function selectCheck(obj)
{
 var i=document.frm.elements.length;
  for(var k=0;k<i;k++)
  {
    if(document.frm.elements[k].name==fieldName)
    {
      document.frm.elements[k].checked=obj;
    }
  }
  selectall();
}

function selectallMe()
{
  if(document.frm.allCheck.checked==true)
  {
   selectCheck(true);
  }
  else
  {
    selectCheck(false);
  }
}
function checkSelect()
{
 var i=document.frm.elements.length;
 var berror=true;
  for(var k=0;k<i;k++)
  {
    if(document.frm.elements[k].name==fieldName)
    {
      if(document.frm.elements[k].checked==false)
      {
        berror=false;
        break;
      }
    }
  }
  if(berror==false)
  {
    document.frm.allCheck.checked=false;
  }
  else
  {
    document.frm.allCheck.checked=true;
  }
}
</script>
	 <form name="frm" action="" method="post">
	 <input name="edit_multi_ep" value="1" type="hidden"/>
	 <table class="widefat">
		<thead>
			<tr>
				<th><input type="checkbox" name="allCheck" onClick="selectallMe();"> Chọn tất cả</th>
				<th scope="col">Tập phim (<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_id&order=asc">Cũ</a>|<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_id&order=desc">Mới</a>)</th>
				<th scope="col">Phim</th>
				<th scope="col">Server(<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_server&order=asc">+</a>|<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_server&order=desc">-</a>)</th>
				<th scope="col">URL</th>
				<th scope="col">Ngày đăng</th>
				<th scope="col">Thứ tự tập(<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_order&order=asc">+</a>|<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_order&order=desc">-</a>)</th>
				<th scope="col">Báo lỗi (<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_broken&order=asc">Ko</a>|<a href="' . $PHP_SELF . '?page=film_episode.php&acc=showEpisode&film=' . $_GET['film'] . '&orderBy=episode_broken&order=desc">Lỗi</a>)</th>
				<th scope="col">Edit</th>
				<th scope="col">Delete</th>
			</tr>
		</thead>
				';
                    if ($_GET['orderBy'] == "") {
                        $_GET['orderBy'] = "episode_id";
                    }
                    if ($_GET['order'] == "") {
                        $_GET['order'] = "desc";
                    }
                    $p = $_GET['p'];
                    FilmEpisodeGetEpisode($_GET['film'], $_GET['server'], $_GET['orderBy'], $_GET['order'], $p, 50);
                    echo '
		</table>

</div>';
                }
            } else {
                if ($_acc == "dataBase") {
                    if (FilmEpisodeInfoDB() == false) {
                        echo "<br/><b>Dữ liệu và database episode phim đã bị xóa</b>! Bạn cần active lại plugin trước khi thêm hoặc sửa tập phim mới.";
                    } else {
                        echo '<h3>Dữ liệu</h3>
		  Bạn không được phép xóa toàn bộ dữ  liệu các tập phim. 
		  Nếu thấy thật sự cần thiết khi gỡ plugin này và muốn xóa bạn có thể <b><a href="' . $PHP_SELF . '?page=film_episode.php&acc=delBD">click here</a></b> để xóa toàn bộ và deactive plugin<br>Manhtienpt<br>';
                    }
                }
            }
        }
    }
}