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)
|
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]);
|
$this->so->log('debug',sprintf('Session Char (%s)',ord($read)),['complete'=>$this->complete,'option'=>$this->option]);
|
||||||
|
|
||||||
switch ($read) {
|
switch ($read) {
|
||||||
|
@ -120,11 +120,11 @@ abstract class Server {
|
|||||||
try {
|
try {
|
||||||
$session = NULL; // TCP Session Details
|
$session = NULL; // TCP Session Details
|
||||||
|
|
||||||
$client->send(TCP_IAC . TCP_DO . TCP_OPT_SUP_GOAHEAD); // DO SUPPRES GO AHEAD
|
$client->send(TCP_IAC.TCP_DO.TCP_OPT_SUP_GOAHEAD); // DO SUPPRES GO AHEAD
|
||||||
$client->send(TCP_IAC . TCP_WONT . TCP_OPT_LINEMODE); // WONT LINEMODE
|
$client->send(TCP_IAC.TCP_WONT.TCP_OPT_LINEMODE); // WONT LINEMODE
|
||||||
$client->send(TCP_IAC . TCP_DO . TCP_OPT_ECHO); // DO ECHO
|
$client->send(TCP_IAC.TCP_DO.TCP_OPT_ECHO); // DO ECHO
|
||||||
// $client->send(TCP_IAC.TCP_AYT); // AYT
|
// $client->send(TCP_IAC.TCP_AYT); // AYT
|
||||||
$client->send(TCP_IAC . TCP_DO . TCP_OPT_TERMTYPE . TCP_IAC . TCP_SB . TCP_OPT_TERMTYPE . TCP_OPT_ECHO . TCP_IAC . TCP_SE); // Request Term Type
|
$client->send(TCP_IAC.TCP_DO.TCP_OPT_TERMTYPE.TCP_IAC.TCP_SB.TCP_OPT_TERMTYPE.TCP_OPT_ECHO.TCP_IAC.TCP_SE); // Request Term Type
|
||||||
|
|
||||||
$client->send(CLS.COFF);
|
$client->send(CLS.COFF);
|
||||||
|
|
||||||
@ -133,10 +133,10 @@ abstract class Server {
|
|||||||
$timewarpalt = FALSE; // Alternative timewarp frame to get
|
$timewarpalt = FALSE; // Alternative timewarp frame to get
|
||||||
$history = collect(); // Page history for going backwards
|
$history = collect(); // Page history for going backwards
|
||||||
$action = ACTION_GOTO; // Initial action.
|
$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
|
$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
|
$method = collect(); // Method in control for CONTROL_METHOD
|
||||||
|
|
||||||
$current = []; // Attributes about the current page
|
$current = []; // Attributes about the current page
|
||||||
@ -157,7 +157,7 @@ abstract class Server {
|
|||||||
while ($action != ACTION_TERMINATE) {
|
while ($action != ACTION_TERMINATE) {
|
||||||
// Read a character from the client session
|
// Read a character from the client session
|
||||||
$read = $client->read(1);
|
$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.
|
// It appears that read will return '' instead of false when a disconnect has occurred.
|
||||||
// We'll set it to NULL so its caught later
|
// 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) {
|
switch ($mode) {
|
||||||
// Key presses during field input.
|
// Key presses during field input.
|
||||||
case MODE_FIELD:
|
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
|
// This section performs some action if it is deemed necessary
|
||||||
if ($action) {
|
if ($action) {
|
||||||
printf("+ Performing action: %s\n",$action);
|
printf("+ Performing action: %s\n",$action);
|
||||||
@ -792,13 +796,14 @@ abstract class Server {
|
|||||||
// Standard Frame
|
// Standard Frame
|
||||||
case Frame::FRAMETYPE_INFO:
|
case Frame::FRAMETYPE_INFO:
|
||||||
$client->send($output);
|
$client->send($output);
|
||||||
$mode = $action = false;
|
$mode = $action = FALSE;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Login Frame.
|
// Login Frame.
|
||||||
case Frame::FRAMETYPE_LOGIN:
|
case Frame::FRAMETYPE_LOGIN:
|
||||||
$client->send($output);
|
$client->send($output);
|
||||||
|
$action = FALSE;
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
// If this is the registration page
|
// If this is the registration page
|
||||||
@ -807,7 +812,7 @@ abstract class Server {
|
|||||||
$control = CONTROL_METHOD;
|
$control = CONTROL_METHOD;
|
||||||
$method->push(Control::factory('register',$this));
|
$method->push(Control::factory('register',$this));
|
||||||
$method->last()->state['control'] = $control;
|
$method->last()->state['control'] = $control;
|
||||||
$method->last()->state['action'] = $action;
|
$method->last()->state['action'] = FALSE;
|
||||||
$method->last()->state['mode'] = MODE_FIELD;
|
$method->last()->state['mode'] = MODE_FIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,6 +899,8 @@ abstract class Server {
|
|||||||
break;
|
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.
|
// We need to reposition the cursor to the current field.
|
||||||
if ($current['fieldreset'] !== FALSE) {
|
if ($current['fieldreset'] !== FALSE) {
|
||||||
$client->send($this->outputPosition($current['field']->x,$current['field']->y).CON);
|
$client->send($this->outputPosition($current['field']->x,$current['field']->y).CON);
|
||||||
|
Reference in New Issue
Block a user