// auth => is_local, is_global
$f_permissions = array('f_' => array(1, 0), 'f_list' => array(1, 0), 'f_read' => array(1, 0), 'f_post' => array(1, 0), 'f_reply' => array(1, 0), 'f_edit' => array(1, 0), 'f_user_lock' => array(1, 0), 'f_delete' => array(1, 0), 'f_bump' => array(1, 0), 'f_poll' => array(1, 0), 'f_vote' => array(1, 0), 'f_votechg' => array(1, 0), 'f_announce' => array(1, 0), 'f_sticky' => array(1, 0), 'f_attach' => array(1, 0), 'f_download' => array(1, 0), 'f_icons' => array(1, 0), 'f_bbcode' => array(1, 0), 'f_smilies' => array(1, 0), 'f_img' => array(1, 0), 'f_flash' => array(1, 0), 'f_sigs' => array(1, 0), 'f_search' => array(1, 0), 'f_email' => array(1, 0), 'f_print' => array(1, 0), 'f_ignoreflood' => array(1, 0), 'f_postcount' => array(1, 0), 'f_noapprove' => array(1, 0), 'f_report' => array(1, 0), 'f_subscribe' => array(1, 0));
$m_permissions = array('m_' => array(1, 1), 'm_edit' => array(1, 1), 'm_delete' => array(1, 1), 'm_move' => array(1, 1), 'm_lock' => array(1, 1), 'm_split' => array(1, 1), 'm_merge' => array(1, 1), 'm_approve' => array(1, 1), 'm_unrate' => array(1, 1), 'm_auth' => array(1, 1), 'm_ip' => array(1, 1), 'm_info' => array(1, 1));
$a_permissions = array('a_' => array(0, 1), 'a_server' => array(0, 1), 'a_board' => array(0, 1), 'a_clearlogs' => array(0, 1), 'a_words' => array(0, 1), 'a_icons' => array(0, 1), 'a_bbcode' => array(0, 1), 'a_attach' => array(0, 1), 'a_email' => array(0, 1), 'a_styles' => array(0, 1), 'a_user' => array(0, 1), 'a_useradd' => array(0, 1), 'a_userdel' => array(0, 1), 'a_ranks' => array(0, 1), 'a_ban' => array(0, 1), 'a_names' => array(0, 1), 'a_group' => array(0, 1), 'a_groupadd' => array(0, 1), 'a_groupdel' => array(0, 1), 'a_forum' => array(0, 1), 'a_forumadd' => array(0, 1), 'a_forumdel' => array(0, 1), 'a_prune' => array(0, 1), 'a_auth' => array(0, 1), 'a_authmods' => array(0, 1), 'a_authadmins' => array(0, 1), 'a_authusers' => array(0, 1), 'a_authgroups' => array(0, 1), 'a_authdeps' => array(0, 1), 'a_backup' => array(0, 1), 'a_restore' => array(0, 1), 'a_search' => array(0, 1), 'a_events' => array(0, 1), 'a_cron' => array(0, 1));
$u_permissions = array('u_' => array(0, 1), 'u_sendemail' => array(0, 1), 'u_readpm' => array(0, 1), 'u_sendpm' => array(0, 1), 'u_sendim' => array(0, 1), 'u_hideonline' => array(0, 1), 'u_viewonline' => array(0, 1), 'u_viewprofile' => array(0, 1), 'u_chgavatar' => array(0, 1), 'u_chggrp' => array(0, 1), 'u_chgemail' => array(0, 1), 'u_chgname' => array(0, 1), 'u_chgpasswd' => array(0, 1), 'u_chgcensors' => array(0, 1), 'u_search' => array(0, 1), 'u_savedrafts' => array(0, 1), 'u_download' => array(0, 1), 'u_attach' => array(0, 1), 'u_sig' => array(0, 1), 'u_pm_attach' => array(0, 1), 'u_pm_bbcode' => array(0, 1), 'u_pm_smilies' => array(0, 1), 'u_pm_download' => array(0, 1), 'u_pm_edit' => array(0, 1), 'u_pm_printpm' => array(0, 1), 'u_pm_emailpm' => array(0, 1), 'u_pm_forward' => array(0, 1), 'u_pm_delete' => array(0, 1), 'u_pm_img' => array(0, 1), 'u_pm_flash' => array(0, 1));
echo "<p><b>Determining existing permissions</b></p>\n";
$sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE;
$result = $db->sql_query($sql);
$remove_auth_options = array();
while ($row = $db->sql_fetchrow($result)) {
    if (!in_array($row['auth_option'], array_keys(${substr($row['auth_option'], 0, 2) . 'permissions'}))) {
        $remove_auth_options[$row['auth_option']] = $row['auth_option_id'];
    }
    unset(${substr($row['auth_option'], 0, 2) . 'permissions'}[$row['auth_option']]);
}
$db->sql_freeresult($result);
if (sizeof($remove_auth_options)) {
    $db->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
    $db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
    $db->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')');
    echo '<p><b>Removed the following auth options... [<i>' . implode(', ', array_keys($remove_auth_options)) . "</i>]</b></p>\n\n";
}
$prefixes = array('f_', 'a_', 'm_', 'u_');
foreach ($prefixes as $prefix) {
    $var = $prefix . 'permissions';
    if (sizeof(${$var})) {
        foreach (${$var} as $auth_option => $l_ary) {
            $sql_ary = array('auth_option' => $auth_option, 'is_local' => $l_ary[0], 'is_global' => $l_ary[1]);
            $db->sql_query('INSERT INTO ' . ACL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
            echo "<p><b>Adding {$auth_option}...</b></p>\n";
            mass_auth('group', 0, 'guests', $auth_option, ACL_NEVER);
Пример #2
0
         $sql = "DELETE FROM `" . $db_config['prefix'] . "_" . $lang_data . "_modules` WHERE `title` NOT IN ('" . implode("', '", $modules_exit) . "')";
         $db->sql_query($sql);
         //xoa du lieu tai bang  nv3_setup_modules
         $sql = "DELETE FROM `" . $db_config['prefix'] . "_setup_modules` WHERE `title` NOT IN ('" . implode("', '", $modules_exit) . "')";
         $db->sql_query($sql);
         ///xoa du lieu tai bang nv3_config
         $sql = "DELETE FROM `" . $db_config['prefix'] . "_config` WHERE `lang`=" . $db->dbescape($lang_data) . " AND `module` NOT IN ('" . implode("', '", $modules_exit) . "')";
         $db->sql_query($sql);
         $sql = "SELECT * FROM `" . $db_config['prefix'] . "_" . NV_LANG_DATA . "_modules` WHERE `title`='news'";
         $result = $db->sql_query($sql);
         if ($db->sql_numrows($result)) {
             $result = $db->sql_query("SELECT catid FROM `" . $db_config['prefix'] . "_" . $lang_data . "_news_cat` ORDER BY `order` ASC");
             while (list($catid_i) = $db->sql_fetchrow($result)) {
                 nv_create_table_news($catid_i);
             }
             $db->sql_freeresult();
             $result = $db->sql_query("SELECT id, listcatid FROM `" . $db_config['prefix'] . "_" . $lang_data . "_news_rows` ORDER BY `id` ASC");
             while (list($id, $listcatid) = $db->sql_fetchrow($result)) {
                 $arr_catid = explode(",", $listcatid);
                 foreach ($arr_catid as $catid) {
                     $db->sql_query("INSERT INTO `" . $db_config['prefix'] . "_" . $lang_data . "_news_" . $catid . "` SELECT * FROM `" . $db_config['prefix'] . "_" . $lang_data . "_news_rows` WHERE `id`=" . $id . "");
                 }
             }
             $db->sql_freeresult();
         }
         ++$step;
         $nv_Request->set_Session('maxstep', $step);
         Header("Location: " . NV_BASE_SITEURL . "install/index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&step=" . $step);
         exit;
     }
 }