[ Index ] |
|
Code source de Phorum 5.1.25 |
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 $ban_types = array(PHORUM_BAD_IPS=>"IP Address/Hostname", PHORUM_BAD_NAMES=>"Name/User Name", PHORUM_BAD_EMAILS=>"Email Address", PHORUM_BAD_USERID=>"User-Id (registered User)", PHORUM_BAD_SPAM_WORDS=>"Illegal Words (SPAM)"); 26 27 $match_types = array("string", "PCRE"); 28 29 $forum_list=phorum_get_forum_info(2); 30 $forum_list[0]="GLOBAL"; 31 32 if(count($_POST) && $_POST["string"]!=""){ 33 34 if($_POST["curr"]!="NEW"){ 35 $ret=phorum_db_mod_banlists($_POST['type'],$_POST['pcre'],$_POST['string'],$_POST['forum_id'],$_POST["curr"]); 36 } else { 37 $ret=phorum_db_mod_banlists($_POST['type'],$_POST['pcre'],$_POST['string'],$_POST['forum_id'],0); 38 } 39 40 if(!$ret){ 41 $error="Database error while updating settings."; 42 } else { 43 phorum_admin_okmsg("Ban Item Updated"); 44 } 45 } 46 47 if(isset($_POST["curr"]) && isset($_POST["delete"]) && $_POST["confirm"]=="Yes"){ 48 phorum_db_del_banitem((int)$_POST['curr']); 49 phorum_admin_okmsg("Ban Item Deleted"); 50 } 51 52 if(isset($_GET["curr"])){ 53 $curr = (int)$_GET["curr"]; 54 } 55 56 if($curr!="NEW"){ 57 extract(phorum_db_get_banitem($curr)); 58 $title="Edit Ban Item"; 59 $submit="Update"; 60 } else { 61 settype($string, "string"); 62 settype($type, "int"); 63 settype($pcre, "int"); 64 settype($forum_id,"int"); 65 $title="Add A Ban Item"; 66 $submit="Add"; 67 } 68 69 if($error){ 70 phorum_admin_error($error); 71 } 72 73 if($_GET["curr"] && $_GET["delete"]){ 74 75 ?> 76 77 <div class="PhorumInfoMessage"> 78 Are you sure you want to delete this entry? 79 <form action="<?php echo $PHORUM["admin_http_path"] ?>" method="post"> 80 <input type="hidden" name="module" value="<?php echo $module; ?>" /> 81 <input type="hidden" name="curr" value="<?php echo $_GET['curr']; ?>" /> 82 <input type="hidden" name="delete" value="1" /> 83 <input type="submit" name="confirm" value="Yes" /> <input type="submit" name="confirm" value="No" /> 84 </form> 85 </div> 86 87 <?php 88 89 } else { 90 91 include_once "./include/admin/PhorumInputForm.php"; 92 93 $frm =& new PhorumInputForm ("", "post", $submit); 94 95 $frm->hidden("module", "banlist"); 96 97 $frm->hidden("curr", "$curr"); 98 99 $frm->addbreak($title); 100 101 $frm->addrow("String To Match", $frm->text_box("string", $string, 50)); 102 103 $frm->addrow("Field To Match", $frm->select_tag("type", $ban_types, $type)); 104 105 $frm->addrow("Compare As", $frm->select_tag("pcre", $match_types, $pcre)); 106 107 $frm->addrow("Valid for Forum", $frm->select_tag("forum_id", $forum_list, $forum_id)); 108 109 $frm->show(); 110 111 echo "If using PCRE for comparison, \"String To Match\" should be a valid PCRE expression. See <a href=\"http://php.net/pcre\" target=\"_blank\">the PHP manual</a> for more information."; 112 113 if($curr=="NEW"){ 114 115 $PHORUM['banlists']=phorum_db_get_banlists(true); 116 unset($PHORUM['banlists'][PHORUM_BAD_WORDS]); 117 118 echo "<hr class=\"PhorumAdminHR\" />"; 119 120 if(count($PHORUM['banlists'])){ 121 122 echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n"; 123 echo "<tr>\n"; 124 echo " <td class=\"PhorumAdminTableHead\">String</td>\n"; 125 echo " <td class=\"PhorumAdminTableHead\">Field</td>\n"; 126 echo " <td class=\"PhorumAdminTableHead\">Compare Method</td>\n"; 127 echo " <td class=\"PhorumAdminTableHead\">Valid for Forum</td>\n"; 128 echo " <td class=\"PhorumAdminTableHead\"> </td>\n"; 129 echo "</tr>\n"; 130 131 132 133 foreach($PHORUM["banlists"] as $type => $content){ 134 $t_last_string = ''; 135 foreach($content as $key => $item){ 136 $ta_class = "PhorumAdminTableRow".($ta_class == "PhorumAdminTableRow" ? "Alt" : ""); 137 echo "<tr>\n"; 138 echo " <td class=\"".$ta_class."\"".($item["string"] == $t_last_string ? " style=\"color:red;\"" : "").">".htmlspecialchars($item['string'])."</td>\n"; 139 echo " <td class=\"".$ta_class."\">".$ban_types[$type]."</td>\n"; 140 echo " <td class=\"".$ta_class."\">".$match_types[$item["pcre"]]."</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=banlist&curr=$key&edit=1\">Edit</a> • <a href=\"{$PHORUM["admin_http_path"]}?module=banlist&curr=$key&delete=1\">Delete</a></td>\n"; 143 echo "</tr>\n"; 144 $t_last_string = $item["string"]; 145 } 146 } 147 148 echo "</table>\n"; 149 150 } else { 151 152 echo "No bans in list currently."; 153 154 } 155 156 } 157 } 158 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:22:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |