From 57aac306a11b4de165d8e6bca2d3c17964e9a805 Mon Sep 17 00:00:00 2001
From: Moritz Strohm <strohm@data-quest.de>
Date: Tue, 8 Aug 2023 16:10:04 +0000
Subject: [PATCH] Rename OwnCloudPlugin to NextcloudPlugin, fixes #19

---
 ...gin.class.php => NextcloudPlugin.class.php | 46 +++++-----
 .../{OwncloudFile.php => NextcloudFile.php}   | 50 +++++------
 ...OwncloudFolder.php => NextcloudFolder.php} | 90 +++++++++----------
 classes/OAuth.class.php                       | 72 +++++++--------
 cli/migrate_config_from_owncloud_plugin.php   | 10 +++
 controllers/configure.php                     | 22 ++---
 controllers/file.php                          | 18 ++--
 controllers/oauth.php                         | 44 ++++-----
 migrations/01_init_plugin.php                 | 37 ++++++++
 ...secure_ssl.php => 02_add_unsecure_ssl.php} |  6 +-
 ...custom_name.php => 03_add_custom_name.php} |  8 +-
 migrations/04_migrate_plugin_name.php         | 83 +++++++++++++++++
 migrations/1_init_plugin.php                  | 38 --------
 plugin.manifest                               |  6 +-
 readme.md                                     | 37 ++++----
 views/configure/myarea.php                    | 44 ++++-----
 views/file/edit.php                           | 15 +---
 views/file/update.php                         | 13 ++-
 18 files changed, 359 insertions(+), 280 deletions(-)
 rename OwnCloudPlugin.class.php => NextcloudPlugin.class.php (81%)
 rename classes/{OwncloudFile.php => NextcloudFile.php} (89%)
 rename classes/{OwncloudFolder.php => NextcloudFolder.php} (87%)
 create mode 100644 cli/migrate_config_from_owncloud_plugin.php
 create mode 100755 migrations/01_init_plugin.php
 rename migrations/{2_add_unsecure_ssl.php => 02_add_unsecure_ssl.php} (59%)
 rename migrations/{3_add_custom_name.php => 03_add_custom_name.php} (54%)
 create mode 100644 migrations/04_migrate_plugin_name.php
 delete mode 100755 migrations/1_init_plugin.php

diff --git a/OwnCloudPlugin.class.php b/NextcloudPlugin.class.php
similarity index 81%
rename from OwnCloudPlugin.class.php
rename to NextcloudPlugin.class.php
index 856e67b..505edc3 100755
--- a/OwnCloudPlugin.class.php
+++ b/NextcloudPlugin.class.php
@@ -1,29 +1,29 @@
 <?php
 
 require_once __DIR__."/classes/OAuth.class.php";
-require_once __DIR__."/classes/OwncloudFile.php";
-require_once __DIR__."/classes/OwncloudFolder.php";
+require_once __DIR__ . "/classes/NextcloudFile.php";
+require_once __DIR__ . "/classes/NextcloudFolder.php";
 
-class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
+class NextcloudPlugin extends StudIPPlugin implements FilesystemPlugin {
 
 
     public function __construct()
     {
         //Make the plugin classes available:
-        class_exists('Owncloud\OAuth');
-        class_exists('OwncloudFile');
-        class_exists('OwncloudFolder');
+        class_exists('Nextcloud\OAuth');
+        class_exists('NextcloudFile');
+        class_exists('NextcloudFolder');
         parent::__construct();
     }
 
     public function getFileSelectNavigation() : Navigation
     {
-        $nav = new Navigation(Config::get()->OWNCLOUD_NAME);
+        $nav = new Navigation(Config::get()->NEXTCLOUD_NAME);
         $nav->setImage(Icon::create("cloud", "clickable"));
         return $nav;
     }
 
-    public function getFolder($folder_id = null) : ?OwncloudFolder
+    public function getFolder($folder_id = null) : ?NextcloudFolder
     {
         if (Navigation::hasItem('/files/my_files')) {
             Navigation::activateItem('/files/my_files');
@@ -40,7 +40,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
         $folder_path = explode("/", $folder_id);
         $name = rawurldecode(array_pop($folder_path));
         $parent_folder_id = implode("/", $folder_path);
-        return new OwncloudFolder(
+        return new NextcloudFolder(
             [
                 'id' => $folder_id,
                 'name' => $name,
@@ -57,7 +57,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
         $args = func_get_args();
         $file_id = implode("/", array_map("rawurlencode", $args));
 
-        $url = Config::get()->OWNCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER;
+        $url = Config::get()->NEXTCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER;
         if ($url[strlen($url) - 1] !== "/") {
             $url .= "/";
         }
@@ -65,16 +65,16 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
 
 
         $header = array();
-        $header[] = OwnCloudFolder::getAuthHeader();
+        $header[] = NextcloudFolder::getAuthHeader();
 
         $r = curl_init();
         curl_setopt($r, CURLOPT_CUSTOMREQUEST, "GET");
         curl_setopt($r, CURLOPT_URL, $webdav . $file_id);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
@@ -89,7 +89,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
 
     /**
      * @param $file_id This is a path to the file. Remind that the chunks of this path need to be rawurlencoded!
-     * @param bool $with_blob Should OwnCloudPlugin retrieve the blob of the file as well?
+     * @param bool $with_blob Should NextcloudPlugin retrieve the blob of the file as well?
      * @return FileType|null Returns the FileRef on success and null if the file doesn't exist.
      */
     public function getPreparedFile($file_id, $with_blob = false) : ?FileType
@@ -113,7 +113,7 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
             'range_id' => $this->getPluginName()
         ];
 
-        $folder = new OwncloudFolder(
+        $folder = new NextcloudFolder(
             $data,
             $this->getPluginId()
         );
@@ -149,31 +149,31 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
 
     public function isSource()
     {
-        return UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACTIVATED;
+        return UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACTIVATED;
     }
 
     public function isPersonalFileArea()
     {
-        return UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACTIVATED;
+        return UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACTIVATED;
     }
 
     protected function getType($id)
     {
-        $url = Config::get()->OWNCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER;
+        $url = Config::get()->NEXTCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER;
         if ($url[strlen($url) - 1] !== "/") {
             $url .= "/";
         }
         $webdav = $url . "remote.php/webdav/";
         $header = array();
-        $header[] = OwnCloudFolder::getAuthHeader();
+        $header[] = NextcloudFolder::getAuthHeader();
         $r = curl_init();
         curl_setopt($r, CURLOPT_CUSTOMREQUEST, "PROPFIND");
         curl_setopt($r, CURLOPT_URL, $webdav.$id);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
         $xml = curl_exec($r);
diff --git a/classes/OwncloudFile.php b/classes/NextcloudFile.php
similarity index 89%
rename from classes/OwncloudFile.php
rename to classes/NextcloudFile.php
index 0857b87..a76f9d9 100644
--- a/classes/OwncloudFile.php
+++ b/classes/NextcloudFile.php
@@ -1,6 +1,6 @@
 <?php
 
-class OwncloudFile implements FileType
+class NextcloudFile implements FileType
 {
 
     public $data = [];
@@ -169,26 +169,26 @@ class OwncloudFile implements FileType
         $actionMenu = ActionMenu::get();
         $actionMenu->addLink(
             URLHelper::getURL("dispatch.php/file/details/{$this->getId()}", [
-                'to_plugin' => "OwnCloudPlugin",
-                'from_plugin' => "OwnCloudPlugin",
+                'to_plugin' => "NextcloudPlugin",
+                'from_plugin' => "NextcloudPlugin",
                 'file_navigation' => 1
             ]),
-            dgettext('OwnCloudPlugin', 'Info'),
+            dgettext('NextcloudPlugin', 'Info'),
             Icon::create('info-circle', Icon::ROLE_CLICKABLE, ['size' => 20]),
             ['data-dialog' => ''],
             'file-display-info'
         );
         if ($this->isEditable($GLOBALS['user']->id)) {
             $actionMenu->addLink(
-                PluginEngine::getURL("owncloudplugin", [], 'file/edit/' . $this->getId()),
-                dgettext('OwnCloudPlugin', 'Datei bearbeiten'),
+                PluginEngine::getURL("NextcloudPlugin", [], 'file/edit/' . $this->getId()),
+                dgettext('NextcloudPlugin', 'Datei bearbeiten'),
                 Icon::create('edit', Icon::ROLE_CLICKABLE, ['size' => 20]),
                 ['data-dialog' => ''],
                 'file-edit'
             );
             $actionMenu->addLink(
-                PluginEngine::getURL("owncloudplugin", [], 'file/update/' . $this->getId()),
-                dgettext('OwnCloudPlugin', 'Datei aktualisieren'),
+                PluginEngine::getURL("NextcloudPlugin", [], 'file/update/' . $this->getId()),
+                dgettext('NextcloudPlugin', 'Datei aktualisieren'),
                 Icon::create('refresh', Icon::ROLE_CLICKABLE, ['size' => 20]),
                 ['data-dialog' => ''],
                 'file-update'
@@ -197,7 +197,7 @@ class OwncloudFile implements FileType
         if ($this->isWritable($GLOBALS['user']->id)) {
             $actionMenu->addLink(
                 URLHelper::getURL('dispatch.php/file/choose_destination/move/' . $this->getId()),
-                dgettext('OwnCloudPlugin', 'Datei verschieben'),
+                dgettext('NextcloudPlugin', 'Datei verschieben'),
                 Icon::create('file+move_right', Icon::ROLE_CLICKABLE, ['size' => 20]),
                 ['data-dialog' => 'size=auto'],
                 'file-move'
@@ -206,14 +206,14 @@ class OwncloudFile implements FileType
         if ($this->isDownloadable($GLOBALS['user']->id) && $GLOBALS['user']->id !== 'nobody') {
             $actionMenu->addLink(
                 URLHelper::getURL('dispatch.php/file/choose_destination/copy/' . $this->getId()),
-                dgettext('OwnCloudPlugin', 'Datei kopieren'),
+                dgettext('NextcloudPlugin', 'Datei kopieren'),
                 Icon::create('file+add', Icon::ROLE_CLICKABLE, ['size' => 20]),
                 ['data-dialog' => 'size=auto'],
                 'file-copy'
             );
             $actionMenu->addLink(
                 $this->getDownloadURL(),
-                dgettext('OwnCloudPlugin', 'Link kopieren'),
+                dgettext('NextcloudPlugin', 'Link kopieren'),
                 Icon::create('group'),
                 ['class' => 'copyable-link'],
                 'link-to-clipboard'
@@ -222,11 +222,11 @@ class OwncloudFile implements FileType
         if ($this->isWritable($GLOBALS['user']->id)) {
             $actionMenu->addButton(
                 'delete',
-                dgettext('OwnCloudPlugin', 'Datei löschen'),
+                dgettext('NextcloudPlugin', 'Datei löschen'),
                 Icon::create('trash', Icon::ROLE_CLICKABLE, ['size' => 20]),
                 [
                     'formaction'   => URLHelper::getURL("dispatch.php/file/delete/{$this->getId()}"),
-                    'data-confirm' => sprintf(dgettext('OwnCloudPlugin', 'Soll die Datei „%s“ wirklich gelöscht werden?'), $this->getFilename()),
+                    'data-confirm' => sprintf(dgettext('NextcloudPlugin', 'Soll die Datei „%s“ wirklich gelöscht werden?'), $this->getFilename()),
                 ]
             );
         }
@@ -319,10 +319,10 @@ class OwncloudFile implements FileType
      */
     public function convertToStandardFile()
     {
-        $webdav = OwncloudFolder::getWebDavURL();
+        $webdav = NextcloudFolder::getWebDavURL();
 
         $header = array();
-        $header[] = OwnCloudFolder::getAuthHeader();
+        $header[] = NextcloudFolder::getAuthHeader();
 
         $url = $webdav.$this->getFolderType()->getId()."/".$this->getFilename();
 
@@ -331,16 +331,16 @@ class OwncloudFile implements FileType
         curl_setopt($r, CURLOPT_URL, $url);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
         $content = curl_exec($r);
 
         curl_close($r);
-        $path = $GLOBALS['TMP_PATH']."/owncloudplugin_".md5(uniqid());
+        $path = $GLOBALS['TMP_PATH']."/nextcloudplugin_".md5(uniqid());
         file_put_contents(
             $path,
             $content
@@ -350,7 +350,7 @@ class OwncloudFile implements FileType
             'type'     => $this->getMimeType(),
             'size'     => $this->getSize(),
             'tmp_name' => $path
-        ], "owncloud");
+        ], "nextcloud");
     }
 
     /**
@@ -415,12 +415,12 @@ class OwncloudFile implements FileType
 
     public function update($new_filepath)
     {
-        $webdav = OwnCloudFolder::getWebDavURL();
+        $webdav = NextcloudFolder::getWebDavURL();
 
         $file_path = $this->getFolderType()->getId() . (mb_strlen($this->getFolderType()->getId()) ? '/' : '') . rawurlencode($this->getFilename());
 
         $header = array();
-        $header[] = OwnCloudFolder::getAuthHeader();
+        $header[] = NextcloudFolder::getAuthHeader();
 
         $fh_res = fopen($new_filepath, 'r');
 
@@ -431,9 +431,9 @@ class OwncloudFile implements FileType
         curl_setopt($r, CURLOPT_INFILE, $fh_res);
         curl_setopt($r, CURLOPT_INFILESIZE, filesize($new_filepath));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
         curl_exec($r);
diff --git a/classes/OwncloudFolder.php b/classes/NextcloudFolder.php
similarity index 87%
rename from classes/OwncloudFolder.php
rename to classes/NextcloudFolder.php
index 2e23a1a..ca8d41b 100755
--- a/classes/OwncloudFolder.php
+++ b/classes/NextcloudFolder.php
@@ -1,12 +1,12 @@
 <?php
 
-class OwncloudFolder extends VirtualFolderType {
+class NextcloudFolder extends VirtualFolderType {
 
     protected bool $did_propfind = false;
 
     public static function availableInRange($range_id_or_object, $user_id)
     {
-        return $range_id_or_object == 'OwnCloudPlugin';
+        return $range_id_or_object == 'NextcloudPlugin';
     }
 
     public function isWritable($user_id)
@@ -56,9 +56,9 @@ class OwncloudFolder extends VirtualFolderType {
             curl_setopt($r, CURLOPT_URL, $webdav . $old_id);
             curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
             curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-            curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-            curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-            if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+            curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+            curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+            if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
                 curl_setopt($r, CURLOPT_VERBOSE, true);
             }
             curl_exec($r);
@@ -88,9 +88,9 @@ class OwncloudFolder extends VirtualFolderType {
         curl_setopt($r, CURLOPT_URL, $webdav . $file_ref_id);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
@@ -102,7 +102,7 @@ class OwncloudFolder extends VirtualFolderType {
 
     public function addFile(FileType $file, $user_id = null)
     {
-        if ($file instanceof OwncloudFile) {
+        if ($file instanceof NextcloudFile) {
             return $this->copyFile($file->getID());
         }
         $webdav = $this->getWebDavURL();
@@ -140,16 +140,16 @@ class OwncloudFolder extends VirtualFolderType {
         curl_setopt($r, CURLOPT_INFILE, $fh_res);
         curl_setopt($r, CURLOPT_INFILESIZE, filesize($data));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
         curl_exec($r);
         curl_close($r);
         fclose($fh_res);
 
-        $plugin = PluginManager::getInstance()->getPlugin("OwnCloudPlugin");
+        $plugin = PluginManager::getInstance()->getPlugin("NextcloudPlugin");
         return $plugin->getPreparedFile($file_ref_id);
     }
 
@@ -187,16 +187,16 @@ class OwncloudFolder extends VirtualFolderType {
         curl_setopt($r, CURLOPT_URL, $webdav . $file_ref_id);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
         curl_exec($r);
         curl_close($r);
 
-        $plugin = PluginManager::getInstance()->getPlugin("OwnCloudPlugin");
+        $plugin = PluginManager::getInstance()->getPlugin("NextcloudPlugin");
         return $plugin->getPreparedFile($destination);
     }
 
@@ -233,16 +233,16 @@ class OwncloudFolder extends VirtualFolderType {
         curl_setopt($r, CURLOPT_URL, $webdav . $file_ref_id);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
         curl_exec($r);
         curl_close($r);
 
-        $plugin = PluginManager::getInstance()->getPlugin("OwnCloudPlugin");
+        $plugin = PluginManager::getInstance()->getPlugin("NextcloudPlugin");
         return $plugin->getPreparedFile($destination);
     }
 
@@ -279,16 +279,16 @@ class OwncloudFolder extends VirtualFolderType {
         curl_setopt($r, CURLOPT_URL, $webdav . $file_ref_id);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
         curl_exec($r);
         curl_close($r);
 
-        $plugin = PluginManager::getInstance()->getPlugin("OwnCloudPlugin");
+        $plugin = PluginManager::getInstance()->getPlugin("NextcloudPlugin");
         return $plugin->getPreparedFile($destination);
     }
 
@@ -326,9 +326,9 @@ class OwncloudFolder extends VirtualFolderType {
         curl_setopt($r, CURLOPT_URL, $webdav . $destination);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
@@ -336,13 +336,13 @@ class OwncloudFolder extends VirtualFolderType {
         $status = curl_getinfo($r, CURLINFO_HTTP_CODE);
         curl_close($r);
 
-        $plugin = PluginManager::getInstance()->getPlugin("OwnCloudPlugin");
+        $plugin = PluginManager::getInstance()->getPlugin("NextcloudPlugin");
         return (($status >= 200) && ($status < 300)) ? $plugin->getFolder($destination) : false;
     }
 
     public static function getWebDavURL() : string
     {
-        $url = Config::get()->OWNCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER;
+        $url = Config::get()->NEXTCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER;
         if ($url[strlen($url) - 1] !== "/") {
             $url .= "/";
         }
@@ -367,22 +367,22 @@ class OwncloudFolder extends VirtualFolderType {
         curl_setopt($r, CURLOPT_URL, $webdav . $this->id);
         curl_setopt($r, CURLOPT_HTTPHEADER, ($header));
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
         $xml = curl_exec($r);
         $info = curl_getinfo($r);
-        if ($info['http_code'] === 401 && \Owncloud\OAuth::hasAccessToken()) {
-            \Owncloud\OAuth::removeAccessToken();
-            PageLayout::postError(sprintf(dgettext('OwnCloudPlugin', 'Die Zugangsberechtigung zu %s ist abgelaufen. Erneuern Sie die Verbindung zu %s.'), Config::get()->OWNCLOUD_NAME, Config::get()->OWNCLOUD_NAME));
+        if ($info['http_code'] === 401 && \Nextcloud\OAuth::hasAccessToken()) {
+            \Nextcloud\OAuth::removeAccessToken();
+            PageLayout::postError(sprintf(dgettext('NextcloudPlugin', 'Die Zugangsberechtigung zu %s ist abgelaufen. Erneuern Sie die Verbindung zu %s.'), Config::get()->NEXTCLOUD_NAME, Config::get()->NEXTCLOUD_NAME));
         }
         curl_close($r);
 
         if (!$xml) {
-            PageLayout::postError(sprintf(dgettext('OwnCloudPlugin', "Es konnte keine Daten von %s gelesen werden."), Config::get()->OWNCLOUD_NAME));
+            PageLayout::postError(sprintf(dgettext('NextcloudPlugin', "Es konnte keine Daten von %s gelesen werden."), Config::get()->NEXTCLOUD_NAME));
             $this->subfolders = array();
             $this->files = array();
             $this->did_propfind = true;
@@ -466,17 +466,17 @@ class OwncloudFolder extends VirtualFolderType {
             }
             if (trim($file_attributes['name'])) {
                 if ($file_attributes['type'] === "folder") {
-                    $this->subfolders[] = new OwncloudFolder(array(
+                    $this->subfolders[] = new NextcloudFolder(array(
                         'id' => ($this->id ? $this->id . "/" : "") . rawurlencode($file_attributes['name']),
                         'name' => $file_attributes['name'],
                         'parent_id' => $this->id,
                         'user_id' => $GLOBALS['user']->id,
                         'range_type' => $this->plugin_id,
-                        'range_id' => 'OwnCloudPlugin'
+                        'range_id' => 'NextcloudPlugin'
                     ), $this->plugin_id);
                 } else {
                     $content_type = $file_attributes['contenttype'] ?: get_mime_type($file_attributes['name']);
-                    $this->files[] = new OwncloudFile([
+                    $this->files[] = new NextcloudFile([
                         'id' => ($this->id ? $this->id . "/" : "") . rawurlencode($file_attributes['name']),
                         'name' => $file_attributes['name'],
                         'size' => $file_attributes['size'],
@@ -484,7 +484,7 @@ class OwncloudFolder extends VirtualFolderType {
                         'description' => "",
                         'user_id' => $GLOBALS['user']->id,
                         'chdate' => $file_attributes['chdate'],
-                        'download_url' => URLHelper::getURL("plugins.php/owncloudplugin/download/" . ($this->id ? $this->id . "/" : "") . rawurlencode($file_attributes['name']))
+                        'download_url' => URLHelper::getURL("plugins.php/NextcloudPlugin/download/" . ($this->id ? $this->id . "/" : "") . rawurlencode($file_attributes['name']))
                     ], $this);
                 }
             }
@@ -507,7 +507,7 @@ class OwncloudFolder extends VirtualFolderType {
     public function setDataFromEditTemplate($request)
     {
         if (!$request['name']) {
-            return MessageBox::error(dgettext('OwnCloudPlugin', 'Die Bezeichnung des Ordners fehlt.'));
+            return MessageBox::error(dgettext('NextcloudPlugin', 'Die Bezeichnung des Ordners fehlt.'));
         }
 
         $plugin = PluginEngine::getPlugin($request["from_plugin"]);
@@ -529,7 +529,7 @@ class OwncloudFolder extends VirtualFolderType {
         if ($this->id == $this->parent_id) {
             return null;
         }
-        $plugin = PluginEngine::getPlugin('OwnCloudPlugin');
+        $plugin = PluginEngine::getPlugin('NextcloudPlugin');
         return $plugin->getFolder($this->parent_id);
     }
 
@@ -555,7 +555,7 @@ class OwncloudFolder extends VirtualFolderType {
 
     static public function getAuthHeader()
     {
-        return "Authorization: Bearer " . \Owncloud\OAuth::getAccessToken();
+        return "Authorization: Bearer " . \Nextcloud\OAuth::getAccessToken();
     }
 
     public function getAdditionalColumns()
@@ -571,7 +571,7 @@ class OwncloudFolder extends VirtualFolderType {
 
     public function validateUpload(FileType $file, $user_id)
     {
-        if ($file instanceof OwncloudFile) {
+        if ($file instanceof NextcloudFile) {
             //A file in the Nextcloud/Owncloud shall be validated.
             //That is simple:
             return true;
diff --git a/classes/OAuth.class.php b/classes/OAuth.class.php
index 8f1eed6..2f7f11f 100755
--- a/classes/OAuth.class.php
+++ b/classes/OAuth.class.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Owncloud;
+namespace Nextcloud;
 
 class OAuth {
 
@@ -10,19 +10,19 @@ class OAuth {
 
         $accessToken = self::getAccessToken();
         if (!$accessToken) {
-            throw new \Exception(sprintf("No valid access token. Please refresh your connection to %s.", Config::get()->OWNCLOUD_NAME));
+            throw new \Exception(sprintf("No valid access token. Please refresh your connection to %s.", Config::get()->NEXTCLOUD_NAME));
         }
 
-        $header[] = OwnCloudFolder::getAuthHeader();
+        $header[] = \NextcloudFolder::getAuthHeader();
 
         $r = curl_init();
         curl_setopt($r, CURLOPT_URL, $url);
         curl_setopt($r, CURLOPT_POST, $type === "get" ? 0 : 1);
         curl_setopt($r, CURLOPT_HTTPHEADER, $header);
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) \Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) \Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) \Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) \Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
@@ -39,16 +39,16 @@ class OAuth {
 
     static public function isReady() : bool
     {
-        return self::hasAccessToken() || \Config::get()->OWNCLOUD_REFRESH_TOKEN;
+        return self::hasAccessToken() || \Config::get()->NEXTCLOUD_REFRESH_TOKEN;
     }
 
     static public function getAccessToken()
     {
         if (self::hasAccessToken()) {
-            return \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACCESS_TOKEN;
-        } elseif(\UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_REFRESH_TOKEN) {
+            return \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACCESS_TOKEN;
+        } elseif(\UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_REFRESH_TOKEN) {
             self::refreshAccessToken();
-            return \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACCESS_TOKEN;
+            return \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACCESS_TOKEN;
         } else {
             return false;
         }
@@ -56,18 +56,18 @@ class OAuth {
 
     static public function hasAccessToken() : bool
     {
-        return \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACCESS_TOKEN
-            && (\UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACCESS_TOKEN_EXPIRES >= time());
+        return \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACCESS_TOKEN
+            && (\UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACCESS_TOKEN_EXPIRES >= time());
     }
 
     static public function refreshAccessToken() : void
     {
-        $owncloud = \Config::get()->OWNCLOUD_ENDPOINT ?: \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER;
-        if ($owncloud[strlen($owncloud) - 1] !== "/") {
-            $owncloud .= "/";
+        $nextcloud = \Config::get()->NEXTCLOUD_ENDPOINT ?: \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER;
+        if ($nextcloud[strlen($nextcloud) - 1] !== "/") {
+            $nextcloud .= "/";
         }
-        $client_id  = \Config::get()->OWNCLOUD_CLIENT_ID ?: \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_ID_USER; // The client ID assigned to you by the provider
-        $client_secret = \Config::get()->OWNCLOUD_CLIENT_SECRET ?: \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_SECRET_USER; // The client password assigned to you by the provider
+        $client_id  = \Config::get()->NEXTCLOUD_CLIENT_ID ?: \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_CLIENT_ID_USER; // The client ID assigned to you by the provider
+        $client_secret = \Config::get()->NEXTCLOUD_CLIENT_SECRET ?: \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_CLIENT_SECRET_USER; // The client password assigned to you by the provider
 
         $header = array();
 
@@ -76,22 +76,22 @@ class OAuth {
 
         $payload = array(
             'grant_type' => "refresh_token",
-            'refresh_token' => \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_REFRESH_TOKEN,
-            'code' => \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_REFRESH_TOKEN,
+            'refresh_token' => \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_REFRESH_TOKEN,
+            'code' => \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_REFRESH_TOKEN,
             'client_id' => $client_id,
             'client_secret' => $client_secret,
             'format' => "json",
-            'access_token' => \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACCESS_TOKEN
+            'access_token' => \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACCESS_TOKEN
         );
 
         $r = curl_init();
-        curl_setopt($r, CURLOPT_URL, $owncloud."index.php/apps/oauth2/api/v1/token");
+        curl_setopt($r, CURLOPT_URL, $nextcloud."index.php/apps/oauth2/api/v1/token");
         curl_setopt($r, CURLOPT_POST, 1);
         curl_setopt($r, CURLOPT_HTTPHEADER, $header);
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) \Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) \Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) \Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) \Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
@@ -105,15 +105,15 @@ class OAuth {
         if (!$json) {
             \URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']);
             //Muss den Nutzer weiterleiten auf den Server, wo der Nutzer die App freischaltet
-            $owncloud = \Config::get()->OWNCLOUD_ENDPOINT ?: \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER;
-            if ($owncloud[strlen($owncloud) - 1] !== "/") {
-                $owncloud .= "/";
+            $nextcloud = \Config::get()->NEXTCLOUD_ENDPOINT ?: \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER;
+            if ($nextcloud[strlen($nextcloud) - 1] !== "/") {
+                $nextcloud .= "/";
             }
             \URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']);
-            $client_id = \Config::get()->OWNCLOUD_CLIENT_ID ?: \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_ID_USER;
-            $redirect_uri = \URLHelper::getURL("plugin.php/owncloudplugin/oauth/receive_access_token", array(),  true);
+            $client_id = \Config::get()->NEXTCLOUD_CLIENT_ID ?: \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_CLIENT_ID_USER;
+            $redirect_uri = \URLHelper::getURL("plugin.php/NextcloudPlugin/oauth/receive_access_token", array(),  true);
 
-            $url = $owncloud."index.php/apps/oauth2/authorize";
+            $url = $nextcloud."index.php/apps/oauth2/authorize";
 
             $_SESSION['oauth2state'] = md5(uniqid());
             $url .= "?state=".urlencode($_SESSION['oauth2state'])
@@ -125,23 +125,23 @@ class OAuth {
             header("Location: ".$url);
             exit;
         } elseif (!empty($json['error'])) {
-            \PageLayout::postError(dgettext('OwnCloudPlugin', 'Authentifizierungsfehler:')." ".$json['error']);
+            \PageLayout::postError(dgettext('NextcloudPlugin', 'Authentifizierungsfehler:')." ".$json['error']);
         } else {
             if (\Studip\ENV === "development") {
                 \PageLayout::postInfo("Access-Token wurde erfolgreich erneuert.");
             }
             $config = \UserConfig::get($GLOBALS['user']->id);
-            $config->store("OWNCLOUD_ACCESS_TOKEN", $json['access_token']);
+            $config->store("NEXTCLOUD_ACCESS_TOKEN", $json['access_token']);
             if ($json['refresh_token']) {
-                $config->store("OWNCLOUD_REFRESH_TOKEN", $json['refresh_token']);
+                $config->store("NEXTCLOUD_REFRESH_TOKEN", $json['refresh_token']);
             }
-            $config->store("OWNCLOUD_ACCESS_TOKEN_EXPIRES", time() + $json['expires_in']);
+            $config->store("NEXTCLOUD_ACCESS_TOKEN_EXPIRES", time() + $json['expires_in']);
         }
     }
 
     static public function removeAccessToken() : void
     {
-        \UserConfig::get($GLOBALS['user']->id)->delete("OWNCLOUD_ACCESS_TOKEN");
-        \UserConfig::get($GLOBALS['user']->id)->delete("OWNCLOUD_REFRESH_TOKEN");
+        \UserConfig::get($GLOBALS['user']->id)->delete("NEXTCLOUD_ACCESS_TOKEN");
+        \UserConfig::get($GLOBALS['user']->id)->delete("NEXTCLOUD_REFRESH_TOKEN");
     }
 }
diff --git a/cli/migrate_config_from_owncloud_plugin.php b/cli/migrate_config_from_owncloud_plugin.php
new file mode 100644
index 0000000..bcdf37d
--- /dev/null
+++ b/cli/migrate_config_from_owncloud_plugin.php
@@ -0,0 +1,10 @@
+<?php
+
+require_once __DIR__ . '/../../../../../cli/studip_cli_env.inc.php';
+require_once __DIR__ . '/../migrations/04_migrate_plugin_name.php';
+
+
+$migration = new MigratePluginName();
+$migration->migrateConfigFromOwncloudPlugin();
+
+echo 'The configuration from the OwnCloudPlugin has been migrated.';
diff --git a/controllers/configure.php b/controllers/configure.php
index fbcc9f0..46803c7 100755
--- a/controllers/configure.php
+++ b/controllers/configure.php
@@ -9,34 +9,34 @@ class ConfigureController extends PluginController
         } elseif (Navigation::hasItem('/contents/files/my_files')) {
             Navigation::activateItem('/contents/files/my_files');
         }
-        PageLayout::setTitle(Config::get()->OWNCLOUD_NAME);
+        PageLayout::setTitle(Config::get()->NEXTCLOUD_NAME);
         if (Request::isPost() && Request::submitted("remove")) {
             $config = UserConfig::get($GLOBALS['user']->id);
-            $config->unsetValue("OWNCLOUD_ACCESS_TOKEN");
-            $config->unsetValue("OWNCLOUD_REFRESH_TOKEN");
-            $config->unsetValue("OWNCLOUD_ACTIVATED");
-            $config->unsetValue("OWNCLOUD_ACCESS_TOKEN_EXPIRES");
-            PageLayout::postSuccess(dgettext('OwnCloudPlugin', "Die Zugangsdaten zur Owncloud wurden gelöscht."));
+            $config->unsetValue("NEXTCLOUD_ACCESS_TOKEN");
+            $config->unsetValue("NEXTCLOUD_REFRESH_TOKEN");
+            $config->unsetValue("NEXTCLOUD_ACTIVATED");
+            $config->unsetValue("NEXTCLOUD_ACCESS_TOKEN_EXPIRES");
+            PageLayout::postSuccess(dgettext('NextcloudPlugin', "Die Zugangsdaten zur Nextcloud wurden gelöscht."));
             $this->redirect(URLHelper::getURL("dispatch.php/files"));
             return;
         }
         if (Request::isPost()) {
             $config = UserConfig::get($GLOBALS['user']->id);
-            $data = Request::getArray("owncloud");
+            $data = Request::getArray("nextcloud");
             foreach ($data as $key => $value) {
-                $config->store("OWNCLOUD_" . strtoupper($key) . ($key === "activated" ? "" : "_USER"), $value);
+                $config->store("NEXTCLOUD_" . strtoupper($key) . ($key === "activated" ? "" : "_USER"), $value);
             }
             if (!$data['activated']) {
-                $config->store("OWNCLOUD_ACTIVATED", 0);
+                $config->store("NEXTCLOUD_ACTIVATED", 0);
                 $this->redirect(URLHelper::getURL("dispatch.php/files"));
             } else {
-                if (\OwnCloud\OAuth::hasAccessToken()) {
+                if (\Nextcloud\OAuth::hasAccessToken()) {
                     $this->redirect(URLHelper::getURL("dispatch.php/files/system/" . $this->plugin->getPluginId()));
                 } else {
                     $this->redirect("oauth/request_access_token");
                 }
             }
-            PageLayout::postSuccess(dgettext('OwnCloudPlugin', "Die Konfiguration wurde gespeichert."));
+            PageLayout::postSuccess(dgettext('NextcloudPlugin', "Die Konfiguration wurde gespeichert."));
         }
     }
 }
diff --git a/controllers/file.php b/controllers/file.php
index c298320..580abbe 100644
--- a/controllers/file.php
+++ b/controllers/file.php
@@ -13,11 +13,11 @@ class FileController extends PluginController
      */
     public function edit_action($file_ref_id)
     {
-        $file_id = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], "plugins.php/owncloudplugin/file/edit/") + strlen("plugins.php/owncloudplugin/file/edit/"));
+        $file_id = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], "plugins.php/NextcloudPlugin/file/edit/") + strlen("plugins.php/NextcloudPlugin/file/edit/"));
         if (strpos($file_id, "?") !== false) {
             $file_id = substr($file_id, 0, strpos($file_id, "?"));
         }
-        $plugin = PluginManager::getInstance()->getPlugin("OwnCloudPlugin");
+        $plugin = PluginManager::getInstance()->getPlugin("NextcloudPlugin");
 
         $this->file = $plugin->getPreparedFile($file_id);
         $this->from_plugin = Request::get("from_plugin");
@@ -49,13 +49,13 @@ class FileController extends PluginController
             if ($this->errors) {
                 PageLayout::postError(
                     sprintf(
-                        dgettext('OwnCloudPlugin', 'Ein Fehler trat auf beim Ändern der Datei „%s“.'),
+                        dgettext('NextcloudPlugin', 'Ein Fehler trat auf beim Ändern der Datei „%s“.'),
                         htmlReady($this->file->getFilename())
                     ),
                     $this->errors
                 );
             } else {
-                PageLayout::postSuccess(dgettext('OwnCloudPlugin', 'Die Änderungen wurden gespeichert.'));
+                PageLayout::postSuccess(dgettext('NextcloudPlugin', 'Die Änderungen wurden gespeichert.'));
                 $this->redirect(URLHelper::getURL("dispatch.php/files/system/".$this->plugin->getPluginId()."/".$this->folder->getId()));
             }
         }
@@ -72,13 +72,13 @@ class FileController extends PluginController
      */
     public function update_action($file_ref_id)
     {
-        $file_id = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], "plugins.php/owncloudplugin/file/update/") + strlen("plugins.php/owncloudplugin/file/update/"));
+        $file_id = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], "plugins.php/NextcloudPlugin/file/update/") + strlen("plugins.php/NextcloudPlugin/file/update/"));
         if (strpos($file_id, "?") !== false) {
             $file_id = substr($file_id, 0, strpos($file_id, "?"));
         }
         $plugin = PluginManager::getInstance()->getPlugin(Request::get("from_plugin"));
         if (!$plugin) {
-            throw new Trails_Exception(404, dgettext('OwnCloudPlugin', 'Das Plugin existiert nicht.'));
+            throw new Trails_Exception(404, dgettext('NextcloudPlugin', 'Das Plugin existiert nicht.'));
         }
 
         $this->file = $plugin->getPreparedFile($file_id);
@@ -107,13 +107,13 @@ class FileController extends PluginController
                     );
                 }
             } else {
-                $this->errors[] = dgettext('OwnCloudPlugin', 'Es wurde keine neue Dateiversion gewählt.');
+                $this->errors[] = dgettext('NextcloudPlugin', 'Es wurde keine neue Dateiversion gewählt.');
             }
 
             if ($this->errors) {
                 PageLayout::postError(
                     sprintf(
-                        dgettext('OwnCloudPlugin', 'Ein Fehler trat auf beim Aktualisieren der Datei „%s“.'),
+                        dgettext('NextcloudPlugin', 'Ein Fehler trat auf beim Aktualisieren der Datei „%s“.'),
                         htmlReady($this->file_ref->name)
                     ),
                     $this->errors
@@ -121,7 +121,7 @@ class FileController extends PluginController
             } else {
                 PageLayout::postSuccess(
                     sprintf(
-                        dgettext('OwnCloudPlugin', 'Die Datei „%s“ wurde aktualisiert!'),
+                        dgettext('NextcloudPlugin', 'Die Datei „%s“ wurde aktualisiert!'),
                         htmlReady($this->file_ref->name)
                     )
                 );
diff --git a/controllers/oauth.php b/controllers/oauth.php
index c570af5..ceb1a2c 100755
--- a/controllers/oauth.php
+++ b/controllers/oauth.php
@@ -6,15 +6,15 @@ class OauthController extends PluginController
     {
         URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']);
         //Muss den Nutzer weiterleiten auf den Server, wo der Nutzer die App freischaltet
-        $owncloud = Config::get()->OWNCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER;
-        if ($owncloud[strlen($owncloud) - 1] !== "/") {
-            $owncloud .= "/";
+        $nextcloud = Config::get()->NEXTCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER;
+        if ($nextcloud[strlen($nextcloud) - 1] !== "/") {
+            $nextcloud .= "/";
         }
         URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']);
-        $client_id = Config::get()->OWNCLOUD_CLIENT_ID ?: UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_ID_USER;
-        $redirect_uri = PluginEngine::getURL($this->plugin, array(), "oauth/receive_access_token", true);
+        $client_id = Config::get()->NEXTCLOUD_CLIENT_ID ?: UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_CLIENT_ID_USER;
+        $redirect_uri = PluginEngine::getURL($this->plugin, [], "oauth/receive_access_token", true);
 
-        $url = $owncloud."index.php/apps/oauth2/authorize";
+        $url = $nextcloud."index.php/apps/oauth2/authorize";
 
         $_SESSION['oauth2state'] = md5(uniqid());
         $url .= "?state=".urlencode($_SESSION['oauth2state'])
@@ -30,9 +30,9 @@ class OauthController extends PluginController
     public function receive_access_token_action()
     {
         //Save the access token and refresh-token
-        $owncloud = Config::get()->OWNCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER;
-        if ($owncloud[strlen($owncloud) - 1] !== "/") {
-            $owncloud .= "/";
+        $nextcloud = Config::get()->NEXTCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER;
+        if ($nextcloud[strlen($nextcloud) - 1] !== "/") {
+            $nextcloud .= "/";
         }
 
         if (Request::get("state") !== $_SESSION['oauth2state']) {
@@ -40,10 +40,10 @@ class OauthController extends PluginController
         }
 
 
-        $client_id  = \Config::get()->OWNCLOUD_CLIENT_ID ?: \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_ID_USER; // The client ID assigned to you by the provider
-        $client_secret = \Config::get()->OWNCLOUD_CLIENT_SECRET ?: \UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_SECRET_USER; // The client password assigned to you by the provider
+        $client_id  = \Config::get()->NEXTCLOUD_CLIENT_ID ?: \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_CLIENT_ID_USER; // The client ID assigned to you by the provider
+        $client_secret = \Config::get()->NEXTCLOUD_CLIENT_SECRET ?: \UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_CLIENT_SECRET_USER; // The client password assigned to you by the provider
         URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']);
-        $redirect_uri = PluginEngine::getURL($this->plugin, array(), "oauth/receive_access_token", true);
+        $redirect_uri = PluginEngine::getURL($this->plugin, [], "oauth/receive_access_token", true);
 
         $payload = [
             'grant_type' => "authorization_code",
@@ -59,13 +59,13 @@ class OauthController extends PluginController
         $header[] = "Authorization: Basic ".base64_encode($client_id . ":" .$client_secret);
 
         $r = curl_init();
-        curl_setopt($r, CURLOPT_URL, $owncloud."index.php/apps/oauth2/api/v1/token?grant_type=authorization_code&code=".urlencode(Request::get("code"))."&redirect_uri=".urlencode($redirect_uri)); //nextcloud
+        curl_setopt($r, CURLOPT_URL, $nextcloud."index.php/apps/oauth2/api/v1/token?grant_type=authorization_code&code=".urlencode(Request::get("code"))."&redirect_uri=".urlencode($redirect_uri)); //nextcloud
         curl_setopt($r, CURLOPT_POST, 1);
         curl_setopt($r, CURLOPT_HTTPHEADER, $header);
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->OWNCLOUD_SSL_VERIFYPEER);
-        if (!empty($GLOBALS['OWNCLOUD_VERBOSE'])) {
+        curl_setopt($r, CURLOPT_SSL_VERIFYPEER, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        curl_setopt($r, CURLOPT_SSL_VERIFYHOST, (bool) Config::get()->NEXTCLOUD_SSL_VERIFY_PEER);
+        if (!empty($GLOBALS['NEXTCLOUD_VERBOSE'])) {
             curl_setopt($r, CURLOPT_VERBOSE, true);
         }
 
@@ -77,17 +77,17 @@ class OauthController extends PluginController
         $json = json_decode($response, true);
 
         if (!empty($json['error'])) {
-            PageLayout::postError(dgettext('OwnCloudPlugin', 'Authentifizierungsfehler:')." ".$json['error']);
+            PageLayout::postError(dgettext('NextcloudPlugin', 'Authentifizierungsfehler:')." ".$json['error']);
             $this->redirect(URLHelper::getURL("dispatch.php/files/index"));
         } else {
             if ($response === false) {
-                PageLayout::postError(dgettext('OwnCloudPlugin', 'Ein Fehler trat auf beim Abrufen der OAuth-Token:'), array(curl_error($r)));
+                PageLayout::postError(dgettext('NextcloudPlugin', 'Ein Fehler trat auf beim Abrufen der OAuth-Token:'), array(curl_error($r)));
             }
             $config = \UserConfig::get($GLOBALS['user']->id);
-            $config->store("OWNCLOUD_ACCESS_TOKEN", $json['access_token']);
-            $config->store("OWNCLOUD_REFRESH_TOKEN", $json['refresh_token']);
-            $config->store("OWNCLOUD_ACCESS_TOKEN_EXPIRES", time() + $json['expires_in']);
-            if (UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACTIVATED) {
+            $config->store("NEXTCLOUD_ACCESS_TOKEN", $json['access_token']);
+            $config->store("NEXTCLOUD_REFRESH_TOKEN", $json['refresh_token']);
+            $config->store("NEXTCLOUD_ACCESS_TOKEN_EXPIRES", time() + $json['expires_in']);
+            if (UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACTIVATED) {
                 $this->redirect(URLHelper::getURL("dispatch.php/files/system/" . $this->plugin->getPluginId()));
             } else {
                 $this->redirect(URLHelper::getURL("dispatch.php/files"));
diff --git a/migrations/01_init_plugin.php b/migrations/01_init_plugin.php
new file mode 100755
index 0000000..b753f06
--- /dev/null
+++ b/migrations/01_init_plugin.php
@@ -0,0 +1,37 @@
+<?php
+
+class InitPlugin extends Migration
+{
+    protected $configs =     ["NEXTCLOUD_ENDPOINT", "NEXTCLOUD_CLIENT_ID", "NEXTCLOUD_CLIENT_SECRET"];
+    protected $userconfigs = ["NEXTCLOUD_ENDPOINT_USER", "NEXTCLOUD_CLIENT_ID_USER", "NEXTCLOUD_CLIENT_SECRET_USER", "NEXTCLOUD_ACTIVATED", "NEXTCLOUD_ACCESS_TOKEN", "NEXTCLOUD_ACCESS_TOKEN_EXPIRES", "NEXTCLOUD_REFRESH_TOKEN"];
+
+    public function up()
+    {
+        foreach ($this->configs as $config) {
+            Config::get()->create($config, [
+                'value' => "",
+                'type' => "string",
+                'range' => "global",
+                'section' => "Nextcloud"
+            ]);
+        }
+        foreach ($this->userconfigs as $config) {
+            Config::get()->create($config, [
+                'value' => "",
+                'type' => in_array($config, ["NEXTCLOUD_ACTIVATED"]) ? "boolean" : "string",
+                'range' => "user",
+                'section' => "Nextcloud"
+            ]);
+        }
+    }
+
+    public function down()
+    {
+        foreach ($this->configs as $config) {
+            Config::get()->delete($config);
+        }
+        foreach ($this->userconfigs as $config) {
+            Config::get()->delete($config);
+        }
+    }
+}
diff --git a/migrations/2_add_unsecure_ssl.php b/migrations/02_add_unsecure_ssl.php
similarity index 59%
rename from migrations/2_add_unsecure_ssl.php
rename to migrations/02_add_unsecure_ssl.php
index 80962a3..0981327 100755
--- a/migrations/2_add_unsecure_ssl.php
+++ b/migrations/02_add_unsecure_ssl.php
@@ -4,16 +4,16 @@ class AddUnsecureSsl extends Migration
 {
     public function up()
     {
-        Config::get()->create("OWNCLOUD_SSL_VERIFYPEER", [
+        Config::get()->create("NEXTCLOUD_SSL_VERIFY_PEER", [
             'value' => "1",
             'type' => "boolean",
             'range' => "global",
-            'section' => "Owncloud"
+            'section' => "Nextcloud"
         ]);
     }
 
     public function down()
     {
-        Config::get()->delete("OWNCLOUD_SSL_VERIFYPEER");
+        Config::get()->delete("NEXTCLOUD_SSL_VERIFY_PEER");
     }
 }
diff --git a/migrations/3_add_custom_name.php b/migrations/03_add_custom_name.php
similarity index 54%
rename from migrations/3_add_custom_name.php
rename to migrations/03_add_custom_name.php
index 10ee3f6..60a416a 100755
--- a/migrations/3_add_custom_name.php
+++ b/migrations/03_add_custom_name.php
@@ -4,16 +4,16 @@ class AddCustomName extends Migration
 {
     public function up()
     {
-        Config::get()->create("OWNCLOUD_NAME", [
-            'value' => "OwnCloud",
+        Config::get()->create("NEXTCLOUD_NAME", [
+            'value' => "Nextcloud",
             'type' => "string",
             'range' => "global",
-            'section' => "Owncloud"
+            'section' => "Nextcloud"
         ]);
     }
 
     public function down()
     {
-        Config::get()->delete("OWNCLOUD_NAME");
+        Config::get()->delete("NEXTCLOUD_NAME");
     }
 }
diff --git a/migrations/04_migrate_plugin_name.php b/migrations/04_migrate_plugin_name.php
new file mode 100644
index 0000000..73d5873
--- /dev/null
+++ b/migrations/04_migrate_plugin_name.php
@@ -0,0 +1,83 @@
+<?php
+
+
+class MigratePluginName extends Migration
+{
+    protected function up()
+    {
+        $db = DBManager::get();
+
+        $owncloud_plugin_existed = $db->exec(
+            "UPDATE `plugins` SET `pluginname` = 'NextcloudPlugin'
+            WHERE `pluginname` = 'OwnCloudPlugin'"
+        );
+        if ($owncloud_plugin_existed) {
+            //Migrate the configuration from the OwnCloudPlugin:
+            $this->migrateConfigFromOwncloudPlugin();
+        }
+    }
+
+
+    public function migrateConfigFromOwncloudPlugin()
+    {
+        $db = DBManager::get();
+
+        $all_owncloud_configs = [
+            'OWNCLOUD_ENDPOINT'       => 'NEXTCLOUD_ENDPOINT',
+            'OWNCLOUD_CLIENT_ID'      => 'NEXTCLOUD_CLIENT_ID',
+            'OWNCLOUD_CLIENT_SECRET'  => 'NEXTCLOUD_CLIENT_SECRET',
+            'OWNCLOUD_SSL_VERIFYPEER' => 'NEXTCLOUD_SSL_VERIFY_PEER',
+            'OWNCLOUD_NAME'           => 'NEXTCLOUD_NAME'
+        ];
+
+        $all_owncloud_user_configs = [
+            'OWNCLOUD_ENDPOINT_USER' => 'NEXTCLOUD_ENDPOINT_USER',
+            'OWNCLOUD_CLIENT_ID_USER' => 'NEXTCLOUD_CLIENT_ID_USER',
+            'OWNCLOUD_CLIENT_SECRET_USER' => 'NEXTCLOUD_CLIENT_SECRET_USER',
+            'OWNCLOUD_ACTIVATED' => 'NEXTCLOUD_ACTIVATED',
+            'OWNCLOUD_ACCESS_TOKEN' => 'NEXTCLOUD_ACCESS_TOKEN',
+            'OWNCLOUD_ACCESS_TOKEN_EXPIRES' => 'NEXTCLOUD_ACCESS_TOKEN_EXPIRES',
+            'OWNCLOUD_REFRESH_TOKEN' => 'NEXTCLOUD_REFRESH_TOKEN'
+        ];
+
+        $stmt = $db->prepare(
+            "UPDATE `config_values`
+            SET `field` = :nextcloud_name
+            WHERE `field` = :owncloud_name"
+        );
+        foreach ($all_owncloud_user_configs as $owncloud_name => $nextcloud_name) {
+            $stmt->execute(
+                [
+                    'owncloud_name'  => $owncloud_name,
+                    'nextcloud_name' => $nextcloud_name
+                ]
+            );
+        }
+
+        $c = Config::get();
+        foreach ($all_owncloud_configs as $owncloud_name => $nextcloud_name) {
+            $success = false;
+            try {
+                $c->store($nextcloud_name, $c->getValue($owncloud_name));
+            } catch (InvalidArgumentException $e) {
+                $is_boolean = in_array($nextcloud_name, ['NEXTCLOUD_ACTIVATED', 'NEXTCLOUD_SSL_VERIFY_PEER']);
+                $c->create(
+                    $nextcloud_name,
+                    [
+                        'value'   => $c->getValue($owncloud_name),
+                        'type'    => $is_boolean ? 'boolean' : 'string',
+                        'range'   => $nextcloud_name == 'NEXTCLOUD_ACTIVATED' ? 'user' : 'global',
+                        'section' => 'Nextcloud'
+                    ]
+                );
+            }
+            $c->delete($owncloud_name);
+        }
+    }
+
+
+    protected function down()
+    {
+        //Uhh... no!
+    }
+}
diff --git a/migrations/1_init_plugin.php b/migrations/1_init_plugin.php
deleted file mode 100755
index f040208..0000000
--- a/migrations/1_init_plugin.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-class InitPlugin extends Migration
-{
-    public function up()
-    {
-        $configs =     ["OWNCLOUD_ENDPOINT", "OWNCLOUD_CLIENT_ID", "OWNCLOUD_CLIENT_SECRET"];
-        $userconfigs = ["OWNCLOUD_ENDPOINT_USER", "OWNCLOUD_CLIENT_ID_USER", "OWNCLOUD_CLIENT_SECRET_USER", "OWNCLOUD_ACTIVATED", "OWNCLOUD_ACCESS_TOKEN", "OWNCLOUD_ACCESS_TOKEN_EXPIRES", "OWNCLOUD_REFRESH_TOKEN"];
-        foreach ($configs as $config) {
-            Config::get()->create($config, [
-                'value' => "",
-                'type' => "string",
-                'range' => "global",
-                'section' => "Owncloud"
-            ]);
-        }
-        foreach ($userconfigs as $config) {
-            Config::get()->create($config, [
-                'value' => "",
-                'type' => in_array($config, ["OWNCLOUD_ACTIVATED"]) ? "boolean" : "string",
-                'range' => "user",
-                'section' => "Owncloud"
-            ]);
-        }
-    }
-
-    public function down()
-    {
-        $configs =     ["OWNCLOUD_ENDPOINT", "OWNCLOUD_CLIENT_ID", "OWNCLOUD_CLIENT_SECRET"];
-        $userconfigs = ["OWNCLOUD_ENDPOINT_USER", "OWNCLOUD_CLIENT_ID_USER", "OWNCLOUD_CLIENT_SECRET_USER", "OWNCLOUD_ACTIVATED", "OWNCLOUD_ACCESS_TOKEN", "OWNCLOUD_ACCESS_TOKEN_EXPIRES", "OWNCLOUD_REFRESH_TOKEN"];
-        foreach ($configs as $config) {
-            Config::get()->delete($config);
-        }
-        foreach ($userconfigs as $config) {
-            Config::get()->delete($config);
-        }
-    }
-}
diff --git a/plugin.manifest b/plugin.manifest
index 8acca4b..d77e355 100755
--- a/plugin.manifest
+++ b/plugin.manifest
@@ -1,6 +1,6 @@
-pluginname=OwnCloudPlugin
-pluginclassname=OwnCloudPlugin
-version=2.1.2
+pluginname=NextcloudPlugin
+pluginclassname=NextcloudPlugin
+version=3.0
 origin=data-quest
 studipMinVersion=5.0
 studipMaxVersion=5.3.99
diff --git a/readme.md b/readme.md
index 0e8ee9e..68d1da7 100755
--- a/readme.md
+++ b/readme.md
@@ -1,41 +1,38 @@
-OwnCloud-Plugin für Stud.IP
+Nextcloud-Plugin für Stud.IP
 ===========================
 
-Mit diesem Plugin kann man ab der Stud.IP-Version 4.0 eine Owncloud (oder Nextcloud) als persönlichen Dateibereich einbinden und von und zu der Owncloud Dateien nach oder von Stud.IP kopieren.
+Mit diesem Plugin kann man ab der Stud.IP-Version 5.0 eine Nextcloud (oder OwnCloud) als persönlichen Dateibereich einbinden und von und zu der Nextcloud Dateien nach oder von Stud.IP kopieren.
 
 ## Installation
 
 1. Das Plugin wird ganz normal in Stud.IP per Drag&Drop installiert.
-2. Die OwnCloud braucht die [OAuth2-App](https://github.com/owncloud/oauth2/releases), die installiert und aktiviert werden muss. Wer nur Stud.IP gewohnt ist: OAuth2 heißt im Owncloud-Kontext zwar "App", ist aber das gleiche wie bei Stud.IP ein Plugin. Die Dateien müssen in das Owncloud-Verzeichnis unter `./apps/oauth2` abgelegt werden. NextCloud hingegen hat OAuth 2 schon eingebaut.
-3. Für OAuth in der OwnCloud hinter einem Apache braucht man das mod_rewrite und mod_env Modul, das die Regel `RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]` umsetzt. Wenn das nicht aktiv ist, kann OAuth nicht funktionieren, weil der Apache alle Authorization-Header entfernt.
-4. Die OAuth2 "App" muss als Admin im Webinterface von Owncloud aktiviert werden unter "Einstellungen" (oben rechts unter dem Nutzernamen) -> Apps -> "Deaktivierte Apps anzeigen" -> "aktivieren".
-5. Es muss in Owncloud ein Client angelegt werden. Unter Administration -> "Additional" einen neuen Client anlegen. Name ist dabei egal (vielleicht ja Stud.IP).
-6. Jetzt hat man einen OAuth2-Client erstellt und kopiert Client-ID und das Secret. Wichtig ist dabei, dass man die korrekte Redirect-URI angibt. Owncloud überprüft diese URI penibel. Sie sollte in etwa lauten `https://meinstud.ip/plugins.php/owncloudplugin/oauth/receive_access_token`. Auch sollte HTTPS aktiv sein.
+2. Für OAuth in der Nextcloud hinter einem Apache braucht man das mod_rewrite und mod_env Modul, das die Regel `RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]` umsetzt. Wenn das nicht aktiv ist, kann OAuth nicht funktionieren, weil der Apache alle Authorization-Header entfernt.
+3. Es muss in Nextcloud ein Client angelegt werden. Unter Administration -> "Additional" einen neuen Client anlegen. Name ist dabei egal (vielleicht ja Stud.IP).
+4. Jetzt hat man einen OAuth2-Client erstellt und kopiert Client-ID und das Secret. Wichtig ist dabei, dass man die korrekte Redirect-URI angibt. Nextcloud überprüft diese URI penibel. Sie sollte in etwa lauten `https://meinstud.ip/plugins.php/NextcloudPlugin/oauth/receive_access_token`. Auch sollte HTTPS aktiv sein.
 
-Jetzt muss man sich überlegen, wie das Owncloud-Plugin genutzt werden soll in Stud.IP. Gibt es eine zentrale OwnCloud für alle Stud.IP-Nutzer oder kümmern sich die Nutzer selbst um eine eigene OwnCloud?
+Jetzt muss man sich überlegen, wie das Nextcloud-Plugin genutzt werden soll in Stud.IP. Gibt es eine zentrale Nextcloud für alle Stud.IP-Nutzer oder kümmern sich die Nutzer selbst um eine eigene Nextcloud?
 
 Zentral:
 
-1. Melde Dich im Stud.IP als Root an und gehe unter Admin -> System -> Konfiguration -> Owncloud.
-2. Trage die oben gewonnene Client-ID beim Parameter `OWNCLOUD_CLIENT_ID` ein.
-3. Trage das oben gewonnene Secret beim Parameter `OWNCLOUD_CLIENT_SECRET` ein.
+1. Melde Dich im Stud.IP als Root an und gehe unter Admin -> System -> Konfiguration -> Nextcloud.
+2. Trage die oben gewonnene Client-ID beim Parameter `NEXTCLOUD_CLIENT_ID` ein.
+3. Trage das oben gewonnene Secret beim Parameter `NEXTCLOUD_CLIENT_SECRET` ein.
 
 Individuell:
 
-1. Der Nutzer muss dann alleine die obigen Schritte durchführen bzw. seinen OwnCloud-Admin fragen, ob er das für ihn tun kann und die Credentials übergibt.
-2. Im persönlichen Dateibereich von Stud.IP 4.0 gibt es in der Sidebar den Punkt "OwnCloud konfigurieren". Da muss er drauf klicken. Ein Dialog öffnet sich.
-3. Man muss die Adresse der OwnCloud eintragen (z.B. `https://meineuni/owncloud`) und App-ID und Secret von oben eintragen und die OwnCloud aktiv schalten und speichern.
+1. Der Nutzer muss dann alleine die obigen Schritte durchführen bzw. seinen Nextcloud-Admin fragen, ob er das für ihn tun kann und die Credentials übergibt.
+2. Im persönlichen Dateibereich von Stud.IP 4.0 gibt es in der Sidebar den Punkt "Nextcloud konfigurieren". Da muss er drauf klicken. Ein Dialog öffnet sich.
+3. Man muss die Adresse der Nextcloud eintragen (z.B. `https://meineuni/nextcloud`) und App-ID und Secret von oben eintragen und die Nextcloud aktiv schalten und speichern.
 
 Die nächsten Schritte sind für beide Wege wieder dieselben:
 
-1. Wer es individuell eingestellt hat, kennt es schon: Im persönlichen Dateibereich von Stud.IP 4.0 gibt es in der Sidebar den Punkt "OwnCloud konfigurieren". Da muss man drauf klicken.
+1. Wer es individuell eingestellt hat, kennt es schon: Im persönlichen Dateibereich von Stud.IP 5.0 gibt es in der Sidebar den Punkt "Nextcloud konfigurieren". Da muss man drauf klicken.
 2. Man muss das Häkchen für "aktiviert" setzen und speichern.
-3. Das Fenster lädt sich neu und ein Button erscheint oben "OwnCloud für Stud.IP freigeben". Dort klicken.
-4. Dann landet man in der OwnCloud und wird aufgefordert sich anzumelden. Vergewissern Sie sich in solchen Situationen immer (nicht nur jetzt), dass die URL stimmt und Sie Ihre Passwörter nicht einer anderen Seite als genau Ihrer OwnCloud zusenden.
-5. Die OwnCloud fragt Sie, ob Stud.IP in Ihrem Namen Daten abrufen und verändern darf. Klicken Sie auf "Authorisieren".
-6. Jetzt landen Sie wieder in Stud.IP und die Schnittstelle zwischen Stud.IP und OwnCloud sollte eingerichtet sein.
+3. Das Fenster lädt sich neu und ein Button erscheint oben "Nextcloud für Stud.IP freigeben". Dort klicken.
+4. Dann landet man in der Nextcloud und wird aufgefordert sich anzumelden. Vergewissern Sie sich in solchen Situationen immer (nicht nur jetzt), dass die URL stimmt und Sie Ihre Passwörter nicht einer anderen Seite als genau Ihrer Nextcloud zusenden.
+5. Die Nextcloud fragt Sie, ob Stud.IP in Ihrem Namen Daten abrufen und verändern darf. Klicken Sie auf "Authorisieren".
+6. Jetzt landen Sie wieder in Stud.IP und die Schnittstelle zwischen Stud.IP und Nextcloud sollte eingerichtet sein.
 
 Probleme?
 
 * Manchmal scheint fast alles zu funktionieren. OAuth-Access-Token ist da, Refresh-Token ist da und der Refresh scheint auch zu klappen, aber es werden keine Dateien und Ordner angezeigt. Es erscheint stattdessen eine Fehlermeldung: "No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured". In dem Fall muss man vermutlich in die Datei .htaccess die Zeile einbauen `SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1`
-
diff --git a/views/configure/myarea.php b/views/configure/myarea.php
index 94ed39f..57cb10f 100755
--- a/views/configure/myarea.php
+++ b/views/configure/myarea.php
@@ -1,65 +1,65 @@
 <form action="<?= PluginEngine::getLink($plugin, [], "configure/myarea") ?>"
       method="post"
-      class="default owncloud"
+      class="default nextcloud"
       autocomplete="off">
 
     <fieldset>
         <legend>
-            <?= sprintf(dgettext('OwnCloudPlugin', '%s konfigurieren'), Config::get()->OWNCLOUD_NAME) ?>
+            <?= sprintf(dgettext('NextcloudPlugin', '%s konfigurieren'), Config::get()->NEXTCLOUD_NAME) ?>
         </legend>
 
-        <? if (\Owncloud\OAuth::isReady()) : ?>
-            <?= MessageBox::info(sprintf(dgettext('OwnCloudPlugin', '%s ist verknüpft'), Config::get()->OWNCLOUD_NAME)) ?>
-        <? elseif((UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER || Config::get()->OWNCLOUD_ENDPOINT) && UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACTIVATED) : ?>
+        <? if (\Nextcloud\OAuth::isReady()) : ?>
+            <?= MessageBox::info(sprintf(dgettext('NextcloudPlugin', '%s ist verknüpft'), Config::get()->NEXTCLOUD_NAME)) ?>
+        <? elseif((UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER || Config::get()->NEXTCLOUD_ENDPOINT) && UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACTIVATED) : ?>
             <div style="text-align: center;">
-                <?= \Studip\LinkButton::create(sprintf(dgettext('OwnCloudPlugin', '%s für Stud.IP freigeben'), Config::get()->OWNCLOUD_NAME), PluginEngine::getURL($plugin, [], "oauth/request_access_token")) ?>
+                <?= \Studip\LinkButton::create(sprintf(dgettext('NextcloudPlugin', '%s für Stud.IP freigeben'), Config::get()->NEXTCLOUD_NAME), PluginEngine::getURL($plugin, [], "oauth/request_access_token")) ?>
             </div>
         <? endif ?>
 
-        <? if (!Config::get()->OWNCLOUD_ENDPOINT) : ?>
+        <? if (!Config::get()->NEXTCLOUD_ENDPOINT) : ?>
             <label>
-                <?= sprintf(dgettext('OwnCloudPlugin', 'Adresse von %s'), Config::get()->OWNCLOUD_NAME) ?>
-                <input type="text" name="owncloud[endpoint]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT_USER) ?>" placeholder="<?= "z.B. https://myserver.tdl/owncloud" ?>">
+                <?= sprintf(dgettext('NextcloudPlugin', 'Adresse von %s'), Config::get()->NEXTCLOUD_NAME) ?>
+                <input type="text" name="nextcloud[endpoint]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ENDPOINT_USER) ?>" placeholder="<?= "z.B. https://myserver.tdl/nextcloud" ?>">
             </label>
         <? endif ?>
 
-        <? if (!Config::get()->OWNCLOUD_CLIENT_ID) : ?>
+        <? if (!Config::get()->NEXTCLOUD_CLIENT_ID) : ?>
             <label>
-                <?= dgettext('OwnCloudPlugin', 'App-ID') ?>
-                <input type="text" name="owncloud[client_id]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_ID_USER) ?>">
+                <?= dgettext('NextcloudPlugin', 'App-ID') ?>
+                <input type="text" name="nextcloud[client_id]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_CLIENT_ID_USER) ?>">
             </label>
         <? endif ?>
 
-        <? if (!Config::get()->OWNCLOUD_CLIENT_SECRET) : ?>
+        <? if (!Config::get()->NEXTCLOUD_CLIENT_SECRET) : ?>
             <label>
-                <?= dgettext('OwnCloudPlugin', 'Secret') ?>
-                <input type="text" name="owncloud[client_secret]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_SECRET_USER) ?>">
+                <?= dgettext('NextcloudPlugin', 'Secret') ?>
+                <input type="text" name="nextcloud[client_secret]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_CLIENT_SECRET_USER) ?>">
             </label>
 
             <label>
                 <? URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']) ?>
-                <?= sprintf(dgettext('OwnCloudPlugin', 'Redirect-URI (zum Eintragen in %s)'), Config::get()->OWNCLOUD_NAME) ?>
+                <?= sprintf(dgettext('NextcloudPlugin', 'Redirect-URI (zum Eintragen in %s)'), Config::get()->NEXTCLOUD_NAME) ?>
                 <input type="text" readonly value="<?= htmlReady(PluginEngine::getURL($plugin, [], "oauth/receive_access_token"), true) ?>">
                 <? URLHelper::setBaseURL("/") ?>
             </label>
         <? endif ?>
 
         <label>
-            <input type="checkbox" name="owncloud[activated]" value="1"<?= UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACTIVATED ? " checked" : "" ?>>
-            <?= dgettext('OwnCloudPlugin', "Aktiviert") ?>
+            <input type="checkbox" name="nextcloud[activated]" value="1"<?= UserConfig::get($GLOBALS['user']->id)->NEXTCLOUD_ACTIVATED ? " checked" : "" ?>>
+            <?= dgettext('NextcloudPlugin', "Aktiviert") ?>
         </label>
     </fieldset>
 
     <div data-dialog-button>
-        <?= \Studip\Button::create(dgettext('OwnCloudPlugin', "Speichern")) ?>
-        <? if (\Owncloud\OAuth::isReady()) : ?>
-            <?= \Studip\Button::create(dgettext('OwnCloudPlugin', "Zugang aufheben"), "remove", ['data-confirm' => dgettext('OwnCloudPlugin', "Wirklich den Zugang zur Owncloud aufheben?")]) ?>
+        <?= \Studip\Button::create(dgettext('NextcloudPlugin', "Speichern")) ?>
+        <? if (\Nextcloud\OAuth::isReady()) : ?>
+            <?= \Studip\Button::create(dgettext('NextcloudPlugin', "Zugang aufheben"), "remove", ['data-confirm' => dgettext('NextcloudPlugin', "Wirklich den Zugang zur Owncloud aufheben?")]) ?>
         <? endif ?>
     </div>
 </form>
 
 <style>
-    form.default.owncloud input[readonly] {
+    form.default.nextcloud input[readonly] {
         background-color: #e1e3e4;
         background-image: url(<?= Icon::create("lock-locked", "info_alt")->asImagePath() ?>);
         background-repeat: no-repeat;
diff --git a/views/file/edit.php b/views/file/edit.php
index 9f1272f..dffeeff 100644
--- a/views/file/edit.php
+++ b/views/file/edit.php
@@ -1,28 +1,21 @@
 <div id="file_edit_window">
     <?= $aside_template->render() ?>
-
     <div id="file_management_forms">
         <form method="post" data-dialog class="default"
               action="<?= $controller->link_for('/edit/' . $file->getId()) ?>">
-
             <?= CSRFProtection::tokenTag() ?>
             <fieldset>
-                <legend><?= dgettext('OwnCloudPlugin', 'Datei bearbeiten') ?></legend>
-
+                <legend><?= dgettext('NextcloudPlugin', 'Datei bearbeiten') ?></legend>
                 <label>
-                    <?= dgettext('OwnCloudPlugin', 'Name') ?>
+                    <?= dgettext('NextcloudPlugin', 'Name') ?>
                     <input id="edit_file_name" type="text" name="name"
                            value="<?= htmlReady($name) ?>">
                 </label>
-
             </fieldset>
-
-
-
             <footer data-dialog-button>
-                <?= Studip\Button::createAccept(dgettext('OwnCloudPlugin', 'Speichern'), 'save') ?>
+                <?= Studip\Button::createAccept(dgettext('NextcloudPlugin', 'Speichern'), 'save') ?>
                 <?= Studip\LinkButton::createCancel(
-                    dgettext('OwnCloudPlugin', 'Abbrechen'),
+                    dgettext('NextcloudPlugin', 'Abbrechen'),
                     $controller->url_for((in_array($folder->range_type, ['course', 'institute']) ? $folder->range_type . '/' : '') . 'files/index/' . $folder->id)
                 ) ?>
             </footer>
diff --git a/views/file/update.php b/views/file/update.php
index 6118a6a..d687231 100644
--- a/views/file/update.php
+++ b/views/file/update.php
@@ -1,27 +1,24 @@
 <form action="<?= $controller->link_for('file/update/' . $file->getId(), ['from_plugin' => $from_plugin]) ?>"
       enctype="multipart/form-data" method="post" class="default">
-
     <?= CSRFProtection::tokenTag() ?>
     <fieldset>
-        <legend><?= dgettext('OwnCloudPlugin', 'Neue Dateiversion') ?></legend>
+        <legend><?= dgettext('NextcloudPlugin', 'Neue Dateiversion') ?></legend>
         <label class="file-upload">
             <?= sprintf(
-                dgettext('OwnCloudPlugin', 'Bitte die neue Version der Datei %s auswählen.'),
+                dgettext('NextcloudPlugin', 'Bitte die neue Version der Datei %s auswählen.'),
                 htmlReady($file->getFilename())
             ) ?>
             <input type="file" name="file">
         </label>
         <label>
             <input type="checkbox" name="update_filename" value="1">
-            <?= dgettext('OwnCloudPlugin', 'Dateinamen aus neuer Dateiversion übernehmen.') ?>
+            <?= dgettext('NextcloudPlugin', 'Dateinamen aus neuer Dateiversion übernehmen.') ?>
         </label>
-
-
     </fieldset>
     <footer data-dialog-button>
-        <?= Studip\Button::createAccept(dgettext('OwnCloudPlugin', 'Aktualisieren'), 'confirm') ?>
+        <?= Studip\Button::createAccept(dgettext('NextcloudPlugin', 'Aktualisieren'), 'confirm') ?>
         <?= Studip\LinkButton::createCancel(
-            dgettext('OwnCloudPlugin', 'Abbrechen'),
+            dgettext('NextcloudPlugin', 'Abbrechen'),
             $controller->url_for(
                 (in_array($folder->range_type, ['course', 'institute']) ? $folder->range_type . '/' : '')
                 . 'files/index/' . $folder->parent_id
-- 
GitLab