1

我想创建一个与论坛相同但修改为 vforum 的模块。但我面临一个订阅问题。当我尝试安装 vforum 时,会出现订阅模块并显示“会员包”。我正在尝试为 vforum 创建设置,但出了点问题。url 仍在更改为订阅。

在这里我放了我的 index.class.php 代码

<?php
/**
* [PHPFOX_HEADER]
*/

defined('PHPFOX') or exit('NO DICE!');

/**
* 
* 
* @copyright        [PHPFOX_COPYRIGHT]
* @author       Raymond Benc
* @package          Module_Vforum
* @version      $Id: index.class.php 5219 2013-01-28 12:15:53Z Miguel_Espinoza $
*/
class Vforum_Component_Controller_Index extends Phpfox_Component
{
    /**
     * Class process method wnich is used to execute this component.
     */
    public function process()
    {
        if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle))
        {
            if (($sLegacyThread = $this->request()->get('req3')) && !empty($sLegacyThread) && !is_numeric($sLegacyTitle))
            {
                $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array(
                        'field' => array('thread_id', 'title'),
                        'table' => 'Vforum_thread',     
                        'redirect' => 'Vforum.thread',
                        'title' => $sLegacyThread
                    )
                );              
            }
            else
            {
                $aForumParts = explode('-', $sLegacyTitle);
                if (isset($aForumParts[1]))
                {
                    $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array(
                            'field' => array('Vforum_id', 'name'),
                            'table' => 'Vforum',        
                            'redirect' => 'Vforum',
                            'search' => 'Vforum_id',
                            'title' => $aForumParts[1]
                        )
                    );
                }
            }
        }           


        Phpfox::getUserParam('vforum.can_view_vform', true);

        $aParentModule = $this->getParam('aParentModule');  

        if (Phpfox::getParam('core.phpfox_is_hosted') && empty($aParentModule))
        {
            $this->url()->send('');
        }
        else if (empty($aParentModule) && $this->request()->get('view') == 'new')
        {
            $aDo = explode('/',$this->request()->get('do'));
            if ($aDo[0] == 'mobile' || (isset($aDo[1]) && $aDo[1] == 'mobile'))
            {
            Phpfox::getLib('module')->getComponent('Vforum.Vforum', array('bNoTemplate' => true), 'controller');

            return;
            }           
        }

        if ($this->request()->get('req2') == 'topics' || $this->request()->get('req2') == 'posts')
        {
            return Phpfox::getLib('module')->setController('error.404');
        }

        $this->template()->setBreadcrumb(Phpfox::getPhrase('vforum.vforum'), $this->url()->makeUrl('Vforum'))
            ->setPhrase(array(
                    'Vforum.provide_a_reply',
                    'Vforum.adding_your_reply',
                    'Vforum.are_you_sure',
                    'Vforum.post_successfully_deleted',
                    'Vforum.reply_multi_quoting'
                )
            )           
            ->setHeader('cache', array(                 
                    'Vforum.css' => 'style_css',
                    'Vforum.js' => 'module_Vforum'
                )
            );

        if ($aParentModule !== null)
        {
            Phpfox::getLib('module')->getComponent('Vforum.Vforum', array('bNoTemplate' => true), 'controller');

            return;
        }

        if ($this->request()->getInt('req2') > 0)
        {
            return Phpfox::getLib('module')->setController('Vforum.Vforum');
        }       

        $this->setParam('bIsVforum', true);

        Phpfox::getService('Vforum')->buildMenu();

        $this->template()->setTitle(Phpfox::getPhrase('vforum.vforum'))
            ->assign(array(
                'aVforums' => Phpfox::getService('Vforum')->live()->getVforums(),
                'bHasCategory' => Phpfox::getService('Vforum')->hasCategory(),              
                'aCallback' => null
            )
        );  
    }

    /**
     * Garbage collector. Is executed after this class has completed
     * its job and the template has also been displayed.
     */
    public function clean()
    {
        (($sPlugin = Phpfox_Plugin::get('Vforum.component_controller_index_clean')) ? eval($sPlugin) : false);
    }
}

?>

请帮我。谢谢你。

4

0 回答 0