rpms/pastebin/devel pastebin-db.mysql.class.php.patch, NONE, 1.1 pastebin-pastebin.class.php.patch, NONE, 1.1 pastebin-pastebin.php.patch, NONE, 1.1 pastebin-README.fedora, 1.1, 1.2 pastebin-default.conf.php.patch, 1.1, 1.2 pastebin-layout.php.patch, 1.1, 1.2 pastebin.spec, 1.1, 1.2 pastebin.sql, 1.1, 1.2 sources, 1.2, 1.3 pastebin-config.inc.php.patch, 1.1, NONE

Michael Stahnke (stahnma) fedora-extras-commits at redhat.com
Thu Feb 7 05:22:28 UTC 2008


Author: stahnma

Update of /cvs/extras/rpms/pastebin/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv955/devel

Modified Files:
	pastebin-README.fedora pastebin-default.conf.php.patch 
	pastebin-layout.php.patch pastebin.spec pastebin.sql sources 
Added Files:
	pastebin-db.mysql.class.php.patch 
	pastebin-pastebin.class.php.patch pastebin-pastebin.php.patch 
Removed Files:
	pastebin-config.inc.php.patch 
Log Message:
New Version Upstream


pastebin-db.mysql.class.php.patch:

--- NEW FILE pastebin-db.mysql.class.php.patch ---
--- db.mysql.class.php	2007-07-10 09:40:36.000000000 -0500
+++ db.mysql.class.php.good	2008-02-06 22:35:46.000000000 -0600
@@ -177,7 +177,7 @@
 		$this->_query('unlock tables');
 		
 		//flush recent list
-		$this->_cacheflush('recent'.$domain);		
+		$this->_cacheflush('recent'.$subdomain);		
 		
 		return $id;
     }
@@ -307,10 +307,9 @@
 			$sql=str_replace('?', $q, $sql);
 			
 			$args=func_get_args();
-			for ($i=2; $i<=count($args); $i++)
+			for ($i=2; $i<count($args); $i++)
 			{
 				$sql=preg_replace("/$q/", "'".preg_quote(mysql_real_escape_string($args[$i]))."'", $sql,1);
-				
 			}
 		
 			//we shouldn't have any $q left, but it will help debugging if we change them back!
@@ -385,7 +384,7 @@
 			$sql=str_replace('?', $q, $sql);
 			
 			$args=func_get_args();
-			for ($i=1; $i<=count($args); $i++)
+			for ($i=1; $i<count($args); $i++)
 			{
 				$sql=preg_replace("/$q/", "'".preg_quote(mysql_real_escape_string($args[$i]))."'", $sql,1);
 				

pastebin-pastebin.class.php.patch:

--- NEW FILE pastebin-pastebin.class.php.patch ---
--- pastebin.class.php	2007-07-10 09:42:34.000000000 -0500
+++ pastebin.class.php.good	2008-02-06 22:30:38.000000000 -0600
@@ -149,7 +149,7 @@
 		
 			
 		//set/clear the persistName cookie
-		if ($post['remember'])
+		if (isset($post['remember']) && $post['remember'])
 		{
 			$value=$post['poster'].'#'.$post['format'].'#'.$post['expiry'];
 			

pastebin-pastebin.php.patch:

--- NEW FILE pastebin-pastebin.php.patch ---
--- pastebin.php	2007-07-10 09:57:12.000000000 -0500
+++ pastebin.php.good	2008-02-06 22:57:43.000000000 -0600
@@ -89,7 +89,7 @@
 
 function t($str)
 {
-	//global $CONF;
+	global $CONF;
 	
 	//if in maintainance mode, record this string in the translation db
 	if ($CONF['maintainer_mode'])
@@ -158,7 +158,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // user submitted the "private pastebin" form? redirect them...
 //
-if ($_GET['goprivate'])
+if (isset($_GET['goprivate']) && $_GET['goprivate'])
 {
 	$sub=trim(strtolower($_GET['goprivate']));
 	if (preg_match('/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/i', $sub))
@@ -235,9 +235,13 @@
 {
 	//initialise bits of page with cookie data
 	$page['remember']='checked="checked"';
+        if(isset($cookie['last_format']))
 	$page['current_format']=$cookie['last_format'];
+        if(isset($cookie['poster']))
 	$page['poster']=$cookie['poster'];
+        if(isset($cookie['last_expiry']))
 	$page['expiry']=$cookie['last_expiry'];
+        if(isset($cookie['token']))
 	$page['token']=$cookie['token'];
 }
 


Index: pastebin-README.fedora
===================================================================
RCS file: /cvs/extras/rpms/pastebin/devel/pastebin-README.fedora,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pastebin-README.fedora	12 Jan 2007 15:30:38 -0000	1.1
+++ pastebin-README.fedora	7 Feb 2008 05:21:46 -0000	1.2
@@ -8,6 +8,9 @@
           mysql -u root -P < pastebin.sql
      You might need to change the user and host access in the SQL file.
 
+     If you're upgrading from a previous pastebin package, you will need to run 
+     only the bottom portion of the pastebin.sql file.  
+
 II.  Web server Setup
      Apache is setup with a file /etc/httpd/conf.d/pastebin.conf which
      defaults to the URL being http://localhost/pastebin.  If this is not

pastebin-default.conf.php.patch:

Index: pastebin-default.conf.php.patch
===================================================================
RCS file: /cvs/extras/rpms/pastebin/devel/pastebin-default.conf.php.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pastebin-default.conf.php.patch	12 Jan 2007 15:30:38 -0000	1.1
+++ pastebin-default.conf.php.patch	7 Feb 2008 05:21:46 -0000	1.2
@@ -1,63 +1,65 @@
---- default.conf.php	2006-05-07 05:25:08.000000000 -0500
-+++ default.conf.php.good	2007-01-10 22:00:27.000000000 -0600
-@@ -52,7 +52,7 @@
+--- default.conf.php	2007-07-10 07:07:20.000000000 -0500
++++ default.conf.php.good	2008-02-06 23:09:50.000000000 -0600
+@@ -49,9 +49,16 @@
+ $CONF['title']='pastebin - collaborative debugging tool';
+ 
  /**
++* this is used to create a subdirectory to have your
++* pastebin in, instead of having it at /
++* Field must start with /
++*/
++$CONF['subdir'] = '/pastebin';
++
++/**
  * Email address feedback should be sent to
  */
 -$CONF['feedback_to']='lordelph at gmail.com';
-+$CONF['feedback_to']='you at example.com';
++$CONF['feedback_to']='you at example.com';
  
  /**
  * Apparent sender address for feedback email
-@@ -86,8 +86,7 @@
+@@ -85,7 +92,7 @@
   * 3. if not using mod_rewrite, you'll need something more like this:
-  *    $CONF['url_format']="/pastebin.php?show=%d";
+  *    $CONF['url_format']="/pastebin.php?show=%s";
   */
--$CONF['url_format']='/%d';
--
-+$CONF['url_format']='/pastebin/%d';
+-$CONF['url_format']='/%s';
++$CONF['url_format']=$CONF['subdir'] . '/%s';
  
  
- /**
-@@ -100,7 +99,7 @@
+ 
+@@ -99,7 +106,7 @@
  * to use / for even shorter urls if the main script
  * is renamed to index.php
  */
 -$CONF['this_script']='/pastebin.php';
-+$CONF['this_script']='/pastebin/pastebin.php';
++$CONF['this_script']=$CONF['subdir'] . '/pastebin.php';
  
  /**
  * what's the maximum number of posts we want to keep?
-@@ -114,18 +113,11 @@
- $CONF['highlight_prefix']='@@';
+@@ -118,13 +125,14 @@
+ * elements 'pastebin' and 'com' - for pastebin.mysite.com there 3. Got it?
+ * Good!
+ */
++# This needs to be 2 for running in http://url/pastebin structure
+ $CONF['base_domain_elements']=2;
  
- /**
--* how many elements in the base domain name? This is used to determine
--* what makes a "private" pastebin, i.e. for pastebin.com there are 2
--* elements 'pastebin' and 'com' - for pastebin.mysite.com there 3. Got it?
--* Good!
--*/
--$CONF['base_domain_elements']=2;
--
 -
--/**
+ /**
  * Google Adsense, clear this to remove ads. 
-+* 
-+* Disabled in Fedora Package
  */
 -$CONF['google_ad_client']='pub-3281640380846080';
-+// $CONF['google_ad_client']='pub-3281640380846080';
- 
++# Feel free to add your own or leave blank
++$CONF['google_ad_client']='';
  
  /**
-@@ -197,7 +189,7 @@
+ * maintainer mode enables some code used to aid translation - unless you
+@@ -201,7 +209,7 @@
  * popular formats, listed first
  */
  $CONF['popular_syntax']=array(
 -	'text','bash', 'c', 'cpp', 'html4strict',
-+	'text','bash', 'c', 'cpp', 'diff', 'html4strict',
++	'text','bash', 'c', 'cpp', 'diff', 'html4strict',
  	'java','javascript','php','perl', 'python', 'ruby', 'lua');
  
--?>
+ ?>
 \ No newline at end of file
-+?>

pastebin-layout.php.patch:

Index: pastebin-layout.php.patch
===================================================================
RCS file: /cvs/extras/rpms/pastebin/devel/pastebin-layout.php.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pastebin-layout.php.patch	12 Jan 2007 15:30:38 -0000	1.1
+++ pastebin-layout.php.patch	7 Feb 2008 05:21:46 -0000	1.2
@@ -1,29 +1,146 @@
---- layout.php	2006-05-07 05:30:24.000000000 -0500
-+++ layout.php.good	2007-01-10 21:03:15.000000000 -0600
-@@ -33,7 +33,7 @@
+--- layout.php	2007-07-10 10:22:37.000000000 -0500
++++ layout.php.good	2008-02-06 23:04:05.000000000 -0600
+@@ -34,7 +34,8 @@
  <head>
  <title><?php echo $page['title'] ?></title>
  <meta name="ROBOTS" content="NOARCHIVE"/>
 -<link rel="stylesheet" type="text/css" media="screen" href="/pastebin.css?ver=4" />
-+<link rel="stylesheet" type="text/css" media="screen" href="pastebin.css?ver=4" />
++<link rel="shortcut icon" href="<?php  if(isset($CONF['subdir'])) { echo $CONF['subdir'] ; } ?>/favicon.ico" type="image/x-icon" />
++<link rel="stylesheet" type="text/css" media="screen" href="pastebin.css?ver=4" />
  
  <?php if (isset($page['post']['codecss']))
  {
-@@ -42,7 +42,7 @@
+@@ -43,7 +44,7 @@
  	echo '</style>';
  }
  ?>
 -<script type="text/javascript" src="/pastebin.js?ver=3"></script>
-+<script type="text/javascript" src="pastebin.js?ver=3"></script>
++<script type="text/javascript" src="pastebin.js?ver=3"></script>
  </head>
  
  
-@@ -300,7 +300,7 @@
+@@ -81,7 +82,7 @@
+ <?php  
+ 	foreach($page['recent'] as $idx=>$entry)
+ 	{
+-		if ($entry['pid']==$pid)
++		if (isset($pid) && $entry['pid']==$pid)
+ 			$cls=" class=\"highlight\"";
+ 		else
+ 			$cls="";
+@@ -223,7 +224,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ // show processing errors
+ //
+-if (count($pastebin->errors))
++if (isset($pastebin->errors) && count($pastebin->errors))
+ {
+ 	echo '<h1>'.t('Errors').'</h1><ul>';
+ 	foreach($pastebin->errors as $err)
+@@ -301,21 +302,26 @@
+ if (isset($_GET['help']))
+ 	$page['posttitle']="";
+ 	
+-if (strlen($page['post']['posttitle']))
++if (isset($page['post']['posttitle']) && strlen($page['post']['posttitle']))
+ {
+ 		echo "<h1>{$page['post']['posttitle']}";
+-		if (strlen($page['post']['parent_pid']))
++		if (isset ($page['post']['parent_pid']) && strlen($page['post']['parent_pid']))
++		{
++		        if(isset($page['post']['parent_url']))
+ 		{
+ 			echo ' (';
+ 			printf(t("modification of post by %s"),
+ 				"<a href=\"{$page['post']['parent_url']}\" title=\"".t('view original post')."\">{$page['post']['parent_poster']}</a>");
+-			
++                        }
++		        if(isset($page['post']['parent_diffurl']))
++                        {	
+ 			echo " <a href=\"{$page['post']['parent_diffurl']}\" title=\"".t('compare differences')."\">".t('view diff')."</a>)";
+ 		}
++		}
+ 		
+ 		echo "<br/>";
+ 		
+-		if (strlen($page['post']['token']) && ($page['token']==$page['post']['token']))
++		if (isset($page['post']['token']) && strlen($page['post']['token']) && ($page['token']==$page['post']['token']))
+ 		{
+ 			echo "<a href=\"{$page['post']['deleteurl']}\" title=\"".t('delete post')."\">".t('delete post')."</a> | ";
+ 		}
+@@ -343,7 +349,7 @@
  		
  		echo "<span id=\"copytoclipboard\"></span>";
  		
--		echo "<a href=\"/\" title=\"make new post\">new post</a>";
-+		echo "<a href=\"{$CONF['this_script']}\" title=\"make new post\">new post</a>";
+-		echo "<a href=\"/\" title=\"".t('make new post')."\">".t('new post')."</a>";
++		echo "<a href=\"{$CONF['this_script']}\" title=\"".t('make new post')."\">".t('new post')."</a>";
  		
  		echo "</h1>";
  }
+@@ -364,7 +370,7 @@
+ 	
+ 	echo '<ul>';
+ 	
+-	li('<a href="/">submit</a> a code fragment to pastebin, getting a url like http://pastebin.com/1234');
++	li('<a href=\"{$CONF[\'subdir\']}\" >submit</a> a code fragment to pastebin, getting a url like http://pastebin.com/1234');
+ 	li('paste the url into an IRC or IM conversation');
+ 	li('someone responds by reading and perhaps submitting a modification of your code');
+ 	li('you then view the modification, maybe using the built in diff tool to help locate the changes');
+@@ -399,7 +405,10 @@
+ 	
+ 	<form method="get" action="<?php echo $CONF['this_script']?>">
+ 	<input type="hidden" name="help" value="1"/>
+-	<p><?php echo t('Go to')?> http://<input type="text" name="goprivate" value="<?php echo stripslashes($_GET['goprivate']) ?>" size="10"/>.pastebin.com 
++	<p><?php echo t('Go to')?> http://<input type="text" name="goprivate" value="<?php 
++        if (isset($_GET['goprivate'])) 
++        { echo stripslashes($_GET['goprivate']);  }?>
++        " size="10"/>.pastebin.com 
+ 	<input type="submit" name="go" value="<?php echo t('Go')?>"/></p>
+ 	<?php if (isset($_GET['goprivate'])) { p('Please use only characters a-z,0-9, dash \'-\' and period \'.\'. Your name must start and end with a letter or number.'); } ?>
+ 	</form>
+@@ -435,7 +444,7 @@
+ 	
+ 	h1('Can I get the source?');
+ 	p('The source code to this site is available under a GPL licence. '.
+-		'You can <a title="Pastebin source code, 245Kb" href="pastebin.tar.gz">download it here</a>');
++		'You can <a title="Pastebin source code, 245Kb" href="http://pastebin.com/pastebin.tar.gz">download it here</a>');
+ 	
+ 	p('More news available on my <a title="View pastebin related posts on my blog" href="http://blog.dixo.net/category/pastebin/">blog</a>.');
+ 
+@@ -449,7 +458,7 @@
+ {
+ ?>
+ <form name="editor" method="post" action="<?php echo $CONF['this_script']?>">
+-<input type="hidden" name="parent_pid" value="<?php echo $page['post']['pid'] ?>"/>
++<input type="hidden" name="parent_pid" value="<?php if (isset($page['post']['pid'])) { echo $page['post']['pid']; } ?>"/>
+ 
+ <br/> 
+ <?php
+@@ -483,13 +492,23 @@
+ 
+ <?php printf(t('To highlight particular lines, prefix each line with %s'),$CONF['highlight_prefix']); ?>
+ <br/>
+-<textarea id="code" class="codeedit" name="code2" cols="80" rows="10" onkeydown="return catchTab(this,event)"><?php 
+-echo htmlentities($page['post']['editcode'], ENT_COMPAT,$CONF['htmlentity_encoding']) ?></textarea>
++<textarea id="code" class="codeedit" name="code2" cols="80" rows="10" onkeydown="return catchTab(this,event)">
++<?php 
++if(isset($page['post']['editcode']))
++{ 
++   echo htmlentities($page['post']['editcode'], ENT_COMPAT,$CONF['htmlentity_encoding']) ;
++} 
++?>
++</textarea>
+ 
+ <div id="namebox">
+-	
++<?php 
++  if(isset($SERVER['REMOTE_USER']))
++      $page['poster'] = $SERVER['REMOTE_USER'];
++?>
+ <label for="poster"><?php echo t('Your Name')?></label><br/>
+-<input type="text" maxlength="24" size="24" id="poster" name="poster" value="<?php echo $page['poster'] ?>" />
++<input type="text" maxlength="24" size="24" id="poster" name="poster" value="<?php 
++if(isset($page['poster'])) { echo $page['poster']; } ?>" />
+ <input type="submit" name="paste" value="<?php echo t('Send')?>"/>
+ <br />
+ <?php echo '<input type="checkbox" name="remember" value="1" '.$page['remember'].' />'.t('Remember me'); ?>


Index: pastebin.spec
===================================================================
RCS file: /cvs/extras/rpms/pastebin/devel/pastebin.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pastebin.spec	12 Jan 2007 15:30:38 -0000	1.1
+++ pastebin.spec	7 Feb 2008 05:21:46 -0000	1.2
@@ -1,12 +1,13 @@
 Name:           pastebin 
-Version:        0.50 
-Release:        3%{?dist}
+Version:        0.60
+Release:        1%{?dist}
 Summary:        A collaborative debugging tool 
 
 Group:          Applications/Internet
-License:        GPL 
+# Valid license according to http://fedoraproject.org/wiki/Licensing
+License:        AGPLv1
 URL:            http://pastebin.com/ 
-Source0:        http://pastebin.com/pastebin.tar.gz 
+Source0:        http://pastebin.com/%{name}.tar.gz 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Source1:        pastebin-README.fedora
@@ -14,7 +15,9 @@
 Source3:        pastebin.conf
 Patch0:         pastebin-default.conf.php.patch
 Patch1:         pastebin-layout.php.patch
-Patch2:         pastebin-config.inc.php.patch
+Patch2:         pastebin-pastebin.php.patch
+Patch3:         pastebin-db.mysql.class.php.patch
+Patch4:         pastebin-pastebin.class.php.patch
 
 Requires:       httpd, php-mysql
 BuildArch:      noarch
@@ -23,9 +26,9 @@
 %description
 pastebin is here to help you collaborate on debugging code snippets. 
 If you're not familiar with the idea, most people use it to submit a code
-fragment to pastebin, getting a url like http://pastebin.com/1234 and then
-link that URL in IRC or IM conversations.  This allows others to see your
-code and optionally post changes. 
+fragment to pastebin, getting a url like http://www.example.com/patebin/1234 
+and then link that URL in IRC or IM conversations.  This allows others 
+to see your code and optionally post changes. 
 
 For information on setup see %{_docdir}/%{name}-%{version}/README.fedora
 
@@ -35,13 +38,15 @@
 cp -p %{SOURCE2} pastebin.sql
 # Start patching
 pushd lib/config
-%patch0 -p0
+%patch0 
 popd
 pushd public_html
 %patch1 -p0
+%patch2 -p0
 popd
 pushd lib/pastebin
-%patch2 -p0
+%patch3 -p0
+%patch4 -p0
 popd
 
 # Now fix DOS end of line
@@ -89,21 +94,26 @@
 
 %files
 %defattr(-,root,root,-)
-%doc CHANGES INSTALL LICENCE README UPGRADE README.fedora pastebin.sql 
-%doc geshi/ 
+%doc CHANGES INSTALL LICENCE README UPGRADE README.fedora geshi/ 
 %attr(755,root,root) %dir %{_sysconfdir}/%{name}
-%attr (755,root,root) %dir /%{_datadir}/%{name}/
+%attr (755,root,root) %dir %{_datadir}/%{name}/
 %config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
 %config(noreplace) %{_sysconfdir}/%{name}/*
-/%{_datadir}/%{name}/*
+%{_datadir}/%{name}/*
 
 
 %changelog
+* Wed Feb 06 2008 Michael Stahnke <mastahnke at gmail.com> - 0.60-1
+- New Upstream version (0.60)
+- A few new patches to make it work in url/patebin rather the paste.example.com
+- Patched several bugs throwing errors into the apache logs
+- Provided upgrade SQL script
+
 * Thu Jan 12 2007 Michael Stahnke <mastahnke at gmail.com> - 0.50-3
 - Fixed a few more issues suggested from review [Bug 222257]
 - Preserve timestamps for upstream files
 - Removed a few tabs that snuck in the spec file
-- Moved all doc into %doc
+- Moved all doc into %%doc
 
 * Thu Jan 12 2007 Michael Stahnke <mastahnke at gmail.com> - 0.50-2
 - Fixed issues suggested from review [Bug 222257]


Index: pastebin.sql
===================================================================
RCS file: /cvs/extras/rpms/pastebin/devel/pastebin.sql,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pastebin.sql	12 Jan 2007 15:30:38 -0000	1.1
+++ pastebin.sql	7 Feb 2008 05:21:46 -0000	1.2
@@ -1,3 +1,8 @@
+-- If you're upgrading from a previous pastebin package, just run the bottom portion. 
+-- If this is your first pastebin installation, run the whole thing
+-- You might need to change credentials and such
+
+
 --Create databse in MySQL
 CREATE database pastebin;
 
@@ -25,3 +30,21 @@
    PRIMARY KEY  (`pid`),
    KEY `domain` (`domain`)
    );
+
+-- If you are upgrading from the previous package (pastebin-0.50-x) , run the following
+-- Create table in MySQL
+create table recent
+(
+        domain varchar(255),
+        pid int not null,
+        seq_no int not null,
+        primary key(domain,seq_no)
+);
+
+-- Also part of the upgrade
+ALTER TABLE pastebin
+        ADD COLUMN expires DATETIME,
+        ADD COLUMN expiry_flag ENUM('d','m', 'f') NOT NULL DEFAULT 'm';
+
+UPDATE pastebin SET expires=DATE_ADD(posted, INTERVAL 1 MONTH) where expires is null and expiry_flag='m';
+


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/pastebin/devel/sources,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sources	12 Jan 2007 15:30:38 -0000	1.2
+++ sources	7 Feb 2008 05:21:46 -0000	1.3
@@ -1 +1 @@
-d7b8993f4baed7753fb7c912b06725fb  pastebin.tar.gz
+c73c4b40e8eeddba9b515586f017a777  pastebin.tar.gz


--- pastebin-config.inc.php.patch DELETED ---




More information about the fedora-extras-commits mailing list