diff --git a/config/modules.inc.php b/config/modules.inc.php index 9b63cdc7..060063c6 100644 --- a/config/modules.inc.php +++ b/config/modules.inc.php @@ -60,6 +60,10 @@ "enabled" => true, "name" => "System", "modules" => array ( + "blacklist" => array ( + "enabled" => true, + "name" => "BlackList" + ), "callcenter" => array ( "enabled" => true, "name" => "Callcenter" diff --git a/config/tools/system/blacklist/db.inc.php b/config/tools/system/blacklist/db.inc.php new file mode 100644 index 00000000..ff90ee18 --- /dev/null +++ b/config/tools/system/blacklist/db.inc.php @@ -0,0 +1,26 @@ + diff --git a/config/tools/system/blacklist/local.inc.php b/config/tools/system/blacklist/local.inc.php new file mode 100644 index 00000000..150d688e --- /dev/null +++ b/config/tools/system/blacklist/local.inc.php @@ -0,0 +1,26 @@ +results_per_page = 5; + $config->results_page_range = 10; + $talk_to_this_assoc_id = 1; \ No newline at end of file diff --git a/config/tools/system/blacklist/menu.inc.php b/config/tools/system/blacklist/menu.inc.php new file mode 100644 index 00000000..f8088cc5 --- /dev/null +++ b/config/tools/system/blacklist/menu.inc.php @@ -0,0 +1,35 @@ +menu_item = array( + array( + "blacklist.php", + "Global blacklist" + ), + array( + "userblacklist.php", + "User blacklist" + ), + ); +?> + diff --git a/web/tools/system/blacklist/apply_changes.php b/web/tools/system/blacklist/apply_changes.php new file mode 100644 index 00000000..b09d92de --- /dev/null +++ b/web/tools/system/blacklist/apply_changes.php @@ -0,0 +1,51 @@ + +
Sending MI command: +
+".$mi_connectors[$i]." : "; + + $message=mi_command($command, $mi_connectors[$i], $mi_type, $errors, $status); + if (!$errors) { + echo "Success"; + } + echo "
"; +} + +?> + +
\ No newline at end of file diff --git a/web/tools/system/blacklist/blacklist.php b/web/tools/system/blacklist/blacklist.php new file mode 100644 index 00000000..582a7f7b --- /dev/null +++ b/web/tools/system/blacklist/blacklist.php @@ -0,0 +1,253 @@ +query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $resultset->numRows() > 0 ) $error="This prefix has already been entered in the database !"; + else { + $sql = "INSERT INTO globalblacklist (id, prefix, whitelist, description) VALUES ('', :prefix, :whitelist, :description)"; + $resultset = $link->prepare($sql); + + $resultset->execute(array( + "prefix"=>$prefix, + "whitelist"=>$whitelist, + "description"=>$description + )); + $resultset->free(); + $log = $prefix . " successuly " . ($whitelist ? "whitelisted" : "blacklisted") . "
"; + } + } +} + +##################### +# end add_verify # +##################### + + +################# +# start delete # +################# + +if($action == "delete"){ + if(!$_SESSION['read_only']){ + $id = $_GET['id']; + + $sql = "SELECT * FROM globalblacklist WHERE id='$id'"; + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $resultset->numRows() == 0 ) $error="This entry doesn't exist !"; + else { + $resultset->free(); + + $sql = "DELETE FROM globalblacklist WHERE id=:id"; + $resultset = $link->prepare($sql); + + $resultset->execute(array( + "id"=>$id + )); + $resultset->free(); + $log = "Entry successuly deleted !
"; + } + }else{ + $error = "User with Read-Only Rights"; + } +} + +################# +# end delete # +################# + + +################ +# start search # +################ +if ($action=="dp_act") +{ + $_SESSION[$current_page]=1; + extract($_POST); + if ($show_all=="Show All") { + $_SESSION['lst_g_prefix']=""; + $_SESSION['lst_g_whitelist']=""; + $_SESSION['lst_g_description']=""; + } else if($search=="Search"){ + $_SESSION['lst_g_prefix']=$_POST['lst_prefix']; + $_SESSION['lst_g_whitelist']= isset($_POST['lst_whitelist']) ? $_POST['lst_whitelist'] : ""; + $_SESSION['lst_g_description']=$_POST['lst_description']; + } +} +############## +# end search # +############## + + +############## +# start edit # +############## +if ($action=="edit") +{ + if(!$_SESSION['read_only']){ + $id = $_GET['id']; + $sql = "SELECT * FROM globalblacklist WHERE id='$id'"; + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $resultset->numRows() == 0 ) $error="This entry doesn't exist !"; + else { + $entry = $resultset->fetchRow(); + + $resultset->free(); + + require("template/".$page_id.".edit.php"); + require("template/footer.php"); + exit(); + } + }else{ + $error = "User with Read-Only Rights"; + } +} +############## +# end edit # +############## + + +################# +# start modify # +################# + +if($action == "modify"){ + if(!$_SESSION['read_only']){ + $id = $_GET['id']; + $prefix = $_POST['prefix']; + $description = $_POST['description']; + $whitelist = isset($_POST['whitelisted']) ? "1" : "0"; + + if(empty($prefix)) $error = "You have to specify a prefix !"; + else{ + $sql = "SELECT * FROM globalblacklist WHERE id='$id'"; + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $resultset->numRows() == 0 ) $error="This entry doesn't exist !"; + else { + $resultset->free(); + + $sql = "UPDATE globalblacklist SET prefix=:prefix, description=:description, whitelist=:whitelist WHERE id=:id"; + $resultset = $link->prepare($sql); + + $resultset->execute(array( + "id"=>$id, + "prefix"=>$prefix, + "description"=>$description, + "whitelist"=>$whitelist + )); + $resultset->free(); + $log = $prefix . " successuly " . ($whitelist ? "whitelisted" : "blacklisted") . "
"; + } + } + }else{ + $error = "User with Read-Only Rights"; + } +} + +################# +# end modify # +################# + + + +############## +# start main # +############## + +require("template/".$page_id.".main.php"); +require("template/footer.php"); +exit(); + +############## +# end main # +############## +?> + diff --git a/web/tools/system/blacklist/images/clone.gif b/web/tools/system/blacklist/images/clone.gif new file mode 100644 index 00000000..750586d2 Binary files /dev/null and b/web/tools/system/blacklist/images/clone.gif differ diff --git a/web/tools/system/blacklist/images/edit.gif b/web/tools/system/blacklist/images/edit.gif new file mode 100644 index 00000000..cde537bf Binary files /dev/null and b/web/tools/system/blacklist/images/edit.gif differ diff --git a/web/tools/system/blacklist/images/spacer.gif b/web/tools/system/blacklist/images/spacer.gif new file mode 100644 index 00000000..463511e0 Binary files /dev/null and b/web/tools/system/blacklist/images/spacer.gif differ diff --git a/web/tools/system/blacklist/images/trash.gif b/web/tools/system/blacklist/images/trash.gif new file mode 100644 index 00000000..8c2e5bba Binary files /dev/null and b/web/tools/system/blacklist/images/trash.gif differ diff --git a/web/tools/system/blacklist/index.php b/web/tools/system/blacklist/index.php new file mode 100644 index 00000000..78c4fe80 --- /dev/null +++ b/web/tools/system/blacklist/index.php @@ -0,0 +1,33 @@ + diff --git a/web/tools/system/blacklist/lib/blacklist.main.js b/web/tools/system/blacklist/lib/blacklist.main.js new file mode 100644 index 00000000..a0db473a --- /dev/null +++ b/web/tools/system/blacklist/lib/blacklist.main.js @@ -0,0 +1,100 @@ + diff --git a/web/tools/system/blacklist/lib/db_connect.php b/web/tools/system/blacklist/lib/db_connect.php new file mode 100644 index 00000000..46b3dc60 --- /dev/null +++ b/web/tools/system/blacklist/lib/db_connect.php @@ -0,0 +1,42 @@ +db_host_domains) && isset($config->db_user_domains) && isset($config->db_name_domains) ) { + $config->db_host = $config->db_host_domains; + $config->db_port = $config->db_port_domains; + $config->db_user = $config->db_user_domains; + $config->db_pass = $config->db_pass_domains; + $config->db_name = $config->db_name_domains; + } + $dsn = $config->db_driver.'://' . $config->db_user.':'.$config->db_pass . '@' . $config->db_host . '/'. $config->db_name.''; + $link = & MDB2::connect($dsn); + $link->setFetchMode(MDB2_FETCHMODE_ASSOC); + if(PEAR::isError($link)) { + die("Error while connecting : " . $link->getMessage()); + } +?> diff --git a/web/tools/system/blacklist/lib/functions.inc.php b/web/tools/system/blacklist/lib/functions.inc.php new file mode 100644 index 00000000..a83dedce --- /dev/null +++ b/web/tools/system/blacklist/lib/functions.inc.php @@ -0,0 +1,91 @@ +"; + if($domain == "*") $domain = ""; + $sql = "SELECT * FROM userblacklist WHERE (username='$username' AND prefix='$prefix' AND domain='*') XOR (username='$username' AND prefix='$prefix' AND domain='$domain')"; + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage() . '
' . $sql); + } + + // If one of the two available options exists, we verify which one is in the database, then we look if we can add the new entry + if ( $resultset->numRows() == 1 ) { + $resultset->free(); + $sql = "SELECT * FROM userblacklist WHERE username='$username' AND prefix='$prefix' AND domain='*'"; + + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage() . '
' . $sql); + } + + // If only the first option exists, we can record our entry, only if a domain is specified + if ( $resultset->numRows() == 1 ) { + if($domain == ""){ + $log .= "Error : We're sorry, but this entry already exists without a domain. You should modify it or add a domain !
"; + }else{ + $possible = true; + } + // If only the second option exists, we can record our entry only if domain isn't specified + }else{ + if($domain == ""){ + $possible = true; + }else{ + $log .= "Error : We're sorry, but this entry already exists with a domain. You should modify it or remove the domain !
"; + } + $resultset->free(); + } + // If the options exists or not in the database + } else { + + $resultset->free(); + // Only verify first option, because if it exists + $sql = "SELECT * FROM userblacklist WHERE (username='$username' AND prefix='$prefix' AND domain='*') AND (username='$username' AND prefix='$prefix' AND domain='$domain')"; + + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage() . '
' . $sql); + } + + // If the two options exists, we return an error + if ( $resultset->numRows() > 0 ) { + $log .= "Error : This prefix already exists in the database for the couples (username + prefix) and (username + prefix + domain) !
"; + // If none of the two options exists, we can record our entry in the database + }else{ + $possible = true; + } + $resultset->free(); + } + return Array($possible, $log); +} + +?> diff --git a/web/tools/system/blacklist/style/style.css b/web/tools/system/blacklist/style/style.css new file mode 100644 index 00000000..057ba3e4 --- /dev/null +++ b/web/tools/system/blacklist/style/style.css @@ -0,0 +1,561 @@ +body, table { + font-family:Arial, Helvetica, sans-serif; + color:#33333; + font-size:12px; +} + +select { + background: #fff; + border: none; +} + +table tr:first-child td:first-child { + -moz-border-radius-topleft:4px; + -webkit-border-top-left-radius:4px; + border-top-left-radius:4px; +} + +table tr:first-child td:last-child { + -moz-border-radius-topright:4px; + -webkit-border-top-right-radius:4px; + border-top-right-radius:4px; +} + +table tr:last-child > td:first-child { + -moz-border-radius-bottomleft:4px; + -webkit-border-bottom-left-radius:4px; + border-bottom-left-radius:4px; +} + +table tr:last-child > td:last-child { + -moz-border-radius-bottomright:4px; + -webkit-border-bottom-right-radius:4px; + border-bottom-right-radius:4px; +} + +table tr:first-child th:first-child { + -moz-border-radius-topleft:4px; + -webkit-border-top-left-radius:4px; + border-top-left-radius:4px; +} + +table tr:first-child th:last-child { + -moz-border-radius-topright:4px; + -webkit-border-top-right-radius:4px; + border-top-right-radius:4px; +} + +table tr:last-child > th:first-child { + -moz-border-radius-bottomleft:4px; + -webkit-border-bottom-left-radius:4px; + border-bottom-left-radius:4px; +} + +table tr:last-child > th:last-child { + -moz-border-radius-bottomright:4px; + -webkit-border-bottom-right-radius:4px; + border-bottom-right-radius:4px; +} + +.ttable th { + padding: 1px 0px 1px 0px; +} + +.ttable td { + padding:2px 14px 2px 14px; + border-top: 1px solid #ffffff; + border-bottom:1px solid #e0e0e0; + border-left: 1px solid #e0e0e0; + + background: #fafafa; + background: -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#fafafa)); + background: -moz-linear-gradient(top, #fcfcfc, #fafafa); +} + +.ttable td.rowEven { + background: #f6f6f6; + background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6)); + background: -moz-linear-gradient(top, #f8f8f8, #f6f6f6); +} + +.ttable { + #box-shadow: 0 1px 2px #d1d1d1; +} +.ttable th { + text-shadow: 1px 1px 0px #fff; +} +.ttable tr:hover td { + background: #e2e2e2; + background: -webkit-gradient(linear, left top, left bottom, from(#e2e2e2), to(#efefef)); + background: -moz-linear-gradient(top, #e2e2e2, #efefef); +} +.menuItem { + font-size: 12px; + font-weight: bold; +} +a.menuItem { + color: #000000; + text-decoration: none; +} +a.menuItem:hover { + color: #ff0000; + text-decoration: none; +} +.menuItemSelect { + font-size: 14px; + font-weight: bold; +} +a.menuItemSelect { + color: #ff0000; + text-decoration: none; +} +a.menuItemSelect:hover { + color: #ff0000; + text-decoration: none; +} + +.blacklistTitle { + background: #d1e8ff; /* Old browsers */ + background: -moz-linear-gradient(top, #d1e8ff 0%, #bfe8f9 34%, #8acff2 70%, #5eaeff 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d1e8ff), color-stop(34%,#bfe8f9), color-stop(70%,#8acff2), color-stop(100%,#5eaeff)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* IE10+ */ + background: linear-gradient(to bottom, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d1e8ff', endColorstr='#5eaeff',GradientType=0 ); /* IE6-9 */ + border: #999999 1px solid; + background-color: #99ccff; + font-weight: bold; +} +.searchTitle { + background: #d1e8ff; /* Old browsers */ + background: -moz-linear-gradient(top, #d1e8ff 0%, #bfe8f9 34%, #8acff2 70%, #5eaeff 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d1e8ff), color-stop(34%,#bfe8f9), color-stop(70%,#8acff2), color-stop(100%,#5eaeff)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* IE10+ */ + background: linear-gradient(to bottom, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d1e8ff', endColorstr='#5eaeff',GradientType=0 ); /* IE6-9 */ + border: #999999 1px solid; + background-color: #99ccff; + font-weight: bold; +} + +.newDPID { + border: #999999 1px solid; + padding-top: 1px; + padding-bottom: 1px; + padding-left: 2px; + margin: 1px; + font-size: 12px; + color: #000000; + width: 200px; +} +.formInfo { + font-style: italic; + color: #0000ff; +} +.formError { + font-style: italic; + color: #ff0000; +} +.Button { + border: #aaaaaa 2px outset; + background-color: #dddddd; + font-size: 9px; + font-weight: bold; + color: #000000; +} + +.ButtonLink { + padding:0px 18px 0px 18px; + border-top: 1px solid #ffffff; + border: #aaaaaa 1px solid; + background: #fafafa; + background: -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#fafafa)); + background: -moz-linear-gradient(top, #ececec, #eaeaea); + background-color: #dddddd; + font-size: 9px; + font-weight: bold; + color: #000000; + text-shadow: 1px 1px 0px #fff; + -moz-border-radius:5px; + border-radius: 5px; + -webkit-border-radius: 5px; + -webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); + -moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); + box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); + text-decoration: none; +} + +.ButtonLink:hover { + background: #d2d2d2; + background: -webkit-gradient(linear, left top, left bottom, from(#d2d2d2), to(#dfdfdf)); + background: -moz-linear-gradient(top, #d2d2d2, #dfdfdf); +} + +.pageTitle { + font-size: 12px; + color: #ff0000; + font-weight: bold; +} + +.searchRecord { + padding:2px 14px 2px 14px; + border-top: 1px solid #ffffff; + border-bottom:1px solid #e0e0e0; + border-left: 1px solid #e0e0e0; + + background: #f6f6f6; + background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6)); + background: -moz-linear-gradient(top, #f8f8f8, #f6f6f6); +} + +.listRecord { + padding:2px 14px 2px 14px; + border-top: 1px solid #ffffff; + border-bottom:1px solid #e0e0e0; + border-left: 1px solid #e0e0e0; + + background: #f6f6f6; + background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6)); + background: -moz-linear-gradient(top, #f8f8f8, #f6f6f6); +} + +.dataRecord { + padding:2px 14px 2px 14px; + border-top: 1px solid #ffffff; + border-bottom:1px solid #e0e0e0; + border-left: 1px solid #e0e0e0; + + background: #f6f6f6; + background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6)); + background: -moz-linear-gradient(top, #f8f8f8, #f6f6f6); +} + +.searchInput { + border: #999999 1px solid; + padding-top: 1px; + padding-bottom: 1px; + padding-left: 2px; + margin: 1px; + font-size: 10px; + color: #000000; + width: 200px; +} +.searchButton { + padding:0px 18px 0px 18px; + border-top: 1px solid #ffffff; + border: #aaaaaa 1px solid; + background: #fafafa; + background: -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#fafafa)); + background: -moz-linear-gradient(top, #ececec, #eaeaea); + background-color: #dddddd; + font-size: 9px; + font-weight: bold; + color: #000000; + text-shadow: 1px 1px 0px #fff; + -moz-border-radius:5px; + border-radius: 5px; + -webkit-border-radius: 5px; + -webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); + -moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); + box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); +} + +.searchButton:hover { + background: #d2d2d2; + background: -webkit-gradient(linear, left top, left bottom, from(#d2d2d2), to(#dfdfdf)); + background: -moz-linear-gradient(top, #d2d2d2, #dfdfdf); +} + +.dataTitle { + border: #999999 1px solid; + background-color: #99ccff; + font-weight: bold; +} +.timeRecord { + font-size: 10px; + font-weight: bold; +} +.dataInput { + border: #999999 1px solid; + padding-top: 1px; + padding-bottom: 1px; + padding-left: 2px; + margin: 1px; + font-size: 12px; + color: #000000; + width: 200px; +} +.dataInputCustom { + border: #999999 1px solid; + padding-top: 1px; + padding-bottom: 1px; + padding-left: 2px; + margin: 1px; + font-size: 10px; + color: #000000; +} +.dataSelect { + border: #999999 1px solid; + font-size: 10px; + color: #000000; + width: 200px; +} +a.gwList { + font-size: 12px; + color: #000000; + text-decoration: none; +} +a.gwList:hover { + font-size: 12px; + color: #ff0000; + text-decoration: none; +} + +.pageActive { + border: #999999 1px solid; + padding-left: 2px; + padding-right: 2px; + font-size: 10px; + font-weight: bold; + color: #000090; +} +a.pageList { + font-size: 10px; + color: #000090; + text-decoration: none; +} +a.pageList:hover { + font-size: 10px; + color: #ff0000; + text-decoration: none; +} + +.formButton { + padding:0px 18px 0px 18px; + border-top: 1px solid #ffffff; + border: #aaaaaa 1px solid; + background: #fafafa; + background: -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#fafafa)); + background: -moz-linear-gradient(top, #ececec, #eaeaea); + background-color: #dddddd; + font-size: 9px; + font-weight: bold; + color: #000000; + text-shadow: 1px 1px 0px #fff; + -moz-border-radius:5px; + border-radius: 5px; + -webkit-border-radius: 5px; + -webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); + -moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); + box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); +} + +.formButton:hover { + background: #d2d2d2; + background: -webkit-gradient(linear, left top, left bottom, from(#d2d2d2), to(#dfdfdf)); + background: -moz-linear-gradient(top, #d2d2d2, #dfdfdf); +} + +.formError { + font-style: italic; + color: #ff0000; +} + +a.backLink { + font-size: 10px; + color: #000090; + text-decoration: none; +} +a.backLink:hover { + font-size: 10px; + color: #000090; + text-decoration: underline; +} + +#overlay { + position:absolute; + z-index:10; + width:100%; + height:100%; + top:0; + left:0; + background-color:#000039; + filter:alpha(opacity=10); + -moz-opacity:0.5; + opacity:0.5; + cursor:pointer; + +} + +.dialog { + display: table; + position:fixed; + background-color:trasparent; + z-index:12; +} + +fieldset { + font-family: sans-serif; + border: 2px solid #99ccff; + //background: transparent; + background-color: rgba(255,255,255,1); + -moz-border-radius:7px; + border-radius: 7px; + -webkit-border-radius: 7px; + -webkit-box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.5); + -moz-box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.5); + box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.5); + display: block; + vertical-align: middle; + height: 130px; + padding-bottom: 0.5em; + #overflow: auto; + width: 320px; +} + +fieldset legend { + background: #99ccff; + background: #d1e8ff; /* Old browsers */ + background: -moz-linear-gradient(top, #d1e8ff 0%, #bfe8f9 34%, #8acff2 70%, #5eaeff 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d1e8ff), color-stop(34%,#bfe8f9), color-stop(70%,#8acff2), color-stop(100%,#5eaeff)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* IE10+ */ + background: linear-gradient(to bottom, #d1e8ff 0%,#bfe8f9 34%,#8acff2 70%,#5eaeff 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d1e8ff', endColorstr='#5eaeff',GradientType=0 ); /* IE6-9 */ + color: black; + padding: 5px 10px ; + font-size: 10px; + font-weight: bold; + -moz-border-radius:7px; + border-radius: 7px; + -webkit-border-radius: 7px; + box-shadow: 0 0 0 2px #ddd; + margin-left: 5px; +} + +.listContactTitle { + border: #999999 1px solid; + background-color: #99ccff; + font-weight: bold; + width: 70px; +} + + + + +#################### +################## + + + +h1 { + font-size: 1.5em; + font-weight: normal; + margin: 0; +} +h2 { + font-size: 1.3em; + font-weight: normal; + margin: 2em 0 0; +} +p { + margin: 0.6em 0; +} +p.tabnav { + font-size: 1.1em; + text-align: right; + text-transform: uppercase; +} +p.tabnav a { + color: #999; + text-decoration: none; +} +article.tabs { + display: block; + height: 15em; + margin: 10px 5px 5px 5px; + position: relative; + #width: 40em; +} +article.tabs section { + background-color: #ddd; + border-radius: 0px 5px 5px 5px; + box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); + display: block; + #height: 12em; + left: 0; + padding: 5px; + position: absolute; + #top: 1.8em; + z-index: 0; +} +article.tabs section h2 { + background-color: #ddd; + border-radius: 5px 5px 0 0; + color: #999; + font-size: 1em; + font-weight: normal; + height: 1.8em; + left: 10px; + margin: 0; + padding: 0; + position: absolute; + top: -1.8em; + width: 79px; +} +article.tabs section:nth-child(1) h2 { + left: 0px; +} +article.tabs section:nth-child(2) h2 { + left: 80px; +} +article.tabs section:nth-child(3) h2 { + left: 160px; +} +article.tabs section:nth-child(4) h2 { + left: 240px; +} + +article.tabs section:target h2 ~ article.tabs section:nth-child(1) h2 { + background-color: red; + display:none; +} + +article.tabs section h2 a { + color: inherit; + display: block; + line-height: 1.8em; + outline: 0 none; + text-align: center; + text-decoration: none; + width: 100%; +} +article.tabs section, article.tabs section h2 { + transition: all 500ms ease 0s; +} + +article.tabs section table { + display: none; +} + +article.tabs section:target table { + display: block; +} +article.tabs section:target, +article.tabs section:target h2 { + background-color: #fff; + color: #333; + z-index: 2; +} + +.nocontacts { + background-image: url("../images/nocontacts.png"); + width: 200px; + height: 200px; + margin-top: 62px; +} + diff --git a/web/tools/system/blacklist/template/blacklist.add.php b/web/tools/system/blacklist/template/blacklist.add.php new file mode 100644 index 00000000..d1bec166 --- /dev/null +++ b/web/tools/system/blacklist/template/blacklist.add.php @@ -0,0 +1,91 @@ + + + + + + + + + +Go Main'; +$no_result = "No Data Found."; +?> + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
Add a global entry
Prefix / number
Short description
+
+
+ " . $error . ""; + if(isset($log) && !empty($log)) + echo "" . $log . ""; + ?> +
diff --git a/web/tools/system/blacklist/template/blacklist.edit.php b/web/tools/system/blacklist/template/blacklist.edit.php new file mode 100644 index 00000000..8fcec4cc --- /dev/null +++ b/web/tools/system/blacklist/template/blacklist.edit.php @@ -0,0 +1,95 @@ + + + + + +
+ + + +Go Main'; +$no_result = "No Data Found."; +?> + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
Edit entry n°
Prefix / number
Short description
type="checkbox">
+
+
+ " . $error . ""; + if(isset($log) && !empty($log)) + echo "" . $log . ""; + ?> +
diff --git a/web/tools/system/blacklist/template/blacklist.main.php b/web/tools/system/blacklist/template/blacklist.main.php new file mode 100644 index 00000000..adb12c27 --- /dev/null +++ b/web/tools/system/blacklist/template/blacklist.main.php @@ -0,0 +1,207 @@ + + + + + +
+ + + +Go Main'; +$no_result = "No Data Found."; +?> + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
>
>
+     + +
+
+ + +
+ +
+ + + + + + + + + + + query($sql_search); + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + $data_no = $resultset->numRows(); + $resultset->free(); + $sql_search .= " LIMIT " . $config->results_per_page . " OFFSET " . (($page - 1) * $config->results_per_page); + $resultset = $link->query($sql_search); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $data_no == 0 ) echo(''); + else { + $page=$_SESSION[$current_page]; + $page_no=ceil($data_no/$config->results_per_page); + if ($page>$page_no) { + $page=$page_no; + $_SESSION[$current_page]=$page; + } + + while($row = $resultset->fetchRow()){ + $index_row++; + if ($index_row%2==1) $row_style="rowOdd"; + else $row_style="rowEven"; + $edit_link=''; + $delete_link=''; + ?> + + + + + + + + free(); + + ?> + + + +
+
PrefixDescriptonBlacklisted ?EditDelete

'.$no_result.'

+ + + + + +
+  Page: + 0 '); + else { + $max_pages = $config->results_page_range; + // start page + if ($page % $max_pages == 0) $start_page = $page - $max_pages + 1; + else $start_page = $page - ($page % $max_pages) + 1; + // end page + $end_page = $start_page + $max_pages - 1; + if ($end_page > $page_no) $end_page = $page_no; + // back block + if ($start_page!=1) echo(' << '); + // current pages + for($i=$start_page;$i<=$end_page;$i++) + if ($i==$page) echo(''.$i.' '); + else echo(''.$i.' '); + // next block + if ($end_page!=$page_no) echo(' >> '); + } + ?> + Total Records:  
+
+ + " . $error . ""; + if(isset($log) && !empty($log)) + echo "" . $log . ""; + ?> +
diff --git a/web/tools/system/blacklist/template/footer.php b/web/tools/system/blacklist/template/footer.php new file mode 100644 index 00000000..acaab5b6 --- /dev/null +++ b/web/tools/system/blacklist/template/footer.php @@ -0,0 +1 @@ +
diff --git a/web/tools/system/blacklist/template/header.php b/web/tools/system/blacklist/template/header.php new file mode 100644 index 00000000..90f71a6a --- /dev/null +++ b/web/tools/system/blacklist/template/header.php @@ -0,0 +1,55 @@ +Go Main'; +$no_result = "No Data Found."; +?> + + + + + + + + + +
+ + + + + + + +
+
+ + \ No newline at end of file diff --git a/web/tools/system/blacklist/template/menu.php b/web/tools/system/blacklist/template/menu.php new file mode 100644 index 00000000..22b3a6fa --- /dev/null +++ b/web/tools/system/blacklist/template/menu.php @@ -0,0 +1,55 @@ + + + + + + + + + +
+ +
+ +
+
+
+ Apply Changes to Server'; + ?> +
\ No newline at end of file diff --git a/web/tools/system/blacklist/template/userblacklist.add.php b/web/tools/system/blacklist/template/userblacklist.add.php new file mode 100644 index 00000000..aa5c3822 --- /dev/null +++ b/web/tools/system/blacklist/template/userblacklist.add.php @@ -0,0 +1,96 @@ + + +
+
+ + + +Go Main'; +$no_result = "No Data Found."; +?> + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
Add a user-specific entry
Prefix / number
Username
Domain
+
+
+ " . $error . ""; + if(isset($log) && !empty($log)) + echo "" . $log . ""; + ?> +
diff --git a/web/tools/system/blacklist/template/userblacklist.edit.php b/web/tools/system/blacklist/template/userblacklist.edit.php new file mode 100644 index 00000000..8a125ee9 --- /dev/null +++ b/web/tools/system/blacklist/template/userblacklist.edit.php @@ -0,0 +1,100 @@ + + + + + +
+ + + +Go Main'; +$no_result = "No Data Found."; +?> + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
Edit entry n°
Prefix / number
Username
Domain
type="checkbox">
+
+
+ " . $error . ""; + if(isset($log) && !empty($log)) + echo "" . $log . ""; + ?> +
diff --git a/web/tools/system/blacklist/template/userblacklist.main.php b/web/tools/system/blacklist/template/userblacklist.main.php new file mode 100644 index 00000000..7ef0c5ea --- /dev/null +++ b/web/tools/system/blacklist/template/userblacklist.main.php @@ -0,0 +1,219 @@ + + + + + +
+ + + +Go Main'; +$no_result = "No Data Found."; +?> + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
>
>
+     + +
+
+ + +
+ +
+ + + + + + + + + + + + query($sql_search); + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + $data_no = $resultset->numRows(); + $resultset->free(); + $sql_search .= " LIMIT " . $config->results_per_page . " OFFSET " . (($page - 1) * $config->results_per_page); + $resultset = $link->query($sql_search); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $data_no == 0 ) echo(''); + else { + $page=$_SESSION[$current_page]; + $page_no=ceil($data_no/$config->results_per_page); + if ($page>$page_no) { + $page=$page_no; + $_SESSION[$current_page]=$page; + } + + while($row = $resultset->fetchRow()){ + $index_row++; + if ($index_row%2==1) $row_style="rowOdd"; + else $row_style="rowEven"; + + $edit_link=''; + $delete_link=''; + ?> + + + + + + + + + free(); + + ?> + + + +
+
PrefixUsernameDomainBlacklisted ?EditDelete

'.$no_result.'

+ + + + + +
+  Page: + 0 '); + else { + $max_pages = $config->results_page_range; + // start page + if ($page % $max_pages == 0) $start_page = $page - $max_pages + 1; + else $start_page = $page - ($page % $max_pages) + 1; + // end page + $end_page = $start_page + $max_pages - 1; + if ($end_page > $page_no) $end_page = $page_no; + // back block + if ($start_page!=1) echo(' << '); + // current pages + for($i=$start_page;$i<=$end_page;$i++){ + if ($i==$page) echo(''.$i.' '); + else echo(''.$i.' '); + } + // next block + if ($end_page!=$page_no) echo(' >> '); + } + ?> + Total Records:  
+
+ +
+ " . $error . ""; + if(isset($log) && !empty($log)) + echo "" . $log . ""; + ?> +
diff --git a/web/tools/system/blacklist/tool.name b/web/tools/system/blacklist/tool.name new file mode 100644 index 00000000..57b3181a --- /dev/null +++ b/web/tools/system/blacklist/tool.name @@ -0,0 +1 @@ +BlackList diff --git a/web/tools/system/blacklist/userblacklist.php b/web/tools/system/blacklist/userblacklist.php new file mode 100644 index 00000000..667d4f90 --- /dev/null +++ b/web/tools/system/blacklist/userblacklist.php @@ -0,0 +1,288 @@ + 64) $error="Entered domain name too long (" . strlen($domain) . " chars, 64 max authorized) : ". htmlspecialchars($domain); + else{ + $whitelist = isset($_POST['whitelisted']) ? '1' : '0'; + if(empty($prefix)) $error = "You have to specify a prefix !"; + else{ + if(empty($username)) $error = "You have to specify a username !"; + else{ + if(empty($domain)) $error = "You have to specify a domain !"; + else{ + $verif = verif_entries($username, $prefix, $domain, $whitelist, $action); + if($verif[0]){ + $sql = "INSERT INTO userblacklist (id, username, domain, prefix, whitelist) VALUES ('', :username, :domain, :prefix, :whitelist)"; + $resultset = $link->prepare($sql); + + $resultset->execute(array( + "username"=>$username, + "domain"=>$domain, + "prefix"=>$prefix, + "whitelist"=>$whitelist + )); + $resultset->free(); + $log = $verif[1]; + }else{ + $error = $verif[1]; + } + } + } + } + } + }else{ + $error = "User with Read-Only Rights"; + } +} + +##################### +# end add_verify # +##################### + + +################# +# start delete # +################# + +if($action == "delete"){ + + if(!$_SESSION['read_only']){ + $id = $_GET['id']; + $sql = "SELECT * FROM userblacklist WHERE id='$id'"; + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $resultset->numRows() == 0 ) $error="This entry doesn't exist !"; + else { + $resultset->free(); + + $sql = "DELETE FROM userblacklist WHERE id=:id"; + $resultset = $link->prepare($sql); + + $resultset->execute(array( + "id"=>$id + )); + $resultset->free(); + $log = "Entry successfully deleted !
"; + } + + }else{ + $error = "User with Read-Only Rights"; + } +} + +################# +# end delete # +################# + + +################ +# start search # +################ +if ($action=="dp_act") +{ + $_SESSION[$current_page]=1; + extract($_POST); + if ($show_all=="Show All") { + $_SESSION['lst_u_prefix']=""; + $_SESSION['lst_u_whitelist']=""; + $_SESSION['lst_u_username']=""; + $_SESSION['lst_u_domain']=""; + } else if($search=="Search"){ + $_SESSION['lst_u_prefix']=$_POST['lst_prefix']; + $_SESSION['lst_u_username']=$_POST['lst_username']; + $_SESSION['lst_u_whitelist']= isset($_POST['lst_whitelist']) ? $_POST['lst_whitelist'] : ""; + $_SESSION['lst_u_domain']=$_POST['lst_domain']; + } +} +############## +# end search # +############## + + +############## +# start edit # +############## +if ($action=="edit") +{ + if(!$_SESSION['read_only']){ + $id = $_GET['id']; + $sql = "SELECT * FROM userblacklist WHERE id='$id'"; + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $resultset->numRows() == 0 ) $error="This entry doesn't exist !"; + else { + $entry = $resultset->fetchRow(); + + $resultset->free(); + + require("template/".$page_id.".edit.php"); + require("template/footer.php"); + exit(); + } + }else{ + $error = "User with Read-Only Rights"; + } +} +############## +# end edit # +############## + + +################# +# start modify # +################# + +if($action == "modify"){ + if(!$_SESSION['read_only']){ + $id = $_GET['id']; + $prefix = $_POST['prefix']; + $domain = $_POST['domain']; + $username = $_POST['username']; + $whitelist = isset($_POST['whitelisted']) ? '1' : '0'; + + if(strlen($domain) > 64) $error="Entered domain name too long (" . strlen($domain) . " chars, 64 max authorized) : ". htmlspecialchars($domain); + else{ + if(!isset($error)){ + $sql = "SELECT * FROM userblacklist WHERE id='$id'"; + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $resultset->numRows() == 0 ) $error = "This entry doesn't exist !"; + else { + $resultset->free(); + if(empty($prefix)) $error = "You have to specify a prefix !"; + else{ + if(empty($username)) $error = "You have to specify a username !"; + else{ + if(empty($domain)) $error = "You have to specify a domain !"; + else{ + $sql = "SELECT * FROM userblacklist WHERE username='$username' AND prefix='$prefix' AND domain='$domain' AND id!='$id'"; + $resultset = $link->query($sql); + + if(PEAR::isError($resultset)) { + die('Failed to issue query, error message : ' . $resultset->getMessage()); + } + + if ( $resultset->numRows() == 1 ) $error="This entry already exists, no need to change it !"; + else { + $resultset->free(); + $sql = "UPDATE userblacklist SET prefix=:prefix, username=:username, domain=:domain, whitelist=:whitelist WHERE id=:id"; + $resultset = $link->prepare($sql); + + $resultset->execute(array( + "id"=>$id, + "prefix"=>$prefix, + "username"=>$username, + "domain"=>$domain, + "whitelist"=>$whitelist + )); + $resultset->free(); + $log = $prefix . " successfully " . ($whitelist ? "whitelisted" : "blacklisted") . " for " . $username . (($domain != "*") ? "@" . $domain : "") . "
"; + } + } + } + } + } + } + } + }else{ + $error = "User with Read-Only Rights"; + } +} + +################# +# end modify # +################# + + +############## +# start main # +############## + +require("template/".$page_id.".main.php"); +require("template/footer.php"); +exit(); + +############## +# end main # +############## +?> +