index.php 63 KB

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