page.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <?php declare(strict_types=1);
  2. use PrivateBin\I18n;
  3. ?><!DOCTYPE html>
  4. <html lang="<?php echo I18n::getLanguage(); ?>"<?php echo I18n::isRtl() ? ' dir="rtl"' : ''; ?>>
  5. <head>
  6. <meta charset="utf-8" />
  7. <meta http-equiv="Content-Security-Policy" content="<?php echo I18n::encode($CSPHEADER); ?>">
  8. <meta name="robots" content="noindex" />
  9. <meta name="google" content="notranslate">
  10. <title><?php echo I18n::_($NAME); ?></title>
  11. <link type="text/css" rel="stylesheet" href="css/privatebin.css?<?php echo rawurlencode($VERSION); ?>" />
  12. <?php
  13. if ($SYNTAXHIGHLIGHTING):
  14. ?>
  15. <link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" />
  16. <?php
  17. if (!empty($SYNTAXHIGHLIGHTINGTHEME)):
  18. ?>
  19. <link type="text/css" rel="stylesheet" href="css/prettify/<?php echo rawurlencode($SYNTAXHIGHLIGHTINGTHEME); ?>.css?<?php echo rawurlencode($VERSION); ?>" />
  20. <?php
  21. endif;
  22. endif;
  23. ?>
  24. <?php $this->_scriptTag('js/jquery-3.7.1.js', 'defer'); ?>
  25. <?php
  26. if ($QRCODE):
  27. ?>
  28. <?php $this->_scriptTag('js/kjua-0.9.0.js', 'async'); ?>
  29. <?php
  30. endif;
  31. if ($ZEROBINCOMPATIBILITY):
  32. ?>
  33. <?php $this->_scriptTag('js/base64-1.7.js', 'async'); ?>
  34. <?php
  35. endif;
  36. ?>
  37. <?php $this->_scriptTag('js/zlib-1.3.1-1.js', 'async'); ?>
  38. <?php $this->_scriptTag('js/base-x-4.0.0.js', 'async'); ?>
  39. <?php $this->_scriptTag('js/rawinflate-0.3.js', 'async'); ?>
  40. <?php
  41. if ($SYNTAXHIGHLIGHTING):
  42. ?>
  43. <?php $this->_scriptTag('js/prettify.js', 'async'); ?>
  44. <?php
  45. endif;
  46. if ($MARKDOWN):
  47. ?>
  48. <?php $this->_scriptTag('js/showdown-2.1.0.js', 'async'); ?>
  49. <?php
  50. endif;
  51. ?>
  52. <?php $this->_scriptTag('js/purify-3.2.6.js', 'async'); ?>
  53. <?php $this->_scriptTag('js/legacy.js', 'async'); ?>
  54. <?php $this->_scriptTag('js/privatebin.js', 'defer'); ?>
  55. <!-- icon -->
  56. <link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
  57. <link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
  58. <link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
  59. <link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" />
  60. <link rel="mask-icon" href="img/safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" />
  61. <link rel="shortcut icon" href="img/favicon.ico">
  62. <meta name="msapplication-config" content="browserconfig.xml">
  63. <meta name="theme-color" content="#ffe57e" />
  64. <!-- Twitter/social media cards -->
  65. <meta name="twitter:card" content="summary" />
  66. <meta name="twitter:title" content="<?php echo I18n::_('Encrypted note on %s', I18n::_($NAME)) ?>" />
  67. <meta name="twitter:description" content="<?php echo I18n::_('Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.') ?>" />
  68. <meta name="twitter:image" content="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" />
  69. <meta property="og:title" content="<?php echo I18n::_($NAME); ?>" />
  70. <meta property="og:site_name" content="<?php echo I18n::_($NAME); ?>" />
  71. <meta property="og:description" content="<?php echo I18n::_('Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.') ?>" />
  72. <meta property="og:image" content="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" />
  73. <meta property="og:image:type" content="image/png" />
  74. <meta property="og:image:width" content="180" />
  75. <meta property="og:image:height" content="180" />
  76. </head>
  77. <body data-compression="<?php echo rawurlencode($COMPRESSION); ?>">
  78. <header>
  79. <div id="aboutbox">
  80. <?php echo sprintf(
  81. I18n::_('%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted %sin the browser%s using 256 bits AES.',
  82. I18n::_($NAME),
  83. '%s', '%s'
  84. ),
  85. '<i>', '</i>'), ' ', $INFO;
  86. ?>
  87. <br />
  88. <?php
  89. if (!empty($NOTICE)):
  90. ?>
  91. <span class="blink">▶</span> <?php echo I18n::encode($NOTICE);
  92. endif;
  93. ?>
  94. </div>
  95. <h1 class="title reloadlink"><?php echo I18n::_($NAME); ?></h1><br />
  96. <h2 class="title"><?php echo I18n::_('Because ignorance is bliss'); ?></h2><br />
  97. <h3 class="title"><?php echo $VERSION; ?></h3>
  98. <noscript><div id="noscript" class="nonworking"><?php echo I18n::_('JavaScript is required for %s to work. Sorry for the inconvenience.', I18n::_($NAME)); ?></div></noscript>
  99. <div id="oldnotice" class="nonworking hidden">
  100. <?php echo I18n::_('%s requires a modern browser to work.', I18n::_($NAME)), PHP_EOL; ?>
  101. <a href="https://www.mozilla.org/firefox/">Firefox</a>,
  102. <a href="https://www.opera.com/">Opera</a>,
  103. <a href="https://www.google.com/chrome">Chrome</a>…<br />
  104. <span class="small"><?php echo I18n::_('For more information <a href="%s">see this FAQ entry</a>.', 'https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-it-show-me-the-error-privatebin-requires-a-modern-browser-to-work'); ?></span>
  105. </div>
  106. <?php
  107. if ($HTTPWARNING):
  108. ?>
  109. <div id="httpnotice" class="errorMessage hidden">
  110. <?php echo I18n::_('This website is using an insecure connection! Please only use it for testing.'); ?><br />
  111. <span class="small"><?php echo I18n::_('For more information <a href="%s">see this FAQ entry</a>.', 'https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-it-show-me-an-error-about-an-insecure-connection'); ?></span>
  112. </div>
  113. <div id="insecurecontextnotice" class="errorMessage hidden">
  114. <?php echo I18n::_('Your browser may require an HTTPS connection to support the WebCrypto API. Try <a href="%s">switching to HTTPS</a>.', $HTTPSLINK); ?>
  115. </div>
  116. <?php
  117. endif;
  118. ?>
  119. </header>
  120. <section>
  121. <article>
  122. <div id="loadingindicator" class="hidden"><?php echo I18n::_('Loading…'); ?></div>
  123. <div id="status"><?php echo I18n::encode($STATUS); ?></div>
  124. <div id="errormessage" class="hidden"><?php echo I18n::encode($ERROR); ?></div>
  125. <div id="toolbar">
  126. <button id="newbutton" class="reloadlink hidden"><img src="img/icon_new.png" width="11" height="15" alt="" /><?php echo I18n::_('New'); ?></button>
  127. <button id="retrybutton" class="reloadlink hidden"><?php echo I18n::_('Retry'), PHP_EOL; ?></button>
  128. <button id="sendbutton" tabindex="2" class="hidden"><img src="img/icon_send.png" width="18" height="15" alt="" /><?php echo I18n::_('Create'); ?></button>
  129. <button id="clonebutton" class="hidden"><img src="img/icon_clone.png" width="15" height="17" alt="" /><?php echo I18n::_('Clone'); ?></button>
  130. <button id="rawtextbutton" class="hidden"><img src="img/icon_raw.png" width="15" height="15" alt="" /><?php echo I18n::_('Raw text'); ?></button>
  131. <button id="downloadtextbutton" class="hidden"><?php echo I18n::_('Save paste'), PHP_EOL; ?></button>
  132. <?php
  133. if ($EMAIL):
  134. ?>
  135. <button id="emaillink" class="hidden"><img src="img/icon_email.png" width="15" height="15" alt="" /><?php echo I18n::_('Email'); ?></button>
  136. <?php
  137. endif;
  138. if ($QRCODE):
  139. ?>
  140. <button id="qrcodelink" class="hidden"><img src="img/icon_qr.png" width="15" height="15" alt="" /><?php echo I18n::_('QR code'); ?></button>
  141. <?php
  142. endif;
  143. ?>
  144. <div id="expiration" class="hidden button"><?php echo I18n::_('Expires'); ?>:
  145. <select id="pasteExpiration" name="pasteExpiration">
  146. <?php
  147. foreach ($EXPIRE as $key => $value):
  148. ?>
  149. <option value="<?php echo $key; ?>"<?php
  150. if ($key == $EXPIREDEFAULT):
  151. ?> selected="selected"<?php
  152. endif;
  153. ?>><?php echo $value; ?></option>
  154. <?php
  155. endforeach;
  156. ?>
  157. </select>
  158. </div>
  159. <div id="remainingtime" class="hidden"></div>
  160. <div id="burnafterreadingoption" class="button hidden">
  161. <input type="checkbox" id="burnafterreading" name="burnafterreading"<?php
  162. if ($BURNAFTERREADINGSELECTED):
  163. ?> checked="checked"<?php
  164. endif;
  165. ?> />
  166. <label for="burnafterreading"><?php echo I18n::_('Burn after reading'); ?></label>
  167. </div>
  168. <?php
  169. if ($DISCUSSION):
  170. ?>
  171. <div id="opendiscussionoption" class="button hidden">
  172. <input type="checkbox" id="opendiscussion" name="opendiscussion"<?php
  173. if ($OPENDISCUSSION):
  174. ?> checked="checked"<?php
  175. endif;
  176. ?> />
  177. <label for="opendiscussion"><?php echo I18n::_('Open discussion'); ?></label>
  178. </div>
  179. <?php
  180. endif;
  181. if ($PASSWORD):
  182. ?>
  183. <div id="password" class="hidden">
  184. <input type="password" id="passwordinput" placeholder="<?php echo I18n::_('Password (recommended)'); ?>" size="32" />
  185. </div>
  186. <?php
  187. endif;
  188. ?>
  189. <div id="formatter" class="button hidden"><?php echo I18n::_('Format'); ?>:
  190. <select id="pasteFormatter" name="pasteFormatter">
  191. <?php
  192. foreach ($FORMATTER as $key => $value):
  193. ?>
  194. <option value="<?php echo $key; ?>"<?php
  195. if ($key == $FORMATTERDEFAULT):
  196. ?> selected="selected"<?php
  197. endif;
  198. ?>><?php echo $value; ?></option>
  199. <?php
  200. endforeach;
  201. ?>
  202. </select>
  203. </div>
  204. <?php
  205. if (!empty($LANGUAGESELECTION)):
  206. ?>
  207. <div id="language" class="button">
  208. <select name="lang">
  209. <?php
  210. foreach ($LANGUAGES as $key => $value):
  211. ?>
  212. <option data-lang="<?php echo $key; ?>" value="<?php echo $key; ?>"<?php
  213. if ($key == $LANGUAGESELECTION):
  214. ?> selected="selected"<?php
  215. endif;
  216. ?>><?php echo $value[0]; ?> (<?php echo $value[1]; ?>)</option>
  217. <?php
  218. endforeach;
  219. ?>
  220. </select>
  221. </div>
  222. <?php
  223. endif;
  224. ?>
  225. <?php
  226. if (!empty($TEMPLATESELECTION)):
  227. ?>
  228. <div id="template" class="button"><?php echo I18n::_('Theme'); ?>:
  229. <select name="template">
  230. <?php
  231. foreach ($TEMPLATES as $value):
  232. ?>
  233. <option data-template="<?php echo $value; ?>" value="<?php echo $value; ?>"<?php
  234. if ($value == $TEMPLATESELECTION):
  235. ?> selected="selected"<?php
  236. endif;
  237. ?>><?php echo $value; ?></option>
  238. <?php
  239. endforeach;
  240. ?>
  241. </select>
  242. </div>
  243. <?php
  244. endif;
  245. ?>
  246. </div>
  247. <?php
  248. if ($QRCODE):
  249. ?>
  250. <div id="qrcode-display"></div>
  251. <?php
  252. endif;
  253. ?> <div id="pastesuccess" class="hidden">
  254. <div id="deletelink"></div>
  255. <div id="pastelink"></div>
  256. <?php
  257. if (!empty($URLSHORTENER)):
  258. ?>
  259. <button id="shortenbutton" data-shortener="<?php echo I18n::encode($URLSHORTENER); ?>"><img src="img/icon_shorten.png" width="13" height="15" /><?php echo I18n::_('Shorten URL'); ?></button>
  260. <?php
  261. endif;
  262. ?>
  263. </div>
  264. <?php
  265. if ($FILEUPLOAD):
  266. ?>
  267. <div id="attachment" class="hidden"></div>
  268. <div id="attach" class="hidden">
  269. <span id="clonedfile" class="hidden"><?php echo I18n::_('Cloned file attached.'); ?></span>
  270. <span id="filewrap"><?php echo I18n::_('Attach a file'); ?>: <input type="file" id="file" name="file" multiple /></span>
  271. <span id="dragAndDropFileName" class="dragAndDropFile"><?php echo I18n::_('alternatively drag & drop a file or paste an image from the clipboard'); ?></span>
  272. <button id="fileremovebutton"><?php echo I18n::_('Remove attachment'); ?></button>
  273. </div>
  274. <?php
  275. endif;
  276. ?>
  277. <div id="preview" class="hidden">
  278. <button id="messageedit"><?php echo I18n::_('Editor'); ?></button>
  279. <button id="messagepreview"><?php echo I18n::_('Preview'); ?></button>
  280. </div>
  281. <div id="attachmentPreview" class="hidden"></div>
  282. <div id="prettymessage" class="hidden">
  283. <pre id="prettyprint" class="prettyprint linenums:1"></pre>
  284. </div>
  285. <div id="plaintext" class="hidden"></div>
  286. <textarea id="message" name="message" cols="80" rows="25" tabindex="1" class="hidden"></textarea>
  287. <div class="button">
  288. <input id="messagetab" type="checkbox" tabindex="3" checked="checked" />
  289. <label for="messagetab"><?php echo I18n::_('Tabulator key serves as character (Hit <kbd>Ctrl</kbd>+<kbd>m</kbd> or <kbd>Esc</kbd> to toggle)'); ?></label>
  290. </div>
  291. </article>
  292. </section>
  293. <section>
  294. <div id="discussion" class="hidden">
  295. <h4 class="title"><?php echo I18n::_('Discussion'); ?></h4>
  296. <div id="commentcontainer"></div>
  297. </div>
  298. </section>
  299. <div id="serverdata" class="hidden" aria-hidden="true">
  300. <div id="templates">
  301. <article id="commenttemplate" class="comment">
  302. <div class="commentmeta">
  303. <span class="nickname">name</span>
  304. <span class="commentdate">0000-00-00</span>
  305. </div>
  306. <div class="commentdata">c</div>
  307. <button class="btn btn-default btn-sm"><?php echo I18n::_('Reply'); ?></button>
  308. </article>
  309. <div id="commenttailtemplate" class="comment">
  310. <button class="btn btn-default btn-sm"><?php echo I18n::_('Add comment'); ?></button>
  311. </div>
  312. <div id="replytemplate" class="reply hidden">
  313. <input type="text" id="nickname" class="form-control" title="<?php echo I18n::_('Optional nickname…'); ?>" placeholder="<?php echo I18n::_('Optional nickname…'); ?>" />
  314. <textarea id="replymessage" class="replymessage form-control" cols="80" rows="7"></textarea><br />
  315. <div id="replystatus" role="alert" class="statusmessage hidden alert">
  316. <span class="glyphicon" aria-hidden="true"></span>
  317. </div>
  318. <button id="replybutton" class="btn btn-default btn-sm"><?php echo I18n::_('Post comment'); ?></button>
  319. </div>
  320. <div id="attachmenttemplate" class="attachment">
  321. <a><?php echo I18n::_('Download attachment'); ?></a>
  322. </div>
  323. </div>
  324. </div>
  325. <?php
  326. if ($FILEUPLOAD):
  327. ?>
  328. <div id="dropzone" class="hidden" tabindex="-1" aria-hidden="true"></div>
  329. <?php
  330. endif;
  331. ?>
  332. <section class="container">
  333. <div id="noscript" role="alert" class="nonworking alert alert-info noscript-hide"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true">
  334. <span> <?php echo I18n::_('Loading…'); ?></span><br>
  335. <span class="small"><?php echo I18n::_('In case this message never disappears please have a look at <a href="%s">this FAQ for information to troubleshoot</a>.', 'https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-the-loading-message-not-go-away'); ?></span>
  336. </div>
  337. </section>
  338. </body>
  339. </html>