public function execute()
    {
        if (!$this->getUser()->isAdmin($this->getApp())) {
            throw new waRightsException(_w('Access denied'));
        }
        $plugin_settings = array();
        $plugins = wa()->getConfig()->getPlugins();
        if ($this->plugin_id || ($this->plugin_id = waRequest::request('slug', false))) {
            if (!isset($plugins[$this->plugin_id]) || !($this->plugin_instance = waSystem::getInstance()->getPlugin($this->plugin_id))) {
                throw new waException(_w('Plugin not found', 404));
            }
            $namespace = $this->getApp() . '_' . $this->plugin_id;
            if ($post = $this->getRequest()->post($namespace)) {
                $this->plugin_instance->setup($post)->saveSettings();
                if (get_class($this) == 'blogPluginsSettingsAction') {
                    $this->getResponse()->redirect('?module=plugins');
                }
            }
            $params = array();
            $params['namespace'] = $namespace;
            $params['title_wrapper'] = '<div class="name">%s</div>';
            $params['description_wrapper'] = '<br><span class="hint">%s</span><br>';
            $params['control_separator'] = '</div><br><div class="value no-shift">';
            $params['control_wrapper'] = <<<HTML
%s
<div class="value no-shift">
\t%s
\t%s
</div>
HTML;
            $this->view->assign('plugin_settings', $this->plugin_instance->getControls($params));
            $this->view->assign('plugin_info', $plugins[$this->plugin_id]);
            $this->view->assign('plugin_slug', $this->plugin_id);
            $title = sprintf(_w('Plugin %s settings'), $plugins[$this->plugin_id]['name']);
            $title .= " &mdash; " . wa()->accountName();
            $this->view->assign('title', html_entity_decode($title, ENT_NOQUOTES, 'utf-8'));
            waSystem::popActivePlugin();
        } else {
            $this->view->assign('plugin_slug', false);
        }
    }
 protected function init()
 {
     $transport = ucfirst($this->getRequest()->post('blog_import_transport', '', waRequest::TYPE_STRING_TRIM));
     $class = "blogImportPlugin{$transport}Transport";
     if ($transport && class_exists($class)) {
         $plugin_namespace = $this->getApp() . '_import';
         $namespace = $plugin_namespace . '_' . strtolower($transport);
         $this->plugin = wa()->getPlugin('import');
         if ($post = $this->getRequest()->post($plugin_namespace)) {
             $this->plugin->setup($post)->saveSettings();
         }
         $settings = $this->plugin->getSettings();
         $blog_model = new blogBlogModel();
         if ($settings['blog'] && ($blog = $blog_model->getById($settings['blog']))) {
             $settings['blog_status'] = $blog['status'];
         } else {
             throw new waException(_wp("Target blog not found"));
         }
         $author_has_rights = false;
         try {
             if ($settings['contact']) {
                 $author_has_rights = blogHelper::checkRights($settings['blog'], $settings['contact']);
             }
         } catch (waRightsException $ex) {
             //do nothing
         }
         if (!$author_has_rights) {
             throw new waException(_wp("Author not found or has insufficient rights"));
         }
         $this->data['transport'] = new $class($settings);
         $this->data['blog'] = $this->plugin->getSettingValue('blog');
         $this->transport =& $this->data['transport'];
         $this->transport->setup($this->getRequest()->post($namespace), array());
         $this->data['posts'] = $this->transport->getPosts();
         $this->data['current'] = 0;
         $this->data['count'] = count($this->data['posts']);
     } else {
         throw new waException(sprintf(_wp("Transport type %s not found"), $transport));
     }
 }