Merge lp:~ubuntuforums-devel/vbulletin-launchpad-integration/version4-fixes into lp:vbulletin-launchpad-integration
- version4-fixes
- Merge into trunk
Proposed by
kyleabaker
Status: | Needs review |
---|---|
Proposed branch: | lp:~ubuntuforums-devel/vbulletin-launchpad-integration/version4-fixes |
Merge into: | lp:vbulletin-launchpad-integration |
Diff against target: |
632 lines (+299/-243) 6 files modified
install.txt (+24/-7) product-launchpad.xml (+75/-77) upload/launchpad_add_signin_link.php (+12/-9) upload/launchpad_editprofile.php (+74/-51) upload/launchpad_login.php (+69/-62) upload/launchpad_sync_userinfo.php (+45/-37) |
To merge this branch: | bzr merge lp:~ubuntuforums-devel/vbulletin-launchpad-integration/version4-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Canonical ISD hackers | Pending | ||
Review via email:
|
Commit message
Description of the change
vBulletin 4 fixes
To post a comment you must log in.
Unmerged revisions
- 2. By kyleabaker
-
vBulletin 4 fixes
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'install.txt' |
2 | --- install.txt 2012-07-23 16:23:56 +0000 |
3 | +++ install.txt 2012-11-01 18:26:19 +0000 |
4 | @@ -4,6 +4,7 @@ |
5 | # -----------------------------------------------------------------------------# |
6 | # |
7 | # Copyright 2009 Anthony Lenton |
8 | +# Copyright 2012 Kyle Baker |
9 | # Copyright 2012 Canonical |
10 | # |
11 | # This file is part of vbulletin-launchpad-integration. |
12 | @@ -21,14 +22,30 @@ |
13 | # You should have received a copy of the GNU Lesser Public License |
14 | # along with vbulletin-launchpad-integration. If not, see <http://www.gnu.org/licenses/>. |
15 | |
16 | -1- Install the OpenID product. Follow the instructions from its install.txt, |
17 | +1) Install the vBulletin OpenID product. Follow the instructions from its install.txt, |
18 | except for any modifications to the templates. (It's not necessary to |
19 | manually modify the templates as this product takes care of that |
20 | automatically). |
21 | |
22 | -2- install product-launchpad.xml using the admin Product Manager insterface |
23 | - |
24 | -3- Go to the OpenID settings group in the vBulletin options section and |
25 | - check that you have a couple of new options ther. Configure apropriately. |
26 | - |
27 | - |
28 | +2) Install product-launchpad.xml using the vBulletin Product Manager: |
29 | + - Log in to the Admin Control Panel in vBulletin 4.x. |
30 | + - In the left panel, find 'Plugins & Products' near the bottom |
31 | + and click the arrow to expand. |
32 | + - Once expanded, click 'Manage Products'. |
33 | + - From this page, find '[Add/Import Product]' at the bottom of |
34 | + the Installed Products section and click it. |
35 | + - Under 'Import Product', select 'Choose File' and browse through |
36 | + the vBulletin Launchpad Integration installation files for |
37 | + 'product-launchpad.xml' and open it. |
38 | + - Click 'Import'. |
39 | + |
40 | +3) Upload vBulletin Launchpad Integration files: |
41 | + - From the installation vBulletin Launchpad Integration files, find |
42 | + the directory labeled 'upload'. |
43 | + - Upload the contents of the 'upload' directory to the base directory |
44 | + of your vBulletin 4.x installation. |
45 | + |
46 | +3) Go to the OpenID settings group in the vBulletin options section and |
47 | + check that you have a couple of new options there. Configure apropriately. |
48 | + |
49 | +Congratulations! Installation is complete! |
50 | |
51 | === modified file 'product-launchpad.xml' |
52 | --- product-launchpad.xml 2012-07-23 16:23:56 +0000 |
53 | +++ product-launchpad.xml 2012-11-01 18:26:19 +0000 |
54 | @@ -1,6 +1,8 @@ |
55 | <?xml version="1.0" encoding="ISO-8859-1"?> |
56 | + |
57 | <!-- |
58 | Copyright 2009 Anthony Lenton |
59 | +Copyright 2012 Kyle Baker |
60 | Copyright 2012 Canonical |
61 | |
62 | This file is part of vbulletin-launchpad-integration. |
63 | @@ -18,82 +20,78 @@ |
64 | You should have received a copy of the GNU Lesser Public License |
65 | along with vbulletin-launchpad-integration. If not, see <http://www.gnu.org/licenses/>. |
66 | --> |
67 | + |
68 | <product productid="launchpad" active="1"> |
69 | - <title>Launchpad Login</title> |
70 | - <description>Launchpad integration product</description> |
71 | - <version>1.0.0</version> |
72 | - <url>https://code.launchpad.net/~sfi-team/canonical-bis-openid/vbulletin-openid</url> |
73 | - <versioncheckurl /> |
74 | - <dependencies> |
75 | - <dependency dependencytype="product" parentproductid="openid" |
76 | - minversion="1.0.0" maxversion="" /> |
77 | - </dependencies> |
78 | - <codes> |
79 | - <code version="1.0.0"> |
80 | - <installcode><![CDATA[ |
81 | - |
82 | -]]></installcode> |
83 | - </code> |
84 | - </codes> |
85 | - <templates> |
86 | - <template name="launchpad_profile_fieldset" templatetype="template" username="achuni" version="1.0.0"><![CDATA[ |
87 | -<fieldset class="fieldset"> |
88 | - <legend>Launchpad OpenID</legend> |
89 | - <table cellpadding="0" cellspacing="3" border="0" width="100%"> |
90 | - <tr><td> |
91 | - <if condition="$current_openid_url">Your current Launchpad OpenID url is: |
92 | - <pre style="background-color:#ddd;padding:5px">$current_openid_url</pre></if> |
93 | - </td></tr> |
94 | - <tr><td><a href="launchpad_login.php?do=editprofile">Click here</a> |
95 | - to update your Launchpad OpenID</td></tr> |
96 | - </table> |
97 | -</fieldset> |
98 | -]]></template> |
99 | - </templates> |
100 | - <plugins> |
101 | - <plugin active="1"> |
102 | - <title>Edit Launchpad OpenID</title> |
103 | - <hookname>profile_complete</hookname> |
104 | - <phpcode><![CDATA[include('launchpad_editprofile.php');]]></phpcode> |
105 | - </plugin> |
106 | - |
107 | - <plugin active="1"> |
108 | - <title>Add Launchpad signin link</title> |
109 | - <hookname>global_setup_complete</hookname> |
110 | - <phpcode><![CDATA[include('launchpad_add_signin_link.php');]]></phpcode> |
111 | - </plugin> |
112 | - |
113 | - <plugin active="1"> |
114 | - <title>Sync Launchpad User Info</title> |
115 | - <hookname>login_process</hookname> |
116 | - <phpcode><![CDATA[include('launchpad_sync_userinfo.php');]]></phpcode> |
117 | - </plugin> |
118 | - </plugins> |
119 | - <phrases> |
120 | - <phrasetype name="vBulletin Settings" fieldname="vbsettings"> |
121 | - <phrase name="setting_launchpad_sync_desc"><![CDATA[Keep usernames and emails in sync with Launchpad]]></phrase> |
122 | - <phrase name="setting_launchpad_sync_title"><![CDATA[Keep in sync with Launchpad]]></phrase> |
123 | - <phrase name="setting_launchpad_provider_title"><![CDATA[Launchpad OpenID Provider]]></phrase> |
124 | - <phrase name="setting_launchpad_provider_desc"><![CDATA[The URL of Launchpad's OpenID provider. This should only be changed for testing.]]></phrase> |
125 | - </phrasetype> |
126 | - </phrases> |
127 | - <options> |
128 | - <settinggroup name="openid" displayorder="999"> |
129 | - <setting varname="launchpad_sync" displayorder="1"> |
130 | - <datatype>boolean</datatype> |
131 | - <optioncode>yesno</optioncode> |
132 | - <defaultvalue>1</defaultvalue> |
133 | - </setting> |
134 | - <setting varname="launchpad_provider" displayorder="2"> |
135 | - <datatype>free</datatype> |
136 | - <defaultvalue>https://login.launchpad.net</defaultvalue> |
137 | - </setting> |
138 | - </settinggroup> |
139 | - </options> |
140 | - <helptopics> |
141 | - </helptopics> |
142 | - <cronentries> |
143 | - </cronentries> |
144 | - <faqentries> |
145 | - </faqentries> |
146 | + <title>Launchpad Login</title> |
147 | + <description>Launchpad Integration</description> |
148 | + <version>1.0.0</version> |
149 | + <url>https://code.launchpad.net/~sfi-team/canonical-bis-openid/vbulletin-openid</url> |
150 | + <versioncheckurl/> |
151 | + <dependencies> |
152 | + <dependency dependencytype="vbulletin" minversion="4.2.0" maxversion=""/> |
153 | + <dependency dependencytype="product" parentproductid="openid" minversion="1.0.0" maxversion=""/> |
154 | + </dependencies> |
155 | + <codes> |
156 | + <code version="1.0.0"> |
157 | + <installcode><![CDATA[ |
158 | + |
159 | + ]]></installcode> |
160 | + </code> |
161 | + </codes> |
162 | + <templates> |
163 | + <template name="launchpad_profile_fieldset" templatetype="template" username="achuni" version="1.0.0"> |
164 | + <![CDATA[ |
165 | +<div class="blockrow"> |
166 | + <label>Launchpad OpenID:</label> |
167 | + <div class="rightcol"> |
168 | + <vb:if condition="$current_openid_url"><input type="text" class="primary textbox" name="userfield[field{vb:raw userfield_number}]" id="cfield_{vb:raw userfield_number}" value="{vb:raw current_openid_url}" maxlength="100" tabindex="1" /></vb:if> |
169 | + <p class="description"><vb:if condition="$current_openid_url">Your<vb:else />You've not setup your</vb:if> Launchpad OpenID (<a href="launchpad_login.php?do=editprofile">Click here</a> to update)</p> |
170 | + <input type="hidden" name="userfield[field{vb:raw userfield_number}_set]" value="1" /> |
171 | + </div> |
172 | +</div> |
173 | + ]]></template> |
174 | + </templates> |
175 | + <plugins> |
176 | + <plugin active="1"> |
177 | + <title>Edit Launchpad OpenID</title> |
178 | + <hookname>profile_fetch_profilefields</hookname> |
179 | + <phpcode><![CDATA[include('launchpad_editprofile.php');]]></phpcode> |
180 | + </plugin> |
181 | + |
182 | + <plugin active="1"> |
183 | + <title>Add Launchpad signin link</title> |
184 | + <hookname>global_setup_complete</hookname> |
185 | + <phpcode><![CDATA[include('launchpad_add_signin_link.php');]]></phpcode> |
186 | + </plugin> |
187 | + |
188 | + <plugin active="1"> |
189 | + <title>Sync Launchpad User Info</title> |
190 | + <hookname>login_process</hookname> |
191 | + <phpcode><![CDATA[include('launchpad_sync_userinfo.php');]]></phpcode> |
192 | + </plugin> |
193 | + </plugins> |
194 | + <phrases> |
195 | + <phrasetype name="vBulletin Settings" fieldname="vbsettings"> |
196 | + <phrase name="setting_launchpad_sync_desc"><![CDATA[Keep usernames and emails in sync with Launchpad]]></phrase> |
197 | + <phrase name="setting_launchpad_sync_title"><![CDATA[Keep in sync with Launchpad]]></phrase> |
198 | + <phrase name="setting_launchpad_provider_title"><![CDATA[Launchpad OpenID Provider]]></phrase> |
199 | + <phrase name="setting_launchpad_provider_desc"><![CDATA[The URL of Launchpad's OpenID provider. This should only be changed for testing.]]></phrase> |
200 | + </phrasetype> |
201 | + </phrases> |
202 | + <options> |
203 | + <settinggroup name="openid" displayorder="999"> |
204 | + <setting varname="launchpad_sync" displayorder="1"> |
205 | + <datatype>boolean</datatype> |
206 | + <optioncode>yesno</optioncode> |
207 | + <defaultvalue>1</defaultvalue> |
208 | + </setting> |
209 | + <setting varname="launchpad_provider" displayorder="2"> |
210 | + <datatype>free</datatype> |
211 | + <defaultvalue>https://login.launchpad.net</defaultvalue> |
212 | + </setting> |
213 | + </settinggroup> |
214 | + </options> |
215 | + <!-- <helptopics/> --> |
216 | + <!-- <cronentries/> --> |
217 | + <!-- <faqentries/> --> |
218 | </product> |
219 | |
220 | === modified file 'upload/launchpad_add_signin_link.php' |
221 | --- upload/launchpad_add_signin_link.php 2012-07-23 16:23:56 +0000 |
222 | +++ upload/launchpad_add_signin_link.php 2012-11-01 18:26:19 +0000 |
223 | @@ -1,5 +1,7 @@ |
224 | -<!-- |
225 | +<?php |
226 | +/** |
227 | Copyright 2009 Anthony Lenton |
228 | +Copyright 2012 Kyle Baker |
229 | Copyright 2012 Canonical |
230 | |
231 | This file is part of vbulletin-launchpad-integration. |
232 | @@ -16,12 +18,13 @@ |
233 | |
234 | You should have received a copy of the GNU Lesser Public License |
235 | along with vbulletin-launchpad-integration. If not, see <http://www.gnu.org/licenses/>. |
236 | ---> |
237 | -<?php |
238 | -if (!$show['member'] && |
239 | - (THIS_SCRIPT != 'login' || $_GET['do'] == 'logout' || ($_GET['do'] == 'login' && !$_GET['janrain_nonce'])) && |
240 | - (THIS_SCRIPT != 'register')) { |
241 | - $header .= '<div style="float:right;margin-top:20px" id="launchpad_login"><small>Or, |
242 | - <a href="launchpad_login.php">Sign in using your Launchpad ID</a></small></div>'; |
243 | -} |
244 | +*/ |
245 | + |
246 | + if (!$show['member'] && |
247 | + (THIS_SCRIPT != 'login' || $_GET['do'] == 'logout' || ($_GET['do'] == 'login' && !$_GET['janrain_nonce'])) && |
248 | + (THIS_SCRIPT != 'register')) |
249 | + { |
250 | + $header .= '<div style="float:right;margin-top:20px" id="launchpad_login"><small>Or, |
251 | + <a href="launchpad_login.php">Sign in using your Launchpad ID</a></small></div>'; |
252 | + } |
253 | ?> |
254 | |
255 | === modified file 'upload/launchpad_editprofile.php' |
256 | --- upload/launchpad_editprofile.php 2012-07-23 16:23:56 +0000 |
257 | +++ upload/launchpad_editprofile.php 2012-11-01 18:26:19 +0000 |
258 | @@ -1,5 +1,7 @@ |
259 | -<!-- |
260 | +<?php |
261 | +/** |
262 | Copyright 2009 Anthony Lenton |
263 | +Copyright 2012 Kyle Baker |
264 | Copyright 2012 Canonical |
265 | |
266 | This file is part of vbulletin-launchpad-integration. |
267 | @@ -16,54 +18,75 @@ |
268 | |
269 | You should have received a copy of the GNU Lesser Public License |
270 | along with vbulletin-launchpad-integration. If not, see <http://www.gnu.org/licenses/>. |
271 | ---> |
272 | -<?php |
273 | -/* |
274 | - * This file is called from the 'profile_complete' hook. |
275 | - * It adds the 'Update your Launchpad OpenID' field to the profile edition form, |
276 | - * and handles Launchpad's response |
277 | - */ |
278 | - |
279 | -require_once 'openid_utils.php'; |
280 | - |
281 | -$vbulletin->input->clean_array_gpc('r', array( |
282 | - 'openid' => TYPE_STR, |
283 | - 'openid_mode' => TYPE_STR, |
284 | -)); |
285 | - |
286 | -if ($vbulletin->GPC['openid_mode'] == 'id_res') { |
287 | - // Coming back from the provider |
288 | - vBOpenID_init ($vbulletin); |
289 | - |
290 | - require_once 'Auth/OpenID.php'; |
291 | - require_once 'Auth/OpenID/Consumer.php'; |
292 | - require_once 'Auth/OpenID/SReg.php'; |
293 | - |
294 | - require_once 'openid_store.php'; |
295 | - session_name('vbulletin-openid'); |
296 | - session_start(); |
297 | - $dbStore = new vBulletin_OpenID_OptionStore($vbulletin); |
298 | - $auth = new Auth_OpenID_Consumer($dbStore); |
299 | - $return_to = $vbulletin->options['bburl'] . '/profile.php?do=editprofile'; |
300 | - |
301 | - $return = $auth->complete($return_to); |
302 | - $openid = $return->getDisplayIdentifier(); |
303 | - |
304 | - if ($return->status == Auth_OpenID_SUCCESS) { |
305 | - $openid = $return->getDisplayIdentifier(); |
306 | - $openid_userid = $vbulletin->userinfo['userid']; |
307 | - vBOpenID_setOpenID ($openid_userid, $openid, $vbulletin); |
308 | - session_destroy(); |
309 | - $vbulletin->userinfo[find_openid_fieldname($vbulletin)] = $openid; |
310 | - } |
311 | - else { |
312 | - session_destroy(); |
313 | - } |
314 | -} |
315 | - |
316 | -$current_openid_url = $vbulletin->userinfo[find_openid_fieldname($vbulletin)]; |
317 | -eval('$fieldset = "' . fetch_template('launchpad_profile_fieldset') . '";'); |
318 | -$customfields[regular] .= $fieldset; |
319 | - |
320 | - |
321 | +*/ |
322 | + |
323 | + /* |
324 | + * This file is called from the 'profile_complete' hook. |
325 | + * It adds the 'Update your Launchpad OpenID' field to the profile edition form, |
326 | + * and handles Launchpad's response |
327 | + */ |
328 | + |
329 | + require_once 'vbopenid/openid_utils.php'; |
330 | + |
331 | + $vbulletin->input->clean_array_gpc('r', array( |
332 | + 'openid' => TYPE_STR, |
333 | + 'openid_mode' => TYPE_STR, |
334 | + )); |
335 | + |
336 | + if ($vbulletin->GPC['openid_mode'] == 'id_res') |
337 | + { |
338 | + // Coming back from the provider |
339 | + vBOpenID_init ($vbulletin); |
340 | + |
341 | + require_once 'Auth/OpenID.php'; |
342 | + require_once 'Auth/OpenID/Consumer.php'; |
343 | + require_once 'Auth/OpenID/SReg.php'; |
344 | + |
345 | + require_once 'vbopenid/openid_store.php'; |
346 | + session_name('vbulletin-openid'); |
347 | + session_start(); |
348 | + $dbStore = new vBulletin_OpenID_OptionStore($vbulletin); |
349 | + $auth = new Auth_OpenID_Consumer($dbStore); |
350 | + $return_to = $vbulletin->options['bburl'] . '/profile.php?do=editprofile'; |
351 | + |
352 | + $return = $auth->complete($return_to); |
353 | + $openid = $return->getDisplayIdentifier(); |
354 | + |
355 | + if ($return->status == Auth_OpenID_SUCCESS) |
356 | + { |
357 | + $openid = $return->getDisplayIdentifier(); |
358 | + $openid_userid = $vbulletin->userinfo['userid']; |
359 | + vBOpenID_setOpenID ($openid_userid, $openid, $vbulletin); |
360 | + session_destroy(); |
361 | + $vbulletin->userinfo[find_openid_fieldname($vbulletin)] = $openid; |
362 | + } |
363 | + else |
364 | + { |
365 | + session_destroy(); |
366 | + } |
367 | + } |
368 | + |
369 | + if ($_GET['do'] == "editprofile") |
370 | + { |
371 | + $current_openid_url = $vbulletin->userinfo[find_openid_fieldname($vbulletin)]; |
372 | + |
373 | + // Let's create our fieldset from our template |
374 | + $templater = vB_Template::create('launchpad_profile_fieldset'); |
375 | + $templater->register('current_openid_url', $current_openid_url); |
376 | + $template = $templater->render(); |
377 | + |
378 | + // This fieldset is our profile field for the user's |
379 | + // Launchpad OpenID url. |
380 | + $fieldset = $template; |
381 | + |
382 | + // If our fieldset already exists then it was added in |
383 | + // a previous loop so we'll skip adding it again. Otherwise |
384 | + // we'll add it here. |
385 | + if (!strpos($customfields['regular'], "Launchpad")) |
386 | + { |
387 | + $temp = $customfields['regular']; |
388 | + $customfields['regular'] .= $fieldset; |
389 | + $foo = $customfields['regular']; |
390 | + } |
391 | + } |
392 | ?> |
393 | |
394 | === modified file 'upload/launchpad_login.php' |
395 | --- upload/launchpad_login.php 2012-07-23 16:23:56 +0000 |
396 | +++ upload/launchpad_login.php 2012-11-01 18:26:19 +0000 |
397 | @@ -1,5 +1,7 @@ |
398 | -<!-- |
399 | +<?php |
400 | +/** |
401 | Copyright 2009 Anthony Lenton |
402 | +Copyright 2012 Kyle Baker |
403 | Copyright 2012 Canonical |
404 | |
405 | This file is part of vbulletin-launchpad-integration. |
406 | @@ -16,64 +18,69 @@ |
407 | |
408 | You should have received a copy of the GNU Lesser Public License |
409 | along with vbulletin-launchpad-integration. If not, see <http://www.gnu.org/licenses/>. |
410 | ---> |
411 | -<?php |
412 | -// ####################### SET PHP ENVIRONMENT ########################### |
413 | -error_reporting(E_ALL & ~E_NOTICE); |
414 | - |
415 | -// #################### DEFINE IMPORTANT CONSTANTS ####################### |
416 | -define('THIS_SCRIPT', 'launchpad_login'); |
417 | -define('CSRF_PROTECTION', true); |
418 | -define('CSRF_SKIP_LIST', 'launchpad_login'); |
419 | - |
420 | -// ################### PRE-CACHE TEMPLATES AND DATA ###################### |
421 | -// get special phrase groups |
422 | -$phrasegroups = array(); |
423 | - |
424 | -// get special data templates from the datastore |
425 | -$specialtemplates = array(); |
426 | - |
427 | -// pre-cache templates used by all actions |
428 | -$globaltemplates = array(); |
429 | - |
430 | -// pre-cache templates used by specific actions |
431 | -$actiontemplates = array(); |
432 | - |
433 | -// ######################### REQUIRE BACK-END ############################ |
434 | -require_once './global.php'; |
435 | - |
436 | -require_once 'openid_utils.php'; |
437 | -vBOpenID_init ($vbulletin); |
438 | - |
439 | -require_once 'Auth/OpenID.php'; |
440 | -require_once 'Auth/OpenID/Consumer.php'; |
441 | -require_once 'Auth/OpenID/SReg.php'; |
442 | - |
443 | -require_once 'openid_store.php'; |
444 | -session_name('vbulletin-openid'); |
445 | -session_start(); |
446 | - |
447 | -$dbStore = new vBulletin_OpenID_OptionStore($vbulletin); |
448 | -$auth = new Auth_OpenID_Consumer($dbStore); |
449 | - |
450 | - |
451 | -$authRequest = $auth->begin($vbulletin->options['launchpad_provider']); |
452 | - |
453 | -if ($authRequest === Null) { |
454 | - // Couldn't contact Launchpad, or some other ugly error |
455 | - eval(standard_error(fetch_error('openid_server_not_allowed', $vbulletin->options['launchpad_provider']))); |
456 | -} |
457 | - |
458 | -$endpoint = $authRequest->endpoint->server_url; |
459 | - |
460 | -if ($_GET['do'] == 'editprofile') { |
461 | - $return_to = $vbulletin->options['bburl'] . '/profile.php?do=editprofile'; |
462 | -} |
463 | -else { |
464 | - $return_to = $vbulletin->options['bburl'] . '/login.php?do=login'; |
465 | -} |
466 | -$error = vBOpenID_sendRequest ($vbulletin, $authRequest, $return_to); |
467 | -if ($error !== False) { |
468 | - eval(standard_error($error)); |
469 | -} |
470 | - |
471 | +*/ |
472 | + |
473 | + // ####################### SET PHP ENVIRONMENT ########################### |
474 | + error_reporting(E_ALL & ~E_NOTICE); |
475 | + |
476 | + // #################### DEFINE IMPORTANT CONSTANTS ####################### |
477 | + define('THIS_SCRIPT', 'launchpad_login'); |
478 | + define('CSRF_PROTECTION', true); |
479 | + define('CSRF_SKIP_LIST', 'launchpad_login'); |
480 | + |
481 | + // ################### PRE-CACHE TEMPLATES AND DATA ###################### |
482 | + // get special phrase groups |
483 | + $phrasegroups = array(); |
484 | + |
485 | + // get special data templates from the datastore |
486 | + $specialtemplates = array(); |
487 | + |
488 | + // pre-cache templates used by all actions |
489 | + $globaltemplates = array(); |
490 | + |
491 | + // pre-cache templates used by specific actions |
492 | + $actiontemplates = array(); |
493 | + |
494 | + // ######################### REQUIRE BACK-END ############################ |
495 | + require_once 'global.php'; |
496 | + |
497 | + require_once 'vbopenid/openid_utils.php'; |
498 | + vBOpenID_init ($vbulletin); |
499 | + |
500 | + require_once 'Auth/OpenID.php'; |
501 | + require_once 'Auth/OpenID/Consumer.php'; |
502 | + require_once 'Auth/OpenID/SReg.php'; |
503 | + |
504 | + require_once 'vbopenid/openid_store.php'; |
505 | + session_name('vbulletin-openid'); |
506 | + session_start(); |
507 | + |
508 | + $dbStore = new vBulletin_OpenID_OptionStore($vbulletin); |
509 | + $auth = new Auth_OpenID_Consumer($dbStore); |
510 | + |
511 | + $authRequest = $auth->begin($vbulletin->options['launchpad_provider']); |
512 | + //$authRequest = $auth->begin($vbulletin->GPC['openid']); |
513 | + |
514 | + if ($authRequest === null) |
515 | + { |
516 | + // Couldn't contact Launchpad, or some other ugly error |
517 | + eval(standard_error(fetch_error('openid_server_not_allowed', $vbulletin->options['launchpad_provider']))); |
518 | + } |
519 | + |
520 | + $endpoint = $authRequest->endpoint->server_url; |
521 | + |
522 | + if ($_GET['do'] == 'editprofile') |
523 | + { |
524 | + $return_to = $vbulletin->options['bburl'] . '/profile.php?do=editprofile'; |
525 | + } |
526 | + else |
527 | + { |
528 | + $return_to = $vbulletin->options['bburl'] . '/login.php?do=login'; |
529 | + } |
530 | + |
531 | + $error = vBOpenID_sendRequest ($vbulletin, $authRequest, $return_to); |
532 | + if ($error !== false) |
533 | + { |
534 | + eval(standard_error($error)); |
535 | + } |
536 | +?> |
537 | |
538 | === modified file 'upload/launchpad_sync_userinfo.php' |
539 | --- upload/launchpad_sync_userinfo.php 2012-07-23 16:23:56 +0000 |
540 | +++ upload/launchpad_sync_userinfo.php 2012-11-01 18:26:19 +0000 |
541 | @@ -1,5 +1,7 @@ |
542 | -<!-- |
543 | +<?php |
544 | +/** |
545 | Copyright 2009 Anthony Lenton |
546 | +Copyright 2012 Kyle Baker |
547 | Copyright 2012 Canonical |
548 | |
549 | This file is part of vbulletin-launchpad-integration. |
550 | @@ -16,40 +18,46 @@ |
551 | |
552 | You should have received a copy of the GNU Lesser Public License |
553 | along with vbulletin-launchpad-integration. If not, see <http://www.gnu.org/licenses/>. |
554 | ---> |
555 | -<?php |
556 | - |
557 | -if ($vbulletin->options['launchpad_sync']) { |
558 | - $vbulletin->input->clean_array_gpc('r', array( |
559 | - 'openid_mode' => TYPE_STR, |
560 | - 'openid_sreg_nickname' => TYPE_STR, |
561 | - 'openid_sreg_email' => TYPE_STR, |
562 | - )); |
563 | - |
564 | - if ($vbulletin->GPC['openid_mode'] == 'id_res') { |
565 | - $nickname = $vbulletin->GPC['openid_sreg_nickname']; |
566 | - $email = $vbulletin->GPC['openid_sreg_email']; |
567 | - |
568 | - if ($nickname && $nickname != $vbulletin->userinfo['username']) { |
569 | - $data1 =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); |
570 | - $data1->set_existing($vbulletin->userinfo); |
571 | - $data1->set('username', $nickname); |
572 | - $data1->pre_save(); |
573 | - if (count($data1->errors) == 0) { |
574 | - $data1->save(); |
575 | - } |
576 | - } |
577 | - |
578 | - if ($email && $email != $vbulletin->userinfo['email']) { |
579 | - $data2 =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); |
580 | - $data2->set_existing($vbulletin->userinfo); |
581 | - $data2->set('email', $email); |
582 | - $data2->pre_save(); |
583 | - if (count($data2->errors) == 0) { |
584 | - $data2->save(); |
585 | - } |
586 | - } |
587 | - } |
588 | -} |
589 | - |
590 | +*/ |
591 | + |
592 | + if ($vbulletin->options['launchpad_sync']) |
593 | + { |
594 | + $vbulletin->input->clean_array_gpc('r', array( |
595 | + 'openid_mode' => TYPE_STR, |
596 | + 'openid_sreg_nickname' => TYPE_STR, |
597 | + 'openid_sreg_email' => TYPE_STR, |
598 | + )); |
599 | + |
600 | + if ($vbulletin->GPC['openid_mode'] == 'id_res') |
601 | + { |
602 | + $nickname = $vbulletin->GPC['openid_sreg_nickname']; |
603 | + $email = $vbulletin->GPC['openid_sreg_email']; |
604 | + |
605 | + if ($nickname && $nickname != $vbulletin->userinfo['username']) |
606 | + { |
607 | + $data1 =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); |
608 | + $data1->set_existing($vbulletin->userinfo); |
609 | + $data1->set('username', $nickname); |
610 | + $data1->pre_save(); |
611 | + |
612 | + if (count($data1->errors) == 0) |
613 | + { |
614 | + $data1->save(); |
615 | + } |
616 | + } |
617 | + |
618 | + if ($email && $email != $vbulletin->userinfo['email']) |
619 | + { |
620 | + $data2 =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); |
621 | + $data2->set_existing($vbulletin->userinfo); |
622 | + $data2->set('email', $email); |
623 | + $data2->pre_save(); |
624 | + |
625 | + if (count($data2->errors) == 0) |
626 | + { |
627 | + $data2->save(); |
628 | + } |
629 | + } |
630 | + } |
631 | + } |
632 | ?> |