From 2d4f1550648261e1aa510495433719346d85b492 Mon Sep 17 00:00:00 2001 From: Simon Rupf Date: Tue, 28 Aug 2012 23:28:41 +0200 Subject: [PATCH] had to revert to HTML5 instead of XHTML5 because of compatibility problem with code prettifier, fixed some display bugs --- CREDITS.md | 2 +- INSTALL.md | 4 ++-- css/prettify.css | 1 - css/zerobin.css | 12 ++++++------ js/prettify.js | 2 +- js/zerobin.js | 6 +++--- lib/zerobin.php | 9 +-------- tpl/page.html | 25 ++++++++++++------------- 8 files changed, 26 insertions(+), 35 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index e282cef2..098261b6 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -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 diff --git a/INSTALL.md b/INSTALL.md index 6a0f163a..ae35c5ce 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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 diff --git a/css/prettify.css b/css/prettify.css index accf5713..f2ad6530 100644 --- a/css/prettify.css +++ b/css/prettify.css @@ -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 */ diff --git a/css/zerobin.css b/css/zerobin.css index 47b8797b..c2372fe0 100644 --- a/css/zerobin.css +++ b/css/zerobin.css @@ -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)); } diff --git a/js/prettify.js b/js/prettify.js index 15f225a3..04ed32db 100644 --- a/js/prettify.js +++ b/js/prettify.js @@ -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) { diff --git a/js/zerobin.js b/js/zerobin.js index 7ed65cdb..2392598b 100644 --- a/js/zerobin.js +++ b/js/zerobin.js @@ -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 ' + url + '').show(); + $('div#pastelink').html('Your paste is ' + url + '').removeClass('hidden'); setElementText($('div#cleartext'), $('textarea#message').val()); setElementText($('pre#prettyprint'), $('textarea#message').val()); urls2links($('div#cleartext')); diff --git a/lib/zerobin.php b/lib/zerobin.php index 2860577b..754a7d14 100644 --- a/lib/zerobin.php +++ b/lib/zerobin.php @@ -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. diff --git a/tpl/page.html b/tpl/page.html index 70d396af..8ec740a1 100644 --- a/tpl/page.html +++ b/tpl/page.html @@ -1,4 +1,3 @@ - @@ -6,13 +5,13 @@ ZeroBin - - - - - - - + + + + + + + @@ -46,9 +45,9 @@
- - - + + + -
+