Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
--- a/ajax.php Sat Jul 21 11:28:59 2007 -0400
+++ b/ajax.php Sat Jul 21 18:12:10 2007 -0400
@@ -1,7 +1,8 @@
<?php
+
/*
* 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
--- a/includes/captcha.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/captcha.php Sat Jul 21 18:12:10 2007 -0400
@@ -1,7 +1,7 @@
<?php
/*
* 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
* captcha.php - visual confirmation system used during registration
*
--- a/includes/clientside/css/enano-shared.css Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/clientside/css/enano-shared.css Sat Jul 21 18:12:10 2007 -0400
@@ -15,7 +15,7 @@
div.question-box-mini { background-image: url(../../../images/mini-question.png); background-position: 5px center; background-repeat: no-repeat; background-color: #F4FFF4; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
div.wait-box-mini { background-image: url(../../../images/mini-wait.png); background-position: 5px center; background-repeat: no-repeat; background-color: #FFF4FF; border: 1px solid #406080; padding: 4px 4px 4px 26px; margin: 1em 0; min-height: 17px; }
-/* Similar to the Mediawiki-ish alert box (usermessage) */
+/* Similar to the Mediawikian alert box (usermessage) */
div.alert {
background-color: #F09090;
--- a/includes/clientside/jsres.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/clientside/jsres.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
* jsres.php - the Enano client-side runtime, a.k.a. AJAX on steroids
*
@@ -40,7 +40,7 @@
{
echo "/*
* 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)
* [Aggressively compressed] Javascript client code
* Copyright (C) 2006-2007 Dan Fuhry
* Enano is Free Software, licensed under the GNU General Public License; see http://enanocms.org/ for details.
--- a/includes/clientside/static/acl.js Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/clientside/static/acl.js Sat Jul 21 18:12:10 2007 -0400
@@ -141,15 +141,26 @@
{
scopediv1 = document.createElement('div');
scopediv2 = document.createElement('div');
+ scopediv3 = document.createElement('div');
scopeRadioPage = document.createElement('input');
scopeRadioPage.type = 'radio';
scopeRadioPage.name = 'scope';
scopeRadioPage.value = 'page';
scopeRadioPage.checked = 'checked';
+ scopeRadioPage.className = '1048576';
+ scopeRadioPage.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; };
scopeRadioGlobal = document.createElement('input');
scopeRadioGlobal.type = 'radio';
scopeRadioGlobal.name = 'scope';
scopeRadioGlobal.value = 'global';
+ scopeRadioGlobal.className = '1048576';
+ scopeRadioGlobal.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'none'; };
+ scopeRadioGroup = document.createElement('input');
+ scopeRadioGroup.type = 'radio';
+ scopeRadioGroup.name = 'scope';
+ scopeRadioGroup.value = 'group';
+ scopeRadioGroup.className = '1048576';
+ scopeRadioGroup.onclick = function() { var id = 'enACL_pgsel_' + this.className; document.getElementById(id).style.display = 'block'; };
lblPage = document.createElement('label');
lblPage.style.display = 'block';
lblPage.appendChild(scopeRadioPage);
@@ -158,11 +169,33 @@
lblGlobal.style.display = 'block';
lblGlobal.appendChild(scopeRadioGlobal);
lblGlobal.appendChild(document.createTextNode('The entire website'));
+ lblGroup = document.createElement('label');
+ lblGroup.style.display = 'block';
+ lblGroup.appendChild(scopeRadioGroup);
+ lblGroup.appendChild(document.createTextNode('A group of pages'));
scopediv1.appendChild(lblPage);
- scopediv2.appendChild(lblGlobal);
+ scopediv2.appendChild(lblGroup);
+ scopediv3.appendChild(lblGlobal);
scopedesc = document.createElement('p');
scopedesc.appendChild(document.createTextNode('What should this access rule control?'));
+
+ scopePGrp = document.createElement('select');
+ scopePGrp.style.marginLeft = '13px';
+ scopePGrp.style.display = 'none';
+ scopePGrp.id = "enACL_pgsel_1048576";
+
+ var opt;
+ for ( var i = 0; i < groups.page_groups.length; i++ )
+ {
+ opt = document.createElement('option');
+ opt.value = groups.page_groups[i].id;
+ opt.appendChild(document.createTextNode(groups.page_groups[i].name));
+ scopePGrp.appendChild(opt);
+ }
+
+ scopediv2.appendChild(scopePGrp);
+
}
// Styles
@@ -180,7 +213,7 @@
container = document.createElement('div');
container.style.margin = 'auto';
container.style.width = '360px';
- container.style.paddingTop = '100px';
+ container.style.paddingTop = '50px';
head = document.createElement('h2');
head.appendChild(document.createTextNode('Manage page access'));
@@ -197,6 +230,7 @@
container.appendChild(scopedesc);
container.appendChild(scopediv1);
container.appendChild(scopediv2);
+ container.appendChild(scopediv3);
}
main.appendChild(container);
@@ -591,6 +625,11 @@
obj['page_id'] = false;
obj['namespace'] = false;
}
+ else if(scope == 'group')
+ {
+ obj['page_id'] = document.getElementById('enACL_pgsel_1048576').value;
+ obj['namespace'] = '__PageGroup';
+ }
else
{
alert('Invalid scope');
--- a/includes/clientside/static/autocomplete.js Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/clientside/static/autocomplete.js Sat Jul 21 18:12:10 2007 -0400
@@ -251,22 +251,10 @@
unSelectMenuOn = true;
submitAuthorized = false;
body.appendChild(thediv);
-
- unObj.onblur = function() { CheckDestroyUsernameDropdowns(thediv.id); };
}
});
}
-function CheckDestroyUsernameDropdowns(id)
-{
- elem = document.getElementById(id);
- if(!elem) return;
- if(queryOnObj(elem, 100))
- {
- destroyUsernameDropdowns();
- }
-}
-
function destroyUsernameDropdowns()
{
var divs = document.getElementsByTagName('div');
--- a/includes/comment.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/comment.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
--- a/includes/common.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/common.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
@@ -23,7 +23,7 @@
exit;
}
-$version = '1.0';
+$version = '1.0.1';
function microtime_float()
{
--- a/includes/constants.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/constants.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
* constants.php - important defines used Enano-wide
*
@@ -33,6 +33,11 @@
define('GROUP_ID_ADMIN', 2);
define('GROUP_ID_MOD', 3);
+// Page group types
+define('PAGE_GRP_CATLINK', 1);
+define('PAGE_GRP_TAGGED', 2);
+define('PAGE_GRP_NORMAL', 3);
+
//
// User types - don't touch these
//
--- a/includes/dbal.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/dbal.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
@@ -282,6 +282,16 @@
VALUES(\'security\', \'sql_inject\', '.time().', \'\', \''.$query.'\', \''.$username.'\', \''.$_SERVER['REMOTE_ADDR'].'\');');
}
+ /**
+ * Returns the ID of the row last inserted.
+ * @return int
+ */
+
+ function insert_id()
+ {
+ return @mysql_insert_id();
+ }
+
function fetchrow($r = false) {
$this->enable_errorhandler();
if(!$this->_conn) return false;
--- a/includes/email.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/email.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
--- a/includes/functions.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/functions.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
--- a/includes/graphs.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/graphs.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
--- a/includes/js-compressor.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/js-compressor.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
* Javascript compression library - used to compact the client-side Javascript code (all 72KB of it!) to save some bandwidth
*
--- a/includes/pageprocess.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/pageprocess.php Sat Jul 21 18:12:10 2007 -0400
@@ -1,7 +1,8 @@
<?php
+
/*
* 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)
* pageprocess.php - intelligent retrieval of pages
* Copyright (C) 2006-2007 Dan Fuhry
*
--- a/includes/pageutils.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/pageutils.php Sat Jul 21 18:12:10 2007 -0400
@@ -1,7 +1,7 @@
<?php
/*
* 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
* pageutils.php - a class that handles raw page manipulations, used mostly by AJAX requests or their old-fashioned form-based counterparts
*
@@ -1697,6 +1697,20 @@
);
}
$db->free_result();
+ $return['page_groups'] = Array();
+ $q = $db->sql_query('SELECT pg_id,pg_name FROM '.table_prefix.'page_groups ORDER BY pg_name ASC;');
+ if ( !$q )
+ return Array(
+ 'mode' => 'error',
+ 'error' => $db->get_error()
+ );
+ while ( $row = $db->fetchrow() )
+ {
+ $return['page_groups'][] = Array(
+ 'id' => $row['pg_id'],
+ 'name' => $row['pg_name']
+ );
+ }
break;
case 'seltarget':
$return['mode'] = 'seltarget';
@@ -1739,7 +1753,7 @@
}
$db->free_result();
// Eliminate types that don't apply to this namespace
- if ( $namespace )
+ if ( $namespace && $namespace != '__PageGroup' )
{
foreach ( $return['current_perms'] AS $i => $perm )
{
@@ -1786,7 +1800,7 @@
}
$db->free_result();
// Eliminate types that don't apply to this namespace
- if ( $namespace )
+ if ( $namespace && $namespace != '__PageGroup' )
{
foreach ( $return['current_perms'] AS $i => $perm )
{
--- a/includes/paths.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/paths.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/**
* 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
* paths.php - The part of Enano that actually manages content. Everything related to page handling and namespaces is in here.
*
@@ -81,6 +81,7 @@
$this->addAdminNode('General', 'Backup database', 'DBBackup');
$this->addAdminNode('Content', 'Manage Pages', 'PageManager');
$this->addAdminNode('Content', 'Edit page content', 'PageEditor');
+ $this->addAdminNode('Content', 'Manage page groups', 'PageGroups');
$this->addAdminNode('Appearance', 'Manage themes', 'ThemeManager');
$this->addAdminNode('Users', 'Manage users', 'UserManager');
$this->addAdminNode('Users', 'Edit groups', 'GroupManager');
@@ -822,6 +823,57 @@
return $search;
}
+ /**
+ * Returns a list of groups that a given page is a member of.
+ * @param string Page ID
+ * @param string Namespace
+ * @return array
+ */
+
+ function get_page_groups($page_id, $namespace)
+ {
+ global $db, $session, $paths, $template, $plugins; // Common objects
+
+ $page_id = $db->escape(sanitize_page_id($page_id));
+ if ( !isset($this->nslist[$namespace]) )
+ die('$paths->get_page_groups(): HACKING ATTEMPT');
+
+ $group_list = array();
+
+ // What linked categories have this page?
+ $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g
+ LEFT JOIN '.table_prefix.'categories AS c
+ ON ( c.category_id = g.pg_target AND g.pg_type = ' . PAGE_GRP_CATLINK . ' )
+ WHERE c.page_id=\'' . $page_id . '\' AND c.namespace=\'' . $namespace . '\';');
+ if ( !$q )
+ $db->_die();
+
+ while ( $row = $db->fetchrow() )
+ {
+ $group_list[] = $row['pg_id'];
+ }
+
+ // Static-page groups
+ $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g
+ LEFT JOIN '.table_prefix.'page_group_members AS m
+ ON ( g.pg_id = m.pg_id )
+ WHERE m.page_id=\'' . $page_id . '\' AND m.namespace=\'' . $namespace . '\'
+ GROUP BY g.pg_id;');
+
+ if ( !$q )
+ $db->_die();
+
+ while ( $row = $db->fetchrow() )
+ {
+ $group_list[] = $row['pg_id'];
+ }
+
+ // Tagging ain't implemented yet ;-)
+
+ return $group_list;
+
+ }
+
}
?>
--- a/includes/plugins.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/plugins.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
--- a/includes/render.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/render.php Sat Jul 21 18:12:10 2007 -0400
@@ -1,9 +1,10 @@
<?php
+
/*
* 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
* render.php - handles fetching pages and parsing them into HTML
- * 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
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
--- a/includes/search.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/search.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
* search.php - algorithm used to search pages
*
--- a/includes/sessions.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/sessions.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
* sessions.php - everything related to security and user management
*
@@ -2064,6 +2064,14 @@
}
}
+ // PAGE group info
+ $pg_list = $paths->get_page_groups($paths->cpage['urlname_nons'], $paths->namespace);
+ $pg_info = '';
+ foreach ( $pg_list as $g_id )
+ {
+ $pg_info .= ' ( page_id=\'' . $g_id . '\' AND namespace=\'__PageGroup\' ) OR';
+ }
+
// Build a query to grab ACL info
$bs = 'SELECT rules,target_type,target_id FROM '.table_prefix.'acl WHERE ( ';
$q = Array();
@@ -2077,7 +2085,7 @@
}
// The reason we're using an ORDER BY statement here is because ACL_TYPE_GROUP is less than ACL_TYPE_USER, causing the user's individual
// permissions to override group permissions.
- $bs .= implode(' OR ', $q) . ' ) AND ( page_id=\''.$db->escape($paths->cpage['urlname_nons']).'\' AND namespace=\''.$db->escape($paths->namespace).'\' )
+ $bs .= implode(' OR ', $q) . ' ) AND (' . $pg_info . ' ( page_id=\''.$db->escape($paths->cpage['urlname_nons']).'\' AND namespace=\''.$db->escape($paths->namespace).'\' ) )
ORDER BY target_type ASC, page_id ASC, namespace ASC;';
$q = $this->sql($bs);
if ( $row = $db->fetchrow() )
@@ -2489,6 +2497,14 @@
$this->perms = $acl_types;
$this->perms = $session->acl_merge_complete($this->perms, $base);
+ // PAGE group info
+ $pg_list = $paths->get_page_groups($page_id, $namespace);
+ $pg_info = '';
+ foreach ( $pg_list as $g_id )
+ {
+ $pg_info .= ' ( page_id=\'' . $g_id . '\' AND namespace=\'__PageGroup\' ) OR';
+ }
+
// Build a query to grab ACL info
$bs = 'SELECT rules FROM '.table_prefix.'acl WHERE ( ';
$q = Array();
@@ -2502,7 +2518,7 @@
}
// The reason we're using an ORDER BY statement here is because ACL_TYPE_GROUP is less than ACL_TYPE_USER, causing the user's individual
// permissions to override group permissions.
- $bs .= implode(' OR ', $q) . ' ) AND ( page_id=\''.$db->escape($page_id).'\' AND namespace=\''.$db->escape($namespace).'\' )
+ $bs .= implode(' OR ', $q) . ' ) AND (' . $pg_info . ' page_id=\''.$db->escape($page_id).'\' AND namespace=\''.$db->escape($namespace).'\' )
ORDER BY target_type ASC, page_id ASC, namespace ASC;';
$q = $session->sql($bs);
if ( $row = $db->fetchrow() )
--- a/includes/stats.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/stats.php Sat Jul 21 18:12:10 2007 -0400
@@ -1,7 +1,7 @@
<?php
/*
* 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
* stats.php - handles statistics for pages (disablable in the admin CP)
*
--- a/includes/template.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/template.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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
--- a/includes/wikiengine/Tables.php Sat Jul 21 11:28:59 2007 -0400
+++ b/includes/wikiengine/Tables.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/**
* 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
--- a/index.php Sat Jul 21 11:28:59 2007 -0400
+++ b/index.php Sat Jul 21 18:12:10 2007 -0400
@@ -1,7 +1,8 @@
<?php
+
/**
* 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
--- a/install.php Sat Jul 21 11:28:59 2007 -0400
+++ b/install.php Sat Jul 21 18:12:10 2007 -0400
@@ -1,7 +1,8 @@
<?php
+
/*
* 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
* install.php - handles everything related to installation and initial configuration
*
@@ -22,7 +23,7 @@
define('IN_ENANO_INSTALL', 'true');
-define('ENANO_VERSION', '1.0');
+define('ENANO_VERSION', '1.0.1');
// In beta versions, define ENANO_BETA_VERSION here
if(!defined('scriptPath')) {
@@ -315,7 +316,7 @@
<img alt="[ Enano CMS Project logo ]" src="images/enano-artwork/installer-greeting-blue.png" style="display: block; margin: 0 auto; padding-left: 100px;" />
<h2>Welcome to Enano</h2>
<h3>version 1.0 – stable<br />
- <span style="font-weight: normal;">also affectionately known as "banshee" <tt>:)</tt></span></h3>
+ <span style="font-weight: normal;">also affectionately known as "loch ness" <tt>:)</tt></span></h3>
<?php
if ( file_exists('./_nightly.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 @@
<p>Search for page title (remember prefixes like User: and File:) <?php echo $template->pagename_field('page_url'); ?> <input type="submit" style="font-weight: bold;" name="search" value="Search" /></p>
<p>Select page title from a list: <select name="page_force_url">
<?php
- for($i=0;$i<sizeof($paths->pages)/2;$i++)
+ for ( $i = 0; $i < sizeof($paths->pages) / 2; $i++ )
{
if($paths->pages[$i]['namespace'] != 'Admin' && $paths->pages[$i]['namespace'] != 'Special') echo '<option value="'.$paths->nslist[$paths->pages[$i]['namespace']].$paths->pages[$i]['urlname_nons'].'">'.$paths->nslist[$paths->pages[$i]['namespace']].$paths->pages[$i]['name'].'</option>'."\n";
}
@@ -1710,6 +1710,487 @@
}
}
+function page_Admin_PageGroups()
+{
+ global $db, $session, $paths, $template, $plugins; // Common objects
+ if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
+ {
+ echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
+ return;
+ }
+
+ if ( isset($_POST['action']) )
+ {
+ if ( isset($_POST['action']['create']) || isset($_POST['action']['create_stage2']) )
+ {
+ switch ( isset($_POST['action']['create_stage2']) )
+ {
+ case true:
+ if ( empty($_POST['pg_name']) || empty($_POST['group_type']) )
+ {
+ echo '<div class="error-box">Please enter a name for the page group.</div>';
+ return;
+ }
+ if ( $_POST['group_type'] == PAGE_GRP_TAGGED && empty($_POST['member_tag']) )
+ {
+ echo '<div class="error-box">Please enter a page tag.</div>';
+ return;
+ }
+ if ( $_POST['group_type'] == PAGE_GRP_CATLINK && empty($_POST['member_cat']) )
+ {
+ echo '<div class="error-box">Please create a category page before linking a page group to a category.</div>';
+ return;
+ }
+ if ( $_POST['group_type'] == PAGE_GRP_NORMAL && empty($_POST['member_page_0']) )
+ {
+ echo '<div class="error-box">Please specify at least one page to place in this group.</div>';
+ return;
+ }
+ if ( $_POST['group_type'] != PAGE_GRP_TAGGED && $_POST['group_type'] != PAGE_GRP_CATLINK && $_POST['group_type'] != PAGE_GRP_NORMAL )
+ {
+ echo '<div class="error-box">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.</div>';
+ return;
+ }
+ // All checks passed, create the group
+ switch($_POST['group_type'])
+ {
+ case PAGE_GRP_TAGGED:
+ $name = $db->escape($_POST['pg_name']);
+ $tag = $db->escape($_POST['member_tag']);
+ $sql = 'INSERT INTO '.table_prefix.'page_groups(pg_type,pg_name,pg_target) VALUES(' . PAGE_GRP_TAGGED . ', \'' . $name . '\', \'' . $tag . '\');';
+ $q = $db->sql_query($sql);
+ if ( !$q )
+ $db->_die();
+ break;
+ case PAGE_GRP_CATLINK:
+ $name = $db->escape($_POST['pg_name']);
+ $cat = $db->escape($_POST['member_cat']);
+ $sql = 'INSERT INTO '.table_prefix.'page_groups(pg_type,pg_name,pg_target) VALUES(' . PAGE_GRP_CATLINK . ', \'' . $name . '\', \'' . $cat . '\');';
+ $q = $db->sql_query($sql);
+ if ( !$q )
+ $db->_die();
+ break;
+ case PAGE_GRP_NORMAL:
+ $name = $db->escape($_POST['pg_name']);
+ $sql = 'INSERT INTO '.table_prefix.'page_groups(pg_type,pg_name) VALUES(' . PAGE_GRP_NORMAL . ', \'' . $name . '\');';
+ $q = $db->sql_query($sql);
+ if ( !$q )
+ $db->_die();
+
+ $ins_id = $db->insert_id();
+
+ // Page list
+ $keys = array_keys($_POST);
+ $arr_pages = array();
+ foreach ( $keys as $val )
+ {
+ if ( preg_match('/^member_page_([0-9]+?)$/', $val) && !empty($_POST[$val]) )
+ {
+ $arr_pages[] = $_POST[$val];
+ }
+ }
+ $arr_sql = array();
+ foreach ( $arr_pages as $page )
+ {
+ list($id, $ns) = RenderMan::strToPageID($page);
+ $id = sanitize_page_id($id);
+ $arr_sql[] = '(' . $ins_id . ',\'' . $db->escape($id) . '\', \'' . $ns . '\')';
+ }
+ $sql = 'INSERT INTO '.table_prefix.'page_group_members(pg_id,page_id,namespace) VALUES' . implode(',', $arr_sql) . ';';
+ $q = $db->sql_query($sql);
+ if ( !$q )
+ $db->_die();
+ break;
+ }
+ echo '<div class="info-box">The page group "' . htmlspecialchars($_POST['pg_name']) . '" has been created.</div>';
+ break;
+ }
+ // A little Javascript magic
+ ?>
+ <script language="javascript" type="text/javascript">
+ function pg_create_typeset(selector)
+ {
+ var pg_normal = <?php echo PAGE_GRP_NORMAL; ?>;
+ var pg_tagged = <?php echo PAGE_GRP_TAGGED; ?>;
+ var pg_catlink = <?php echo PAGE_GRP_CATLINK; ?>;
+ var selection = false;
+ // Get selection
+ for ( var i = 0; i < selector.childNodes.length; i++ )
+ {
+ var child = selector.childNodes[i];
+ if ( !child || child.tagName != 'OPTION' )
+ {
+ continue;
+ }
+ if ( child.selected )
+ {
+ selection = child.value;
+ }
+ }
+ if ( !selection )
+ {
+ alert('Cannot get field value');
+ return true;
+ }
+ selection = parseInt(selection);
+ if ( selection != pg_normal && selection != pg_tagged && selection != pg_catlink )
+ {
+ alert('Invalid field value');
+ return true;
+ }
+
+ // We have the selection and it's validated; show the appropriate field group
+
+ if ( selection == pg_normal )
+ {
+ 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 = 'inline';
+ document.getElementById('pg_create_normal_1').style.display = 'block';
+ document.getElementById('pg_create_normal_2').style.display = 'block';
+ }
+ else if ( selection == pg_catlink )
+ {
+ document.getElementById('pg_create_title_catlink').style.display = 'inline';
+ document.getElementById('pg_create_catlink_1').style.display = 'block';
+ document.getElementById('pg_create_catlink_2').style.display = 'block';
+
+ 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';
+ }
+ else if ( selection == pg_tagged )
+ {
+ 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 = 'inline';
+ document.getElementById('pg_create_tagged_1').style.display = 'block';
+ document.getElementById('pg_create_tagged_2').style.display = 'block';
+
+ 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';
+ }
+
+ }
+
+ // Set to pg_normal on page load
+ var pg_createform_init = function()
+ {
+ 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 = 'inline';
+ document.getElementById('pg_create_normal_1').style.display = 'block';
+ document.getElementById('pg_create_normal_2').style.display = 'block';
+ }
+
+ addOnloadHook(pg_createform_init);
+
+ function pg_create_more_fields()
+ {
+ var targettd = document.getElementById('pg_create_normal_2');
+ var id = 0;
+ for ( var i = 0; i < targettd.childNodes.length; i++ )
+ {
+ var child = targettd.childNodes[i];
+ if ( child.tagName == 'INPUT' )
+ {
+ if ( child.type == 'button' )
+ {
+ var newInp = document.createElement('input');
+ // <input type="text" name="member_page_1" id="pg_create_member_1" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
+ newInp.type = 'text';
+ newInp.name = 'member_page_' + id;
+ newInp.id = 'pg_create_member_' + id;
+ newInp.onkeyup = function(e) { return ajaxPageNameComplete(this); };
+ newInp.size = '30';
+ newInp.style.marginTop = '3px';
+ targettd.insertBefore(newInp, child);
+ targettd.insertBefore(document.createElement('br'), child);
+ break;
+ }
+ else // if ( child.type == 'text' )
+ {
+ id++;
+ }
+ }
+ }
+ }
+
+ </script>
+ <?php
+
+ // Build category list
+ $q = $db->sql_query('SELECT name,urlname FROM '.table_prefix.'pages WHERE namespace=\'Category\';');
+ if ( !$q )
+ $db->_die();
+
+ if ( $db->numrows() < 1 )
+ {
+ $catlist = 'There aren\'t any categories on this site.';
+ }
+ else
+ {
+ $catlist = '<select name="member_cat">';
+ while ( $row = $db->fetchrow() )
+ {
+ $catlist .= '<option value="' . htmlspecialchars($row['urlname']) . '">' . htmlspecialchars($row['name']) . '</option>';
+ }
+ $catlist .= '</select>';
+ }
+
+ echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
+
+ echo '<div class="tblholder">
+ <table border="0" cellspacing="1" cellpadding="4">
+ <tr>
+ <th colspan="2">Create page group</th>
+ </tr>';
+
+ // Name
+ echo '<tr>
+ <td class="row2">
+ Group name:<br />
+ <small>This should be short, descriptive, and human-readable.</small>
+ </td>
+ <td class="row1">
+ <input type="text" name="pg_name" size="30" />
+ </td>
+ </tr>';
+
+ // Group type
+ echo '<tr>
+ <td class="row2">
+ Group type:
+ </td>
+ <td class="row1">
+ <select name="group_type" onchange="pg_create_typeset(this);">
+ <option value="' . PAGE_GRP_NORMAL . '" selected="selected">Static group of pages</option>
+ <option value="' . PAGE_GRP_TAGGED . '">Group of pages with one tag</option>
+ <option value="' . PAGE_GRP_CATLINK . '">Link to category</option>
+ </select>
+ </td>
+ </tr>';
+
+ // Titles
+ echo '<tr>
+ <th colspan="2">
+ <span id="pg_create_title_normal">
+ Static group of pages
+ </span>
+ <span id="pg_create_title_tagged">
+ Group of commonly tagged pages
+ </span>
+ <span id="pg_create_title_catlink">
+ Mirror a category
+ </span>
+ </th>
+ </tr>';
+
+ echo '<tr>
+ <td class="row2">
+ <div id="pg_create_normal_1">
+ Member pages:<br />
+ <small>Click the "plus" button to add more fields.</small>
+ </div>
+ <div id="pg_create_catlink_1">
+ Include pages in this category:<br />
+ <small>Pages in subcategories are <u>not</u> included, however subcategory pages themselves are.</small>
+ </div>
+ <div id="pg_create_tagged_1">
+ Include pages with this tag:
+ </div>
+ </td>';
+
+ echo ' <td class="row1">
+ <div id="pg_create_normal_2" />
+ <input type="text" style="margin-top: 3px;" name="member_page_0" id="pg_create_member_0" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
+ <input type="text" style="margin-top: 3px;" name="member_page_1" id="pg_create_member_1" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
+ <input type="text" style="margin-top: 3px;" name="member_page_2" id="pg_create_member_2" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
+ <input type="text" style="margin-top: 3px;" name="member_page_3" id="pg_create_member_3" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
+ <input type="text" style="margin-top: 3px;" name="member_page_4" id="pg_create_member_4" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
+ <input type="button" onclick="pg_create_more_fields(); return false;" style="margin-top: 5px;" value=" + " />
+ </div>
+ <div id="pg_create_tagged_2">
+ <input type="text" name="member_tag" size="30" />
+ </div>
+ <div id="pg_create_catlink_2">
+ ' . $catlist . '
+ </div>
+ </td>
+ </tr>';
+
+ // Submit button
+ echo '<tr>
+ <th class="subhead" colspan="2"><input type="submit" name="action[create_stage2]" value="Create page group" style="font-weight: bold;" /> <input type="submit" name="action[noop]" value="Cancel" style="font-weight: normal;" /></th>
+ </tr>';
+
+ echo '</table>
+ </div>';
+
+ echo '</form>';
+ 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 '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
+ echo '<input type="hidden" name="delete_id" value="' . $delete_id . '" />';
+ echo '<div class="tblholder">';
+ echo ' <table border="0" cellspacing="1" cellpadding="4">';
+ echo ' <tr><th>Confirm deletion</th></tr>';
+ echo ' <tr><td class="row2" style="text-align: center; padding: 20px 0;">Are you sure you want to delete this page group?</td></tr>';
+ echo ' <tr><td class="row1" style="text-align: center;">';
+ echo ' <input type="submit" name="action[del_confirm]" value="Yes, delete group" style="font-weight: bold;" />';
+ echo ' <input type="submit" name="action[noop]" value="Cancel" style="font-weight: normal;" />';
+ echo ' </td></tr>';
+ echo ' </table>';
+ echo '</form>';
+
+ 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 "<div class='info-box'>The group ".'"'."$pg_name".'"'." has been deleted.</div>";
+ }
+ else if ( isset($_POST['action']['edit']) )
+ {
+ return;
+ }
+ else if ( isset($_POST['action']['noop']) )
+ {
+ // Do nothing
+ }
+ else
+ {
+ echo '<div class="error-box">Invalid format of $_POST[action].</div>';
+ }
+ }
+ // 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 '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
+
+ echo '<div class="tblholder">
+ <table border="0" cellspacing="1" cellpadding="4">
+ <tr>
+ <th>Group name</th>
+ <th>Type</th>
+ <th>Target</th>
+ <th colspan="2">Actions</th>
+ </tr>';
+
+ 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 = '<input type="submit" name="action[edit][' . $row['pg_id'] . ']" value="Edit" />';
+ $btn_del = '<input type="submit" name="action[del][' . $row['pg_id'] . ']" value="Delete" />';
+ // stupid jEdit bug/hack
+ $quot = '"';
+ echo "<tr>
+ <td class={$quot}row1{$quot}>$name</td>
+ <td class={$quot}row2{$quot}>$type</td>
+ <td class={$quot}row1{$quot}>$target</td>
+ <td class={$quot}row3{$quot} style={$quot}text-align: center;{$quot}>$btn_edit</td>
+ <td class={$quot}row3{$quot} style={$quot}text-align: center;{$quot}>$btn_del</td>
+ </tr>";
+ }
+ while ( $row = $db->fetchrow() );
+ }
+ else
+ {
+ echo ' <tr><td class="row3" colspan="5" style="text-align: center;">No page groups defined.</td></tr>';
+ }
+
+ echo ' <tr>
+ <th class="subhead" colspan="5">
+ <input type="submit" name="action[create]" value="Create new group" />
+ </th>
+ </tr>';
+
+ echo ' </table>
+ </div>';
+
+ echo '</form>';
+
+}
+
function page_Admin_ThemeManager()
{
--- a/plugins/SpecialPageFuncs.php Sat Jul 21 11:28:59 2007 -0400
+++ b/plugins/SpecialPageFuncs.php Sat Jul 21 18:12:10 2007 -0400
@@ -357,7 +357,7 @@
if(file_exists(ENANO_ROOT.'/GPL'))
{
echo '<p>The following text represents the license that the <a href="'.makeUrlNS('Special', 'About_Enano').'">Enano</a> content management system is under. To make it easier to read, the text has been wiki-formatted; in no other way has it been changed.</p>';
- echo RenderMan::render( htmlspecialchars ( file_get_contents ( ENANO_ROOT . '/GPL' ) ) );
+ echo RenderMan::render( file_get_contents ( ENANO_ROOT . '/GPL' ) );
}
else
{
--- a/schema.sql Sat Jul 21 11:28:59 2007 -0400
+++ b/schema.sql Sat Jul 21 18:12:10 2007 -0400
@@ -223,6 +223,26 @@
PRIMARY KEY ( search_id )
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
+-- Added in 1.0.1
+
+CREATE TABLE {{TABLE_PREFIX}}page_groups(
+ pg_id mediumint(8) NOT NULL auto_increment,
+ pg_type tinyint(2) NOT NULL DEFAULT 1,
+ pg_name varchar(255) NOT NULL DEFAULT '',
+ pg_target varchar(255) DEFAULT NULL,
+ PRIMARY KEY ( pg_id )
+) CHARACTER SET `utf8` COLLATE `utf8_bin`;
+
+-- Added in 1.0.1
+
+CREATE TABLE {{TABLE_PREFIX}}page_group_members(
+ pg_member_id int(12) NOT NULL auto_increment,
+ pg_id mediumint(8) NOT NULL,
+ page_id varchar(63) NOT NULL,
+ namespace varchar(63) NOT NULL DEFAULT 'Article',
+ PRIMARY KEY ( pg_member_id )
+) CHARACTER SET `utf8` COLLATE `utf8_bin`;
+
INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES
('site_name', '{{SITE_NAME}}'),
('main_page', 'Main_Page'),
--- a/upgrade.php Sat Jul 21 11:28:59 2007 -0400
+++ b/upgrade.php Sat Jul 21 18:12:10 2007 -0400
@@ -2,7 +2,7 @@
/*
* 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)
* upgrade.php - upgrade script
* Copyright (C) 2006-2007 Dan Fuhry
*
@@ -61,7 +61,7 @@
// Everything related to versions goes here!
// Valid versions to upgrade from
-$valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2', '1.0RC3');
+$valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2', '1.0RC3', '1.0');
// Basically a list of dependencies, which should be resolved automatically
// If, for example, upgrading from 1.0b1 to 1.0RC1 requires one extra query that would not
@@ -72,9 +72,10 @@
'1.0b3' => Array('1.0b4'),
'1.0b4' => Array('1.0RC1'),
'1.0RC1' => Array('1.0RC2'),
- '1.0RC2' => Array('1.0RC3')
+ '1.0RC2' => Array('1.0RC3'),
+ '1.0RC3' => Array('1.0')
);
-$this_version = '1.0';
+$this_version = '1.0.1';
$func_list = Array(
'1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text'), // ,
// '1.0RC2' => Array('u_1_0_populate_userpage_comments')
--- a/upgrade.sql Sat Jul 21 11:28:59 2007 -0400
+++ b/upgrade.sql Sat Jul 21 18:12:10 2007 -0400
@@ -3,7 +3,11 @@
-- ALL NON-SQL LINES, even otherwise blank lines, must start with "--" or they will get sent to MySQL!
-- Common tasks (version numbers)
DELETE FROM {{TABLE_PREFIX}}config WHERE config_name='enano_version' OR config_name='enano_beta_version' OR config_name='enano_alpha_version' OR config_name='enano_rc_version';
-INSERT INTO {{TABLE_PREFIX}}config (config_name, config_value) VALUES( 'enano_version', '1.0' );
+INSERT INTO {{TABLE_PREFIX}}config (config_name, config_value) VALUES( 'enano_version', '1.0.1' );
+---BEGIN 1.0---
+CREATE TABLE {{TABLE_PREFIX}}page_groups( pg_id mediumint(8) NOT NULL auto_increment, pg_type tinyint(2) NOT NULL DEFAULT 1, pg_name varchar(255) NOT NULL DEFAULT '', pg_target varchar(255) DEFAULT NULL, PRIMARY KEY ( pg_id ) ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
+CREATE TABLE {{TABLE_PREFIX}}page_group_members( pg_member_id int(12) NOT NULL auto_increment, pg_id mediumint(8) NOT NULL, page_id varchar(63) NOT NULL, namespace varchar(63) NOT NULL DEFAULT 'Article', PRIMARY KEY ( pg_member_id ) ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
+---END 1.0---
---BEGIN 1.0RC3---
ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_coppa tinyint(1) NOT NULL DEFAULT 0;
UPDATE {{TABLE_PREFIX}}sidebar SET block_content='[[$NS_SPECIAL$CreatePage|Create a page]]\n[[$NS_SPECIAL$UploadFile|Upload file]]\n[[$NS_SPECIAL$SpecialPages|Special pages]]\n{if auth_admin}\n[[$NS_SPECIAL$EditSidebar|Edit the sidebar]]\n$ADMIN_LINK$\n{/if}' WHERE item_id=2;