Beispiel #1
0
 /**
  * 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;
 }
Beispiel #4
0
 public function xml_action()
 {
     $doc = new DomDocument('1.0', 'utf-8');
     $doc->formatOutput = true;
     $doc->encoding = 'utf-8';
     $xml_plugins = $doc->appendChild($doc->createElement('plugins'));
     $plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 ORDER BY name ASC");
     foreach ($plugins as $plugin) {
         $xml_plugin = $xml_plugins->appendChild($this->create_xml_element($doc, 'plugin', null, array('name' => $plugin->name, 'homepage' => $plugin->url, 'short_description' => $plugin->short_description, 'description' => $plugin->description, 'image' => $plugin->getLogoURL(true), 'score' => $plugin['rating'])));
         foreach ($plugin->releases as $release) {
             $xml_plugin->appendChild($this->create_xml_element($doc, 'release', null, array('version' => $release->version, 'studipMinVersion' => $release->studip_min_version, 'studipMaxVersion' => $release->studip_max_version, 'url' => $this->absolute_url_for('presenting/download/' . $release->id))));
         }
     }
     $this->set_content_type('text/xml;charset=UTF-8');
     $this->render_text($doc->saveXML());
 }
Beispiel #5
0
 public function all_action()
 {
     if (Request::get("search")) {
         $this->plugins = MarketPlugin::findBySQL("\n                    (\n                        name LIKE :likesearch\n                        OR (SELECT CONCAT(Vorname, ' ', Nachname) FROM auth_user_md5 WHERE user_id = pluginmarket_plugins.user_id LIMIT 1) LIKE :likesearch\n                        OR MATCH (short_description, description) AGAINST (:search IN BOOLEAN MODE)\n                        OR (SELECT GROUP_CONCAT(' ', tag) FROM pluginmarket_tags WHERE pluginmarket_tags.plugin_id = plugin_id GROUP BY pluginmarket_tags.plugin_id LIMIT 1) LIKE :likesearch\n                        OR (SELECT 1 FROM pluginmarket_plugin_usages WHERE pluginmarket_plugins.plugin_id = pluginmarket_plugin_usages.plugin_id AND name LIKE :likesearch LIMIT 1)\n                    )\n                    AND publiclyvisible = 1\n                    AND approved = 1\n                ORDER BY (IF(name LIKE :likesearch, 6, 0) + MATCH (short_description, description) AGAINST (:search)),name ", array('likesearch' => "%" . Request::get("search") . "%", 'search' => Request::get("search")));
     } elseif (Request::get("tag")) {
         $statement = DBManager::get()->prepare("\n                SELECT pluginmarket_plugins.*\n                FROM pluginmarket_plugins\n                    INNER JOIN pluginmarket_tags ON (pluginmarket_plugins.plugin_id = pluginmarket_tags.plugin_id)\n                WHERE pluginmarket_tags.tag = :tag\n                    AND pluginmarket_plugins.approved = 1\n                    AND pluginmarket_plugins.publiclyvisible = 1\n                ORDER BY name\n            ");
         $statement->execute(array('tag' => Request::get("tag")));
         $plugin_data = $statement->fetchAll(PDO::FETCH_ASSOC);
         $this->plugins = array();
         foreach ($plugin_data as $data) {
             $plugin = new MarketPlugin();
             $plugin->setData($data);
             $plugin->setNew(false);
             $this->plugins[] = $plugin;
         }
     } else {
         $this->plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 ORDER BY name ASC");
     }
     // Filter version
     if ($_SESSION['pluginmarket']['version']) {
         $this->plugins = array_filter($this->plugins, function ($plugin) {
             return $plugin->checkVersion($_SESSION['pluginmarket']['version']);
         });
     }
     $this->show_all = true;
     $this->render_action('overview_' . $_SESSION['pluginmarket']['view']);
 }
Beispiel #6
0
 public function overview_action()
 {
     $this->plugins = MarketPlugin::findBySQL("approved = 0 AND publiclyvisible = 1 ORDER BY mkdate DESC");
 }
Beispiel #7
0
 public function overview_action()
 {
     $this->plugins = MarketPlugin::findBySQL("user_id = ? ORDER BY mkdate DESC", array($GLOBALS['user']->id));
 }