This file is indexed.

/usr/share/php/Horde/Service/Twitter/Request/Oauth.php is in php-horde-service-twitter 2.1.1-1.

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
<?php
/**
 * Horde_Service_Twitter_Request_Oauth class wraps sending requests to Twitter's
 * REST API using OAuth authentication.
 *
 * Copyright 2009-2013 Horde LLC (http://www.horde.org/)
 *
 * @author Michael J. Rubinsky <mrubinsk@horde.org>
 * @license  http://www.horde.org/licenses/bsd BSD
 * @category Horde
 * @package Service_Twitter
 */
class Horde_Service_Twitter_Request_Oauth extends Horde_Service_Twitter_Request
{
    /**
     * Perform a GET request with OAuth authorization.
     *
     * @param mixed (string | Horde_Url) $url  The url to request.
     * @param array  $params                   URL parameters.
     *
     * @return string  Call results.
     * @throws Horde_Service_Twitter_Exception
     */
    public function get($url, array $params = array())
    {
        $key = md5($url . 'get' . serialize($params) . serialize($this->_twitter->auth->getAccessToken($this->_request)));
        $cache = $this->_twitter->responseCache;
        if (!empty($cache) && $results = $cache->get($key, $this->_twitter->cacheLifetime)) {
            return $results;
        }
        $request = new Horde_Oauth_Request($url, $params, 'GET');
        $request->sign($this->_twitter->auth->oauth->signatureMethod,
                       $this->_twitter->auth->oauth,
                       $this->_twitter->auth->getAccessToken($this->_request));
        $url = ($url instanceof Horde_Url) ? $url : new Horde_Url($url);
        $url->add($params);
        try {
            $response = $this->_twitter->getHttpClient()->get($url->setRaw(true), array('Authorization' => $request->buildAuthorizationHeader('Twitter API')));
        } catch (Horde_Http_Exception $e) {
            throw new Horde_Service_Twitter_Exception($e);
        }

        // Looks like some of the http clients (like Fopen) will thrown an
        // exception if we try to read an empty stream. Ignore this.
        try {
            $body = $response->getBody();
            if ($response->code >= 400 && $response->code <= 500) {
                throw new Horde_Service_Twitter_Exception($body);
            }
        } catch (Horde_Http_Exception $e) {}

        if (!empty($cache)) {
            $cache->set($key, $body);
        }

        return $body;
    }

    /**
     * Send a POST request to the twitter API. Purposely do not cache results
     * from these since POST requests alter data on the server.
     *
     * @see self::get
     */
    public function post($url, array $params = array())
    {
        $request = new Horde_Oauth_Request($url, $params);
        $request->sign($this->_twitter->auth->oauth->signatureMethod,
                       $this->_twitter->auth->oauth,
                       $this->_twitter->auth->getAccessToken($this->_request));
        $url = ($url instanceof Horde_Url) ? $url : new Horde_Url($url);
        try {
            $response = $this->_twitter->getHttpClient()->post($url->setRaw(true), $params, array('Authorization' => $request->buildAuthorizationHeader('Twitter API')));
        } catch (Horde_Http_Exception $e) {
            throw new Horde_Service_Twitter_Exception($e);
        }

        if ($response->code >= 400 && $response->code <= 500) {
            throw new Horde_Service_Twitter_Exception($response->getBody());
        }
        return $response->getBody();
    }

}