[pLog-svn] r3174 - in plog/trunk: class/action templates/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Mon Apr 3 06:43:50 GMT 2006


Author: mark
Date: 2006-04-03 06:43:48 +0000 (Mon, 03 Apr 2006)
New Revision: 3174

Modified:
   plog/trunk/class/action/blogaction.class.php
   plog/trunk/templates/admin/globalsettings_general.template
Log:
Now, we can redirect the "Blog does not exist" to any url instead of a ugly "Blog does not exist" information.

We can put the summary url in "blog_does_not_exist_rul" field directly. User will redirect to the summary page and can't see any warning message.

Or we can create a new page (blognotexist.template) in summary. And we can redirect to that page (http://lalala.com/summary.php?page=blognotexist). Let the user know the blog does not exist first. Then, we can redirect again to summary or any page we want.

It's all up to site admin.

Modified: plog/trunk/class/action/blogaction.class.php
===================================================================
--- plog/trunk/class/action/blogaction.class.php	2006-04-02 21:18:24 UTC (rev 3173)
+++ plog/trunk/class/action/blogaction.class.php	2006-04-03 06:43:48 UTC (rev 3174)
@@ -44,9 +44,18 @@
             $this->_session = $session['SessionInfo'];
 
             $this->_config =& Config::getConfig();
+            if( !$this->_getBlogInfo() ) {
+	            include_once( PLOG_CLASS_PATH."class/view/view.class.php" );
+	            include_once( PLOG_CLASS_PATH."class/view/redirectview.class.php" );
+	            
+	            $blogDoesNotExistUrl = $this->_config->getValue( "blog_does_not_exist_url" );
+	            if ( empty($blogDoesNotExistUrl) )
+	            	$blogDoesNotExistUrl = trim( $this->_config->getValue( "base_url" ) );
+	            
+				$this->_view = new RedirectView( $blogDoesNotExistUrl );
+				$this->_view->render();
+			}
 
-            $this->_getBlogInfo();
-
             // save the blogid in the session
             $this->_session->setValue( 'blogId', $this->_blogInfo->getId());
 
@@ -205,17 +214,18 @@
                 $this->_blogInfo = $blogs->getBlogInfoByName( $blogName );
             }
 
+            $blogExists = true;
+            
             // security checks...
             if( $this->_blogInfo == false ) {
-            	print( 'ERROR: The blog does not exist.' );
-                die;
+				$blogExists = false;
+            } else {
+	            // non-active blogs shoulnd't be shown either!
+	            if( $this->_blogInfo->getStatus() != BLOG_STATUS_ACTIVE )
+	            	$blogExists = false;
             }
             
-            // non-active blogs shoulnd't be shown either!
-            if( $this->_blogInfo->getStatus() != BLOG_STATUS_ACTIVE ) {
-            	print( 'ERROR: The blog does not exist.' );
-                die;	            
-            }
+            return $blogExists;
         }
 
         /**

Modified: plog/trunk/templates/admin/globalsettings_general.template
===================================================================
--- plog/trunk/templates/admin/globalsettings_general.template	2006-04-02 21:18:24 UTC (rev 3173)
+++ plog/trunk/templates/admin/globalsettings_general.template	2006-04-03 06:43:48 UTC (rev 3174)
@@ -96,6 +96,12 @@
 	 {$locale->tr("select")}
 	</a>
    </div>
+   <!-- blog_does_not_exist_url -->
+   <div class="field">
+    <label for="config[blog_does_not_exist_url]">blog_does_not_exist_url</label>
+    <div class="formHelp">{$locale->tr("help_blog_does_not_exist_url")}</div>	
+    <input style="width:100%" type="text" name="config[blog_does_not_exist_url]" value="{$blog_does_not_exist_url}"/>
+   </div>   
    <!-- default_time_offset -->
    <div class="field">
     <label for="config[default_time_offset]">default_time_offset</label>



More information about the pLog-svn mailing list