⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_forum_manager.php

📁 在综合英文版XOOPS 2.09, 2.091, 2.092 的基础上正式发布XOOPS 2.09中文版 XOOPS 2.09x 版主要是PHP5升级、bug修正和安全补正: 1 全面兼容PHP 5.
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php
// $Id: admin_forum_manager.php,v 1.1.1.37 2004/11/26 04:59:14 phppp Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System                      //
// Copyright (c) 2000 XOOPS.org                           //
// <http://www.xoops.org/>                             //
// ------------------------------------------------------------------------ //
// This program 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.                                      //
// //
// You may not change or alter any portion of this comment or credits       //
// of supporting developers from this source code or any supporting         //
// source code which is considered copyrighted (c) material of the          //
// original comment or credit authors.                                      //
// //
// This program 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu)                                          //
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //
include 'admin_header.php';
include XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/pagenav.php";
include_once XOOPS_ROOT_PATH . "/modules/newbb/class/formselectuser.php";

$op = '';
$confirm = '';

if (isset($_GET['op'])) $op = $_GET['op'];
if (isset($_POST['op'])) $op = $_POST['op'];
if (isset($_POST['default'])) $op = 'default';
if (isset($_GET['forum'])) $forum = $_GET['forum'];
if (isset($_POST['forum'])) $forum = $_POST['forum'];

$start = (isset($_GET['start']))?$_GET['start']:0;

$forum_handler = &xoops_getmodulehandler('forum', 'newbb');
/**
 * newForum()
 *
 * @param integer $catid
 * @return
 */
function newForum($parent_forum = null)
{
    editForum(null, $parent_forum);
}

/**
 * editForum()
 *
 * @param integer $catid
 * @return
 */
function editForum($ff = null, $parent_forum = 0)
{
    global $start, $myts;

    $forum_handler = &xoops_getmodulehandler('forum', 'newbb');
    if ($ff == null) {
        $ff = &$forum_handler->create();
        $new = true;
        $forum = 0;
    } else {
        $forum = $ff->getVar('forum_id');
        $new = false;
    }
    if ($parent_forum > 0) {
        $pf = &$forum_handler->get($parent_forum);
    }

    $groups_forum_access = null;
    $groups_forum_can_post = null;
    $groups_forum_can_view = null;
    $groups_forum_can_reply = null;
    $groups_forum_can_edit = null;
    $groups_forum_can_delete = null;
    $groups_forum_can_addpoll = null;
    $groups_forum_can_attach = null;
    $groups_forum_can_noapprove = null;

    Global $xoopsDB, $xoopsModule;

    $mytree = new XoopsTree($xoopsDB->prefix("bb_categories"), "cat_id", "0");

    if ($forum) {
        $moderators = $ff->getModerators(true);

        $limit = 200;
        $moderatorform = new XoopsThemeForm(_AM_NEWBB_MODERATOR . " " . $ff->getVar('forum_name'), "op", xoops_getenv('PHP_SELF'));

        $rem_moderator_checkbox = new XoopsFormCheckBox(_AM_NEWBB_MODERATOR_REMOVE, 'rem_moderator[]');
        if (count($moderators) > 0) {
            foreach($moderators as $moderator => $name) {
                $rem_moderator_checkbox->addOption($moderator, $name);
            }
            $moderatorform->addElement($rem_moderator_checkbox);
        }

        $user_select = new NewbbFormSelectUser('', 'forum_moderator', $start, $limit, array_keys($moderators));
        $user_select_tray = new XoopsFormElementTray(_AM_NEWBB_MODERATOR_ADD, "<br />");
        $user_select_tray->addElement($user_select);
        $member_handler = &xoops_gethandler('member');
        $usercount = $member_handler->getUserCount();
        $nav = new XoopsPageNav($usercount, $limit, $start, "start", "op=mod&amp;forum=$forum");
        $user_select_nav = new XoopsFormLabel('', $nav->renderNav(4));
        $user_select_tray->addElement($user_select_nav);
        $submit_button = new XoopsFormButton('', '', _AM_NEWBB_EDIT, 'submit');

        $moderatorform->addElement($user_select_tray);
        $moderatorform->addElement(new XoopsFormHidden('forum', $forum));
        $moderatorform->addElement(new XoopsFormHidden('op', 'moderators'));
        $moderatorform->addElement($submit_button);
        $moderatorform->display();
        echo "<br />\n";
        $sform = new XoopsThemeForm(_AM_NEWBB_EDITTHISFORUM . " " . $ff->getVar('forum_name'), "op", xoops_getenv('PHP_SELF'));
    } else {
        $sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWFORUM, "op", xoops_getenv('PHP_SELF'));

        $ff->setVar('forum_order', 0);
        $ff->setVar('forum_name', '');
        $ff->setVar('forum_desc', '');
        $ff->setVar('forum_moderator', 1);

        $ff->setVar('forum_type', 0);
        $ff->setVar('allow_html', 1);
        $ff->setVar('allow_sig', 1);
        $ff->setVar('allow_polls', 1);
        $ff->setVar('allow_subject_prefix', 0);
        $ff->setVar('hot_threshold', 10);
        $ff->setVar('allow_attachments', 1);
        $ff->setVar('attach_maxkb', 1000);
        $ff->setVar('attach_ext', 'zip|gif|jpg');
    }
    // READ PERMISSIONS
    $member_handler = &xoops_gethandler('member');
    $group_list = &$member_handler->getGroupList();
    //$group_ids = array();
    $gperm_handler = &xoops_gethandler('groupperm');
    $groups_forum_access =($forum)?$gperm_handler->getGroupIds('global_forum_access', $forum, $xoopsModule->getVar('mid')):array_keys($group_list);

    $groups_access_checkbox = new XoopsFormCheckBox(_AM_NEWBB_ACCESSLEVEL, 'groups_forum_access[]', $groups_forum_access);
    foreach ($group_list as $group_id => $group_name) {
        $groups_access_checkbox->addOption($group_id, $group_name);
    }
    $sform->addElement($groups_access_checkbox);

    $sform->addElement(new XoopsFormText(_AM_NEWBB_SET_FORUMORDER, 'forum_order', 5, 10, $ff->getVar('forum_order')), false);
    $sform->addElement(new XoopsFormText(_AM_NEWBB_FORUMNAME, 'forum_name', 50, 80, $ff->getVar('forum_name', 'E')), true);
    $sform->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_FORUMDESCRIPTION, 'forum_desc', $ff->getVar('forum_desc', 'E'), 10, 60), false);

    $sform->addElement(new XoopsFormHidden('parent_forum', $parent_forum));
    if ($parent_forum == 0) {
        ob_start();
        if ($new) {
        	$mytree->makeMySelBox("cat_title", "cat_id", $_GET['cat_id']);
        } else {
        	$mytree->makeMySelBox("cat_title", "cat_id", $ff->getVar('cat_id'));
        }
        $sform->addElement(new XoopsFormLabel(_AM_NEWBB_CATEGORY, ob_get_contents()));
        ob_end_clean();
    } else {
        $sform->addElement(new XoopsFormHidden('cat_id', $pf->getVar('cat_id')));
    }

    $status_select = new XoopsFormSelect(_AM_NEWBB_STATE, "forum_type", $ff->getVar('forum_type'));
    $status_select->addOptionArray(array('0' => _AM_NEWBB_ACTIVE, '1' => _AM_NEWBB_INACTIVE));
    $sform->addElement($status_select);

    $allowhtml_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOWHTML, 'allow_html', $ff->getVar('allow_html'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowhtml_radio);

    $allowsig_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOWSIGNATURES, 'allow_sig', $ff->getVar('allow_sig'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowsig_radio);

    $allowpolls_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOWPOLLS, 'allow_polls', $ff->getVar('allow_polls'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowpolls_radio);

    $allowprefix_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOW_SUBJECT_PREFIX, 'allow_subject_prefix', $ff->getVar('allow_subject_prefix'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowprefix_radio);

    $sform->addElement(new XoopsFormText(_AM_NEWBB_HOTTOPICTHRESHOLD, 'hot_threshold', 5, 10, $ff->getVar('hot_threshold')), true);

    $allowattach_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOW_ATTACHMENTS, 'allow_attachments', $ff->getVar('allow_attachments'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowattach_radio);
    $sform->addElement(new XoopsFormText(_AM_NEWBB_ATTACHMENT_SIZE, 'attach_maxkb', 5, 10, $ff->getVar('attach_maxkb')), true);
    $sform->addElement(new XoopsFormText(_AM_NEWBB_ALLOWED_EXTENSIONS, 'attach_ext', 50, 512, $ff->getVar('attach_ext')), true);

    $sform->addElement(new XoopsFormLabel('', '<strong>' . _AM_NEWBB_PERMISSIONS_TO_THIS_FORUM . '</strong>'));
    $member_handler = &xoops_gethandler('member');
    $group_list = &$member_handler->getGroupList();

    $gperm_handler = &xoops_gethandler('groupperm');
    if ($forum > 0) {
        $groups_forum_can_view = $gperm_handler->getGroupIds('forum_can_view', $forum, $xoopsModule->getVar('mid'));
        $groups_forum_can_post = $gperm_handler->getGroupIds('forum_can_post', $forum, $xoopsModule->getVar('mid'));
        $groups_forum_can_reply = $gperm_handler->getGroupIds('forum_can_reply', $forum, $xoopsModule->getVar('mid'));
        $groups_forum_can_edit = $gperm_handler->getGroupIds('forum_can_edit', $forum, $xoopsModule->getVar('mid'));
        $groups_forum_can_delete = $gperm_handler->getGroupIds('forum_can_delete', $forum, $xoopsModule->getVar('mid'));
        $groups_forum_can_addpoll = $gperm_handler->getGroupIds('forum_can_addpoll', $forum, $xoopsModule->getVar('mid'));
        $groups_forum_can_vote = $gperm_handler->getGroupIds('forum_can_vote', $forum, $xoopsModule->getVar('mid'));
        $groups_forum_can_attach = $gperm_handler->getGroupIds('forum_can_attach', $forum, $xoopsModule->getVar('mid'));
        $groups_forum_can_noapprove = $gperm_handler->getGroupIds('forum_can_noapprove', $forum, $xoopsModule->getVar('mid'));
    } else {
	    $full_list = array_keys($group_list);
	    $member_list = array();
	    foreach($full_list as $id){
			if($id != 3) $member_list[]=$id; // Make sure the anonymous group id is equal to 3 !!
	    }
	    $admin_list = $gperm_handler->getGroupIds('module_admin', $xoopsModule->getVar('mid'));

        $groups_forum_can_view = &$full_list;
        $groups_forum_can_post = &$member_list;
        $groups_forum_can_reply = &$member_list;
        $groups_forum_can_edit = &$member_list;
        $groups_forum_can_delete = &$admin_list;
        $groups_forum_can_addpoll = &$member_list;
        $groups_forum_can_vote = &$member_list;
        $groups_forum_can_attach = &$member_list;
        $groups_forum_can_noapprove = &$member_list;
    }
    $groups_forum_can_view_checkbox = new XoopsFormCheckBox(_AM_NEWBB_CAN_VIEW, 'groups_forum_can_view[]', $groups_forum_can_view);
    foreach ($group_list as $group_id => $group_name) {
        $groups_forum_can_view_checkbox->addOption($group_id, $group_name);
    }
    $sform->addElement($groups_forum_can_view_checkbox);

    $groups_forum_can_post_checkbox = new XoopsFormCheckBox(_AM_NEWBB_CAN_POST, 'groups_forum_can_post[]', $groups_forum_can_post);
    foreach ($group_list as $group_id => $group_name) {
        $groups_forum_can_post_checkbox->addOption($group_id, $group_name);
    }
    $sform->addElement($groups_forum_can_post_checkbox);

    $groups_forum_can_reply_checkbox = new XoopsFormCheckBox(_AM_NEWBB_CAN_REPLY, 'groups_forum_can_reply[]', $groups_forum_can_reply);
    foreach ($group_list as $group_id => $group_name) {
        $groups_forum_can_reply_checkbox->addOption($group_id, $group_name);
    }
    $sform->addElement($groups_forum_can_reply_checkbox);

    $groups_forum_can_edit_checkbox = new XoopsFormCheckBox(_AM_NEWBB_CAN_EDIT, 'groups_forum_can_edit[]', $groups_forum_can_edit);
    foreach ($group_list as $group_id => $group_name) {
        $groups_forum_can_edit_checkbox->addOption($group_id, $group_name);
    }
    $sform->addElement($groups_forum_can_edit_checkbox);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -