[pLog-svn] r3854 - in plog/trunk/class: action/admin dao net
test/tests/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Aug 10 17:10:40 GMT 2006
Author: oscar
Date: 2006-08-10 17:10:38 +0000 (Thu, 10 Aug 2006)
New Revision: 3854
Modified:
plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
plog/trunk/class/dao/bloginfo.class.php
plog/trunk/class/net/baserequestgenerator.class.php
plog/trunk/class/test/tests/dao/bloginfo_test.class.php
Log:
fixed issue 1006 (http://bugs.lifetype.net/view.php?id=1006). Additionally BlogInfo::setMangledBlogName() will run Textfilter::domainize by itself so the calling class doesn't need to do it. This also means that all classes calling BlogInfo::getMangledBlogName() can trust its output, and that it's not necessary to call domainize() again on its result (like BaseRequestGenerator was doing so far)
Modified: plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php 2006-08-09 18:44:08 UTC (rev 3853)
+++ plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php 2006-08-10 17:10:38 UTC (rev 3854)
@@ -93,7 +93,7 @@
$this->_blogInfo->setTemplate( $this->_request->getValue( "blogTemplate" ));
$this->_blogInfo->setProperties( $this->_request->getValue( "properties" ));
$this->_blogInfo->setBlogCategoryId( $this->_request->getValue( "blogCategory" ));
- $this->_blogInfo->setMangledBlogName( Textfilter::urlize( $this->_blogInfo->getBlog()));
+ $this->_blogInfo->setMangledBlogName( $this->_blogInfo->getBlog());
$this->_blogInfo->setShowInSummary( Textfilter::checkboxToBoolean( $this->_request->getValue( "blogShowInSummary" )));
// check to see whether we are going to save subdomain information
Modified: plog/trunk/class/dao/bloginfo.class.php
===================================================================
--- plog/trunk/class/dao/bloginfo.class.php 2006-08-09 18:44:08 UTC (rev 3853)
+++ plog/trunk/class/dao/bloginfo.class.php 2006-08-10 17:10:38 UTC (rev 3854)
@@ -611,7 +611,8 @@
*/
function setMangledBlogName( $mangledBlog )
{
- $this->_mangledBlog = $mangledBlog;
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+ $this->_mangledBlog = Textfilter::domainize( $mangledBlog );
}
/**
@@ -620,8 +621,10 @@
function getMangledBlogName()
{
// fill in the field if it hasn't been filled yet
- if( $this->_mangledBlog === null )
- $this->_mangledBlog = Textfilter::urlize( $this->getBlog());
+ if( $this->_mangledBlog === null ) {
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+ $this->_mangledBlog = Textfilter::domainize( $this->getBlog());
+ }
return( $this->_mangledBlog );
}
@@ -634,6 +637,7 @@
*/
function setCustomDomain($customDomain)
{
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
$this->_customDomain = Textfilter::domainize($customDomain);
}
@@ -642,8 +646,9 @@
*/
function getCustomDomain()
{
- // fill in the field if it hasn't been filled yet
+ // fill in the field if it hasn't been filled yet
if($this->_customDomain === null){
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
$this->_customDomain = Textfilter::domainize($this->getMangledBlog());
}
Modified: plog/trunk/class/net/baserequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/baserequestgenerator.class.php 2006-08-09 18:44:08 UTC (rev 3853)
+++ plog/trunk/class/net/baserequestgenerator.class.php 2006-08-10 17:10:38 UTC (rev 3854)
@@ -79,11 +79,11 @@
// prepare the correct url if subdomains are enabled...
if( $this->_subdomainsEnabled && $blogInfo != null ) {
$this->_subdomainsBaseUrl = str_replace("{blogname}",
- Textfilter::domainize($blogInfo->getMangledBlog()),
+ $blogInfo->getMangledBlog(),
$this->_subdomainsBaseUrl);
$ownerInfo = $blogInfo->getOwnerInfo();
$this->_subdomainsBaseUrl = str_replace("{username}",
- Textfilter::domainize($ownerInfo->getUsername()),
+ $ownerInfo->getUsername(),
$this->_subdomainsBaseUrl);
$this->_subdomainsBaseUrl = str_replace("{blogdomain}",
$blogInfo->getCustomDomain(),
Modified: plog/trunk/class/test/tests/dao/bloginfo_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/bloginfo_test.class.php 2006-08-09 18:44:08 UTC (rev 3853)
+++ plog/trunk/class/test/tests/dao/bloginfo_test.class.php 2006-08-10 17:10:38 UTC (rev 3854)
@@ -31,5 +31,36 @@
$this->assertFalse( $sameDate, "Please see Mantis case 978 <a href='http://bugs.lifetype.net/view.php?id=978'>here</a>." );
}
+
+ /**
+ * no html allowed in the blog name
+ */
+ function testSetBlogNoHtmlAllowed()
+ {
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+ $blogNameHtml = "<h1>This is</h1>some <script type=\"text/javascript\">window.alert('hello!');</script>HTML!";
+
+ $blog = new BlogInfo( "blah", 1, "blah blah", new BlogSettings());
+
+ $blog->setBlog( $blogNameHtml );
+
+ $tf = new Textfilter();
+ $this->assertEquals( $tf->filterAllHTML($blogNameHtml), $blog->getBlog());
+ }
+
+ /**
+ * regression test for mantis case 1006 (http://bugs.lifetype.net/view.php?id=1006)
+ * BlogInfo::setMangledBlogName() should re-run Textfilter::domainize() on blog names
+ */
+ function testSetMangledBlogName()
+ {
+ $blogName = "this_is_a_blog____ name";
+
+ $blog = new BlogInfo( "blah", 1, "blah blah", new BlogSettings());
+
+ $blog->setMangledBlogName( $blogName );
+
+ $this->assertEquals( Textfilter::domainize( $blogName ), $blog->getMangledBlogName());
+ }
}
?>
\ No newline at end of file
More information about the pLog-svn
mailing list