· 7 years ago · Oct 21, 2018, 02:12 PM
1<?php
2/**
3 * $Project: Pastebin $
4 * $Id: layout.php,v 1.1 2006/04/27 16:22:39 paul Exp $
5 *
6 * Pastebin Collaboration Tool
7 * http://pastebin.com/
8 *
9 * This file copyright (C) 2006 Paul Dixon (paul@elphin.com)
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 */
25
26echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
27?>
28<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
29<!--
30pastebin.com Copyright 2006 Paul Dixon - email suggestions to lordelph at gmail.com
31-->
32<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
33<head>
34<title><?php echo $page['title'] ?></title>
35<meta name="ROBOTS" content="NOARCHIVE"/>
36<link rel="stylesheet" type="text/css" media="screen" href="/codingbin/public_html/pastebin.css?ver=4" />
37
38<?php if (isset($page['post']['codecss']))
39{
40 echo '<style type="text/css">';
41 echo $page['post']['codecss'];
42 echo '</style>';
43}
44?>
45<script type="text/javascript" src="/codingbin/public_html/pastebin.js?ver=3"></script>
46</head>
47
48
49<body onload="initPastebin()">
50
51<div id="titlebar"><?php
52 echo $page['title'];
53?>
54
55</div>
56
57
58
59<div id="menu">
60
61<h1>CodingTeam</h1>
62<p><a href="http://www.codingteam.net">Click here</a>
63to go to the CodingTeam website.</p>
64
65
66<h1>Recent Posts</h1>
67<ul>
68<?php
69 foreach($page['recent'] as $idx=>$entry)
70 {
71 if ($entry['pid']==$pid)
72 $cls=" class=\"highlight\"";
73 else
74 $cls="";
75
76 echo "<li{$cls}><a href=\"{$entry['url']}\">";
77 echo $entry['poster'];
78 echo "</a><br/>{$entry['agefmt']}</li>\n";
79 }
80?>
81<li><a href="<?php echo $CONF['this_script'] ?>">Make new post</a></li>
82</ul>
83
84
85<h1>Credits</h1>
86<p>Initially developed by <a title="My blog, mainly about software development" href="http://blog.dixo.net">Paul Dixon</a> and adapted for <a href="http://www.codingteam.net" title="CodingTeam">CodingTeam</a> by <a href="http://www.codingteam.net/profil,xbright.html">Erwan Briand</a>.</p>
87
88<!--
89<p>
90 <a href="http://validator.w3.org/check/referer"><img
91 src="http://www.w3.org/Icons/valid-xhtml10"
92 alt="Valid XHTML 1.0!" height="31" width="88" border="0"/></a>
93</p>
94-->
95
96</div>
97
98
99<div id="content">
100
101 <?php
102/*
103 * Google AdWords block is below - if you re-use this script, be sure
104 * to configure your own AdWords client id!
105 */
106?>
107<a href="http://www.codingteam.net">
108<img src="http://www.codingteam.net/images/logo.png" alt="CodingTeam" style="border:0px;" /></a><br />
109<span style=" margin-left:15px;
110 margin-top:-10px;
111 font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;
112 font-weight: normal;
113 font-size: 14px;
114 color: #ff9933;
115 margin-bottom: 10px;
116 background-color: transparent;">collaborative debugging tool</span>
117<br/>
118<br/>
119<?php
120
121///////////////////////////////////////////////////////////////////////////////
122// show processing errors
123//
124if (count($pastebin->errors))
125{
126 echo "<h1>Errors</h1><ul>";
127 foreach($pastebin->errors as $err)
128 {
129 echo "<li>$err</li>";
130 }
131 echo "</ul>";
132 echo "<hr />";
133}
134
135
136if (isset($_REQUEST["diff"]))
137{
138
139 $newpid=intval($_REQUEST['diff']);
140
141 $newpost=$pastebin->getPost($newpid);
142 if (count($newpost))
143 {
144 $oldpost=$pastebin->getPost($newpost['parent_pid']);
145 if (count($oldpost))
146 {
147 $page['pid']=$newpid;
148 $page['current_format']=$newpost['format'];
149 $page['editcode']=$newpost['code'];
150 $page['posttitle']='';
151
152 //echo "<div style=\"text-align:center;border:1px red solid;padding:5px;margin-bottom:5px;\">Diff feature is in BETA! If you have feedback, send it to lordelph at gmail.com</div>";
153 echo "<h1>Difference between<br/>modified post <a href=\"".$pastebin->getPostUrl($newpost['pid'])."\">{$newpost['pid']}</a> by {$newpost['poster']} on {$newpost['postdate']} and<br/>".
154 "original post <a href=\"".$pastebin->getPostUrl($oldpost['pid'])."\">{$oldpost['pid']}</a> by {$oldpost['poster']} on {$oldpost['postdate']}<br/>";
155
156 echo "Show ";
157 echo "<a title=\"Don't show inserted or changed lines\" style=\"padding:1px 4px 3px 4px;\" id=\"oldlink\" href=\"javascript:showold()\">old version</a> | ";
158 echo "<a title=\"Don't show lines removed from old version\" style=\"padding:1px 4px 3px 4px;\" id=\"newlink\" href=\"javascript:shownew()\">new version</a> | ";
159 echo "<a title=\"Show both insertions and deletions\" style=\"background:#880000;padding:1px 4px 3px 4px;\" id=\"bothlink\" href=\"javascript:showboth()\">both versions</a> ";
160 echo "</h1>";
161
162 $newpost['code']=preg_replace('/^'.$CONF['highlight_prefix'].'/m', '', $newpost['code']);
163 $oldpost['code']=preg_replace('/^'.$CONF['highlight_prefix'].'/m', '', $oldpost['code']);
164
165 $a1=explode("\n", $newpost['code']);
166 $a2=explode("\n", $oldpost['code']);
167
168 $diff=new Diff($a2,$a1, 1);
169
170 echo "<table cellpadding=\"0\" cellspacing=\"0\" class=\"diff\">";
171 echo "<tr><td></td><td></td><td> </td><td></td></tr>";
172 echo $diff->output;
173 echo "</table>";
174 }
175
176 }
177
178
179}
180
181///////////////////////////////////////////////////////////////////////////////
182// show a post
183//
184
185if (isset($_GET['help']))
186 $page['posttitle']="";
187
188if (strlen($page['post']['posttitle']))
189{
190 echo "<h1>{$page['post']['posttitle']}";
191 if ($page['post']['parent_pid']>0)
192 {
193 echo " (modification of post by <a href=\"{$page['post']['parent_url']}\" title=\"view original post\">{$page['post']['parent_poster']}</a> ";
194 echo "<a href=\"{$page['post']['parent_diffurl']}\" title=\"compare differences\">view diff</a>)";
195 }
196
197 echo "<br/>";
198
199 $followups=count($page['post']['followups']);
200 if ($followups)
201 {
202 echo "View followups from ";
203 $sep="";
204 foreach($page['post']['followups'] as $idx=>$followup)
205 {
206 echo $sep."<a title=\"posted {$followup['postfmt']}\" href=\"{$followup['followup_url']}\">{$followup['poster']}</a>";
207 $sep=($idx<($followups-2))?", ":" and ";
208 }
209
210 echo " | ";
211 }
212
213 if ($page['post']['parent_pid']>0)
214 {
215 echo "<a href=\"{$page['post']['parent_diffurl']}\" title=\"compare differences\">diff</a> | ";
216 }
217
218 echo "<a href=\"{$page['post']['downloadurl']}\" title=\"download file\">download</a> | ";
219
220 echo "<span id=\"copytoclipboard\"></span>";
221
222 echo "<a href=\"".$CONF['this_script']."\" title=\"make new post\">new post</a>";
223
224 echo "</h1>";
225}
226if (isset($page['post']['pid']))
227{
228 echo "<div class=\"syntax\">".$page['post']['codefmt']."</div>";
229 echo "<br /><b>Submit a correction or amendment below. (<a href=\"{$CONF['this_script']}\">click here to make a fresh posting</a>)</b><br/>";
230 echo "After submitting an amendment, you'll be able to view the differences between the old and new posts easily.";
231}
232
233
234
235if (isset($_GET['help']))
236{
237 ?>
238 <h1>What is pastebin?</h1>
239 <p>pastebin is here to help you collaborate on debugging code snippets. If you're
240 not familiar with the idea, most people use it like this:</p>
241 <ul>
242 <li><a href="/">submit</a> a code fragment to pastebin, getting a url like http://pastebin.com/1234</li>
243 <li>paste the url into an IRC or IM conversation</li>
244 <li>someone responds by reading and perhaps submitting a modification of your code</li>
245 <li>you then view the modification, maybe using the built in diff tool to help locate the changes</li>
246 </ul>
247
248 <h1>How can I view the differences between two posts?</h1>
249 <p>When you view a post, you have the opportunity of editing the text -
250 <strong>this creates a new post</strong>, but when you view it, you'll be given a
251 'diff' link which allows you to compare the changes between the old and the new version</p>
252<p>This is a powerful feature, great for seeing exactly what lines someone changed.</p>
253
254
255 <h1>What's a private pastebin and how do I get one?</h1>
256 <p>You get a private pastebin simply by thinking up a domain name no-one else is using,
257 e.g. http://private.pastebin.com or http://this-is-my.pastebin.com. Posts made into a
258 subdomain only show up on that domain, making it easy for you to collaborate without the
259 'noise' of the regular service at <a href="http://pastebin.com">http://pastebin.com</a>.</p>
260
261 <p>All you need to do is change the web address in your browser to access a private pastebin,
262 or you can simply enter the domain you'd like below</p>
263
264 <form method="get" action="<?php echo $CONF['this_script']?>">
265 <input type="hidden" name="help" value="1"/>
266 <p>Go to http://<input type="text" name="goprivate" value="<?php echo stripslashes($_GET['goprivate']) ?>" size="10"/>.pastebin.com
267 <input type="submit" name="go" value="Go"/></p>
268 <?php if (isset($_GET['goprivate'])) { echo "<p>Please use only characters a-z,0-9, dash '-' and period '.'. Your name must start and end with a letter or number.</p>"; } ?>
269 </form>
270
271 <p>Please note that there is no password protection - subdomains are accessible to anyone
272 who knows the domain name you've chosen, but we do not publish a list of domains used.</p>
273
274 <h1>Subdomains for your language...</h1>
275
276 <p>If a subdomain matches a language name, the required syntax highlighting is selected
277 for you, so ruby.pastebin.com will preselect Ruby automatically. </p>
278
279 <p><?php
280
281 $sep="";
282 foreach($CONF['all_syntax'] as $langcode=>$langname)
283 {
284 if ($langcode=='text')
285 $langname="Plain Text";
286 echo "{$sep}<a title=\"{$langname} Pastebin\" href=\"http://{$langcode}.pastebin.com\">{$langname}</a>";
287 $sep=", ";
288 }
289
290
291 ?></p>
292
293 <h1>And this is all free?</h1>
294 <p>It will always be free, our hosting and maintenance costs are paid for through advertising.</p>
295
296 <h1>Can I get the source?</h1>
297 <p>The source code to this site is available under a GPL licence. You can <a title="Pastebin source code, 130Kb" href="pastebin.tar.gz">download it here</a></p>
298
299 <p>More news available on my <a title="View pastebin related posts on my blog" href="http://blog.dixo.net/category/pastebin/">blog</a>.</p>
300
301
302 <h1>I have some feedback, who do I contact?</h1>
303 <p>Use the feedback box in the sidebar or email <script type="text/javascript">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%70%61%75%6c%40%65%6c%70%68%69%6e%2e%63%6f%6d%22%20%3e%50%61%75%6c%20%44%69%78%6f%6e%3c%2f%61%3e%27%29%3b'))</script>
304 </p>
305
306
307 <?php
308}
309else
310{
311?>
312<form name="editor" method="post" action="<?php echo $CONF['this_script']?>">
313<input type="hidden" name="parent_pid" value="<?php echo $page['post']['pid'] ?>"/>
314
315<br/>Use <select name="format">
316<?php
317
318//show the popular ones
319foreach ($CONF['all_syntax'] as $code=>$name)
320{
321 if (in_array($code, $CONF['popular_syntax']))
322 {
323 $sel=($code==$page['current_format'])?"selected=\"selected\"":"";
324 echo "<option $sel value=\"$code\">$name</option>";
325 }
326}
327
328echo "<option value=\"text\">----------------------------</option>";
329
330//show all formats
331foreach ($CONF['all_syntax'] as $code=>$name)
332{
333 $sel=($code==$page['current_format'])?"selected=\"selected\"":"";
334 if (in_array($code, $CONF['popular_syntax']))
335 $sel="";
336 echo "<option $sel value=\"$code\">$name</option>";
337
338}
339?>
340</select> syntax highlighting<br/>
341<br/>
342
343To highlight particular lines, prefix each line with <?php echo $CONF['highlight_prefix'] ?><br/>
344<textarea id="code" class="codeedit" name="code2" cols="80" rows="10" onkeydown="return catchTab(this,event)"><?php
345echo htmlentities($page['post']['editcode']) ?></textarea>
346
347<div id="namebox">
348
349<label for="poster">Your Name</label><br/>
350<input type="text" maxlength="24" size="24" id="poster" name="poster" value="<?php echo $page['poster'] ?>" />
351<input type="submit" name="paste" value="Send"/>
352<br />
353<input type="checkbox" name="remember" value="1" <?php echo $page['remember'] ?>/>Remember my settings
354
355</div>
356
357
358<div id="expirybox">
359
360
361<div id="expiryradios">
362<label>How long should your post be retained?</label><br/>
363
364<input type="radio" id="expiry_day" name="expiry" value="d" <?php if ($page['expiry']=='d') echo 'checked="checked"'; ?> />
365<label id="expiry_day_label" for="expiry_day">a day</label>
366
367<input type="radio" id="expiry_month" name="expiry" value="m" <?php if ($page['expiry']=='m') echo 'checked="checked"'; ?> />
368<label id="expiry_month_label" for="expiry_month">a month</label>
369
370<input type="radio" id="expiry_forever" name="expiry" value="f" <?php if ($page['expiry']=='f') echo 'checked="checked"'; ?> />
371<label id="expiry_forever_label" for="expiry_forever">forever</label>
372</div>
373
374<div id="expiryinfo"></div>
375
376</div>
377
378<div id="end"></div>
379
380</form>
381<?php
382}
383?>
384
385</div>
386</body>
387</html>