| 831 | 
           florian | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
              | 
        
        
            | 
            | 
           3 | 
           ////////////////////////////////////////////////////////////////////////////////
  | 
        
        
            | 
            | 
           4 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           5 | 
           //   Copyright (C) 2006  Phorum Development Team                              //
  | 
        
        
            | 
            | 
           6 | 
           //   http://www.phorum.org                                                    //
  | 
        
        
            | 
            | 
           7 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           8 | 
           //   This program is free software. You can redistribute it and/or modify     //
  | 
        
        
            | 
            | 
           9 | 
           //   it under the terms of either the current Phorum License (viewable at     //
  | 
        
        
            | 
            | 
           10 | 
           //   phorum.org) or the Phorum License that was distributed with this file    //
  | 
        
        
            | 
            | 
           11 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           12 | 
           //   This program is distributed in the hope that it will be useful,          //
  | 
        
        
            | 
            | 
           13 | 
           //   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
  | 
        
        
            | 
            | 
           14 | 
           //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
  | 
        
        
            | 
            | 
           15 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           16 | 
           //   You should have received a copy of the Phorum License                    //
  | 
        
        
            | 
            | 
           17 | 
           //   along with this program.                                                 //
  | 
        
        
            | 
            | 
           18 | 
           ////////////////////////////////////////////////////////////////////////////////
  | 
        
        
            | 
            | 
           19 | 
              | 
        
        
            | 
            | 
           20 | 
               if(!defined("PHORUM_ADMIN")) return;
  | 
        
        
            | 
            | 
           21 | 
              | 
        
        
            | 
            | 
           22 | 
               $error="";
  | 
        
        
            | 
            | 
           23 | 
               $curr="NEW";
  | 
        
        
            | 
            | 
           24 | 
              | 
        
        
            | 
            | 
           25 | 
               // retrieving the forum-info
  | 
        
        
            | 
            | 
           26 | 
               $forum_list=phorum_get_forum_info(2);
  | 
        
        
            | 
            | 
           27 | 
              | 
        
        
            | 
            | 
           28 | 
               $forum_list[0]="GLOBAL";
  | 
        
        
            | 
            | 
           29 | 
              | 
        
        
            | 
            | 
           30 | 
               // conversion of old data if existing
  | 
        
        
            | 
            | 
           31 | 
               if(isset($PHORUM["bad_words"]) && count($PHORUM['bad_words'])) {
  | 
        
        
            | 
            | 
           32 | 
               print "upgrading badwords<br>";
  | 
        
        
            | 
            | 
           33 | 
                   foreach($PHORUM['bad_words'] as $key => $data) {
  | 
        
        
            | 
            | 
           34 | 
                       phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$data ,0 ,0);
  | 
        
        
            | 
            | 
           35 | 
                       unset($PHORUM["bad_words"][$key]);
  | 
        
        
            | 
            | 
           36 | 
                   }
  | 
        
        
            | 
            | 
           37 | 
                   phorum_db_update_settings(array("bad_words"=>$PHORUM["bad_words"]));
  | 
        
        
            | 
            | 
           38 | 
               }
  | 
        
        
            | 
            | 
           39 | 
              | 
        
        
            | 
            | 
           40 | 
               if(count($_POST) && $_POST["string"]!=""){
  | 
        
        
            | 
            | 
           41 | 
                   if($_POST["curr"]!="NEW"){
  | 
        
        
            | 
            | 
           42 | 
                       $ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forumid'] ,$_POST['curr']);
  | 
        
        
            | 
            | 
           43 | 
                   } else {
  | 
        
        
            | 
            | 
           44 | 
                       $ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forumid'] ,0);
  | 
        
        
            | 
            | 
           45 | 
                   }
  | 
        
        
            | 
            | 
           46 | 
              | 
        
        
            | 
            | 
           47 | 
                   if(!$ret){
  | 
        
        
            | 
            | 
           48 | 
                       $error="Database error while updating badwords.";
  | 
        
        
            | 
            | 
           49 | 
                   } else {
  | 
        
        
            | 
            | 
           50 | 
                       echo "Bad Word Added<br />";
  | 
        
        
            | 
            | 
           51 | 
                   }
  | 
        
        
            | 
            | 
           52 | 
               }
  | 
        
        
            | 
            | 
           53 | 
              | 
        
        
            | 
            | 
           54 | 
               if(isset($_GET["curr"])){
  | 
        
        
            | 
            | 
           55 | 
                   if(isset($_GET["delete"])){
  | 
        
        
            | 
            | 
           56 | 
                       phorum_db_del_banitem($_GET['curr']);
  | 
        
        
            | 
            | 
           57 | 
                       echo "Ban Item Deleted<br />";
  | 
        
        
            | 
            | 
           58 | 
                   } else {
  | 
        
        
            | 
            | 
           59 | 
                       $curr = $_GET["curr"];
  | 
        
        
            | 
            | 
           60 | 
                   }
  | 
        
        
            | 
            | 
           61 | 
               }
  | 
        
        
            | 
            | 
           62 | 
               if($curr!="NEW"){
  | 
        
        
            | 
            | 
           63 | 
                   extract(phorum_db_get_banitem($curr));
  | 
        
        
            | 
            | 
           64 | 
                   $title="Edit Bad Word Item";
  | 
        
        
            | 
            | 
           65 | 
                   $submit="Update";
  | 
        
        
            | 
            | 
           66 | 
               } else {
  | 
        
        
            | 
            | 
           67 | 
                   settype($string, "string");
  | 
        
        
            | 
            | 
           68 | 
                   settype($type, "int");
  | 
        
        
            | 
            | 
           69 | 
                   settype($pcre, "int");
  | 
        
        
            | 
            | 
           70 | 
                   settype($forumid,"int");
  | 
        
        
            | 
            | 
           71 | 
                   $title="Add A Bad Word";
  | 
        
        
            | 
            | 
           72 | 
                   $submit="Add";
  | 
        
        
            | 
            | 
           73 | 
               }
  | 
        
        
            | 
            | 
           74 | 
              | 
        
        
            | 
            | 
           75 | 
              | 
        
        
            | 
            | 
           76 | 
               settype($string, "string");
  | 
        
        
            | 
            | 
           77 | 
               settype($type, "int");
  | 
        
        
            | 
            | 
           78 | 
               settype($pcre, "int");
  | 
        
        
            | 
            | 
           79 | 
              | 
        
        
            | 
            | 
           80 | 
               if($error){
  | 
        
        
            | 
            | 
           81 | 
                   phorum_admin_error($error);
  | 
        
        
            | 
            | 
           82 | 
               }
  | 
        
        
            | 
            | 
           83 | 
              | 
        
        
            | 
            | 
           84 | 
               // load bad-words-list
  | 
        
        
            | 
            | 
           85 | 
               $banlists=phorum_db_get_banlists();
  | 
        
        
            | 
            | 
           86 | 
               $bad_words=$banlists[PHORUM_BAD_WORDS];
  | 
        
        
            | 
            | 
           87 | 
              | 
        
        
            | 
            | 
           88 | 
               include_once "./include/admin/PhorumInputForm.php";
  | 
        
        
            | 
            | 
           89 | 
              | 
        
        
            | 
            | 
           90 | 
               $frm =& new PhorumInputForm ("", "post", $submit);
  | 
        
        
            | 
            | 
           91 | 
              | 
        
        
            | 
            | 
           92 | 
               $frm->hidden("module", "badwords");
  | 
        
        
            | 
            | 
           93 | 
              | 
        
        
            | 
            | 
           94 | 
               $frm->hidden("curr", "$curr");
  | 
        
        
            | 
            | 
           95 | 
              | 
        
        
            | 
            | 
           96 | 
               $frm->addbreak($title);
  | 
        
        
            | 
            | 
           97 | 
              | 
        
        
            | 
            | 
           98 | 
               $frm->addrow("Bad Word", $frm->text_box("string", $string, 50));
  | 
        
        
            | 
            | 
           99 | 
              | 
        
        
            | 
            | 
           100 | 
               $frm->addrow("Valid for Forum", $frm->select_tag("forumid", $forum_list, $forumid));
  | 
        
        
            | 
            | 
           101 | 
              | 
        
        
            | 
            | 
           102 | 
               $frm->show();
  | 
        
        
            | 
            | 
           103 | 
              | 
        
        
            | 
            | 
           104 | 
               echo "<hr class=\"PhorumAdminHR\" />";
  | 
        
        
            | 
            | 
           105 | 
              | 
        
        
            | 
            | 
           106 | 
               if(count($bad_words)){
  | 
        
        
            | 
            | 
           107 | 
              | 
        
        
            | 
            | 
           108 | 
                   echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
  | 
        
        
            | 
            | 
           109 | 
                   echo "<tr>\n";
  | 
        
        
            | 
            | 
           110 | 
                   echo "    <td class=\"PhorumAdminTableHead\">Word</td>\n";
  | 
        
        
            | 
            | 
           111 | 
                   echo "    <td class=\"PhorumAdminTableHead\">Valid for Forum</td>\n";
  | 
        
        
            | 
            | 
           112 | 
                   echo "    <td class=\"PhorumAdminTableHead\"> </td>\n";
  | 
        
        
            | 
            | 
           113 | 
                   echo "</tr>\n";
  | 
        
        
            | 
            | 
           114 | 
              | 
        
        
            | 
            | 
           115 | 
                   foreach($bad_words as $key => $item){
  | 
        
        
            | 
            | 
           116 | 
                       $ta_class = "PhorumAdminTableRow".($ta_class == "PhorumAdminTableRow" ? "Alt" : "");
  | 
        
        
            | 
            | 
           117 | 
                       echo "<tr>\n";
  | 
        
        
            | 
            | 
           118 | 
                       echo "    <td class=\"".$ta_class."\">".htmlspecialchars($item[string])."</td>\n";
  | 
        
        
            | 
            | 
           119 | 
                       echo "    <td class=\"".$ta_class."\">".$forum_list[$item["forum_id"]]."</td>\n";
  | 
        
        
            | 
            | 
           120 | 
                       echo "    <td class=\"".$ta_class."\"><a href=\"$_SERVER[PHP_SELF]?module=badwords&curr=$key&edit=1\">Edit</a> • <a href=\"$_SERVER[PHP_SELF]?module=badwords&curr=$key&delete=1\">Delete</a></td>\n";
  | 
        
        
            | 
            | 
           121 | 
                       echo "</tr>\n";
  | 
        
        
            | 
            | 
           122 | 
                   }
  | 
        
        
            | 
            | 
           123 | 
              | 
        
        
            | 
            | 
           124 | 
                   echo "</table>\n";
  | 
        
        
            | 
            | 
           125 | 
              | 
        
        
            | 
            | 
           126 | 
               } else {
  | 
        
        
            | 
            | 
           127 | 
              | 
        
        
            | 
            | 
           128 | 
                   echo "No bad words in list currently.";
  | 
        
        
            | 
            | 
           129 | 
              | 
        
        
            | 
            | 
           130 | 
               }
  | 
        
        
            | 
            | 
           131 | 
           ?>
  |