[17457] | 1 | <?php |
---|
| 2 | |
---|
[21424] | 3 | global $page, $user, $lang, $conf, $template, $errors; |
---|
[17457] | 4 | |
---|
| 5 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 6 | |
---|
[21424] | 7 | check_status(ACCESS_ADMINISTRATOR); |
---|
[17457] | 8 | |
---|
[21424] | 9 | if(!defined('REGFLUXBB_PATH')) |
---|
| 10 | { |
---|
| 11 | define('REGFLUXBB_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
| 12 | } |
---|
[17457] | 13 | |
---|
| 14 | include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
| 15 | include_once (PHPWG_ROOT_PATH.'/include/constants.php'); |
---|
| 16 | |
---|
| 17 | load_language('plugin.lang', REGFLUXBB_PATH); |
---|
| 18 | |
---|
[21424] | 19 | $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); |
---|
[17457] | 20 | |
---|
| 21 | // +-----------------------------------------------------------------------+ |
---|
| 22 | // | Getting plugin version | |
---|
| 23 | // +-----------------------------------------------------------------------+ |
---|
| 24 | $plugin = RegFluxBB_Infos(REGFLUXBB_PATH); |
---|
| 25 | $version = $plugin['version'] ; |
---|
| 26 | |
---|
[21424] | 27 | // +------------------------------------------------------------------+ |
---|
| 28 | // | Plugin settings | |
---|
| 29 | // +------------------------------------------------------------------+ |
---|
| 30 | if (isset($_POST['submit']) and isset($_POST['FluxBB_prefix']) and isset($_POST['FluxBB_admin']) and isset($_POST['FluxBB_guest']) and isset($_POST['FluxBB_del_pt']) and isset($_POST['FluxBB_confirm']) and isset($_POST['FluxBB_details'])) |
---|
[17457] | 31 | { |
---|
[21424] | 32 | $_POST['FluxBB_admin'] = stripslashes($_POST['FluxBB_admin']); |
---|
| 33 | $_POST['FluxBB_guest'] = stripslashes($_POST['FluxBB_guest']); |
---|
[17457] | 34 | |
---|
| 35 | /* Configuration controls */ |
---|
| 36 | // Piwigo's admin username control |
---|
[21424] | 37 | $query = ' |
---|
[17457] | 38 | SELECT username, id |
---|
[21424] | 39 | FROM '.USERS_TABLE.' |
---|
| 40 | WHERE id = '.$conf['webmaster_id'].' |
---|
| 41 | ;'; |
---|
[17457] | 42 | |
---|
[21424] | 43 | $pwgadmin = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[17457] | 44 | |
---|
[21913] | 45 | if (isset($_POST['FluxBB_prefix']) and $_POST['FluxBB_prefix'] <>'') |
---|
| 46 | { |
---|
[17457] | 47 | // FluxBB's admin username control |
---|
[21424] | 48 | $query = ' |
---|
[17457] | 49 | SELECT username, id |
---|
[21913] | 50 | FROM '.$_POST['FluxBB_prefix'].'users'.' |
---|
[17457] | 51 | WHERE id = 2 |
---|
[21424] | 52 | ;'; |
---|
[17457] | 53 | |
---|
[21424] | 54 | $fbbadmin = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[17457] | 55 | |
---|
| 56 | // FluxBB's Guest username control |
---|
[21424] | 57 | $query = ' |
---|
[17457] | 58 | SELECT username, id |
---|
[21913] | 59 | FROM '.$_POST['FluxBB_prefix'].'users'.' |
---|
[17457] | 60 | WHERE id = 1 |
---|
[21424] | 61 | ;'; |
---|
[21913] | 62 | } |
---|
[17457] | 63 | |
---|
[21913] | 64 | |
---|
[21424] | 65 | $fbbguest = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[17457] | 66 | |
---|
| 67 | // Compute configuration errors |
---|
[21424] | 68 | if (stripslashes($pwgadmin['username']) != $_POST['FluxBB_admin']) |
---|
| 69 | { |
---|
| 70 | array_push($page['errors'], l10n('error_config_admin1')); |
---|
| 71 | } |
---|
| 72 | if (stripslashes($pwgadmin['username']) != stripslashes($fbbadmin['username'])) |
---|
| 73 | { |
---|
| 74 | array_push($page['errors'], l10n('error_config_admin2')); |
---|
| 75 | } |
---|
| 76 | if (stripslashes($fbbguest['username']) != stripslashes($_POST['FluxBB_guest'])) |
---|
| 77 | { |
---|
| 78 | array_push($page['errors'], l10n('error_config_guest')); |
---|
| 79 | } |
---|
| 80 | elseif (count($page['errors']) == 0) |
---|
| 81 | { |
---|
| 82 | if (!function_exists('FindAvailableConfirmMailID')) |
---|
[17457] | 83 | { |
---|
[21424] | 84 | $_POST['FluxBB_UAM'] = 'false'; |
---|
| 85 | $_POST['FluxBB_group'] = '0'; |
---|
| 86 | |
---|
| 87 | $newconf_RegFluxBB['REGFLUXBB_VERSION'] = $version; |
---|
| 88 | $newconf_RegFluxBB['FLUXBB_PREFIX'] = (isset($_POST['FluxBB_prefix']) ? $_POST['FluxBB_prefix'] : ''); |
---|
| 89 | $newconf_RegFluxBB['FLUXBB_ADMIN'] = (isset($_POST['FluxBB_admin']) ? $_POST['FluxBB_admin'] : ''); |
---|
| 90 | $newconf_RegFluxBB['FLUXBB_GUEST'] = (isset($_POST['FluxBB_guest']) ? $_POST['FluxBB_guest'] : ''); |
---|
| 91 | $newconf_RegFluxBB['FLUXBB_DEL_PT'] = (isset($_POST['FluxBB_del_pt']) ? $_POST['FluxBB_del_pt'] : 'false'); |
---|
| 92 | $newconf_RegFluxBB['FLUXBB_CONFIRM'] = (isset($_POST['FluxBB_confirm']) ? $_POST['FluxBB_confirm'] : 'false'); |
---|
| 93 | $newconf_RegFluxBB['FLUXBB_DETAIL'] = (isset($_POST['FluxBB_details']) ? $_POST['FluxBB_details'] : 'false'); |
---|
| 94 | $newconf_RegFluxBB['FLUXBB_UAM_LINK'] = (isset($_POST['FluxBB_UAM']) ? $_POST['FluxBB_UAM'] : 'false'); |
---|
| 95 | $newconf_RegFluxBB['FLUXBB_GROUP'] = (isset($_POST['FluxBB_group']) ? $_POST['FluxBB_group'] : ''); |
---|
[17457] | 96 | } |
---|
[21424] | 97 | elseif (function_exists('FindAvailableConfirmMailID')) |
---|
[17457] | 98 | { |
---|
[21424] | 99 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
| 100 | |
---|
| 101 | if (isset($conf_UAM['CONFIRM_MAIL']) and ($conf_UAM['CONFIRM_MAIL'] == 'true' or $conf_UAM['CONFIRM_MAIL'] == 'local') and isset($conf_UAM['NO_CONFIRM_GROUP']) and $conf_UAM['NO_CONFIRM_GROUP'] != '-1') |
---|
[17457] | 102 | { |
---|
[21424] | 103 | $newconf_RegFluxBB['REGFLUXBB_VERSION'] = $version; |
---|
| 104 | $newconf_RegFluxBB['FLUXBB_PREFIX'] = (isset($_POST['FluxBB_prefix']) ? $_POST['FluxBB_prefix'] : ''); |
---|
| 105 | $newconf_RegFluxBB['FLUXBB_ADMIN'] = (isset($_POST['FluxBB_admin']) ? $_POST['FluxBB_admin'] : ''); |
---|
| 106 | $newconf_RegFluxBB['FLUXBB_GUEST'] = (isset($_POST['FluxBB_guest']) ? $_POST['FluxBB_guest'] : ''); |
---|
| 107 | $newconf_RegFluxBB['FLUXBB_DEL_PT'] = (isset($_POST['FluxBB_del_pt']) ? $_POST['FluxBB_del_pt'] : 'false'); |
---|
| 108 | $newconf_RegFluxBB['FLUXBB_CONFIRM'] = (isset($_POST['FluxBB_confirm']) ? $_POST['FluxBB_confirm'] : 'false'); |
---|
| 109 | $newconf_RegFluxBB['FLUXBB_DETAIL'] = (isset($_POST['FluxBB_details']) ? $_POST['FluxBB_details'] : 'false'); |
---|
| 110 | $newconf_RegFluxBB['FLUXBB_UAM_LINK'] = (isset($_POST['FluxBB_UAM']) ? $_POST['FluxBB_UAM'] : 'false'); |
---|
| 111 | $newconf_RegFluxBB['FLUXBB_GROUP'] = (isset($_POST['FluxBB_group']) ? $_POST['FluxBB_group'] : ''); |
---|
[17457] | 112 | } |
---|
[21424] | 113 | else |
---|
[17457] | 114 | { |
---|
[21424] | 115 | $_POST['FluxBB_UAM'] = 'false'; |
---|
| 116 | $_POST['FluxBB_group'] = '0'; |
---|
| 117 | |
---|
| 118 | $newconf_RegFluxBB['REGFLUXBB_VERSION'] = $version; |
---|
| 119 | $newconf_RegFluxBB['FLUXBB_PREFIX'] = (isset($_POST['FluxBB_prefix']) ? $_POST['FluxBB_prefix'] : ''); |
---|
| 120 | $newconf_RegFluxBB['FLUXBB_ADMIN'] = (isset($_POST['FluxBB_admin']) ? $_POST['FluxBB_admin'] : ''); |
---|
| 121 | $newconf_RegFluxBB['FLUXBB_GUEST'] = (isset($_POST['FluxBB_guest']) ? $_POST['FluxBB_guest'] : ''); |
---|
| 122 | $newconf_RegFluxBB['FLUXBB_DEL_PT'] = (isset($_POST['FluxBB_del_pt']) ? $_POST['FluxBB_del_pt'] : 'false'); |
---|
| 123 | $newconf_RegFluxBB['FLUXBB_CONFIRM'] = (isset($_POST['FluxBB_confirm']) ? $_POST['FluxBB_confirm'] : 'false'); |
---|
| 124 | $newconf_RegFluxBB['FLUXBB_DETAIL'] = (isset($_POST['FluxBB_details']) ? $_POST['FluxBB_details'] : 'false'); |
---|
| 125 | $newconf_RegFluxBB['FLUXBB_UAM_LINK'] = (isset($_POST['FluxBB_UAM']) ? $_POST['FluxBB_UAM'] : 'false'); |
---|
| 126 | $newconf_RegFluxBB['FLUXBB_GROUP'] = (isset($_POST['FluxBB_group']) ? $_POST['FluxBB_group'] : ''); |
---|
[17457] | 127 | } |
---|
| 128 | } |
---|
| 129 | |
---|
[21424] | 130 | $conf['Register_FluxBB'] = serialize($newconf_RegFluxBB); |
---|
[17457] | 131 | |
---|
[21424] | 132 | conf_update_param('Register_FluxBB', pwg_db_real_escape_string($conf['Register_FluxBB'])); |
---|
[17457] | 133 | |
---|
[21424] | 134 | array_push($page['infos'], l10n('save_config')); |
---|
[17457] | 135 | } |
---|
[21424] | 136 | } |
---|
[17457] | 137 | |
---|
| 138 | |
---|
[21424] | 139 | // +--------------------------------------------------------+ |
---|
| 140 | // | Synch and Audit | |
---|
| 141 | // +--------------------------------------------------------+ |
---|
| 142 | if ( isset($_POST['Synchro'])) |
---|
| 143 | { |
---|
| 144 | $page_Register_FluxBB_admin = get_admin_plugin_menu_link(__FILE__); |
---|
[17457] | 145 | |
---|
[21424] | 146 | $msg_error_PWG_Dup = ''; |
---|
| 147 | $msg_error_FluxBB_Dup = ''; |
---|
| 148 | $msg_error_Link_Break = ''; |
---|
| 149 | $msg_error_Link_Bad = ''; |
---|
| 150 | $msg_error_Synchro = ''; |
---|
| 151 | $msg_ok_Synchro = ''; |
---|
| 152 | $msg_error_FluxBB2PWG = ''; |
---|
| 153 | $msg_error_PWG2FluxBB = ''; |
---|
[17457] | 154 | |
---|
| 155 | |
---|
[21424] | 156 | $query = ' |
---|
[17457] | 157 | SELECT COUNT(*) AS nbr_dup, id, username |
---|
[21424] | 158 | FROM '.USERS_TABLE.' |
---|
| 159 | WHERE username NOT IN ("18","16") |
---|
[22091] | 160 | AND username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
[17457] | 161 | GROUP BY BINARY username |
---|
| 162 | HAVING COUNT(*) > 1 |
---|
[21424] | 163 | ;'; |
---|
[17457] | 164 | |
---|
[21424] | 165 | $result = pwg_query($query); |
---|
[17457] | 166 | |
---|
[21424] | 167 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 168 | $msg_error_PWG_Dup .= '<br>'.l10n('Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); |
---|
[17457] | 169 | |
---|
[21424] | 170 | if ($msg_error_PWG_Dup <> '') |
---|
| 171 | $msg_error_PWG_Dup = l10n('Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Advise_PWG_Dup'); |
---|
| 172 | |
---|
| 173 | $query = ' |
---|
[17457] | 174 | SELECT COUNT(*) AS nbr_dup, username |
---|
[21424] | 175 | FROM '.FluxBB_USERS_TABLE.' |
---|
[17457] | 176 | GROUP BY BINARY username |
---|
| 177 | HAVING COUNT(*) > 1 |
---|
[21424] | 178 | ;'; |
---|
[17457] | 179 | |
---|
[21424] | 180 | $result = pwg_query($query); |
---|
[17457] | 181 | |
---|
[21424] | 182 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 183 | { |
---|
| 184 | $msg_error_FluxBB_Dup .= '<br>'.l10n('Error_FluxBB_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); |
---|
| 185 | |
---|
| 186 | $subquery = ' |
---|
[17457] | 187 | SELECT id, username, email |
---|
[21424] | 188 | FROM '.FluxBB_USERS_TABLE.' |
---|
| 189 | WHERE BINARY username = BINARY "'.$row['username'].'" |
---|
[22091] | 190 | AND username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
[21424] | 191 | ;'; |
---|
[17457] | 192 | |
---|
[21424] | 193 | $subresult = pwg_query($subquery); |
---|
[17457] | 194 | |
---|
[21424] | 195 | while($subrow = pwg_db_fetch_assoc($subresult)) |
---|
| 196 | { |
---|
| 197 | $msg_error_FluxBB_Dup .= '<br>id:'.$subrow['id'].'='.stripslashes($subrow['username']).' ('.$subrow['email'].')'; |
---|
[17457] | 198 | |
---|
[21424] | 199 | $msg_error_FluxBB_Dup .= ' <a href="'; |
---|
[17457] | 200 | |
---|
[21424] | 201 | $msg_error_FluxBB_Dup .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 202 | 'action' => 'del_user', |
---|
| 203 | 'id' => $subrow['id'], |
---|
| 204 | )); |
---|
| 205 | |
---|
| 206 | $msg_error_FluxBB_Dup .= '" title="'.l10n('Del_User').stripslashes($subrow['username']).'"'; |
---|
| 207 | |
---|
| 208 | $msg_error_FluxBB_Dup .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 209 | |
---|
| 210 | $msg_error_FluxBB_Dup .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($subrow['username']).'" /></a>'; |
---|
[17457] | 211 | } |
---|
[21424] | 212 | } |
---|
[17457] | 213 | |
---|
[21424] | 214 | if ($msg_error_FluxBB_Dup <> '') |
---|
| 215 | $msg_error_FluxBB_Dup = l10n('Sync_Check_Dup').$msg_error_FluxBB_Dup.'<br>'.l10n('Advise_FluxBB_Dup'); |
---|
[17457] | 216 | |
---|
[21424] | 217 | if ($msg_error_FluxBB_Dup == '' and $msg_error_PWG_Dup == '') |
---|
| 218 | { |
---|
| 219 | $query = ' |
---|
[17457] | 220 | SELECT pwg.id as pwg_id, bb.id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail |
---|
[21424] | 221 | FROM '.FluxBB_USERS_TABLE.' AS bb, '.USERS_TABLE.' as pwg |
---|
[17457] | 222 | WHERE bb.id NOT in ( |
---|
| 223 | SELECT id_user_FluxBB |
---|
[21424] | 224 | FROM '.Register_FluxBB_ID_TABLE.' |
---|
[17457] | 225 | ) |
---|
| 226 | AND pwg.id NOT in ( |
---|
| 227 | SELECT id_user_pwg |
---|
[21424] | 228 | FROM '.Register_FluxBB_ID_TABLE.' |
---|
[17457] | 229 | ) |
---|
| 230 | AND pwg.username = bb.username |
---|
[21424] | 231 | AND pwg.username NOT IN ("18","16") |
---|
[22091] | 232 | AND pwg.username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
[17457] | 233 | AND pwg.mail_address = bb.email |
---|
[21424] | 234 | ;'; |
---|
[17457] | 235 | |
---|
[21424] | 236 | $result = pwg_query($query); |
---|
| 237 | |
---|
| 238 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 239 | { |
---|
| 240 | $msg_error_Link_Break .= '<br>'.l10n('New_Link').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'; |
---|
[22091] | 241 | FluxBB_Linkuser($row['pwg_id'], $row['bb_id'], "NOK"); |
---|
[21424] | 242 | } |
---|
| 243 | |
---|
| 244 | if ($msg_error_Link_Break == '') |
---|
| 245 | array_push($page['infos'], l10n('Sync_Link_Break').'<br>'.l10n('Sync_OK')); |
---|
| 246 | else |
---|
| 247 | $msg_error_Link_Break = l10n('Sync_Link_Break').$msg_error_Link_Break; |
---|
| 248 | |
---|
| 249 | $query = ' |
---|
[17457] | 250 | 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 |
---|
[21424] | 251 | FROM '.FluxBB_USERS_TABLE.' AS bb |
---|
| 252 | INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = bb.id |
---|
| 253 | INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id |
---|
[17457] | 254 | WHERE BINARY pwg.username <> BINARY bb.username |
---|
[21424] | 255 | AND pwg.username NOT IN ("18","16") |
---|
[22091] | 256 | AND pwg.username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
[21424] | 257 | ;'; |
---|
[17457] | 258 | |
---|
[21424] | 259 | $result = pwg_query($query); |
---|
[17457] | 260 | |
---|
[21424] | 261 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 262 | { |
---|
| 263 | $msg_error_Link_Bad .= '<br>'.l10n('Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')'; |
---|
[17457] | 264 | |
---|
[21424] | 265 | $subquery = ' |
---|
| 266 | DELETE FROM '.Register_FluxBB_ID_TABLE.' |
---|
| 267 | WHERE id_user_pwg = '.$row['pwg_id'].' |
---|
| 268 | AND id_user_FluxBB = '.$row['bb_id'].' |
---|
| 269 | ;'; |
---|
[17457] | 270 | |
---|
[21424] | 271 | $subresult = pwg_query($subquery); |
---|
| 272 | } |
---|
[17457] | 273 | |
---|
[21424] | 274 | $query = ' |
---|
[17457] | 275 | SELECT COUNT(*) as nbr_dead |
---|
[21424] | 276 | FROM '.Register_FluxBB_ID_TABLE.' AS Link |
---|
[17457] | 277 | WHERE id_user_FluxBB NOT IN ( |
---|
| 278 | SELECT id |
---|
[21424] | 279 | FROM '.FluxBB_USERS_TABLE.' |
---|
[17457] | 280 | ) |
---|
| 281 | OR id_user_pwg NOT IN ( |
---|
| 282 | SELECT id |
---|
[21424] | 283 | FROM '.USERS_TABLE.' |
---|
[17457] | 284 | ) |
---|
[21424] | 285 | ;'; |
---|
[17457] | 286 | |
---|
[21424] | 287 | $Compteur = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 288 | |
---|
| 289 | if (!empty($Compteur) and $Compteur['nbr_dead'] > 0) |
---|
| 290 | { |
---|
| 291 | $msg_error_Link_Bad .= '<br>'.l10n('Link_Dead').$Compteur['nbr_dead']; |
---|
| 292 | |
---|
| 293 | $query = ' |
---|
| 294 | DELETE FROM '.Register_FluxBB_ID_TABLE.' |
---|
[17457] | 295 | WHERE id_user_FluxBB NOT IN ( |
---|
| 296 | SELECT id |
---|
[21424] | 297 | FROM '.FluxBB_USERS_TABLE.' |
---|
[17457] | 298 | ) |
---|
| 299 | OR id_user_pwg NOT IN ( |
---|
| 300 | SELECT id |
---|
[21424] | 301 | FROM '.USERS_TABLE.' |
---|
[17457] | 302 | ) |
---|
[21424] | 303 | ;'; |
---|
[17457] | 304 | |
---|
[21424] | 305 | $result = pwg_query($query); |
---|
| 306 | } |
---|
| 307 | |
---|
| 308 | $query = ' |
---|
[17457] | 309 | 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 |
---|
[21424] | 310 | FROM '.FluxBB_USERS_TABLE.' AS bb |
---|
| 311 | INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = bb.id |
---|
| 312 | INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id |
---|
| 313 | WHERE pwg.username NOT IN ("18","16") |
---|
[22091] | 314 | AND pwg.username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
[17457] | 315 | GROUP BY link.id_user_pwg, link.id_user_FluxBB |
---|
| 316 | HAVING COUNT(*) > 1 |
---|
[21424] | 317 | ;'; |
---|
[17457] | 318 | |
---|
[21424] | 319 | $result = pwg_query($query); |
---|
[17457] | 320 | |
---|
[21424] | 321 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 322 | { |
---|
| 323 | $msg_error_Link_Bad .= '<br>'.l10n('Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')'; |
---|
[17457] | 324 | |
---|
[22091] | 325 | FluxBB_Linkuser($row['pwg_id'], $row['bb_id'], "NOK"); |
---|
[21424] | 326 | } |
---|
[17457] | 327 | |
---|
[21424] | 328 | if ($msg_error_Link_Bad == '') |
---|
| 329 | array_push($page['infos'], l10n('Sync_Link_Bad').'<br>'.l10n('Sync_OK')); |
---|
| 330 | else |
---|
| 331 | $msg_error_Link_Bad = l10n('Sync_Link_Bad').$msg_error_Link_Bad; |
---|
| 332 | |
---|
[22091] | 333 | $query = ' |
---|
| 334 | SELECT pwg.id as pwg_id, pwg.username as username, pwg.mail_address as pwg_eml, FluxBB.id as bb_id, FluxBB.email as bb_eml |
---|
| 335 | FROM '.FluxBB_USERS_TABLE.' AS FluxBB |
---|
| 336 | INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = FluxBB.id |
---|
| 337 | INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id |
---|
| 338 | AND BINARY pwg.username = BINARY FluxBB.username |
---|
| 339 | AND pwg.username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
| 340 | ORDER BY LOWER(pwg.username) |
---|
| 341 | ;'; |
---|
[17457] | 342 | |
---|
[22091] | 343 | $result = pwg_query($query); |
---|
| 344 | |
---|
| 345 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 346 | { |
---|
| 347 | if ($row['pwg_eml'] != $row['bb_eml']) |
---|
| 348 | { |
---|
| 349 | $msg_error_Synchro .= '<br>'.l10n('Sync_User').stripslashes($row['username']); |
---|
| 350 | |
---|
| 351 | $query = ' |
---|
| 352 | SELECT id, username, mail_address |
---|
| 353 | FROM '.USERS_TABLE.' |
---|
| 354 | WHERE BINARY id = "'.$row['pwg_id'].'" |
---|
| 355 | AND "'.$row['username'].'" NOT IN ("18","16") |
---|
| 356 | AND username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
| 357 | ;'; |
---|
| 358 | |
---|
| 359 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 360 | |
---|
| 361 | if (!empty($data)) |
---|
| 362 | Synch_FluxBB_Updateuser($data['id'], stripslashes($data['username']), $data['mail_address']); |
---|
| 363 | } |
---|
| 364 | } |
---|
| 365 | |
---|
[21424] | 366 | if ($msg_error_Synchro == '') |
---|
| 367 | array_push($page['infos'], l10n('Sync_DataUser').'<br>'.l10n('Sync_OK')); |
---|
| 368 | else |
---|
| 369 | $msg_error_Synchro = l10n('Sync_DataUser').$msg_error_Synchro; |
---|
| 370 | |
---|
[22091] | 371 | $query = ' |
---|
| 372 | SELECT username, mail_address FROM '.USERS_TABLE.' |
---|
| 373 | WHERE BINARY username <> BINARY "guest" |
---|
| 374 | AND username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
| 375 | AND username NOT IN ("18","16") |
---|
| 376 | AND id not in ( |
---|
| 377 | SELECT id_user_pwg FROM '.Register_FluxBB_ID_TABLE.' |
---|
| 378 | ) |
---|
| 379 | AND BINARY username not in ( |
---|
| 380 | SELECT username FROM '.FluxBB_USERS_TABLE.' |
---|
| 381 | ) |
---|
| 382 | ORDER BY LOWER(username) |
---|
| 383 | ;'; |
---|
[17457] | 384 | |
---|
[22091] | 385 | $result = pwg_query($query); |
---|
| 386 | |
---|
| 387 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 388 | { |
---|
| 389 | $msg_error_PWG2FluxBB .= '<br>'.l10n('Add_User').stripslashes($row['username']).' ('.$row['mail_address'].')'; |
---|
| 390 | |
---|
| 391 | $query = ' |
---|
| 392 | SELECT id, username, mail_address |
---|
| 393 | FROM '.USERS_TABLE.' |
---|
| 394 | WHERE BINARY username = BINARY "'.$row['username'].'" |
---|
| 395 | AND username NOT IN ("18","16") |
---|
| 396 | AND username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
| 397 | LIMIT 1 |
---|
| 398 | ;'; |
---|
| 399 | |
---|
| 400 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 401 | |
---|
| 402 | if (!empty($data)) |
---|
| 403 | Synch_FluxBB_Adduser($data['id'], stripslashes($data['username']), $data['mail_address']); |
---|
| 404 | } |
---|
| 405 | |
---|
[21424] | 406 | if ($msg_error_PWG2FluxBB == '') |
---|
| 407 | array_push($page['infos'], l10n('Sync_PWG2FluxBB').'<br>'.l10n('Sync_OK')); |
---|
| 408 | else |
---|
| 409 | $msg_error_PWG2FluxBB = l10n('Sync_PWG2FluxBB').$msg_error_PWG2FluxBB; |
---|
[17457] | 410 | |
---|
[21424] | 411 | $query = ' |
---|
| 412 | SELECT id, username, email FROM '.FluxBB_USERS_TABLE.' |
---|
| 413 | WHERE BINARY username <> BINARY "'.$conf_Register_FluxBB['FLUXBB_GUEST'].'" |
---|
[22091] | 414 | AND username <> "'.stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']).'" |
---|
[17457] | 415 | AND id not in ( |
---|
[21424] | 416 | SELECT id_user_FluxBB FROM '.Register_FluxBB_ID_TABLE.' |
---|
[17457] | 417 | ) |
---|
| 418 | AND BINARY username not in ( |
---|
[21424] | 419 | SELECT username FROM '.USERS_TABLE.' |
---|
[17457] | 420 | ) |
---|
| 421 | ORDER BY LOWER(username) |
---|
[21424] | 422 | ;'; |
---|
[17457] | 423 | |
---|
[21424] | 424 | $result = pwg_query($query); |
---|
| 425 | |
---|
| 426 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 427 | { |
---|
| 428 | $msg_error_FluxBB2PWG .= '<br>'.l10n('Error_FluxBB2PWG').stripslashes($row['username']).' ('.$row['email'].')'; |
---|
| 429 | $msg_error_FluxBB2PWG .= ' <a href="'; |
---|
| 430 | $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( |
---|
[17457] | 431 | 'action' => 'del_user', |
---|
| 432 | 'id' => $row['id'], |
---|
[21424] | 433 | )); |
---|
[17457] | 434 | |
---|
[21424] | 435 | $msg_error_FluxBB2PWG .= '" title="'.l10n('Del_User').stripslashes($row['username']).'"'; |
---|
[17457] | 436 | |
---|
[21424] | 437 | $msg_error_FluxBB2PWG .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
[17457] | 438 | |
---|
[21424] | 439 | $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>'; |
---|
[17457] | 440 | } |
---|
[21424] | 441 | |
---|
| 442 | if ($msg_error_FluxBB2PWG == '') |
---|
| 443 | array_push($page['infos'], l10n('Sync_FluxBB2PWG').'<br>'.l10n('Sync_OK')); |
---|
[17457] | 444 | else |
---|
[21424] | 445 | $msg_error_FluxBB2PWG = l10n('Sync_FluxBB2PWG').$msg_error_FluxBB2PWG; |
---|
| 446 | } |
---|
| 447 | else |
---|
| 448 | $errors[] = l10n('Advise_Check_Dup'); |
---|
[17457] | 449 | |
---|
[21424] | 450 | if ($msg_error_PWG_Dup <> '') |
---|
| 451 | $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>' ); |
---|
[17457] | 452 | |
---|
[21424] | 453 | if ($msg_error_FluxBB_Dup <> '') |
---|
| 454 | $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>' ); |
---|
[17457] | 455 | |
---|
[21424] | 456 | if ($msg_error_Link_Break <> '') |
---|
| 457 | $errors[] = $msg_error_Link_Break . ( ($msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); |
---|
[17457] | 458 | |
---|
[21424] | 459 | if ($msg_error_Link_Bad <> '') |
---|
| 460 | $errors[] = $msg_error_Link_Bad . ( ($msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); |
---|
[17457] | 461 | |
---|
[21424] | 462 | if ($msg_error_Synchro <> '') |
---|
| 463 | $errors[] = $msg_error_Synchro . ( ($msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); |
---|
[17457] | 464 | |
---|
[21424] | 465 | if ($msg_error_PWG2FluxBB <> '') |
---|
| 466 | $errors[] = $msg_error_PWG2FluxBB . ( ($msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); |
---|
[17457] | 467 | |
---|
[21424] | 468 | if ($msg_error_FluxBB2PWG <> '') |
---|
| 469 | $errors[] = $msg_error_FluxBB2PWG; |
---|
| 470 | } |
---|
| 471 | else if ( isset($_POST['Audit'])) |
---|
| 472 | { |
---|
| 473 | Audit_PWG_FluxBB(); |
---|
| 474 | } |
---|
| 475 | |
---|
| 476 | |
---|
| 477 | // +---------------------------------------------------------------+ |
---|
[22039] | 478 | // | Audit function | |
---|
| 479 | // +---------------------------------------------------------------+ |
---|
| 480 | function Audit_PWG_FluxBB() |
---|
| 481 | { |
---|
| 482 | global $page, $conf, $errors; |
---|
| 483 | |
---|
| 484 | $page_Register_FluxBB_admin = get_admin_plugin_menu_link(__FILE__); |
---|
| 485 | |
---|
| 486 | $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); |
---|
| 487 | |
---|
| 488 | $msg_error_PWG_Dup = ''; |
---|
| 489 | $msg_error_FluxBB_Dup = ''; |
---|
| 490 | $msg_error_Link_Break = ''; |
---|
| 491 | $msg_error_Link_Bad = ''; |
---|
| 492 | $msg_error_Synchro = ''; |
---|
| 493 | $msg_ok_Synchro = ''; |
---|
| 494 | $msg_error_PWG2FluxBB = ''; |
---|
| 495 | $msg_error_FluxBB2PWG = ''; |
---|
| 496 | |
---|
| 497 | // Check duplicate accounts in Piwigo users table |
---|
| 498 | // ---------------------------------------------- |
---|
| 499 | $query = ' |
---|
| 500 | SELECT COUNT(*) AS nbr_dup, id, username |
---|
| 501 | FROM '.USERS_TABLE.' |
---|
| 502 | WHERE username NOT IN ("18","16") |
---|
| 503 | GROUP BY BINARY username |
---|
| 504 | HAVING COUNT(*) > 1 |
---|
| 505 | ;'; |
---|
| 506 | $result = pwg_query($query); |
---|
| 507 | |
---|
| 508 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 509 | $msg_error_PWG_Dup .= '<br>'.l10n('Error_PWG_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); |
---|
| 510 | |
---|
| 511 | if ($msg_error_PWG_Dup == '') |
---|
| 512 | array_push($page['infos'], l10n('Audit_PWG_Dup').'<br>'.l10n('Audit_OK')); |
---|
| 513 | else |
---|
| 514 | $msg_error_PWG_Dup = l10n('Audit_PWG_Dup').$msg_error_PWG_Dup.'<br>'.l10n('Advise_PWG_Dup'); |
---|
| 515 | |
---|
| 516 | |
---|
| 517 | // Check duplicate accounts in FluxBB users table |
---|
| 518 | // ---------------------------------------------- |
---|
| 519 | $query = ' |
---|
| 520 | SELECT COUNT(*) AS nbr_dup, username |
---|
| 521 | FROM '.FluxBB_USERS_TABLE.' |
---|
| 522 | GROUP BY BINARY username |
---|
| 523 | HAVING COUNT(*) > 1 |
---|
| 524 | ;'; |
---|
| 525 | $result = pwg_query($query); |
---|
| 526 | |
---|
| 527 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 528 | { |
---|
| 529 | $msg_error_FluxBB_Dup .= '<br>'.l10n('Error_FluxBB_Dup').$row['nbr_dup'].' x '.stripslashes($row['username']); |
---|
| 530 | |
---|
| 531 | $subquery = ' |
---|
| 532 | SELECT id, username, email |
---|
| 533 | FROM '.FluxBB_USERS_TABLE.' |
---|
| 534 | WHERE BINARY username = BINARY "'.$row['username'].'" |
---|
| 535 | ;'; |
---|
| 536 | $subresult = pwg_query($subquery); |
---|
| 537 | |
---|
| 538 | while($subrow = pwg_db_fetch_assoc($subresult)) |
---|
| 539 | { |
---|
| 540 | $msg_error_FluxBB_Dup .= '<br>id:'.$subrow['id'].'='.stripslashes($subrow['username']).' ('.$subrow['email'].')'; |
---|
| 541 | |
---|
| 542 | $msg_error_FluxBB_Dup .= ' <a href="'; |
---|
| 543 | |
---|
| 544 | $msg_error_FluxBB_Dup .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 545 | 'action' => 'del_user', |
---|
| 546 | 'id' => $subrow['id'], |
---|
| 547 | )); |
---|
| 548 | |
---|
| 549 | $msg_error_FluxBB_Dup .= '" title="'.l10n('Del_User').stripslashes($subrow['username']).'"'; |
---|
| 550 | |
---|
| 551 | $msg_error_FluxBB_Dup .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 552 | |
---|
| 553 | $msg_error_FluxBB_Dup .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').$subrow['username'].'" /></a>'; |
---|
| 554 | } |
---|
| 555 | } |
---|
| 556 | |
---|
| 557 | if ($msg_error_FluxBB_Dup == '') |
---|
| 558 | array_push($page['infos'], l10n('Audit_FluxBB_Dup').'<br>'.l10n('Audit_OK')); |
---|
| 559 | else |
---|
| 560 | $msg_error_FluxBB_Dup = l10n('Audit_FluxBB_Dup').$msg_error_FluxBB_Dup.'<br>'.l10n('Advise_FluxBB_Dup'); |
---|
| 561 | |
---|
| 562 | |
---|
| 563 | // Check links between Piwigo and FluxBB users |
---|
| 564 | // ------------------------------------------- |
---|
| 565 | // Check fixable broken links between Piwigo and FluxBB users |
---|
| 566 | // ---------------------------------------------------------- |
---|
| 567 | $query = ' |
---|
| 568 | SELECT pwg.id as pwg_id, bb.id as bb_id, pwg.username as pwg_user, pwg.mail_address as pwg_mail |
---|
| 569 | FROM '.FluxBB_USERS_TABLE.' AS bb, '.USERS_TABLE.' as pwg |
---|
| 570 | WHERE bb.id NOT in ( |
---|
| 571 | SELECT id_user_FluxBB |
---|
| 572 | FROM '.Register_FluxBB_ID_TABLE.' |
---|
| 573 | ) |
---|
| 574 | AND pwg.id NOT in ( |
---|
| 575 | SELECT id_user_pwg |
---|
| 576 | FROM '.Register_FluxBB_ID_TABLE.' |
---|
| 577 | ) |
---|
| 578 | AND pwg.username = bb.username |
---|
| 579 | AND pwg.username NOT IN ("18","16") |
---|
| 580 | AND pwg.mail_address = bb.email |
---|
| 581 | ;'; |
---|
| 582 | |
---|
| 583 | $result = pwg_query($query); |
---|
| 584 | |
---|
| 585 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 586 | { |
---|
| 587 | $msg_error_Link_Break .= '<br>'.l10n('Error_Link_Break').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'; |
---|
| 588 | |
---|
| 589 | $msg_error_Link_Break .= ' <a href="'; |
---|
| 590 | |
---|
| 591 | $msg_error_Link_Break .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 592 | 'action' => 'new_link', |
---|
| 593 | 'pwg_id' => $row['pwg_id'], |
---|
| 594 | 'bb_id' => $row['bb_id'], |
---|
| 595 | )); |
---|
| 596 | |
---|
| 597 | $msg_error_Link_Break .= '" title="'.l10n('New_Link').stripslashes($row['pwg_user']).'"'; |
---|
| 598 | |
---|
| 599 | $msg_error_Link_Break .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 600 | |
---|
| 601 | $msg_error_Link_Break .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_break.png" alt="'.l10n('New_Link').stripslashes($row['pwg_user']).'" /></a>'; |
---|
| 602 | } |
---|
| 603 | |
---|
| 604 | if ($msg_error_Link_Break == '') |
---|
| 605 | array_push($page['infos'], l10n('Audit_Link_Break').'<br>'.l10n('Audit_OK')); |
---|
| 606 | else |
---|
| 607 | $msg_error_Link_Break = l10n('Audit_Link_Break').$msg_error_Link_Break; |
---|
| 608 | |
---|
| 609 | |
---|
| 610 | // Check not fixable broken links between Piwigo and FluxBB users |
---|
| 611 | // -------------------------------------------------------------- |
---|
| 612 | $query = ' |
---|
| 613 | 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 |
---|
| 614 | FROM '.FluxBB_USERS_TABLE.' AS bb |
---|
| 615 | INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = bb.id |
---|
| 616 | INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id |
---|
| 617 | WHERE pwg.username <> bb.username |
---|
| 618 | AND pwg.username NOT IN ("18","16") |
---|
| 619 | ;'; |
---|
| 620 | |
---|
| 621 | $result = pwg_query($query); |
---|
| 622 | |
---|
| 623 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 624 | { |
---|
| 625 | $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Del').stripslashes($row['pwg_user']).' ('.$row['pwg_mail'].')'.' -- '.stripslashes($row['bb_user']).' ('.$row['bb_mail'].')'; |
---|
| 626 | |
---|
| 627 | $msg_error_Link_Bad .= ' <a href="'; |
---|
| 628 | |
---|
| 629 | $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 630 | 'action' => 'link_del', |
---|
| 631 | 'pwg_id' => $row['pwg_id'], |
---|
| 632 | 'bb_id' => $row['bb_id'], |
---|
| 633 | )); |
---|
| 634 | |
---|
| 635 | $msg_error_Link_Bad .= '" title="'.l10n('Link_Del').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"'; |
---|
| 636 | |
---|
| 637 | $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 638 | |
---|
| 639 | $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>'; |
---|
| 640 | |
---|
| 641 | $msg_error_Link_Bad .= ' -- <a href="'; |
---|
| 642 | |
---|
| 643 | $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 644 | 'action' => 'sync_user', |
---|
| 645 | 'username' => stripslashes($row['pwg_user']), |
---|
| 646 | )); |
---|
| 647 | |
---|
| 648 | $msg_error_Link_Bad .= '" title="'.l10n('Sync_User').stripslashes($row['pwg_user']).' --> '.stripslashes($row['bb_user']).'"'; |
---|
| 649 | |
---|
| 650 | $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 651 | |
---|
| 652 | $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>'; |
---|
| 653 | } |
---|
| 654 | |
---|
| 655 | |
---|
| 656 | // Check dead links between Piwigo and FluxBB users |
---|
| 657 | // ------------------------------------------------ |
---|
| 658 | $query = ' |
---|
| 659 | SELECT COUNT(*) as nbr_dead |
---|
| 660 | FROM '.Register_FluxBB_ID_TABLE.' AS Link |
---|
| 661 | WHERE id_user_FluxBB NOT IN ( |
---|
| 662 | SELECT id |
---|
| 663 | FROM '.FluxBB_USERS_TABLE.' |
---|
| 664 | ) |
---|
| 665 | OR id_user_pwg NOT IN ( |
---|
| 666 | SELECT id |
---|
| 667 | FROM '.USERS_TABLE.' |
---|
| 668 | ) |
---|
| 669 | ;'; |
---|
| 670 | |
---|
| 671 | $Compteur = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 672 | |
---|
| 673 | if (!empty($Compteur) and $Compteur['nbr_dead'] > 0) |
---|
| 674 | { |
---|
| 675 | $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Dead').$Compteur['nbr_dead']; |
---|
| 676 | |
---|
| 677 | $msg_error_Link_Bad .= ' <a href="'; |
---|
| 678 | |
---|
| 679 | $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 680 | 'action' => 'link_dead', |
---|
| 681 | )); |
---|
| 682 | |
---|
| 683 | $msg_error_Link_Bad .= '" title="'.l10n('Link_Dead').$Compteur['nbr_dead'].'"'; |
---|
| 684 | |
---|
| 685 | $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 686 | |
---|
| 687 | $msg_error_Link_Bad .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/link_delete.png" alt="'.l10n('Link_Dead').$Compteur['nbr_dead'].'" /></a>'; |
---|
| 688 | } |
---|
| 689 | |
---|
| 690 | |
---|
| 691 | // Check duplicated links between Piwigo and FluxBB users |
---|
| 692 | // ------------------------------------------------------ |
---|
| 693 | $query = ' |
---|
| 694 | 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 |
---|
| 695 | FROM '.FluxBB_USERS_TABLE.' AS bb |
---|
| 696 | INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = bb.id |
---|
| 697 | INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id |
---|
| 698 | WHERE pwg.username NOT IN ("18","16") |
---|
| 699 | GROUP BY link.id_user_pwg, link.id_user_FluxBB |
---|
| 700 | HAVING COUNT(*) > 1 |
---|
| 701 | ;'; |
---|
| 702 | |
---|
| 703 | $result = pwg_query($query); |
---|
| 704 | |
---|
| 705 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 706 | { |
---|
| 707 | $msg_error_Link_Bad .= '<br>'.l10n('Error_Link_Dup').$row['nbr_dup'].' = '.stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).')'; |
---|
| 708 | |
---|
| 709 | $msg_error_Link_Bad .= ' <a href="'; |
---|
| 710 | |
---|
| 711 | $msg_error_Link_Bad .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 712 | 'action' => 'new_link', |
---|
| 713 | 'pwg_id' => $row['pwg_id'], |
---|
| 714 | 'bb_id' => $row['bb_id'], |
---|
| 715 | )); |
---|
| 716 | |
---|
| 717 | $msg_error_Link_Bad .= '" title="'.l10n('Link_Dup').stripslashes($row['pwg_user']).' -- '.stripslashes($row['bb_user']).'"'; |
---|
| 718 | |
---|
| 719 | $msg_error_Link_Bad .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 720 | |
---|
| 721 | $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>'; |
---|
| 722 | } |
---|
| 723 | |
---|
| 724 | if ($msg_error_Link_Bad == '') |
---|
| 725 | array_push($page['infos'], l10n('Audit_Link_Bad').'<br>'.l10n('Audit_OK')); |
---|
| 726 | else |
---|
| 727 | $msg_error_Link_Bad = l10n('Audit_Link_Bad').$msg_error_Link_Bad; |
---|
| 728 | |
---|
| 729 | |
---|
| 730 | // Check synch between Piwigo and FluxBB users |
---|
| 731 | // ------------------------------------------- |
---|
| 732 | $query = ' |
---|
[22091] | 733 | SELECT pwg.id as pwg_id, pwg.username as username, pwg.mail_address as pwg_eml, FluxBB.email as bb_eml |
---|
[22039] | 734 | FROM '.FluxBB_USERS_TABLE.' AS FluxBB |
---|
| 735 | INNER JOIN '.Register_FluxBB_ID_TABLE.' AS link ON link.id_user_FluxBB = FluxBB.id |
---|
| 736 | INNER JOIN '.USERS_TABLE.' as pwg ON link.id_user_pwg = pwg.id |
---|
| 737 | WHERE BINARY pwg.username = BINARY FluxBB.username |
---|
| 738 | AND pwg.username NOT IN ("18","16") |
---|
| 739 | ORDER BY LOWER(pwg.username) |
---|
| 740 | ;'; |
---|
| 741 | |
---|
| 742 | $result = pwg_query($query); |
---|
| 743 | |
---|
| 744 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 745 | { |
---|
[22091] | 746 | if (($row['pwg_eml'] != $row['bb_eml']) or Reg_FluxBB_PwdSynch($row['pwg_id'])) |
---|
[22039] | 747 | { |
---|
[22091] | 748 | if ($row['pwg_eml'] != $row['bb_eml'] and Reg_FluxBB_PwdSynch($row['pwg_id'])) |
---|
| 749 | { |
---|
| 750 | $msg_error_Synchro .= '<br>'.l10n('Error_Synchro').stripslashes($row['username']); |
---|
[22039] | 751 | |
---|
[22091] | 752 | $msg_error_Synchro .= ' <a href="'; |
---|
[22039] | 753 | |
---|
[22091] | 754 | $msg_error_Synchro .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 755 | 'action' => 'sync_user', |
---|
| 756 | 'username' => stripslashes($row['username']), |
---|
| 757 | )); |
---|
[22039] | 758 | |
---|
[22091] | 759 | $msg_error_Synchro .= '" title="'.l10n('Sync_User').stripslashes($row['username']).'"'; |
---|
[22039] | 760 | |
---|
[22091] | 761 | $msg_error_Synchro .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
[22039] | 762 | |
---|
[22091] | 763 | $msg_error_Synchro .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_refresh.png" alt="'.l10n('Sync_User').stripslashes($row['username']).'" /></a>'; |
---|
[22039] | 764 | |
---|
[22091] | 765 | $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Mail').'<br>-- PWG = '.$row['pwg_eml'].'<br>-- FluxBB = '.$row['bb_eml']; |
---|
| 766 | |
---|
[22039] | 767 | $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Pswd'); |
---|
[22091] | 768 | } |
---|
| 769 | elseif ($row['pwg_eml'] != $row['bb_eml'] and !Reg_FluxBB_PwdSynch($row['pwg_id'])) |
---|
| 770 | { |
---|
| 771 | $msg_error_Synchro .= '<br>'.l10n('Error_Synchro').stripslashes($row['username']); |
---|
[22039] | 772 | |
---|
[22091] | 773 | $msg_error_Synchro .= ' <a href="'; |
---|
| 774 | |
---|
| 775 | $msg_error_Synchro .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 776 | 'action' => 'sync_user', |
---|
| 777 | 'username' => stripslashes($row['username']), |
---|
| 778 | )); |
---|
| 779 | |
---|
| 780 | $msg_error_Synchro .= '" title="'.l10n('Sync_User').stripslashes($row['username']).'"'; |
---|
| 781 | |
---|
| 782 | $msg_error_Synchro .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 783 | |
---|
| 784 | $msg_error_Synchro .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_refresh.png" alt="'.l10n('Sync_User').stripslashes($row['username']).'" /></a>'; |
---|
| 785 | |
---|
[22039] | 786 | $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Mail').'<br>-- PWG = '.$row['pwg_eml'].'<br>-- FluxBB = '.$row['bb_eml']; |
---|
[22091] | 787 | } |
---|
| 788 | elseif ($row['pwg_eml'] = $row['bb_eml'] and Reg_FluxBB_PwdSynch($row['pwg_id'])) |
---|
| 789 | { |
---|
| 790 | $msg_error_Synchro .= '<br>'.l10n('Error_Synchro').stripslashes($row['username']); |
---|
| 791 | |
---|
| 792 | $msg_error_Synchro .= '<br>'.l10n('Error_Synchro_Pswd'); |
---|
| 793 | } |
---|
[22039] | 794 | } |
---|
| 795 | else if ($conf_Register_FluxBB['FLUXBB_DETAIL'] == 'true') |
---|
| 796 | $msg_ok_Synchro .= '<br> - '.stripslashes($row['username']).' ('.$row['pwg_eml'].')'.l10n('Audit_Synchro_OK'); |
---|
| 797 | } |
---|
| 798 | |
---|
| 799 | if ($msg_error_Synchro <> '') |
---|
| 800 | $msg_error_Synchro = l10n('Audit_Synchro').$msg_error_Synchro; |
---|
[22091] | 801 | |
---|
[22039] | 802 | if ($msg_ok_Synchro <> '') |
---|
| 803 | if ($msg_error_Synchro <> '') |
---|
| 804 | array_push($page['infos'], l10n('Audit_Synchro').$msg_ok_Synchro.'<br><br>'); |
---|
| 805 | else |
---|
| 806 | array_push($page['infos'], l10n('Audit_Synchro').$msg_ok_Synchro.'<br><br>'.l10n('Audit_OK')); |
---|
| 807 | |
---|
| 808 | |
---|
| 809 | $query = ' |
---|
| 810 | SELECT username, mail_address FROM '.USERS_TABLE.' |
---|
| 811 | WHERE BINARY username <> BINARY "guest" |
---|
| 812 | AND username NOT IN ("18","16") |
---|
| 813 | AND id not in ( |
---|
| 814 | SELECT id_user_pwg FROM '.Register_FluxBB_ID_TABLE.' |
---|
| 815 | ) |
---|
| 816 | AND BINARY username not in ( |
---|
| 817 | SELECT username FROM '.FluxBB_USERS_TABLE.' |
---|
| 818 | ) |
---|
| 819 | ORDER BY LOWER(username) |
---|
| 820 | ;'; |
---|
| 821 | |
---|
| 822 | $result = pwg_query($query); |
---|
| 823 | |
---|
| 824 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 825 | { |
---|
| 826 | $msg_error_PWG2FluxBB .= '<br>'.l10n('Error_PWG2FluxBB').stripslashes($row['username']).' ('.$row['mail_address'].')'; |
---|
| 827 | |
---|
| 828 | $msg_error_PWG2FluxBB .= ' <a href="'; |
---|
| 829 | |
---|
| 830 | $msg_error_PWG2FluxBB .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 831 | 'action' => 'add_user', |
---|
| 832 | 'username' => stripslashes($row['username']), |
---|
| 833 | )); |
---|
| 834 | |
---|
| 835 | $msg_error_PWG2FluxBB .= '" title="'.l10n('Add_User').stripslashes($row['username']).'" '; |
---|
| 836 | |
---|
| 837 | $msg_error_PWG2FluxBB .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 838 | |
---|
| 839 | $msg_error_PWG2FluxBB .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_add.png" alt="'.l10n('Add_User').stripslashes($row['username']).'" /></a>'; |
---|
| 840 | } |
---|
| 841 | |
---|
| 842 | if ($msg_error_PWG2FluxBB == '') |
---|
| 843 | array_push($page['infos'], l10n('Audit_PWG2FluxBB').'<br>'.l10n('Audit_OK')); |
---|
| 844 | else |
---|
| 845 | $msg_error_PWG2FluxBB = l10n('Audit_PWG2FluxBB').$msg_error_PWG2FluxBB; |
---|
| 846 | |
---|
| 847 | |
---|
| 848 | $query = ' |
---|
| 849 | SELECT id, username, email FROM '.FluxBB_USERS_TABLE.' |
---|
| 850 | WHERE BINARY username <> BINARY "'.$conf_Register_FluxBB['FLUXBB_GUEST'].'" |
---|
| 851 | AND id not in ( |
---|
| 852 | SELECT id_user_FluxBB FROM '.Register_FluxBB_ID_TABLE.' |
---|
| 853 | ) |
---|
| 854 | AND BINARY username not in ( |
---|
| 855 | SELECT username FROM '.USERS_TABLE.' |
---|
| 856 | ) |
---|
| 857 | ORDER BY LOWER(username) |
---|
| 858 | ;'; |
---|
| 859 | |
---|
| 860 | $result = pwg_query($query); |
---|
| 861 | |
---|
| 862 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 863 | { |
---|
| 864 | $msg_error_FluxBB2PWG .= '<br>'.l10n('Error_FluxBB2PWG').stripslashes($row['username']).' ('.$row['email'].')'; |
---|
| 865 | |
---|
| 866 | $msg_error_FluxBB2PWG .= ' <a href="'; |
---|
| 867 | |
---|
| 868 | $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 869 | 'action' => 'del_user', |
---|
| 870 | 'id' => $row['id'], |
---|
| 871 | )); |
---|
| 872 | |
---|
| 873 | $msg_error_FluxBB2PWG .= '" title="'.l10n('Del_User').stripslashes($row['username']).'"'; |
---|
| 874 | |
---|
| 875 | $msg_error_FluxBB2PWG .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 876 | |
---|
| 877 | $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_delete.png" alt="'.l10n('Del_User').stripslashes($row['username']).'" /></a>'; |
---|
[22092] | 878 | |
---|
| 879 | $msg_error_FluxBB2PWG .= ' <a href="'; |
---|
| 880 | |
---|
| 881 | $msg_error_FluxBB2PWG .= add_url_params($page_Register_FluxBB_admin, array( |
---|
| 882 | 'action' => 'add2pwg', |
---|
| 883 | 'id' => $row['id'], |
---|
| 884 | 'username' => $row['username'], |
---|
| 885 | 'email' => $row['email'], |
---|
| 886 | )); |
---|
| 887 | |
---|
| 888 | $msg_error_FluxBB2PWG .= '" title="'.l10n('Add_User2pwg').stripslashes($row['username']).'"'; |
---|
| 889 | |
---|
| 890 | $msg_error_FluxBB2PWG .= $conf_Register_FluxBB['FLUXBB_CONFIRM']=='false' ? ' onclick="return confirm(\''.l10n('Are you sure?').'\');" ' : ' '; |
---|
| 891 | |
---|
| 892 | $msg_error_FluxBB2PWG .= '><img src="'.REGFLUXBB_PATH.'/admin/template/icon/user_add.png" alt="'.l10n('Add_User2pwg').stripslashes($row['username']).'" /></a>'; |
---|
[22039] | 893 | } |
---|
| 894 | |
---|
| 895 | if ($msg_error_FluxBB2PWG == '') |
---|
| 896 | array_push($page['infos'], l10n('Audit_FluxBB2PWG').'<br>'.l10n('Audit_OK')); |
---|
| 897 | else |
---|
| 898 | $msg_error_FluxBB2PWG = l10n('Audit_FluxBB2PWG').$msg_error_FluxBB2PWG; |
---|
| 899 | |
---|
| 900 | |
---|
| 901 | |
---|
| 902 | if ($msg_error_PWG_Dup <> '') |
---|
| 903 | $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>' ); |
---|
| 904 | |
---|
| 905 | if ($msg_error_FluxBB_Dup <> '') |
---|
| 906 | $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>' ); |
---|
| 907 | |
---|
| 908 | if ($msg_error_Link_Break <> '') |
---|
| 909 | $errors[] = $msg_error_Link_Break . ( ($msg_error_Link_Bad == '' and $msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); |
---|
| 910 | |
---|
| 911 | if ($msg_error_Link_Bad <> '') |
---|
| 912 | $errors[] = $msg_error_Link_Bad . ( ($msg_error_Synchro == '' and $msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); |
---|
| 913 | |
---|
| 914 | if ($msg_error_Synchro <> '') |
---|
| 915 | $errors[] = $msg_error_Synchro . ( ($msg_error_PWG2FluxBB == '' and $msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); |
---|
| 916 | |
---|
| 917 | if ($msg_error_PWG2FluxBB <> '') |
---|
| 918 | $errors[] = $msg_error_PWG2FluxBB . ( ($msg_error_FluxBB2PWG == '') ? '' : '<br><br>' ); |
---|
| 919 | |
---|
| 920 | if ($msg_error_FluxBB2PWG <> '') |
---|
| 921 | $errors[] = $msg_error_FluxBB2PWG; |
---|
| 922 | |
---|
| 923 | if (isset ($errors) and count($errors) != 0) |
---|
| 924 | { |
---|
| 925 | foreach ($errors as $error) |
---|
| 926 | { |
---|
| 927 | array_push($page['errors'], $error); |
---|
| 928 | } |
---|
| 929 | } |
---|
| 930 | } |
---|
| 931 | |
---|
| 932 | // +-----------------------------------------------------------------------+ |
---|
| 933 | // | Audit actions process | |
---|
| 934 | // +-----------------------------------------------------------------------+ |
---|
| 935 | if (isset($_GET['action']) and ($_GET['action']=='link_dead')) |
---|
| 936 | { |
---|
| 937 | $query = ' |
---|
| 938 | DELETE FROM '.Register_FluxBB_ID_TABLE.' |
---|
| 939 | WHERE id_user_FluxBB NOT IN ( |
---|
| 940 | SELECT id |
---|
| 941 | FROM '.FluxBB_USERS_TABLE.' |
---|
| 942 | ) |
---|
| 943 | OR id_user_pwg NOT IN ( |
---|
| 944 | SELECT id |
---|
| 945 | FROM '.USERS_TABLE.' |
---|
| 946 | ) |
---|
| 947 | ;'; |
---|
| 948 | |
---|
| 949 | $result = pwg_query($query); |
---|
| 950 | |
---|
| 951 | Audit_PWG_FluxBB(); |
---|
| 952 | } |
---|
| 953 | else if (isset($_GET['action']) and ($_GET['action']=='link_del') and isset($_GET['pwg_id']) and isset($_GET['bb_id'])) |
---|
| 954 | { |
---|
| 955 | $query = ' |
---|
| 956 | DELETE FROM '.Register_FluxBB_ID_TABLE.' |
---|
| 957 | WHERE id_user_pwg = '.$_GET['pwg_id'].' |
---|
| 958 | AND id_user_FluxBB = '.$_GET['bb_id'].' |
---|
| 959 | ;'; |
---|
| 960 | |
---|
| 961 | $result = pwg_query($query); |
---|
| 962 | |
---|
| 963 | Audit_PWG_FluxBB(); |
---|
| 964 | } |
---|
| 965 | else if (isset($_GET['action']) and ($_GET['action']=='new_link') and isset($_GET['pwg_id']) and isset($_GET['bb_id'])) |
---|
| 966 | { |
---|
[22091] | 967 | FluxBB_Linkuser($_GET['pwg_id'], $_GET['bb_id'], "NOK"); |
---|
[22039] | 968 | |
---|
| 969 | Audit_PWG_FluxBB(); |
---|
| 970 | } |
---|
[22091] | 971 | else if (isset($_GET['action']) and ($_GET['action']=='sync_user') and isset($_GET['username'])) |
---|
| 972 | { |
---|
| 973 | $query = ' |
---|
| 974 | SELECT id AS id_pwg, username, mail_address |
---|
| 975 | FROM '.USERS_TABLE.' |
---|
| 976 | WHERE BINARY username = BINARY "'.pwg_db_real_escape_string($_GET['username']).'" |
---|
| 977 | AND username NOT IN ("18","16") |
---|
| 978 | LIMIT 1 |
---|
| 979 | ;'; |
---|
| 980 | |
---|
| 981 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 982 | |
---|
| 983 | if (!empty($data)) |
---|
| 984 | { |
---|
| 985 | Synch_FluxBB_Updateuser($data['id_pwg'], stripslashes($data['username']), $data['mail_address']); |
---|
| 986 | } |
---|
| 987 | |
---|
| 988 | Audit_PWG_FluxBB(); |
---|
| 989 | } |
---|
[22039] | 990 | else if (isset($_GET['action']) and ($_GET['action']=='add_user') and isset($_GET['username'])) |
---|
| 991 | { |
---|
| 992 | $query = ' |
---|
[22091] | 993 | SELECT id, username, mail_address |
---|
[22039] | 994 | FROM '.USERS_TABLE.' |
---|
| 995 | WHERE BINARY username = BINARY "'.pwg_db_real_escape_string($_GET['username']).'" |
---|
| 996 | AND username NOT IN ("18","16") |
---|
| 997 | LIMIT 1 |
---|
| 998 | ;'; |
---|
| 999 | |
---|
| 1000 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 1001 | |
---|
| 1002 | if (!empty($data)) |
---|
[22091] | 1003 | Synch_FluxBB_Adduser($data['id'], stripslashes($data['username']), $data['mail_address']); |
---|
[22039] | 1004 | |
---|
| 1005 | Audit_PWG_FluxBB(); |
---|
| 1006 | } |
---|
| 1007 | else if (isset($_GET['action']) and ($_GET['action']=='del_user') and isset($_GET['id'])) |
---|
| 1008 | { |
---|
[22091] | 1009 | FluxBB_Deluser($_GET['id'], true); |
---|
[22039] | 1010 | |
---|
| 1011 | Audit_PWG_FluxBB(); |
---|
| 1012 | } |
---|
[22092] | 1013 | else if (isset($_GET['action']) and ($_GET['action']=='add2pwg') and isset($_GET['id']) and isset($_GET['username']) and isset($_GET['email'])) |
---|
| 1014 | { |
---|
| 1015 | $error = Synch_Piwigo_Adduser($_GET['id'], $_GET['username'], $_GET['email']); |
---|
| 1016 | |
---|
| 1017 | if (!$error) |
---|
| 1018 | Audit_PWG_FluxBB(); |
---|
| 1019 | else |
---|
| 1020 | $template->append('errors', l10n('RegFluxBB_Email_or_Username_already_exist')); |
---|
| 1021 | } |
---|
[22039] | 1022 | |
---|
| 1023 | |
---|
| 1024 | // +---------------------------------------------------------------+ |
---|
[21424] | 1025 | // | Template init | |
---|
| 1026 | // +---------------------------------------------------------------+ |
---|
| 1027 | $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']); |
---|
| 1028 | |
---|
| 1029 | // If UAM exists and if UAM ConfirmMail is set, we can set this feature |
---|
| 1030 | if (function_exists('FindAvailableConfirmMailID')) |
---|
| 1031 | { |
---|
| 1032 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
| 1033 | |
---|
| 1034 | if (isset($conf_UAM['CONFIRM_MAIL']) and ($conf_UAM['CONFIRM_MAIL'] == 'true' or $conf_UAM['CONFIRM_MAIL'] == 'local') and (isset($conf_UAM['NO_CONFIRM_GROUP']) and $conf_UAM['NO_CONFIRM_GROUP'] <> '-1')) |
---|
[17457] | 1035 | { |
---|
[21424] | 1036 | $UAM_bridge = true; |
---|
[17457] | 1037 | } |
---|
[21424] | 1038 | else $UAM_bridge = false; |
---|
| 1039 | } |
---|
[21912] | 1040 | else $UAM_bridge = false; |
---|
[17457] | 1041 | |
---|
[21424] | 1042 | // Save last opened paragraph in configuration tab |
---|
| 1043 | // ----------------------------------------------- |
---|
| 1044 | $nb_para=(isset($_POST["nb_para"])) ? $_POST["nb_para"]:""; |
---|
| 1045 | $nb_para2=(isset($_POST["nb_para2"])) ? $_POST["nb_para2"]:""; |
---|
[17457] | 1046 | |
---|
[21424] | 1047 | $themeconf=$template->get_template_vars('themeconf'); |
---|
| 1048 | $RFBB_theme=$themeconf['id']; |
---|
[17457] | 1049 | |
---|
[21424] | 1050 | $template->assign( |
---|
| 1051 | array |
---|
| 1052 | ( |
---|
| 1053 | 'nb_para' => $nb_para, |
---|
| 1054 | 'nb_para2' => $nb_para2, |
---|
| 1055 | 'REGFLUXBB_THEME' => $RFBB_theme, |
---|
| 1056 | 'REGFLUXBB_PATH' => REGFLUXBB_PATH, |
---|
| 1057 | 'REGFLUXBB_VERSION' => $conf_Register_FluxBB['REGFLUXBB_VERSION'], |
---|
| 1058 | 'FluxBB_PREFIX' => $conf_Register_FluxBB['FLUXBB_PREFIX'], |
---|
| 1059 | 'FluxBB_ADMIN' => stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']), |
---|
| 1060 | 'FluxBB_GUEST' => stripslashes($conf_Register_FluxBB['FLUXBB_GUEST']), |
---|
| 1061 | 'FluxBB_DEL_PT_TRUE' => $conf_Register_FluxBB['FLUXBB_DEL_PT'] == 'true' ? 'checked="checked"' : '', |
---|
| 1062 | 'FluxBB_DEL_PT_FALSE' => $conf_Register_FluxBB['FLUXBB_DEL_PT'] == 'false' ? 'checked="checked"' : '', |
---|
| 1063 | 'FluxBB_CONFIRM_TRUE' => $conf_Register_FluxBB['FLUXBB_CONFIRM'] == 'true' ? 'checked="checked"' : '', |
---|
| 1064 | 'FluxBB_CONFIRM_FALSE' => $conf_Register_FluxBB['FLUXBB_CONFIRM'] == 'false' ? 'checked="checked"' : '', |
---|
| 1065 | 'FluxBB_DETAILS_TRUE' => $conf_Register_FluxBB['FLUXBB_DETAIL'] == 'true' ? 'checked="checked"' : '', |
---|
| 1066 | 'FluxBB_DETAILS_FALSE' => $conf_Register_FluxBB['FLUXBB_DETAIL'] == 'false' ? 'checked="checked"' : '', |
---|
| 1067 | 'UAM_BRIDGE' => $UAM_bridge, |
---|
| 1068 | 'FluxBB_UAM_LINK_TRUE' => $conf_Register_FluxBB['FLUXBB_UAM_LINK'] == 'true' ? 'checked="checked"' : '', |
---|
| 1069 | 'FluxBB_UAM_LINK_FALSE'=> $conf_Register_FluxBB['FLUXBB_UAM_LINK'] == 'false' ? 'checked="checked"' : '', |
---|
| 1070 | 'FluxBB_GROUP' => $conf_Register_FluxBB['FLUXBB_GROUP'], |
---|
| 1071 | ) |
---|
| 1072 | ); |
---|
| 1073 | |
---|
| 1074 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/admin.tpl'); |
---|
| 1075 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
[17457] | 1076 | ?> |
---|