}
        if ($pluginvars) {
            set_pluginsetting($pluginvars);
        }
        updatecache(array('usergroups', 'onlinelist', 'groupreadaccess'));
        cpmsg('usergroups_edit_succeed', 'action=usergroups&operation=edit&' . ($multiset ? 'multi=' . implode(',', $_G['gp_multi']) : 'id=' . $_G['gp_id']) . '&anchor=' . $_G['gp_anchor'], 'succeed');
    }
} elseif ($operation == 'copy') {
    loadcache('usergroups');
    $source = intval($_G['gp_source']);
    $sourceusergroup = $_G['cache']['usergroups'][$source];
    if (empty($sourceusergroup)) {
        cpmsg('usergroups_copy_source_invalid', '', 'error');
    }
    $delfields = array('usergroups' => array('groupid', 'radminid', 'type', 'system', 'grouptitle', 'creditshigher', 'creditslower', 'stars', 'color', 'icon', 'groupavatar'));
    $fields = array('usergroups' => fetch_table_struct('common_usergroup'), 'usergroupfields' => fetch_table_struct('common_usergroup_field'));
    if (!submitcheck('copysubmit')) {
        $groupselect = array();
        $query = DB::query("SELECT type, groupid, grouptitle, radminid FROM " . DB::table('common_usergroup') . " WHERE groupid NOT IN ('6', '7') ORDER BY (creditshigher<>'0' || creditslower<>'0'), creditslower, groupid");
        while ($group = DB::fetch($query)) {
            $group['type'] = $group['type'] == 'special' && $group['radminid'] ? 'specialadmin' : $group['type'];
            $groupselect[$group['type']] .= "<option value=\"{$group['groupid']}\">{$group['grouptitle']}</option>\n";
        }
        $groupselect = '<optgroup label="' . $lang['usergroups_member'] . '">' . $groupselect['member'] . '</optgroup>' . ($groupselect['special'] ? '<optgroup label="' . $lang['usergroups_special'] . '">' . $groupselect['special'] . '</optgroup>' : '') . ($groupselect['specialadmin'] ? '<optgroup label="' . $lang['usergroups_specialadmin'] . '">' . $groupselect['specialadmin'] . '</optgroup>' : '') . '<optgroup label="' . $lang['usergroups_system'] . '">' . $groupselect['system'] . '</optgroup>';
        $usergroupselect = '<select name="target[]" size="10" multiple="multiple">' . $groupselect . '</select>';
        $optselect = '<select name="options[]" size="10" multiple="multiple">';
        $fieldarray = array_merge($fields['usergroups'], $fields['usergroupfields']);
        $listfields = array_diff($fieldarray, $delfields['usergroups']);
        foreach ($listfields as $field) {
            $optselect .= '<option value="' . $field . '">' . ($lang['project_option_group_' . $field] ? $lang['project_option_group_' . $field] : $field) . '</option>';
        }
Exemplo n.º 2
0
            cpmsg('forums_delete_confirm', "mod=forum&action=forums&operation=delete&fid={$fid}", 'form');
        } else {
            $threads = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_thread') . " WHERE fid='{$fid}'");
            cpmsg('forums_delete_alarm', "mod=forum&action=forums&operation=delete&fid={$fid}&confirmed=1", 'loadingform', '', '<div id="percent">0%</div>', FALSE);
            echo "\n\t\t\t<div id=\"statusid\" style=\"display:none\"></div>\n\t\t\t<script type=\"text/JavaScript\">\n\t\t\t\tvar xml_http_building_link = '" . cplang('xml_http_building_link') . "';\n\t\t\t\tvar xml_http_sending = '" . cplang('xml_http_sending') . "';\n\t\t\t\tvar xml_http_loading = '" . cplang('xml_http_loading') . "';\n\t\t\t\tvar xml_http_load_failed = '" . cplang('xml_http_load_failed') . "';\n\t\t\t\tvar xml_http_data_in_processed = '" . cplang('xml_http_data_in_processed') . "';\n\t\t\t\tvar adminfilename = '" . ADMINSCRIPT . "';\n\t\t\t\tfunction forumsdelete(url, total, pp, currow) {\n\n\t\t\t\t\tvar x = new Ajax('HTML', 'statusid');\n\t\t\t\t\tx.get(url+'&ajax=1&pp='+pp+'&total='+total+'&currow='+currow, function(s) {\n\t\t\t\t\t\tif(s != 'GO') {\n\t\t\t\t\t\t\tlocation.href = adminfilename + '?action=forums&operation=delete&finished=1';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrow += pp;\n\t\t\t\t\t\tvar percent = ((currow / total) * 100).toFixed(0);\n\t\t\t\t\t\tpercent = percent > 100 ? 100 : percent;\n\t\t\t\t\t\tdocument.getElementById('percent').innerHTML = percent+'%';\n\t\t\t\t\t\tdocument.getElementById('percent').style.backgroundPosition = '-'+percent+'%';\n\n\t\t\t\t\t\tif(currow < total) {\n\t\t\t\t\t\t\tforumsdelete(url, total, pp, currow);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tforumsdelete(adminfilename + '?action=forums&operation=delete&fid={$fid}&confirmed=1', {$threads}, 2000, 0);\n\t\t\t</script>\n\t\t\t";
        }
    }
} elseif ($operation == 'copy') {
    loadcache('forums');
    $source = intval($_G['gp_source']);
    $sourceforum = $_G['cache']['forums'][$source];
    if (empty($sourceforum) || $sourceforum['type'] == 'group') {
        cpmsg('forums_copy_source_invalid', '', 'error');
    }
    $delfields = array('forums' => array('fid', 'fup', 'type', 'name', 'status', 'displayorder', 'threads', 'posts', 'todayposts', 'lastpost', 'modworks', 'icon', 'level', 'commoncredits', 'archive', 'recommend'), 'forumfields' => array('description', 'password', 'redirect', 'moderators', 'rules', 'threadtypes', 'threadsorts', 'threadplugin', 'jointype', 'gviewperm', 'membernum', 'dateline', 'lastupdate', 'founderuid', 'foundername', 'banner', 'groupnum', 'activity'));
    $fields = array('forums' => fetch_table_struct('forum_forum'), 'forumfields' => fetch_table_struct('forum_forumfield'));
    if (!submitcheck('copysubmit')) {
        require_once libfile('function/forumlist');
        $forumselect = '<select name="target[]" size="10" multiple="multiple">' . forumselect(FALSE, 0, 0, TRUE) . '</select>';
        $optselect = '<select name="options[]" size="10" multiple="multiple">';
        $fieldarray = array_merge($fields['forums'], $fields['forumfields']);
        $listfields = array_diff($fieldarray, array_merge($delfields['forums'], $delfields['forumfields']));
        foreach ($listfields as $field) {
            $optselect .= '<option value="' . $field . '">' . ($lang['project_option_forum_' . $field] ? $lang['project_option_forum_' . $field] : $field) . '</option>';
        }
        $optselect .= '</select>';
        shownav('forum', 'forums_copy');
        showsubmenu('forums_copy');
        showtips('forums_copy_tips');
        showformheader('forums&operation=copy');
        showhiddenfields(array('source' => $source));
Exemplo n.º 3
0
} elseif ($operation == 'add') {
    $delfields = array('forum' => array('fid', 'fup', 'type', 'name', 'status', 'displayorder', 'threads', 'posts', 'todayposts', 'lastpost', 'description', 'password', 'icon', 'redirect', 'moderators', 'rules', 'threadtypes'), 'group' => array('groupid', 'radminid', 'type', 'system', 'grouptitle', 'creditshigher', 'creditslower', 'stars', 'color', 'groupavatar'));
    if (!submitcheck('addsubmit')) {
        shownav('tools', 'project_scheme_add');
        showsubmenu('project_scheme_add');
        if (!empty($projectid)) {
            $query = $db->query("SELECT name, description, value FROM {$tablepre}projects WHERE id='{$projectid}'");
            $project = $db->fetch_array($query);
        }
        if ($type == 'forum' && empty($allowforumsedit) || $type == 'group' && empty($allowusergroups) || $type == 'extcredit' && empty($allowcreditwizard)) {
            cpmsg('action_noaccess', '', 'error');
        }
        $allselected = 'selected';
        if ($type == 'forum' || $type == 'group') {
            $listoption = '';
            $fieldarray = $type == 'forum' ? array_merge(fetch_table_struct('forums'), fetch_table_struct('forumfields')) : fetch_table_struct('usergroups');
            $listfields = array_diff($fieldarray, $delfields[$type]);
            foreach ($listfields as $field) {
                $listoption .= '<option value="' . $field . '">' . $lang['project_option_' . $type . '_' . $field] . '</option>';
            }
        } elseif ($type == 'extcredit') {
            $value = unserialize($project['value']);
            $savemethod = $value['savemethod'];
            $allselected = '';
            $listoption = '<option value="1"' . (@in_array(1, $savemethod) ? ' selected' : '') . '>' . $lang['project_credits_item_config'] . '</option>';
            $listoption .= '<option value="2"' . (@in_array(2, $savemethod) ? ' selected' : '') . '>' . $lang['project_credits_rule_config'] . '</option>';
            $listoption .= '<option value="3"' . (@in_array(3, $savemethod) ? ' selected' : '') . '>' . $lang['project_credits_use_config'] . '</option>';
        }
        showformheader("project&operation=add&id={$id}");
        showhiddenfields(array('projectid' => $projectid, 'type' => $type, 'detailsubmit' => 'submit'));
        showtableheader();