}
if ($mode == 'upgrade') {
    include_once DP_BASE_DIR . '/includes/config.php';
}
require_once DP_BASE_DIR . '/includes/main_functions.php';
require_once DP_BASE_DIR . '/install/install.inc.php';
require_once DP_BASE_DIR . '/includes/db_adodb.php';
require_once DP_BASE_DIR . '/includes/db_connect.php';
// Required here as we may either be an upgrade, or an install.
$dbprefix = dPgetConfig('dbprefix', '');
// Now update the GACL class information.
require_once DP_BASE_DIR . '/classes/permissions.class.php';
dPmsg('Creating new Permissions objects');
$perms = new dPacl();
// First, create the basic ACL sections.
$perms->add_object_section('System', 'system', 1, 0, 'aco');
$perms->add_object_section('Application', 'application', 2, 0, 'aco');
$perms->add_object_section('Users', 'user', 1, 0, 'aro');
$perms->add_object_section('System', 'sys', 1, 0, 'axo');
$perms->add_object_section('Application', 'app', 2, 0, 'axo');
// Create the permissions in the ACO sections.
$perms->add_object('system', 'Login', 'login', 1, 0, 'aco');
$perms->add_object('application', 'Access', 'access', 1, 0, 'aco');
$perms->add_object('application', 'View', 'view', 2, 0, 'aco');
$perms->add_object('application', 'Add', 'add', 3, 0, 'aco');
$perms->add_object('application', 'Edit', 'edit', 4, 0, 'aco');
$perms->add_object('application', 'Delete', 'delete', 5, 0, 'aco');
// Now create the groups we need.
$role = $perms->add_group('role', 'Roles', 0, 'aro');
$admin_role = $perms->add_group('admin', 'Administrator', $role, 'aro');
$anon_role = $perms->add_group('anon', 'Anonymous', $role, 'aro');