Campsite /campsite/src/include/phorum/include/admin/badwords.php

Language PHP Lines 132
MD5 Hash 33e5ba6af530b22583d0cb60d0511679
Repository https://github.com/joechrysler/Campsite.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//   Copyright (C) 2006  Phorum Development Team                              //
//   http://www.phorum.org                                                    //
//                                                                            //
//   This program is free software. You can redistribute it and/or modify     //
//   it under the terms of either the current Phorum License (viewable at     //
//   phorum.org) or the Phorum License that was distributed with this file    //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   You should have received a copy of the Phorum License                    //
//   along with this program.                                                 //
////////////////////////////////////////////////////////////////////////////////

    if(!defined("PHORUM_ADMIN")) return;

    $error="";
    $curr="NEW";

    // retrieving the forum-info
    $forum_list=phorum_get_forum_info(2);

    $forum_list[0]="GLOBAL";

    // conversion of old data if existing
    if(isset($PHORUM["bad_words"]) && count($PHORUM['bad_words'])) {
    print "upgrading badwords<br>";
        foreach($PHORUM['bad_words'] as $key => $data) {
            phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$data ,0 ,0);
            unset($PHORUM["bad_words"][$key]);
        }
        phorum_db_update_settings(array("bad_words"=>$PHORUM["bad_words"]));
    }

    if(count($_POST) && $_POST["string"]!=""){
        if($_POST["curr"]!="NEW"){
            $ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forumid'] ,$_POST['curr']);
        } else {
            $ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forumid'] ,0);
        }

        if(!$ret){
            $error="Database error while updating badwords.";
        } else {
            echo "Bad Word Added<br />";
        }
    }

    if(isset($_GET["curr"])){
        if(isset($_GET["delete"])){
            phorum_db_del_banitem($_GET['curr']);
            echo "Ban Item Deleted<br />";
        } else {
            $curr = $_GET["curr"];
        }
    }
    if($curr!="NEW"){
        extract(phorum_db_get_banitem($curr));
        $title="Edit Bad Word Item";
        $submit="Update";
    } else {
        settype($string, "string");
        settype($type, "int");
        settype($pcre, "int");
        settype($forumid,"int");
        $title="Add A Bad Word";
        $submit="Add";
    }


    settype($string, "string");
    settype($type, "int");
    settype($pcre, "int");

    if($error){
        phorum_admin_error($error);
    }

    // load bad-words-list
    $banlists=phorum_db_get_banlists();
    $bad_words=$banlists[PHORUM_BAD_WORDS];

    include_once "./include/admin/PhorumInputForm.php";

    $frm = new PhorumInputForm ("", "post", $submit);

    $frm->hidden("module", "badwords");

    $frm->hidden("curr", "$curr");

    $frm->addbreak($title);

    $frm->addrow("Bad Word", $frm->text_box("string", $string, 50));

    $frm->addrow("Valid for Forum", $frm->select_tag("forumid", $forum_list, $forumid));

    $frm->show();

    echo "<hr class=\"PhorumAdminHR\" />";

    if(count($bad_words)){

        echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
        echo "<tr>\n";
        echo "    <td class=\"PhorumAdminTableHead\">Word</td>\n";
        echo "    <td class=\"PhorumAdminTableHead\">Valid for Forum</td>\n";
        echo "    <td class=\"PhorumAdminTableHead\">&nbsp;</td>\n";
        echo "</tr>\n";

        foreach($bad_words as $key => $item){
            $ta_class = "PhorumAdminTableRow".($ta_class == "PhorumAdminTableRow" ? "Alt" : "");
            echo "<tr>\n";
            echo "    <td class=\"".$ta_class."\">".htmlspecialchars($item[string])."</td>\n";
            echo "    <td class=\"".$ta_class."\">".$forum_list[$item["forum_id"]]."</td>\n";
            echo "    <td class=\"".$ta_class."\"><a href=\"$_SERVER[PHP_SELF]?module=badwords&curr=$key&edit=1\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=badwords&curr=$key&delete=1\">Delete</a></td>\n";
            echo "</tr>\n";
        }

        echo "</table>\n";

    } else {

        echo "No bad words in list currently.";

    }
?>
Back to Top