From c644f405d3a072af57b3b0fd8077c64ed6b36420 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 19 Feb 2019 23:33:35 +0300 Subject: [PATCH] Admin Panel: Information Manager - cleanup and refactoring. --- .../admin/classes/InformationManager.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/site/plugins/admin/classes/InformationManager.php b/site/plugins/admin/classes/InformationManager.php index 1e11f57d..77a1aca4 100644 --- a/site/plugins/admin/classes/InformationManager.php +++ b/site/plugins/admin/classes/InformationManager.php @@ -9,6 +9,29 @@ class InformationManager public static function getInformationManager() { Registry::set('sidebar_menu_item', 'infomation'); + Themes::view('admin/views/templates/system/information/list')->display(); } + + /** + * Tests whether a file is writable for anyone. + * + * @param string $file File to check + * @return bool + */ + public static function isFileWritable(string $file) : bool + { + // Is file exists ? + if (! file_exists($file)) { + throw new RuntimeException(vsprintf("%s(): The file '{$file}' doesn't exist", array(__METHOD__))); + } + + // Gets file permissions + $perms = fileperms($file); + + // Is writable ? + if (is_writable($file) || ($perms & 0x0080) || ($perms & 0x0010) || ($perms & 0x0002)) { + return true; + } + } }