Skip to content
Browse files

thezoggy's changes to fix Coming Episodes

  • Loading branch information...
1 parent 76ed735 commit 35bd570fd2c9ca520cbec3fcf3469c9eafa9f6bc @rodneyshupe rodneyshupe committed
Showing with 389 additions and 360 deletions.
  1. +129 −112 css/comingepisodes.css
  2. +260 −248 widgets/wComingEpisodes.php
View
241 css/comingepisodes.css
@@ -1,112 +1,129 @@
-#wComingEpisodes iframe {
- display : none;
- visibility : hidden;
- height : 1px;
-}
-#wComingEpisodes h1 {
- display : none;
- visibility : hidden;
-}
-
-div#header, span.MainMenu, span.SubMenu {
- display : none;
- visibility : hidden;
- height : 1px;
-}
-
-#outerWrapper {
- width: 100%;
- margin: -40px auto 0px auto;
- font: 9pt arial;
-}
-
-#listingWrapper {
- padding: 1px 0px 10px 0px;
- overflow: auto;
- height:auto!important;
- font-size: 0.8em;
-}
-
-#listingWrapper h1 {
- display:block;
- visibility: visible;
- border-bottom: 0px;
- text-align: left;
- margin:0 0 -8 15px;
-}
-
-.listing {
- padding: 10px 20px 10px 10px;
- border: none;
- margin-top: 10px;
- overflow: hidden;
- background-color: inherit;
-}
-
-.listingThumb, .posterThumb {
- width: 80px!important;
- /*height: 118px;*/
- float: left!important;
- border: 1px solid #000!important;
- background-image: url(/sickbeard/images/poster.png)!important;
-}
-a.highslide img.listingThumb {
- border: 1px solid #000;
-}
-.listing > div {
- margin-left: 100px;
-}
-
-.listing h1 {
- font-size: 1.2em;
- font-weight: bold;
- margin: 10px 0px;
- padding: 0;
- border-bottom: 0px none #000;
- text-align: left;
-}
-
-.listing h1 > .icons {
- float: right;
-}
-
-.listing h1 > .icons a {
- font-size: 0.5em;
- font-weight: normal;
- color: #222528
-}
-
-.listing h1 > .icons a img {
- width: 12px;
- height: 12px;
-}
-
-.listing p {
- /* font-size: 1.1em; */
- padding: 0px 0px 0px 5px;
-}
-
-.listing p > .info {
- font-weight: bold;
-}
-
-.listing p > .ended {
- color: red;
-}
-
-.listing p > .unknown {
- color: blue;
-}
-
-.listing p.next {
- padding: 5px;
-}
-
-.listing p.noMargin {
- margin-bottom: 0;
-}
-
-#main #wComingEpisodes.widget .widget-content {
- max-height:none;
- overflow:hidden;
-}
+div#header, span.MainMenu, span.SubMenu, span#tagline, .h2footer, .footer, .plotInfo {
+display: none !important;
+visibility: hidden !important;
+}
+
+#comingepisodeswrapper, #insideWrapper {
+max-height: 500px;
+/* set max-width for using this widget on either side otherwise you can't see everything */
+/* max-width: 400px; */
+}
+
+/* remove border from images --needed for all 3 views */
+div.tvshowDiv > table tr th img, td > a > img{
+border:0 !important;
+margin:0 !important;
+}
+
+/* start - specific to list view */
+table#showListTable {
+width: 100% !important;
+}
+/* fix list alignment problem */
+table#showListTable > tbody > tr > td, table#showListTable > thead > tr > th {
+text-align: left;
+padding-left: 5px;
+}
+/* make it so that the tv show doesn't word wrap */
+table#showListTable > tbody > tr > td a {
+white-space:nowrap;
+}
+/* end - specific to list view */
+
+/* make the tv show w/icons look more like a title bar */
+div.tvshowDiv > table tr th {
+ /* background-color: #333 !important;
+ border-bottom: 1px solid #666 !important;
+ */
+background-color: transparent !important;
+}
+/* left align the tv show title */
+div.tvshowDiv > table tr th > span.tvshowTitle a{
+text-align: left !important;
+float: left !important;
+padding: 3px 0px 4px !important;
+font-size: 16px !important;
+}
+/* right align the icons for the show */
+div.tvshowDiv > table tr th span.tvshowTitleIcons{
+text-align: right !important;
+float: right !important;
+}
+div.tvshowDiv > table tr th span.tvshowTitleIcons img{
+height: 16px;
+width: 16px;
+padding: 2px 2px 0px !important;
+}
+/* remove the Next Episode: / Airs: */
+div.tvshowDiv > table tr td > span.title {
+display: none!important;
+}
+
+/* remove the styling for the th that holds the banner image */
+div.tvshowDiv > table > tbody > tr > th.nobg {
+border:0 !important;
+background:none !important;
+height: 1px !important;
+text-align:center;
+}
+
+.bannerThumb {
+height: 75px !important;
+width: 90% !important;
+padding-bottom: 2px;
+}
+.posterThumb {
+width: 68px !important;
+height: 100px !important;
+padding: 0px 5px 5px 0px;
+/* float:left; */
+}
+
+/* adjust the ep #x## - title */
+div.tvshowDiv > table > tbody > tr > td.next_episode {
+text-align: left;
+font-size: 15px;
+display: hidden;
+padding-top: 3px;
+padding-bottom: 3px;
+}
+
+/* adjust the ep summary/air text */
+div.tvshowDiv > table > tbody > tr > td span {
+display: inline;
+visibility: visible;
+color: #aaa;
+}
+
+/* crude hack to get rid of the [] for the quality and add spacing after tvshow */
+div.tvshowDiv > table > tbody > tr > td {
+text-align: left !important;
+visibility: hidden;
+padding-bottom: 10px;
+}
+
+/* use the line breaks as visual seperation of elements */
+br {
+/* seperate each block by some spacing */
+/* display: inline; */
+
+/* merge the airdate with summary */
+display: none; /* looks best for all 3 views */
+}
+
+#main #wComingEpisodes.widget .widget-content {
+max-height:90%;
+/* show vertical scrollbar only on overflow */
+overflow-x:hidden;
+overflow-y:scroll;
+}
+
+/* not sure what this is for, pulled it from comingepisodes.css */
+#wComingEpisodes h1, #wComingEpisodes iframe {
+display : none !important;
+visibility : hidden;
+height : 1px;
+}
+a.highslide img.bannerThumb, a.highslide img.posterThumb {
+border: 1px solid #fff;
+}
View
508 widgets/wComingEpisodes.php
@@ -1,248 +1,260 @@
-<?php
-//Note this example uses the "stylesheet", and "headerfunction" properties.
-$wdgtComingEpisodes = array("name" => "Coming Episodes", "type" => "inline", "function" => "widgetComingEpisodes();", "stylesheet" => "css/comingepisodes.css", "headerfunction" => "widgetComingEpisodesHeader();");
-$wIndex["wComingEpisodes"] = $wdgtComingEpisodes;
-
-function widgetComingEpisodes() {
- global $sickbeardcomingepisodes;
-
- echo "\t<div id=\"comingepisodeswrapper\"></div>\n";
-
- if(strpos($sickbeardcomingepisodes, "http://")===false) {
- $iFrameSource= 'widgets/wComingEpisodes.php?style=s';
- } else {
- if(strpos($sickbeardcomingepisodes, "/sickbeard/")===false) {
- $iFrameSource= 'widgets/wComingEpisodes.php?display=yes';
- } else {
- $iFrameSource= 'widgets/wComingEpisodes.php?style=w';
- }
- }
- echo " <iframe onload='onIFrameLoad(this);' src ='".$iFrameSource."' name='middle' scrolling='no' frameborder='0' border='0' framespacing='0'>";
- echo " <p>Your browser does not support iframes.</p>";
- echo " </iframe>";
-}
-function widgetComingEpisodesHeader() {
- echo <<< ComingEpisodesSCRIPT
- <script type="text/javascript" language="javascript">
- <!--
- function extractIFrameBody(iFrameEl) {
- var doc = null;
- if (iFrameEl.contentDocument) { // For NS6
- doc = iFrameEl.contentDocument;
- } else if (iFrameEl.contentWindow) { // For IE5.5 and IE6
- doc = iFrameEl.contentWindow.document;
- } else if (iFrameEl.document) { // For IE5
- doc = iFrameEl.document;
- } else {
- alert("Error: could not find sumiFrame document");
- return null;
- }
- return doc.body;
- }
- function onIFrameLoad(iFrameElement) {
- var serverResponse = extractIFrameBody(iFrameElement).innerHTML;
-
- var iFrameBody = document.getElementById("comingepisodeswrapper");
- iFrameBody.innerHTML = serverResponse;
- addAltClass();
- addHighSlide();
- //adjustHeight();
- }
-
- function addAltClass() {
- var allHTMLTags = document.getElementsByTagName("*");
- var alt;
- alt = false;
-
- for (i=0; i < allHTMLTags.length; i++) {
- if (allHTMLTags[i].className == 'listing') {
- if(alt) {
- allHTMLTags[i].className = 'listing alt';
- }
- alt = !alt;
- }
- }
- }
-
- function addHighSlide() {
- var allHTMLTags = document.getElementsByTagName("img");
-
- for (i=0; i < allHTMLTags.length; i++) {
- if (allHTMLTags[i].className == 'listingThumb') {
- //Set parent node <a> tag to have correct
- allHTMLTags[i].parentNode.setAttribute('href',allHTMLTags[i].src);
- allHTMLTags[i].parentNode.className = 'highslide';
- allHTMLTags[i].parentNode.setAttribute('onclick','return hs.expand(this)');
- allHTMLTags[i].parentNode.onclick = function() { return hs.expand(allHTMLTags[i]) };
-
- //Wrap with span and reset.
- var newHTML = '<span class="sbposter-img">'+allHTMLTags[i].parentNode.outerHTML+'<a><div class="highslide-caption"><br></div></a></span>';
- allHTMLTags[i].parentNode.outerHTML = newHTML;
- }
- }
- }
-
- function adjustHeight() {
- var windowSizeAdjustment = 100;
- var windowHeight = (window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight) - windowSizeAdjustment;
- if (windowHeight > 0) {
- var objWrapper = document.getElementById("listingWrapper");
- objWrapper.style.height = windowHeight + 'px';
- }
- }
- -->
- </script>
-
-ComingEpisodesSCRIPT;
-}
-if(!empty($_GET["display"])) {
- include_once "../config.php";
-
- $body = getComingSoon($sickbeardcomingepisodes);
-
- $urldata = parse_url($sickbeardcomingepisodes);
- $pos = strrpos($sickbeardcomingepisodes, "/");
- if($pos < strlen($sickbeardcomingepisodes)) {
- $uri_full = substr($sickbeardcomingepisodes, 0, $pos + 1);
- } else {
- $uri_full = $sickbeardcomingepisodes;
- }
- $uri_domain = str_replace($urldata["path"], "", $sickbeardcomingepisodes);
-
- $regex = '/(<[(img)|(a)]\s*(.*?)\s*[(src)|(href)]=(?P<link>[\'"]+?\s*\S+\s*[\'"])+?\s*(.*?)\s*>)/i';
-
- preg_match_all($regex, $body, $matches);
-
- foreach($matches['link'] as $link) {
- $pos = strpos($link, "/");
- if($pos && strpos($link, "//")===false) {
- if($pos==1) {
- $newlink = substr($link , 0, 1).$uri_domain.substr($link , 1);
- } else {
- $newlink = substr($link , 0, 1).$uri_full.substr($link , 1);
- }
- }
- $body = str_replace($link, $newlink, $body);
- }
-
- echo $body;
-}
-
-function stripBody($body) {
- $pos = strpos($body, "<body");
- if ($pos > 0) {
- $body = substr($body, $pos);
- $pos = strpos($body, ">");
- if ($pos > 0) {
- $body = substr($body, $pos + 1);
- $pos = strpos($body, "</body>");
- if ($pos > 0) {
- $body = substr($body, 0, $pos - 1);
- }
- }
- }
- return $body;
-}
-function stripInnerWrapper($body) {
- $pos = strpos($body, "<div id=\"listingWrapper\">");
- if ($pos > 0) {
- $body = substr($body, $pos);
- $pos = strpos($body, "<script");
- if ($pos > 0) {
- $body = substr($body, 0, $pos - 1);
- }
- }
- return $body;
-}
-function changeLinks($body) {
- global $sickbeardcomingepisodes;
-
- $urldata = parse_url($sickbeardcomingepisodes);
- $pos = strrpos($sickbeardcomingepisodes, "/");
- if($pos < strlen($sickbeardcomingepisodes)) {
- $uri_full = substr($sickbeardcomingepisodes, 0, $pos + 1);
- } else {
- $uri_full = $sickbeardcomingepisodes;
- }
- $uri_domain = str_replace($urldata["path"], "", $sickbeardcomingepisodes);
-
- $regex = '/(<[(img)|(a)]\s*(.*?)\s*[(src)|(href)]=(?P<link>[\'"]+?\s*\S+\s*[\'"])+?\s*(.*?)\s*>)/i';
-
- preg_match_all($regex, $body, $matches);
- foreach($matches['link'] as $link) {
- $pos = strpos($link, "/");
- if($pos && strpos($link, "//")===false) {
- if($pos==1) {
- $newlink = substr($link , 0, 1).$uri_domain.substr($link , 1);
- } else {
- $newlink = substr($link , 0, 1).$uri_full.substr($link , 1);
- }
- }
- //$body = str_replace($link, "\"".sickbeardposter(str_replace("\"", "", $newlink))."\"", $body);
- $body = str_replace($link, $newlink, $body);
- }
-
- return $body;
-}
-function comingSoonUrl($url = "") {
- global $sickbeardcomingepisodes;
-
- if(empty($url)) {
- if(!(strpos($sickbeardcomingepisodes, "http") === 0)){
- $url = "http://".$_SERVER['PHP_AUTH_USER'].":".$_SERVER['PHP_AUTH_PW']."@".$_SERVER['SERVER_NAME'].((strpos($sickbeardcomingepisodes, "/") === 0)?"":"/").$sickbeardcomingepisodes;
- } else {
- $url = $sickbeardcomingepisodes;
- }
- }
- return $url;
-}
-
-function getComingSoon($url = "") {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPGET, 1);
- curl_setopt($ch, CURLOPT_URL, comingSoonUrl($url));
-
- $html = curl_exec($ch);
- curl_close($ch);
-
- return $html;
-}
-
-function displayComingSoon () {
- global $sickbeardurl;
-
- if(strrpos($sickbeardurl, "/") < strlen($sickbeardurl)) {
- $sickbeardurl .= "/";
- }
-
- $html = getComingSoon();
- $body = stripBody($html);
- $body = stripInnerWrapper($body);
- //$body = changeLinks($body);
-
- if(!empty($_GET["style"]) && (($_GET["style"] == "s") || ($_GET["style"] == "m"))) {
- $reldir = (($_GET["style"] == "m") ? "../" : "");
- $body = str_replace("src=\"".$sickbeardurl."showPoster/", "src=\"".$reldir."sickbeardposter.php", $body);
- $body = str_replace("src=\"/sickbeard/showPoster/", "src=\"".$reldir."sickbeardposter.php", $body);
- $body = str_replace("src=\"/showPoster/", "src=\"".$reldir."sickbeardposter.php", $body);
- }
- $body = str_replace("src=\"/sickbeard/", "src=\"".$sickbeardurl, $body);
- $body = str_replace("href=\"/sickbeard/", "href=\"".$sickbeardurl, $body);
- $body = str_replace("src=\"/home/", "src=\"".$sickbeardurl."home/", $body);
- $body = str_replace("href=\"/home/", "href=\"".$sickbeardurl."home/", $body);
- $body = str_replace("src=\"home/", "src=\"".$sickbeardurl."home/", $body);
- $body = str_replace("href=\"home/", "href=\"".$sickbeardurl."home/", $body);
- $body = str_replace("src=\"/images/", "src=\"".$sickbeardurl."images/", $body);
- $body = str_replace("href=\"/images/", "href=\"".$sickbeardurl."images/", $body);
- $body = str_replace("src=\"images/", "src=\"".$sickbeardurl."images/", $body);
- $body = str_replace("href=\"images/", "href=\"".$sickbeardurl."images/", $body);
- echo $body;
-}
-
-if(!empty($_GET["style"]) && (($_GET["style"] == "s") || ($_GET["style"] == "w"))) {
- include_once "../config.php";
- displayComingSoon();
-}
-
-?>
+<?php
+//Note this example uses the "stylesheet", and "headerfunction" properties.
+$wdgtComingEpisodes = array("name" => "Coming Episodes", "type" => "inline", "function" => "widgetComingEpisodes();", "stylesheet" => "css/comingepisodes.css", "headerfunction" => "widgetComingEpisodesHeader();");
+$wIndex["wComingEpisodes"] = $wdgtComingEpisodes;
+
+function widgetComingEpisodes() {
+ global $sickbeardcomingepisodes;
+
+ echo "\t<div id=\"comingepisodeswrapper\"></div>\n";
+
+ if(strpos($sickbeardcomingepisodes, "http://")===false) {
+ $iFrameSource= 'widgets/wComingEpisodes.php?style=s';
+ } else {
+ if(strpos($sickbeardcomingepisodes, "/sickbeard/")===false) {
+ $iFrameSource= 'widgets/wComingEpisodes.php?display=yes';
+ } else {
+ $iFrameSource= 'widgets/wComingEpisodes.php?style=w';
+ }
+ }
+ echo " <iframe onload='onIFrameLoad(this);' src ='".$iFrameSource."' name='middle' scrolling='no' frameborder='0' border='0' framespacing='0'>";
+ echo " <p>Your browser does not support iframes.</p>";
+ echo " </iframe>";
+}
+function widgetComingEpisodesHeader() {
+ echo <<< ComingEpisodesSCRIPT
+ <script type="text/javascript" language="javascript">
+ <!--
+ function extractIFrameBody(iFrameEl) {
+ var doc = null;
+ if (iFrameEl.contentDocument) { // For NS6
+ doc = iFrameEl.contentDocument;
+ } else if (iFrameEl.contentWindow) { // For IE5.5 and IE6
+ doc = iFrameEl.contentWindow.document;
+ } else if (iFrameEl.document) { // For IE5
+ doc = iFrameEl.document;
+ } else {
+ alert("Error: could not find sumiFrame document");
+ return null;
+ }
+ return doc.body;
+ }
+ function onIFrameLoad(iFrameElement) {
+ var serverResponse = extractIFrameBody(iFrameElement).innerHTML;
+
+ var iFrameBody = document.getElementById("comingepisodeswrapper");
+ iFrameBody.innerHTML = serverResponse;
+ addAltClass();
+ addHighSlide();
+ //adjustHeight();
+ }
+
+ function addAltClass() {
+ var allHTMLTags = document.getElementsByTagName("*");
+ var alt;
+ alt = false;
+
+ for (i=0; i < allHTMLTags.length; i++) {
+ if (allHTMLTags[i].className == 'ep_listing') {
+ if(alt) {
+ allHTMLTags[i].className = 'ep_listing alt';
+ }
+ alt = !alt;
+ }
+ }
+ }
+
+ function addHighSlide() {
+ var allHTMLTags = document.getElementsByTagName("img");
+
+ for (i=0; i < allHTMLTags.length; i++) {
+ if (allHTMLTags[i].className == 'bannerThumb') {
+ //Set parent node <a> tag to have correct
+ allHTMLTags[i].parentNode.setAttribute('href',allHTMLTags[i].src);
+ allHTMLTags[i].parentNode.className = 'highslide';
+ allHTMLTags[i].parentNode.setAttribute('onclick','return hs.expand(this)');
+ allHTMLTags[i].parentNode.onclick = function() { return hs.expand(allHTMLTags[i]) };
+
+ //Wrap with span and reset.
+ var newHTML = '<span class="sbposter-img">'+allHTMLTags[i].parentNode.outerHTML+'<a><div class="highslide-caption"><br></div></a></span>';
+ allHTMLTags[i].parentNode.outerHTML = newHTML;
+ }
+ }
+ for (i=0; i < allHTMLTags.length; i++) {
+ if (allHTMLTags[i].className == 'posterThumb') {
+ //Set parent node <a> tag to have correct
+ allHTMLTags[i].parentNode.setAttribute('href',allHTMLTags[i].src);
+ allHTMLTags[i].parentNode.className = 'highslide';
+ allHTMLTags[i].parentNode.setAttribute('onclick','return hs.expand(this)');
+ allHTMLTags[i].parentNode.onclick = function() { return hs.expand(allHTMLTags[i]) };
+
+ //Wrap with span and reset.
+ var newHTML = '<span class="sbposter-img">'+allHTMLTags[i].parentNode.outerHTML+'<a><div class="highslide-caption"><br></div></a></span>';
+ allHTMLTags[i].parentNode.outerHTML = newHTML;
+ }
+ }
+ }
+
+ function adjustHeight() {
+ var windowSizeAdjustment = 100;
+ var windowHeight = (window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight) - windowSizeAdjustment;
+ if (windowHeight > 0) {
+ var objWrapper = document.getElementById("insideContent");
+ objWrapper.style.height = windowHeight + 'px';
+ }
+ }
+ -->
+ </script>
+
+ComingEpisodesSCRIPT;
+}
+if(!empty($_GET["display"])) {
+ include_once "../config.php";
+
+ $body = getComingSoon($sickbeardcomingepisodes);
+
+ $urldata = parse_url($sickbeardcomingepisodes);
+ $pos = strrpos($sickbeardcomingepisodes, "/");
+ if($pos < strlen($sickbeardcomingepisodes)) {
+ $uri_full = substr($sickbeardcomingepisodes, 0, $pos + 1);
+ } else {
+ $uri_full = $sickbeardcomingepisodes;
+ }
+ $uri_domain = str_replace($urldata["path"], "", $sickbeardcomingepisodes);
+
+ $regex = '/(<(img|a)\s*(.*?)\s*(src|href)=(?P<link>([\'"])\s*\S+?\s*\6)+?\s*(.*?)\s*>)/i';
+
+ preg_match_all($regex, $body, $matches);
+
+ foreach($matches['link'] as $link) {
+ $pos = strpos($link, "/");
+ if($pos && strpos($link, "//")===false) {
+ if($pos==1) {
+ $newlink = substr($link , 0, 1).$uri_domain.substr($link , 1);
+ } else {
+ $newlink = substr($link , 0, 1).$uri_full.substr($link , 1);
+ }
+ }
+ $body = str_replace($link, $newlink, $body);
+ }
+ echo $body;
+}
+
+function stripBody($body) {
+ $pos = strpos($body, "<body");
+ if ($pos > 0) {
+ $body = substr($body, $pos);
+ $pos = strpos($body, ">");
+ if ($pos > 0) {
+ $body = substr($body, $pos + 1);
+ $pos = strpos($body, "</body>");
+ if ($pos > 0) {
+ $body = substr($body, 0, $pos - 1);
+ }
+ }
+ }
+ return $body;
+}
+function stripInnerWrapper($body) {
+ $pos = strpos($body, "<h1>Coming Episodes</h1>");
+ if ($pos > 0) {
+ $body = substr($body, $pos);
+ $pos = strpos($body, "<script");
+ if ($pos > 0) {
+ $body = substr($body, 0, $pos - 1);
+ }
+ }
+ return $body;
+}
+function changeLinks($body) {
+ global $sickbeardcomingepisodes;
+
+ $urldata = parse_url($sickbeardcomingepisodes);
+ $pos = strrpos($sickbeardcomingepisodes, "/");
+ if($pos < strlen($sickbeardcomingepisodes)) {
+ $uri_full = substr($sickbeardcomingepisodes, 0, $pos + 1);
+ } else {
+ $uri_full = $sickbeardcomingepisodes;
+ }
+ $uri_domain = str_replace($urldata["path"], "", $sickbeardcomingepisodes);
+
+ $regex = '/(<[(img)|(a)]\s*(.*?)\s*[(src)|(href)]=(?P<link>[\'"]+?\s*\S+\s*[\'"])+?\s*(.*?)\s*>)/i';
+
+ preg_match_all($regex, $body, $matches);
+ foreach($matches['link'] as $link) {
+ $pos = strpos($link, "/");
+ if($pos && strpos($link, "//")===false) {
+ if($pos==1) {
+ $newlink = substr($link , 0, 1).$uri_domain.substr($link , 1);
+ } else {
+ $newlink = substr($link , 0, 1).$uri_full.substr($link , 1);
+ }
+ }
+ //$body = str_replace($link, "\"".sickbeardposter(str_replace("\"", "", $newlink))."\"", $body);
+ $body = str_replace($link, $newlink, $body);
+ }
+
+ return $body;
+}
+function comingSoonUrl($url = "") {
+ global $sickbeardcomingepisodes;
+
+ if(empty($url)) {
+ if(!(strpos($sickbeardcomingepisodes, "http") === 0)){
+ $url = "http://".$_SERVER['PHP_AUTH_USER'].":".$_SERVER['PHP_AUTH_PW']."@".$_SERVER['SERVER_NAME'].((strpos($sickbeardcomingepisodes, "/") === 0)?"":"/").$sickbeardcomingepisodes;
+ } else {
+ $url = $sickbeardcomingepisodes;
+ }
+ }
+ return $url;
+}
+
+function getComingSoon($url = "") {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_HTTPGET, 1);
+ curl_setopt($ch, CURLOPT_URL, comingSoonUrl($url));
+
+ $html = curl_exec($ch);
+ curl_close($ch);
+
+ return $html;
+}
+
+function displayComingSoon () {
+ global $sickbeardurl;
+
+ if(strrpos($sickbeardurl, "/") < strlen($sickbeardurl)) {
+ $sickbeardurl .= "/";
+ }
+
+ $html = getComingSoon();
+ $body = stripBody($html);
+ $body = stripInnerWrapper($body);
+ //$body = changeLinks($body);
+
+ if(!empty($_GET["style"]) && (($_GET["style"] == "s") || ($_GET["style"] == "m"))) {
+ $reldir = (($_GET["style"] == "m") ? "../" : "");
+ $body = str_replace("src=\"".$sickbeardurl."showPoster/", "src=\"".$reldir."sickbeardposter.php", $body);
+ $body = str_replace("src=\"/sickbeard/showPoster/", "src=\"".$reldir."sickbeardposter.php", $body);
+ $body = str_replace("src=\"/showPoster/", "src=\"".$reldir."sickbeardposter.php", $body);
+ }
+ $body = str_replace("src=\"/sickbeard/", "src=\"".$sickbeardurl, $body);
+ $body = str_replace("href=\"/sickbeard/", "href=\"".$sickbeardurl, $body);
+ $body = str_replace("src=\"/home/", "src=\"".$sickbeardurl."home/", $body);
+ $body = str_replace("href=\"/home/", "href=\"".$sickbeardurl."home/", $body);
+ $body = str_replace("src=\"home/", "src=\"".$sickbeardurl."home/", $body);
+ $body = str_replace("href=\"home/", "href=\"".$sickbeardurl."home/", $body);
+ $body = str_replace("src=\"/images/", "src=\"".$sickbeardurl."images/", $body);
+ $body = str_replace("href=\"/images/", "href=\"".$sickbeardurl."images/", $body);
+ $body = str_replace("src=\"images/", "src=\"".$sickbeardurl."images/", $body);
+ $body = str_replace("href=\"images/", "href=\"".$sickbeardurl."images/", $body);
+ echo $body;
+}
+
+if(!empty($_GET["style"]) && (($_GET["style"] == "s") || ($_GET["style"] == "w"))) {
+ include_once "../config.php";
+ displayComingSoon();
+}
+
+?>

0 comments on commit 35bd570

Please sign in to comment.
Something went wrong with that request. Please try again.