" . $item . " & "; elseif($i = $messageCount) : echo "" . $item . ""; endif; endforeach; } function write_ini_file($content, $path) { if (!$handle = fopen($path, 'w')) { return false; } $success = fwrite($handle, trim($content)); fclose($handle); return $success; } function gotTimezone(){ $regions = array( 'Africa' => DateTimeZone::AFRICA, 'America' => DateTimeZone::AMERICA, 'Antarctica' => DateTimeZone::ANTARCTICA, 'Arctic' => DateTimeZone::ARCTIC, 'Asia' => DateTimeZone::ASIA, 'Atlantic' => DateTimeZone::ATLANTIC, 'Australia' => DateTimeZone::AUSTRALIA, 'Europe' => DateTimeZone::EUROPE, 'Indian' => DateTimeZone::INDIAN, 'Pacific' => DateTimeZone::PACIFIC ); $timezones = array(); foreach ($regions as $name => $mask) { $zones = DateTimeZone::listIdentifiers($mask); foreach($zones as $timezone) { $time = new DateTime(NULL, new DateTimeZone($timezone)); $ampm = $time->format('H') > 12 ? ' ('. $time->format('g:i a'). ')' : ''; $timezones[$name][$timezone] = substr($timezone, strlen($name) + 1) . ' - ' . $time->format('H:i') . $ampm; } } print ''; } function getTimezone(){ $regions = array( 'Africa' => DateTimeZone::AFRICA, 'America' => DateTimeZone::AMERICA, 'Antarctica' => DateTimeZone::ANTARCTICA, 'Arctic' => DateTimeZone::ARCTIC, 'Asia' => DateTimeZone::ASIA, 'Atlantic' => DateTimeZone::ATLANTIC, 'Australia' => DateTimeZone::AUSTRALIA, 'Europe' => DateTimeZone::EUROPE, 'Indian' => DateTimeZone::INDIAN, 'Pacific' => DateTimeZone::PACIFIC ); $timezones = array(); foreach ($regions as $name => $mask) { $zones = DateTimeZone::listIdentifiers($mask); foreach($zones as $timezone) { $time = new DateTime(NULL, new DateTimeZone($timezone)); $ampm = $time->format('H') > 12 ? ' ('. $time->format('g:i a'). ')' : ''; $timezones[$name][$timezone] = substr($timezone, strlen($name) + 1) . ' - ' . $time->format('H:i') . $ampm; } } print ''; } function explosion($string, $position){ $getWord = explode("|", $string); return $getWord[$position]; } function getServerPath() { if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { $protocol = "https://"; } else { $protocol = "http://"; } return $protocol . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']); } function get_browser_name() { $user_agent = $_SERVER['HTTP_USER_AGENT']; if (strpos($user_agent, 'Opera') || strpos($user_agent, 'OPR/')) return 'Opera'; elseif (strpos($user_agent, 'Edge')) return 'Edge'; elseif (strpos($user_agent, 'Chrome')) return 'Chrome'; elseif (strpos($user_agent, 'Safari')) return 'Safari'; elseif (strpos($user_agent, 'Firefox')) return 'Firefox'; elseif (strpos($user_agent, 'MSIE') || strpos($user_agent, 'Trident/7')) return 'Internet Explorer'; return 'Other'; } function getPlexRecent($url, $port, $type, $token, $size, $header){ $urlCheck = stripos($url, "http"); if ($urlCheck === false) { $url = "http://" . $url; } if($port !== ""){ $url = $url . ":" . $port; } $address = $url; $api = file_get_contents($address."/library/recentlyAdded?X-Plex-Token=".$token); $api = simplexml_load_string($api); $i = 0; $gotPlex = '
'.$header.'
'; $gotPlex .= '
'; if ($i != 0){ return $gotPlex; } } function getPlexStreams($url, $port, $token, $size, $header){ $urlCheck = stripos($url, "http"); if ($urlCheck === false) { $url = "http://" . $url; } if($port !== ""){ $url = $url . ":" . $port; } $address = $url; $api = file_get_contents($address."/status/sessions?X-Plex-Token=".$token); $api = simplexml_load_string($api); $i = 0; $gotPlex = '
'.$header.'
'; $gotPlex .= '
'; $noPlex = '
'.$header.'
'; $noPlex .= '
'; if ($i != 0){ return $gotPlex; } if ($i == 0){ return $noPlex; } } function getSonarrCalendar($url, $port, $key){ $startDate = date('Y-m-d',strtotime("-30 days")); $endDate = date('Y-m-d',strtotime("+30 days")); $urlCheck = stripos($url, "http"); if ($urlCheck === false) { $url = "http://" . $url; } if($port !== ""){ $url = $url . ":" . $port; } $address = $url; $api = file_get_contents($address."/api/calendar?apikey=".$key."&start=".$startDate."&end=".$endDate); $api = json_decode($api, true); $i = 0; $gotCalendar = ""; foreach($api AS $child) { $i++; $seriesName = $child['series']['title']; $runtime = $child['series']['runtime']; $episodeName = htmlspecialchars($child['title'], ENT_QUOTES); $episodeAirDate = $child['airDateUtc']; $episodeAirDate = strtotime($episodeAirDate); $episodeAirDate = date("Y-m-d H:i:s", $episodeAirDate); if (new DateTime() < new DateTime($episodeAirDate)) { $unaired = true; } $downloaded = $child['hasFile']; if($downloaded == "0" && isset($unaired)){ $downloaded = "indigo-bg"; }elseif($downloaded == "1"){ $downloaded = "green-bg";}else{ $downloaded = "red-bg"; } $gotCalendar .= "{ title: \"$seriesName\", start: \"$episodeAirDate\", className: \"$downloaded\", imagetype: \"tv\" }, \n"; } if ($i != 0){ return $gotCalendar; } } function getRadarrCalendar($url, $port, $key){ $startDate = date('Y-m-d',strtotime("-30 days")); $endDate = date('Y-m-d',strtotime("+30 days")); $urlCheck = stripos($url, "http"); if ($urlCheck === false) { $url = "http://" . $url; } if($port !== ""){ $url = $url . ":" . $port; } $address = $url; $api = file_get_contents($address."/api/calendar?apikey=".$key."&start=".$startDate."&end=".$endDate); $api = json_decode($api, true); $i = 0; $gotCalendar = ""; foreach($api AS $child) { if(isset($child['physicalRelease'])){ $i++; $movieName = $child['title']; $runtime = $child['runtime']; $physicalRelease = $child['physicalRelease']; $physicalRelease = strtotime($physicalRelease); $physicalRelease = date("Y-m-d", $physicalRelease); if (new DateTime() < new DateTime($physicalRelease)) { $notReleased = true; } $downloaded = $child['hasFile']; if($downloaded == "0" && isset($notReleased)){ $downloaded = "indigo-bg"; }elseif($downloaded == "1"){ $downloaded = "green-bg"; }else{ $downloaded = "red-bg"; } $gotCalendar .= "{ title: \"$movieName\", start: \"$physicalRelease\", className: \"$downloaded\", imagetype: \"film\" }, \n"; } } if ($i != 0){ return $gotCalendar; } } function nzbgetConnect($url, $port, $username, $password, $list){ $urlCheck = stripos($url, "http"); if ($urlCheck === false) { $url = "http://" . $url; } if($port !== ""){ $url = $url . ":" . $port; } $address = $url; $api = file_get_contents("$url/$username:$password/jsonrpc/$list"); $api = json_decode($api, true); $i = 0; $gotNZB = ""; foreach ($api['result'] AS $child) { $i++; //echo '
' . var_export($child, true) . '
'; $downloadName = $child['NZBName']; $downloadStatus = $child['Status']; $downloadCategory = $child['Category']; if($list == "history"){ $downloadPercent = "100"; $progressBar = ""; } if($list == "listgroups"){ $downloadPercent = (($child['FileSizeMB'] - $child['RemainingSizeMB']) / $child['FileSizeMB']) * 100; $progressBar = "progress-bar-striped active"; } if($child['Health'] <= "750"){ $downloadHealth = "danger"; }elseif($child['Health'] <= "900"){ $downloadHealth = "warning"; }elseif($child['Health'] <= "1000"){ $downloadHealth = "success"; } $gotNZB .= ' '.$downloadName.' '.$downloadStatus.' '.$downloadCategory.'

'.round($downloadPercent).'%

'.$downloadPercent.'% Complete
'; } if($i > 0){ return $gotNZB; } if($i == 0){ echo '

No Results

'; } } function sabnzbdConnect($url, $port, $key, $list){ $urlCheck = stripos($url, "http"); if ($urlCheck === false) { $url = "http://" . $url; } if($port !== ""){ $url = $url . ":" . $port; } $address = $url; $api = file_get_contents("$url/api?mode=$list&output=json&apikey=$key"); $api = json_decode($api, true); $i = 0; $gotNZB = ""; foreach ($api[$list]['slots'] AS $child) { $i++; if($list == "queue"){ $downloadName = $child['filename']; $downloadCategory = $child['cat']; $downloadPercent = (($child['mb'] - $child['mbleft']) / $child['mb']) * 100; $progressBar = "progress-bar-striped active"; } if($list == "history"){ $downloadName = $child['name']; $downloadCategory = $child['category']; $downloadPercent = "100"; $progressBar = ""; } $downloadStatus = $child['status']; $gotNZB .= ' '.$downloadName.' '.$downloadStatus.' '.$downloadCategory.'

'.round($downloadPercent).'%

'.$downloadPercent.'% Complete
'; } if($i > 0){ return $gotNZB; } if($i == 0){ echo '

No Results

'; } } function getHeadphonesCalendar($url, $port, $key, $list){ $urlCheck = stripos($url, "http"); if ($urlCheck === false) { $url = "http://" . $url; } if($port !== ""){ $url = $url . ":" . $port; } $address = $url; $api = file_get_contents($address."/api?apikey=".$key."&cmd=$list"); $api = json_decode($api, true); $i = 0; $gotCalendar = ""; foreach($api AS $child) { if($child['Status'] != "Skipped"){ $i++; $albumName = $child['AlbumTitle']; $albumArtist = $child['ArtistName']; $albumDate = $child['ReleaseDate']; $albumDate = strtotime($albumDate); $albumDate = date("Y-m-d", $albumDate); $albumStatus = $child['Status']; if (new DateTime() < new DateTime($albumDate)) { $notReleased = "true"; }else{ $notReleased = "false"; } if($albumStatus == "Wanted" && $notReleased == "true"){ $albumStatusColor = "indigo-bg"; }elseif($albumStatus == "Downloaded"){ $albumStatusColor = "green-bg"; }else{ $albumStatusColor = "red-bg"; } $gotCalendar .= "{ title: \"$albumArtist - $albumName\", start: \"$albumDate\", className: \"$albumStatusColor\", imagetype: \"music\" }, \n"; } } if ($i != 0){ return $gotCalendar; } } ?>