<?php
/*
*****************************************************************
PortalPermissions.php
*****************************************************************
LSP: Lunabyte Systems Portal
Open-Source Project Inspired by Zef Hemel (hide@address.com)
*****************************************************************
Software Version: LSP 2.0 "Enigma 2"
Software by: Lunabyte Systems (http://www.lunabyte.net)
Copyright 2002-2005 by: Lunabyte Systems (http://www.lunabyte.net)
Support, News, Updates at: http://www.lunabyte.net
*****************************************************************
This program is free software; you may redistribute it and/or modify it
under the terms of the provided license as published by Lunabyte Systems.
This program is distributed in the hope that it is and will be useful,
but WITHOUT ANY WARRANTIES; without even any implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the "LSP_license.txt" file for details of the LSP license.
The latest version can always be found at http://www.lunabyte.net.
*****************************************************************
*/
loadPLanguage('PortalPermissions');
$permissionList['membergroup'] = array_merge($permissionList['membergroup'], portalPermissionList());
$non_guest_permissions = array_merge($non_guest_permissions, portalNonGuestPermissions());
$leftPermissionGroups = array_merge($leftPermissionGroups, portalLeftPermissionGroups());
/*
1. to add portal permissions, add to the $portalPermissionList array and PortalPermissions.english.php
in the same manner as SMF's permission array and language file.
2. If the new permission is something that Guests should NOT be allowed at all, add it
to the $portalNonGuestPermissions array. Otherwise it will be able to be set for guests.
3. If you want the new group of permissions to display on the left side of the permission
screen, add the group name to the $portalLeftPermissions array.
For all other formating or options, refer to the comments in SMF's ManagePermissions.php file.
*/
function portalPermissionList()
{
$portalPermissionList = array (
'portal_manage' => array(
'manage_blocks' => false,
'manage_menus' => false,
'manage_news' => false,
'manage_pages' => false,
),
'submissions' => array(
'submit_news' => false,
'review_news' => false,
'submit_article' => false,
'review_article' => false,
),
);
return $portalPermissionList;
}
function portalNonGuestPermissions()
{
$portalNonGuestPermissions = array(
'manage_blocks',
'manage_menus',
'manage_news',
'manage_pages',
'review_news',
'review_article',
);
return $portalNonGuestPermissions;
}
function portalLeftPermissionGroups()
{
$portalLeftPermissionGroups = array(
'portal_manage',
);
return $portalLeftPermissionGroups;
}
global $moduledir, $txt, $blockdir, $modSettings;
// set an array to use for auto loading settings files
$autoLoad = array();
// Enigma -- Get ModSettings for Modules from the Main ModuleSettings file if the file exists
if ($modSettings['enablemodules'] && file_exists($moduledir . '/ModulePermissions.php'))
{
include_once($moduledir . '/ModulePermissions.php');
// if autoload directory exists, set it to check
if (is_dir($moduledir . '/ModulePermissions'))
$autoLoad[] = $moduledir . '/ModulePermissions';
}
// set and autoload directory for blocks if it exists
if ($modSettings['enableblocks'] && is_dir($blockdir . '/BlockPermissions'))
$autoLoad[] = $blockdir . '/BlockPermissions';
// now let's check for files
if (sizeof($autoLoad) > 0)
{
foreach ($autoLoad as $load)
{
if ($loadFiles = readDirectory($load, 'Permissions_', '.php'))
{
foreach ($loadFiles as $file)
{ // include the file
include_once($load . '/' . $file);
// is it setup properly? check it the best we can and add it to the array if it is
if (!empty($perm_list) && is_array($perm_list) && sizeof($perm_list) > 0)
{
$permissionList['membergroup'] = array_merge($permissionList['membergroup'], $perm_list);
// check for non_guest perms
if (!empty($perm_non_guest) && is_array($perm_non_guest) && sizeof($perm_non_guest) > 0)
$non_guest_permissions = array_merge($non_guest_permissions, $perm_non_guest);
// check for left groups
if (!empty($perm_left_groups) && is_array($perm_left_groups) && sizeof($perm_left_groups) > 0)
$leftPermissionGroups = array_merge($leftPermissionGroups, $perm_left_groups);
}
// it's not configured properly, so let's let someone know
else
fatal_error('"' . $load . '/' . $file . '" ' . $txt['bad_file']);
}
}
}
}
?>