[pLog-svn] r4322 - in plog/branches/lifetype-1.1.3: class/action/admin class/security class/view/admin templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Tue Nov 21 20:58:13 GMT 2006


Author: oscar
Date: 2006-11-21 20:58:13 +0000 (Tue, 21 Nov 2006)
New Revision: 4322

Modified:
   plog/branches/lifetype-1.1.3/class/action/admin/adminaddpostaction.class.php
   plog/branches/lifetype-1.1.3/class/security/bayesianfilter.class.php
   plog/branches/lifetype-1.1.3/class/view/admin/admindashboardview.class.php
   plog/branches/lifetype-1.1.3/class/view/admin/adminview.class.php
   plog/branches/lifetype-1.1.3/templates/admin/dashboard.template
   plog/branches/lifetype-1.1.3/templates/admin/editcomments.template
   plog/branches/lifetype-1.1.3/templates/admin/edittrackbacks.template
Log:
fixes for issue http://bugs.lifetype.net/view.php?id=1125 (icons and options related to the bayesian filter should be removed from the admin interface when the filter is not active)


Modified: plog/branches/lifetype-1.1.3/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/branches/lifetype-1.1.3/class/action/admin/adminaddpostaction.class.php	2006-11-21 20:48:49 UTC (rev 4321)
+++ plog/branches/lifetype-1.1.3/class/action/admin/adminaddpostaction.class.php	2006-11-21 20:58:13 UTC (rev 4322)
@@ -143,9 +143,11 @@
             	//$article->setId( $artId );
                 $message = $this->_locale->tr("post_added_ok");
                 
-                // train the filter
-	            include_once( PLOG_CLASS_PATH."class/bayesian/bayesianfiltercore.class.php" );
-                BayesianFilterCore::trainWithArticle( $article );
+                // train the filter, but only if enabled
+				if( $this->_config->getValue( "bayesian_filter_enabled" ) == true ) {
+		            include_once( PLOG_CLASS_PATH."class/bayesian/bayesianfiltercore.class.php" );
+	                BayesianFilterCore::trainWithArticle( $article );
+				}
                                 
         		// add the article notification if requested to do so
             	if( $this->_sendNotification ) {

Modified: plog/branches/lifetype-1.1.3/class/security/bayesianfilter.class.php
===================================================================
--- plog/branches/lifetype-1.1.3/class/security/bayesianfilter.class.php	2006-11-21 20:48:49 UTC (rev 4321)
+++ plog/branches/lifetype-1.1.3/class/security/bayesianfilter.class.php	2006-11-21 20:58:13 UTC (rev 4322)
@@ -44,8 +44,7 @@
         {
             $config =& Config::getConfig();
             
-            if (!$config->getValue("bayesian_filter_enabled"))
-            {
+            if (!$config->getValue("bayesian_filter_enabled")) {
                 return new PipelineResult(true);
             }
         

Modified: plog/branches/lifetype-1.1.3/class/view/admin/admindashboardview.class.php
===================================================================
--- plog/branches/lifetype-1.1.3/class/view/admin/admindashboardview.class.php	2006-11-21 20:48:49 UTC (rev 4321)
+++ plog/branches/lifetype-1.1.3/class/view/admin/admindashboardview.class.php	2006-11-21 20:58:13 UTC (rev 4322)
@@ -128,6 +128,7 @@
             $ts = new TemplateService();
         	$template = $ts->AdminTemplate( "dashboard" );
             $this->setValue( "locale", $locale );
+			$this->setValue( "bayesian_filter_enabled", $this->_config->getValue( "bayesian_filter_enabled" ));
             // assign all the values
             $template->assign( $this->_params->getAsArray());
 

Modified: plog/branches/lifetype-1.1.3/class/view/admin/adminview.class.php
===================================================================
--- plog/branches/lifetype-1.1.3/class/view/admin/adminview.class.php	2006-11-21 20:48:49 UTC (rev 4321)
+++ plog/branches/lifetype-1.1.3/class/view/admin/adminview.class.php	2006-11-21 20:58:13 UTC (rev 4322)
@@ -94,6 +94,7 @@
             $this->setValue( 'baseurl', $config->getValue( 'base_url'));			
             $this->setValue( 'version', Version::getVersion());
             $this->setValue( 'uploads_enabled', $config->getValue( 'uploads_enabled' ));			
+            $this->setValue( 'bayesian_filter_enabled', $config->getValue( 'bayesian_filter_enabled' ));			
 
 			//
 			// stuff to generate the menu on the left

Modified: plog/branches/lifetype-1.1.3/templates/admin/dashboard.template
===================================================================
--- plog/branches/lifetype-1.1.3/templates/admin/dashboard.template	2006-11-21 20:48:49 UTC (rev 4321)
+++ plog/branches/lifetype-1.1.3/templates/admin/dashboard.template	2006-11-21 20:58:13 UTC (rev 4322)
@@ -79,6 +79,7 @@
                             <td>
                                 <div class="list_action_button">
                                 <a href="?op=blogSelect&amp;blogId={$blog->getId()}&amp;action=deleteComment&amp;commentId={$comment->getId()}&amp;articleId={$article->getId()}"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
+								{if $bayesian_filter_enabled}
                                 {if $comment->getStatus() == 0}
                                     <a href="?op=blogSelect&amp;blogId={$blog->getId()}&amp;action=markComment&amp;mode=1&amp;articleId={$comment->getArticleId()}&amp;commentId={$comment->getId()}">
                                      <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
@@ -88,6 +89,7 @@
                                      <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
                                     </a>
                                 {/if}
+								{/if}
                                 {if $comment->getUserUrl()}
                                   <a href="{$comment->getUserUrl()}">
                                    <img src="imgs/admin/icon_url-16.png" alt="{$locale->tr("url")}" />
@@ -130,6 +132,7 @@
                             <td>
                                 <div class="list_action_button">
                                  <a href="?op=blogSelect&amp;blogId={$blog->getId()}&amp;action=deleteTrackback&amp;articleId={$article->getId()}&amp;trackbackId={$trackback->getId()}"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete_trackback")}" /></a>
+								{if $bayesian_filter_enabled}
                                   {if $trackback->getStatus() == 0}
                                     <a href="?op=blogSelect&amp;blogId={$blog->getId()}&amp;action=markTrackback&amp;mode=1&amp;articleId={$trackback->getArticleId()}&amp;trackbackId={$trackback->getId()}">
                                      <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
@@ -139,6 +142,7 @@
                                      <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
                                     </a>
                                   {/if}
+								{/if}
                                   {if $trackback->getUserUrl()}
                                     <a href="{$trackback->getUserUrl()}">
                                      <img src="imgs/admin/icon_url-16.png" alt="{$locale->tr("url")}" />

Modified: plog/branches/lifetype-1.1.3/templates/admin/editcomments.template
===================================================================
--- plog/branches/lifetype-1.1.3/templates/admin/editcomments.template	2006-11-21 20:48:49 UTC (rev 4321)
+++ plog/branches/lifetype-1.1.3/templates/admin/editcomments.template	2006-11-21 20:58:13 UTC (rev 4322)
@@ -95,14 +95,16 @@
                             <a href="?op=deleteComment&amp;commentId={$comment->getId()}&amp;articleId={if $post}{$post->getId()}{else}0{/if}" title="{$locale->tr("delete")}">
                             	<img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
                             </a>
-							{if $comment->getStatus() == 0}
-							    <a href="?op=markComment&amp;mode=1&amp;articleId={if $post}{$comment->getArticleId()}{else}0{/if}&amp;commentId={$comment->getId()}" title="{$locale->tr("mark_as_spam")}">
-								 <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
-								</a>
-							{elseif $comment->getStatus() == 1}
-								<a href="?op=markComment&amp;mode=0&amp;articleId={if $post}{$comment->getArticleId()}{else}0{/if}&amp;commentId={$comment->getId()}" title="{$locale->tr("mark_as_no_spam")}">
-								 <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
-								</a>
+							{if $bayesian_filter_enabled}
+								{if $comment->getStatus() == 0}
+								    <a href="?op=markComment&amp;mode=1&amp;articleId={if $post}{$comment->getArticleId()}{else}0{/if}&amp;commentId={$comment->getId()}" title="{$locale->tr("mark_as_spam")}">
+									 <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
+									</a>
+								{elseif $comment->getStatus() == 1}
+									<a href="?op=markComment&amp;mode=0&amp;articleId={if $post}{$comment->getArticleId()}{else}0{/if}&amp;commentId={$comment->getId()}" title="{$locale->tr("mark_as_no_spam")}">
+									 <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
+									</a>
+								{/if}
 							{/if}
 							{if $comment->getUserUrl()}
 							  <a href="{$comment->getUserUrl()}" title="{$locale->tr("url")}">
@@ -129,7 +131,7 @@
 		            <select name="commentStatus" id="commentStatus">
 		              <option value="-1">-{$locale->tr("select")}-</option>
 		              {foreach from=$commentstatusWithoutAll key=name item=status}
-		                <option value="{$status}">{$locale->tr($name)}</option>
+						{if ($status != 0 && $status != 1) || $bayesian_filter_enabled}<option value="{$status}">{$locale->tr($name)}</option>{/if}
 		              {/foreach}
 		            </select>
 		            <input type="button" name="changeCommentsStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitCommentsList('changeCommentsStatus');" /> 

Modified: plog/branches/lifetype-1.1.3/templates/admin/edittrackbacks.template
===================================================================
--- plog/branches/lifetype-1.1.3/templates/admin/edittrackbacks.template	2006-11-21 20:48:49 UTC (rev 4321)
+++ plog/branches/lifetype-1.1.3/templates/admin/edittrackbacks.template	2006-11-21 20:58:13 UTC (rev 4322)
@@ -94,14 +94,16 @@
                              <a href="?op=deleteTrackback&amp;articleId={if $post}{$post->getId()}{else}0{/if}&amp;trackbackId={$trackback->getId()}" title="{$locale->tr("delete_trackback")}">
                              	<img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete_trackback")}" />
                              </a>
-							{if $trackback->getStatus() == 0}
-							    <a href="?op=markTrackback&amp;mode=1&amp;articleId={if $post}{$post->getId()}{else}0{/if}&amp;trackbackId={$trackback->getId()}" title="{$locale->tr("mark_as_spam")}">
-								 <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
-								</a>
-							{elseif $trackback->getStatus() == 1}
-								<a href="?op=markTrackback&amp;mode=0&amp;articleId={if $post}{$post->getId()}{else}0{/if}&amp;trackbackId={$trackback->getId()}" title="{$locale->tr("mark_as_no_spam")}">
-								 <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
-								</a>
+							{if $bayesian_filter_enabled}
+								{if $trackback->getStatus() == 0}
+								    <a href="?op=markTrackback&amp;mode=1&amp;articleId={if $post}{$post->getId()}{else}0{/if}&amp;trackbackId={$trackback->getId()}" title="{$locale->tr("mark_as_spam")}">
+									 <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
+									</a>
+								{elseif $trackback->getStatus() == 1}
+									<a href="?op=markTrackback&amp;mode=0&amp;articleId={if $post}{$post->getId()}{else}0{/if}&amp;trackbackId={$trackback->getId()}" title="{$locale->tr("mark_as_no_spam")}">
+									 <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
+									</a>
+								{/if}
 							{/if}
                             {if $trackback->getUserUrl()}
                                 <a href="{$trackback->getUserUrl()}" title="{$locale->tr("url")}">
@@ -128,7 +130,7 @@
 		            <select name="trackbackStatus" id="trackbackStatus">
 		              <option value="-1">-{$locale->tr("select")}-</option>
 		              {foreach from=$commentstatusWithoutAll key=name item=status}
-		                <option value="{$status}">{$locale->tr($name)}</option>
+		                {if ($status != 0 && $status != 1) || $bayesian_filter_enabled}<option value="{$status}">{$locale->tr($name)}</option>{/if}
 		              {/foreach}
 		            </select>
 		            <input type="button" name="changeTrackbacksStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitTrackbacksList('changeTrackbacksStatus');" /> 



More information about the pLog-svn mailing list