diff options
-rw-r--r-- | lib/Settings/Admin.php | 91 | ||||
-rw-r--r-- | lib/Settings/Section.php | 24 | ||||
-rw-r--r-- | templates/issuetemplate.php | 47 | ||||
-rw-r--r-- | templates/settings-admin.php | 27 |
4 files changed, 111 insertions, 78 deletions
diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index 3e2a618..1f9f6be 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -28,7 +28,9 @@ use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; use OCP\Settings\ISettings; - +use OC\IntegrityCheck\Checker; +use OCP\App\IAppManager; +use OC\SystemConfig; class Admin implements ISettings { /** @var IConfig */ private $config; @@ -36,27 +38,38 @@ class Admin implements ISettings { private $l; /** @var IURLGenerator */ private $urlGenerator; + /** @var Checker */ + private $checker; + /** @var IAppManager */ + private $appManager; + /** @var SystemConfig */ + private $systemConfig; - public function __construct(IConfig $config, + public function __construct( + IConfig $config, IL10N $l, - IURLGenerator $urlGenerator) { + IURLGenerator $urlGenerator, + Checker $checker, + IAppManager $appManager) { $this->config = $config; $this->l = $l; $this->urlGenerator = $urlGenerator; + $this->checker = $checker; + $this->appManager = $appManager; + $this->systemConfig = \OC::$server->query("SystemConfig"); } - - /** - * @return TemplateResponse - */ + public function getForm() { $data = array( 'version' => $this->config->getSystemValue('version'), 'os' => php_uname(), 'php' => PHP_VERSION, 'dbserver' => $this->config->getSystemValue('dbtype'), - 'webserver' => $_SERVER['software'] - - + 'webserver' => $_SERVER['software'] . " " . php_sapi_name(), + 'installMethod' => $this->getInstallMethod(), + 'integrity' => $this->checker->verifyCoreSignature(), + 'apps' => $this->getAppList(), + 'config' => $this->getConfig(), ); $issueTemplate = new TemplateResponse('issuetemplate', 'issuetemplate', $data, ''); @@ -67,22 +80,60 @@ class Admin implements ISettings { return new TemplateResponse('issuetemplate', 'settings-admin', $parameters, ''); } - /** - * @return string the section ID, e.g. 'sharing' - */ public function getSection() { return 'issuetemplate'; } - /** - * @return int whether the form should be rather on the top or bottom of - * the admin section. The forms are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. - * - * E.g.: 70 - */ public function getPriority() { return 10; } + private function getInstallMethod() { + $base = \OC::$SERVERROOT; + if(file_exists($base . '/.git')) { + return "git"; + } + } + + private function getAppList() { + $apps = \OC_App::getAllApps(); + $enabledApps = $disabledApps = []; + $versions = \OC_App::getAppVersions(); + //sort enabled apps above disabled apps + foreach ($apps as $app) { + if ($this->appManager->isInstalled($app)) { + $enabledApps[] = $app; + } else { + $disabledApps[] = $app; + } + } + $apps = ['enabled' => [], 'disabled' => []]; + sort($enabledApps); + foreach ($enabledApps as $app) { + $apps['enabled'][$app] = (isset($versions[$app])) ? $versions[$app] : true; + } + sort($disabledApps); + foreach ($disabledApps as $app) { + $apps['disabled'][$app] = null; + } + return $apps; + } + + private function getConfig() { + + $keys = $this->systemConfig->getKeys(); + $configs = []; + foreach ($keys as $key) { + if (true) { + $value = $this->systemConfig->getFilteredValue($key, serialize(null)); + } else { + $value = $this->systemConfig->getValue($key, serialize(null)); + } + if ($value !== 'N;') { + $configs[$key] = $value; + } + } + return $configs; + } + } diff --git a/lib/Settings/Section.php b/lib/Settings/Section.php index 3a67c82..3bda81d 100644 --- a/lib/Settings/Section.php +++ b/lib/Settings/Section.php @@ -27,6 +27,7 @@ use OCP\IL10N; use OCP\Settings\ISection; class Section implements ISection { + /** @var IL10N */ private $l; @@ -34,33 +35,14 @@ class Section implements ISection { $this->l = $l; } - /** - * returns the ID of the section. It is supposed to be a lower case string, - * e.g. 'ldap' - * - * @returns string - */ public function getID() { return 'issuetemplate'; } - /** - * returns the translated name as it should be displayed, e.g. 'LDAP / AD - * integration'. Use the L10N service to translate it. - * - * @return string - */ public function getName() { - return $this->l->t('Issue Reporting'); + return $this->l->t('Issue reporting'); } - - /** - * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. - * - * E.g.: 70 - */ + public function getPriority() { return 30; } diff --git a/templates/issuetemplate.php b/templates/issuetemplate.php index 72ba30f..47782cd 100644 --- a/templates/issuetemplate.php +++ b/templates/issuetemplate.php @@ -1,14 +1,3 @@ -### Steps to reproduce -1. -2. -3. - -### Expected behaviour -Tell us what should happen - -### Actual behaviour -Tell us what happens instead - ### Server configuration **Operating system**: <?php p($_['os']); ?> @@ -27,16 +16,15 @@ Tell us what happens instead **Updated from an older Nextcloud/ownCloud or fresh install:** -**Where did you install Nextcloud from:** + +**Where did you install Nextcloud from:** <?php p($_['installMethod']); ?> **Signing status:** <details> <summary>Signing status</summary> ``` - Login as admin user into your Nextcloud and access - http://example.com/index.php/settings/integrity/failed - paste the results here. + <?php p(implode($_['integrity'],",")); ?> ``` </details> @@ -45,9 +33,17 @@ Tell us what happens instead <summary>App list</summary> ``` - If you have access to your command line run e.g.: - sudo -u www-data php occ app:list - from within your Nextcloud installation folder + Enabled: +<?php + foreach ($_['apps']['enabled'] as $name => $version) { + p("\t - " . $name . ": " . $version . "\n"); + } ?> + + Disabled: +<?php + foreach ($_['apps']['disabled'] as $name => $version) { + p("\t - " . $name . "\n"); + } ?> ``` </details> @@ -55,16 +51,10 @@ Tell us what happens instead <details> <summary>Config report</summary> - ``` - If you have access to your command line run e.g.: - sudo -u www-data php occ config:list system - from within your Nextcloud installation folder - - or +``` +<?php print_unescaped(print_r(json_encode($_['config'], JSON_PRETTY_PRINT), true)); ?> - Insert your config.php content here - (Without the database password, passwordsalt and secret) - ``` +``` </details> **Are you using external storage, if yes which one:** local/smb/sftp/... @@ -73,6 +63,7 @@ Tell us what happens instead **Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/... +<?php if(array_key_exists('user_ldap', $_['apps']['enabled'])) { ?> #### LDAP configuration (delete this part if not used) <details> <summary>LDAP config</summary> @@ -90,7 +81,7 @@ Tell us what happens instead Eventually replace sensitive data as the name/IP-address of your LDAP server or groups. ``` </details> - +<?php } ?> ### Client configuration **Browser:** diff --git a/templates/settings-admin.php b/templates/settings-admin.php index 9c15f05..1c55648 100644 --- a/templates/settings-admin.php +++ b/templates/settings-admin.php @@ -1,15 +1,24 @@ <div id="issuetemplate" class="section"> - <h2 class="inlineblock"><?php p($l->t('Issue Template')); ?></h2> - <p>Use this for reporting an issue on <a href="https://github.com/nextcloud/server/issues/new">GitHub</a> with your current server setup.</p> - - <p>Thanks for reporting issues back to Nextcloud! This is the issue tracker of Nextcloud, if you have any support question please check out https://nextcloud.com/support<br /> - This is the bug tracker for the Server component. Find other components at https://github.com/nextcloud/<br /> - For reporting potential security issues please see https://nextcloud.com/security/<br /> - To make it possible for us to help you please fill out below information carefully.<br /> + <h2 class="inlineblock"><?php p($l->t('Issue reporting')); ?></h2> + <p><?php $l->t("Thanks for reporting issues back to Nextcloud! This is the issue tracker of Nextcloud, if you have any support question please check out"); ?> <a href="https://nextcloud.com/support">https://nextcloud.com/support</a><br /> + <?php $l->t("This is the bug tracker for the Server component. Find other components at"); ?> <a href="https://github.com/nextcloud/">https://github.com/nextcloud/</a><br /> + <?php $l->t("For reporting potential security issues please see"); ?> <a href="https://nextcloud.com/security/">https://nextcloud.com/security/</a><br /> + <?php $l->t("To make it possible for us to help you please fill out below information carefully."); ?><br /> </p> + <textarea id="issue_description" style="width: 100%; height:200px;">### Steps to reproduce +1. +2. +3. + +### Expected behaviour +Tell us what should happen + +### Actual behaviour +Tell us what happens instead</textarea> + <p><strong><?php $l->t("Please always check if the automatically filled out information is correct and there is nothing important missing, before reporting the issue."); ?></strong></p> <form method="GET" action="https://github.com/nextcloud/server/issues/new"> - <textarea name="body" width="100%" height="400" style="width: 100%; height:400px;"><?php p($_['issueTemplate']); ?></textarea> - <input type="submit" value=" File a new issue on GitHub" /> + <textarea name="body" style="width: 100%; height:400px;"><?php p($_['issueTemplate']); ?></textarea> + <input type="submit" value=" <?php $l->t("File a new issue on GitHub"); ?> " /> </form> </div> |