[pLog-svn] r3559 - in plog/trunk: class/action class/action/adminclass/data class/data/validator class/net/httpclass/summary/action class/summary/view class/view/admin localetemplates/admin templates/summary

Mark Wu markplace at gmail.com
Thu Jun 8 19:14:04 GMT 2006


I never try this.

But will we have a global settings to disable this ?

Not all site admin allow there users use tis function.

If we show these setteing in user blog setting.

It may casue a lot of confusions.

Mark

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> Oscar Renalias
> Sent: Friday, June 09, 2006 3:08 AM
> To: plog-svn at devel.lifetype.net
> Subject: Re: [pLog-svn] r3559 - in plog/trunk: class/action 
> class/action/adminclass/data class/data/validator 
> class/net/httpclass/summary/action class/summary/view 
> class/view/admin localetemplates/admin templates/summary
> 
> Jon,
> 
> I am not sure if you'll have any time but could you give this a try?  
> It should work in exactly the same way you meant it to work.
> 
> I also fixed the subdomain selection process in the registration page.
> 
> Oscar
> 
> On 8 Jun 2006, at 21:31, oscar at devel.lifetype.net wrote:
> 
> > Author: oscar
> > Date: 2006-06-08 18:31:30 +0000 (Thu, 08 Jun 2006) New 
> Revision: 3559
> >
> > Added:
> >    plog/trunk/class/data/validator/domainvalidator.class.php
> > Modified:
> >    plog/trunk/class/action/admin/
> > adminupdateblogsettingsaction.class.php
> >    plog/trunk/class/action/blogaction.class.php
> >    plog/trunk/class/data/textfilter.class.php
> >    plog/trunk/class/net/http/subdomains.class.php
> >    plog/trunk/class/summary/action/doblogregistration.class.php
> >    plog/trunk/class/summary/action/dofinishregister.class.php
> >    plog/trunk/class/summary/action/registeraction.class.php
> >    plog/trunk/class/summary/view/doblogregistrationview.class.php
> >    plog/trunk/class/view/admin/adminblogsettingsview.class.php
> >    plog/trunk/locale/locale_en_UK.php
> >    plog/trunk/templates/admin/blogsettings.template
> >    plog/trunk/templates/admin/globalsettings_general.template
> >    plog/trunk/templates/summary/registerstep2.template
> >    plog/trunk/templates/summary/registerstep3.template
> > Log:
> > merged Jon's support for different domains at the same time
> >
> >
> > Modified: plog/trunk/class/action/admin/ 
> > adminupdateblogsettingsaction.class.php
> > ===================================================================
> > --- plog/trunk/class/action/admin/ 
> > adminupdateblogsettingsaction.class.php	2006-06-08 
> 17:33:01 UTC  
> > (rev 3558)
> > +++ plog/trunk/class/action/admin/
> > adminupdateblogsettingsaction.class.php	2006-06-08 
> 18:31:30 UTC  
> > (rev 3559)
> > @@ -6,7 +6,9 @@
> >      include_once( PLOG_CLASS_PATH."class/data/validator/
> > integervalidator.class.php" );
> >  	include_once( 
> PLOG_CLASS_PATH."class/data/textfilter.class.php" );
> >  	include_once( PLOG_CLASS_PATH."class/view/admin/
> > adminblogsettingsview.class.php" );
> > +    include_once( PLOG_CLASS_PATH."class/data/validator/
> > domainvalidator.class.php" );	
> >  	include_once( PLOG_CLASS_PATH."class/data/validator/rules/
> > intrangerule.class.php" );
> > +	include_once( PLOG_CLASS_PATH."class/net/http/
> > subdomains.class.php" );
> >
> >
> >      /**
> > @@ -50,6 +52,8 @@
> >  			$this->registerField( 
> "blogEnableAutosaveDrafts" );
> >  			$this->registerField( "blogShowInSummary" );
> >  			$this->registerField( "blogSendNotification" );
> > +			$this->registerFieldValidator( 
> "blogSubDomain", new
> > DomainValidator());
> > +			$this->registerFieldValidator( 
> "blogMainDomain", new
> > DomainValidator());			
> >  			// set the view that we're going to use
> >  			$view = new AdminBlogSettingsView( 
> $this->_blogInfo );
> >  			$view->setErrorMessage( $this->_locale->tr 
> > ("error_updating_settings")); @@ -61,6 +65,8 @@
> >           */
> >          function perform()
> >          {
> > +			$config =& Config::getConfig();	
> > +	
> >          	// fetch the settings from the db and update them 
> > accordingly
> >              $blogs = new Blogs();
> >              $blogSettings = 
> $this->_blogInfo->getSettings(); @@ -87,7 
> > +93,42 @@
> >  			$this->_blogInfo->setBlogCategoryId( 
> $this->_request->getValue ( 
> > "blogCategory" ));
> >  			$this->_blogInfo->setMangledBlogName( 
> Textfilter::urlize( $this-
> > >_blogInfo->getBlog()));
> >  			$this->_blogInfo->setShowInSummary
> > ( Textfilter::checkboxToBoolean( $this->_request->getValue ( 
> > "blogShowInSummary" )));
> > +			
> > +            // 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 AdminBlogSettingsView
> > ( $this->_blogInfo );
> > +                    $this->_view->setErrorMessage( $this->_locale-
> > >tr("error_updating_blog_subdomain"));
> > +                    $this->setCommonData();
> > +                    return false;
> > +                }
> > +
> > +				if( 
> Subdomains::isValidDomainName( $mainDomain )) {
> > +	                $this->_view = new AdminBlogSettingsView( $this-
> > >_blogInfo );
> > +	                $this->_view->setErrorMessage( 
> $this->_locale->tr
> > ("error_updating_blog_subdomain"));
> > +	                $this->setCommonData();
> > +	                return false;
> > +				}
> > +
> > +                if($mainDomain == "?"){
> > +					$blog_domain = $subDomain;
> > +                }
> > +                else{
> > +					$blog_domain = 
> $subDomain . "." . $mainDomain;
> > +                }
> > +
> > +				print("blog_domain = $blog_domain" );
> > +
> > +				
> $this->_blogInfo->setCustomDomain( $blog_domain );
> > +            }			
> > +
> >              // and now update the settings in the database
> >              $blogs = new Blogs();
> >
> >
> > Modified: plog/trunk/class/action/blogaction.class.php
> > ===================================================================
> > --- plog/trunk/class/action/blogaction.class.php	2006-06-08  
> > 17:33:01 UTC (rev 3558)
> > +++ plog/trunk/class/action/blogaction.class.php	2006-06-08  
> > 18:31:30 UTC (rev 3559)
> > @@ -206,7 +206,7 @@
> >                      }
> >                  }
> >                  else {
> > -                        // if there is no user parameter, we take  
> > the blogId from the session
> > +                    // if there is no user parameter, we take the
> > blogId from the session
> >                      if( 
> $this->_session->getValue('blogId') != '' ) {
> >                      	$blogId = 
> $this->_session->getValue('blogId');
> >                      }
> >
> > Modified: plog/trunk/class/data/textfilter.class.php
> > ===================================================================
> > --- plog/trunk/class/data/textfilter.class.php	
> 2006-06-08 17:33:01  
> > UTC (rev 3558)
> > +++ plog/trunk/class/data/textfilter.class.php	
> 2006-06-08 18:31:30  
> > UTC (rev 3559)
> > @@ -425,14 +425,37 @@
> >           *
> >           * @param string The string that we wish to convert into 
> > something that can be used as a URL
> >           */
> > +        /**
> > +         * Given a string, convert it into something that can be
> > used in the domain part of a URL
> > +         * (it probably doesn't work very
> > +         * well with non iso-8859-X strings) It will remove the
> > following characters:
> > +         *
> > +         * ; / ? : @ & = + $ ,
> > +         *
> > +         * It will convert accented characters such as ˆ, , ’,
> > etc to
> > +         * their non-accented counterparts (a, e, i) And
> > +         * any other non-alphanumeric character that hasn't been
> > removed
> > +         * or replaced will be thrown away.
> > +         *
> > +         * @param string The string that we wish to convert into
> > something that can be used as a URL
> > +         */
> >          function domainize( $string )
> >          {
> > -            $search  = array('_',' ');
> > -            $replace = array('-','-');
> > +		    // remove unnecessary spaces and make 
> everything lower case
> > +		    $string = preg_replace( "/ +/", " ", 
> strtolower($string) );
> > +
> > +            // removing a set of reserved characters
> > (rfc2396: ; / ? : @ & = + $ ,)
> > +            $string = str_replace(array
> > (';','/','?',':','@','&','=','+','$',','), '', $string);
> > +
> > +            // replace some characters to similar ones
> > +            $search  = array('_','  
> > ','ä','ö','ü','é','è','à','ç','à','è','ì','ò','ù','á','é
> > ','í','ó','ú','ë','ï');
> > +            $replace = array
> > 
> ('-','-','a','o','u','e','e','a','c','a','e','i','o','u','a','
> e','i',' 
> > o','u','e','i');
> >              $string = str_replace($search, $replace, $string);
> > -            $string = Textfilter::urlize($string);
> > +
> > +            // and everything that is still left that hasn't been
> > replaced/encoded, throw it away
> > +            $string = preg_replace( '/[^a-z0-9.-]/', '', $string );
> >              $string = trim($string, "-.");
> > -
> > +
> >              return $string;
> >          }
> >
> >
> > Added: plog/trunk/class/data/validator/domainvalidator.class.php
> > ===================================================================
> > --- 
> plog/trunk/class/data/validator/domainvalidator.class.php	 
> > 2006-06-08 17:33:01 UTC (rev 3558)
> > +++ 
> plog/trunk/class/data/validator/domainvalidator.class.php	 
> > 2006-06-08 18:31:30 UTC (rev 3559)
> > @@ -0,0 +1,32 @@
> > +<?php
> > +
> > +	include_once( PLOG_CLASS_PATH."class/data/validator/
> > validator.class.php" );
> > +	include_once( PLOG_CLASS_PATH."class/data/validator/rules/
> > nonemptyrule.class.php" );
> > +	include_once( PLOG_CLASS_PATH."class/data/validator/rules/
> > filteredwordsrule.class.php" );
> > +	
> > +    /**
> > +     * \ingroup Validator
> > +     *
> > +     * Checks if a domain is valid. Domains have to comply with
> > the following rules:
> > +     *
> > +     * - They must not be empty
> > +     * - They must not be any of the forbidden usernames.  
> > Forbidden domains
> > +     *   (and usernames) can be configured via the  
> > 'forbidden_usernames'
> > +     *   configuration parameter.
> > +     *
> > +     * @see NonEmptyRule
> > +     * @see FilteredWordsRule
> > +     */
> > +    class DomainValidator extends Validator
> > +    {
> > +    	function DomainValidator()
> > +        {
> > +        	$this->Validator();
> > +//        	$this->addRule( new NonEmptyRule());
> > +			$config =& Config::getConfig();
> > +			$forbiddenDomainNames = $config->getValue
> > ( "forbidden_usernames", "" );
> > +			$forbiddenDomainNamesArray = explode( " ",
> > $forbiddenDomainNames );
> > +			$this->addRule( new FilteredWordsRule
> > ( $forbiddenDomainNamesArray ));
> > +        }
> > +    }
> > +?>
> > \ No newline at end of file
> >
> > Modified: plog/trunk/class/net/http/subdomains.class.php
> > ===================================================================
> > --- plog/trunk/class/net/http/subdomains.class.php	2006-06-08  
> > 17:33:01 UTC (rev 3558)
> > +++ plog/trunk/class/net/http/subdomains.class.php	2006-06-08  
> > 18:31:30 UTC (rev 3559)
> > @@ -63,5 +63,72 @@
> >  			// return it...
> >  			return( $isSubdomain );
> >  		}
> > +		
> > +		/**
> > +		 * Returns true if subdomains are enabled in 
> one way or another
> > in the configuration
> > +		 *
> > +		 * @return True if enabled or false otherwise
> > +	     * @static		
> > +		 */
> > +		function getSubdomainsEnabled()
> > +		{
> > +			include_once( PLOG_CLASS_PATH."class/config/
> > config.class.php" );			
> > +			$config =& Config::getConfig();
> > +			
> > +            $blog_domains_enabled =
> > +                ($config->getValue("subdomains_enabled", 0) &&
> > +                
> (strpos($config->getValue("subdomains_base_url", ""),
> > +                        "{blogdomain}") !== FALSE));
> > +
> > +			return( $blog_domains_enabled );
> > +		}
> > +		
> > +		/**
> > +		 * Returns an array with the list of available domains
> > +		 *
> > +		 * @return True if successful or false otherwise
> > +		 */
> > +		function getAvailableDomains()
> > +		{
> > +			include_once( 
> PLOG_CLASS_PATH."class/config/config.class.php" );
> > +			$config =& Config::getConfig();
> > +			
> > +            $available_domains = $config->getValue
> > ("subdomains_available_domains", "");
> > +            if($available_domains){
> > +                $available_domains = explode(" ",
> > $available_domains);
> > +            }
> > +
> > +			return( $available_domains );
> > +		}
> > +		
> > +		/**
> > +		 * Returns true if the given domain name is one 
> of the available
> > ones
> > +		 *
> > +		 * @param domain The domain name we'd like to check
> > +		 * @return True if successful or false otherwise
> > +	     * @static
> > +		 * @see Subdomains::getAvailableDomains
> > +		 */		
> > +		function isDomainAvailable( $domain )
> > +		{
> > +			$domains = Subdomains::getAvailableDomains();
> > +			return( array_key_exists( $domain, 
> array_flip( $domains )));
> > +		}
> > +		
> > +		/**
> > +		 * Returns true if the given subdomain name is 
> valid (i.e.  
> > complies with the domain naming restrictions)
> > +		 *
> > +		 * @param domain The name we'd like to check
> > +		 * @return True if successful or false otherwise
> > +		 */
> > +		function isValidDomainName( $domain )
> > +		{
> > +            // Use forbidden_usernames for domains as well, since
> > they are related
> > +            // in that we don't want people to register www.xyz or
> > forums.xyz
> > +            // through these subdomains either
> > +			include_once( 
> PLOG_CLASS_PATH."class/data/validator/
> > usernamevalidator.class.php" );
> > +			$val =  new UsernameValidator();
> > +			return( $val->validate( $domain ));
> > +		}
> >  	}
> >  ?>
> > \ No newline at end of file
> >
> > Modified: 
> plog/trunk/class/summary/action/doblogregistration.class.php
> > ===================================================================
> > --- 
> plog/trunk/class/summary/action/doblogregistration.class.php	 
> > 2006-06-08 17:33:01 UTC (rev 3558)
> > +++ 
> plog/trunk/class/summary/action/doblogregistration.class.php	 
> > 2006-06-08 18:31:30 UTC (rev 3559)
> > @@ -7,6 +7,8 @@
> >  	include_once( PLOG_CLASS_PATH."class/summary/view/
> > doblogregistrationview.class.php" );
> >  	include_once( PLOG_CLASS_PATH."class/summary/view/
> > blogtemplatechooserview.class.php" );
> >  	include_once( 
> PLOG_CLASS_PATH."class/locale/locales.class.php" );
> > +    include_once( PLOG_CLASS_PATH."class/data/validator/
> > domainvalidator.class.php" );
> > +	include_once( PLOG_CLASS_PATH."class/net/http/
> > subdomains.class.php" );
> >
> >  	/**
> >  	 * registers a blog
> > @@ -23,20 +25,57 @@
> >  	    	$this->registerFieldValidator( "blogName", new 
> > StringValidator());
> >  	    	$this->registerFieldValidator( "blogCategoryId", new 
> > IntegerValidator());
> >  	    	$this->registerFieldValidator( "blogLocale", new 
> > StringValidator());
> > +			$this->registerFieldValidator( 
> "blogSubDomain", new
> > DomainValidator(), true );
> > +			$this->registerFieldValidator( 
> "blogMainDomain", new
> > DomainValidator(), true );
> >  	    	$view = new doBlogRegistrationView();
> >  	    	$view->setErrorMessage( $this->_locale->tr 
> > ("register_error_creating_blog"));
> >  	    	$this->setValidationErrorView( $view );
> >          }
> >
> > +		function validate()
> > +		{
> > +			// if the other fields did not 
> validate, no need to continue
> > +			if( !parent::validate())
> > +				return false;
> > +				
> > +            // check to see whether we are going to save subdomain
> > information
> > +			$valid = true;
> > +            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" ));
> > +
> > +                // get list of allowed domains
> > +				$available_domains = 
> Subdomains::getAvailableDomains();
> > +
> > +                // make sure the mainDomain parameter is one of
> > the blogAvailableDomains and if not,
> > +				// force a validation error
> > +                if( !Subdomains::isDomainAvailable( $mainDomain )
> > || !Subdomains::isValidDomainName( $subDomain )) {
> > +					$valid = false;
> > +					
> $this->_form->setFieldValidationStatus( "blogSubDomain",
> > false );					
> > +					
> $this->validationErrorProcessing();
> > +                }
> > +
> > +                if($mainDomain == "?")
> > +                    $this->blogDomain = $subDomain;
> > +                else
> > +                    $this->blogDomain = $subDomain . "." .  
> > $mainDomain;
> > +            }
> > +
> > +			return( $valid );
> > +		}
> > +
> >          function perform()
> >          {
> > -            // validated values
> > -            $tf = new Textfilter();
> > -			
> >              // create the new view and clean the cache
> >              $this->_view = new BlogTemplateChooserView();
> >              $this->setValues();
> >              $this->setCommonData();
> > +
> > +			return( true );
> >          }
> >      }
> > -?>
> > +?>
> > \ No newline at end of file
> >
> > Modified: plog/trunk/class/summary/action/dofinishregister.class.php
> > ===================================================================
> > --- 
> plog/trunk/class/summary/action/dofinishregister.class.php	 
> > 2006-06-08 17:33:01 UTC (rev 3558)
> > +++ 
> plog/trunk/class/summary/action/dofinishregister.class.php	 
> > 2006-06-08 18:31:30 UTC (rev 3559)
> > @@ -100,6 +100,7 @@
> >          function createBlog($userId)
> >  		{
> >              $this->blogName = stripslashes($this->_request-
> > >getValue("blogName"));
> > +            $this->blogDomain = stripslashes($this->_request-
> > >getValue("blogDomain"));
> >              $this->blogCategoryId = $this->_request->getValue 
> > ("blogCategoryId");
> >              $this->blogLocale = $this->_request->getValue 
> > ("blogLocale");
> >              $this->templateId = $this->_request->getValue 
> > ("templateId"); @@ -118,6 +119,12 @@
> >              $blogInfo->setLocale( $locale );
> >              $blogInfo->setTemplate( $this->templateId );
> >              $blogInfo->setBlogCategoryId( $this->blogCategoryId );
> > +
> > +            if( Subdomains::getSubdomainsEnabled()) {
> > +				$blogDomain = 
> $this->_request->getValue( "blogDomain" );
> > +				$blogInfo->setCustomDomain( 
> $blogDomain );
> > +            }			
> > +
> >              $newblogId = $blogs->addBlog( $blogInfo );
> >
> >              if( !$newblogId ) {
> >
> > Modified: plog/trunk/class/summary/action/registeraction.class.php
> > ===================================================================
> > --- 
> plog/trunk/class/summary/action/registeraction.class.php	 
> > 2006-06-08 17:33:01 UTC (rev 3558)
> > +++ 
> plog/trunk/class/summary/action/registeraction.class.php	 
> > 2006-06-08 18:31:30 UTC (rev 3559)
> > @@ -20,6 +20,7 @@
> >      var $blogCategoryId;
> >      var $blogLocale;
> >      var $templateId;
> > +    var $blogDomain;
> >      //}}}
> >
> >      //{{{function RegisterAction( $actionInfo, $request ) @@ -29,6 
> > +30,7 @@
> >  		
> >  		$tf = new Textfilter();
> >          $this->blogName = $tf->filterAllHTML( $this->_request-
> > >getValue( "blogName" ));
> > +        $this->blogDomain = $tf->filterAllHTML( $this->_request-
> > >getValue( "blogDomain" ));
> >          $this->blogCategoryId = $this->_request->getValue ( 
> > "blogCategoryId" );
> >          $this->blogLocale = $this->_request->getValue ( 
> "blogLocale" 
> > );
> >          $this->userName = $tf->filterAllHTML($this->_request-
> > >getValue( "userName" ));
> > @@ -55,6 +57,7 @@
> >          $this->_view->setValue( "userEmail", $this->userEmail );
> >          $this->_view->setValue( "blogName", $this->blogName );
> >          $this->_view->setValue( "blogCategoryId", $this-
> > >blogCategoryId );
> > +        $this->_view->setValue( "blogDomain", $this->blogDomain );
> >          $this->_view->setValue( "blogLocale", $this->blogLocale );
> >          $this->_view->setValue( "templateId", $this->templateId );
> >      }
> >
> > Modified: plog/trunk/class/summary/view/ 
> > doblogregistrationview.class.php 
> > ===================================================================
> > --- 
> plog/trunk/class/summary/view/doblogregistrationview.cl
> ass.php	 
> > 2006-06-08 17:33:01 UTC (rev 3558)
> > +++ 
> plog/trunk/class/summary/view/doblogregistrationview.cl
> ass.php	 
> > 2006-06-08 18:31:30 UTC (rev 3559)
> > @@ -3,6 +3,7 @@
> >  	include_once( PLOG_CLASS_PATH."class/summary/view/
> > summaryview.class.php" );
> >  	include_once( 
> PLOG_CLASS_PATH."class/locale/locales.class.php" );
> >  	include_once( PLOG_CLASS_PATH."class/dao/ 
> blogcategories.class.php" 
> > );
> > +	include_once( PLOG_CLASS_PATH."class/net/http/
> > subdomains.class.php" );
> >  	
> >  	/**
> >  	 * shows a list with all the locales so that users can 
> choose, too 
> > @@ -28,8 +29,14 @@
> >  			// get a list of blog categories, so we 
> can let user to choose
> >  			$blogCategories = new BlogCategories();
> >  			$categories = 
> $blogCategories->getBlogCategories();
> > -			$this->setValue( "blogCategories", 
> $categories );
> > +			$this->setValue( "blogCategories", 
> $categories );
> >  			
> > +			// enable or disable the drop-down list 
> to select subdomains
> > +			if( Subdomains::getSubdomainsEnabled()) {
> > +				$this->setValue( 
> "blogDomainsEnabled", true );
> > +				$this->setValue( "blogAvailableDomains",
> > Subdomains::getAvailableDomains());
> > +			}
> > +			
> >  			// and render the rest of the contents 
> of the view
> >  			parent::render();
> >  		}
> >
> > Modified: 
> plog/trunk/class/view/admin/adminblogsettingsview.class.php
> > ===================================================================
> > --- 
> plog/trunk/class/view/admin/adminblogsettingsview.class.php	 
> > 2006-06-08 17:33:01 UTC (rev 3558)
> > +++ 
> plog/trunk/class/view/admin/adminblogsettingsview.class.php	 
> > 2006-06-08 18:31:30 UTC (rev 3559)
> > @@ -4,6 +4,7 @@
> >  	include_once( PLOG_CLASS_PATH."class/template/templatesets/
> > templatesets.class.php" );
> >  	include_once( 
> PLOG_CLASS_PATH."class/locale/locales.class.php" );
> >  	include_once( PLOG_CLASS_PATH."class/dao/ 
> blogcategories.class.php" 
> > );
> > +	include_once( PLOG_CLASS_PATH."class/net/http/
> > subdomains.class.php" );
> >  	
> >      /**
> >       * \ingroup View
> > @@ -18,6 +19,8 @@
> >  		{
> >  			$this->AdminTemplatedView( $blogInfo, 
> "blogsettings" );
> >  			
> > +			$config =& Config::getConfig();			
> > +			
> >              $blogSettings = $blogInfo->getSettings();
> >  			$this->setValue( "blogAbout", 
> $this->_blogInfo->getAbout());
> >  			$this->setValue( "blogName", 
> $this->_blogInfo->getBlog()); @@ 
> > -40,6 +43,37 @@
> >  			$this->setValue( "blogCategory", 
> $this->_blogInfo-
> > >getBlogCategoryId());
> >  			$this->setValue( "blogShowInSummary", 
> $this->_blogInfo-
> > >getShowInSummary());
> >  			$this->setValue( 
> "blogSendNotification", $blogSettings->getValue ( 
> > "default_send_notification" ));
> > +			
> > +            // only do blog_domain stuff if subdomains are enabled
> > +            // Don't waste time here, as well as be less 
> confusing by
> > +            // not showing the option to users who can't use it
> > +            if( Subdomains::getSubdomainsEnabled()) {
> > +                $domain = $this->_blogInfo->getCustomDomain();
> > +
> > +				$available_domains = 
> Subdomains::getAvailableDomains();
> > +
> > +                // default to any domain, this will be overwritten
> > +                // if the domain is found in the available_domains
> > array
> > +                $subdomain = $domain;
> > +                $maindomain = "?";
> > +
> > +                foreach($available_domains as $avdomain){
> > +	                // search to see if domain suffix is on
> > +	                // the available_domain list.
> > +	                $found = strpos($domain, $avdomain);
> > +	                if($found !== FALSE && $found == 
> (strlen($domain)
> > - strlen($avdomain))){
> > +	                $subdomain = substr($domain, 0, $found-1);
> > +	                $maindomain = $avdomain;
> > +	                break;
> > +	                }
> > +                }
> > +
> > +                // pass the domain information to the view
> > +                $this->setValue( "blogSubDomain", $subdomain );
> > +                $this->setValue( "blogMainDomain", $maindomain );
> > +                $this->setValue( "blogAvailableDomains",
> > $available_domains );
> > +                $this->setValue( "blogDomainsEnabled", 1 );
> > +            }			
> >  		}
> >  		
> >  		function render()
> >
> > Modified: plog/trunk/locale/locale_en_UK.php
> > ===================================================================
> > --- plog/trunk/locale/locale_en_UK.php	2006-06-08 
> 17:33:01 UTC (rev  
> > 3558)
> > +++ plog/trunk/locale/locale_en_UK.php	2006-06-08 
> 18:31:30 UTC (rev  
> > 3559)
> > @@ -688,7 +688,6 @@
> >  $messages['help_temp_folder'] = 'Folder that LifeType can use to 
> > write its temporary data such as compiled templates, etc. 
> Use a folder 
> > outside the web server tree for increased security [Default 
> = ./tmp]';  
> > $messages['help_base_url'] = 'Base URL where this blog is 
> installed';  
> > $messages['help_subdomains_enabled'] = 'Enable or disable 
> subdomains. 
> > Please see the documentation for more information regarding 
> subdomains 
> > [Default = No]'; -$messages['help_subdomains_base_url'] = 'When 
> > subdomains are enabled, this base URL is used instead of 
> base_url. Use 
> > {blogname} to get the blog name and {username} to get the 
> name of the 
> > user owner of the blog in order to generate a link to a blog. (i.e.
> > http://{blogname}.yourdomain.com)';
> >  $messages['help_include_blog_id_in_url'] = 'Meaningful only when 
> > subdomains are enabled and "normal" URLs are enabled, forces 
> > internally-generated URLs not to have the "blogId" 
> parameter. Do not 
> > change unless you know what you are doing [Default = Yes]';  
> > $messages['help_script_name'] = 'Set this if you need to rename 
> > index.php to something else [Default = index.php]';  
> > $messages['help_show_posts_max'] = 'Maximum number of posts 
> shown in 
> > the main page. Only meaningful for new blogs [Default = 15]'; @@ 
> > -1041,6 +1040,11 @@  $messages['first_day_of_week_label'] = 
> 'First Day 
> > of Week';  $messages['first_day_of_week_help'] = 'First Day 
> of Week in 
> > calendar';
> >
> > +$messages['help_subdomains_base_url'] = 'When subdomains are
> > enabled, this base URL is used instead of base_url. Use 
> {blogname} to 
> > get the blog name, {username} to get the name of the user 
> owner of the 
> > blog and {blogdomain} to allow the user to specify any subdomain in 
> > order to generate a link to a blog. (e.g.. http:// 
> > {blogname}.yourdomain.com)';
> > +
> >  $messages['registration_default_subject'] = 'LifeType registration 
> > confirmation';
> >
> > +$messages['error_invalid_subdomain'] = 'The subdomain name is not
> > valid or it is not unique';
> > +$messages['register_blog_domain_help'] = 'Name and subdomain that
> > you would like to use for your new blog';
> > +$messages['domain'] = 'Domain';
> >  ?>
> > \ No newline at end of file
> >
> > Modified: plog/trunk/templates/admin/blogsettings.template
> > ===================================================================
> > --- plog/trunk/templates/admin/blogsettings.template	
> 2006-06-08  
> > 17:33:01 UTC (rev 3558)
> > +++ plog/trunk/templates/admin/blogsettings.template	
> 2006-06-08  
> > 18:31:30 UTC (rev 3559)
> > @@ -15,7 +15,29 @@
> >        {include file="$admintemplatepath/validate.template"  
> > field=blogName message=$locale->tr("error_empty_name")}
> >      </div>
> >
> > +    {if $blogDomainsEnabled}
> >      <div class="field">
> > +      <label for="blogSubDomain">{$locale->tr("domain")}</label>
> > +      <div class="formHelp">{$locale->tr
> > ("register_blog_domain_help")}</div>
> > +      <input type="text" name="blogSubDomain" id="blogSubDomain"  
> > style="width:150px" value="{$blogSubDomain}" />
> > +      <select name="blogMainDomain" id="blogMainDomain">
> > +       {foreach from=$blogAvailableDomains item=domain}
> > +        <option value="{$domain}"
> > +             {if $domain == $blogMainDomain}selected{/if}>
> > +             {if $domain == "?"}
> > +               {$locale->tr("subdomains_any_domain")}
> > +             {else}
> > +               .{$domain}
> > +             {/if}
> > +        </option>
> > +       {/foreach}
> > +      </select>
> > +      {include file="$admintemplatepath/validate.template"  
> > field=blogSubDomain message=$locale->tr("error_invalid_subdomain")}
> > +      {include file="$admintemplatepath/validate.template"  
> > field=blogMainDomain message=$locale->tr("error_invalid_domain")}
> > +    </div>
> > +    {/if}
> > +
> > +    <div class="field">
> >        <label for="blogAbout">{$locale->tr("description")}</label>
> >        <span class="required"></span>
> >        <div class="formHelp">{$locale->tr("blog_description_help")}
> > </div>
> >
> > Modified: plog/trunk/templates/admin/globalsettings_general.template
> > ===================================================================
> > --- 
> plog/trunk/templates/admin/globalsettings_general.template	 
> > 2006-06-08 17:33:01 UTC (rev 3558)
> > +++ 
> plog/trunk/templates/admin/globalsettings_general.template	 
> > 2006-06-08 18:31:30 UTC (rev 3559)
> > @@ -38,6 +38,12 @@
> >      <div class="formHelp">{$locale->tr("help_subdomains_base_url")}
> > </div>
> >      <input style="width:100%" type="text" name="config 
> > [subdomains_base_url]" value="{$subdomains_base_url}"/>
> >     </div>
> > +   <!-- subdomains_available_domains -->
> > +   <div class="field">
> > +    <label for="config
> > [subdomains_available_domains]">subdomains_available_domains</label>
> > +    <div class="formHelp">{$locale->tr
> > ("help_subdomains_available_domains")}</div>
> > +    <input style="width:100%" type="text" name="config
> > [subdomains_available_domains]"  
> > value="{$subdomains_available_domains}"/>
> > +   </div>
> >     <!-- include_blog_id_in_url -->
> >     <div class="field">
> >      <label for="config
> > [include_blog_id_in_url]">include_blog_id_in_url</label>
> >
> > Modified: plog/trunk/templates/summary/registerstep2.template
> > ===================================================================
> > --- plog/trunk/templates/summary/registerstep2.template	
> 2006-06-08  
> > 17:33:01 UTC (rev 3558)
> > +++ plog/trunk/templates/summary/registerstep2.template	
> 2006-06-08  
> > 18:31:30 UTC (rev 3559)
> > @@ -10,7 +10,30 @@
> >       <input type="text" name="blogName" value="{$blogName}"  
> > id="blogName" />
> >       {include file="summary/validate.template" field=blogName 
> > message=$locale->tr("error_empty_name")}
> >     </div>
> > +
> > +   {if $blogDomainsEnabled}
> >     <div class="field">
> > +     <label for="blogSubDomain">{$locale->tr("domain")}</label>
> > +	 <span class="required">*</span>
> > +     <div class="formHelp">{$locale->tr
> > ("register_blog_domain_help")}</div>
> > +     <input type="text" name="blogSubDomain" id="blogSubDomain"  
> > style="width:150px" value="{$blogSubDomain}" />
> > +     <select name="blogMainDomain" id="blogMainDomain">
> > +      {foreach from=$blogAvailableDomains item=domain}
> > +       <option value="{$domain}" {if $domain == $blogMainDomain}
> > selected{/if}>
> > +            {if $domain == "?"}
> > +              {$locale->tr("subdomains_any_domain")}
> > +            {else}
> > +              .{$domain}
> > +            {/if}
> > +       </option>
> > +      {/foreach}
> > +     </select>
> > +     {include file="summary/validate.template" field=blogSubDomain
> > message=$locale->tr("error_invalid_subdomain")}
> > +     {include file="summary/validate.template"  
> > field=blogMainDomain message=$locale->tr("error_invalid_domain")}
> > +   </div>
> > +   {/if}
> > +
> > +   <div class="field">
> >       <label for="blogCategoryId">{$locale->tr("blog_category")}</
> > label>
> >       <span class="required">*</span>
> >       <div 
> class="formHelp">{$locale->tr("blog_category_help")}</div>
> > @@ -20,6 +43,7 @@
> >        {/foreach}
> >       </select>
> >     </div>
> > +
> >     <div class="field">
> >       <label for="blogLocale">{$locale->tr("language")}</label>
> >       <span class="required">*</span>
> >
> > Modified: plog/trunk/templates/summary/registerstep3.template
> > ===================================================================
> > --- plog/trunk/templates/summary/registerstep3.template	
> 2006-06-08  
> > 17:33:01 UTC (rev 3558)
> > +++ plog/trunk/templates/summary/registerstep3.template	
> 2006-06-08  
> > 18:31:30 UTC (rev 3559)
> > @@ -31,6 +31,7 @@
> >      <!-- <input type="button"  
> > 
> onClick="javascript:window.location='summary.php?op=RegisterStep3'"  
> > value="&laquo; {$locale->tr("register_back")}" name="Register"/> -->
> >      <input type="submit" name="{$locale->tr("register_next")}"  
> > value="{$locale->tr("register_next")} &raquo;"/>
> >      <input type="hidden" name="userName" value="{$userName}"/>
> > +    <input type="hidden" name="blogDomain" value="{$blogDomain}"/>
> >      <input type="hidden" name="userFullName"  
> > value="{$userFullName}"/>
> >      <input type="hidden" name="userPassword"  
> > value="{$userPassword}"/>
> >      <input type="hidden" name="userEmail" value="{$userEmail}"/>
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
> 
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn



More information about the pLog-svn mailing list