homepage.php 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  1. <?php
  2. $data = false;
  3. ini_set("display_errors", 1);
  4. ini_set("error_reporting", E_ALL | E_STRICT);
  5. require_once("user.php");
  6. require_once("functions.php");
  7. use Kryptonit3\Sonarr\Sonarr;
  8. use Kryptonit3\SickRage\SickRage;
  9. $sonarr = new Sonarr(SONARRURL, SONARRKEY);
  10. $radarr = new Sonarr(RADARRURL, RADARRKEY);
  11. $sickrage = new SickRage(SICKRAGEURL, SICKRAGEKEY);
  12. $USER = new User("registration_callback");
  13. // Check if connection to homepage is allowed
  14. qualifyUser(HOMEPAGEAUTHNEEDED, true);
  15. // Load Colours/Appearance
  16. foreach(loadAppearance() as $key => $value) {
  17. ${$key} = $value;
  18. }
  19. $startDate = date('Y-m-d',strtotime("-".CALENDARSTARTDAY." days"));
  20. $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
  21. ?>
  22. <!DOCTYPE html>
  23. <html lang="en" class="no-js">
  24. <head>
  25. <meta charset="UTF-8">
  26. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  27. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  28. <meta name="msapplication-tap-highlight" content="no" />
  29. <title><?=$title;?> Homepage</title>
  30. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  31. <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  32. <link rel="stylesheet" href="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css">
  33. <script src="js/menu/modernizr.custom.js"></script>
  34. <link rel="stylesheet" href="bower_components/animate.css/animate.min.css">
  35. <link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css">
  36. <link rel="stylesheet" href="css/style.css?v=<?php echo INSTALLEDVERSION; ?>">
  37. <link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css?v=<?php echo INSTALLEDVERSION; ?>">
  38. <link rel="stylesheet" href="bower_components/google-material-color/dist/palette.css?v=<?php echo INSTALLEDVERSION; ?>">
  39. <link rel="stylesheet" type="text/css" href="bower_components/slick/slick.css?v=<?php echo INSTALLEDVERSION; ?>">
  40. <!-- Add the slick-theme.css if you want default styling -->
  41. <!--Scripts-->
  42. <script src="bower_components/jquery/dist/jquery.min.js"></script>
  43. <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  44. <script src="bower_components/moment/min/moment.min.js"></script>
  45. <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  46. <script src="bower_components/slimScroll/jquery.slimscroll.min.js"></script>
  47. <script src="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
  48. <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  49. <script src="bower_components/cta/dist/cta.min.js"></script>
  50. <script src="bower_components/fullcalendar/dist/fullcalendar.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
  51. <script src="bower_components/slick/slick.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
  52. <script src="js/jqueri_ui_custom/jquery-ui.min.js"></script>
  53. <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
  54. <!--Other-->
  55. <script src="js/ajax.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
  56. <!--[if lt IE 9]>
  57. <script src="bower_components/html5shiv/dist/html5shiv.min.js"></script>
  58. <script src="bower_components/respondJs/dest/respond.min.js"></script>
  59. <![endif]-->
  60. <style>
  61. .fc-day-grid-event{
  62. cursor: pointer;
  63. }
  64. .recentItems {
  65. padding-top: 10px;
  66. margin: 5px 0;
  67. }
  68. .slick-image-tall{
  69. width: 125px;
  70. height: 180px;
  71. }
  72. .slick-image-short{
  73. width: 125px;
  74. height: 130px;
  75. margin-top: 50px;
  76. }
  77. .overlay{
  78. position: absolute;
  79. top: 0;
  80. left: 0;
  81. width: 100%;
  82. height: 100%;
  83. display: none;
  84. z-index: 0;
  85. opacity: .98;
  86. }
  87. sort {
  88. display: none;
  89. }
  90. table.fc-list-table {
  91. table-layout: auto;
  92. }.tabbable{
  93. margin-bottom: 0;
  94. }.fc-day-grid-event .fc-content {
  95. white-space: normal;
  96. }.fc-list-item {
  97. table-layout: auto;
  98. position: inherit;
  99. margin: 10px;
  100. border-radius: 4px;
  101. padding: 0 5px 0 5px;
  102. color: #fff !important;
  103. }.fc-calendar .fc-toolbar {
  104. background: <?=$topbar;?>;
  105. color: <?=$topbartext;?>;
  106. border-radius: 5px 5px 0 0;
  107. padding: 15px;
  108. }.fc-calendar .fc-toolbar .fc-right {
  109. bottom: 0px;
  110. right: 20px;
  111. }.fc-calendar .fc-toolbar .fc-right button {
  112. color: <?=$topbartext;?>;
  113. }.fc-calendar .fc-toolbar .fc-prev-button, .fc-calendar .fc-toolbar .fc-next-button {
  114. color: <?=$topbartext;?>;
  115. }.carousel-image{
  116. width: 100px !important;
  117. height: 150px !important;
  118. border-radius: 3px 0 0 3px;
  119. }.carousel-image.album{
  120. width: 150px !important;
  121. height: 150px !important;
  122. border-radius: 3px 0 0 3px;
  123. }.carousel-control.album {
  124. top: 5px !important;
  125. width: 4% !important;
  126. }.carousel-control {
  127. top: 5px !important;
  128. width: 4% !important;
  129. }.carousel-caption.album {
  130. position: absolute;
  131. right: 4%;
  132. top: 0px;
  133. left: 160px;
  134. z-index: 10;
  135. bottom: 0px;
  136. padding-top: 0px;
  137. color: #fff;
  138. text-align: left;
  139. }.carousel-caption {
  140. position: absolute;
  141. right: 4%;
  142. top: 0px;
  143. left: 110px;
  144. z-index: 10;
  145. bottom: 0px;
  146. padding-top: 0px;
  147. color: #fff;
  148. text-align: left;
  149. padding-bottom: 2px !important;
  150. overflow: hidden !important;
  151. } @media screen and (max-width: 576px) {
  152. .nzbtable {
  153. padding-left: 5px !important;
  154. padding-right: 2px !important;
  155. font-size: 10px !important;
  156. word-break: break-word !important;
  157. }
  158. .nzbtable-file-row {
  159. padding-left: 5px !important;
  160. padding-right: 2px !important;
  161. font-size: 10px !important;
  162. white-space: normal !important;
  163. word-break: break-all !important;
  164. width: 0% !important;
  165. }
  166. } .nzbtable-file-row {
  167. white-space: normal !important;
  168. word-break: break-all !important;
  169. width: 0% !important;
  170. }.nzbtable-row {
  171. white-space: normal !important;
  172. width: 0% !important;
  173. font-size: 12px; !important;
  174. }<?php customCSS(); ?>
  175. </style>
  176. </head>
  177. <body class="scroller-body" style="padding: 0px;">
  178. <div class="main-wrapper" style="position: initial;">
  179. <div id="content" class="container-fluid">
  180. <br/>
  181. <?php if (qualifyUser(HOMEPAGENOTICEAUTH) && HOMEPAGENOTICETITLE && HOMEPAGENOTICETYPE && HOMEPAGENOTICEMESSAGE && HOMEPAGENOTICELAYOUT) { echo buildHomepageNotice(HOMEPAGENOTICELAYOUT, HOMEPAGENOTICETYPE, HOMEPAGENOTICETITLE, HOMEPAGENOTICEMESSAGE); } ?>
  182. <?php if (qualifyUser(HOMEPAGECUSTOMHTML1AUTH) && HOMEPAGECUSTOMHTML1) { echo "<div>" . HOMEPAGECUSTOMHTML1 . "</div>"; } ?>
  183. <?php if(SPEEDTEST == "true"){ ?>
  184. <style type="text/css">
  185. .flash {
  186. animation: flash 0.6s linear infinite;
  187. }
  188. @keyframes flash {
  189. 0% { opacity: 0.6; }
  190. 50% { opacity: 1; }
  191. }
  192. </style>
  193. <script type="text/javascript">
  194. var w = null
  195. function runTest() {
  196. document.getElementById('startBtn').style.display = 'none'
  197. document.getElementById('testArea').style.display = ''
  198. document.getElementById('abortBtn').style.display = ''
  199. w = new Worker('bower_components/speed/speedtest_worker.min.js')
  200. var interval = setInterval(function () { w.postMessage('status') }, 100)
  201. w.onmessage = function (event) {
  202. var data = event.data.split(';')
  203. var status = Number(data[0])
  204. var dl = document.getElementById('download')
  205. var ul = document.getElementById('upload')
  206. var ping = document.getElementById('ping')
  207. var jitter = document.getElementById('jitter')
  208. dl.className = status === 1 ? 'w-name flash' : 'w-name'
  209. ping.className = status === 2 ? 'w-name flash' : 'w-name'
  210. jitter.className = ul.className = status === 3 ? 'w-name flash' : 'w-name'
  211. if (status >= 4) {
  212. clearInterval(interval)
  213. document.getElementById('abortBtn').style.display = 'none'
  214. document.getElementById('startBtn').style.display = ''
  215. w = null
  216. }
  217. if (status === 5) {
  218. document.getElementById('testArea').style.display = 'none'
  219. }
  220. dl.textContent = data[1] + " Mbit/s";
  221. $("#downloadpercent").attr("style", "width: " + data[1] + "%;");
  222. $("#uploadpercent").attr("style", "width: " + data[2] + "%;");
  223. $("#pingpercent").attr("style", "width: " + data[3] + "%;");
  224. $("#jitterpercent").attr("style", "width: " + data[5] + "%;");
  225. ul.textContent = data[2] + " Mbit/s";
  226. ping.textContent = data[3] + " ms";
  227. jitter.textContent = data[5] + " ms";
  228. }
  229. w.postMessage('start')
  230. }
  231. function abortTest() {
  232. if (w) w.postMessage('abort')
  233. }
  234. </script>
  235. <div class="row" id="testArea" style="display:none">
  236. <div class="test col-sm-3 col-lg-3">
  237. <div class="content-box ultra-widget green-bg" data-counter="">
  238. <div id="downloadpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  239. <div class="w-content">
  240. <div class="w-icon right pull-right"><i class="mdi mdi-cloud-download"></i></div>
  241. <div class="w-descr left pull-left text-center">
  242. <span class="testName text-uppercase w-name">Download</span>
  243. <br>
  244. <span class="w-name counter" id="download" ></span>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. <div class="test col-sm-3 col-lg-3">
  250. <div class="content-box ultra-widget red-bg" data-counter="">
  251. <div id="uploadpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  252. <div class="w-content">
  253. <div class="w-icon right pull-right"><i class="mdi mdi-cloud-upload"></i></div>
  254. <div class="w-descr left pull-left text-center">
  255. <span class="testName text-uppercase w-name">Upload</span>
  256. <br>
  257. <span class="w-name counter" id="upload" ></span>
  258. </div>
  259. </div>
  260. </div>
  261. </div>
  262. <div class="test col-sm-3 col-lg-3">
  263. <div class="content-box ultra-widget yellow-bg" data-counter="">
  264. <div id="pingpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  265. <div class="w-content">
  266. <div class="w-icon right pull-right"><i class="mdi mdi-timer"></i></div>
  267. <div class="w-descr left pull-left text-center">
  268. <span class="testName text-uppercase w-name">Latency</span>
  269. <br>
  270. <span class="w-name counter" id="ping" ></span>
  271. </div>
  272. </div>
  273. </div>
  274. </div>
  275. <div class="test col-sm-3 col-lg-3">
  276. <div class="content-box ultra-widget blue-bg" data-counter="">
  277. <div id="jitterpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  278. <div class="w-content">
  279. <div class="w-icon right pull-right"><i class="mdi mdi-pulse"></i></div>
  280. <div class="w-descr left pull-left text-center">
  281. <span class="testName text-uppercase w-name">Jitter</span>
  282. <br>
  283. <span class="w-name counter" id="jitter" ></span>
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. <br/>
  289. </div>
  290. <div id="abortBtn" class="row" style="display: none" onclick="javascript:abortTest()">
  291. <div class="col-lg-12">
  292. <div class="content-box red-bg" style="cursor: pointer;">
  293. <h1 style="margin: 10px" class="text-uppercase text-center">Abort Speed Test</h1>
  294. <div class="clearfix"></div>
  295. </div>
  296. </div>
  297. </div>
  298. <div id="startBtn" class="row" onclick="javascript:runTest()">
  299. <div class="col-lg-12">
  300. <div class="content-box green-bg" style="cursor: pointer;">
  301. <h1 style="margin: 10px" class="text-uppercase text-center">Run Speed Test</h1>
  302. <div class="clearfix"></div>
  303. </div>
  304. </div>
  305. </div>
  306. <?php } ?>
  307. <?php if((PLEXSEARCH == "true" && qualifyUser(PLEXHOMEAUTH))) { ?>
  308. <div id="searchPlexRow" class="row">
  309. <div class="col-lg-12">
  310. <div class="content-box box-shadow big-box todo-list">
  311. <form id="plexSearchForm" onsubmit="return false;" autocomplete="off">
  312. <div class="">
  313. <div class="input-group">
  314. <div style="border-radius: 25px 0 0 25px; border:0" class="input-group-addon gray-bg"><i class="fa fa-search white"></i></div>
  315. <input id="searchInput" type="text" style="border-radius: 0;" autocomplete="off" name="search-title" class="form-control input-group-addon gray-bg" placeholder="Media Search">
  316. <div id="clearSearch" style="border-radius: 0 25px 25px 0;border:0; cursor: pointer;" class="input-group-addon gray-bg"><i class="fa fa-close white"></i></div>
  317. <button style="display:none" id="plexSearchForm_submit" class="btn btn-primary waves"></button>
  318. </div>
  319. </div>
  320. </form>
  321. <div id="resultshere" class="table-responsive"></div>
  322. </div>
  323. </div>
  324. </div>
  325. <?php } ?>
  326. <?php if((NZBGETURL != "" && qualifyUser(NZBGETHOMEAUTH)) || (SABNZBDURL != "" && qualifyUser(SABNZBDHOMEAUTH))) { ?>
  327. <div id="downloadClientRow" class="row">
  328. <div class="col-xs-12 col-md-12">
  329. <div class="content-box">
  330. <div class="tabbable panel with-nav-tabs panel-default">
  331. <div class="panel-heading">
  332. <div class="content-tools i-block pull-right">
  333. <a id="getDownloader" class="repeat-btn">
  334. <i class="fa fa-repeat"></i>
  335. </a>
  336. <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
  337. <i class="fa fa-chevron-down"></i>
  338. </a>
  339. <!-- Lets Move This To Homepage Settings
  340. <ul id="downloaderSeconds" class="dropdown-menu" style="top: 32px !important">
  341. <li data-value="5000"><a>Refresh every 5 seconds</a></li>
  342. <li data-value="10000"><a>Refresh every 10 seconds</a></li>
  343. <li data-value="30000"><a>Refresh every 30 seconds</a></li>
  344. <li data-value="60000"><a>Refresh every 60 seconds</a></li>
  345. </ul>
  346. -->
  347. </div>
  348. <h3 class="pull-left"><?php if(NZBGETURL != ""){ echo "NZBGet "; } if(SABNZBDURL != ""){ echo "SABnzbd "; } ?></h3>
  349. <ul class="nav nav-tabs pull-right">
  350. <li class="active"><a href="#downloadQueue" data-toggle="tab" aria-expanded="true"><?php echo $language->translate("QUEUE");?></a></li>
  351. <li class=""><a href="#downloadHistory" data-toggle="tab" aria-expanded="false"><?php echo $language->translate("HISTORY");?></a></li>
  352. </ul>
  353. <div class="clearfix"></div>
  354. </div>
  355. <div class="panel-body">
  356. <div class="tab-content">
  357. <div class="tab-pane fade active in" id="downloadQueue">
  358. <div class="table-responsive" style="max-height: 300px">
  359. <table class="table table-striped progress-widget zero-m" style="max-height: 300px">
  360. <thead>
  361. <tr>
  362. <th class="col-xs-7 nzbtable-file-row"><?php echo $language->translate("FILE");?></th>
  363. <th class="col-xs-2 nzbtable"><?php echo $language->translate("STATUS");?></th>
  364. <th class="col-xs-1 nzbtable"><?php echo $language->translate("CATEGORY");?></th>
  365. <th class="col-xs-2 nzbtable"><?php echo $language->translate("PROGRESS");?></th>
  366. </tr>
  367. </thead>
  368. <tbody class="dl-queue sabnzbd"></tbody>
  369. <tbody class="dl-queue nzbget"></tbody>
  370. </table>
  371. </div>
  372. </div>
  373. <div class="tab-pane fade" id="downloadHistory">
  374. <div class="table-responsive" style="max-height: 300px">
  375. <table class="table table-striped progress-widget zero-m" style="max-height: 300px">
  376. <thead>
  377. <tr>
  378. <th class="col-xs-7 nzbtable-file-row"><?php echo $language->translate("FILE");?></th>
  379. <th class="col-xs-2 nzbtable"><?php echo $language->translate("STATUS");?></th>
  380. <th class="col-xs-1 nzbtable"><?php echo $language->translate("CATEGORY");?></th>
  381. <th class="col-xs-2 nzbtable"><?php echo $language->translate("PROGRESS");?></th>
  382. </tr>
  383. </thead>
  384. <tbody class="dl-history sabnzbd"></tbody>
  385. <tbody class="dl-history nzbget"></tbody>
  386. </table>
  387. </div>
  388. </div>
  389. </div>
  390. </div>
  391. </div>
  392. </div>
  393. </div>
  394. </div>
  395. <?php } ?>
  396. <?php if (qualifyUser(PLEXHOMEAUTH) && PLEXTOKEN) { ?>
  397. <div id="plexRowNowPlaying" class="row">
  398. <?php if(PLEXPLAYINGNOW == "true"){ echo getPlexStreams(12, PLEXSHOWNAMES, $USER->role); } ?>
  399. </div>
  400. <div id="plexRow" class="row">
  401. <div class="col-lg-12">
  402. <?php
  403. if(PLEXRECENTMOVIE == "true" || PLEXRECENTTV == "true" || PLEXRECENTMUSIC == "true"){
  404. $plexArray = array("movie" => PLEXRECENTMOVIE, "season" => PLEXRECENTTV, "album" => PLEXRECENTMUSIC);
  405. echo getPlexRecent($plexArray);
  406. }
  407. ?>
  408. </div>
  409. </div>
  410. <div id="plexPlaylists" class="row">
  411. <div class="col-lg-12">
  412. <?php
  413. if(PLEXPLAYLISTS == "true"){
  414. echo getPlexPlaylists($plexArray);
  415. }
  416. ?>
  417. </div>
  418. </div>
  419. <?php } ?>
  420. <?php if (qualifyUser(EMBYHOMEAUTH) && EMBYTOKEN) { ?>
  421. <div id="embyRowNowPlaying" class="row">
  422. <?php if(EMBYPLAYINGNOW == "true"){ echo getEmbyStreams(12, EMBYSHOWNAMES, $USER->role); } ?>
  423. </div>
  424. <div id="embyRow" class="row">
  425. <div class="col-lg-12">
  426. <?php
  427. if(EMBYRECENTMOVIE == "true" || EMBYRECENTTV == "true" || EMBYRECENTMUSIC == "true"){
  428. $embyArray = array("Movie" => EMBYRECENTMOVIE, "Episode" => EMBYRECENTTV, "MusicAlbum" => EMBYRECENTMUSIC, "Series" => EMBYRECENTTV);
  429. echo getEmbyRecent($embyArray);
  430. }
  431. ?>
  432. </div>
  433. </div>
  434. <?php } ?>
  435. <?php if ((SONARRURL != "" && qualifyUser(SONARRHOMEAUTH)) || (RADARRURL != "" && qualifyUser(RADARRHOMEAUTH)) || (HEADPHONESURL != "" && qualifyUser(HEADPHONESHOMEAUTH)) || (SICKRAGEURL != "" && qualifyUser(SICKRAGEHOMEAUTH))) { ?>
  436. <div id="calendarLegendRow" class="row" style="padding: 0 0 10px 0;">
  437. <div class="col-lg-12 content-form form-inline">
  438. <div class="form-group">
  439. <select class="form-control" id="imagetype_selector" style="width: auto !important; display: inline-block">
  440. <option value="all">View All</option>
  441. <?php if(RADARRURL != ""){ echo '<option value="film">Movies</option>'; }?>
  442. <?php if(SONARRURL != "" || SICKRAGEURL != ""){ echo '<option value="tv">TV Shows</option>'; }?>
  443. <?php if(HEADPHONESURL != ""){ echo '<option value="music">Music</option>'; }?>
  444. </select>
  445. <span class="label label-primary well-sm">Available</span>
  446. <span class="label label-danger well-sm">Unavailable</span>
  447. <span class="label indigo-bg well-sm">Unreleased</span>
  448. <span class="label light-blue-bg well-sm">Premier</span>
  449. </div>
  450. <!--
  451. <div class="pull-right">
  452. <div class="btn-group" role="group">
  453. <button type="button" class="btn waves btn-default btn-sm dropdown-toggle waves-effect waves-float" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">View All<span class="caret"></span></button>
  454. <ul style="right:0; left: auto" class="dropdown-menu">
  455. <li><a class="" href="javascript:void(0)">Movies</a></li>
  456. <li><a class="" href="javascript:void(0)">TV Shows</a></li>
  457. <li><a class="" href="javascript:void(0)">Music</a></li>
  458. </ul>
  459. </div>
  460. </div>-->
  461. </div>
  462. </div>
  463. <div id="calendarRow" class="row">
  464. <div class="col-lg-12">
  465. <div id="calendar" class="fc-calendar box-shadow fc fc-ltr fc-unthemed"></div>
  466. </div>
  467. </div>
  468. <?php } ?>
  469. </div>
  470. </div>
  471. <script>
  472. $('.close-btn').click(function(e){
  473. var closedBox = $(this).closest('div.content-box').remove();
  474. e.preventDefault();
  475. });
  476. $('#clearSearch').click(function(e){
  477. $('#searchInput').val("");
  478. $('#resultshere').html("");
  479. $('#searchInput').focus();
  480. e.preventDefault();
  481. });
  482. $(document).on("click", ".openTab", function(e) {
  483. if($(this).attr("openTab") === "true") {
  484. var isActive = parent.$("div[data-content-name^='<?php echo strtolower(PLEXTABNAME);?>']");
  485. var activeFrame = isActive.children('iframe');
  486. if(isActive.length === 1){
  487. activeFrame.attr("src", $(this).attr("href"));
  488. parent.$("li[name='<?php echo strtolower(PLEXTABNAME);?>']").trigger("click");
  489. }else{
  490. parent.$("li[name='<?php echo strtolower(PLEXTABNAME);?>']").trigger("click");
  491. parent.$("div[data-content-name^='<?php echo strtolower(PLEXTABNAME);?>']").children('iframe').attr("src", $(this).attr("href"));
  492. }
  493. e.preventDefault();
  494. }else{
  495. console.log("nope");
  496. }
  497. });
  498. function localStorageSupport() {
  499. return (('localStorage' in window) && window['localStorage'] !== null)
  500. }
  501. $( document ).ready(function() {
  502. $('#plexSearchForm').on('submit', function () {
  503. var refreshBox = $(this).closest('div.content-box');
  504. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(300);
  505. setTimeout(function(){
  506. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  507. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  508. refreshPreloader.remove();
  509. });
  510. },1000);
  511. ajax_request('POST', 'search-plex', {
  512. searchtitle: $('#plexSearchForm [name=search-title]').val(),
  513. }).done(function(data){ $('#resultshere').html(data);});
  514. });
  515. $('.repeat-btn').click(function(){
  516. var refreshBox = $(this).closest('div.content-box');
  517. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(300);
  518. setTimeout(function(){
  519. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  520. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  521. refreshPreloader.remove();
  522. });
  523. },1500);
  524. });
  525. $(document).on('click', '.w-refresh', function(){
  526. var id = $(this).attr("link");
  527. $("div[np^='"+id+"']").toggle();
  528. });
  529. $('div[class*=recentItems-]').each(function() {
  530. var name = $(this).attr("data-name");
  531. console.log(name);
  532. $(this).slick({
  533. slidesToShow: 13,
  534. slidesToScroll: 13,
  535. infinite: true,
  536. lazyLoad: 'ondemand',
  537. prevArrow: '<a class="zero-m pull-left prev-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-left"></i></a>',
  538. nextArrow: '<a class="pull-left next-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-right"></i></a>',
  539. appendArrows: $('.'+name),
  540. arrows: true,
  541. responsive: [
  542. {
  543. breakpoint: 1750,
  544. settings: {
  545. slidesToShow: 12,
  546. slidesToScroll: 12,
  547. }
  548. },
  549. {
  550. breakpoint: 1600,
  551. settings: {
  552. slidesToShow: 11,
  553. slidesToScroll: 11,
  554. }
  555. },
  556. {
  557. breakpoint: 1450,
  558. settings: {
  559. slidesToShow: 10,
  560. slidesToScroll: 10,
  561. }
  562. },
  563. {
  564. breakpoint: 1300,
  565. settings: {
  566. slidesToShow: 9,
  567. slidesToScroll: 9,
  568. }
  569. },
  570. {
  571. breakpoint: 1150,
  572. settings: {
  573. slidesToShow: 8,
  574. slidesToScroll: 8,
  575. }
  576. },
  577. {
  578. breakpoint: 1000,
  579. settings: {
  580. slidesToShow: 7,
  581. slidesToScroll: 7,
  582. }
  583. },
  584. {
  585. breakpoint: 850,
  586. settings: {
  587. slidesToShow: 6,
  588. slidesToScroll: 6,
  589. }
  590. },
  591. {
  592. breakpoint: 700,
  593. settings: {
  594. slidesToShow: 5,
  595. slidesToScroll: 5,
  596. }
  597. },
  598. {
  599. breakpoint: 675,
  600. settings: {
  601. slidesToShow: 4,
  602. slidesToScroll: 4
  603. }
  604. },
  605. {
  606. breakpoint: 480,
  607. settings: {
  608. slidesToShow: 3,
  609. slidesToScroll: 3
  610. }
  611. }
  612. // You can unslick at a given breakpoint now by adding:
  613. // settings: "unslick"
  614. // instead of a settings object
  615. ]
  616. });
  617. });
  618. //RECENT ITEMS
  619. // each filter we click on
  620. $(".filter-recent-event > li").on("click", function() {
  621. // toggle the filter on/off
  622. $(this).data( "filter-on" , !$(this).data("filter-on") );
  623. // set all the filter strings to empty
  624. var filtersOn = "";
  625. var filtersOff = "";
  626. var allFilters = "";
  627. // loop through each filter
  628. $(".filter-recent-event > li").each(function() {
  629. // set a variable to hold the value of the filter class
  630. // and also if the filter is on/off
  631. var filter = $(this).data("filter");
  632. var isOn = $(this).data("filter-on");
  633. // add the filter to the filtersOn / filtersOff collection
  634. if( isOn ) {
  635. filtersOn += "." + filter + ", ";
  636. } else {
  637. filtersOff += "." + filter + ", ";
  638. }
  639. });
  640. // remove the last ", " from each filter collection.
  641. filtersOn = filtersOn.replace(/, $/, "");
  642. filtersOff = filtersOff.replace(/, $/, "");
  643. // remove all filters if none are on.
  644. if( filtersOn === "" ) {
  645. filtersOn = "*";
  646. filtersOff = "";
  647. }
  648. // combine the filters together ( on + off )
  649. allFilters = filtersOn + ":not(" + filtersOff + ")";
  650. console.log( allFilters );
  651. // now filter the slides.
  652. $('.recentItems-recent')
  653. .slick('slickUnfilter')
  654. .slick('slickFilter' , allFilters );
  655. });
  656. //PLAYLIST SHIT
  657. // each filter we click on
  658. $(".filter-recent-playlist > li").on("click", function() {
  659. var name = $(this).attr('data-name');
  660. var filter = $(this).attr('data-filter');
  661. $('#playlist-title').text(name);
  662. // now filter the slides.
  663. $('.recentItems-playlists')
  664. .slick('slickUnfilter')
  665. .slick('slickFilter' , '.'+filter );
  666. });
  667. $("body").niceScroll({
  668. railpadding: {top:0,right:0,left:0,bottom:0},
  669. scrollspeed: 30,
  670. mousescrollstep: 60
  671. });
  672. $(".table-responsive").niceScroll({
  673. railpadding: {top:0,right:0,left:0,bottom:0},
  674. scrollspeed: 30,
  675. mousescrollstep: 60
  676. });
  677. // check if browser support HTML5 local storage
  678. <?php if((NZBGETURL != "" && qualifyUser(NZBGETHOMEAUTH)) || (SABNZBDURL != "" && qualifyUser(SABNZBDHOMEAUTH))){ ?>
  679. var queueRefresh = <?php echo DOWNLOADREFRESH; ?>;
  680. var historyRefresh = <?php echo HISTORYREFRESH; ?>; // This really doesn't need to happen that often
  681. var queueLoad = function() {
  682. <?php if(SABNZBDURL != "") { echo '$("tbody.dl-queue.sabnzbd").load("ajax.php?a=sabnzbd-update&list=queue");'; } ?>
  683. <?php if(NZBGETURL != "") { echo '$("tbody.dl-queue.nzbget").load("ajax.php?a=nzbget-update&list=listgroups");'; } ?>
  684. };
  685. var historyLoad = function() {
  686. <?php if(SABNZBDURL != "") { echo '$("tbody.dl-history.sabnzbd").load("ajax.php?a=sabnzbd-update&list=history");'; } ?>
  687. <?php if(NZBGETURL != "") { echo '$("tbody.dl-history.nzbget").load("ajax.php?a=nzbget-update&list=history");'; } ?>
  688. };
  689. // Initial Loads
  690. queueLoad();
  691. historyLoad();
  692. // Interval Loads
  693. var queueInterval = setInterval(queueLoad, queueRefresh);
  694. var historyInterval = setInterval(historyLoad, historyRefresh);
  695. // Manual Load
  696. $("#getDownloader").click(function() {
  697. queueLoad();
  698. historyLoad();
  699. });
  700. <?php } ?>
  701. });
  702. $( window ).on( "load", function() {
  703. $( "ul.filter-recent-playlist > li:first" ).trigger("click");
  704. });
  705. </script>
  706. <?php if ((SONARRURL != "" && qualifyUser(SONARRHOMEAUTH)) || (RADARRURL != "" && qualifyUser(RADARRHOMEAUTH)) || (HEADPHONESURL != "" && qualifyUser(HEADPHONESHOMEAUTH)) || (SICKRAGEURL != "" && qualifyUser(SICKRAGEHOMEAUTH))) { ?>
  707. <script>
  708. $(function () {
  709. var date = new Date();
  710. var d = date.getDate();
  711. var m = date.getMonth();
  712. var y = date.getFullYear();
  713. $('#calendar').fullCalendar({
  714. eventLimit: false,
  715. firstDay: <?php echo CALENDARSTART;?>,
  716. height: "auto",
  717. defaultView: '<?php echo CALENDARVIEW;?>',
  718. header: {
  719. left: 'prev,next,',
  720. center: 'title',
  721. right: 'today, month, basicDay,basicWeek,'
  722. },
  723. views: {
  724. basicDay: { buttonText: '<?php echo $language->translate("DAY");?>', eventLimit: false },
  725. basicWeek: { buttonText: '<?php echo $language->translate("WEEK");?>', eventLimit: false },
  726. month: { buttonText: '<?php echo $language->translate("MONTH");?>', eventLimit: false },
  727. today: { buttonText: '<?php echo $language->translate("TODAY");?>' },
  728. },
  729. events: [
  730. <?php
  731. if (SICKRAGEURL != "" && qualifyUser(SICKRAGEHOMEAUTH)){
  732. try {
  733. echo getSickrageCalendarWanted($sickrage->future());
  734. } catch (Exception $e) {
  735. writeLog("error", "SICKRAGE/BEARD ERROR: ".strip($e->getMessage()));
  736. } try {
  737. echo getSickrageCalendarHistory($sickrage->history("100","downloaded"));
  738. } catch (Exception $e) {
  739. writeLog("error", "SICKRAGE/BEARD ERROR: ".strip($e->getMessage()));
  740. }
  741. }
  742. if (SONARRURL != "" && qualifyUser(SONARRHOMEAUTH)){
  743. try {
  744. echo getSonarrCalendar($sonarr->getCalendar($startDate, $endDate));
  745. } catch (Exception $e) {
  746. writeLog("error", "SONARR ERROR: ".strip($e->getMessage()));
  747. }
  748. }
  749. if (RADARRURL != "" && qualifyUser(RADARRHOMEAUTH)){
  750. try {
  751. echo getRadarrCalendar($radarr->getCalendar($startDate, $endDate));
  752. } catch (Exception $e) {
  753. writeLog("error", "RADARR ERROR: ".strip($e->getMessage()));
  754. }
  755. }
  756. if (HEADPHONESURL != "" && qualifyUser(HEADPHONESHOMEAUTH)){
  757. echo getHeadphonesCalendar(HEADPHONESURL, HEADPHONESKEY, "getHistory");
  758. echo getHeadphonesCalendar(HEADPHONESURL, HEADPHONESKEY, "getWanted");
  759. }?>
  760. ],
  761. eventRender: function eventRender( event, element, view ) {
  762. return ['all', event.imagetype].indexOf($('#imagetype_selector').val()) >= 0
  763. },
  764. editable: false,
  765. droppable: false,
  766. timeFormat: '<?php echo CALTIMEFORMAT; ?>',
  767. });
  768. });
  769. $('#imagetype_selector').on('change',function(){
  770. $('#calendar').fullCalendar('rerenderEvents');
  771. })
  772. </script>
  773. <?php } ?>
  774. <script>
  775. function convertTime(a){
  776. if(a){
  777. var hours = Math.trunc(a/60);
  778. var minutes = a % 60;
  779. return hours+"h "+minutes+"m";
  780. }else{
  781. return "N/A";
  782. }
  783. }
  784. function convertArray(a, type){
  785. var result = "";
  786. var count = 1;
  787. var color = "";
  788. $.each( a, function( key, value ) {
  789. if (count == 1){ color = "gray"; }else{ color = "gray"; }
  790. if(type == "MOVIE"){
  791. result += '<span class="label label-'+color+'">'+value['name']+'</span>&nbsp;';
  792. }else if(type == "TV"){
  793. result += '<span class="label label-'+color+'">'+value+'</span>&nbsp;';
  794. }
  795. count++;
  796. });
  797. return result;
  798. }
  799. function convertTrailer(a){
  800. var result = "";
  801. var count = 1;
  802. $.each( a.results, function( key, value ) {
  803. if (count == 1){
  804. result += '<span id="openTrailer" style="cursor:pointer;width: 100%;display: block;" data-key="'+value['key']+'" data-name="'+value['name']+'" data-site="'+value['site']+'" class="label label-danger"><i class="fa fa-youtube-play" aria-hidden="true"></i> &nbsp;Watch Trailer</span>&nbsp;';
  805. }
  806. count++;
  807. });
  808. return result;
  809. }
  810. function convertCast(a){
  811. var result = "";
  812. var count = 1;
  813. $.each( a.cast, function( key, value ) {
  814. if( value['profile_path'] ){
  815. if (count <= 6){
  816. result += '<div class="col-lg-2 col-xs-2"><div class="zero-m"><img style="border-radius:10%;margin-left: auto;margin-right: auto;display: block;" height="50px" src="https://image.tmdb.org/t/p/w150'+value['profile_path']+'" alt="profile"><h5 class="text-center"><strong>'+value['name']+'</strong></h5><h6 class="text-center">'+value['character']+'</h6></div></div>';
  817. count++;
  818. }
  819. }
  820. });
  821. return result;
  822. }
  823. function whatIsIt(a){
  824. var what = Object.prototype.toString;
  825. if(what.call(a) == "[object Array]"){
  826. return a[0].fileName;
  827. }else if(what.call(a) == "[object Object]"){
  828. return a.fileName;
  829. }
  830. }
  831. function whatWasIt(a){
  832. var what = Object.prototype.toString;
  833. if(what.call(a) == "[object Array]"){
  834. return a[0];
  835. }else if(what.call(a) == "[object Object]"){
  836. return a;
  837. }
  838. }
  839. $(document).on('click', "#openTrailer", function(){
  840. var key = $(this).attr("data-key");
  841. $('#iFrameYT').html('<iframe id="calendarYoutube" class="embed-responsive-item" src="https://www.youtube.com/embed/'+key+'" allowfullscreen=""></iframe>');
  842. $('#calendarVideo').modal('show');
  843. });
  844. $(document).on('click', "a[class*=ID-]", function(){
  845. $('#calendarExtra').modal('show');
  846. var refreshBox = $('#calendarMainID');
  847. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(300);
  848. setTimeout(function(){
  849. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  850. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  851. refreshPreloader.remove();
  852. });
  853. },300);
  854. var check = $(this).attr("class");
  855. var ID = check.split("--")[1];
  856. if (~check.indexOf("tvID")){
  857. var type = "TV";
  858. ajax_request('POST', 'tvdb-get', {
  859. id: ID,
  860. }).done(function(data){
  861. if( data.trakt ) {
  862. $.ajax({
  863. type: 'GET',
  864. url: 'https://api.themoviedb.org/3/tv/'+data.trakt.tmdb+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits',
  865. cache: true,
  866. async: true,
  867. complete: function(xhr, status) {
  868. var result = $.parseJSON(xhr.responseText);
  869. if (xhr.statusText === "OK") {
  870. console.log(result);
  871. $('#calendarTitle').text(result.name);
  872. $('#calendarRating').html('<span class="label label-gray"><i class="fa fa-thumbs-up white"></i> '+result.vote_average+'</span>&nbsp;');
  873. $('#calendarRuntime').html('<span class="label label-gray"><i class="fa fa-clock-o white"></i> '+convertTime(whatWasIt(result.episode_run_time))+'</span>&nbsp;');
  874. $('#calendarSummary').text(result.overview);
  875. $('#calendarTagline').text("");
  876. $('#calendarTrailer').html(convertTrailer(result.videos));
  877. $('#calendarCast').html(convertCast(result.credits));
  878. $('#calendarGenres').html(convertArray(result.genres, "MOVIE"));
  879. $('#calendarLang').html(convertArray(result.languages, "TV"));
  880. $('#calendarPoster').attr("src","https://image.tmdb.org/t/p/w300"+result.poster_path);
  881. $('#calendarMain').attr("style","background-size: cover; background: linear-gradient(rgba(25,27,29,.75),rgba(25,27,29,.75)),url(https://image.tmdb.org/t/p/w1000"+result.backdrop_path+");top: 0;left: 0;width: 100%;height: 100%;position: fixed;");
  882. $('#calendarExtra').modal('show');
  883. }
  884. }
  885. });
  886. }else{
  887. $('#calendarTitle').text(data.series.seriesName);
  888. $('#calendarRating').html('<span class="label label-gray"><i class="fa fa-thumbs-up white"></i> '+data.series.siteRating+'</span>&nbsp');
  889. $('#calendarRuntime').html('<span class="label label-gray"><i class="fa fa-clock-o white"></i> '+convertTime(data.series.runtime)+'</span>&nbsp;');
  890. $('#calendarSummary').text(data.series.overview);
  891. $('#calendarTagline').text("");
  892. $('#calendarTrailer').html("");
  893. $('#calendarCast').html("");
  894. $('#calendarGenres').html(convertArray(data.series.genre, "TV"));
  895. $('#calendarLang').html("");
  896. $('#calendarPoster').attr("src","https://thetvdb.com/banners/_cache/"+whatIsIt(data.poster));
  897. $('#calendarMain').attr("style","background-size: cover; background: linear-gradient(rgba(25,27,29,.75),rgba(25,27,29,.75)),url(ajax.php?a=show-image&image=http://thetvdb.com/banners/"+whatIsIt(data.backdrop)+");top: 0;left: 0;width: 100%;height: 100%;position: fixed;");
  898. $('#calendarExtra').modal('show');
  899. }
  900. });
  901. }else if (~check.indexOf("movieID")){
  902. var type = "MOVIE";
  903. $.ajax({
  904. type: 'GET',
  905. url: 'https://api.themoviedb.org/3/movie/'+ID+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits',
  906. cache: true,
  907. async: true,
  908. complete: function(xhr, status) {
  909. var result = $.parseJSON(xhr.responseText);
  910. console.log(result);
  911. console.log(convertCast(result.credits));
  912. if (xhr.statusText === "OK") {
  913. $('#calendarTitle').text(result.title);
  914. $('#calendarRating').html('<span class="label label-gray"><i class="fa fa-thumbs-up white"></i> '+result.vote_average+'</span>&nbsp;');
  915. $('#calendarRuntime').html('<span class="label label-gray"><i class="fa fa-clock-o white"></i> '+convertTime(result.runtime)+'</span>&nbsp;');
  916. $('#calendarSummary').text(result.overview);
  917. $('#calendarTagline').text(result.tagline);
  918. $('#calendarTrailer').html(convertTrailer(result.videos));
  919. $('#calendarCast').html(convertCast(result.credits));
  920. $('#calendarGenres').html(convertArray(result.genres, "MOVIE"));
  921. $('#calendarLang').html(convertArray(result.spoken_languages, "MOVIE"));
  922. $('#calendarPoster').attr("src","https://image.tmdb.org/t/p/w300"+result.poster_path);
  923. $('#calendarMain').attr("style","background-size: cover; background: linear-gradient(rgba(25,27,29,.75),rgba(25,27,29,.75)),url(https://image.tmdb.org/t/p/w1000"+result.backdrop_path+");top: 0;left: 0;width: 100%;height: 100%;position: fixed;");
  924. $('#calendarExtra').modal('show');
  925. }
  926. }
  927. });
  928. }
  929. });
  930. </script>
  931. <div id="calendarExtra" class="modal fade in" tabindex="-1" role="dialog">
  932. <div class="modal-dialog modal-lg gray-bg" role="document">
  933. <div id="calendarMainID" class="modal-content">
  934. <div class="modal-content" id="calendarMain"></div>
  935. <div style="position: inherit; padding: 15px">
  936. <span id="calendarRuntime" class="pull-left"></span>
  937. <span id="calendarRating" class="pull-left"></span>
  938. <span id="calendarGenres" class="pull-right"></span>
  939. </div>
  940. <div class="modal-body">
  941. <div class="row">
  942. <div class="col-sm-4">
  943. <img style="width:100%;border-radius: 10px;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);" id="calendarPoster" src="">
  944. </div>
  945. <div class="col-sm-8">
  946. <h2 id="calendarTitle" class="modal-title text-center">Modal title</h2>
  947. <h6 id="calendarTagline" class="modal-title text-center"><em>Modal title</em></h6>
  948. <p id="calendarSummary">Modal Summary</p>
  949. <div class="" id="calendarCast">Modal Summary</div>
  950. </div>
  951. </div>
  952. </div>
  953. <div style="position: inherit; padding: 15px 0px 30px 0px; margin-top: -20px;">
  954. <div class="col-sm-4">
  955. <span id="calendarTrailer" class="pull-left" style="width:100%"></span>
  956. </div>
  957. <div class="col-sm-8">
  958. <span id="calendarLang" class="pull-right"></span>
  959. </div>
  960. </div>
  961. </div>
  962. </div>
  963. </div>
  964. <div id="calendarVideo" class="modal fade in palette-Grey-900 bg" tabindex="-1" role="dialog">
  965. <div class="modal-dialog modal-lg gray-bg" role="document">
  966. <div id="calendarMainVideo" class="modal-content gray-bg">
  967. <div class="">
  968. <!-- 16:9 aspect ratio -->
  969. <div id="iFrameYT" class="embed-responsive embed-responsive-16by9 gray-bg"></div>
  970. </div>
  971. </div>
  972. </div>
  973. </div>
  974. </body>
  975. </html>