/** * Renders an rss feed containing the newest plugins. * * @param int $limit How many plugins to display (optional, default 20) */ public function newest_action($limit = 20) { $doc = new DomDocument('1.0', 'utf-8'); $doc->formatOutput = true; $doc->encoding = 'utf-8'; $rss = $doc->appendChild($this->create_xml_element($doc, 'rss', null, array('version' => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom'))); $channel = $rss->appendChild($doc->createElement('channel')); $channel->appendChild($this->create_xml_element($doc, 'title', 'Stud.IP Plugin Marktplatz - Neueste Plugins')); $channel->appendChild($this->create_xml_element($doc, 'description', 'Liste der neuesten Plugins auf dem Stud.IP Plugin Marktplatz')); $channel->appendChild($this->create_xml_element($doc, 'link', 'http://plugins.studip.de')); $channel->appendChild($this->create_xml_element($doc, 'lastBuildDate', gmdate('D, d M Y H:i:s T'))); $channel->appendChild($this->create_xml_element($doc, 'generator', _('Stud.IP Plugin Marktplatz'))); $channel->appendChild($this->create_xml_element($doc, 'atom:link', null, array('rel' => 'self', 'type' => 'application/rss+xml', 'href' => $this->absolute_url_for('rss/newest')))); $plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 ORDER BY mkdate DESC"); foreach ($plugins as $plugin) { if (count($plugin->releases) === 0) { continue; } $rss_plugin = $channel->appendChild($doc->createElement('item')); $rss_plugin->appendChild($this->create_xml_element($doc, 'title', $plugin->name)); $rss_plugin->appendChild($this->create_xml_element($doc, 'link', $this->absolute_url_for('presenting/details/' . $plugin->id))); $rss_plugin->appendChild($this->create_xml_element($doc, 'guid', $this->absolute_url_for('presenting/details/' . $plugin->id), array('isPermaLink' => 'true'))); $rss_plugin->appendChild($this->create_xml_element($doc, 'description', $plugin->description, array(), false)); if ($plugin->user) { $rss_plugin->appendChild($this->create_xml_element($doc, 'author', $plugin->user->email . ' (' . $plugin->user->getFullname() . ')')); } } $this->render_text($doc->saveXML()); }
public function up() { DBManager::get()->exec("\n ALTER TABLE `pluginmarket_plugins`\n ADD `rating` DOUBLE NULL AFTER `language` ;\n "); SimpleORMap::expireTableScheme(); foreach (MarketPlugin::findBySQL("1=1") as $plugin) { $plugin['rating'] = $plugin->calculateRating(); $plugin->store(); } }
public function getHomepageTemplate($user_id) { $this->addStylesheet('assets/pluginmarket.less'); $templatefactory = new Flexi_TemplateFactory(__DIR__ . "/views"); $template = $templatefactory->open("presenting/users_plugins.php"); $plugins = MarketPlugin::findBySQL("user_id = ? AND publiclyvisible = 1 AND approved = 1 ORDER BY mkdate DESC", array($user_id)); $template->set_attribute("plugin", $this); $template->set_attribute("plugins", $plugins); $template->set_attribute("title", _("Meine Plugins")); return count($plugins) ? $template : null; }
public function find_releases_action() { $output = array(); $studipversion = Request::get("studipversion"); $plugins = MarketPlugin::findByPluginclassname(Request::get("classname")); if (!count($plugins)) { $output['info'] = "No release found in the market."; } else { foreach ($plugins as $plugin) { foreach ($plugin->releases as $release) { if ((!$release['studip_min_version'] || version_compare($studipversion, $release['studip_min_version'], ">=")) && (!$release['studip_max_version'] || version_compare($studipversion, $release['studip_max_version'], "<="))) { $output['releases'][] = array('version' => $release['version'], 'html_url' => $this->url_for('presenting/details/' . $plugin->getId()), 'download_url' => $this->url_for('presenting/download/' . $release->getId())); } } } } $this->render_json($output); }
public function register_for_pluginnews_action($plugin_id) { $this->marketplugin = MarketPlugin::find($plugin_id); if (Request::isPost()) { if (Request::submitted("follow")) { $following = new MarketPluginFollower(); $following['plugin_id'] = $plugin_id; $following['user_id'] = $GLOBALS['user']->id; $following->store(); PageLayout::postMessage(MessageBox::success(_("Sie bekommen nun Informationen zu Updates dieses Plugins zugeschickt."))); } elseif (Request::submitted("unfollow")) { $following = MarketPluginFollower::findByUserAndPlugin($GLOBALS['user']->id, $plugin_id); $following->delete(); PageLayout::postMessage(MessageBox::success(_("Sie werden jetzt keine weiteren Neuigkeiten über dieses Plugin als Stud.IP Nachricht bekommen."))); } } if (Request::isXhr()) { $this->response->add_header('X-Title', _("Plugin abonnieren")); $this->set_layout(null); $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 usage_action() { $this->plugins = MarketPlugin::findManyByName(Request::getArray('plugins')); $this->mostlikely = MarketPluginUsage::findOneBySQL('user_id = ? GROUP BY name ORDER BY count(*) DESC', array(User::findCurrent()->id))->name; }
public function delete_action($plugin_id) { $this->marketplugin = MarketPlugin::find($plugin_id); if (Request::submitted('delete') && $this->marketplugin->isWritable()) { CSRFProtection::verifyUnsafeRequest(); $this->marketplugin->delete(); $this->redirect('myplugins/overview'); } }