<commit_before><?
	# $Id: missing-port.php,v 1.1.2.16 2002-03-19 21:26:59 dan Exp $
	#
	# Copyright (c) 2001 DVL Software Limited


function freshports_Parse404CategoryPort($REQUEST_URI, $db) {

$Debug=0;


	if ($Debug) echo "you asked for $REQUEST_URI<BR>";

	$result = "";
	$url_Array = explode('/', $REQUEST_URI);
	if (array_count_values($url_Array) >= 1) {
		$CategoryName = AddSlashes($url_Array[1]);
		if (array_count_values($url_Array) >= 2) {
			$PortName = AddSlashes($url_Array[2]);
		}

		if ($Debug) {
			echo "\$CategoryName = '$CategoryName'<BR>";
			echo "\$PortName     = '$PortName'<BR>";
		}


		$CategoryID = freshports_CategoryId($CategoryName, $db);

		if ($Debug) {
			echo "\$CategoryName = '$CategoryName' ($CategoryID)<BR>";
			echo "\$PortName     = '$PortName'<BR>";
		}

		if (IsSet($PortName) && $PortName != '') {
			$element = new Element($db);
			$element->FetchByName("/ports/$CategoryName/$PortName");

			if (IsSet($element->id)) {
				$port = new Port($db);
				GLOBAL $WatchListID;
				$port->FetchByPartialName("/ports/$CategoryName/$PortName", $WatchListID);

				if ($Debug) {
					if (IsSet($port->id)) {
						echo "port was found with id = $port->id<BR>";
					} else {
						echo "that port not found<BR>";
					}
				}
			}
		}

		if (IsSet($CategoryID)) {
#			echo "<A HREF=\"/category.php?category=$CategoryID\">this link</A> should take you to the category details<BR>";
			if (IsSet($port->id)) {
#				echo "This is where you'd see details for port = '$port->id'<BR>";
#				echo "<A HREF=\"/port-description.php?port=$port->id\">this link</A> should take you to the port details<BR>";
#				echo "and short_description = $port->short_description";

				freshports_PortDescription($port);<commit_msg>Allow URL of /category/ports/files.php?commitid to show files affected by said commit it<commit_after><?
	# $Id: missing-port.php,v 1.1.2.17 2002-04-01 21:01:14 dan Exp $
	#
	# Copyright (c) 2001 DVL Software Limited

#	phpinfo();


$CommitDetails = 'files.php';
require_once("./include/files.php");


function freshports_Parse404CategoryPort($REQUEST_URI, $db) {

	$Debug=0;

	unset($CategoryName);
	unset($PortName);
	unset($FileName);


	if ($Debug) echo "you asked for $REQUEST_URI<BR>";

	$result = "";
	$url_Array = explode('/', $REQUEST_URI);
	if ($Debug) echo "count(\$url_Array) = '" . sizeof($url_Array) .  "' : '" . $url_Array[4] . "'<BR>";
	if (count($url_Array) >= 1) {
		$CategoryName = AddSlashes($url_Array[1]);
		if (array_count_values($url_Array) >= 2) {
			$PortName = AddSlashes($url_Array[2]);
		}

		if (count($url_Array) >= 3) {
			if ($Debug) echo "getting FileName<BR>";
			$FileName = AddSlashes($url_Array[3]);
		}

		if ($Debug) {
			echo "\$CategoryName = '$CategoryName'<BR>";
			echo "\$PortName     = '$PortName'<BR>";
			echo "\$FileName     = '$FileName'<BR>";
		}


		$CategoryID = freshports_CategoryId($CategoryName, $db);

		if ($Debug) {
			echo "\$CategoryName = '$CategoryName' ($CategoryID)<BR>";
			echo "\$PortName     = '$PortName'<BR>";
		}

		if (IsSet($PortName) && $PortName != '') {
			$element = new Element($db);
			$element->FetchByName("/ports/$CategoryName/$PortName");

			if (IsSet($element->id)) {
				$port = new Port($db);
				GLOBAL $WatchListID;
				$port->FetchByPartialName("/ports/$CategoryName/$PortName", $WatchListID);

				if ($Debug) {
					if (IsSet($port->id)) {
						echo "port was found with id = $port->id<BR>";
					} else {
						echo "that port not found<BR>";
					}
				}
			}
		}

		if (IsSet($CategoryID)) {
#			echo "<A HREF=\"/category.php?category=$CategoryID\">this link</A> should take you to the category details<BR>";
			if (IsSet($port->id)) {
				if ($FileName != '') {
					if (substr($FileName, 0, strlen($CommitDetails)) == $CommitDetails) {
						$commit_id = $_SERVER["REDIRECT_QUERY_STRING"];
						freshports_Files($port->id, $commit_id, $db);
					} else {
						$result = 'The category and port you specified both exist, but that extra bit I don\'t recognize: \'' . $FileName . '\'';
					}
				} else {
					freshports_PortDescription($port);
				}
{'fraction_non_alphanumeric': 0.19257993653893093, 'fraction_numerical': 0.016109348303636806, 'mean_word_length': 3.6941580756013748, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6070622', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1431, 'n_words': 309}