homepage.php 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  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. $dbfile = DATABASE_LOCATION.'users.db';
  16. $file_db = new PDO("sqlite:" . $dbfile);
  17. $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  18. $dbOptions = $file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="options"');
  19. $hasOptions = "No";
  20. foreach($dbOptions as $row) :
  21. if (in_array("options", $row)) :
  22. $hasOptions = "Yes";
  23. endif;
  24. endforeach;
  25. if($hasOptions == "No") :
  26. $title = "Organizr";
  27. $topbar = "#333333";
  28. $topbartext = "#66D9EF";
  29. $bottombar = "#333333";
  30. $sidebar = "#393939";
  31. $hoverbg = "#AD80FD";
  32. $activetabBG = "#F92671";
  33. $activetabicon = "#FFFFFF";
  34. $activetabtext = "#FFFFFF";
  35. $inactiveicon = "#66D9EF";
  36. $inactivetext = "#66D9EF";
  37. $loading = "#66D9EF";
  38. $hovertext = "#000000";
  39. endif;
  40. if($hasOptions == "Yes") :
  41. $resulto = $file_db->query('SELECT * FROM options');
  42. foreach($resulto as $row) :
  43. $title = isset($row['title']) ? $row['title'] : "Organizr";
  44. $topbartext = isset($row['topbartext']) ? $row['topbartext'] : "#66D9EF";
  45. $topbar = isset($row['topbar']) ? $row['topbar'] : "#333333";
  46. $bottombar = isset($row['bottombar']) ? $row['bottombar'] : "#333333";
  47. $sidebar = isset($row['sidebar']) ? $row['sidebar'] : "#393939";
  48. $hoverbg = isset($row['hoverbg']) ? $row['hoverbg'] : "#AD80FD";
  49. $activetabBG = isset($row['activetabBG']) ? $row['activetabBG'] : "#F92671";
  50. $activetabicon = isset($row['activetabicon']) ? $row['activetabicon'] : "#FFFFFF";
  51. $activetabtext = isset($row['activetabtext']) ? $row['activetabtext'] : "#FFFFFF";
  52. $inactiveicon = isset($row['inactiveicon']) ? $row['inactiveicon'] : "#66D9EF";
  53. $inactivetext = isset($row['inactivetext']) ? $row['inactivetext'] : "#66D9EF";
  54. $loading = isset($row['loading']) ? $row['loading'] : "#66D9EF";
  55. $hovertext = isset($row['hovertext']) ? $row['hovertext'] : "#000000";
  56. endforeach;
  57. endif;
  58. $startDate = date('Y-m-d',strtotime("-".CALENDARSTARTDAY." days"));
  59. $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
  60. ?>
  61. <!DOCTYPE html>
  62. <html lang="en" class="no-js">
  63. <head>
  64. <meta charset="UTF-8">
  65. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  66. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  67. <meta name="msapplication-tap-highlight" content="no" />
  68. <title><?=$title;?> Homepage</title>
  69. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  70. <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  71. <link rel="stylesheet" href="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css">
  72. <script src="js/menu/modernizr.custom.js"></script>
  73. <link rel="stylesheet" href="bower_components/animate.css/animate.min.css">
  74. <link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css">
  75. <link rel="stylesheet" href="css/style.css">
  76. <link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css?v=<?php echo INSTALLEDVERSION; ?>">
  77. <!--Scripts-->
  78. <script src="bower_components/jquery/dist/jquery.min.js"></script>
  79. <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  80. <script src="bower_components/moment/min/moment.min.js"></script>
  81. <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  82. <script src="bower_components/slimScroll/jquery.slimscroll.min.js"></script>
  83. <script src="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
  84. <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  85. <script src="bower_components/cta/dist/cta.min.js"></script>
  86. <script src="bower_components/fullcalendar/dist/fullcalendar.js"></script>
  87. <script src="js/jqueri_ui_custom/jquery-ui.min.js"></script>
  88. <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
  89. <!--Other-->
  90. <script src="js/ajax.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
  91. <!--[if lt IE 9]>
  92. <script src="bower_components/html5shiv/dist/html5shiv.min.js"></script>
  93. <script src="bower_components/respondJs/dest/respond.min.js"></script>
  94. <![endif]-->
  95. <style>
  96. sort {
  97. display: none;
  98. }
  99. table.fc-list-table {
  100. table-layout: auto;
  101. }.tabbable{
  102. margin-bottom: 0;
  103. }.fc-day-grid-event .fc-content {
  104. white-space: normal;
  105. }.fc-list-item {
  106. table-layout: auto;
  107. position: inherit;
  108. margin: 10px;
  109. border-radius: 4px;
  110. padding: 0 5px 0 5px;
  111. color: #fff !important;
  112. }.fc-calendar .fc-toolbar {
  113. background: <?=$topbar;?>;
  114. color: <?=$topbartext;?>;
  115. border-radius: 5px 5px 0 0;
  116. padding: 15px;
  117. }.fc-calendar .fc-toolbar .fc-right {
  118. bottom: 0px;
  119. right: 20px;
  120. }.fc-calendar .fc-toolbar .fc-right button {
  121. color: <?=$topbartext;?>;
  122. }.fc-calendar .fc-toolbar .fc-prev-button, .fc-calendar .fc-toolbar .fc-next-button {
  123. color: <?=$topbartext;?>;
  124. }.carousel-image{
  125. width: 100px !important;
  126. height: 150px !important;
  127. border-radius: 3px 0 0 3px;
  128. }.carousel-image.album{
  129. width: 150px !important;
  130. height: 150px !important;
  131. border-radius: 3px 0 0 3px;
  132. }.carousel-control.album {
  133. top: 5px !important;
  134. width: 4% !important;
  135. }.carousel-control {
  136. top: 5px !important;
  137. width: 4% !important;
  138. }.carousel-caption.album {
  139. position: absolute;
  140. right: 4%;
  141. top: 0px;
  142. left: 160px;
  143. z-index: 10;
  144. bottom: 0px;
  145. padding-top: 0px;
  146. color: #fff;
  147. text-align: left;
  148. }.carousel-caption {
  149. position: absolute;
  150. right: 4%;
  151. top: 0px;
  152. left: 110px;
  153. z-index: 10;
  154. bottom: 0px;
  155. padding-top: 0px;
  156. color: #fff;
  157. text-align: left;
  158. padding-bottom: 2px !important;
  159. overflow: hidden !important;
  160. } @media screen and (max-width: 576px) {
  161. .nzbtable {
  162. padding-left: 5px !important;
  163. padding-right: 2px !important;
  164. font-size: 10px !important;
  165. word-break: break-word !important;
  166. }
  167. .nzbtable-file-row {
  168. padding-left: 5px !important;
  169. padding-right: 2px !important;
  170. font-size: 10px !important;
  171. white-space: normal !important;
  172. word-break: break-all !important;
  173. width: 0% !important;
  174. }
  175. } .nzbtable-file-row {
  176. white-space: normal !important;
  177. word-break: break-all !important;
  178. width: 0% !important;
  179. }.nzbtable-row {
  180. white-space: normal !important;
  181. width: 0% !important;
  182. font-size: 12px; !important;
  183. }<?php if(CUSTOMCSS == "true") :
  184. $template_file = "custom.css";
  185. $file_handle = fopen($template_file, "rb");
  186. echo fread($file_handle, filesize($template_file));
  187. fclose($file_handle);
  188. echo "\n";
  189. endif; ?>
  190. </style>
  191. </head>
  192. <body class="scroller-body" style="padding: 0px;">
  193. <div class="main-wrapper" style="position: initial;">
  194. <div id="content" class="container-fluid">
  195. <!-- <button id="numBnt">Numerical</button> -->
  196. <br/>
  197. <?php if (qualifyUser(HOMEPAGENOTICEAUTH) && HOMEPAGENOTICETITLE && HOMEPAGENOTICETYPE && HOMEPAGENOTICEMESSAGE) { ?>
  198. <div class="row">
  199. <div class="col-lg-12">
  200. <div class="content-box big-box box-shadow panel-box panel-<?php echo HOMEPAGENOTICETYPE; ?>">
  201. <div class="content-title i-block">
  202. <h4 class="zero-m"><strong><?php echo HOMEPAGENOTICETITLE; ?></strong></h4>
  203. <div class="content-tools i-block pull-right">
  204. <a class="close-btn">
  205. <i class="fa fa-times"></i>
  206. </a>
  207. </div>
  208. </div>
  209. <p><?php echo HOMEPAGENOTICEMESSAGE; ?></p>
  210. </div>
  211. </div>
  212. </div>
  213. <?php } ?>
  214. <?php if (qualifyUser(HOMEPAGECUSTOMHTML1AUTH) && HOMEPAGECUSTOMHTML1) { echo "<div>" . HOMEPAGECUSTOMHTML1 . "</div>"; } ?>
  215. <?php if(SPEEDTEST == "true"){ ?>
  216. <style type="text/css">
  217. .flash {
  218. animation: flash 0.6s linear infinite;
  219. }
  220. @keyframes flash {
  221. 0% { opacity: 0.6; }
  222. 50% { opacity: 1; }
  223. }
  224. </style>
  225. <script type="text/javascript">
  226. var w = null
  227. function runTest() {
  228. document.getElementById('startBtn').style.display = 'none'
  229. document.getElementById('testArea').style.display = ''
  230. document.getElementById('abortBtn').style.display = ''
  231. w = new Worker('bower_components/speed/speedtest_worker.min.js')
  232. var interval = setInterval(function () { w.postMessage('status') }, 100)
  233. w.onmessage = function (event) {
  234. var data = event.data.split(';')
  235. var status = Number(data[0])
  236. var dl = document.getElementById('download')
  237. var ul = document.getElementById('upload')
  238. var ping = document.getElementById('ping')
  239. var jitter = document.getElementById('jitter')
  240. dl.className = status === 1 ? 'w-name flash' : 'w-name'
  241. ping.className = status === 2 ? 'w-name flash' : 'w-name'
  242. jitter.className = ul.className = status === 3 ? 'w-name flash' : 'w-name'
  243. if (status >= 4) {
  244. clearInterval(interval)
  245. document.getElementById('abortBtn').style.display = 'none'
  246. document.getElementById('startBtn').style.display = ''
  247. w = null
  248. }
  249. if (status === 5) {
  250. document.getElementById('testArea').style.display = 'none'
  251. }
  252. dl.textContent = data[1] + " Mbit/s";
  253. $("#downloadpercent").attr("style", "width: " + data[1] + "%;");
  254. $("#uploadpercent").attr("style", "width: " + data[2] + "%;");
  255. $("#pingpercent").attr("style", "width: " + data[3] + "%;");
  256. $("#jitterpercent").attr("style", "width: " + data[5] + "%;");
  257. ul.textContent = data[2] + " Mbit/s";
  258. ping.textContent = data[3] + " ms";
  259. jitter.textContent = data[5] + " ms";
  260. }
  261. w.postMessage('start')
  262. }
  263. function abortTest() {
  264. if (w) w.postMessage('abort')
  265. }
  266. </script>
  267. <div class="row" id="testArea" style="display:none">
  268. <div class="test col-sm-3 col-lg-3">
  269. <div class="content-box ultra-widget green-bg" data-counter="">
  270. <div id="downloadpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  271. <div class="w-content">
  272. <div class="w-icon right pull-right"><i class="mdi mdi-cloud-download"></i></div>
  273. <div class="w-descr left pull-left text-center">
  274. <span class="testName text-uppercase w-name">Download</span>
  275. <br>
  276. <span class="w-name counter" id="download" ></span>
  277. </div>
  278. </div>
  279. </div>
  280. </div>
  281. <div class="test col-sm-3 col-lg-3">
  282. <div class="content-box ultra-widget red-bg" data-counter="">
  283. <div id="uploadpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  284. <div class="w-content">
  285. <div class="w-icon right pull-right"><i class="mdi mdi-cloud-upload"></i></div>
  286. <div class="w-descr left pull-left text-center">
  287. <span class="testName text-uppercase w-name">Upload</span>
  288. <br>
  289. <span class="w-name counter" id="upload" ></span>
  290. </div>
  291. </div>
  292. </div>
  293. </div>
  294. <div class="test col-sm-3 col-lg-3">
  295. <div class="content-box ultra-widget yellow-bg" data-counter="">
  296. <div id="pingpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  297. <div class="w-content">
  298. <div class="w-icon right pull-right"><i class="mdi mdi-timer"></i></div>
  299. <div class="w-descr left pull-left text-center">
  300. <span class="testName text-uppercase w-name">Latency</span>
  301. <br>
  302. <span class="w-name counter" id="ping" ></span>
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. <div class="test col-sm-3 col-lg-3">
  308. <div class="content-box ultra-widget blue-bg" data-counter="">
  309. <div id="jitterpercent" class="progress-bar progress-bar-striped active w-used" style=""></div>
  310. <div class="w-content">
  311. <div class="w-icon right pull-right"><i class="mdi mdi-pulse"></i></div>
  312. <div class="w-descr left pull-left text-center">
  313. <span class="testName text-uppercase w-name">Jitter</span>
  314. <br>
  315. <span class="w-name counter" id="jitter" ></span>
  316. </div>
  317. </div>
  318. </div>
  319. </div>
  320. <br/>
  321. </div>
  322. <div id="abortBtn" class="row" style="display: none" onclick="javascript:abortTest()">
  323. <div class="col-lg-12">
  324. <div class="content-box red-bg" style="cursor: pointer;">
  325. <h1 style="margin: 10px" class="text-uppercase text-center">Abort Speed Test</h1>
  326. <div class="clearfix"></div>
  327. </div>
  328. </div>
  329. </div>
  330. <div id="startBtn" class="row" onclick="javascript:runTest()">
  331. <div class="col-lg-12">
  332. <div class="content-box green-bg" style="cursor: pointer;">
  333. <h1 style="margin: 10px" class="text-uppercase text-center">Run Speed Test</h1>
  334. <div class="clearfix"></div>
  335. </div>
  336. </div>
  337. </div>
  338. <?php } ?>
  339. <?php if((NZBGETURL != "" && qualifyUser(NZBGETHOMEAUTH)) || (SABNZBDURL != "" && qualifyUser(SABNZBDHOMEAUTH))) { ?>
  340. <div id="downloadClientRow" class="row">
  341. <sort>2</sort>
  342. <div class="col-xs-12 col-md-12">
  343. <div class="content-box">
  344. <div class="tabbable panel with-nav-tabs panel-default">
  345. <div class="panel-heading">
  346. <div class="content-tools i-block pull-right">
  347. <a id="getDownloader" class="repeat-btn">
  348. <i class="fa fa-repeat"></i>
  349. </a>
  350. <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
  351. <i class="fa fa-chevron-down"></i>
  352. </a>
  353. <!-- Lets Move This To Homepage Settings
  354. <ul id="downloaderSeconds" class="dropdown-menu" style="top: 32px !important">
  355. <li data-value="5000"><a>Refresh every 5 seconds</a></li>
  356. <li data-value="10000"><a>Refresh every 10 seconds</a></li>
  357. <li data-value="30000"><a>Refresh every 30 seconds</a></li>
  358. <li data-value="60000"><a>Refresh every 60 seconds</a></li>
  359. </ul>
  360. -->
  361. </div>
  362. <h3 class="pull-left"><?php if(NZBGETURL != ""){ echo "NZBGet "; } if(SABNZBDURL != ""){ echo "SABnzbd "; } ?></h3>
  363. <ul class="nav nav-tabs pull-right">
  364. <li class="active"><a href="#downloadQueue" data-toggle="tab" aria-expanded="true"><?php echo $language->translate("QUEUE");?></a></li>
  365. <li class=""><a href="#downloadHistory" data-toggle="tab" aria-expanded="false"><?php echo $language->translate("HISTORY");?></a></li>
  366. </ul>
  367. <div class="clearfix"></div>
  368. </div>
  369. <div class="panel-body">
  370. <div class="tab-content">
  371. <div class="tab-pane fade active in" id="downloadQueue">
  372. <div class="table-responsive" style="max-height: 300px">
  373. <table class="table table-striped progress-widget zero-m" style="max-height: 300px">
  374. <thead>
  375. <tr>
  376. <th class="col-xs-7 nzbtable-file-row"><?php echo $language->translate("FILE");?></th>
  377. <th class="col-xs-2 nzbtable"><?php echo $language->translate("STATUS");?></th>
  378. <th class="col-xs-1 nzbtable"><?php echo $language->translate("CATEGORY");?></th>
  379. <th class="col-xs-2 nzbtable"><?php echo $language->translate("PROGRESS");?></th>
  380. </tr>
  381. </thead>
  382. <tbody class="dl-queue sabnzbd"></tbody>
  383. <tbody class="dl-queue nzbget"></tbody>
  384. </table>
  385. </div>
  386. </div>
  387. <div class="tab-pane fade" id="downloadHistory">
  388. <div class="table-responsive" style="max-height: 300px">
  389. <table class="table table-striped progress-widget zero-m" style="max-height: 300px">
  390. <thead>
  391. <tr>
  392. <th class="col-xs-7 nzbtable-file-row"><?php echo $language->translate("FILE");?></th>
  393. <th class="col-xs-2 nzbtable"><?php echo $language->translate("STATUS");?></th>
  394. <th class="col-xs-1 nzbtable"><?php echo $language->translate("CATEGORY");?></th>
  395. <th class="col-xs-2 nzbtable"><?php echo $language->translate("PROGRESS");?></th>
  396. </tr>
  397. </thead>
  398. <tbody class="dl-history sabnzbd"></tbody>
  399. <tbody class="dl-history nzbget"></tbody>
  400. </table>
  401. </div>
  402. </div>
  403. </div>
  404. </div>
  405. </div>
  406. </div>
  407. </div>
  408. </div>
  409. <?php } ?>
  410. <?php if (qualifyUser(PLEXHOMEAUTH) && PLEXTOKEN) { ?>
  411. <div id="plexRow" class="row">
  412. <sort>3</sort>
  413. <?php
  414. $plexSize = (PLEXRECENTMOVIE == "true") + (PLEXRECENTTV == "true") + (PLEXRECENTMUSIC == "true") + (PLEXPLAYINGNOW == "true");
  415. if(PLEXRECENTMOVIE == "true"){ echo getPlexRecent("movie", 12/$plexSize); }
  416. if(PLEXRECENTTV == "true"){ echo getPlexRecent("season", 12/$plexSize); }
  417. if(PLEXRECENTMUSIC == "true"){ echo getPlexRecent("album", 12/$plexSize); }
  418. if(PLEXPLAYINGNOW == "true"){ echo getPlexStreams(12/$plexSize); }
  419. ?>
  420. </div>
  421. <?php } ?>
  422. <?php if (qualifyUser(EMBYHOMEAUTH) && EMBYTOKEN) { ?>
  423. <div id="embyRow" class="row">
  424. <sort>3</sort>
  425. <?php
  426. $embySize = (EMBYRECENTMOVIE == "true") + (EMBYRECENTTV == "true") + (EMBYRECENTMUSIC == "true") + (EMBYPLAYINGNOW == "true");
  427. if(EMBYRECENTMOVIE == "true"){ echo getEmbyRecent("movie", 12/$embySize); }
  428. if(EMBYRECENTTV == "true"){ echo getEmbyRecent("season", 12/$embySize); }
  429. if(EMBYRECENTMUSIC == "true"){ echo getEmbyRecent("album", 12/$embySize); }
  430. if(EMBYPLAYINGNOW == "true"){ echo getEmbyStreams(12/$embySize); }
  431. ?>
  432. </div>
  433. <?php } ?>
  434. <?php if ((SONARRURL != "" && qualifyUser(SONARRHOMEAUTH)) || (RADARRURL != "" && qualifyUser(RADARRHOMEAUTH)) || (HEADPHONESURL != "" && qualifyUser(HEADPHONESHOMEAUTH)) || (SICKRAGEURL != "" && qualifyUser(SICKRAGEHOMEAUTH))) { ?>
  435. <div id="calendarLegendRow" class="row" style="padding: 0 0 10px 0;">
  436. <sort>1</sort>
  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. </div>
  451. </div>
  452. <div id="calendarRow" class="row">
  453. <sort>1</sort>
  454. <div class="col-lg-12">
  455. <div id="calendar" class="fc-calendar box-shadow fc fc-ltr fc-unthemed"></div>
  456. </div>
  457. </div>
  458. <?php } ?>
  459. </div>
  460. </div>
  461. <script>
  462. $('.close-btn').click(function(e){
  463. var closedBox = $(this).closest('div.content-box').remove();
  464. e.preventDefault();
  465. });
  466. function localStorageSupport() {
  467. return (('localStorage' in window) && window['localStorage'] !== null)
  468. }
  469. $( document ).ready(function() {
  470. $('.repeat-btn').click(function(){
  471. var refreshBox = $(this).closest('div.content-box');
  472. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(300);
  473. setTimeout(function(){
  474. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  475. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  476. refreshPreloader.remove();
  477. });
  478. },1500);
  479. });
  480. $("body").niceScroll({
  481. railpadding: {top:0,right:0,left:0,bottom:0},
  482. scrollspeed: 30,
  483. mousescrollstep: 60
  484. });
  485. $(".table-responsive").niceScroll({
  486. railpadding: {top:0,right:0,left:0,bottom:0},
  487. scrollspeed: 30,
  488. mousescrollstep: 60
  489. });
  490. /*$(".carousel-caption").niceScroll({
  491. railpadding: {top:0,right:0,left:0,bottom:0},
  492. scrollspeed: 30,
  493. mousescrollstep: 60
  494. });*/
  495. // check if browser support HTML5 local storage
  496. <?php if((NZBGETURL != "" && qualifyUser(NZBGETHOMEAUTH)) || (SABNZBDURL != "" && qualifyUser(SABNZBDHOMEAUTH))){ ?>
  497. var queueRefresh = 30000;
  498. var historyRefresh = 120000; // This really doesn't need to happen that often
  499. var queueLoad = function() {
  500. <?php if(SABNZBDURL != "") { echo '$("tbody.dl-queue.sabnzbd").load("ajax.php?a=sabnzbd-update&list=queue");'; } ?>
  501. <?php if(NZBGETURL != "") { echo '$("tbody.dl-queue.nzbget").load("ajax.php?a=nzbget-update&list=listgroups");'; } ?>
  502. };
  503. var historyLoad = function() {
  504. <?php if(SABNZBDURL != "") { echo '$("tbody.dl-history.sabnzbd").load("ajax.php?a=sabnzbd-update&list=history");'; } ?>
  505. <?php if(NZBGETURL != "") { echo '$("tbody.dl-history.nzbget").load("ajax.php?a=nzbget-update&list=history");'; } ?>
  506. };
  507. // Initial Loads
  508. queueLoad();
  509. historyLoad();
  510. // Interval Loads
  511. var queueInterval = setInterval(queueLoad, queueRefresh);
  512. var historyInterval = setInterval(historyLoad, historyRefresh);
  513. // Manual Load
  514. $("#getDownloader").click(function() {
  515. queueLoad();
  516. historyLoad();
  517. });
  518. <?php } ?>
  519. });
  520. </script>
  521. <?php if ((SONARRURL != "" && qualifyUser(SONARRHOMEAUTH)) || (RADARRURL != "" && qualifyUser(RADARRHOMEAUTH)) || (HEADPHONESURL != "" && qualifyUser(HEADPHONESHOMEAUTH)) || (SICKRAGEURL != "" && qualifyUser(SICKRAGEHOMEAUTH))) { ?>
  522. <script>
  523. $(function () {
  524. var date = new Date();
  525. var d = date.getDate();
  526. var m = date.getMonth();
  527. var y = date.getFullYear();
  528. $('#calendar').fullCalendar({
  529. eventLimit: false,
  530. firstDay: <?php echo CALENDARSTART;?>,
  531. height: "auto",
  532. defaultView: '<?php echo CALENDARVIEW;?>',
  533. header: {
  534. left: 'prev,next,',
  535. center: 'title',
  536. right: 'today, month, basicDay,basicWeek,'
  537. },
  538. views: {
  539. basicDay: { buttonText: '<?php echo $language->translate("DAY");?>', eventLimit: false },
  540. basicWeek: { buttonText: '<?php echo $language->translate("WEEK");?>', eventLimit: false },
  541. month: { buttonText: '<?php echo $language->translate("MONTH");?>', eventLimit: false },
  542. today: { buttonText: '<?php echo $language->translate("TODAY");?>' },
  543. },
  544. events: [
  545. <?php if (SICKRAGEURL != "" && qualifyUser(SICKRAGEHOMEAUTH)){ echo getSickrageCalendarWanted($sickrage->future()); echo getSickrageCalendarHistory($sickrage->history("100","downloaded")); } ?>
  546. <?php if (SONARRURL != "" && qualifyUser(SONARRHOMEAUTH)){ echo getSonarrCalendar($sonarr->getCalendar($startDate, $endDate)); } ?>
  547. <?php if (RADARRURL != "" && qualifyUser(RADARRHOMEAUTH)){ echo getRadarrCalendar($radarr->getCalendar($startDate, $endDate)); } ?>
  548. <?php if (HEADPHONESURL != "" && qualifyUser(HEADPHONESHOMEAUTH)){ echo getHeadphonesCalendar(HEADPHONESURL, HEADPHONESKEY, "getHistory"); echo getHeadphonesCalendar(HEADPHONESURL, HEADPHONESKEY, "getWanted"); } ?>
  549. ],
  550. eventRender: function eventRender( event, element, view ) {
  551. return ['all', event.imagetype].indexOf($('#imagetype_selector').val()) >= 0
  552. },
  553. editable: false,
  554. droppable: false,
  555. timeFormat: '<?php echo CALTIMEFORMAT; ?>',
  556. });
  557. });
  558. $('#imagetype_selector').on('change',function(){
  559. $('#calendar').fullCalendar('rerenderEvents');
  560. })
  561. var $divs = $("div.row");
  562. $('#numBnt').on('click', function () {
  563. var numericallyOrderedDivs = $divs.sort(function (a, b) {
  564. return $(a).find("sort").text() > $(b).find("sort").text();
  565. });
  566. $("#content").html(numericallyOrderedDivs);
  567. });
  568. </script>
  569. <?php } ?>
  570. </body>
  571. </html>