CVS update: /cowiki/includes/cowiki/class/dao/

[email protected] 17 Jul 2005 18:48:06 -0000
Newsgroups gmane.comp.php.cowiki.cvs
Message-ID <[email protected]>
User: dgorski 
Date: 2005/07/17 11:48:06

Modified:
   cowiki/includes/cowiki/class/dao/class.DocumentDAO.php

Log:
 Cast and check possible illegal parameter

File Changes:

Directory: /cowiki/includes/cowiki/class/dao/
=============================================

File [changed]: class.DocumentDAO.php
Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/dao/class.DocumentDAO.php?r1=1.73&r2=1.74
Delta lines:  +9 -3
-------------------
--- class.DocumentDAO.php	17 Jul 2005 18:40:47 -0000	1.73
+++ class.DocumentDAO.php	17 Jul 2005 18:48:03 -0000	1.74
@@ -2,7 +2,7 @@
 
 /**
  *
- * $Id: class.DocumentDAO.php,v 1.73 2005/07/17 18:40:47 dgorski Exp $
+ * $Id: class.DocumentDAO.php,v 1.74 2005/07/17 18:48:03 dgorski Exp $
  *
  * This file is part of coWiki. coWiki is free software under the terms of
  * the GNU General Public License (GPL). Read the LICENSE file. If you did
@@ -17,7 +17,7 @@
  * @author      Daniel T. Gorski, <[email protected]>
  * @copyright   (C) Daniel T. Gorski, {@link http://www.develnet.org}
  * @license     http://www.gnu.org/licenses/gpl.html
- * @version     $Revision: 1.73 $
+ * @version     $Revision: 1.74 $
  *
  */
 
@@ -172,11 +172,17 @@
         // {{{ DEBUG }}}
         Logger::info('Fetching node id #'.$sId);
 
+        $nId = (int)$sId;
+
+        if ($nId === 0) {
+            return null;
+        }
+
         $sQuery = " SELECT  ".$sFields.",
                             is_dir, parent_id,
                             UNIX_TIMESTAMP(created) as created
                       FROM  ".$this->sNodeTable."
-                     WHERE  node_id = '".$sId."'";
+                     WHERE  node_id = '".$nId."'";
 
         // {{{ DEBUG }}}
         Logger::sql($sQuery);