390 break; |
390 break; |
391 case 'user': |
391 case 'user': |
392 $solution = 'Please check your e-mail; you should have been sent a message with instructions on how to activate your account. If you do not receive an e-mail from this site within 24 hours, please contact the site administration for further assistance.'; |
392 $solution = 'Please check your e-mail; you should have been sent a message with instructions on how to activate your account. If you do not receive an e-mail from this site within 24 hours, please contact the site administration for further assistance.'; |
393 break; |
393 break; |
394 case 'admin': |
394 case 'admin': |
395 $solution = 'This website has been configured so that all user accounts must be activated by the administrator before they can be used, so your account will most likely be activated the next time the one of the administrators visits the site.'; |
395 $solution = 'This website has been configured so that all user accounts must be activated by the administrator before they can be used, so your account will most likely be activated the next time an administrator visits the site.'; |
396 break; |
396 break; |
397 } |
397 } |
398 die_semicritical('Account error', '<p>It appears that your user account has not yet been activated. '.$solution.'</p>'); |
398 |
|
399 // admin activation request opportunity |
|
400 $q = $db->sql_query('SELECT 1 FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\' AND edit_summary=\'' . $db->escape($userdata['username']) . '\';'); |
|
401 if ( !$q ) |
|
402 $db->_die(); |
|
403 |
|
404 $can_request = ( $db->numrows() < 1 ); |
|
405 $db->free_result(); |
|
406 |
|
407 if ( isset($_POST['logout']) ) |
|
408 { |
|
409 $this->sid = $_COOKIE['sid']; |
|
410 $this->user_logged_in = true; |
|
411 $this->user_id = intval($userdata['user_id']); |
|
412 $this->username = $userdata['username']; |
|
413 $this->auth_level = USER_LEVEL_MEMBER; |
|
414 $this->user_level = USER_LEVEL_MEMBER; |
|
415 $this->logout(); |
|
416 redirect(scriptPath . '/', 'Logged out', 'You have successfully been logged out. All cookies cleared.', 4); |
|
417 } |
|
418 |
|
419 if ( $can_request && !isset($_POST['activation_request']) ) |
|
420 { |
|
421 $form = '<p>If you are having trouble or did not receive the e-mail, you can request account activation from the administrators of this site.</p> |
|
422 <form action="' . makeUrlNS('System', 'ActivateStub') . '" method="post"> |
|
423 <p><input type="submit" name="activation_request" value="Request account activation" /> <input type="submit" name="logout" value="Log out" /></p> |
|
424 </form>'; |
|
425 } |
|
426 else |
|
427 { |
|
428 if ( $can_request && isset($_POST['activation_request']) ) |
|
429 { |
|
430 $this->admin_activation_request($userdata['username']); |
|
431 $form = '<p>A request has just been sent to the administrators of this site. They will be able to activate your account or send you another activation e-mail if needed.</p> |
|
432 <form action="' . makeUrlNS('System', 'ActivateStub') . '" method="post"> |
|
433 <p><input type="submit" name="logout" value="Log out" /></p> |
|
434 </form>'; |
|
435 } |
|
436 else |
|
437 { |
|
438 $form = '<p>There is an active request in the administrators\' control panel for your account to be activated.</p> |
|
439 <form action="' . makeUrlNS('System', 'ActivateStub') . '" method="post"> |
|
440 <p><input type="submit" name="logout" value="Log out" /></p> |
|
441 </form>'; |
|
442 } |
|
443 } |
|
444 |
|
445 die_semicritical('Account error', '<p>It appears that your user account has not yet been activated. '.$solution.'</p>' . $form); |
399 } |
446 } |
400 |
447 |
401 $this->sid = $_COOKIE['sid']; |
448 $this->sid = $_COOKIE['sid']; |
402 $this->user_logged_in = true; |
449 $this->user_logged_in = true; |
403 $this->user_id = intval($userdata['user_id']); |
450 $this->user_id = intval($userdata['user_id']); |