1<?php
2/**
3 * -----------------------------------------------------------------------
4 * vBSSO is a solution which helps you connect to different software platforms
5 * via secure Single Sign-On.
6 *
7 * Copyright (c) 2011-2017 vBSSO. All Rights Reserved.
8 * This software is the proprietary information of vBSSO.
9 *
10 * Author URI: http://www.vbsso.com
11 * License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12 * -----------------------------------------------------------------------
13 *
14 */
15
16require_once(dirname(__FILE__) . '/sharedapi.php');
17
18if (!defined('VBSSO_SHARED')) {
19    define ('VBSSO_PRODUCT_VERSION_1_4_13', '1.4.13');
20    define ('VBSSO_PRODUCT_VERSION_1_4_12', '1.4.12');
21    define ('VBSSO_PRODUCT_VERSION_1_4_11', '1.4.11');
22    define ('VBSSO_PRODUCT_VERSION_1_4_10', '1.4.10');
23    define ('VBSSO_PRODUCT_VERSION_1_4_9', '1.4.9');
24    define ('VBSSO_PRODUCT_VERSION_1_4_8', '1.4.8');
25    define ('VBSSO_PRODUCT_VERSION_1_4_7', '1.4.7');
26    define ('VBSSO_PRODUCT_VERSION_1_4_6', '1.4.6');
27    define ('VBSSO_PRODUCT_VERSION_1_4_5', '1.4.5');
28    define ('VBSSO_PRODUCT_VERSION_1_4_4', '1.4.4');
29    define ('VBSSO_PRODUCT_VERSION_1_4_3', '1.4.3');
30    define ('VBSSO_PRODUCT_VERSION_1_4_2', '1.4.2');
31    define ('VBSSO_PRODUCT_VERSION_1_4_1', '1.4.1');
32    define ('VBSSO_PRODUCT_VERSION_1_4', '1.4');
33    define ('VBSSO_PRODUCT_VERSION_1_3', '1.3');
34    define ('VBSSO_PRODUCT_VERSION_1_2', '1.2');
35    define ('VBSSO_PRODUCT_VERSION_1_1', '1.1');
36    define ('VBSSO_PRODUCT_VERSION_1_0', '1.0');
37
38    define ('VBSSO_SHARED', VBSSO_PRODUCT_VERSION_1_4_13);
39
40    define ('VBSSO_PRODUCT_ID', 'vbsso');
41    define ('VBSSO_PRODUCT_NAME', 'vBSSO');
42
43    /**
44     * Product Options.
45     */
46    define ('VBSSO_OPTIONS_CUSTOM_LOGIN_LINK', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'custom_login_link'));
47    define ('VBSSO_OPTIONS_CUSTOM_LOGOUT_LINK', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'custom_logout_link'));
48    define ('VBSSO_OPTIONS_CUSTOM_REGISTER_LINK', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'custom_register_link'));
49
50    define ('VBSSO_OPTIONS_PROFILE_FIELD_FIRST_NAME', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'profile_field_first_name'));
51    define ('VBSSO_OPTIONS_PROFILE_FIELD_LAST_NAME', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'profile_field_last_name'));
52    define ('VBSSO_OPTIONS_PROFILE_FIELD_COUNTRY', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'profile_field_country'));
53    define ('VBSSO_OPTIONS_PROFILE_FIELD_CITY', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'profile_field_city'));
54    define ('VBSSO_OPTIONS_PROFILE_FIELD_PHONE', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'profile_field_phone'));
55    define ('VBSSO_OPTIONS_PROFILE_FIELD_BIRTH', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'profile_field_birth'));
56
57    define ('VBSSO_OPTIONS_ALLOWED_USERGROUPS', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'allowed_usergroups'));
58    define ('VBSSO_OPTIONS_ASSOCIATED_USERGROUPS', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'associated_usergroups'));
59    define ('VBSSO_OPTIONS_LOGIN_ACCESS_SETTINGS', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'login_access_settings'));
60
61    define ('VBSSO_OPTIONS_LOGGING_MODE', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'logging_mode'));
62    define ('VBSSO_OPTIONS_LOGGING_LEVEL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'logging_level'));
63    define ('VBSSO_OPTIONS_LOGGING_EMAIL_NOTIFICATIONS', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'logging_email_notifications'));
64    define ('VBSSO_OPTIONS_LOGGING_EMAIL_NOTIFICATIONS_ADDRESSES', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'logging_email_notifications_addresses'));
65
66    /**
67     * Platform Config.
68     */
69    define ('VBSSO_CONFIG_PROPERTY_LOG', 'log');
70    define ('VBSSO_CONFIG_PROPERTY_SIMPLE_LOGGING', 'simple-logging');
71    define ('VBSSO_CONFIG_PROPERTY_OVERRIDE_LINKS', 'override-links');
72    define ('VBSSO_CONFIG_PROPERTY_VB_REGISTER_REDIRECT', 'vbulletin-registration-redirect');
73
74    /**
75     * Platform Errors.
76     */
77    define ('VBSSO_PLATFORM_ERROR_DISABLED', 'You are trying to connect a platform where vBSSO extension is disabled. Please enable vBSSO extension on that platform and try again.');
78
79    /**
80     * Footer Link Options.
81     */
82    define ('VBSSO_PLATFORM_DESCRIPTION_HTML', 'Provides universal Secure Single Sign-On between vBulletin and different popular platforms. The product provided by <a href="http://www.vbsso.com/">' . VBSSO_PRODUCT_NAME . '.</a>');
83
84    define ('VBSSO_PLATFORM_FOOTER_LINK_PROPERTY', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'footer_link'));
85    define ('VBSSO_PLATFORM_FOOTER_LINK_DESCRIPTION_HTML', 'To remove the footer link back to this project, you may purchase a <a href="http://www.vbsso.com/documentation/#remove-footer-link">Branding Free license</a>. Your support is used to maintain this project.');
86    define ('VBSSO_PLATFORM_FOOTER_LINK_HTML', '<div align="center" style="z-index: 3;color: #777777;clear:both; position: relative;">Single Sign On provided by <a href="http://www.vbsso.com/">vBSSO</a></div>');
87
88
89    define ('VBSSO_PLATFORM_FOOTER_GA_HTML', "<script type=\"text/javascript\"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-25094208-2']); /*_gaq.push(['_trackPageview']);*/ /*track_event_marker*/ (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>\n");
90    function VBSSO_PLATFORM_FOOTER_GA_HTML($platforms, $action = '') {
91        $platforms = (is_array($platforms)) ? $platforms : array($platforms);
92        if (!empty($action)) {
93            switch ($action) {
94                case ('login'):
95                    $action = 'A/';
96                    break;
97                case ('register'):
98                    $action = 'R/';
99            }
100        }
101
102        $ga_code = VBSSO_PLATFORM_FOOTER_GA_HTML;
103        $marker = '/*track_event_marker*/';
104
105        foreach ($platforms as $platform) {
106            $ga_code = str_replace($marker, '_gaq.push([\'_trackEvent\', \'' . $action . $platform . '\', window.location.host, window.location.href]); ' . $marker, $ga_code);
107        }
108
109        return str_replace($marker, '', $ga_code);
110    }
111
112    define ('VBSSO_PLATFORM_FOOTER_LINK_SHOW_NONE', 0);
113    define ('VBSSO_PLATFORM_FOOTER_LINK_SHOW_EVERYWHERE', 1);
114    define ('VBSSO_PLATFORM_FOOTER_LINK_SHOW_ADMIN', 2);
115
116    function vbsso_get_platform_footer_link_options() {
117        return array(
118//            VBSSO_PLATFORM_FOOTER_LINK_SHOW_ADMIN => 'I want to evaluate it first (don\'t show the link for the public)',
119            VBSSO_PLATFORM_FOOTER_LINK_SHOW_EVERYWHERE => 'Show',
120            VBSSO_PLATFORM_FOOTER_LINK_SHOW_NONE => 'Don\'t show (I have already purchased branding Free license)',
121        );
122    }
123
124    /**
125     * Event Fields.
126     */
127    define ('VBSSO_NAMED_EVENT_FIELD_API_KEY', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_API_KEY));
128    define ('VBSSO_NAMED_EVENT_FIELD_API_KEY_TITLE', 'Platform Shared Key');
129    define ('VBSSO_NAMED_EVENT_FIELD_API_KEY_WARNING', 'Please unconnect this platform to change shared key');
130
131    define ('VBSSO_NAMED_EVENT_FIELD_LID', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_LID));
132    define ('VBSSO_NAMED_EVENT_FIELD_LID_TITLE', 'Plugin Id');
133
134    define ('VBSSO_NAMED_EVENT_FIELD_LISTENER_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_LISTENER_URL));
135    define ('VBSSO_NAMED_EVENT_FIELD_LISTENER_URL_TITLE', 'Platform Address');
136
137    define ('VBSSO_NAMED_EVENT_FIELD_TIMEOUT', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_TIMEOUT));
138    define ('VBSSO_NAMED_EVENT_FIELD_MUID', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_MUID));
139
140    define ('VBSSO_NAMED_EVENT_FIELD_LOGIN_THROUGH_VB_PAGE', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'login_through_vb_page'));
141    define ('VBSSO_NAMED_EVENT_FIELD_LOGIN_THROUGH_VB_PAGE_TITLE', 'Login Through vBulletin Page');
142
143    define ('VBSSO_NAMED_EVENT_FIELD_SHOW_VBULLETIN_AUTHOR_PROFILE', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'vb_author_profile_url'));
144    define ('VBSSO_NAMED_EVENT_FIELD_SHOW_VBULLETIN_AUTHOR_PROFILE_TITLE', 'View Member Profile in vBulletin');
145
146    define ('VBSSO_NAMED_EVENT_FIELD_EDIT_MEMBER_PROFILE_IN_VBULLETIN', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'edit_member_profile_in_vbulletin'));
147    define ('VBSSO_NAMED_EVENT_FIELD_EDIT_MEMBER_PROFILE_IN_VBULLETIN_TITLE', 'Edit Member Profile in vBulletin');
148
149    define ('VBSSO_NAMED_EVENT_FIELD_EDIT_PROFILE_IN_VBULLETIN', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'edit_profile_in_vbulletin'));
150    define ('VBSSO_NAMED_EVENT_FIELD_EDIT_PROFILE_IN_VBULLETIN_TITLE', 'Edit Profile in vBulletin');
151
152    define ('VBSSO_NAMED_EVENT_FIELD_SHOW_VBULLETIN_PROFILE', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'vb_profile_url'));
153    define ('VBSSO_NAMED_EVENT_FIELD_SHOW_VBULLETIN_PROFILE_TITLE', 'View My Profile in vBulletin');
154
155    define ('VBSSO_NAMED_EVENT_FIELD_FETCH_AVATARS', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'fetch_avatars'));
156    define ('VBSSO_NAMED_EVENT_FIELD_FETCH_AVATARS_TITLE', 'Fetch and Show vBulletin Avatars');
157
158    define ('VBSSO_NAMED_EVENT_FIELD_SHOW_LOGIN_FORM_WIDGET', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'login_form_widget'));
159    define ('VBSSO_NAMED_EVENT_FIELD_SHOW_LOGIN_FORM_WIDGET_TITLE', 'Show vBSSO Login Form Widget');
160
161    define ('VBSSO_NAMED_EVENT_FIELD_ADMINISTRATOR_ROLE_NAME', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'admin_role_name'));
162    define ('VBSSO_NAMED_EVENT_FIELD_ADMINISTRATOR_ROLE_NAME_TITLE', 'Name of Administrator Role');
163
164    define ('VBSSO_NAMED_EVENT_FIELD_USERGROUPS_ASSOC', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, 'usergroups_assoc'));
165    define ('VBSSO_NAMED_EVENT_FIELD_USERGROUPS_ASSOC_TITLE', 'Usergroups Associations');
166
167    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_FIELDS', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_PROFILE_FIELDS));
168    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_FIRST_NAME', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_PROFILE_FIRST_NAME));
169    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_LAST_NAME', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_PROFILE_LAST_NAME));
170    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_COUNTRY', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_PROFILE_COUNTRY));
171    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_CITY', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_PROFILE_CITY));
172    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_PHONE', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_PROFILE_PHONE));
173    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_BIRTH', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_PROFILE_BIRTH));
174
175    define ('VBSSO_NAMED_EVENT_FIELD_LOGIN_VBULLETIN_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_LOGIN_VBULLETIN_URL));
176    define ('VBSSO_NAMED_EVENT_FIELD_LOGIN_VBULLETIN_URL_TITLE', 'Login vBulletin Url');
177
178    define ('VBSSO_NAMED_EVENT_FIELD_LOGIN_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_LOGIN_URL));
179    define ('VBSSO_NAMED_EVENT_FIELD_LOGIN_URL_TITLE', 'Login Url');
180
181    define ('VBSSO_NAMED_EVENT_FIELD_LOGOUT_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_LOGOUT_URL));
182    define ('VBSSO_NAMED_EVENT_FIELD_LOGOUT_URL_TITLE', 'Logout Url');
183
184    define ('VBSSO_NAMED_EVENT_FIELD_REGISTER_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_REGISTER_URL));
185    define ('VBSSO_NAMED_EVENT_FIELD_REGISTER_URL_TITLE', 'Register Url');
186
187    define ('VBSSO_NAMED_EVENT_FIELD_LOSTPASSWORD_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_LOSTPASSWORD_URL));
188    define ('VBSSO_NAMED_EVENT_FIELD_LOSTPASSWORD_URL_TITLE', 'Lost Password Url');
189
190    define ('VBSSO_NAMED_EVENT_FIELD_AVATAR_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_AVATAR_URL));
191    define ('VBSSO_NAMED_EVENT_FIELD_AVATAR_URL_TITLE', 'Avatar Url');
192
193    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_PROFILE_URL));
194    define ('VBSSO_NAMED_EVENT_FIELD_PROFILE_URL_TITLE', 'Profile Url');
195
196    define ('VBSSO_NAMED_EVENT_FIELD_USERGROUPS_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_USERGROUPS_URL));
197    define ('VBSSO_NAMED_EVENT_FIELD_USERGROUPS_URL_TITLE', 'Get User Groups Url');
198
199    define ('VBSSO_NAMED_EVENT_FIELD_BAA_USERNAME', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_BAA_USERNAME));
200    define ('VBSSO_NAMED_EVENT_FIELD_BAA_USERNAME_TITLE', 'Basic access authentication username');
201
202    define ('VBSSO_NAMED_EVENT_FIELD_BAA_PASSWORD', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_BAA_PASSWORD));
203    define ('VBSSO_NAMED_EVENT_FIELD_BAA_PASSWORD_TITLE', 'Basic access authentication password');
204
205    define ('VBSSO_NAMED_EVENT_FIELD_USER_UNREAD_STATS_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_USER_UNREAD_STATS_URL));
206    define ('VBSSO_NAMED_EVENT_FIELD_USER_UNREAD_STATS_URL_TITLE', 'Unread Stats Url');
207
208    define ('VBSSO_NAMED_EVENT_FIELD_STATS_URL', SHAREDAPI_NAME_DEFINITION(VBSSO_PRODUCT_ID, SHAREDAPI_EVENT_FIELD_STATS_URL));
209    define ('VBSSO_NAMED_EVENT_FIELD_STATS_URL_TITLE', 'Stats Url');
210
211    /*
212     * Platform Configuration methods.
213     */
214    function vbsso_get_platform_config($platform) {
215        static $config = array();
216
217        if (!isset($config[$platform]) || $config[$platform] === NULL) {
218            $platforms_ids = sharedapi_get_platforms_ids();
219
220            $config[$platform] = array(
221                VBSSO_CONFIG_PROPERTY_LOG => TRUE,
222                VBSSO_CONFIG_PROPERTY_OVERRIDE_LINKS => TRUE,
223                VBSSO_CONFIG_PROPERTY_SIMPLE_LOGGING => FALSE,
224                VBSSO_CONFIG_PROPERTY_VB_REGISTER_REDIRECT => FALSE
225            );
226
227            $cfg = array();
228            $platform_id = isset($platforms_ids[$platform]) ? $platforms_ids[$platform] : NULL;
229
230            if (count($cfg)) {
231                $config[$platform] = array_merge($config[$platform], $cfg);
232            }
233
234            if ($platform_id && function_exists('vbsso_get_' . $platform_id . '_custom_config')) {
235                $custom_config = call_user_func('vbsso_get_' . $platform_id . '_custom_config');
236                $config[$platform] = array_merge($config[$platform], $custom_config);
237            }
238        }
239
240        return $config[$platform];
241    }
242
243    function vbsso_get_platform_config_property($platform, $property, $default = '') {
244        static $config_platform;
245
246        if (!isset($config_platform[$platform])) {
247            $config_platform[$platform] = vbsso_get_platform_config($platform);
248        }
249
250        $config = $config_platform[$platform];
251        return isset($config[$property]) ? $config[$property] : $default;
252    }
253
254    function vbsso_get_supported_api_properties() {
255        static $properties;
256
257        if (!$properties) {
258            $properties = array(
259                VBSSO_NAMED_EVENT_FIELD_LID => array('field' => SHAREDAPI_EVENT_FIELD_LID, 'title' => VBSSO_NAMED_EVENT_FIELD_LID_TITLE),
260                VBSSO_NAMED_EVENT_FIELD_LOGIN_VBULLETIN_URL => array('field' => SHAREDAPI_EVENT_FIELD_LOGIN_VBULLETIN_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_LOGIN_VBULLETIN_URL_TITLE),
261                VBSSO_NAMED_EVENT_FIELD_LOGIN_URL => array('field' => SHAREDAPI_EVENT_FIELD_LOGIN_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_LOGIN_URL_TITLE),
262                VBSSO_NAMED_EVENT_FIELD_LOGOUT_URL => array('field' => SHAREDAPI_EVENT_FIELD_LOGOUT_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_LOGOUT_URL_TITLE),
263                VBSSO_NAMED_EVENT_FIELD_REGISTER_URL => array('field' => SHAREDAPI_EVENT_FIELD_REGISTER_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_REGISTER_URL_TITLE),
264                VBSSO_NAMED_EVENT_FIELD_LOSTPASSWORD_URL => array('field' => SHAREDAPI_EVENT_FIELD_LOSTPASSWORD_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_LOSTPASSWORD_URL_TITLE),
265                VBSSO_NAMED_EVENT_FIELD_AVATAR_URL => array('field' => SHAREDAPI_EVENT_FIELD_AVATAR_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_AVATAR_URL_TITLE),
266                VBSSO_NAMED_EVENT_FIELD_PROFILE_URL => array('field' => SHAREDAPI_EVENT_FIELD_PROFILE_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_PROFILE_URL_TITLE),
267                VBSSO_NAMED_EVENT_FIELD_USERGROUPS_URL => array('field' => SHAREDAPI_EVENT_FIELD_USERGROUPS_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_USERGROUPS_URL_TITLE),
268                VBSSO_NAMED_EVENT_FIELD_BAA_USERNAME => array('field' => SHAREDAPI_EVENT_FIELD_BAA_USERNAME, 'title' => VBSSO_NAMED_EVENT_FIELD_BAA_USERNAME_TITLE),
269                VBSSO_NAMED_EVENT_FIELD_BAA_PASSWORD => array('field' => SHAREDAPI_EVENT_FIELD_BAA_PASSWORD, 'title' => VBSSO_NAMED_EVENT_FIELD_BAA_PASSWORD_TITLE),
270                VBSSO_NAMED_EVENT_FIELD_USER_UNREAD_STATS_URL => array('field' => SHAREDAPI_EVENT_FIELD_USER_UNREAD_STATS_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_USER_UNREAD_STATS_URL_TITLE),
271                VBSSO_NAMED_EVENT_FIELD_STATS_URL => array('field' => SHAREDAPI_EVENT_FIELD_STATS_URL, 'title' => VBSSO_NAMED_EVENT_FIELD_STATS_URL_TITLE)
272            );
273        }
274
275        return $properties;
276    }
277
278    /*
279     * Supported profile fields.
280     */
281    function vbsso_get_supported_profile_fields() {
282        return array(
283            SHAREDAPI_EVENT_FIELD_PROFILE_FIRST_NAME => VBSSO_OPTIONS_PROFILE_FIELD_FIRST_NAME,
284            SHAREDAPI_EVENT_FIELD_PROFILE_LAST_NAME => VBSSO_OPTIONS_PROFILE_FIELD_LAST_NAME,
285            SHAREDAPI_EVENT_FIELD_PROFILE_COUNTRY => VBSSO_OPTIONS_PROFILE_FIELD_COUNTRY,
286            SHAREDAPI_EVENT_FIELD_PROFILE_CITY => VBSSO_OPTIONS_PROFILE_FIELD_CITY,
287            SHAREDAPI_EVENT_FIELD_PROFILE_PHONE => VBSSO_OPTIONS_PROFILE_FIELD_PHONE,
288            SHAREDAPI_EVENT_FIELD_PROFILE_BIRTH => VBSSO_OPTIONS_PROFILE_FIELD_BIRTH,
289        );
290    }
291
292    /*
293     * Verification methods.
294     */
295    function vbsso_verify_loaded_extensions() {
296        $extensions = array('curl', 'mcrypt', 'zip');
297
298        $nloaded = array();
299        foreach ($extensions as $extension) {
300            if (!extension_loaded($extension)) {
301                $nloaded[] = $extension;
302            }
303        }
304
305        return $nloaded;
306    }
307
308    function vbsso_get_final_destination($event) {
309        return sharedapi_get_final_destination(VBSSO_PRODUCT_ID, $event);
310    }
311
312    function vbsso_get_destination($event, $r = 'r', $reset = FALSE) {
313        return sharedapi_get_destination(VBSSO_PRODUCT_ID, $event, $r, $reset);
314    }
315
316    function vbsso_get_final_lid($event) {
317        return sharedapi_get_final_lid(VBSSO_PRODUCT_ID, $event);
318    }
319
320    function vbsso_get_lid($event, $r = 'r', $reset = FALSE) {
321        return sharedapi_get_lid(VBSSO_PRODUCT_ID, $event, $r, $reset);
322    }
323
324    function vbsso_capture_destination($event) {
325        sharedapi_capture_destination(VBSSO_PRODUCT_ID, $event, VBSSO_PRODUCT_API_PATH);
326    }
327
328    function vbsso_log($data, $file = 'default', $path = NULL) {
329        if (vbsso_get_platform_config_property(SHAREDAPI_PLATFORM_VBULLETIN, VBSSO_CONFIG_PROPERTY_LOG, TRUE)) {
330            sharedapi_log($data, $file == 'default' ? 'vbsso_' . date('Y-m-d', time()) . '.log' : $file, $path);
331        }
332    }
333}