-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
71 lines (57 loc) · 1.87 KB
/
index.php
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
<?php
require_once("../../global/library.php");
use FormTools\Modules;
$module = Modules::initModulePage("admin");
$L = $module->getLangStrings();
$sortable_id = "ip_list";
$success = true;
$message = "";
if (isset($_POST["update_page"])) {
// serialize the IP information
$ip_list = array();
$ips = (isset($_POST["ip"])) ? $_POST["ip"] : array();
for ($i=0; $i<count($ips); $i++) {
$ip = trim($ips[$i]);
$desc = trim($_POST["ip_desc"][$i]);
$ip_list[] = "$desc`$ip";
}
$serialized_ip_list = implode("|", $ip_list);
$settings = array(
"list_type" => $_POST["list_type"],
"ip_list" => $serialized_ip_list
);
$module->setSettings($settings);
$success = true;
$message = $L["notify_settings_updated"];
}
$module_settings = $module->getSettings();
$ip_list_hash = $module->deserializeIpList($module_settings["ip_list"]);
$page_vars = array(
"g_success" => $success,
"g_message" => $message,
"ip" => $_SERVER["REMOTE_ADDR"],
"sortable_id" => $sortable_id,
"module_settings" => $module_settings,
"js_messages" => array(
"word_close", "word_warning", "word_no"
),
"module_js_messages" => array(
"validation_no_list_type", "validation_invalid_chars", "phrase_fix_errors",
"phrase_problems_found", "confirm_ip_on_blacklist", "confirm_ip_on_whitelist", "phrase_yes_continue"
),
"ip_list_hash" => $ip_list_hash
);
$page_vars["head_js"] =<<< END
$(function() {
if ($(".sortable_row").length == 0) {
ip_ns.add_row();
}
$("#add_row_link").bind("click", function() {
return ip_ns.add_row();
});
$("#update").bind("click", function() {
ip_ns.validate_ip_list({ ip: "{$_SERVER["REMOTE_ADDR"]}" });
});
});
END;
$module->displayPage("templates/index.tpl", $page_vars);