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 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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. $theme=array(
  230. 'default'=>'Default',
  231. 'darkly'=>'Darkly',
  232. 'flatly'=>'Flatly',
  233. 'lumen'=>'Lumen',
  234. 'material'=>'Material',
  235. 'paper'=>'Paper',
  236. 'sandstone'=>'Sandstone',
  237. 'simplex'=>'Simplex',
  238. 'superhero'=>'Superhero'
  239. );
  240. switch ($CONF['theme'])
  241. {
  242. case "default":
  243. array_push($cssTheme, 'bootstrap.default.min.css');
  244. break;
  245. case "darkly":
  246. array_push($cssTheme, 'bootstrap.darkly.min.css');
  247. break;
  248. case "flatly":
  249. array_push($cssTheme, 'bootstrap.flatly.min.css');
  250. break;
  251. case "lumen":
  252. array_push($cssTheme, 'bootstrap.lumen.min.css');
  253. break;
  254. case "material":
  255. array_push($cssTheme, 'bootstrap.default.min.css', 'material.css');
  256. array_push($jsTheme, 'material.js');
  257. break;
  258. case "paper":
  259. array_push($cssTheme, 'bootstrap.paper.min.css');
  260. break;
  261. case "sandstone":
  262. array_push($cssTheme, 'bootstrap.sandstone.min.css');
  263. break;
  264. case "simplex":
  265. array_push($cssTheme, 'bootstrap.samplex.min.css');
  266. break;
  267. case "superhero":
  268. array_push($cssTheme, 'bootstrap.superhero.min.css');
  269. break;
  270. }
  271. foreach ($cssTheme as $file)
  272. {
  273. ?>
  274. <link href="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/css/<?php echo $file; ?>" rel="stylesheet" />
  275. <?php
  276. }
  277. foreach ($jsTheme as $file)
  278. {
  279. ?>
  280. <script src="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/js/<?php echo $file; ?>"></script>
  281. <?php
  282. }
  283. ?>
  284. <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
  285. <!--[if lt IE 9]>
  286. <script src="<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/js/html5/html5.js"></script>
  287. <![endif]-->
  288. </head>
  289. <?php flush(); ?>
  290. <body data-twttr-rendered="true">
  291. <div id="wrap">
  292. <div class="navbar navbar-default navbar-fixed-top">
  293. <div class="container">
  294. <div class="navbar-header">
  295. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  296. <span class="icon-bar"></span>
  297. <span class="icon-bar"></span>
  298. <span class="icon-bar"></span>
  299. </button>
  300. <a class="navbar-brand" href="<?php echo get_page_url("home", $CONF); ?>">Teknik</a>
  301. </div>
  302. <div class="navbar-collapse collapse">
  303. <ul class="nav navbar-nav">
  304. <li class="<?php echo get_active("home", $CONF); ?>"><a href="<?php echo get_page_url("home", $CONF); ?>">Home</a></li>
  305. <li class="<?php echo get_active("about", $CONF); ?>"><a href="<?php echo get_page_url("about", $CONF); ?>">About</a></li>
  306. <li class="<?php echo get_active("blog", $CONF); ?>"><a href="<?php echo get_page_url("blog", $CONF); ?>">Blog</a></li>
  307. <li class="<?php echo get_active("podcast", $CONF); echo get_active("pod", $CONF); ?>"><a href="<?php echo get_page_url("podcast", $CONF); ?>">Podcast</a></li>
  308. <li class="divider-vertical"></li>
  309. <li class="dropdown">
  310. <a href="#" id="services_menu" class="dropdown-toggle" data-toggle="dropdown">Services <strong class="caret"></strong></a>
  311. <ul class="dropdown-menu" role="menu" aria-labelledby="services_menu">
  312. <li>
  313. <a href="<?php echo get_page_url("upload", $CONF); ?>">Upload</a>
  314. </li>
  315. <li>
  316. <a href="<?php echo get_page_url("paste", $CONF); ?>">Paste</a>
  317. </li>
  318. <li>
  319. <a href="<?php echo get_page_url("git", $CONF); ?>">Git</a>
  320. </li>
  321. <li>
  322. <a href="<?php echo get_page_url("mail", $CONF); ?>" target="_blank">Mail</a>
  323. </li>
  324. <li>
  325. <a href="mumble://mumble.<?php echo $CONF['host']; ?>:64738/?version=1.2.5" target="_blank">Mumble</a>
  326. </li>
  327. <!--
  328. <li class="divider"></li>
  329. <li>
  330. <a href="<?php echo get_page_url("ricehalla", $CONF); ?>">Ricehalla</a>
  331. </li>
  332. -->
  333. </ul>
  334. </li>
  335. <li class="<?php echo get_active("contact", $CONF); ?>">
  336. <a href="<?php echo get_page_url("contact", $CONF); ?>">Contact</a>
  337. </li>
  338. <li class="<?php echo get_active("help", $CONF); ?>">
  339. <a href="<?php echo get_page_url("help", $CONF); ?>">Help</a>
  340. </li>
  341. </ul>
  342. <ul class="nav navbar-nav navbar-right">
  343. <?php
  344. if ($logged_in)
  345. {
  346. ?>
  347. <li class="dropdown">
  348. <a href="#" id="user_menu" class="dropdown-toggle" data-toggle="dropdown"><?php echo $user->username; ?> <strong class="caret"></strong></a>
  349. <ul class="dropdown-menu" role="menu" aria-labelledby="user_menu">
  350. <li>
  351. <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $user->username; ?>">Profile</a>
  352. </li>
  353. <li>
  354. <a href="<?php echo get_page_url("blog", $CONF); ?>/<?php echo $user->username; ?>">Blog</a>
  355. </li>
  356. <?php
  357. if ($user->group == "Founder" || $user->group == "Admin" || $user->group == "Moderator")
  358. {
  359. ?>
  360. <li>
  361. <a href="<?php echo get_page_url("admin", $CONF); ?>">Administration</a>
  362. </li>
  363. <?php
  364. }
  365. ?>
  366. <li>
  367. <a href="#" id="logout">Logout</a>
  368. </li>
  369. </ul>
  370. </li>
  371. <?php
  372. }
  373. else
  374. {
  375. ?>
  376. <li class="dropdown">
  377. <a class="dropdown-toggle" href="#" data-toggle="dropdown" id="reg_dropdown">Sign Up <strong class="caret"></strong></a>
  378. <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">
  379. <form role="form" id="registrationForm" action="#" method="post" accept-charset="UTF-8">
  380. <div id="reg_err"></div>
  381. <div class="form-group">
  382. <input type="text" class="form-control" id="reg_username" placeholder="Username" name="reg_username" maxlength="30" />
  383. </div>
  384. <div class="form-group">
  385. <input type="password" class="form-control" id="reg_password" placeholder="Password" name="reg_password" />
  386. </div>
  387. <div class="form-group">
  388. <input type="password" class="form-control" id="reg_password_confirm" placeholder="Confirm" name="reg_password_confirm" />
  389. </div>
  390. <div class="form-group text-center">
  391. <button class="btn btn-primary" id="reg_submit" type="submit" name="submit">Sign Up</button>
  392. </div>
  393. </form>
  394. </div>
  395. </li>
  396. <li class="dropdown">
  397. <a class="dropdown-toggle" href="#" data-toggle="dropdown" id="login_dropdown">Sign In <strong class="caret"></strong></a>
  398. <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">
  399. <form role="form" id="loginForm" action="#" method="post" accept-charset="UTF-8">
  400. <div id="login_err"></div>
  401. <div class="form-group">
  402. <input type="text" class="form-control" id="login_username" placeholder="Username" name="login_username" />
  403. </div>
  404. <div class="form-group">
  405. <input type="password" class="form-control" id="login_password" placeholder="Password" name="login_password" />
  406. </div>
  407. <div class="checkbox">
  408. <label>
  409. <input id="login_remember_me" type="checkbox" name="login_remember_me" /> Remember Me
  410. </label>
  411. </div>
  412. <div class="form-group text-center">
  413. <button class="btn btn-primary" id="login_submit" type="submit" name="submit">Sign In</button>
  414. </div>
  415. </form>
  416. </div>
  417. </li>
  418. <?php
  419. }
  420. ?>
  421. </ul>
  422. </div>
  423. </div>
  424. </div>
  425. <div class="container">
  426. <div class="row">
  427. <div class="col-xs-12 text-center">
  428. <div id="top_msg"></div>
  429. </div>
  430. </div>
  431. </div>
  432. <!-- NoScript Alert -->
  433. <noscript>
  434. <div class="container">
  435. <div class="row">
  436. <div class="col-xs-12 text-center">
  437. <div class="alert alert-danger">
  438. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  439. <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>
  440. </div>
  441. </div>
  442. </div>
  443. </div>
  444. </noscript>