<commit_before><?php
class Kwf_Controller_Action_User_MenuController extends Kwf_Controller_Action
{
    public function jsonDataAction()
    {
        $showLogout = true;
        $acl = $this->_getAcl();
        $menus = $acl->getMenuConfig($this->_getAuthData());

        if (empty($menus) && $this->_getUserRole() == 'guest') {
            $menu = array();
            $menu['type'] = 'commandDialog';
            $menu['menuConfig']['text'] = 'Login';
            $menu['commandClass'] = 'Kwf.User.Login.Dialog';
            $menus[] = $menu;
            $showLogout = false;
        }

        foreach ($acl->getAllResources() as $resource) {
            if ($resource instanceof Kwf_Acl_Resource_UserSelf
                && $acl->isAllowedUser($this->_getAuthData(), $resource, 'view')
            ) {

                $this->view->userSelfControllerUrl = $resource->getControllerUrl();
                break;
            }
        }

        $authData = $this->_getAuthData();

        $this->view->menus = $menus;
        $this->view->showLogout = $showLogout;
        $this->view->userId = $authData ? $authData->id : 0;
        $this->view->fullname = $authData ? $authData->__toString() : '';

        $role = Zend_Registry::get('userModel')->getAuthedChangedUserRole();
        $this->view->changeUser = $acl->isAllowed($role, 'kwf_user_changeuser', 'view');

        $this->view->frontendUrls = array();
        if (Kwf_Registry::get('acl')->has('kwf_component_pages')) {
            foreach (Kwc_Abstract::getComponentClasses() as $c) {
                if (Kwc_Abstract::getFlag($c, 'hasDomain')) {
                    foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByClass($c, array('ignoreVisible'=>true)) as $domain)  {
                        if ($acl->getComponentAcl()->isAllowed($authData, $domain)) {
                            $this->view->frontendUrls[] = array(
                                'href' => 'http://'.$domain->getComponent()->getDomain().'/',
                                'text' => $domain->name,
                            );
                        }
                    }
                }
            }
            if (!$this->view->frontendUrls) {
                $this->view->frontendUrls[] = array(
                    'href' => '/',
                    'text' => trlKwf('Frontend'),
                );
            }
        }
    }
}<commit_msg>frontend link in backend links to the new preview site<commit_after><?php
class Kwf_Controller_Action_User_MenuController extends Kwf_Controller_Action
{
    public function jsonDataAction()
    {
        $showLogout = true;
        $acl = $this->_getAcl();
        $menus = $acl->getMenuConfig($this->_getAuthData());

        if (empty($menus) && $this->_getUserRole() == 'guest') {
            $menu = array();
            $menu['type'] = 'commandDialog';
            $menu['menuConfig']['text'] = 'Login';
            $menu['commandClass'] = 'Kwf.User.Login.Dialog';
            $menus[] = $menu;
            $showLogout = false;
        }

        foreach ($acl->getAllResources() as $resource) {
            if ($resource instanceof Kwf_Acl_Resource_UserSelf
                && $acl->isAllowedUser($this->_getAuthData(), $resource, 'view')
            ) {

                $this->view->userSelfControllerUrl = $resource->getControllerUrl();
                break;
            }
        }

        $authData = $this->_getAuthData();

        $this->view->menus = $menus;
        $this->view->showLogout = $showLogout;
        $this->view->userId = $authData ? $authData->id : 0;
        $this->view->fullname = $authData ? $authData->__toString() : '';

        $role = Zend_Registry::get('userModel')->getAuthedChangedUserRole();
        $this->view->changeUser = $acl->isAllowed($role, 'kwf_user_changeuser', 'view');

        $this->view->frontendUrls = array();
        if (Kwf_Registry::get('acl')->has('kwf_component_pages')) {
            foreach (Kwc_Abstract::getComponentClasses() as $c) {
                if (Kwc_Abstract::getFlag($c, 'hasDomain')) {
                    foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByClass($c, array('ignoreVisible'=>true)) as $domain)  {
                        if ($acl->getComponentAcl()->isAllowed($authData, $domain)) {
                            $this->view->frontendUrls[] = array(
                                'href' => '/admin/component/preview?url='.urlencode($domain->getComponent()->getDomain()),
                                'text' => $domain->name,
                            );
                        }
                    }
                }
            }
            if (!$this->view->frontendUrls) {
                $this->view->frontendUrls[] = array(
                    'href' => '/admin/component/preview',
                    'text' => trlKwf('Frontend'),
                );
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.16148057758796014, 'fraction_numerical': 0.0004067520846044336, 'mean_word_length': 1.799089356858281, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 93, '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': '360949', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1360, 'n_words': 200}