MDL-57404 admin_settings: Allow comments in ip block
This adds the ability to to add comments to ip lists in moodle. Currently, the configiplist textentry box does not allow the user to annotate the IP addresses defined. For example, I'd like to be able to define: 192.168.1.1 # London office 10.1.1.1 # New york office 118.209.246.240 # My home IP This would allow me to revisit this list after a few months, and remove IP addresses that are no longer required - without having to manually confirm each IP address
This commit is contained in:
+4
-3
@@ -3614,14 +3614,15 @@ class admin_setting_configiplist extends admin_setting_configtextarea {
|
||||
*/
|
||||
public function validate($data) {
|
||||
if(!empty($data)) {
|
||||
$ips = explode("\n", $data);
|
||||
$lines = explode("\n", $data);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
$result = true;
|
||||
$badips = array();
|
||||
foreach($ips as $ip) {
|
||||
$ip = trim($ip);
|
||||
foreach ($lines as $line) {
|
||||
$tokens = explode('#', $line);
|
||||
$ip = trim($tokens[0]);
|
||||
if (empty($ip)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user