plugins/SpecialUserFuncs.php
changeset 93 95c4d91bd954
parent 85 7c68a18a27be
child 101 bb4e677a4da9
equal deleted inserted replaced
92:aa8ffe41d1c4 93:95c4d91bd954
   122   
   122   
   123   if ( $level > USER_LEVEL_MEMBER && !$session->user_logged_in )
   123   if ( $level > USER_LEVEL_MEMBER && !$session->user_logged_in )
   124   {
   124   {
   125     $level = USER_LEVEL_MEMBER;
   125     $level = USER_LEVEL_MEMBER;
   126   }
   126   }
       
   127   if ( $level <= USER_LEVEL_MEMBER && $session->user_logged_in )
       
   128     $paths->main_page();
   127   $template->header();
   129   $template->header();
   128   echo '<form action="'.makeUrl($paths->nslist['Special'].'Login').'" method="post" name="loginform" onsubmit="runEncryption();">';
   130   echo '<form action="'.makeUrl($paths->nslist['Special'].'Login').'" method="post" name="loginform" onsubmit="runEncryption();">';
   129   $header = ( $level > USER_LEVEL_MEMBER ) ? 'Please re-enter your login details' : 'Please enter your username and password to log in.';
   131   $header = ( $level > USER_LEVEL_MEMBER ) ? 'Please re-enter your login details' : 'Please enter your username and password to log in.';
   130   if ( isset($_POST['login']) )
   132   if ( isset($_POST['login']) )
   131   {
   133   {
   272     {
   274     {
   273       $template->load_theme($session->theme, $session->style);
   275       $template->load_theme($session->theme, $session->style);
   274       if(isset($_POST['return_to']))
   276       if(isset($_POST['return_to']))
   275       {
   277       {
   276         $name = ( isset($paths->pages[$_POST['return_to']]['name']) ) ? $paths->pages[$_POST['return_to']]['name'] : $_POST['return_to'];
   278         $name = ( isset($paths->pages[$_POST['return_to']]['name']) ) ? $paths->pages[$_POST['return_to']]['name'] : $_POST['return_to'];
   277         redirect( makeUrl($_POST['return_to']), 'Login successful', 'You have successfully logged into the '.getConfig('site_name').' site as "'.$session->username.'". Redirecting to ' . $name . '...' );
   279         redirect( makeUrl($_POST['return_to'], false, true), 'Login successful', 'You have successfully logged into the '.getConfig('site_name').' site as "'.$session->username.'". Redirecting to ' . $name . '...' );
   278       }
   280       }
   279       else
   281       else
   280       {
   282       {
   281         $paths->main_page();
   283         redirect( makeUrl(getConfig('main_page'), false, true), 'Login successful', 'You have successfully logged into the '.getConfig('site_name').' site as "'.$session->username.'". Redirecting to the main page...' );
   282       }
   284       }
   283     }
   285     }
   284     else
   286     else
   285     {
   287     {
   286       $GLOBALS['__login_status'] = $result;
   288       $GLOBALS['__login_status'] = $result;
   306   exit;
   308   exit;
   307 }
   309 }
   308 
   310 
   309 function page_Special_Logout() {
   311 function page_Special_Logout() {
   310   global $db, $session, $paths, $template, $plugins; // Common objects
   312   global $db, $session, $paths, $template, $plugins; // Common objects
       
   313   if ( !$session->user_logged_in )
       
   314     $paths->main_page();
       
   315   
   311   $l = $session->logout();
   316   $l = $session->logout();
   312   if($l == 'success') $paths->main_page();
   317   if ( $l == 'success' )
       
   318   {
       
   319     redirect(makeUrl(getConfig('main_page'), false, true), 'Logged out', 'You have been successfully logged out, and all cookies have been cleared. You will now be transferred to the main page.', 4);
       
   320   }
   313   $template->header();
   321   $template->header();
   314   echo '<h3>An error occurred during the logout process.</h3><p>'.$l.'</p>';
   322   echo '<h3>An error occurred during the logout process.</h3><p>'.$l.'</p>';
   315   $template->footer();
   323   $template->footer();
   316 }
   324 }
   317 
   325 
   320   global $db, $session, $paths, $template, $plugins; // Common objects
   328   global $db, $session, $paths, $template, $plugins; // Common objects
   321   if(getConfig('account_activation') == 'disable' && ( ( $session->user_level >= USER_LEVEL_ADMIN && !isset($_GET['IWannaPlayToo']) ) || $session->user_level < USER_LEVEL_ADMIN || !$session->user_logged_in ))
   329   if(getConfig('account_activation') == 'disable' && ( ( $session->user_level >= USER_LEVEL_ADMIN && !isset($_GET['IWannaPlayToo']) ) || $session->user_level < USER_LEVEL_ADMIN || !$session->user_logged_in ))
   322   {
   330   {
   323     $s = ($session->user_level >= USER_LEVEL_ADMIN) ? '<p>Oops...it seems that you <em>are</em> the administrator...hehe...you can also <a href="'.makeUrl($paths->page, 'IWannaPlayToo', true).'">force account registration to work</a>.</p>' : '';
   331     $s = ($session->user_level >= USER_LEVEL_ADMIN) ? '<p>Oops...it seems that you <em>are</em> the administrator...hehe...you can also <a href="'.makeUrl($paths->page, 'IWannaPlayToo', true).'">force account registration to work</a>.</p>' : '';
   324     die_friendly('Registration disabled', '<p>The administrator has disabled new user registration on this site.</p>' . $s);
   332     die_friendly('Registration disabled', '<p>The administrator has disabled new user registration on this site.</p>' . $s);
       
   333   }
       
   334   if ( $session->user_level < USER_LEVEL_ADMIN && $session->user_logged_in )
       
   335   {
       
   336     $paths->main_page();
   325   }
   337   }
   326   if(isset($_POST['submit'])) 
   338   if(isset($_POST['submit'])) 
   327   {
   339   {
   328     $_GET['coppa'] = ( isset($_POST['coppa']) ) ? $_POST['coppa'] : 'x';
   340     $_GET['coppa'] = ( isset($_POST['coppa']) ) ? $_POST['coppa'] : 'x';
   329     
   341