Skip to content
Snippets Groups Projects
Select Git revision
  • f6ce2608a47d6a84b55f7291f067569f41facda8
  • master default protected
  • luniki-tools-typo
3 results

approving.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    approving.php 2.52 KiB
    <?php
    require_once 'app/controllers/plugin_controller.php';
    
    class ApprovingController extends PluginController {
    
        function before_filter(&$action, &$args)
        {
            parent::before_filter($action, $args);
            if (!$GLOBALS['perm']->have_perm("root")) {
                throw new AcessDeniedException("Kein Zutritt");
            }
    
            Navigation::activateItem("/pluginmarket/approving");
            $this->set_content_type('text/html;charset=windows-1252');
        }
    
        public function overview_action()
        {
            $this->plugins = MarketPlugin::findBySQL("approved = 0 AND publiclyvisible = 1 ORDER BY mkdate DESC");
        }
    
        public function review_action($plugin_id) {
            $this->marketplugin = new MarketPlugin($plugin_id);
            if ($this->marketplugin['approved']) {
                throw new Exception("Plugin ist schon reviewt.");
            }
            if (Request::isXhr()) {
                $this->response->add_header('X-Title', _("Review schreiben"));
                $this->set_layout(null);
            }
        }
    
        public function approve_action($plugin_id) {
            $this->marketplugin = new MarketPlugin($plugin_id);
            if ($this->marketplugin['approved']) {
                throw new Exception("Plugin ist schon reviewt.");
            }
            $this->marketplugin['approved'] = (int) Request::int("approved");
            if (!$this->marketplugin['approved']) {
                $this->marketplugin['publiclyvisible'] = 0;
            }
            if ($this->marketplugin['approved'] && $this->marketplugin['publiclyvisible']) {
                $this->marketplugin['published'] = time();
            }
            $this->marketplugin->store();
    
            $messaging = new messaging();
            $messaging->insert_message(
                sprintf(_("Ihr Plugin %s wurde reviewt:"), $this->marketplugin['name'])
                    ."\n\n"
                    .($this->marketplugin['approved'] ? _("Es ist in den Marktplatz aufgenommen worden!") : _("Es ist leider noch nicht in den Marktplatz aufgenommen."))
                    ."\n\n"
                    .(Request::get("review") ? _("Begrndung:")."\n\n".Request::get("review") : _("Ein ausfhrliches Review wurde nicht angegeben und muss bei Bedarf direkt angefragt werden.")),
                get_username($this->marketplugin['user_id']),
                '',
                '',
                '',
                '',
                '',
                _("Pluginreview"),
                true,
                'normal',
                "pluginreview"
            );
    
            PageLayout::postMessage(MessageBox::success(_("Review wurde gespeichert.")));
            $this->redirect('approving/overview');
        }
    
    }