[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/include/admin/ -> badwords.php (source)

   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          echo "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['forum_id'] ,$_POST['curr']);
  43          } else {
  44              $ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forum_id'] ,0);
  45          }
  46  
  47          if(!$ret){
  48              $error="Database error while updating badwords.";
  49          } else {
  50              if($_POST["curr"]!="NEW"){
  51                  phorum_admin_okmsg("Bad Word Updated");
  52              } else {
  53                  phorum_admin_okmsg("Bad Word Added");
  54              }
  55          }
  56      }
  57  
  58      if(isset($_POST["curr"]) && isset($_POST["delete"]) && $_POST["confirm"]=="Yes"){
  59          phorum_db_del_banitem((int)$_POST['curr']);
  60          phorum_admin_okmsg("Bad Word Deleted");
  61      }
  62  
  63      if(isset($_GET["curr"])){
  64          $curr = $_GET["curr"];
  65      }
  66  
  67      if($curr!="NEW"){
  68          $ban = phorum_db_get_banitem($curr);
  69          extract($ban);
  70          $title="Edit Bad Word Item";
  71          $submit="Update";
  72      } else {
  73          $title="Add A Bad Word";
  74          $submit="Add";
  75      }
  76  
  77      settype($string, "string");
  78      settype($type, "int");
  79      settype($pcre, "int");
  80      settype($forum_id,"int");
  81  
  82      if($error){
  83          phorum_admin_error($error);
  84      }
  85  
  86      if($_GET["curr"] && $_GET["delete"]){
  87  
  88          ?>
  89  
  90          <div class="PhorumInfoMessage">
  91              Are you sure you want to delete this entry?
  92              <form action="<?php echo $PHORUM["admin_http_path"] ?>" method="post">
  93                  <input type="hidden" name="module" value="<?php echo $module; ?>" />
  94                  <input type="hidden" name="curr" value="<?php echo $_GET['curr']; ?>" />
  95                  <input type="hidden" name="delete" value="1" />
  96                  <input type="submit" name="confirm" value="Yes" />&nbsp;<input type="submit" name="confirm" value="No" />
  97              </form>
  98          </div>
  99  
 100          <?php
 101  
 102      } else {
 103  
 104  
 105          // load bad-words-list
 106          $banlists=phorum_db_get_banlists();
 107          $bad_words=$banlists[PHORUM_BAD_WORDS];
 108  
 109          include_once  "./include/admin/PhorumInputForm.php";
 110  
 111          $frm =& new PhorumInputForm ("", "post", $submit);
 112  
 113          $frm->hidden("module", "badwords");
 114  
 115          $frm->hidden("curr", "$curr");
 116  
 117          $row = $frm->addbreak($title);
 118          $frm->addhelp($row, "Censor List", "This feature can be used to mask bad words in forum messages with \"".PHORUM_BADWORD_REPLACE."\". All bad words will automatically be replaced by that string.<br/><br/>If you want to use a different string (e.g. \"CENSORED\" or \"*****\", then change the definition of the constant \"PHORUM_BADWORD_REPLACE\" in the Phorum file include/constants.php.");
 119  
 120          $frm->addrow("Bad Word", $frm->text_box("string", $string, 50));
 121  
 122          $frm->addrow("Valid for Forum", $frm->select_tag("forum_id", $forum_list, $forum_id));
 123  
 124          $frm->show();
 125  
 126          echo "<hr class=\"PhorumAdminHR\" />";
 127  
 128          if(count($bad_words)){
 129  
 130              echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
 131              echo "<tr>\n";
 132              echo "    <td class=\"PhorumAdminTableHead\">Word</td>\n";
 133              echo "    <td class=\"PhorumAdminTableHead\">Valid for Forum</td>\n";
 134              echo "    <td class=\"PhorumAdminTableHead\">&nbsp;</td>\n";
 135              echo "</tr>\n";
 136  
 137              foreach($bad_words as $key => $item){
 138                  $ta_class = "PhorumAdminTableRow".($ta_class == "PhorumAdminTableRow" ? "Alt" : "");
 139                  echo "<tr>\n";
 140                  echo "    <td class=\"".$ta_class."\">".htmlspecialchars($item[string])."</td>\n";
 141                  echo "    <td class=\"".$ta_class."\">".$forum_list[$item["forum_id"]]."</td>\n";
 142                  echo "    <td class=\"".$ta_class."\"><a href=\"{$PHORUM["admin_http_path"]}?module=badwords&curr=$key&edit=1\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"{$PHORUM["admin_http_path"]}?module=badwords&curr=$key&delete=1\">Delete</a></td>\n";
 143                  echo "</tr>\n";
 144              }
 145  
 146              echo "</table>\n";
 147  
 148          } else {
 149  
 150              echo "No bad words in list currently.";
 151  
 152          }
 153      }
 154  ?>


Généré le : Thu Nov 29 12:22:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics