| 232 | | if (!is_a_guest() and !is_admin()) if ( |
| 233 | | read_ec_conf('dup_allow') == '1' or ( |
| 234 | | read_ec_conf('dup_allow') == '2' and |
| 235 | | dup_allowed($user['id']) |
| 236 | | ) |
| 237 | | ) { |
| 238 | | // User access |
| 239 | | $result = pwg_query(" |
| 240 | | SELECT `cat_id` |
| 241 | | FROM `".USER_ACCESS_TABLE."` |
| 242 | | WHERE `user_id` = ".$user['id']."; |
| 243 | | "); |
| 244 | | $insert = array(); |
| 245 | | while ($row = pwg_db_fetch_assoc($result)) |
| 246 | | $insert[] = "(".$new_user['id'].",".$row['cat_id'].")"; |
| 247 | | if (!empty($insert)) pwg_query(" |
| 248 | | INSERT INTO `".USER_ACCESS_TABLE."` |
| 249 | | VALUES ".implode(',', $insert)."; |
| 250 | | "); |
| 251 | | |
| 252 | | // User groups |
| 253 | | $result = pwg_query(" |
| 254 | | SELECT `group_id` |
| 255 | | FROM `".USER_GROUP_TABLE."` |
| 256 | | WHERE `user_id` = ".$user['id']."; |
| 257 | | "); |
| 258 | | $insert = array(); |
| 259 | | while ($row = pwg_db_fetch_assoc($result)) |
| 260 | | $insert[] = "(".$new_user['id'].",".$row['group_id'].")"; |
| 261 | | if (!empty($insert)) pwg_query(" |
| 262 | | INSERT INTO `".USER_GROUP_TABLE."` |
| 263 | | VALUES ".implode(',', $insert)."; |
| 264 | | "); |
| 265 | | |
| 266 | | // User infos |
| 267 | | $result = pwg_query(" |
| 268 | | SELECT `level` |
| 269 | | FROM `".USER_INFOS_TABLE."` |
| 270 | | WHERE `user_id` = ".$user['id']."; |
| 271 | | "); |
| 272 | | $insert = array(); |
| 273 | | while ($row = pwg_db_fetch_assoc($result)) |
| 274 | | $insert[] = "(".$new_user['id'].",".$row['level'].")"; |
| 275 | | if (!empty($insert)) pwg_query(" |
| 276 | | UPDATE `".USER_INFOS_TABLE."` |
| 277 | | SET `level` = ".$user['level']." |
| 278 | | WHERE `user_id` = ".$new_user['id']."; |
| 279 | | "); |
| | 232 | if (read_ec_conf('activated') == '1') { |
| | 233 | if ( |
| | 234 | !is_a_guest() and !is_admin() and ( |
| | 235 | read_ec_conf('dup_allow') == '1' or ( |
| | 236 | read_ec_conf('dup_allow') == '2' and ( |
| | 237 | dup_allowed($user['id']) or ( |
| | 238 | read_ec_conf('simple_mode_on') == '1' and |
| | 239 | is_generic() |
| | 240 | ) |
| | 241 | ) |
| | 242 | ) |
| | 243 | ) |
| | 244 | ) { |
| | 245 | // User access |
| | 246 | $result = pwg_query(" |
| | 247 | SELECT `cat_id` |
| | 248 | FROM `".USER_ACCESS_TABLE."` |
| | 249 | WHERE `user_id` = ".$user['id']."; |
| | 250 | "); |
| | 251 | $insert = array(); |
| | 252 | while ($row = pwg_db_fetch_assoc($result)) |
| | 253 | $insert[] = "(".$new_user['id'].",".$row['cat_id'].")"; |
| | 254 | if (!empty($insert)) pwg_query(" |
| | 255 | INSERT INTO `".USER_ACCESS_TABLE."` |
| | 256 | VALUES ".implode(',', $insert)."; |
| | 257 | "); |
| | 258 | |
| | 259 | // User groups |
| | 260 | $result = pwg_query(" |
| | 261 | SELECT `group_id` |
| | 262 | FROM `".USER_GROUP_TABLE."` |
| | 263 | WHERE `user_id` = ".$user['id']."; |
| | 264 | "); |
| | 265 | $insert = array(); |
| | 266 | while ($row = pwg_db_fetch_assoc($result)) |
| | 267 | $insert[] = "(".$new_user['id'].",".$row['group_id'].")"; |
| | 268 | if (!empty($insert)) pwg_query(" |
| | 269 | INSERT INTO `".USER_GROUP_TABLE."` |
| | 270 | VALUES ".implode(',', $insert)."; |
| | 271 | "); |
| | 272 | |
| | 273 | // User infos |
| | 274 | $result = pwg_query(" |
| | 275 | SELECT `level` |
| | 276 | FROM `".USER_INFOS_TABLE."` |
| | 277 | WHERE `user_id` = ".$user['id']."; |
| | 278 | "); |
| | 279 | $insert = array(); |
| | 280 | while ($row = pwg_db_fetch_assoc($result)) |
| | 281 | $insert[] = "(".$new_user['id'].",".$row['level'].")"; |
| | 282 | if (!empty($insert)) pwg_query(" |
| | 283 | UPDATE `".USER_INFOS_TABLE."` |
| | 284 | SET `level` = ".$user['level']." |
| | 285 | WHERE `user_id` = ".$new_user['id']."; |
| | 286 | "); |
| | 287 | } |
| 315 | | if (version_compare(PHPWG_VERSION, '2.1.0', '<')) { |
| 316 | | // Makes the "quick connect" fieldset able to redirect to current page |
| 317 | | // after user identification, just as does the "connection" link. |
| 318 | | $template->assign(array('U_REDIRECT' => $_SERVER['REQUEST_URI'])); |
| 319 | | $template->set_prefilter('menubar', 'ec_duplicate_prefilter'); |
| 320 | | } |
| 321 | | |
| 322 | | // Adds duplication link, if needed |
| 323 | | if (!is_admin() and !is_a_guest()) if ( |
| 324 | | read_ec_conf('dup_allow') == '1' or ( |
| 325 | | read_ec_conf('dup_allow') == '2' and |
| 326 | | dup_allowed($user['id']) |
| 327 | | ) |
| 328 | | ) { |
| 329 | | $template->assign('U_REGISTER', get_root_url().'register.php'); |
| | 323 | if (read_ec_conf('activated') == '1') { |
| | 324 | if (version_compare(PHPWG_VERSION, '2.1.0', '<')) { |
| | 325 | // Makes the "quick connect" fieldset able to redirect to current page |
| | 326 | // after user identification, just as does the "connection" link. |
| | 327 | $template->assign(array('U_REDIRECT' => $_SERVER['REQUEST_URI'])); |
| | 328 | $template->set_prefilter('menubar', 'ec_duplicate_prefilter'); |
| | 329 | } |
| | 330 | |
| | 331 | // Add duplication link, if needed |
| 336 | | $lang['Register'] = $lang['Duplicate']; |
| 337 | | $lang['Create a new account'] = |
| 338 | | $lang['Create a new account with same properties']; |
| 339 | | } |
| 340 | | } |
| 341 | | |
| 342 | | // Adds connection link, if needed |
| 343 | | if (read_ec_conf('display_connection') == '1' and is_generic()) { |
| 344 | | // Adds connection link |
| 345 | | $template->assign( |
| 346 | | 'U_LOGIN', |
| 347 | | get_root_url().'identification.php?redirect='.$_SERVER['REQUEST_URI'] |
| 348 | | ); |
| | 344 | $template->assign('U_REGISTER', get_root_url().'register.php'); |
| | 345 | if ( |
| | 346 | read_ec_conf('duplic_display') == '1' or ( |
| | 347 | read_ec_conf('duplic_display') == '2' and |
| | 348 | !is_generic() |
| | 349 | ) |
| | 350 | ) { |
| | 351 | $lang['Register'] = $lang['Duplicate']; |
| | 352 | $lang['Create a new account'] = |
| | 353 | $lang['Create a new account with same properties']; |
| | 354 | } |
| | 355 | } |
| | 356 | |
| | 357 | // Adds connection link, if needed |
| | 358 | if (read_ec_conf('display_connection') == '1' and is_generic()) { |
| | 359 | // Adds connection link |
| | 360 | $template->assign( |
| | 361 | 'U_LOGIN', |
| | 362 | get_root_url().'identification.php?redirect='.$_SERVER['REQUEST_URI'] |
| | 363 | ); |
| | 364 | } |