phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: forum/inc class.uiadmin.inc.php,NONE,1.1.2.1 hoo


From: Mark A Peters <address@hidden>
Subject: [Phpgroupware-cvs] CVS: forum/inc class.uiadmin.inc.php,NONE,1.1.2.1 hook_admin.inc.php,1.19,1.19.2.1 class.boforum.inc.php,1.1.2.3,1.1.2.4 class.soforum.inc.php,1.1.2.2,1.1.2.3
Date: Thu, 24 Jan 2002 21:38:06 -0500

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

Modified Files:
      Tag: Version-0_9_14-branch
        hook_admin.inc.php class.boforum.inc.php class.soforum.inc.php 
Added Files:
      Tag: Version-0_9_14-branch
        class.uiadmin.inc.php 
Log Message:
This is now using 3-tier design for the forum admin functions.  Still need the 
preferences.


***** Error reading new file: [Errno 2] No such file or directory: 
'class.uiadmin.inc.php'
Index: hook_admin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/forum/inc/hook_admin.inc.php,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -C2 -r1.19 -r1.19.2.1
*** hook_admin.inc.php  21 Nov 2001 03:22:07 -0000      1.19
--- hook_admin.inc.php  25 Jan 2002 02:38:03 -0000      1.19.2.1
***************
*** 15,19 ****
        $title = $appname;
        $file = Array(
!               'Forum Administration' => 
$GLOBALS['phpgw']->link('/forum/admin/index.php','appname='.$appname)
        );
  //Do not modify below this line
--- 15,20 ----
        $title = $appname;
        $file = Array(
! //            'Forum Administration' => 
$GLOBALS['phpgw']->link('/forum/admin/index.php','appname='.$appname)
!               'Forum Administration' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiadmin.index')
        );
  //Do not modify below this line

Index: class.boforum.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/forum/inc/class.boforum.inc.php,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** class.boforum.inc.php       20 Jan 2002 12:07:24 -0000      1.1.2.3
--- class.boforum.inc.php       25 Jan 2002 02:38:03 -0000      1.1.2.4
***************
*** 18,22 ****
                var $public_functions = array(
                        'reply' => True,
!                       'post'  => True
                );
  
--- 18,26 ----
                var $public_functions = array(
                        'reply' => True,
!                       'post'  => True,
!                       'delete_category'       => True,
!                       'delete_forum'  => True,
!                       'category'      => True,
!                       'forum' => True
                );
  
***************
*** 52,57 ****
                        {
                                $var_str = $var[$i];
!                               $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,61 ----
                        {
                                $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);
                        }
                        if(address@hidden($this->view))
***************
*** 133,136 ****
--- 137,188 ----
                        }
                        Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiforum.threads'));
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+ 
+               function delete_category()
+               {
+                       if(!$GLOBALS['phpgw_info']['user']['apps']['admin'])
+                       {
+                               Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiforum.index'));
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+                       $this->so->delete_category($this->cat_id);
+                       Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiadmin.index'));
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+ 
+               function delete_forum()
+               {
+                       if(!$GLOBALS['phpgw_info']['user']['apps']['admin'])
+                       {
+                               Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiforum.index'));
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+                       $this->so->delete_forum($this->cat_id,$this->forum_id);
+                       Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiadmin.index'));
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+ 
+               function category()
+               {
+                       if(!$GLOBALS['phpgw_info']['user']['apps']['admin'])
+                       {
+                               Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiforum.index'));
+                               $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();
+               }
+ 
+               function forum()
+               {
+                       if(!$GLOBALS['phpgw_info']['user']['apps']['admin'])
+                       {
+                               Header('Location: 
'.$GLOBALS['phpgw']->link('/index.php','menuaction=forum.uiforum.index'));
+                               $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();
                }

Index: class.soforum.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/forum/inc/class.soforum.inc.php,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** class.soforum.inc.php       20 Jan 2002 12:07:24 -0000      1.1.2.2
--- class.soforum.inc.php       25 Jan 2002 02:38:03 -0000      1.1.2.3
***************
*** 16,19 ****
--- 16,21 ----
        class soforum
        {
+               var $debug=False;
+               
                var $db;
  
***************
*** 23,26 ****
--- 25,93 ----
                }
  
+               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 
cat_id='.$cat_id;
+                       $this->db->query($query,__LINE__,__FILE__);
+               }
+ 
+               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__);
+               }
+ 
+               function save_category($cat)
+               {
+                       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('".$forum['name']."','".$forum['descr']."')";
+                       }
+                       $this->db->query($query,__LINE__,__FILE__);
+               }
+ 
+               function save_forum($forum)
+               {
+                       if($forum['id'])
+                       {
+                               if(intval($forum['orig_cat_id']) == 
intval($forum['cat_id']))
+                               {
+                                       if($this->debug)
+                                       {
+                                               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
+                               {
+                                       $new_forum_id = 
$this->get_max_forum_id($forum['cat_id']) + 1;
+                                       $query = 'UPDATE phpgw_forum_forums SET 
cat_id='.$forum['cat_id'].', id='.$new_forum_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'].', for_id='.$new_forum_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'].', for_id='.$new_forum_id." WHERE 
cat_id=".$forum['orig_cat_id'].' and for_id='.$forum['id'];
+                               }
+                       }
+                       else
+                       {
+                               $new_forum_id = 
$this->get_max_forum_id($forum['cat_id']) + 1;
+                               $query = 'INSERT INTO 
phpgw_forum_forums(cat_id,id,name,descr) 
VALUES('.$forum['cat_id'].','.$new_forum_id.",'".$forum['name']."','".$forum['descr']."')";
+                       }
+                       $this->db->query($query,__LINE__,__FILE__);
+               }
+ 
                function add_reply($data)
                {
***************
*** 44,47 ****
--- 111,121 ----
                }
  
+               function get_max_forum_id($cat_id)
+               {
+                       $this->db->query('select max(id) from 
phpgw_forum_forums where cat_id='.$cat_id,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return $this->db->f(0);
+               }
+ 
                function get_max_body_id()
                {
***************
*** 73,77 ****
                function get_cat_ids()
                {
!                       $this->db->query('select * from 
phpgw_forum_categories',__LINE__,__FILE__);
                        while($this->db->next_record())
                        {
--- 147,151 ----
                function get_cat_ids()
                {
!                       $this->db->query('select * from phpgw_forum_categories 
order by id',__LINE__,__FILE__);
                        while($this->db->next_record())
                        {




reply via email to

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