[pLog-svn] r3574 - plog/trunk/class/action/admin
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Wed Jun 14 09:54:33 GMT 2006
Author: jondaley
Date: 2006-06-14 09:54:33 +0000 (Wed, 14 Jun 2006)
New Revision: 3574
Modified:
plog/trunk/class/action/admin/admindoregisterblogaction.class.php
Log:
added multi-domain code
Modified: plog/trunk/class/action/admin/admindoregisterblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindoregisterblogaction.class.php 2006-06-14 09:53:55 UTC (rev 3573)
+++ plog/trunk/class/action/admin/admindoregisterblogaction.class.php 2006-06-14 09:54:33 UTC (rev 3574)
@@ -4,11 +4,13 @@
include_once( PLOG_CLASS_PATH."class/view/admin/adminregisterblogview.class.php" );
include_once( PLOG_CLASS_PATH."class/view/admin/admindashboardview.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+ include_once( PLOG_CLASS_PATH."class/data/validator/domainvalidator.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
+ include_once( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
class AdminDoRegisterBlogAction extends AdminAction
{
@@ -18,7 +20,9 @@
$this->AdminAction( $actionInfo, $request );
$this->registerFieldValidator( "blogName", new StringValidator());
- $this->registerFieldValidator( "blogLocale", new StringValidator());
+ $this->registerFieldValidator( "blogSubDomain", new DomainValidator());
+ $this->registerFieldValidator( "blogMainDomain", new DomainValidator());
+ $this->registerFieldValidator( "blogLocale", new StringValidator());
$this->registerFieldValidator( "templateId", new StringValidator());
$this->setValidationErrorView( new AdminRegisterBlogView( $this->_userInfo ));
}
@@ -35,7 +39,40 @@
$this->_userInfo->getId(), // owner id
'', // about
''); // settings
- // set the template
+
+ // check to see whether we are going to save subdomain information
+ if( Subdomains::getSubdomainsEnabled()) {
+ // Translate a few characters to valid names, and remove the rest
+ $mainDomain = Textfilter::domainize($this->_request->getValue( "blogMainDomain" ));
+ if(!$mainDomain)
+ $mainDomain = "?";
+ $subDomain = Textfilter::domainize($this->_request->getValue( "blogSubDomain" ));
+
+ if(!Subdomains::isDomainAvailable($mainDomain)){
+ $this->_view = new AdminRegisterBlogView( $this->_userInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_updating_blog_subdomain"));
+ $this->setCommonData();
+ return false;
+ }
+
+ if(!Subdomains::isValidDomainName($subDomain)){
+ $this->_view = new AdminRegisterBlogView( $this->_userInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_updating_blog_subdomain"));
+ $this->setCommonData();
+ return false;
+ }
+
+ if($mainDomain == "?"){
+ $blog_domain = $subDomain;
+ }
+ else{
+ $blog_domain = $subDomain . "." . $mainDomain;
+ }
+
+ $blog->setCustomDomain( $blog_domain );
+ }
+
+ // set the template
$blog->setTemplate( $template );
// set the locale
$locale = Locales::getLocale( $localeCode );
More information about the pLog-svn
mailing list