[pLog-svn] r947 - plog/trunk/class/dao

oscar at devel.plogworld.net oscar at devel.plogworld.net
Fri Feb 4 18:38:42 GMT 2005


Author: oscar
Date: 2005-02-04 18:38:42 +0000 (Fri, 04 Feb 2005)
New Revision: 947

Modified:
   plog/trunk/class/dao/articles.class.php
Log:
possible fix for issue 128 (http://bugs.plogworld.net/view.php?id=128)

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2005-02-04 18:32:25 UTC (rev 946)
+++ plog/trunk/class/dao/articles.class.php	2005-02-04 18:38:42 UTC (rev 947)
@@ -849,13 +849,32 @@
             $query = "UPDATE ".$this->getPrefix()."articles SET ".
                      " num_reads = num_reads+1 ".
                      ", date = date ".
-                     " WHERE id = $articleId;";
+                     " WHERE id = '".Db::qstr($articleId)."'";
 
             $result = $this->Execute( $query );
 
             return $result;
         }
+		
+		/**
+		 * similar as the one above but it takes an article 'name' instead of an article id
+		 * @see updateArticleNumReads
+		 * @param articleName an article "name" (the post 'slug')
+		 * @return true if successful or false otherwise
+		 */
+        function updateArticleNumReadsByName( $articleName )
+        {
+            // we have to build up the query, which will be pretty long...
+            $query = "UPDATE ".$this->getPrefix()."articles SET ".
+                     " num_reads = num_reads+1 ".
+                     ", date = date ".
+                     " WHERE slug = '".Db::qstr($articleName)."'";
 
+            $result = $this->Execute( $query );
+
+            return $result;
+        }		
+
         /**
          * Removes an article from the database
          *




More information about the pLog-svn mailing list