]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/ExtendedProfile/ExtendedProfilePlugin.php
XSS vulnerability when remote-subscribing
[quix0rs-gnu-social.git] / plugins / ExtendedProfile / ExtendedProfilePlugin.php
1 <?php
2 /*
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2011, StatusNet, Inc.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 if (!defined('STATUSNET')) {
21     exit(1);
22 }
23
24 /**
25  * Extra profile bio-like fields
26  *
27  * @package ExtendedProfilePlugin
28  * @maintainer Brion Vibber <brion@status.net>
29  */
30 class ExtendedProfilePlugin extends Plugin
31 {
32     function onPluginVersion(array &$versions)
33     {
34         $versions[] = array(
35             'name' => 'ExtendedProfile',
36             'version' => GNUSOCIAL_VERSION,
37             'author' => 'Brion Vibber, Samantha Doherty, Zach Copley',
38             'homepage' => 'http://status.net/wiki/Plugin:ExtendedProfile',
39             // TRANS: Plugin description.
40             'rawdescription' => _m('UI extensions for additional profile fields.')
41         );
42
43         return true;
44     }
45
46     /**
47      * Add paths to the router table
48      *
49      * Hook for RouterInitialized event.
50      *
51      * @param URLMapper $m URL mapper
52      *
53      * @return boolean hook return
54      */
55     public function onStartInitializeRouter(URLMapper $m)
56     {
57         $m->connect(
58             ':nickname/detail',
59             array('action' => 'profiledetail'),
60             array('nickname' => Nickname::DISPLAY_FMT)
61         );
62         $m->connect(
63             '/settings/profile/finduser',
64             array('action' => 'Userautocomplete')
65         );
66         $m->connect(
67             'settings/profile/detail',
68             array('action' => 'profiledetailsettings')
69         );
70
71         return true;
72     }
73
74     function onCheckSchema()
75     {
76         $schema = Schema::get();
77         $schema->ensureTable('profile_detail', Profile_detail::schemaDef());
78
79         return true;
80     }
81
82     function onEndShowAccountProfileBlock(HTMLOutputter $out, Profile $profile) {
83         $user = User::getKV('id', $profile->id);
84         if ($user) {
85             $url = common_local_url('profiledetail', array('nickname' => $user->nickname));
86             // TRANS: Link text on user profile page leading to extended profile page.
87             $out->element('a', array('href' => $url, 'class' => 'profiledetail'), _m('More details...'));
88         }
89     }
90 }