<commit_before><?php
class Vpc_Forum_Group_Component extends Vpc_Directories_ItemPage_Directory_Component
{
    private $_mayModerate;
    
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['generators']['detail']['component'] = 'Vpc_Forum_Thread_Component';
        $ret['generators']['detail']['maxFilenameLength'] = 50;
        $ret['generators']['detail']['maxNameLength'] = 30;
        $ret['generators']['detail']['table'] = 'Vpc_Forum_Group_Model';
        $ret['generators']['child']['component']['view'] = 'Vpc_Forum_Group_View_Component';
        $ret['generators']['newThread'] = array(
            'class' => 'Vps_Component_Generator_Page_Static',
            'component' => 'Vpc_Forum_Group_NewThread_Component',
            'name' => trlVps('new thread')
        );
        $ret['tablename'] = 'Vpc_Forum_Group_Model';
        return $ret;
    }

    public function mayModerate()
    {
        if (is_null($this->_mayModerate)) {
            $this->_mayModerate = false;
            $authedUser = Zend_Registry::get('userModel')->getAuthedUser();
            if ($authedUser) {
                if ($authedUser->role == 'admin') {
                    $this->_mayModerate = true;
                } else {
                    $table = new Vpc_Forum_Group_ModeratorsModel();
                    $row = $table->fetchRow(array(
                        'user_id = ?' => $authedUser->id,
                        'group_id = ?' => $this->getData()->row->id
                    ));
                    if ($row) $this->_mayModerate = true;
                }
            } else {
                bt();
            }
        }
        return $this->_mayModerate;
    }
    
    public function getTemplateVars()
    {
        $ret = parent::getTemplateVars();
        $ret['newThread'] = $this->getData()->getChildComponent('_newThread');
        $ret['group'] = $this->getData();
        $ret['forum'] = $this->getData()->getParentPage();
        return $ret;
    }
    
    public function getSelect()
    {
        $ret = parent::getSelect();
        $ret->order(new Zend_Db_Expr('(SELECT MAX(create_time) 
                FROM vpc_posts 
                WHERE vpc_posts.component_id=cache_child_component_id) DESC'));
        return $ret;        
    }
}<commit_msg>Debug-Meldung rausgenommen<commit_after><?php
class Vpc_Forum_Group_Component extends Vpc_Directories_ItemPage_Directory_Component
{
    private $_mayModerate;
    
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['generators']['detail']['component'] = 'Vpc_Forum_Thread_Component';
        $ret['generators']['detail']['maxFilenameLength'] = 50;
        $ret['generators']['detail']['maxNameLength'] = 30;
        $ret['generators']['detail']['table'] = 'Vpc_Forum_Group_Model';
        $ret['generators']['child']['component']['view'] = 'Vpc_Forum_Group_View_Component';
        $ret['generators']['newThread'] = array(
            'class' => 'Vps_Component_Generator_Page_Static',
            'component' => 'Vpc_Forum_Group_NewThread_Component',
            'name' => trlVps('new thread')
        );
        $ret['tablename'] = 'Vpc_Forum_Group_Model';
        return $ret;
    }

    public function mayModerate()
    {
        if (is_null($this->_mayModerate)) {
            $this->_mayModerate = false;
            $authedUser = Zend_Registry::get('userModel')->getAuthedUser();
            if ($authedUser) {
                if ($authedUser->role == 'admin') {
                    $this->_mayModerate = true;
                } else {
                    $table = new Vpc_Forum_Group_ModeratorsModel();
                    $row = $table->fetchRow(array(
                        'user_id = ?' => $authedUser->id,
                        'group_id = ?' => $this->getData()->row->id
                    ));
                    if ($row) $this->_mayModerate = true;
                }
            }
        }
        return $this->_mayModerate;
    }
    
    public function getTemplateVars()
    {
        $ret = parent::getTemplateVars();
        $ret['newThread'] = $this->getData()->getChildComponent('_newThread');
        $ret['group'] = $this->getData();
        $ret['forum'] = $this->getData()->getParentPage();
        return $ret;
    }
    
    public function getSelect()
    {
        $ret = parent::getSelect();
        $ret->order(new Zend_Db_Expr('(SELECT MAX(create_time) 
                FROM vpc_posts 
                WHERE vpc_posts.component_id=cache_child_component_id) DESC'));
        return $ret;        
    }
}
{'fraction_non_alphanumeric': 0.15091066782307025, 'fraction_numerical': 0.0017346053772766695, 'mean_word_length': 2.123222748815166, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1527881', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1331, 'n_words': 195}