Location: PHPKode > projects > XennoBB > xennobb/admin/permissions.php
<?php
/*

  Copyright (C) 2005-2011 UserDot
  Visit XennoBB at www.userdot.net/projects/xennobb
  Originally based on PunBB www.punbb.org

  XennoBB is free software; you can redistribute it 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.

  XennoBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  MA 02110-1301 USA

 */
define('IN_FORUM_ADMIN', 1);
require dirname(__FILE__) . '/../include/init.php';
if ($forum_user['g_id'] != USER_ADMIN)
    BB_Functions::Message($lang['No permission']);
if (isset($_POST['perm_sended']))
{
    $form = array_map('trim', $_POST['form']);
    $res = true;
    $cms_settings->Set_Namespace('permissions');
    $res &= $cms_settings->Save('bb_perm_modules', $form['perm_modules']);
    $res &= $cms_settings->Save('bb_perm_blocks', $form['perm_blocks']);
    $modules_list = $cms_modules->Installed_Elements();
    natsort($modules_list);
    foreach ($modules_list as $m)
    {
        $form_str = 'perm_module_' . $m;
        $config_str = 'bb_perm_module_' . $m;
        $res &= $cms_settings->Save($config_str, $form[$form_str]);
    }
    $blocks_list = $cms_blocks->Installed_Elements();
    natsort($blocks_list);
    foreach ($blocks_list as $b)
    {
        $form_str = 'perm_block_' . $b;
        $config_str = 'bb_perm_block_' . $b;
        $res &= $cms_settings->Save($config_str, $form[$form_str]);
    }
    $cms_settings->Set_Namespace('');
    if ($res)
        BB_Functions::Redirect(bb_website_url . '/admin/permissions.php', $lang['config_updated']);
    else
        BB_Functions::Message($lang['unable_update_config']);
}
$cms_custom_title_page = $lang['Admin'] . $lang['Permissions'];
if (is_file(FORUM_ROOT . 'include/templates/' . $forum_user['template'] . '/forum_admin.tpl'))
    $cms_main_template = FORUM_ROOT . 'include/templates/' . $forum_user['template'] . '/forum_admin.tpl';
else
    $cms_main_template = FORUM_ROOT . 'include/templates/Default/forum_admin.tpl';
require FORUM_ROOT . 'include/header.php';
?>
<div class="blockform">
    <h2><span><?php echo $lang['Permissions']; ?></span></h2>
    <div class="box">
        <form method="post" action="permissions.php">
            <input type="hidden" name="perm_sended" value="1" />
            <div class="inform">
                <div class="infldset file" style="padding:15px">
                    <table cellspacing="0" >
                        <tr>
                            <th style="width:150px" scope="row"><?php echo $lang['manage_modules']; ?></th>
                            <td><input type="radio" name="form[perm_modules]" value="1"<?php if (bb_perm_modules == 1)
    echo ' checked="checked"'; ?> />&#160;<?php echo $lang['Yes']; ?>&#160;&#160;&#160;<input type="radio" name="form[perm_modules]" value="0"<?php if (bb_perm_modules == 0)
    echo ' checked="checked"'; ?>/>&#160;<?php echo $lang['No']; ?></td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo $lang['manage_blocks']; ?></th>
                            <td><input type="radio" name="form[perm_blocks]" value="1"<?php if (bb_perm_blocks == 1)
    echo ' checked="checked"'; ?> />&#160;<?php echo $lang['Yes']; ?>&#160;&#160;&#160;<input type="radio" name="form[perm_blocks]" value="0"<?php if (bb_perm_blocks == 0)
    echo ' checked="checked"'; ?>/>&#160;<?php echo $lang['No']; ?></td>
                        </tr>

                        <tr>
                            <th style="width:150px" scope="row"><?php echo $lang['manage_themes']; ?></th>
                            <td><input type="radio" name="form[perm_themes]" value="1"<?php if (bb_perm_themes == 1)
    echo ' checked="checked"'; ?> />&#160;<?php echo $lang['Yes']; ?>&#160;&#160;&#160;<input type="radio" name="form[perm_themes]" value="0"<?php if (bb_perm_themes == 0)
    echo ' checked="checked"'; ?>/>&#160;<?php echo $lang['No']; ?></td>
                        </tr>
                        <tr>
                            <th scope="row"><?php echo $lang['manage_langs']; ?></th>
                            <td><input type="radio" name="form[perm_langs]" value="1"<?php if (bb_perm_langs == 1)
    echo ' checked="checked"'; ?> />&#160;<?php echo $lang['Yes']; ?>&#160;&#160;&#160;<input type="radio" name="form[perm_langs]" value="0"<?php if (bb_perm_langs == 0)
    echo ' checked="checked"'; ?>/>&#160;<?php echo $lang['No']; ?></td>
                        </tr>
                    </table>
                </div>
            </div>
            <p class="submitend"><input type="submit" class="b1" value=" <?php echo $lang['Save']; ?> " /></p>
        </form>
    </div>
</div>
<div class="blockform">
    <h2><span><?php echo $lang['Permissions']; ?></span></h2>
    <div class="box">
        <form method="post" action="permissions.php">
            <input type="hidden" name="perm_sended" value="1" />
            <div class="inform">
                <div class="infldset file" style="padding:15px">
                    <table cellspacing="0" >
                        <?php
                        $modules_list = $cms_modules->Installed_Elements();
                        natsort($modules_list);
                        foreach ($modules_list as $m)
                        {
                            $lang_var = 'lang_cms_main_module_' . $m;
                            $lang_array = $$lang_var;
                            $form_str = 'perm_module_' . $m;
                            $config_str = 'bb_perm_module_' . $m;
                            echo '<tr>' . "\n" . '<th style="width:150px" scope="row">' . $lang_array[$m] . '</th>' . "\n";
                            echo '<td><input type="radio" name="form[' . $form_str . ']" value="1"';
                            if (constant($config_str) == 1)
                                echo ' checked="checked"';
                            echo ' />&#160;' . $lang['Yes'] . '&#160;&#160;&#160;<input type="radio" name="form[' . $form_str . ']" value="0"';
                            if (constant($config_str) == 0)
                                echo ' checked="checked"';
                            echo ' />&#160;' . $lang['No'] . '</td>' . "\n" . '</tr>';
                        }
                        ?>
                    </table>
                </div>
            </div>
            <p class="submitend"><input type="submit" class="b1" value=" <?php echo $lang['Save']; ?> " /></p>
        </form>
    </div>
</div>
<div class="blockform">
    <h2><span><?php echo $lang['Permissions']; ?></span></h2>
    <div class="box">
        <form method="post" action="permissions.php">
            <input type="hidden" name="perm_sended" value="1" />
            <div class="inform">
                <div class="infldset file" style="padding:15px">
                    <table cellspacing="0" >
                        <?php
                        $blocks_list = $cms_blocks->Installed_Elements();
                        natsort($blocks_list);
                        foreach ($blocks_list as $b)
                        {
                            $lang_var = 'lang_cms_main_block_' . $b;
                            $lang_array = $$lang_var;
                            $form_str = 'perm_block_' . $b;
                            $config_str = 'bb_perm_block_' . $b;
                            echo '<tr>' . "\n" . '<th style="width:150px" scope="row">' . $lang_array[$b] . '</th>' . "\n";
                            echo '<td><input type="radio" name="form[' . $form_str . ']" value="1"';
                            if (constant($config_str) == 1)
                                echo ' checked="checked"';
                            echo ' />&#160;' . $lang['Yes'] . '&#160;&#160;&#160;<input type="radio" name="form[' . $form_str . ']" value="0"';
                            if (constant($config_str) == 0)
                                echo ' checked="checked"';
                            echo ' />&#160;' . $lang['No'] . '</td>' . "\n" . '</tr>';
                        }
                        ?>
                    </table>
                </div>
            </div>
            <p class="submitend"><input type="submit" class="b1" value=" <?php echo $lang['Save']; ?> " /></p>
        </form>
    </div>
</div>
<?php
require FORUM_ROOT . 'include/footer.php';
?>
Return current item: XennoBB