function delWord() { if (isset($_POST['delWordSubmit'])) { $badWord = getBadWord(); foreach ($badWord as $k => $v) { if (!strcasecmp(mb_strtolower($v), mb_strtolower($_POST['delWord']))) { unset($badWord[$k]); } } $badWordDB = serialize($badWord); file_put_contents("cencored/del", $badWordDB); } }
function cenZor($post, $key) { /* Функция цензурирования */ $cens = getBadWord(); $postTemp["userName"] = md5($post["userName"]); $postTemp["userMassage"] = md5($post["userMassage"]); foreach ($cens as $word) { $post["userName"] = str_ireplace($word, "МАТ", $post['userName']); $post["userMassage"] = str_ireplace($word, "МАТ", $post['userMassage']); } if ($postTemp["userName"] != md5($post["userName"])) { $post["cencored"] = $key; } elseif ($postTemp["userMassage"] != md5($post["userMassage"])) { $post["cencored"] = $key; } return $post; }
</div> <div class="col-sm-6"> <label for="showNoCencored">Проказать коменты без мата</label> <input type="checkbox" id="showNoCencored"> </div> </div> <div class="clearfix"></div> <?php $massage = getContent(); showComment($massage, true); ?> </div> <div role="tabpanel" class="tab-pane fade" id="addBadWords"> <div id="addBadWordInfo"> <div class="col-sm-6" id="badWordCount"><p>В словаре <?php echo count(getBadWord()); ?> слов(а)</p></div> <div class="col-sm-6"><a href="cencored/cen.db" download>Скачать список слов</a></div> </div> <div class="clearfix"></div> <form action="<?php echo $_SERVER['REQUEST_URI']; ?> " method="post" class="form-group"> <h2 class="headH2">Добывить слова</h2> <textarea name="badWord" cols="36" rows="10" placeholder="Вводите слова с новой строчки" class="form-control" required></textarea><br> <input type="submit" name="submit" class="addBtn button"> </form> <?php