phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] forum/inc class.boforum.inc.php, 1.1.2.7, 1.1.2.7.2.1


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] forum/inc class.boforum.inc.php, 1.1.2.7, 1.1.2.7.2.1 class.soforum.inc.php, 1.1.2.6, 1.1.2.6.2.1 class.uiadmin.inc.php, 1.1.2.4, 1.1.2.4.2.1
Date: Fri, 10 Oct 2003 00:22:41 +0000

Update of /cvsroot/phpgroupware/forum/inc
In directory subversions:/tmp/cvs-serv6833/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.boforum.inc.php class.soforum.inc.php 
        class.uiadmin.inc.php 
Log Message:
sql and globals

Index: class.uiadmin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/forum/inc/class.uiadmin.inc.php,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.4.2.1
diff -C2 -d -r1.1.2.4 -r1.1.2.4.2.1
*** class.uiadmin.inc.php       4 Jun 2002 21:06:38 -0000       1.1.2.4
--- class.uiadmin.inc.php       10 Oct 2003 00:22:37 -0000      1.1.2.4.2.1
***************
*** 48,52 ****
                        $this->template_dir = 
$GLOBALS['phpgw']->common->get_tpl_dir('forum');
                        $this->template = 
CreateObject('phpgwapi.Template',$this->template_dir);
!                       $info = 
explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
                        $this->current_page = $info[2];
                }
--- 48,52 ----
                        $this->template_dir = 
$GLOBALS['phpgw']->common->get_tpl_dir('forum');
                        $this->template = 
CreateObject('phpgwapi.Template',$this->template_dir);
!                       $info = explode('.',$_GET['menuaction']);
                        $this->current_page = $info[2];
                }
***************
*** 191,200 ****
                function edit_category()
                {
!                       
$this->category_screen($GLOBALS['HTTP_GET_VARS']['cat_id']);
                }
  
                function edit_forum()
                {
!                       
$this->forum_screen($GLOBALS['HTTP_GET_VARS']['forum_id']);
                }
  
--- 191,200 ----
                function edit_category()
                {
!                       $this->category_screen($_GET['cat_id']);
                }
  
                function edit_forum()
                {
!                       $this->forum_screen($_GET['forum_id']);
                }
  
***************
*** 237,241 ****
                                                Array(
                                                        'menuaction'    => 
'forum.boforum.delete_category',
!                                                       'cat_id'        => 
$GLOBALS['HTTP_GET_VARS']['cat_id']
                                                )
                                        ),
--- 237,241 ----
                                                Array(
                                                        'menuaction'    => 
'forum.boforum.delete_category',
!                                                       'cat_id'        => 
$_GET['cat_id']
                                                )
                                        ),
***************
*** 288,293 ****
                                                Array(
                                                        'menuaction'    => 
'forum.boforum.delete_forum',
!                                                       'cat_id'        => 
$GLOBALS['HTTP_GET_VARS']['cat_id'],
!                                                       'forum_id'      => 
$GLOBALS['HTTP_GET_VARS']['forum_id']
                                                )
                                        ),
--- 288,293 ----
                                                Array(
                                                        'menuaction'    => 
'forum.boforum.delete_forum',
!                                                       'cat_id'        => 
$_GET['cat_id'],
!                                                       'forum_id'      => 
$_GET['forum_id']
                                                )
                                        ),

Index: class.boforum.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/forum/inc/class.boforum.inc.php,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.7.2.1
diff -C2 -d -r1.1.2.7 -r1.1.2.7.2.1
*** class.boforum.inc.php       4 Jun 2002 14:14:48 -0000       1.1.2.7
--- class.boforum.inc.php       10 Oct 2003 00:22:36 -0000      1.1.2.7.2.1
***************
*** 56,63 ****
                        {
                                $var_str = $var[$i];
! //                            $this->$var_str = 
(@isset($GLOBALS['HTTP_GET_VARS'][$var_str])?intval($GLOBALS['HTTP_GET_VARS'][$var_str]):$this->$var_str);
! //                            $this->$var_str = 
(@isset($GLOBALS['HTTP_POST_VARS'][$var_str])?intval($GLOBALS['HTTP_POST_VARS'][$var_str]):$this->$var_str);
!                               $this->$var_str = 
(@isset($GLOBALS['HTTP_GET_VARS'][$var_str])?$GLOBALS['HTTP_GET_VARS'][$var_str]:$this->$var_str);
!                               $this->$var_str = 
(@isset($GLOBALS['HTTP_POST_VARS'][$var_str])?$GLOBALS['HTTP_POST_VARS'][$var_str]:$this->$var_str);
                        }
                        if(address@hidden($this->view))
--- 56,63 ----
                        {
                                $var_str = $var[$i];
! //                            $this->$var_str = 
(@isset($_GET[$var_str])?intval($_GET[$var_str]):$this->$var_str);
! //                            $this->$var_str = 
(@isset($_POST[$var_str])?intval($_POST[$var_str]):$this->$var_str);
!                               $this->$var_str = 
(@isset($_GET[$var_str])?$_GET[$var_str]:$this->$var_str);
!                               $this->$var_str = 
(@isset($_POST[$var_str])?$_POST[$var_str]:$this->$var_str);
                        }
                        if(address@hidden($this->view))
***************
*** 89,100 ****
                function post()
                {
!                       if ($GLOBALS['HTTP_POST_VARS']['action'] == 'post')
                        {
                                $data = Array(
!                                       'cat_id'        => 
$GLOBALS['HTTP_POST_VARS']['cat_id'],
!                                       'forum_id'      => 
$GLOBALS['HTTP_POST_VARS']['forum_id'],
                                        'postdate'      => time() - ((60 * 60) 
* intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])),
!                                       'subject'       => 
$GLOBALS['HTTP_POST_VARS']['subject'],
!                                       'message'       => 
$GLOBALS['HTTP_POST_VARS']['message']
                                );
  
--- 89,100 ----
                function post()
                {
!                       if ($_POST['action'] == 'post')
                        {
                                $data = Array(
!                                       'cat_id'        => $_POST['cat_id'],
!                                       'forum_id'      => $_POST['forum_id'],
                                        'postdate'      => time() - ((60 * 60) 
* intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])),
!                                       'subject'       => $_POST['subject'],
!                                       'message'       => $_POST['message']
                                );
  
***************
*** 107,111 ****
                function reply()
                {
!                       if ($GLOBALS['HTTP_POST_VARS']['action'] == 'reply')
                        {
                                $stat = 0;
--- 107,111 ----
                function reply()
                {
!                       if ($_POST['action'] == 'reply')
                        {
                                $stat = 0;
***************
*** 115,137 ****
                                $next_f_threads_id = 
$this->so->get_max_thread_id() + 1;
  
!                               if ($GLOBALS['HTTP_POST_VARS']['pos'] != 0)
                                {
!                                       
$this->so->fix_pos($GLOBALS['HTTP_POST_VARS']['thread'],$GLOBALS['HTTP_POST_VARS']['pos']);
                                }
                                else
                                {
!                                       $GLOBALS['HTTP_POST_VARS']['pos'] = 1;
                                }
  
                                $data = Array(
!                                       'pos' => 
$GLOBALS['HTTP_POST_VARS']['pos'],
!                                       'thread'        => 
$GLOBALS['HTTP_POST_VARS']['thread'],
!                                       'depth' => 
$GLOBALS['HTTP_POST_VARS']['depth'],
                                        'postdate'      => time() - ((60 * 60) 
* intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])),
!                                       'parent'        => 
$GLOBALS['HTTP_POST_VARS']['msg'],
!                                       'cat_id'        => 
$GLOBALS['HTTP_POST_VARS']['cat_id'],
!                                       'forum_id'      => 
$GLOBALS['HTTP_POST_VARS']['forum_id'],
!                                       'subject'       => 
$GLOBALS['HTTP_POST_VARS']['subject'],
!                                       'message'       => 
$GLOBALS['HTTP_POST_VARS']['message']
                                );
  
--- 115,137 ----
                                $next_f_threads_id = 
$this->so->get_max_thread_id() + 1;
  
!                               if ($_POST['pos'] != 0)
                                {
!                                       
$this->so->fix_pos($_POST['thread'],$_POST['pos']);
                                }
                                else
                                {
!                                       $_POST['pos'] = 1;
                                }
  
                                $data = Array(
!                                       'pos'           => $_POST['pos'],
!                                       'thread'        => $_POST['thread'],
!                                       'depth'         => $_POST['depth'],
                                        'postdate'      => time() - ((60 * 60) 
* intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])),
!                                       'parent'        => $_POST['msg'],
!                                       'cat_id'        => $_POST['cat_id'],
!                                       'forum_id'      => $_POST['forum_id'],
!                                       'subject'       => $_POST['subject'],
!                                       'message'       => $_POST['message']
                                );
  
***************
*** 173,177 ****
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
!                       
$this->so->save_category($GLOBALS['HTTP_POST_VARS']['cat']);
                        Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiadmin.index'));
                        $GLOBALS['phpgw']->common->phpgw_exit();
--- 173,177 ----
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
!                       $this->so->save_category($_POST['cat']);
                        Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiadmin.index'));
                        $GLOBALS['phpgw']->common->phpgw_exit();
***************
*** 185,189 ****
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
!                       
$this->so->save_forum($GLOBALS['HTTP_POST_VARS']['forum']);
                        Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiadmin.index'));
                        $GLOBALS['phpgw']->common->phpgw_exit();
--- 185,189 ----
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
!                       $this->so->save_forum($_POST['forum']);
                        Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiadmin.index'));
                        $GLOBALS['phpgw']->common->phpgw_exit();

Index: class.soforum.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/forum/inc/class.soforum.inc.php,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.6.2.1
diff -C2 -d -r1.1.2.6 -r1.1.2.6.2.1
*** class.soforum.inc.php       15 Mar 2002 03:51:57 -0000      1.1.2.6
--- class.soforum.inc.php       10 Oct 2003 00:22:37 -0000      1.1.2.6.2.1
***************
*** 27,37 ****
                function delete_category($cat_id)
                {
!                       $query = 'DELETE FROM phpgw_forum_threads WHERE 
cat_id='.$cat_id;
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_body WHERE 
cat_id='.$cat_id;
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_forums WHERE 
cat_id='.$cat_id;
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_categories WHERE 
id='.$cat_id;
                        $this->db->query($query,__LINE__,__FILE__);
                }
--- 27,37 ----
                function delete_category($cat_id)
                {
!                       $query = 'DELETE FROM phpgw_forum_threads WHERE 
cat_id='.intval($cat_id);
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_body WHERE 
cat_id='.intval($cat_id);
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_forums WHERE 
cat_id='.intval($cat_id);
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_categories WHERE 
id='.intval($cat_id);
                        $this->db->query($query,__LINE__,__FILE__);
                }
***************
*** 39,47 ****
                function delete_forum($cat_id,$forum_id)
                {
!                       $query = 'DELETE FROM phpgw_forum_threads WHERE 
cat_id='.$cat_id.' AND for_id='.$forum_id;
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_body WHERE 
cat_id='.$cat_id.' AND for_id='.$forum_id;
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_forums WHERE 
cat_id='.$cat_id.' AND id='.$forum_id;
                        $this->db->query($query,__LINE__,__FILE__);
                }
--- 39,50 ----
                function delete_forum($cat_id,$forum_id)
                {
!                       $query = 'DELETE FROM phpgw_forum_threads'
!                               . ' WHERE cat_id='.intval($cat_id).' AND 
for_id='.intval($forum_id);
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_body'
!                               . ' WHERE cat_id='.intval($cat_id).' AND 
for_id='.intval($forum_id);
                        $this->db->query($query,__LINE__,__FILE__);
!                       $query = 'DELETE FROM phpgw_forum_forums'
!                               . ' WHERE cat_id='.intval($cat_id).' AND 
id='.intval($forum_id);
                        $this->db->query($query,__LINE__,__FILE__);
                }
***************
*** 51,59 ****
                        if($cat['id'])
                        {
!                               $query = "UPDATE phpgw_forum_categories SET 
name='".$cat['name']."', descr='".$cat['descr']."' WHERE id=".$cat['id'];
                        }
                        else
                        {
!                               $query = "INSERT INTO 
phpgw_forum_categories(name,descr) 
VALUES('".$cat['name']."','".$cat['descr']."')";
                        }
                        $this->db->query($query,__LINE__,__FILE__);
--- 54,67 ----
                        if($cat['id'])
                        {
!                               $query = 'UPDATE phpgw_forum_categories'
!                                       . " SET 
name='".$this->db->db_addslashes($cat['name'])."',"
!                                       . " 
descr='".$this->db->db_addslashes($cat['descr'])."'"
!                                       . ' WHERE id='.intval($cat['id']);
                        }
                        else
                        {
!                               $query = 'INSERT INTO 
phpgw_forum_categories(name,descr)'
!                                       . " 
VALUES('".$this->db->db_addslashes($cat['name'])."',"
!                                       . " 
'".$this->db->db_addslashes($cat['descr'])."')";
                        }
                        $this->db->query($query,__LINE__,__FILE__);
***************
*** 70,82 ****
                                                echo '<!-- Setting name/descr 
for CAT_ID: '.$forum['cat_id'].' and ID: '.$forum['id'].' -->'."\n";
                                        }
!                                       $query = "UPDATE phpgw_forum_forums SET 
name='".$forum['name']."', descr='".$forum['descr']."' WHERE 
id=".$forum['id'].' AND cat_id='.$forum['cat_id'];
                                }
                                else
                                {
!                                       $query = 'UPDATE phpgw_forum_forums SET 
cat_id='.$forum['cat_id'].", name='".$forum['name']."', 
descr='".$forum['descr']."' WHERE cat_id=".$forum['orig_cat_id'].' and 
id='.$forum['id'];
                                        
$this->db->query($query,__LINE__,__FILE__);
!                                       $query = 'UPDATE phpgw_forum_threads 
SET cat_id='.$forum['cat_id'].' WHERE cat_id='.$forum['orig_cat_id'].' and 
for_id='.$forum['id'];
                                        
$this->db->query($query,__LINE__,__FILE__);
!                                       $query = 'UPDATE phpgw_forum_body SET 
cat_id='.$forum['cat_id'].' WHERE cat_id='.$forum['orig_cat_id'].' and 
for_id='.$forum['id'];
                                }
                        }
--- 78,105 ----
                                                echo '<!-- Setting name/descr 
for CAT_ID: '.$forum['cat_id'].' and ID: '.$forum['id'].' -->'."\n";
                                        }
!                                       $query = 'UPDATE phpgw_forum_forums '
!                                               . " SET 
name='".$this->db->db_addslashes($forum['name'])."',"
!                                               . " 
descr='".$this->db->db_addslashes($forum['descr'])."'"
!                                               . ' WHERE 
id='.intval($forum['id'])
!                                               . ' AND 
cat_id='.intval($forum['cat_id']);
                                }
                                else
                                {
!                                       $query = 'UPDATE phpgw_forum_forums '
!                                               . ' SET 
cat_id='.intval($forum['cat_id']).','
!                                               . " 
name='".$this->db->db_addslashes($forum['name'])."',"
!                                               . " 
descr='".$this->db->db_addslashes($forum['descr'])."'"
!                                               . ' WHERE 
cat_id='.intval($forum['orig_cat_id'])
!                                               . ' AND 
id='.intval($forum['id']);
                                        
$this->db->query($query,__LINE__,__FILE__);
!                                       $query = 'UPDATE phpgw_forum_threads'
!                                               . ' SET 
cat_id='.intval($forum['cat_id'])
!                                               . ' WHERE 
cat_id='.intval($forum['orig_cat_id'])
!                                               . ' AND 
for_id='.intval($forum['id']);
                                        
$this->db->query($query,__LINE__,__FILE__);
!                                       $query = 'UPDATE phpgw_forum_body'
!                                               . ' SET 
cat_id='.intval($forum['cat_id'])
!                                               . ' WHERE 
cat_id='.intval($forum['orig_cat_id'])
!                                               . ' AND 
for_id='.intval($forum['id']);
                                }
                        }
***************
*** 87,91 ****
                                        echo '<-- Cat ID: '.$forum['cat_id'].' 
-->'."\n";
                                }
!                               $query = 'INSERT INTO phpgw_forum_forums 
(cat_id,name,descr,perm,groups) VALUES 
('.$forum['cat_id'].",'".$forum['name']."','".$forum['descr']."',0,'0')";
                        }
                        $this->db->query($query,__LINE__,__FILE__);
--- 110,117 ----
                                        echo '<-- Cat ID: '.$forum['cat_id'].' 
-->'."\n";
                                }
!                               $query = 'INSERT INTO phpgw_forum_forums 
(cat_id,name,descr,perm,groups)'
!                                       . ' VALUES 
('.intval($forum['cat_id']).','
!                                       . 
"'".$this->db->db_addslashes($forum['name'])."',"
!                                       . 
"'".$this->db->db_addslashes($forum['descr'])."',0,'0')";
                        }
                        $this->db->query($query,__LINE__,__FILE__);
***************
*** 94,104 ****
                function add_reply($data)
                {
!                       $this->db->query('insert into phpgw_forum_threads 
(pos,thread,depth,postdate,main,parent,cat_id,for_id,thread_owner,subject,stat,n_replies)
 '
!                               
.'VALUES('.$data['pos'].','.$data['thread'].','.$data['depth'].",'".$this->db->to_timestamp($data['postdate'])."',"
!                                       . ($this->get_max_body_id() + 
1).','.$data['parent'].','.$data['cat_id'].','
!                                       . 
$data['forum_id'].','.$GLOBALS['phpgw_info']['user']['account_id'].",'"
!                                       . 
$this->db->db_addslashes($data['subject']) . "',0,0)",__LINE__,__FILE__);
!                       $this->db->query('update phpgw_forum_threads set 
n_replies = n_replies+1 where thread='.$data['thread'],__LINE__,__FILE__);
!                       $this->db->query('insert into phpgw_forum_body 
(cat_id,for_id,message) VALUES 
('.$data['cat_id'].','.$data['forum_id'].",'".$this->db->db_addslashes($data['message'])."')",__LINE__,__FILE__);
                }
  
--- 120,140 ----
                function add_reply($data)
                {
!                       $this->db->query('INSERT INTO phpgw_forum_threads 
(pos,thread,depth,postdate,main,parent,cat_id,for_id,thread_owner,subject,stat,n_replies)
 '
!                               .'VALUES('.intval($data['pos']).','
!                                       . intval($data['thread']).','
!                                       . intval($data['depth']).","
!                                       . 
"'".$this->db->to_timestamp($data['postdate'])."',"
!                                       . intval($this->get_max_body_id() + 
1).','
!                                       . intval($data['parent']).','
!                                       . intval($data['cat_id']).','
!                                       . intval($data['forum_id']).','
!                                       . 
$GLOBALS['phpgw_info']['user']['account_id'].","
!                                       . 
"'".$this->db->db_addslashes($data['subject']) . "',0,0)",__LINE__,__FILE__);
!                       $this->db->query('UPDATE phpgw_forum_threads SET 
n_replies = n_replies+1 '
!                                       . ' WHERE 
thread='.intval($data['thread']),__LINE__,__FILE__);
!                       $this->db->query('INSERT INTO phpgw_forum_body 
(cat_id,for_id,message) '
!                                       . 'VALUES ('.intval($data['cat_id']).','
!                                       . intval($data['forum_id']).','
!                                       . 
"'".$this->db->db_addslashes($data['message'])."')",__LINE__,__FILE__);
                }
  
***************
*** 106,119 ****
                {
                        $next_f_body_id = $this->get_max_body_id() + 1;
!                       $this->db->query('insert into phpgw_forum_threads 
(pos,thread,depth,postdate,main,parent,cat_id,for_id,thread_owner,subject,stat,n_replies)
 '
!                               .'VALUES 
(0,'.$next_f_body_id.",0,'".$this->db->to_timestamp($data['postdate'])."',".$next_f_body_id.',-1,'.$data['cat_id'].','.$data['forum_id']
!                               
.','.$GLOBALS['phpgw_info']['user']['account_id'] . 
",'".$this->db->db_addslashes($data['subject'])."',0,0)",__LINE__,__FILE__);
                                
!                       $this->db->query('insert into phpgw_forum_body 
(cat_id,for_id,message) VALUES 
('.$data['cat_id'].','.$data['forum_id'].",'".$this->db->db_addslashes($data['message'])."')",__LINE__,__FILE__);
                }
  
                function get_max_forum_id()
                {
!                       $this->db->query('select max(id) from 
phpgw_forum_forums',__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f(0);
--- 142,160 ----
                {
                        $next_f_body_id = $this->get_max_body_id() + 1;
!                       $this->db->query('INSERT INTO phpgw_forum_threads 
(pos,thread,depth,postdate,main,parent,cat_id,for_id,thread_owner,subject,stat,n_replies)
 '
!                               .'VALUES (0,'.intval($next_f_body_id).',0,'
!                               . 
"'".$this->db->to_timestamp($data['postdate'])."',"
!                               . 
intval($next_f_body_id).',-1,'.intval($data['cat_id']).','.intval($data['forum_id']).','
!                               .$GLOBALS['phpgw_info']['user']['account_id'] . 
','
!                               . 
"'".$this->db->db_addslashes($data['subject'])."',0,0)",__LINE__,__FILE__);
                                
!                       $this->db->query('INSERT INTO phpgw_forum_body 
(cat_id,for_id,message) '
!                                       . 'VALUES 
('.intval($data['cat_id']).','.intval($data['forum_id']).','
!                                       . 
"'".$this->db->db_addslashes($data['message'])."')",__LINE__,__FILE__);
                }
  
                function get_max_forum_id()
                {
!                       $this->db->query('SELECT MAX(id) FROM 
phpgw_forum_forums',__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f(0);
***************
*** 122,126 ****
                function get_max_body_id()
                {
!                       $this->db->query('select max(id) from 
phpgw_forum_body',__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f(0);
--- 163,167 ----
                function get_max_body_id()
                {
!                       $this->db->query('SELECT MAX(id) FROM 
phpgw_forum_body',__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f(0);
***************
*** 129,133 ****
                function get_max_thread_id()
                {
!                       $this->db->query('select max(id) from 
phpgw_forum_threads',__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f(0);
--- 170,174 ----
                function get_max_thread_id()
                {
!                       $this->db->query('SELECT MAX(id) FROM 
phpgw_forum_threads',__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f(0);
***************
*** 137,141 ****
                {
                        $db2 = $GLOBALS['phpgw']->db;
!                       $tmp = $this->db->query('select id,pos from 
phpgw_forum_threads where thread='.$thread.' and pos>='.$pos.' order by pos 
desc',__LINE__,__FILE__);
                        while($this->db->next_record($tmp))
                        {
--- 178,184 ----
                {
                        $db2 = $GLOBALS['phpgw']->db;
!                       $tmp = $this->db->query('SELECT id,pos FROM 
phpgw_forum_threads '
!                                       . ' WHERE thread='.intval($thread)
!                                       . ' AND pos>='.intval($pos).' ORDER BY 
pos DESC',__LINE__,__FILE__);
                        while($this->db->next_record($tmp))
                        {
***************
*** 143,147 ****
                                $oldid = $this->db->f('id');
  //                            print "$oldid $oldpos<br>";
!                               $db2->query('update phpgw_forum_threads set 
pos='.$oldpos.' where thread='.$thread.' and id='.$oldid,__LINE__,__FILE__);
                        }
                }
--- 186,193 ----
                                $oldid = $this->db->f('id');
  //                            print "$oldid $oldpos<br>";
!                               $db2->query('UPDATE phpgw_forum_threads'
!                                       . ' SET pos='.intval($oldpos)
!                                       . ' WHERE thread='.intval($thread)
!                                       .' AND 
id='.intval($oldid),__LINE__,__FILE__);
                        }
                }
***************
*** 149,153 ****
                function get_cat_ids()
                {
!                       $this->db->query('select * from phpgw_forum_categories 
order by id',__LINE__,__FILE__);
                        while($this->db->next_record())
                        {
--- 195,199 ----
                function get_cat_ids()
                {
!                       $this->db->query('SELECT * FROM phpgw_forum_categories 
ORDER BY id',__LINE__,__FILE__);
                        while($this->db->next_record())
                        {
***************
*** 163,167 ****
                function get_cat_info($cat_id)
                {
!                       $this->db->query('select * from phpgw_forum_categories 
where id='.$cat_id,__LINE__,__FILE__);
                        if($this->db->num_rows())
                        {
--- 209,214 ----
                function get_cat_info($cat_id)
                {
!                       $this->db->query('SELECT * FROM phpgw_forum_categories'
!                                       . ' WHERE 
id='.intval($cat_id),__LINE__,__FILE__);
                        if($this->db->num_rows())
                        {
***************
*** 179,190 ****
                {
                        $db2 = $GLOBALS['phpgw']->db;
!                       $query = 'select max(postdate), count(id) from 
phpgw_forum_threads where cat_id='.$cat_id;
                        if($forum_id!=0)
                        {
!                               $query .= ' and for_id='.$forum_id;
                        }
                        if($thread_id!=0)
                        {
!                               $query .= ' and thread='.$thread_id;
                        }
                        $db2->query($query,__LINE__,__FILE__);
--- 226,237 ----
                {
                        $db2 = $GLOBALS['phpgw']->db;
!                       $query = 'SELECT MAX(postdate), COUNT(id) FROM 
phpgw_forum_threads WHERE cat_id='.intval($cat_id);
                        if($forum_id!=0)
                        {
!                               $query .= ' AND for_id='.intval($forum_id);
                        }
                        if($thread_id!=0)
                        {
!                               $query .= ' AND thread='.intval($thread_id);
                        }
                        $db2->query($query,__LINE__,__FILE__);
***************
*** 204,211 ****
                function get_forum_info($cat_id,$forum_id=0)
                {
!                       $query = 'select * from phpgw_forum_forums where 
cat_id='.$cat_id;
                        if($forum_id!=0)
                        {
!                               $query .= ' and id='.$forum_id;
                        }
                        $this->db->query($query,__LINE__,__FILE__);
--- 251,258 ----
                function get_forum_info($cat_id,$forum_id=0)
                {
!                       $query = 'SELECT * FROM phpgw_forum_forums WHERE 
cat_id='.intval($cat_id);
                        if($forum_id!=0)
                        {
!                               $query .= ' AND id='.intval($forum_id);
                        }
                        $this->db->query($query,__LINE__,__FILE__);
***************
*** 215,220 ****
                                        'cat_id'        =>      $cat_id,
                                        'id'    => $this->db->f('id'),
!                                       'name'  => $this->db->f('name'),
!                                       'descr' => $this->db->f('descr')
                                );
                        }
--- 262,267 ----
                                        'cat_id'        =>      $cat_id,
                                        'id'    => $this->db->f('id'),
!                                       'name'  => $this->db->f('name', True),
!                                       'descr' => $this->db->f('descr', True)
                                );
                        }
***************
*** 224,235 ****
                function get_thread($cat_id,$forum_id,$collapsed)
                {
!                       $query = 'select * from phpgw_forum_threads where 
cat_id='.$cat_id.' and for_id='.$forum_id;
                        if($collapsed)
                        {
!                               $query .= ' and parent = -1 order by postdate 
DESC';
                        }
                        else
                        {
!                               $query .= ' order by thread DESC, postdate, 
depth';
                        }
                        $this->db->query($query,__LINE__,__FILE__);
--- 271,284 ----
                function get_thread($cat_id,$forum_id,$collapsed)
                {
!                       $query = 'SELECT * FROM phpgw_forum_threads'
!                               . ' WHERE cat_id='.intval($cat_id)
!                               . ' AND for_id='.intval($forum_id);
                        if($collapsed)
                        {
!                               $query .= ' AND parent = -1 ORDER BY postdate 
DESC';
                        }
                        else
                        {
!                               $query .= ' ORDER BY thread DESC, postdate, 
depth';
                        }
                        $this->db->query($query,__LINE__,__FILE__);
***************
*** 242,252 ****
                                }
                                $thread[] = Array(
!                                       'id'    => $this->db->f('id'),
!                                       'subject'       => 
$this->db->f('subject'),
!                                       'author'                => 
$this->db->f('thread_owner'),
                                        'replies'       => 
$this->db->f('n_replies'),
                                        'pos'           => $this->db->f('pos'),
!                                       'depth' => $this->db->f('depth'),
!                                       'last_reply'=> 
($last_post?$last_post:$GLOBALS['phpgw']->common->show_date($this->db->from_timestamp($this->db->f('postdate'))))
                                );
  
--- 291,301 ----
                                }
                                $thread[] = Array(
!                                       'id'            => $this->db->f('id'),
!                                       'subject'       => 
$this->db->f('subject',True),
!                                       'author'        => 
$this->db->f('thread_owner'),
                                        'replies'       => 
$this->db->f('n_replies'),
                                        'pos'           => $this->db->f('pos'),
!                                       'depth'         => 
$this->db->f('depth'),
!                                       'last_reply'    => 
($last_post?$last_post:$GLOBALS['phpgw']->common->show_date($this->db->from_timestamp($this->db->f('postdate'))))
                                );
  
***************
*** 258,264 ****
                {
                        $db2 = $GLOBALS['phpgw']->db;
!                       $db2->query('select thread from phpgw_forum_threads 
where id='.$msg_id,__LINE__,__FILE__);
                        $db2->next_record();
!                       $this->db->query('select * from phpgw_forum_threads 
where id >= '.$msg_id.' and cat_id='.$cat_id.' and for_id='.$forum_id.' and 
thread='.$db2->f('thread').' order by parent,id',__LINE__,__FILE__);
                        if(!$this->db->num_rows())
                        {
--- 307,318 ----
                {
                        $db2 = $GLOBALS['phpgw']->db;
!                       $db2->query('SELECT thread FROM phpgw_forum_threads 
WHERE id='.intval($msg_id),__LINE__,__FILE__);
                        $db2->next_record();
!                       $this->db->query('SELECT * FROM phpgw_forum_threads'
!                               . ' WHERE id >= '.intval($msg_id)
!                               . ' AND cat_id='.intval($cat_id)
!                               . ' AND for_id='.intval($forum_id)
!                               . ' and thread='.$db2->f('thread')
!                               . ' ORDER BY parent,id',__LINE__,__FILE__);
                        if(!$this->db->num_rows())
                        {
***************
*** 267,271 ****
                        while($this->db->next_record())
                        {
!                               $subject = $this->db->f('subject');
                                if (!$subject)
                                {
--- 321,325 ----
                        while($this->db->next_record())
                        {
!                               $subject = $this->db->f('subject', True);
                                if (!$subject)
                                {
***************
*** 273,286 ****
                                }
  
!                               $db2->query('select * from phpgw_forum_body 
where id='.$this->db->f('id'),__LINE__,__FILE__);
                                $db2->next_record();
                                $message = 
$GLOBALS['phpgw']->strip_html($db2->f('message'));
  
                                $msg[] = Array(
!                                       'id'    => $this->db->f('id'),
!                                       'main'  => $this->db->f('main'),
                                        'parent'        => 
$this->db->f('parent'),
                                        'thread'        => 
$this->db->f('thread'),
!                                       'depth' => ($this->db->f('depth') + 1),
                                        'pos'           => $this->db->f('pos'),
                                        'subject'       => $subject,
--- 327,341 ----
                                }
  
!                               $db2->query('SELECT * FROM phpgw_forum_body'
!                                       . ' WHERE 
id='.$this->db->f('id'),__LINE__,__FILE__);
                                $db2->next_record();
                                $message = 
$GLOBALS['phpgw']->strip_html($db2->f('message'));
  
                                $msg[] = Array(
!                                       'id'            => $this->db->f('id'),
!                                       'main'          => $this->db->f('main'),
                                        'parent'        => 
$this->db->f('parent'),
                                        'thread'        => 
$this->db->f('thread'),
!                                       'depth'         => 
($this->db->f('depth') + 1),
                                        'pos'           => $this->db->f('pos'),
                                        'subject'       => $subject,





reply via email to

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