diff --git a/classes/MarketController.php b/classes/MarketController.php index 14dd033437b2f467f642da546684e13cdd1b736f..bc69c18346dc09e9b5ee52750f7a166d4a44ce44 100755 --- a/classes/MarketController.php +++ b/classes/MarketController.php @@ -1,15 +1,12 @@ <?php -require_once 'app/controllers/plugin_controller.php'; - class MarketController extends PluginController { - public function absolute_url_for($to) { $old_base = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); $args = func_get_args(); - $url = call_user_func_array(array($this, 'url_for'), $args); + $url = call_user_func_array([$this, 'url_for'], $args); URLHelper::setBaseURL($old_base); @@ -59,7 +56,7 @@ class MarketController extends PluginController return $string; } - public function create_xml_element($parent, $name, $value, $attributes = array(), $convert_to_markdown = true) + public function create_xml_element($parent, $name, $value, $attributes = [], $convert_to_markdown = true) { $element = $parent->createElement($name, $this->xml_ready($value, $convert_to_markdown)); foreach ($attributes as $k => $v) { diff --git a/classes/MarketImage.class.php b/classes/MarketImage.class.php index b97d32b7164e11a4b896e74b283204290989ec05..a866a2c57102c8b4d40a0ab453c7320c0ce68175 100755 --- a/classes/MarketImage.class.php +++ b/classes/MarketImage.class.php @@ -3,20 +3,20 @@ class MarketImage extends SimpleORMap { static public function findByPlugin_id($plugin_id) { - return self::findBySQL("plugin_id = ? ORDER BY position ASC, mkdate ASC", array($plugin_id)); + return self::findBySQL("plugin_id = ? ORDER BY position ASC, mkdate ASC", [$plugin_id]); } static public function getImageDataPath() { return $GLOBALS['STUDIP_BASE_PATH'] . "/data/pluginmarket_images"; } - protected static function configure($config = array()) + protected static function configure($config = []) { $config['db_table'] = 'pluginmarket_images'; - $config['belongs_to']['plugin'] = array( + $config['belongs_to']['plugin'] = [ 'class_name' => 'MarketPlugin', 'foreign_key' => 'plugin_id', - ); + ]; parent::configure($config); } @@ -26,7 +26,7 @@ class MarketImage extends SimpleORMap $old_base = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); } - $url = URLHelper::getURL("plugins.php/pluginmarket/presenting/image/".$this->getId(), array(), true); + $url = URLHelper::getURL("plugins.php/pluginmarket/presenting/image/".$this->getId(), [], true); if ($absolute_url) { URLHelper::setBaseURL($old_base); @@ -60,4 +60,4 @@ class MarketImage extends SimpleORMap header("Content-Disposition: inline; filename=" . $this['filename']); echo file_get_contents($path); } -} \ No newline at end of file +} diff --git a/classes/MarketPlugin.class.php b/classes/MarketPlugin.class.php index 6abacd9d4a2e478e56438ed9fa0bda01824f4ca3..96f68680b65aef8d6e0ebe7d9b595dab692205d1 100755 --- a/classes/MarketPlugin.class.php +++ b/classes/MarketPlugin.class.php @@ -1,44 +1,45 @@ <?php -class MarketPlugin extends SimpleORMap { - protected static function configure($config = array()) +class MarketPlugin extends SimpleORMap +{ + protected static function configure($config = []) { $config['db_table'] = 'pluginmarket_plugins'; - $config['has_many']['releases'] = array( + $config['has_many']['releases'] = [ 'class_name' => 'MarketRelease', 'on_delete' => 'delete', 'on_store' => 'store', - ); - $config['has_many']['images'] = array( + ]; + $config['has_many']['images'] = [ 'class_name' => 'MarketImage', 'on_delete' => 'delete', 'on_store' => 'store', - ); - $config['has_many']['reviews'] = array( + ]; + $config['has_many']['reviews'] = [ 'class_name' => 'MarketReview', 'on_delete' => 'delete', 'on_store' => 'store', - ); - $config['has_many']['follower'] = array( + ]; + $config['has_many']['follower'] = [ 'class_name' => 'MarketPluginFollower', 'on_delete' => 'delete', 'on_store' => 'store', - ); - $config['has_many']['uses'] = array( + ]; + $config['has_many']['uses'] = [ 'class_name' => 'MarketPluginUsage', 'on_delete' => 'delete', 'on_store' => 'store', - ); - $config['belongs_to']['user'] = array( + ]; + $config['belongs_to']['user'] = [ 'class_name' => 'User', 'foreign_key' => 'user_id', - ); - $config['has_and_belongs_to_many']['more_users'] = array( + ]; + $config['has_and_belongs_to_many']['more_users'] = [ 'class_name' => "User", 'thru_table' => 'pluginmarket_user_plugins', 'on_delete' => 'delete', 'on_store' => 'store' - ); + ]; $config['registered_callbacks']['before_store'][] = 'requestReview'; parent::configure($config); } @@ -107,17 +108,17 @@ class MarketPlugin extends SimpleORMap { AND tag = :tag "); foreach (array_diff($old_tags, $tags) as $tag_to_delete) { - $delete->execute(array( + $delete->execute([ 'plugin_id' => $this->getId(), 'tag' => $tag_to_delete - )); + ]); } foreach ($tags as $tag) { - $insert->execute(array( + $insert->execute([ 'plugin_id' => $this->getId(), 'tag' => $tag, 'user_id' => $GLOBALS['user']->id - )); + ]); } } @@ -128,7 +129,7 @@ class MarketPlugin extends SimpleORMap { WHERE plugin_id = ? ORDER BY (SELECT COUNT(*) FROM pluginmarket_tags AS t2 WHERE t2.tag = pluginmarket_tags.tag) DESC "); - $statement->execute(array($this->getId())); + $statement->execute([$this->getId()]); return $statement->fetchAll(PDO::FETCH_COLUMN, 0); } @@ -137,8 +138,9 @@ class MarketPlugin extends SimpleORMap { * * @return int Number of downloads */ - public function getDownloads() { - return DBManager::get()->fetchColumn('SELECT SUM(downloads) FROM pluginmarket_releases WHERE plugin_id = ?', array($this->id)); + public function getDownloads() + { + return DBManager::get()->fetchColumn('SELECT SUM(downloads) FROM pluginmarket_releases WHERE plugin_id = ?', [$this->id]); } /** @@ -147,11 +149,13 @@ class MarketPlugin extends SimpleORMap { * @param String $version the requested version * @param boolean $all_releases Defines if all releases are checked for compatibility */ - public function checkVersion($version) { + public function checkVersion($version) + { return $this->releases[0] ? $this->releases[0]->checkVersion($version) : false; } - public function calculateRating() { + public function calculateRating() + { $rating = 0; $factors = 0; foreach ($this->reviews as $review) { diff --git a/classes/MarketPluginFollower.class.php b/classes/MarketPluginFollower.class.php index b10d4c01a4da6ae55b51e078094f7d1aa59cbaed..9bd606ff8b689fd55273e406651ba2718a590b72 100755 --- a/classes/MarketPluginFollower.class.php +++ b/classes/MarketPluginFollower.class.php @@ -1,25 +1,20 @@ <?php -class MarketPluginFollower extends SimpleORMap { +class MarketPluginFollower extends SimpleORMap +{ - static public function notifyUsers($plugin_id, $type = null) + public static function findByUserAndPlugin($user_id, $plugin_id) { - foreach (self::findByPlugin_id($plugin_id) as $follower) { - - } - } - - static public function findByUserAndPlugin($user_id, $plugin_id) { - return self::findOneBySQL("user_id = ? AND plugin_id = ?", array($user_id, $plugin_id)); + return self::findOneBySQL("user_id = ? AND plugin_id = ?", [$user_id, $plugin_id]); } - protected static function configure($config = array()) + protected static function configure($config = []) { $config['db_table'] = 'pluginmarket_plugin_follower'; - $config['belongs_to']['plugin'] = array( + $config['belongs_to']['plugin'] = [ 'class_name' => 'MarketPlugin', 'foreign_key' => 'plugin_id', - ); + ]; parent::configure($config); } -} \ No newline at end of file +} diff --git a/classes/MarketPluginUsage.php b/classes/MarketPluginUsage.php index 9bbf82b51d52b23de68c18ac9518ba9fa83ba0e2..c0a68220e7f7167261ae88d71fec1a09d839c111 100755 --- a/classes/MarketPluginUsage.php +++ b/classes/MarketPluginUsage.php @@ -17,21 +17,22 @@ class MarketPluginUsage extends SimpleORMap { - - protected static function configure($config = array()) { + protected static function configure($config = []) + { $config['db_table'] = 'pluginmarket_plugin_usages'; - $config['belongs_to']['plugin'] = array( + $config['belongs_to']['plugin'] = [ 'class_name' => 'MarketPlugin', 'foreign_key' => 'plugin_id', - ); - $config['belongs_to']['user'] = array( + ]; + $config['belongs_to']['user'] = [ 'class_name' => 'User', 'foreign_key' => 'user_id', - ); + ]; parent::configure($config); } - public function isEditable() { + public function isEditable() + { return $GLOBALS['perm']->have_perm('root') || $this->user_id == User::findCurrent() || $this->plugin->user_id == User::findCurrent()->id diff --git a/classes/MarketRelease.class.php b/classes/MarketRelease.class.php index e29db9bf69287e2a2a88c4102e06879f430fdb31..71724b2c2989884ba501c7bf46c3fd9f631d4b3f 100755 --- a/classes/MarketRelease.class.php +++ b/classes/MarketRelease.class.php @@ -9,31 +9,33 @@ class MarketRelease extends SimpleORMap { } static public function findByPlugin_id($plugin_id) { - return self::findBySQL("plugin_id = ? ORDER BY version DESC", array($plugin_id)); + return self::findBySQL("plugin_id = ? ORDER BY version DESC", [$plugin_id]); } - protected static function configure($config = array()) + protected static function configure($config = []) { $config['db_table'] = 'pluginmarket_releases'; - $config['belongs_to']['plugin'] = array( + $config['belongs_to']['plugin'] = [ 'class_name' => 'MarketPlugin', 'foreign_key' => 'plugin_id', - ); - $config['has_many']['followers'] = array( + ]; + $config['has_many']['followers'] = [ 'class_name' => 'MarketReleaseFollower', 'on_delete' => 'delete', 'on_store' => 'store', - ); + ]; $config['additional_fields']['last_upload_time']['get'] = 'getFileMTime'; parent::configure($config); } - public function delete() { + public function delete() + { parent::delete(); @unlink($this->getFilePath()); } - public function installFile() { + public function installFile() + { $hash = md5(uniqid()); $tmp_folder = $GLOBALS['TMP_PATH']."/temp_plugin_".$hash; mkdir($tmp_folder); @@ -196,13 +198,15 @@ class MarketRelease extends SimpleORMap { * * @param String $version Version to check for */ - public function checkVersion($version) { + public function checkVersion($version) + { return ( !$this->studip_min_version || version_compare($version, $this->studip_min_version) >= 0 ) && ( !$this->studip_max_version || version_compare($version, $this->studip_max_version) <= 0 ); } - protected function createManifest($manifest) { - $arr = array(); + protected function createManifest($manifest) + { + $arr = []; foreach ($manifest as $index => $value) { if (is_array($value)) { if ($index == 'screenshots') { diff --git a/classes/MarketReleaseFollower.class.php b/classes/MarketReleaseFollower.class.php index 99beddabdd0acc6c51481ce3840c06e5d04a7c7a..185bed2e38e88547a8e719d4300f8914f4011a23 100755 --- a/classes/MarketReleaseFollower.class.php +++ b/classes/MarketReleaseFollower.class.php @@ -3,16 +3,16 @@ class MarketReleaseFollower extends SimpleORMap { static public function findByUserAndRelease($user_id, $release_id) { - return self::findOneBySQL("user_id = ? AND release_id = ?", array($user_id, $release_id)); + return self::findOneBySQL("user_id = ? AND release_id = ?", [$user_id, $release_id]); } - protected static function configure($config = array()) + protected static function configure($config = []) { $config['db_table'] = 'pluginmarket_release_followers'; - $config['belongs_to']['release'] = array( + $config['belongs_to']['release'] = [ 'class_name' => 'MarketRelease', 'foreign_key' => 'release_id', - ); + ]; parent::configure($config); } -} \ No newline at end of file +} diff --git a/classes/MarketReview.class.php b/classes/MarketReview.class.php index 94529cbe842713a8910f44cc6d2cd9f33a72361f..7cdc4f8ddf0477ad4e24d4d249cc49c750eaf32c 100755 --- a/classes/MarketReview.class.php +++ b/classes/MarketReview.class.php @@ -1,18 +1,19 @@ <?php -class MarketReview extends SimpleORMap { - - protected static function configure($config = array()) +class MarketReview extends SimpleORMap +{ + protected static function configure($config = []) { $config['db_table'] = 'pluginmarket_reviews'; - $config['belongs_to']['plugin'] = array( + $config['belongs_to']['plugin'] = [ 'class_name' => 'MarketPlugin', 'foreign_key' => 'plugin_id', - ); + ]; parent::configure($config); } - public static function findByPlugin_id ($plugin_id) { - return self::findBySQL("plugin_id = ? ORDER BY mkdate DESC", array($plugin_id)); + public static function findByPlugin_id ($plugin_id) + { + return self::findBySQL("plugin_id = ? ORDER BY mkdate DESC", [$plugin_id]); } -} \ No newline at end of file +} diff --git a/controllers/extern.php b/controllers/extern.php index de78bc644d9549886b7cf5b4ea516968791af57c..5931a23f485aeb6a3298e9d1bf4c1af66ee9b843 100755 --- a/controllers/extern.php +++ b/controllers/extern.php @@ -43,7 +43,7 @@ class ExternController extends MarketController public function find_releases_action() { - $output = array(); + $output = []; $studipversion = Request::get("studipversion"); $plugins = MarketPlugin::findByPluginclassname(Request::get("classname")); if (!count($plugins)) { @@ -53,11 +53,11 @@ class ExternController extends MarketController 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( + $output['releases'][] = [ 'version' => $release['version'], 'html_url' => $this->url_for('presenting/details/' . $plugin->getId()), 'download_url' => $this->url_for('presenting/download/' . $release->getId()), - ); + ]; } } } diff --git a/controllers/myplugins.php b/controllers/myplugins.php index 01ada8cdf99fa5a827f7bfd0dce1430bbb38b998..3791e7da78f0b88bb9394c4f43a1aff0758ef5de 100755 --- a/controllers/myplugins.php +++ b/controllers/myplugins.php @@ -13,7 +13,7 @@ class MypluginsController extends MarketController 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) + ORDER BY mkdate DESC", ['user_id' => $GLOBALS['user']->id] ); } @@ -170,10 +170,10 @@ class MypluginsController extends MarketController SET user_id = :user_id, plugin_id = :plugin_id "); - $statement->execute(array( + $statement->execute([ 'user_id' => $user_id, 'plugin_id' => $this->marketplugin->getId() - )); + ]); } } $this->marketplugin->store(); @@ -188,10 +188,10 @@ class MypluginsController extends MarketController WHERE user_id = :user_id AND plugin_id = :plugin_id "); - $statement->execute(array( + $statement->execute([ 'user_id' => $new_boss->getId(), 'plugin_id' => $this->marketplugin->getId() - )); + ]); } } else { $statement = DBManager::get()->prepare(" @@ -199,10 +199,10 @@ class MypluginsController extends MarketController WHERE user_id = :user_id AND plugin_id = :plugin_id "); - $statement->execute(array( + $statement->execute([ 'user_id' => $user_id, 'plugin_id' => $this->marketplugin->getId() - )); + ]); } } diff --git a/controllers/presenting.php b/controllers/presenting.php index 9affc0fdbefbdd8cd2fd2618790e354b360ed5eb..b7f15e6a4122b26d5362330506da4698c76b9834 100755 --- a/controllers/presenting.php +++ b/controllers/presenting.php @@ -49,15 +49,15 @@ class PresentingController extends MarketController $tagWidget = new LinkCloudWidget(); $tagWidget->setTitle(_("Beliebte Tags")); foreach ($this->tags as $tag) { - $tagWidget->addLink($tag['tag'], $this->url_for('presenting/all', array('tag' => $tag['tag'])), $tag['number']); + $tagWidget->addLink($tag['tag'], $this->url_for('presenting/all', ['tag' => $tag['tag']]), $tag['number']); } $sidebar->addWidget($tagWidget); // Create view widget if ($action != 'details') { $viewWidget = new ViewsWidget(); - $viewWidget->addLink(_('Kacheln'), URLHelper::getLink('', array('view' => 'tiles')))->setActive($_SESSION['pluginmarket']['view'] == 'tiles'); - $viewWidget->addLink(_('Liste'), $this->url_for('presenting/all', array('view' => 'list')))->setActive($_SESSION['pluginmarket']['view'] == 'list'); + $viewWidget->addLink(_('Kacheln'), URLHelper::getLink('', ['view' => 'tiles']))->setActive($_SESSION['pluginmarket']['view'] == 'tiles'); + $viewWidget->addLink(_('Liste'), $this->url_for('presenting/all', ['view' => 'list']))->setActive($_SESSION['pluginmarket']['view'] == 'list'); $sidebar->addWidget($viewWidget); } @@ -66,7 +66,7 @@ class PresentingController extends MarketController $versionWidget->setTitle(_('Stud.IP Version')); // Create options for all studip versions - $_SESSION['pluginmarket']['version'] = Request::submitted('version') ? Request::get('version') : $_SESSION['pluginmarket']['version']; + $_SESSION['pluginmarket']['version'] = Request::get('version', $_SESSION['pluginmarket']['version'] ?? null); $options[] = "<option value='".URLHelper::getLink('', ['version' => 0])."'>"._('Alle Versionen')."</option>"; foreach (array_reverse(PluginMarket::getStudipReleases()) as $version) { @@ -82,7 +82,7 @@ class PresentingController extends MarketController { if ($GLOBALS['perm']->have_perm("user")) { if ($this->last_pluginmarket_visit !== time()) { - $this->new_plugins = MarketPlugin::findBySql("publiclyvisible = 1 AND approved = 1 AND published > ? ORDER BY mkdate DESC", array($this->last_pluginmarket_visit)); + $this->new_plugins = MarketPlugin::findBySql("publiclyvisible = 1 AND approved = 1 AND published > ? ORDER BY mkdate DESC", [$this->last_pluginmarket_visit]); } } @@ -102,12 +102,12 @@ class PresentingController extends MarketController LIMIT 6 "); $best->execute(); - $this->best_plugins = array(); + $this->best_plugins = []; foreach ($best->fetchAll(PDO::FETCH_ASSOC) as $data) { $this->best_plugins[] = MarketPlugin::buildExisting($data); } - $this->showall = false; + $this->show_all = false; $this->render_action('overview_'.$_SESSION['pluginmarket']['view']); } @@ -125,10 +125,10 @@ class PresentingController extends MarketController ) AND publiclyvisible = 1 AND approved = 1 - ORDER BY deprecated ASC, (IF(name LIKE :likesearch, 6, 0) + MATCH (short_description, description) AGAINST (:search)), name ", array( + ORDER BY deprecated ASC, (IF(name LIKE :likesearch, 6, 0) + MATCH (short_description, description) AGAINST (:search)), name ", [ 'likesearch' => "%".Request::get("search")."%", 'search' => Request::get("search") - ) + ] ); } elseif(Request::get("tag")) { $statement = DBManager::get()->prepare(" @@ -140,9 +140,9 @@ class PresentingController extends MarketController AND pluginmarket_plugins.publiclyvisible = 1 ORDER BY deprecated ASC, name ASC "); - $statement->execute(array('tag' => Request::get("tag"))); + $statement->execute(['tag' => Request::get("tag")]); $plugin_data = $statement->fetchAll(PDO::FETCH_ASSOC); - $this->plugins = array(); + $this->plugins = []; foreach ($plugin_data as $data) { $plugin = new MarketPlugin(); $plugin->setData($data); @@ -204,14 +204,14 @@ class PresentingController extends MarketController // Submit propose usage if (Request::submitted('propose')) { CSRFProtection::verifyUnsafeRequest(); - MarketPluginUsage::create(array( + MarketPluginUsage::create([ 'plugin_id' => $plugin_id, 'user_id' => User::findCurrent()->id, 'name' => Request::get('used_at') - )); + ]); $this->redirect('presenting/details/'.$plugin_id); } - $this->most_used = DBManager::get()->fetchFirst('SELECT name FROM pluginmarket_plugin_usages WHERE user_id = ? AND name NOT IN (SELECT name FROM pluginmarket_plugin_usages WHERE plugin_id = ?) GROUP BY name ORDER BY count(*)', array(User::findCurrent()->id, $plugin_id)); + $this->most_used = DBManager::get()->fetchFirst('SELECT name FROM pluginmarket_plugin_usages WHERE user_id = ? AND name NOT IN (SELECT name FROM pluginmarket_plugin_usages WHERE plugin_id = ?) GROUP BY name ORDER BY count(*)', [User::findCurrent()->id, $plugin_id]); } public function delete_usage_action($usage_id) @@ -228,7 +228,7 @@ class PresentingController extends MarketController public function review_action($plugin_id) { - $reviews = MarketReview::findBySQL("plugin_id = ? AND user_id = ?", array($plugin_id, $GLOBALS['user']->id)); + $reviews = MarketReview::findBySQL("plugin_id = ? AND user_id = ?", [$plugin_id, $GLOBALS['user']->id]); if (count($reviews)) { $this->review = $reviews[0]; } else { @@ -251,7 +251,7 @@ class PresentingController extends MarketController if (!$this->marketplugin) { throw new Exception("Unknown plugin."); } - $reviews = MarketReview::findBySQL("plugin_id = ? AND user_id = ?", array($plugin_id, $GLOBALS['user']->id)); + $reviews = MarketReview::findBySQL("plugin_id = ? AND user_id = ?", [$plugin_id, $GLOBALS['user']->id]); if (count($reviews)) { $this->review = $reviews[0]; } else { @@ -270,7 +270,7 @@ class PresentingController extends MarketController PersonalNotifications::add( $this->marketplugin['user_id'], - PluginEngine::getURL($this->plugin, array(), "presenting/details/".$plugin_id), + PluginEngine::getURL($this->plugin, [], "presenting/details/".$plugin_id), sprintf(_("Ihr Plugin %s wurde von %s bewertet."), $this->marketplugin['name'], get_fullname($GLOBALS['user']->id)), "", Assets::image_path("icons/blue/star.svg") diff --git a/controllers/rss.php b/controllers/rss.php index ef6a8fd6f8303d08c17eecad974b0610d972b892..77a0828124f36c0cc329273f9d232f9dfd449805 100755 --- a/controllers/rss.php +++ b/controllers/rss.php @@ -19,10 +19,10 @@ class RssController extends MarketController $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( + $rss = $doc->appendChild($this->create_xml_element($doc, 'rss', null, [ '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')); @@ -30,11 +30,11 @@ class RssController extends MarketController $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( + $channel->appendChild($this->create_xml_element($doc, 'atom:link', null, [ '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) { @@ -45,10 +45,10 @@ class RssController extends MarketController $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( + $rss_plugin->appendChild($this->create_xml_element($doc, 'guid', $this->absolute_url_for('presenting/details/' . $plugin->id), [ 'isPermaLink' => 'true' - ))); - $rss_plugin->appendChild($this->create_xml_element($doc, 'description', $plugin->description, array(), false)); + ])); + $rss_plugin->appendChild($this->create_xml_element($doc, 'description', $plugin->description, [], false)); if ($plugin->user) { $rss_plugin->appendChild($this->create_xml_element($doc, 'author', $plugin->user->email . ' (' . $plugin->user->getFullname() . ')')); } diff --git a/controllers/update.php b/controllers/update.php index f59b4b3dd52e602889f37e3047bdb57140785351..e4ffefd868fd86b3c05a1fa522cba9d509e73b60 100755 --- a/controllers/update.php +++ b/controllers/update.php @@ -32,21 +32,21 @@ class UpdateController extends MarketController 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; + $this->mostlikely = MarketPluginUsage::findOneBySQL('user_id = ? GROUP BY name ORDER BY count(*) DESC', [User::findCurrent()->id])->name; } public function save_usage_action() { // delete old usage - MarketPluginUsage::deleteBySQL('user_id = ? AND name = ?', array(User::findCurrent()->id, Request::get('tag'))); + MarketPluginUsage::deleteBySQL('user_id = ? AND name = ?', [User::findCurrent()->id, Request::get('tag')]); // create new usages foreach (Request::getArray('plugins') as $pluginid) { - MarketPluginUsage::create(array( + MarketPluginUsage::create([ 'plugin_id' => $pluginid, 'user_id' => User::findCurrent()->id, 'name' => Request::get('tag') - )); + ]); $this->done++; } } diff --git a/migrations/02_import_old_data.php b/migrations/02_import_old_data.php index 1581e73ebb517cb6eaa49149dbc040a7357baf47..27fee252e14eff1c7c12a37c2166f8098133a14b 100755 --- a/migrations/02_import_old_data.php +++ b/migrations/02_import_old_data.php @@ -78,7 +78,7 @@ class ImportOldData extends Migration { } //move user_ids for the powerusers - $user_mappings = array( + $user_mappings = [ '9790cb9e745cb7d85d3bc5a00141c851' => "2be5757744a32e6fe9a591f628f85ae8", //Jan Kulmann '8fcc07aaadbc82bb8e72a4faa1ae42d0' => "f28e9576efd238287b8db87ac1119087", //André Noack '2ee0aa5f6dcd48b945a1c786f488c148' => "f953070076eadbfd898e9552a35f5d95", //Jan-Hendrik Wilms @@ -101,7 +101,7 @@ class ImportOldData extends Migration { '49d15355f3fbe8b15c59f949d362747d' => "4abd1b0ca7fd763016316bec212e3866", //Stefan Osterloh 'c28b58bbe8e0755b5b6e2784160aa35b' => "84476bf266debf59c34f76ac82f59a03", //Lennart G '64cba677908f2a058d20c67a5ada7663' => "ba850607ce72dd2d2cbe46361c91ecab", //Olga Mertsalova (?) - ); + ]; $change_plugin_user = $db->prepare(" UPDATE pluginmarket_plugins SET user_id = :new WHERE user_id = :old "); @@ -115,22 +115,22 @@ class ImportOldData extends Migration { UPDATE pluginmarket_tags SET user_id = :new WHERE user_id = :old "); foreach ($user_mappings as $old_user_id => $user_id) { - $change_plugin_user->execute(array( + $change_plugin_user->execute([ 'old' => $old_user_id, 'new' => $user_id - )); - $change_plugin_user_connection->execute(array( + ]); + $change_plugin_user_connection->execute([ 'old' => $old_user_id, 'new' => $user_id - )); - $change_releases->execute(array( + ]); + $change_releases->execute([ 'old' => $old_user_id, 'new' => $user_id - )); - $change_plugin_tags->execute(array( + ]); + $change_plugin_tags->execute([ 'old' => $old_user_id, 'new' => $user_id - )); + ]); } } } diff --git a/migrations/05_usage_proposals.php b/migrations/05_usage_proposals.php index 8c50f8f0202b8679be0ff855ec7a5906c05fc1d2..cc1ede35a4b09e79774385d2a4be1cc3a7a041da 100755 --- a/migrations/05_usage_proposals.php +++ b/migrations/05_usage_proposals.php @@ -31,11 +31,11 @@ class UsageProposals extends Migration { $hits = array_map('trim', $hits); $hits = array_filter($hits); foreach ($hits as $hit) { - MarketPluginUsage::create(array( + MarketPluginUsage::create([ 'plugin_id' => $plugin['plugin_id'], 'user_id' => $plugin['user_id'], 'name' => $hit - )); + ]); } } diff --git a/views/myplugins/_edit_release.php b/views/myplugins/_edit_release.php index 4ee4c1d051deb8a8048dbbb40372f379d9ccf4b3..197d1cca631bc73ab2ae38d27d4a84161cccbad7 100755 --- a/views/myplugins/_edit_release.php +++ b/views/myplugins/_edit_release.php @@ -55,7 +55,7 @@ <? if (!$release->isNew()) : ?> <p class="info"> <?= _("Webhook-URL zum Einfügen in github oder gitlab:") ?> - <input type="text" readonly style="border: thin solid #cccccc; background-color: #eeeeee; width:100%;" value="<?= $controller->absolute_url_for('update/release/' . $release->getId(), array('s' => $release->getSecurityHash())) ?>"> + <input type="text" readonly style="border: thin solid #cccccc; background-color: #eeeeee; width:100%;" value="<?= $controller->absolute_url_for('update/release/' . $release->getId(), ['s' => $release->getSecurityHash()]) ?>"> </p> <? if ($release['repository_secret']) : ?> <label> @@ -70,4 +70,4 @@ <? endif ?> </fieldset> -</fieldset> \ No newline at end of file +</fieldset> diff --git a/views/myplugins/edit.php b/views/myplugins/edit.php index 2e02d3ac3392ef7c43d476bda0ac4a882b543da2..6408cdc17abaffa0c540bee71e377abd240735ef 100755 --- a/views/myplugins/edit.php +++ b/views/myplugins/edit.php @@ -49,9 +49,9 @@ <div style="margin-bottom: 10px; margin-top: 10px;"> <?= _("Mitarbeiter") ?> <ul class="clean" style="margin-bottom: 5px;" id="plugincollaborators"> - <?= $this->render_partial("myplugins/_collaborator.php", array('user' => $marketplugin->user ?: User::findCurrent())) ?> + <?= $this->render_partial("myplugins/_collaborator.php", ['user' => $marketplugin->user ?: User::findCurrent()]) ?> <? foreach ($marketplugin->more_users as $user) : ?> - <?= $this->render_partial("myplugins/_collaborator.php", array('user' => $user)) ?> + <?= $this->render_partial("myplugins/_collaborator.php", ['user' => $user]) ?> <? endforeach ?> </ul> <?= QuickSearch::get("user_id", new StandardSearch("user_id"))->fireJSFunctionOnSelect("STUDIP.PluginMarket.addCollaborator")->render() ?> @@ -83,10 +83,10 @@ <?= $this->render_partial("myplugins/_edit_images.php", compact("marketplugin")) ?> <? if ($marketplugin->isNew()) : ?> - <?= $this->render_partial("myplugins/_edit_release.php", array('release' => new MarketRelease())) ?> + <?= $this->render_partial("myplugins/_edit_release.php", ['release' => new MarketRelease()]) ?> <? endif ?> <div data-dialog-button> <?= \Studip\Button::createAccept(_('Speichern')) ?> </div> -</form> \ No newline at end of file +</form> diff --git a/views/myplugins/edit_release.php b/views/myplugins/edit_release.php index fb477fb281793457989c54ca0a11364c56b5aa71..9ec33810134c318794e37e9278a2eed0b81119d2 100755 --- a/views/myplugins/edit_release.php +++ b/views/myplugins/edit_release.php @@ -1,9 +1,9 @@ <form action="<?= $controller->url_for('myplugins/save_release') ?>" method="post" class="default" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?= $release->getId() ?>"> <input type="hidden" name="plugin_id" value="<?= $marketplugin->getId() ?>"> - <?= $this->render_partial("myplugins/_edit_release.php", array('release' => $release)) ?> + <?= $this->render_partial("myplugins/_edit_release.php", ['release' => $release]) ?> <div data-dialog-button> <?= \Studip\Button::create(_("Speichern")) ?> </div> -</form> \ No newline at end of file +</form> diff --git a/views/presenting/_cloud_tag.php b/views/presenting/_cloud_tag.php index c3b41745bac6f8216afa30b2b015cf4d242201ff..3952a5be0cfecd7edd9ea6507433ee67ca203fd0 100755 --- a/views/presenting/_cloud_tag.php +++ b/views/presenting/_cloud_tag.php @@ -1,7 +1,7 @@ <? if ($tag) : ?> <div style="font-size: <?= (double) ($tag['number'] / $max) * 6 ?>em;"> - <a href="<?= URLHelper::getLink("plugins.php/pluginmarket/presenting/all", array('tag' => $tag['tag'])) ?>"> + <a href="<?= URLHelper::getLink("plugins.php/pluginmarket/presenting/all", ['tag' => $tag['tag']]) ?>"> <?= htmlReady($tag['tag']) ?> </a> </div> -<? endif ?> \ No newline at end of file +<? endif ?> diff --git a/views/presenting/details.php b/views/presenting/details.php index 064fa1de87eb4fab680fb163cc076282aad57c4e..f4f8452b25625d67ed404956c4b165452797de66 100755 --- a/views/presenting/details.php +++ b/views/presenting/details.php @@ -1,12 +1,12 @@ <? //OpenGraph attributes -PageLayout::addHeadElement("meta", array('property' => "og:site_name", 'content' => _("Stud.IP Plugin-Marktplatz"))); -PageLayout::addHeadElement("meta", array('property' => "og:type", 'content' => "article")); -PageLayout::addHeadElement("meta", array('property' => "og:title", 'content' => $marketplugin['name'])); -PageLayout::addHeadElement("meta", array('property' => "og:description", 'content' => $marketplugin['short_description'])); +PageLayout::addHeadElement("meta", ['property' => "og:site_name", 'content' => _("Stud.IP Plugin-Marktplatz")]); +PageLayout::addHeadElement("meta", ['property' => "og:type", 'content' => "article"]); +PageLayout::addHeadElement("meta", ['property' => "og:title", 'content' => $marketplugin['name']]); +PageLayout::addHeadElement("meta", ['property' => "og:description", 'content' => $marketplugin['short_description']]); $image = $marketplugin->images->first(); if ($image) { - PageLayout::addHeadElement("meta", array('property' => "og:image", 'content' => $image->getURL(true))); + PageLayout::addHeadElement("meta", ['property' => "og:image", 'content' => $image->getURL(true)]); } ?> @@ -37,7 +37,7 @@ if ($image) { <? endforeach ?> <? if ($marketplugin->isWritable()) : ?> <div> - <a href="<?= PluginEngine::getLink($plugin, array(), "myplugins/edit_images/". $marketplugin->getId()) ?>" data-dialog title="<?= _("Galerie bearbeiten / neue Bilder hinzufügen") ?>"> + <a href="<?= PluginEngine::getLink($plugin, [], "myplugins/edit_images/". $marketplugin->getId()) ?>" data-dialog title="<?= _("Galerie bearbeiten / neue Bilder hinzufügen") ?>"> <?= Icon::create('add')->asImg(20) ?> </a> </div> @@ -49,14 +49,14 @@ if ($image) { <ul class="plugin-usages"> <? foreach ($marketplugin['uses'] as $use): ?> <li> - <a href="<?= PluginEngine::getLink($plugin, array('search' => htmlReady($use->name)), "presenting/all") ?>"> + <a href="<?= PluginEngine::getLink($plugin, ['search' => $use->name], "presenting/all") ?>"> <?= htmlReady($use->name) ?> </a> <? if ($use->plugin->isWritable(User::findCurrent()->id)): ?> (<?= ObjectdisplayHelper::link($use->user) ?>) <? endif; ?> <? if ($use->isEditable()): ?> - <a href="<?= PluginEngine::getLink($plugin, array(), "presenting/delete_usage/" . $use->id) ?>"> + <a href="<?= PluginEngine::getLink($plugin, [], "presenting/delete_usage/" . $use->id) ?>"> <?= Icon::create('trash')->asImg(20) ?> </a> <? endif; ?> @@ -90,7 +90,7 @@ if ($image) { <div> <? if ($author) : ?> <a href="<?= URLHelper::getLink('dispatch.php/profile', ['username' => $author['username']]) ?>" style="text-align: center; display: inline-block; vertical-align: top;"> - <?= Avatar::getAvatar($marketplugin['user_id'])->getImageTag(Avatar::MEDIUM, array('style' => "display: block;")) ?> + <?= Avatar::getAvatar($marketplugin['user_id'])->getImageTag(Avatar::MEDIUM, ['style' => "display: block;"]) ?> <?= htmlReady($author->getFullName()) ?> </a> <? else : ?> @@ -101,8 +101,8 @@ if ($image) { <? foreach ($marketplugin->more_users as $user) : ?> <li> <div> - <a href="<?= URLHelper::getLink("dispatch.php/profile", array('username' => $user['username'])) ?>" style="text-align: center; display: inline-block; vertical-align: top;"> - <?= Avatar::getAvatar($user->getId())->getImageTag(Avatar::MEDIUM, array('style' => "display: block;")) ?> + <a href="<?= URLHelper::getLink("dispatch.php/profile", ['username' => $user['username']]) ?>" style="text-align: center; display: inline-block; vertical-align: top;"> + <?= Avatar::getAvatar($user->getId())->getImageTag(Avatar::MEDIUM, ['style' => "display: block;"]) ?> <?= htmlReady($user->getFullName()) ?> </a> </div> @@ -276,7 +276,7 @@ if ($image) { <div class="author"> <div style="float: right;"><?= date("j.n.Y", $review['chdate']) ?></div> <?= sprintf(_("Rezension von %s"), $GLOBALS['user']->id !== "nobody" - ? '<a style="color: white;" href="'.URLHelper::getLink("dispatch.php/profile", array('username' => get_username($review['user_id']))).'">'.Icon::create("link-intern", "info_alt")->asImg("16px", array('class' => "text-bottom"))." ".htmlReady(get_fullname($review['user_id'])).'</a>' + ? '<a style="color: white;" href="'.URLHelper::getLink("dispatch.php/profile", ['username' => get_username($review['user_id'])]).'">'.Icon::create("link-intern", "info_alt")->asImg(['class' => "text-bottom"])." ".htmlReady(get_fullname($review['user_id'])).'</a>' : htmlReady(get_fullname($review['user_id'])) ) ?>: </div> <div> @@ -302,14 +302,14 @@ if ($image) { <div style="text-align: center"> <? if ($marketplugin->isWritable()) : ?> - <?= \Studip\LinkButton::create(_("Plugin löschen"), PluginEngine::getURL($plugin, array(), 'myplugins/delete/' . $marketplugin->getId()), array('data-dialog' => 1)) ?> - <?= \Studip\LinkButton::create(_("Bearbeiten"), PluginEngine::getURL($plugin, array(), "myplugins/edit/" . $marketplugin->getId()), array('data-dialog' => 1)) ?> - <?= \Studip\LinkButton::create(_("Release hinzufügen"), PluginEngine::getURL($plugin, array(), "myplugins/add_release/" . $marketplugin->getId()), array('data-dialog' => 1)) ?> + <?= \Studip\LinkButton::create(_("Plugin löschen"), PluginEngine::getURL($plugin, [], 'myplugins/delete/' . $marketplugin->getId()), ['data-dialog' => '']) ?> + <?= \Studip\LinkButton::create(_("Bearbeiten"), PluginEngine::getURL($plugin, [], "myplugins/edit/" . $marketplugin->getId()), ['data-dialog' => '']) ?> + <?= \Studip\LinkButton::create(_("Release hinzufügen"), PluginEngine::getURL($plugin, [], "myplugins/add_release/" . $marketplugin->getId()), ['data-dialog' => '']) ?> <? endif ?> <? if (!$marketplugin->isWritable()) : ?> - <?= \Studip\LinkButton::create(_("Bewertung schreiben"), $controller->url_for('presenting/review/' . $marketplugin->getId()), array('data-dialog' => 1)) ?> + <?= \Studip\LinkButton::create(_("Bewertung schreiben"), $controller->url_for('presenting/review/' . $marketplugin->getId()), ['data-dialog' => '']) ?> <? endif ?> <? if ($marketplugin['user_id'] !== $GLOBALS['user']->id) : ?> - <?= \Studip\LinkButton::create(_("Plugin abonnieren"), PluginEngine::getURL($plugin, array(), "presenting/register_for_pluginnews/" . $marketplugin->getId()), array('title' => _("Neuigkeiten des Plugins per Nachricht bekommen."), 'data-dialog' => "1")) ?> + <?= \Studip\LinkButton::create(_("Plugin abonnieren"), PluginEngine::getURL($plugin, [], "presenting/register_for_pluginnews/" . $marketplugin->getId()), ['title' => _("Neuigkeiten des Plugins per Nachricht bekommen."), 'data-dialog' => "1"]) ?> <? endif ?> </div> diff --git a/views/presenting/propose_usage.php b/views/presenting/propose_usage.php index a6707de7210be5ce545847da7af2856f8cdbf065..bc0bf1b95718716aa873ffc01f32a1d53df2449c 100755 --- a/views/presenting/propose_usage.php +++ b/views/presenting/propose_usage.php @@ -14,7 +14,7 @@ <h3><?= _('Vorschläge') ?></h3> <p class="usage-proposes"> <? foreach ($most_used as $used): ?> - <a class="usage-proposal" href="<?= $controller->url_for('presenting/propose_usage/' . $plugin->id, array('usage' => $used)) ?>"> + <a class="usage-proposal" href="<?= $controller->link_for('presenting/propose_usage/' . $plugin->id, ['usage' => $used]) ?>"> <?= htmlReady($used) ?> </a> <? endforeach; ?> diff --git a/views/update/usage.php b/views/update/usage.php index 3e31f3c74cace2b1d7403b544874be90e37a9aa3..4a9f74ff53302dfb319135e247977cd94dc82ad5 100755 --- a/views/update/usage.php +++ b/views/update/usage.php @@ -1,4 +1,4 @@ -<form class="studip_form" method="post" action="<?= PluginEngine::getLink($plugin, array(), 'update/save_usage/') ?>"> +<form class="studip_form" method="post" action="<?= PluginEngine::getLink($plugin, [], 'update/save_usage/') ?>"> <fieldset> <legend> <?= _('Pluginnutzung') ?> @@ -24,4 +24,3 @@ <?= Studip\Button::create(_('Eintragen')) ?> </fieldset> </form> -