index.php 71 KB

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