[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.historylog.inc.php
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.historylog.inc.php |
Date: |
Sat, 14 Oct 2006 05:41:56 +0000 |
CVSROOT: /sources/phpgwapi
Module name: phpgwapi
Changes by: Dave Hall <skwashd> 06/10/14 05:41:56
Modified files:
inc : class.historylog.inc.php
Log message:
cleanup and notices
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.historylog.inc.php?cvsroot=phpgwapi&r1=1.14&r2=1.15
Patches:
Index: class.historylog.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.historylog.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- class.historylog.inc.php 3 Sep 2006 06:15:27 -0000 1.14
+++ class.historylog.inc.php 14 Oct 2006 05:41:56 -0000 1.15
@@ -6,7 +6,7 @@
* @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage application
- * @version $Id: class.historylog.inc.php,v 1.14 2006/09/03 06:15:27
skwashd Exp $
+ * @version $Id: class.historylog.inc.php,v 1.15 2006/10/14 05:41:56
skwashd Exp $
*/
/**
@@ -41,7 +41,7 @@
function delete($record_id)
{
- $this->db->query("delete from phpgw_history_log where
history_record_id='".intval($record_id)."' and "
+ $this->db->query("DELETE FROM phpgw_history_log WHERE
history_record_id='".(int)$record_id."' and "
. "history_appname='" . $this->appname .
"'",__LINE__,__FILE__);
}
@@ -49,53 +49,64 @@
{
if ($new_value != $old_value)
{
- $this->db->query("insert into phpgw_history_log
(history_record_id,"
+ $this->db->query("INSERT INTO phpgw_history_log
(history_record_id,"
.
"history_appname,history_owner,history_status,history_new_value,history_old_value,history_timestamp)
"
- . "values ('".intval($record_id)."','"
. $this->appname . "','"
+ . "VALUES ('".(int)$record_id."','" .
$this->appname . "','"
.
$GLOBALS['phpgw_info']['user']['account_id'] . "','$status','"
. $this->db->db_addslashes($new_value)
. "','" . $this->db->db_addslashes($old_value) . "','" .
$this->db->to_timestamp(time())
. "')",__LINE__,__FILE__);
}
}
- function return_array($filter_out,$only_show,$_orderby =
'',$sort = '', $record_id)
+ function return_array($filter_out = array(),$only_show =
array(), $_orderby = '',$sort = '', $record_id)
{
+ $record_id = (int) $record_id;
+
+ if ( !$record_id )
+ {
+ return array();
+ }
if (! $sort || ! $_orderby)
{
- $orderby = 'order by
history_timestamp,history_id';
+ $orderby = 'ORDER BY history_timestamp,
history_id';
}
else
{
- $orderby = "order by $_orderby $sort";
+ $orderby = "ORDER BY $_orderby $sort";
}
- while (is_array($filter_out) && (list(,$_filter) =
each($filter_out)))
+ $filter = '';
+ if ( count($filter_out) )
{
- $filtered[] = "history_status != '$_filter'";
- }
-
- if (is_array($filtered))
+ $filtered = array();
+ foreach ( $filter_out as $_filter )
{
- $filter = ' and ' . implode(' and ',$filtered);
+ $filtered[] = "history_status != '" .
$this->db->db_addslashes($_filter) . "'";
+ }
+ $filter = ' AND ' . implode(' AND ',$filtered);
}
- while (is_array($only_show) && (list(,$_filter) =
each($only_show)))
+ $only_show_filter = '';
+ if ( count($only_show) )
+ {
+ $_only_show = array();
+ foreach ( $only_show as $_filter )
{
$_only_show[] = "history_status='$_filter'";
}
-
- if (is_array($_only_show))
- {
- $only_show_filter = ' and (' . implode(' or
',$_only_show). ')';
+ $only_show_filter = ' AND (' . implode(' OR
',$_only_show). ')';
}
- $this->db->query("select * from phpgw_history_log where
history_appname='"
- . $this->appname . "' and
history_record_id='".intval($record_id)."' $filter $only_show_filter "
- . "$orderby",__LINE__,__FILE__);
- while ($this->db->next_record())
+ $this->db->query('SELECT * FROM phpgw_history_log'
+ . " WHERE history_appname='{$this->appname}'
AND history_record_id = {$record_id} $filter $only_show_filter "
+ . $orderby, __LINE__, __FILE__);
+
+ $return_values = array();
+ while ( $this->db->next_record() )
{
- $return_values[] = array(
+ $return_values[] = array
+ (
'id' =>
$this->db->f('history_id'),
'record_id' =>
$this->db->f('history_record_id'),
'owner' =>
$GLOBALS['phpgw']->accounts->id2name($this->db->f('history_owner')),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.historylog.inc.php,
Dave Hall <=