diff -r bda11e521e8a -r 0a74676a2f2f plugins/SpecialAdmin.php --- a/plugins/SpecialAdmin.php Sat Jul 21 11:28:59 2007 -0400 +++ b/plugins/SpecialAdmin.php Sat Jul 21 18:12:10 2007 -0400 @@ -4,13 +4,13 @@ Plugin URI: http://enanocms.org/ Description: Provides the page Special:Administration, which is the AJAX frontend to the various Admin: Author: Dan Fuhry -Version: 1.0 +Version: 1.0.1 Author URI: http://enanocms.org/ */ /* * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between - * Version 1.0 (Banshee) + * Version 1.0.1 (Loch Ness) * Copyright (C) 2006-2007 Dan Fuhry * * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License @@ -1699,7 +1699,7 @@

Search for page title (remember prefixes like User: and File:) pagename_field('page_url'); ?>

Select page title from a list: '; + while ( $row = $db->fetchrow() ) + { + $catlist .= ''; + } + $catlist .= ''; + } + + echo '

'; + + echo '
+ + + + '; + + // Name + echo ' + + + '; + + // Group type + echo ' + + + '; + + // Titles + echo ' + + '; + + echo ' + '; + + echo ' + '; + + // Submit button + echo ' + + '; + + echo '
Create page group
+ Group name:
+ This should be short, descriptive, and human-readable. +
+ +
+ Group type: + + +
+ + Static group of pages + + + Group of commonly tagged pages + + + Mirror a category + +
+
+ Member pages:
+ Click the "plus" button to add more fields. +
+ +
+ Include pages with this tag: +
+
+
+
+
+
+
+
+ +
+
+ +
+ +
+
'; + + echo '
'; + return; + } + else if ( isset($_POST['action']['del']) ) + { + // Confirmation to delete a group (this is really only a stub) + + $delete_id = array_keys($_POST['action']['del']); + $delete_id = intval($delete_id[0]); + + if ( !empty($delete_id) ) + { + echo '
'; + echo ''; + echo '
'; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo '
Confirm deletion
Are you sure you want to delete this page group?
'; + echo ' '; + echo ' '; + echo '
'; + echo ''; + + return; + } + } + else if ( isset($_POST['action']['del_confirm']) ) + { + $delete_id = intval($_POST['delete_id']); + if ( empty($delete_id) ) + { + echo 'Hack attempt'; + return; + } + // Obtain group name + $q = $db->sql_query('SELECT pg_name FROM '.table_prefix.'page_groups WHERE pg_id=' . $delete_id . ';'); + if ( !$q ) + $db->_die(); + if ( $db->numrows() < 1 ) + { + echo 'Page group dun exist.'; + return; + } + $row = $db->fetchrow(); + $pg_name = $row['pg_name']; + unset($row); + // Delete the group + $q = $db->sql_query('DELETE FROM '.table_prefix.'page_groups WHERE pg_id=' . $delete_id . ';'); + if ( !$q ) + $db->_die(); + $q = $db->sql_query('DELETE FROM '.table_prefix.'page_group_members WHERE pg_id=' . $delete_id . ';'); + if ( !$q ) + $db->_die(); + echo "
The group ".'"'."$pg_name".'"'." has been deleted.
"; + } + else if ( isset($_POST['action']['edit']) ) + { + return; + } + else if ( isset($_POST['action']['noop']) ) + { + // Do nothing + } + else + { + echo '
Invalid format of $_POST[action].
'; + } + } + // No action defined - show default menu + $q = $db->sql_query('SELECT pg_id, pg_type, pg_name, pg_target FROM '.table_prefix.'page_groups;'); + if ( !$q ) + $db->_die(); + + echo '
'; + + echo '
+ + + + + + + '; + + if ( $row = $db->fetchrow() ) + { + do + { + $name = htmlspecialchars($row['pg_name']); + $type = 'Invalid'; + switch ( $row['pg_type'] ) + { + case PAGE_GRP_CATLINK: + $type = 'Link to category'; + break; + case PAGE_GRP_TAGGED: + $type = 'Set of tagged pages'; + break; + case PAGE_GRP_NORMAL: + $type = 'Static set of pages'; + break; + } + $target = ''; + if ( $row['pg_type'] == PAGE_GRP_TAGGED ) + { + $target = 'Tag: ' . htmlspecialchars($row['pg_target']); + } + else if ( $row['pg_type'] == PAGE_GRP_CATLINK ) + { + $target = 'Category: ' . htmlspecialchars(get_page_title($paths->nslist['Category'] . sanitize_page_id($row['pg_target']))); + } + $btn_edit = ''; + $btn_del = ''; + // stupid jEdit bug/hack + $quot = '"'; + echo " + + + + + + "; + } + while ( $row = $db->fetchrow() ); + } + else + { + echo ' '; + } + + echo ' + + '; + + echo '
Group nameTypeTargetActions
$name$type$target$btn_edit$btn_del
No page groups defined.
+ +
+
'; + + echo '
'; + +} + function page_Admin_ThemeManager() {