summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjrags <>2006-11-01 04:47:01 +0000
committerjrags <>2006-11-01 04:47:01 +0000
commit6d28e3f62535bb637b08287585bf9c13dfd756d2 (patch)
treeea8e6ba21ff3f5fcf7c16933d7c9a8ed224a2412
parentb4403995107c4440b4e19dd5e5e8385e0eac2a5a (diff)
Update of new Security code, currently working on making TLogin functional so we can test the providers soon.
-rw-r--r--.gitattributes12
-rw-r--r--demos/helloworld/protected/pages/Home.page2
-rw-r--r--demos/providers/index.php2
-rw-r--r--demos/providers/protected/application.xml74
-rw-r--r--demos/providers/protected/pages/Home.page2
-rw-r--r--demos/providers/protected/pages/Home.php20
-rw-r--r--framework/Security/TMembershipManager.php111
-rw-r--r--framework/TApplication.php192
-rw-r--r--framework/Web/Security/Principal/IIdentity.php24
-rw-r--r--framework/Web/Security/Principal/IPrincipal.php19
-rw-r--r--framework/Web/Security/Principal/TGenericIdentity.php48
-rw-r--r--framework/Web/Security/Principal/TGenericPrincipal.php34
-rw-r--r--framework/Web/Security/TCookieProtection.php27
-rw-r--r--framework/Web/Security/TDefaultAuthenticationModule.php15
-rw-r--r--framework/Web/Security/TFormsAuthentication.php96
-rw-r--r--framework/Web/Security/TFormsAuthenticationModule.php126
-rw-r--r--framework/Web/Security/TFormsAuthenticationTicket.php124
-rw-r--r--framework/Web/Security/TFormsIdentity.php71
-rw-r--r--framework/Web/Security/TMembershipProvider.php1
-rw-r--r--framework/Web/Security/TRoleManagerModule.php11
-rw-r--r--framework/Web/Security/TSqlMembershipProvider.php2
-rw-r--r--framework/Web/UI/WebControls/TLogin.php924
-rw-r--r--framework/Web/UI/WebControls/TLoginUtil.php173
23 files changed, 1849 insertions, 261 deletions
diff --git a/.gitattributes b/.gitattributes
index 592c9f95..da378ed8 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1719,7 +1719,6 @@ framework/PradoBase.php -text
framework/Security/IUserManager.php -text
framework/Security/TAuthManager.php -text
framework/Security/TAuthorizationRule.php -text
-framework/Security/TMembershipManager.php -text
framework/Security/TSecurityManager.php -text
framework/Security/TUser.php -text
framework/Security/TUserManager.php -text
@@ -1827,8 +1826,18 @@ framework/Web/Javascripts/ratings/ratings.js -text
framework/Web/Javascripts/rico/colors.js -text
framework/Web/Javascripts/rico/extension.js -text
framework/Web/Javascripts/rico/rico.js -text
+framework/Web/Security/Principal/IIdentity.php -text
+framework/Web/Security/Principal/IPrincipal.php -text
+framework/Web/Security/Principal/TGenericIdentity.php -text
+framework/Web/Security/Principal/TGenericPrincipal.php -text
framework/Web/Security/TAnonymousIdentificationModule.php -text
framework/Web/Security/TAuthorizationStoreRoleProvider.php -text
+framework/Web/Security/TCookieProtection.php -text
+framework/Web/Security/TDefaultAuthenticationModule.php -text
+framework/Web/Security/TFormsAuthentication.php -text
+framework/Web/Security/TFormsAuthenticationModule.php -text
+framework/Web/Security/TFormsAuthenticationTicket.php -text
+framework/Web/Security/TFormsIdentity.php -text
framework/Web/Security/TMembership.php -text
framework/Web/Security/TMembershipCreateStatus.php -text
framework/Web/Security/TMembershipCreateUserException.php -text
@@ -1936,6 +1945,7 @@ framework/Web/UI/WebControls/TLiteralColumn.php -text
framework/Web/UI/WebControls/TLogin.php -text
framework/Web/UI/WebControls/TLoginName.php -text
framework/Web/UI/WebControls/TLoginStatus.php -text
+framework/Web/UI/WebControls/TLoginUtil.php -text
framework/Web/UI/WebControls/TLoginView.php -text
framework/Web/UI/WebControls/TMarkdown.php -text
framework/Web/UI/WebControls/TMultiView.php -text
diff --git a/demos/helloworld/protected/pages/Home.page b/demos/helloworld/protected/pages/Home.page
index 97702e67..fad60d4a 100644
--- a/demos/helloworld/protected/pages/Home.page
+++ b/demos/helloworld/protected/pages/Home.page
@@ -8,7 +8,7 @@
<com:TForm>
-<com:TButton Text="Click me" OnClick="buttonClicked" />
+<com:TButton ID="Button1" Text="Click me" OnClick="buttonClicked" />
</com:TForm>
diff --git a/demos/providers/index.php b/demos/providers/index.php
index 50bfe940..59c29c50 100644
--- a/demos/providers/index.php
+++ b/demos/providers/index.php
@@ -1,7 +1,7 @@
<?php
$basePath=dirname(__FILE__);
-$frameworkPath='/Users/jrags/Sites/prado-trunk/framework/prado.php';
+$frameworkPath=dirname(__FILE__).'/../../framework/prado.php';
$assetsPath=$basePath."/assets";
$runtimePath=$basePath."/protected/runtime";
diff --git a/demos/providers/protected/application.xml b/demos/providers/protected/application.xml
index d9258934..4763b2a6 100644
--- a/demos/providers/protected/application.xml
+++ b/demos/providers/protected/application.xml
@@ -3,41 +3,45 @@
<application id="Providers" mode="Debug">
<modules>
- <module id="MembershipProvider"
- class="System.Configuration.TProtectedConfiguration"
- defaultProvider="SqlMembershipProvider" >
- <provider
- id="SqlMembershipProvider"
- Description="Our SQL Membership provider"
- class="System.Web.Security.TSqlMembershipProvider"
- ConnectionStringName="SqlMembershipProvider"
- Enabled="true"
- EnablePasswordReset="True"
- EnablePasswordRetrieval="True"
- MaxInvalidPasswordAttempts="5"
- MinRequiredNonAlphanumericCharacters="5"
- MinRequiredPasswordLength="5"
- PasswordAttemptWindow="5"
- PasswordStrengthRegularExpression=""
- RequiresQuestionAndAnswer="True"
- RequiresUniqueEmail="True"/>
- </module>
+ <module id="FormsAuthentication"
+ class="System.Web.Security.TFormsAuthenticationModule"
+ defaultProvider="MembershipProvider"/>
+
+ <module id="MembershipProvider"
+ class="System.Configuration.TProtectedConfiguration"
+ defaultProvider="SqlMembershipProvider" >
+ <provider
+ id="SqlMembershipProvider"
+ Description="Our SQL Membership provider"
+ class="System.Web.Security.TSqlMembershipProvider"
+ ConnectionStringName="SqlMembershipProvider"
+ Enabled="true"
+ EnablePasswordReset="True"
+ EnablePasswordRetrieval="True"
+ MaxInvalidPasswordAttempts="5"
+ MinRequiredNonAlphanumericCharacters="5"
+ MinRequiredPasswordLength="5"
+ PasswordAttemptWindow="5"
+ PasswordStrengthRegularExpression=""
+ RequiresQuestionAndAnswer="True"
+ RequiresUniqueEmail="True"/>
+ </module>
- <module id="RoleProvider"
- class="System.Configuration.TProtectedConfiguration"
- defaultProvider="SqlRoleProvider">
- <provider
- id="SqlRoleProvider"
- class="System.Web.Security.TSqlRoleProvider"
- ConnectionStringName="SqlRoleProvider"
- ApplicationName="SampleApplication"
- Enabled="true"
- CacheRolesInCookie="True"
- CookieName="PRADO"
- CookieTimeout="30"
- CookiePath="/"
- CookieRequireSSL="False"
- CookieSlidingExpiration="True"/>
- </module>
+ <module id="RoleProvider"
+ class="System.Configuration.TProtectedConfiguration"
+ defaultProvider="SqlRoleProvider">
+ <provider
+ id="SqlRoleProvider"
+ class="System.Web.Security.TSqlRoleProvider"
+ ConnectionStringName="SqlRoleProvider"
+ ApplicationName="SampleApplication"
+ Enabled="true"
+ CacheRolesInCookie="True"
+ CookieName="PRADO"
+ CookieTimeout="30"
+ CookiePath="/"
+ CookieRequireSSL="False"
+ CookieSlidingExpiration="True"/>
+ </module>
</modules>
</application> \ No newline at end of file
diff --git a/demos/providers/protected/pages/Home.page b/demos/providers/protected/pages/Home.page
index 10069478..27be9e58 100644
--- a/demos/providers/protected/pages/Home.page
+++ b/demos/providers/protected/pages/Home.page
@@ -1,4 +1,4 @@
-<h1>Welcome to Prado!</h1>
+<h1>Provider Demo</h1>
<com:TForm>
<com:TLogin ID="LoginCtrl" MembershipProvider="SqlMembershipProvider"/>
</com:TForm> \ No newline at end of file
diff --git a/demos/providers/protected/pages/Home.php b/demos/providers/protected/pages/Home.php
index bbcbc20b..0c6320e4 100644
--- a/demos/providers/protected/pages/Home.php
+++ b/demos/providers/protected/pages/Home.php
@@ -6,22 +6,22 @@ class Home extends TPage
Prado::using('System.Util.TVarDumper');
Prado::using('System.Web.Security.TSqlMembershipProvider');
Prado::using('System.Configuration.TProtectedConfiguration');
- // TRoles::CreateRole('test');
- // TMembership::ValidateUser('test','test');
- // echo TVarDumper::dump(TProtectedConfiguration::getDefaultProvider(),10,true);
- // echo TVarDumper::dump($this->Application->getModule('ProtectedConfiguration'),10,true);
-
// Access by provider id
// $MembershipProvider = $this->Application->getModule('MembershipProvider')->getProvider('SqlMembershipProvider');
- // or just get the default provider
- $MembershipProvider = $this->Application->getModule('MembershipProvider')->Provider;
- // $RoleProvider = $this->Application->getModule('RoleProvider')->Provider;
+
+
/* @VAR $MembershipProvider TSqlMembershipProvider */
+ // $MembershipProvider = $this->Application->getModule('MembershipProvider')->Provider;
+ // echo TVarDumper::dump($MembershipProvider,10,true);
+
/* @VAR $RoleProvider TSqlRoleProvider */
- echo TVarDumper::dump($MembershipProvider,10,true);
- echo TVarDumper::dump($MembershipProvider->getMembershipUser('testUser'),10,true);
+ // $RoleProvider = $this->Application->getModule('RoleProvider')->Provider;
// echo TVarDumper::dump($RoleProvider,10,true);
+
+ /* @VAR $FormsAuthentication TFormsAuthenticationModule */
+ $FormsAuthentication = $this->Application->getModule('FormsAuthentication');
+ // echo TVarDumper::dump($FormsAuthentication,10,true);
}
}
?> \ No newline at end of file
diff --git a/framework/Security/TMembershipManager.php b/framework/Security/TMembershipManager.php
deleted file mode 100644
index b5986ac5..00000000
--- a/framework/Security/TMembershipManager.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-Prado::using('System.Security.TUser');
-
-interface IMembershipUser
-{
- public function getEmail();
- public function setEmail($value);
- public function getCreationDate();
- public function setCreationDate($value);
- public function getIsApproved();
- public function setIsApproved($value);
- public function getIsLockedOut();
- public function setIsLockedOut($value);
- public function getIsOnline();
- public function setIsOnline($value);
- public function getLastLoginDate();
- public function setLastLoginDate($value);
- public function getLastActivityDate();
- public function setLastActivityDate($value);
- public function getLastLockoutDate();
- public function setLastLockoutDate($value);
- public function getLastPasswordChangedDate();
- public function setLastPasswordChangedDate($value);
- public function getPasswordQuestion();
- public function setPasswordQuestion($value);
- public function getComment();
- public function setComment($value);
-
- public function update();
- public function fetchPassword($passwordAnswer=null);
- public function changePassword($username,$oldPassword,$newPassword);
- public function changePasswordQuestionAndAnswer($username,$password,$newQuestion,$newAnswer);
- public function resetPassword($passwordAnswer=null);
-}
-
-/*
-interface IUserManager
-{
-}*/
-
-
-
-abstract class TMembershipUser extends TUser implements IMembershipUser
-{
-}
-
-interface IRoleProvider
-{
- public function addUsersToRoles($users,$roles);
- public function removeUsersFromRoles($users,$roles);
- public function createRole($role);
- public function deleteRole($role,$throwOnPopulatedRole);
- public function getAllRoles();
- public function getRolesForUser($user);
- public function getUsersInRole($role);
- public function isUserInRole($user,$role);
- public function roleExists($role);
-}
-
-interface IMembershipProvider
-{
- public function getApplicationName();
- public function setApplicationName($value);
-
- public function createUser($username,$password,$email,$question,$answer,$isApproved); // return $key or error status
- public function deleteUser($username,$deleteAllRelatedData);
- public function updateUser($user);
-
- public function changePassword($username,$oldPassword,$newPassword);
- public function changePasswordQuestionAndAnswer($username,$password,$newQuestion,$newAnswer);
-
- public function encryptPassword($password);
- public function decryptPassword($encodedPassword);
- public function encodePassword($password,$format,$salt);
- public function decodePassword($password,$format);
- public function generateSalt();
-
- public function findUsersByEmail($email,$pageIndex,$pageSize);
- public function findUsersByName($email,$pageIndex,$pageSize);
-
- public function getAllUsers($pageIndex,$pageSize);
- public function getUser($username,$userkey,$userIsOnline);
- public function getNumberOfUsersOnline(); //???
- public function getUsernameByEmail($email);
- public function getPassword($username,$answer);
- public function resetPassword($username,$answer);
- public function unlockUser($username);
-
- public function validateUser($username,$password);
-
- public function onValidatingPassword($param);
-
- public function getEnablePasswordReset();
- public function setEnablePasswordReset($value);
- public function getEnablePasswordRetrieval();
- public function setEnablePasswordRetrieval($value);
- public function getMaxInvalidPasswordAttempts();
- public function setMaxInvalidPasswordAttempts($value);
- public function getUsernameFormat();
- public function setUsernameFormat($value);
- public function getPasswordFormat();
- public function setPasswordFormat($value);
- public function getRequiresQuestionAndAnswer();
- public function setRequiresQuestionAndAnswer($value);
- public function getRequiresUniqueEmail();
- public function setRequiresUniqueEmail($value);
-}
-
-
-?> \ No newline at end of file
diff --git a/framework/TApplication.php b/framework/TApplication.php
index 9e1026bf..5f4e8ec8 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -146,19 +146,19 @@ class TApplication extends TComponent
* @var array list of events that define application lifecycles
*/
private static $_steps=array(
- 'onBeginRequest',
- 'onAuthentication',
- 'onAuthenticationComplete',
- 'onAuthorization',
- 'onAuthorizationComplete',
- 'onLoadState',
- 'onLoadStateComplete',
- 'onPreRunService',
- 'runService',
- 'onSaveState',
- 'onSaveStateComplete',
- 'onPreFlushOutput',
- 'flushOutput'
+ 'onBeginRequest',
+ 'onAuthentication',
+ 'onAuthenticationComplete',
+ 'onAuthorization',
+ 'onAuthorizationComplete',
+ 'onLoadState',
+ 'onLoadStateComplete',
+ 'onPreRunService',
+ 'runService',
+ 'onSaveState',
+ 'onSaveStateComplete',
+ 'onPreFlushOutput',
+ 'flushOutput'
);
/**
@@ -291,16 +291,16 @@ class TApplication extends TComponent
// determine configuration path and file
if(($this->_basePath=realpath($basePath))===false)
- throw new TConfigurationException('application_basepath_invalid',$basePath);
+ throw new TConfigurationException('application_basepath_invalid',$basePath);
if(is_file($this->_basePath))
{
$this->_configFile=$this->_basePath;
$this->_basePath=dirname($this->_basePath);
}
else if(is_file($this->_basePath.'/'.self::CONFIG_FILE))
- $this->_configFile=$this->_basePath.'/'.self::CONFIG_FILE;
+ $this->_configFile=$this->_basePath.'/'.self::CONFIG_FILE;
else
- $this->_configFile=null;
+ $this->_configFile=null;
// determine runtime path
$this->_runtimePath=$this->_basePath.'/'.self::RUNTIME_PATH;
@@ -313,13 +313,13 @@ class TApplication extends TComponent
if(!is_dir($this->_runtimePath))
{
if(@mkdir($this->_runtimePath)===false)
- throw new TConfigurationException('application_runtimepath_failed',$this->_runtimePath);
+ throw new TConfigurationException('application_runtimepath_failed',$this->_runtimePath);
chmod($this->_runtimePath, 0777); //make it deletable
}
}
}
else
- throw new TConfigurationException('application_runtimepath_invalid',$this->_runtimePath);
+ throw new TConfigurationException('application_runtimepath_invalid',$this->_runtimePath);
$this->_cacheFile=$cacheConfig ? $this->_runtimePath.'/'.self::CONFIGCACHE_FILE : null;
@@ -343,9 +343,9 @@ class TApplication extends TComponent
while($this->_step<$n)
{
if($this->_mode===self::STATE_OFF)
- throw new THttpException(503,'application_service_unavailable');
+ throw new THttpException(503,'application_service_unavailable');
if($this->_requestCompleted)
- break;
+ break;
$method=self::$_steps[$this->_step];
Prado::trace("Executing $method()",'System.TApplication');
$this->$method();
@@ -403,9 +403,9 @@ class TApplication extends TComponent
{
$this->_stateChanged=true;
if($value===$defaultValue)
- unset($this->_globals[$key]);
+ unset($this->_globals[$key]);
else
- $this->_globals[$key]=$value;
+ $this->_globals[$key]=$value;
}
/**
@@ -438,7 +438,7 @@ class TApplication extends TComponent
protected function saveGlobals()
{
if(!$this->_stateChanged)
- return;
+ return;
$this->getApplicationStatePersister()->save($this->_globals);
}
@@ -524,9 +524,9 @@ class TApplication extends TComponent
public function setModule($id,IModule $module)
{
if(isset($this->_modules[$id]))
- throw new TConfigurationException('application_moduleid_duplicated',$id);
+ throw new TConfigurationException('application_moduleid_duplicated',$id);
else
- $this->_modules[$id]=$module;
+ $this->_modules[$id]=$module;
}
/**
@@ -765,7 +765,7 @@ class TApplication extends TComponent
public function getGlobalization($createIfNotExists=true)
{
if($this->_globalization===null && $createIfNotExists)
- $this->_globalization=new TGlobalization;
+ $this->_globalization=new TGlobalization;
return $this->_globalization;
}
@@ -783,7 +783,7 @@ class TApplication extends TComponent
public function getAuthorizationRules()
{
if($this->_authRules===null)
- $this->_authRules=new TAuthorizationRuleCollection;
+ $this->_authRules=new TAuthorizationRuleCollection;
return $this->_authRules;
}
@@ -821,7 +821,7 @@ class TApplication extends TComponent
fclose($fp);
}
else
- syslog(LOG_WARNING, 'Prado application config cache file "'.$this->_cacheFile.'" cannot be created.');
+ syslog(LOG_WARNING, 'Prado application config cache file "'.$this->_cacheFile.'" cannot be created.');
}
}
else
@@ -831,13 +831,13 @@ class TApplication extends TComponent
// set path aliases and using namespaces
foreach($config->getAliases() as $alias=>$path)
- Prado::setPathOfAlias($alias,$path);
+ Prado::setPathOfAlias($alias,$path);
foreach($config->getUsings() as $using)
- Prado::using($using);
+ Prado::using($using);
// set application properties
foreach($config->getProperties() as $name=>$value)
- $this->setSubProperty($name,$value);
+ $this->setSubProperty($name,$value);
// load parameters
$this->_parameters=new TMap;
@@ -847,11 +847,11 @@ class TApplication extends TComponent
{
$component=Prado::createComponent($parameter[0]);
foreach($parameter[1] as $name=>$value)
- $component->setSubProperty($name,$value);
+ $component->setSubProperty($name,$value);
$this->_parameters->add($id,$component);
}
else
- $this->_parameters->add($id,$parameter);
+ $this->_parameters->add($id,$parameter);
}
// load and init modules specified in app config
@@ -863,13 +863,13 @@ class TApplication extends TComponent
$module=Prado::createComponent($moduleConfig[0]);
if(is_string($id))
- $this->setModule($id,$module);
+ $this->setModule($id,$module);
foreach($moduleConfig[1] as $name=>$value)
- $module->setSubProperty($name,$value);
+ $module->setSubProperty($name,$value);
$modules[]=array($module,$moduleConfig[2]);
}
foreach($modules as $module)
- $module[0]->init($module[1]);
+ $module[0]->init($module[1]);
// load service
$services=$config->getServices();
@@ -879,20 +879,20 @@ class TApplication extends TComponent
$request->setAvailableServices($serviceIDs);
if(($serviceID=$request->getServiceID())===null)
- $serviceID=self::PAGE_SERVICE_ID;
+ $serviceID=self::PAGE_SERVICE_ID;
if(isset($services[$serviceID]))
{
$serviceConfig=$services[$serviceID];
$service=Prado::createComponent($serviceConfig[0]);
if(!($service instanceof IService))
- throw new THttpException(500,'application_service_unknown',$serviceID);
+ throw new THttpException(500,'application_service_unknown',$serviceID);
$this->_service=$service;
foreach($serviceConfig[1] as $name=>$value)
- $service->setSubProperty($name,$value);
+ $service->setSubProperty($name,$value);
$service->init($serviceConfig[2]);
}
else
- $this->_service=$this->getPageService();
+ $this->_service=$this->getPageService();
}
/**
@@ -990,7 +990,7 @@ class TApplication extends TComponent
public function runService()
{
if($this->_service)
- $this->_service->run();
+ $this->_service->run();
}
/**
@@ -1112,7 +1112,7 @@ class TApplicationConfiguration extends TComponent
// application properties
foreach($dom->getAttributes() as $name=>$value)
- $this->_properties[$name]=$value;
+ $this->_properties[$name]=$value;
// paths
if(($pathsNode=$dom->getElementByTagName('paths'))!==null)
@@ -1123,24 +1123,24 @@ class TApplicationConfiguration extends TComponent
{
$path=str_replace('\\','/',$path);
if(preg_match('/^\\/|.:\\/|.:\\\\/',$path)) // if absolute path
- $p=realpath($path);
+ $p=realpath($path);
else
- $p=realpath($configPath.'/'.$path);
+ $p=realpath($configPath.'/'.$path);
if($p===false || !is_dir($p))
- throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path);
+ throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path);
if(isset($this->_aliases[$id]))
- throw new TConfigurationException('appconfig_alias_redefined',$id);
+ throw new TConfigurationException('appconfig_alias_redefined',$id);
$this->_aliases[$id]=$p;
}
else
- throw new TConfigurationException('appconfig_alias_invalid');
+ throw new TConfigurationException('appconfig_alias_invalid');
}
foreach($pathsNode->getElementsByTagName('using') as $usingNode)
{
if(($namespace=$usingNode->getAttribute('namespace'))!==null)
- $this->_usings[]=$namespace;
+ $this->_usings[]=$namespace;
else
- throw new TConfigurationException('appconfig_using_invalid');
+ throw new TConfigurationException('appconfig_using_invalid');
}
}
@@ -1153,12 +1153,12 @@ class TApplicationConfiguration extends TComponent
$id=$properties->itemAt('id');
$type=$properties->remove('class');
if($type===null)
- throw new TConfigurationException('appconfig_moduletype_required',$id);
+ throw new TConfigurationException('appconfig_moduletype_required',$id);
$node->setParent(null);
if($id===null)
- $this->_modules[]=array($type,$properties->toArray(),$node);
+ $this->_modules[]=array($type,$properties->toArray(),$node);
else
- $this->_modules[$id]=array($type,$properties->toArray(),$node);
+ $this->_modules[$id]=array($type,$properties->toArray(),$node);
}
}
@@ -1169,9 +1169,9 @@ class TApplicationConfiguration extends TComponent
{
$properties=$node->getAttributes();
if(($id=$properties->itemAt('id'))===null)
- throw new TConfigurationException('appconfig_serviceid_required');
+ throw new TConfigurationException('appconfig_serviceid_required');
if(($type=$properties->remove('class'))===null)
- throw new TConfigurationException('appconfig_servicetype_required',$id);
+ throw new TConfigurationException('appconfig_servicetype_required',$id);
$node->setParent(null);
$this->_services[$id]=array($type,$properties->toArray(),$node);
}
@@ -1184,67 +1184,67 @@ class TApplicationConfiguration extends TComponent
{
$properties=$node->getAttributes();
if(($id=$properties->remove('id'))===null)
- throw new TConfigurationException('appconfig_parameterid_required');
+ throw new TConfigurationException('appconfig_parameterid_required');
if(($type=$properties->remove('class'))===null)
{
if(($value=$properties->remove('value'))===null)
- $this->_parameters[$id]=$node;
+ $this->_parameters[$id]=$node;
else
- $this->_parameters[$id]=$value;
+ $this->_parameters[$id]=$value;
}
else
- $this->_parameters[$id]=array($type,$properties->toArray());
+ $this->_parameters[$id]=array($type,$properties->toArray());
}
}
- }
+}
- /**
+/**
* @return array list of application initial property values, indexed by property names
*/
- public function getProperties()
- {
- return $this->_properties;
- }
+public function getProperties()
+{
+ return $this->_properties;
+}
- /**
+/**
* @return array list of path aliases, indexed by alias names
*/
- public function getAliases()
- {
- return $this->_aliases;
- }
+public function getAliases()
+{
+ return $this->_aliases;
+}
- /**
+/**
* @return array list of namespaces to be used
*/
- public function getUsings()
- {
- return $this->_usings;
- }
+public function getUsings()
+{
+ return $this->_usings;
+}
- /**
+/**
* @return array list of module configurations
*/
- public function getModules()
- {
- return $this->_modules;
- }
+public function getModules()
+{
+ return $this->_modules;
+}
- /**
+/**
* @return array list of service configurations
*/
- public function getServices()
- {
- return $this->_services;
- }
+public function getServices()
+{
+ return $this->_services;
+}
- /**
+/**
* @return array list of parameters
*/
- public function getParameters()
- {
- return $this->_parameters;
- }
+public function getParameters()
+{
+ return $this->_parameters;
+}
}
/**
@@ -1290,13 +1290,13 @@ class TApplicationStatePersister extends TModule implements IStatePersister
public function load()
{
if(($cache=$this->getApplication()->getCache())!==null && ($value=$cache->get(self::CACHE_NAME))!==false)
- return unserialize($value);
+ return unserialize($value);
else
{
if(($content=@file_get_contents($this->getStateFilePath()))!==false)
- return unserialize($content);
+ return unserialize($content);
else
- return null;
+ return null;
}
}
@@ -1311,17 +1311,17 @@ class TApplicationStatePersister extends TModule implements IStatePersister
if(($cache=$this->getApplication()->getCache())!==null)
{
if($cache->get(self::CACHE_NAME)===$content)
- $saveFile=false;
+ $saveFile=false;
else
- $cache->set(self::CACHE_NAME,$content);
+ $cache->set(self::CACHE_NAME,$content);
}
if($saveFile)
{
$fileName=$this->getStateFilePath();
if(version_compare(phpversion(),'5.1.0','>='))
- file_put_contents($fileName,$content,LOCK_EX);
+ file_put_contents($fileName,$content,LOCK_EX);
else
- file_put_contents($fileName,$content);
+ file_put_contents($fileName,$content);
}
}
diff --git a/framework/Web/Security/Principal/IIdentity.php b/framework/Web/Security/Principal/IIdentity.php
new file mode 100644
index 00000000..89bc0f70
--- /dev/null
+++ b/framework/Web/Security/Principal/IIdentity.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * IIdentity interface.
+ * Defines the basic functionality of a principal object.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: IIdentity.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security.Principal
+ * @since 3.1
+ */
+interface IIdentity
+{
+ private $_authenticationType;
+ private $_isAuthenticated;
+ private $_name;
+
+ public function getAuthenticationType();
+ public function setAuthenticationType($value);
+ public function getIsAuthenticated();
+ public function setIsAuthenticated($value);
+ public function getName();
+ public function setName($value);
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/Principal/IPrincipal.php b/framework/Web/Security/Principal/IPrincipal.php
new file mode 100644
index 00000000..9503387a
--- /dev/null
+++ b/framework/Web/Security/Principal/IPrincipal.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * IPrincipal interface.
+ * Defines the basic functionality of an identity object.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: IIdentity.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security.Principal
+ * @since 3.1
+ */
+interface IPrincipal
+{
+ private $_identity;
+
+ public function getIdentity();
+ public function setIdentity($value);
+ public function isInRole($role);
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/Principal/TGenericIdentity.php b/framework/Web/Security/Principal/TGenericIdentity.php
new file mode 100644
index 00000000..037ebc42
--- /dev/null
+++ b/framework/Web/Security/Principal/TGenericIdentity.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * TGenericIdentity class.
+ * Represents a generic user.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TGenericIdentity.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security.Principal
+ * @since 3.1
+ */
+Prado::using('System.Web.Security.Principal.IIdentity');
+class TGenericIdentity implements IIdentity
+{
+ private $_authenticationType;
+ private $_isAuthenticated;
+ private $_name;
+
+ public function getAuthenticationType()
+ {
+ return $this->_authenticationType;
+ }
+ public function setAuthenticationType($value)
+ {
+ $this->_authenticationType = TPropertyValue::ensureString($value);
+ }
+ public function getIsAuthenticated()
+ {
+ return $this->_isAuthenticated;
+ }
+ public function setIsAuthenticated($value)
+ {
+ $this->_isAuthenticated = TPropertyValue::ensureBoolean($value);
+ }
+ public function getName()
+ {
+ return $this->_name;
+ }
+ public function setName($value)
+ {
+ $this->_name = TPropertyValue::ensureString($value);
+ }
+
+ public function __construct($name, $type=null)
+ {
+
+ }
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/Principal/TGenericPrincipal.php b/framework/Web/Security/Principal/TGenericPrincipal.php
new file mode 100644
index 00000000..8e07388e
--- /dev/null
+++ b/framework/Web/Security/Principal/TGenericPrincipal.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * TGenericPrincipal class.
+ * Represents a generic principal.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TGenericPrincipal.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security.Principal
+ * @since 3.1
+ */
+Prado::using('System.Web.Security.Principal.IPrincipal');
+class TGenericPrincipal implements IPrincipal
+{
+ private $_identity;
+
+ public function getIdentity()
+ {
+ return $this->_identity;
+ }
+ public function setIdentity($value)
+ {
+ $this->_identity = TPropertyValue::ensureString($value);
+ }
+
+ public function __construct($name, $type=null)
+ {
+
+ }
+ public function isInRole($role)
+ {
+
+ }
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TCookieProtection.php b/framework/Web/Security/TCookieProtection.php
new file mode 100644
index 00000000..2a757898
--- /dev/null
+++ b/framework/Web/Security/TCookieProtection.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * TCookieProtection class.
+ * Describes how information in a cookie is protected.
+ *
+ * All Use both Validation and Encryption to protect the information
+ * in the cookie.
+ * Encryption Encrypt the information in the cookie.
+ * None Do not protect information in the cookie. Information in the
+ * cookie is stored in clear text and not validated when sent back
+ * to the server.
+ * Validation Ensure that the information in the cookie has not been altered
+ * before being sent back to the server.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TCookieProtection.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security
+ * @since 3.1
+ */
+class TCookieProtection extends TEnumerable
+{
+ const All='All';
+ const Encryption='Encryption';
+ const None='None';
+ const Validation='Validation';
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TDefaultAuthenticationModule.php b/framework/Web/Security/TDefaultAuthenticationModule.php
new file mode 100644
index 00000000..03d6e758
--- /dev/null
+++ b/framework/Web/Security/TDefaultAuthenticationModule.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * TDefaultAuthenticationModule class.
+ * Ensures that an authentication object is present in the context. This class cannot be inherited.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TDefaultAuthenticationModule.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security
+ * @since 3.1
+ */
+final class TDefaultAuthenticationModule extends TModule
+{
+
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TFormsAuthentication.php b/framework/Web/Security/TFormsAuthentication.php
new file mode 100644
index 00000000..5830d7eb
--- /dev/null
+++ b/framework/Web/Security/TFormsAuthentication.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * TFormsAuthentication class.
+ * Manages forms-authentication services for Web applications. This class cannot be inherited.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TFormsAuthentication.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security
+ * @since 3.1
+ */
+final class TFormsAuthentication
+{
+ private static $_cookieDomain;
+ private static $_cookieMode;
+ private static $_cookiesSupported;
+ private static $_defaultUrl;
+ private static $_enableCrossAppRedirects;
+ private static $_formsCookieName;
+ private static $_formsCookiePath;
+ private static $_loginUrl;
+ private static $_requireSSL;
+ private static $_slidingExpiration;
+
+ public static function getCookiePath()
+ {
+ return self::$_cookieDomain;
+ }
+ public static function setCookiePath($value)
+ {
+ self::$_cookieDomain = TPropertyValue::ensureString($value);
+ }
+
+ public function __construct()
+ {
+
+ }
+
+ public static Authenticate($name, $password);
+ public static Decrypt($encryptedTicket);
+ public static Encrypt($ticket);
+ private static Encrypt($ticket, $hexEncodedTicket);
+ public static GetAuthCookie( $$userName, $createPersistentCookie);
+ public static GetAuthCookie( $$userName, $createPersistentCookie, strCookiePath);
+ private static GetAuthCookie( $userName, $createPersistentCookie, strCookiePath, hexEncodedTicket);
+ public static GetLoginPage( $extraQuery);
+ public static GetLoginPage( $extraQuery, $reuseReturnUrl);
+ public static GetRedirectUrl( $userName, $createPersistentCookie);
+ public static GetReturnUrl( $useDefaultIfAbsent);
+ public static HashPasswordForStoringInConfigFile($password, $passwordFormat);
+ public static Initialize();
+ private static ernalAuthenticate( $name, $password);
+ private static IsPathWithinAppRoot($context, $path);
+ private static MakeTicketoBinaryBlob($ticket);
+ public static RedirectFromLoginPage($userName, $createPersistentCookie);
+ public static RedirectFromLoginPage($userName, $createPersistentCookie, $strCookiePath);
+ public static RedirectToLoginPage();
+ public static RedirectToLoginPage($extraQuery);
+ private static RemoveQSVar($ref $strUrl, $posQ, $token, $sep, $lenAtStartToLeave);
+ public static RemoveQueryVariableFromUrl( $strUrl, $QSVar);
+ public static RenewTicketIfOld($tOld);
+ public static SetAuthCookie( $userName, $createPersistentCookie);
+ public static SetAuthCookie( $userName, $createPersistentCookie, $strCookiePath);
+ public static SignOut();
+
+ // Properties
+ public static CookieDomain { get; }
+ public static HttpCookieMode CookieMode { get; }
+ public static CookiesSupported { get; }
+ public static DefaultUrl { get; }
+ public static EnableCrossAppRedirects { get; }
+ public static FormsCookieName { get; }
+ public static FormsCookiePath { get; }
+ public static LoginUrl { get; }
+ public static RequireSSL { get; }
+ public static SlidingExpiration { get; }
+
+ // Fields
+ private static _CookieDomain;
+ private static HttpCookieMode _CookieMode;
+ private static _DefaultUrl;
+ private static _EnableCrossAppRedirects;
+ private static _FormsCookiePath;
+ private static _FormsName;
+ private static _Initialized;
+ private static object _lockObject;
+ private static _LoginUrl;
+ private static FormsProtectionEnum _Protection;
+ private static _RequireSSL;
+ private static _SlidingExpiration;
+ private static _Timeout;
+ private const CONFIG_DEFAULT_COOKIE = ".ASPXAUTH";
+ private const MAC_LENGTH = 20;
+ private const MAX_TICKET_LENGTH = 0x1000;
+ ernal const RETURN_URL = "ReturnUrl";
+}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TFormsAuthenticationModule.php b/framework/Web/Security/TFormsAuthenticationModule.php
new file mode 100644
index 00000000..df0d5300
--- /dev/null
+++ b/framework/Web/Security/TFormsAuthenticationModule.php
@@ -0,0 +1,126 @@
+<?php
+/**
+ * TFormsAuthenticationModule class.
+ * Sets the identity of the user for an PRADO application when forms authentication is enabled.
+ * This class cannot be inherited.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TFormsAuthenticationModule.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security
+ * @since 3.1
+ */
+final class TFormsAuthenticationModule extends TModule
+{
+ /**
+ * @var boolean if the module has been initialized
+ */
+ private $_initialized=false;
+
+ private static $_fAuthChecked=false;
+ private static $_fAuthRequired=false;
+ private $_fFormsInit;
+ private $_formsName;
+ private $_loginUrl;
+ const CONFIG_DEFAULT_COOKIE = ".ASPXAUTH";
+ const CONFIG_DEFAULT_LOGINURL = "login.aspx";
+
+ //Is this the best way to do it?? i dont see how the forms module knows about the provider
+ private $_defaultProvider;
+
+ public function getDefaultProvider()
+ {
+ return $this->_defaultProvider;
+ }
+ public function setDefaultProvider($value)
+ {
+ $this->_defaultProvider = TPropertyValue::ensureString($value);
+ }
+
+ public function __construct()
+ {
+
+ }
+ /**
+ * Initializes this module.
+ * This method is required by the IModule interface.
+ * @param TXmlElement configuration for this module, can be null
+ * @throws TConfigurationException if user manager does not exist or is not IUserManager
+ */
+ public function init($config)
+ {
+ $this->getApplication()->attachEventHandler('OnAuthentication',array($this,'doAuthentication'));
+ $this->getApplication()->attachEventHandler('OnEndRequest',array($this,'leave'));
+ $this->getApplication()->attachEventHandler('OnAuthorization',array($this,'doAuthorization'));
+ $this->_initialized=true;
+ }
+
+ private static function extractTicketFromCookie($context, $name)
+ {
+
+ }
+ /**
+ * Performs authentication.
+ * This is the event handler attached to application's Authentication event.
+ * Do not call this method directly.
+ * @param mixed sender of the Authentication event
+ * @param mixed event parameter
+ */
+ public function doAuthentication($sender,$param)
+ {
+ Prado::using('System.Util.TVarDumper');
+// echo TVarDumper::dump(__METHOD__,10,true);
+ }
+ /**
+ * Performs login redirect if authorization fails.
+ * This is the event handler attached to application's EndRequest event.
+ * Do not call this method directly.
+ * @param mixed sender of the event
+ * @param mixed event parameter
+ */
+ public function leave($sender,$param)
+ {
+ Prado::using('System.Util.TVarDumper');
+// echo TVarDumper::dump(__METHOD__,10,true);
+ }
+ /**
+ * Performs authorization.
+ * This is the event handler attached to application's Authorization event.
+ * Do not call this method directly.
+ * @param mixed sender of the Authorization event
+ * @param mixed event parameter
+ */
+ public function doAuthorization($sender,$param)
+ {
+ Prado::using('System.Util.TVarDumper');
+// echo TVarDumper::dump(__METHOD__,10,true);
+ }
+}
+//public sealed class FormsAuthenticationModule : IHttpModule
+//{
+// // Events
+// public event FormsAuthenticationEventHandler Authenticate;
+//
+// // Methods
+// [SecurityPermission(SecurityAction.Demand, Unrestricted=true)]
+// public FormsAuthenticationModule();
+// public void Dispose();
+// private static FormsAuthenticationTicket
+//ExtractTicketFromCookie(HttpContext context, string name, out bool
+//cookielessTicket);
+// public void Init(HttpApplication app);
+// private void OnAuthenticate(FormsAuthenticationEventArgs e);
+// private void OnEnter(object source, EventArgs eventArgs);
+// private void OnLeave(object source, EventArgs eventArgs);
+// private static void Trace(string str);
+//
+// // Fields
+// private FormsAuthenticationEventHandler _eventHandler;
+// private static bool _fAuthChecked;
+// private static bool _fAuthRequired;
+// private bool _fFormsInit;
+// private string _FormsName;
+// private string _LoginUrl;
+// private const string CONFIG_DEFAULT_COOKIE = ".ASPXAUTH";
+// private const string CONFIG_DEFAULT_LOGINURL = "login.aspx";
+//}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TFormsAuthenticationTicket.php b/framework/Web/Security/TFormsAuthenticationTicket.php
new file mode 100644
index 00000000..e53b68b2
--- /dev/null
+++ b/framework/Web/Security/TFormsAuthenticationTicket.php
@@ -0,0 +1,124 @@
+<?php
+/**
+ * TFormsAuthenticationTicket class.
+ * Provides access to properties and values of the ticket used with forms
+ * authentication to identify users. This class cannot be inherited.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TFormsAuthenticationTicket.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security
+ * @since 3.1
+ */
+final class TFormsAuthenticationTicket
+{
+ private $_cookiePath;
+ private $_expiration;
+ private $_expired;
+ private $_isPersistent;
+ private $_issueDate;
+ private $_name;
+ private $_userData;
+ private $_version;
+
+ public function getCookiePath()
+ {
+ return $this->_cookiePath;
+ }
+ public function setCookiePath($value)
+ {
+ $this->_cookiePath = TPropertyValue::ensureString($value);
+ }
+ public function getExpiration()
+ {
+ return $this->_expiration;
+ }
+ public function setExpiration($value)
+ {
+ $this->_expiration = TPropertyValue::ensureString($value);
+ }
+ public function getExpired()
+ {
+ return $this->_expired;
+ }
+ public function setExpired($value)
+ {
+ $this->_expired = TPropertyValue::ensureString($value);
+ }
+ public function getIsPersistent()
+ {
+ return $this->_isPersistent;
+ }
+ public function setIsPersistent($value)
+ {
+ $this->_isPersistent = TPropertyValue::ensureString($value);
+ }
+ public function getIssueDate()
+ {
+ return $this->_issueDate;
+ }
+ public function setIssueDate($value)
+ {
+ $this->_issueDate = TPropertyValue::ensureString($value);
+ }
+ public function getName()
+ {
+ return $this->_name;
+ }
+ public function setName($value)
+ {
+ $this->_name = TPropertyValue::ensureString($value);
+ }
+ public function getUserData()
+ {
+ return $this->_userData;
+ }
+ public function setUserData($value)
+ {
+ $this->_userData = TPropertyValue::ensureString($value);
+ }
+ public function getVersion()
+ {
+ return $this->_version;
+ }
+ public function setVersion($value)
+ {
+ $this->_version = TPropertyValue::ensureString($value);
+ }
+
+ public function __construct()
+ {
+
+ }
+}
+//public sealed class FormsAuthenticationTicket
+//{
+// // Methods
+// public FormsAuthenticationTicket(string name, bool isPersistent,
+//int timeout);
+// public FormsAuthenticationTicket(int version, string name,
+//DateTime issueDate, DateTime expiration, bool isPersistent, string
+//userData);
+// public FormsAuthenticationTicket(int version, string name,
+//DateTime issueDate, DateTime expiration, bool isPersistent, string
+//userData, string cookiePath);
+//
+// // Properties
+// public string CookiePath { get; }
+// public DateTime Expiration { get; }
+// public bool Expired { get; }
+// public bool IsPersistent { get; }
+// public DateTime IssueDate { get; }
+// public string Name { get; }
+// public string UserData { get; }
+// public int Version { get; }
+//
+// // Fields
+// private string _CookiePath;
+// private DateTime _Expiration;
+// private bool _IsPersistent;
+// private DateTime _IssueDate;
+// private string _Name;
+// private string _UserData;
+// private int _Version;
+//}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TFormsIdentity.php b/framework/Web/Security/TFormsIdentity.php
new file mode 100644
index 00000000..f4d00f82
--- /dev/null
+++ b/framework/Web/Security/TFormsIdentity.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * TFormsIdentity class.
+ * Represents a user identity authenticated using forms authentication. This class cannot be inherited.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TFormsIdentity.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security
+ * @since 3.1
+ */
+Prado::using('System.Web.Security.Principal.IIdentity');
+final class TFormsIdentity implements IIdentity
+{
+ private $_authenticationType;
+ private $_isAuthenticated=false;
+ private $_name;
+ private $_ticket;
+
+ public function getAuthenticationType()
+ {
+ return $this->_authenticationType;
+ }
+ public function setAuthenticationType($value)
+ {
+ $this->_authenticationType = TPropertyValue::ensureString($value);
+ }
+ public function getIsAuthenticated()
+ {
+ return $this->_isAuthenticated;
+ }
+ public function setIsAuthenticated($value)
+ {
+ $this->_isAuthenticated = TPropertyValue::ensureBoolean($value);
+ }
+ public function getName()
+ {
+ return $this->_name;
+ }
+ public function setName($value)
+ {
+ $this->_name = TPropertyValue::ensureString($value);
+ }
+ public function getTicket()
+ {
+ return $this->_ticket;
+ }
+ public function setTicket($value)
+ {
+ $this->_ticket = TPropertyValue::ensureString($value);
+ }
+
+ public function __construct()
+ {
+
+ }
+}
+//public sealed class FormsIdentity : IIdentity
+//{
+// // Methods
+// public FormsIdentity(FormsAuthenticationTicket ticket);
+//
+// // Properties
+// public string AuthenticationType { get; }
+// public bool IsAuthenticated { get; }
+// public string Name { get; }
+// public FormsAuthenticationTicket Ticket { get; }
+//
+// // Fields
+// private FormsAuthenticationTicket _Ticket;
+//}
+?> \ No newline at end of file
diff --git a/framework/Web/Security/TMembershipProvider.php b/framework/Web/Security/TMembershipProvider.php
index 6a54819d..446d59d9 100644
--- a/framework/Web/Security/TMembershipProvider.php
+++ b/framework/Web/Security/TMembershipProvider.php
@@ -117,7 +117,6 @@ abstract class TMembershipProvider extends TProviderBase
throw new TConfigurationException('membershipprovider_configfile_invalid',$this->_configFile);
}
$this->loadConfig($config);
-// $this->getApplication()->attachEventHandler('OnEndRequest',array($this,'collectLogs'));
}
/**
* Loads configuration from an XML element
diff --git a/framework/Web/Security/TRoleManagerModule.php b/framework/Web/Security/TRoleManagerModule.php
index 7f6181e0..79c6b7a5 100644
--- a/framework/Web/Security/TRoleManagerModule.php
+++ b/framework/Web/Security/TRoleManagerModule.php
@@ -1,5 +1,14 @@
<?php
-class TRoleManagerModule
+/**
+ * TRoleManagerModule class.
+ * Manages a TRolePrincipal instance for the current user. This class cannot be inherited.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TRoleManagerModule.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.Security
+ * @since 3.1
+ */
+final class TRoleManagerModule extends TModule
{
}
diff --git a/framework/Web/Security/TSqlMembershipProvider.php b/framework/Web/Security/TSqlMembershipProvider.php
index 6bd677f7..87e9015f 100644
--- a/framework/Web/Security/TSqlMembershipProvider.php
+++ b/framework/Web/Security/TSqlMembershipProvider.php
@@ -57,7 +57,7 @@ class TSqlMembershipProvider extends TMembershipProvider
public function getMembershipUser($username=null,$providerUserKey=null,$userIsOnline=false)
{
Prado::using('System.Web.Security.TMembershipUser');
-// return new TMembershipUser($this->getID());
+ return new TMembershipUser($this->getID());
}
public function getUserNameByEmail($email)
{
diff --git a/framework/Web/UI/WebControls/TLogin.php b/framework/Web/UI/WebControls/TLogin.php
index 3b3be585..470caee2 100644
--- a/framework/Web/UI/WebControls/TLogin.php
+++ b/framework/Web/UI/WebControls/TLogin.php
@@ -3,13 +3,933 @@
* TLogin class.
* Provides user interface (UI) elements for logging in to a Web site..
*
+ * The TLogin control is a composite control that provides all the common UI elements
+ * needed to authenticate a user on a Web site. The following three elements are
+ * required for all login scenarios:
+ * A unique user name to identify the user.
+ * A password to verify the identity of the user.
+ * A login button to send the login information to the server.
+ * The TLogin control also provides the following optional UI elements that support additional functions:
+ * A link for a password reminder.
+ * A Remember Me checkbox for retaining the login information between sessions.
+ * A Help link for users who are having trouble logging in.
+ * A Register New User link that redirects users to a registration page.
+ * Instruction text that appears on the login form.
+ * Custom error text that appears when the user clicks the login button without filling in the user name or password fields.
+ * Custom error text that appears if the login fails.
+ * A custom action that occurs when login succeeds.
+ * A way to hide the login control if the user is already logged in to the site.
+ *
+ * The TLogin control uses a membership provider to obtain user credentials.
+ * Unless you specify otherwise, the TLogin control uses the default membership
+ * provider defined in the Web.config file. To specify a different provider,
+ * set the MembershipProvider property to one of the membership provider
+ * names defined in your application's Web.config file. For more information,
+ * see Membership Providers.
+ *
+ * If you want to use a custom authentication service, you can use the OnAuthenticate
+ * method to call the service.
+ *
+ * Styles and Templates
+ * The appearance of the Login control is fully customizable through templates and
+ * style settings. All UI text messages are also customizable through properties
+ * of the TLogin class. The default interface text is automatically localized based
+ * on the locale setting on the server.
+ *
+ * If the TLogin control is customized with templates, then the AccessKey property
+ * and the TabIndex property are ignored. In this case, set the AccessKey property
+ * and the TabIndex property of each template child control directly.
+ *
+ * TLogin control properties represented by text boxes, such as UserName and Password,
+ * are accessible during all phases of the page life cycle. The control will pick up
+ * any changes made by the end user by means of the TextChanged event triggered by
+ * the textboxes.
+ *
+ * The following table lists the Login control style properties and explains which UI
+ * element each style property affects. For a list of which properties each style applies
+ * to, see the documentation for the individual style properties.
+ *
+ * Style property UI element affected
+ * BorderPadding The space between the control contents and the control's border.
+ * CheckBoxStyle Remember Me checkbox.
+ * FailureTextStyle Login failure text.
+ * InstructionTextStyle Instructional text on the page that tells users how to use the
+ * control.
+ * LabelStyle Labels for all input fields, such as text boxes.
+ * TextBoxStyle Text entry input fields.
+ * TitleTextStyle Title text.
+ * ValidatorTextStyle Text displayed to the user when a login attempt is unsuccessful
+ * due to validation errors
+ * HyperLinkStyle Links to other pages.
+ * LoginButtonStyle Login button.
+ *
+ * Validation Groupings
+ * The UserName and Password properties have RequiredFieldValidator controls associated
+ * with them to prevent users from submitting the page without providing required information.
+ *
+ * The TLogin control uses a validation group so that other fields on the same page as the TLogin
+ * control can be validated separately. By default, the ID property of the Login control is
+ * used as the name of the validation group. For example, a TLogin control with the ID "Login1"
+ * will use a validation group name of "Login1". If you want to set the validation group that
+ * the TLogin control is part of, you must template the control and change the validation group name.
+ *
* @author Jason Ragsdale <jrags@jasrags.net>
* @version $Id: TLogin.php 1398 2006-09-08 19:31:03Z xue $
* @package System.Web.UI.WebControls
* @since 3.1
*/
-class TLogin extends TCompositeControl
+class TLogin extends TCompositeControl
{
-
+ private $_borderPadding=1;
+ private $_checkBoxStyle;
+ private $_convertingToTemplate=false;
+ private $_failureTextStyle;
+ private $_hyperLinkStyle;
+ private $_instructionTextStyle;
+ private $_labelStyle;
+ private $_layoutTemplate;
+ private $_loginButtonStyle;
+ private $_password;
+ private $_passwordInternal;
+ private $_tagKey;
+ private $_templateContainer;
+ private $_textBoxStyle;
+ private $_titleTextStyle;
+ private $_userNameInternal;
+ private $_validatorTextStyle;
+
+ public function getBorderPadding()
+ {
+ return $this->getViewState('BorderPadding',1);
+ }
+ public function setBorderPadding($value)
+ {
+ $this->setViewState('BorderPadding',TPropertyValue::ensureInteger($value),1);
+ }
+ public function getCheckBoxStyle()
+ {
+ return $this->_checkBoxStyle;
+ }
+ public function getConvertingToTemplate()
+ {
+ return $this->_convertingToTemplate;
+ }
+ public function getCreateUserIconUrl()
+ {
+ return $this->getViewState('CreateUserIconUrl','');
+ }
+ public function setCreateUserIconUrl($value)
+ {
+ $this->setViewState('CreateUserIconUrl',TPropertyValue::ensureString($value),'');
+ }
+ public function getCreateUserText()
+ {
+ return $this->getViewState('CreateUserText','');
+ }
+ public function setCreateUserText($value)
+ {
+ $this->setViewState('CreateUserText',TPropertyValue::ensureString($value),'');
+ }
+ public function getCreateUserUrl()
+ {
+ return $this->getViewState('CreateUserUrl','');
+ }
+ public function setCreateUserUrl($value)
+ {
+ $this->setViewState('CreateUserUrl',TPropertyValue::ensureString($value),'');
+ }
+ public function getDestinationPageUrl()
+ {
+ return $this->getViewState('DestinationPageUrl','');
+ }
+ public function setDestinationPageUrl($value)
+ {
+ $this->setViewState('DestinationPageUrl',TPropertyValue::ensureString($value),'');
+ }
+ public function getDisplayRememberMe()
+ {
+ return $this->getViewState('DisplayRememberMe',true);
+ }
+ public function setDisplayRememberMe($value)
+ {
+ $this->setViewState('DisplayRememberMe',TPropertyValue::ensureBoolean($value),true);
+ }
+ public function getFailureAction()
+ {
+ return $this->getViewState('FailureAction','');
+ }
+ public function setFailureAction($value)
+ {
+ $this->setViewState('FailureAction',TPropertyValue::ensureString($value),'');
+ }
+ public function getFailureText()
+ {
+ return $this->getViewState('FailureText','');
+ }
+ public function setFailureText($value)
+ {
+ $this->setViewState('FailureText',TPropertyValue::ensureString($value),'');
+ }
+ public function getFailureTextStyle()
+ {
+ return $this->_failureTextStyle;
+ }
+ public function getHelpPageIconUrl()
+ {
+ return $this->getViewState('HelpPageIconUrl','');
+ }
+ public function setHelpPageIconUrl($value)
+ {
+ $this->setViewState('HelpPageIconUrl',TPropertyValue::ensureString($value),'');
+ }
+ public function getHelpPageText()
+ {
+ return $this->getViewState('HelpPageText','');
+ }
+ public function setHelpPageText($value)
+ {
+ $this->setViewState('HelpPageText',TPropertyValue::ensureString($value),'');
+ }
+ public function getHelpPageUrl()
+ {
+ return $this->getViewState('HelpPageUrl','');
+ }
+ public function setHelpPageUrl($value)
+ {
+ $this->setViewState('HelpPageUrl',TPropertyValue::ensureString($value),'');
+ }
+ public function getHyperLinkStyle()
+ {
+ return $this->_hyperLinkStyle;
+ }
+ public function getInstructionText()
+ {
+ return $this->getViewState('InstructionText','');
+ }
+ public function setInstructionText($value)
+ {
+ $this->setViewState('InstructionText',TPropertyValue::ensureString($value),'');
+ }
+ public function getInstructionTextStyle()
+ {
+ return $this->_instructionTextStyle;
+ }
+ public function getLabelStyle()
+ {
+ return $this->_labelStyle;
+ }
+ public function getLayoutTemplate()
+ {
+ return $this->_layoutTemplate;
+ }
+ public function setLayoutTemplate($value)
+ {
+ $this->_layoutTemplate = TPropertyValue::ensureString($value);
+ // parent::ChildControlsCreated=false;
+ }
+ public function getLoginButtonImageUrl()
+ {
+ return $this->getViewState('LoginButtonImageUrl','');
+ }
+ public function setLoginButtonImageUrl($value)
+ {
+ $this->setViewState('LoginButtonImageUrl',TPropertyValue::ensureString($value),'');
+ }
+ public function getLoginButtonStyle()
+ {
+ return $this->_loginButtonStyle;
+ }
+ public function getLoginButtonText()
+ {
+ return $this->getViewState('LoginButtonText','');
+ }
+ public function setLoginButtonText($value)
+ {
+ $this->setViewState('LoginButtonText',TPropertyValue::ensureString($value),'');
+ }
+ public function getLoginButtonType()
+ {
+ return $this->getViewState('LoginButtonType','');
+ }
+ public function setLoginButtonType($value)
+ {
+ $this->setViewState('LoginButtonType',TPropertyValue::ensureString($value),'');
+ }
+ public function getMembershipProvider()
+ {
+ return $this->getViewState('MembershipProvider','');
+ }
+ public function setMembershipProvider($value)
+ {
+ $this->setViewState('MembershipProvider',TPropertyValue::ensureString($value),'');
+ }
+ public function getOrientation()
+ {
+ return $this->getViewState('Orientation','');
+ }
+ public function setOrientation($value)
+ {
+ $this->setViewState('Orientation',TPropertyValue::ensureString($value),'');
+ // parent::ChildControlsCreated=false;
+ //Do we need TOrientation?
+ }
+ public function getPassword()
+ {
+ return $this->_password;
+ }
+ public function getPasswordInternal()
+ {
+ return $this->_passwordInternal;
+ }
+ public function getPasswordLabelText()
+ {
+ return $this->getViewState('PasswordLabelText','LoginControls_DefaultPasswordLabelText');
+ }
+ public function setPasswordLabelText($value)
+ {
+ $this->setViewState('PasswordLabelText',TPropertyValue::ensureString($value),'LoginControls_DefaultPasswordLabelText');
+ }
+ public function getPasswordRecoveryIconUrl()
+ {
+ return $this->getViewState('PasswordRecoveryIconUrl','');
+ }
+ public function setPasswordRecoveryIconUrl($value)
+ {
+ $this->setViewState('PasswordRecoveryIconUrl',TPropertyValue::ensureString($value),'');
+ }
+ public function getPasswordRecoveryText()
+ {
+ return $this->getViewState('PasswordRecoveryText','');
+ }
+ public function setPasswordRecoveryText($value)
+ {
+ $this->setViewState('PasswordRecoveryText',TPropertyValue::ensureString($value),'');
+ }
+ public function getPasswordRecoveryUrl()
+ {
+ return $this->getViewState('PasswordRecoveryUrl','');
+ }
+ public function setPasswordRecoveryUrl($value)
+ {
+ $this->setViewState('PasswordRecoveryUrl',TPropertyValue::ensureString($value),'');
+ }
+ public function getPasswordRequiredErrorMessage()
+ {
+ return $this->getViewState('PasswordRequiredErrorMessage','Login_DefaultPasswordRequiredErrorMessage');
+ }
+ public function setPasswordRequiredErrorMessage($value)
+ {
+ $this->setViewState('PasswordRequiredErrorMessage',TPropertyValue::ensureString($value),'Login_DefaultPasswordRequiredErrorMessage');
+ }
+ public function getRememberMeSet()
+ {
+ return $this->getViewState('RememberMeSet',false);
+ }
+ public function setRememberMeSet($value)
+ {
+ $this->setViewState('RememberMeSet',TPropertyValue::ensureBoolean($value),false);
+ }
+ public function getRememberMeText()
+ {
+ return $this->getViewState('RememberMeText','Login_DefaultRememberMeText');
+ }
+ public function setRememberMeText($value)
+ {
+ $this->setViewState('RememberMeText',TPropertyValue::ensureString($value),'Login_DefaultRememberMeText');
+ }
+ public function getTagKey()
+ {
+ //return HtmlTextWriterTag.Table;
+ }
+ public function getTemplateContainer()
+ {
+ $this->ensureChildControls();
+ return $this->_templateContainer;
+ }
+ public function getTextBoxStyle()
+ {
+ return $this->_textBoxStyle;
+ }
+ public function getTextLayout()
+ {
+ return $this->getViewState('TextLayout',TLoginTextLayout::TextOnLeft);
+ }
+ public function setTextLayout($value)
+ {
+ $this->setViewState('TextLayout',TPropertyValue::ensureEnum($value,'TLoginTextLayout'),TLoginTextLayout::TextOnLeft);
+ // parent::ChildControlsCreated=false;
+ }
+ public function getTitleText()
+ {
+ return $this->getViewState('TitleText','Login_DefaultTitleText');
+ }
+ public function setTitleText($value)
+ {
+ $this->setViewState('TitleText',TPropertyValue::ensureString($value),'Login_DefaultTitleText');
+ }
+ public function getTitleTextStyle()
+ {
+ return $this->_titleTextStyle;
+ }
+ public function getUserName()
+ {
+ return $this->getViewState('UserName','');
+ }
+ public function setUserName($value)
+ {
+ $this->setViewState('UserName',TPropertyValue::ensureString($value),'');
+ }
+ public function getUserNameInternal()
+ {
+ $this->_userNameInternal;
+ }
+ public function getUserNameLabelText()
+ {
+ return $this->getViewState('UserNameLabelText','Login_DefaultUserNameLabelText');
+ }
+ public function setUserNameLabelText($value)
+ {
+ $this->setViewState('UserNameLabelText',TPropertyValue::ensureString($value),'Login_DefaultUserNameLabelText');
+ }
+ public function getUserNameRequiredErrorMessage()
+ {
+ return $this->getViewState('UserNameRequiredErrorMessage','Login_DefaultUserNameRequiredErrorMessage');
+ }
+ public function setUserNameRequiredErrorMessage($value)
+ {
+ $this->setViewState('UserNameRequiredErrorMessage',TPropertyValue::ensureString($value),'Login_DefaultUserNameRequiredErrorMessage');
+ }
+ public function getValidatorTextStyle()
+ {
+ return $this->_validatorTextStyle;
+ }
+ public function getVisibleWhenLoggedIn()
+ {
+ return $this->getViewState('VisibleWhenLoggedIn',true);
+ }
+ public function setVisibleWhenLoggedIn($value)
+ {
+ $this->setViewState('VisibleWhenLoggedIn',TPropertyValue::ensureBoolean($value),true);
+ }
+ private function attemptLogin()
+ {
+
+ }
+ private function authenticateUsingMembershipProvider($param)
+ {
+ // e.Authenticated = LoginUtil.GetProvider(this.MembershipProvider).ValidateUser(this.UserNameInternal,this.PasswordInternal);
+ }
+ private function getRedirectUrl()
+ {
+
+ }
+ // protected function loadViewState($savedState)
+ // {
+
+ // }
+ public function onAuthenticate($param)
+ {
+ // AuthenticateEventHandler handler1 = (AuthenticateEventHandler) base.Events[Login.EventAuthenticate];
+ $handler1;
+ if ($handler1!==null)
+ {
+ $handler1($this,$param);
+ }
+ else
+ {
+ $this->authenticateUsingMembershipProvider($param);
+ }
+ }
+ public function onBubbleEvent($sender,$param)
+ {
+ // bool flag1 = false;
+ // if (e is CommandEventArgs)
+ // {
+ // CommandEventArgs args1 = (CommandEventArts) e;
+ // if (string.Equals(args1.CommandName,Login.LoginButtonCommandName,StringComparison.OrdinalIgnoreCase))
+ // {
+ // this.AttemptLogin();
+ // flag1=true;
+ // }
+ // }
+ // return flag1;
+ }
+ public function onLoggedIn($param)
+ {
+ // EventHandler handler1 = (EventHandler) base.Events[Login.EventLoggedIn];
+ if ($handler1!==null)
+ {
+ $handler1($this,$param);
+ }
+ }
+ public function onLoggingIn($param)
+ {
+ // LoginCancelEventHandler handler1 = (LoginCancelEventHandler) base.Events[Login.EventLoggingIn];
+ if ($handler1!==null)
+ {
+ $handler1($this,$param);
+ }
+ }
+ public function onLoginError($param)
+ {
+ // EventHandler handler1 = (EventHandler) base.Events[Login.EventLoginError];
+ if ($handler1!==null)
+ {
+ $handler1($this,$param);
+ }
+ }
+ private function onLoginPage()
+ {
+
+ }
+ public function onPreRender($param)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ parent::onPreRender($param);
+ $this->setEditableChildProperties();
+ $this->_templateContainer->setVisible(true);
+ // $this->getPage()->getRequest()->IsAuthenticated() is not created yet!
+ // $this->_templateContainer->Visible = ($this->getVisibleWhenLoggedIn() || !$this->getPage()->getRequest()->IsAuthenticated()) || $this->onLoginPage();
+ }
+ private function passwordTextChanged($sender,$param)
+ {
+ $this->_password = $sender->Text;
+ }
+ private function redirectedFromFailedLogin()
+ {
+
+ }
+ private function rememberMeCheckedChanged($sender,$param)
+ {
+ $this->_rememberMeSet = $sender->Checked;
+ }
+ public function render($writer)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ if ($this->_templateContainer->getVisible())
+ {
+ $this->setChildProperties();
+ // $this->renderControl($writer);
+ // $this->render($writer);
+ }
+ }
+ public function createChildControls()
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ $this->getControls()->clear();
+ $this->_templateContainer = new TLoginContainer($this);
+ $template1 = new TLoginTemplate($this);
+ $template1->instantiateIn($this->_templateContainer);
+ $this->_templateContainer->setVisible(true);
+ $this->getControls()->add($this->_templateContainer);
+ $this->setEditableChildProperties();
+ }
+ // protected function saveViewState()
+ // {
+
+ // }
+ public function setChildProperties()
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ $this->setCommonChildProperties();
+ if ($this->_layoutTemplate === null)
+ {
+ $this->setDefaultTemplateChildProperties();
+ }
+ }
+ private function setCommonChildProperties()
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ /* @VAR $container1 TLoginContainer */
+ $container1 = $this->_templateContainer;
+
+ }
+ private function setDefaultTemplateChildProperties()
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ /* @VAR $container1 TLoginContainer */
+ $container1 = $this->_templateContainer;
+ $container1->getBorderTable()->setCellPadding = $this->getBorderPadding();
+ $container1->getBorderTable()->setCellSpacing = 0;
+ $literal1 = $container1->getTitle();
+ $text1 = $this->getTitleText();
+ if (strlen($text1)>0)
+ {
+ $literal1->setText($text1);
+ }
+ }
+ private function setEditableChildProperties()
+ {
+
+ }
+ protected function trackViewState()
+ {
+
+ }
+ private function userNameTextChanged($sender,$param)
+ {
+ $this->_userName = $sender->Text;
+ }
+}
+
+class TLoginTemplate implements ITemplate
+{
+ private $_owner;
+
+ public function __construct($owner)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ $this->_owner=$owner;
+ }
+
+ private function createControls(TLoginContainer $loginContainer)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ $text1 = $this->_owner->getUniqueID();
+ $literal1 = new TLiteral();
+ $loginContainer->setTitle($literal1);
+ $literal2 = new TLiteral();
+ $loginContainer->setInstruction($literal2);
+ $box1 = new TTextBox();
+ $box1->setID('UserName');
+ $loginContainer->setUserNameTextBox($box1);
+ $label1 = new TLabel();
+ $loginContainer->setUserNameLabel($label1);
+ $flag1 = true;
+ $validator1 = new TRequiredFieldValidator();
+ $validator1->setID('UserNameRequired');
+ $validator1->setValidationGroup($text1);
+ $validator1->setControlToValidate($box1->getID());
+ $validator1->setDisplay(TValidatorDisplayStyle::Fixed);
+ $validator1->setText('LoginControls_DefaultRequiredFieldValidatorText');
+ $validator1->setEnabled($flag1);
+ $validator1->setVisible($flag1);
+ $loginContainer->setUserNameRequired($validator1);
+ }
+ private function layoutControls(TLoginContainer $loginContainer)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ // $orientation1 = $this->_owner->getOrientation();
+ // $layout1 = new TLoginTextLayout();
+ // if (($orientation1 === tl))
+ // $test = new TLogin();
+ $this->layoutHorizontalTextOnLeft($loginContainer);
+
+ }
+ private function layoutHorizontalTextOnLeft(TLoginContainer $loginContainer)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ $table1 = new TTable();
+ $table1->setCellPadding(0);
+ $row1 = new TTableRow();
+ $cell1 = new TTableCell();
+ $cell1->setColumnSpan(6);
+ $cell1->setHorizontalAlign(THorizontalAlign::Center);
+ $cell1->getControls()->add($loginContainer->getTitle());
+ $row1->getCells()->add($cell1);
+ $table1->getRows()->add($row1);
+
+ $row1 = new TTableRow();//Disapperingtablerow
+ $cell1 = new TTableCell();
+ $cell1->setColumnSpan(6);
+ $cell1->setHorizontalAlign(THorizontalAlign::Center);
+ $cell1->getControls()->add($loginContainer->getInstruction());
+ $row1->getCells()->add($cell1);
+ $table1->getRows()->add($row1);
+
+ $row1 = new TTableRow();//Disapperingtablerow
+ $cell1 = new TTableCell();
+ // if ($this->_owner->getConvertingToTemplate)
+ // {
+ // $loginContainer->getUserNameLabel()->RenderAsLabel = true;
+ // }
+ $cell1->getControls()->add($loginContainer->getUserNameLabel());
+ $row1->getCells()->add($cell1);
+
+ $cell1 = new TTableCell();
+ $cell1->getControls()->add($loginContainer->getUserNameTextBox());
+ $cell1->getControls()->add($loginContainer->getUserNameRequired());
+ $row1->getCells()->add($cell1);
+
+ $loginContainer->setLayoutTable($table1);
+ // $loginContainer->setBorderTable($table2);
+ // $loginContainer->getControls()->add($table2);
+ $loginContainer->getControls()->add($table1);
+ }
+ private function layoutHorizontalTextOnTop(TLoginContainer $loginContainer)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ }
+ private function layoutVerticalTextOnLeft(TLoginContainer $loginContainer)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ }
+ private function layoutVerticalTextOnTop(TLoginContainer $loginContainer)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ }
+ public function instantiateIn($parent)
+ {
+ echo TVarDumper::dump(__METHOD__,10,true);
+ $this->createControls($parent);
+ $this->layoutControls($parent);
+ }
+
+}
+
+Prado::using('System.Web.UI.WebControls.TLoginUtil');
+class TLoginContainer extends TGenericContainer
+{
+ private $_convertingToTemplate=false;
+ private $_createUserIcon;
+ private $_createUserLink;
+ private $_createUserLinkSeparator;
+ private $_failureTextLabel;
+ private $_helpPageIcon;
+ private $_helpPageLink;
+ private $_imageButton;
+ private $_instruction;
+ private $_linkButton;
+ private $_passwordLabel;
+ private $_passwordRecoveryIcon;
+ private $_passwordRecoveryLink;
+ private $_passwordRecoveryLinkSeparator;
+ private $_passwordRequired;
+ private $_passwordTextBox;
+ private $_pushButton;
+ private $_rememberMeCheckBox;
+ private $_title;
+ private $_userNameLabel;
+ private $_userNameRequired;
+ private $_userNameTextBox;
+
+ public function getConvertingToTemplate()
+ {
+ return parent::getOwner()->getConvertingToTemplate();
+ }
+ public function getCreateUserIcon()
+ {
+ return $this->_createUserIcon;
+ }
+ public function setCreateUserIcon(TImage $value)
+ {
+ $this->_createUserIcon = TPropertyValue::ensureObject($value);
+ }
+ public function getCreateUserLink()
+ {
+ return $this->_createUserLink;
+ }
+ public function setCreateUserLink(THyperLink $value)
+ {
+ $this->_createUserLink = TPropertyValue::ensureObject($value);
+ }
+ public function getCreateUserLinkSeparator()
+ {
+ return $this->_createUserLinkSeparator;
+ }
+ public function setCreateUserLinkSeparator(TLiteral $value)
+ {
+ $this->_createUserLinkSeparator = TPropertyValue::ensureObject($value);
+ }
+ public function getFailureTextLabel()
+ {
+ return $this->_failureTextLabel;
+ }
+ public function setFailureTextLabel(TControl $value)
+ {
+ $this->_failureTextLabel = TPropertyValue::ensureObject($value);
+ }
+ public function getHelpPageIcon()
+ {
+ return $this->_helpPageIcon;
+ }
+ public function setHelpPageIcon(TImage $value)
+ {
+ $this->_helpPageIcon = TPropertyValue::ensureObject($value);
+ }
+ public function getHelpPageLink()
+ {
+ return $this->_helpPageLink;
+ }
+ public function setHelpPageLink(THyperLink $value)
+ {
+ $this->_helpPageLink = TPropertyValue::ensureObject($value);
+ }
+ public function getImageButton()
+ {
+ return $this->_imageButton;
+ }
+ public function setImageButton(TImageButton $value)
+ {
+ $this->_imageButton = TPropertyValue::ensureObject($value);
+ }
+ public function getInstruction()
+ {
+ return $this->_instruction;
+ }
+ public function setInstruction(TLiteral $value)
+ {
+ $this->_instruction = TPropertyValue::ensureObject($value);
+ }
+ public function getLinkButton()
+ {
+ return $this->_linkButton;
+ }
+ public function setLinkButton(TLinkButton $value)
+ {
+ $this->_linkButton = TPropertyValue::ensureObject($value);
+ }
+ public function getPasswordLabel()
+ {
+ return $this->_passwordLabel;
+ }
+ public function setPasswordLabel(TLabel $value)
+ {
+ $this->_passwordLabel = TPropertyValue::ensureObject($value);
+ }
+ public function getPasswordRecoveryIcon()
+ {
+ return $this->_passwordRecoveryIcon;
+ }
+ public function setPasswordRecoveryIcon(TImage $value)
+ {
+ $this->_passwordRecoveryIcon = TPropertyValue::ensureObject($value);
+ }
+ public function getPasswordRecoveryLink()
+ {
+ return $this->_passwordRecoveryLink;
+ }
+ public function setPasswordRecoveryLink(THyperLink $value)
+ {
+ $this->_passwordRecoveryLink = TPropertyValue::ensureObject($value);
+ }
+ public function getPasswordRecoveryLinkSeparator()
+ {
+ return $this->_passwordRecoveryLinkSeparator;
+ }
+ public function setPasswordRecoveryLinkSeparator($value)
+ {
+ $this->_passwordRecoveryLinkSeparator = TPropertyValue::ensureObject($value);
+ }
+ public function getPasswordRequired()
+ {
+ return $this->_passwordRequired;
+ }
+ public function setPasswordRequired(TRequiredFieldValidator $value)
+ {
+ $this->_passwordRequired = TPropertyValue::ensureObject($value);
+ }
+ public function getPasswordTextBox()
+ {
+ return $this->_passwordTextBox;
+ }
+ public function setPasswordTextBox(TControl $value)
+ {
+ $this->_passwordTextBox = TPropertyValue::ensureObject($value);
+ }
+ public function getPushButton()
+ {
+ return $this->_pushButton;
+ }
+ public function setPushButton(TControl $value)
+ {
+ $this->_pushButton = TPropertyValue::ensureObject($value);
+ }
+ public function getRememberMeCheckBox()
+ {
+ return $this->_rememberMeCheckBox;
+ }
+ public function setRememberMeCheckBox(TControl $value)
+ {
+ $this->_rememberMeCheckBox = TPropertyValue::ensureObject($value);
+ }
+ public function getTitle()
+ {
+ return $this->_title;
+ }
+ public function setTitle(TLiteral $value)
+ {
+ $this->_title = TPropertyValue::ensureObject($value);
+ }
+ public function getUserNameLabel()
+ {
+ return $this->_userNameLabel;
+ }
+ public function setUserNameLabel(TLabel $value)
+ {
+ $this->_userNameLabel = TPropertyValue::ensureObject($value);
+ }
+ public function getUserNameRequired()
+ {
+ return $this->_userNameRequired;
+ }
+ public function setUserNameRequired(TRequiredFieldValidator $value)
+ {
+ $this->_userNameRequired = TPropertyValue::ensureObject($value);
+ }
+ public function getUserNameTextBox()
+ {
+ return $this->_userNameTextBox;
+ }
+ public function setUserNameTextBox(TControl $value)
+ {
+ $this->_userNameTextBox = TPropertyValue::ensureObject($value);
+ }
+}
+
+/**
+ * TLoginFailureAction class.
+ * Determines the page that the user will go to when a login attempt is not successful.
+ *
+ * RedirectToLoginPage Redirects the user to the login page defined in the site's
+ * configuration files.
+ * Refresh Refreshes the current page so that the Login control can display
+ * an error message.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TLoginFailureAction.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.UI.WebControls
+ * @since 3.1
+ */
+class TLoginFailureAction extends TEnumerable
+{
+ const RedirectToLoginPage='RedirectToLoginPage';
+ const Refresh='Refresh';
+}
+/**
+ * TLoginTextLayout class.
+ * Specifies the position of labels relative to their associated text boxes for the Login control.
+ *
+ * TextOnLeft Places labels to the left of the associated text entry fields.
+ * TextOnTop Places labels above the associated text entry fields.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TLoginTextLayout.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.UI.WebControls
+ * @since 3.1
+ */
+class TLoginTextLayout extends TEnumerable
+{
+ const TextOnLeft='TextOnLeft';
+ const TextOnTop='TextOnTop';
+}
+/**
+ * TLogoutAction class.
+ * Indicates the page that the user will be directed to when he or she logs out of the Web site.
+ *
+ * Redirect Redirects the user to a specified URL.
+ * RedirectToLoginPage Redirects the user to the login page defined in the site's configuration files.
+ * Refresh Reloads the current page with the user logged out.
+ *
+ * @author Jason Ragsdale <jrags@jasrags.net>
+ * @version $Id: TLogoutAction.php 1398 2006-09-08 19:31:03Z xue $
+ * @package System.Web.UI.WebControls
+ * @since 3.1
+ */
+class TLogoutAction extends TEnumerable
+{
+ const Redirect='Redirect';
+ const RedirectToLoginPage='RedirectToLoginPage';
+ const Refresh='Refresh';
}
?> \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TLoginUtil.php b/framework/Web/UI/WebControls/TLoginUtil.php
new file mode 100644
index 00000000..073f580d
--- /dev/null
+++ b/framework/Web/UI/WebControls/TLoginUtil.php
@@ -0,0 +1,173 @@
+<?php
+class TLoginUtil
+{
+ const _passwordReplacementKey='<%\s*Password\s*%>';
+ const _userNameReplacementKey='<%\s*UserName\s*%>';
+
+ // public function onSendingMailDelegate($param)
+ // {
+ //
+ // }
+ // public function onSendMailErrorDelegate($param)
+ // {
+ //
+ // }
+ public static function applyStyleToLiteral(TLiteral $literal,$text,$setTableCellVisible)
+ {
+
+ }
+ public static function copyBorderStyles(TControl $control,$style)
+ {
+ if (($style!==null) && strlen($providerName)!==0)
+ {
+ $control->BorderStyle = $style->BorderStyle;
+ $control->BorderColor = $style->BorderColor;
+ $control->BorderWidth = $style->BorderWidth;
+ $control->BackColor = $style->BackColor;
+ $control->CssClass = $style->CssClass;
+ }
+ }
+ public static function copyStyleToInnerControl(TControl $control,$style)
+ {
+ if (($style!==null) && strlen($providerName)!==0)
+ {
+ $control->ForeColor = $style->ForeColor;
+ $control->Font = $style->Font;
+ }
+ }
+ private static function createMailMessage($email,$userName,$password,$mailDefinition,$defaultSubject,$defaultBody,$owner)
+ {
+
+ }
+ public static function getProvider($providerName)
+ {
+ if (strlen($providerName)===0)
+ {
+ return TMembership::getProvider();
+ }
+ $provider1 = TMembership::getProviders($providerName);
+ if ($provider1===null)
+ {
+ throw new TException('WebControl_CantFindProvider');
+ }
+ return $provider1;
+ }
+ public static function getUser(TControl $c)
+ {
+
+ }
+ public static function getUserName(TControl $c)
+ {
+
+ }
+ public static function sendPasswordMail($email,$userName,$password,$mailDefinition,$defaultSubject,$defaultBody,$onSendmailDelegate,$onSendMailErrorDelegate,$owner)
+ {
+
+ }
+ public static function setTableCellStyle(TControl $control,$style)
+ {
+ // $control1 = $control->Parent;
+ // if ($control1!==null)
+ // {
+ // $control1->ApplyStyle=$style;
+ // }
+ }
+ public static function setTableCellVisible(TControl $control,$visible)
+ {
+ $control1 = $control->Parent;
+ if ($control1!==null)
+ {
+ $control1->Visible=$visible;
+ }
+ }
+}
+class TDisappearingTableRow extends TTableRow
+{
+ public function render($writer)
+ {
+ // bool flag1 = false;
+ // foreach (TableCell cell1 in this.Cells)
+ // {
+ // if (cell1.Visible)
+ // {
+ // flag1=true;
+ // break;
+ // }
+ // }
+ // if (flag1)
+ // {
+ // base.Render(writer);
+ // }
+ }
+}
+class TGenericContainer extends TWebControl
+{
+ private $_borderTable;
+ private $_convertingToTemplate=false;
+ private $_layoutTable;
+ private $_owner;
+ private $_usingDefaultTemplate=false;
+
+ public function getBorderTable()
+ {
+ return $this->_borderTable;
+ }
+ public function setBorderTable($value)
+ {
+ $this->_borderTable = $value;
+ }
+ public function getConvertingToTemplate()
+ {
+ return $this->_convertingToTemplate;
+ }
+ public function getLayoutTable()
+ {
+ return $this->_layoutTable;
+ }
+ public function setLayoutTable($value)
+ {
+ $this->_layoutTable = $value;
+ }
+ public function getOwner()
+ {
+ return $this->_owner;
+ }
+ public function getUsingDefaultTemplate()
+ {
+ return $this->_usingDefaultTemplate;
+ }
+
+ public function __construct($owner)
+ {
+ $this->_owner=$owner;
+ }
+ public function findControl($id,$required,$errorResourceKey)
+ {
+
+ }
+ protected function findOptionalControl($id)
+ {
+
+ }
+ protected function findRequiredControl($id,$errorResourceKey)
+ {
+
+ }
+ public function focus()
+ {
+
+ }
+ public function render($writer)
+ {
+
+ }
+ private function renderContentsInUnitTable($writer)
+ {
+
+ }
+ protected function verifyControlNotPresent($id,$errorResourceKey)
+ {
+
+ }
+}
+?> \ No newline at end of file