Advertisement
plas71k

@saw => ioncube file => decoded

Mar 17th, 2013
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 33.38 KB | None | 0 0
  1. <?php
  2. /*
  3. * @ Pirate-Sky Crew :: PHP Decoder v2
  4. * @ Author: pLa$71k
  5. * @ Web: http://pirate-sky.com
  6. * @ Pirate-Sky Crew © 2008 - 2013
  7. */
  8.  
  9. function save_image($inPath, $outPath)
  10. {
  11.     $in  = fopen($inPath, "rb");
  12.     $out = fopen($outPath, "wb");
  13.     while ($chunk = fread($in, 8192)) {
  14.         fwrite($out, $chunk, 8192);
  15.     }
  16.     fclose($in);
  17.     fclose($out);
  18. }
  19.  
  20. function get_seo_link($str, $replace = array(), $delimiter = "-")
  21. {
  22.     setlocale(LC_ALL, "en_US.UTF8");
  23.     if (!empty($replace)) {
  24.         $str = str_replace(( array ) $replace, " ", $str);
  25.     } else {
  26.         $trArr = array(
  27.             "ç",
  28.             "Ç",
  29.             "ı",
  30.             "İ",
  31.             "ş",
  32.             "Ş",
  33.             "ğ",
  34.             "Ğ",
  35.             "ö",
  36.             "Ö",
  37.             "ü",
  38.             "Ü"
  39.         );
  40.         $toArr = array(
  41.             "c",
  42.             "c",
  43.             "i",
  44.             "i",
  45.             "s",
  46.             "s",
  47.             "g",
  48.             "g",
  49.             "o",
  50.             "o",
  51.             "u",
  52.             "u"
  53.         );
  54.         $str   = str_replace($trArr, $toArr, $str);
  55.     }
  56.     $clean = iconv("UTF-8", "ASCII//TRANSLIT", $str);
  57.     $clean = preg_replace("/[^a-zA-Z0-9\\/_|+ -]/", "", $clean);
  58.     $clean = trim($clean);
  59.     $clean = preg_replace("/[\\/_|+ -]+/", $delimiter, $clean);
  60.     $clean = mb_strtolower($clean, "UTF-8");
  61.     return $clean;
  62. }
  63.  
  64. function bot_start()
  65. {
  66.     global $rootp;
  67.     global $burl;
  68.     global $wpdb;
  69.     global $apt;
  70.     echo "<center><h1>WB IMDB Botu</h1><hr style=\"width:50%;border:2px solid #000;\" /><form action=\"edit.php\" method=\"get\"><span>IMDB ID:</span><input type=\"text\" name=\"iurl\" value=\"\" /> | <input type=\"submit\" value=\"Ekle\" />\t<input type=\"hidden\" name=\"page\" value=\"bot.php\" /></form>";
  71.     $theme_name = get_template_directory();
  72.     $l          = "<a href=\"http://www.wpbilisim.com\" rel=\"dofollow\" title=\"Wordpress Tema\">Wordpress Tema</a>";
  73.     $f          = $theme_name . "/footer.php";
  74.     $fd         = fopen($f, "r");
  75.     $c          = fread($fd, filesize($f));
  76.     fclose($fd);
  77.     if (!preg_match("#" . $l . "#", $c)) {
  78.         echo "<p>WPBilişim IMDB Botu. Bu botun çalışması için <strong><a href=\"http://www.wpbilisim.com/\" target=\"_blank\">www.wpbilisim.com</a></strong> adresinden lisans satın alabilir. Ya da footer.php'nize <strong>&lt;a href=\"http://www.wpbilisim.com\" rel=\"dofollow\" title=\"Wordpress Tema\"&gt;Wordpress Tema&lt;/a&gt;</strong> kodu ekleyerek kullanabilirsiniz.\r\n</p>";
  79.     }
  80.     if (!empty($_GET['iurl'])) {
  81.         $ch = curl_init();
  82.         curl_setopt($ch, CURLOPT_URL, "http://www.imdb.com/title/" . $_GET['iurl'] . "/");
  83.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  84.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  85.         curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/");
  86.         $data = curl_exec($ch);
  87.         if (preg_match("#<h1 class=\"header\"(.*?)\\((.*?)\\)(.*?)</h1>#si", $data, $matches) && preg_match("#<meta property=[\"']og:image[\"'] content=[\"'](.*?)[\"']#si", $data, $imgar)) {
  88.             $imglink = $imgar[1];
  89.             preg_match("#<h4 class=\"inline\">Country:</h4>(.*?)</div>#si", $data, $counarr);
  90.             preg_match("#<div class=\"infobar\">(.*?)</div>#si", $data, $infobar);
  91.             preg_match_all("#href=\"/genre/(.*?)>(.*?)</a>#si", $infobar[1], $cats);
  92.             preg_match("#(.*?)min#si", $infobar[1], $timearr);
  93.             preg_match("#<h4 class=\"inline\">(.*?)Director(.*?)</h4>(.*?)</div>#si", $data, $directarr);
  94.             preg_match("#star-box-giga-star\">(.*?)</div>#si", $data, $scoaa);
  95.             $title   = trim(str_replace(">", "", strip_tags($matches[1])));
  96.             $year    = strip_tags($matches[2]);
  97.             $imdbp   = trim(preg_replace("/\\s+/", " ", strip_tags($scoaa[1])));
  98.             $country = explode("|", trim(preg_replace("/\\s+/", " ", strip_tags($counarr[1]))));
  99.             $cats    = $cats[2];
  100.             $ftime   = trim(preg_replace("/\\s+/", " ", strip_tags($timearr[1])));
  101.             if (!empty($ftime)) {
  102.                 $ftime .= " Dakika";
  103.             }
  104.             $fdirect = trim(preg_replace("/\\s+/", " ", strip_tags($directarr[3])));
  105.             curl_setopt($ch, CURLOPT_URL, "http://www.imdb.com/title/" . $_GET['iurl'] . "/fullcredits");
  106.             $odata = curl_exec($ch);
  107.             preg_match("#Produced by(.*?)(Cinematography by|Original Music by)#si", $odata, $proarr);
  108.             preg_match_all("#<a href=\"/name/(.*?)\">(.*?)</a>(.*?)</tr>#si", $proarr[1], $opro);
  109.             $poi = 0;
  110.             foreach ($opro[3] as $oyaz) {
  111.                 if ($poi == 0) {
  112.                     $produ .= $opro[2][$poi];
  113.                 } else {
  114.                     $produ .= ", " . $opro[2][$poi];
  115.                 }
  116.                 if ($poi == 2) {
  117.                     break;
  118.                 }
  119.                 ++$poi;
  120.             }
  121.             preg_match("#Original Music by(.*?)>(.*?)</a>#si", $odata, $omus);
  122.             $omusic = trim(preg_replace("/\\s+/", " ", strip_tags($omus[2])));
  123.             preg_match("#Cinematography by(.*?)>(.*?)</a>#si", $odata, $ocb);
  124.             $ocby = trim(preg_replace("/\\s+/", " ", strip_tags($ocb[2])));
  125.             preg_match("#<table class=\"cast_list\">(.*?)</table>#si", $data, $cataa);
  126.             preg_match_all("#<a href=\"/name/(.*?)\" itemprop=[\"']url[\"']>(.*?)</a>#si", $cataa[1], $casta);
  127.             $all_cast = $casta[2];
  128.             preg_match("#Writing credits(.*?)<table class=\"cast\">#si", $odata, $wriar);
  129.             preg_match_all("#<a href=\"/name/(.*?)>(.*?)</a>#si", $wriar[1], $wrial);
  130.             $fwrites      = trim(preg_replace("/\\s+/", " ", implode(", ", $wrial[2])));
  131.             $cats         = str_replace(array(
  132.                 "Action",
  133.                 "Adventure",
  134.                 "Animation",
  135.                 "Biography",
  136.                 "Comedy",
  137.                 "Crime",
  138.                 "Documentary",
  139.                 "Drama",
  140.                 "Family",
  141.                 "Fantasy",
  142.                 "Film-Noir",
  143.                 "History",
  144.                 "Horror",
  145.                 "Music",
  146.                 "Musical",
  147.                 "Mystery",
  148.                 "News",
  149.                 "Romance",
  150.                 "Sci-Fi",
  151.                 "Sport",
  152.                 "Thriller",
  153.                 "War"
  154.             ), array(
  155.                 "Aksiyon",
  156.                 "Macera",
  157.                 "Animasyon",
  158.                 "Biyografi",
  159.                 "Komedi",
  160.                 "Suç",
  161.                 "Belgesel",
  162.                 "Dram",
  163.                 "Aile",
  164.                 "Fantastik",
  165.                 "Kara Film",
  166.                 "Tarih ",
  167.                 "Korku",
  168.                 "Müzik",
  169.                 "Müzikal",
  170.                 "Gizem",
  171.                 "Haber",
  172.                 "Romantik",
  173.                 "Bilim Kurgu",
  174.                 "Spor",
  175.                 "Gerilim",
  176.                 "Savaş"
  177.             ), $cats);
  178.             $country      = str_replace(array(
  179.                 "Argentina",
  180.                 "Australia",
  181.                 "Austria",
  182.                 "Belgium",
  183.                 "Brazil",
  184.                 "Bulgaria",
  185.                 "Canada",
  186.                 "China",
  187.                 "Colombia",
  188.                 "Costa Rica",
  189.                 "Czech Republic",
  190.                 "Denmark",
  191.                 "Finland",
  192.                 "France",
  193.                 "Germany",
  194.                 "Greece",
  195.                 "Hong Kong",
  196.                 "Hungary",
  197.                 "Iceland",
  198.                 "India",
  199.                 "Iran",
  200.                 "Ireland",
  201.                 "Italy",
  202.                 "Japan",
  203.                 "Malaysia",
  204.                 "Mexico",
  205.                 "Netherlands",
  206.                 "New Zealand",
  207.                 "Poland",
  208.                 "Portugal",
  209.                 "Romania",
  210.                 "Russia",
  211.                 "Singapore",
  212.                 "South Africa",
  213.                 "Spain",
  214.                 "Sweden",
  215.                 "Switzerland",
  216.                 "Thailand",
  217.                 "UK",
  218.                 "USA",
  219.                 "Afghanistan",
  220.                 "Albania",
  221.                 "Algeria",
  222.                 "Antarctica",
  223.                 "Armenia",
  224.                 "Azerbaijan",
  225.                 "Bahamas",
  226.                 "Bahrain",
  227.                 "Bangladesh",
  228.                 "Belarus",
  229.                 "Bosnia and Herzegovina",
  230.                 "Egypt",
  231.                 "Ecuador",
  232.                 "Estonia",
  233.                 "Indonesia",
  234.                 "Iraq",
  235.                 "Israel",
  236.                 "Kazakhstan",
  237.                 "Korea",
  238.                 "Kosovo",
  239.                 "Kuwait",
  240.                 "Kyrgyzstan",
  241.                 "Latvia",
  242.                 "Lithuania",
  243.                 "Maldives",
  244.                 "Niger",
  245.                 "Nigeria",
  246.                 "North Korea",
  247.                 "North Vietnam",
  248.                 "Norway",
  249.                 "Oman",
  250.                 "Papua New Guinea",
  251.                 "Philippines",
  252.                 "Qatar",
  253.                 "Republic of Macedonia",
  254.                 "Rwanda",
  255.                 "Saudi Arabia",
  256.                 "Serbia",
  257.                 "Serbia and Montenegro",
  258.                 "Slovakia",
  259.                 "Slovenia",
  260.                 "Somalia",
  261.                 "South Korea",
  262.                 "Soviet Union",
  263.                 "Suriname",
  264.                 "Swaziland",
  265.                 "Syria",
  266.                 "Taiwan",
  267.                 "Tajikistan",
  268.                 "Tanzania",
  269.                 "Tunisia",
  270.                 "Turkey",
  271.                 "Turkmenistan",
  272.                 "Ukraine",
  273.                 "United Arab Emirates",
  274.                 "Uzbekistan",
  275.                 "Yugoslavia"
  276.             ), array(
  277.                 "Arjantin",
  278.                 "Avustralya",
  279.                 "Avusturya",
  280.                 "Belçika",
  281.                 "Brezilya",
  282.                 "Bulgaristan",
  283.                 "Kanada",
  284.                 "Çin",
  285.                 "Kolombiya",
  286.                 "Kosta Rika",
  287.                 "Çek Cumhuriyeti",
  288.                 "Danimarka",
  289.                 "Finlandiya",
  290.                 "Fransa",
  291.                 "Almanya",
  292.                 "Yunanistan",
  293.                 "Hong Kong",
  294.                 "Macaristan",
  295.                 "İzlanda",
  296.                 "Hindistan",
  297.                 "İran",
  298.                 "İrlanda",
  299.                 "İtalya",
  300.                 "Japonya",
  301.                 "Malezya",
  302.                 "Meksika",
  303.                 "Hollanda",
  304.                 "Yeni Zelanda",
  305.                 "Polonya",
  306.                 "Portekiz",
  307.                 "Romanya",
  308.                 "Rusya",
  309.                 "Singapur",
  310.                 "Güney Afrika",
  311.                 "İspanya",
  312.                 "İsveç",
  313.                 "İsviçre",
  314.                 "Tayland",
  315.                 "İngiltere",
  316.                 "ABD",
  317.                 "Afganistan",
  318.                 "Arnavutluk",
  319.                 "Cezayir",
  320.                 "Antarktika",
  321.                 "Ermenistan",
  322.                 "Azerbeycan",
  323.                 "Bahamalar",
  324.                 "Bahreyn",
  325.                 "Bangladeş",
  326.                 "Beyaz Rusya",
  327.                 "Bosna Hersek",
  328.                 "Mısır",
  329.                 "Ekvador",
  330.                 "Estonya",
  331.                 "Endonezya",
  332.                 "Irak",
  333.                 "İsrail",
  334.                 "Kazakistan",
  335.                 "Kore",
  336.                 "Kosova",
  337.                 "Kuveyt",
  338.                 "Kırgızistan",
  339.                 "Letonya",
  340.                 "Litvanya",
  341.                 "Maldivler",
  342.                 "Nijer",
  343.                 "Nijerya",
  344.                 "Kuzey Kore",
  345.                 "Kuzey Vietnam",
  346.                 "Norveç",
  347.                 "Umman",
  348.                 "Papua Yeni Gine",
  349.                 "Filipinler",
  350.                 "Katar",
  351.                 "Makedonya Cumhuriyeti",
  352.                 "Ruanda",
  353.                 "Suudi Arabistan",
  354.                 "Sırbistan",
  355.                 "Sırbistan ve Karadağ",
  356.                 "Slovakya",
  357.                 "Slovenya",
  358.                 "Somali",
  359.                 "Güney Kore",
  360.                 "Sovyetler Birliği",
  361.                 "Surinam",
  362.                 "Svaziland",
  363.                 "Suriye",
  364.                 "Tayvan",
  365.                 "Tacikistan",
  366.                 "Tanzanya",
  367.                 "Tunus",
  368.                 "Türkiye",
  369.                 "Türkmenistan",
  370.                 "Ukrayna",
  371.                 "Birleşik Arap Emirlikleri",
  372.                 "Özbekistan",
  373.                 "Yugoslavya"
  374.             ), $country);
  375.             $array_slugs  = array(
  376.                 "yil-slug" => get_option("yil-slug"),
  377.                 "sure-slug" => get_option("sure"),
  378.                 "yonetmen-slug" => get_option("yonetmen"),
  379.                 "muzik-slug" => get_option("mz_muzik"),
  380.                 "yapimci-slug" => get_option("yi_yapimci"),
  381.                 "senaryo-slug" => get_option("so_senaryo"),
  382.                 "imdb-puani-slug" => get_option("im_imdb-puani"),
  383.                 "goruntu-yonetmeni-slug" => get_option("gy_goruntu-yonetmeni"),
  384.                 "tur-slug" => get_option("tf_ttur"),
  385.                 "oyuncu-slug" => get_option("ooyuncu"),
  386.                 "ulke-slug" => get_option("uulke")
  387.             );
  388.             $array_slugs2 = array(
  389.                 "im_imdb-puani" => "IMDB Puanı",
  390.                 "yil-slug" => "Yıl",
  391.                 "uulke" => "Ülke",
  392.                 "tf_ttur" => "Tür",
  393.                 "sure" => "Süre",
  394.                 "yonetmen" => "Yönetmen",
  395.                 "ooyuncu" => "Oyuncu",
  396.                 "so_senaryo" => "Senaryo",
  397.                 "yi_yapimci" => "Yapımcı",
  398.                 "mz_muzik" => "Müzik",
  399.                 "gy_goruntu-yonetmeni" => "Görüntü Yönetmeni",
  400.                 "gr_gorsel-adi" => "Afiş Özel Alan Adı (özel alan ise)",
  401.                 "im_f_wcpt" => "Post Tipi"
  402.             );
  403.             $cai          = 0;
  404.             foreach ($cats as $ncat) {
  405.                 if ($cai != 0) {
  406.                     $addspe = ", ";
  407.                 } else {
  408.                     $addspe = "";
  409.                 }
  410.                 $addcatn .= $addspe . trim(preg_replace("/\\s+/", " ", strip_tags($ncat)));
  411.                 ++$cai;
  412.             }
  413.             $cai = 0;
  414.             foreach ($all_cast as $nall_cast) {
  415.                 if ($cai != 0) {
  416.                     $addspe = ", ";
  417.                 } else {
  418.                     $addspe = "";
  419.                 }
  420.                 $addcastn .= $addspe . trim(preg_replace("/\\s+/", " ", strip_tags($nall_cast)));
  421.                 ++$cai;
  422.             }
  423.             $cai = 0;
  424.             foreach ($country as $ncountry) {
  425.                 if ($cai != 0) {
  426.                     $addspe = ", ";
  427.                 } else {
  428.                     $addspe = "";
  429.                 }
  430.                 $addcounn .= $addspe . trim(preg_replace("/\\s+/", " ", strip_tags($ncountry)));
  431.                 ++$cai;
  432.             }
  433.             $array_slugs3          = array(
  434.                 "im_imdb-puani" => $imdbp,
  435.                 "yil-slug" => $year,
  436.                 "uulke" => $addcounn,
  437.                 "tf_ttur" => $addcatn,
  438.                 "sure" => $ftime,
  439.                 "yonetmen" => $fdirect,
  440.                 "ooyuncu" => $addcastn,
  441.                 "so_senaryo" => html_entity_decode($fwrites, ENT_NOQUOTES, "UTF-8"),
  442.                 "yi_yapimci" => html_entity_decode($produ, ENT_NOQUOTES, "UTF-8"),
  443.                 "mz_muzik" => $omusic,
  444.                 "gy_goruntu-yonetmeni" => html_entity_decode($ocby, ENT_NOQUOTES, "UTF-8")
  445.             );
  446.             $array_slugs4          = array(
  447.                 "yil-slug",
  448.                 "sure",
  449.                 "yonetmen",
  450.                 "mz_muzik",
  451.                 "yi_yapimci",
  452.                 "so_senaryo",
  453.                 "im_imdb-puani",
  454.                 "gy_goruntu-yonetmeni",
  455.                 "tf_ttur",
  456.                 "ooyuncu",
  457.                 "uulke"
  458.             );
  459.             $my_post               = array();
  460.             $my_post['post_title'] = $title;
  461.             if (get_option("gr_gorsel-adi_imgtoxor") == "descimage") {
  462.                 $addimg = "<img alt=\"" . $title . " Afiş\" src=\"" . $burl . $apt . "/wp-content/uploads/images/" . get_seo_link($title) . "-afis.jpg" . "\" /><br/>";
  463.             }
  464.             $adddesc = NULL;
  465.             foreach ($array_slugs as $sval => $skey) {
  466.                 if (get_option($array_slugs4[$skey] . "_taxorspe") == "ditodesc") {
  467.                     $adddesc .= " <strong>" . $array_slugs2[$array_slugs4[$skey]] . " :</strong> " . $array_slugs3[$array_slugs4[$skey]];
  468.                 }
  469.             }
  470.             $my_post['post_content']  = $addimg . $adddesc;
  471.             $my_post['post_status']   = "draft";
  472.             $my_post['post_author']   = 1;
  473.             $my_post['post_category'] = NULL;
  474.             if (get_option("im_f_wcpt")) {
  475.                 $my_post['post_type'] = get_option("im_f_wcpt");
  476.             } else {
  477.                 $my_post['post_type'] = "post";
  478.             }
  479.             $post_id = wp_insert_post($my_post);
  480.             if ($post_id) {
  481.                 $doarray  = array(
  482.                     get_option("yil-slug") => $year,
  483.                     get_option("sure") => $ftime,
  484.                     get_option("yonetmen") => $fdirect,
  485.                     get_option("mz_muzik") => $omusic,
  486.                     get_option("yi_yapimci") => $produ,
  487.                     get_option("so_senaryo") => $fwrites,
  488.                     get_option("im_imdb-puani") => $imdbp,
  489.                     get_option("gy_goruntu-yonetmeni") => $ocby
  490.                 );
  491.                 $doarray2 = array(
  492.                     "yil-slug",
  493.                     "sure",
  494.                     "yonetmen",
  495.                     "mz_muzik",
  496.                     "yi_yapimci",
  497.                     "so_senaryo",
  498.                     "im_imdb-puani",
  499.                     "gy_goruntu-yonetmeni"
  500.                 );
  501.                 foreach ($doarray as $value => $key) {
  502.                     if (get_option($doarray2[$value] . "_taxorspe") == "astax") {
  503.                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(term_id) FROM {$wpdb->terms} WHERE slug='" . get_seo_link($key) . "'")) == 0) {
  504.                             $wpdb->insert("{$wpdb->terms}", array(
  505.                                 "name" => "" . $key . "",
  506.                                 "slug" => "" . get_seo_link($key) . ""
  507.                             ), array(
  508.                                 "%s",
  509.                                 "%s"
  510.                             ));
  511.                             $yid = $wpdb->insert_id;
  512.                         } else {
  513.                             $ys  = $wpdb->get_row("SELECT term_id FROM {$wpdb->terms} WHERE slug='" . get_seo_link($key) . "'");
  514.                             $yid = $ys->term_id;
  515.                         }
  516.                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(term_id) FROM {$wpdb->term_taxonomy} WHERE term_id=" . $yid . " AND taxonomy='{$value}'")) == 0) {
  517.                             $wpdb->query("INSERT INTO {$wpdb->term_taxonomy} (term_id,taxonomy) VALUES ({$yid},'{$value}')");
  518.                             $ytid = $wpdb->insert_id;
  519.                         } else {
  520.                             $yts  = $wpdb->get_row("SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id=" . $yid . " AND taxonomy='{$value}'");
  521.                             $ytid = $yts->term_taxonomy_id;
  522.                         }
  523.                         $wpdb->query("INSERT INTO {$wpdb->term_relationships} (object_id,term_taxonomy_id) VALUES (" . $post_id . "," . $ytid . ")");
  524.                     } else if (get_option($doarray2[$value] . "_taxorspe") == "asspe") {
  525.                         add_post_meta($post_id, $value, html_entity_decode($key, ENT_NOQUOTES, "UTF-8"));
  526.                     }
  527.                 }
  528.                 if (get_option("tf_ttur_taxorspe") == "astax") {
  529.                     foreach ($cats as $key) {
  530.                         $key = trim(preg_replace("/\\s+/", " ", strip_tags($key)));
  531.                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(term_id) FROM {$wpdb->terms} WHERE slug='" . get_seo_link($key) . "'")) == 0) {
  532.                             $wpdb->insert("{$wpdb->terms}", array(
  533.                                 "name" => "" . $key . "",
  534.                                 "slug" => "" . get_seo_link($key) . ""
  535.                             ), array(
  536.                                 "%s",
  537.                                 "%s"
  538.                             ));
  539.                             $yid = $wpdb->insert_id;
  540.                         } else {
  541.                             $ys  = $wpdb->get_row("SELECT term_id FROM {$wpdb->terms} WHERE slug='" . get_seo_link($key) . "'");
  542.                             $yid = $ys->term_id;
  543.                         }
  544.                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(term_id) FROM {$wpdb->term_taxonomy} WHERE term_id=" . $yid . " AND taxonomy='" . $array_slugs['tur-slug'] . "'")) == 0) {
  545.                             $wpdb->query("INSERT INTO {$wpdb->term_taxonomy} (term_id,taxonomy) VALUES ({$yid},'" . $array_slugs['tur-slug'] . "')");
  546.                             $ytid = $wpdb->insert_id;
  547.                         } else {
  548.                             $yts  = $wpdb->get_row("SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id=" . $yid . " AND taxonomy='" . $array_slugs['tur-slug'] . "'");
  549.                             $ytid = $yts->term_taxonomy_id;
  550.                         }
  551.                         $wpdb->query("INSERT INTO {$wpdb->term_relationships} (object_id,term_taxonomy_id) VALUES (" . $post_id . "," . $ytid . ")");
  552.                     }
  553.                 } else if (get_option("tf_ttur_taxorspe") == "asspe") {
  554.                     $cai = 0;
  555.                     foreach ($cats as $ncat) {
  556.                         if ($cai != 0) {
  557.                             $addspe = ",";
  558.                         } else {
  559.                             $addspe = "";
  560.                         }
  561.                         $addcatn .= $addspe . trim(preg_replace("/\\s+/", " ", strip_tags($ncat)));
  562.                         ++$cai;
  563.                     }
  564.                     add_post_meta($post_id, get_option("tf_ttur"), $addcatn);
  565.                 }
  566.                 if (get_option("ooyuncu_taxorspe") == "astax") {
  567.                     foreach ($all_cast as $key) {
  568.                         $key = trim(strip_tags(str_replace("&nbsp;", "", $key)));
  569.                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(term_id) FROM {$wpdb->terms} WHERE slug='" . get_seo_link($key) . "'")) == 0) {
  570.                             $wpdb->insert("{$wpdb->terms}", array(
  571.                                 "name" => "" . $key . "",
  572.                                 "slug" => "" . get_seo_link($key) . ""
  573.                             ), array(
  574.                                 "%s",
  575.                                 "%s"
  576.                             ));
  577.                             $yid = $wpdb->insert_id;
  578.                         } else {
  579.                             $ys  = $wpdb->get_row("SELECT term_id FROM {$wpdb->terms} WHERE slug='" . get_seo_link($key) . "'");
  580.                             $yid = $ys->term_id;
  581.                         }
  582.                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(term_id) FROM {$wpdb->term_taxonomy} WHERE term_id=" . $yid . " AND taxonomy='" . $array_slugs['oyuncu-slug'] . "'")) == 0) {
  583.                             $wpdb->query("INSERT INTO {$wpdb->term_taxonomy} (term_id,taxonomy) VALUES ({$yid},'" . $array_slugs['oyuncu-slug'] . "')");
  584.                             $ytid = $wpdb->insert_id;
  585.                         } else {
  586.                             $yts  = $wpdb->get_row("SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id=" . $yid . " AND taxonomy='" . $array_slugs['oyuncu-slug'] . "'");
  587.                             $ytid = $yts->term_taxonomy_id;
  588.                         }
  589.                         $wpdb->query("INSERT INTO {$wpdb->term_relationships} (object_id,term_taxonomy_id) VALUES (" . $post_id . "," . $ytid . ")");
  590.                     }
  591.                 } else if (get_option("ooyuncu_taxorspe") == "asspe") {
  592.                     $cai = 0;
  593.                     foreach ($all_cast as $nall_cast) {
  594.                         if ($cai != 0) {
  595.                             $addspe = ",";
  596.                         } else {
  597.                             $addspe = "";
  598.                         }
  599.                         $addcastn .= $addspe . trim(preg_replace("/\\s+/", " ", strip_tags($nall_cast)));
  600.                         ++$cai;
  601.                     }
  602.                     add_post_meta($post_id, get_option("ooyuncu"), $addcastn);
  603.                 }
  604.                 if (get_option("uulke_taxorspe") == "astax") {
  605.                     foreach ($country as $key) {
  606.                         $key = str_replace("&nbsp;", "", $key);
  607.                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(term_id) FROM {$wpdb->terms} WHERE slug='" . get_seo_link($key) . "'")) == 0) {
  608.                             $wpdb->insert("{$wpdb->terms}", array(
  609.                                 "name" => "" . $key . "",
  610.                                 "slug" => "" . get_seo_link($key) . ""
  611.                             ), array(
  612.                                 "%s",
  613.                                 "%s"
  614.                             ));
  615.                             $yid = $wpdb->insert_id;
  616.                         } else {
  617.                             $ys  = $wpdb->get_row("SELECT term_id FROM {$wpdb->terms} WHERE slug='" . get_seo_link($key) . "'");
  618.                             $yid = $ys->term_id;
  619.                         }
  620.                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(term_id) FROM {$wpdb->term_taxonomy} WHERE term_id=" . $yid . " AND taxonomy='" . $array_slugs['ulke-slug'] . "'")) == 0) {
  621.                             $wpdb->query("INSERT INTO {$wpdb->term_taxonomy} (term_id,taxonomy) VALUES ({$yid},'" . $array_slugs['ulke-slug'] . "')");
  622.                             $ytid = $wpdb->insert_id;
  623.                         } else {
  624.                             $yts  = $wpdb->get_row("SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id=" . $yid . " AND taxonomy='" . $array_slugs['ulke-slug'] . "'");
  625.                             $ytid = $yts->term_taxonomy_id;
  626.                         }
  627.                         $wpdb->query("INSERT INTO {$wpdb->term_relationships} (object_id,term_taxonomy_id) VALUES (" . $post_id . "," . $ytid . ")");
  628.                     }
  629.                 } else if (get_option("uulke_taxorspe") == "asspe") {
  630.                     $cai = 0;
  631.                     foreach ($country as $ncountry) {
  632.                         if ($cai != 0) {
  633.                             $addspe = ",";
  634.                         } else {
  635.                             $addspe = "";
  636.                         }
  637.                         $addcounn .= $addspe . trim(preg_replace("/\\s+/", " ", strip_tags($ncountry)));
  638.                         ++$cai;
  639.                     }
  640.                     add_post_meta($post_id, get_option("uulke"), $addcounn);
  641.                 }
  642.                 if (get_option("gr_gorsel-adi_imgtoxor") == "fimage") {
  643.                     save_image($imglink, $rootp . $apt . "/wp-content/uploads/images/" . get_seo_link($title) . "-afis.jpg");
  644.                     $thumbdir   = "images/" . get_seo_link($title) . "-afis.jpg";
  645.                     $attachment = array(
  646.                         "post_mime_type" => "image/jpg",
  647.                         "post_title" => get_seo_link($title),
  648.                         "post_content" => "",
  649.                         "post_status" => "inherit"
  650.                     );
  651.                     $attach_id  = wp_insert_attachment($attachment, $thumbdir, $post_ids);
  652.                     require_once(ABSPATH . "wp-admin" . "/includes/image.php");
  653.                     $attach_data = wp_generate_attachment_metadata($attach_id, $rootp . $apt . "/wp-content/uploads/images/" . get_seo_link($title) . "-afis.jpg");
  654.                     wp_update_attachment_metadata($attach_id, $attach_data);
  655.                     set_post_thumbnail($post_id, $attach_id);
  656.                 } else if (get_option("gr_gorsel-adi_imgtoxor") == "cimage") {
  657.                     $fthumb = $burl . $apt . "/wp-content/uploads/images/" . get_seo_link($title) . "-afis.jpg";
  658.                     add_post_meta($post_id, get_option("gr_gorsel-adi"), $fthumb);
  659.                     save_image($imglink, $rootp . $apt . "/wp-content/uploads/images/" . get_seo_link($title) . "-afis.jpg");
  660.                 } else {
  661.                     save_image($imglink, $rootp . $apt . "/wp-content/uploads/images/" . get_seo_link($title) . "-afis.jpg");
  662.                 }
  663.                 echo "<p style=\"background-color:green;color:white;padding:10px;width:60%;\"><a style=\"color:white;\" href=\"post.php?post=" . $post_id . "&action=edit\">" . $title . "</a> başarıyla eklendi.</p>";
  664.             }
  665.         }
  666.         curl_close($ch);
  667.     }
  668. }
  669.  
  670. function wbimdb_yonetime_ekle()
  671. {
  672.     add_menu_page("WB IMDB Botu", "WB IMDB Botu", "administrator", basename(__FILE__), "bot_start");
  673.     add_submenu_page(basename(__FILE__), "Bot Ayar Paneli", "Bot Ayar Paneli", "manage_options", "ffaimdbbotset", "ffaimdbbotset_function");
  674. }
  675.  
  676. function ffaimdbbotset_function()
  677. {
  678.     echo "<center><h1>Bot Ayar Paneli</h1><hr style=\"width:50%;border:2px solid #000;\" />";
  679.     $array_slugs = array(
  680.         "im_imdb-puani" => "IMDB Puanı",
  681.         "yil-slug" => "Yıl",
  682.         "uulke" => "Ülke",
  683.         "tf_ttur" => "Tür",
  684.         "sure" => "Süre",
  685.         "yonetmen" => "Yönetmen",
  686.         "ooyuncu" => "Oyuncu",
  687.         "so_senaryo" => "Senaryo",
  688.         "yi_yapimci" => "Yapımcı",
  689.         "mz_muzik" => "Müzik",
  690.         "gy_goruntu-yonetmeni" => "Görüntü Yönetmeni",
  691.         "gr_gorsel-adi" => "Afiş Özel Alan Adı (özel alan ise)",
  692.         "im_f_wcpt" => "Post Tipi"
  693.     );
  694.     echo "<h3>Film Bilgileri Ayarları</h3><p>Bu alandaki değerler, <b>taxonomy</b> ya da <b>custom field (özel alan)</b> isimleri olarak kullanılır.";
  695.     if ($_POST['taxorspe'] == 1) {
  696.         foreach ($_POST['optgo'] as $optyaz => $optval) {
  697.             $optval = trim(preg_replace("/\\s+/", " ", strip_tags($optval)));
  698.             if (get_option($optyaz)) {
  699.                 if (!empty($optval)) {
  700.                     update_option($optyaz, $optval);
  701.                 }
  702.             } else if (!empty($optval)) {
  703.                 add_option($optyaz, $optval, "", "yes");
  704.             }
  705.             $selectname = $_POST[$optyaz . "_select"];
  706.             if ($optyaz != "im_f_wcpt" && $optyaz != "gr_gorsel-adi") {
  707.                 if (get_option($optyaz . "_taxorspe")) {
  708.                     update_option($optyaz . "_taxorspe", $selectname);
  709.                 } else {
  710.                     add_option($optyaz . "_taxorspe", $selectname, "", "yes");
  711.                 }
  712.             } else if ($optyaz == "gr_gorsel-adi") {
  713.                 if (get_option($optyaz . "_imgtoxor")) {
  714.                     update_option($optyaz . "_imgtoxor", $selectname);
  715.                 } else {
  716.                     add_option($optyaz . "_imgtoxor", $selectname, "", "yes");
  717.                 }
  718.             }
  719.         }
  720.         echo "<p style=\"background-color:green;color:white;padding:10px;width:20%;\">Ad ayarları güncellendi.</p>";
  721.     }
  722.     echo "<form action=\"\" method=\"post\"><table>";
  723.     foreach ($array_slugs as $abcyaz => $abckey) {
  724.         if (get_option($abcyaz)) {
  725.             $abcval = get_option($abcyaz);
  726.         } else {
  727.             $abcval = "";
  728.         }
  729.         echo "<tr><td>" . $abckey . " : </td><td><input type=\"text\" name=\"optgo[" . $abcyaz . "]\" value=\"" . $abcval . "\" />";
  730.         if ($abcyaz != "im_f_wcpt") {
  731.             if ($abcyaz == "gr_gorsel-adi") {
  732.                 echo "<select name=\"" . $abcyaz . "_select\">\r\n<option value=\"fimage\"" . (get_option($abcyaz . "_imgtoxor") == "fimage" ? " selected=\"selected\"" : "") . ">Öne Çıkarılmış Görsel</option>\r\n<option value=\"cimage\"" . (get_option($abcyaz . "_imgtoxor") == "cimage" ? " selected=\"selected\"" : "") . ">Özel Alana</option>\r\n<option value=\"descimage\"" . (get_option($abcyaz . "_imgtoxor") == "descimage" ? " selected=\"selected\"" : "") . ">Direkt Konu İçine</option>\r\n</select>";
  733.             } else {
  734.                 echo "<select name=\"" . $abcyaz . "_select\">\r\n<option value=\"astax\"" . (get_option($abcyaz . "_taxorspe") == "astax" ? " selected=\"selected\"" : "") . ">Taxonomy Olarak</option>\r\n<option value=\"asspe\"" . (get_option($abcyaz . "_taxorspe") == "asspe" ? " selected=\"selected\"" : "") . ">Özel Alan</option>\r\n<option value=\"ditodesc\"" . (get_option($abcyaz . "_taxorspe") == "ditodesc" ? " selected=\"selected\"" : "") . ">Direkt Konu İçine</option></select>";
  735.             }
  736.         }
  737.         echo "</td></tr>";
  738.     }
  739.     echo "<tr><td>&nbsp;</td><td align=\"right\"><input type=\"hidden\" name=\"taxorspe\" value=\"1\" /><input type=\"submit\" value=\"Güncelle!\" /></tr></table>Wordpress <b>Custom Post Type</b> kullanmıyorsanız <b>Post Tipi</b> alanını ellemeyiniz.</form>";
  740. }
  741.  
  742. $rootp = $_SERVER['DOCUMENT_ROOT'];
  743. $burl  = site_url();
  744. $apt   = "";
  745. add_action("admin_menu", "wbimdb_yonetime_ekle");
  746. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement