]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/privatestreamexception.php
Note in the debug log if we render the HTML of a message
[quix0rs-gnu-social.git] / lib / privatestreamexception.php
1 <?php
2 if (!defined('GNUSOCIAL')) { exit(1); }
3
4 /**
5  * An exception for private streams
6  *
7  * @category  Exception
8  * @package   GNUsocial
9  * @author    Mikael Nordfeldth <mmn@hethane.se>
10  * @copyright 2016 Free Software Foundation, Inc.
11  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
12  */
13
14 class PrivateStreamException extends AuthorizationException
15 {
16     var $owner = null;  // owner of the private stream
17     var $reader = null; // reader, may be null if not logged in
18
19     public function __construct(Profile $owner, Profile $reader=null)
20     {
21         $this->owner = $owner;
22         $this->reader = $reader;
23
24         // TRANS: Message when a private stream attemps to be read by unauthorized third party.
25         $msg = sprintf(_m('This stream is protected and only authorized subscribers may see its contents.'));
26
27         // If $reader is a profile, authentication has been made but still not accepted (403),
28         // otherwise authentication may give access to this resource (401).
29         parent::__construct($msg, ($reader instanceof Profile ? 403 : 401));
30     }
31 }