This file is indexed.

/usr/share/pnopaste/lib/Format.pm is in pnopaste 1.4-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package Format;

# This file is part of the pnopaste program
# Copyright (C) 2008-2010 Patrick Matthäi <pmatthaei@debian.org>
#
# This program 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.

use warnings;
use strict;
use lib::Highlighting;


### Build line numbers in html.
sub Build_Line_Numbers {
	my($Count) = @_;

	my $String = '';

	# Build $Count anker elements and return them.
	for(my $x = 1; $x <= $Count; $x++){
		$String .= '<a id="line' . $x . '">' . $x . ':</a>' . "\n";
	}

	$String =~ s/\n$//;

	return $String;
}


### Reformat the text for html.
sub To_HTML {
	my($Input, $Language, $Syntax_HL) = @_;

	my $Return = '';


	if($Language eq 'Plain'){
		$Syntax_HL = 0;
	}
	elsif($Syntax_HL == 1){
		Highlighting::Language($Language);
	}

	# We need the numbers of lines.
	my @Walk;
	push(@Walk, $_) for split m!\n! => $Input;


	if($Syntax_HL){
		# Use the highlighting engine.
		$Return = Highlighting::Highlight($Input);
	}
	else {

		foreach my $Line (@Walk){
			$Line =~ s/\r//g;
			$Line =~ s/&/&amp;/g;
			# Do some html enties.
			$Line =~ s/</&lt;/g;
			$Line =~ s/>/&gt;/g;
			$Line =~ s/"/&quot;/g;

			# Add to string.
			if(defined $Line){
				$Return .= $Line . "\n";
			}
		}
	}


	$Return =~ s/\n$//;

	return(scalar(@Walk), $Return);
}

1;