[pLog-svn] r7214 - in plog/branches/lifetype-1.2: class/action/admin class/dao class/net class/net/http class/template/smarty/plugins class/view/admin locale/admin templates/admin

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Wed Aug 7 15:40:57 EDT 2013


Author: jondaley
Date: 2013-08-07 15:40:57 -0400 (Wed, 07 Aug 2013)
New Revision: 7214

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminupdateblogsettingsaction.class.php
   plog/branches/lifetype-1.2/class/dao/blogsettings.class.php
   plog/branches/lifetype-1.2/class/net/baserequestgenerator.class.php
   plog/branches/lifetype-1.2/class/net/http/httpclient.class.php
   plog/branches/lifetype-1.2/class/net/http/subdomains.class.php
   plog/branches/lifetype-1.2/class/template/smarty/plugins/function.fetch.php
   plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php
   plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php
   plog/branches/lifetype-1.2/templates/admin/blogsettings.template
Log:
allow SSL to be used for just some blogs in a multi-domain installation, rather than only for all blogs or none.  I've updated the wiki with the (relatively straightforward) instructions for doing this.  http://wiki.lifetype.net/index.php/Users_FAQ#How_can_I_use_.22https:.2F.2F.22_URLs_with_LifeType.3F

Modified: plog/branches/lifetype-1.2/class/action/admin/adminupdateblogsettingsaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminupdateblogsettingsaction.class.php	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/class/action/admin/adminupdateblogsettingsaction.class.php	2013-08-07 19:40:57 UTC (rev 7214)
@@ -117,6 +117,7 @@
         	// fetch the settings from the db and update them accordingly
             $blogs = new Blogs();
             $blogSettings = $this->_blogInfo->getSettings();
+           	$blogSettings->setValue( "use_ssl",  Textfilter::checkboxToBoolean($this->_request->getValue( "blogUseSsl" )));
             $blogSettings->setValue( "locale", $this->_request->getValue( "blogLocale" ));
             $blogSettings->setValue( "show_posts_max", $this->_request->getValue( "blogMaxMainPageItems" ));
             $blogSettings->setValue( "recent_posts_max", $this->_request->getValue( "blogMaxRecentItems" ));

Modified: plog/branches/lifetype-1.2/class/dao/blogsettings.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/blogsettings.class.php	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/class/dao/blogsettings.class.php	2013-08-07 19:40:57 UTC (rev 7214)
@@ -32,6 +32,7 @@
 		{
 			$config =& Config::getConfig();
 
+			$this->setValue( "use_ssl", 0 );
 			$this->setValue( "locale", $config->getValue("default_locale"));
 			$this->setValue( "show_posts_max", $config->getValue( "show_posts_max" ));
 			$this->setValue( "template", $config->getValue("default_template"));

Modified: plog/branches/lifetype-1.2/class/net/baserequestgenerator.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/net/baserequestgenerator.class.php	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/class/net/baserequestgenerator.class.php	2013-08-07 19:40:57 UTC (rev 7214)
@@ -91,7 +91,16 @@
                 $this->_subdomainsBaseUrl = str_replace("{blogdomain}",
                                                         $blogInfo->getCustomDomain(),
                                                         $this->_subdomainsBaseUrl);
+
+					// If blog wants ssl, modify the URL for them
+				$blogSettings = $blogInfo->getSettings();
+				if($blogSettings->getValue("use_ssl")){
+					$this->_subdomainsBaseUrl = str_replace("http://", "https://", $this->_subdomainsBaseUrl);
+				}
 			}
+
+
+			
             $this->_scriptName = $config->getValue( "script_name", DEFAULT_SCRIPT_NAME );
 			
 			// enable the xhtml mode by default, but it can be turned off

Modified: plog/branches/lifetype-1.2/class/net/http/httpclient.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/net/http/httpclient.class.php	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/class/net/http/httpclient.class.php	2013-08-07 19:40:57 UTC (rev 7214)
@@ -168,7 +168,7 @@
 							if($this->maxredirs > $this->_redirectdepth)
 							{
 								// only follow redirect if it's on this site, or offsiteok is true
-								if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
+								if(preg_match("|^https?://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
 								{
 									/* follow the redirect */
 									$this->_redirectdepth++;
@@ -228,7 +228,7 @@
 						if($this->maxredirs > $this->_redirectdepth)
 						{
 							// only follow redirect if it's on this site, or offsiteok is true
-							if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
+							if(preg_match("|^https?://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
 							{
 								/* follow the redirect */
 								$this->_redirectdepth++;
@@ -323,7 +323,7 @@
 									$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);						
 
 								// only follow redirect if it's on this site, or offsiteok is true
-								if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
+								if(preg_match("|^https?://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
 								{
 									/* follow the redirect */
 									$this->_redirectdepth++;
@@ -390,7 +390,7 @@
 								$this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);						
 
 							// only follow redirect if it's on this site, or offsiteok is true
-							if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
+							if(preg_match("|^https?://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
 							{
 								/* follow the redirect */
 								$this->_redirectdepth++;
@@ -752,9 +752,9 @@
 			$match_root =
 			$match_part["scheme"]."://".$match_part["host"];
 
-			$search = array( 	"|^http://".preg_quote($this->host)."|i",
+			$search = array( 	"|^https?://".preg_quote($this->host)."|i",
 								"|^(\/)|i",
-								"|^(?!http://)(?!mailto:)|i",
+								"|^(?!https?://)(?!mailto:)|i",
 								"|/\./|",
 								"|/[^\/]+/\.\./|"
 							);

Modified: plog/branches/lifetype-1.2/class/net/http/subdomains.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/net/http/subdomains.class.php	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/class/net/http/subdomains.class.php	2013-08-07 19:40:57 UTC (rev 7214)
@@ -44,7 +44,12 @@
 			// prepare the url
 			if( $url == null ) {
 				$server = HttpVars::getServer();
-				$urlObject = new Url( "http://".$server["HTTP_HOST"] );
+				if ( !isset($serverVars['HTTPS']) || strtolower($serverVars['HTTPS']) != 'on' ) {
+					$protocol = 'http://';
+				} else {
+					$protocol = 'https://';
+				}
+				$urlObject = new Url( $protocol.$server["HTTP_HOST"] );
 			}
 			else
 				$urlObject = new Url( $url );

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/function.fetch.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/function.fetch.php	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/function.fetch.php	2013-08-07 19:40:57 UTC (rev 7214)
@@ -48,7 +48,7 @@
         }
     } else {
         // not a local file
-        if(preg_match('!^http://!i',$params['file'])) {
+        if(preg_match('!^https?://!i',$params['file'])) {
             // http fetch
             if($uri_parts = parse_url($params['file'])) {
                 // set defaults

Modified: plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php	2013-08-07 19:40:57 UTC (rev 7214)
@@ -24,6 +24,7 @@
             $blogSettings = $blogInfo->getSettings();
 			$this->setValue( "blogAbout", $this->_blogInfo->getAbout( false ));
 			$this->setValue( "blogName", $this->_blogInfo->getBlog());
+			$this->setValue( "blogUseSsl", $blogSettings->getValue( "use_ssl" ));
             $this->setValue( "blogLocale", $blogSettings->getValue( "locale" ));
 			$this->setValue( "blogMaxRecentItems", $blogSettings->getValue( "recent_posts_max" ));
 			$this->setValue( "blogMaxMainPageItems", $blogSettings->getValue( "show_posts_max" ));

Modified: plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2013-08-07 19:40:57 UTC (rev 7214)
@@ -369,6 +369,8 @@
 $messages['blog_link'] = 'Blog link';
 $messages['blog_link_help'] = 'Permanent link to this blog';
 $messages['blog_name_help'] = 'Title for this blog';
+$messages['use_ssl'] = 'Use SSL';
+$messages['use_ssl_help'] = 'If enabled, the blog will use https:// when creating links to the domain/subdomain for this blog.';
 $messages['blog_description_help'] = 'Longer description about the contents of this blog.';
 $messages['language'] = 'Language';
 $messages['blog_language_help'] = 'Language used to display the texts of this blog, both in the public and administration side.';

Modified: plog/branches/lifetype-1.2/templates/admin/blogsettings.template
===================================================================
--- plog/branches/lifetype-1.2/templates/admin/blogsettings.template	2013-07-25 03:48:21 UTC (rev 7213)
+++ plog/branches/lifetype-1.2/templates/admin/blogsettings.template	2013-08-07 19:40:57 UTC (rev 7214)
@@ -35,6 +35,15 @@
       {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>
+
+     <div class="field">
+      <label for="blogUseSsl">{$locale->tr("use_ssl")}</label>
+      <div class="formHelp">
+	    <input class="checkbox" type="checkbox" value="1" name="blogUseSsl" id="blogUseSsl" {if $blogUseSsl == true} checked="checked" {/if} />
+	    {$locale->tr("use_ssl_help")}
+      </div> 
+     </div>
+
     {/if}
 
     <div class="field">



More information about the pLog-svn mailing list