Explorar el Código

had to revert to HTML5 instead of XHTML5 because of compatibility
problem with code prettifier, fixed some display bugs

Simon Rupf hace 14 años
padre
commit
2d4f155064
Se han modificado 8 ficheros con 26 adiciones y 35 borrados
  1. 1 1
      CREDITS.md
  2. 2 2
      INSTALL.md
  3. 0 1
      css/prettify.css
  4. 6 6
      css/zerobin.css
  5. 1 1
      js/prettify.js
  6. 3 3
      js/zerobin.js
  7. 1 8
      lib/zerobin.php
  8. 12 13
      tpl/page.html

+ 1 - 1
CREDITS.md

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

+ 2 - 2
INSTALL.md

@@ -7,8 +7,8 @@ For Administrators
 In the index.php in the main folder you can define a different PATH. This is 
 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 
 useful if you want to secure your installation and want to move the 
 configuration, data files, templates and PHP libraries (directories cfg, data, 
 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 ###
 > ### PATH Example ###
 > Your zerobin installation lives in a subfolder called "paste" inside of your 
 > Your zerobin installation lives in a subfolder called "paste" inside of your 

+ 0 - 1
css/prettify.css

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

+ 6 - 6
css/zerobin.css

@@ -4,17 +4,17 @@
 
 
 /*  CSS Reset from YUI 3.4.1 (build 4118) - Copyright 2011 Yahoo! Inc. All rights reserved.
 /*  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/    */
 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 {
 html {
 	background-color: #455463;
 	background-color: #455463;
 	color: #fff;
 	color: #fff;
 	min-height: 100%;
 	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));
 	background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #0f1823), color-stop(1, #455463));
 }
 }
 
 

+ 1 - 1
js/prettify.js

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

+ 3 - 3
js/zerobin.js

@@ -124,9 +124,9 @@ function displayMessages(key, comments) {
     prettyPrint();
     prettyPrint();
 
 
     // Display paste expiration.
     // 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) {
     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).
         $('button#clonebutton').addClass('hidden'); // Discourage cloning (as it can't really be prevented).
     }
     }
 
 
@@ -261,7 +261,7 @@ function send_data() {
                 stateExistingPaste();
                 stateExistingPaste();
                 var url = scriptLocation() + "?" + data.id + '#' + randomkey;
                 var url = scriptLocation() + "?" + data.id + '#' + randomkey;
                 showStatus('');
                 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($('div#cleartext'), $('textarea#message').val());
                 setElementText($('pre#prettyprint'), $('textarea#message').val());
                 setElementText($('pre#prettyprint'), $('textarea#message').val());
                 urls2links($('div#cleartext'));
                 urls2links($('div#cleartext'));

+ 1 - 8
lib/zerobin.php

@@ -397,20 +397,13 @@ class zerobin
      */
      */
     private function _view()
     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');
         $time = gmdate('D, d M Y H:i:s \G\M\T');
-
         header('Cache-Control: no-store, no-cache, must-revalidate');
         header('Cache-Control: no-store, no-cache, must-revalidate');
         header('Pragma: no-cache');
         header('Pragma: no-cache');
         header('Expires: ' . $time);
         header('Expires: ' . $time);
         header('Last-Modified: ' . $time);
         header('Last-Modified: ' . $time);
         header('Vary: Accept');
         header('Vary: Accept');
-        header('Content-Type: ' . $content . ';charset=UTF-8');
 
 
         $page = new RainTPL;
         $page = new RainTPL;
         // We escape it here because ENT_NOQUOTES can't be used in RainTPL templates.
         // We escape it here because ENT_NOQUOTES can't be used in RainTPL templates.

+ 12 - 13
tpl/page.html

@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 	<head>
 	<head>
@@ -6,13 +5,13 @@
 		<title>ZeroBin</title>
 		<title>ZeroBin</title>
 		<link type="text/css" rel="stylesheet" href="css/zerobin.css?{$VERSION|rawurlencode}#" /> 
 		<link type="text/css" rel="stylesheet" href="css/zerobin.css?{$VERSION|rawurlencode}#" /> 
 		<link type="text/css" rel="stylesheet" href="css/prettify.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]>
 		<!--[if lt IE 10]>
 		<style> body {padding-left:60px;padding-right:60px;} div#ienotice {display:block;} </style>
 		<style> body {padding-left:60px;padding-right:60px;} div#ienotice {display:block;} </style>
 		<![endif]-->
 		<![endif]-->
@@ -46,9 +45,9 @@
 				<div id="status"> </div>
 				<div id="status"> </div>
 				<div id="errormessage" class="hidden">{$ERRORMESSAGE|htmlspecialchars}</div>
 				<div id="errormessage" class="hidden">{$ERRORMESSAGE|htmlspecialchars}</div>
 				<div id="toolbar">
 				<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: 
 		      <div id="expiration" class="hidden">Expire: 
 			      <select id="pasteExpiration" name="pasteExpiration">
 			      <select id="pasteExpiration" name="pasteExpiration">
 							<option value="burn">Burn after reading</option>
 							<option value="burn">Burn after reading</option>
@@ -72,14 +71,14 @@
 						</select>
 						</select>
 					</div>
 					</div>
 					<input id="password" value="Optional password..." class="hidden" />
 					<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} />
 						<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="!$OPENDISCUSSION"} disabled="disabled"{/if} />
 						<label for="opendiscussion">Open discussion</label>
 						<label for="opendiscussion">Open discussion</label>
 					</div>
 					</div>
 				</div>
 				</div>
 				<div id="pastelink" class="hidden"></div>
 				<div id="pastelink" class="hidden"></div>
 				<div id="prettymessage" class="hidden">
 				<div id="prettymessage" class="hidden">
-					<div id="prettyprint" class="prettyprint linenums:1"></div>
+					<pre id="prettyprint" class="prettyprint linenums:1"></pre>
 				</div>
 				</div>
 				<div id="cleartext" class="hidden"></div>
 				<div id="cleartext" class="hidden"></div>
 				<textarea id="message" name="message" cols="80" rows="25" class="hidden"></textarea>
 				<textarea id="message" name="message" cols="80" rows="25" class="hidden"></textarea>