Changeset 21424 for extensions/Register_FluxBB/include
- Timestamp:
- Mar 10, 2013, 2:16:32 AM (12 years ago)
- Location:
- extensions/Register_FluxBB/include
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Register_FluxBB/include/constants.php
r17457 r21424 3 3 global $prefixeTable, $conf; 4 4 5 $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();5 $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); 6 6 7 7 define('Register_FluxBB_ID_TABLE', $prefixeTable.'Register_FluxBB_id'); 8 define('FluxBB_CONFIG_TABLE', $conf_Register_FluxBB['FLUXBB_PREFIX'].'config'); 9 define('FluxBB_USERS_TABLE', $conf_Register_FluxBB['FLUXBB_PREFIX'].'users'); 10 define('FluxBB_POSTS_TABLE', $conf_Register_FluxBB['FLUXBB_PREFIX'].'posts'); 11 define('FluxBB_TOPICS_TABLE', $conf_Register_FluxBB['FLUXBB_PREFIX'].'topics'); 12 define('FluxBB_SUBSCRIPTIONS_TABLE', $conf_Register_FluxBB['FLUXBB_PREFIX'].'topic_subscriptions'); 8 13 9 if (isset($conf_Register_FluxBB[0]))10 {11 define('FluxBB_CONFIG_TABLE', $conf_Register_FluxBB[0].'config');12 define('FluxBB_USERS_TABLE', $conf_Register_FluxBB[0].'users');13 define('FluxBB_POSTS_TABLE', $conf_Register_FluxBB[0].'posts');14 define('FluxBB_TOPICS_TABLE', $conf_Register_FluxBB[0].'topics');15 define('FluxBB_SUBSCRIPTIONS_TABLE', $conf_Register_FluxBB[0].'topic_subscriptions');16 }17 14 ?> -
extensions/Register_FluxBB/include/functions.inc.php
r17457 r21424 3 3 include_once (PHPWG_ROOT_PATH.'/include/constants.php'); 4 4 include_once (REGFLUXBB_PATH.'include/constants.php'); 5 6 7 function Audit_PWG_FluxBB() 8 { 9 global $page, $conf, $errors; 10 11 $page_Register_FluxBB_admin = get_admin_plugin_menu_link(__FILE__); 12 13 $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); 14 15 $msg_error_PWG_Dup = ''; 16 $msg_error_FluxBB_Dup = ''; 17 $msg_error_Link_Break = ''; 18 $msg_error_Link_Bad = ''; 19 $msg_error_Synchro = ''; 20 $msg_ok_Synchro = ''; 21 $msg_error_PWG2FluxBB = ''; 22 $msg_error_FluxBB2PWG = ''; 23 24 $query = ' 25 SELECT COUNT(*) AS nbr_dup, id, username 26 FROM '.USERS_TABLE.' 27 WHERE username NOT IN ("18","16") 28 GROUP BY BINARY username 29 HAVING COUNT(*) > 1 30 ;'; 31 $result = pwg_query($query); 32 33 while($row = pwg_db_fetch_assoc($result)) 34 $msg_error_PWG_Dup .= '<br>'.l10n('Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); 35 36 if ($msg_error_PWG_Dup == '') 37 array_push($page['infos'], l10n('Audit_PWG_Dup').'<br>'.l10n('Audit_OK')); 38 else 39 $msg_error_PWG_Dup = l10n('Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Advise_PWG_Dup'); 40 41 42 43 $query = ' 44 SELECT COUNT(*) AS nbr_dup, username 45 FROM '.FluxBB_USERS_TABLE.' 46 GROUP BY BINARY username 47 HAVING COUNT(*) > 1 48 ;'; 49 $result = pwg_query($query); 50 51 while($row = pwg_db_fetch_assoc($result)) 52 { 53 $msg_error_FluxBB_Dup .= '<br>'.l10n('Error_FluxBB_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); 54 55 $subquery = ' 56 SELECT id, username, email 57 FROM '.FluxBB_USERS_TABLE.' 58 WHERE BINARY username = BINARY "'.$row['username'].'" 59 ;'; 60 $subresult = pwg_query($subquery); 61 62 while($subrow = pwg_db_fetch_assoc($subresult)) 63 { 64 $msg_error_FluxBB_Dup .= '<br>id:'.$subrow['id'].'='.stripslashes($subrow['username']).' ('.$subrow['email'].')'; 65 66 $msg_error_FluxBB_Dup .= ' <a href="'; 67 68 $msg_error_FluxBB_Dup .= add_url_params($page_Register_FluxBB_admin, array( 69 'action' => 'del_user', 70 'id' => $subrow['id'], 71 )); 72 73 $msg_error_FluxBB_Dup .= '" title="'.l10n('Del_User').stripslashes($subrow['username']).'"'; 74 75 $msg_error_FluxBB_Dup .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 76 77 $msg_error_FluxBB_Dup .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').$subrow['username'].'" /></a>'; 78 } 79 } 80 81 if ($msg_error_FluxBB_Dup == '') 82 array_push($page['infos'], l10n('Audit_FluxBB_Dup').'<br>'.l10n('Audit_OK')); 83 else 84 $msg_error_FluxBB_Dup = l10n('Audit_FluxBB_Dup').$msg_error_FluxBB_Dup.'<br>'.l10n('Advise_FluxBB_Dup'); 85 86 87 88 $query = ' 89 SELECT pwg.id as pwg_id, bb.id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail 90 FROM '.FluxBB_USERS_TABLE.' AS bb, '.USERS_TABLE.' as pwg 91 WHERE bb.id NOT in ( 92 SELECT id_user_FluxBB 93 FROM '.Register_FluxBB_ID_TABLE.' 94 ) 95 AND pwg.id NOT in ( 96 SELECT id_user_pwg 97 FROM '.Register_FluxBB_ID_TABLE.' 98 ) 99 AND pwg.username = bb.username 100 AND pwg.username NOT IN ("18","16") 101 AND pwg.mail_address = bb.email 102 ;'; 103 104 $result = pwg_query($query); 105 106 while($row = pwg_db_fetch_assoc($result)) 107 { 108 $msg_error_Link_Break .= '<br>'.l10n('Error_Link_Break').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'; 109 110 $msg_error_Link_Break .= ' <a href="'; 111 112 $msg_error_Link_Break .= add_url_params($page_Register_FluxBB_admin, array( 113 'action' => 'new_link', 114 'pwg_id' => $row['pwg_id'], 115 'bb_id' => $row['bb_id'], 116 )); 117 118 $msg_error_Link_Break .= '" title="'.l10n('New_Link').stripslashes($row['pwg_user']).'"'; 119 120 $msg_error_Link_Break .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 121 122 $msg_error_Link_Break .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_break.png" alt="'.l10n('New_Link').stripslashes($row['pwg_user']).'" /></a>'; 123 } 124 125 if ($msg_error_Link_Break == '') 126 array_push($page['infos'], l10n('Audit_Link_Break').'<br>'.l10n('Audit_OK')); 127 else 128 $msg_error_Link_Break = l10n('Audit_Link_Break').$msg_error_Link_Break; 129 130 131 132 $query = ' 133 SELECT pwg.username as pwg_user, pwg.id as pwg_id, pwg.mail_address as pwg_mail, bb.id as bb_id, bb.username as bb_user, bb.email as bb_mail 134 FROM '.FluxBB_USERS_TABLE.' AS bb 135 INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = bb.id 136 INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id 137 WHERE pwg.username <> bb.username 138 AND pwg.username NOT IN ("18","16") 139 ;'; 140 141 $result = pwg_query($query); 142 143 while($row = pwg_db_fetch_assoc($result)) 144 { 145 $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')'; 146 147 $msg_error_Link_Bad .= ' <a href="'; 148 149 $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 150 'action' => 'link_del', 151 'pwg_id' => $row['pwg_id'], 152 'bb_id' => $row['bb_id'], 153 )); 154 155 $msg_error_Link_Bad .= '" title="'.l10n('Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"'; 156 157 $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 158 159 $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_delete.png" alt="'.l10n('Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'" /></a>'; 160 161 $msg_error_Link_Bad .= ' -- <a href="'; 162 163 $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 164 'action' => 'sync_user', 165 'username' => stripslashes($row['pwg_user']), 166 )); 167 168 $msg_error_Link_Bad .= '" title="'.l10n('Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'"'; 169 170 $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 171 172 $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/arrow_switch.png" alt="'.l10n('Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'" /></a>'; 173 } 174 175 176 $query = ' 177 SELECT COUNT(*) as nbr_dead 178 FROM '.Register_FluxBB_ID_TABLE.' AS Link 179 WHERE id_user_FluxBB NOT IN ( 180 SELECT id 181 FROM '.FluxBB_USERS_TABLE.' 182 ) 183 OR id_user_pwg NOT IN ( 184 SELECT id 185 FROM '.USERS_TABLE.' 186 ) 187 ;'; 188 189 $Compteur = pwg_db_fetch_assoc(pwg_query($query)); 190 191 if (!empty($Compteur) and $Compteur['nbr_dead'] > 0) 192 { 193 $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Dead').$Compteur['nbr_dead']; 194 195 $msg_error_Link_Bad .= ' <a href="'; 196 197 $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 198 'action' => 'link_dead', 199 )); 200 201 $msg_error_Link_Bad .= '" title="'.l10n('Link_Dead').$Compteur['nbr_dead'].'"'; 202 203 $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 204 205 $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_delete.png" alt="'.l10n('Link_Dead').$Compteur['nbr_dead'].'" /></a>'; 206 } 207 208 $query = ' 209 SELECT COUNT(*) AS nbr_dup, pwg.id AS pwg_id, pwg.username AS pwg_user, bb.username AS bb_user, bb.id AS bb_id 210 FROM '.FluxBB_USERS_TABLE.' AS bb 211 INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = bb.id 212 INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id 213 WHERE pwg.username NOT IN ("18","16") 214 GROUP BY link.id_user_pwg, link.id_user_FluxBB 215 HAVING COUNT(*) > 1 216 ;'; 217 218 $result = pwg_query($query); 219 220 while($row = pwg_db_fetch_assoc($result)) 221 { 222 $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')'; 223 224 $msg_error_Link_Bad .= ' <a href="'; 225 226 $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( 227 'action' => 'new_link', 228 'pwg_id' => $row['pwg_id'], 229 'bb_id' => $row['bb_id'], 230 )); 231 232 $msg_error_Link_Bad .= '" title="'.l10n('Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"'; 233 234 $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 235 236 $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_error.png" alt="'.l10n('Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'" /></a>'; 237 } 238 239 if ($msg_error_Link_Bad == '') 240 array_push($page['infos'], l10n('Audit_Link_Bad').'<br>'.l10n('Audit_OK')); 241 else 242 $msg_error_Link_Bad = l10n('Audit_Link_Bad').$msg_error_Link_Bad; 243 244 245 246 $query = ' 247 SELECT pwg.username as username, pwg.password as pwg_pwd, pwg.mail_address as pwg_eml, FluxBB.password as bb_pwd, FluxBB.email as bb_eml 248 FROM '.FluxBB_USERS_TABLE.' AS FluxBB 249 INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = FluxBB.id 250 INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id 251 WHERE BINARY pwg.username = BINARY FluxBB.username 252 AND pwg.username NOT IN ("18","16") 253 ORDER BY LOWER(pwg.username) 254 ;'; 255 256 $result = pwg_query($query); 257 258 while($row = pwg_db_fetch_assoc($result)) 259 { 260 if ( ($row['pwg_pwd'] != $row['bb_pwd']) or ($row['pwg_eml'] != $row['bb_eml']) ) 261 { 262 $msg_error_Synchro .= '<br>'.l10n('Error_Synchro').stripslashes($row['username']); 263 264 $msg_error_Synchro .= ' <a href="'; 265 266 $msg_error_Synchro .= add_url_params($page_Register_FluxBB_admin, array( 267 'action' => 'sync_user', 268 'username' => stripslashes($row['username']), 269 )); 270 271 $msg_error_Synchro .= '" title="'.l10n('Sync_User').stripslashes($row['username']).'"'; 272 273 $msg_error_Synchro .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 274 275 $msg_error_Synchro .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_refresh.png" alt="'.l10n('Sync_User').stripslashes($row['username']).'" /></a>'; 276 277 if ($row['pwg_pwd'] != $row['bb_pwd']) 278 $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Pswd'); 279 280 if ($row['pwg_eml'] != $row['bb_eml']) 281 $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Mail').'<br>-- PWG = '.$row['pwg_eml'].'<br>-- FluxBB = '.$row['bb_eml']; 282 } 283 else if ($conf_Register_FluxBB['FLUXBB_DETAIL'] == 'true') 284 $msg_ok_Synchro .= '<br> - '.stripslashes($row['username']).' ('.$row['pwg_eml'].')'.l10n('Audit_Synchro_OK'); 285 } 286 287 if ($msg_error_Synchro <> '') 288 $msg_error_Synchro = l10n('Audit_Synchro').$msg_error_Synchro; 289 290 if ($msg_ok_Synchro <> '') 291 if ($msg_error_Synchro <> '') 292 array_push($page['infos'], l10n('Audit_Synchro').$msg_ok_Synchro.'<br><br>'); 293 else 294 array_push($page['infos'], l10n('Audit_Synchro').$msg_ok_Synchro.'<br><br>'.l10n('Audit_OK')); 295 296 297 $query = ' 298 SELECT username, mail_address FROM '.USERS_TABLE.' 299 WHERE BINARY username <> BINARY "guest" 300 AND username NOT IN ("18","16") 301 AND id not in ( 302 SELECT id_user_pwg FROM '.Register_FluxBB_ID_TABLE.' 303 ) 304 AND BINARY username not in ( 305 SELECT username FROM '.FluxBB_USERS_TABLE.' 306 ) 307 ORDER BY LOWER(username) 308 ;'; 309 310 $result = pwg_query($query); 311 312 while($row = pwg_db_fetch_assoc($result)) 313 { 314 $msg_error_PWG2FluxBB .= '<br>'.l10n('Error_PWG2FluxBB').stripslashes($row['username']).' ('.$row['mail_address'].')'; 315 316 $msg_error_PWG2FluxBB .= ' <a href="'; 317 318 $msg_error_PWG2FluxBB .= add_url_params($page_Register_FluxBB_admin, array( 319 'action' => 'add_user', 320 'username' => stripslashes($row['username']), 321 )); 322 323 $msg_error_PWG2FluxBB .= '" title="'.l10n('Add_User').stripslashes($row['username']).'" '; 324 325 $msg_error_PWG2FluxBB .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 326 327 $msg_error_PWG2FluxBB .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_add.png" alt="'.l10n('Add_User').stripslashes($row['username']).'" /></a>'; 328 } 329 330 if ($msg_error_PWG2FluxBB == '') 331 array_push($page['infos'], l10n('Audit_PWG2FluxBB').'<br>'.l10n('Audit_OK')); 332 else 333 $msg_error_PWG2FluxBB = l10n('Audit_PWG2FluxBB').$msg_error_PWG2FluxBB; 334 335 336 337 $query = ' 338 SELECT id, username, email FROM '.FluxBB_USERS_TABLE.' 339 WHERE BINARY username <> BINARY "'.$conf_Register_FluxBB['FLUXBB_GUEST'].'" 340 AND id not in ( 341 SELECT id_user_FluxBB FROM '.Register_FluxBB_ID_TABLE.' 342 ) 343 AND BINARY username not in ( 344 SELECT username FROM '.USERS_TABLE.' 345 ) 346 ORDER BY LOWER(username) 347 ;'; 348 349 $result = pwg_query($query); 350 351 while($row = pwg_db_fetch_assoc($result)) 352 { 353 $msg_error_FluxBB2PWG .= '<br>'.l10n('Error_FluxBB2PWG').stripslashes($row['username']).' ('.$row['email'].')'; 354 355 $msg_error_FluxBB2PWG .= ' <a href="'; 356 357 $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( 358 'action' => 'del_user', 359 'id' => $row['id'], 360 )); 361 362 $msg_error_FluxBB2PWG .= '" title="'.l10n('Del_User').stripslashes($row['username']).'"'; 363 364 $msg_error_FluxBB2PWG .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; 365 366 $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>'; 367 } 368 369 if ($msg_error_FluxBB2PWG == '') 370 array_push($page['infos'], l10n('Audit_FluxBB2PWG').'<br>'.l10n('Audit_OK')); 371 else 372 $msg_error_FluxBB2PWG = l10n('Audit_FluxBB2PWG').$msg_error_FluxBB2PWG; 373 374 375 376 if ($msg_error_PWG_Dup <> '') 377 $errors[] = $msg_error_PWG_Dup . ( ($msg_error_FluxBB_Dup == '' and $msg_error_Link_Break == '' and $msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); 378 379 if ($msg_error_FluxBB_Dup <> '') 380 $errors[] = $msg_error_FluxBB_Dup . ( ($msg_error_Link_Break == '' and $msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); 381 382 if ($msg_error_Link_Break <> '') 383 $errors[] = $msg_error_Link_Break . ( ($msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); 384 385 if ($msg_error_Link_Bad <> '') 386 $errors[] = $msg_error_Link_Bad . ( ($msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); 387 388 if ($msg_error_Synchro <> '') 389 $errors[] = $msg_error_Synchro . ( ($msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); 390 391 if ($msg_error_PWG2FluxBB <> '') 392 $errors[] = $msg_error_PWG2FluxBB . ( ($msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); 393 394 if ($msg_error_FluxBB2PWG <> '') 395 $errors[] = $msg_error_FluxBB2PWG; 396 } 5 397 6 398 … … 47 439 FROM '.USERS_TABLE.' 48 440 WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' 441 AND '.$conf['user_fields']['username'].' NOT IN ("18","16") 49 442 ;'; 50 443 … … 61 454 global $conf, $user; 62 455 63 $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();456 $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); 64 457 65 458 // Check if UAM is installed and if bridge is set - Exception for admins and webmasters … … 73 466 if ($data['status'] <> "admin" and $data['status'] <> "webmaster") 74 467 { 75 if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB[ 6]) and $conf_Register_FluxBB[6] == 'true')468 if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB['FLUXBB_UAM_LINK']) and $conf_Register_FluxBB['FLUXBB_UAM_LINK'] == 'true') 76 469 { 77 470 $conf_UAM = unserialize($conf['UserAdvManager']); 78 471 79 472 // Getting unvalidated users group else Piwigo's default group 80 if (isset($conf_UAM[ 2]) and $conf_UAM[2] != '-1')473 if (isset($conf_UAM['NO_CONFIRM_GROUP']) and $conf_UAM['NO_CONFIRM_GROUP'] != '-1') 81 474 { 82 $Waitingroup = $conf_UAM[ 2];475 $Waitingroup = $conf_UAM['NO_CONFIRM_GROUP']; 83 476 } 84 477 else … … 104 497 105 498 // Check if logged in user is in a FluxBB's unvalidated group 106 $query = "499 $query = ' 107 500 SELECT group_id 108 FROM ".FluxBB_USERS_TABLE."109 WHERE id = ".FluxBB_Searchuser($user['id'])."110 ; ";501 FROM '.FluxBB_USERS_TABLE.' 502 WHERE id = '.FluxBB_Searchuser($user['id']).' 503 ;'; 111 504 112 505 $data = pwg_db_fetch_assoc(pwg_query($query)); 113 506 114 // Logged in user switch to the default FluxBB's group if he 'is validated115 if ($count == 0 and $data['group_id'] = $conf_Register_FluxBB[ 7])507 // Logged in user switch to the default FluxBB's group if he is validated 508 if ($count == 0 and $data['group_id'] = $conf_Register_FluxBB['FLUXBB_GROUP']) 116 509 { 117 $query = "510 $query = ' 118 511 SELECT conf_value 119 FROM ".FluxBB_CONFIG_TABLE."120 WHERE conf_name = 'o_default_user_group'121 ; ";512 FROM '.FluxBB_CONFIG_TABLE.' 513 WHERE conf_name = "o_default_user_group" 514 ;'; 122 515 123 516 $o_user_group = pwg_db_fetch_assoc(pwg_query($query)); 124 517 125 $query = "126 UPDATE ".FluxBB_USERS_TABLE."127 SET group_id = ".$o_user_group['conf_value']."128 WHERE id = ".FluxBB_Searchuser($user['id'])."129 ; ";518 $query = ' 519 UPDATE '.FluxBB_USERS_TABLE.' 520 SET group_id = '.$o_user_group['conf_value'].' 521 WHERE id = '.FluxBB_Searchuser($user['id']).' 522 ;'; 130 523 pwg_query($query); 131 524 } … … 139 532 global $conf; 140 533 141 // Because FluxBB is case insensitive on login name, we have to check if a similar login already exists in FluxBB's user table534 // Because FluxBB is case insensitive on login name, we have to check if a similar login already exists in FluxBB's user table 142 535 // If "test" user already exists, "TEST" or "Test" (and so on...) can't register 143 $query = "536 $query = ' 144 537 SELECT username 145 FROM ".FluxBB_USERS_TABLE."146 WHERE LOWER( ".stripslashes('username').") = '".strtolower($user['username'])."'147 ; ";538 FROM '.FluxBB_USERS_TABLE.' 539 WHERE LOWER('.stripslashes('username').') = "'.strtolower($user['username']).'" 540 ;'; 148 541 149 542 $count = pwg_db_num_rows(pwg_query($query)); … … 159 552 function FluxBB_Linkuser($pwg_id, $bb_id) 160 553 { 161 $query = "554 $query = ' 162 555 SELECT pwg.id as pwg_id, bb.id as bb_id 163 FROM ".USERS_TABLE." pwg, ".FluxBB_USERS_TABLE." bb 164 WHERE pwg.id = ".$pwg_id." 165 AND bb.id = ".$bb_id." 166 AND pwg.username = bb.username 167 ;"; 556 FROM '.USERS_TABLE.' pwg, '.FluxBB_USERS_TABLE.' bb 557 WHERE pwg.id = '.$pwg_id.' 558 AND bb.id = '.$bb_id.' 559 AND pwg.username = bb.username 560 AND pwg.username NOT IN ("18","16") 561 ;'; 168 562 169 563 $data = pwg_db_fetch_row(pwg_query($query)); … … 171 565 if (!empty($data)) 172 566 { 173 $subquery = "174 DELETE FROM ".Register_FluxBB_ID_TABLE."175 WHERE id_user_pwg = '".$pwg_id."'176 OR id_user_FluxBB = '".$bb_id."'177 ; ";567 $subquery = ' 568 DELETE FROM '.Register_FluxBB_ID_TABLE.' 569 WHERE id_user_pwg = "'.$pwg_id.'" 570 OR id_user_FluxBB = "'.$bb_id.'" 571 ;'; 178 572 179 573 $subresult = pwg_query($subquery); 180 574 181 $subquery = "182 INSERT INTO ".Register_FluxBB_ID_TABLE."575 $subquery = ' 576 INSERT INTO '.Register_FluxBB_ID_TABLE.' 183 577 (id_user_pwg, id_user_FluxBB) 184 VALUES ( ".$pwg_id.", ".$bb_id.")185 ; ";578 VALUES ('.$pwg_id.', '.$bb_id.') 579 ;'; 186 580 187 581 $subresult = pwg_query($subquery); … … 193 587 function FluxBB_Unlinkuser($bb_id) 194 588 { 195 $query = "196 DELETE FROM ".Register_FluxBB_ID_TABLE."197 WHERE id_user_FluxBB = ".$bb_id."198 ; ";589 $query = ' 590 DELETE FROM '.Register_FluxBB_ID_TABLE.' 591 WHERE id_user_FluxBB = '.$bb_id.' 592 ;'; 199 593 200 594 $result = pwg_query($query); … … 207 601 global $errors, $conf; 208 602 209 $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();603 $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); 210 604 211 605 $registred = time(); … … 213 607 214 608 // Check if UAM is installed and if bridge is set - Exception for admins and webmasters 215 if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB[ 6]) and $conf_Register_FluxBB[6] == 'true')216 { 217 $o_default_user_group = $conf_Register_FluxBB[7];609 if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB['FLUXBB_UAM_LINK']) and $conf_Register_FluxBB['FLUXBB_UAM_LINK'] == 'true') 610 { 611 $o_default_user_group1 = $conf_Register_FluxBB['FLUXBB_GROUP']; 218 612 } 219 613 else 220 614 { 615 $query = ' 616 SELECT conf_value 617 FROM '.FluxBB_CONFIG_TABLE.' 618 WHERE conf_name = "o_default_user_group" 619 ;'; 620 621 $o_default_user_group = pwg_db_fetch_assoc(pwg_query($query)); 622 } 623 624 // Check for FluxBB version 1.4.x or higher and get the correct value 625 $query1 = ' 626 SELECT conf_value 627 FROM '.FluxBB_CONFIG_TABLE.' 628 WHERE conf_name = "o_default_timezone" 629 ;'; 630 631 $count1 = pwg_db_num_rows(pwg_query($query1)); 632 633 // Check for FluxBB version 1.2.x and get the correct value 634 $query2 = ' 635 SELECT conf_value 636 FROM '.FluxBB_CONFIG_TABLE.' 637 WHERE conf_name = "o_server_timezone" 638 ;'; 639 640 $count2 = pwg_db_num_rows(pwg_query($query2)); 641 642 if ($count1 == 1 and $count2 == 0) 643 { 644 $o_default_timezone = pwg_db_fetch_assoc(pwg_query($query1)); 645 } 646 else if ($count1 == 0 and $count2 == 1) 647 { 648 $o_default_timezone = pwg_db_fetch_assoc(pwg_query($query2)); 649 } 650 651 652 $query = ' 653 SELECT conf_value 654 FROM '.FluxBB_CONFIG_TABLE.' 655 WHERE conf_name = "o_default_lang" 656 ;'; 657 658 $o_default_lang = pwg_db_fetch_assoc(pwg_query($query)); 659 660 $query = ' 661 SELECT conf_value 662 FROM '.FluxBB_CONFIG_TABLE.' 663 WHERE conf_name = "o_default_style" 664 ;'; 665 666 $o_default_style = pwg_db_fetch_assoc(pwg_query($query)); 667 668 // Check if UAM is installed and if bridge is set - Exception for admins and webmasters 669 if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB['FLUXBB_UAM_LINK']) and $conf_Register_FluxBB['FLUXBB_UAM_LINK'] == 'true') 670 { 221 671 $query = " 222 SELECT conf_value223 FROM ".FluxBB_CONFIG_TABLE."224 WHERE conf_name = 'o_default_user_group'225 ;";226 227 $o_default_user_group = pwg_db_fetch_assoc(pwg_query($query));228 }229 230 // Check for FluxBB version 1.4.x and get the correct value231 $query1 = "232 SELECT conf_value233 FROM ".FluxBB_CONFIG_TABLE."234 WHERE conf_name = 'o_default_timezone'235 ;";236 237 $count1 = pwg_db_num_rows(pwg_query($query1));238 239 // Check for FluxBB version 1.2.x and get the correct value240 $query2 = "241 SELECT conf_value242 FROM ".FluxBB_CONFIG_TABLE."243 WHERE conf_name = 'o_server_timezone'244 ;";245 246 $count2 = pwg_db_num_rows(pwg_query($query2));247 248 if ($count1 == 1 and $count2 == 0)249 {250 $o_default_timezone = pwg_db_fetch_assoc(pwg_query($query1));251 }252 else if ($count1 == 0 and $count2 == 1)253 {254 $o_default_timezone = pwg_db_fetch_assoc(pwg_query($query2));255 }256 257 258 $query = "259 SELECT conf_value260 FROM ".FluxBB_CONFIG_TABLE."261 WHERE conf_name = 'o_default_lang'262 ;";263 264 $o_default_lang = pwg_db_fetch_assoc(pwg_query($query));265 266 $query = "267 SELECT conf_value268 FROM ".FluxBB_CONFIG_TABLE."269 WHERE conf_name = 'o_default_style'270 ;";271 272 $o_default_style = pwg_db_fetch_assoc(pwg_query($query));273 274 $query = "275 672 INSERT INTO ".FluxBB_USERS_TABLE." ( 276 username, 277 ". ( isset($o_default_user_group ['conf_value']) ? 'group_id' : '' ) .",278 password, 279 email, 673 username, 674 ". ( isset($o_default_user_group1) ? 'group_id' : '' ) .", 675 password, 676 email, 280 677 ". ( isset($o_default_timezone['conf_value']) ? 'timezone' : '' ) .", 281 678 ". ( isset($o_default_lang['conf_value']) ? 'language' : '' ) .", 282 679 ". ( isset($o_default_style['conf_value']) ? 'style' : '' ) .", 283 registered, 284 registration_ip, 680 registered, 681 registration_ip, 682 last_visit 683 ) 684 VALUES( 685 '".pwg_db_real_escape_string($login)."', 686 ". ( isset($o_default_user_group1) ? "'".$o_default_user_group1."'" : '' ) .", 687 '".$password."', 688 '".$adresse_mail."', 689 ". ( isset($o_default_timezone['conf_value']) ? "'".$o_default_timezone['conf_value']."'" : '' ) .", 690 ". ( isset($o_default_lang['conf_value']) ? "'".$o_default_lang['conf_value']."'" : '' ) .", 691 ". ( isset($o_default_style['conf_value']) ? "'".$o_default_style['conf_value']."'" : '' ) .", 692 '".$registred."', 693 '".$registred_ip."', 694 '".$registred."' 695 );"; 696 697 $result = pwg_query($query); 698 } 699 else 700 { 701 $query = " 702 INSERT INTO ".FluxBB_USERS_TABLE." ( 703 username, 704 ". ( isset($o_default_user_group['conf_value']) ? 'group_id' : '' ) .", 705 password, 706 email, 707 ". ( isset($o_default_timezone['conf_value']) ? 'timezone' : '' ) .", 708 ". ( isset($o_default_lang['conf_value']) ? 'language' : '' ) .", 709 ". ( isset($o_default_style['conf_value']) ? 'style' : '' ) .", 710 registered, 711 registration_ip, 285 712 last_visit 286 713 ) … … 298 725 ) 299 726 ;"; 300 301 $result = pwg_query($query);727 $result = pwg_query($query); 728 } 302 729 303 730 $bb_id = pwg_db_insert_id(); … … 310 737 function FluxBB_Searchuser($id_user_pwg) 311 738 { 312 $query = "739 $query = ' 313 740 SELECT id_user_FluxBB, id_user_pwg 314 FROM ".Register_FluxBB_ID_TABLE."315 WHERE id_user_pwg = ".$id_user_pwg."741 FROM '.Register_FluxBB_ID_TABLE.' 742 WHERE id_user_pwg = '.$id_user_pwg.' 316 743 LIMIT 1 317 ; ";744 ;'; 318 745 319 746 $data = pwg_db_fetch_assoc(pwg_query($query)); … … 331 758 global $conf; 332 759 333 $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array(); 334 335 $query0 = " 336 SELECT username, id FROM ".FluxBB_USERS_TABLE." 337 WHERE id = ".$id_user_FluxBB." 760 $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); 761 762 $query0 = ' 763 SELECT username, id 764 FROM '.FluxBB_USERS_TABLE.' 765 WHERE id = '.$id_user_FluxBB.' 338 766 LIMIT 1 339 ; ";767 ;'; 340 768 341 769 $data0 = pwg_db_fetch_assoc(pwg_query($query0)); 342 770 343 771 // If True, delete related topics and posts 344 if ($SuppTopicsPosts and $conf_Register_FluxBB[ 3])772 if ($SuppTopicsPosts and $conf_Register_FluxBB['FLUXBB_DEL_PT']) 345 773 { 346 774 // Delete posts and topics of this user 347 $subquery = "348 DELETE FROM ".FluxBB_POSTS_TABLE."349 WHERE poster_id = ".$id_user_FluxBB."350 ; ";775 $subquery = ' 776 DELETE FROM '.FluxBB_POSTS_TABLE.' 777 WHERE poster_id = '.$id_user_FluxBB.' 778 ;'; 351 779 352 780 $subresult = pwg_query($subquery); 353 781 354 782 // Delete topics of this user 355 $subquery = "356 DELETE FROM ".FluxBB_TOPICS_TABLE."357 WHERE BINARY poster = BINARY '".pwg_db_real_escape_string($data0['username'])."'358 ; ";783 $subquery = ' 784 DELETE FROM '.FluxBB_TOPICS_TABLE.' 785 WHERE BINARY poster = BINARY "'.pwg_db_real_escape_string($data0['username']).'" 786 ;'; 359 787 360 788 $subresult = pwg_query($subquery); … … 362 790 363 791 // Delete user's subscriptions 364 $subquery = "365 DELETE FROM ".FluxBB_SUBSCRIPTIONS_TABLE."366 WHERE user_id = ".$id_user_FluxBB."367 ; ";792 $subquery = ' 793 DELETE FROM '.FluxBB_SUBSCRIPTIONS_TABLE.' 794 WHERE user_id = '.$id_user_FluxBB.' 795 ;'; 368 796 369 797 $subresult = pwg_query($subquery); 370 798 371 799 // Delete user's account 372 $subquery = "373 DELETE FROM ".FluxBB_USERS_TABLE."374 WHERE id = ".$id_user_FluxBB."375 ; ";800 $subquery = ' 801 DELETE FROM '.FluxBB_USERS_TABLE.' 802 WHERE id = '.$id_user_FluxBB.' 803 ;'; 376 804 377 805 $subresult = pwg_query($subquery); … … 386 814 include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); 387 815 388 $query = "816 $query = ' 389 817 SELECT id_user_FluxBB as FluxBB_id 390 FROM ".Register_FluxBB_ID_TABLE."391 WHERE id_user_pwg = ".$pwg_id."392 ; ";818 FROM '.Register_FluxBB_ID_TABLE.' 819 WHERE id_user_pwg = '.$pwg_id.' 820 ;'; 393 821 394 822 $row = pwg_db_fetch_assoc(pwg_query($query)); … … 396 824 if (!empty($row)) 397 825 { 398 $query = " 399 UPDATE ".FluxBB_USERS_TABLE." 400 SET username = '".pwg_db_real_escape_string($username)."', email = '".$adresse_mail."', password = '".$password."' 401 WHERE id = ".$row['FluxBB_id']." 402 ;"; 826 $query = ' 827 UPDATE '.FluxBB_USERS_TABLE.' 828 SET username = "'.pwg_db_real_escape_string($username).'", email = "'.$adresse_mail.'", password = "'.$password.'" 829 WHERE id = '.$row['FluxBB_id'].' 830 AND "'.pwg_db_real_escape_string($username).'" NOT IN ("18","16") 831 ;'; 403 832 404 833 $result = pwg_query($query); … … 408 837 else 409 838 { 410 $query = "839 $query = ' 411 840 SELECT id as FluxBB_id 412 FROM ".FluxBB_USERS_TABLE."413 WHERE BINARY username = BINARY '".pwg_db_real_escape_string($username)."'414 ; ";841 FROM '.FluxBB_USERS_TABLE.' 842 WHERE BINARY username = BINARY "'.pwg_db_real_escape_string($username).'" 843 ;'; 415 844 416 845 $row = pwg_db_fetch_assoc(pwg_query($query)); … … 418 847 if (!empty($row)) 419 848 { 420 $query = " 421 UPDATE ".FluxBB_USERS_TABLE." 422 SET username = '".pwg_db_real_escape_string($username)."', email = '".$adresse_mail."', password = '".$password."' 423 WHERE id = ".$row['FluxBB_id']." 424 ;"; 849 $query = ' 850 UPDATE '.FluxBB_USERS_TABLE.' 851 SET username = "'.pwg_db_real_escape_string($username).'", email = "'.$adresse_mail.'", password = "'.$password.'" 852 WHERE id = '.$row['FluxBB_id'].' 853 AND "'.pwg_db_real_escape_string($username).'" NOT IN ("18","16") 854 ;'; 425 855 426 856 $result = pwg_query($query); … … 475 905 return $plugin ; 476 906 } 907 477 908 478 909 function regfluxbb_obsolete_files() … … 493 924 } 494 925 } 926 927 928 /** 929 * Function to update plugin version number in config table 930 * Used everytime a new version is updated even if no database 931 * upgrade is needed 932 */ 933 function RegFluxBB_version_update() 934 { 935 global $conf; 936 937 // Get current plugin version 938 // -------------------------- 939 $plugin = PHInfos(REGFLUXBB_PATH); 940 $version = $plugin['version']; 941 942 // Upgrading options 943 // ----------------- 944 $query = ' 945 SELECT value 946 FROM '.CONFIG_TABLE.' 947 WHERE param = "Register_FluxBB" 948 ;'; 949 950 $result = pwg_query($query); 951 $Conf_RegFluxBB = pwg_db_fetch_assoc($result); 952 953 $Newconf_RegFluxBB = unserialize($Conf_RegFluxBB['value']); 954 955 $Newconf_RegFluxBB['REGFLUXBB_VERSION'] = $version; 956 957 $update_conf = serialize($Newconf_RegFluxBB); 958 959 conf_update_param('Register_FluxBB', pwg_db_real_escape_string($update_conf)); 960 961 962 // Check #_plugin table consistency 963 // Only useful if a previous version upgrade has not worked correctly (rare case) 964 // ------------------------------------------------------------------------------ 965 $query = ' 966 SELECT version 967 FROM '.PLUGINS_TABLE.' 968 WHERE id = "Register_FluxBB" 969 ;'; 970 971 $data = pwg_db_fetch_assoc(pwg_query($query)); 972 973 if (empty($data['version']) or $data['version'] <> $version) 974 { 975 $query = ' 976 UPDATE '.PLUGINS_TABLE.' 977 SET version="'.$version.'" 978 WHERE id = "Register_FluxBB" 979 LIMIT 1 980 ;'; 981 982 pwg_query($query); 983 } 984 } 985 986 987 /** 988 * Useful for debugging - 4 vars can be set 989 * Output result to log.txt file 990 * 991 */ 992 function RegFluxBBLog($var1, $var2, $var3, $var4) 993 { 994 $fo=fopen (REGFLUXBB_PATH.'log.txt','a') ; 995 fwrite($fo,"======================\n") ; 996 fwrite($fo,'le ' . date('D, d M Y H:i:s') . "\r\n"); 997 fwrite($fo,$var1 ."\r\n") ; 998 fwrite($fo,$var2 ."\r\n") ; 999 fwrite($fo,$var3 ."\r\n") ; 1000 fwrite($fo,$var4 ."\r\n") ; 1001 fclose($fo) ; 1002 } 495 1003 ?>
Note: See TracChangeset
for help on using the changeset viewer.