This file is indexed.

/usr/share/horde/nag/lib/QuickParser.php is in php-horde-nag 4.2.7-1ubuntu1.

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
<?php
class Nag_QuickParser
{
    protected $_indentStack;

    public function __construct($stack = null)
    {
        if ($stack === null) { $stack = new Horde_Support_Stack(); }
        $this->_indentStack = $stack;
    }

    public function parse($text)
    {
        $text = str_replace("\t", '    ', $text);
        $lines = preg_split('/[\r\n]+/', $text, -1, PREG_SPLIT_NO_EMPTY);

        $parents = array();
        $tasks = array();
        foreach ($lines as $line) {
            $line = rtrim($line);
            if (preg_match('/^\s*$/', $line)) { continue; }

            $indented = preg_match('/^([*-\s]+)(.*)$/', $line, $matches);
            if (!$indented) {
                $tasks[] = $line;
                $parents[$this->_indentStack->peek()] = count($tasks) - 1;
            } else {
                $line = $matches[2];
                $indent = strlen($matches[1]);
                if ($indent == $this->_indentStack->peek()) {
                    $parent = $parents[$this->_indentStack->peek(2)];
                    $tasks[] = array($line, 'parent' => $parent);
                } elseif ($indent > $this->_indentStack->peek()) {
                    $parent = $parents[$this->_indentStack->peek()];
                    $this->_indentStack->push($indent);
                    $tasks[] = array($line, 'parent' => $parent);
                    $parents[$this->_indentStack->peek()] = count($tasks) - 1;
                } else {
                    while ($this->_indentStack->pop() > $indent);

                    $parents[$indent] = $parents[$this->_indentStack->peek()];
                    $this->_indentStack->pop(); $this->_indentStack->push($indent);
                    $parent = $parents[$this->_indentStack->peek()];
                    if ($parent !== null) {
                        $tasks[] = array($line, 'parent' => $parent);
                    } else {
                        $tasks[] = $line;
                    }
                    $parents[$this->_indentStack->peek()] = count($tasks) - 1;
                }
            }
        }

        return $tasks;
    }
}