]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/Logs/View.php
Fix security vulnerability in admin modules
[friendica.git] / src / Module / Admin / Logs / View.php
index b66a6781e50836cc9dbfb5a32606dc0a8e0fe1c0..3a60ed99ed94035c86e23883a1d20ea1140b48db 100644 (file)
@@ -1,29 +1,47 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module\Admin\Logs;
 
-use Friendica\Core\Config;
-use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
-use Friendica\Module\BaseAdminModule;
+use Friendica\DI;
+use Friendica\Module\BaseAdmin;
 use Friendica\Util\Strings;
 
-class View extends BaseAdminModule
+class View extends BaseAdmin
 {
-       public static function content()
+       public static function content(array $parameters = [])
        {
-               parent::content();
+               parent::content($parameters);
 
                $t = Renderer::getMarkupTemplate('admin/logs/view.tpl');
-               $f = Config::get('system', 'logfile');
+               $f = DI::config()->get('system', 'logfile');
                $data = '';
 
                if (!file_exists($f)) {
-                       $data = L10n::t('Error trying to open <strong>%1$s</strong> log file.\r\n<br/>Check to see if file %1$s exist and is readable.', $f);
+                       $data = DI::l10n()->t('Error trying to open <strong>%1$s</strong> log file.\r\n<br/>Check to see if file %1$s exist and is readable.', $f);
                } else {
                        $fp = fopen($f, 'r');
                        if (!$fp) {
-                               $data = L10n::t('Couldn\'t open <strong>%1$s</strong> log file.\r\n<br/>Check to see if file %1$s is readable.', $f);
+                               $data = DI::l10n()->t('Couldn\'t open <strong>%1$s</strong> log file.\r\n<br/>Check to see if file %1$s is readable.', $f);
                        } else {
                                $fstat = fstat($fp);
                                $size = $fstat['size'];
@@ -43,10 +61,10 @@ class View extends BaseAdminModule
                        }
                }
                return Renderer::replaceMacros($t, [
-                       '$title' => L10n::t('Administration'),
-                       '$page' => L10n::t('View Logs'),
+                       '$title' => DI::l10n()->t('Administration'),
+                       '$page' => DI::l10n()->t('View Logs'),
                        '$data' => $data,
-                       '$logname' => Config::get('system', 'logfile')
+                       '$logname' => DI::config()->get('system', 'logfile')
                ]);
        }
 }