This file is indexed.

/usr/share/php/Text/CAPTCHA/Driver/Word.php is in php-text-captcha 1.0.2-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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
 * Text_CAPTCHA_Driver_Word - Text_CAPTCHA driver word CAPTCHAs
 * Class to create a textual Turing test
 *
 * PHP version 5
 *
 * @category Text
 * @package  Text_CAPTCHA
 * @author   Tobias Schlitt <schlitt@php.net>
 * @author   Christian Wenz <wenz@php.net>
 * @author   Michael Cramer <michael@bigmichi1.de>
 * @license  http://www.opensource.org/licenses/bsd-license.php BSD License
 * @link     http://pear.php.net/package/Text_CAPTCHA
 */
require_once 'Text/CAPTCHA/Driver/Base.php';
require_once 'Numbers/Words.php';
/**
 * Require Numbers_Words class for generating the text.
 *
 * @category Text
 * @package  Text_CAPTCHA
 * @author   Tobias Schlitt <schlitt@php.net>
 * @author   Christian Wenz <wenz@php.net>
 * @author   Michael Cramer <michael@bigmichi1.de>
 * @license  http://www.opensource.org/licenses/bsd-license.php BSD License
 * @link     http://pear.php.net/package/Text_CAPTCHA
 */
class Text_CAPTCHA_Driver_Word extends Text_CAPTCHA_Driver_Base
{
    /**
     * Phrase length.
     * This variable holds the length of the Word.
     *
     * @var integer
     */
    private $_length;

    /**
     * Numbers_Words mode.
     * This variable holds the mode for Numbers_Words.
     *
     * @var String
     */
    private $_mode;

    /**
     * Locale
     * This variable holds the locale for Numbers_Words
     *
     * @var string
     */
    private $_locale;

    /**
     * Initializes the new Text_CAPTCHA_Driver_Word object.
     *
     * @param array $options CAPTCHA options with these keys:<br>
     *                       phrase  The "secret word" of the CAPTCHA<br>
     *                       length  The number of characters in the phrase<br>
     *                       locale  The locale for Numbers_Words<br>
     *                       mode    The mode for Numbers_Words
     *
     * @return void
     */
    public function initDriver($options = array())
    {
        if (isset($options['length']) && is_int($options['length'])) {
            $this->_length = $options['length'];
        } else {
            $this->_length = 4;
        }
        if (isset($options['phrase']) && !empty($options['phrase'])) {
            $this->setPhrase((string)$options['phrase']);
        } else {
            $this->createPhrase();
        }
        if (isset($options['mode']) && !empty($options['mode'])) {
            $this->_mode = $options['mode'];
        } else {
            $this->_mode = 'single';
        }
        if (isset($options['locale']) && !empty($options['locale'])) {
            $this->_locale = $options['locale'];
        } else {
            $this->_locale = 'en_US';
        }
    }

    /**
     * Create random CAPTCHA phrase, "Word edition" (numbers only).
     * This method creates a random phrase
     *
     * @return void
     */
    public function createPhrase()
    {
        $phrase = new Text_Password();
        $this->setPhrase(
            $phrase->create(
                $this->_length, 'unpronounceable', 'numeric'
            )
        );
    }

    /**
     * Place holder for the real _createCAPTCHA() method
     * used by extended classes to generate CAPTCHA from phrase
     *
     * @return void
     */
    public function createCAPTCHA()
    {
        $res = '';
        $numberWords = new Numbers_Words();
        $phrase = $this->getPhrase();
        if ($this->_mode == 'single') {
            $phraseArr = str_split($phrase);
            for ($i = 0; $i < strlen($phrase); $i++) {
                $res .= ' ' . $numberWords->toWords($phraseArr[$i], $this->_locale);
            }
        } else {
            $res = $numberWords->toWords($phrase, $this->_locale);
        }
        $this->setCaptcha($res);
    }
}