[Fusionforge-commits] r10649 - trunk/src/www/snippet

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Thu Sep 23 12:20:17 CEST 2010


Author: nerville
Date: 2010-09-23 12:20:17 +0200 (Thu, 23 Sep 2010)
New Revision: 10649

Modified:
   trunk/src/www/snippet/add_snippet_to_package.php
   trunk/src/www/snippet/addversion.php
   trunk/src/www/snippet/browse.php
   trunk/src/www/snippet/delete.php
   trunk/src/www/snippet/detail.php
   trunk/src/www/snippet/download.php
   trunk/src/www/snippet/index.php
   trunk/src/www/snippet/package.php
   trunk/src/www/snippet/snippet_utils.php
   trunk/src/www/snippet/submit.php
Log:
mostly licence + make it work

Modified: trunk/src/www/snippet/add_snippet_to_package.php
===================================================================
--- trunk/src/www/snippet/add_snippet_to_package.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/add_snippet_to_package.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,15 +1,27 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
-
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'snippet/snippet_utils.php';
@@ -139,7 +151,7 @@
 GROUP BY
 name,snippet.snippet_id ) AS foo,snippet_version
 WHERE
-snippet_version.post_date=mydate');
+snippet_version.post_date=mydate',array());
 $combolistrows=db_numrows($combolistresult);
 for ($i=0; $i<$combolistrows; $i++)
 {

Modified: trunk/src/www/snippet/addversion.php
===================================================================
--- trunk/src/www/snippet/addversion.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/addversion.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,15 +1,27 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
-
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'snippet/snippet_utils.php';
@@ -57,14 +69,13 @@
 								  time(),
 								  htmlspecialchars($code)));
 				if (!$result) {
-					$feedback .= _('ERROR DOING SNIPPET VERSION INSERT!');
-					echo db_error();
+					$error_msg .= _('ERROR DOING SNIPPET VERSION INSERT! ').db_error();
 				} else {
 					form_release_key(getStringFromRequest("form_key"));
 					$feedback .= _('Snippet Version Added Successfully.');
 				}
 			} else {
-				exit_error(_('Error'),_('Error - Go back and fill in all the information'));
+				exit_error(_('Error - Go back and fill in all the information'));
 			}
 
 		}
@@ -141,9 +152,8 @@
 								  time()));
 				if (!$result) {
 					//error in database
-					$feedback .= _('ERROR DOING SNIPPET PACKAGE VERSION INSERT!');
+					$error_msg .= _('ERROR DOING SNIPPET PACKAGE VERSION INSERT! ').db_error();
 					snippet_header(array('title'=>_('New snippet package')));
-					echo db_error();
 					snippet_footer(array());
 					exit;
 				} else {

Modified: trunk/src/www/snippet/browse.php
===================================================================
--- trunk/src/www/snippet/browse.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/browse.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,13 +1,26 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
@@ -41,24 +54,23 @@
 if ($by=='lang') {
 	$lang = getStringFromRequest('lang');
 
-	$qpa = db_construct_qpa ($qpa, 'AND language=$1', array ($lang)) ;
-	$qpa2 = db_construct_qpa ($qpa2, 'AND snippet_package.language=$1', array ($lang)) ;
+	$qpa = db_construct_qpa ($qpa, ' AND snippet.language=$1', array ($lang)) ;
+	$qpa2 = db_construct_qpa ($qpa2, ' AND snippet_package.language=$1', array ($lang)) ;
 
 	echo '<h2>' .sprintf(_('Snippets by language: %1$s'), $SCRIPT_LANGUAGE[$lang]).'</h2>';
 } else if ($by=='cat') {
 	$cat = getStringFromRequest('cat');
 
-	$qpa = db_construct_qpa ($qpa, 'AND snippet.category=$1', array ($cat)) ;
-	$qpa2 = db_construct_qpa ($qpa2, 'AND snippet_package.category=$1', array ($cat)) ;
+	$qpa = db_construct_qpa ($qpa, ' AND snippet.category=$1', array ($cat)) ;
+	$qpa2 = db_construct_qpa ($qpa2, ' AND snippet_package.category=$1', array ($cat)) ;
 
 	echo '<h2>' .sprintf(_('Snippets by category: %1$s'), $SCRIPT_CATEGORY[$cat]).'</h2>';
 } else {
-	exit_error(_('Error'),_('Error - bad url?'));
+	exit_error(_('Error - bad url?'));
 }
 
 $result = db_query_qpa ($qpa) ;
 $rows=db_numrows($result);
-
 $result2 = db_query_qpa ($qpa2) ;
 $rows2=db_numrows($result2);
 

Modified: trunk/src/www/snippet/delete.php
===================================================================
--- trunk/src/www/snippet/delete.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/delete.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,21 +1,31 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems - Tim Perdue
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
-
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'snippet/snippet_utils.php';
 /*
-	By Tim Perdue, 2000/01/10
-
 	Delete items from packages, package versions, and snippet versions
 */
 
@@ -129,7 +139,7 @@
 			exit;
 		}
 	} else {
-		exit_error('Error','Error - mangled URL?');
+		exit_error(_('Error - mangled URL?'));
 	}
 
 } else {

Modified: trunk/src/www/snippet/detail.php
===================================================================
--- trunk/src/www/snippet/detail.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/detail.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,15 +1,27 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
-
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'snippet/snippet_utils.php';
@@ -208,7 +220,7 @@
 
 } else {
 
-	exit_error(_('Error'),_('Error - was the URL mangled?'));
+	exit_error(_('Error - was the URL mangled?'));
 
 }
 

Modified: trunk/src/www/snippet/download.php
===================================================================
--- trunk/src/www/snippet/download.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/download.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,13 +1,26 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 $no_gz_buffer=true;
 
@@ -30,7 +43,7 @@
 		echo 'nothing in here';
 	}
 } else {
-	echo 'Error';
+	exit_error(_('Error'));
 }
 
 ?>

Modified: trunk/src/www/snippet/index.php
===================================================================
--- trunk/src/www/snippet/index.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/index.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,13 +1,27 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'snippet/snippet_utils.php';

Modified: trunk/src/www/snippet/package.php
===================================================================
--- trunk/src/www/snippet/package.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/package.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,15 +1,27 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
-
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'snippet/snippet_utils.php';
@@ -43,7 +55,7 @@
 			if (!$result) {
 				//error in database
 				form_release_key(getStringFromRequest("form_key"));
-				$feedback .= _('ERROR DOING SNIPPET PACKAGE INSERT!');
+				$error_msg .= _('ERROR DOING SNIPPET PACKAGE INSERT!');
 				snippet_header(array('title'=>_('Submit A New Snippet Package')));
 				echo db_error();
 				snippet_footer(array());
@@ -62,7 +74,7 @@
 								  time()));
 				if (!$result) {
 					//error in database
-					$feedback .= _('ERROR DOING SNIPPET PACKAGE VERSION INSERT!');
+					$error_msg .= _('ERROR DOING SNIPPET PACKAGE VERSION INSERT!');
 					snippet_header(array('title'=>_('Submit A New Snippet Package')));
 					echo db_error();
 					snippet_footer(array());
@@ -112,7 +124,7 @@
 			}
 		} else {
 			form_release_key(getStringFromRequest("form_key"));
-			exit_error(_('Error'),_('Error - Go back and fill in all the information'));
+			exit_error(_('Error - Go back and fill in all the information'));
 		}
 
 	}

Modified: trunk/src/www/snippet/snippet_utils.php
===================================================================
--- trunk/src/www/snippet/snippet_utils.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/snippet_utils.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,20 +1,27 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems - Tim Perdue
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
-
-/*
-	Code Snippet System
-	By Tim Perdue, Sourceforge, Jan 2000
-*/
-
 $SCRIPT_CATEGORY[0]= _('Choose One');
 $SCRIPT_CATEGORY[1]= _('UNIX Admin');
 $SCRIPT_CATEGORY[2]= _('HTML Manipulation');
@@ -94,13 +101,24 @@
 $SCRIPT_EXTENSION[16] = '.cs';
 
 function snippet_header($params) {
-	global $HTML;
-
 	if (!forge_get_config('use_snippet')) {
 		exit_disabled();
 	}
+	global $HTML;
+	global $feedback;
+	global $warning_msg;
+	global $error_msg;
+	$HTML->header($params);
+	if (!empty($error_msg)) {
+		html_feedback_top($error_msg);
+	}
+	if (!empty($warning_msg)) {
+		html_feedback_top($warning_msg);
+	}
+	if (!empty($feedback)) {
+		html_feedback_top($feedback);
+	}
 
-	$HTML->header($params);
 	/*
 		Show horizontal links
 	*/
@@ -114,8 +132,6 @@
 
 function snippet_footer($params) {
 	GLOBAL $HTML;
-	global $feedback;
-	html_feedback_bottom($feedback);
 	$HTML->footer($params);
 }
 

Modified: trunk/src/www/snippet/submit.php
===================================================================
--- trunk/src/www/snippet/submit.php	2010-09-23 10:08:40 UTC (rev 10648)
+++ trunk/src/www/snippet/submit.php	2010-09-23 10:20:17 UTC (rev 10649)
@@ -1,15 +1,27 @@
 <?php
 /**
-  *
-  * SourceForge Code Snippets Repository
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  */
+ * Code Snippets Repository
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
-
 require_once('../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'snippet/snippet_utils.php';
@@ -45,7 +57,7 @@
 							  $language,
 							  $license));
 			if (!$result) {
-				$feedback = _('ERROR DOING SNIPPET INSERT!');
+				$error_msg = _('ERROR DOING SNIPPET INSERT!');
 				echo db_error();
 			} else {
 				$feedback = _('Snippet Added Successfully.');
@@ -69,7 +81,7 @@
 			}
 		} else {
 			form_release_key(getStringFromRequest("form_key"));
-			exit_error(_('Error'),_('Error - Go back and fill in all the information'));
+			exit_error(_('Error - Go back and fill in all the information'));
 		}
 
 	}




More information about the Fusionforge-commits mailing list