index.php 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698
  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. $loading = "#000000";
  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. <form style="display: none;" name="forgotPassword" id="forgotPassword" action="" method="POST" data-smk-icon="glyphicon-remove-sign">
  631. <h4 class="text-center"><?php echo $language->translate("FORGOT_PASSWORD");?></h4>
  632. <div class="form-group">
  633. <input type="hidden" name="op" value="reset">
  634. <input type="text" class="form-control material" name="email" placeholder="<?php echo $language->translate("EMAIL");?>" autocorrect="off" autocapitalize="off" value="" autofocus required>
  635. </div>
  636. <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>
  637. </form>
  638. </div>
  639. </div>
  640. </div>
  641. </div>
  642. </div>
  643. </div>
  644. </div>
  645. <?php endif; endif;?>
  646. <?php if($configReady == "Yes") : if($USER->authenticated) : ?>
  647. <div style="background:<?=$topbar;?>;" class="logout-modal modal fade">
  648. <div class="table-wrapper" style="background: <?=$topbar;?>">
  649. <div class="table-row">
  650. <div class="table-cell text-center">
  651. <div class="login i-block">
  652. <div class="content-box">
  653. <div style="background:<?=$topbartext;?>;" class="biggest-box">
  654. <form name="log out" id="logout" action="" method="POST">
  655. <input type="hidden" name="op" value="logout">
  656. <input type="hidden" name="username"value="<?php echo $_SESSION["username"]; ?>" >
  657. <h3 style="color:<?=$topbar;?>;" class="zero-m text-uppercase"><?php echo $language->translate("DO_YOU_WANT_TO_LOGOUT");?></h3>
  658. <a style="color:<?=$topbar;?>;" id="logoutSubmit" class="i-block" data-dismiss="modal"><?php echo $language->translate("YES_WORD");?></a>
  659. <a style="color:<?=$topbar;?>;" class="i-block" data-dismiss="modal"><?php echo $language->translate("NO_WORD");?></a>
  660. </form>
  661. </div>
  662. </div>
  663. </div>
  664. </div>
  665. </div>
  666. </div>
  667. </div>
  668. <?php endif; endif;?>
  669. <!--Scripts-->
  670. <script src="<?=$baseURL;?>bower_components/jquery/dist/jquery.min.js"></script>
  671. <script src="<?=$baseURL;?>bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  672. <script src="<?=$baseURL;?>bower_components/metisMenu/dist/metisMenu.min.js"></script>
  673. <script src="<?=$baseURL;?>bower_components/Waves/dist/waves.min.js"></script>
  674. <script src="<?=$baseURL;?>bower_components/moment/min/moment.min.js"></script>
  675. <script src="<?=$baseURL;?>bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
  676. <script src="<?=$baseURL;?>bower_components/slimScroll/jquery.slimscroll.min.js"></script>
  677. <script src="<?=$baseURL;?>bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
  678. <script src="<?=$baseURL;?>bower_components/cta/dist/cta.min.js"></script>
  679. <!--Menu-->
  680. <script src="<?=$baseURL;?>js/menu/classie.js"></script>
  681. <script src="<?=$baseURL;?>js/menu/gnmenu.js"></script>
  682. <!--Selects-->
  683. <script src="<?=$baseURL;?>js/selects/selectFx.js"></script>
  684. <script src="<?=$baseURL;?>bower_components/sweetalert/dist/sweetalert.min.js"></script>
  685. <script src="<?=$baseURL;?>bower_components/smoke/dist/js/smoke.min.js"></script>
  686. <!--Notification-->
  687. <script src="<?=$baseURL;?>js/notifications/notificationFx.js"></script>
  688. <!--Custom Scripts-->
  689. <script src="<?=$baseURL;?>js/common.js"></script>
  690. <script src="<?=$baseURL;?>js/mousetrap.min.js"></script>
  691. <script>
  692. var fixed = document.getElementById('gn-scroller');
  693. fixed.addEventListener('touchmove', function(e) {
  694. e.preventDefault();
  695. }, false);
  696. function setHeight() {
  697. windowHeight = $(window).innerHeight();
  698. $("div").find(".iframe").css('height', windowHeight - 56 + "px");
  699. $('#content').css('height', windowHeight - 56 + "px");
  700. };
  701. function notify(notifyString, notifyIcon, notifyType, notifyLength) {
  702. var notifyString = notifyString;
  703. var notifyIcon = notifyIcon;
  704. var notifyType = notifyType;
  705. var notifyLength = notifyLength;
  706. setTimeout(function () {
  707. var notification = new NotificationFx({
  708. message: '<span class="fa fa-' + notifyIcon + ' fa-2x"></span><p>' + notifyString + '</p>',
  709. layout: 'bar',
  710. effect: 'slidetop',
  711. ttl: notifyLength,
  712. type: notifyType // notice, warning, success or error
  713. });
  714. notification.show();
  715. }, 300);
  716. }
  717. $('#loginSubmit').click(function() {
  718. if ($('#login').smkValidate()) {
  719. console.log("validated");
  720. }
  721. console.log("didnt validate");
  722. });
  723. $('#registerSubmit').click(function() {
  724. if ($('#registration').smkValidate()) {
  725. console.log("validated");
  726. }
  727. console.log("didnt validate");
  728. User.processRegistration();
  729. });
  730. $("#editInfo").click(function(){
  731. $( "div[id^='editInfoDiv']" ).toggle();
  732. $( "div[id^='buttonsDiv']" ).toggle();
  733. });
  734. $("#goBackButtons").click(function(){
  735. $( "div[id^='editInfoDiv']" ).toggle();
  736. $( "div[id^='buttonsDiv']" ).toggle();
  737. });
  738. $("#switchForgot").click(function(){
  739. $( "form[id^='login']" ).toggle();
  740. $( "form[id^='forgotPassword']" ).toggle();
  741. $("#switchForgot").toggle();
  742. });
  743. //Sign in
  744. $(".log-in").click(function(e){
  745. var e1 = document.querySelector(".log-in"),
  746. e2 = document.querySelector(".login-modal");
  747. cta(e1, e2, {relativeToWindow: true}, function () {
  748. $('.login-modal').modal("show");
  749. });
  750. e.preventDefault();
  751. });
  752. //Logout
  753. $(".logout").click(function(e){
  754. var el1 = document.querySelector(".logout"),
  755. el2 = document.querySelector(".logout-modal");
  756. cta(el1, el2, {relativeToWindow: true}, function () {
  757. $('.logout-modal').modal("show");
  758. });
  759. e.preventDefault();
  760. });
  761. //Members Sidebar
  762. $(".show-members").click(function(e){
  763. var e_s1 = document.querySelector(".show-members"),
  764. e_s2 = document.querySelector("#members-sidebar");
  765. cta(e_s1, e_s2, {relativeToWindow: true}, function () {
  766. $('#members-sidebar').addClass('members-sidebar-open');
  767. });
  768. e.preventDefault();
  769. });
  770. $('.close-members-sidebar').click(function(){
  771. $('#members-sidebar').removeClass('members-sidebar-open');
  772. });
  773. $(document).ready(function(){
  774. defaultTab = $("li[class^='tab-item active']").attr("id");
  775. if (defaultTab){
  776. defaultTab = defaultTab.substr(0, defaultTab.length-1);
  777. }else{
  778. defaultTabNone = $("li[class^='tab-item']").attr("id");
  779. if (defaultTabNone){
  780. $("li[class^='tab-item']").first().attr("class", "tab-item active");
  781. defaultTab = defaultTabNone.substr(0, defaultTabNone.length-1);
  782. }
  783. }
  784. if (defaultTab){
  785. $("#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>');
  786. document.getElementById('main-wrapper').focus();
  787. }
  788. if (defaultTab == null){
  789. $("div[id^='tabEmpty']").show();
  790. <?php if($needSetup == "No" && $configReady == "Yes") : if(!$USER->authenticated) : ?>
  791. $('.login-modal').modal("show");
  792. <?php endif; endif; ?>
  793. }
  794. if ($(location).attr('hash')){
  795. var getHash = $(location).attr('hash').substr(1).replace("%20", " ").replace("_", " ");
  796. var gotHash = getHash.toLowerCase();
  797. var getLiTab = $("li[name^='" + gotHash + "']");
  798. if(gotHash === "upgrade"){ getLiTab.toggle(); console.log("got it"); }
  799. getLiTab.trigger("click");
  800. }
  801. setHeight();
  802. });
  803. $(function () {
  804. <?php if(!empty($USER->info_log)) : ?>
  805. setTimeout(function () {
  806. var notification = new NotificationFx({
  807. message: '<span class="fa fa-info-circle fa-2x"></span><p><?php echo printArray($USER->info_log);?></p>',
  808. layout: 'bar',
  809. effect: 'slidetop',
  810. type: 'notice', // notice, warning, success or error
  811. });
  812. notification.show();
  813. }, 1200);
  814. <?php endif; ?>
  815. <?php if(!empty($USER->error_log)) : ?>
  816. setTimeout(function () {
  817. var notification = new NotificationFx({
  818. message: '<span class="fa fa-exclamation-triangle fa-2x"></span><p><?php echo printArray($USER->error_log); ?></p>',
  819. layout: 'bar',
  820. effect: 'slidetop',
  821. type: 'warning', // notice, warning, success or error
  822. });
  823. notification.show();
  824. }, 1200);
  825. <?php endif; ?>
  826. });
  827. $('#reload').on('click tap', function(){
  828. $("i[class^='mdi mdi-refresh']").attr("class", "mdi mdi-refresh fa-spin");
  829. var activeFrame = $('#content').find('.active').children('iframe');
  830. activeFrame.attr('src', activeFrame.attr('src'));
  831. var refreshBox = $('#content').find('.active');
  832. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(10);
  833. setTimeout(function(){
  834. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  835. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  836. refreshPreloader.remove();
  837. $("i[class^='mdi mdi-refresh fa-spin']").attr("class", "mdi mdi-refresh");
  838. });
  839. },500);
  840. });
  841. $('#reload').on('contextmenu', function(e){
  842. $("i[class^='mdi mdi-refresh']").attr("class", "mdi mdi-refresh fa-spin");
  843. var activeFrame = $('#contentRight').find('.active').children('iframe');
  844. activeFrame.attr('src', activeFrame.attr('src'));
  845. var refreshBox = $('#contentRight').find('.active');
  846. $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(refreshBox).fadeIn(10);
  847. setTimeout(function(){
  848. var refreshPreloader = refreshBox.find('.refresh-preloader'),
  849. deletedRefreshBox = refreshPreloader.fadeOut(300, function(){
  850. refreshPreloader.remove();
  851. $("i[class^='mdi mdi-refresh fa-spin']").attr("class", "mdi mdi-refresh");
  852. });
  853. },500);
  854. return false;
  855. });
  856. $('#splitView').on('click tap', function(){
  857. $('#splitView').hide();
  858. $("#content").attr("class", "content");
  859. $("li[class^='tab-item rightActive']").attr("class", "tab-item");
  860. $("#contentRight").html('');
  861. });
  862. $("li[id^='settings.phpx']").on('click tap', function(){
  863. $("img[id^='settings-icon']").attr("class", "fa-spin");
  864. $("i[id^='settings-icon']").attr("class", "fa fa-cog fa-spin");
  865. setTimeout(function(){
  866. $("img[id^='settings-icon']").attr("class", "");
  867. $("i[id^='settings-icon']").attr("class", "fa fa-cog");
  868. },1000);
  869. });
  870. $('#logoutSubmit').on('click tap', function(){
  871. $( "#logout" ).submit();
  872. });
  873. $(window).resize(function(){
  874. setHeight();
  875. });
  876. $("li[class^='tab-item']").on('click vclick', function(){
  877. var thisidfull = $(this).attr("id");
  878. var thistitle = $(this).attr("data-title");
  879. var thisname = $(this).attr("name");
  880. var thisid = thisidfull.substr(0, thisidfull.length-1);
  881. var currentframe = $("#content div[data-content-url^='"+thisid+"']");
  882. if (currentframe.attr("class") == "iframe active") {
  883. console.log(thisid + " is active already");
  884. }else if (currentframe.attr("class") == "iframe hidden") {
  885. console.log(thisid + " is active already but hidden");
  886. $("#content div[class^='iframe active']").attr("class", "iframe hidden");
  887. currentframe.attr("class", "iframe active");
  888. document.title = thistitle;
  889. window.location.href = '#' + thisname;
  890. setHeight();
  891. $("li[class^='tab-item active']").attr("class", "tab-item");
  892. $(this).attr("class", "tab-item active");
  893. }else {
  894. if ($(this).attr("window") == "true") {
  895. window.open(thisid,'_blank');
  896. }else {
  897. console.log(thisid + " make new div");
  898. $("#content div[class^='iframe active']").attr("class", "iframe hidden");
  899. $( '<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" );
  900. document.title = thistitle;
  901. window.location.href = '#' + thisname;
  902. setHeight();
  903. $("li[class^='tab-item active']").attr("class", "tab-item");
  904. $(this).attr("class", "tab-item active");
  905. }
  906. }
  907. });
  908. $("li[class^='tab-item']").on('contextmenu', function(e){
  909. e.stopPropagation();
  910. $('#splitView').show();
  911. $("#content").attr("class", "content split");
  912. var thisidfull = $(this).attr("id");
  913. var thistitle = $(this).attr("data-title");
  914. var thisname = $(this).attr("name");
  915. var thisid = thisidfull.substr(0, thisidfull.length-1);
  916. var currentframe = $("#contentRight div[data-content-url^='"+thisid+"']");
  917. if (currentframe.attr("class") == "iframe active") {
  918. console.log(thisid + " is active already");
  919. }else if (currentframe.attr("class") == "iframe hidden") {
  920. console.log(thisid + " is active already but hidden");
  921. $("#contentRight div[class^='iframe active']").attr("class", "iframe hidden");
  922. currentframe.attr("class", "iframe active");
  923. document.title = thistitle;
  924. window.location.href = '#' + thisname;
  925. setHeight();
  926. $("li[class^='tab-item rightActive']").attr("class", "tab-item");
  927. $(this).attr("class", "tab-item rightActive");
  928. }else {
  929. if ($(this).attr("window") == "true") {
  930. window.open(thisid,'_blank');
  931. }else {
  932. console.log(thisid + " make new div");
  933. $("#contentRight div[class^='iframe active']").attr("class", "iframe hidden");
  934. $( '<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" );
  935. document.title = thistitle;
  936. window.location.href = '#' + thisname;
  937. setHeight();
  938. $("li[class^='tab-item rightActive']").attr("class", "tab-item");
  939. $(this).attr("class", "tab-item rightActive");
  940. }
  941. }
  942. return false;
  943. });
  944. Mousetrap.bind('ctrl+shift+up', function(e) {
  945. var getCurrentTab = $("li[class^='tab-item active']");
  946. var previousTab = getCurrentTab.prev().attr( "class", "tab-item" );
  947. previousTab.trigger("click");
  948. return false;
  949. });
  950. Mousetrap.bind('ctrl+shift+down', function(e) {
  951. var getCurrentTab = $("li[class^='tab-item active']");
  952. var nextTab = getCurrentTab.next().attr( "class", "tab-item" );
  953. nextTab.trigger("click");
  954. return false;
  955. });
  956. Mousetrap.bind('s s', function() { $("li[id^='settings.phpx']").trigger("click"); });
  957. Mousetrap.bind('p p', function() { $("a[class^='fix-nav']").trigger("click"); });
  958. Mousetrap.bind('m m', function() { $("div[class^='hamburger']").trigger("click"); });
  959. Mousetrap.bind('r r', function() { $("a[id^='reload']").trigger("click"); });
  960. Mousetrap.bind('f f', function() { $("a[class^='fullscreen']").trigger("click"); });
  961. <?php if($tabSetup == "No") : foreach(range(1,$tabCount) as $index) : if ($index == 10) : break; endif;?>
  962. Mousetrap.bind('ctrl+shift+<?php echo $index; ?>', function() { $("ul[id^='tabList'] li:nth-child(<?php echo $index; ?>)").trigger("click"); });
  963. <?php endforeach; endif; ?>
  964. Mousetrap.bind('esc esc', function() {
  965. $("#content").attr("class", "content");
  966. $("li[class^='tab-item rightActive']").attr("class", "tab-item");
  967. $("#contentRight").html('');
  968. });
  969. </script>
  970. </body>
  971. </html>