User:Highway of life/Auth List

Created this script to generate the permission roles for Admin permissions, Moderator permissions, User permissions, and Forum permissions tables.  Highway of Life  (talk)  22:58, 13 April 2007 (UTC) <?php /**
 * @author Highway of Life http://startrekguide.com
 * @package Develop
 * @version $Id: auth_permissions_wiki.php 18 2007-04-18 00:40:27Z highwayoflife $
 * @copyright (c) 2007 Star Trek Guide Group
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License

/** define('IN_PHPBB', true); $phpbb_root_path = './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx);
 * @ignore

// Start session management $user->session_begin; $auth->acl($user->data); $user->setup('common');

// is the user logged in? if (!$user->data['is_registered']) {   if ($user->data['is_bot']) {       // the user is a bot, send them back to home plate... redirect(append_sid("{$phpbb_root_path}index.$phpEx")); }   // the user is not logged in, give them a chance to login here... login_box('', 'LOGIN'); } else if ($user->data['user_type'] != USER_FOUNDER) {   trigger_error('NOT_AUTHORISED'); } $user->add_lang('acp/permissions_phpbb');

$acl = request_var('acl', ''); $type = '';

$action	= sprintf('%sView Admin Permissions%s',		'', ''). ' '; $action .= sprintf('%sView Moderator Permissions%s','', ''). ' '; $action .= sprintf('%sView User Permissions%s',		'', ''). ' '; $action .= sprintf('%sView Forum Permissions%s',	'', ''). ' ';

if (!empty($acl)) {   switch ($acl) {       case 'a': $type = 'a'; break; case 'm': $type = 'm'; break; case 'u': $type = 'u'; break; case 'f': $type = 'f'; break; }	if ($type) {		header('Content-type:text/plain'); print '{|border="1" cellspacing="0" cellpadding="3" ! Auth Option ! Auth Usage ! Auth Lang ';		$sql = 'SELECT auth_option FROM '. ACL_OPTIONS_TABLE. ' WHERE auth_option LIKE "' . $type . '_%"'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) {			if ($row['auth_option'] == ($type. '_'))			{				print "|-\n"; print "| {$row['auth_option']}\n"; print '| $auth->acl_get(\'' . $row['auth_option'] . "');< /php>\n"; print '| '. $user->lang['permission_type'][$row['auth_option']]. "\n"; }			else {				$permission = $row['auth_option']; print "|-\n"; print "| $permission\n"; print '| $auth->acl_get(\'' . $row['auth_option'] . "');< /php>\n"; print '| '. $user->lang['acl_'. $permission]['lang']. "\n"; }		}		$db->sql_freeresult($result); print '|}'; }	else {		trigger_error($action); } } else {	trigger_error($action); } ?>