index.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <?php
  2. set_include_path(get_include_path() . PATH_SEPARATOR .
  3. dirname(__FILE__) ."/include");
  4. require_once "functions.php";
  5. require_once "sessions.php";
  6. require_once "sanity_check.php";
  7. require_once "version.php";
  8. require_once "config.php";
  9. login_sequence();
  10. header('Content-Type: text/html; charset=utf-8');
  11. $user_theme = get_user_theme_path();
  12. ?>
  13. <!DOCTYPE html>
  14. <head>
  15. <title>Tiny Tiny IRC</title>
  16. <?php stylesheet_tag("css/default.css") ?>
  17. <?php stylesheet_tag("lib/bootstrap/css/bootstrap.min.css") ?>
  18. <?php
  19. $use_default_skin = true;
  20. $bodyclass = '';
  21. $params = get_user_theme_params();
  22. if ($params) {
  23. @$use_default_skin = !$params['no_default_skin'];
  24. $bodyclass = $params['dark'] ? 'dark' : '';
  25. }
  26. if ($bodyclass == "dark") {
  27. stylesheet_tag("lib/highlightjs/styles/pojoaque.css");
  28. } else {
  29. stylesheet_tag("lib/highlightjs/styles/default.css");
  30. }
  31. ?>
  32. <?php if ($use_default_skin) stylesheet_tag("lib/bootstrap/css/bootstrap-theme.min.css") ?>
  33. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  34. <?php if (file_exists("local.css")) stylesheet_tag("local.css") ?>
  35. <link id="favicon" rel="shortcut icon" type="image/png" href="images/favicon.png" />
  36. <link rel="icon" type="image/png" sizes="144x144"
  37. href="images/icon-hires.png" />
  38. <meta name="mobile-web-app-capable" content="yes">
  39. <meta http-equiv="Content-Security-Policy" content="block-all-mixed-content,upgrade-insecure-requests">
  40. <link rel="manifest" href="manifest.json">
  41. <meta name="referrer" content="no-referrer">
  42. <?php
  43. foreach (array("lib/bootstrap/js/jquery.js",
  44. "lib/bootstrap/js/bootstrap.min.js",
  45. "lib/jquery.mobile.custom.js",
  46. "lib/localforage.min.js",
  47. "lib/highlightjs/highlight.pack.js",
  48. "lib/knockout.js") as $jsfile) {
  49. javascript_tag($jsfile);
  50. } ?>
  51. <?php if (file_exists("local.js")) javascript_tag("local.js") ?>
  52. <script type="text/javascript">
  53. 'use strict';
  54. var _user_theme = "<?php echo $user_theme ?>";
  55. <?php
  56. init_js_translations();
  57. print get_minified_js(array("tt-irc",
  58. "functions", "prefs", "users", "PluginHost"));
  59. ?>
  60. </script>
  61. <?php
  62. if ($user_theme) {
  63. stylesheet_tag("$user_theme/theme.css");
  64. if (file_exists("$user_theme/theme.js"))
  65. javascript_tag("$user_theme/theme.js");
  66. }
  67. ?>
  68. <?php print_user_css(); ?>
  69. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  70. <script type="text/javascript">
  71. 'use strict';
  72. $(document).ready(function() {
  73. init();
  74. });
  75. $(window).on("focus", function() {
  76. set_window_active(true);
  77. });
  78. $(window).on("blur", function() {
  79. set_window_active(false);
  80. });
  81. </script>
  82. </head>
  83. <body class="main <?php echo $bodyclass ?>" user-theme="<?php echo $user_theme ?>">
  84. <div id="dnd_overlay" style="display : none">
  85. <div class="inner">
  86. <?php echo __("Drop files to upload and post here.") ?>
  87. </div>
  88. </div>
  89. <div id="overlay" style="display : block">
  90. <div id="overlay_inner">
  91. <?php echo __("Loading, please wait...") ?>
  92. <div id="l_progress_o">
  93. <div id="l_progress_i"></div>
  94. </div>
  95. <noscript>
  96. <p><?php print_error(__("Your browser doesn't support Javascript, which is required
  97. for this application to function properly. Please check your
  98. browser settings.")) ?></p>
  99. </noscript>
  100. </div>
  101. </div>
  102. <div style="display : none" class="modal" id="infoBox">
  103. <div class="modal-dialog">
  104. <div class="modal-content">&nbsp;</div>
  105. </div>
  106. </div>
  107. <div id="notifyBox" class="modal">
  108. <div class="modal-dialog">
  109. <div class="modal-content">
  110. <div class="modal-header">
  111. <button type="button" data-toggle='modal' data-target='#notifyBox' class="close">&times;</button>
  112. <h4 class="modal-title"></h4>
  113. </div>
  114. <div class="modal-body">&nbsp;</div>
  115. <div class="modal-footer">
  116. <button class="btn btn-primary" data-toggle='modal' data-target='#notifyBox'>
  117. <?php echo __('Close') ?></button>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. <div id="errorBox" class="modal">
  123. <div class="modal-dialog">
  124. <div class="modal-content">
  125. <div class="modal-header"><h4 class="modal-title text-danger"><?php echo __('Fatal Exception') ?></h4></div>
  126. <div class="modal-body">&nbsp;</div>
  127. <div class="modal-footer">
  128. <button class="btn btn-primary" onclick="window.location.reload()">
  129. <?php echo __('Reload') ?></button>
  130. <button class="btn btn-danger" data-toggle='modal' data-target='#errorBox'>
  131. <?php echo __('Ignore') ?></button>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. <div id="main">
  137. <div id="header">
  138. <span class="header-left">
  139. <button class='btn btn-default'>
  140. <span title="<?php echo __("Toggle alerts") ?>"
  141. onclick="toggle_alerts()" class="glyphicon glyphicon-bell" id="alerts-indicator"> </span>
  142. </button>
  143. <button class="btn btn-default"
  144. title="<?php echo __("Filter muted channels") ?>"
  145. id="filter-muted-prompt" onclick="toggle_filter_muted()">
  146. <span class="text-muted glyphicon glyphicon-filter"> </span>
  147. </button>
  148. </span>
  149. <img id="spinner" style="display : none"
  150. alt="spinner" title="Loading..."
  151. src="<?php echo theme_image('images/indicator_tiny.gif') ?>"/>
  152. <span id="net-alert" class="glyphicon glyphicon-exclamation-sign text-danger" style="display : none"
  153. title="<?php echo __("Communication problem with the server.") ?>"> </span>
  154. <?php if (!SINGLE_USER_MODE) { ?>
  155. <span class="hello"><?php echo __('Hello,') ?> <b><?php echo $_SESSION["name"] ?></b></span> |
  156. <?php } ?>
  157. <a href="#" onclick="show_prefs()"><?php echo __('Preferences') ?></a>
  158. <?php if ($_SESSION["access_level"] >= 10) { ?>
  159. | <a href="#" onclick="show_users()"><?php echo __('Users') ?></a>
  160. <?php } ?>
  161. <?php if (!SINGLE_USER_MODE) { ?>
  162. | <a href="backend.php?op=logout"><?php echo __('Logout') ?></a>
  163. <?php } ?>
  164. </div>
  165. <div id="tabs">
  166. <div id="tabs-inner">
  167. <ul id="tabs-list" data-bind="foreach: connections">
  168. <li channel="---" tab_type="S" data-bind="attr: { id: 'tab-' + id(), connection_id: id() }, css: { selected: selected, muted: muted(), attention: unread() > 0 }" onclick="change_tab(this, event)">
  169. <span data-bind="attr: { id: 'cimg-' + id() }, css: { 'conn-img': true, connected: connected, attention: unread() > 0 }"> </span>
  170. <div data-bind="text: title"></div>
  171. </li>
  172. <ul class="sub-tabs" data-bind="foreach: channels, attr: { id: 'tabs-' + id() }">
  173. <li onclick="change_tab(this, event)" data-bind="attr: { id: 'tab-' + title() + ':' + $parent.id(), connection_id: $parent.id(), channel: title(), tab_type: type() }, css: { selected: selected, highlight: highlight, offline: offline, muted: muted(), attention: unread() > 0 }">
  174. <span onclick="close_tab(this)" title="Close this tab" class="close-img"
  175. data-bind="attr: { tab_id: 'tab-' + title() + ':' + $parent.id() }">&times;</span>
  176. <span class="unread" data-bind="visible: unread, text: unread"></span>
  177. <div class="indented" data-bind="text: title"></div>
  178. </li>
  179. </ul>
  180. </ul>
  181. </div>
  182. </div>
  183. <div id="content">
  184. <div id="topic"><div class="wrapper">
  185. <div class="form-control" data-bind="html: activeTopicFormatted, attr: { title: activeTopic }, css: { 'uneditable-input': true, disabled: activeTopicDisabled }" id="topic-input"></div>
  186. <textarea rows="1" type="text"
  187. class="form-control" id="topic-input-real" style="display : none"></textarea>
  188. </div>
  189. </div>
  190. <div id="sidebar">
  191. <div id="sidebar-inner">
  192. <!-- fuck you very much, MSIE team -->
  193. <form action="javascript:void(null);" method="post" class="form form-inline">
  194. <div id="connect">
  195. <button class="btn btn-default"
  196. id="connect-btn" data-bind="enable: toggleConnection, text: connectBtnLabel, click: toggleConnection"> </button>
  197. </span>
  198. </div>
  199. </form>
  200. <div id="userlist" class="">
  201. <div data-bind="with: activeChannel" id="userlist-inner">
  202. <ul id="userlist-list" data-bind="foreach: nicklist">
  203. <li data-bind="attr: { ident: $root.getNickIdent($root.activeChannel().connection_id(), $data) }">
  204. <span data-bind="css: { 'user-img': true, op: $root.nickIsOp($data), voice: $root.nickIsVoiced($data) }"> </span>
  205. <span onclick="query_user(this)"
  206. data-bind="text: $root.stripNickPrefix($data),
  207. css: { away: $root.isUserAway($root.activeChannel().connection_id(), $data) },
  208. attr: { nick: $root.stripNickPrefix($data),
  209. title: $root.getNickHost($root.activeChannel().connection_id(), $data) }"></span>
  210. </li>
  211. </ul>
  212. </div>
  213. </div> <!-- userlist -->
  214. </div> <!-- sidebar-inner -->
  215. <div class="aux-buttons">
  216. <button class="btn btn-default"
  217. title="<?php echo __("Toggle emoticons") ?>"
  218. onclick="$('#emoticons').fadeToggle()" id="emoticon-prompt">
  219. <span class="text-muted glyphicon glyphicon-piggy-bank"> </span> </button>
  220. <button class="btn btn-default"
  221. title="<?php echo __("Mute notifications") ?>"
  222. onclick="toggle_chanmute()" id="chanmute-prompt">
  223. <span class="text-muted glyphicon glyphicon-bell"> </button>
  224. <button class="btn btn-default"
  225. title="<?php echo __("Join channel") ?>"
  226. onclick="join_channel()">
  227. <span class="text-muted glyphicon glyphicon-plus-sign"> </span>
  228. </button>
  229. </div> <!-- aux-buttons -->
  230. <div style="display : none" id="emoticons"><?php echo render_emoticons() ?></div>
  231. </div> <!-- sidebar -->
  232. <div id="log" data-bind="with: activeChannel" >
  233. <ul id="log-list" data-bind="foreach: lines.slice(lines.length-BUFFER_MAX_LINES)">
  234. <li data-bind="html: format, attr: { rowid: $data.id, ident: $data.ident, ts: $data.unixts }, css: { row: true, HL: is_hl, LV: is_lv }"> </li>
  235. </ul>
  236. </div> <!-- log -->
  237. <div id="nick" onclick="change_nick()" data-bind="text: activeNick, css: { away: isAway }"></div>
  238. <div id="input"><div class="wrapper">
  239. <ul class="emoticons-popup" style="display : none"></ul>
  240. <textarea data-bind="enable: activeStatus() == 2"
  241. class="form-control" rows="1" id="input-prompt"/></textarea>
  242. </div></div>
  243. </div>
  244. </div>
  245. </body>
  246. </html>