Fixed rendering of login page multiple times
This commit is contained in:
parent
8f5a9a307c
commit
a9576422ee
@ -21,7 +21,6 @@ class Telnet extends Control
|
||||
|
||||
public function handle(string $read)
|
||||
{
|
||||
$this->state['mode'] = FALSE;
|
||||
$this->so->log('debug',sprintf('Session Char (%s)',ord($read)),['complete'=>$this->complete,'option'=>$this->option]);
|
||||
|
||||
switch ($read) {
|
||||
|
@ -133,10 +133,10 @@ abstract class Server {
|
||||
$timewarpalt = FALSE; // Alternative timewarp frame to get
|
||||
$history = collect(); // Page history for going backwards
|
||||
$action = ACTION_GOTO; // Initial action.
|
||||
$cmd = ''; // Current *command being typed in
|
||||
$mode = FALSE; // Current mode.
|
||||
$user = new User; // The logged in user
|
||||
$control = FALSE; // Logic in control
|
||||
$mode = FALSE; // Current mode.
|
||||
$cmd = ''; // Current *command being typed in
|
||||
$user = new User; // The logged in user
|
||||
$method = collect(); // Method in control for CONTROL_METHOD
|
||||
|
||||
$current = []; // Attributes about the current page
|
||||
@ -157,7 +157,7 @@ abstract class Server {
|
||||
while ($action != ACTION_TERMINATE) {
|
||||
// Read a character from the client session
|
||||
$read = $client->read(1);
|
||||
printf(". Got: %s (%s)\n",$read,ord($read));
|
||||
printf(". Got: %s (%s): Mode: [%s], Action: [%s], Control: [%s]\n",$read,ord($read),$mode,$action,$control);
|
||||
|
||||
// It appears that read will return '' instead of false when a disconnect has occurred.
|
||||
// We'll set it to NULL so its caught later
|
||||
@ -214,6 +214,8 @@ abstract class Server {
|
||||
}
|
||||
}
|
||||
|
||||
printf("- End Control: Read %s (%s): Mode: [%s], Action: [%s], Control: [%s]\n",$read,ord($read),$mode,$action,$control);
|
||||
|
||||
switch ($mode) {
|
||||
// Key presses during field input.
|
||||
case MODE_FIELD:
|
||||
@ -644,6 +646,8 @@ abstract class Server {
|
||||
}
|
||||
}
|
||||
|
||||
printf("- End Mode: Read %s (%s): Mode: [%s], Action: [%s], Control: [%s]\n",$read,ord($read),$mode,$action,$control);
|
||||
|
||||
// This section performs some action if it is deemed necessary
|
||||
if ($action) {
|
||||
printf("+ Performing action: %s\n",$action);
|
||||
@ -792,13 +796,14 @@ abstract class Server {
|
||||
// Standard Frame
|
||||
case Frame::FRAMETYPE_INFO:
|
||||
$client->send($output);
|
||||
$mode = $action = false;
|
||||
$mode = $action = FALSE;
|
||||
|
||||
break;
|
||||
|
||||
// Login Frame.
|
||||
case Frame::FRAMETYPE_LOGIN:
|
||||
$client->send($output);
|
||||
$action = FALSE;
|
||||
$output = '';
|
||||
|
||||
// If this is the registration page
|
||||
@ -807,7 +812,7 @@ abstract class Server {
|
||||
$control = CONTROL_METHOD;
|
||||
$method->push(Control::factory('register',$this));
|
||||
$method->last()->state['control'] = $control;
|
||||
$method->last()->state['action'] = $action;
|
||||
$method->last()->state['action'] = FALSE;
|
||||
$method->last()->state['mode'] = MODE_FIELD;
|
||||
}
|
||||
|
||||
@ -894,6 +899,8 @@ abstract class Server {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("- End Action: Read %s (%s): Mode: [%s], Action: [%s], Control: [%s]\n",$read,ord($read),$mode,$action,$control);
|
||||
|
||||
// We need to reposition the cursor to the current field.
|
||||
if ($current['fieldreset'] !== FALSE) {
|
||||
$client->send($this->outputPosition($current['field']->x,$current['field']->y).CON);
|
||||
|
Reference in New Issue
Block a user