10 Commits
5.0.2 ... 5.1.1

Author SHA1 Message Date
Hamza Tamyachte
d65fd40621 Update #86c89ftg9 - Bump release to 5.1.1 for plugin availability_ipaddress 2026-03-18 10:21:56 +01:00
Hamza Tamyachte
4632008dfb Update CHANGELOG.md 2026-03-18 10:19:50 +01:00
Hamza Tamyachte
c91646df81 Merge pull request #16 from LdesignMedia/86c89ftg9-fix-php-version-compat
Fix #86c89ftg9 - Remove PHP 7.4 typed properties for PHP 7.3 compatibility
2026-03-18 10:17:06 +01:00
Hamza Tamyachte
d2c231e657 Merge branch 'main' into 86c89ftg9-fix-php-version-compat 2026-03-18 10:16:46 +01:00
Hamza Tamyachte
700820480d Update #86c89ftg9 - Bump version to 2026031800 for plugin availability_ipaddress 2026-03-18 10:13:19 +01:00
Nihaal Shaikh
e91befdf10 Merge pull request #15 from LdesignMedia/86c8jzuvd-upgrade-moodle51
Update #86c8jzuvd - upgraded plugin to support Moodle 5.1, moved chan…
2026-03-16 13:13:15 +01:00
Nihaal Shaikh
3f5f4ee6cb Update #86c8jzuvd - Moodle code style followed 2026-03-16 13:09:05 +01:00
Hamza Tamyachte
cccebb6c15 Update #86c89ftg9 - Reorganise changelog and update PHP compatibility docs 2026-03-15 22:35:39 +01:00
Hamza Tamyachte
af275d1699 Fix #86c89ftg9 - Remove PHP 7.4 typed properties for PHP 7.3 compatibility
Remove typed property declarations to prevent fatal parse errors on
Moodle 4.0.x servers running PHP 7.3. Lower environment.xml PHP
requirement from 7.4 to 7.3.

Fixes #13
2026-03-15 22:22:16 +01:00
Nihaal Shaikh
5dce3ed488 Update #86c8jzuvd - upgraded plugin to support Moodle 5.1, moved changelog to separate file 2026-03-03 13:26:17 +01:00
13 changed files with 102 additions and 52 deletions

0
.gitignore vendored Normal file
View File

30
CHANGELOG.md Normal file
View File

@@ -0,0 +1,30 @@
# Changelog
## 5.1.1 (2026031800)
* Fixed PHP 7.3 compatibility issue that broke Moodle 4.0.x servers ([#13](https://github.com/LdesignMedia/moodle-availability_ipaddress/issues/13))
* Removed typed properties (PHP 7.4+) to support PHP 7.3+
* Lowered environment.xml PHP requirement from 7.4 to 7.3
## 5.1.0 (2026030300)
- Tested and verified on Moodle 5.1
## 5.0.2 (2025080401)
- Added support for pre-configuring IP ranges by admins
## 5.0.1 (2025052200)
- Tested on Moodle 5.0
## 4.5.0 (2025040400)
- Tested on Moodle 4.5
## 4.4.0 (2024072000)
- Tested on Moodle 4.4
## 4.0.3 (2022052801)
- Test in Moodle 4.0 @[hamzatamyachte](https://github.com/hamzatamyachte)
## 4.0.2 (2022052800)
- Fixed the [issue 6](https://github.com/ldesignmediaNL/moodle-availability_ipaddress/issues/6) @[hamzatamyachte](https://github.com/hamzatamyachte)
## 3.9.0 (2022021100)
- Thanks for adding ip-range support @[juacas](https://github.com/juacas)

View File

@@ -11,7 +11,7 @@ activity, making it accessible only to users from specified IP addresses.
* Author: Luuk Verhoeven, [ldesignmedia.nl](https://ldesignmedia.nl/)
* Author: Vincent Cornelis, [ldesignmedia.nl](https://ldesignmedia.nl/)
* Min. required: Moodle 4.0
* Supports PHP: 7.4
* Supports PHP: 7.3+
![Moodle400](https://img.shields.io/badge/moodle-4.0-F98012.svg?logo=moodle)
![Moodle401](https://img.shields.io/badge/moodle-4.1-F98012.svg?logo=moodle)
@@ -20,7 +20,9 @@ activity, making it accessible only to users from specified IP addresses.
![Moodle404](https://img.shields.io/badge/moodle-4.4-F98012.svg?logo=moodle)
![Moodle405](https://img.shields.io/badge/moodle-4.5-F98012.svg?logo=moodle)
![Moodle500](https://img.shields.io/badge/moodle-5.0-F98012.svg?logo=moodle)
![Moodle501](https://img.shields.io/badge/moodle-5.1-F98012.svg?logo=moodle)
![PHP7.3](https://img.shields.io/badge/PHP-7.3-777BB4.svg?logo=php)
![PHP7.4](https://img.shields.io/badge/PHP-7.4-777BB4.svg?logo=php)
![PHP8.0](https://img.shields.io/badge/PHP-8.0-777BB4.svg?logo=php)
![PHP8.1](https://img.shields.io/badge/PHP-8.1-777BB4.svg?logo=php)
@@ -62,12 +64,6 @@ The GNU GENERAL PUBLIC LICENSE. Please see [License File](LICENSE) for more info
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.
## Changelog
### Changelog
- 2024080401 Added support for pre-configuring IP ranges by admins
- 2025052200 Tested on Moodle 5.0
- 2025040400 Tested on Moodle 4.5
- 2024072000 Tested on Moodle 4.4
- 2022021100 Thanks for adding ip-range support @[juacas](https://github.com/juacas)
- 2022052800 Fixed the [issue 6](https://github.com/ldesignmediaNL/moodle-availability_ipaddress/issues/6) @[hamzatamyachte](https://github.com/hamzatamyachte)
- 2022052801 Test in Moodle 4.0 @[hamzatamyachte](https://github.com/hamzatamyachte)
See [CHANGELOG.md](CHANGELOG.md) for a full list of changes.

View File

@@ -36,20 +36,19 @@ use core_availability\info;
* @copyright 2019-05-14 Mfreak.nl | LdesignMedia.nl - Luuk Verhoeven
*/
class condition extends \core_availability\condition {
/**
* Manual provided IP addresses.
*
* @var string
*/
protected string $ipaddresses = '';
protected $ipaddresses = '';
/**
* Predefined IP address ranges.
*
* @var array
*/
protected array $predefinedranges = [];
protected $predefinedranges = [];
/**
* condition constructor.
@@ -213,5 +212,4 @@ class condition extends \core_availability\condition {
return $result;
}
}

View File

@@ -39,7 +39,6 @@ require_once($CFG->libdir . '/formslib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class range_form extends \moodleform {
/**
* Define the form.
*
@@ -72,8 +71,12 @@ class range_form extends \moodleform {
$mform->addHelpButton('ipaddresses', 'ipaddresses_help', 'availability_ipaddress');
// Description field.
$mform->addElement('textarea', 'description', get_string('description'),
['rows' => 3, 'cols' => 60]);
$mform->addElement(
'textarea',
'description',
get_string('description'),
['rows' => 3, 'cols' => 60]
);
$mform->setType('description', PARAM_TEXT);
// Enabled field.
@@ -147,5 +150,4 @@ class range_form extends \moodleform {
return false;
}
}

View File

@@ -34,7 +34,6 @@ namespace availability_ipaddress;
* @copyright 2019-05-14 Mfreak.nl | LdesignMedia.nl - Luuk Verhoeven
*/
class frontend extends \core_availability\frontend {
/**
* get_javascript_strings
*
@@ -81,5 +80,4 @@ class frontend extends \core_availability\frontend {
return [$rangedata];
}
}

View File

@@ -34,7 +34,6 @@ namespace availability_ipaddress;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class helper {
/**
* Check if a predefined range is in use.
*
@@ -296,7 +295,6 @@ class helper {
// Process nested conditions.
return self::process_nested_conditions($availability, $rangeid) || $modified;
}
/**
@@ -361,5 +359,4 @@ class helper {
return $modified;
}
}

View File

@@ -33,7 +33,6 @@ namespace availability_ipaddress\privacy;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
@@ -43,5 +42,4 @@ class provider implements \core_privacy\local\metadata\null_provider {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View File

@@ -45,7 +45,6 @@ use confirm_action;
* @author Vincent Cornelis
*/
class ipranges_table extends table_sql {
/**
* @var moodle_url The base URL for the page.
*/
@@ -185,8 +184,10 @@ class ipranges_table extends table_sql {
// Edit action.
$editurl = new moodle_url($this->baseurl, ['action' => 'edit', 'id' => $range->id]);
$actions[] = $OUTPUT->action_icon($editurl,
new pix_icon('t/edit', get_string('edit')));
$actions[] = $OUTPUT->action_icon(
$editurl,
new pix_icon('t/edit', get_string('edit'))
);
// Toggle action.
$toggleurl = new moodle_url($this->baseurl, ['action' => 'toggle', 'id' => $range->id, 'sesskey' => sesskey()]);
@@ -199,10 +200,16 @@ class ipranges_table extends table_sql {
if ($usage['inuse']) {
// Create confirmation message with usage details.
$message = \availability_ipaddress\helper::get_range_usage_html($range->id);
$message .= \html_writer::tag('p', get_string('confirm_disable_range', 'availability_ipaddress'),
['class' => 'font-weight-bold']);
$actions[] = $OUTPUT->action_icon($toggleurl, new pix_icon($toggleicon, $togglestring),
new confirm_action($message));
$message .= \html_writer::tag(
'p',
get_string('confirm_disable_range', 'availability_ipaddress'),
['class' => 'font-weight-bold']
);
$actions[] = $OUTPUT->action_icon(
$toggleurl,
new pix_icon($toggleicon, $togglestring),
new confirm_action($message)
);
} else {
$actions[] = $OUTPUT->action_icon($toggleurl, new pix_icon($toggleicon, $togglestring));
}
@@ -222,17 +229,21 @@ class ipranges_table extends table_sql {
$usage = \availability_ipaddress\helper::is_range_in_use($range->id);
if ($usage['inuse']) {
$message = \availability_ipaddress\helper::get_range_usage_html($range->id);
$message .= \html_writer::tag('p', get_string('confirm_delete_range', 'availability_ipaddress'),
['class' => 'font-weight-bold']);
$message .= \html_writer::tag(
'p',
get_string('confirm_delete_range', 'availability_ipaddress'),
['class' => 'font-weight-bold']
);
} else {
$message = get_string('confirm_delete_range', 'availability_ipaddress');
}
$actions[] = $OUTPUT->action_icon($deleteurl,
$actions[] = $OUTPUT->action_icon(
$deleteurl,
new pix_icon('t/delete', get_string('delete')),
new confirm_action($message));
new confirm_action($message)
);
return implode(' ', $actions);
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<COMPATIBILITY_MATRIX>
<PLUGIN name="availability_ipaddress">
<PHP version="7.4" level="required"/>
<PHP version="7.3" level="required"/>
</PLUGIN>
</COMPATIBILITY_MATRIX>

View File

@@ -44,11 +44,19 @@ if ($action === 'delete' && confirm_sesskey()) {
$DB->delete_records('availability_ipaddress_pre', ['id' => $id]);
if ($removed > 0) {
redirect($PAGE->url, get_string('range_deleted_and_removed', 'availability_ipaddress', $removed),
null, \core\output\notification::NOTIFY_SUCCESS);
redirect(
$PAGE->url,
get_string('range_deleted_and_removed', 'availability_ipaddress', $removed),
null,
\core\output\notification::NOTIFY_SUCCESS
);
} else {
redirect($PAGE->url, get_string('range_deleted', 'availability_ipaddress'), null,
\core\output\notification::NOTIFY_SUCCESS);
redirect(
$PAGE->url,
get_string('range_deleted', 'availability_ipaddress'),
null,
\core\output\notification::NOTIFY_SUCCESS
);
}
}
@@ -63,8 +71,12 @@ if ($action === 'toggle' && confirm_sesskey()) {
if (!$record->enabled) {
$removed = \availability_ipaddress\helper::remove_range_from_restrictions($id);
if ($removed > 0) {
redirect($PAGE->url, get_string('range_disabled_and_removed', 'availability_ipaddress', $removed),
null, \core\output\notification::NOTIFY_SUCCESS);
redirect(
$PAGE->url,
get_string('range_disabled_and_removed', 'availability_ipaddress', $removed),
null,
\core\output\notification::NOTIFY_SUCCESS
);
}
}
@@ -85,15 +97,23 @@ if ($action === 'add' || $action === 'edit') {
// Update existing.
$data->timemodified = time();
$DB->update_record('availability_ipaddress_pre', $data);
redirect($PAGE->url, get_string('range_updated', 'availability_ipaddress'), null,
\core\output\notification::NOTIFY_SUCCESS);
redirect(
$PAGE->url,
get_string('range_updated', 'availability_ipaddress'),
null,
\core\output\notification::NOTIFY_SUCCESS
);
} else {
// Create new.
$data->timecreated = time();
$data->timemodified = time();
$DB->insert_record('availability_ipaddress_pre', $data);
redirect($PAGE->url, get_string('range_created', 'availability_ipaddress'), null,
\core\output\notification::NOTIFY_SUCCESS);
redirect(
$PAGE->url,
get_string('range_created', 'availability_ipaddress'),
null,
\core\output\notification::NOTIFY_SUCCESS
);
}
}

View File

@@ -29,7 +29,6 @@ defined('MOODLE_INTERNAL') || die();
global $ADMIN;
if ($hassiteconfig) {
// Add external page for managing IP ranges.
$ADMIN->add(
'availabilitysettings',
@@ -38,7 +37,8 @@ if ($hassiteconfig) {
get_string('setting:manage_predefined_ranges', 'availability_ipaddress'),
new moodle_url('/availability/condition/ipaddress/manage_ranges.php'),
'moodle/site:config'
));
)
);
}
// Set the visible name of auto generated settings page to empty string,

View File

@@ -27,8 +27,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'availability_ipaddress';
$plugin->version = 2025080401;
$plugin->release = '5.0.2';
$plugin->version = 2026031800;
$plugin->release = '5.1.1';
$plugin->requires = 2016120500;
$plugin->maturity = MATURITY_STABLE;
$plugin->supported = [400, 500];
$plugin->supported = [400, 501];