phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] notes/class.base.php, 1.1.2.6


From: nomail
Subject: [Phpgroupware-cvs] notes/class.base.php, 1.1.2.6
Date: Thu, 20 May 2004 17:35:22 -0000

Update of /notes
Modified Files:
        Branch: proposal-branch
          class.base.php

date: 2004/04/21 05:03:37;  author: jengo;  state: Exp;  lines: +31 -16

Log Message:
Changed some of the flow and added some sanity checking
=====================================================================
No syntax errors detected in -
=====================================================================
Index: notes/class.base.php
diff -u notes/class.base.php:1.1.2.5 notes/class.base.php:1.1.2.6
--- notes/class.base.php:1.1.2.5        Sun Apr 18 08:05:27 2004
+++ notes/class.base.php        Wed Apr 21 05:03:37 2004
@@ -189,16 +189,15 @@
                        $args->set('note_id',REQUIRED,'number');
                        $args = $args->get(func_get_args());
 
-                       $result['action_type'] = 'note_view';
-                       $db = $GLOBALS['phpgw']->db->execute("SELECT * FROM 
phpgw_notes WHERE note_id='"
-                               . $args['note_id'] . "' AND note_dm_type='N'");
+                       $result['action_type'] = 'note_view';
+                       $note                  = 
$this->_read($args['note_id'],'N');
 
                        if (! $GLOBALS['phpgw']->acl->check('notes.' . 
$args['note_id'],PHPGW_ACL_READ))
                        {
                                
$GLOBALS['phpgw']->interface->access_denied('this record');
                                return array();
                        }
-                       else if ($db->EOF)
+                       else if (! is_array($note))
                        {
                                $GLOBALS['msgbox']->add(lang('Record not 
found'),'notice');
                                return array();
@@ -208,7 +207,7 @@
                                $GLOBALS['phpgw']->add_appmenu('Notes 
menu','Edit note','notes.base.edit&note_id=' . $args['note_id']);
                                $GLOBALS['phpgw']->add_appmenu('Notes 
menu','Delete note','notes.base.delete&note_id=' . $args['note_id']);
 
-                               $result['note'] = $this->__get_record(&$db);
+                               $result['note']         = $note;
                                $obj                    = 
createObject('api_history');
                                $obj->field_desc        = array
                                (
@@ -376,15 +375,13 @@
 
                        if ($args['answer'] == NOVAR)
                        {
-                               $db = $GLOBALS['phpgw']->db->execute("SELECT * 
from phpgw_notes WHERE note_id='"
-                                       . $args['note_id'] . "'");
-
-                               if ($db->EOF)
+                               $note = $this->_read($args['note_id']);
+                               if (! is_array($note))
                                {
                                        $GLOBALS['msgbox']->add(lang('Record 
not found'),'notice');
                                        return array();
                                }
-                               $result['note'] = $this->__get_record(&$db);
+                               $result['note'] = $note;
 
                                $result['dialog'] = array(
                                        'question' => lang('Are you sure you 
want to delete this note ?'),
@@ -474,11 +471,21 @@
                function _read()
                {
                        $args = new safe_args();
-                       $args->set('note_id',REQUIRED,'number');
+                       $args->set('note_id',REQUIRED,'number');
+                       $args->set('note_dm_type','N','string');
                        $args = $args->get(func_get_args());
 
-                       $dbresult = $GLOBALS['phpgw']->db->execute("SELECT * 
FROM phpgw_notes WHERE note_id='"
-                               . $args['note_id'] . "'");
+                       $dbresult = $GLOBALS['phpgw']->db->execute("
+                               SELECT
+                                       *
+                               FROM
+                                       phpgw_notes
+                               WHERE
+                                       note_id='" . $args['note_id'] . "'
+                               AND
+                                       note_dm_type='" . $args['note_dm_type'] 
. "'
+                               AND
+                                       note_owner='" . 
$GLOBALS['phpgw_data']['user']['id'] . "'");
 
                        if (! $dbresult->_numOfRows)
                        {
@@ -499,9 +506,17 @@
                        $GLOBALS['phpgw']->add_xsl('notes.widgets');
 
                        // FIXME: This needs ACL check and it needs to check 
for note_dm_type of D
-                       $dbresult = $GLOBALS['phpgw']->db->execute("SELECT * 
FROM phpgw_notes WHERE note_id='"
-                               . $args['note_id'] . "' AND note_dm_type='D'");
+                       $dbresult = $GLOBALS['phpgw']->db->execute("
+                               SELECT
+                                       *
+                               FROM
+                                       phpgw_notes
+                               WHERE
+                                       note_id='" . $args['note_id'] . "'
+                               AND
+                                       note_dm_type='D'");
 
+                       //return $this->_read($args['note_id']);
                        return $this->__get_record(&$dbresult);
                }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]