index.php 11 KB

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