Changeset 373566
- Timestamp:
- 04/16/2011 07:10:29 AM (15 years ago)
- Location:
- phpbb-single-sign-on/trunk
- Files:
-
- 8 edited
-
common-functions.php (modified) (16 diffs)
-
connect-phpbb.php (modified) (5 diffs)
-
files/auth_wpbb.php (modified) (3 diffs)
-
files/common.php (modified) (5 diffs)
-
module.phpbb.php (modified) (10 diffs)
-
module.wp.php (modified) (1 diff)
-
options.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
phpbb-single-sign-on/trunk/common-functions.php
r242467 r373566 2 2 3 3 //Get the current options create empty ones if they don't exist. 4 $connect_phpbb_options = get_option('connect_phpbb_options');5 if ($connect_phpbb_options == ''){6 $connect_phpbb_options = array('path' => '');4 $connect_phpbb_options = get_option('connect_phpbb_options'); 5 if ($connect_phpbb_options == '') { 6 $connect_phpbb_options = array('path' => ''); 7 7 } 8 8 9 9 //Get the paths 10 if ( !defined('ABSPATH') ){10 if (!defined('ABSPATH')) { 11 11 define('ABSPATH', (dirname(dirname(dirname(dirname(__FILE__))))) . '/'); 12 12 } 13 13 14 if (!defined('PHPBBPATH')){15 if ($connect_phpbb_options['path'] != ''){16 define('PHPBBPATH', $connect_phpbb_options['path']);17 } else { 18 define('PHPBBPATH', 'forum/');14 if (!defined('PHPBBPATH')) { 15 if ($connect_phpbb_options['path'] != '') { 16 define('PHPBBPATH', $connect_phpbb_options['path']); 17 } else { 18 define('PHPBBPATH', 'forum/'); 19 19 } 20 20 } … … 23 23 $config_files = array( 24 24 'auth_wpbb' => array( 25 'source' => realpath(dirname(__FILE__) .'/files/auth_wpbb.php'),26 'destin' => realpath(ABSPATH .PHPBBPATH.'includes/auth').'/auth_wpbb.php',27 'folder' => realpath(ABSPATH .PHPBBPATH.'includes/auth')25 'source' => realpath(dirname(__FILE__) . '/files/auth_wpbb.php'), 26 'destin' => realpath(ABSPATH . PHPBBPATH . 'includes/auth') . '/auth_wpbb.php', 27 'folder' => realpath(ABSPATH . PHPBBPATH . 'includes/auth') 28 28 ), 29 29 'common' => array( 30 'source' => realpath(dirname(__FILE__) .'/files/common.php'),31 'destin' => realpath(ABSPATH .PHPBBPATH).'/common.php',32 'folder' => realpath(ABSPATH .PHPBBPATH)30 'source' => realpath(dirname(__FILE__) . '/files/common.php'), 31 'destin' => realpath(ABSPATH . PHPBBPATH) . '/common.php', 32 'folder' => realpath(ABSPATH . PHPBBPATH) 33 33 ), 34 34 'common-orig' => array( 35 'destin' => realpath(ABSPATH .PHPBBPATH).'/common-orig.php',36 ) 35 'destin' => realpath(ABSPATH . PHPBBPATH) . '/common-orig.php', 36 ), 37 37 ); 38 38 … … 41 41 */ 42 42 43 function wpbb_get_file_version($file) 44 { 45 if(file_exists($file)){ 46 $content = file_get_contents($file); 47 if(strpos($content, '@version $Id') !== false){ 48 return "Original"; 49 } 50 preg_match('/@version\s([0-9.]+)/',$content,$version); 43 function wpbb_get_file_version($file) { 44 if (file_exists($file)) { 45 $content = file_get_contents($file); 46 if (strpos($content, '@version $Id') !== false) { 47 return "Original"; 48 } 49 preg_match('/@version\s([0-9.]+)/', $content, $version); 51 50 return $version[1]; 52 51 } else { … … 55 54 } 56 55 57 function wpbb_get_file_versions() 58 { 56 function wpbb_create_form($action, $title) { 57 static $form_num; 58 59 if(empty($form_num)){ 60 $form_num = 1; 61 } else { 62 $form_num++; 63 } 64 65 return ' 66 <form name="form'.$form_num.'" method="post" action="'.WPBB_OPTIONS_PAGE.'"> 67 <input type="hidden" name="stage" value="'.$action.'" /> 68 <input type="submit" name="Submit" value="'.__($title, 'phpbb').'" class="button" /> 69 </form> 70 '; 71 } 72 73 function wpbb_get_file_versions() { 59 74 global $config_files; 60 75 //GETS all the files versions :: … … 63 78 'source' => wpbb_get_file_version($config_files['auth_wpbb']['source']), 64 79 'destin' => wpbb_get_file_version($config_files['auth_wpbb']['destin']) 65 ),80 ), 66 81 'common' => array( 67 82 'source' => wpbb_get_file_version($config_files['common']['source']), 68 83 'destin' => wpbb_get_file_version($config_files['common']['destin']) 69 ),84 ), 70 85 'common-orig' => array( 71 86 'destin' => wpbb_get_file_version($config_files['common-orig']['destin']), 72 )73 );87 ) 88 ); 74 89 return $file_versions; 75 90 } … … 79 94 */ 80 95 81 function wpbb_get_config_value($config_name) 82 { 96 function wpbb_get_config_value($config_name) { 83 97 global $wpdb; 84 98 85 99 //Get_the phpbb prefix 86 100 $phpbb_db_prefix = wpbb_get_phpbb_prefix(); 87 $config_table = $phpbb_db_prefix .'config';88 89 $data = $wpdb->get_var('SELECT config_value FROM ' .$config_table.' WHERE config_name = \''.$config_name.'\'', 0, 0);101 $config_table = $phpbb_db_prefix . 'config'; 102 103 $data = $wpdb->get_var('SELECT config_value FROM ' . $config_table . ' WHERE config_name = \'' . $config_name . '\'', 0, 0); 90 104 91 105 return $data; 92 106 } 93 107 94 function wpbb_set_config_value($prefix, $config_name, $value) 95 { 108 function wpbb_set_config_value($prefix, $config_name, $value) { 96 109 global $wpdb; 97 98 if ($prefix != ''){99 $config_table = $prefix .'config';100 101 $query = "UPDATE `" .$config_table."` SET `config_value` = '".$value."' WHERE `config_name` = '".$config_name."'";110 111 if ($prefix != '') { 112 $config_table = $prefix . 'config'; 113 114 $query = "UPDATE `" . $config_table . "` SET `config_value` = '" . $value . "' WHERE `config_name` = '" . $config_name . "'"; 102 115 $wpdb->query($query); 103 116 } 104 117 } 105 118 106 107 function wpbb_get_phpbb_prefix() 108 { 119 function wpbb_get_phpbb_prefix() { 109 120 global $connect_phpbb_options; 110 121 111 $file = ABSPATH .$connect_phpbb_options['path'].'config.php';112 113 if (file_exists($file)){114 $content = file_get_contents($file); 115 116 preg_match('/dbname\s{0,}=\s{0,}[\'"]([0-9A-Za-z_]+)[\'"]/', $content,$dbname);117 preg_match('/table_prefix\s{0,}=\s{0,}[\'"]([0-9A-Za-z_]+)[\'"]/', $content,$table_prefix);122 $file = ABSPATH . $connect_phpbb_options['path'] . 'config.php'; 123 124 if (file_exists($file)) { 125 $content = file_get_contents($file); 126 127 preg_match('/dbname\s{0,}=\s{0,}[\'"]([0-9A-Za-z_]+)[\'"]/', $content, $dbname); 128 preg_match('/table_prefix\s{0,}=\s{0,}[\'"]([0-9A-Za-z_]+)[\'"]/', $content, $table_prefix); 118 129 119 130 return $table_prefix[1]; … … 124 135 125 136 //function to get the auth modes, copied from phpbb 3.0.6 : /includes/acp_/acp_board.php line 665 126 function wpbb_select_auth_method($selected_method, $key = '') 127 { 128 $phpbb_root_path = ABSPATH.PHPBBPATH; 137 function wpbb_select_auth_method($selected_method, $key = '') { 138 $phpbb_root_path = ABSPATH . PHPBBPATH; 129 139 $phpEx = 'php'; 130 140 … … 133 143 $dp = @opendir($phpbb_root_path . 'includes/auth'); 134 144 135 if (!$dp) 136 { 137 return ''; 138 } 139 140 while (($file = readdir($dp)) !== false) 141 { 142 if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) 143 { 144 $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); 145 } 145 if (!$dp) { 146 return ''; 147 } 148 149 while (($file = readdir($dp)) !== false) { 150 if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) { 151 $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); 152 } 146 153 } 147 154 closedir($dp); … … 150 157 151 158 $auth_select = ''; 152 foreach ($auth_plugins as $method) 153 { 159 foreach ($auth_plugins as $method) { 154 160 $selected = ($selected_method == $method) ? ' selected="selected"' : ''; 155 161 $auth_select .= '<option value="' . $method . '"' . $selected . '>' . $method . '</option>'; … … 163 169 */ 164 170 165 function wpbb_run_test($echo = true) 166 { 171 function wpbb_run_test($echo = true) { 167 172 global $config_files; 168 173 $file_versions = wpbb_get_file_versions(); 174 175 $plugin_url = WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__)).'/'; 169 176 170 177 $test = array( … … 173 180 'common-orig' => array('state' => true, 'message' => 'Original'), 174 181 'auth_method' => true, 175 'path_var' => true 182 'path_var' => true, 183 'posting.php' => true, 184 'functions_user.php' => true, 176 185 ); 177 186 $error = false; 178 179 //auth_wpbb.php180 if($file_versions['auth_wpbb']['source'] != $file_versions['auth_wpbb']['destin']){181 $error = true ; 182 $test['auth_wpbb'] = false;183 } 184 185 // common.php186 if($file_versions['common']['source'] != $file_versions['common']['destin']){187 $error = true ;188 $ test['common'] = false;189 }190 191 //common-orig.php 192 if( file_exists($config_files['common-orig']['destin'])){193 if($file_versions['common-orig']['destin'] !== 'Original'){194 $error = true ;195 $test['common-orig'] = array('state' => false, 'message' => 'Wrong Version');196 }197 } else {198 $error = true;199 $test['common-orig'] = array('state' => false, 'message' => 'File not found');200 } 201 202 187 /** 188 * Configurations 189 */ 190 191 $result = '<tr><th colspan="5">'.__('configuration', 'phpbb').'</th></tr>'; 192 193 //////////////////////////////////////////////////////////////////////////// 194 //path_var 195 $path_var = get_option('connect_phpbb_options'); 196 if (!(isset($path_var['path']) && $path_var['path'] != '')) { 197 $error = true; 198 $test['path_var'] = false; 199 } 200 201 if($echo){ 202 $result .= '<tr class="alternate"> 203 <td>Wordpress Path</td> 204 <th><i>Variable</i></th> 205 <td>' . $path_var['path'] . '</td> 206 <td>' . wpbb_passed_test($test['path_var']) . '</td> 207 <td><a href="#configuration" class="button" style="height:17px; margin:1px; line-height:23px;">'.__('Configure').'</a></td> 208 </tr>'; 209 } 210 211 //////////////////////////////////////////////////////////////////////////// 203 212 //auth_method 204 213 $auth_method = wpbb_get_config_value('auth_method'); 205 if ($auth_method != 'wpbb'){214 if ($auth_method != 'wpbb') { 206 215 $error = true; 207 216 $test['auth_method'] = false; 208 217 } 209 218 210 //path_var 211 $path_var = get_option('connect_phpbb_options'); 212 if(!(isset($path_var['path']) && $path_var['path'] != '')){ 213 $error = true ; 214 $test['path_var'] = false; 215 } 216 217 218 if($echo) 219 echo ' 220 <table> 221 <tr> 222 <th width="200"> </th> 223 <th width="100">Reccomended</th> 224 <th width="100">Current</th> 225 <th width="50">OK ?</th> 226 </tr> 227 <tr> 228 <th>Files</th> 229 </tr> 230 <tr> 219 if($echo){ 220 $result .= '<tr> 221 <td>Auth Mode</td> 222 <td>wpbb</td> 223 <td>' . $auth_method . '</td> 224 <td>' . wpbb_passed_test($test['auth_method']) . '</td> 225 <td><a href="#configuration" class="button" style="height:17px; margin:1px; line-height:23px;">'.__('Configure').'</a></td> 226 </tr>'; 227 } 228 229 if($echo){ 230 $result .= '<tr class="alternate"><th colspan="5">'.__('Files', 'phpbb').'</th></tr>'; 231 } 232 233 //////////////////////////////////////////////////////////////////////////// 234 //auth_wpbb.php 235 if ($file_versions['auth_wpbb']['source'] != $file_versions['auth_wpbb']['destin']) { 236 $error = true; 237 $test['auth_wpbb'] = false; 238 } 239 240 if($echo){ 241 $result .= '<tr> 231 242 <td>auth_wpbb.php</td> 232 <td>'.$file_versions['auth_wpbb']['source'].'</td> 233 <td>'.$file_versions['auth_wpbb']['destin'].'</td> 234 <td>'.wpbb_passed_test($test['auth_wpbb']).'</td> 235 </tr> 236 <tr> 243 <td>' . $file_versions['auth_wpbb']['source'] . '</td> 244 <td>' . $file_versions['auth_wpbb']['destin'] . '</td> 245 <td>' . wpbb_passed_test($test['auth_wpbb']) . '</td> 246 <td>' . wpbb_create_form('install-auth','Install').'</td> 247 </tr>'; 248 } 249 250 //////////////////////////////////////////////////////////////////////////// 251 //common.php 252 if ($file_versions['common']['source'] != $file_versions['common']['destin']) { 253 $error = true; 254 $test['common'] = false; 255 } 256 257 if($echo){ 258 $result .= '<tr class="alternate"> 237 259 <td>common.php</td> 238 <td>'.$file_versions['common']['source'].'</td> 239 <td>'.$file_versions['common']['destin'].'</td> 240 <td>'.wpbb_passed_test($test['common']).'</td> 241 </tr> 242 <tr> 260 <td>' . $file_versions['common']['source'] . '</td> 261 <td>' . $file_versions['common']['destin'] . '</td> 262 <td>' . wpbb_passed_test($test['common']) . '</td> 263 <td>' . wpbb_create_form('install-common','Install').'</td> 264 </tr>'; 265 } 266 267 268 //////////////////////////////////////////////////////////////////////////// 269 //common-orig.php 270 if (file_exists($config_files['common-orig']['destin'])) { 271 if ($file_versions['common-orig']['destin'] !== 'Original') { 272 $error = true; 273 $test['common-orig'] = array('state' => false, 'message' => 'Wrong Version'); 274 } 275 } else { 276 $error = true; 277 $test['common-orig'] = array('state' => false, 'message' => 'File not found'); 278 } 279 280 if($echo){ 281 $result .= '<tr> 243 282 <td>common-orig.php</td> 244 283 <td>-</td> 245 <td>'.$test['common-orig']['message'].'</td> 246 <td>'.wpbb_passed_test($test['common-orig']).'</td> 247 </tr> 248 <tr> 249 <th>Configurations</th> 250 </tr> 251 <tr> 252 <td>Auth Mode</td> 253 <td>wpbb</td> 254 <td>'.$auth_method.'</td> 255 <td>'.wpbb_passed_test($test['auth_method']).'</td> 256 </tr> 257 <tr> 258 <td>Wordpress Path</td> 259 <th><i>Variable</i></th> 260 <td>'.$path_var['path'].'</td> 261 <td>'.wpbb_passed_test($test['path_var']).'</td> 262 </tr> 263 264 </table>'; 284 <td>' . $test['common-orig']['message'] . '</td> 285 <td>' . wpbb_passed_test($test['common-orig']) . '</td> 286 <td>' . wpbb_create_form('install-common','Install').'</td> 287 </tr>'; 288 } 289 290 //////////////////////////////////////////////////////////////////////////// 291 292 $result .= '<tr class="alternate"><th colspan="5">'.__('Patches', 'phpbb').'</th></tr>'; 293 294 //////////////////////////////////////////////////////////////////////////// 295 //posting.php 296 $posting_patched = wpbb_validate_user_patched(realpath(ABSPATH . PHPBBPATH).'/posting.php'); 297 if(!$posting_patched){ 298 $error = true; 299 $test['posting.php'] = false; 300 } 301 302 if($echo){ 303 $result .= '<tr> 304 <td>posting.php</td> 305 <th>'.__('Yes').'</th> 306 <td>' . (($posting_patched)? __('Yes') : __('No')) . '</td> 307 <td>' . wpbb_passed_test($test['posting.php']) . '</td> 308 <td>' . wpbb_create_form('patch-posting','Patch').'</td> 309 </tr>'; 310 } 311 312 313 //////////////////////////////////////////////////////////////////////////// 314 //includes/functions_user.php 315 $functions_user = wpbb_validate_user_patched(realpath(ABSPATH . PHPBBPATH).'/includes/functions_user.php'); 316 $functions_user2 = wpbb_validate_user2_patched(realpath(ABSPATH . PHPBBPATH).'/includes/functions_user.php'); 317 if(!$functions_user OR !$functions_user2){ 318 $error = true; 319 $test['functions_user.php'] = false; 320 } 321 322 if($echo){ 323 $result .= '<tr class="alternate"> 324 <td>functions_user.php</td> 325 <th>'.__('Yes').'</th> 326 <td>' . (($functions_user)? __('Yes') : __('No')) . '</td> 327 <td>' . wpbb_passed_test($test['functions_user.php']) . '</td> 328 <td>' . wpbb_create_form('patch-user_function','Patch').'</td> 329 </tr>'; 330 } 331 332 333 //////////////////////////////////////////////////////////////////////////// 334 335 if ($echo){ 336 echo ' 337 <table class="widefat" summary="" title="PHPBB"> 338 <thead> 339 <tr> 340 <th scope="col"> </th> 341 <th scope="col">'.__('Recommended', 'phpbb').'</th> 342 <th scope="col">'.__('Current', 'phpbb').'</th> 343 <th scope="col">'.__('OK ?', 'phpbb').'</th> 344 <th scope="col">'.__('Action', 'phpbb').'</th> 345 </tr> 346 <tbody id="the-list"> 347 '.$result.' 348 </tbody> 349 </table> 350 '; 351 } 265 352 266 353 return $error; 267 354 } 268 355 269 function wpbb_passed_test($test_result) {270 if (is_array($test_result)){356 function wpbb_passed_test($test_result) { 357 if (is_array($test_result)) { 271 358 $test_result = $test_result['state']; 272 359 } 273 if ($test_result){360 if ($test_result) { 274 361 return '<span style="color:green">OK</span>'; 275 362 } else { … … 282 369 */ 283 370 284 285 function wpbb_get_functions_conflict(){ 286 $functions_list = wpbb_folder_function_list(ABSPATH.PHPBBPATH); 287 //print_r($functions_list); 288 $modules_directory = str_replace('/phpbb-single-sign-on', '',dirname(__FILE__)); 289 371 /*function wpbb_get_functions_conflict() { 372 $functions_list = wpbb_folder_function_list(ABSPATH . PHPBBPATH); 373 374 $modules_directory = str_replace('/phpbb-single-sign-on', '', dirname(__FILE__)); 375 290 376 $modules_list = wpbb_get_modules_list($modules_directory); 291 377 292 foreach ($modules_list as $module){293 $list = wpbb_folder_function_list($modules_directory .'/'.$module.'/');378 foreach ($modules_list as $module) { 379 $list = wpbb_folder_function_list($modules_directory . '/' . $module . '/'); 294 380 295 381 print_r(array_intersect($list, $functions_list)); … … 297 383 } 298 384 299 function wpbb_get_modules_list($modules_directory) {300 $modules_list = array();385 function wpbb_get_modules_list($modules_directory) { 386 $modules_list = array(); 301 387 302 388 $iterator = new DirectoryIterator($modules_directory); 303 foreach ($iterator as $file) {304 if ($file->isDir() && !$file->isDot()){389 foreach ($iterator as $file) { 390 if ($file->isDir() && !$file->isDot()) { 305 391 $name = $file->getFilename(); 306 if ($name != 'phpbb-single-sign-on'){392 if ($name != 'phpbb-single-sign-on') { 307 393 $modules_list[] = $name; 308 394 } … … 312 398 } 313 399 314 function wpbb_folder_function_list($folder) {400 function wpbb_folder_function_list($folder) { 315 401 $file_list = wpbb_get_files_list($folder); 316 402 317 403 $function_list = array(); 318 foreach ($file_list as $file){319 $file_path = $folder .$file;404 foreach ($file_list as $file) { 405 $file_path = $folder . $file; 320 406 $function_list = array_merge($function_list, wpbb_functions_list($file_path)); 321 407 } … … 326 412 } 327 413 328 function wpbb_get_files_list($directory, &$list = array(), $base = '') {414 function wpbb_get_files_list($directory, &$list = array(), $base = '') { 329 415 $iterator = new DirectoryIterator($directory); 330 foreach ($iterator as $file) {331 332 if (!$file->isDot()) {416 foreach ($iterator as $file) { 417 418 if (!$file->isDot()) { 333 419 $name = $file->getFilename(); 334 420 335 if ($file->isDir() && $name != 'cache') {336 wpbb_get_files_list($directory .'/'.$name, &$list, $base.$name.'/');421 if ($file->isDir() && $name != 'cache') { 422 wpbb_get_files_list($directory . '/' . $name, &$list, $base . $name . '/'); 337 423 } else { 338 if (strpos($name, '.php') !== false && $name != 'auth_wpbb.php' && $name != 'common-orig.php'){339 $list[] = $base .$name;424 if (strpos($name, '.php') !== false && $name != 'auth_wpbb.php' && $name != 'common-orig.php') { 425 $list[] = $base . $name; 340 426 } 341 427 } 342 428 } 343 344 429 } 345 430 return $list; 346 431 } 347 432 348 function wpbb_functions_list($file) {349 if (file_exists($file)){350 $content = file_get_contents($file); 351 352 preg_match_all('/function\s{1,}([0-9A-Za-z_\-]+)\s{0,}\(/', $content,$functions);353 354 if (count($functions != 0)){433 function wpbb_functions_list($file) { 434 if (file_exists($file)) { 435 $content = file_get_contents($file); 436 437 preg_match_all('/function\s{1,}([0-9A-Za-z_\-]+)\s{0,}\(/', $content, $functions); 438 439 if (count($functions != 0)) { 355 440 return $functions[1]; 356 441 } … … 358 443 //else 359 444 return array(); 360 } 361 445 }*/ 446 447 function wpbb_validate_user_patch($file) { 448 if (file_exists($file)) { 449 $content = file_get_contents($file); 450 $content = str_replace(' phpbb_validate_username', ' validate_phpbb_username', $content); //DEBUG PHASE, REMOVE FOR PROD 451 $content = str_replace(' validate_username', ' validate_phpbb_username', $content); 452 453 file_put_contents($file, $content); 454 return true; 455 } else { 456 return false; 457 } 458 } 459 460 function wpbb_validate_user_patched($file) { 461 if (file_exists($file)) { 462 $content = file_get_contents($file); 463 464 if(strpos($content,'validate_phpbb_username') !== false){ 465 return true; 466 } else { 467 return false; 468 } 469 470 } else { 471 return false; 472 } 473 } 474 475 476 function wpbb_validate_user2_patch($file) { 477 if (file_exists($file)) { 478 $content = file_get_contents($file); 479 $content = str_replace( 480 '$function = array_shift($validate);'."\n\t\t\t".'array', 481 '$function = array_shift($validate);'."\n\t\t\t".'if($function == \'username\'){$function = \'phpbb_username\';}'."\n\t\t\t".'array', $content); 482 483 file_put_contents($file, $content); 484 return true; 485 } else { 486 return false; 487 } 488 } 489 490 function wpbb_validate_user2_patched($file) { 491 if (file_exists($file)) { 492 $content = file_get_contents($file); 493 494 if(strpos($content,'$function = array_shift($validate);'."\n\t\t\t".'if($function == \'username\'){$function = \'phpbb_username\';}') !== false){ 495 return true; 496 } else { 497 return false; 498 } 499 500 } else { 501 return false; 502 } 503 } -
phpbb-single-sign-on/trunk/connect-phpbb.php
r242467 r373566 1 1 <?php 2 2 3 /* 3 Plugin Name: PHPBB Single Sign On 4 Version: 0.7.1 5 Plugin URI: http://www.onigoetz.ch/plugins/wordpress-phpbb-plugin/ 6 Description: Connecte un site wordpress à PHPBB 7 Author: Stéphane Goetz 8 Author URI: http://www.onigoetz.ch 9 */ 10 11 12 13 define('FROM_WP',TRUE); 14 15 //Installation 16 register_activation_hook( __FILE__, 'connect_phpbb_install'); 17 function connect_phpbb_install(){ 4 Plugin Name: PHPBB Single Sign On 5 Version: 0.8 6 Plugin URI: http://www.onigoetz.ch/plugins/wordpress-phpbb-plugin/ 7 Description: Connecte un site wordpress à PHPBB 8 Author: Stéphane Goetz 9 Author URI: http://www.onigoetz.ch 10 */ 11 12 if(!defined('LOADED_PHPBB')){ 13 define('LOADED_WP', true); 14 } 15 16 include (dirname(__FILE__) . '/common-functions.php'); 17 include (dirname(__FILE__) . '/module.phpbb.php'); 18 include (dirname(__FILE__) . '/module.wp.php'); 19 20 define('WPBB_OPTIONS_PAGE', get_option('siteurl') . '/wp-admin/admin.php?page='.dirname(plugin_basename(__FILE__)).'/options.php'); 21 22 //////////////////////////////////////////////////////////////////////////////// 23 24 register_activation_hook(__FILE__, 'connect_phpbb_install'); 25 26 /** 27 * Activation Hook 28 */ 29 function connect_phpbb_install() { 18 30 $default_options = array( 19 31 'path' => 'forum/' … … 22 34 } 23 35 24 //Options page 36 //////////////////////////////////////////////////////////////////////////////// 37 25 38 add_action('admin_menu', 'connect_phpbb_options_page'); 39 40 /** 41 * Options page 42 */ 26 43 function connect_phpbb_options_page() { 27 add_options_page('PHP BB', 'PHP BB Options', 10, 'phpbb-single-sign-on/options.php'); 28 } 29 30 include (dirname(__FILE__).'/common-functions.php'); 31 include (dirname(__FILE__).'/module.phpbb.php'); 32 include (dirname(__FILE__).'/module.wp.php'); 33 34 35 global $op_credentials; 36 37 // AUTHENTICATE 38 add_action('wp_authenticate_user','wpbb_login',10,2); 39 function wpbb_login($userdata,$password){ 40 41 if(file_exists(ABSPATH.'/'.PHPBBPATH.'config.php')){ // check to see if phpBB exists 42 if(defined('IN_PHPBB')){ 43 // return if we're already in phpBB (to avoid a loop) 44 return $userdata; 45 } 46 47 // FIX start, RamonFincken.com WebsiteFreelancers.nl 48 // Fix for phpbb3 login attempts. If too many failed logins, phpbb demands you enter a visual code 49 // So include ( but do not use ) the class to make phpbb happy :) 50 define(IN_PHPBB,true); 51 if(file_exists(ABSPATH.'/'.PHPBBPATH.'includes/captcha/captcha_factory.php')){ //needed, file doesn't exist before PHPBB 3.0.6 52 include_once(ABSPATH.'/'.PHPBBPATH.'includes/captcha/captcha_factory.php'); 53 } 54 // FIX end, RamonFincken.com WebsiteFreelancers.nl 55 56 wpbb_phpBB3::getIdentity(); 57 $result = wpbb_phpBB3::login($userdata->user_login,$password); 58 } 59 60 if($result['response'] == LOGIN_SUCCESS){ 44 add_options_page('PHP BB', 'PHP BB Options', 10, 'phpbb-single-sign-on/options.php'); 45 } 46 47 //////////////////////////////////////////////////////////////////////////////// 48 49 //Doesn't add the hook if we're in phpbb 50 if(defined('LOADED_WP')){ 51 add_action('wp_authenticate_user', 'wpbb_login', 10, 2); 52 } 53 54 /** 55 * On login actions 56 * 57 * @param string $userdata 58 * @param string $password 59 * @return object 60 */ 61 function wpbb_login($userdata, $password) { 62 // check to see if phpBB exists 63 if (!file_exists(ABSPATH . '/' . PHPBBPATH . 'config.php')) 61 64 return $userdata; 62 } 63 64 return 0; 65 } 66 67 // LOGOUT 68 add_action('wp_logout','wpbb_logout'); 69 function wpbb_logout(){ 70 if(!defined('FROM_WP')) define('FROM_WP',TRUE); 71 72 if(file_exists(ABSPATH.'/'.PHPBBPATH.'config.php')){ // check to see if phpBB exists 65 66 define('FROM_WP', TRUE); 67 68 // Set up phpBB environment 69 wpbb_phpBB3::getIdentity(); 70 71 global $db; 72 73 //PHPBB 74 $phpBB_user = wpbb_phpBB3::getUserByName($userdata->user_login); 75 76 //Wordpress 77 $in_wp = ($userdata->ID == 0) ? FALSE : TRUE; 78 79 //WP 1 BB 0 ? 80 if (!$phpBB_user && $in_wp) { //If he doesn't exists, create the user in phpbb 81 $email = $userdata->user_email ? $userdata->user_email : ''; 82 83 // since group IDs may change, use a query to make sure it is the right default group. 84 $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = '" . $db->sql_escape(REGISTERED) . "' AND group_type = " . GROUP_SPECIAL; 85 $result = $db->sql_query($sql); 86 87 $row = $db->sql_fetchrow($result); 88 $group_id = $row['group_id']; 89 90 $user_row = array( 91 'username' => $userdata->user_login, 92 'user_password' => phpbb_hash($password), 93 'group_id' => $group_id, 94 'user_email' => $email, 95 'user_type' => 0 96 ); 97 98 $id = wpbb_phpBB3::addUser($user_row); 99 $phpBB_user = wpbb_phpBB3::getUserById($id); 100 } 101 102 global $user; 103 104 $result = $user->session_create($phpBB_user->user_id, 0, 1, 1); 105 106 return $userdata; 107 } 108 109 //////////////////////////////////////////////////////////////////////////////// 110 111 add_action('wp_logout', 'wpbb_logout'); 112 113 /** 114 * Logout action 115 */ 116 function wpbb_logout() { 117 if (!defined('FROM_WP')) 118 define('FROM_WP', TRUE); 119 120 if (file_exists(ABSPATH . '/' . PHPBBPATH . 'config.php')) { // check to see if phpBB exists 73 121 wpbb_phpBB3::getIdentity(); 74 122 wpbb_phpBB3::logout(); … … 78 126 } 79 127 80 // PASSWORD CHANGES, when a user changes his password in wordpress, it applies to phpbb 128 //////////////////////////////////////////////////////////////////////////////// 129 81 130 add_filter('check_passwords', 'wpbb_change_password', 10, 3); 82 function wpbb_change_password($username, $pass1, $pass2){ 83 if(!empty($pass1) && !empty($pass2) && $pass1 == $pass2){ 131 132 /** 133 * PASSWORD CHANGES, when a user changes his password in wordpress, it applies to phpbb 134 * 135 * @param string $username 136 * @param string $pass1 137 * @param string $pass2 138 * @return bool 139 */ 140 function wpbb_change_password($username, $pass1, $pass2) { 141 if (!empty($pass1) && !empty($pass2) && $pass1 == $pass2) { 84 142 wpbb_phpBB3::getIdentity(); 85 if (wpbb_phpBB3::getUserByName($username)){86 wpbb_phpBB3::changePassword($username, $pass1);143 if (wpbb_phpBB3::getUserByName($username)) { 144 wpbb_phpBB3::changePassword($username, $pass1); 87 145 } 88 146 } … … 90 148 } 91 149 92 // TEST , Runs tests in admin to show if the user has some configs to do. 150 //////////////////////////////////////////////////////////////////////////////// 151 93 152 add_action('init', 'wpbb_admin_warnings'); 153 154 /** 155 * Runs tests in admin to show if the user has some configs to do. 156 * 157 * @return null 158 */ 94 159 function wpbb_admin_warnings() { 95 if ( wpbb_run_test(false) ) { 160 if (wpbb_run_test(false)) { 161 96 162 function wpbb_warning() { 97 163 echo " 98 164 <div id='phpbb-warning' class='updated fade'> 99 <p><strong>" .__('PHP Single Sign On is almost ready.')."</strong>100 " .sprintf(__('You have to <a href="%s">Follow the instructions</a> for it to work.'),101 get_option('siteurl') . '/wp-admin/admin.php?page=phpbb-single-sign-on/options.php')."</p></div>165 <p><strong>" . __('PHP Single Sign On is almost ready.') . "</strong> 166 " . sprintf(__('You have to <a href="%s">Follow the instructions</a> for it to work.'), 167 get_option('siteurl') . '/wp-admin/admin.php?page=phpbb-single-sign-on/options.php') . "</p></div> 102 168 "; 103 169 } 170 104 171 add_action('admin_notices', 'wpbb_warning'); 105 172 return; … … 107 174 } 108 175 176 //////////////////////////////////////////////////////////////////////////////// 177 178 add_action('register_post', 'wpbb_register_post', 10, 3); 179 180 /** 181 * Email existing 182 * 183 * @param string $login 184 * @param string $email 185 * @param object $errors 186 * @return null 187 */ 188 function wpbb_register_post($login, $email, $errors) { 189 if ($errors->get_error_code()){ 190 return; // No need to add to the despair 191 } 192 193 if (wpbb_phpBB3::get_wp_user_by_email($email)) { 194 $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.')); 195 } 196 } 197 198 //////////////////////////////////////////////////////////////////////////////// 199 200 add_action('register_post', 'wpbb_register_hint', 11, 3); 201 202 /** 203 * Error Hints 204 * 205 * @param string $login 206 * @param string $email 207 * @param object $errors 208 * @return null 209 */ 210 function wpbb_register_hint($login, $email, $errors) { 211 error_log($errors->get_error_code()); 212 213 214 if ($errors->get_error_code() != 'email_exists' and 215 $errors->get_error_code() != 'username_exists' 216 ) 217 return; 218 219 $errors->add('email_exists', sprintf("<a href=\"%s\">%s</a>", 220 site_url('wp-login.php', 'login'), 221 __('Log In'))); 222 223 $errors->add('email_exists', sprintf("<a href=\"%s\" title=\"%s\">%s</a>", 224 site_url('wp-login.php?action=lostpassword','recover password'), 225 __('Password Lost and Found'), 226 __('Lost your password?'))); 227 } -
phpbb-single-sign-on/trunk/files/auth_wpbb.php
r242467 r373566 1 1 <?php 2 2 3 /** 3 * Database auth plug-in for PHPBB - Wordpress Connector 4 * 5 * This is for authentication via the integrated user table 6 * 7 * @package login 8 * @version 0.7.1 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 10 * 11 */ 12 4 * Database auth plug-in for PHPBB - Wordpress Connector 5 * 6 * This is for authentication via the integrated user table 7 * 8 * @package login 9 * @version 0.8 10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 11 * 12 */ 13 13 //Doesn't load it in the admin area of the plugin, or it will make a conflict 14 if ($_GET['i'] != 'board' && $_GET['mode'] != 'auth'){15 include(dirname(__FILE__).'/auth_db.php');14 if ($_GET['i'] != 'board' && $_GET['mode'] != 'auth') { 15 include(dirname(__FILE__) . '/auth_db.php'); 16 16 } 17 17 18 18 19 19 /** 20 * @ignore 21 */ 22 if (!defined('IN_PHPBB')) 23 { 24 exit; 25 } 26 27 function init_wpbb(){ 20 * @ignore 21 */ 22 if (!defined('IN_PHPBB')) { 23 exit; 24 } 25 26 function init_wpbb() { 28 27 29 28 } 30 29 31 30 // Provide option for WordPress path 32 function acp_wpbb(&$new) 33 { 34 // These are fields required in the config table 35 $tpl = ' 31 function acp_wpbb(&$new) { 32 // These are fields required in the config table 33 $tpl = ' 36 34 <dl> 37 35 <dt><label for="op_path">WordPress Path:</label><br /><span>This is the path to your WordPress installation relative to the site\'s root directory. Most users will not need to change this.</span></dt> … … 39 37 </dl> 40 38 '; 41 42 return array(43 'tpl'=> $tpl,44 'config'=> array('wpbb_path')45 );39 40 return array( 41 'tpl' => $tpl, 42 'config' => array('wpbb_path') 43 ); 46 44 } 47 45 48 46 /** 49 * Login function 50 */ 51 function login_wpbb(&$username, &$password) 52 { 47 * Login function 48 */ 49 function login_wpbb(&$username, &$password) { 53 50 global $db, $config; 54 55 //Still needed ? 56 if(defined('SECOND_RUN')){ 57 return array( 58 'status' => LOGIN_SUCCESS, 59 'error_msg' => false, 60 'user_row' => $row, 61 ); 62 } else { 63 define('SECOND_RUN', true); 64 } 65 66 51 67 52 //checks if Wordpress is loaded, if not uses simple authentication 68 if (function_exists('wp_signon')){69 53 if (function_exists('wp_signon')) { 54 70 55 global $current_user; 71 56 72 57 /* 73 ** Exists in PHPBB ?74 */58 * * Exists in PHPBB ? 59 */ 75 60 $sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts 76 61 FROM ' . USERS_TABLE . " … … 78 63 $result = $db->sql_query($sql); 79 64 $phpBB_user = $db->sql_fetchrow($result); 80 65 81 66 /* 82 ** Exists in WP ? 83 */ 84 //Loaded from within WP ? 85 if(!function_exists('censor_text')){ //Loaded from within PHPBB 86 $wp_user = wpbb_Wordpress::getIdByName($username); 87 $in_wp = ($wp_user == 0) ? FALSE : TRUE; 88 } else { //Loaded from within PHPBB 89 //SYNC to WP 90 wpbb_WordPress::loadAdminAPI(); 91 wpbb_WordPress::changePassword($username, $password); 92 93 if(isset($current_user)){ 94 wp_clear_auth_cookie(); 95 } 96 97 if ( is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) ){ 98 $secure_cookie = false; 99 } else { 100 $secure_cookie = ''; 101 } 102 103 // Use the wp_signon function to get the object of our user from WP 67 * * Exists in WP ? 68 */ 69 //SYNC to WP 70 wpbb_WordPress::loadAdminAPI(); 71 72 if (isset($current_user)) { 73 wp_clear_auth_cookie(); 74 } 75 76 if (is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') )) { 77 $secure_cookie = false; 78 } else { 79 $secure_cookie = ''; 80 } 81 82 // Use the wp_signon function to get the object of our user from WP 83 $wp_user = wp_signon(array( 84 'user_login' => $username, 85 'user_password' => html_entity_decode($password) 86 ), $secure_cookie); 87 88 89 // Flag whether or not the user exists in wordpress 90 $in_wp = isset($wp_user->errors['invalid_username']) || ($wp_user->ID == 0 && !isset($wp_user->errors['incorrect_password'])) ? FALSE : TRUE; 91 92 //WP 0 BB 1 ? 93 if ($phpBB_user && !$in_wp) { //if he doesn't exist creates the user in wordpress 94 $username = $phpBB_user['username']; 95 96 $user_row = array( 97 'username' => $username, 98 'email' => $phpBB_user['user_email'] ? $phpBB_user['user_email'] : '', 99 'password' => html_entity_decode($password) 100 ); 101 102 $wp_user = wpbb_WordPress::addUser($user_row); 103 104 104 $wp_user = wp_signon(array( 105 'user_login' => $username, 106 'user_password' => html_entity_decode($password) 107 ), $secure_cookie); 108 109 110 // Flag whether or not the user exists in wordpress 111 $in_wp = isset($wp_user->errors['invalid_username']) || ($wp_user->ID == 0 && !isset($wp_user->errors['incorrect_password'])) ? FALSE: TRUE; 112 } 113 114 //Checking existence of users 115 if(!function_exists('censor_text')){ //censor_text is a function from phpbb 116 //WP 1 BB 0 ? 117 if(!$phpBB_user && $in_wp){ //If he doesn't exists, create the user in phpbb 118 $email = $wp_user->user_email ? $wp_user->user_email : ''; 119 120 // since group IDs may change, use a query to make sure it is the right default group. 121 $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = '" . $db->sql_escape(REGISTERED) . "' AND group_type = " . GROUP_SPECIAL; 122 $result = $db->sql_query($sql); 123 124 $row = $db->sql_fetchrow($result); 125 $group_id = $row['group_id']; 126 127 $user_row = array( 128 'username' => $username, 129 'user_password' => phpbb_hash($password), 130 'group_id' => $group_id, 131 'user_email' => $email, 132 'user_type' => 0 133 ); 134 135 $id = wpbb_phpBB3::addUser($user_row); 136 $phpBB_user = wpbb_phpBB3::getUserById($id); 137 } 105 'user_login' => $username, 106 'user_password' => html_entity_decode($password) 107 ), $secure_cookie); 108 109 //mysql_select_db($db->db_name); // Select phpBB database 110 } else if (!$phpBB_user && $in_wp) { 111 $email = $wp_user->user_email ? $wp_user->user_email : ''; 112 113 // since group IDs may change, use a query to make sure it is the right default group. 114 $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = '" . $db->sql_escape(REGISTERED) . "' AND group_type = " . GROUP_SPECIAL; 115 $result = $db->sql_query($sql); 116 117 $row = $db->sql_fetchrow($result); 118 $group_id = $row['group_id']; 119 120 $user_row = array( 121 'username' => $username, 122 'user_password' => phpbb_hash($password), 123 'group_id' => $group_id, 124 'user_email' => $email, 125 'user_type' => 0 126 ); 127 128 $id = wpbb_phpBB3::addUser($user_row); 129 $phpBB_user = wpbb_phpBB3::getUserById($id); 130 } 131 132 //logon phpBB is the access right in wordpress ? 133 if (wp_check_password($password, $wp_user->user_pass, $wp_user->ID)) { 134 wpbb_phpBB3::changePassword($username, $password); 135 136 return array( 137 'status' => LOGIN_SUCCESS, 138 'error_msg' => false, 139 'user_row' => $phpBB_user, 140 ); 138 141 } else { 139 //WP 0 BB 1 ?140 if($phpBB_user && !$in_wp){ //if he doesn't exist creates the user in wordpress141 142 $username = $phpBB_user['username'];143 144 $user_row = array(145 'username' => $username,146 'email' => $phpBB_user['user_email'] ? $phpBB_user['user_email'] : '',147 'password' => html_entity_decode($password)148 );149 150 $wp_user = wpbb_WordPress::addUser($user_row);151 152 $wp_user = wp_signon(array(153 'user_login' => $username,154 'user_password' => html_entity_decode($password)155 ), $secure_cookie);156 157 mysql_select_db($db->db_name); // Select phpBB database158 }159 }160 161 //SYNC Password in PHPBB162 //TODO :: put it in standard class163 if(!function_exists('censor_text')){ //censor_text is a function from phpbb164 wpbb_phpBB3::changePassword($username,$password);165 }166 167 //logon phpBB168 $result = login_db($username, $password);169 170 if($result['status'] == LOGIN_SUCCESS){171 $phpBB_authed = 1;172 } else {173 $phpBB_authed = 0;174 }175 176 if ((!$phpBB_user || !$phpBB_authed) && !$in_wp)177 {178 // FIXME -- WordPress always reports username error when user exists in phpBB but not WP and password is wrong179 if(isset($wp_user->errors['incorrect_password']) || ($phpBB_user && !$phpBB_authed)){180 return array(181 'status' => LOGIN_ERROR_PASSWORD,182 'error_msg' => 'LOGIN_ERROR_PASSWORD',183 'user_row' => array('user_id' => ANONYMOUS),184 );185 }186 // error187 142 return array( 188 'status' => LOGIN_ERROR_USERNAME, 189 'error_msg' => 'LOGIN_ERROR_USERNAME', 190 'user_row' => array('user_id' => ANONYMOUS), 191 ); 192 } 193 194 return $result; 143 'status' => LOGIN_ERROR_PASSWORD, 144 'error_msg' => 'LOGIN_ERROR_PASSWORD', 145 'user_row' => $phpBB_user, 146 ); 147 } 148 } 149 return login_db($username, $password); 150 } 151 152 //Executed when the session is closed 153 function logout_wpbb($data, $new_session) { 154 if (function_exists('wp_clear_auth_cookie')) { //if WP is loaded 155 wp_clear_auth_cookie(); 156 } 157 return $data; 158 } 159 160 //TODO :: WTH is that ?!?!? 161 function validate_session_wpbb() { 162 global $phpbb_root_path, $phpEx; 163 // Need to block registrations for users that already exist 164 $mode = request_var('mode', ''); 165 166 /** 167 * There's no hook for password changing in phpBB so we have to reuse validation technique from ucp_profile.php 168 */ 169 if ($mode == 'reg_details' && !empty($_POST['submit'])) { // password and email changing 170 global $auth, $config, $user; 171 172 $data = array( 173 'username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)), 174 'email' => strtolower(request_var('email', $user->data['user_email'])), 175 'email_confirm' => strtolower(request_var('email_confirm', '')), 176 'new_password' => request_var('new_password', '', true), 177 'cur_password' => request_var('cur_password', '', true), 178 'password_confirm' => request_var('password_confirm', '', true), 179 ); 180 181 // Do not check cur_password, it is the old one. 182 $check_ary = array( 183 'new_password' => array( 184 array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 185 array('password')), 186 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']) 187 ); 188 189 if ($auth->acl_get('u_chgname') && $config['allow_namechange']) { 190 $check_ary['username'] = array( 191 array('string', false, $config['min_name_chars'], $config['max_name_chars']), 192 array('username') 193 ); 194 } 195 196 if (sizeof(validate_data($data, $check_ary))) 197 return true; 198 if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) 199 return true; 200 if (($data['new_password'] || ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) || ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], $user->data['user_password'])) 201 return true; 202 203 if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) 204 return true; 205 206 define('WP_ADMIN', true); 207 wpbb_WordPress::loadAdminAPI(); 208 wpbb_WordPress::updateUser($data); 209 } 210 211 if ($mode != 'register' || !request_var('username', '', true)) 212 return true; 213 214 global $current_user; 215 216 $username = utf8_normalize_nfc(request_var('username', '', true)); 217 218 if ($user->data['is_registered'] || isset($_REQUEST['not_agreed'])) { //FIX BY BRIAN PAN 219 //if(wpbb_userExists($username, 'phpbb')){ 220 // User exists, TODO -- notify user somehow 221 //header('Location: http://www.opc.dev/forum/ucp.php?mode=register'); 222 redirect(append_sid($phpbb_root_path . 'index' . $phpEx)); 195 223 } else { 196 //Does run if wordpress isn't loaded 197 return login_db($username, $password); 198 } 199 } 200 201 //Executed when the session is closed 202 function logout_wpbb($data, $new_session){ 203 if(function_exists('wp_clear_auth_cookie')){ //if WP is loaded 204 wp_clear_auth_cookie(); 205 } 206 return $data; 207 } 208 209 //TODO :: WTH is that ?!?!? 210 function validate_session_wpbb(){ 211 global $phpbb_root_path, $phpEx; 212 // Need to block registrations for users that already exist 213 $mode = request_var('mode', ''); 214 215 216 /** 217 * There's no hook for password changing in phpBB so we have to reuse validation technique from ucp_profile.php 218 */ 219 if($mode == 'reg_details' && !empty($_POST['submit'])){ // password and email changing 220 global $auth, $config, $user; 221 222 $data = array( 223 'username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)), 224 'email' => strtolower(request_var('email', $user->data['user_email'])), 225 'email_confirm' => strtolower(request_var('email_confirm', '')), 226 'new_password' => request_var('new_password', '', true), 227 'cur_password' => request_var('cur_password', '', true), 228 'password_confirm' => request_var('password_confirm', '', true), 229 ); 230 231 // Do not check cur_password, it is the old one. 232 $check_ary = array( 233 'new_password' => array( 234 array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 235 array('password')), 236 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']) 237 ); 238 239 if ($auth->acl_get('u_chgname') && $config['allow_namechange']) 240 { 241 $check_ary['username'] = array( 242 array('string', false, $config['min_name_chars'], $config['max_name_chars']), 243 array('username') 244 ); 245 } 246 247 if (sizeof(validate_data($data, $check_ary))) 248 return true; 249 if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) 250 return true; 251 if (($data['new_password'] || ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) || ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])) && !phpbb_check_hash($data['cur_password'], $user->data['user_password'])) 252 return true; 253 254 if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email']) 255 return true; 256 257 define('WP_ADMIN', true); 258 wpbb_WordPress::loadAdminAPI(); 259 wpbb_WordPress::updateUser($data); 260 } 261 262 if($mode != 'register' || !request_var('username', '', true)) return true; 263 264 global $current_user; 265 266 $username = utf8_normalize_nfc(request_var('username', '', true)); 267 268 if ($user->data['is_registered'] || isset($_REQUEST['not_agreed'])){ //FIX BY BRIAN PAN 269 //if(wpbb_userExists($username, 'phpbb')){ 270 // User exists, TODO -- notify user somehow 271 //header('Location: http://www.opc.dev/forum/ucp.php?mode=register'); 272 redirect(append_sid($phpbb_root_path.'index'.$phpEx)); 273 } 274 else{ 275 return true; 276 } 277 } 224 return true; 225 } 226 } 227 278 228 ?> -
phpbb-single-sign-on/trunk/files/common.php
r242467 r373566 1 1 <?php 2 2 3 /** 3 * Common.php file Replacement for PHPBB - Wordpress Connector4 * 5 * This is for the loading without conflict of the two scripts6 *7 * @package login8 * @version 0.7.1 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License10 *11 */4 * Common.php file Replacement for PHPBB - Wordpress Connector 5 * 6 * This is for the loading without conflict of the two scripts 7 * 8 * @package login 9 * @version 0.8 10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 11 * 12 */ 12 13 13 function include_for_eval($file) 14 { 15 $file_contents = file_get_contents($file); 16 $file_contents = preg_replace('/^\s*\<\?php/','',$file_contents); 17 $file_contents = preg_replace('/\?\>\s*$/','',$file_contents); 18 19 return $file_contents; 14 if(!defined('LOADED_WP')){ 15 define('LOADED_PHPBB', true); 20 16 } 21 17 18 19 function include_for_eval($file) { 20 $file_contents = file_get_contents($file); 21 $file_contents = preg_replace('/^\s*\<\?php/', '', $file_contents); 22 $file_contents = preg_replace('/\?\>\s*$/', '', $file_contents); 23 24 return $file_contents; 25 } 26 27 //Affected files : 28 22 29 //Common.php 23 //config.php24 //includes/session.php25 //includes/functions_content.php26 //includes/constants.php30 //config.php 31 //includes/session.php 32 //includes/functions_content.php 33 //includes/constants.php 27 34 28 35 $include_common_contents = include_for_eval($phpbb_root_path . 'common-orig.' . $phpEx); … … 41 48 42 49 //Fusionne 43 $include_common_contents = str_replace('require($phpbb_root_path . \'config.\' . $phpEx);',$include_config_contents,$include_common_contents); 44 $include_common_contents = str_replace('require($phpbb_root_path . \'includes/session.\' . $phpEx);',$include_session_contents,$include_common_contents); 45 $include_common_contents = str_replace('require($phpbb_root_path . \'includes/functions_content.\' . $phpEx);',$include_formatting_contents,$include_common_contents); 46 $include_common_contents = str_replace('require($phpbb_root_path . \'includes/constants.\' . $phpEx);',$include_constants_contents,$include_common_contents); 50 $include_common_contents = str_replace('require($phpbb_root_path . \'config.\' . $phpEx);', $include_config_contents, $include_common_contents); 51 $include_common_contents = str_replace('require($phpbb_root_path . \'includes/session.\' . $phpEx);', $include_session_contents, $include_common_contents); 52 $include_common_contents = str_replace('require($phpbb_root_path . \'includes/functions_content.\' . $phpEx);', $include_formatting_contents, $include_common_contents); 53 $include_common_contents = str_replace('require($phpbb_root_path . \'includes/constants.\' . $phpEx);', $include_constants_contents, $include_common_contents); 54 55 //Clean memory 56 unset($include_config_contents); 57 unset($include_session_contents); 58 unset($include_formatting_contents); 59 unset($include_constants_contents); 47 60 48 61 49 62 //suprimme le conflit de $table_prefix 50 $include_common_contents = str_replace('$table_prefix', '$dbname.".".$table_prefix2',$include_common_contents);63 $include_common_contents = str_replace('$table_prefix', '$dbname.".".$table_prefix2', $include_common_contents); 51 64 52 65 //suprimme le conflit de make_clickable() 53 $include_common_contents = str_replace('make_clickable', 'wpbb_make_clickable',$include_common_contents);66 $include_common_contents = str_replace('make_clickable', 'wpbb_make_clickable', $include_common_contents); 54 67 55 68 … … 60 73 //corrige le get_cookie 61 74 $original_get_cookie = array( 62 '$this->cookie_data[\'u\'] = request_var($config[\'cookie_name\'] . \'_u\', 0, false, true);', 63 '$this->cookie_data[\'k\'] = request_var($config[\'cookie_name\'] . \'_k\', \'\', false, true);', 64 '$this->session_id = request_var($config[\'cookie_name\'] . \'_sid\', \'\', false, true);' 65 //,'$config[\'cookie_path\'] . $domain . ((!$config[\'cookie_secure\'])' 75 '$this->cookie_data[\'u\'] = request_var($config[\'cookie_name\'] . \'_u\', 0, false, true);', 76 '$this->cookie_data[\'k\'] = request_var($config[\'cookie_name\'] . \'_k\', \'\', false, true);', 77 '$this->session_id = request_var($config[\'cookie_name\'] . \'_sid\', \'\', false, true);' 66 78 ); 67 79 $new_get_cookie = array( 68 '$this->cookie_data[\'u\'] = $_COOKIE[$config[\'cookie_name\'] . \'_u\'];' 69 ,'$this->cookie_data[\'k\'] = $_COOKIE[$config[\'cookie_name\'] . \'_k\'];' 70 ,'$this->session_id = $_COOKIE[$config[\'cookie_name\'] . \'_sid\'];' 71 //,'$config[\'cookie_path\'] . ((!$config[\'cookie_secure\'])' 80 '$this->cookie_data[\'u\'] = $_COOKIE[$config[\'cookie_name\'] . \'_u\'];' 81 , '$this->cookie_data[\'k\'] = $_COOKIE[$config[\'cookie_name\'] . \'_k\'];' 82 , '$this->session_id = $_COOKIE[$config[\'cookie_name\'] . \'_sid\'];' 72 83 ); 73 $include_common_contents = str_replace($original_get_cookie, $new_get_cookie,$include_common_contents);84 $include_common_contents = str_replace($original_get_cookie, $new_get_cookie, $include_common_contents); 74 85 75 86 //Include de la version modifiée de common.php … … 81 92 */ 82 93 83 //save all vars before they're escaped by wordpress 84 $saved_vars = array('SERVER' => $_SERVER, 'GET' => $_GET, 'POST' => $_POST, 85 'COOKIE' => $_COOKIE, 'SESSION' => $_SESSION,'REQUEST' => $_REQUEST,'ENV' => $_ENV); 86 //not $_FILE nor $GLOBALS 94 //save all vars before they're escaped by wordpress (but not $_FILE nor $GLOBALS) 95 $saved_vars = array( 96 'SERVER' => $_SERVER, 97 'GET' => $_GET, 98 'POST' => $_POST, 99 'COOKIE' => $_COOKIE, 100 'SESSION' => $_SESSION, 101 'REQUEST' => $_REQUEST, 102 'ENV' => $_ENV 103 ); 87 104 88 89 //TODO : sanitize path name 90 if(isset($config['wpbb_path'])){ 105 if (isset($config['wpbb_path'])) { 91 106 $extra_path = $config['wpbb_path']; 92 107 } else { … … 97 112 98 113 //tests if the wordpress files exist 99 if(file_exists(dirname($root_path).'/'.$extra_path.'wp-blog-header.php')) 100 { 101 $wp_blog_header_path = dirname($root_path).'/'.$extra_path.'wp-blog-header.php'; 102 } 103 else if(file_exists($root_path.'/'.$extra_path.'wp-blog-header.php')) 104 { 105 $wp_blog_header_path = $root_path.'/'.$extra_path.'wp-blog-header.php'; 106 } 107 else 108 { 109 $wp_blog_header_path = ''; 110 } 111 112 113 if($wp_blog_header_path != ''){ 114 //Include Wordpress 115 include($wp_blog_header_path); 114 if (file_exists(dirname($root_path) . '/' . $extra_path . 'wp-blog-header.php')) { 115 include dirname($root_path) . '/' . $extra_path . 'wp-blog-header.php'; 116 } else if (file_exists($root_path . '/' . $extra_path . 'wp-blog-header.php')) { 117 include $root_path . '/' . $extra_path . 'wp-blog-header.php'; 118 } else { 119 //nothing found 116 120 } 117 121 118 122 //restore all vars. 119 foreach ($saved_vars as $key => $val){120 $varname = '_' .$key;123 foreach ($saved_vars as $key => $val) { 124 $varname = '_' . $key; 121 125 global $$varname; 122 126 $$varname = $val; 123 127 } 124 128 -
phpbb-single-sign-on/trunk/module.phpbb.php
r233919 r373566 1 1 <?php 2 2 3 class wpbb_phpBB3{ 3 class wpbb_phpBB3 { 4 4 5 var $user; 5 6 var $loggedin; 6 7 7 function getIdentity() {8 function getIdentity() { 8 9 define('IN_PHPBB', true); 9 10 global $phpbb_root_path, $phpEx; 10 11 11 $phpbb_root_path = ABSPATH .PHPBBPATH;12 $phpbb_root_path = ABSPATH . PHPBBPATH; 12 13 $phpEx = substr(strrchr(__FILE__, '.'), 1); 13 14 … … 24 25 //do not include the function_content, there is a depedency in auth_op to check if it's opened from within phpbb or within wordpress 25 26 26 if (file_exists($phpbb_root_path . 'common-orig.' . $phpEx)){27 if (file_exists($phpbb_root_path . 'common-orig.' . $phpEx)) { 27 28 $common_file = $phpbb_root_path . 'common-orig.' . $phpEx; 28 29 } else { … … 32 33 33 34 $include_contents = file_get_contents($common_file); 34 $include_contents = str_replace('<?php', '',$include_contents);35 $include_contents = str_replace('?>', '',$include_contents);36 $include_contents = str_replace('require($phpbb_root_path . \'includes/functions_content.\' . $phpEx);', '',$include_contents);35 $include_contents = str_replace('<?php', '', $include_contents); 36 $include_contents = str_replace('?>', '', $include_contents); 37 $include_contents = str_replace('require($phpbb_root_path . \'includes/functions_content.\' . $phpEx);', '', $include_contents); 37 38 38 39 39 40 //called on line 189 of common.php //require($phpbb_root_path . 'includes/session.' . $phpEx); 40 41 $include_session_contents = file_get_contents($phpbb_root_path . 'includes/session.' . $phpEx); 41 $include_session_contents = str_replace('<?php', '',$include_session_contents);42 $include_session_contents = str_replace('?>', '',$include_session_contents);43 $include_session_contents = str_replace('', '',$include_session_contents);42 $include_session_contents = str_replace('<?php', '', $include_session_contents); 43 $include_session_contents = str_replace('?>', '', $include_session_contents); 44 $include_session_contents = str_replace('', '', $include_session_contents); 44 45 45 46 //corrige le set_cookie … … 49 50 50 51 51 $include_contents = str_replace('require($phpbb_root_path . \'includes/session.\' . $phpEx);', $include_session_contents,$include_contents);52 $include_contents = str_replace('require($phpbb_root_path . \'includes/session.\' . $phpEx);', $include_session_contents, $include_contents); 52 53 53 54 eval($include_contents); … … 57 58 $user->setup(); 58 59 59 if ($user->data['is_registered'] == TRUE){60 if ($user->data['is_registered'] == TRUE) { 60 61 $identity = array( 61 'id' =>$user->data['user_id'],62 'alias' =>$user->data['username_clean'],63 'email' =>$user->data['user_email'],64 'rank' =>$user->rank['user_rank']62 'id' => $user->data['user_id'], 63 'alias' => $user->data['username_clean'], 64 'email' => $user->data['user_email'], 65 'rank' => $user->rank['user_rank'] 65 66 ); 66 } 67 else{ 67 } else { 68 68 $identity = array(); 69 69 } 70 70 } 71 71 72 function login($uname, $passwd){ 73 define('IN_PHPBB',TRUE); 74 75 global $auth; 76 77 $username = $uname=='' ? request_var('username', '', true) : $uname; 78 $password = $passwd=='' ? request_var('password', '', true) : $passwd; 79 80 $result = $auth->login($username, $password); 81 82 83 return $result['status'] == LOGIN_SUCCESS ? array('response'=>TRUE,'error'=>'') : array('response'=>FALSE,'error'=>(!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>')); 84 } 85 86 function logout(){ 72 /* 73 * WP wants a user obj on success and an WP_Error on failure 74 */ 75 76 function login($username, $password) { 77 78 global $db; 79 80 //PHPBB 81 $phpBB_user = self::getUserByName($username); 82 83 //Wordpress 84 $wp_user = wpbb_Wordpress::getIdByName($username); 85 $in_wp = ($wp_user == 0) ? FALSE : TRUE; 86 87 //WP 1 BB 0 ? 88 if (!$phpBB_user && $in_wp) { //If he doesn't exists, create the user in phpbb 89 $email = $wp_user->user_email ? $wp_user->user_email : ''; 90 91 // since group IDs may change, use a query to make sure it is the right default group. 92 $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = '" . $db->sql_escape(REGISTERED) . "' AND group_type = " . GROUP_SPECIAL; 93 $result = $db->sql_query($sql); 94 95 $row = $db->sql_fetchrow($result); 96 $group_id = $row['group_id']; 97 98 $user_row = array( 99 'username' => $username, 100 'user_password' => phpbb_hash($password), 101 'group_id' => $group_id, 102 'user_email' => $email, 103 'user_type' => 0 104 ); 105 106 $id = wpbb_phpBB3::addUser($user_row); 107 $phpBB_user = wpbb_phpBB3::getUserById($id); 108 } 109 110 //has to be done when identity is checked 111 //wpbb_phpBB3::changePassword($username, $password); 112 } 113 114 function logout() { 87 115 global $user, $auth; 88 116 … … 94 122 * OLD FUNCTION 95 123 * function changePassword($username,$password){ 96 $phpbb_root_path = ABSPATH.PHPBBPATH; 97 98 require($phpbb_root_path.'config.php'); 99 100 // set user_pass_convert to 1 so user's pass will be hashed under phpBB rules when logging in after pass is changed in WordPress 101 $sql = 'UPDATE ' . USERS_TABLE . ' SET user_password="'.md5($password).'",user_pass_convert=1 WHERE username = "' . $username . '"'; 102 $result = mysql_query($sql); 103 }*/ 104 105 function changePassword($username, $password) 106 { 124 $phpbb_root_path = ABSPATH.PHPBBPATH; 125 126 require($phpbb_root_path.'config.php'); 127 128 // set user_pass_convert to 1 so user's pass will be hashed under phpBB rules when logging in after pass is changed in WordPress 129 $sql = 'UPDATE ' . USERS_TABLE . ' SET user_password="'.md5($password).'",user_pass_convert=1 WHERE username = "' . $username . '"'; 130 $result = mysql_query($sql); 131 } */ 132 133 function changePassword($username, $password) { 107 134 global $db; 108 135 109 136 $hashed = phpbb_hash($password); 110 $sql = 'UPDATE ' . USERS_TABLE . ' SET user_password="' .$hashed.'",user_pass_convert=0,user_last_search=1 WHERE username = "' . $username . '"';137 $sql = 'UPDATE ' . USERS_TABLE . ' SET user_password="' . $hashed . '",user_pass_convert=0,user_last_search=1 WHERE username = "' . $username . '"'; 111 138 112 139 $result = $db->sql_query($sql); 113 140 } 114 141 115 function addUser($user) {142 function addUser($user) { 116 143 global $phpbb_root_path, $phpEx; 117 144 118 145 // Use the user_add function, this code is from auth.php line 864-869 119 if (!function_exists('user_add')) 120 { 146 if (!function_exists('user_add')) { 121 147 include($phpbb_root_path . 'includes/functions_user.' . $phpEx); 122 148 } … … 125 151 } 126 152 127 function getUserById($id) {153 function getUserById($id) { 128 154 global $db; 129 155 mysql_select_db($db->dbname); … … 139 165 } 140 166 141 function getUserByName($name , $clean = false){142 $phpbb_root_path = ABSPATH .PHPBBPATH;143 144 require($phpbb_root_path .'config.php');145 146 $dbr = mysql_connect($dbhost, $dbuser,$dbpasswd);167 function getUserByName($name) { 168 $phpbb_root_path = ABSPATH . PHPBBPATH; 169 170 require($phpbb_root_path . 'config.php'); 171 172 $dbr = mysql_connect($dbhost, $dbuser, $dbpasswd); 147 173 mysql_select_db($dbname); 148 174 define('USERS_TABLE', $table_prefix . 'users'); … … 152 178 153 179 $result = mysql_query($sql); 154 if ($result){155 $user = mysql_fetch_ row($result);180 if ($result) { 181 $user = mysql_fetch_object($result); 156 182 mysql_free_result($result); 157 183 return $user; … … 160 186 return false; 161 187 } 188 189 //////////////////////////////////////////////////////////// 190 191 function get_wp_user_by_email($email) { 192 $lcemail = strtolower($email); 193 194 $phpbb_root_path = ABSPATH . PHPBBPATH; 195 require($phpbb_root_path . 'config.php'); 196 $dbr = mysql_connect($dbhost, $dbuser, $dbpasswd); 197 mysql_select_db($dbname); 198 define('USERS_TABLE', $table_prefix . 'users'); 199 $sql = 'SELECT username, user_email FROM ' . USERS_TABLE . 200 " WHERE user_email = '" . esc_sql($lcemail) . "'"; 201 $result = mysql_query($sql); 202 if ($result) { 203 $user = mysql_fetch_row($result); 204 if ($user[0]) { 205 $user_row = array( 206 'username' => $user[0], 207 'email' => $user[1], 208 'password' => wp_generate_password(), 209 ); 210 return wpbb_WordPress::addUser($user_row); 211 } 212 } 213 214 return false; 215 } 216 217 //////////////////////////////////////////////////////////// 218 219 function get_wp_user_by_name($name) { 220 $phpbb_root_path = ABSPATH . PHPBBPATH; 221 require($phpbb_root_path . 'config.php'); 222 $dbr = mysql_connect($dbhost, $dbuser, $dbpasswd); 223 mysql_select_db($dbname); 224 define('USERS_TABLE', $table_prefix . 'users'); 225 $sql = 'SELECT username, user_email FROM ' . USERS_TABLE . 226 " WHERE username = '" . esc_sql($name) . "'"; 227 $result = mysql_query($sql); 228 if ($result) { 229 $user = mysql_fetch_row($result); 230 if ($user[0]) { 231 $user_row = array( 232 'username' => $user[0], 233 'email' => $user[1], 234 'password' => wp_generate_password(), 235 ); 236 return wpbb_WordPress::addUser($user_row); 237 } 238 } 239 240 return false; 241 } 242 162 243 } -
phpbb-single-sign-on/trunk/module.wp.php
r233919 r373566 1 1 <?php 2 2 3 class wpbb_WordPress{ 4 function load(){ 5 } 6 7 function loadAdminAPI(){ 8 if(!function_exists('validate_username')){ 9 require_once(ABSPATH . '/wp-admin/includes/admin.php'); 10 } 11 else{ 12 $include_registration_contents = file_get_contents(ABSPATH . WPINC . '/registration.php'); 13 $include_registration_contents = preg_replace('/^\<\?php/','',$include_registration_contents); 14 $include_registration_contents = preg_replace('/\?\>$/','',$include_registration_contents); 15 $include_registration_contents = str_replace('validate_username','op_validate_username',$include_registration_contents); 16 17 $include_admin_contents = file_get_contents(ABSPATH . '/wp-admin/includes/admin.php'); 18 $include_admin_contents = preg_replace('/^\<\?php/','',$include_admin_contents); 19 $include_admin_contents = preg_replace('/\?\>$/','',$include_admin_contents); 20 $include_admin_contents = str_replace('require_once(ABSPATH . WPINC . \'/registration.php\');',$include_registration_contents,$include_admin_contents); 21 22 eval($include_admin_contents); 23 } 24 } 25 26 function addUser($user){ 27 global $wpdb; 28 mysql_select_db(DB_NAME); // Select WP database 29 30 // Derived from wp_insert_user() wp-includes/registration.php line 104 31 $user_login = sanitize_user( $user['username'] ); 32 $user_login = apply_filters('pre_user_login', $user_login); 33 34 35 //preparing user data 36 $user_pass = wp_hash_password($user['password']); 37 $user_email = $user['email'] ? $wpdb->escape($user['email']) : ''; 38 $user_login = $wpdb->escape($user_login); 39 $user_url = ''; 40 $user_nicename = apply_filters('pre_user_nicename', sanitize_title( $user_login )); 41 $display_name = $user_login; 42 $user_registered = gmdate('Y-m-d H:i:s'); 43 44 $data = compact( 'user_pass', 'user_email', 'user_login', 'user_url', 'user_nicename', 'display_name', 'user_registered' ); 45 46 //creation 47 $wpdb->insert( $wpdb->users, $data); 48 $user_id = (int) $wpdb->insert_id; 49 50 $wp_user = new WP_User($user_id); 51 $wp_user->set_role(get_option('default_role')); 52 53 wp_cache_delete($user_id, 'users'); 54 wp_cache_delete($user_login, 'userlogins'); 55 56 return $wp_user; 57 } 58 59 function getNicename($username){ 60 return apply_filters('pre_user_nicename', sanitize_title( $username )); 61 } 62 63 function logout(){ 64 wp_clear_auth_cookie(); 65 } 66 67 function updateUser($data){ 68 $user = ''; 69 $user->ID = wpbb_WordPress::getIdByName($data['username']); 70 $user->user_login = $data['username']; 71 $user->user_pass = $data['new_password']; 72 $user->user_email = $data['email']; 73 74 wp_update_user(get_object_vars($user)); 75 } 76 77 function changePassword($username, $password){ 78 $id = wpbb_WordPress::getIdByName($username); 79 if($id != false){ 80 $user = array(); 81 $user['ID'] = $id; 82 $user['user_pass'] = $password; 83 84 wp_update_user($user); 85 } 86 } 87 88 function getIdByName($user){ 89 mysql_select_db(DB_NAME); 90 //to find the informations correctly 91 //return get_profile('id', wpbb_WordPress::getNicename($user)); 92 return get_profile('id',$user); 93 } 94 95 function wpbb_login(){ 96 if ( isset( $_REQUEST['redirect_to'] ) ) 97 $redirect_to = $_REQUEST['redirect_to']; 98 else 99 $redirect_to = admin_url(); 100 101 if ( is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) ) 102 $secure_cookie = false; 103 else 104 $secure_cookie = ''; 105 106 if ('POST' == $_SERVER['REQUEST_METHOD']) { 107 $user = wp_signon('', $secure_cookie); 108 109 $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user); 110 111 if ( !is_wp_error($user) ) { 112 if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || strpos($redirect_to,'wp-admin/') )){ 113 $redirect_to = admin_url('profile.php'); 114 } 115 wp_safe_redirect($redirect_to); 116 exit(); 117 } 118 119 $errors = $user; 120 } 121 // Clear errors if loggedout is set. 122 if ( !empty($_GET['loggedout']) ) 123 $errors = new WP_Error(); 124 125 return array('redirect_to'=>$redirect_to,'errors'=>$errors); 126 } 127 128 function wpbb_register(){ 129 if ( !get_option('users_can_register') ) { 130 wp_redirect('wp-login.php?registration=disabled'); 131 exit(); 132 } 133 134 global $errors; 135 $errors = new WP_Error(); 136 require_once( ABSPATH . WPINC . '/registration.php'); 137 138 $user_login = ''; 139 $user_email = ''; 140 141 if ('POST' == $_SERVER['REQUEST_METHOD']) { 142 require_once( ABSPATH . WPINC . '/registration.php'); 143 144 $user_login = $_POST['user_login']; 145 $user_email = $_POST['user_email']; 146 register_new_user($user_login, $user_email); 147 if ( !is_wp_error($errors) ) { 148 wp_redirect('wp-login.php?checkemail=registered'); 149 exit(); 150 } 151 } 152 return $errors; 153 } 154 155 function wpbb_lostpassword(){ 156 $http_post = ('POST' == $_SERVER['REQUEST_METHOD']); 157 if ( $http_post ) { 158 $errors = retrieve_password(); 159 if ( !is_wp_error($errors) ) { 160 wp_redirect('wp-login.php?checkemail=confirm'); 161 exit(); 162 } 163 } 164 else{ 165 $errors = new WP_Error(); // initialize error object 166 } 167 168 if ( 'invalidkey' == $_GET['error'] && isset($errors)) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.')); 169 170 do_action('lost_password'); 171 return $errors; 172 } 173 174 function wpbb_profile(){ 175 if ( !$user_id ){ 176 $current_user = wp_get_current_user(); 177 $user_id = $current_user->ID; 178 } 179 require_once(ABSPATH.'wp-admin/includes/user.php'); 180 181 if($_POST['action'] == 'update'){ 182 require_once(ABSPATH.'wp-admin/includes/admin.php'); 183 check_admin_referer('update-user_' . $user_id); 184 185 do_action('personal_options_update'); 186 187 $errors = edit_user($user_id); 188 189 if( !is_wp_error( $errors ) ) { 190 global $wpdb; 191 $userdata = get_userdata( $user_id ); 192 $user_login = $wpdb->escape( $userdata->user_login ); 193 // is password being changed in wordpress? 194 if (!empty($_POST['pass1'])) // using $_POST['pass1'] is ok here because it will not reach this point if value doesn't pass checks in edit_user() 195 wpbb_updatePassword($user_login,$_POST['pass1'],'wp'); 196 197 if(!empty($_POST['email'])) 198 wpbb_updateEmail($user_login,$_POST['email'],'wp'); 199 200 //op_selectDbFromModule('wp'); 201 202 $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), "profile.php"); 203 wp_redirect($redirect); 204 exit; 205 } 206 } 207 208 $profileuser = get_user_to_edit($user_id); 209 210 return array( 211 'is_profile_page' => TRUE, 212 'profileuser' => $profileuser, 213 'user_id' => $user_id, 214 'errors' => $errors 215 ); 216 } 3 class wpbb_WordPress { 4 5 function load() { 6 7 } 8 9 function loadAdminAPI() { 10 require_once(ABSPATH . '/wp-admin/includes/admin.php'); 11 } 12 13 function addUser($user) { 14 global $wpdb; 15 mysql_select_db(DB_NAME); // Select WP database 16 // Derived from wp_insert_user() wp-includes/registration.php line 104 17 $user_login = sanitize_user($user['username']); 18 $user_login = apply_filters('pre_user_login', $user_login); 19 20 21 //preparing user data 22 $user_pass = wp_hash_password($user['password']); 23 $user_email = $user['email'] ? $wpdb->escape($user['email']) : ''; 24 $user_login = $wpdb->escape($user_login); 25 $user_url = ''; 26 $user_nicename = apply_filters('pre_user_nicename', sanitize_title($user_login)); 27 $display_name = $user_login; 28 $user_registered = gmdate('Y-m-d H:i:s'); 29 30 $data = compact('user_pass', 'user_email', 'user_login', 'user_url', 'user_nicename', 'display_name', 'user_registered'); 31 32 //creation 33 $wpdb->insert($wpdb->users, $data); 34 $user_id = (int) $wpdb->insert_id; 35 36 $wp_user = new WP_User($user_id); 37 $wp_user->set_role(get_option('default_role')); 38 39 wp_cache_delete($user_id, 'users'); 40 wp_cache_delete($user_login, 'userlogins'); 41 42 return $wp_user; 43 } 44 45 function getNicename($username) { 46 return apply_filters('pre_user_nicename', sanitize_title($username)); 47 } 48 49 function logout() { 50 wp_clear_auth_cookie(); 51 } 52 53 function updateUser($data) { 54 $user = ''; 55 $user->ID = wpbb_WordPress::getIdByName($data['username']); 56 $user->user_login = $data['username']; 57 $user->user_pass = $data['new_password']; 58 $user->user_email = $data['email']; 59 60 wp_update_user(get_object_vars($user)); 61 } 62 63 function changePassword($username, $password) { 64 $id = wpbb_WordPress::getIdByName($username); 65 if ($id != false) { 66 $user = array(); 67 $user['ID'] = $id; 68 $user['user_pass'] = $password; 69 70 wp_update_user($user); 71 } 72 } 73 74 function getIdByName($user) { 75 mysql_select_db(DB_NAME); 76 //to find the informations correctly 77 //return get_profile('id', wpbb_WordPress::getNicename($user)); 78 return get_profile('id', $user); 79 } 80 81 function wpbb_login() { 82 if (isset($_REQUEST['redirect_to'])) 83 $redirect_to = $_REQUEST['redirect_to']; 84 else 85 $redirect_to = admin_url(); 86 87 if (is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') )) 88 $secure_cookie = false; 89 else 90 $secure_cookie = ''; 91 92 if ('POST' == $_SERVER['REQUEST_METHOD']) { 93 $user = wp_signon('', $secure_cookie); 94 95 $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user); 96 97 if (!is_wp_error($user)) { 98 if (!$user->has_cap('edit_posts') && ( empty($redirect_to) || strpos($redirect_to, 'wp-admin/') )) { 99 $redirect_to = admin_url('profile.php'); 100 } 101 wp_safe_redirect($redirect_to); 102 exit(); 103 } 104 105 $errors = $user; 106 } 107 // Clear errors if loggedout is set. 108 if (!empty($_GET['loggedout'])) 109 $errors = new WP_Error(); 110 111 return array('redirect_to' => $redirect_to, 'errors' => $errors); 112 } 113 114 function wpbb_register() { 115 if (!get_option('users_can_register')) { 116 wp_redirect('wp-login.php?registration=disabled'); 117 exit(); 118 } 119 120 global $errors; 121 $errors = new WP_Error(); 122 require_once( ABSPATH . WPINC . '/registration.php'); 123 124 $user_login = ''; 125 $user_email = ''; 126 127 if ('POST' == $_SERVER['REQUEST_METHOD']) { 128 require_once( ABSPATH . WPINC . '/registration.php'); 129 130 $user_login = $_POST['user_login']; 131 $user_email = $_POST['user_email']; 132 register_new_user($user_login, $user_email); 133 if (!is_wp_error($errors)) { 134 wp_redirect('wp-login.php?checkemail=registered'); 135 exit(); 136 } 137 } 138 return $errors; 139 } 140 141 function wpbb_lostpassword() { 142 $http_post = ('POST' == $_SERVER['REQUEST_METHOD']); 143 if ($http_post) { 144 $errors = retrieve_password(); 145 if (!is_wp_error($errors)) { 146 wp_redirect('wp-login.php?checkemail=confirm'); 147 exit(); 148 } 149 } else { 150 $errors = new WP_Error(); // initialize error object 151 } 152 153 if ('invalidkey' == $_GET['error'] && isset($errors)) 154 $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.')); 155 156 do_action('lost_password'); 157 return $errors; 158 } 159 160 function wpbb_profile() { 161 if (!$user_id) { 162 $current_user = wp_get_current_user(); 163 $user_id = $current_user->ID; 164 } 165 require_once(ABSPATH . 'wp-admin/includes/user.php'); 166 167 if ($_POST['action'] == 'update') { 168 require_once(ABSPATH . 'wp-admin/includes/admin.php'); 169 check_admin_referer('update-user_' . $user_id); 170 171 do_action('personal_options_update'); 172 173 $errors = edit_user($user_id); 174 175 if (!is_wp_error($errors)) { 176 global $wpdb; 177 $userdata = get_userdata($user_id); 178 $user_login = $wpdb->escape($userdata->user_login); 179 // is password being changed in wordpress? 180 if (!empty($_POST['pass1'])) // using $_POST['pass1'] is ok here because it will not reach this point if value doesn't pass checks in edit_user() 181 wpbb_updatePassword($user_login, $_POST['pass1'], 'wp'); 182 183 if (!empty($_POST['email'])) 184 wpbb_updateEmail($user_login, $_POST['email'], 'wp'); 185 186 //op_selectDbFromModule('wp'); 187 188 $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), "profile.php"); 189 wp_redirect($redirect); 190 exit; 191 } 192 } 193 194 $profileuser = get_user_to_edit($user_id); 195 196 return array( 197 'is_profile_page' => TRUE, 198 'profileuser' => $profileuser, 199 'user_id' => $user_id, 200 'errors' => $errors 201 ); 202 } 203 217 204 } -
phpbb-single-sign-on/trunk/options.php
r242467 r373566 1 1 <?php 2 3 2 //wpbb_get_functions_conflict(); //TEST 4 3 5 $options_page = get_option('siteurl') . '/wp-admin/admin.php?page=phpbb-single-sign-on/options.php'; 6 7 //Version compatibility before 0.6.3 8 if(file_exists(ABSPATH.PHPBBPATH.'common.orig.php')){ 9 copy(ABSPATH.PHPBBPATH.'common.orig.php',$config_files['common-orig']['destin']); 10 unlink(ABSPATH.PHPBBPATH.'common.orig.php'); 11 } 12 13 14 switch($_POST['stage']){ 4 switch ($_POST['stage']) { 15 5 16 6 //Check if there are new options set … … 20 10 $new_options = array(); 21 11 22 foreach ($connect_phpbb_options as $key => $option){12 foreach ($connect_phpbb_options as $key => $option) { 23 13 $new_options[$key] = $_POST[strtolower($key)]; 24 14 } … … 30 20 //-------------------------------------------------------------------------- 31 21 $phpbb_db_prefix = wpbb_get_phpbb_prefix(); 32 if ($phpbb_db_prefix != ''){33 if (isset($_POST['auth_method']) && $_POST['auth_method'] != ''){22 if ($phpbb_db_prefix != '') { 23 if (isset($_POST['auth_method']) && $_POST['auth_method'] != '') { 34 24 wpbb_set_config_value($phpbb_db_prefix, 'auth_method', $_POST['auth_method']); 35 25 } 36 if (isset($_POST['wpbb_path']) && $_POST['wpbb_path'] != ''){26 if (isset($_POST['wpbb_path']) && $_POST['wpbb_path'] != '') { 37 27 wpbb_set_config_value($phpbb_db_prefix, 'wpbb_path', $_POST['wpbb_path']); 38 28 } 39 29 } 40 break; 30 break; 31 case 'install-common': 41 32 42 //Install the plugin 43 case 'install': 33 if (is_writable($config_files['common']['folder'])) { 34 //is original file ? 35 if (wpbb_get_file_version($config_files['common']['destin']) == 'Original') { 36 //is original file there ? 37 if (file_exists($config_files['common-orig']['destin'])) { 38 unlink($config_files['common-orig']['destin']); 39 } 40 //put the original file there 41 copy($config_files['common']['destin'], $config_files['common-orig']['destin']); 42 } 44 43 45 //if the auth folder is writable 46 if(is_writable($config_files['auth_wpbb']['folder'])){ 47 //the file is already installed 48 if(!file_exists($config_files['auth_wpbb']['destin'])){ 49 copy($config_files['auth_wpbb']['source'],$config_files['auth_wpbb']['destin']); 44 //in all cases, install the file 45 //is the file there ? 46 if (file_exists($config_files['common']['destin'])) { 47 unlink($config_files['common']['destin']); 48 } 49 copy($config_files['common']['source'], $config_files['common']['destin']); 50 50 } else { 51 unlink($config_files['auth_wpbb']['destin']); 52 copy($config_files['auth_wpbb']['source'],$config_files['auth_wpbb']['destin']); 53 } 54 //if the file isn't writable 55 } else { 56 $error = true; 57 } 58 59 if(is_writable($config_files['common']['folder'])){ 60 //is original file ? 61 if(wpbb_get_file_version($config_files['common']['destin']) == 'Original') { 62 //is original file there ? 63 if(file_exists($config_files['common-orig']['destin'])){ 64 unlink($config_files['common-orig']['destin']); 65 } 66 //put the original file there 67 copy($config_files['common']['destin'],$config_files['common-orig']['destin']); 51 $error = true; 68 52 } 69 53 70 //in all cases, install the file 71 //is the file there ? 72 if(file_exists($config_files['common']['destin'])){ 73 unlink($config_files['common']['destin']); 54 break; 55 case 'install-auth': 56 57 //if the auth folder is writable 58 if (is_writable($config_files['auth_wpbb']['folder'])) { 59 //the file is already installed 60 if (!file_exists($config_files['auth_wpbb']['destin'])) { 61 copy($config_files['auth_wpbb']['source'], $config_files['auth_wpbb']['destin']); 62 } else { 63 unlink($config_files['auth_wpbb']['destin']); 64 copy($config_files['auth_wpbb']['source'], $config_files['auth_wpbb']['destin']); 65 } 66 //if the file isn't writable 67 } else { 68 $error = true; 74 69 } 75 copy($config_files['common']['source'],$config_files['common']['destin']);76 70 77 } else { 78 $error = true; 71 break; 72 case 'patch-posting': 73 wpbb_validate_user_patch(realpath(ABSPATH . PHPBBPATH).'/posting.php'); 74 break; 79 75 80 } 81 break; 76 case 'patch-user_function'; 77 wpbb_validate_user_patch(realpath(ABSPATH . PHPBBPATH).'/includes/functions_user.php'); 78 wpbb_validate_user2_patch(realpath(ABSPATH . PHPBBPATH).'/includes/functions_user.php'); 79 break; 82 80 } 83 81 84 82 85 83 $phpbb_db_prefix = wpbb_get_phpbb_prefix(); 86 if ($phpbb_db_prefix != ''){84 if ($phpbb_db_prefix != '') { 87 85 $phpbb_found = true; 88 86 } else { 89 87 $phpbb_found = false; 90 88 } 91 92 89 ?> 93 90 <div class="wrap"> 94 <h2><?php _e('PHP BB Options', 'PHPBB') ?></h2> 95 <form name="form1" method="post" action="<?php echo $options_page ?>&updated=true"> 96 <input type="hidden" name="stage" value="update" /> 97 <table width="100%" cellspacing="2" cellpadding="5" class="form-table"> 98 <tr> 99 <th scope="row" colspan="2"><strong>Wordpress Part</strong></th> 100 <?php if($phpbb_found){ echo '<th scope="row" colspan="2"><strong>PHPBB Part</strong></th>'; } ?> 101 </tr> 91 <h2><?php _e('PHP BB Options', 'phpbb') ?></h2> 102 92 103 <tr valign="baseline"> 104 <th scope="row"><?php _e('Path', 'phpbb') ?></th> 105 <td> 106 <input type="text" value="<?php echo $connect_phpbb_options['path'] ?>" name="path" /> 107 <div><small><?php _e('To PHPBB from Wordpress', 'phpbb') ?></small></div> 108 </td> 109 <?php if($phpbb_found){ echo '<th scope="row">'; _e('Path', 'phpbb'); echo '</th> 110 <td> 111 <input type="text" value="'.wpbb_get_config_value('wpbb_path').'" name="wpbb_path" /> 112 <div><small>'; _e('To Wordpress from PHPBB', 'phpbb'); echo '</small></div> 113 </td>'; } ?> 114 </tr> 115 116 <?php if($phpbb_found){ ?> 117 <tr valign="baseline"> 118 <td> </td><td> </td> 119 <th scope="row"><?php _e('Auth Method', 'phpbb') ?></th> 120 <td> 121 <select name="auth_method"> 122 <?php echo wpbb_select_auth_method(wpbb_get_config_value('auth_method')); ?> 123 </select> 124 <div><small><?php _e('Auth method to use, you have to use "wpbb" to make this plugin work', 'phpbb') ?></small></div> 125 </td> 126 </tr> 127 <?php } ?> 128 129 </table> 130 <p class="submit"> 131 <input type="submit" name="Submit" value="<?php _e('Save Changes', 'phpbb') ?>" /> 132 </p> 133 </form> 134 135 <!-- Install files part --> 136 <form name="form2" method="post" action="<?php echo $options_page ?>"> 137 <input type="hidden" name="stage" value="install" /> 93 <form name="form1" method="post" id="configuration" action="<?php echo WPBB_OPTIONS_PAGE ?>&updated=true"> 94 <input type="hidden" name="stage" value="update" /> 95 <table class="widefat" summary="" title="PHPBB"> 96 <thead> 97 <tr> 98 <th scope="col" colspan="2"><?php _e('Wordpress Part', 'phpbb') ?></th> 99 <?php if ($phpbb_found) { ?> 100 <th scope="col" colspan="2"><?php _e('PHPBB Part', 'phpbb') ?></th> 101 <?php } ?> 102 </tr> 103 <tbody id="the-list"> 104 <tr valign="baseline"> 105 <th scope="row"><?php _e('Path', 'phpbb') ?></th> 106 <td> 107 <input type="text" value="<?php echo $connect_phpbb_options['path'] ?>" name="path" /> 108 <div><small><?php _e('To PHPBB from Wordpress', 'phpbb') ?></small></div> 109 </td> 110 <?php if ($phpbb_found) { 111 echo '<th scope="row">'; 112 _e('Path', 'phpbb'); 113 echo '</th> 114 <td> 115 <input type="text" value="' . wpbb_get_config_value('wpbb_path') . '" name="wpbb_path" /> 116 <div><small>'; 117 _e('To Wordpress from PHPBB', 'phpbb'); 118 echo '</small></div> 119 </td>'; 120 } ?> 121 </tr> 122 <?php if ($phpbb_found) { ?> 123 <tr valign="baseline"> 124 <td> </td><td> </td> 125 <th scope="row"><?php _e('Auth Method', 'phpbb') ?></th> 126 <td> 127 <select name="auth_method"> 128 <?php echo wpbb_select_auth_method(wpbb_get_config_value('auth_method')); ?> 129 </select> 130 <div><small><?php _e('Auth method to use, you have to use "wpbb" to make this plugin work', 'phpbb') ?></small></div> 131 </td> 132 </tr> 133 <?php } ?> 134 </tbody> 135 </table> 138 136 <p class="submit"> 139 <input type="submit" name="Submit" value="<?php _e(' Install Files in PHP BB', 'phpbb') ?>" />137 <input type="submit" name="Submit" value="<?php _e('Save Changes', 'phpbb') ?>" /> 140 138 </p> 141 139 </form> 142 140 143 <?php144 $error = wpbb_run_test();145 141 146 if($error == true) { ?> 147 <p>The phpBB Plugin is not activated now.</p> 142 <?php 143 $error = wpbb_run_test(); 148 144 149 <p>If the check didn't work correctly, you can see on the following instructions on how to manually correct the problems.</p> 150 <p>Notice : if the first test isn't correct, the following won't work, so please do it in the right order.</p> 145 if ($error == true) { 146 ?> 147 <p>The phpBB Plugin is not activated now.</p> 151 148 152 <p><strong>Wordpress Path</strong></p> 153 <p>This is the first thing you have to set, it is the relative path to your PHPBB installation.<br /> 154 If the wordpress is at the root of your web folder (/www/) and your forum in the wordpress folder (www/forum/).<br /> 155 You will have to set <strong>forum/</strong> as path. (don't forget the end slash) 156 </p> 149 <p>If the check didn't work correctly, you can see on the following instructions on how to manually correct the problems.</p> 150 <p>Notice : if the first test isn't correct, the following won't work, so please do it in the right order.</p> 157 151 158 <p><strong>auth_wpbb.php</strong></p> 159 <p>This file must be copied from <strong><?php echo $config_files['auth_wpbb']['source']; ?></strong> to <strong><?php echo $config_files['auth_wpbb']['destin']; ?></strong></p> 152 <p><strong>Wordpress Path</strong></p> 153 <p>This is the first thing you have to set, it is the relative path to your PHPBB installation.<br /> 154 If the wordpress is at the root of your web folder (/www/) and your forum in the wordpress folder (www/forum/).<br /> 155 You will have to set <strong>forum/</strong> as path. (don't forget the end slash) 156 </p> 160 157 161 <p><strong>common.php</strong></p> 162 <?php if(wpbb_get_file_version($config_files['common']['destin']) == 'Original'){ ?> 163 <p>It seems that this file is the original common.php file.<br /> 164 you will have to rename this file from <strong>common.php</strong> to <strong>common-orig.php</strong><br /> 165 the file is in the folder <strong><?php echo $config_files['common']['folder'] ?></strong></p> 166 <?php } ?> 167 <p>This file must be copied from <strong><?php echo $config_files['common']['source']; ?></strong> to <strong><?php echo $config_files['common']['destin']; ?></strong></p> 158 <p><strong>auth_wpbb.php</strong></p> 159 <p>This file must be copied from <strong><?php echo $config_files['auth_wpbb']['source']; ?></strong> to <strong><?php echo $config_files['auth_wpbb']['destin']; ?></strong></p> 168 160 169 <p><strong>common-orig.php</strong></p> 170 <p>You already did this on the previous step, this file doesn't exist by default, it's the original common.php file, because this script needs another one in place to load some libraries</p> 161 <p><strong>common.php</strong></p> 162 <?php if (wpbb_get_file_version($config_files['common']['destin']) == 'Original') { ?> 163 <p>It seems that this file is the original common.php file.<br /> 164 you will have to rename this file from <strong>common.php</strong> to <strong>common-orig.php</strong><br /> 165 the file is in the folder <strong><?php echo $config_files['common']['folder'] ?></strong></p> 166 <?php } ?> 167 <p>This file must be copied from <strong><?php echo $config_files['common']['source']; ?></strong> to <strong><?php echo $config_files['common']['destin']; ?></strong></p> 171 168 172 <p><strong>auth_method</strong></p> 173 <p>This form element only appears when the path_var is correctly set.<br />You have to set it to <strong>wpbb</strong></p> 174 <p></p> 175 <?php } ?> 169 <p><strong>common-orig.php</strong></p> 170 <p>You already did this on the previous step, this file doesn't exist by default, it's the original common.php file, because this script needs another one in place to load some libraries</p> 171 172 <p><strong>auth_method</strong></p> 173 <p>This form element only appears when the path_var is correctly set.<br />You have to set it to <strong>wpbb</strong></p> 174 <p></p> 175 <?php } ?> 176 176 </div> -
phpbb-single-sign-on/trunk/readme.txt
r242467 r373566 30 30 * Make it work on multiple db's 31 31 * Uninstaller 32 33 = 0.8 = 34 * Cleaner admin Area 35 * Added a way to patch files for the "validate_username" bug 36 * Rewrote some parts involved in login the user in the two codes are now separated 32 37 33 38 = 0.7.1 =
Note: See TracChangeset
for help on using the changeset viewer.