homepage.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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("translate.php");
  7. require_once("functions.php");
  8. $USER = new User("registration_callback");
  9. $dbfile = DATABASE_LOCATION . constant('User::DATABASE_NAME') . ".db";
  10. $file_db = new PDO("sqlite:" . $dbfile);
  11. $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  12. $dbOptions = $file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="options"');
  13. $hasOptions = "No";
  14. foreach($dbOptions as $row) :
  15. if (in_array("options", $row)) :
  16. $hasOptions = "Yes";
  17. endif;
  18. endforeach;
  19. if($hasOptions == "No") :
  20. $title = "Organizr";
  21. $topbar = "#333333";
  22. $topbartext = "#66D9EF";
  23. $bottombar = "#333333";
  24. $sidebar = "#393939";
  25. $hoverbg = "#AD80FD";
  26. $activetabBG = "#F92671";
  27. $activetabicon = "#FFFFFF";
  28. $activetabtext = "#FFFFFF";
  29. $inactiveicon = "#66D9EF";
  30. $inactivetext = "#66D9EF";
  31. $loading = "#66D9EF";
  32. $hovertext = "#000000";
  33. endif;
  34. if($hasOptions == "Yes") :
  35. $resulto = $file_db->query('SELECT * FROM options');
  36. foreach($resulto as $row) :
  37. $title = isset($row['title']) ? $row['title'] : "Organizr";
  38. $topbartext = isset($row['topbartext']) ? $row['topbartext'] : "#66D9EF";
  39. $topbar = isset($row['topbar']) ? $row['topbar'] : "#333333";
  40. $bottombar = isset($row['bottombar']) ? $row['bottombar'] : "#333333";
  41. $sidebar = isset($row['sidebar']) ? $row['sidebar'] : "#393939";
  42. $hoverbg = isset($row['hoverbg']) ? $row['hoverbg'] : "#AD80FD";
  43. $activetabBG = isset($row['activetabBG']) ? $row['activetabBG'] : "#F92671";
  44. $activetabicon = isset($row['activetabicon']) ? $row['activetabicon'] : "#FFFFFF";
  45. $activetabtext = isset($row['activetabtext']) ? $row['activetabtext'] : "#FFFFFF";
  46. $inactiveicon = isset($row['inactiveicon']) ? $row['inactiveicon'] : "#66D9EF";
  47. $inactivetext = isset($row['inactivetext']) ? $row['inactivetext'] : "#66D9EF";
  48. $loading = isset($row['loading']) ? $row['loading'] : "#66D9EF";
  49. $hovertext = isset($row['hovertext']) ? $row['hovertext'] : "#000000";
  50. endforeach;
  51. endif;
  52. ?>
  53. <!DOCTYPE html>
  54. <html lang="en" class="no-js">
  55. <head>
  56. <meta charset="UTF-8">
  57. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  58. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  59. <meta name="msapplication-tap-highlight" content="no" />
  60. <title><?=$title;?> Homepage</title>
  61. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  62. <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  63. <!--<link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css">
  64. <link rel="stylesheet" href="bower_components/metisMenu/dist/metisMenu.min.css">
  65. <link rel="stylesheet" href="bower_components/Waves/dist/waves.min.css"> -->
  66. <link rel="stylesheet" href="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css">
  67. <script src="js/menu/modernizr.custom.js"></script>
  68. <link rel="stylesheet" href="bower_components/animate.css/animate.min.css">
  69. <link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css">
  70. <link rel="stylesheet" href="css/style.css">
  71. <!--[if lt IE 9]>
  72. <script src="bower_components/html5shiv/dist/html5shiv.min.js"></script>
  73. <script src="bower_components/respondJs/dest/respond.min.js"></script>
  74. <![endif]-->
  75. <style>
  76. table.fc-list-table {
  77. table-layout: auto;
  78. }.fc-day-grid-event .fc-content {
  79. white-space: normal;
  80. }.fc-list-item {
  81. table-layout: auto;
  82. position: inherit;
  83. margin: 10px;
  84. border-radius: 4px;
  85. padding: 0 5px 0 5px;
  86. color: #fff !important;
  87. }.fc-calendar .fc-toolbar {
  88. background: <?=$topbar;?>;
  89. color: <?=$topbartext;?>;
  90. border-radius: 5px 5px 0 0;
  91. padding: 15px;
  92. }.fc-calendar .fc-toolbar .fc-right {
  93. bottom: 0px;
  94. right: 20px;
  95. }.fc-calendar .fc-toolbar .fc-right button {
  96. color: <?=$topbartext;?>;
  97. }.fc-calendar .fc-toolbar .fc-prev-button, .fc-calendar .fc-toolbar .fc-next-button {
  98. color: <?=$topbartext;?>;
  99. }.carousel-image{
  100. width: 100px !important;
  101. height: 150px !important;
  102. border-radius: 3px 0 0 3px;
  103. }.carousel-image.album{
  104. width: 150px !important;
  105. height: 150px !important;
  106. border-radius: 3px 0 0 3px;
  107. }.carousel-control.album {
  108. top: 5px !important;
  109. width: 4% !important;
  110. }.carousel-control {
  111. top: 5px !important;
  112. width: 4% !important;
  113. }.carousel-caption.album {
  114. position: absolute;
  115. right: 4%;
  116. top: 0px;
  117. left: 160px;
  118. z-index: 10;
  119. bottom: 0px;
  120. padding-top: 0px;
  121. color: #fff;
  122. text-align: left;
  123. }.carousel-caption {
  124. position: absolute;
  125. right: 4%;
  126. top: 0px;
  127. left: 110px;
  128. z-index: 10;
  129. bottom: 0px;
  130. padding-top: 0px;
  131. color: #fff;
  132. text-align: left;
  133. padding-bottom: 2px !important;
  134. }<?php if(CUSTOMCSS == "true") :
  135. $template_file = "custom.css";
  136. $file_handle = fopen($template_file, "rb");
  137. echo fread($file_handle, filesize($template_file));
  138. fclose($file_handle);
  139. echo "\n";
  140. endif; ?>
  141. </style>
  142. </head>
  143. <body class="scroller-body" style="padding: 0px;">
  144. <div class="main-wrapper" style="position: initial;">
  145. <div id="content" class="container-fluid">
  146. <br>
  147. <?php if(NZBGETURL != "" || SABNZBDURL != "") : ?>
  148. <div id="downloadClientRow" class="row">
  149. <div class="col-md-12">
  150. <div class="tabbable panel with-nav-tabs panel-default">
  151. <div class="panel-heading">
  152. <h3 class="pull-left"><?php if(NZBGETURL != ""){ echo "NZBGet "; } if(SABNZBDURL != ""){ echo "SABnzbd "; } ?></h3>
  153. <ul class="nav nav-tabs pull-right">
  154. <li class="active"><a href="#downloadQueue" data-toggle="tab" aria-expanded="true"><?php echo $language->translate("QUEUE");?></a></li>
  155. <li class=""><a href="#downloadHistory" data-toggle="tab" aria-expanded="false"><?php echo $language->translate("HISTORY");?></a></li>
  156. </ul>
  157. <div class="clearfix"></div>
  158. </div>
  159. <div class="panel-body">
  160. <div class="tab-content">
  161. <div class="tab-pane fade active in" id="downloadQueue">
  162. <div class="table-responsive">
  163. <table class="table table-striped progress-widget zero-m">
  164. <thead>
  165. <tr>
  166. <th><?php echo $language->translate("FILE");?></th>
  167. <th><?php echo $language->translate("STATUS");?></th>
  168. <th><?php echo $language->translate("CATEGORY");?></th>
  169. <th><?php echo $language->translate("PROGRESS");?></th>
  170. </tr>
  171. </thead>
  172. <tbody>
  173. <?php if(NZBGETURL != ""){ echo nzbgetConnect(NZBGETURL, NZBGETPORT, NZBGETUSERNAME, NZBGETPASSWORD, "listgroups"); }?>
  174. <?php if(SABNZBDURL != ""){ echo sabnzbdConnect(SABNZBDURL, SABNZBDPORT, SABNZBDKEY, "queue"); }?>
  175. </tbody>
  176. </table>
  177. </div>
  178. </div>
  179. <div class="tab-pane fade" id="downloadHistory">
  180. <div class="table-responsive">
  181. <table class="table table-striped progress-widget zero-m">
  182. <thead>
  183. <tr>
  184. <th>File</th>
  185. <th>Status</th>
  186. <th>Category</th>
  187. <th>Progress</th>
  188. </tr>
  189. </thead>
  190. <tbody>
  191. <?php if(NZBGETURL != ""){ echo nzbgetConnect(NZBGETURL, NZBGETPORT, NZBGETUSERNAME, NZBGETPASSWORD, "history"); }?>
  192. <?php if(SABNZBDURL != ""){ echo sabnzbdConnect(SABNZBDURL, SABNZBDPORT, SABNZBDKEY, "history"); }?>
  193. </tbody>
  194. </table>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <?php endif; ?>
  203. <div id="plexRow" class="row">
  204. <?php
  205. $plexSize = 0;
  206. if(PLEXRECENTMOVIE == "true"){ $plexSize++; }
  207. if(PLEXRECENTTV == "true"){ $plexSize++; }
  208. if(PLEXRECENTMUSIC == "true"){ $plexSize++; }
  209. if(PLEXPLAYINGNOW == "true"){ $plexSize++; }
  210. if($plexSize >= 4){ $plexSize = 3; }elseif($plexSize == 3){ $plexSize = 4; }elseif($plexSize == 2){ $plexSize = 6; }elseif($plexSize == 1){ $plexSize = 12; }
  211. if(PLEXRECENTMOVIE == "true"){ echo getPlexRecent(PLEXURL, PLEXPORT, "movie", PLEXTOKEN, $plexSize, $language->translate("MOVIES")); }
  212. if(PLEXRECENTTV == "true"){ echo getPlexRecent(PLEXURL, PLEXPORT, "season", PLEXTOKEN, $plexSize, $language->translate("TV_SHOWS")); }
  213. if(PLEXRECENTMUSIC == "true"){ echo getPlexRecent(PLEXURL, PLEXPORT, "album", PLEXTOKEN, $plexSize, $language->translate("MUSIC")); }
  214. if(PLEXPLAYINGNOW == "true"){ echo getPlexStreams(PLEXURL, PLEXPORT, PLEXTOKEN, $plexSize, $language->translate("PLAYING_NOW_ON_PLEX")); }
  215. ?>
  216. </div>
  217. <?php if(SONARRURL != "" || RADARRURL != "") : ?>
  218. <div id="calendarLegendRow" class="row" style="padding: 0 0 10px 0;">
  219. <div class="col-lg-4">
  220. <span class="label progress-bar-success progress-bar-striped well-sm"><span class="fc-image"><i class="fa fa-film"></i></span> Available</span>
  221. <span class="label progress-bar-danger progress-bar-striped well-sm"><span class="fc-image"><i class="fa fa-film"></i></span> Unavailable</span>
  222. <span class="label label-primary well-sm"><span class="fc-image"><i class="fa fa-tv"></i></span> Available</span>
  223. <span class="label label-danger well-sm"><span class="fc-image"><i class="fa fa-tv"></i></span> Unavailable</span>
  224. </div>
  225. </div>
  226. <div id="calendarRow" class="row">
  227. <div class="col-lg-12">
  228. <div id="calendar" class="fc-calendar box-shadow fc fc-ltr fc-unthemed"></div>
  229. </div>
  230. </div>
  231. <?php endif; ?>
  232. </div>
  233. </div>
  234. <!--Scripts-->
  235. <script src="bower_components/jquery/dist/jquery.min.js"></script>
  236. <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  237. <script src="bower_components/moment/min/moment.min.js"></script>
  238. <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  239. <script src="bower_components/slimScroll/jquery.slimscroll.min.js"></script>
  240. <script src="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
  241. <script src="bower_components/cta/dist/cta.min.js"></script>
  242. <script src="bower_components/fullcalendar/dist/fullcalendar.js"></script>
  243. <script src="js/jqueri_ui_custom/jquery-ui.min.js"></script>
  244. <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
  245. <script>
  246. $( document ).ready(function() {
  247. $(".carousel-caption").mCustomScrollbar({
  248. theme:"inset-2",
  249. scrollInertia: 300,
  250. autoHideScrollbar: true,
  251. autoExpandScrollbar: true
  252. });
  253. $(".scroller-body").mCustomScrollbar({
  254. theme:"inset-3",
  255. scrollInertia: 300,
  256. autoHideScrollbar: true,
  257. autoExpandScrollbar: true
  258. });
  259. $("fc-scroller").mCustomScrollbar({
  260. theme:"inset-3",
  261. scrollInertia: 300,
  262. autoHideScrollbar: true,
  263. autoExpandScrollbar: true
  264. });
  265. });
  266. </script>
  267. <?php if(SONARRURL != "" || RADARRURL != "") : ?>
  268. <script>
  269. $(function () {
  270. var date = new Date();
  271. var d = date.getDate();
  272. var m = date.getMonth();
  273. var y = date.getFullYear();
  274. $('#calendar').fullCalendar({
  275. eventLimit: false,
  276. height: "auto",
  277. defaultView: 'basicWeek',
  278. header: {
  279. left: 'prev,next,',
  280. center: 'title',
  281. right: 'today, month, basicDay,basicWeek,'
  282. },
  283. views: {
  284. basicDay: { buttonText: '<?php echo $language->translate("DAY");?>', eventLimit: false },
  285. basicWeek: { buttonText: '<?php echo $language->translate("WEEK");?>', eventLimit: false },
  286. month: { buttonText: '<?php echo $language->translate("MONTH");?>', eventLimit: false },
  287. today: { buttonText: '<?php echo $language->translate("TODAY");?>' },
  288. },
  289. events: [
  290. <?php if(SONARRURL != ""){ echo getSonarrCalendar(SONARRURL, SONARRPORT, SONARRKEY); } ?>
  291. <?php if(RADARRURL != ""){ echo getRadarrCalendar(RADARRURL, RADARRPORT, RADARRKEY); } ?>
  292. <?php if(HEADPHONESURL != ""){ echo getHeadphonesCalendar(HEADPHONESURL, HEADPHONESPORT, HEADPHONESKEY, "getUpcoming"); echo getHeadphonesCalendar(HEADPHONESURL, HEADPHONESPORT, HEADPHONESKEY, "getWanted"); } ?>
  293. ],
  294. editable: false,
  295. droppable: false,
  296. });
  297. });
  298. </script>
  299. <?php endif; ?>
  300. </body>
  301. </html>