[thirdparty-commits] jpeeler: mantis/trunk r51 - in /mantis/trunk: ./ core/

SVN commits to the Digium third-party software repository thirdparty-commits at lists.digium.com
Fri Jan 9 13:42:28 CST 2009


Author: jpeeler
Date: Fri Jan  9 13:42:27 2009
New Revision: 51

URL: http://svn.digium.com/view/thirdparty?view=rev&rev=51
Log:
fix several more problems with non code submissions as well as later marking them as code

Modified:
    mantis/trunk/core/license_api.php
    mantis/trunk/file_download.php
    mantis/trunk/mantis_mark_as_code.php

Modified: mantis/trunk/core/license_api.php
URL: http://svn.digium.com/view/thirdparty/mantis/trunk/core/license_api.php?view=diff&rev=51&r1=50&r2=51
==============================================================================
--- mantis/trunk/core/license_api.php (original)
+++ mantis/trunk/core/license_api.php Fri Jan  9 13:42:27 2009
@@ -8,6 +8,7 @@
 	define("LICENSE_PENDING", 1);
 	define("LICENSE_ACCEPTED", 2);
 	define("LICENSE_REJECTED", 3);
+	define("LICENSE_NOTREQUIRED", 4);
 
 	function license_on_file ( $p_id, $p_license_ver = NULL ) {
 		$t_license = get_license( $p_license_ver );
@@ -50,11 +51,10 @@
 	}
 
 	function license_status( $p_result ) {
-		if ($p_result === false)
-			return false; // no license required
+		if ($p_result === LICENSE_NOTREQUIRED)
+			return false;
 		if (!$p_result)
 			return LICENSE_NONE;
-		}
 
 		if ($p_result["pending"] && !is_null($p_result["date_expired"]))
 			return LICENSE_REJECTED;
@@ -69,7 +69,8 @@
 		$result = db_query($sql);
 			
 		if (!db_num_rows($result)) {
-			return false;
+			/* this is for a non code submission */
+			return LICENSE_NOTREQUIRED;
 		}
 
 		$result = db_fetch_array($result);

Modified: mantis/trunk/file_download.php
URL: http://svn.digium.com/view/thirdparty/mantis/trunk/file_download.php?view=diff&rev=51&r1=50&r2=51
==============================================================================
--- mantis/trunk/file_download.php (original)
+++ mantis/trunk/file_download.php Fri Jan  9 13:42:27 2009
@@ -42,7 +42,7 @@
 
 	$t_license_status = license_on_file_for_upload($c_file_id);
 
-	if($t_license_status !== false && $t_license_status != LICENSE_ACCEPTED) {
+	if($t_license_status != LICENSE_NOTREQUIRED && $t_license_status != LICENSE_ACCEPTED) {
 		access_denied();
 	}
 

Modified: mantis/trunk/mantis_mark_as_code.php
URL: http://svn.digium.com/view/thirdparty/mantis/trunk/mantis_mark_as_code.php?view=diff&rev=51&r1=50&r2=51
==============================================================================
--- mantis/trunk/mantis_mark_as_code.php (original)
+++ mantis/trunk/mantis_mark_as_code.php Fri Jan  9 13:42:27 2009
@@ -23,6 +23,7 @@
 
 	$file_id = $_GET["file_id"];
 	$bug_id = $_GET["bug_id"];
+	$license = get_license();
 
 	if(user_get_access_level(auth_get_current_user_id()) >= 70) {
 		$sql = sprintf("SELECT * FROM mantis_bug_file_table WHERE id = '%s'",
@@ -48,13 +49,14 @@
 		if(!$result) reloc();
 
 		$sql = sprintf("INSERT INTO mantis_license_uploads_table VALUES " .
-					   " ('', '%d', '%d', 0, '', NOW())",
+					   " ('', '%d', '%d', 0, '%s', NOW())",
 					   $result["user_id"],
-					   $_GET["file_id"]);
+					   $_GET["file_id"],
+					   $license["version"]);
 
 //		die(var_dump($sql));
 
-		$result = db_query($sql);
+	$result = db_query($sql);
 //		operation_report(db_affected_rows($result) > 0);
 		reloc();
 	} else access_denied();




More information about the thirdparty-commits mailing list