had to revert to HTML5 instead of XHTML5 because of compatibility

problem with code prettifier, fixed some display bugs
pull/17/head
Simon Rupf 2012-08-28 23:28:41 +02:00
parent 907538875b
commit 2d4f155064
8 changed files with 26 additions and 35 deletions

View File

@ -4,5 +4,5 @@ Sébastien Sauvage - original idea and main developer
Alexey Gladkov - syntax highlighting
Greg Knaddison - robots.txt
MrKooky - XHTML5 markup, CSS cleanup
MrKooky - HTML5 markup, CSS cleanup
Simon Rupf - MVC refactoring, configuration support and unit tests

View File

@ -7,8 +7,8 @@ For Administrators
In the index.php in the main folder you can define a different PATH. This is
useful if you want to secure your installation and want to move the
configuration, data files, templates and PHP libraries (directories cfg, data,
lib and tpl) outside of your document root. This new location must still be
accessible to your webserver / PHP process.
lib, tpl and tst) outside of your document root. This new location must still
be accessible to your webserver / PHP process.
> ### PATH Example ###
> Your zerobin installation lives in a subfolder called "paste" inside of your

View File

@ -37,7 +37,6 @@
border: 1px solid #888;
background-color: white;
white-space: pre-wrap;
clear: both;
}
/* Specify class=linenums on a pre to get line numbering */

View File

@ -4,17 +4,17 @@
/* CSS Reset from YUI 3.4.1 (build 4118) - Copyright 2011 Yahoo! Inc. All rights reserved.
Licensed under the BSD License. - http://yuilibrary.com/license/ */
html{color:#000;background:#fff}body,div,dl,dt,dd,ul,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}ol,ul{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}input,textarea,select{*font-size:100%}legend{color:#000}
html{color:#000;background:#fff}body,div,dl,dt,dd,ul,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}ol,ul{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}input,textarea,select{font-size:100%;}legend{color:#000}
html {
background-color: #455463;
color: #fff;
min-height: 100%;
background-image: linear-gradient(bottom, #0f1823 0%, #455463 100%);
background-image: -o-linear-gradient(bottom, #0f1823 0%, #455463 100%);
background-image: -moz-linear-gradient(bottom, #0f1823 0%, #455463 100%);
background-image: -webkit-linear-gradient(bottom, #0f1823 0%, #455463 100%);
background-image: -ms-linear-gradient(bottom, #0f1823 0%, #455463 100%);
background-image: linear-gradient(bottom, #0f1823 0, #455463 100%);
background-image: -o-linear-gradient(bottom, #0f1823 0, #455463 100%);
background-image: -moz-linear-gradient(bottom, #0f1823 0, #455463 100%);
background-image: -webkit-linear-gradient(bottom, #0f1823 0, #455463 100%);
background-image: -ms-linear-gradient(bottom, #0f1823 0, #455463 100%);
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #0f1823), color-stop(1, #455463));
}

View File

@ -1347,7 +1347,7 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&
function prettyPrint(opt_whenDone) {
function byTagName(tn) { return document.getElementsByTagName(tn); }
// fetch a list of nodes to rewrite
var codeSegments = [byTagName('pre'), byTagName('code'), byTagName('xmp'), byTagName('div')];
var codeSegments = [byTagName('pre'), byTagName('code'), byTagName('xmp')];
var elements = [];
for (var i = 0; i < codeSegments.length; ++i) {
for (var j = 0, n = codeSegments[i].length; j < n; ++j) {

View File

@ -124,9 +124,9 @@ function displayMessages(key, comments) {
prettyPrint();
// Display paste expiration.
if (comments[0].meta.expire_date) $('div#remainingtime').removeClass('foryoureyesonly').text('This document will expire in '+secondsToHuman(comments[0].meta.remaining_time)+'.').show();
if (comments[0].meta.expire_date) $('div#remainingtime').removeClass('foryoureyesonly').text('This document will expire in '+secondsToHuman(comments[0].meta.remaining_time)+'.').removeClass('hidden');
if (comments[0].meta.burnafterreading) {
$('div#remainingtime').addClass('foryoureyesonly').text('FOR YOUR EYES ONLY. Don\'t close this window, this message can\'t be displayed again.').show();
$('div#remainingtime').addClass('foryoureyesonly').text('FOR YOUR EYES ONLY. Don\'t close this window, this message can\'t be displayed again.').removeClass('hidden');
$('button#clonebutton').addClass('hidden'); // Discourage cloning (as it can't really be prevented).
}
@ -261,7 +261,7 @@ function send_data() {
stateExistingPaste();
var url = scriptLocation() + "?" + data.id + '#' + randomkey;
showStatus('');
$('div#pastelink').html('Your paste is <a href="' + url + '">' + url + '</a>').show();
$('div#pastelink').html('Your paste is <a href="' + url + '">' + url + '</a>').removeClass('hidden');
setElementText($('div#cleartext'), $('textarea#message').val());
setElementText($('pre#prettyprint'), $('textarea#message').val());
urls2links($('div#cleartext'));

View File

@ -397,20 +397,13 @@ class zerobin
*/
private function _view()
{
// set headers to disable caching and return valid XHTML, if supported
$content = (
array_key_exists('HTTP_ACCEPT', $_SERVER) &&
!empty($_SERVER['HTTP_ACCEPT']) &&
stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') !== false
) ? 'application/xhtml+xml' : 'text/html';
// set headers to disable caching
$time = gmdate('D, d M Y H:i:s \G\M\T');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Pragma: no-cache');
header('Expires: ' . $time);
header('Last-Modified: ' . $time);
header('Vary: Accept');
header('Content-Type: ' . $content . ';charset=UTF-8');
$page = new RainTPL;
// We escape it here because ENT_NOQUOTES can't be used in RainTPL templates.

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@ -6,13 +5,13 @@
<title>ZeroBin</title>
<link type="text/css" rel="stylesheet" href="css/zerobin.css?{$VERSION|rawurlencode}#" />
<link type="text/css" rel="stylesheet" href="css/prettify.css?{$VERSION|rawurlencode}#" />
<script src="js/jquery.js#"></script>
<script src="js/sjcl.js#"></script>
<script src="js/base64.js#"></script>
<script src="js/rawdeflate.js#"></script>
<script src="js/rawinflate.js#"></script>
<script src="js/prettify.js#"></script>
<script src="js/zerobin.js?{$VERSION|rawurlencode}#"></script>
<script type="text/javascript" src="js/jquery.js#"></script>
<script type="text/javascript" src="js/sjcl.js#"></script>
<script type="text/javascript" src="js/base64.js#"></script>
<script type="text/javascript" src="js/rawdeflate.js#"></script>
<script type="text/javascript" src="js/rawinflate.js#"></script>
<script type="text/javascript" src="js/prettify.js#"></script>
<script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}#"></script>
<!--[if lt IE 10]>
<style> body {padding-left:60px;padding-right:60px;} div#ienotice {display:block;} </style>
<![endif]-->
@ -46,9 +45,9 @@
<div id="status"> </div>
<div id="errormessage" class="hidden">{$ERRORMESSAGE|htmlspecialchars}</div>
<div id="toolbar">
<button id="newbutton" onclick="window.location.href=scriptLocation();return false;" class="hidden"><img src="img/icon_new.png#" width="11" height="15" />New</button>
<button id="sendbutton" onclick="send_data();return false;" class="hidden"><img src="img/icon_send.png#" width="18" height="15" />Send</button>
<button id="clonebutton" onclick="clonePaste();return false;" class="hidden"><img src="img/icon_clone.png#" width="15" height="17" />Clone</button>
<button id="newbutton" onclick="window.location.href=scriptLocation();return false;" class="hidden"><img src="img/icon_new.png#" width="11" height="15" alt="" />New</button>
<button id="sendbutton" onclick="send_data();return false;" class="hidden"><img src="img/icon_send.png#" width="18" height="15" alt="" />Send</button>
<button id="clonebutton" onclick="clonePaste();return false;" class="hidden"><img src="img/icon_clone.png#" width="15" height="17" alt="" />Clone</button>
<div id="expiration" class="hidden">Expire:
<select id="pasteExpiration" name="pasteExpiration">
<option value="burn">Burn after reading</option>
@ -72,14 +71,14 @@
</select>
</div>
<input id="password" value="Optional password..." class="hidden" />
<div id="opendisc" class="button" class="hidden">
<div id="opendisc" class="button hidden">
<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="!$OPENDISCUSSION"} disabled="disabled"{/if} />
<label for="opendiscussion">Open discussion</label>
</div>
</div>
<div id="pastelink" class="hidden"></div>
<div id="prettymessage" class="hidden">
<div id="prettyprint" class="prettyprint linenums:1"></div>
<pre id="prettyprint" class="prettyprint linenums:1"></pre>
</div>
<div id="cleartext" class="hidden"></div>
<textarea id="message" name="message" cols="80" rows="25" class="hidden"></textarea>