Login working

This commit is contained in:
Deon George
2018-12-11 23:31:44 +11:00
parent 4d65bb05a1
commit e60a7d9045
14 changed files with 289 additions and 92 deletions

View File

@@ -48,6 +48,11 @@ abstract class Frame
protected $cost_unit = 'u';
*/
const FRAMETYPE_INFO = 'i';
const FRAMETYPE_ACTION = 'a';
const FRAMETYPE_LOGIN = 'l';
const FRAMETYPE_TERMINATE = 't';
public $fields = NULL; // The fields in this frame.
// Magic Fields that are pre-filled
@@ -58,9 +63,9 @@ abstract class Frame
// Fields that are editable
private $fieldoptions = [
'a'=>['edit'=>TRUE], // Address
'p'=>['edit'=>TRUE], // Password
'u'=>['edit'=>TRUE], // User
'p'=>['edit'=>TRUE,'mask'=>'*'], // Password
'u'=>['edit'=>TRUE], // User
't'=>['edit'=>TRUE], // Text
];
// @todo Move this to the database
@@ -78,7 +83,7 @@ abstract class Frame
$startline = 0;
if (! $this->hasFlag('ip')) {
if (! $this->hasFlag('ip') AND (! $this->isCUG(0) OR $this->type() !== self::FRAMETYPE_LOGIN)) {
// Set the page header: CUG/Site Name | Page # | Cost
$this->output .= $this->render_header($this->header).
$this->render_page($this->frame->frame,$this->frame->index).
@@ -113,6 +118,7 @@ abstract class Frame
->where('index',$this->index())
->where('id','<>',$this->frame->id)
->where('mode_id',$o->id)
->where('access',1)
->limit(9);
}
@@ -130,7 +136,7 @@ abstract class Frame
*
* @param int $startline
*/
abstract public function fields($startline=0,$fieldchar='.');
abstract public function fields($startline=0);
/**
* Returns the current frame.
@@ -191,6 +197,11 @@ abstract class Frame
});
}
public function getFieldOptions(int $id)
{
return array_get($this->fieldoptions,$this->getField($id)->type);
}
/**
* Return the flag for this page
*
@@ -258,6 +269,11 @@ abstract class Frame
return array_get(array_get($this->fieldoptions,$field),'edit',FALSE);
}
public function isFieldMasked(string $field)
{
return array_get(array_get($this->fieldoptions,$field),'mask',FALSE);
}
/**
* Is this frame Public
*
@@ -354,8 +370,15 @@ abstract class Frame
*/
public function route(string $read)
{
// @todo
return FALSE;
if (! preg_match('/^[0-9]$/',$read))
throw new \Exception('Routes are single digit');
// If we dont have a route record...
if (! $this->frame->route)
return '*';
$key = 'r'.$read;
return $this->frame->route->{$key};
}
/**