index.php 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801
  1. <?php
  2. //Set some variables
  3. ini_set("display_errors", 1);
  4. ini_set("error_reporting", E_ALL | E_STRICT);
  5. $data = false;
  6. $databaseLocation = "databaseLocation.ini.php";
  7. $needSetup = "Yes";
  8. $tabSetup = "Yes";
  9. $hasOptions = "No";
  10. $settingsicon = "No";
  11. $settingsActive = "";
  12. $action = "";
  13. $title = "Organizr";
  14. $topbar = "#333333";
  15. $topbartext = "#66D9EF";
  16. $bottombar = "#333333";
  17. $sidebar = "#393939";
  18. $hoverbg = "#AD80FD";
  19. $activetabBG = "#F92671";
  20. $activetabicon = "#FFFFFF";
  21. $activetabtext = "#FFFFFF";
  22. $inactiveicon = "#66D9EF";
  23. $inactivetext = "#66D9EF";
  24. $loading = "#66D9EF";
  25. $hovertext = "#000000";
  26. $loadingIcon = "images/organizr.png";
  27. $baseURL = "";
  28. require_once("translate.php");
  29. function registration_callback($username, $email, $userdir){
  30. global $data;
  31. $data = array($username, $email, $userdir);
  32. }
  33. function printArray($arrayName){
  34. foreach ( $arrayName as $item ) :
  35. echo $item . "<br/>";
  36. endforeach;
  37. }
  38. function write_ini_file($content, $path) {
  39. if (!$handle = fopen($path, 'w')) {
  40. return false;
  41. }
  42. $success = fwrite($handle, $content);
  43. fclose($handle);
  44. return $success;
  45. }
  46. function getTimezone(){
  47. $regions = array(
  48. 'Africa' => DateTimeZone::AFRICA,
  49. 'America' => DateTimeZone::AMERICA,
  50. 'Antarctica' => DateTimeZone::ANTARCTICA,
  51. 'Asia' => DateTimeZone::ASIA,
  52. 'Atlantic' => DateTimeZone::ATLANTIC,
  53. 'Europe' => DateTimeZone::EUROPE,
  54. 'Indian' => DateTimeZone::INDIAN,
  55. 'Pacific' => DateTimeZone::PACIFIC
  56. );
  57. $timezones = array();
  58. foreach ($regions as $name => $mask) {
  59. $zones = DateTimeZone::listIdentifiers($mask);
  60. foreach($zones as $timezone) {
  61. $time = new DateTime(NULL, new DateTimeZone($timezone));
  62. $ampm = $time->format('H') > 12 ? ' ('. $time->format('g:i a'). ')' : '';
  63. $timezones[$name][$timezone] = substr($timezone, strlen($name) + 1) . ' - ' . $time->format('H:i') . $ampm;
  64. }
  65. }
  66. print '<select name="timezone" id="timezone" class="form-control material" required>';
  67. foreach($timezones as $region => $list) {
  68. print '<optgroup label="' . $region . '">' . "\n";
  69. foreach($list as $timezone => $name) {
  70. print '<option value="' . $timezone . '">' . $name . '</option>' . "\n";
  71. }
  72. print '</optgroup>' . "\n";
  73. }
  74. print '</select>';
  75. }
  76. if(isset($_POST['action'])) :
  77. $action = $_POST['action'];
  78. endif;
  79. if($action == "createLocation") :
  80. $databaseData = '; <?php die("Access denied"); ?>' . "\r\n";
  81. foreach ($_POST as $postName => $postValue) {
  82. if($postName !== "action") :
  83. if(substr($postValue, -1) == "/") : $postValue = rtrim($postValue, "/"); endif;
  84. $postValue = str_replace("\\","/", $postValue);
  85. $databaseData .= $postName . " = \"" . $postValue . "\"\r\n";
  86. endif;
  87. }
  88. write_ini_file($databaseData, $databaseLocation);
  89. endif;
  90. if(!file_exists($databaseLocation)) :
  91. $configReady = "No";
  92. $userpic = "";
  93. else :
  94. $configReady = "Yes";
  95. require_once("user.php");
  96. $USER = new User("registration_callback");
  97. $dbfile = DATABASE_LOCATION . constant('User::DATABASE_NAME') . ".db";
  98. $database = new PDO("sqlite:" . $dbfile);
  99. $query = "SELECT * FROM users";
  100. foreach($database->query($query) as $data) {
  101. $needSetup = "No";
  102. }
  103. $db = DATABASE_LOCATION . constant('User::DATABASE_NAME') . ".db";
  104. $file_db = new PDO("sqlite:" . $db);
  105. $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  106. $dbTab = $file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="tabs"');
  107. $dbOptions = $file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="options"');
  108. foreach($dbTab as $row) :
  109. if (in_array("tabs", $row)) :
  110. $tabSetup = "No";
  111. endif;
  112. endforeach;
  113. if($tabSetup == "Yes") :
  114. $settingsActive = "active";
  115. endif;
  116. foreach($dbOptions as $row) :
  117. if (in_array("options", $row)) :
  118. $hasOptions = "Yes";
  119. endif;
  120. endforeach;
  121. if($tabSetup == "No") :
  122. if($USER->authenticated && $USER->role == "admin") :
  123. $result = $file_db->query('SELECT * FROM tabs WHERE active = "true"');
  124. $getsettings = $file_db->query('SELECT * FROM tabs WHERE active = "true"');
  125. foreach($getsettings as $row) :
  126. if(!empty($row['iconurl']) && $settingsicon == "No") :
  127. $settingsicon = "Yes";
  128. endif;
  129. endforeach;
  130. elseif($USER->authenticated && $USER->role == "user") :
  131. $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND user = "true"');
  132. else :
  133. $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND guest = "true"');
  134. endif;
  135. endif;
  136. if($hasOptions == "Yes") :
  137. $resulto = $file_db->query('SELECT * FROM options');
  138. foreach($resulto as $row) :
  139. $title = $row['title'];
  140. $topbartext = $row['topbartext'];
  141. $topbar = $row['topbar'];
  142. $bottombar = $row['bottombar'];
  143. $sidebar = $row['sidebar'];
  144. $hoverbg = $row['hoverbg'];
  145. $activetabBG = $row['activetabBG'];
  146. $activetabicon = $row['activetabicon'];
  147. $activetabtext = $row['activetabtext'];
  148. $inactiveicon = $row['inactiveicon'];
  149. $inactivetext = $row['inactivetext'];
  150. $loading = $row['loading'];
  151. $hovertext = $row['hovertext'];
  152. endforeach;
  153. endif;
  154. $userpic = md5( strtolower( trim( $USER->email ) ) );
  155. if(LOADINGICON !== "") : $loadingIcon = LOADINGICON; endif;
  156. endif;
  157. ?>
  158. <!--
  159. ___ ___ ___ ___ ___ ___ ___ ___
  160. /\ \ /\ \ /\ \ /\ \ /\__\ /\ \ /\ \ /\ \
  161. /::\ \ /::\ \ /::\ \ /::\ \ /:| _|_ _\:\ \ _\:\ \ /::\ \
  162. /:/\:\__\ /::\:\__\ /:/\:\__\ /::\:\__\ /::|/\__\ /\/::\__\ /::::\__\ /::\:\__\
  163. \:\/:/ / \;:::/ / \:\:\/__/ \/\::/ / \/|::/ / \::/\/__/ \::;;/__/ \;:::/ /
  164. \::/ / |:\/__/ \::/ / /:/ / |:/ / \:\__\ \:\__\ |:\/__/
  165. \/__/ \|__| \/__/ \/__/ \/__/ \/__/ \/__/ \|__|
  166. -->
  167. <!DOCTYPE html>
  168. <html lang="<?php echo $getLanguage; ?>" class="no-js">
  169. <head>
  170. <meta charset="UTF-8">
  171. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  172. <meta name="apple-mobile-web-app-capable" content="yes" />
  173. <meta name="mobile-web-app-capable" content="yes" /
  174. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  175. <meta name="msapplication-tap-highlight" content="no" />
  176. <title><?=$title;?><?php if($title !== "Organizr") : echo " - Organizr"; endif; ?></title>
  177. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/bootstrap/dist/css/bootstrap.min.css">
  178. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/font-awesome/css/font-awesome.min.css">
  179. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/mdi/css/materialdesignicons.min.css">
  180. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/metisMenu/dist/metisMenu.min.css">
  181. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/Waves/dist/waves.min.css">
  182. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css">
  183. <link rel="stylesheet" href="<?=$baseURL;?>js/selects/cs-select.css">
  184. <link rel="stylesheet" href="<?=$baseURL;?>js/selects/cs-skin-elastic.css">
  185. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/google-material-color/dist/palette.css">
  186. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/sweetalert/dist/sweetalert.css">
  187. <link rel="stylesheet" href="<?=$baseURL;?>bower_components/smoke/dist/css/smoke.min.css">
  188. <script src="<?=$baseURL;?>js/menu/modernizr.custom.js"></script>
  189. <script type="text/javascript" src="<?=$baseURL;?>js/sha1.js"></script>
  190. <script type="text/javascript" src="<?=$baseURL;?>js/user.js"></script>
  191. <link rel="stylesheet" href="<?=$baseURL;?>css/style.css">
  192. <link rel="icon" type="image/png" href="<?=$baseURL;?>images/favicon/android-chrome-192x192.png" sizes="192x192">
  193. <link rel="apple-touch-icon" sizes="180x180" href="<?=$baseURL;?>images/favicon/apple-touch-icon.png">
  194. <link rel="icon" type="image/png" href="<?=$baseURL;?>images/favicon/favicon-32x32.png" sizes="32x32">
  195. <link rel="icon" type="image/png" href="<?=$baseURL;?>images/favicon/favicon-16x16.png" sizes="16x16">
  196. <link rel="manifest" href="<?=$baseURL;?>images/favicon/manifest.json">
  197. <link rel="mask-icon" href="<?=$baseURL;?>images/favicon/safari-pinned-tab.svg" color="#2d89ef">
  198. <link rel="shortcut icon" href="<?=$baseURL;?>images/favicon/favicon.ico">
  199. <meta name="msapplication-config" content="<?=$baseURL;?>images/favicon/browserconfig.xml">
  200. <meta name="theme-color" content="#2d89ef">
  201. <link rel="stylesheet" type="text/css" href="css/addtohomescreen.css">
  202. <script src="js/addtohomescreen.js"></script>
  203. <!--[if lt IE 9]>
  204. <script src="bower_components/html5shiv/dist/html5shiv.min.js"></script>
  205. <script src="bower_components/respondJs/dest/respond.min.js"></script>
  206. <![endif]-->
  207. </head>
  208. <body style="overflow: hidden">
  209. <!--Preloader-->
  210. <div id="preloader" class="preloader table-wrapper">
  211. <div class="table-row">
  212. <div class="table-cell">
  213. <div class="la-ball-scale-multiple la-3x" style="color: <?=$topbar;?>">
  214. <?php if (pathinfo($loadingIcon, PATHINFO_EXTENSION) !== "gif" ) :
  215. echo "<div></div><div></div><div></div>";
  216. endif; ?>
  217. <logo class="logo"><img height="192px" src="<?=$loadingIcon;?>"></logo>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. <div id="main-wrapper" class="main-wrapper" tabindex="-1">
  223. <style>
  224. .bottom-bnts a {
  225. background: <?=$bottombar;?> !important;
  226. color: <?=$topbartext;?> !important;
  227. }.bottom-bnts {
  228. background-color: <?=$bottombar;?> !important;
  229. }.gn-menu-main {
  230. background-color: <?=$topbar;?>;
  231. }.gn-menu-main ul.gn-menu {
  232. background: <?=$sidebar;?>;
  233. }.gn-menu-wrapper {
  234. background: <?=$sidebar;?>;
  235. }.gn-menu i {
  236. height: 18px;
  237. width: 52px;
  238. }.la-timer.la-dark {
  239. color: <?=$topbartext;?>
  240. }.refresh-preloader {
  241. background: <?=$loading;?>;
  242. }.la-timer {
  243. width: 75px;
  244. height: 75px;
  245. padding-top: 20px;
  246. border-radius: 100px;
  247. background: <?=$sidebar;?>;
  248. border: 2px solid <?=$topbar;?>;
  249. }@media screen and (min-width:737px){
  250. .tab-item:hover a {
  251. color: <?=$hovertext;?> !important;
  252. background: <?=$hoverbg;?>;
  253. border-radius: 100px 0 0 100px;
  254. }
  255. }.gn-menu li.active > a {
  256. color: <?=$activetabtext;?> !important;
  257. background: <?=$activetabBG;?>;
  258. border-radius: 100px 0 0 100px;
  259. }.gn-menu li.rightActive > a {
  260. background: <?=$hoverbg;?>;
  261. border-radius: 100px 0 0 100px;
  262. }.active {
  263. display: block;
  264. }.hidden {
  265. display: none;
  266. }.errorz {
  267. background-image: linear-gradient(red, red), linear-gradient(#d2d2d2, #d2d2d2);
  268. outline: none;
  269. animation: input-highlight .5s forwards;
  270. box-shadow: none;
  271. padding-left: 0;
  272. border: 0;
  273. border-radius: 0;
  274. background-size: 0 2px,100% 1px;
  275. background-repeat: no-repeat;
  276. background-position: center bottom,center calc(100% - 1px);
  277. background-color: transparent;
  278. box-shadow: none;
  279. }.gn-menu li.active i.fa {
  280. color: <?=$activetabicon;?>;
  281. }.gn-menu li i.fa {
  282. color: <?=$inactiveicon;?>;
  283. }.gn-menu-main ul.gn-menu a {
  284. color: <?=$inactivetext;?>;
  285. }li.dropdown.some-btn .mdi {
  286. color: <?=$topbartext;?>;
  287. }.nav>li>a:focus, .nav>li>a:hover {
  288. text-decoration: none;
  289. background-color: transparent;
  290. }div#preloader {
  291. background-color: <?=$loading;?>;
  292. }.iframe {
  293. -webkit-overflow-scrolling: touch;
  294. }.iframe iframe{
  295. }#menu-toggle span {
  296. background: <?=$topbartext;?>;
  297. }logo.logo {
  298. opacity: 0.5;
  299. filter: alpha(opacity=50);
  300. }.mini-nav .split {
  301. width: calc(50% - 25px);
  302. }.splitRight {
  303. width: 50%;
  304. margin-left: 50% !important;
  305. position: absolute !important;
  306. }.split {
  307. width: 50%;
  308. position: absolute !important;
  309. }.mini-nav .splitRight {
  310. margin-left: calc(50% + 25px) !important;
  311. width: calc(50% - 25px);
  312. }.form-control.material {
  313. background-image: -webkit-gradient(linear, left top, left bottom, from(<?=$topbartext;?>), to(<?=$topbartext;?>)), -webkit-gradient(linear, left top, left bottom, from(#d2d2d2), to(#d2d2d2));
  314. background-image: -webkit-linear-gradient(<?=$topbartext;?>, <?=$topbartext;?>), -webkit-linear-gradient(#d2d2d2, #d2d2d2);
  315. background-image: linear-gradient(<?=$topbartext;?>, <?=$topbartext;?>), linear-gradient(#d2d2d2, #d2d2d2);
  316. }
  317. </style>
  318. <ul id="gn-menu" class="gn-menu-main">
  319. <li class="gn-trigger">
  320. <a id="menu-toggle" class="menu-toggle gn-icon gn-icon-menu">
  321. <div class="hamburger">
  322. <span></span>
  323. <span></span>
  324. <span></span>
  325. </div>
  326. <div class="cross">
  327. <span></span>
  328. <span></span>
  329. </div>
  330. </a>
  331. <nav class="gn-menu-wrapper">
  332. <div class="gn-scroller" id="gn-scroller">
  333. <ul id="tabList" class="gn-menu metismenu">
  334. <!--Start Tab List-->
  335. <?php if($tabSetup == "No") : $tabCount = 1; foreach($result as $row) :
  336. if($row['defaultz'] == "true") : $defaultz = "active"; else : $defaultz = ""; endif; ?>
  337. <li window="<?=$row['window'];?>" class="tab-item <?=$defaultz;?>" id="<?=$row['url'];?>x" data-title="<?=$row['name'];?>" name="<?php echo strtolower($row['name']);?>">
  338. <a class="tab-link">
  339. <?php if($row['iconurl']) : ?>
  340. <i style="font-size: 19px; padding: 0 10px; font-size: 19px;">
  341. <img src="<?=$row['iconurl'];?>" style="height: 30px; width: 30px; margin-top: -2px;">
  342. </i>
  343. <?php else : ?>
  344. <i class="fa <?=$row['icon'];?> fa-lg"></i>
  345. <?php endif; ?>
  346. <?=$row['name'];?>
  347. </a>
  348. </li>
  349. <?php $tabCount++; endforeach; endif;?>
  350. <?php if($configReady == "Yes") : if($USER->authenticated && $USER->role == "admin") :?>
  351. <li class="tab-item <?=$settingsActive;?>" id="settings.phpx" data-title="Settings" name="settings">
  352. <a class="tab-link">
  353. <?php if($settingsicon == "Yes") :
  354. echo '<i style="font-size: 19px; padding: 0 10px; font-size: 19px;">
  355. <img id="settings-icon" src="images/settings.png" style="height: 30px; margin-top: -2px;"></i>';
  356. else :
  357. echo '<i id="settings-icon" class="fa fa-cog"></i>';
  358. endif; ?>
  359. <?php echo $language->translate("SETTINGS");?>
  360. </a>
  361. </li>
  362. <li style="display: none;" class="tab-item" id="updatedb.phpx" data-title="Upgrade" name="upgrade">
  363. <a class="tab-link">
  364. <?php if($settingsicon == "Yes") :
  365. echo '<i style="font-size: 19px; padding: 0 10px; font-size: 19px;">
  366. <img id="upgrade-icon" src="images/upgrade.png" style="height: 30px; margin-top: -2px;"></i>';
  367. else :
  368. echo '<i id="upgrade-icon" class="fa fa-arrow-up"></i>';
  369. endif; ?>
  370. <?php echo $language->translate("UPGRADE");?>
  371. </a>
  372. </li>
  373. <?php endif; endif;?>
  374. <!--End Tab List-->
  375. </ul>
  376. </div>
  377. <!-- /gn-scroller -->
  378. <div class="bottom-bnts">
  379. <a class="fix-nav"><i class="mdi mdi-pin"></i></a>
  380. </div>
  381. </nav>
  382. </li>
  383. <li class="top-clock">
  384. <?php
  385. if($configReady == "Yes") :
  386. if(TITLELOGO == "") :
  387. echo "<span><span style=\"color: $topbartext\"><b>$title</b></span></span>";
  388. else :
  389. echo "<img style='max-width: 250px; max-height: 50px;' src='" . TITLELOGO . "'>";
  390. endif;
  391. else :
  392. echo "<span><span style=\"color: $topbartext\"><b>$title</b></span></span>";
  393. endif;
  394. ?>
  395. </li>
  396. <li class="pull-right">
  397. <ul class="nav navbar-right right-menu">
  398. <li class="dropdown notifications">
  399. <?php if($configReady == "Yes") : if(!$USER->authenticated) : ?>
  400. <a class="log-in">
  401. <?php endif; endif;?>
  402. <?php if($configReady == "Yes") : if($USER->authenticated) : ?>
  403. <a class="show-members">
  404. <?php endif; endif;?>
  405. <i class="userpic"><img src="https://www.gravatar.com/avatar/<?=$userpic;?>?s=40&d=mm" class="img-circle"></i>
  406. </a>
  407. </li>
  408. <li class="dropdown some-btn">
  409. <a class="fullscreen">
  410. <i class="mdi mdi-fullscreen"></i>
  411. </a>
  412. </li>
  413. <li class="dropdown some-btn">
  414. <a id="reload" class="refresh">
  415. <i class="mdi mdi-refresh"></i>
  416. </a>
  417. </li>
  418. <li style="display: none" id="splitView" class="dropdown some-btn">
  419. <a class="spltView">
  420. <i class="mdi mdi-window-close"></i>
  421. </a>
  422. </li>
  423. </ul>
  424. </li>
  425. </ul>
  426. <!--Content-->
  427. <div id="content" class="content" style="">
  428. <script>addToHomescreen();</script>
  429. <!--Load Framed Content-->
  430. <?php if($needSetup == "Yes" && $configReady == "Yes") : ?>
  431. <div class="table-wrapper">
  432. <div class="table-row">
  433. <div class="table-cell text-center">
  434. <div class="login i-block">
  435. <div class="content-box">
  436. <div class="green-bg biggest-box">
  437. <h1 class="zero-m text-uppercase"><?php echo $language->translate("CREATE_ADMIN");?></h1>
  438. </div>
  439. <div class="big-box text-left registration-form">
  440. <h4 class="text-center"><?php echo $language->translate("CREATE_ACCOUNT");?></h4>
  441. <form class="controlbox" name="new user registration" id="registration" action="" method="POST" data-smk-icon="glyphicon-remove-sign">
  442. <input type="hidden" name="op" value="register"/>
  443. <input type="hidden" name="sha1" value=""/>
  444. <div class="form-group">
  445. <input type="text" class="form-control material" name="username" autofocus placeholder="<?php echo $language->translate("USERNAME");?>" autocorrect="off" autocapitalize="off" minlength="3" maxlength="16" required>
  446. </div>
  447. <div class="form-group">
  448. <input type="email" class="form-control material" name="email" placeholder="<?php echo $language->translate("EMAIL");?>">
  449. </div>
  450. <div class="form-group">
  451. <input type="password" class="form-control material" name="password1" placeholder="<?php echo $language->translate("PASSWORD");?>" data-smk-strongPass="weak" required>
  452. </div>
  453. <div class="form-group">
  454. <input type="password" class="form-control material" name="password2" placeholder="<?php echo $language->translate("PASSWORD_AGAIN");?>">
  455. </div>
  456. <button id="registerSubmit" type="submit" class="btn green-bg btn-block btn-warning text-uppercase waves waves-effect waves-float" value="Register"><?php echo $language->translate("REGISTER");?></button>
  457. </form>
  458. </div>
  459. </div>
  460. </div>
  461. </div>
  462. </div>
  463. </div>
  464. <?php endif; ?>
  465. <?php if($needSetup == "Yes" && $configReady == "No") : ?>
  466. <div class="table-wrapper">
  467. <div class="table-row">
  468. <div class="table-cell text-center">
  469. <div class="login i-block">
  470. <div class="content-box">
  471. <div class="green-bg biggest-box">
  472. <h1 class="zero-m text-uppercase"><?php echo $language->translate("DATABASE_PATH");?></h1>
  473. </div>
  474. <div class="big-box text-left">
  475. <h3 class="text-center"><?php echo $language->translate("SPECIFY_LOCATION");?></h3>
  476. <h5 class="text-left"><strong><?php echo $language->translate("CURRENT_DIRECTORY");?>: <?php echo __DIR__; ?> <br><?php echo $language->translate("PARENT_DIRECTORY");?>: <?php echo dirname(__DIR__); ?></strong></h5>
  477. <form class="controlbox" name="setupDatabase" id="setupDatabase" action="" method="POST" data-smk-icon="glyphicon-remove-sign">
  478. <input type="hidden" name="action" value="createLocation" />
  479. <div class="form-group">
  480. <input type="text" class="form-control material" name="databaseLocation" autofocus value="<?php echo dirname(__DIR__);?>" autocorrect="off" autocapitalize="off" required>
  481. <h5><?php echo $language->translate("SET_DATABASE_LOCATION");?></h5>
  482. <?php echo getTimezone();?>
  483. <h5><?php echo $language->translate("SET_TIMEZONE");?></h5>
  484. <?php
  485. if(file_exists(dirname(__DIR__) . '/users.db') || file_exists(__DIR__ . '/users.db')) :
  486. echo '<h5 class="text-center red">';
  487. echo $language->translate("DONT_WORRY");
  488. echo '</h5>';
  489. endif;?>
  490. </div>
  491. <button id="databaseLocationSubmit" type="submit" class="btn green-bg btn-block btn-sm text-uppercase waves waves-effect waves-float" value="Save Location"><?php echo $language->translate("SAVE_LOCATION");?></button>
  492. </form>
  493. </div>
  494. </div>
  495. </div>
  496. </div>
  497. </div>
  498. </div>
  499. <?php endif; ?>
  500. <?php if($configReady == "Yes") : if(!$USER->authenticated && $tabSetup == "Yes" && $needSetup == "No") :?>
  501. <div class="table-wrapper">
  502. <div class="table-row">
  503. <div class="table-cell text-center">
  504. <div class="login i-block">
  505. <div class="content-box">
  506. <div class="blue-bg biggest-box">
  507. <h1 class="zero-m text-uppercase"><?php echo $language->translate("AWESOME");?></h1>
  508. </div>
  509. <div class="big-box text-left">
  510. <h4 class="text-center"><?php echo $language->translate("TIME_TO_LOGIN");?></h4>
  511. <button type="submit" class="btn log-in btn-block btn-primary text-uppercase waves waves-effect waves-float"><?php echo $language->translate("LOGIN");?></button>
  512. </div>
  513. </div>
  514. </div>
  515. </div>
  516. </div>
  517. </div>
  518. <?php endif; endif; ?>
  519. <?php if($tabSetup == "No" && $needSetup == "No") :?>
  520. <div id="tabEmpty" class="table-wrapper" style="display: none; background:<?=$sidebar;?>;">
  521. <div class="table-row">
  522. <div class="table-cell text-center">
  523. <div class="login i-block">
  524. <div class="content-box">
  525. <div class="biggest-box" style="background:<?=$topbar;?>;">
  526. <h1 class="zero-m text-uppercase" style="color:<?=$topbartext;?>;"><?php echo $language->translate("HOLD_UP");?></h1>
  527. </div>
  528. <div class="big-box text-left">
  529. <center><img src="images/sowwy.png" style="height: 200px;"></center>
  530. <h2 class="text-center"><?php echo $language->translate("LOOKS_LIKE_YOU_DONT_HAVE_ACCESS");?></h2>
  531. <?php if(!$USER->authenticated) : ?>
  532. <button style="background:<?=$topbar;?>;" type="submit" class="btn log-in btn-block btn-primary text-uppercase waves waves-effect waves-float"><text style="color:<?=$topbartext;?>;"><?php echo $language->translate("LOGIN");?></text></button>
  533. <?php endif; ?>
  534. </div>
  535. </div>
  536. </div>
  537. </div>
  538. </div>
  539. </div>
  540. <?php endif;?>
  541. <!--End Load Framed Content-->
  542. </div>
  543. <div id="contentRight" class="content splitRight" style="">
  544. </div>
  545. <!--End Content-->
  546. <!--Welcome notification-->
  547. <div id="welcome"></div>
  548. <div id="members-sidebar" style="background: <?=$sidebar;?>;" class="members-sidebar">
  549. <h4 class="pull-left zero-m"><?php echo $language->translate("OPTIONS");?></h4>
  550. <span class="close-members-sidebar"><i class="fa fa-remove fa-lg pull-right"></i></span>
  551. <div class="clearfix"><br/></div>
  552. <?php if($configReady == "Yes") : if($USER->authenticated) : ?>
  553. <br>
  554. <div class="content-box profile-sidebar box-shadow">
  555. <img src="https://www.gravatar.com/avatar/<?=$userpic;?>?s=100&d=mm" class="img-responsive img-circle center-block" alt="user" https:="" www.gravatar.com="" avatar="">
  556. <div class="profile-usertitle">
  557. <div class="profile-usertitle-name">
  558. <?php echo strtoupper($USER->username); ?>
  559. </div>
  560. <div class="profile-usertitle-job">
  561. <?php echo strtoupper($USER->role); ?>
  562. </div>
  563. </div>
  564. <div id="buttonsDiv" class="profile-userbuttons">
  565. <button id="editInfo" type="button" class="btn btn-primary text-uppercase waves waves-effect waves-float"><?php echo $language->translate("EDIT_INFO");?></button>
  566. <button type="button" class="logout btn btn-warning waves waves-effect waves-float"><?php echo $language->translate("LOGOUT");?></button>
  567. </div>
  568. <div id="editInfoDiv" style="display: none" class="profile-usertitle">
  569. <form class="content-form form-inline" name="update" id="update" action="" method="POST">
  570. <input type="hidden" name="op" value="update"/>
  571. <input type="hidden" name="sha1" value=""/>
  572. <input type="hidden" name="role" value="<?php echo $USER->role; ?>"/>
  573. <div class="form-group">
  574. <input autocomplete="off" type="text" value="<?php echo $USER->email; ?>" class="form-control" name="email" placeholder="<?php echo $language->translate("EMAIL_ADDRESS");?>">
  575. </div>
  576. <div class="form-group">
  577. <input autocomplete="off" type="password" class="form-control" name="password1" placeholder="<?php echo $language->translate("PASSWORD");?>">
  578. </div>
  579. <div class="form-group">
  580. <input autocomplete="off" type="password" class="form-control" name="password2" placeholder="<?php echo $language->translate("PASSWORD_AGAIN");?>">
  581. </div>
  582. <br>
  583. <div class="form-group">
  584. <input type="button" class="btn btn-success text-uppercase waves-effect waves-float" value="<?php echo $language->translate("UPDATE");?>" onclick="User.processUpdate()"/>
  585. <button id="goBackButtons" type="button" class="btn btn-primary text-uppercase waves waves-effect waves-float"><?php echo $language->translate("GO_BACK");?></button>
  586. </div>
  587. </form>
  588. </div>
  589. </div>
  590. <?php endif; endif;?>
  591. </div>
  592. </div>
  593. <?php if($configReady == "Yes") : if(!$USER->authenticated && $configReady == "Yes") : ?>
  594. <div class="login-modal modal fade">
  595. <div style="background:<?=$sidebar;?>;" class="table-wrapper">
  596. <div class="table-row">
  597. <div class="table-cell text-center">
  598. <button style="color:<?=$topbartext;?>;" type="button" class="close" data-dismiss="modal" aria-label="Close">
  599. <span aria-hidden="true">&times;</span>
  600. </button>
  601. <div class="login i-block">
  602. <div class="content-box">
  603. <div style="background:<?=$topbar;?>;" class="biggest-box">
  604. <h1 style="color:<?=$topbartext;?>;" class="zero-m text-uppercase"><?php echo $language->translate("WELCOME");?></h1>
  605. </div>
  606. <div class="big-box text-left login-form">
  607. <?php if($USER->error!="") : ?>
  608. <p class="error">Error: <?php echo $USER->error; ?></p>
  609. <?php endif; ?>
  610. <form name="log in" id="login" action="" method="POST" data-smk-icon="glyphicon-remove-sign">
  611. <h4 class="text-center"><?php echo $language->translate("LOGIN");?></h4>
  612. <div class="form-group">
  613. <input type="hidden" name="op" value="login">
  614. <input type="hidden" name="sha1" value="">
  615. <input type="hidden" name="rememberMe" value="false"/>
  616. <input type="text" class="form-control material" name="username" placeholder="<?php echo $language->translate("USERNAME");?>" autocomplete="off" autocorrect="off" autocapitalize="off" value="" autofocus required>
  617. </div>
  618. <div class="form-group">
  619. <input type="password" class="form-control material" name="password1" value="" autocomplete="off" placeholder="<?php echo $language->translate("PASSWORD");?>" required>
  620. </div>
  621. <div class="form-group">
  622. <div class="i-block"> <input id="rememberMe" name="rememberMe" class="switcher switcher-success switcher-medium pull-left" value="true" type="checkbox" checked="">
  623. <label for="rememberMe" class="pull-left"></label>
  624. <label class="pull-right"> &nbsp; <?php echo $language->translate("REMEMBER_ME");?></label>
  625. </div>
  626. </div>
  627. <button id="loginSubmit" style="background:<?=$topbar;?>;" type="submit" class="btn btn-block btn-info text-uppercase waves" value="log in" onclick="User.processLogin()"><text style="color:<?=$topbartext;?>;"><?php echo $language->translate("LOGIN");?></text></button>
  628. </form>
  629. <button id="switchForgot" style="background:<?=$topbartext;?>;" class="btn btn-block btn-info text-uppercase waves"><text style="color:<?=$topbar;?>;"><?php echo $language->translate("FORGOT_PASSWORD");?></text></button>
  630. <?php if(REGISTERPASSWORD != "") : ?>
  631. <button id="switchCreateUser" style="background:<?=$hoverbg;?>;" class="btn btn-block btn-info text-uppercase waves"><text style="color:<?=$hovertext;?>;"><?php echo $language->translate("CREATE_USER");?></text></button>
  632. <?php endif; ?>
  633. <form style="display: none;" name="forgotPassword" id="forgotPassword" action="" method="POST" data-smk-icon="glyphicon-remove-sign">
  634. <h4 class="text-center"><?php echo $language->translate("FORGOT_PASSWORD");?></h4>
  635. <div class="form-group">
  636. <input type="hidden" name="op" value="reset">
  637. <input type="text" class="form-control material" name="email" placeholder="<?php echo $language->translate("EMAIL");?>" autocorrect="off" autocapitalize="off" value="" autofocus required>
  638. </div>
  639. <button style="background:<?=$topbar;?>;" type="submit" class="btn btn-block btn-info text-uppercase waves" value="reset password"><text style="color:<?=$topbartext;?>;"><?php echo $language->translate("RESET_PASSWORD");?></text></button>
  640. </form>
  641. <?php if(REGISTERPASSWORD != "") : ?>
  642. <div id="userPassForm" style="display: none;">
  643. <form id="userCreateForm" action="register.php" method="POST">
  644. <h4 class="text-center"><?php echo $language->translate("ENTER_PASSWORD_TO_REGISTER");?></h4>
  645. <center><h5 id="userCreateErrors" style="color: red"></h5></center>
  646. <div class="form-group">
  647. <input type="text" class="form-control material" name="registerPasswordValue" placeholder="<?php echo $language->translate("PASSWORD");?>" autocorrect="off" autocapitalize="off" value="" autofocus required>
  648. </div>
  649. <button style="background:<?=$topbar;?>;" type="submit" id="checkRegisterPass" class="btn btn-block btn-info text-uppercase waves" value="reset password"><text style="color:<?=$topbartext;?>;"><?php echo $language->translate("SUBMIT");?></text></button>
  650. </form>
  651. </div>
  652. <form style="display: none;" name="createUser" id="registration" action="" method="POST" data-smk-icon="glyphicon-remove-sign">
  653. <h4 class="text-center"><?php echo $language->translate("CREATE_USER");?></h4>
  654. <input type="hidden" name="op" value="register"/>
  655. <input type="hidden" name="sha1" value=""/>
  656. <div class="form-group">
  657. <input type="text" class="form-control material" name="username" autofocus placeholder="<?php echo $language->translate("USERNAME");?>" autocorrect="off" autocapitalize="off" minlength="3" maxlength="16" required>
  658. </div>
  659. <div class="form-group">
  660. <input type="email" class="form-control material" name="email" placeholder="<?php echo $language->translate("EMAIL");?>">
  661. </div>
  662. <div class="form-group">
  663. <input type="password" class="form-control material" name="password1" placeholder="<?php echo $language->translate("PASSWORD");?>" data-smk-strongPass="weak" required>
  664. </div>
  665. <div class="form-group">
  666. <input type="password" class="form-control material" name="password2" placeholder="<?php echo $language->translate("PASSWORD_AGAIN");?>">
  667. </div>
  668. <button id="registerSubmit" type="submit" class="btn green-bg btn-block btn-warning text-uppercase waves waves-effect waves-float" value="Register"><?php echo $language->translate("REGISTER");?></button>
  669. </form>
  670. <?php endif; ?>
  671. </div>
  672. </div>
  673. </div>
  674. </div>
  675. </div>
  676. </div>
  677. </div>
  678. <?php endif; endif;?>
  679. <?php if($configReady == "Yes") : if($USER->authenticated) : ?>
  680. <div style="background:<?=$topbar;?>;" class="logout-modal modal fade">
  681. <div class="table-wrapper" style="background: <?=$topbar;?>">
  682. <div class="table-row">
  683. <div class="table-cell text-center">
  684. <div class="login i-block">
  685. <div class="content-box">
  686. <div style="background:<?=$topbartext;?>;" class="biggest-box">
  687. <form name="log out" id="logout" action="" method="POST">
  688. <input type="hidden" name="op" value="logout">
  689. <input type="hidden" name="username"value="<?php echo $_SESSION["username"]; ?>" >
  690. <h3 style="color:<?=$topbar;?>;" class="zero-m text-uppercase"><?php echo $language->translate("DO_YOU_WANT_TO_LOGOUT");?></h3>
  691. <a style="color:<?=$topbar;?>;" id="logoutSubmit" class="i-block" data-dismiss="modal"><?php echo $language->translate("YES_WORD");?></a>
  692. <a style="color:<?=$topbar;?>;" class="i-block" data-dismiss="modal"><?php echo $language->translate("NO_WORD");?></a>
  693. </form>
  694. </div>
  695. </div>
  696. </div>
  697. </div>
  698. </div>
  699. </div>
  700. </div>
  701. <?php endif; endif;?>
  702. <!--Scripts-->
  703. <script src="<?=$baseURL;?>bower_components/jquery/dist/jquery.min.js"></script>
  704. <script src="<?=$baseURL;?>bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  705. <script src="<?=$baseURL;?>bower_components/metisMenu/dist/metisMenu.min.js"></script>
  706. <script src="<?=$baseURL;?>bower_components/Waves/dist/waves.min.js"></script>
  707. <script src="<?=$baseURL;?>bower_components/moment/min/moment.min.js"></script>
  708. <script src="<?=$baseURL;?>bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  709. <script src="<?=$baseURL;?>bower_components/slimScroll/jquery.slimscroll.min.js"></script>
  710. <script src="<?=$baseURL;?>bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
  711. <script src="<?=$baseURL;?>bower_components/cta/dist/cta.min.js"></script>
  712. <!--Menu-->
  713. <script src="<?=$baseURL;?>js/menu/classie.js"></script>
  714. <script src="<?=$baseURL;?>js/menu/gnmenu.js"></script>
  715. <!--Selects-->
  716. <script src="<?=$baseURL;?>js/selects/selectFx.js"></script>
  717. <script src="<?=$baseURL;?>bower_components/sweetalert/dist/sweetalert.min.js"></script>
  718. <script src="<?=$baseURL;?>bower_components/smoke/dist/js/smoke.min.js"></script>
  719. <!--Notification-->
  720. <script src="<?=$baseURL;?>js/notifications/notificationFx.js"></script>
  721. <!--Custom Scripts-->
  722. <script src="<?=$baseURL;?>js/common.js"></script>
  723. <script src="<?=$baseURL;?>js/mousetrap.min.js"></script>
  724. <script>
  725. var fixed = document.getElementById('gn-scroller');
  726. fixed.addEventListener('touchmove', function(e) {
  727. e.preventDefault();
  728. }, false);
  729. function setHeight() {
  730. windowHeight = $(window).innerHeight();
  731. $("div").find(".iframe").css('height', windowHeight - 56 + "px");
  732. $('#content').css('height', windowHeight - 56 + "px");
  733. };
  734. function notify(notifyString, notifyIcon, notifyType, notifyLength) {
  735. var notifyString = notifyString;
  736. var notifyIcon = notifyIcon;
  737. var notifyType = notifyType;
  738. var notifyLength = notifyLength;
  739. setTimeout(function () {
  740. var notification = new NotificationFx({
  741. message: '<span class="fa fa-' + notifyIcon + ' fa-2x"></span><p>' + notifyString + '</p>',
  742. layout: 'bar',
  743. effect: 'slidetop',
  744. ttl: notifyLength,
  745. type: notifyType // notice, warning, success or error
  746. });
  747. notification.show();
  748. }, 300);
  749. }
  750. $('#loginSubmit').click(function() {
  751. if ($('#login').smkValidate()) {
  752. console.log("validated");
  753. }
  754. console.log("didnt validate");
  755. });
  756. $('#registerSubmit').click(function() {
  757. if ($('#registration').smkValidate()) {
  758. console.log("validated");
  759. }
  760. console.log("didnt validate");
  761. User.processRegistration();
  762. });
  763. $("#editInfo").click(function(){
  764. $( "div[id^='editInfoDiv']" ).toggle();
  765. $( "div[id^='buttonsDiv']" ).toggle();
  766. });
  767. $("#goBackButtons").click(function(){
  768. $( "div[id^='editInfoDiv']" ).toggle();
  769. $( "div[id^='buttonsDiv']" ).toggle();
  770. });
  771. $("#switchForgot").click(function(){
  772. $( "form[id^='login']" ).toggle();
  773. $( "form[id^='forgotPassword']" ).toggle();
  774. $("#switchForgot").toggle();
  775. $("#switchCreateUser").toggle();
  776. });
  777. $("#switchCreateUser").click(function(){
  778. $( "form[id^='login']" ).toggle();
  779. $("#userPassForm").toggle();
  780. $("#switchForgot").toggle();
  781. $("#switchCreateUser").toggle();
  782. });
  783. //Sign in
  784. $(".log-in").click(function(e){
  785. var e1 = document.querySelector(".log-in"),
  786. e2 = document.querySelector(".login-modal");
  787. cta(e1, e2, {relativeToWindow: true}, function () {
  788. $('.login-modal').modal("show");
  789. });
  790. e.preventDefault();
  791. });
  792. //Logout
  793. $(".logout").click(function(e){
  794. var el1 = document.querySelector(".logout"),
  795. el2 = document.querySelector(".logout-modal");
  796. cta(el1, el2, {relativeToWindow: true}, function () {
  797. $('.logout-modal').modal("show");
  798. });
  799. e.preventDefault();
  800. });
  801. //Members Sidebar
  802. $(".show-members").click(function(e){
  803. var e_s1 = document.querySelector(".show-members"),
  804. e_s2 = document.querySelector("#members-sidebar");
  805. cta(e_s1, e_s2, {relativeToWindow: true}, function () {
  806. $('#members-sidebar').addClass('members-sidebar-open');
  807. });
  808. e.preventDefault();
  809. });
  810. $('.close-members-sidebar').click(function(){
  811. $('#members-sidebar').removeClass('members-sidebar-open');
  812. });
  813. $(document).ready(function(){
  814. $('#userCreateForm').submit(function(event) {
  815. var formData = {
  816. 'registerPasswordValue' : $('input[name=registerPasswordValue]').val()
  817. };
  818. $.ajax({
  819. type : 'POST',
  820. url : 'register.php',
  821. data : formData,
  822. dataType : 'json',
  823. encode : true
  824. })
  825. .done(function(data) {
  826. console.log(data);
  827. if ( ! data.success) {
  828. $('#userCreateErrors').html('Wrong Password!'); // add the actual error message under our input
  829. } else {
  830. $("#userPassForm").toggle();
  831. $("#registration").toggle();
  832. }
  833. });
  834. event.preventDefault();
  835. });
  836. defaultTab = $("li[class^='tab-item active']").attr("id");
  837. if (defaultTab){
  838. defaultTab = defaultTab.substr(0, defaultTab.length-1);
  839. }else{
  840. defaultTabNone = $("li[class^='tab-item']").attr("id");
  841. if (defaultTabNone){
  842. $("li[class^='tab-item']").first().attr("class", "tab-item active");
  843. defaultTab = defaultTabNone.substr(0, defaultTabNone.length-1);
  844. }
  845. }
  846. if (defaultTab){
  847. $("#content").html('<div class="iframe active" data-content-url="'+defaultTab+'"><iframe scrolling="auto" sandbox="allow-forms allow-same-origin allow-pointer-lock allow-scripts allow-popups allow-modals allow-top-navigation" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" frameborder="0" style="width:100%; height:100%;" src="'+defaultTab+'"></iframe></div>');
  848. document.getElementById('main-wrapper').focus();
  849. }
  850. if (defaultTab == null){
  851. $("div[id^='tabEmpty']").show();
  852. <?php if($needSetup == "No" && $configReady == "Yes") : if(!$USER->authenticated) : ?>
  853. $('.login-modal').modal("show");
  854. <?php endif; endif; ?>
  855. }
  856. if ($(location).attr('hash')){
  857. var getHash = $(location).attr('hash').substr(1).replace("%20", " ").replace("_", " ");
  858. var gotHash = getHash.toLowerCase();
  859. var getLiTab = $("li[name^='" + gotHash + "']");
  860. if(gotHash === "upgrade"){ getLiTab.toggle(); console.log("got it"); }
  861. getLiTab.trigger("click");
  862. }
  863. setHeight();
  864. });
  865. $(function () {
  866. <?php if(!empty($USER->info_log)) : ?>
  867. setTimeout(function () {
  868. var notification = new NotificationFx({
  869. message: '<span class="fa fa-info-circle fa-2x"></span><p><?php echo printArray($USER->info_log);?></p>',
  870. layout: 'bar',
  871. effect: 'slidetop',
  872. type: 'notice', // notice, warning, success or error
  873. });
  874. notification.show();
  875. }, 1200);
  876. <?php endif; ?>
  877. <?php if(!empty($USER->error_log)) : ?>
  878. setTimeout(function () {
  879. var notification = new NotificationFx({
  880. message: '<span class="fa fa-exclamation-triangle fa-2x"></span><p><?php echo printArray($USER->error_log); ?></p>',
  881. layout: 'bar',
  882. effect: 'slidetop',
  883. type: 'warning', // notice, warning, success or error
  884. });
  885. notification.show();
  886. }, 1200);
  887. <?php endif; ?>
  888. });
  889. $('#reload').on('click tap', function(){
  890. $("i[class^='mdi mdi-refresh']").attr("class", "mdi mdi-refresh fa-spin");
  891. var activeFrame = $('#content').find('.active').children('iframe');
  892. activeFrame.attr('src', activeFrame.attr('src'));
  893. var refreshBox = $('#content').find('.active');
  894. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(10);
  895. setTimeout(function(){
  896. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  897. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  898. refreshPreloader.remove();
  899. $("i[class^='mdi mdi-refresh fa-spin']").attr("class", "mdi mdi-refresh");
  900. });
  901. },500);
  902. });
  903. $('#reload').on('contextmenu', function(e){
  904. $("i[class^='mdi mdi-refresh']").attr("class", "mdi mdi-refresh fa-spin");
  905. var activeFrame = $('#contentRight').find('.active').children('iframe');
  906. activeFrame.attr('src', activeFrame.attr('src'));
  907. var refreshBox = $('#contentRight').find('.active');
  908. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(10);
  909. setTimeout(function(){
  910. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  911. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  912. refreshPreloader.remove();
  913. $("i[class^='mdi mdi-refresh fa-spin']").attr("class", "mdi mdi-refresh");
  914. });
  915. },500);
  916. return false;
  917. });
  918. $('#splitView').on('click tap', function(){
  919. $('#splitView').hide();
  920. $("#content").attr("class", "content");
  921. $("li[class^='tab-item rightActive']").attr("class", "tab-item");
  922. $("#contentRight").html('');
  923. });
  924. $("li[id^='settings.phpx']").on('click tap', function(){
  925. $("img[id^='settings-icon']").attr("class", "fa-spin");
  926. $("i[id^='settings-icon']").attr("class", "fa fa-cog fa-spin");
  927. setTimeout(function(){
  928. $("img[id^='settings-icon']").attr("class", "");
  929. $("i[id^='settings-icon']").attr("class", "fa fa-cog");
  930. },1000);
  931. });
  932. $('#logoutSubmit').on('click tap', function(){
  933. $( "#logout" ).submit();
  934. });
  935. $(window).resize(function(){
  936. setHeight();
  937. });
  938. $("li[class^='tab-item']").on('click vclick', function(){
  939. var thisidfull = $(this).attr("id");
  940. var thistitle = $(this).attr("data-title");
  941. var thisname = $(this).attr("name");
  942. var thisid = thisidfull.substr(0, thisidfull.length-1);
  943. var currentframe = $("#content div[data-content-url^='"+thisid+"']");
  944. if (currentframe.attr("class") == "iframe active") {
  945. console.log(thisid + " is active already");
  946. }else if (currentframe.attr("class") == "iframe hidden") {
  947. console.log(thisid + " is active already but hidden");
  948. $("#content div[class^='iframe active']").attr("class", "iframe hidden");
  949. currentframe.attr("class", "iframe active");
  950. document.title = thistitle;
  951. window.location.href = '#' + thisname;
  952. setHeight();
  953. $("li[class^='tab-item active']").attr("class", "tab-item");
  954. $(this).attr("class", "tab-item active");
  955. }else {
  956. if ($(this).attr("window") == "true") {
  957. window.open(thisid,'_blank');
  958. }else {
  959. console.log(thisid + " make new div");
  960. $("#content div[class^='iframe active']").attr("class", "iframe hidden");
  961. $( '<div class="iframe active" data-content-url="'+thisid+'"><iframe scrolling="auto" sandbox="allow-forms allow-same-origin allow-pointer-lock allow-scripts allow-popups allow-modals allow-top-navigation" allowfullscreen="true" webkitallowfullscreen="true" frameborder="0" style="width:100%; height:100%;" src="'+thisid+'"></iframe></div>' ).appendTo( "#content" );
  962. document.title = thistitle;
  963. window.location.href = '#' + thisname;
  964. setHeight();
  965. $("li[class^='tab-item active']").attr("class", "tab-item");
  966. $(this).attr("class", "tab-item active");
  967. }
  968. }
  969. });
  970. $("li[class^='tab-item']").on('contextmenu', function(e){
  971. e.stopPropagation();
  972. $('#splitView').show();
  973. $("#content").attr("class", "content split");
  974. var thisidfull = $(this).attr("id");
  975. var thistitle = $(this).attr("data-title");
  976. var thisname = $(this).attr("name");
  977. var thisid = thisidfull.substr(0, thisidfull.length-1);
  978. var currentframe = $("#contentRight div[data-content-url^='"+thisid+"']");
  979. if (currentframe.attr("class") == "iframe active") {
  980. console.log(thisid + " is active already");
  981. }else if (currentframe.attr("class") == "iframe hidden") {
  982. console.log(thisid + " is active already but hidden");
  983. $("#contentRight div[class^='iframe active']").attr("class", "iframe hidden");
  984. currentframe.attr("class", "iframe active");
  985. document.title = thistitle;
  986. window.location.href = '#' + thisname;
  987. setHeight();
  988. $("li[class^='tab-item rightActive']").attr("class", "tab-item");
  989. $(this).attr("class", "tab-item rightActive");
  990. }else {
  991. if ($(this).attr("window") == "true") {
  992. window.open(thisid,'_blank');
  993. }else {
  994. console.log(thisid + " make new div");
  995. $("#contentRight div[class^='iframe active']").attr("class", "iframe hidden");
  996. $( '<div class="iframe active" data-content-url="'+thisid+'"><iframe scrolling="auto" sandbox="allow-forms allow-same-origin allow-pointer-lock allow-scripts allow-popups allow-modals allow-top-navigation" allowfullscreen="true" webkitallowfullscreen="true" frameborder="0" style="width:100%; height:100%;" src="'+thisid+'"></iframe></div>' ).appendTo( "#contentRight" );
  997. document.title = thistitle;
  998. window.location.href = '#' + thisname;
  999. setHeight();
  1000. $("li[class^='tab-item rightActive']").attr("class", "tab-item");
  1001. $(this).attr("class", "tab-item rightActive");
  1002. }
  1003. }
  1004. return false;
  1005. });
  1006. Mousetrap.bind('ctrl+shift+up', function(e) {
  1007. var getCurrentTab = $("li[class^='tab-item active']");
  1008. var previousTab = getCurrentTab.prev().attr( "class", "tab-item" );
  1009. previousTab.trigger("click");
  1010. return false;
  1011. });
  1012. Mousetrap.bind('ctrl+shift+down', function(e) {
  1013. var getCurrentTab = $("li[class^='tab-item active']");
  1014. var nextTab = getCurrentTab.next().attr( "class", "tab-item" );
  1015. nextTab.trigger("click");
  1016. return false;
  1017. });
  1018. Mousetrap.bind('s s', function() { $("li[id^='settings.phpx']").trigger("click"); });
  1019. Mousetrap.bind('p p', function() { $("a[class^='fix-nav']").trigger("click"); });
  1020. Mousetrap.bind('m m', function() { $("div[class^='hamburger']").trigger("click"); });
  1021. Mousetrap.bind('r r', function() { $("a[id^='reload']").trigger("click"); });
  1022. Mousetrap.bind('f f', function() { $("a[class^='fullscreen']").trigger("click"); });
  1023. <?php if($tabSetup == "No") : foreach(range(1,$tabCount) as $index) : if ($index == 10) : break; endif;?>
  1024. Mousetrap.bind('ctrl+shift+<?php echo $index; ?>', function() { $("ul[id^='tabList'] li:nth-child(<?php echo $index; ?>)").trigger("click"); });
  1025. <?php endforeach; endif; ?>
  1026. Mousetrap.bind('esc esc', function() {
  1027. $("#content").attr("class", "content");
  1028. $("li[class^='tab-item rightActive']").attr("class", "tab-item");
  1029. $("#contentRight").html('');
  1030. });
  1031. </script>
  1032. </body>
  1033. </html>