diff -r 87bffacdfb92 -r edbff85d43e8 plugins/admin/PageGroups.php
--- a/plugins/admin/PageGroups.php Sun Sep 30 19:40:07 2007 -0400
+++ b/plugins/admin/PageGroups.php Sun Sep 30 20:20:07 2007 -0400
@@ -48,7 +48,12 @@
echo '
Please specify at least one page to place in this group.
';
return;
}
- if ( $_POST['group_type'] != PAGE_GRP_TAGGED && $_POST['group_type'] != PAGE_GRP_CATLINK && $_POST['group_type'] != PAGE_GRP_NORMAL )
+ if ( $_POST['group_type'] == PAGE_GRP_REGEX && empty($_POST['regex']) )
+ {
+ echo 'Please specify a regular expression to match page IDs against.
';
+ return;
+ }
+ if ( $_POST['group_type'] != PAGE_GRP_TAGGED && $_POST['group_type'] != PAGE_GRP_CATLINK && $_POST['group_type'] != PAGE_GRP_NORMAL && $_POST['group_type'] != PAGE_GRP_REGEX )
{
echo 'Umm, you sent an invalid group type. I\'d put a real error message here but this will only be shown if you try to hack the system.
';
return;
@@ -103,6 +108,14 @@
if ( !$q )
$db->_die();
break;
+ case PAGE_GRP_REGEX:
+ $name = $db->escape($_POST['pg_name']);
+ $regex = $db->escape($_POST['regex']);
+ $sql = 'INSERT INTO '.table_prefix.'page_groups(pg_type,pg_name,pg_target) VALUES(' . PAGE_GRP_REGEX . ', \'' . $name . '\', \'' . $regex . '\');';
+ $q = $db->sql_query($sql);
+ if ( !$q )
+ $db->_die();
+ break;
}
echo 'The page group "' . htmlspecialchars($_POST['pg_name']) . '" has been created.
';
break;
@@ -115,6 +128,7 @@
var pg_normal = ;
var pg_tagged = ;
var pg_catlink = ;
+ var pg_regex = ;
var selection = false;
// Get selection
for ( var i = 0; i < selector.childNodes.length; i++ )
@@ -135,7 +149,7 @@
return true;
}
selection = parseInt(selection);
- if ( selection != pg_normal && selection != pg_tagged && selection != pg_catlink )
+ if ( selection != pg_normal && selection != pg_tagged && selection != pg_catlink && selection != pg_regex )
{
alert('Invalid field value');
return true;
@@ -156,6 +170,10 @@
document.getElementById('pg_create_title_normal').style.display = 'inline';
document.getElementById('pg_create_normal_1').style.display = 'block';
document.getElementById('pg_create_normal_2').style.display = 'block';
+
+ document.getElementById('pg_create_title_regex').style.display = 'none';
+ document.getElementById('pg_create_regex_1').style.display = 'none';
+ document.getElementById('pg_create_regex_2').style.display = 'none';
}
else if ( selection == pg_catlink )
{
@@ -170,6 +188,10 @@
document.getElementById('pg_create_title_normal').style.display = 'none';
document.getElementById('pg_create_normal_1').style.display = 'none';
document.getElementById('pg_create_normal_2').style.display = 'none';
+
+ document.getElementById('pg_create_title_regex').style.display = 'none';
+ document.getElementById('pg_create_regex_1').style.display = 'none';
+ document.getElementById('pg_create_regex_2').style.display = 'none';
}
else if ( selection == pg_tagged )
{
@@ -184,6 +206,28 @@
document.getElementById('pg_create_title_normal').style.display = 'none';
document.getElementById('pg_create_normal_1').style.display = 'none';
document.getElementById('pg_create_normal_2').style.display = 'none';
+
+ document.getElementById('pg_create_title_regex').style.display = 'none';
+ document.getElementById('pg_create_regex_1').style.display = 'none';
+ document.getElementById('pg_create_regex_2').style.display = 'none';
+ }
+ else if ( selection == pg_regex )
+ {
+ document.getElementById('pg_create_title_catlink').style.display = 'none';
+ document.getElementById('pg_create_catlink_1').style.display = 'none';
+ document.getElementById('pg_create_catlink_2').style.display = 'none';
+
+ document.getElementById('pg_create_title_tagged').style.display = 'none';
+ document.getElementById('pg_create_tagged_1').style.display = 'none';
+ document.getElementById('pg_create_tagged_2').style.display = 'none';
+
+ document.getElementById('pg_create_title_normal').style.display = 'none';
+ document.getElementById('pg_create_normal_1').style.display = 'none';
+ document.getElementById('pg_create_normal_2').style.display = 'none';
+
+ document.getElementById('pg_create_title_regex').style.display = 'inline';
+ document.getElementById('pg_create_regex_1').style.display = 'block';
+ document.getElementById('pg_create_regex_2').style.display = 'block';
}
}
@@ -199,6 +243,10 @@
document.getElementById('pg_create_tagged_1').style.display = 'none';
document.getElementById('pg_create_tagged_2').style.display = 'none';
+ document.getElementById('pg_create_title_regex').style.display = 'none';
+ document.getElementById('pg_create_regex_1').style.display = 'none';
+ document.getElementById('pg_create_regex_2').style.display = 'none';
+
document.getElementById('pg_create_title_normal').style.display = 'inline';
document.getElementById('pg_create_normal_1').style.display = 'block';
document.getElementById('pg_create_normal_2').style.display = 'block';
@@ -292,6 +340,7 @@
Static group of pages
Group of pages with one tag
Link to category
+ Perl-compatible regular expression (advanced)
';
@@ -308,6 +357,9 @@
Mirror a category
+
+ Filter through a regular expression
+
';
@@ -324,6 +376,14 @@
Include pages with this tag:
+
+ Regular expression:
+
Be sure to include the starting and ending delimiters and any flags you might need.
+ These pages might help: Pattern modifiers •
+ Pattern syntax
+ Examples: /^(Special|Admin):/i • /^Image:([0-9]+)$/
+ Developers, remember that this will be matched against the full page identifier string. This means that /^About_Enano$/
+ will NOT match the page Special:About_Enano.
';
echo '
@@ -341,6 +401,9 @@
' . $catlist . '
+
+
+
';
@@ -911,6 +974,9 @@
case PAGE_GRP_NORMAL:
$type = 'Static set of pages';
break;
+ case PAGE_GRP_REGEX:
+ $type = 'Regular expression match';
+ break;
}
$target = '';
if ( $row['pg_type'] == PAGE_GRP_TAGGED )
@@ -921,6 +987,10 @@
{
$target = 'Category: ' . htmlspecialchars(get_page_title($paths->nslist['Category'] . sanitize_page_id($row['pg_target'])));
}
+ else if ( $row['pg_type'] == PAGE_GRP_REGEX )
+ {
+ $target = 'Expression:
' . htmlspecialchars($row['pg_target']) . ' ';
+ }
$btn_edit = '
';
$btn_del = '
';
// stupid jEdit bug/hack