function spa_save_permissions_new_role()
{
    global $spGlobals;
    sp_build_site_auths_cache();
    check_admin_referer('forum-adminform_rolenew', 'forum-adminform_rolenew');
    $new_auths = array();
    if (isset($_POST['role']) && $_POST['role'] != -1) {
        $role = spa_get_role_row(sp_esc_int($_POST['role']));
        $new_auths = $role->role_auths;
    } else {
        foreach ($spGlobals['auths_map'] as $auth_name => $auth_id) {
            $thisperm = isset($_POST['b-' . $auth_id]) ? 1 : 0;
            $new_auths[$auth_id] = $thisperm;
        }
        $new_auths = serialize($new_auths);
    }
    $role_name = sp_filter_title_save(trim($_POST['role_name']));
    $role_desc = sp_filter_title_save(trim($_POST['role_desc']));
    if (empty($role_name)) {
        $mess = spa_text('New permission set creation failed - permission set name required');
        return $mess;
    }
    # force max size
    $role_name = substr($role_name, 0, 50);
    $role_desc = substr($role_desc, 0, 150);
    # create the permission set
    $success = spa_create_role_row($role_name, $role_desc, $new_auths, true);
    if ($success == false) {
        $mess = spa_text('New permission set creation failed');
    } else {
        do_action('sph_perms_add', $role_id);
        $mess = spa_text('New permission set created');
    }
    return $mess;
}
function spa_setup_permissions()
{
    # Create default role data
    # NOTE that the auths do not use action names like this, but its pretty unreadable the way its stored
    # so use action names here for readability and maintainability. we will convert the actions to auths before storing
    $actions = array();
    $actions['Can view forum'] = 0;
    $actions['Can view forum lists only'] = 0;
    $actions['Can view forum and topic lists only'] = 0;
    $actions['Can view forum and topic lists only'] = 0;
    $actions['Can view admin posts'] = 0;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can start new topics'] = 0;
    $actions['Can reply to topics'] = 0;
    $actions['Can reply to topics'] = 0;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 0;
    $actions['Can edit own topic titles'] = 0;
    $actions['Can pin topics'] = 0;
    $actions['Can move topics'] = 0;
    $actions['Can move posts'] = 0;
    $actions['Can lock topics'] = 0;
    $actions['Can delete topics'] = 0;
    $actions['Can edit own posts forever'] = 0;
    $actions['Can edit own posts until reply'] = 0;
    $actions['Can edit any posts'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can pin posts'] = 0;
    $actions['Can reassign posts'] = 0;
    $actions['Can view users email addresses'] = 0;
    $actions['Can view members profiles'] = 0;
    $actions['Can view members lists'] = 0;
    $actions['Can sort most recent posts'] = 0;
    $actions['Can bypass math question'] = 0;
    $actions['Can bypass post moderation'] = 0;
    $actions['Can bypass post moderation once'] = 0;
    $actions['Can use signatures'] = 0;
    $actions['Can upload avatars'] = 0;
    $actions['Can use spoilers'] = 0;
    $actions['Can view links'] = 0;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can create links'] = 0;
    $role_name = 'No Access';
    $role_desc = 'Permission with no access to any Forum features';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view forum lists only'] = 0;
    $actions['Can view forum and topic lists only'] = 0;
    $actions['Can view admin posts'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can start new topics'] = 0;
    $actions['Can reply to topics'] = 0;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 0;
    $actions['Can edit own topic titles'] = 0;
    $actions['Can edit any topic titles'] = 0;
    $actions['Can pin topics'] = 0;
    $actions['Can move topics'] = 0;
    $actions['Can move posts'] = 0;
    $actions['Can lock topics'] = 0;
    $actions['Can delete topics'] = 0;
    $actions['Can edit own posts forever'] = 0;
    $actions['Can edit own posts until reply'] = 0;
    $actions['Can edit any posts'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can pin posts'] = 0;
    $actions['Can reassign posts'] = 0;
    $actions['Can view users email addresses'] = 0;
    $actions['Can view members profiles'] = 0;
    $actions['Can view members lists'] = 0;
    $actions['Can sort most recent posts'] = 0;
    $actions['Can bypass math question'] = 0;
    $actions['Can bypass post moderation'] = 0;
    $actions['Can bypass post moderation once'] = 0;
    $actions['Can use signatures'] = 0;
    $actions['Can upload avatars'] = 0;
    $actions['Can use spoilers'] = 1;
    $actions['Can view links'] = 1;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can create links'] = 0;
    $role_name = 'Read Only Access';
    $role_desc = 'Permission with access to only view the Forum';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view forum lists only'] = 0;
    $actions['Can view forum and topic lists only'] = 0;
    $actions['Can view admin posts'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can start new topics'] = 1;
    $actions['Can reply to topics'] = 1;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 0;
    $actions['Can edit own topic titles'] = 0;
    $actions['Can edit any topic titles'] = 0;
    $actions['Can pin topics'] = 0;
    $actions['Can move topics'] = 0;
    $actions['Can move posts'] = 0;
    $actions['Can lock topics'] = 0;
    $actions['Can delete topics'] = 0;
    $actions['Can edit own posts forever'] = 0;
    $actions['Can edit own posts until reply'] = 0;
    $actions['Can edit any posts'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can pin posts'] = 0;
    $actions['Can reassign posts'] = 0;
    $actions['Can view users email addresses'] = 0;
    $actions['Can view members profiles'] = 1;
    $actions['Can view members lists'] = 1;
    $actions['Can sort most recent posts'] = 0;
    $actions['Can bypass math question'] = 0;
    $actions['Can bypass post moderation'] = 0;
    $actions['Can bypass post moderation once'] = 0;
    $actions['Can use signatures'] = 0;
    $actions['Can upload avatars'] = 1;
    $actions['Can use spoilers'] = 1;
    $actions['Can view links'] = 1;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can create links'] = 1;
    $role_name = 'Limited Access';
    $role_desc = 'Permission with access to reply and start topics but with limited features';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view forum lists only'] = 0;
    $actions['Can view forum and topic lists only'] = 0;
    $actions['Can view admin posts'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can start new topics'] = 1;
    $actions['Can reply to topics'] = 1;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 0;
    $actions['Can edit own topic titles'] = 0;
    $actions['Can edit any topic titles'] = 0;
    $actions['Can pin topics'] = 0;
    $actions['Can move topics'] = 0;
    $actions['Can move posts'] = 0;
    $actions['Can lock topics'] = 0;
    $actions['Can delete topics'] = 0;
    $actions['Can edit own posts forever'] = 0;
    $actions['Can edit own posts until reply'] = 1;
    $actions['Can edit any posts'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can pin posts'] = 0;
    $actions['Can reassign posts'] = 0;
    $actions['Can view users email addresses'] = 0;
    $actions['Can view members profiles'] = 1;
    $actions['Can view members lists'] = 1;
    $actions['Can sort most recent posts'] = 0;
    $actions['Can bypass math question'] = 0;
    $actions['Can bypass post moderation'] = 1;
    $actions['Can bypass post moderation once'] = 1;
    $actions['Can use signatures'] = 1;
    $actions['Can upload avatars'] = 1;
    $actions['Can use spoilers'] = 1;
    $actions['Can view links'] = 1;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can create links'] = 1;
    $role_name = 'Standard Access';
    $role_desc = 'Permission with access to reply and start topics with advanced features such as signatures';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view forum lists only'] = 0;
    $actions['Can view forum and topic lists only'] = 0;
    $actions['Can view admin posts'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can start new topics'] = 1;
    $actions['Can reply to topics'] = 1;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 1;
    $actions['Can edit own topic titles'] = 1;
    $actions['Can edit any topic titles'] = 0;
    $actions['Can pin topics'] = 0;
    $actions['Can move topics'] = 0;
    $actions['Can move posts'] = 0;
    $actions['Can lock topics'] = 0;
    $actions['Can delete topics'] = 0;
    $actions['Can edit own posts forever'] = 1;
    $actions['Can edit own posts until reply'] = 1;
    $actions['Can edit any posts'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can pin posts'] = 0;
    $actions['Can reassign posts'] = 0;
    $actions['Can view users email addresses'] = 0;
    $actions['Can view members profiles'] = 1;
    $actions['Can view members lists'] = 1;
    $actions['Can sort most recent posts'] = 0;
    $actions['Can bypass math question'] = 1;
    $actions['Can bypass post moderation'] = 1;
    $actions['Can bypass post moderation once'] = 1;
    $actions['Can use signatures'] = 1;
    $actions['Can upload avatars'] = 1;
    $actions['Can use spoilers'] = 1;
    $actions['Can view links'] = 1;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can create links'] = 1;
    $role_name = 'Full Access';
    $role_desc = 'Permission with Standard Access features and math question bypass';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view forum lists only'] = 0;
    $actions['Can view forum and topic lists only'] = 0;
    $actions['Can view admin posts'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can start new topics'] = 1;
    $actions['Can reply to topics'] = 1;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 1;
    $actions['Can edit any topic titles'] = 1;
    $actions['Can edit own topic titles'] = 1;
    $actions['Can pin topics'] = 1;
    $actions['Can move topics'] = 1;
    $actions['Can move posts'] = 1;
    $actions['Can lock topics'] = 1;
    $actions['Can delete topics'] = 1;
    $actions['Can edit own posts forever'] = 1;
    $actions['Can edit own posts until reply'] = 1;
    $actions['Can edit any posts'] = 1;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 1;
    $actions['Can pin posts'] = 1;
    $actions['Can reassign posts'] = 1;
    $actions['Can view users email addresses'] = 1;
    $actions['Can view members profiles'] = 1;
    $actions['Can view members lists'] = 1;
    $actions['Can sort most recent posts'] = 1;
    $actions['Can bypass math question'] = 1;
    $actions['Can bypass post moderation'] = 1;
    $actions['Can bypass post moderation once'] = 1;
    $actions['Can use signatures'] = 1;
    $actions['Can upload avatars'] = 1;
    $actions['Can use spoilers'] = 1;
    $actions['Can view links'] = 1;
    $actions['Can moderate pending posts'] = 1;
    $actions['Can create links'] = 1;
    $role_name = 'Moderator Access';
    $role_desc = 'Permission with access to all Forum features';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
}
function spa_setup_permissions()
{
    # Create default role data
    # NOTE that the auths do not use action names like this, but its pretty unreadable the way its stored
    # so use action names here for readability and maintainability. we will convert the actions to auths before storing
    $actions = array();
    $actions['Can view forum'] = 0;
    $actions['Can view a list of forums only'] = 0;
    $actions['Can view a list of forums and list of topics only'] = 0;
    $actions['Can view posts by an administrator'] = 0;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can view email and IP addresses of members'] = 0;
    $actions['Can view profiles of members'] = 0;
    $actions['Can view the members lists'] = 0;
    $actions['Can view links within posts'] = 0;
    $actions['Can start new topics in a forum'] = 0;
    $actions['Can reply to existing topics in a forum'] = 0;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 0;
    $actions['Can use spoilers in posts'] = 0;
    $actions['Can attach a signature to posts'] = 0;
    $actions['Can create links in posts'] = 0;
    $actions['Can use smileys in posts'] = 0;
    $actions['Can use iframes in posts'] = 0;
    $actions['Can edit own topic titles'] = 0;
    $actions['Can edit any topic title'] = 0;
    $actions['Can edit own posts for time period'] = 0;
    $actions['Can edit own posts forever'] = 0;
    $actions['Can edit own posts until there has been a reply'] = 0;
    $actions['Can edit any post'] = 0;
    $actions['Can delete topics in forum'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can bypass the math question'] = 0;
    $actions['Can bypass all post moderation'] = 0;
    $actions['Can bypass first post moderation'] = 0;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can pin topics in a forum'] = 0;
    $actions['Can move topics from a forum'] = 0;
    $actions['Can move posts from a topic'] = 0;
    $actions['Can lock topics in a forum'] = 0;
    $actions['Can pin posts within a topic'] = 0;
    $actions['Can reassign posts to a different user'] = 0;
    $actions['Can upload avatars'] = 0;
    $role_name = 'No Access';
    $role_desc = 'Permission with no access to any Forum features';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view a list of forums only'] = 0;
    $actions['Can view a list of forums and list of topics only'] = 0;
    $actions['Can view posts by an administrator'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can view email and IP addresses of members'] = 0;
    $actions['Can view profiles of members'] = 0;
    $actions['Can view the members lists'] = 0;
    $actions['Can view links within posts'] = 1;
    $actions['Can start new topics in a forum'] = 0;
    $actions['Can reply to existing topics in a forum'] = 0;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 0;
    $actions['Can use spoilers in posts'] = 1;
    $actions['Can attach a signature to posts'] = 0;
    $actions['Can create links in posts'] = 0;
    $actions['Can use smileys in posts'] = 0;
    $actions['Can use iframes in posts'] = 0;
    $actions['Can edit own topic titles'] = 0;
    $actions['Can edit any topic title'] = 0;
    $actions['Can edit own posts for time period'] = 0;
    $actions['Can edit own posts forever'] = 0;
    $actions['Can edit own posts until there has been a reply'] = 0;
    $actions['Can edit any post'] = 0;
    $actions['Can delete topics in forum'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can bypass the math question'] = 0;
    $actions['Can bypass all post moderation'] = 0;
    $actions['Can bypass first post moderation'] = 0;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can pin topics in a forum'] = 0;
    $actions['Can move topics from a forum'] = 0;
    $actions['Can move posts from a topic'] = 0;
    $actions['Can lock topics in a forum'] = 0;
    $actions['Can pin posts within a topic'] = 0;
    $actions['Can reassign posts to a different user'] = 0;
    $actions['Can upload avatars'] = 0;
    $role_name = 'Read Only Access';
    $role_desc = 'Permission with access to only view the Forum';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view a list of forums only'] = 0;
    $actions['Can view a list of forums and list of topics only'] = 0;
    $actions['Can view posts by an administrator'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can view email and IP addresses of members'] = 0;
    $actions['Can view profiles of members'] = 1;
    $actions['Can view the members lists'] = 1;
    $actions['Can view links within posts'] = 1;
    $actions['Can start new topics in a forum'] = 1;
    $actions['Can reply to existing topics in a forum'] = 1;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 0;
    $actions['Can use spoilers in posts'] = 1;
    $actions['Can attach a signature to posts'] = 0;
    $actions['Can create links in posts'] = 1;
    $actions['Can use smileys in posts'] = 1;
    $actions['Can use iframes in posts'] = 0;
    $actions['Can edit own topic titles'] = 0;
    $actions['Can edit any topic title'] = 0;
    $actions['Can edit own posts for time period'] = 0;
    $actions['Can edit own posts forever'] = 0;
    $actions['Can edit own posts until there has been a reply'] = 0;
    $actions['Can edit any post'] = 0;
    $actions['Can delete topics in forum'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can bypass the math question'] = 0;
    $actions['Can bypass all post moderation'] = 0;
    $actions['Can bypass first post moderation'] = 0;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can pin topics in a forum'] = 0;
    $actions['Can move topics from a forum'] = 0;
    $actions['Can move posts from a topic'] = 0;
    $actions['Can lock topics in a forum'] = 0;
    $actions['Can pin posts within a topic'] = 0;
    $actions['Can reassign posts to a different user'] = 0;
    $actions['Can upload avatars'] = 1;
    $role_name = 'Limited Access';
    $role_desc = 'Permission with access to reply and start topics but with limited features';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view a list of forums only'] = 0;
    $actions['Can view a list of forums and list of topics only'] = 0;
    $actions['Can view posts by an administrator'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can view email and IP addresses of members'] = 0;
    $actions['Can view profiles of members'] = 1;
    $actions['Can view the members lists'] = 1;
    $actions['Can view links within posts'] = 1;
    $actions['Can start new topics in a forum'] = 1;
    $actions['Can reply to existing topics in a forum'] = 1;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 0;
    $actions['Can use spoilers in posts'] = 1;
    $actions['Can attach a signature to posts'] = 1;
    $actions['Can create links in posts'] = 1;
    $actions['Can use smileys in posts'] = 1;
    $actions['Can use iframes in posts'] = 0;
    $actions['Can edit own topic titles'] = 0;
    $actions['Can edit any topic title'] = 0;
    $actions['Can edit own posts for time period'] = 0;
    $actions['Can edit own posts forever'] = 0;
    $actions['Can edit own posts until there has been a reply'] = 1;
    $actions['Can edit any post'] = 0;
    $actions['Can delete topics in forum'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can bypass the math question'] = 0;
    $actions['Can bypass all post moderation'] = 1;
    $actions['Can bypass first post moderation'] = 1;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can pin topics in a forum'] = 0;
    $actions['Can move topics from a forum'] = 0;
    $actions['Can move posts from a topic'] = 0;
    $actions['Can lock topics in a forum'] = 0;
    $actions['Can pin posts within a topic'] = 0;
    $actions['Can reassign posts to a different user'] = 0;
    $actions['Can upload avatars'] = 1;
    $role_name = 'Standard Access';
    $role_desc = 'Permission with access to reply and start topics with advanced features such as signatures';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view a list of forums only'] = 0;
    $actions['Can view a list of forums and list of topics only'] = 0;
    $actions['Can view posts by an administrator'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can view email and IP addresses of members'] = 0;
    $actions['Can view profiles of members'] = 1;
    $actions['Can view the members lists'] = 1;
    $actions['Can view links within posts'] = 1;
    $actions['Can start new topics in a forum'] = 1;
    $actions['Can reply to existing topics in a forum'] = 1;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 1;
    $actions['Can use spoilers in posts'] = 1;
    $actions['Can attach a signature to posts'] = 1;
    $actions['Can create links in posts'] = 1;
    $actions['Can use smileys in posts'] = 1;
    $actions['Can use iframes in posts'] = 0;
    $actions['Can edit own topic titles'] = 1;
    $actions['Can edit any topic title'] = 0;
    $actions['Can edit own posts for time period'] = 0;
    $actions['Can edit own posts forever'] = 1;
    $actions['Can edit own posts until there has been a reply'] = 1;
    $actions['Can edit any post'] = 0;
    $actions['Can delete topics in forum'] = 0;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 0;
    $actions['Can bypass the math question'] = 1;
    $actions['Can bypass all post moderation'] = 1;
    $actions['Can bypass first post moderation'] = 1;
    $actions['Can moderate pending posts'] = 0;
    $actions['Can pin topics in a forum'] = 0;
    $actions['Can move topics from a forum'] = 0;
    $actions['Can move posts from a topic'] = 0;
    $actions['Can lock topics in a forum'] = 0;
    $actions['Can pin posts within a topic'] = 0;
    $actions['Can reassign posts to a different user'] = 0;
    $actions['Can upload avatars'] = 1;
    $role_name = 'Full Access';
    $role_desc = 'Permission with Standard Access features and math question bypass';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
    //==>
    $actions = array();
    $actions['Can view forum'] = 1;
    $actions['Can view a list of forums only'] = 0;
    $actions['Can view a list of forums and list of topics only'] = 0;
    $actions['Can view posts by an administrator'] = 1;
    $actions['Can view only own posts and admin/mod posts'] = 0;
    $actions['Can view email and IP addresses of members'] = 1;
    $actions['Can view profiles of members'] = 1;
    $actions['Can view the members lists'] = 1;
    $actions['Can view links within posts'] = 1;
    $actions['Can start new topics in a forum'] = 1;
    $actions['Can reply to existing topics in a forum'] = 1;
    $actions['Can only reply to own topics'] = 0;
    $actions['Can bypass wait time between posts'] = 1;
    $actions['Can use spoilers in posts'] = 1;
    $actions['Can attach a signature to posts'] = 1;
    $actions['Can create links in posts'] = 1;
    $actions['Can use smileys in posts'] = 1;
    $actions['Can use iframes in posts'] = 0;
    $actions['Can edit own topic titles'] = 1;
    $actions['Can edit any topic title'] = 1;
    $actions['Can edit own posts for time period'] = 0;
    $actions['Can edit own posts forever'] = 1;
    $actions['Can edit own posts until there has been a reply'] = 1;
    $actions['Can edit any post'] = 1;
    $actions['Can delete topics in forum'] = 1;
    $actions['Can delete own posts'] = 0;
    $actions['Can delete any post'] = 1;
    $actions['Can bypass the math question'] = 1;
    $actions['Can bypass all post moderation'] = 1;
    $actions['Can bypass first post moderation'] = 1;
    $actions['Can moderate pending posts'] = 1;
    $actions['Can pin topics in a forum'] = 1;
    $actions['Can move topics from a forum'] = 1;
    $actions['Can move posts from a topic'] = 1;
    $actions['Can lock topics in a forum'] = 1;
    $actions['Can pin posts within a topic'] = 1;
    $actions['Can reassign posts to a different user'] = 1;
    $actions['Can upload avatars'] = 1;
    $role_name = 'Moderator Access';
    $role_desc = 'Permission with access to all Forum features';
    $new_actions = spa_convert_action_to_auth($actions);
    spa_create_role_row($role_name, $role_desc, serialize($new_actions));
}