Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

header.php 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <?php ob_start(); ?>
  5. <title>{title_holder}</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  8. <meta name="description" content="<?php echo $CONF['sitedescription']; ?>" />
  9. <meta name="author" content="<?php echo $CONF['siteowner']; ?>" />
  10. <meta name="viewport" content="width=device-width, initial-scale=1" />
  11. <link rel="shortcut icon" href="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/img/favicon.ico" type="image/x-icon" />
  12. <?php
  13. $cssFiles = array();
  14. $jsFiles = array();
  15. // Global CSS Files //
  16. array_push($cssFiles, 'font-awesome.min.css', 'common.css');
  17. // Global JS Files //
  18. array_push($jsFiles, 'jquery/1.10.2/jquery.min.js', 'common.js', 'bootstrap/bootstrap.min.js', 'bootstrap/select/bootstrap-select.js');
  19. // Service Specific Files //
  20. switch ($CONF['page'])
  21. {
  22. case "home":
  23. array_push($cssFiles, 'bootstrap-markdown.min.css');
  24. array_push($jsFiles, 'bootbox/bootbox.min.js',
  25. 'PageDown/Markdown.Converter.js',
  26. 'PageDown/Markdown.Sanitizer.js',
  27. 'bootstrap/markdown/bootstrap-markdown.js',
  28. 'jquery/jquery.blockUI.js',
  29. 'profile.js');
  30. break;
  31. case "admin":
  32. array_push($jsFiles, 'admin.js');
  33. break;
  34. case "about":
  35. array_push($cssFiles, 'coin.css');
  36. array_push($jsFiles, 'coin/coin.js');
  37. break;
  38. case "blog":
  39. array_push($cssFiles, 'bootstrap-markdown.min.css');
  40. array_push($jsFiles,
  41. 'bootbox/bootbox.min.js',
  42. 'PageDown/Markdown.Converter.js',
  43. 'PageDown/Markdown.Sanitizer.js',
  44. 'bootstrap/markdown/bootstrap-markdown.js',
  45. 'ocupload/1.1.2/ocupload.js',
  46. 'blog.js');
  47. break;
  48. case "contact":
  49. array_push($jsFiles, 'contact.js');
  50. break;
  51. case "git":
  52. $url = curPageURL();
  53. $pattern = "/^(.*)((\/zipball\/)|(\/tarball\/)|(\/raw\/))(.*)$/";
  54. if(!preg_match($pattern, $url))
  55. {
  56. array_push($jsFiles,
  57. //'raphael/raphael.js',
  58. 'showdown/showdown.js',
  59. 'codemirror/codemirror.js');
  60. }
  61. array_push($jsFiles, 'git.js');
  62. break;
  63. case "help":
  64. array_push($cssFiles, 'jquery.tocify.css');
  65. array_push($jsFiles,
  66. 'jquery/1.10.2/jquery-ui.widgets.js',
  67. 'jquery/jquery.tocify.min.js',
  68. 'help.js');
  69. break;
  70. case "pod":
  71. case "podcast":
  72. array_push($cssFiles, 'bootstrap-markdown.min.css', 'audioplayer.css');
  73. array_push($jsFiles,
  74. 'bootbox/bootbox.min.js',
  75. 'PageDown/Markdown.Converter.js',
  76. 'PageDown/Markdown.Sanitizer.js',
  77. 'bootstrap/markdown/bootstrap-markdown.js',
  78. 'jquery/1.10.2/jquery-ui.widgets.js',
  79. 'jquery/jquery.iframe-transport.js',
  80. 'jquery/jquery.fileupload.js',
  81. 'audioplayer/audioplayer.min.js',
  82. 'podcast.js');
  83. break;
  84. case "ricehalla":
  85. case "desktops":
  86. array_push($cssFiles, 'bootstrap-tags.css', 'bootstrap-modal.css');
  87. array_push($jsFiles,
  88. 'bootbox/bootbox.min.js',
  89. 'ocupload/1.1.2/ocupload.js',
  90. 'jquery/jquery.zoom.min.js',
  91. 'bootstrap/modal/bootstrap-modalmanager.js',
  92. 'bootstrap/modal/bootstrap-modal.js',
  93. 'bootstrap/tags/bootstrap-tags.js',
  94. 'ricehalla.js');
  95. break;
  96. case "upload":
  97. case "u":
  98. array_push($cssFiles, 'dropzone.css');
  99. array_push($jsFiles,
  100. 'dropzone/dropzone.js',
  101. 'upload.js',
  102. 'bootbox/bootbox.min.js');
  103. break;
  104. case "paste":
  105. case "p":
  106. array_push($jsFiles, 'paste.js');
  107. break;
  108. case "server":
  109. array_push($jsFiles,
  110. 'sorttable/sorttable.js',
  111. 'transparency/transparency.min.js',
  112. 'server.js');
  113. case "w":
  114. case "walls":
  115. array_push($cssFiles, 'blueimp-gallery.min.css', 'bootstrap-image-gallery.min.css');
  116. array_push($jsFiles,
  117. 'blueimp/blueimp-gallery.min.js',
  118. 'jquery/jquery.blueimp-gallery.min.js',
  119. 'bootstrap/image-gallery/bootstrap-image-gallery.min.js',
  120. 'walls.js');
  121. break;
  122. }
  123. // Check to see if the JS files have changed //
  124. $jsChanged = false;
  125. $jsCacheFile = dirname(__FILE__).'/cache/js_cache_'.$CONF['page'].'.txt';
  126. if (file_exists($jsCacheFile))
  127. {
  128. $cache_arr = explode('|', file_get_contents($jsCacheFile));
  129. $time_str = $cache_arr[0];
  130. $files_arr = explode(',', $cache_arr[1]);
  131. if (!empty($time_str) && files_arr)
  132. {
  133. $time = strtotime($time_str);
  134. foreach($jsFiles as $file)
  135. {
  136. if (!in_array($file, $files_arr))
  137. {
  138. $jsChanged = true;
  139. break;
  140. }
  141. if(filemtime(dirname(__FILE__)."/js/".$file)>$time)
  142. {
  143. $jsChanged = true;
  144. break;
  145. }
  146. }
  147. }
  148. else
  149. {
  150. $jsChanged = true;
  151. }
  152. }
  153. else
  154. {
  155. $jsChanged = true;
  156. }
  157. // If they have changed, minify them and
  158. if($jsChanged)
  159. {
  160. file_put_contents($jsCacheFile, date("Y-m-d H:i:s",time()).'|'.implode(",", $jsFiles));
  161. $js = "";
  162. foreach($jsFiles as $file)
  163. {
  164. $js .= \JShrink\Minifier::minify(file_get_contents(dirname(__FILE__).'/js/'.$file));
  165. }
  166. file_put_contents(dirname(__FILE__)."/cache/".$CONF['page'].".teknik.min.js", $js);
  167. }
  168. // Check to see if the CSS files have changed //
  169. $cssChanged = false;
  170. $cssCacheFile = dirname(__FILE__).'/cache/css_cache_'.$CONF['page'].'.txt';
  171. if (file_exists($cssCacheFile) && file_exists(dirname(__FILE__)."/cache/".$CONF['page'].".teknik.min.css"))
  172. {
  173. $cache_arr = explode('|', file_get_contents($cssCacheFile));
  174. $time_str = $cache_arr[0];
  175. $files_arr = explode(',', $cache_arr[1]);
  176. if (!empty($time_str) && files_arr)
  177. {
  178. $time = strtotime($time_str);
  179. foreach($cssFiles as $file)
  180. {
  181. if (!in_array($file, $files_arr))
  182. {
  183. $cssChanged = true;
  184. break;
  185. }
  186. if(filemtime(dirname(__FILE__)."/css/".$file)>$time)
  187. {
  188. $cssChanged = true;
  189. break;
  190. }
  191. }
  192. }
  193. else
  194. {
  195. $cssChanged = true;
  196. }
  197. }
  198. else
  199. {
  200. $cssChanged = true;
  201. }
  202. // If they have changed, minify them and
  203. if($cssChanged)
  204. {
  205. file_put_contents($cssCacheFile, date("Y-m-d H:i:s",time()).'|'.implode(",", $cssFiles));
  206. $css_str = "";
  207. foreach ($cssFiles as $file)
  208. {
  209. $css_str .= file_get_contents(dirname(__FILE__)."/css/".$file)."\r\n";
  210. }
  211. $final_css = compress($css_str);
  212. file_put_contents(dirname(__FILE__)."/cache/".$CONF['page'].".teknik.min.css", $css_str);
  213. }
  214. /*
  215. foreach ($cssFiles as $file)
  216. {
  217. ?>
  218. <link href="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/css/<?php echo $file; ?>" rel="stylesheet" />
  219. <?php
  220. }*/
  221. ?>
  222. <link href="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/css/bootstrap.<?php echo $CONF['theme']; ?>.min.css" rel="stylesheet" />
  223. <link href="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/cache/<?php echo $CONF['page']; ?>.teknik.min.css" rel="stylesheet" />
  224. <script src="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/cache/<?php echo $CONF['page']; ?>.teknik.min.js"></script>
  225. <?php
  226. // Theme specific files
  227. $cssTheme = array();
  228. $jsTheme = array();
  229. switch ($CONF['theme'])
  230. {
  231. case "default":
  232. array_push($cssTheme, 'bootstrap.default.min.css');
  233. break;
  234. case "darkly":
  235. array_push($cssTheme, 'bootstrap.darkly.min.css');
  236. break;
  237. case "flat-ui":
  238. array_push($cssTheme, 'bootstrap.default.min.css', 'flat-ui.min.css');
  239. array_push($jsTheme, 'respond/respond.min.js', 'flat-ui/flat-ui.min.js');
  240. break;
  241. case "flatly":
  242. array_push($cssTheme, 'bootstrap.flatly.min.css');
  243. break;
  244. case "lumen":
  245. array_push($cssTheme, 'bootstrap.lumen.min.css');
  246. break;
  247. case "material":
  248. array_push($cssTheme, 'bootstrap.default.min.css', 'material.css');
  249. array_push($jsTheme, 'material/material.js');
  250. break;
  251. case "paper":
  252. array_push($cssTheme, 'bootstrap.paper.min.css');
  253. break;
  254. case "sandstone":
  255. array_push($cssTheme, 'bootstrap.sandstone.min.css');
  256. break;
  257. case "simplex":
  258. array_push($cssTheme, 'bootstrap.samplex.min.css');
  259. break;
  260. case "superhero":
  261. array_push($cssTheme, 'bootstrap.superhero.min.css');
  262. break;
  263. }
  264. foreach ($cssTheme as $file)
  265. {
  266. ?>
  267. <link href="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/css/<?php echo $file; ?>" rel="stylesheet" />
  268. <?php
  269. }
  270. foreach ($jsTheme as $file)
  271. {
  272. ?>
  273. <script src="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/js/<?php echo $file; ?>"></script>
  274. <?php
  275. }
  276. ?>
  277. <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
  278. <!--[if lt IE 9]>
  279. <script src="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/js/html5/html5.js"></script>
  280. <![endif]-->
  281. </head>
  282. <?php flush(); ?>
  283. <body data-twttr-rendered="true">
  284. <div id="wrap">
  285. <div class="navbar navbar-default navbar-fixed-top">
  286. <div class="container">
  287. <div class="navbar-header">
  288. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  289. <span class="icon-bar"></span>
  290. <span class="icon-bar"></span>
  291. <span class="icon-bar"></span>
  292. </button>
  293. <a class="navbar-brand" href="<?php echo get_page_url("home", $CONF); ?>"><img src="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/img/logo-black.svg" height="50px" alt="Teknik"></a>
  294. </div>
  295. <div class="navbar-collapse collapse">
  296. <ul class="nav navbar-nav">
  297. <li class="<?php echo get_active("home", $CONF); ?>"><a href="<?php echo get_page_url("home", $CONF); ?>">Home</a></li>
  298. <li class="<?php echo get_active("about", $CONF); ?>"><a href="<?php echo get_page_url("about", $CONF); ?>">About</a></li>
  299. <li class="divider-vertical"></li>
  300. <li class="dropdown">
  301. <a href="#" id="services_menu" class="dropdown-toggle" data-toggle="dropdown">Services <strong class="caret"></strong></a>
  302. <ul class="dropdown-menu" role="menu" aria-labelledby="services_menu">
  303. <li class="<?php echo get_active("blog", $CONF); ?>">
  304. <a href="<?php echo get_page_url("blog", $CONF); ?>">Blog</a>
  305. </li>
  306. <li class="<?php echo get_active("podcast", $CONF); echo get_active("pod", $CONF); ?>">
  307. <a href="<?php echo get_page_url("podcast", $CONF); ?>">Podcast</a>
  308. </li>
  309. <li class="divider"></li>
  310. <li class="<?php echo get_active("upload", $CONF); echo get_active("u", $CONF); ?>">
  311. <a href="<?php echo get_page_url("upload", $CONF); ?>">Upload</a>
  312. </li>
  313. <li class="<?php echo get_active("paste", $CONF); echo get_active("p", $CONF); ?>">
  314. <a href="<?php echo get_page_url("paste", $CONF); ?>">Paste</a>
  315. </li>
  316. <li class="<?php echo get_active("git", $CONF); ?>">
  317. <a href="<?php echo get_page_url("git", $CONF); ?>">Git</a>
  318. </li>
  319. <li class="<?php echo get_active("mail", $CONF); ?>">
  320. <a href="<?php echo get_page_url("mail", $CONF); ?>" target="_blank">Mail</a>
  321. </li>
  322. <li class="<?php echo get_active("mumble", $CONF); ?>">
  323. <a href="mumble://mumble.<?php echo $CONF['host']; ?>:64738/?version=1.2.5" target="_blank">Mumble</a>
  324. </li>
  325. <li class="divider"></li>
  326. <li class="<?php echo get_active("ricehalla", $CONF); echo get_active("desktops", $CONF); ?>">
  327. <a href="<?php echo get_page_url("ricehalla", $CONF); ?>">Ricehalla</a>
  328. </li>
  329. </ul>
  330. </li>
  331. <li class="<?php echo get_active("contact", $CONF); ?>">
  332. <a href="<?php echo get_page_url("contact", $CONF); ?>">Contact</a>
  333. </li>
  334. <li class="<?php echo get_active("help", $CONF); ?>">
  335. <a href="<?php echo get_page_url("help", $CONF); ?>">Help</a>
  336. </li>
  337. </ul>
  338. <ul class="nav navbar-nav pull-right">
  339. <?php
  340. if ($logged_in)
  341. {
  342. ?>
  343. <li class="dropdown">
  344. <a href="#" id="user_menu" class="dropdown-toggle" data-toggle="dropdown"><?php echo $user->username; ?> <strong class="caret"></strong></a>
  345. <ul class="dropdown-menu" role="menu" aria-labelledby="user_menu">
  346. <li>
  347. <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $user->username; ?>">Profile</a>
  348. </li>
  349. <li>
  350. <a href="<?php echo get_page_url("blog", $CONF); ?>/<?php echo $user->username; ?>">Blog</a>
  351. </li>
  352. <?php
  353. if ($user->group == "Founder" || $user->group == "Admin" || $user->group == "Moderator")
  354. {
  355. ?>
  356. <li>
  357. <a href="<?php echo get_page_url("admin", $CONF); ?>">Administration</a>
  358. </li>
  359. <?php
  360. }
  361. ?>
  362. <li>
  363. <a href="#" id="logout">Logout</a>
  364. </li>
  365. </ul>
  366. </li>
  367. <?php
  368. }
  369. else
  370. {
  371. ?>
  372. <li class="dropdown">
  373. <a class="dropdown-toggle" href="#" data-toggle="dropdown" id="reg_dropdown">Sign Up <strong class="caret"></strong></a>
  374. <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">
  375. <form role="form" id="registrationForm" action="#" method="post" accept-charset="UTF-8">
  376. <div id="reg_err"></div>
  377. <div class="form-group">
  378. <input type="text" class="form-control" id="reg_username" placeholder="Username" name="reg_username" maxlength="30" />
  379. </div>
  380. <div class="form-group">
  381. <input type="password" class="form-control" id="reg_password" placeholder="Password" name="reg_password" />
  382. </div>
  383. <div class="form-group">
  384. <input type="password" class="form-control" id="reg_password_confirm" placeholder="Confirm" name="reg_password_confirm" />
  385. </div>
  386. <div class="form-group text-center">
  387. <button class="btn btn-primary" id="reg_submit" type="submit" name="submit">Sign Up</button>
  388. </div>
  389. </form>
  390. </div>
  391. </li>
  392. <li class="dropdown">
  393. <a class="dropdown-toggle" href="#" data-toggle="dropdown" id="login_dropdown">Sign In <strong class="caret"></strong></a>
  394. <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">
  395. <form role="form" id="loginForm" action="#" method="post" accept-charset="UTF-8">
  396. <div id="login_err"></div>
  397. <div class="form-group">
  398. <input type="text" class="form-control" id="login_username" placeholder="Username" name="login_username" />
  399. </div>
  400. <div class="form-group">
  401. <input type="password" class="form-control" id="login_password" placeholder="Password" name="login_password" />
  402. </div>
  403. <div class="checkbox">
  404. <label>
  405. <input id="login_remember_me" type="checkbox" name="login_remember_me" /> Remember Me
  406. </label>
  407. </div>
  408. <div class="form-group text-center">
  409. <button class="btn btn-primary" id="login_submit" type="submit" name="submit">Sign In</button>
  410. </div>
  411. </form>
  412. </div>
  413. </li>
  414. <?php
  415. }
  416. ?>
  417. </ul>
  418. </div>
  419. </div>
  420. </div>
  421. <div class="container">
  422. <div class="row">
  423. <div class="col-xs-12 text-center">
  424. <div id="top_msg"></div>
  425. </div>
  426. </div>
  427. </div>
  428. <!-- NoScript Alert -->
  429. <noscript>
  430. <div class="container">
  431. <div class="row">
  432. <div class="col-xs-12 text-center">
  433. <div class="alert alert-danger">
  434. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  435. <span><strong>Notice: </strong> JavaScript is not enabled. To experience the site at it's best, <a href="http://enable-javascript.com/" class="alert-link">please enable JavaScript</a>.</span>
  436. </div>
  437. </div>
  438. </div>
  439. </div>
  440. </noscript>