Select Git revision
SimpleORMapCollection.class.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Marcus Eibrink-Lunzenauer authoredMarcus Eibrink-Lunzenauer authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
myplugins.php 10.46 KiB
<?php
require_once 'market_controller.php';
class MypluginsController extends MarketController
{
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
Navigation::activateItem("/pluginmarket/myplugins");
$this->set_content_type('text/html;charset=windows-1252');
}
public function overview_action()
{
$this->plugins = MarketPlugin::findBySQL("LEFT JOIN pluginmarket_user_plugins USING (plugin_id)
WHERE pluginmarket_plugins.user_id = :user_id
OR pluginmarket_user_plugins.user_id = :user_id
GROUP BY pluginmarket_plugins.plugin_id
ORDER BY mkdate DESC", array('user_id' => $GLOBALS['user']->id)
);
}
public function addfromzip_action()
{
CSRFProtection::verifyUnsafeRequest();
if (isset($_FILES['release_file']['tmp_name'])) {
$plugin = new MarketPlugin();
$plugin->setId($plugin->getNewId());
$plugin->user_id = $GLOBALS['user']->id;
$release = new MarketRelease();
$release->plugin = $plugin;
$release['user_id'] = $GLOBALS['user']->id;
//throws Exception on error
$release->installFile();
$this->redirect($this->url_for('/overview', ['edit_plugin_id' => $plugin->id]));
}
}
public function add_action() {
$this->marketplugin = new MarketPlugin();
if (Request::isXhr()) {
$this->set_layout(null);
}
$this->render_action("edit");
}
public function edit_action($plugin_id) {
$this->marketplugin = new MarketPlugin($plugin_id);
if (Request::isXhr()) {
$this->response->add_header('X-Title', _("Plugin bearbeiten"));
$this->set_layout(null);
}
}
public function add_release_action($plugin_id) {
$this->marketplugin = new MarketPlugin($plugin_id);
$this->release = new MarketRelease();
if (Request::isXhr()) {
$this->response->add_header('X-Title', _("Release hinzufgen"));
$this->set_layout(null);
}
$this->render_action("edit_release");
}
public function edit_release_action($release_id) {
$this->release = new MarketRelease($release_id);
$this->marketplugin = $this->release->plugin;
if (!$this->marketplugin->isNew() && !$this->marketplugin->isWritable()) {