From 82621f4f0a7e47314222fa3b21a0745425e1248b Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 14 May 2007 11:40:22 +0000 Subject: moving unfinished files to dev branch. --- .gitattributes | 62 - demos/activeblog/index.php | 22 - demos/activeblog/protected/.htaccess | 1 - .../protected/App_Controls/BlogException.php | 31 - .../activeblog/protected/App_Controls/BlogPage.php | 49 - .../activeblog/protected/App_Controls/messages.txt | 12 - demos/activeblog/protected/App_Data/Settings.xml | 18 - demos/activeblog/protected/App_Data/blog.db | Bin 19456 -> 0 bytes .../protected/App_Layouts/MainLayout.php | 24 - .../protected/App_Layouts/MainLayout.tpl | 28 - .../protected/App_Modules/BlogDataModule.php | 633 -------- .../protected/App_Modules/BlogErrorHandler.php | 46 - .../activeblog/protected/App_Modules/BlogUser.php | 60 - .../protected/App_Modules/BlogUserManager.php | 73 - demos/activeblog/protected/App_Modules/schema.sql | 76 - demos/activeblog/protected/App_Pages/Home.page | 11 - demos/activeblog/protected/App_Pages/Home.php | 27 - demos/activeblog/protected/application.xml | 86 -- demos/activeblog/protected/urlmaps.xml | 4 - demos/activeblog/themes/Default/style.css | 18 - demos/providers/index.php | 20 - demos/providers/protected/.htaccess | 1 - demos/providers/protected/application.xml | 47 - demos/providers/protected/pages/Home.page | 55 - demos/providers/protected/pages/Home.php | 27 - framework/Configuration/Provider/TProviderBase.php | 118 -- .../Configuration/Provider/TProviderException.php | 19 - .../Configuration/TProtectedConfiguration.php | 84 -- framework/Web/Security/Principal/IIdentity.php | 24 - framework/Web/Security/Principal/IPrincipal.php | 19 - .../Web/Security/Principal/TGenericIdentity.php | 48 - .../Web/Security/Principal/TGenericPrincipal.php | 34 - .../Security/TAnonymousIdentificationModule.php | 7 - .../Security/TAuthorizationStoreRoleProvider.php | 68 - framework/Web/Security/TCookieProtection.php | 27 - .../Web/Security/TDefaultAuthenticationModule.php | 15 - framework/Web/Security/TFormsAuthentication.php | 176 --- .../Web/Security/TFormsAuthenticationModule.php | 126 -- .../Web/Security/TFormsAuthenticationTicket.php | 124 -- framework/Web/Security/TFormsIdentity.php | 71 - framework/Web/Security/TMembership.php | 208 --- framework/Web/Security/TMembershipCreateStatus.php | 39 - .../Security/TMembershipCreateUserException.php | 17 - .../Web/Security/TMembershipPasswordException.php | 17 - .../Web/Security/TMembershipPasswordFormat.php | 24 - framework/Web/Security/TMembershipProvider.php | 178 --- framework/Web/Security/TMembershipUser.php | 165 -- framework/Web/Security/TProviderException.php | 6 - framework/Web/Security/TRoleManagerModule.php | 15 - framework/Web/Security/TRolePrincipal.php | 6 - framework/Web/Security/TRoleProvider.php | 86 -- framework/Web/Security/TRoles.php | 237 --- framework/Web/Security/TSqlMembershipProvider.php | 83 -- framework/Web/Security/TSqlRoleProvider.php | 70 - framework/Web/Security/TUrlAuthorizationModule.php | 6 - framework/Web/UI/WebControls/TLogin.php | 1575 -------------------- framework/Web/UI/WebControls/TLoginName.php | 15 - framework/Web/UI/WebControls/TLoginStatus.php | 15 - framework/Web/UI/WebControls/TLoginUtil.php | 183 --- framework/Web/UI/WebControls/TLoginView.php | 15 - framework/Web/UI/WebControls/TOrientation.php | 19 - framework/Xml/TFeedDocument.php | 93 -- framework/Xml/TRssFeedDocument.php | 952 ------------ 63 files changed, 6415 deletions(-) delete mode 100644 demos/activeblog/index.php delete mode 100644 demos/activeblog/protected/.htaccess delete mode 100644 demos/activeblog/protected/App_Controls/BlogException.php delete mode 100644 demos/activeblog/protected/App_Controls/BlogPage.php delete mode 100644 demos/activeblog/protected/App_Controls/messages.txt delete mode 100644 demos/activeblog/protected/App_Data/Settings.xml delete mode 100644 demos/activeblog/protected/App_Data/blog.db delete mode 100644 demos/activeblog/protected/App_Layouts/MainLayout.php delete mode 100644 demos/activeblog/protected/App_Layouts/MainLayout.tpl delete mode 100644 demos/activeblog/protected/App_Modules/BlogDataModule.php delete mode 100644 demos/activeblog/protected/App_Modules/BlogErrorHandler.php delete mode 100644 demos/activeblog/protected/App_Modules/BlogUser.php delete mode 100644 demos/activeblog/protected/App_Modules/BlogUserManager.php delete mode 100644 demos/activeblog/protected/App_Modules/schema.sql delete mode 100644 demos/activeblog/protected/App_Pages/Home.page delete mode 100644 demos/activeblog/protected/App_Pages/Home.php delete mode 100644 demos/activeblog/protected/application.xml delete mode 100644 demos/activeblog/protected/urlmaps.xml delete mode 100644 demos/activeblog/themes/Default/style.css delete mode 100644 demos/providers/index.php delete mode 100644 demos/providers/protected/.htaccess delete mode 100644 demos/providers/protected/application.xml delete mode 100644 demos/providers/protected/pages/Home.page delete mode 100644 demos/providers/protected/pages/Home.php delete mode 100644 framework/Configuration/Provider/TProviderBase.php delete mode 100644 framework/Configuration/Provider/TProviderException.php delete mode 100644 framework/Configuration/TProtectedConfiguration.php delete mode 100644 framework/Web/Security/Principal/IIdentity.php delete mode 100644 framework/Web/Security/Principal/IPrincipal.php delete mode 100644 framework/Web/Security/Principal/TGenericIdentity.php delete mode 100644 framework/Web/Security/Principal/TGenericPrincipal.php delete mode 100644 framework/Web/Security/TAnonymousIdentificationModule.php delete mode 100644 framework/Web/Security/TAuthorizationStoreRoleProvider.php delete mode 100644 framework/Web/Security/TCookieProtection.php delete mode 100644 framework/Web/Security/TDefaultAuthenticationModule.php delete mode 100644 framework/Web/Security/TFormsAuthentication.php delete mode 100644 framework/Web/Security/TFormsAuthenticationModule.php delete mode 100644 framework/Web/Security/TFormsAuthenticationTicket.php delete mode 100644 framework/Web/Security/TFormsIdentity.php delete mode 100644 framework/Web/Security/TMembership.php delete mode 100644 framework/Web/Security/TMembershipCreateStatus.php delete mode 100644 framework/Web/Security/TMembershipCreateUserException.php delete mode 100644 framework/Web/Security/TMembershipPasswordException.php delete mode 100644 framework/Web/Security/TMembershipPasswordFormat.php delete mode 100644 framework/Web/Security/TMembershipProvider.php delete mode 100644 framework/Web/Security/TMembershipUser.php delete mode 100644 framework/Web/Security/TProviderException.php delete mode 100644 framework/Web/Security/TRoleManagerModule.php delete mode 100644 framework/Web/Security/TRolePrincipal.php delete mode 100644 framework/Web/Security/TRoleProvider.php delete mode 100644 framework/Web/Security/TRoles.php delete mode 100644 framework/Web/Security/TSqlMembershipProvider.php delete mode 100644 framework/Web/Security/TSqlRoleProvider.php delete mode 100644 framework/Web/Security/TUrlAuthorizationModule.php delete mode 100644 framework/Web/UI/WebControls/TLogin.php delete mode 100644 framework/Web/UI/WebControls/TLoginName.php delete mode 100644 framework/Web/UI/WebControls/TLoginStatus.php delete mode 100644 framework/Web/UI/WebControls/TLoginUtil.php delete mode 100644 framework/Web/UI/WebControls/TLoginView.php delete mode 100644 framework/Web/UI/WebControls/TOrientation.php delete mode 100644 framework/Xml/TFeedDocument.php delete mode 100644 framework/Xml/TRssFeedDocument.php diff --git a/.gitattributes b/.gitattributes index e05638c0..dc6b40bc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -642,25 +642,6 @@ buildscripts/wikibuilder/dumpHTML.inc -text buildscripts/wikibuilder/dumpHTML.php -text buildscripts/wikibuilder/external.png -text buildscripts/wikibuilder/main.css -text -demos/activeblog/index.php -text -demos/activeblog/protected/.htaccess -text -demos/activeblog/protected/App_Controls/BlogException.php -text -demos/activeblog/protected/App_Controls/BlogPage.php -text -demos/activeblog/protected/App_Controls/messages.txt -text -demos/activeblog/protected/App_Data/Settings.xml -text -demos/activeblog/protected/App_Data/blog.db -text svneol=unset#unset -demos/activeblog/protected/App_Layouts/MainLayout.php -text -demos/activeblog/protected/App_Layouts/MainLayout.tpl -text -demos/activeblog/protected/App_Modules/BlogDataModule.php -text -demos/activeblog/protected/App_Modules/BlogErrorHandler.php -text -demos/activeblog/protected/App_Modules/BlogUser.php -text -demos/activeblog/protected/App_Modules/BlogUserManager.php -text -demos/activeblog/protected/App_Modules/schema.sql -text -demos/activeblog/protected/App_Pages/Home.page -text -demos/activeblog/protected/App_Pages/Home.php -text -demos/activeblog/protected/application.xml -text -demos/activeblog/protected/urlmaps.xml -text -demos/activeblog/themes/Default/style.css -text demos/address-book/index.php -text demos/address-book/protected/.htaccess -text demos/address-book/protected/application.xml -text @@ -956,11 +937,6 @@ demos/personal/themes/White/images/header.gif -text demos/personal/themes/White/images/photonav-bg.gif -text demos/personal/themes/White/images/photonav-top-bg.gif -text demos/personal/themes/White/images/resume-photo.jpg -text -demos/providers/index.php -text -demos/providers/protected/.htaccess -text -demos/providers/protected/application.xml -text -demos/providers/protected/pages/Home.page -text -demos/providers/protected/pages/Home.php -text demos/quickstart/images/star1.gif -text demos/quickstart/images/star2.gif -text demos/quickstart/images/star3.gif -text @@ -1601,9 +1577,6 @@ framework/Collections/TPagedDataSource.php -text framework/Collections/TPagedList.php -text framework/Collections/TQueue.php -text framework/Collections/TStack.php -text -framework/Configuration/Provider/TProviderBase.php -text -framework/Configuration/Provider/TProviderException.php -text -framework/Configuration/TProtectedConfiguration.php -text framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php -text framework/Data/ActiveRecord/Exceptions/messages.txt -text framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php -text @@ -2087,33 +2060,6 @@ framework/Web/Javascripts/source/scriptaculous/controls.js -text framework/Web/Javascripts/source/scriptaculous/dragdrop.js -text framework/Web/Javascripts/source/scriptaculous/effects.js -text framework/Web/Javascripts/source/scriptaculous/slider.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 -framework/Web/Security/TMembershipPasswordException.php -text -framework/Web/Security/TMembershipPasswordFormat.php -text -framework/Web/Security/TMembershipProvider.php -text -framework/Web/Security/TMembershipUser.php -text -framework/Web/Security/TProviderException.php -text -framework/Web/Security/TRoleManagerModule.php -text -framework/Web/Security/TRolePrincipal.php -text -framework/Web/Security/TRoleProvider.php -text -framework/Web/Security/TRoles.php -text -framework/Web/Security/TSqlMembershipProvider.php -text -framework/Web/Security/TSqlRoleProvider.php -text -framework/Web/Security/TUrlAuthorizationModule.php -text framework/Web/Services/TFeedService.php -text framework/Web/Services/TJsonService.php -text framework/Web/Services/TPageService.php -text @@ -2208,14 +2154,8 @@ framework/Web/UI/WebControls/TListControlValidator.php -text framework/Web/UI/WebControls/TListItem.php -text framework/Web/UI/WebControls/TLiteral.php -text 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 -framework/Web/UI/WebControls/TOrientation.php -text framework/Web/UI/WebControls/TOutputCache.php -text framework/Web/UI/WebControls/TPager.php -text framework/Web/UI/WebControls/TPanel.php -text @@ -2248,8 +2188,6 @@ framework/Web/UI/WebControls/TWebControl.php -text framework/Web/UI/WebControls/TWebControlAdapter.php -text framework/Web/UI/WebControls/TWizard.php -text framework/Web/UI/WebControls/TXmlTransform.php -text -framework/Xml/TFeedDocument.php -text -framework/Xml/TRssFeedDocument.php -text framework/Xml/TXmlDocument.php -text framework/interfaces.php -text framework/powered.gif -text diff --git a/demos/activeblog/index.php b/demos/activeblog/index.php deleted file mode 100644 index c9808717..00000000 --- a/demos/activeblog/index.php +++ /dev/null @@ -1,22 +0,0 @@ -run(); - -?> \ No newline at end of file diff --git a/demos/activeblog/protected/.htaccess b/demos/activeblog/protected/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/demos/activeblog/protected/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/demos/activeblog/protected/App_Controls/BlogException.php b/demos/activeblog/protected/App_Controls/BlogException.php deleted file mode 100644 index 2501fa49..00000000 --- a/demos/activeblog/protected/App_Controls/BlogException.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id: BlogException.php 1398 2006-09-08 19:31:03Z xue $ - */ - -/** - * BlogException class - * - * @author Qiang Xue - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - */ -class BlogException extends THttpException -{ - /** - * @return string path to the error message file - */ - protected function getErrorMessageFile() - { - return dirname(__FILE__).'/messages.txt'; - } -} - -?> \ No newline at end of file diff --git a/demos/activeblog/protected/App_Controls/BlogPage.php b/demos/activeblog/protected/App_Controls/BlogPage.php deleted file mode 100644 index 61f7492d..00000000 --- a/demos/activeblog/protected/App_Controls/BlogPage.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id: BlogPage.php 1509 2006-11-25 20:51:43Z xue $ - */ - -/** - * BlogPage class - * - * @author Qiang Xue - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - */ -class BlogPage extends TPage -{ - public function onPreInit($param) - { - parent::onPreInit($param); - // $this->setTheme($this->getApplication()->Parameters['ThemeName']); - } - - public function getDataAccess() - { - return $this->getApplication()->getModule('data'); - } - - public function gotoDefaultPage() - { - $this->gotoPage($this->getService()->DefaultPage); - } - - public function gotoPage($pagePath,$getParameters=null) - { - $this->getResponse()->redirect($this->getService()->constructUrl($pagePath,$getParameters,false)); - } - - public function reportError($errorCode) - { - $this->gotoPage('ErrorReport',array('id'=>$errorCode)); - } -} - -?> \ No newline at end of file diff --git a/demos/activeblog/protected/App_Controls/messages.txt b/demos/activeblog/protected/App_Controls/messages.txt deleted file mode 100644 index 2a18aac2..00000000 --- a/demos/activeblog/protected/App_Controls/messages.txt +++ /dev/null @@ -1,12 +0,0 @@ -blogdatamodule_dbconnect_failed = Unable to connect to database: {0} -blogdatamodule_dbfile_invalid = BlogDataModule.DbFile='{0}' is invalid. -blogdatamodule_createdatabase_failed = BlogDataModule failed to create database when executing SQL: {1}. Last SQL error is: {0}. -blogdatamodule_query_failed = Failed to execute SQL: {1}. Last SQL error is: {0}. - -newuser_registration_disallowed = The Weblog system is running in single user mode and does not allow new user registration. -profile_edit_disallowed = You are not allowed to modify user profile {0}. -profile_id_invalid = Unable to retrieve user profile {0}. - -post_id_invalid = Unable to retrieve post {0}. -post_edit_disallowed = You are not allowed to modify post {0}. -post_view_disallowed = You are not allowed to read post {0}. \ No newline at end of file diff --git a/demos/activeblog/protected/App_Data/Settings.xml b/demos/activeblog/protected/App_Data/Settings.xml deleted file mode 100644 index d8b3c92b..00000000 --- a/demos/activeblog/protected/App_Data/Settings.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demos/activeblog/protected/App_Data/blog.db b/demos/activeblog/protected/App_Data/blog.db deleted file mode 100644 index ef3dbbfc..00000000 Binary files a/demos/activeblog/protected/App_Data/blog.db and /dev/null differ diff --git a/demos/activeblog/protected/App_Layouts/MainLayout.php b/demos/activeblog/protected/App_Layouts/MainLayout.php deleted file mode 100644 index e307aaed..00000000 --- a/demos/activeblog/protected/App_Layouts/MainLayout.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id: MainLayout.php 1398 2006-09-08 19:31:03Z xue $ - */ - -/** - * MainLayout class - * - * @author Qiang Xue - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - */ -class MainLayout extends TTemplateControl -{ -} - -?> \ No newline at end of file diff --git a/demos/activeblog/protected/App_Layouts/MainLayout.tpl b/demos/activeblog/protected/App_Layouts/MainLayout.tpl deleted file mode 100644 index 63fa576d..00000000 --- a/demos/activeblog/protected/App_Layouts/MainLayout.tpl +++ /dev/null @@ -1,28 +0,0 @@ - - - - > - - - - -
-

Header

-
-
- -
-
- -
-

3) More stuff here. very text make long column make filler fill make column column silly filler text silly column fill silly fill column text filler make text silly filler make filler very silly make text very very text make long filler very make column make silly column fill silly column long make silly filler column filler silly long long column fill silly column very

-
- -
-
- - \ No newline at end of file diff --git a/demos/activeblog/protected/App_Modules/BlogDataModule.php b/demos/activeblog/protected/App_Modules/BlogDataModule.php deleted file mode 100644 index 5065d239..00000000 --- a/demos/activeblog/protected/App_Modules/BlogDataModule.php +++ /dev/null @@ -1,633 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id: BlogDataModule.php 1398 2006-09-08 19:31:03Z xue $ - */ - -/** - * BlogDataModule class - * - * @author Qiang Xue - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - */ -class BlogDataModule extends TModule -{ - const DB_FILE_EXT='.db'; - const DEFAULT_DB_FILE='Application.App_Data.blog'; - private $_db=null; - private $_dbFile=null; - - public function init($config) - { - $this->connectDatabase(); - } - - public function getDbFile() - { - if($this->_dbFile===null) - $this->_dbFile=Prado::getPathOfNamespace(self::DEFAULT_DB_FILE,self::DB_FILE_EXT); - return $this->_dbFile; - } - - public function setDbFile($value) - { - if(($this->_dbFile=Prado::getPathOfNamespace($value,self::DB_FILE_EXT))===null) - throw new BlogException(500,'blogdatamodule_dbfile_invalid',$value); - } - - protected function createDatabase() - { - $schemaFile=dirname(__FILE__).'/schema.sql'; - $statements=explode(';',file_get_contents($schemaFile)); - foreach($statements as $statement) - { - if(trim($statement)!=='') - { - if(@sqlite_query($this->_db,$statement)===false) - throw new BlogException(500,'blogdatamodule_createdatabase_failed',sqlite_error_string(sqlite_last_error($this->_db)),$statement); - } - } - } - - protected function connectDatabase() - { - $dbFile=$this->getDbFile(); - $newDb=!is_file($dbFile); - $error=''; - - //create a connection and give it to the ActiveRecord manager. - $dsn = 'sqlite2:'.$dbFile; //Postgres SQL - $conn = new TDbConnection($dsn); - TActiveRecordManager::getInstance()->setDbConnection($conn); - - if($newDb) - $this->createDatabase(); - } - - protected function generateModifier($filter,$orderBy,$limit) - { - $modifier=''; - if($filter!=='') - $modifier=' WHERE '.$filter; - if($orderBy!=='') - $modifier.=' ORDER BY '.$orderBy; - if($limit!=='') - $modifier.=' LIMIT '.$limit; - return $modifier; - } - - public function query($sql) - { - if(($result=@sqlite_query($this->_db,$sql))!==false) - return $result; - else - throw new BlogException(500,'blogdatamodule_query_failed',sqlite_error_string(sqlite_last_error($this->_db)),$sql); - } - - protected function populateUserRecord($row) - { - $userRecord=new UserRecord; - $userRecord->ID=(integer)$row['id']; - $userRecord->Name=$row['name']; - $userRecord->FullName=$row['full_name']; - $userRecord->Role=(integer)$row['role']; - $userRecord->Password=$row['passwd']; - $userRecord->VerifyCode=$row['vcode']; - $userRecord->Email=$row['email']; - $userRecord->CreateTime=(integer)$row['reg_time']; - $userRecord->Status=(integer)$row['status']; - $userRecord->Website=$row['website']; - return $userRecord; - } - - public function queryUsers($filter='',$orderBy='',$limit='') - { - if($filter!=='') - $filter='WHERE '.$filter; - $sql="SELECT * FROM tblUsers $filter $orderBy $limit"; - $result=$this->query($sql); - $rows=sqlite_fetch_all($result,SQLITE_ASSOC); - $users=array(); - foreach($rows as $row) - $users[]=$this->populateUserRecord($row); - return $users; - } - - public function queryUserCount($filter) - { - if($filter!=='') - $filter='WHERE '.$filter; - $sql="SELECT COUNT(id) AS user_count FROM tblUsers $filter"; - $result=$this->query($sql); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - return $row['user_count']; - else - return 0; - } - - public function queryUserByID($id) - { - $sql="SELECT * FROM tblUsers WHERE id=$id"; - $result=$this->query($sql); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - return $this->populateUserRecord($row); - else - return null; - } - - public function queryUserByName($name) - { - $name=sqlite_escape_string($name); - $sql="SELECT * FROM tblUsers WHERE name='$name'"; - $result=$this->query($sql); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - return $this->populateUserRecord($row); - else - return null; - } - - public function insertUser($user) - { - $name=sqlite_escape_string($user->Name); - $fullName=sqlite_escape_string($user->FullName); - $passwd=sqlite_escape_string($user->Password); - $email=sqlite_escape_string($user->Email); - $website=sqlite_escape_string($user->Website); - $createTime=time(); - $sql="INSERT INTO tblUsers ". - "(name,full_name,role,passwd,email,reg_time,status,website) ". - "VALUES ('$name','$fullName',{$user->Role},'$passwd','$email',$createTime,{$user->Status},'$website')"; - $this->query($sql); - $user->ID=sqlite_last_insert_rowid($this->_db); - } - - public function updateUser($user) - { - $name=sqlite_escape_string($user->Name); - $fullName=sqlite_escape_string($user->FullName); - $passwd=sqlite_escape_string($user->Password); - $email=sqlite_escape_string($user->Email); - $website=sqlite_escape_string($user->Website); - $sql="UPDATE tblUsers SET - name='$name', - full_name='$fullName', - role={$user->Role}, - passwd='$passwd', - vcode='{$user->VerifyCode}', - email='$email', - status={$user->Status}, - website='$website' - WHERE id={$user->ID}"; - $this->query($sql); - } - - public function deleteUser($id) - { - $this->query("DELETE FROM tblUsers WHERE id=$id"); - } - - protected function populatePostRecord($row) - { - $postRecord=new PostRecord; - $postRecord->ID=(integer)$row['id']; - $postRecord->AuthorID=(integer)$row['author_id']; - if($row['author_full_name']!=='') - $postRecord->AuthorName=$row['author_full_name']; - else - $postRecord->AuthorName=$row['author_name']; - $postRecord->CreateTime=(integer)$row['create_time']; - $postRecord->ModifyTime=(integer)$row['modify_time']; - $postRecord->Title=$row['title']; - $postRecord->Content=$row['content']; - $postRecord->Status=(integer)$row['status']; - $postRecord->CommentCount=(integer)$row['comment_count']; - return $postRecord; - } - - public function queryPosts($postFilter,$categoryFilter,$orderBy,$limit) - { - $filter=''; - if($postFilter!=='') - $filter.=" AND $postFilter"; - if($categoryFilter!=='') - $filter.=" AND a.id IN (SELECT post_id AS id FROM tblPost2Category WHERE $categoryFilter)"; - $sql="SELECT a.id AS id, - a.author_id AS author_id, - b.name AS author_name, - b.full_name AS author_full_name, - a.create_time AS create_time, - a.modify_time AS modify_time, - a.title AS title, - a.content AS content, - a.status AS status, - a.comment_count AS comment_count - FROM tblPosts a, tblUsers b - WHERE a.author_id=b.id $filter $orderBy $limit"; - $result=$this->query($sql); - $rows=sqlite_fetch_all($result,SQLITE_ASSOC); - $posts=array(); - foreach($rows as $row) - $posts[]=$this->populatePostRecord($row); - return $posts; - } - - public function queryPostCount($postFilter,$categoryFilter) - { - $filter=''; - if($postFilter!=='') - $filter.=" AND $postFilter"; - if($categoryFilter!=='') - $filter.=" AND a.id IN (SELECT post_id AS id FROM tblPost2Category WHERE $categoryFilter)"; - $sql="SELECT COUNT(a.id) AS post_count - FROM tblPosts a, tblUsers b - WHERE a.author_id=b.id $filter"; - $result=$this->query($sql); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - return $row['post_count']; - else - return 0; - } - - public function queryPostByID($id) - { - $sql="SELECT a.id AS id, - a.author_id AS author_id, - b.name AS author_name, - b.full_name AS author_full_name, - a.create_time AS create_time, - a.modify_time AS modify_time, - a.title AS title, - a.content AS content, - a.status AS status, - a.comment_count AS comment_count - FROM tblPosts a, tblUsers b - WHERE a.id=$id AND a.author_id=b.id"; - $result=$this->query($sql); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - return $this->populatePostRecord($row); - else - return null; - } - - public function escapeString($string) - { - return sqlite_escape_string($string); - } - - public function insertPost($post,$catIDs) - { - $title=sqlite_escape_string($post->Title); - $content=sqlite_escape_string($post->Content); - $sql="INSERT INTO tblPosts - (author_id,create_time,modify_time,title,content,status) - VALUES ({$post->AuthorID},{$post->CreateTime},{$post->ModifyTime},'$title','$content',{$post->Status})"; - $this->query($sql); - $post->ID=sqlite_last_insert_rowid($this->_db); - foreach($catIDs as $catID) - $this->insertPostCategory($post->ID,$catID); - } - - public function updatePost($post,$newCatIDs=null) - { - if($newCatIDs!==null) - { - $cats=$this->queryCategoriesByPostID($post->ID); - $catIDs=array(); - foreach($cats as $cat) - $catIDs[]=$cat->ID; - $deleteIDs=array_diff($catIDs,$newCatIDs); - foreach($deleteIDs as $id) - $this->deletePostCategory($post->ID,$id); - $insertIDs=array_diff($newCatIDs,$catIDs); - foreach($insertIDs as $id) - $this->insertPostCategory($post->ID,$id); - } - - $title=sqlite_escape_string($post->Title); - $content=sqlite_escape_string($post->Content); - $sql="UPDATE tblPosts SET - modify_time={$post->ModifyTime}, - title='$title', - content='$content', - status={$post->Status} - WHERE id={$post->ID}"; - $this->query($sql); - } - - public function deletePost($id) - { - $cats=$this->queryCategoriesByPostID($id); - foreach($cats as $cat) - $this->deletePostCategory($id,$cat->ID); - $this->query("DELETE FROM tblComments WHERE post_id=$id"); - $this->query("DELETE FROM tblPosts WHERE id=$id"); - } - - protected function populateCommentRecord($row) - { - $commentRecord=new CommentRecord; - $commentRecord->ID=(integer)$row['id']; - $commentRecord->PostID=(integer)$row['post_id']; - $commentRecord->AuthorName=$row['author_name']; - $commentRecord->AuthorEmail=$row['author_email']; - $commentRecord->AuthorWebsite=$row['author_website']; - $commentRecord->AuthorIP=$row['author_ip']; - $commentRecord->CreateTime=(integer)$row['create_time']; - $commentRecord->Content=$row['content']; - $commentRecord->Status=(integer)$row['status']; - return $commentRecord; - } - - public function queryComments($filter,$orderBy,$limit) - { - if($filter!=='') - $filter='WHERE '.$filter; - $sql="SELECT * FROM tblComments $filter $orderBy $limit"; - $result=$this->query($sql); - $rows=sqlite_fetch_all($result,SQLITE_ASSOC); - $comments=array(); - foreach($rows as $row) - $comments[]=$this->populateCommentRecord($row); - return $comments; - } - - public function queryCommentsByPostID($id) - { - $sql="SELECT * FROM tblComments WHERE post_id=$id ORDER BY create_time DESC"; - $result=$this->query($sql); - $rows=sqlite_fetch_all($result,SQLITE_ASSOC); - $comments=array(); - foreach($rows as $row) - $comments[]=$this->populateCommentRecord($row); - return $comments; - } - - public function insertComment($comment) - { - $authorName=sqlite_escape_string($comment->AuthorName); - $authorEmail=sqlite_escape_string($comment->AuthorEmail); - $authorWebsite=sqlite_escape_string($comment->AuthorWebsite); - $content=sqlite_escape_string($comment->Content); - $sql="INSERT INTO tblComments - (post_id,author_name,author_email,author_website,author_ip,create_time,status,content) - VALUES ({$comment->PostID},'$authorName','$authorEmail','$authorWebsite','{$comment->AuthorIP}',{$comment->CreateTime},{$comment->Status},'$content')"; - $this->query($sql); - $comment->ID=sqlite_last_insert_rowid($this->_db); - $this->query("UPDATE tblPosts SET comment_count=comment_count+1 WHERE id={$comment->PostID}"); - } - - public function updateComment($comment) - { - $authorName=sqlite_escape_string($comment->AuthorName); - $authorEmail=sqlite_escape_string($comment->AuthorEmail); - $content=sqlite_escape_string($comment->Content); - $sql="UPDATE tblComments SET status={$comment->Status} WHERE id={$comment->ID}"; - $this->query($sql); - } - - public function deleteComment($id) - { - $result=$this->query("SELECT post_id FROM tblComments WHERE id=$id"); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - { - $postID=$row['post_id']; - $this->query("DELETE FROM tblComments WHERE id=$id"); - $this->query("UPDATE tblPosts SET comment_count=comment_count-1 WHERE id=$postID"); - } - } - - protected function populateCategoryRecord($row) - { - $catRecord=new CategoryRecord; - $catRecord->ID=(integer)$row['id']; - $catRecord->Name=$row['name']; - $catRecord->Description=$row['description']; - $catRecord->PostCount=$row['post_count']; - return $catRecord; - } - - public function queryCategories() - { - $sql="SELECT * FROM tblCategories ORDER BY name ASC"; - $result=$this->query($sql); - $rows=sqlite_fetch_all($result,SQLITE_ASSOC); - $cats=array(); - foreach($rows as $row) - $cats[]=$this->populateCategoryRecord($row); - return $cats; - } - - public function queryCategoriesByPostID($postID) - { - $sql="SELECT a.id AS id, - a.name AS name, - a.description AS description, - a.post_count AS post_count - FROM tblCategories a, tblPost2Category b - WHERE a.id=b.category_id AND b.post_id=$postID ORDER BY a.name"; - $result=$this->query($sql); - $rows=sqlite_fetch_all($result,SQLITE_ASSOC); - $cats=array(); - foreach($rows as $row) - $cats[]=$this->populateCategoryRecord($row); - return $cats; - } - - public function queryCategoryByID($id) - { - $sql="SELECT * FROM tblCategories WHERE id=$id"; - $result=$this->query($sql); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - return $this->populateCategoryRecord($row); - else - return null; - } - - public function queryCategoryByName($name) - { - $name=sqlite_escape_string($name); - $sql="SELECT * FROM tblCategories WHERE name='$name'"; - $result=$this->query($sql); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - return $this->populateCategoryRecord($row); - else - return null; - } - - public function insertCategory($category) - { - $name=sqlite_escape_string($category->Name); - $description=sqlite_escape_string($category->Description); - $sql="INSERT INTO tblCategories - (name,description) - VALUES ('$name','$description')"; - $this->query($sql); - $category->ID=sqlite_last_insert_rowid($this->_db); - } - - public function updateCategory($category) - { - $name=sqlite_escape_string($category->Name); - $description=sqlite_escape_string($category->Description); - $sql="UPDATE tblCategories SET name='$name', description='$description', post_count={$category->PostCount} WHERE id={$category->ID}"; - $this->query($sql); - } - - public function deleteCategory($id) - { - $sql="DELETE FROM tblPost2Category WHERE category_id=$id"; - $this->query($sql); - $sql="DELETE FROM tblCategories WHERE id=$id"; - $this->query($sql); - } - - public function insertPostCategory($postID,$categoryID) - { - $sql="INSERT INTO tblPost2Category (post_id, category_id) VALUES ($postID, $categoryID)"; - $this->query($sql); - $sql="UPDATE tblCategories SET post_count=post_count+1 WHERE id=$categoryID"; - $this->query($sql); - } - - public function deletePostCategory($postID,$categoryID) - { - $sql="DELETE FROM tblPost2Category WHERE post_id=$postID AND category_id=$categoryID"; - if($this->query($sql)>0) - { - $sql="UPDATE tblCategories SET post_count=post_count-1 WHERE id=$categoryID"; - $this->query($sql); - } - } - - public function queryEarliestPostTime() - { - $sql="SELECT MIN(create_time) AS create_time FROM tblPosts"; - $result=$this->query($sql); - if(($row=sqlite_fetch_array($result,SQLITE_ASSOC))!==false) - return $row['create_time']; - else - return time(); - } -} - -class UserRecord extends TActiveRecord -{ - const ROLE_USER=0; - const ROLE_ADMIN=1; - const STATUS_NORMAL=0; - const STATUS_DISABLED=1; - const STATUS_PENDING=2; - public $id; - public $name; - public $full_name; - public $role; - public $passwd; - public $vcode; - public $email; - public $reg_time; - public $status; - public $website; - - public static $_tablename='tblUsers'; //table name - - /** - * @return TActiveRecord active record finder instance - */ - public static function finder() - { - return self::getRecordFinder('UserRecord'); - } -} - -class PostRecord extends TActiveRecord -{ - const STATUS_PUBLISHED=0; - const STATUS_DRAFT=1; - const STATUS_PENDING=2; - const STATUS_STICKY=3; - public $id; - public $author_id; - public $author_name; - public $create_time; - public $modify_time; - public $title; - public $content; - public $status; - public $comment_count; - - public static $_tablename='tblPosts'; //table name - - /** - * @return TActiveRecord active record finder instance - */ - public static function finder() - { - return self::getRecordFinder('PostRecord'); - } -} - -class CommentRecord extends TActiveRecord -{ - public $id; - public $post_id; - public $author_name; - public $author_email; - public $author_website; - public $author_ip; - public $create_time; - public $status; - public $content; - - public static $_tablename='tblComments'; //table name - - /** - * @return TActiveRecord active record finder instance - */ - public static function finder() - { - return self::getRecordFinder('CommentRecord'); - } -} - -class CategoryRecord extends TActiveRecord -{ - public $id; - public $name; - public $description; - public $post_count; - - public static $_tablename='tblCategories'; //table name - - /** - * @return TActiveRecord active record finder instance - */ - public static function finder() - { - return self::getRecordFinder('CategoryRecord'); - } -} - -class Post2CategoryRecord extends TActiveRecord -{ - public $post_id; - public $category_id; - - public static $_tablename='tblPost2Category'; //table name - - /** - * @return TActiveRecord active record finder instance - */ - public static function finder() - { - return self::getRecordFinder('Post2CategoryRecord'); - } -} - -?> \ No newline at end of file diff --git a/demos/activeblog/protected/App_Modules/BlogErrorHandler.php b/demos/activeblog/protected/App_Modules/BlogErrorHandler.php deleted file mode 100644 index dc8985d8..00000000 --- a/demos/activeblog/protected/App_Modules/BlogErrorHandler.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id: BlogErrorHandler.php 1509 2006-11-25 20:51:43Z xue $ - */ - -Prado::using('System.Exceptions.TErrorHandler'); -Prado::using('Application.Common.BlogException'); - -/** - * BlogErrorHandler class - * - * @author Qiang Xue - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - */ -class BlogErrorHandler extends TErrorHandler -{ - /** - * Displays error to the client user. - * THttpException and errors happened when the application is in Debug - * mode will be displayed to the client user. - * @param integer response status code - * @param Exception exception instance - */ - protected function handleExternalError($statusCode,$exception) - { - if($exception instanceof BlogException) - { - $message=$exception->getMessage(); - Prado::log($message,TLogger::ERROR,'BlogApplication'); - $message=urldecode($this->getApplication()->getSecurityManager()->hashData($message)); - $this->Response->redirect($this->Service->constructUrl('ErrorReport',array('msg'=>$message),false)); - } - else - parent::handleExternalError($statusCode,$exception); - } -} - -?> \ No newline at end of file diff --git a/demos/activeblog/protected/App_Modules/BlogUser.php b/demos/activeblog/protected/App_Modules/BlogUser.php deleted file mode 100644 index 042ada86..00000000 --- a/demos/activeblog/protected/App_Modules/BlogUser.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id: BlogUser.php 1398 2006-09-08 19:31:03Z xue $ - */ - -Prado::using('System.Security.TUser'); - -/** - * BlogUser class - * - * @author Qiang Xue - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - */ -class BlogUser extends TUser -{ - private $_id; - - public function getID() - { - return $this->_id; - } - - public function setID($value) - { - $this->_id=$value; - } - - public function getIsAdmin() - { - return $this->isInRole('admin'); - } - - public function saveToString() - { - $a=array($this->_id,parent::saveToString()); - return serialize($a); - } - - public function loadFromString($data) - { - if(!empty($data)) - { - list($id,$str)=unserialize($data); - $this->_id=$id; - return parent::loadFromString($str); - } - else - return $this; - } -} - -?> \ No newline at end of file diff --git a/demos/activeblog/protected/App_Modules/BlogUserManager.php b/demos/activeblog/protected/App_Modules/BlogUserManager.php deleted file mode 100644 index 370966ef..00000000 --- a/demos/activeblog/protected/App_Modules/BlogUserManager.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id: BlogUserManager.php 1398 2006-09-08 19:31:03Z xue $ - */ - -Prado::using('System.Security.IUserManager'); -Prado::using('Application.Common.BlogUser'); - -/** - * BlogUserManager class - * - * @author Qiang Xue - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - */ -class BlogUserManager extends TModule implements IUserManager -{ - public function getGuestName() - { - return 'Guest'; - } - - /** - * Returns a user instance given the user name. - * @param string user name, null if it is a guest. - * @return TUser the user instance, null if the specified username is not in the user database. - */ - public function getUser($username=null) - { - if($username===null) - return new BlogUser($this); - else - { - $username=strtolower($username); - $db=$this->Application->getModule('data'); - if(($userRecord=$db->queryUserByName($username))!==null) - { - $user=new BlogUser($this); - $user->setID($userRecord->ID); - $user->setName($username); - $user->setIsGuest(false); - $user->setRoles($userRecord->Role===UserRecord::ROLE_USER?'user':'admin'); - return $user; - } - else - return null; - } - } - - /** - * Validates if the username and password are correct. - * @param string user name - * @param string password - * @return boolean true if validation is successful, false otherwise. - */ - public function validateUser($username,$password) - { - $db=$this->Application->getModule('data'); - if(($userRecord=$db->queryUserByName($username))!==null) - return $userRecord->Password===md5($password) && $userRecord->Status===UserRecord::STATUS_NORMAL; - else - return false; - } -} - -?> \ No newline at end of file diff --git a/demos/activeblog/protected/App_Modules/schema.sql b/demos/activeblog/protected/App_Modules/schema.sql deleted file mode 100644 index 9c111f0c..00000000 --- a/demos/activeblog/protected/App_Modules/schema.sql +++ /dev/null @@ -1,76 +0,0 @@ -CREATE TABLE tblUsers ( - id INTEGER NOT NULL PRIMARY KEY, - name VARCHAR(128) NOT NULL UNIQUE, - full_name VARCHAR(128) DEFAULT '', - role INTEGER NOT NULL DEFAULT 0, /* 0: user, 1: admin */ - passwd VARCHAR(128) NOT NULL, - vcode VARCHAR(128) DEFAULT '', - email VARCHAR(128) NOT NULL, - reg_time INTEGER NOT NULL, - status INTEGER NOT NULL DEFAULT 0, /* 0: normal, 1: disabled, 2: pending approval */ - website VARCHAR(128) DEFAULT '' -); - -CREATE TABLE tblPosts ( - id INTEGER NOT NULL PRIMARY KEY, - author_id INTEGER NOT NULL, - create_time INTEGER NOT NULL, - modify_time INTEGER DEFAULT 0, - title VARCHAR(256) NOT NULL, - content TEXT NOT NULL, - status INTEGER NOT NULL DEFAULT 0, /* 0: published, 1: draft, 2: pending approval */ - comment_count INTEGER NOT NULL DEFAULT 0 -); - -CREATE TABLE tblComments ( - id INTEGER NOT NULL PRIMARY KEY, - post_id INTEGER NOT NULL, - author_name VARCHAR(64) NOT NULL, - author_email VARCHAR(128) NOT NULL, - author_website VARCHAR(128) DEFAULT '', - author_ip CHAR(16) NOT NULL, - create_time INTEGER NOT NULL, - status INTEGER NOT NULL DEFAULT 0, /* 0: published, 1: pending approval */ - content TEXT NOT NULL -); - -CREATE TABLE tblCategories ( - id INTEGER NOT NULL PRIMARY KEY, - name VARCHAR(128) NOT NULL UNIQUE, - description TEXT DEFAULT '', - post_count INTEGER NOT NULL DEFAULT 0 -); - -CREATE TABLE tblAttachments ( - id VARCHAR(128) NOT NULL PRIMARY KEY, - post_id INTEGER NOT NULL, - create_time INTEGER NOT NULL, - file_name VARCHAR(128) NOT NULL, - file_size INTEGER NOT NULL, - mime_type VARCHAR(32) NOT NULL DEFAULT 'text/html', - download_count INTEGER NOT NULL DEFAULT 0 -); - -CREATE TABLE tblPost2Category ( - post_id INTEGER NOT NULL, - category_id INTEGER NOT NULL, - PRIMARY KEY (post_id, category_id) -); - -INSERT INTO tblUsers (id,name,full_name,role,status,passwd,email,reg_time,website) - VALUES (1,'admin','Prado User',1,0,'4d688da592969d0a56b5accec3ce8554','admin@example.com',1148819681,'http://www.pradosoft.com'); - -INSERT INTO tblPosts (id,author_id,create_time,title,content,status) - VALUES (1,1,1148819691,'Welcome to Prado Weblog','Congratulations! You have successfully installed Prado Blog -- a PRADO-driven weblog system. A default administrator account has been created. Please login with admin/prado and update your password as soon as possible.',0); - -INSERT INTO tblCategories (name,description,post_count) - VALUES ('Miscellaneous','This category holds posts on any topic.',1); - -INSERT INTO tblCategories (name,description,post_count) - VALUES ('PRADO','Topics related with the PRADO framework.',0); - -INSERT INTO tblCategories (name,description,post_count) - VALUES ('PHP','Topics related with PHP.',0); - -INSERT INTO tblPost2Category (post_id,category_id) - VALUES (1,1); diff --git a/demos/activeblog/protected/App_Pages/Home.page b/demos/activeblog/protected/App_Pages/Home.page deleted file mode 100644 index a750c44c..00000000 --- a/demos/activeblog/protected/App_Pages/Home.page +++ /dev/null @@ -1,11 +0,0 @@ - -

Welcome to Prado!

- -
    -
  • Login Module
  • -
  • Search Module
  • -
  • Rss Feed Service
  • -
  • Active Controls
  • -
  • Active Record interface
  • -
-
\ No newline at end of file diff --git a/demos/activeblog/protected/App_Pages/Home.php b/demos/activeblog/protected/App_Pages/Home.php deleted file mode 100644 index 0012e073..00000000 --- a/demos/activeblog/protected/App_Pages/Home.php +++ /dev/null @@ -1,27 +0,0 @@ -findByPk(1); - // echo TVarDumper::dump($user,10,true); - // - // $finder = PostRecord::finder(); - // $post = $finder->findByPk(1); - // echo TVarDumper::dump($post,10,true); - // - // $finder = CategoryRecord::finder(); - // $categories = $finder->findAll(); - // echo TVarDumper::dump($categories,10,true); - // - // $finder = Post2CategoryRecord::finder(); - // $post2category = $finder->findByPk(1,1); - // echo TVarDumper::dump($post2category,10,true); - } -} -?> \ No newline at end of file diff --git a/demos/activeblog/protected/application.xml b/demos/activeblog/protected/application.xml deleted file mode 100644 index ce3906d5..00000000 --- a/demos/activeblog/protected/application.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demos/activeblog/protected/urlmaps.xml b/demos/activeblog/protected/urlmaps.xml deleted file mode 100644 index e0352e88..00000000 --- a/demos/activeblog/protected/urlmaps.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/demos/activeblog/themes/Default/style.css b/demos/activeblog/themes/Default/style.css deleted file mode 100644 index be98cb9a..00000000 --- a/demos/activeblog/themes/Default/style.css +++ /dev/null @@ -1,18 +0,0 @@ -html,body{margin:0;padding:0} -body{font: 76% arial,sans-serif;text-align:center} -p{margin:0 10px 10px} -a{display:block;color: #981793;padding:10px} -div.header h1{height:80px;line-height:80px;margin:0; - padding-left:10px;background: #EEE;color: #79B30B} -div.container{text-align:left} -div.content p{line-height:1.4} -div.navigation{background:#B9CAFF} -div.extra{background:#FF8539} -div.footer{background: #333;color: #FFF} -div.footer p{margin:0;padding:5px 10px} - -div.container{width:700px;margin:0 auto} -div.content{float:left;width:500px} -div.navigation{float:right;width:200px} -div.extra{float:right;clear:right;width:200px} -div.footer{clear:both;width:100%} \ No newline at end of file diff --git a/demos/providers/index.php b/demos/providers/index.php deleted file mode 100644 index 59c29c50..00000000 --- a/demos/providers/index.php +++ /dev/null @@ -1,20 +0,0 @@ -run(); - -?> \ No newline at end of file diff --git a/demos/providers/protected/.htaccess b/demos/providers/protected/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/demos/providers/protected/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/demos/providers/protected/application.xml b/demos/providers/protected/application.xml deleted file mode 100644 index 4763b2a6..00000000 --- a/demos/providers/protected/application.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demos/providers/protected/pages/Home.page b/demos/providers/protected/pages/Home.page deleted file mode 100644 index 5fb47aa3..00000000 --- a/demos/providers/protected/pages/Home.page +++ /dev/null @@ -1,55 +0,0 @@ -

Provider Demo

- -
-Vertical - TextOnLeft - - -
- -
-Vertical - TextOnTop - - -
- -
-Horizontal - TextOnLeft - - -
- -
-Horizontal - TextOnTop - - -
- -
\ No newline at end of file diff --git a/demos/providers/protected/pages/Home.php b/demos/providers/protected/pages/Home.php deleted file mode 100644 index 0c6320e4..00000000 --- a/demos/providers/protected/pages/Home.php +++ /dev/null @@ -1,27 +0,0 @@ -Application->getModule('MembershipProvider')->getProvider('SqlMembershipProvider'); - - - /* @VAR $MembershipProvider TSqlMembershipProvider */ - // $MembershipProvider = $this->Application->getModule('MembershipProvider')->Provider; - // echo TVarDumper::dump($MembershipProvider,10,true); - - /* @VAR $RoleProvider TSqlRoleProvider */ - // $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/Configuration/Provider/TProviderBase.php b/framework/Configuration/Provider/TProviderBase.php deleted file mode 100644 index 7c5ffbb8..00000000 --- a/framework/Configuration/Provider/TProviderBase.php +++ /dev/null @@ -1,118 +0,0 @@ - - * @version $Id: TProviderBase.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Configuration.Provider - * @since 3.1 - */ -abstract class TProviderBase extends TModule -{ - private $_description; - private $_initialized = false; - private $_name; - private $_applicationName; - private $_enabled=false; - - public function __construct(){} - - public function getDescription() - { - return $this->_description; - } - public function setDescription($value) - { - $this->_description = TPropertyValue::ensureString($value); - } - public function getName() - { - return $this->_name; - } - public function getApplicationName() - { - return $this->_applicationName; - } - public function setApplicationName($value) - { - $this->_applicationName = TPropertyValue::ensureString($value); - } - public function getEnabled() - { - return $this->_enabled; - } - public function setEnabled($value) - { - $this->_enabled = TPropertyValue::ensureBoolean($value); - } - public function initialize($name,$config) - { - if ($this->_initialized) - { - throw new TProviderException('Provider_Already_Initialized'); - } - $this->_initialized=true; - - if ($name === null) - { - throw new TProviderException('name'); - } - - if (strlen($name) == 0) - { - throw new TProviderException('Config_provider_name_null_or_empty'); - } - - $this->_name = TPropertyValue::ensureString($name); - - if ($config !== null && is_array($config)) - { - $this->_description = TPropertyValue::ensureString($config['description']); - unset($config['description']); - } - } - /** - * Generates a Universally Unique IDentifier, version 4. - * - * RFC 4122 (http://www.ietf.org/rfc/rfc4122.txt) defines a special type of Globally - * Unique IDentifiers (GUID), as well as several methods for producing them. One - * such method, described in section 4.4, is based on truly random or pseudo-random - * number generators, and is therefore implementable in a language like PHP. - * - * We choose to produce pseudo-random numbers with the Mersenne Twister, and to always - * limit single generated numbers to 16 bits (ie. the decimal value 65535). That is - * because, even on 32-bit systems, PHP's RAND_MAX will often be the maximum *signed* - * value, with only the equivalent of 31 significant bits. Producing two 16-bit random - * numbers to make up a 32-bit one is less efficient, but guarantees that all 32 bits - * are random. - * - * The algorithm for version 4 UUIDs (ie. those based on random number generators) - * states that all 128 bits separated into the various fields (32 bits, 16 bits, 16 bits, - * 8 bits and 8 bits, 48 bits) should be random, except : (a) the version number should - * be the last 4 bits in the 3rd field, and (b) bits 6 and 7 of the 4th field should - * be 01. We try to conform to that definition as efficiently as possible, generating - * smaller values where possible, and minimizing the number of base conversions. - * - * @copyright Copyright (c) CFD Labs, 2006. This function may be used freely for - * any purpose ; it is distributed without any form of warranty whatsoever. - * @author David Holmes - * - * @return string A UUID, made up of 32 hex digits and 4 hyphens. - */ - public function generateUuid() - { - // The field names refer to RFC 4122 section 4.1.2 - return sprintf('%04x%04x-%04x-%03x4-%04x-%04x%04x%04x', - mt_rand(0, 65535), mt_rand(0, 65535), // 32 bits for "time_low" - mt_rand(0, 65535), // 16 bits for "time_mid" - mt_rand(0, 4095), // 12 bits before the 0100 of (version) 4 for "time_hi_and_version" - bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '01', 6, 2)), - // 8 bits, the last two of which (positions 6 and 7) are 01, for "clk_seq_hi_res" - // (hence, the 2nd hex digit after the 3rd hyphen can only be 1, 5, 9 or d) - // 8 bits for "clk_seq_low" - mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535) // 48 bits for "node" - ); - } -} -?> \ No newline at end of file diff --git a/framework/Configuration/Provider/TProviderException.php b/framework/Configuration/Provider/TProviderException.php deleted file mode 100644 index ac2caf08..00000000 --- a/framework/Configuration/Provider/TProviderException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @version $Id: TProviderException.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Configuration.Provider - * @since 3.1 - */ - -Prado::using('System.Exceptions.TException'); -class TProviderException extends TException -{ - -} -?> \ No newline at end of file diff --git a/framework/Configuration/TProtectedConfiguration.php b/framework/Configuration/TProtectedConfiguration.php deleted file mode 100644 index da643014..00000000 --- a/framework/Configuration/TProtectedConfiguration.php +++ /dev/null @@ -1,84 +0,0 @@ - - * @version $Id: TProtectedConfiguration.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Configuration - * @since 3.1 - */ -final class TProtectedConfiguration extends TModule -{ - private $_defaultProvider; - /** - * @var array list of providers available - */ - private $_providers=array(); - /** - * @var string external configuration file - */ - private $_configFile=null; - - public function getDefaultProvider() - { - return $this->_defaultProvider; - } - public function setDefaultProvider($value) - { - $this->_defaultProvider = TPropertyValue::ensureString($value); - } - public function getProvider($value=null) - { - if ($value) - $index = $value; - else - $index = $this->_defaultProvider; - - $provider = $this->_providers[$index]; - - if (!$provider instanceof TProviderBase) - throw new TConfigurationException('protectedconfiguration_not_a_provider',$index); - - return $provider; - } - - public function init($config) - { - if($this->_configFile!==null) - { - if(is_file($this->_configFile)) - { - $dom=new TXmlDocument; - $dom->loadFromFile($this->_configFile); - $this->loadConfig($dom); - } - else - throw new TConfigurationException('protectedconfiguration_configfile_invalid',$this->_configFile); - } - $this->loadConfig($config); -// $this->getApplication()->attachEventHandler('OnEndRequest',array($this,'collectLogs')); - } - /** - * Loads configuration from an XML element - * @param TXmlElement configuration node - * @throws TConfigurationException if log route class or type is not specified - */ - private function loadConfig($xml) - { - foreach($xml->getElementsByTagName('provider') as $providerConfig) - { - $properties=$providerConfig->getAttributes(); - if(($class=$properties->remove('class'))===null) - throw new TConfigurationException('protectedconfiguration_providerclass_required'); - $provider=Prado::createComponent($class); - if(!($provider instanceof TProviderBase)) - throw new TConfigurationException('protectedconfiguration_providertype_invalid'); - foreach($properties as $name=>$value) - $provider->setSubproperty($name,$value); - $this->_providers[$provider->getId()]=$provider; - $provider->init($providerConfig); - } - } -} -?> \ No newline at end of file diff --git a/framework/Web/Security/Principal/IIdentity.php b/framework/Web/Security/Principal/IIdentity.php deleted file mode 100644 index 89bc0f70..00000000 --- a/framework/Web/Security/Principal/IIdentity.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @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 deleted file mode 100644 index 9503387a..00000000 --- a/framework/Web/Security/Principal/IPrincipal.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @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 deleted file mode 100644 index 037ebc42..00000000 --- a/framework/Web/Security/Principal/TGenericIdentity.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @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 deleted file mode 100644 index 8e07388e..00000000 --- a/framework/Web/Security/Principal/TGenericPrincipal.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @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/TAnonymousIdentificationModule.php b/framework/Web/Security/TAnonymousIdentificationModule.php deleted file mode 100644 index 1735edf1..00000000 --- a/framework/Web/Security/TAnonymousIdentificationModule.php +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/framework/Web/Security/TAuthorizationStoreRoleProvider.php b/framework/Web/Security/TAuthorizationStoreRoleProvider.php deleted file mode 100644 index d6919ae6..00000000 --- a/framework/Web/Security/TAuthorizationStoreRoleProvider.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @version $Id: TAuthorizationStoreRoleProvider.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -Prado::using('System.Web.Security.TRoleProvider'); -class TAuthorizationStoreRoleProvider extends TRoleProvider -{ - private $_ApplicationName; - public function __construct() - { - - } - public function getApplicationName() - { - return $this->_ApplicationName; - } - public function setApplicationName($value) - { - $this->_ApplicationName = TPropertyValue::ensureString($value); - } - public function AddUsersToRoles($usernames,$roleNames) - { - - } - public function CreateRole($roleName) - { - - } - public function DeleteRole($roleName) - { - - } - public function FineUsersInRole($roleName,$usernameToMatch) - { - - } - public function GetAllRoles() - { - - } - public function GetRolesForUser($username) - { - - } - public function GetUsersIsRole($username,$roleName) - { - - } - public function IsUserIsRole($username,$roleName) - { - - } - public function RemoveUsersFromRoles($usernames,$roleNames) - { - - } - public function RoleExists($roleName) - { - - } -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TCookieProtection.php b/framework/Web/Security/TCookieProtection.php deleted file mode 100644 index 2a757898..00000000 --- a/framework/Web/Security/TCookieProtection.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @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 deleted file mode 100644 index 03d6e758..00000000 --- a/framework/Web/Security/TDefaultAuthenticationModule.php +++ /dev/null @@ -1,15 +0,0 @@ - - * @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 deleted file mode 100644 index 970303a7..00000000 --- a/framework/Web/Security/TFormsAuthentication.php +++ /dev/null @@ -1,176 +0,0 @@ - - * @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 function Authenticate($name, $password) - { - - } - public static function Decrypt($encryptedTicket) - { - - } - public static function Encrypt($ticket, $hexEncodedTicket=null) - { - - } - public static function GetAuthCookie( $userName, $createPersistentCookie, $strCookiePath=null, $hexEncodedTicket=null) - { - - } - public static function GetLoginPage($extraQuery,$reuseReturnUrl=null) - { - - } - public static function GetRedirectUrl( $userName, $createPersistentCookie) - { - - } - public static function GetReturnUrl($useDefaultIfAbsent) - { - - } - public static function HashPasswordForStoringInConfigFile($password, $passwordFormat) - { - - } - public static function Initialize() - { - - } - private static function ernalAuthenticate( $name, $password) - { - - } - private static function IsPathWithinAppRoot($context, $path) - { - - } - private static function MakeTicketoBinaryBlob($ticket) - { - - } - public static function RedirectFromLoginPage($userName, $createPersistentCookie, $strCookiePath=null) - { - - } - public static function RedirectToLoginPage($extraQuery=null) - { - - } - private static function RemoveQSVar($ref, $strUrl, $posQ, $token, $sep, $lenAtStartToLeave) - { - - } - public static function RemoveQueryVariableFromUrl( $strUrl, $QSVar) - { - - } - public static function RenewTicketIfOld($tOld) - { - - } - public static function SetAuthCookie( $userName, $createPersistentCookie, $strCookiePath=null) - { - - } - public static function SignOut() - { - - } - - // Properties - public static function getCookieDomain() - { - return self::$_cookieDomain; - } - public static function getCookieMode() - { - return self::$_cookieMode; - } - public static function getCookiesSupported() - { - return self::$_cookiesSupported; - } - public static function getDefaultUrl() - { - return self::$_defaultUrl; - } - public static function getEnableCrossAppRedirects() - { - return self::$_enableCrossAppRedirects; - } - public static function getFormsCookieName() - { - return self::$_formsCookieName; - } - public static function getFormsCookiePath() - { - return self::$_formsCookiePath; - } - public static function getLoginUrl() - { - return self::$_loginUrl; - } - public static function getRequireSSL() - { - return self::$_requireSSL; - } - public static function getSlidingExpiration() - { - return self::$_slidingExpiration; - } - - // Fields - // private static $_CookieDomain; - // private static $_CookieMode; - // private static $_DefaultUrl; - // private static $_EnableCrossAppRedirects; - // private static $_FormsCookiePath; - // private static $_FormsName; - // private static $_Initialized; - // private static $_lockObject; - // private static $_LoginUrl; - // private static $_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 deleted file mode 100644 index df0d5300..00000000 --- a/framework/Web/Security/TFormsAuthenticationModule.php +++ /dev/null @@ -1,126 +0,0 @@ - - * @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 deleted file mode 100644 index e53b68b2..00000000 --- a/framework/Web/Security/TFormsAuthenticationTicket.php +++ /dev/null @@ -1,124 +0,0 @@ - - * @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 deleted file mode 100644 index f4d00f82..00000000 --- a/framework/Web/Security/TFormsIdentity.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @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/TMembership.php b/framework/Web/Security/TMembership.php deleted file mode 100644 index e68a0a6a..00000000 --- a/framework/Web/Security/TMembership.php +++ /dev/null @@ -1,208 +0,0 @@ - - * @version $Id: TMembership.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -final class TMembership -{ - private static $_applicationName; - private static $_enablePasswordReset=false; - private static $_enablePasswordRetrieval=false; - private static $_hashAlgorithmType; - private static $_isHashAlgorithmFromMembershipConfig=false; - private static $_maxInvalidPasswordAttempts; - private static $_minRequiredNonAlphanumericCharacters; - private static $_minRequiredPasswordLength; - private static $_passwordAttemptWindow; - private static $_passwordStrengthReqularExpression; - private static $_provider; - private static $_providers; - private static $_requiresQuestionAndAnswer=false; - private static $_userIsOnlineTimeWindow=15; - private static $_punctuations='!@#$%^&*()_-+=[{]};:>./?'; - private static $_hashAlgorithmFromConfig=false; - private static $_initialized=false; - private static $_initializeException; - - public static function getApplicationName() - { - return self::$_applicationName; - } - public static function setApplicationName($value) - { - self::$_applicationName = TPropertyValue::ensureString($value); - } - public static function getEnablePasswordReset() - { - return self::$_enablePasswordReset; - } - public static function getEnablePasswordRetrieval() - { - return self::$_enablePasswordRetrieval; - } - public static function getHashAlgorithmType() - { - return self::$_hashAlgorithmType; - } - public static function getHashAlgorithmFromMembershipConfig() - { - return self::$_isHashAlgorithmFromMembershipConfig; - } - public static function getMaxInvalidPasswordAttempts() - { - return self::$_maxInvalidPasswordAttempts; - } - public static function getMinRequiredNonAlphanumericCharacters() - { - return self::$_minRequiredNonAlphanumericCharacters; - } - public static function getMinRequiredPasswordLength() - { - return self::$_minRequiredPasswordLength; - } - public static function getPasswordAttemptWindow() - { - return self::$_passwordAttemptWindow; - } - public static function getPasswordStrengthReqularExpression() - { - return self::$_passwordStrengthReqularExpression; - } - public static function getProvider() - { - self::initialize(); - return self::$_provider; - } - public static function getProviders($providerName) - { - self::initialize(); - return self::$_providers[$providerName]; - } - public static function getUserIsOnlineTimeWindow() - { - return self::$_userIsOnlineTimeWindow; - } - public static function createUser($username,$password,$email=null,$passwordQuestion=null,$passwordAnswer=null,$isApproved=null,$providerUserKey=null) - { - return self::$_provider->createUser($username,$password,$email,$passwordQuestion,$passwordAnswer,$isApproved,$providerUserKey); - } - public static function deleteUser($username,$deleteAllRelatedData=true) - { - return self::$_provider->deleteUser($username,$deleteAllRelatedData); - } - public static function findUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null) - { - if ($pageIndex < 0 && $pageIndex!==null) - { - throw new TException('PageIndex_bad',$pageIndex); - } - if ($pageSize > 1 && $pageSize!==null) - { - throw new TException('PageSize_bad',$pageSize); - } - return self::$_provider->findUsersByEmail($emailToMatch,$pageIndex,$pageSize); - } - public static function findUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null) - { - if ($pageIndex < 0 && $pageIndex!==null) - { - throw new TException('PageIndex_bad',$pageIndex); - } - if ($pageSize > 1 && $pageSize!==null) - { - throw new TException('PageSize_bad',$pageSize); - } - return self::$_provider->findUsersByName($usernameToMatch,$pageIndex,$pageSize); - } - public static function generatePassword($length,$numberOfNonAlphanumericCharacters) - { - if (($length < 1) || ($length > 0x80)) - { - throw new TException('Membership_password_length_incorrect'); - } - if (($numberOfNonAlphanumericCharacters > $length) || ($numberOfNonAlphanumericCharacters < 0)) - { - throw new TException('Membership_min_required_non_alphanumeric_characters_incorrect',$numberOfNonAlphanumericCharacters); - } - //need to do the alpha checking in here - // $num1=0; - // $buffer1=null; - // $chArray1; - // $num2=0; - // for ($num3 = 0;$num3 < $length; $num3++) - // { - // $num4 = $buffer[$num3]; - // } - } - public static function getAllUsers($pageIndex=null,$pageSize=null) - { - if ($pageIndex < 0 && $pageIndex!==null) - { - throw new TException('PageIndex_bad',$pageIndex); - } - if ($pageSize > 1 && $pageSize!==null) - { - throw new TException('PageSize_bad',$pageSize); - } - return self::$_provider->getAllUsers($pageIndex,$pageSize); - } - private static function getCurrentUserName() - { - //how to get the current username? - } - public static function getNumberOfUsersOnline() - { - return self::$_provider->getNumberOfUsersOnline(); - } - public static function getUser($username=null,$providerUserKey=null,$userIsOnline=false) - { - if ($username===null && $providerUserKey===null) - { - return self::$_provider->getUser(self::GetCurrentUserName(),null,true); - } - if ($username===null && $providerUserKey!==null) - { - return self::$_provider->getUser(null,$providerUserKey,$userIsOnline); - } - if ($username!==null && $providerUserKey===null) - { - return self::$_provider->getUser($username,null,$userIsOnline); - } - } - public static function getUserNameByEmail($emailToMatch) - { - return self::$_provider->getUserNameByEmail($emailToMatch); - } - private static function initialize() - { - if (self::$_initialized) - { - if (self::$_initializeException!==null) - { - throw new self::$_initializeException; - } - } - else - { - - } - } - public static function updateUser(TMembershipUser $user) - { - if ($user===null) - { - throw new TException('Membership_user_can_not_be_null'); - } - $user->update(); - } - public static function validateUser($username,$password) - { - return self::$_provider->validateUser($username,$password); - } -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TMembershipCreateStatus.php b/framework/Web/Security/TMembershipCreateStatus.php deleted file mode 100644 index 78b64de4..00000000 --- a/framework/Web/Security/TMembershipCreateStatus.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @version $Id: TMembershipCreateStatus.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -class TMembershipCreateStatus extends TEnumerable -{ - const DuplicateEmail='DuplicateEmail'; - const DuplicateProviderUserKey='DuplicateProviderUserKey'; - const DuplicateUserName='DuplicateUserName'; - const InvalidAnswer='InvalidAnswer'; - const InvalidEmail='InvalidEmail'; - const InvalidPassword='InvalidPassword'; - const InvalidProviderUserKey='InvalidProviderUserKey'; - const InvalidQuestion='InvalidQuestion'; - const InvalidUserName='InvalidUserName'; - const ProviderError='ProviderError'; - const Success='Success'; - const UserRejected='UserRejected'; -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TMembershipCreateUserException.php b/framework/Web/Security/TMembershipCreateUserException.php deleted file mode 100644 index def74c8d..00000000 --- a/framework/Web/Security/TMembershipCreateUserException.php +++ /dev/null @@ -1,17 +0,0 @@ - - * @version $Id: TMembershipCreateUserException.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Configuration.Provider - * @since 3.1 - */ - -Prado::using('System.Exceptions.TException'); -class TMembershipCreateUserException extends TException -{ - -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TMembershipPasswordException.php b/framework/Web/Security/TMembershipPasswordException.php deleted file mode 100644 index faf0c599..00000000 --- a/framework/Web/Security/TMembershipPasswordException.php +++ /dev/null @@ -1,17 +0,0 @@ - - * @version $Id: TMembershipPasswordException.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Configuration.Provider - * @since 3.1 - */ - -Prado::using('System.Exceptions.TException'); -class TMembershipPasswordException extends TException -{ - -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TMembershipPasswordFormat.php b/framework/Web/Security/TMembershipPasswordFormat.php deleted file mode 100644 index fdff0e39..00000000 --- a/framework/Web/Security/TMembershipPasswordFormat.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @version $Id: TMembershipPasswordFormat.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -class TMembershipPasswordFormat extends TEnumerable -{ - const Clear='Clear'; - const Encrypted='Encrypted'; - const Hashed='Hashed'; -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TMembershipProvider.php b/framework/Web/Security/TMembershipProvider.php deleted file mode 100644 index 446d59d9..00000000 --- a/framework/Web/Security/TMembershipProvider.php +++ /dev/null @@ -1,178 +0,0 @@ - - * @version $Id: TMembershipProvider.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -Prado::using('System.Configuration.Provider.TProviderBase'); -abstract class TMembershipProvider extends TProviderBase -{ - private $_applicationName; - private $_enablePasswordReset=false; - private $_enablePasswordRetrieval=false; - private $_maxInvalidPasswordAttempts; - private $_minRequiredNonAlphanumericCharacters; - private $_minRequiredPasswordLength; - private $_passwordAttemptWindow; - private $_passwordStrengthRegularExpression; - private $_requiresQuestionAndAnswer=false; - private $_requiresUniqueEmail=false; - /** - * @var string external configuration file - */ - private $_configFile=null; - - public function getEnablePasswordReset() - { - return $this->_enablePasswordReset; - } - public function setEnablePasswordReset($value) - { - $this->_enablePasswordReset = TPropertyValue::ensureBoolean($value); - } - public function getEnablePasswordRetrieval() - { - return $this->_enablePasswordRetrieval; - } - public function setEnablePasswordRetrieval($value) - { - $this->_enablePasswordRetrieval = TPropertyValue::ensureBoolean($value); - } - public function getMaxInvalidPasswordAttempts() - { - return $this->_maxInvalidPasswordAttempts; - } - public function setMaxInvalidPasswordAttempts($value) - { - $this->_maxInvalidPasswordAttempts = TPropertyValue::ensureInteger($value); - } - public function getMinRequiredNonAlphanumericCharacters() - { - return $this->_minRequiredNonAlphanumericCharacters; - } - public function setMinRequiredNonAlphanumericCharacters($value) - { - $this->_minRequiredNonAlphanumericCharacters = TPropertyValue::ensureInteger($value); - } - public function getMinRequiredPasswordLength() - { - return $this->_minRequiredPasswordLength; - } - public function setMinRequiredPasswordLength($value) - { - $this->_minRequiredPasswordLength = TPropertyValue::ensureInteger($value); - } - public function getPasswordAttemptWindow() - { - return $this->_passwordAttemptWindow; - } - public function setPasswordAttemptWindow($value) - { - $this->_passwordAttemptWindow = TPropertyValue::ensureInteger($value); - } - public function getPasswordStrengthRegularExpression() - { - return $this->_passwordStrengthRegularExpression; - } - public function setPasswordStrengthRegularExpression($value) - { - $this->_passwordStrengthRegularExpression = TPropertyValue::ensureString($value); - } - public function getRequiresQuestionAndAnswer() - { - return $this->_requiresQuestionAndAnswer; - } - public function setRequiresQuestionAndAnswer($value) - { - $this->_requiresQuestionAndAnswer = TPropertyValue::ensureString($value); - } - public function getRequiresUniqueEmail() - { - return $this->_requiresUniqueEmail; - } - public function setRequiresUniqueEmail($value) - { - $this->_requiresUniqueEmail = TPropertyValue::ensureBoolean($value); - } - - public function __construct() - { - - } - public function init($config) - { - if($this->_configFile!==null) - { - if(is_file($this->_configFile)) - { - $dom=new TXmlDocument; - $dom->loadFromFile($this->_configFile); - $this->loadConfig($dom); - } - else - throw new TConfigurationException('membershipprovider_configfile_invalid',$this->_configFile); - } - $this->loadConfig($config); - } - /** - * Loads configuration from an XML element - * @param TXmlElement configuration node - * @throws TConfigurationException if log route class or type is not specified - */ - private function loadConfig($xml) - { - foreach($xml->getElementsByTagName('provider') as $providerConfig) - { - $properties=$providerConfig->getAttributes(); - if(($class=$properties->remove('class'))===null) - throw new TConfigurationException('membershipprovider_routeclass_required'); - $provider=Prado::createComponent($class); - if(!($provider instanceof TMembershipProvider)) - throw new TConfigurationException('membershipprovider_routetype_invalid'); - foreach($properties as $name=>$value) - $provider->setSubproperty($name,$value); - $this->_providers[]=$provider; - $provider->init($providerConfig); - } - } - public abstract function changePassword($username,$oldPassword,$newPassword); - public abstract function changePasswordQuestionAndAnswer($username,$password,$newPasswordQuestion,$newPasswordAnswer); - public abstract function createUser($username,$password,$email,$passwordQuestion,$passwordAnswer,$isApproved,$providerUserKey); - protected function decryptPassword($encodedPassword) - { - - } - public abstract function deleteUser($username,$deleteAllRelatedData); - public function encodePassword($pass,$passwordFormat,$salt) - { - - } - protected function encryptPassword($password) - { - - } - public abstract function findUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null); - public abstract function findUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null); - public function generateSalt() - { - - } - public abstract function getAllUsers($pageIndex=null,$pageSize=null); - public abstract function getNumberOfUsersOnline(); - public abstract function getPassword($username,$answer); - public abstract function getMembershipUser($username=null,$providerUserKey=null,$userIsOnline=false); - public abstract function getUserNameByEmail($email); - public abstract function resetPassword($username,$answer); - public function unEncodePassword($pass,$passwordFormat) - { - - } - public abstract function unlockUser($userName); - public abstract function updateUser(TMembershipUser $user); - public abstract function validateUser($username,$password); -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TMembershipUser.php b/framework/Web/Security/TMembershipUser.php deleted file mode 100644 index ad7b9f78..00000000 --- a/framework/Web/Security/TMembershipUser.php +++ /dev/null @@ -1,165 +0,0 @@ - - * @version $Id: TMembershipUser.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -Prado::using('System.Web.Security.TProviderException'); -Prado::using('System.Web.Security.TMembership'); -class TMembershipUser -{ - private $_comment; - private $_creationDate; - private $_email; - private $_isApproved=false; - private $_isLockedOut=false; - private $_isOnline=false; - private $_lastActivityDate; - private $_lastLockoutDate; - private $_lastLoginDate; - private $_lastPasswordChangedDate; - private $_passwordQuestion; - private $_providerName; - private $_providerUserKey; - private $_userName; - - public function __construct($providerName=null,$name=null,$providerUserKey=null,$email=null,$passwordQuestion=null,$comment=null,$isApproved=null,$isLockedOut=null,$creationDate=null,$lastLoginDate=null,$lastActivityDate=null,$lastPasswordChangedDate=null,$lastLockoutDate=null) - { - if (($providerName===null) || (TMembership::getProviders($providerName)===null)) - { - throw new TProviderException('Membership_provider_name_invalid',$providerName); - } - if ($name!==null) - { - $name = trim($name); - } - if ($email!==null) - { - $email = trim($email); - } - if ($passwordQuestion!==null) - { - $passwordQuestion = trim($passwordQuestion); - } - $this->_providerName = $providerName; - $this->_userName = $name; - $this->_providerUserKey = $providerUserKey; - $this->_email = $email; - $this->_passwordQuestion = $passwordQuestion; - $this->_comment = $comment; - $this->_isApproved = $isApproved; - $this->_isLockedOut = $isLockedOut; - $this->_creationDate = $creationDate; - $this->_lastLoginDate = $lastLoginDate; - $this->_lastActivityDate = $lastActivityDate; - $this->_lastPasswordChangedDate = $lastPasswordChangedDate; - $this->_lastLockoutDate = $lastLockoutDate; - } - public function getComment() - { - return $this->_comment; - } - public function setApplicationName($value) - { - $this->_comment = TPropertyValue::ensureString($value); - } - public function getCreationDate() - { - return $this->_creationDate; - } - public function getEmail() - { - return $this->_email; - } - public function setEmail($value) - { - $this->_email = TPropertyValue::ensureString($value); - } - public function getIsApproved() - { - return $this->_isApproved; - } - public function setIsApproved($value) - { - $this->_isApproved = TPropertyValue::ensureBoolean($value); - } - public function getIsLockedOut() - { - return $this->_isLockedOut; - } - public function getIsOnline() - { - return $this->_isOnline; - } - public function getLastActivityDate() - { - return $this->_lastActivityDate; - } - public function setLastActivityDate($value) - { - $this->_lastActivityDate = TPropertyValue::ensureString($value); - } - public function getLastLockoutDate() - { - return $this->_lastLockoutDate; - } - public function getLastLoginDate() - { - return $this->_lastLoginDate; - } - public function setLastLoginDate($value) - { - $this->_lastLoginDate = TPropertyValue::ensureString($value); - } - public function getLastPasswordChangedDate() - { - return $this->_lastPasswordChangedDate; - } - public function getPasswordQuestion() - { - return $this->_passwordQuestion; - } - public function getProviderUserKey() - { - return $this->_providerUserKey; - } - public function getUserName() - { - return $this->_userName; - } - public function changePassword($oldPassword,$newPassword,$throwOnError=null) - { - - } - public function getPassword() - { - // $throwOnError; - // $passwordAnswer; - // $answer; - // $answer,$useAnswer,$throwOnError; - } - public function resetPassword() - { - // $throwOnError; - // $passwordAnswer; - // $answer; - // $answer,$useAnswer,$throwOnError; - } - public function unlockUser() - { - - } - public function update() - { - - } - private function updateSelf() - { - - } -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TProviderException.php b/framework/Web/Security/TProviderException.php deleted file mode 100644 index 7239585c..00000000 --- a/framework/Web/Security/TProviderException.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/framework/Web/Security/TRoleManagerModule.php b/framework/Web/Security/TRoleManagerModule.php deleted file mode 100644 index 79c6b7a5..00000000 --- a/framework/Web/Security/TRoleManagerModule.php +++ /dev/null @@ -1,15 +0,0 @@ - - * @version $Id: TRoleManagerModule.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -final class TRoleManagerModule extends TModule -{ - -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TRolePrincipal.php b/framework/Web/Security/TRolePrincipal.php deleted file mode 100644 index 682f2cbe..00000000 --- a/framework/Web/Security/TRolePrincipal.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/framework/Web/Security/TRoleProvider.php b/framework/Web/Security/TRoleProvider.php deleted file mode 100644 index a83bfb0b..00000000 --- a/framework/Web/Security/TRoleProvider.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @version $Id: TRoleProvider.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -Prado::using('System.Configuration.Provider.TProviderBase'); -abstract class TRoleProvider extends TProviderBase -{ - private $_cacheRolesInCookie=false; - private $_cookieName="PRADO"; - private $_cookieTimeout="30"; - private $_cookiePath="/"; - private $_cookieRequireSSL=false; - private $_cookieSlidingExpiration=true; - - public function getCacheRolesInCookie() - { - return $this->_cacheRolesInCookie; - } - public function setCacheRolesInCookie($value) - { - $this->_cacheRolesInCookie = TPropertyValue::ensureBoolean($value); - } - public function getCookieName() - { - return $this->_cookieName; - } - public function setCookieName($value) - { - $this->_cookieName = TPropertyValue::ensureString($value); - } - public function getCookiePath() - { - return $this->_cookiePath; - } - public function setCookiePath($value) - { - $this->_cookiePath = TPropertyValue::ensureString($value); - } - public function getCookieRequireSSL() - { - return $this->_cookieRequireSSL; - } - public function setCookieRequireSSL($value) - { - $this->_cookieRequireSSL = TPropertyValue::ensureBoolean($value); - } - public function getCookieSlidingExpiration() - { - return $this->_cookieSlidingExpiration; - } - public function setCookieSlidingExpiration($value) - { - $this->_cookieSlidingExpiration = TPropertyValue::ensureBoolean($value); - } - public function getCookieTimeout() - { - return $this->_cookieTimeout; - } - public function setCookieTimeout($value) - { - $this->_cookieTimeout = TPropertyValue::ensureInteger($value); - } - - - public function __construct() - { - - } - public abstract function addUsersToRoles($usernames,$roleNames); - public abstract function createRole($roleName); - public abstract function deleteRole($roleName); - public abstract function findUsersInRole($roleName,$usernameToMatch); - public abstract function getAllRoles(); - public abstract function getRolesForUser($username); - public abstract function getUsersIsRole($username,$roleName); - public abstract function isUserIsRole($username,$roleName); - public abstract function removeUsersFromRoles($usernames,$roleNames); - public abstract function roleExists($roleName); -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TRoles.php b/framework/Web/Security/TRoles.php deleted file mode 100644 index 8072cb64..00000000 --- a/framework/Web/Security/TRoles.php +++ /dev/null @@ -1,237 +0,0 @@ - - * @version $Id: TRoles.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -Prado::using('System.Web.Security.TProviderException'); -final class TRoles -{ - private static $_applicationName; - private static $_cacheRolesInCookie=false; - private static $_cookieName; - private static $_cookiePath; - private static $_cookieProtectionValue; - private static $_cookieRequireSSL=false; - private static $_cookieSlidingExpiration=false; - private static $_cookieTimeout; - private static $_createPersistentCookie=false; - private static $_domain; - private static $_enabled=false; - private static $_maxCachedResults; - private static $_provider; - private static $_providers; - private static $_enabledSet=false; - private static $_initialized=false; - private static $_initializeException; - - public static function getApplicationName() - { - return self::$_applicationName; - } - public static function setApplicationName($value) - { - self::$_applicationName = TPropertyValue::ensureString($value); - } - public static function getCacheRolesInCookie() - { - return self::$_cacheRolesInCookie; - } - public static function getCookieName() - { - return self::$_cookieName; - } - public static function getCookiePath() - { - return self::$_cookiePath; - } - public static function getCookieProtectionValue() - { - return self::$_cookieProtectionValue; - } - public static function getCookieRequireSSL() - { - return self::$_cookieRequireSSL; - } - public static function getCookieSlidingExpiration() - { - return self::$_cookieSlidingExpiration; - } - public static function getCookieTimeout() - { - return self::$_cookieTimeout; - } - public static function getCreatePersistentCookie() - { - return self::$_createPersistentCookie; - } - public static function getDomain() - { - return self::$_domain; - } - public static function getEnabled() - { - return self::$_enabled; - } - public static function getMaxCachedResults() - { - return self::$_maxCachedResults; - } - public static function getProvider() - { - return self::$_provider; - } - public static function getProviders() - { - return self::$_providers; - } - - public static function addUsersToRole($usernames,$roleName) - { - - } - public static function addUsersToRoles($usernames,$roleNames) - { - - } - public static function addUserToRole($username,$roleName) - { - - } - public static function addUserToRoles($username,$roleNames) - { - - } - public static function createRole($roleName) - { - self::ensureEnabled(); - self::$_provider->createRole($roleName); - } - public static function deleteCookie() - { - - } - public static function deleteRole($roleName,$throwOnPopulatedRole=true) - { - self::ensureEnabled(); - - // $flag1 = self::$_Provider->DeleteRole($roleName,$throwOnPopulatedRole); - // try - // { - // $principal1 = self::GetCurrentUser(); - // } - // catch () - // { - // - // } - - } - private static function ensureEnabled() - { - self::initialize(); - if (!self::$_Initialized) - { - throw new TProviderException('Roles_feature_not_enabled'); - } - } - public static function findUsersInRole($roleName,$usernameToMatch) - { - - } - public static function getAllRoles() - { - - } - private static function getCurrentUser() - { - - } - private static function getCurrentUserName() - { - - } - public static function getRolesForUser($username=null) - { - - } - public static function getUsersInRole($roleName) - { - - } - private static function initialize() - { - if (self::$_initialized) - { - if (self::$_initializeException!==null) - { - throw new $_initializeException; - } - } - else - { - if (self::$_initialized) - { - if (self::$_initializeException!==null) - { - throw new $_initializeException; - } - return; - } - try - { - self::$_enabled; - self::$_cookieName; - self::$_cookiePath; - self::$_cacheRolesInCookie; - self::$_cookieTimeout; - self::$_cookiePath; - self::$_cookieRequireSSL; - self::$_cookieSlidingExpiration; - self::$_cookieProtectionValue; - self::$_domain; - self::$_createPersistentCookie; - self::$_maxCachedResults; - if (self::$_enabled) - { - if (self::$_maxCachedResults < 0) - { - throw new TProviderException('Value_must_be_non_negative_integer',self::$_MaxCachedResults); - }////stopped here - } - } - catch (TException $e) - { - - } - } - } - public static function isUserInRole($roleName,$username=null) - { - - } - public static function removeUserFromRole($username,$roleName) - { - - } - public static function remoreUserFromRoles($username,$roleNames) - { - - } - public static function removeUsersFromRole($usernames,$roleName) - { - - } - public static function removeUsersFromRoles($usernames,$roleNames) - { - - } - public static function roleExists($roleName) - { - - } -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TSqlMembershipProvider.php b/framework/Web/Security/TSqlMembershipProvider.php deleted file mode 100644 index 87e9015f..00000000 --- a/framework/Web/Security/TSqlMembershipProvider.php +++ /dev/null @@ -1,83 +0,0 @@ -_connectionStringName; - } - public function setConnectionStringName($value) - { - $this->_connectionStringName = TPropertyValue::ensureString($value); - } - - - public function __construct() - { - - } - public function changePassword($username,$oldPassword,$newPassword) - { - - } - public function changePasswordQuestionAndAnswer($username,$password,$newPasswordQuestion,$newPasswordAnswer) - { - - } - public function createUser($username,$password,$email,$passwordQuestion,$passwordAnswer,$isApproved,$providerUserKey) - { - - } - public function deleteUser($username,$deleteAllRelatedData) - { - - } - public function findUsersByEmail($emailToMatch,$pageIndex=null,$pageSize=null) - { - - } - public function findUsersByName($usernameToMatch,$pageIndex=null,$pageSize=null) - { - - } - public function getAllUsers($pageIndex=null,$pageSize=null) - { - - } - public function getNumberOfUsersOnline() - { - - } - public function getPassword($username,$answer) - { - - } - public function getMembershipUser($username=null,$providerUserKey=null,$userIsOnline=false) - { - Prado::using('System.Web.Security.TMembershipUser'); - return new TMembershipUser($this->getID()); - } - public function getUserNameByEmail($email) - { - - } - public function resetPassword($username,$answer) - { - - } - public function unlockUser($userName) - { - - } - public function updateUser(TMembershipUser $user) - { - - } - public function validateUser($username,$password) - { - - } -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TSqlRoleProvider.php b/framework/Web/Security/TSqlRoleProvider.php deleted file mode 100644 index 7eadc265..00000000 --- a/framework/Web/Security/TSqlRoleProvider.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @version $Id: TSqlRoleProvider.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.Security - * @since 3.1 - */ -Prado::using('System.Web.Security.TRoleProvider'); -class TSqlRoleProvider extends TRoleProvider -{ - private $_connectionStringName; - - public function getConnectionStringName() - { - return $this->_connectionStringName; - } - public function setConnectionStringName($value) - { - $this->_connectionStringName = TPropertyValue::ensureString($value); - } - - public function __construct() - { - - } - public function addUsersToRoles($usernames,$roleNames) - { - - } - public function createRole($roleName) - { - - } - public function deleteRole($roleName) - { - - } - public function findUsersInRole($roleName,$usernameToMatch) - { - - } - public function getAllRoles() - { - - } - public function getRolesForUser($username) - { - - } - public function getUsersIsRole($username,$roleName) - { - - } - public function isUserIsRole($username,$roleName) - { - - } - public function removeUsersFromRoles($usernames,$roleNames) - { - - } - public function roleExists($roleName) - { - - } -} -?> \ No newline at end of file diff --git a/framework/Web/Security/TUrlAuthorizationModule.php b/framework/Web/Security/TUrlAuthorizationModule.php deleted file mode 100644 index c321d95d..00000000 --- a/framework/Web/Security/TUrlAuthorizationModule.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/framework/Web/UI/WebControls/TLogin.php b/framework/Web/UI/WebControls/TLogin.php deleted file mode 100644 index a4d4d2af..00000000 --- a/framework/Web/UI/WebControls/TLogin.php +++ /dev/null @@ -1,1575 +0,0 @@ - - * @version $Id: TLogin.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.UI.WebControls - * @since 3.1 - */ -Prado::using('System.Web.UI.WebControls.TDataGridColumn'); - -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','Login'); - } - public function setLoginButtonText($value) - { - $this->setViewState('LoginButtonText',TPropertyValue::ensureString($value),'Login'); - } - public function getLoginButtonType() - { - return $this->getViewState('LoginButtonType',TButtonColumnType::PushButton); - } - public function setLoginButtonType($value) - { - $this->setViewState('LoginButtonType',TPropertyValue::ensureEnum($value,'TButtonColumnType'),TButtonColumnType::PushButton); - } - public function getMembershipProvider() - { - return $this->getViewState('MembershipProvider',''); - } - public function setMembershipProvider($value) - { - $this->setViewState('MembershipProvider',TPropertyValue::ensureString($value),''); - } - public function getOrientation() - { - return $this->getViewState('Orientation',TOrientation::Horizontal); - } - public function setOrientation($value) - { - $this->setViewState('Orientation',TPropertyValue::ensureEnum($value,'TOrientation'),TOrientation::Horizontal); - } - public function getPassword() - { - return $this->_password; - } - public function getPasswordInternal() - { - return $this->_passwordInternal; - } - public function getPasswordLabelText() - { - return $this->getViewState('PasswordLabelText','Password:'); - } - public function setPasswordLabelText($value) - { - $this->setViewState('PasswordLabelText',TPropertyValue::ensureString($value),'Password:'); - } - 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','A Password Is Required'); - } - public function setPasswordRequiredErrorMessage($value) - { - $this->setViewState('PasswordRequiredErrorMessage',TPropertyValue::ensureString($value),'A Password Is Required'); - } - 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','Remember Me Next Time:'); - } - public function setRememberMeText($value) - { - $this->setViewState('RememberMeText',TPropertyValue::ensureString($value),'Remember Me Next Time:'); - } - 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','Log In'); - } - public function setTitleText($value) - { - $this->setViewState('TitleText',TPropertyValue::ensureString($value),'Log In'); - } - 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','User Name:'); - } - public function setUserNameLabelText($value) - { - $this->setViewState('UserNameLabelText',TPropertyValue::ensureString($value),'User Name:'); - } - public function getUserNameRequiredErrorMessage() - { - return $this->getViewState('UserNameRequiredErrorMessage','A User Name Is Required'); - } - public function setUserNameRequiredErrorMessage($value) - { - $this->setViewState('UserNameRequiredErrorMessage',TPropertyValue::ensureString($value),'A User Name Is Required'); - } - 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() - { - echo TVarDumper::dump(__METHOD__,10,true); - if (($this->getPage() === null) || $this->getPage()->getIsValid()) - { - // $args1 = new LoginCancelEventArgs(); - $this->onLoggingIn($args1); - if (!$args1.Cancel) - { - // $args2 = new AuthenticateEventArgs(); - $this->onAuthenticate($args2); - if ($args2.Authenticated) - { - TFormsAuthentication::SetAuthCookie($this->getUserNameInternal(),$this->getRememberMeSet()); - // $this->onLoggedIn(EventArgs.Empty); - $this->getPage()->getResponse()->redirect($this->getRedirectUrl(),false); - } - else - { - // $this->onLoginError(EventArgs.Empty); - if ($this->getFailureAction() === TLoginFailureAction::RedirectToLoginPage) - { - TFormsAuthentication::RedirectToLoginPage("loginfailure=1"); - } - $control1 = $this->getTemplateContainer()->getFailureTextLabel(); - if ($control1 !== null) - { - $control1->setText($this->getFailureText()); - } - } - } - } - } - private function authenticateUsingMembershipProvider($param) - { - echo TVarDumper::dump(__METHOD__,10,true); - TLoginUtil::getProvider($this->getMembershipProvider())->validateUser($this->getUserNameInternal(),$this->getPasswordInternal()); - // e.Authenticated = LoginUtil.GetProvider(this.MembershipProvider).ValidateUser(this.UserNameInternal,this.PasswordInternal); - } - private function getRedirectUrl() - { - if ($this->onLoginPage()) - { - $text1 = TFormsAuthentication::GetReturnUrl(false); - if ($text1!==null || strlen($text1) === 0) - { - return $text1; - } - $text2 = $this->getDestinationPageUrl(); - if ($text2!==null || strlen($text2) === 0) - { - // return base.ResolveClientUrl($text2); - } - return TFormsAuthentication::getDefaultUrl(); - } - $text3 = $this->getDestinationPageUrl(); - if ($text3!==null || strlen($text3) === 0) - { - // return base.ResolveClientUrl($text3); - } - if (($this->getPage()->getForm() !== null)) - { - return $this->getPage()->getRequest()->getPathInfo(); - } - return $this->getPage()->getRequest()->getPathInfo(); - } - public function onAuthenticate($param) - { - echo TVarDumper::dump(__METHOD__,10,true); - // AuthenticateEventHandler handler1 = (AuthenticateEventHandler) base.Events[Login.EventAuthenticate]; - $handler1; - if ($handler1!==null) - { - $handler1($this,$param); - } - else - { - $this->authenticateUsingMembershipProvider($param); - } - } - public function onBubbleEvent($sender,$param) - { - echo TVarDumper::dump(__METHOD__,10,true); - // 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) - { - echo TVarDumper::dump(__METHOD__,10,true); - // EventHandler handler1 = (EventHandler) base.Events[Login.EventLoggedIn]; - // if ($handler1!==null) - // { - // $handler1($this,$param); - // } - } - public function onLoggingIn($param) - { - echo TVarDumper::dump(__METHOD__,10,true); - // LoginCancelEventHandler handler1 = (LoginCancelEventHandler) base.Events[Login.EventLoggingIn]; - // if ($handler1!==null) - // { - // $handler1($this,$param); - // } - } - public function onLoginError($param) - { - echo TVarDumper::dump(__METHOD__,10,true); - // EventHandler handler1 = (EventHandler) base.Events[Login.EventLoginError]; - // if ($handler1!==null) - // { - // $handler1($this,$param); - // } - } - private function onLoginPage() - { - - } - public function onPreRender($param) - { - parent::onPreRender($param); - $this->setEditableChildProperties(); - $this->_templateContainer->setVisible(($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->renderChildren($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); - if ($this->_titleTextStyle !== null) - { - TLoginUtil::setTableCellStyle($literal1,$this->_titleTextStyle); - } - TLoginUtil::setTableCellVisible($literal1,true); - } - else - { - TLoginUtil::setTableCellVisible($literal1,false); - } - $literal2 = $container1->getInstruction(); - $text2 = $this->getInstructionText(); - if (strlen($text2)>0) - { - $literal2->setText($text2); - if ($this->_instructionTextStyle !== null) - { - TLoginUtil::setTableCellStyle($literal2,$this->_instructionTextStyle); - } - TLoginUtil::setTableCellVisible($literal2,true); - } - else - { - TLoginUtil::setTableCellVisible($literal2,false); - } - $control1 = $container1->getUserNameLabel(); - $text3 = $this->getUserNameLabelText(); - if (strlen($text3)>0) - { - $control1->setText($text3); - if ($this->_instructionTextStyle !== null) - { - TLoginUtil::setTableCellStyle($control1,$this->_labelStyle); - } - TLoginUtil::setTableCellVisible($control1,true); - } - else - { - TLoginUtil::setTableCellVisible($control1,false); - } - $control2 = $container1->getUserNameTextBox(); - if ($this->_textBoxStyle !== null) - { - // $control2->ApplyStyle(this.TextBoxStyle);//This comes from WebControl - } - // $control2->setTabIndex($this->getTabIndex());//This comes from WebControl - // $control2->setAccessKey($this->getAccessKey());//This comes from WebControl - $flag1 = true; - /* @VAR $validator1 TRequiredFieldValidator */ - $validator1 = $container1->getUserNameRequired(); - $validator1->setErrorMessage($this->getUserNameRequiredErrorMessage()); - $validator1->setToolTip($this->getUserNameRequiredErrorMessage()); - $validator1->setEnabled($flag1); - $validator1->setVisible($flag1); - if ($this->_validatorTextStyle !== null) - { - // validator1.ApplyStyle(this._validatorTextStyle); - } - $control3 = $container1->getPasswordLabel(); - $text4 = $this->getPasswordLabelText(); - if (strlen($text4) > 0) - { - $control3->setText($text4); - if ($this->_labelStyle !== null) - { - TLoginUtil::setTableCellStyle($control3,$this->_labelStyle); - } - $control3->setVisible(true); - } - else - { - $control3->setVisible(false); - } - $control4 = $container1->getPasswordTextBox(); - if ($this->_textBoxStyle !== null) - { - // control4.ApplyStyle(this.TextBoxStyle); - } - // $control4.TabIndex = this.TabIndex; - $validator2 = $container1->getPasswordRequired(); - $validator2->setErrorMessage($this->getPasswordRequiredErrorMessage()); - $validator2->setToolTip($this->getPasswordRequiredErrorMessage()); - $validator2->setEnabled($flag1); - $validator2->setVisible($flag1); - if ($this->_validatorTextStyle !== null) - { - // validator2.ApplyStyle(this._validatorTextStyle); - } - $box1 = $container1->getRememberMeCheckBox(); - if ($this->getDisplayRememberMe()) - { - $box1->setText($this->getRememberMeText()); - if ($this->_checkBoxStyle !== null) - { - TLoginUtil::setTableCellStyle($box1,$this->getCheckBoxStyle()); - } - TLoginUtil::setTableCellVisible($box1,true); - } - else - { - TLoginUtil::setTableCellVisible($box1,false); - } - // box1.TabIndex = this.TabIndex; - $button1 = $container1->getLinkButton(); - $button2 = $container1->getImageButton(); - $button3 = $container1->getPushButton(); - $control5 = null; - switch ($this->getLoginButtonType()) - { - case TButtonColumnType::PushButton: - $button3->setText($this->getLoginButtonText()); - $control5 = $button3; - break; - case TButtonColumnType::ImageButton: - $button2->setImageUrl($this->getLoginButtonImageUrl()); - $button2->setAlternateText($this->getLoginButtonText()); - $control5 = $button2; - break; - - case TButtonColumnType::LinkButton: - $button1->setText($this->getLoginButtonText()); - $control5 = $button1; - break; - } - $button1->setVisible(false); - $button2->setVisible(false); - $button3->setVisible(false); - $control5->setVisible(true); - // control5.TabIndex = this.TabIndex; - if ($this->getLoginButtonStyle() !== null) - { - // control5.ApplyStyle(this.LoginButtonStyle); - } - $image1 = $container1->getCreateUserIcon(); - $link1 = $container1->getCreateUserLink(); - $control6 = $container1->getCreateUserLinkSeparator(); - $link2 = $container1->getPasswordRecoveryLink(); - $image2 = $container1->getPasswordRecoveryIcon(); - $link3 = $container1->getHelpPageLink(); - $image3 = $container1->getHelpPageIcon(); - $control7 = $container1->getPasswordRecoveryLinkSeparator(); - $text5 = $this->getCreateUserText(); - $text6 = $this->getCreateUserIconUrl(); - $text7 = $this->getPasswordRecoveryText(); - $text8 = $this->getPasswordRecoveryIconUrl(); - $text9 = $this->getHelpPageText(); - $text10 = $this->getHelpPageIconUrl(); - $flag2 = strlen($text5) > 0; - $flag3 = strlen($text7) > 0; - $flag4 = strlen($text9) > 0; - $flag5 = strlen($text10) > 0; - $flag6 = strlen($text6) > 0; - $flag7 = strlen($text8) > 0; - $flag8 = $flag4 || $flag5; - $flag9 = $flag2 || $flag6; - $flag10 = $flag3 || $flag7; - $link3->setVisible($flag4); - $control7->setVisible($flag8 && ($flag10 || $flag9)); - if ($flag4) - { - $link3->setText($text9); - $link3->setNavigateUrl($this->getHelpPageUrl()); - // $link3->setTabIndex($this.TabIndex); - } - $image3->setVisible($flag5); - if ($flag5) - { - $image3->setImageUrl($text10); - $image3->setAlternateText($this->getHelpPageText()); - } - $link1->setVisible($flag2); - $control6->setVisible($flag9 && $flag10); - if ($flag2) - { - $link1->setText($text5); - $link1->setNavigateUrl($this->getCreateUserUrl()); - // $link1->setTabIndex($this.TabIndex); - } - $image1->setVisible($flag6); - if ($flag6) - { - $image1->setImageUrl($text6); - $image1->setAlternateText($this->getCreateUserText()); - } - $link2->setVisible($flag3); - if ($flag3) - { - $link2->setText($text7); - $link2->setNavigateUrl($this->getPasswordRecoveryUrl()); - // $link2->setTabIndex($this.TabIndex); - } - $image2->setVisible($flag7); - if ($flag7) - { - $image2->setImageUrl($text8); - $image2->setAlternateText($this->getPasswordRecoveryText()); - } - if (($flag9 || $flag10) || $flag8) - { - if ($this->getHyperLinkStyle() !== null) - { - $style1 = new TTableItemStyle(); - // $style1.CopyFrom($this->getHyperLinkStyle()); - $style1->getFont()->reset(); - TLoginUtil::setTableCellStyle($link1,$style1); - // $link1.Font.CopyFrom(this.HyperLinkStyle.Font); - // $link1.ForeColor = this.HyperLinkStyle.ForeColor; - // $link2.Font.CopyFrom(this.HyperLinkStyle.Font); - // $link2.ForeColor = this.HyperLinkStyle.ForeColor; - // $link3.Font.CopyFrom(this.HyperLinkStyle.Font); - // $link3.ForeColor = this.HyperLinkStyle.ForeColor; - } - TLoginUtil::setTableCellVisible($link3, true); - } - else - { - TLoginUtil::setTableCellVisible($link3, false); - } - $control8 = $container1->getFailureTextLabel(); - if (strlen($control8->getText()) > 0) - { - TLoginUtil::setTableCellStyle($control8, $this->getFailureTextStyle()); - TLoginUtil::setTableCellVisible($control8, true); - } - else - { - TLoginUtil::setTableCellVisible($control8, false); - } - } - private function setEditableChildProperties() - { - // echo TVarDumper::dump(__METHOD__,10,true); - } - // 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::Dynamic); - $validator1->setText('*'); - $validator1->setEnabled($flag1); - $validator1->setVisible($flag1); - $loginContainer->setUserNameRequired($validator1); - $box2 = new TTextBox(); - $box2->setID('Password'); - $box2->setTextMode(TTextBoxMode::Password); - $loginContainer->setPasswordTextBox($box2); - $label2 = new TLabel(); - $loginContainer->setPasswordLabel($label2); - $validator2 = new TRequiredFieldValidator(); - $validator2->setID('PasswordRequired'); - $validator2->setValidationGroup($text1); - $validator2->setControlToValidate($box2->getID()); - $validator2->setDisplay(TValidatorDisplayStyle::Dynamic); - $validator2->setText('*'); - $validator2->setEnabled($flag1); - $validator2->setVisible($flag1); - $loginContainer->setPasswordRequired($validator2); - $box3 = new TCheckBox(); - $box3->setID('RememberMe'); - $loginContainer->setRememberMeCheckBox($box3); - $button1 = new TLinkButton(); - $button1->setID('LoginLinkButton'); - $button1->setValidationGroup($text1); - // $button1->setCommandName(TLogin::LoginButtonCommandName); - $loginContainer->setLinkButton($button1); - $button2 = new TImageButton(); - $button2->setID('LoginImageButton'); - $button2->setValidationGroup($text1); - // $button2->setCommandName(TLogin::LoginButtonCommandName); - $loginContainer->setImageButton($button2); - $button3 = new TButton(); - $button3->setID('LoginButton'); - $button3->setValidationGroup($text1); - // $button3->setCommandName(TLogin::LoginButtonCommandName); - $loginContainer->setPushButton($button3); - $link1 = new THyperLink(); - $link1->setID('PasswordRecoveryLink'); - $loginContainer->setPasswordRecoveryLink($link1); - $control1 = new TLiteral(); - $loginContainer->setPasswordRecoveryLinkSeparator($control1); - $link2 = new THyperLink(); - $link2->setID('CreateUserLink'); - $loginContainer->setCreateUserLink($link2); - $control2 = new TLiteral(); - $loginContainer->setCreateUserLinkSeparator($control2); - $link3 = new THyperLink(); - $link3->setID('HelpLink'); - $loginContainer->setHelpPageLink($link3); - $literal3 = new TLiteral(); - $literal3->setID('FailureText'); - $loginContainer->setFailureTextLabel($literal3); - $loginContainer->setPasswordRecoveryIcon(new TImage()); - $loginContainer->setPasswordRecoveryIcon(new TImage()); - $loginContainer->setHelpPageIcon(new TImage()); - $loginContainer->setCreateUserIcon(new TImage()); - } - private function layoutControls(TLoginContainer $loginContainer) - { - $orientation1 = $this->_owner->getOrientation(); - $layout1 = $this->_owner->getTextLayout(); - - if (($orientation1 === TOrientation::Vertical) && ($layout1 === TLoginTextLayout::TextOnLeft)) - { - $this->layoutVerticalTextOnLeft($loginContainer); - } - elseif (($orientation1 === TOrientation::Vertical) && ($layout1 === TLoginTextLayout::TextOnTop)) - { - $this->layoutVerticalTextOnTop($loginContainer); - } - elseif (($orientation1 === TOrientation::Horizontal) && ($layout1 === TLoginTextLayout::TextOnLeft)) - { - $this->layoutHorizontalTextOnLeft($loginContainer); - } - else - { - $this->layoutHorizontalTextOnTop($loginContainer); - } - } - private function layoutHorizontalTextOnLeft(TLoginContainer $loginContainer) - { - $table1 = new TTable(); - $table1->setCellPadding(0); - $row1 = new TDisappearingTableRow(); - $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 TDisappearingTableRow(); - $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 TDisappearingTableRow(); - $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); - $cell1 = new TTableCell(); - if ($this->_owner->getConvertingToTemplate()) - { - // $loginContainer->getPasswordLabel()->RenderAsLabel = true; - } - $cell1->getControls()->add($loginContainer->getPasswordLabel()); - $row1->getCells()->add($cell1); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getPasswordTextBox()); - $cell1->getControls()->add($loginContainer->getPasswordRequired()); - $row1->getCells()->add($cell1); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getRememberMeCheckBox()); - $row1->getCells()->add($cell1); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getLinkButton()); - $cell1->getControls()->add($loginContainer->getImageButton()); - $cell1->getControls()->add($loginContainer->getPushButton()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(6); - $cell1->getControls()->add($loginContainer->getFailureTextLabel()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(6); - $loginContainer->getCreateUserLinkSeparator()->setText(''); - $loginContainer->getPasswordRecoveryLinkSeparator()->setText(''); - $cell1->getControls()->add($loginContainer->getCreateUserIcon()); - $cell1->getControls()->add($loginContainer->getCreateUserLink()); - $cell1->getControls()->add($loginContainer->getCreateUserLinkSeparator()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryIcon()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryLink()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryLinkSeparator()); - $cell1->getControls()->add($loginContainer->getHelpPageIcon()); - $cell1->getControls()->add($loginContainer->getHelpPageLink()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $table2 = TLoginUtil::createChildTable($this->_owner->getConvertingToTemplate()); - $row1 = new TTableRow(); - $cell1 = new TTableCell(); - $cell1->getControls()->add($table1); - $row1->getCells()->add($cell1); - $table2->getRows()->add($row1); - $loginContainer->setLayoutTable($table1); - $loginContainer->setBorderTable($table2); - $loginContainer->getControls()->add($table2); - } - private function layoutHorizontalTextOnTop(TLoginContainer $loginContainer) - { - $table1 = new TTable(); - $table1->setCellPadding(0); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(4); - $cell1->setHorizontalAlign(THorizontalAlign::Center); - $cell1->getControls()->add($loginContainer->getTitle()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(4); - $cell1->setHorizontalAlign(THorizontalAlign::Center); - $cell1->getControls()->add($loginContainer->getInstruction()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - if ($this->_owner->getConvertingToTemplate()) - { - // $loginContainer->getUserNameLabel()->RenderAsLabel = true; - } - $cell1->getControls()->add($loginContainer->getUserNameLabel()); - $row1->getCells()->add($cell1); - $cell1 = new TTableCell(); - if ($this->_owner->getConvertingToTemplate()) - { - // $loginContainer->getPasswordLabel()->RenderAsLabel = true; - } - $cell1->getControls()->add($loginContainer->getPasswordLabel()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getUserNameTextBox()); - $cell1->getControls()->add($loginContainer->getUserNameRequired()); - $row1->getCells()->add($cell1); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getPasswordTextBox()); - $cell1->getControls()->add($loginContainer->getPasswordRequired()); - $row1->getCells()->add($cell1); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getRememberMeCheckBox()); - $row1->getCells()->add($cell1); - $cell1 = new TTableCell(); - $cell1->setHorizontalAlign(THorizontalAlign::Right); - $cell1->getControls()->add($loginContainer->getLinkButton()); - $cell1->getControls()->add($loginContainer->getImageButton()); - $cell1->getControls()->add($loginContainer->getPushButton()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(4); - $cell1->getControls()->add($loginContainer->getFailureTextLabel()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(4); - $loginContainer->getCreateUserLinkSeparator()->setText(''); - $loginContainer->getPasswordRecoveryLinkSeparator()->setText(''); - $cell1->getControls()->add($loginContainer->getCreateUserIcon()); - $cell1->getControls()->add($loginContainer->getCreateUserLink()); - $cell1->getControls()->add($loginContainer->getCreateUserLinkSeparator()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryIcon()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryLink()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryLinkSeparator()); - $cell1->getControls()->add($loginContainer->getHelpPageIcon()); - $cell1->getControls()->add($loginContainer->getHelpPageLink()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $table2 = TLoginUtil::createChildTable($this->_owner->getConvertingToTemplate()); - $row1 = new TTableRow(); - $cell1 = new TTableCell(); - $cell1->getControls()->add($table1); - $row1->getCells()->add($cell1); - $table2->getRows()->add($row1); - $loginContainer->setLayoutTable($table1); - $loginContainer->setBorderTable($table2); - $loginContainer->getControls()->add($table2); - } - private function layoutVerticalTextOnLeft(TLoginContainer $loginContainer) - { - $table1 = new TTable(); - $table1->setCellPadding(0); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(2); - $cell1->setHorizontalAlign(THorizontalAlign::Center); - $cell1->getControls()->add($loginContainer->getTitle()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(2); - $cell1->setHorizontalAlign(THorizontalAlign::Center); - $cell1->getControls()->add($loginContainer->getInstruction()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setHorizontalAlign(THorizontalAlign::Right); - 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); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setHorizontalAlign(THorizontalAlign::Right); - if ($this->_owner->getConvertingToTemplate()) - { - // $loginContainer->getPasswordLabel()->RenderAsLabel = true; - } - $cell1->getControls()->add($loginContainer->getPasswordLabel()); - $row1->getCells()->add($cell1); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getPasswordTextBox()); - $cell1->getControls()->add($loginContainer->getPasswordRequired()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(2); - $cell1->getControls()->add($loginContainer->getRememberMeCheckBox()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(2); - $cell1->setHorizontalAlign(THorizontalAlign::Center); - $cell1->getControls()->add($loginContainer->getFailureTextLabel()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(2); - $cell1->setHorizontalAlign(THorizontalAlign::Right); - $cell1->getControls()->add($loginContainer->getLinkButton()); - $cell1->getControls()->add($loginContainer->getImageButton()); - $cell1->getControls()->add($loginContainer->getPushButton()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(2); - $loginContainer->getPasswordRecoveryLinkSeparator()->setText('
'); - $loginContainer->getCreateUserLinkSeparator()->setText('
'); - $cell1->getControls()->add($loginContainer->getCreateUserIcon()); - $cell1->getControls()->add($loginContainer->getCreateUserLink()); - $cell1->getControls()->add($loginContainer->getCreateUserLinkSeparator()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryIcon()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryLink()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryLinkSeparator()); - $cell1->getControls()->add($loginContainer->getHelpPageIcon()); - $cell1->getControls()->add($loginContainer->getHelpPageLink()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $table2 = TLoginUtil::createChildTable($this->_owner->getConvertingToTemplate()); - $row1 = new TTableRow(); - $cell1 = new TTableCell(); - $cell1->getControls()->add($table1); - $row1->getCells()->add($cell1); - $table2->getRows()->add($row1); - $loginContainer->setLayoutTable($table1); - $loginContainer->setBorderTable($table2); - $loginContainer->getControls()->add($table2); - } - private function layoutVerticalTextOnTop(TLoginContainer $loginContainer) - { - $table1 = new TTable(); - $table1->setCellPadding(0); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setColumnSpan(2); - $cell1->setHorizontalAlign(THorizontalAlign::Center); - $cell1->getControls()->add($loginContainer->getTitle()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setHorizontalAlign(THorizontalAlign::Center); - $cell1->getControls()->add($loginContainer->getInstruction()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - if ($this->_owner->getConvertingToTemplate()) - { - // $loginContainer->getUserNameLabel()->RenderAsLabel = true; - } - $cell1->getControls()->add($loginContainer->getUserNameLabel()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getUserNameTextBox()); - $cell1->getControls()->add($loginContainer->getUserNameRequired()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - if ($this->_owner->getConvertingToTemplate()) - { - // $loginContainer->getPasswordLabel()->RenderAsLabel = true; - } - $cell1->getControls()->add($loginContainer->getPasswordLabel()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getPasswordTextBox()); - $cell1->getControls()->add($loginContainer->getPasswordRequired()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->getControls()->add($loginContainer->getRememberMeCheckBox()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setHorizontalAlign(THorizontalAlign::Center); - $cell1->getControls()->add($loginContainer->getFailureTextLabel()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $cell1->setHorizontalAlign(THorizontalAlign::Right); - $cell1->getControls()->add($loginContainer->getLinkButton()); - $cell1->getControls()->add($loginContainer->getImageButton()); - $cell1->getControls()->add($loginContainer->getPushButton()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $row1 = new TDisappearingTableRow(); - $cell1 = new TTableCell(); - $loginContainer->getPasswordRecoveryLinkSeparator()->setText('
'); - $loginContainer->getCreateUserLinkSeparator()->setText('
'); - $cell1->getControls()->add($loginContainer->getCreateUserIcon()); - $cell1->getControls()->add($loginContainer->getCreateUserLink()); - $cell1->getControls()->add($loginContainer->getCreateUserLinkSeparator()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryIcon()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryLink()); - $cell1->getControls()->add($loginContainer->getPasswordRecoveryLinkSeparator()); - $cell1->getControls()->add($loginContainer->getHelpPageIcon()); - $cell1->getControls()->add($loginContainer->getHelpPageLink()); - $row1->getCells()->add($cell1); - $table1->getRows()->add($row1); - $table2 = TLoginUtil::createChildTable($this->_owner->getConvertingToTemplate()); - $row1 = new TTableRow(); - $cell1 = new TTableCell(); - $cell1->getControls()->add($table1); - $row1->getCells()->add($cell1); - $table2->getRows()->add($row1); - $loginContainer->setLayoutTable($table1); - $loginContainer->setBorderTable($table2); - $loginContainer->getControls()->add($table2); - } - 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 - * @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 - * @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 - * @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/TLoginName.php b/framework/Web/UI/WebControls/TLoginName.php deleted file mode 100644 index 6367a5a2..00000000 --- a/framework/Web/UI/WebControls/TLoginName.php +++ /dev/null @@ -1,15 +0,0 @@ - - * @version $Id: TLoginName.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.UI.WebControls - * @since 3.1 - */ -class TLoginName extends TWebControl -{ - -} -?> \ No newline at end of file diff --git a/framework/Web/UI/WebControls/TLoginStatus.php b/framework/Web/UI/WebControls/TLoginStatus.php deleted file mode 100644 index d82112de..00000000 --- a/framework/Web/UI/WebControls/TLoginStatus.php +++ /dev/null @@ -1,15 +0,0 @@ - - * @version $Id: TLoginStatus.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.UI.WebControls - * @since 3.1 - */ -class TLoginStatus extends TCompositeControl -{ - -} -?> \ No newline at end of file diff --git a/framework/Web/UI/WebControls/TLoginUtil.php b/framework/Web/UI/WebControls/TLoginUtil.php deleted file mode 100644 index 10b3b2a9..00000000 --- a/framework/Web/UI/WebControls/TLoginUtil.php +++ /dev/null @@ -1,183 +0,0 @@ -'; - const _userNameReplacementKey='<%\s*UserName\s*%>'; - - // public function onSendingMailDelegate($param) - // { - // - // } - // public function onSendMailErrorDelegate($param) - // { - // - // } - public static function createChildTable($convertingToTemplate) - { - if ($convertingToTemplate) - { - return new TTable(); - } - else - return new TTable(); - // else - // return new TChildTable(2); - } - 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) - { - $flag1 = false; - foreach ($this->getCells() as $cell1) - { - if ($cell1->getVisible()) - { - $flag1 = true; - break; - } - } - if ($flag1) - { - parent::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 diff --git a/framework/Web/UI/WebControls/TLoginView.php b/framework/Web/UI/WebControls/TLoginView.php deleted file mode 100644 index 0f4e2105..00000000 --- a/framework/Web/UI/WebControls/TLoginView.php +++ /dev/null @@ -1,15 +0,0 @@ - - * @version $Id: TLoginView.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.UI.WebControls - * @since 3.1 - */ -class TLoginView extends TControl -{ - -} -?> \ No newline at end of file diff --git a/framework/Web/UI/WebControls/TOrientation.php b/framework/Web/UI/WebControls/TOrientation.php deleted file mode 100644 index ffe7aec7..00000000 --- a/framework/Web/UI/WebControls/TOrientation.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @version $Id: TLogoutAction.php 1398 2006-09-08 19:31:03Z xue $ - * @package System.Web.UI.WebControls - * @since 3.1 - */ -class TOrientation extends TEnumerable -{ - const Horizontal='Horizontal'; - const Vertical='Vertical'; -} -?> \ No newline at end of file diff --git a/framework/Xml/TFeedDocument.php b/framework/Xml/TFeedDocument.php deleted file mode 100644 index 28f917cb..00000000 --- a/framework/Xml/TFeedDocument.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @link http://www.pradosoft.com - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package System.Xml - */ - -Prado::using('System.Web.Services.IFeedContentProvider'); - -/** - * TFeedDocument class - * - * TFeedDocument represents a Web feed used for Web syndication. - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - */ -abstract class TFeedDocument extends DOMDocument implements IFeedContentProvider { - - /** - * - */ - public function __construct($encoding = null) { - parent::__construct('1.0', $encoding); - } - - /** - * - */ - public function getEncoding() { - return $this->encoding; - } - - /** - * - */ - public function setEncoding($encoding) { - $this->encoding = $encoding; - } -} - -/** - * TFeedElement class - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - */ -abstract class TFeedElement extends TXmlElement { - - /** - * - */ - /* public function getValue($name) { - $element = $this->getElementByTagName($name); - if($element instanceof TXmlElement) { - return $element->getValue(); - } - throw new Exception("Element '$name' not found"); - }*/ - - /** - * - */ - /*public function setValue($name, $value) { - - if(($element = $this->getElementByTagName($name)) !== null) { - $element->setValue($value); - } else { - $element = new TXmlElement($name); - $element->setValue($value); - $this->getElements()->add($element); - } - }*/ -} - -/** - * TFeedItem class - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - */ -abstract class TFeedItem extends TFeedElement { - -} - -?> \ No newline at end of file diff --git a/framework/Xml/TRssFeedDocument.php b/framework/Xml/TRssFeedDocument.php deleted file mode 100644 index e4c441ab..00000000 --- a/framework/Xml/TRssFeedDocument.php +++ /dev/null @@ -1,952 +0,0 @@ - - * @link http://www.pradosoft.com - * @copyright Copyright © 2006 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package System.Xml - */ - -Prado::using('System.Xml.TFeedDocument'); - -/** - * TRssFeedDocument class - * - * TRssFeedDocument represents an RSS feed. RSS is a family of web feed formats, specified in XML and - * used for Web syndication. RSS is used by (among other things) news websites, weblogs and - * podcasting. - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - */ -class TRssFeedDocument extends TFeedDocument { - - private $_rss; // reference to rss node - private $_channel; // reference to channel node - - /** - * Constructor - */ - public function __construct($encoding = null) { - parent::__construct($encoding); - - $this->formatOutput = true; - - $this->_rss = $this->createElement('rss'); - $this->_rss->setAttribute('version', '0.91'); - $this->appendChild($this->_rss); - - $this->_channel = $this->createElement('channel'); - $this->_rss->appendChild($this->_channel); - } - - public function init() { - - } - - /** - * @return RSS version - */ - public function getVersion() { - return $this->_rss->getAttribute('version'); - } - - /** - * @param string $version RSS version - */ - public function setVersion($version) { - if($version == '0.91' or $version == '0.92' or $version == '2.0') { - $this->_rss->setAttribute('version', $version); - } else { - throw new TInvalidDataTypeException('rssfeed_version_invalid', $version); - } - } - - /** - * @return string The name of the channel. - */ - public function getTitle() { - return $this->get('title'); - } - - /** - * The name of the channel. It's how people refer to your service. If you have an HTML - * website that contains the same information as your RSS file, the title of your channel - * should be the same as the title of your website. - * - * @param string $title The name of the channel. - */ - public function setTitle($title) { - $this->set('title', $title); - } - - /** - * @return string The URL to the HTML website corresponding to the channel. - */ - public function getLink() { - return $this->get('link'); - } - - /** - * The URL to the HTML website corresponding to the channel. - * - * @param string $link The URL to the HTML website corresponding to the channel. - */ - public function setLink($link) { - $this->set('link', $link); - } - - /** - * @return string Phrase or sentence describing the channel. - */ - public function getDescription() { - return $this->get('description'); - } - - /** - * @param string $description Phrase or sentence describing the channel. - */ - public function setDescription($description) { - $this->set('description', $description); - } - - /** - * @return string The language the channel is written in. - */ - public function getLanguage() { - return $this->get('language'); - } - - /** - * The language the channel is written in. This allows aggregators to group all Italian - * language sites, for example, on a single page. A list of allowable values for this - * element, as provided by Netscape, is {@link http://www.rssboard.org/rss-language-codes here}. - * You may also use {@link http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes values defined} - * by the W3C. - */ - public function setLanguage($language) { - $this->set('language', $language); - } - - /** - * @return string Copyright notice for content in the channel. - */ - public function getCopyright() { - return $this->get('copyright'); - } - - /** - * @param string Copyright notice for content in the channel. - */ - public function setCopyright($copyright) { - $this->set('copyright', $copyright); - } - - /** - * @return string Email address for person responsible for editorial content. - */ - public function getManagingEditor() { - return $this->get('managingEditor'); - } - - /** - * @param string Email address for person responsible for editorial content. - */ - public function setManagingEditor($managingEditor) { - $this->set('managingEditor', $managingEditor); - } - - /** - * @return string Email address for person responsible for technical issues relating to channel. - */ - public function getWebMaster() { - return $this->get('webMaster'); - } - - /** - * @param string Email address for person responsible for technical issues relating to channel. - */ - public function setWebMaster($webMaster) { - $this->set('webMaster', $webMaster); - } - - /** - * @return string The {@link http://www.w3.org/PICS/ PICS} rating for the channel. - */ - public function getRating() { - return $this->get('rating'); - } - - /** - * @param string The {@link http://www.w3.org/PICS/ PICS} rating for the channel. - */ - public function setRating($rating) { - $this->set('rating', $rating); - } - - /** - * @return string Publication date - */ - public function getPublicationDate() { - return $this->get('pubDate'); - } - - /** - * The publication date for the content in the channel. For example, the New York Times - * publishes on a daily basis, the publication date flips once every 24 hours. That's when - * the pubDate of the channel changes. All date-times in RSS conform to the Date and Time - * Specification of {@link http://asg.web.cmu.edu/rfc/rfc822.html RFC 822}, with the exception - * that the year may be expressed with two characters or four characters (four preferred). - * - * @param string $pubDate Publication date - */ - public function setPublicationDate($pubDate) { - $this->set('pubDate', $pubDate); - } - - /** - * @return The last time the channel was modified. - */ - public function getLastBuildDate() { - return $this->get('lastBuildDate'); - } - - /** - * @param string $date The last time the channel was modified (RFC 822). - */ - public function setLastBuildDate($date) { - return $this->set('lastBuildDate', $date); - } - - /** - * @return An URL that references a description of the channel. - */ - public function getDocumentation() { - return $this->get('docs'); - } - - /** - * A URL that points to the documentation for the format used in the RSS file. It's probably - * a pointer to this page. It's for people who might stumble across an RSS file on a Web - * server 25 years from now and wonder what it is. - * - * @param string $documentation An URL that references a description of the channel. - */ - public function setDocumentation($documentation) { - $this->set('docs', $documentation); - } - - /** - * @return array The days of the week, spelled out in English. - */ - public function getSkipDays() { - $skipDays = $this->_channel->getElementsByTagName('skipDays')->item(0); - $return = array(); - if($skipDays instanceof DOMElement) { - $days = $skipDays->getElementsByTagName('day'); - foreach($days as $day) { - $return[] = $day->nodeValue; - } - } - return $return; - } - - /** - * @param array $days The days of the week, spelled out in English. - */ - public function setSkipDays($days) { - - $skipDays = $this->createElement('skipDays'); - foreach($days as $day) { // Append day - $day = $this->createElement('day', $day); - $skipDays->appendChild($day); - } - - // Add skipDays - $node = $this->_channel->getElementsByTagName('skipDays')->item(0); - if($node instanceof DOMElement) { - $this->_channel->replaceChild($skipDays, $node); - } else { - $this->_channel->appendChild($skipDays); - } - } - - /** - * @return array - */ - public function getSkipHours() { - $skipHours = $this->_channel->getElementsByTagName('skipHours')->item(0); - $return = array(); - if($skipHours instanceof DOMElement) { - $hours = $skipHours->getElementsByTagName('hour'); - foreach($hours as $hour) { - $return[] = (int)$hour->nodeValue; - } - } - return $return; - } - - /** - * A list of hour's indicating the hours in the day, GMT, when the channel is unlikely to - * be updated. If not set, the channel is assumed to be updated hourly. - * - * @param array $hours - */ - public function setSkipHours($hours) { - - $skipHours = $this->createElement('skipHours'); - foreach($hours as $hour) { // Append hour - $hour = $this->createElement('hour', $hour); - $skipHours->appendChild($hour); - } - - // Add skipHours - $node = $this->_channel->getElementsByTagName('skipHours')->item(0); - if($node instanceof DOMElement) { - $this->_channel->replaceChild($skipHours, $node); - } else { - $this->_channel->appendChild($skipHours); - } - } - - /** - * - * - * @param TRssFeedItem $item - */ - public function addItem(TRssFeedItem $item) { - - //if($this->_version == '0.91' and count($this->getItems()) <= 15) { - - $fragment = $this->createDocumentFragment(); - if($fragment->appendXML($item->toString())) { - $this->_channel->appendChild($fragment); - } else { - // TODO - } - /*} else { - throw new TInvalidOperationException(''); - }*/ - } - - /** - * - * - * @param TRssFeedImage $image The feed accompanying icon. - */ - public function setImage(TRssFeedImage $image) { - $fragment = $this->createDocumentFragment(); - $fragment->appendXML($image->toString()); - $node = $this->_channel->getElementsByTagName($name)->item(0); - if($node instanceof DOMElement) { - $this->_channel->replaceChild($fragment, $node); - } else { - $this->_channel->appendChild($fragment); - } - } - - /** - * - * - * @param TRssFeedTextInput $textInput A small text box and a Submit button to associate with a CGI application. - */ - public function setTextInput(TRssFeedTextInput $textInput) { - $fragment = $this->createDocumentFragment(); - $fragment->appendXML($textInput->toString()); - $node = $this->_channel->getElementsByTagName($name)->item(0); - if($node instanceof DOMElement) { - $this->_channel->replaceChild($fragment, $node); - } else { - $this->_channel->appendChild($fragment); - } - } - - /** - * - * @param TRssFeedCloud $cloud - * @since RSS 0.92 - */ - public function setCloud(TRssFeedCloud $cloud) { - // TODO: RSS >= 0.92 - $fragment = $this->createDocumentFragment(); - $fragment->appendXML($cloud->toString()); - $node = $this->_channel->getElementsByTagName($name)->item(0); - if($node instanceof DOMElement) { - $this->_channel->replaceChild($fragment, $node); - } else { - $this->_channel->appendChild($fragment); - } - - } - - /** - * @return array A list of TRssItem's - */ - public function getItems() { - $return = array(); - $elements = $this->getElementsByTagName('item'); - - $items = new TRssFeedItemList(); - - /*foreach($items as $item) { - $return[] = - }*/ - return $return; - } - - /** - * @return string Category path seperated with forward slash. - */ - public function getCategory() { - return $this->get('category'); - } - - /** - * Specify one or more categories that the channel belongs to. - * - * @param string $category Category path seperated with forward slash. - * @param string $domain Domain name which the category applies to. - * @since RSS 2.0 - */ - public function setCategory($category, $domain) { - $newNode = $this->createElement('category', $category); - $newNode->setAttribute('domain', $domain); - $node = $this->_channel->getElementsByTagName($category)->item(0); - if($node instanceof DOMElement) { - $this->_channel->replaceChild($newNode, $node); - } else { - $this->_channel->appendChild($newNode); - } - } - - /** - * @return string A string indicating the program used to generate the channel. - */ - public function getGenerator() { - return $this->get('generator'); - } - - /** - * @param string $generator A string indicating the program used to generate the channel. - * @since RSS 2.0 - */ - public function setGenerator($generator) { - if($this->getVersion() >= '2.0') { - $this->set('generator', $generator); - } else { - throw new TInvalidDataTypeException('rssfeed_generator_unsupported'); - } - } - - /** - * ttl stands for time to live. It's a number of minutes that indicates how long a - * channel can be cached before refreshing from the source. - * - * @param int Number of minutes that channel can be cached. - * @since RSS 2.0 - */ - public function setTimeToLive($ttl) { - - } - - /** - * Help getter - */ - private function get($name) { - return $this->getElementsByTagName($name)->item(0)->nodeValue; - } - - /** - * Helpt setter - */ - private function set($name, $value) { - $newNode = $this->createElement($name, $value); - $node = $this->_channel->getElementsByTagName($name)->item(0); - if($node instanceof DOMElement) { - $this->_channel->replaceChild($newNode, $node); - } else { - $this->_channel->appendChild($newNode); - } - } - - /** - * - * @return string Feed as XML - */ - public function getFeedContent() { - return $this->saveXML(); - } -} - -/** - * TRssFeedItem class - * - * An item may represent a "story" -- much like a story in a newspaper or magazine; if so its - * description is a synopsis of the story, and the link points to the full story. An item may - * also be complete in itself, if so, the description contains the text (entity-encoded HTML - * is allowed), and the link and title may be omitted. All elements of an item are optional, - * however at least one of title or description must be present. - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - */ -class TRssFeedItem extends TFeedItem { - - - public function __construct() { - parent::__construct('item'); - } - - /** - * @return string The title of the item. - */ - public function getTitle() { - return $this->get('title'); - } - - /** - * @param string $title The title of the item. - */ - public function setTitle($title) { - $this->set('title', $title); - } - - /** - * @return string The URL of the item. - */ - public function getLink() { - return $this->get('link'); - } - - /** - * @param string $link The URL of the item. - */ - public function setLink($link) { - $this->set('link', $link); - } - - /** - * @return string The item synopsis. - */ - public function getDescription() { - return $this->get('description'); - } - - /** - * @param string $description The item synopsis. - */ - public function setDescription($description) { - $this->set('description', $description); - } - - - /** - * The RSS channel that the item came from. The purpose of this property is to propagate - * credit for links, to publicize the sources of news items. It can be used in the Post - * command of an aggregator. It should be generated automatically when forwarding an item - * from an aggregator to a weblog authoring tool. - * - * @param string $source Name of source - * @param string $url Link back to source - * @since RSS 0.92 - */ - public function setSource($source, $url) { - $source = $this->getElementsByTagName('source'); - if($source instanceof TXmlElement) { - $source->setValue($source); - $source->setAttribute('url', $url); - } else { - $source = new TXmlElement('source'); - $source->setValue($source); - $source->setAttribute('url', $url); - $this->getElements()->add($source); - } - } - - /** - * Describes a media object that is attached to the item. - * - * @param string $url Where the enclosure is located. - * @param int $length Size in bytes. - * @param string $type MIME type - * @since RSS 0.92 - */ - public function setEnclosure($url, $length, $type) { - $enclosure = $this->getElementsByTagName('enclosure'); - if($enclosure instanceof TXmlElement) { - $enclosure->setAttribute('url', $url); - $enclosure->setAttribute('length', $length); - $enclosure->setAttribute('type', $type); - } else { - $enclosure = new TXmlElement('enclosure'); - $enclosure->setAttribute('url', $url); - $enclosure->setAttribute('length', $length); - $enclosure->setAttribute('type', $type); - $this->getElements()->add($enclosure); - } - } - - /** - * Includes the item in one or more categories. - * - * @param string $category A forward-slash-separated string that identifies a hierarchic location in the indicated taxonomy. - * @param string $domain - * @since RSS 0.92 - */ - public function setCategory($category, $domain) { - $element = $this->getElementsByTagName('category'); - if($element instanceof TXmlElement) { - $element->setValue($category); - $element->setAttribute('domain', $domain); - } else { - $element = new TXmlElement('category'); - $element->setValue($category); - $element->setAttribute('domain', $domain); - $this->getElements()->insertAt(count($this->getElements()), $element); - } - } - - /** - * @param string $comments URL of a page for comments relating to the item. - * @since RSS 2.0 - */ - public function setComments($comments) { - $this->set('comments', $comments); - } - - /** - * @param string $author Email address of the author of the item. - * @since RSS 2.0 - */ - public function setAuthor($author) { - $this->set('author', $author); - } - - /** - * @param string $pubDate Indicates when the item was published. - * @since RSS 2.0 - */ - public function setPublicationDate($pubDate) { - $this->set('pubDate', $pubDate); - } - - /** - * guid stands for globally unique identifier. It's a string that uniquely identifies the - * item. When present, an aggregator may choose to use this string to determine if an item - * is new. - * - * @param string $guid A string that uniquely identifies the item. - * @param bool $isPermaLink If its value is false, the guid may not be assumed to be a url, or a url to anything in particular. - * @since RSS 2.0 - */ - public function setGuid($guid, $isPermaLink = true) { - - } -} - -/** - * TRssFeedItemList class - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - */ -class TRssFeedItemList extends TList { - - - /*public function insertAt($index, TRssFeedItem $item) { - - } - - public function removeAt($index) { - - }*/ - -} - -/** - * TRssFeedImage class - * - * Specifies a GIF, JPEG or PNG image that can be displayed with the channel. - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - */ -class TRssFeedImage extends TFeedElement { - - public function __construct() { - parent::__construct('image'); - } - - /** - * @return string Title of the image. - */ - public function getTitle() { - return $this->get('title'); - } - - /** - * Title describes the image, it's used in the ALT attribute of the HTML tag when the - * channel is rendered in HTML. - * - * @param string $title Title of the image. - */ - public function setTitle($title) { - $this->set('title', $title); - } - - /** - * @return string URL of a GIF, JPEG or PNG image that represents the channel. - */ - public function getUrl() { - return $this->get('url'); - } - - /** - * @param string $url URL of a GIF, JPEG or PNG image that represents the channel. - */ - public function setUrl($url) { - $this->set('url', $url); - } - - /** - * @return string The URL that a user is expected to click on. - */ - public function getLink() { - return $this->get('link'); - } - - /** - * The URL that a user is expected to click on, as opposed to a {@link TRssFeedImage::setUrl} - * that is for loading a resource, such as an image. - * - * The link must start with either "http://" or "ftp://". All other urls are considered - * invalid. - * - * @param string $link The URL that a user is expected to click on. - */ - public function setLink($link) { - if(substr($link, 0, 7) == 'http://' or substr($link, 0, 6) == 'ftp://') { - $this->set('link', $link); - } else { - throw new TInvalidDataValueException('rssfeedimage_link_invalid'); - } - } - - /** - * @return int Width of the image in pixels. - */ - public function getWidth() { - return $this->get('width'); - } - - /** - * The value must be between 1 and 144. If ommitted, the default value is 88. - * - * @param int Width of the image in pixels. - */ - public function setWidth($width) { - if($width >= 1 and $width <= 144) { - $this->set('width', $width); - } else { - throw new TInvalidDataValueException('rssfeedimage_width_invalid', 1, 144); - } - } - - /** - * @return int Height of the image in pixels. - */ - public function getHeight() { - return $this->get('height'); - } - - /** - * The value must be between 1 and 400. If ommitted, the default value is 31. - * - * @param int $height Height of the image in pixels. - */ - public function setHeight($height) { - if($height >= 1 and $height <= 400) { - $this->set('height', $height); - } else { - throw new TInvalidDataValueException('rssfeedimage_height_invalid', 1, 400); - } - } - - /** - * @return string A plain text description of the image. - */ - public function getDescription() { - return $this->get('description'); - } - - /** - * @param string $description A plain text description of the image. - */ - public function setDescription($description) { - $this->set('description', $description); - } - -} - -/** - * TRssFeedTextInput class - * - * The purpose of the textinput element is something of a mystery. You can use it to specify - * a search engine box. Or to allow a reader to provide feedback. Most aggregators ignore it. - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - */ -class TRssFeedTextInput extends TFeedElement { - - public function __construct() { - parent::__construct('textinput'); - } - - /** - * @return string The label of the Submit button in the text input area. - */ - public function getTitle() { - return $this->get('title'); - } - - /** - * @param string $title The label of the Submit button in the text input area. - */ - public function setTitle($title) { - $this->set('title', $title); - } - - /** - * @return string Explains the text input area. - */ - public function getDescription() { - return $this->get('description'); - } - - /** - * @param string $description Explains the text input area. - */ - public function setDescription($description) { - $this->set('description', $description); - } - - /** - * @return string The name of the text object in the text input area. - */ - public function getName() { - return $this->get('name'); - } - - /** - * @param string $name The name of the text object in the text input area. - */ - public function setName($name) { - $this->set('name', $name); - } - - /** - * @return string The URL of the script that processes text input requests. - */ - public function getLink() { - return $this->get('link'); - } - - /** - * @param string $link The URL of the script that processes text input requests. - */ - public function setLink($link) { - $this->set('link', $link); - } -} - - -/** - * TRssFeedCloud class - * - * It specifies a web service that supports the rssCloud interface which can be - * implemented in HTTP-POST, XML-RPC or SOAP 1.1. - * - * Its purpose is to allow processes to register with a cloud to be notified of - * updates to the channel, implementing a lightweight publish-subscribe protocol - * for RSS feeds. - * - * @author Knut Urdalen - * @package System.Xml - * @since 3.1 - * @link http://www.rssboard.org/rsscloud-interface RssCloud API - */ -class TRssFeedCloud extends TFeedElement { - - const PROTOCOL_HTTP_POST = 'HTTP-POST'; - const PROTOCOL_XML_RPC = 'XML-RPC'; - const PROTOCOL_SOAP = 'SOAP'; - - public function __construct() { - parent::__construct('cloud'); - } - - public function getDomain() { - return $this->get('domain'); - } - - public function setDomain($domain) { - $this->set('domain', $domain); - } - - public function getPort() { - return $this->get('port'); - } - - public function setPort($port) { - $this->set('port', $port); - } - - public function getPath() { - return $this->get('path'); - } - - public function setPath($path) { - $this->set('path', $path); - } - - public function getRegisterProcedure() { - return $this->get('registerProcedure'); - } - - public function setRegisterProcedure($registerProcedure) { - $this->set('registerProcedure', $registerProcedure); - } - - public function getProtocol() { - return $this->get('protocol'); - } - - public function setProtocol($protocol) { - if(strcasecmp($protocol, self::PROTOCOL_HTTP_POST) or - strcasecmp($protocol, self::PROTOCOL_XML_RPC) or - strcasecmp($protocol, self::PROTOCOL_SOAP)) { - $this->set('protocol', $protocol); - } else { - throw new TInvalidDataTypeException('rssfeedcloud_protocol_invalid', $protocol); - } - } - - protected function get($name) { - return $this->getAttribute($name)->nodeValue; - } - - protected function set($name, $value) { - $this->setAttribute($name, $value); - } - -} - -?> \ No newline at end of file -- cgit v1.2.3