00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: postmod_filters.php 5187 2005-12-01 16:22:29Z yeupou $
00006 #
00007 # Copyright 1999-2000 (c) The SourceForge Crew
00008 # Copyright 2000-2003 (c) Free Software Foundation
00009 #
00010 # Copyright 2004 (c) ...
00011 #
00012 # The Savane project is free software; you can redistribute it and/or
00013 # modify it under the terms of the GNU General Public License
00014 # as published by the Free Software Foundation; either version 2
00015 # of the License, or (at your option) any later version.
00016 #
00017 # The Savane project is distributed in the hope that it will be useful,
00018 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 # GNU General Public License for more details.
00021 #
00022 # You should have received a copy of the GNU General Public License
00023 # along with the Savane project; if not, write to the Free Software
00024 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00025
00026 exit;
00027
00028 if (user_isloggedin()) {
00029
00030 if ($subfunc=="mod") {
00031
00032 if ($delete_filter) {
00033
00034 $result=db_query("DELETE FROM bug_filter WHERE filter_id='$filter_id' AND user_id='".user_getid()."' AND group_id='$group_id'");
00035
00036 if (!$result) {
00037 bug_header(array ("title"=>"Filter Delete Failed"));
00038 echo "<H1>Delete failed</H2>";
00039 echo db_error();
00040 bug_footer(array());
00041 exit;
00042 } else {
00043 " Successfully Deleted Filter ";
00044 }
00045
00046 } else {
00047 $sql_clause=eregi_replace('drop','',$sql_clause);
00048 $sql_clause=eregi_replace('update','',$sql_clause);
00049 $sql_clause=eregi_replace('insert','',$sql_clause);
00050 $sql_clause=eregi_replace('delete','',$sql_clause);
00051
00052
00053
00054
00055 $toss=db_query("UPDATE bug_filter SET is_active='0' WHERE user_id='".user_getid()."' AND group_id='$group_id'");
00056
00057
00058
00059
00060 $sql="UPDATE bug_filter SET sql_clause='$sql_clause',is_active='1' WHERE filter_id='$filter_id' AND user_id='".user_getid()."'";
00061 $result=db_query($sql);
00062 if (!$result) {
00063 bug_header(array ("title"=>"Filter Update Failed"));
00064 echo "<H1>Update failed</H2>";
00065 echo db_error();
00066 bug_footer(array());
00067 exit;
00068 } else {
00069 " Successfully Modified Filter ";
00070 }
00071
00072 }
00073
00074 } else if ($subfunc=="add") {
00075
00076
00077
00078
00079 $toss=db_query("UPDATE bug_filter SET is_active='0' WHERE user_id='".user_getid()."' AND group_id='$group_id'");
00080
00081 $sql_clause=eregi_replace('drop','',$sql_clause);
00082 $sql_clause=eregi_replace('update','',$sql_clause);
00083 $sql_clause=eregi_replace('insert','',$sql_clause);
00084 $sql_clause=eregi_replace('delete','',$sql_clause);
00085
00086
00087
00088
00089 $sql="INSERT INTO bug_filter (user_id,group_id,sql_clause,is_active) VALUES ('".user_getid()."','$group_id','$sql_clause','1')";
00090 $result=db_query($sql);
00091 if (!$result) {
00092 bug_header(array ("title"=>"Filter Add Failed"));
00093 echo "<H1>Add failed</H2>";
00094 echo db_error();
00095 bug_footer(array());
00096 exit;
00097 } else {
00098 " Successfully Added Filter ";
00099 }
00100
00101 } else if ($subfunc=="turn_off") {
00102
00103
00104
00105 $toss=db_query("UPDATE bug_filter SET is_active='0' WHERE user_id='".user_getid()."' AND group_id='$group_id'");
00106
00107 " Turned Off Filters ";
00108
00109 } else {
00110
00111 bug_header(array ("title"=>"Filter Update Failed"));
00112 echo "<H1>We are in a F.U.B.A.R. state</H2>";
00113 bug_footer(array());
00114 exit;
00115
00116 }
00117
00118 } else {
00119
00120 exit_not_logged_in();
00121
00122 }
00123
00124 ?>