Viewing file: Login.php (6.91 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//Include Common Files @1-5471E0F2
define("RelativePath", ".");
include(RelativePath . "/Common.php");
include(RelativePath . "/Template.php");
include(RelativePath . "/Sorter.php");
include(RelativePath . "/Navigator.php");
//End Include Common Files
Class clsRecordLogin { //Login Class @2-426E3B84
//Variables @2-CB19EB75
// Public variables
var $ComponentName;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormEnctype;
var $Visible;
var $Recordset;
var $CCSEvents = "";
var $CCSEventResult;
var $ds;
var $EditMode;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-A587F259
function clsRecordLogin()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record Login/Error";
$this->ReadAllowed = false;
$this->InsertAllowed = false;
$this->UpdateAllowed = false;
$this->DeleteAllowed = false;
if($this->Visible)
{
$this->ComponentName = "Login";
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->EditMode = ($FormMethod == "Edit");
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->login = new clsControl(ccsTextBox, "login", "login", ccsText, "", CCGetRequestParam("login", $Method));
$this->login->Required = true;
$this->password = new clsControl(ccsTextBox, "password", "password", ccsText, "", CCGetRequestParam("password", $Method));
$this->password->Required = true;
$this->Button_DoLogin = new clsButton("Button_DoLogin");
}
}
//End Class_Initialize Event
//Validate Method @2-FCD4B6B1
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->login->Validate() && $Validation);
$Validation = ($this->password->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-CE95D583
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->login->Errors->Count());
$errors = ($errors || $this->password->Errors->Count());
$errors = ($errors || $this->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-1A4952E6
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->EditMode = false;
if(!$this->FormSubmitted)
return;
if($this->FormSubmitted) {
$this->PressedButton = "Button_DoLogin";
if(strlen(CCGetParam("Button_DoLogin", ""))) {
$this->PressedButton = "Button_DoLogin";
}
}
$Redirect = "fono_list.php";
if($this->Validate()) {
if($this->PressedButton == "Button_DoLogin") {
if(!CCGetEvent($this->Button_DoLogin->CCSEvents, "OnClick")) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//Show Method @2-CD353F82
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error .= $this->login->Errors->ToString();
$Error .= $this->password->Errors->ToString();
$Error .= $this->Errors->ToString();
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName;
$this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm);
$Tpl->SetVar("Action", $this->HTMLFormAction);
$Tpl->SetVar("HTMLFormName", $this->ComponentName);
$Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->login->Show();
$this->password->Show();
$this->Button_DoLogin->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
}
//End Show Method
} //End Login Class @2-FCB6E20C
//Include Page implementation @8-5CD56755
include_once("./Footer.php");
//End Include Page implementation
//Initialize Page @1-1D39B2FF
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "Login.php";
$Redirect = "";
$TemplateFileName = "Login.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page
//Initialize Objects @1-713ABD0C
// Controls
$Login = new clsRecordLogin();
$Footer = new clsFooter();
$Footer->BindEvents();
$Footer->TemplatePath = "./";
$Footer->Initialize();
// Events
include("./Login_events.php");
BindEvents();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
//End Initialize Objects
//Initialize HTML Template @1-A0111C9D
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView");
$Tpl = new clsTemplate();
$Tpl->LoadTemplate(TemplatePath . $TemplateFileName, "main");
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow");
//End Initialize HTML Template
//Execute Components @1-ABCE2C31
$Login->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-BEB91355
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
header("Location: " . $Redirect);
exit;
}
//End Go to destination page
//Show Page @1-3E61D024
$Login->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-AB7622EF
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
unset($Tpl);
//End Unload Page
?>
|