Эх сурвалжийг харах

[svn r14305] Ensure there is at least a scheme URI provided in the OpenID URI (add http:// by default)

Yannick Warnier 17 жил өмнө
parent
commit
2a59b9cef3
1 өөрчлөгдсөн 7 нэмэгдсэн , 1 устгасан
  1. 7 1
      main/auth/profile.php

+ 7 - 1
main/auth/profile.php

@@ -1,5 +1,5 @@
 <?php
-// $Id: profile.php 14237 2008-02-03 18:57:05Z yannoo $
+// $Id: profile.php 14305 2008-02-17 21:21:42Z yannoo $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -508,6 +508,12 @@ elseif ($form->validate())
 	unset($user_data['password1'], $user_data['password2'], $user_data['MAX_FILE_SIZE'],
 		$user_data['remove_picture'], $user_data['apply_change']);
 
+	// Following RFC2396 (http://www.faqs.org/rfcs/rfc2396.html), a URI uses ':' as a reserved character
+	// we can thus ensure the URL doesn't contain any scheme name by searching for ':' in the string
+	if(!preg_match('/^[^:]*:\/\/.*$/',$user_data['openid']))
+	{	//ensure there is at least a http:// scheme in the URI provided
+		$user_data['openid'] = 'http://'.$user_data['openid'];
+	}
 	// build SQL query
 	$sql = "UPDATE $table_user SET";