Passed
Push — master ( 757841...94ec22 )
by Goffy
06:13 queued 02:50
created
class/Helper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     {
68 68
         $ret = false;
69 69
 
70
-        $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler';
70
+        $class = __NAMESPACE__.'\\'.\ucfirst($name).'Handler';
71 71
         if (!\class_exists($class)) {
72 72
             throw new \RuntimeException("Class '$class' not found");
73 73
         }
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -23,62 +23,62 @@
 block discarded – undo
23 23
  */
24 24
 class Helper extends \Xmf\Module\Helper
25 25
 {
26
-    public $debug;
26
+	public $debug;
27 27
 
28
-    /**
29
-     * @param bool $debug
30
-     */
31
-    public function __construct($debug = false)
32
-    {
33
-        $this->debug   = $debug;
34
-        $moduleDirName = \basename(\dirname(__DIR__));
35
-        parent::__construct($moduleDirName);
36
-    }
28
+	/**
29
+	 * @param bool $debug
30
+	 */
31
+	public function __construct($debug = false)
32
+	{
33
+		$this->debug   = $debug;
34
+		$moduleDirName = \basename(\dirname(__DIR__));
35
+		parent::__construct($moduleDirName);
36
+	}
37 37
 
38
-    /**
39
-     * @param bool $debug
40
-     *
41
-     * @return \XoopsModules\Myiframe\Helper
42
-     */
43
-    public static function getInstance(bool $debug = false): self
44
-    {
45
-        static $instance;
46
-        if (null === $instance) {
47
-            $instance = new static($debug);
48
-        }
38
+	/**
39
+	 * @param bool $debug
40
+	 *
41
+	 * @return \XoopsModules\Myiframe\Helper
42
+	 */
43
+	public static function getInstance(bool $debug = false): self
44
+	{
45
+		static $instance;
46
+		if (null === $instance) {
47
+			$instance = new static($debug);
48
+		}
49 49
 
50
-        return $instance;
51
-    }
50
+		return $instance;
51
+	}
52 52
 
53
-    /**
54
-     * @return string
55
-     */
56
-    public function getDirname(): string
57
-    {
58
-        return $this->dirname;
59
-    }
53
+	/**
54
+	 * @return string
55
+	 */
56
+	public function getDirname(): string
57
+	{
58
+		return $this->dirname;
59
+	}
60 60
 
61
-    /**
62
-     * Get an Object Handler
63
-     *
64
-     * @param string $name name of handler to load
65
-     *
66
-     * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler
67
-     */
68
-    public function getHandler($name)
69
-    {
70
-        $ret = false;
61
+	/**
62
+	 * Get an Object Handler
63
+	 *
64
+	 * @param string $name name of handler to load
65
+	 *
66
+	 * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler
67
+	 */
68
+	public function getHandler($name)
69
+	{
70
+		$ret = false;
71 71
 
72
-        $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler';
73
-        if (!\class_exists($class)) {
74
-            throw new \RuntimeException("Class '$class' not found");
75
-        }
76
-        /** @var \XoopsMySQLDatabase $db */
77
-        $db     = \XoopsDatabaseFactory::getDatabaseConnection();
78
-        $helper = self::getInstance();
79
-        $ret    = new $class($db, $helper);
80
-        $this->addLog("Getting handler '{$name}'");
72
+		$class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler';
73
+		if (!\class_exists($class)) {
74
+			throw new \RuntimeException("Class '$class' not found");
75
+		}
76
+		/** @var \XoopsMySQLDatabase $db */
77
+		$db     = \XoopsDatabaseFactory::getDatabaseConnection();
78
+		$helper = self::getInstance();
79
+		$ret    = new $class($db, $helper);
80
+		$this->addLog("Getting handler '{$name}'");
81 81
 
82
-        return $ret;
83
-    }
82
+		return $ret;
83
+	}
84 84
 }
Please login to merge, or discard this patch.
class/Common/Breadcrumb.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -25,39 +25,39 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class Breadcrumb
27 27
 {
28
-    public  $dirname;
29
-    private $bread = [];
28
+	public  $dirname;
29
+	private $bread = [];
30 30
 
31
-    public function __construct()
32
-    {
33
-        $this->dirname = \basename(\dirname(__DIR__, 2));
34
-    }
31
+	public function __construct()
32
+	{
33
+		$this->dirname = \basename(\dirname(__DIR__, 2));
34
+	}
35 35
 
36
-    /**
37
-     * Add link to breadcrumb
38
-     *
39
-     * @param string $title
40
-     * @param string $link
41
-     */
42
-    public function addLink($title = '', $link = ''): void
43
-    {
44
-        $this->bread[] = [
45
-            'link'  => $link,
46
-            'title' => $title,
47
-        ];
48
-    }
36
+	/**
37
+	 * Add link to breadcrumb
38
+	 *
39
+	 * @param string $title
40
+	 * @param string $link
41
+	 */
42
+	public function addLink($title = '', $link = ''): void
43
+	{
44
+		$this->bread[] = [
45
+			'link'  => $link,
46
+			'title' => $title,
47
+		];
48
+	}
49 49
 
50
-    /**
51
-     * Render BreadCrumb
52
-     */
53
-    public function render(): void
54
-    {
55
-        /*
50
+	/**
51
+	 * Render BreadCrumb
52
+	 */
53
+	public function render(): void
54
+	{
55
+		/*
56 56
         TODO if you want to use the render code below,
57 57
         1) create ./templates/chess_common_breadcrumb.tpl)
58 58
         2) add declaration to  xoops_version.php
59 59
         */
60
-        /*
60
+		/*
61 61
         if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) {
62 62
             require $GLOBALS['xoops']->path('class/theme.php');
63 63
 
@@ -76,5 +76,5 @@  discard block
 block discarded – undo
76 76
 
77 77
         return $html;
78 78
         */
79
-    }
79
+	}
80 80
 }
Please login to merge, or discard this patch.
class/Common/TestdataButtons.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 
63 63
         if (self::SHOW_BUTTONS == $displaySampleButton) {
64 64
             \xoops_loadLanguage('admin/modulesadmin', 'system');
65
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add');
66
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add');
67
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert');
65
+            $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add');
66
+            $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add');
67
+            $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert');
68 68
             //    $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), $helper->url( 'testdata/index.php?op=exportschema'), 'add');
69
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete');
69
+            $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete');
70 70
         } else {
71
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add');
71
+            $adminObject->addItemButton(\constant('CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add');
72 72
             // $displaySampleButton = $config['displaySampleButton'];
73 73
         }
74 74
     }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public static function hideButtons(): void
82 82
     {
83
-        $yamlFile                   = \dirname(__DIR__, 2) . '/config/admin.yml';
83
+        $yamlFile                   = \dirname(__DIR__, 2).'/config/admin.yml';
84 84
         $app                        = [];
85 85
         $app['displaySampleButton'] = 0;
86 86
         Yaml::save($app, $yamlFile);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public static function showButtons(): void
96 96
     {
97
-        $yamlFile                   = \dirname(__DIR__, 2) . '/config/admin.yml';
97
+        $yamlFile                   = \dirname(__DIR__, 2).'/config/admin.yml';
98 98
         $app                        = [];
99 99
         $app['displaySampleButton'] = 1;
100 100
         Yaml::save($app, $yamlFile);
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 use Xmf\{
26
-    Module\Admin,
27
-    Request,
28
-    Yaml
26
+	Module\Admin,
27
+	Request,
28
+	Yaml
29 29
 };
30 30
 use XoopsModules\Myiframe\{
31
-    Helper
31
+	Helper
32 32
 };
33 33
 
34 34
 /** @var Helper $helper */
@@ -40,65 +40,65 @@  discard block
 block discarded – undo
40 40
  */
41 41
 class TestdataButtons
42 42
 {
43
-    /** Button status constants */
44
-    private const SHOW_BUTTONS = 1;
45
-    private const HIDE_BUTTONS = 0;
43
+	/** Button status constants */
44
+	private const SHOW_BUTTONS = 1;
45
+	private const HIDE_BUTTONS = 0;
46 46
 
47
-    /**
48
-     * Load the test button configuration
49
-     *
50
-     * @param \Xmf\Module\Admin $adminObject
51
-     *
52
-     * @return void
53
-     */
54
-    public static function loadButtonConfig($adminObject): void
55
-    {
56
-        $moduleDirName      = \basename(\dirname(__DIR__, 2));
57
-        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
58
-        $helper             = Helper::getInstance();
59
-        $yamlFile           = $helper->path('/config/admin.yml');
60
-        /** @var array $config */
61
-        $config              = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps
62
-        $displaySampleButton = $config['displaySampleButton'];
47
+	/**
48
+	 * Load the test button configuration
49
+	 *
50
+	 * @param \Xmf\Module\Admin $adminObject
51
+	 *
52
+	 * @return void
53
+	 */
54
+	public static function loadButtonConfig($adminObject): void
55
+	{
56
+		$moduleDirName      = \basename(\dirname(__DIR__, 2));
57
+		$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
58
+		$helper             = Helper::getInstance();
59
+		$yamlFile           = $helper->path('/config/admin.yml');
60
+		/** @var array $config */
61
+		$config              = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps
62
+		$displaySampleButton = $config['displaySampleButton'];
63 63
 
64
-        if (self::SHOW_BUTTONS == $displaySampleButton) {
65
-            \xoops_loadLanguage('admin/modulesadmin', 'system');
66
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add');
67
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add');
68
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert');
69
-            //    $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), $helper->url( 'testdata/index.php?op=exportschema'), 'add');
70
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete');
71
-        } else {
72
-            $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add');
73
-            // $displaySampleButton = $config['displaySampleButton'];
74
-        }
75
-    }
64
+		if (self::SHOW_BUTTONS == $displaySampleButton) {
65
+			\xoops_loadLanguage('admin/modulesadmin', 'system');
66
+			$adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add');
67
+			$adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add');
68
+			$adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert');
69
+			//    $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), $helper->url( 'testdata/index.php?op=exportschema'), 'add');
70
+			$adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete');
71
+		} else {
72
+			$adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add');
73
+			// $displaySampleButton = $config['displaySampleButton'];
74
+		}
75
+	}
76 76
 
77
-    /**
78
-     * Hide the test buttons
79
-     *
80
-     * @return void
81
-     */
82
-    public static function hideButtons(): void
83
-    {
84
-        $yamlFile                   = \dirname(__DIR__, 2) . '/config/admin.yml';
85
-        $app                        = [];
86
-        $app['displaySampleButton'] = 0;
87
-        Yaml::save($app, $yamlFile);
88
-        \redirect_header('index.php', 0, '');
89
-    }
77
+	/**
78
+	 * Hide the test buttons
79
+	 *
80
+	 * @return void
81
+	 */
82
+	public static function hideButtons(): void
83
+	{
84
+		$yamlFile                   = \dirname(__DIR__, 2) . '/config/admin.yml';
85
+		$app                        = [];
86
+		$app['displaySampleButton'] = 0;
87
+		Yaml::save($app, $yamlFile);
88
+		\redirect_header('index.php', 0, '');
89
+	}
90 90
 
91
-    /**
92
-     * Show the test buttons
93
-     *
94
-     * @return void
95
-     */
96
-    public static function showButtons(): void
97
-    {
98
-        $yamlFile                   = \dirname(__DIR__, 2) . '/config/admin.yml';
99
-        $app                        = [];
100
-        $app['displaySampleButton'] = 1;
101
-        Yaml::save($app, $yamlFile);
102
-        \redirect_header('index.php', 0, '');
103
-    }
91
+	/**
92
+	 * Show the test buttons
93
+	 *
94
+	 * @return void
95
+	 */
96
+	public static function showButtons(): void
97
+	{
98
+		$yamlFile                   = \dirname(__DIR__, 2) . '/config/admin.yml';
99
+		$app                        = [];
100
+		$app['displaySampleButton'] = 1;
101
+		Yaml::save($app, $yamlFile);
102
+		\redirect_header('index.php', 0, '');
103
+	}
104 104
 }
Please login to merge, or discard this patch.
class/Common/ServerStats.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
         //        $sql   .= " WHERE metakey='version' LIMIT 1";
37 37
         //        $query = $GLOBALS['xoopsDB']->query($sql);
38 38
         //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
39
-        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
39
+        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>".\constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO')."</legend>\n";
40 40
         $html .= "<div style='padding: 8px;'>\n";
41 41
         //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
42 42
         //        $html .= "<br>\n";
43 43
         //        $html .= "<br>\n";
44
-        $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
44
+        $html .= '<div>'.\constant('CO_'.$moduleDirNameUpper.'_SPHPINI')."</div>\n";
45 45
         $html .= "<ul>\n";
46 46
 
47
-        $gdlib = \function_exists('gd_info') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
48
-        $html  .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
47
+        $gdlib = \function_exists('gd_info') ? '<span style="color: green;">'.\constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: red;">'.\constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>';
48
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib;
49 49
         if (\function_exists('gd_info')) {
50 50
             if (true === ($gdlib = gd_info())) {
51
-                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
51
+                $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>';
52 52
             }
53 53
         }
54 54
         //
@@ -58,18 +58,18 @@  discard block
 block discarded – undo
58 58
         //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
59 59
         //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
60 60
         //
61
-        $downloads = \ini_get('file_uploads') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
62
-        $html      .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
61
+        $downloads = \ini_get('file_uploads') ? '<span style="color: green;">'.\constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: red;">'.\constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>';
62
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads;
63 63
 
64
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . \ini_get('upload_max_filesize') . "</span></b>\n";
65
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . \ini_get('post_max_size') . "</span></b>\n";
66
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . \ini_get('memory_limit') . "</span></b>\n";
64
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: blue;">'.\ini_get('upload_max_filesize')."</span></b>\n";
65
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: blue;">'.\ini_get('post_max_size')."</span></b>\n";
66
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: blue;">'.\ini_get('memory_limit')."</span></b>\n";
67 67
         $html .= "</ul>\n";
68 68
         $html .= "<ul>\n";
69
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
69
+        $html .= '<li>'.\constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH."</b>\n";
70 70
         $html .= "</ul>\n";
71 71
         $html .= "<br>\n";
72
-        $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
72
+        $html .= \constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC')."\n";
73 73
         $html .= '</div>';
74 74
         $html .= '</fieldset><br>';
75 75
 
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -19,60 +19,60 @@
 block discarded – undo
19 19
  */
20 20
 trait ServerStats
21 21
 {
22
-    /**
23
-     * serverStats()
24
-     *
25
-     * @return string
26
-     */
27
-    public static function getServerStats(): string
28
-    {
29
-        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
30
-        $moduleDirName      = \basename(\dirname(__DIR__, 2));
31
-        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
32
-        \xoops_loadLanguage('common', $moduleDirName);
33
-        $html = '';
34
-        //        $sql   = 'SELECT metavalue';
35
-        //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
36
-        //        $sql   .= " WHERE metakey='version' LIMIT 1";
37
-        //        $query = $GLOBALS['xoopsDB']->query($sql);
38
-        //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
39
-        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
40
-        $html .= "<div style='padding: 8px;'>\n";
41
-        //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
42
-        //        $html .= "<br>\n";
43
-        //        $html .= "<br>\n";
44
-        $html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
45
-        $html .= "<ul>\n";
22
+	/**
23
+	 * serverStats()
24
+	 *
25
+	 * @return string
26
+	 */
27
+	public static function getServerStats(): string
28
+	{
29
+		//mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
30
+		$moduleDirName      = \basename(\dirname(__DIR__, 2));
31
+		$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
32
+		\xoops_loadLanguage('common', $moduleDirName);
33
+		$html = '';
34
+		//        $sql   = 'SELECT metavalue';
35
+		//        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
36
+		//        $sql   .= " WHERE metakey='version' LIMIT 1";
37
+		//        $query = $GLOBALS['xoopsDB']->query($sql);
38
+		//        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
39
+		$html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
40
+		$html .= "<div style='padding: 8px;'>\n";
41
+		//        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
42
+		//        $html .= "<br>\n";
43
+		//        $html .= "<br>\n";
44
+		$html .= '<div>' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
45
+		$html .= "<ul>\n";
46 46
 
47
-        $gdlib = \function_exists('gd_info') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
48
-        $html  .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
49
-        if (\function_exists('gd_info')) {
50
-            if (true === ($gdlib = gd_info())) {
51
-                $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
52
-            }
53
-        }
54
-        //
55
-        //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
56
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
57
-        //
58
-        //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
59
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
60
-        //
61
-        $downloads = \ini_get('file_uploads') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
62
-        $html      .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
47
+		$gdlib = \function_exists('gd_info') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
48
+		$html  .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
49
+		if (\function_exists('gd_info')) {
50
+			if (true === ($gdlib = gd_info())) {
51
+				$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
52
+			}
53
+		}
54
+		//
55
+		//    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
56
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
57
+		//
58
+		//    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
59
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
60
+		//
61
+		$downloads = \ini_get('file_uploads') ? '<span style="color: green;">' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
62
+		$html      .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
63 63
 
64
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . \ini_get('upload_max_filesize') . "</span></b>\n";
65
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . \ini_get('post_max_size') . "</span></b>\n";
66
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . \ini_get('memory_limit') . "</span></b>\n";
67
-        $html .= "</ul>\n";
68
-        $html .= "<ul>\n";
69
-        $html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
70
-        $html .= "</ul>\n";
71
-        $html .= "<br>\n";
72
-        $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
73
-        $html .= '</div>';
74
-        $html .= '</fieldset><br>';
64
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . \ini_get('upload_max_filesize') . "</span></b>\n";
65
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . \ini_get('post_max_size') . "</span></b>\n";
66
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . \ini_get('memory_limit') . "</span></b>\n";
67
+		$html .= "</ul>\n";
68
+		$html .= "<ul>\n";
69
+		$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
70
+		$html .= "</ul>\n";
71
+		$html .= "<br>\n";
72
+		$html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
73
+		$html .= '</div>';
74
+		$html .= '</fieldset><br>';
75 75
 
76
-        return $html;
77
-    }
76
+		return $html;
77
+	}
78 78
 }
Please login to merge, or discard this patch.
class/Common/FilesManagement.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
                     throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder));
33 33
                 }
34 34
 
35
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
35
+                file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
36 36
             }
37 37
         } catch (\Throwable $e) {
38 38
             echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
         $dir = \opendir($src);
58 58
         //        @mkdir($dst);
59 59
         if (!@\mkdir($dst) && !\is_dir($dst)) {
60
-            throw new \RuntimeException('The directory ' . $dst . ' could not be created.');
60
+            throw new \RuntimeException('The directory '.$dst.' could not be created.');
61 61
         }
62 62
         while (false !== ($file = \readdir($dir))) {
63 63
             if (('.' !== $file) && ('..' !== $file)) {
64
-                if (\is_dir($src . '/' . $file)) {
65
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
64
+                if (\is_dir($src.'/'.$file)) {
65
+                    self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
66 66
                 } else {
67
-                    \copy($src . '/' . $file, $dst . '/' . $file);
67
+                    \copy($src.'/'.$file, $dst.'/'.$file);
68 68
                 }
69 69
             }
70 70
         }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 self::rrmdir($fObj->getPathname());
155 155
             }
156 156
         }
157
-        $iterator = null;   // clear iterator Obj to close file/directory
157
+        $iterator = null; // clear iterator Obj to close file/directory
158 158
 
159 159
         return \rmdir($src); // remove the directory & return results
160 160
     }
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
         $iterator = new \DirectoryIterator($src);
189 189
         foreach ($iterator as $fObj) {
190 190
             if ($fObj->isFile()) {
191
-                \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
191
+                \rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
192 192
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
193 193
                 // Try recursively on directory
194
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
194
+                self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
195 195
                 //                rmdir($fObj->getPath()); // now delete the directory
196 196
             }
197 197
         }
198
-        $iterator = null;   // clear iterator Obj to close file/directory
198
+        $iterator = null; // clear iterator Obj to close file/directory
199 199
 
200 200
         return \rmdir($src); // remove the directory & return results
201 201
     }
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
         $iterator = new \DirectoryIterator($src);
233 233
         foreach ($iterator as $fObj) {
234 234
             if ($fObj->isFile()) {
235
-                \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
235
+                \copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
236 236
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
237
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
237
+                self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
238 238
             }
239 239
         }
240 240
 
Please login to merge, or discard this patch.
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -19,226 +19,226 @@
 block discarded – undo
19 19
  */
20 20
 trait FilesManagement
21 21
 {
22
-    /**
23
-     * Function responsible for checking if a directory exists, we can also write in and create an index.html file
24
-     *
25
-     * @param string $folder The full path of the directory to check
26
-     */
27
-    public static function createFolder($folder): void
28
-    {
29
-        try {
30
-            if (!\is_dir($folder)) {
31
-                if (!\is_dir($folder) && !\mkdir($folder) && !\is_dir($folder)) {
32
-                    throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder));
33
-                }
34
-
35
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
36
-            }
37
-        } catch (\Throwable $e) {
38
-            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
39
-        }
40
-    }
41
-
42
-    /**
43
-     * @param string $file
44
-     * @param string $folder
45
-     * @return bool
46
-     */
47
-    public static function copyFile(string $file, string $folder): bool
48
-    {
49
-        return \copy($file, $folder);
50
-    }
51
-
52
-    /**
53
-     * @param $src
54
-     * @param $dst
55
-     */
56
-    public static function recurseCopy($src, $dst): void
57
-    {
58
-        $dir = \opendir($src);
59
-        //        @mkdir($dst);
60
-        if (!@\mkdir($dst) && !\is_dir($dst)) {
61
-            throw new \RuntimeException('The directory ' . $dst . ' could not be created.');
62
-        }
63
-        while (false !== ($file = \readdir($dir))) {
64
-            if (('.' !== $file) && ('..' !== $file)) {
65
-                if (\is_dir($src . '/' . $file)) {
66
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
67
-                } else {
68
-                    \copy($src . '/' . $file, $dst . '/' . $file);
69
-                }
70
-            }
71
-        }
72
-        \closedir($dir);
73
-    }
74
-
75
-    /**
76
-     * Remove files and (sub)directories
77
-     *
78
-     * @param string $src source directory to delete
79
-     *
80
-     * @return bool true on success
81
-     * @uses \Xmf\Module\Helper::isUserAdmin()
82
-     *
83
-     * @uses \Xmf\Module\Helper::getHelper()
84
-     */
85
-    public static function deleteDirectory($src): bool
86
-    {
87
-        // Only continue if user is a 'global' Admin
88
-        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
89
-            return false;
90
-        }
91
-
92
-        $success = true;
93
-        // remove old files
94
-        $dirInfo = new \SplFileInfo($src);
95
-        // validate is a directory
96
-        if ($dirInfo->isDir()) {
97
-            $fileList = \array_diff(\scandir($src, \SCANDIR_SORT_NONE), ['..', '.']);
98
-            foreach ($fileList as $k => $v) {
99
-                $fileInfo = new \SplFileInfo("{$src}/{$v}");
100
-                if ($fileInfo->isDir()) {
101
-                    // recursively handle subdirectories
102
-                    if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
103
-                        break;
104
-                    }
105
-                } elseif (!($success = \unlink($fileInfo->getRealPath()))) {
106
-                    break;
107
-                }
108
-            }
109
-            // now delete this (sub)directory if all the files are gone
110
-            if ($success) {
111
-                $success = \rmdir($dirInfo->getRealPath());
112
-            }
113
-        } else {
114
-            // input is not a valid directory
115
-            $success = false;
116
-        }
117
-
118
-        return $success;
119
-    }
120
-
121
-    /**
122
-     * Recursively remove directory
123
-     *
124
-     * @todo currently won't remove directories with hidden files, should it?
125
-     *
126
-     * @param string $src directory to remove (delete)
127
-     *
128
-     * @return bool true on success
129
-     */
130
-    public static function rrmdir($src): bool
131
-    {
132
-        // Only continue if user is a 'global' Admin
133
-        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
134
-            return false;
135
-        }
136
-
137
-        // If source is not a directory stop processing
138
-        if (!\is_dir($src)) {
139
-            return false;
140
-        }
141
-
142
-        $success = true;
143
-
144
-        // Open the source directory to read in files
145
-        $iterator = new \DirectoryIterator($src);
146
-        foreach ($iterator as $fObj) {
147
-            if ($fObj->isFile()) {
148
-                $filename = $fObj->getPathname();
149
-                $fObj     = null; // clear this iterator object to close the file
150
-                if (!\unlink($filename)) {
151
-                    return false; // couldn't delete the file
152
-                }
153
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
154
-                // Try recursively on directory
155
-                self::rrmdir($fObj->getPathname());
156
-            }
157
-        }
158
-        $iterator = null;   // clear iterator Obj to close file/directory
159
-
160
-        return \rmdir($src); // remove the directory & return results
161
-    }
162
-
163
-    /**
164
-     * Recursively move files from one directory to another
165
-     *
166
-     * @param string $src  - Source of files being moved
167
-     * @param string $dest - Destination of files being moved
168
-     *
169
-     * @return bool true on success
170
-     */
171
-    public static function rmove($src, $dest): bool
172
-    {
173
-        // Only continue if user is a 'global' Admin
174
-        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
175
-            return false;
176
-        }
177
-
178
-        // If source is not a directory stop processing
179
-        if (!\is_dir($src)) {
180
-            return false;
181
-        }
182
-
183
-        // If the destination directory does not exist and could not be created stop processing
184
-        if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) {
185
-            return false;
186
-        }
187
-
188
-        // Open the source directory to read in files
189
-        $iterator = new \DirectoryIterator($src);
190
-        foreach ($iterator as $fObj) {
191
-            if ($fObj->isFile()) {
192
-                \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
193
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
194
-                // Try recursively on directory
195
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
196
-                //                rmdir($fObj->getPath()); // now delete the directory
197
-            }
198
-        }
199
-        $iterator = null;   // clear iterator Obj to close file/directory
200
-
201
-        return \rmdir($src); // remove the directory & return results
202
-    }
203
-
204
-    /**
205
-     * Recursively copy directories and files from one directory to another
206
-     *
207
-     * @param string $src  - Source of files being moved
208
-     * @param string $dest - Destination of files being moved
209
-     *
210
-     * @return bool true on success
211
-     * @uses \Xmf\Module\Helper::isUserAdmin()
212
-     *
213
-     * @uses \Xmf\Module\Helper::getHelper()
214
-     */
215
-    public static function rcopy($src, $dest): bool
216
-    {
217
-        // Only continue if user is a 'global' Admin
218
-        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
219
-            return false;
220
-        }
221
-
222
-        // If source is not a directory stop processing
223
-        if (!\is_dir($src)) {
224
-            return false;
225
-        }
226
-
227
-        // If the destination directory does not exist and could not be created stop processing
228
-        if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) {
229
-            return false;
230
-        }
231
-
232
-        // Open the source directory to read in files
233
-        $iterator = new \DirectoryIterator($src);
234
-        foreach ($iterator as $fObj) {
235
-            if ($fObj->isFile()) {
236
-                \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
237
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
238
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
239
-            }
240
-        }
241
-
242
-        return true;
243
-    }
22
+	/**
23
+	 * Function responsible for checking if a directory exists, we can also write in and create an index.html file
24
+	 *
25
+	 * @param string $folder The full path of the directory to check
26
+	 */
27
+	public static function createFolder($folder): void
28
+	{
29
+		try {
30
+			if (!\is_dir($folder)) {
31
+				if (!\is_dir($folder) && !\mkdir($folder) && !\is_dir($folder)) {
32
+					throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder));
33
+				}
34
+
35
+				file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
36
+			}
37
+		} catch (\Throwable $e) {
38
+			echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
39
+		}
40
+	}
41
+
42
+	/**
43
+	 * @param string $file
44
+	 * @param string $folder
45
+	 * @return bool
46
+	 */
47
+	public static function copyFile(string $file, string $folder): bool
48
+	{
49
+		return \copy($file, $folder);
50
+	}
51
+
52
+	/**
53
+	 * @param $src
54
+	 * @param $dst
55
+	 */
56
+	public static function recurseCopy($src, $dst): void
57
+	{
58
+		$dir = \opendir($src);
59
+		//        @mkdir($dst);
60
+		if (!@\mkdir($dst) && !\is_dir($dst)) {
61
+			throw new \RuntimeException('The directory ' . $dst . ' could not be created.');
62
+		}
63
+		while (false !== ($file = \readdir($dir))) {
64
+			if (('.' !== $file) && ('..' !== $file)) {
65
+				if (\is_dir($src . '/' . $file)) {
66
+					self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
67
+				} else {
68
+					\copy($src . '/' . $file, $dst . '/' . $file);
69
+				}
70
+			}
71
+		}
72
+		\closedir($dir);
73
+	}
74
+
75
+	/**
76
+	 * Remove files and (sub)directories
77
+	 *
78
+	 * @param string $src source directory to delete
79
+	 *
80
+	 * @return bool true on success
81
+	 * @uses \Xmf\Module\Helper::isUserAdmin()
82
+	 *
83
+	 * @uses \Xmf\Module\Helper::getHelper()
84
+	 */
85
+	public static function deleteDirectory($src): bool
86
+	{
87
+		// Only continue if user is a 'global' Admin
88
+		if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
89
+			return false;
90
+		}
91
+
92
+		$success = true;
93
+		// remove old files
94
+		$dirInfo = new \SplFileInfo($src);
95
+		// validate is a directory
96
+		if ($dirInfo->isDir()) {
97
+			$fileList = \array_diff(\scandir($src, \SCANDIR_SORT_NONE), ['..', '.']);
98
+			foreach ($fileList as $k => $v) {
99
+				$fileInfo = new \SplFileInfo("{$src}/{$v}");
100
+				if ($fileInfo->isDir()) {
101
+					// recursively handle subdirectories
102
+					if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
103
+						break;
104
+					}
105
+				} elseif (!($success = \unlink($fileInfo->getRealPath()))) {
106
+					break;
107
+				}
108
+			}
109
+			// now delete this (sub)directory if all the files are gone
110
+			if ($success) {
111
+				$success = \rmdir($dirInfo->getRealPath());
112
+			}
113
+		} else {
114
+			// input is not a valid directory
115
+			$success = false;
116
+		}
117
+
118
+		return $success;
119
+	}
120
+
121
+	/**
122
+	 * Recursively remove directory
123
+	 *
124
+	 * @todo currently won't remove directories with hidden files, should it?
125
+	 *
126
+	 * @param string $src directory to remove (delete)
127
+	 *
128
+	 * @return bool true on success
129
+	 */
130
+	public static function rrmdir($src): bool
131
+	{
132
+		// Only continue if user is a 'global' Admin
133
+		if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
134
+			return false;
135
+		}
136
+
137
+		// If source is not a directory stop processing
138
+		if (!\is_dir($src)) {
139
+			return false;
140
+		}
141
+
142
+		$success = true;
143
+
144
+		// Open the source directory to read in files
145
+		$iterator = new \DirectoryIterator($src);
146
+		foreach ($iterator as $fObj) {
147
+			if ($fObj->isFile()) {
148
+				$filename = $fObj->getPathname();
149
+				$fObj     = null; // clear this iterator object to close the file
150
+				if (!\unlink($filename)) {
151
+					return false; // couldn't delete the file
152
+				}
153
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
154
+				// Try recursively on directory
155
+				self::rrmdir($fObj->getPathname());
156
+			}
157
+		}
158
+		$iterator = null;   // clear iterator Obj to close file/directory
159
+
160
+		return \rmdir($src); // remove the directory & return results
161
+	}
162
+
163
+	/**
164
+	 * Recursively move files from one directory to another
165
+	 *
166
+	 * @param string $src  - Source of files being moved
167
+	 * @param string $dest - Destination of files being moved
168
+	 *
169
+	 * @return bool true on success
170
+	 */
171
+	public static function rmove($src, $dest): bool
172
+	{
173
+		// Only continue if user is a 'global' Admin
174
+		if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
175
+			return false;
176
+		}
177
+
178
+		// If source is not a directory stop processing
179
+		if (!\is_dir($src)) {
180
+			return false;
181
+		}
182
+
183
+		// If the destination directory does not exist and could not be created stop processing
184
+		if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) {
185
+			return false;
186
+		}
187
+
188
+		// Open the source directory to read in files
189
+		$iterator = new \DirectoryIterator($src);
190
+		foreach ($iterator as $fObj) {
191
+			if ($fObj->isFile()) {
192
+				\rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
193
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
194
+				// Try recursively on directory
195
+				self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
196
+				//                rmdir($fObj->getPath()); // now delete the directory
197
+			}
198
+		}
199
+		$iterator = null;   // clear iterator Obj to close file/directory
200
+
201
+		return \rmdir($src); // remove the directory & return results
202
+	}
203
+
204
+	/**
205
+	 * Recursively copy directories and files from one directory to another
206
+	 *
207
+	 * @param string $src  - Source of files being moved
208
+	 * @param string $dest - Destination of files being moved
209
+	 *
210
+	 * @return bool true on success
211
+	 * @uses \Xmf\Module\Helper::isUserAdmin()
212
+	 *
213
+	 * @uses \Xmf\Module\Helper::getHelper()
214
+	 */
215
+	public static function rcopy($src, $dest): bool
216
+	{
217
+		// Only continue if user is a 'global' Admin
218
+		if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
219
+			return false;
220
+		}
221
+
222
+		// If source is not a directory stop processing
223
+		if (!\is_dir($src)) {
224
+			return false;
225
+		}
226
+
227
+		// If the destination directory does not exist and could not be created stop processing
228
+		if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) {
229
+			return false;
230
+		}
231
+
232
+		// Open the source directory to read in files
233
+		$iterator = new \DirectoryIterator($src);
234
+		foreach ($iterator as $fObj) {
235
+			if ($fObj->isFile()) {
236
+				\copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
237
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
238
+				self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
239
+			}
240
+		}
241
+
242
+		return true;
243
+	}
244 244
 }
Please login to merge, or discard this patch.
class/Common/Configurator.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -24,41 +24,41 @@
 block discarded – undo
24 24
  */
25 25
 class Configurator
26 26
 {
27
-    public $name;
28
-    public $paths           = [];
29
-    public $uploadFolders   = [];
30
-    public $copyBlankFiles  = [];
31
-    public $copyTestFolders = [];
32
-    public $templateFolders = [];
33
-    public $oldFiles        = [];
34
-    public $oldFolders      = [];
35
-    public $renameTables    = [];
36
-    public $renameColumns   = [];
37
-    public $moduleStats     = [];
38
-    public $modCopyright;
39
-    public $icons;
27
+	public $name;
28
+	public $paths           = [];
29
+	public $uploadFolders   = [];
30
+	public $copyBlankFiles  = [];
31
+	public $copyTestFolders = [];
32
+	public $templateFolders = [];
33
+	public $oldFiles        = [];
34
+	public $oldFolders      = [];
35
+	public $renameTables    = [];
36
+	public $renameColumns   = [];
37
+	public $moduleStats     = [];
38
+	public $modCopyright;
39
+	public $icons;
40 40
 
41
-    /**
42
-     * Configurator constructor.
43
-     */
44
-    public function __construct()
45
-    {
46
-        $config = require \dirname(__DIR__, 2) . '/config/config.php';
41
+	/**
42
+	 * Configurator constructor.
43
+	 */
44
+	public function __construct()
45
+	{
46
+		$config = require \dirname(__DIR__, 2) . '/config/config.php';
47 47
 
48
-        $this->name            = $config->name;
49
-        $this->paths           = $config->paths;
50
-        $this->uploadFolders   = $config->uploadFolders;
51
-        $this->copyBlankFiles  = $config->copyBlankFiles;
52
-        $this->copyTestFolders = $config->copyTestFolders;
53
-        $this->templateFolders = $config->templateFolders;
54
-        $this->oldFiles        = $config->oldFiles;
55
-        $this->oldFolders      = $config->oldFolders;
56
-        $this->renameTables    = $config->renameTables;
57
-        $this->renameColumns   = $config->renameColumns;
58
-        $this->moduleStats     = $config->moduleStats;
59
-        $this->modCopyright    = $config->modCopyright;
48
+		$this->name            = $config->name;
49
+		$this->paths           = $config->paths;
50
+		$this->uploadFolders   = $config->uploadFolders;
51
+		$this->copyBlankFiles  = $config->copyBlankFiles;
52
+		$this->copyTestFolders = $config->copyTestFolders;
53
+		$this->templateFolders = $config->templateFolders;
54
+		$this->oldFiles        = $config->oldFiles;
55
+		$this->oldFolders      = $config->oldFolders;
56
+		$this->renameTables    = $config->renameTables;
57
+		$this->renameColumns   = $config->renameColumns;
58
+		$this->moduleStats     = $config->moduleStats;
59
+		$this->modCopyright    = $config->modCopyright;
60 60
 
61
-        $this->icons = require \dirname(__DIR__, 2) . '/config/icons.php';
62
-        $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php';
63
-    }
61
+		$this->icons = require \dirname(__DIR__, 2) . '/config/icons.php';
62
+		$this->paths = require \dirname(__DIR__, 2) . '/config/paths.php';
63
+	}
64 64
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function __construct()
45 45
     {
46
-        $config = require \dirname(__DIR__, 2) . '/config/config.php';
46
+        $config = require \dirname(__DIR__, 2).'/config/config.php';
47 47
 
48 48
         $this->name            = $config->name;
49 49
         $this->paths           = $config->paths;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $this->moduleStats     = $config->moduleStats;
59 59
         $this->modCopyright    = $config->modCopyright;
60 60
 
61
-        $this->icons = require \dirname(__DIR__, 2) . '/config/icons.php';
62
-        $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php';
61
+        $this->icons = require \dirname(__DIR__, 2).'/config/icons.php';
62
+        $this->paths = require \dirname(__DIR__, 2).'/config/paths.php';
63 63
     }
64 64
 }
Please login to merge, or discard this patch.
class/MyiframeBase.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -15,50 +15,50 @@
 block discarded – undo
15 15
  */
16 16
 class MyiframeBase extends \XoopsObject
17 17
 {
18
-    //    /** @var \XoopsMySQLDatabase */
19
-    public $db;
18
+	//    /** @var \XoopsMySQLDatabase */
19
+	public $db;
20 20
 
21
-    /**
22
-     * myiframe constructor.
23
-     * @param null $id
24
-     */
25
-    public function __construct($id = null)
26
-    {
27
-        $this->db = \XoopsDatabaseFactory::getDatabaseConnection();
28
-        $this->initVar('frame_frameid', \XOBJ_DTYPE_INT, null, false, 10);
29
-        $this->initVar('frame_created', \XOBJ_DTYPE_INT, null, false, 10);
30
-        $this->initVar('frame_uid', \XOBJ_DTYPE_INT, null, false, 10);
31
-        $this->initVar('frame_description', \XOBJ_DTYPE_TXTBOX, null, false, 255);
32
-        $this->initVar('frame_width', \XOBJ_DTYPE_TXTBOX, null, false, 15);
33
-        $this->initVar('frame_height', \XOBJ_DTYPE_TXTBOX, null, false, 15);
34
-        $this->initVar('frame_align', \XOBJ_DTYPE_INT, null, false, 10);
35
-        $this->initVar('frame_frameborder', \XOBJ_DTYPE_INT, null, false, 10);
36
-        $this->initVar('frame_marginwidth', \XOBJ_DTYPE_INT, null, false, 10);
37
-        $this->initVar('frame_marginheight', \XOBJ_DTYPE_INT, null, false, 10);
38
-        $this->initVar('frame_scrolling', \XOBJ_DTYPE_INT, null, false, 10);
39
-        $this->initVar('frame_hits', \XOBJ_DTYPE_INT, null, false, 10);
40
-        $this->initVar('frame_url', \XOBJ_DTYPE_TXTBOX, null, false, 255);
41
-        if (!empty($id)) {
42
-            if (\is_array($id)) {
43
-                $this->assignVars($id);
44
-            } else {
45
-                $this->load((int)$id);
46
-            }
47
-        } else {
48
-            $this->setNew();
49
-        }
50
-    }
21
+	/**
22
+	 * myiframe constructor.
23
+	 * @param null $id
24
+	 */
25
+	public function __construct($id = null)
26
+	{
27
+		$this->db = \XoopsDatabaseFactory::getDatabaseConnection();
28
+		$this->initVar('frame_frameid', \XOBJ_DTYPE_INT, null, false, 10);
29
+		$this->initVar('frame_created', \XOBJ_DTYPE_INT, null, false, 10);
30
+		$this->initVar('frame_uid', \XOBJ_DTYPE_INT, null, false, 10);
31
+		$this->initVar('frame_description', \XOBJ_DTYPE_TXTBOX, null, false, 255);
32
+		$this->initVar('frame_width', \XOBJ_DTYPE_TXTBOX, null, false, 15);
33
+		$this->initVar('frame_height', \XOBJ_DTYPE_TXTBOX, null, false, 15);
34
+		$this->initVar('frame_align', \XOBJ_DTYPE_INT, null, false, 10);
35
+		$this->initVar('frame_frameborder', \XOBJ_DTYPE_INT, null, false, 10);
36
+		$this->initVar('frame_marginwidth', \XOBJ_DTYPE_INT, null, false, 10);
37
+		$this->initVar('frame_marginheight', \XOBJ_DTYPE_INT, null, false, 10);
38
+		$this->initVar('frame_scrolling', \XOBJ_DTYPE_INT, null, false, 10);
39
+		$this->initVar('frame_hits', \XOBJ_DTYPE_INT, null, false, 10);
40
+		$this->initVar('frame_url', \XOBJ_DTYPE_TXTBOX, null, false, 255);
41
+		if (!empty($id)) {
42
+			if (\is_array($id)) {
43
+				$this->assignVars($id);
44
+			} else {
45
+				$this->load((int)$id);
46
+			}
47
+		} else {
48
+			$this->setNew();
49
+		}
50
+	}
51 51
 
52
-    /**
53
-     * @param $id
54
-     */
55
-    public function load($id): void
56
-    {
57
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id;
58
-        $myrow = $this->db->fetchArray($this->db->query($sql));
59
-        $this->assignVars($myrow);
60
-        if (!$myrow) {
61
-            $this->setNew();
62
-        }
63
-    }
52
+	/**
53
+	 * @param $id
54
+	 */
55
+	public function load($id): void
56
+	{
57
+		$sql   = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id;
58
+		$myrow = $this->db->fetchArray($this->db->query($sql));
59
+		$this->assignVars($myrow);
60
+		if (!$myrow) {
61
+			$this->setNew();
62
+		}
63
+	}
64 64
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * Copyright (c) Hervé Thouzard of Instant Zero (https://www.instant-zero.com)
9 9
  * ****************************************************************************
10 10
  */
11
-require_once XOOPS_ROOT_PATH . '/kernel/object.php';
11
+require_once XOOPS_ROOT_PATH.'/kernel/object.php';
12 12
 
13 13
 /**
14 14
  * Class Myiframe
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             if (\is_array($id)) {
43 43
                 $this->assignVars($id);
44 44
             } else {
45
-                $this->load((int)$id);
45
+                $this->load((int) $id);
46 46
             }
47 47
         } else {
48 48
             $this->setNew();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function load($id): void
56 56
     {
57
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id;
57
+        $sql   = 'SELECT * FROM '.$this->db->prefix('myiframe').' WHERE frame_frameid='.(int) $id;
58 58
         $myrow = $this->db->fetchArray($this->db->query($sql));
59 59
         $this->assignVars($myrow);
60 60
         if (!$myrow) {
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -18,81 +18,81 @@
 block discarded – undo
18 18
 
19 19
 $suplparam = '';
20 20
 if (isset($_GET)) {
21
-    foreach ($_GET as $k => $v) {
22
-        if ('IFRAMEID' !== \mb_strtoupper(trim($k))) {
23
-            $suplparam .= $k . '=' . $v . '&';
24
-        }
25
-    }
21
+	foreach ($_GET as $k => $v) {
22
+		if ('IFRAMEID' !== \mb_strtoupper(trim($k))) {
23
+			$suplparam .= $k . '=' . $v . '&';
24
+		}
25
+	}
26 26
 }
27 27
 
28 28
 if (mb_strlen(xoops_trim($suplparam)) > 0) {
29
-    $suplparam = mb_substr($suplparam, 0, -1);
29
+	$suplparam = mb_substr($suplparam, 0, -1);
30 30
 }
31 31
 
32 32
 /** @var \MyiframeBaseHandler $iframeHandler */
33 33
 $iframeHandler = $helper->getHandler('MyiframeBase');
34 34
 
35 35
 if (Request::hasVar('iframeid', 'GET')) {
36
-    $tblalign     = [
37
-        'top',
38
-        'middle',
39
-        'bottom',
40
-        'left',
41
-        'rigth',
42
-    ];
43
-    $tblscrolling = [
44
-        'yes',
45
-        'no',
46
-        'auto',
47
-    ];
48
-    $frameid      = Request::getInt('iframeid', 0, 'GET');
36
+	$tblalign     = [
37
+		'top',
38
+		'middle',
39
+		'bottom',
40
+		'left',
41
+		'rigth',
42
+	];
43
+	$tblscrolling = [
44
+		'yes',
45
+		'no',
46
+		'auto',
47
+	];
48
+	$frameid      = Request::getInt('iframeid', 0, 'GET');
49 49
 
50
-    $frame = $iframeHandler->get($frameid);
50
+	$frame = $iframeHandler->get($frameid);
51 51
 
52
-    if (is_object($frame)) {
53
-        $iframeHandler->updatehits($frameid);
54
-        $xoopsTpl->assign('frameok', true);
55
-        $xoopsTpl->assign('longdesc', $frame->getVar('frame_description'));
56
-        $xoopsTpl->assign('width', $frame->getVar('frame_width'));
57
-        $xoopsTpl->assign('height', $frame->getVar('frame_height'));
58
-        $xoopsTpl->assign('align', $tblalign[(string)($frame->getVar('frame_align') - 1)]);
59
-        $xoopsTpl->assign('frameborder', $frame->getVar('frame_frameborder'));
60
-        $xoopsTpl->assign('marginwidth', $frame->getVar('frame_marginwidth'));
61
-        $xoopsTpl->assign('marginheight', $frame->getVar('frame_marginheight'));
62
-        $xoopsTpl->assign('scrolling', $tblscrolling[(string)($frame->getVar('frame_scrolling') - 1)]);
63
-        if ('' !== xoops_trim($suplparam)) {
64
-            $xoopsTpl->assign('url', $frame->getVar('frame_url') . '?' . $suplparam);
65
-        } else {
66
-            $xoopsTpl->assign('url', $frame->getVar('frame_url'));
67
-        }
68
-        $title = $frame->getVar('frame_description');
69
-        myiframe_set_metas($title, $title);
70
-    } else {
71
-        $xoopsTpl->assign('frameok', false);
72
-        $xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR);
73
-    }
52
+	if (is_object($frame)) {
53
+		$iframeHandler->updatehits($frameid);
54
+		$xoopsTpl->assign('frameok', true);
55
+		$xoopsTpl->assign('longdesc', $frame->getVar('frame_description'));
56
+		$xoopsTpl->assign('width', $frame->getVar('frame_width'));
57
+		$xoopsTpl->assign('height', $frame->getVar('frame_height'));
58
+		$xoopsTpl->assign('align', $tblalign[(string)($frame->getVar('frame_align') - 1)]);
59
+		$xoopsTpl->assign('frameborder', $frame->getVar('frame_frameborder'));
60
+		$xoopsTpl->assign('marginwidth', $frame->getVar('frame_marginwidth'));
61
+		$xoopsTpl->assign('marginheight', $frame->getVar('frame_marginheight'));
62
+		$xoopsTpl->assign('scrolling', $tblscrolling[(string)($frame->getVar('frame_scrolling') - 1)]);
63
+		if ('' !== xoops_trim($suplparam)) {
64
+			$xoopsTpl->assign('url', $frame->getVar('frame_url') . '?' . $suplparam);
65
+		} else {
66
+			$xoopsTpl->assign('url', $frame->getVar('frame_url'));
67
+		}
68
+		$title = $frame->getVar('frame_description');
69
+		myiframe_set_metas($title, $title);
70
+	} else {
71
+		$xoopsTpl->assign('frameok', false);
72
+		$xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR);
73
+	}
74 74
 } else {
75
-    if (myiframe_getmoduleoption('showlist')) {
76
-        $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php';
77
-        $frarray = [];
78
-        $critere = new \Criteria('1', '1', '=');
79
-        $critere->setSort('frame_description');
80
-        $frarray = $iframeHandler->getObjects($critere);
81
-        if (count($frarray) > 0) {
82
-            foreach ($frarray as $frame) {
83
-                /** @var Myiframe $frame */
84
-                if ('' === xoops_trim($frame->getVar('frame_description'))) {
85
-                    $liendesc = $frame->getVar('frame_url');
86
-                } else {
87
-                    $liendesc = "<a href='" . $baseurl . '?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>';
88
-                }
89
-                $iframe['list'] = $liendesc;
90
-                $xoopsTpl->append('iframes', $iframe);
91
-            }
92
-        }
93
-    } else {
94
-        $xoopsTpl->assign('frameok', false);
95
-        $xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR);
96
-    }
75
+	if (myiframe_getmoduleoption('showlist')) {
76
+		$baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php';
77
+		$frarray = [];
78
+		$critere = new \Criteria('1', '1', '=');
79
+		$critere->setSort('frame_description');
80
+		$frarray = $iframeHandler->getObjects($critere);
81
+		if (count($frarray) > 0) {
82
+			foreach ($frarray as $frame) {
83
+				/** @var Myiframe $frame */
84
+				if ('' === xoops_trim($frame->getVar('frame_description'))) {
85
+					$liendesc = $frame->getVar('frame_url');
86
+				} else {
87
+					$liendesc = "<a href='" . $baseurl . '?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>';
88
+				}
89
+				$iframe['list'] = $liendesc;
90
+				$xoopsTpl->append('iframes', $iframe);
91
+			}
92
+		}
93
+	} else {
94
+		$xoopsTpl->assign('frameok', false);
95
+		$xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR);
96
+	}
97 97
 }
98 98
 require_once XOOPS_ROOT_PATH . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 /** @var Helper $helper */
12 12
 
13 13
 $GLOBALS['xoopsOption']['template_main'] = 'myiframe.tpl';
14
-require __DIR__ . '/header.php';
15
-require_once XOOPS_ROOT_PATH . '/header.php';
14
+require __DIR__.'/header.php';
15
+require_once XOOPS_ROOT_PATH.'/header.php';
16 16
 
17 17
 $tblalign = [];
18 18
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 if (isset($_GET)) {
21 21
     foreach ($_GET as $k => $v) {
22 22
         if ('IFRAMEID' !== \mb_strtoupper(trim($k))) {
23
-            $suplparam .= $k . '=' . $v . '&';
23
+            $suplparam .= $k.'='.$v.'&';
24 24
         }
25 25
     }
26 26
 }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 $iframeHandler = $helper->getHandler('MyiframeBase');
34 34
 
35 35
 if (Request::hasVar('iframeid', 'GET')) {
36
-    $tblalign     = [
36
+    $tblalign = [
37 37
         'top',
38 38
         'middle',
39 39
         'bottom',
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         'no',
46 46
         'auto',
47 47
     ];
48
-    $frameid      = Request::getInt('iframeid', 0, 'GET');
48
+    $frameid = Request::getInt('iframeid', 0, 'GET');
49 49
 
50 50
     $frame = $iframeHandler->get($frameid);
51 51
 
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
         $xoopsTpl->assign('longdesc', $frame->getVar('frame_description'));
56 56
         $xoopsTpl->assign('width', $frame->getVar('frame_width'));
57 57
         $xoopsTpl->assign('height', $frame->getVar('frame_height'));
58
-        $xoopsTpl->assign('align', $tblalign[(string)($frame->getVar('frame_align') - 1)]);
58
+        $xoopsTpl->assign('align', $tblalign[(string) ($frame->getVar('frame_align')-1)]);
59 59
         $xoopsTpl->assign('frameborder', $frame->getVar('frame_frameborder'));
60 60
         $xoopsTpl->assign('marginwidth', $frame->getVar('frame_marginwidth'));
61 61
         $xoopsTpl->assign('marginheight', $frame->getVar('frame_marginheight'));
62
-        $xoopsTpl->assign('scrolling', $tblscrolling[(string)($frame->getVar('frame_scrolling') - 1)]);
62
+        $xoopsTpl->assign('scrolling', $tblscrolling[(string) ($frame->getVar('frame_scrolling')-1)]);
63 63
         if ('' !== xoops_trim($suplparam)) {
64
-            $xoopsTpl->assign('url', $frame->getVar('frame_url') . '?' . $suplparam);
64
+            $xoopsTpl->assign('url', $frame->getVar('frame_url').'?'.$suplparam);
65 65
         } else {
66 66
             $xoopsTpl->assign('url', $frame->getVar('frame_url'));
67 67
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     }
74 74
 } else {
75 75
     if (myiframe_getmoduleoption('showlist')) {
76
-        $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php';
76
+        $baseurl = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/index.php';
77 77
         $frarray = [];
78 78
         $critere = new \Criteria('1', '1', '=');
79 79
         $critere->setSort('frame_description');
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 if ('' === xoops_trim($frame->getVar('frame_description'))) {
85 85
                     $liendesc = $frame->getVar('frame_url');
86 86
                 } else {
87
-                    $liendesc = "<a href='" . $baseurl . '?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>';
87
+                    $liendesc = "<a href='".$baseurl.'?iframeid='.$frame->getVar('frame_frameid')."'>".$frame->getVar('frame_description').'</a>';
88 88
                 }
89 89
                 $iframe['list'] = $liendesc;
90 90
                 $xoopsTpl->append('iframes', $iframe);
@@ -95,4 +95,4 @@  discard block
 block discarded – undo
95 95
         $xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR);
96 96
     }
97 97
 }
98
-require_once XOOPS_ROOT_PATH . '/footer.php';
98
+require_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
xoops_version.php 2 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -14,113 +14,113 @@
 block discarded – undo
14 14
 $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
15 15
 
16 16
 $modversion = [
17
-    'version'             => '1.67.0',
18
-    'module_status'       => 'Beta 2',
19
-    'release_date'        => '2022/03/28',
20
-    'name'                => _MI_MYIFRAME_NAME,
21
-    'description'         => _MI_MYIFRAME_DESC,
22
-    'credits'             => '',
23
-    'author'              => 'Instant Zero - https://xoops.instant-zero.com',
24
-    'help'                => 'page=help',
25
-    'license'             => 'GPL see LICENSE',
26
-    'official'            => 0,
27
-    'image'               => 'assets/images/logoModule.png',
28
-    'dirname'             => basename(__DIR__),
29
-    'min_php'             => '7.4',
30
-    'min_db'              => ['mysql' => '5.5'],
31
-    'min_xoops'           => '2.5.10',
32
-    'min_admin'           => '1.2',
33
-    'module_website_url'  => 'www.xoops.org',
34
-    'module_website_name' => 'XOOPS',
35
-    'module_release'      => '03/28/2022',
36
-    'system_menu'         => 1,
37
-    //sql tables
38
-    'sqlfile'             => ['mysql' => 'sql/mysql.sql'],
39
-    'tables'              => [
40
-        'myiframe',
41
-    ],
42
-    // Admin
43
-    'hasAdmin'            => 1,
44
-    'adminindex'          => 'admin/index.php',
45
-    'adminmenu'           => 'admin/menu.php',
46
-    // Menu
47
-    'hasMain'             => 1,
17
+	'version'             => '1.67.0',
18
+	'module_status'       => 'Beta 2',
19
+	'release_date'        => '2022/03/28',
20
+	'name'                => _MI_MYIFRAME_NAME,
21
+	'description'         => _MI_MYIFRAME_DESC,
22
+	'credits'             => '',
23
+	'author'              => 'Instant Zero - https://xoops.instant-zero.com',
24
+	'help'                => 'page=help',
25
+	'license'             => 'GPL see LICENSE',
26
+	'official'            => 0,
27
+	'image'               => 'assets/images/logoModule.png',
28
+	'dirname'             => basename(__DIR__),
29
+	'min_php'             => '7.4',
30
+	'min_db'              => ['mysql' => '5.5'],
31
+	'min_xoops'           => '2.5.10',
32
+	'min_admin'           => '1.2',
33
+	'module_website_url'  => 'www.xoops.org',
34
+	'module_website_name' => 'XOOPS',
35
+	'module_release'      => '03/28/2022',
36
+	'system_menu'         => 1,
37
+	//sql tables
38
+	'sqlfile'             => ['mysql' => 'sql/mysql.sql'],
39
+	'tables'              => [
40
+		'myiframe',
41
+	],
42
+	// Admin
43
+	'hasAdmin'            => 1,
44
+	'adminindex'          => 'admin/index.php',
45
+	'adminmenu'           => 'admin/menu.php',
46
+	// Menu
47
+	'hasMain'             => 1,
48 48
 ];
49 49
 // ------------------- Help files ------------------- //
50 50
 $modversion['helpsection'] = [
51
-    ['name' => _MI_MYIFRAME_OVERVIEW, 'link' => 'page=help'],
52
-    ['name' => _MI_MYIFRAME_DISCLAIMER, 'link' => 'page=disclaimer'],
53
-    ['name' => _MI_MYIFRAME_LICENSE, 'link' => 'page=license'],
54
-    ['name' => _MI_MYIFRAME_SUPPORT, 'link' => 'page=support'],
51
+	['name' => _MI_MYIFRAME_OVERVIEW, 'link' => 'page=help'],
52
+	['name' => _MI_MYIFRAME_DISCLAIMER, 'link' => 'page=disclaimer'],
53
+	['name' => _MI_MYIFRAME_LICENSE, 'link' => 'page=license'],
54
+	['name' => _MI_MYIFRAME_SUPPORT, 'link' => 'page=support'],
55 55
 ];
56 56
 // ------------------- Templates ------------------- //
57 57
 $modversion['templates'] = [
58
-    ['file' => 'myiframe.tpl', 'description' => 'Default template'],
58
+	['file' => 'myiframe.tpl', 'description' => 'Default template'],
59 59
 ];
60 60
 
61 61
 //Blocks
62 62
 $modversion['blocks'][] = [
63
-    'file'        => 'myiframe_iframe.php',
64
-    'name'        => _MI_MYIFRAME_BNAME1,
65
-    'description' => 'Shows an iframe in a block',
66
-    'show_func'   => 'b_myiframe_iframe_show',
67
-    'edit_func'   => 'b_myiframe_iframe_edit',
68
-    'options'     => '0',
69
-    'template'    => 'myiframe_block_show.tpl',
63
+	'file'        => 'myiframe_iframe.php',
64
+	'name'        => _MI_MYIFRAME_BNAME1,
65
+	'description' => 'Shows an iframe in a block',
66
+	'show_func'   => 'b_myiframe_iframe_show',
67
+	'edit_func'   => 'b_myiframe_iframe_edit',
68
+	'options'     => '0',
69
+	'template'    => 'myiframe_block_show.tpl',
70 70
 ];
71 71
 global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
72 72
 
73 73
 if (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $modversion['dirname'] && $xoopsModule->getVar('isactive')) {
74
-    $i = 0;
75
-    require_once XOOPS_ROOT_PATH . '/modules/myiframe/include/functions.php';
76
-    $myts = \MyTextSanitizer::getInstance();
77
-    if (myiframe_getmoduleoption('showinmenu')) {
78
-        $sql    = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' ORDER BY frame_description';
79
-        $result = $GLOBALS['xoopsDB']->query($sql);
80
-        while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
81
-            if ('' !== xoops_trim($myrow['frame_description'])) {
82
-                $modversion['sub'][$i]['name'] = htmlspecialchars($myrow['frame_description'], ENT_QUOTES | ENT_HTML5);
83
-                $modversion['sub'][$i]['url']  = 'index.php?iframeid=' . (int)$myrow['frame_frameid'];
84
-                $i++;
85
-            }
86
-        }
87
-    }
74
+	$i = 0;
75
+	require_once XOOPS_ROOT_PATH . '/modules/myiframe/include/functions.php';
76
+	$myts = \MyTextSanitizer::getInstance();
77
+	if (myiframe_getmoduleoption('showinmenu')) {
78
+		$sql    = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' ORDER BY frame_description';
79
+		$result = $GLOBALS['xoopsDB']->query($sql);
80
+		while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
81
+			if ('' !== xoops_trim($myrow['frame_description'])) {
82
+				$modversion['sub'][$i]['name'] = htmlspecialchars($myrow['frame_description'], ENT_QUOTES | ENT_HTML5);
83
+				$modversion['sub'][$i]['url']  = 'index.php?iframeid=' . (int)$myrow['frame_frameid'];
84
+				$i++;
85
+			}
86
+		}
87
+	}
88 88
 }
89 89
 // Options
90 90
 $modversion['config'][] = [
91
-    'name'        => 'showinmenu',
92
-    'title'       => '_MI_MYIFRAME_OPT0',
93
-    'description' => '_MI_MYIFRAME_OPT0_DSC',
94
-    'formtype'    => 'yesno',
95
-    'valuetype'   => 'int',
96
-    'default'     => 0,
91
+	'name'        => 'showinmenu',
92
+	'title'       => '_MI_MYIFRAME_OPT0',
93
+	'description' => '_MI_MYIFRAME_OPT0_DSC',
94
+	'formtype'    => 'yesno',
95
+	'valuetype'   => 'int',
96
+	'default'     => 0,
97 97
 ];
98 98
 $modversion['config'][] = [
99
-    'name'        => 'showlist',
100
-    'title'       => '_MI_MYIFRAME_OPT1',
101
-    'description' => '_MI_MYIFRAME_OPT1_DSC',
102
-    'formtype'    => 'yesno',
103
-    'valuetype'   => 'int',
104
-    'default'     => 1,
99
+	'name'        => 'showlist',
100
+	'title'       => '_MI_MYIFRAME_OPT1',
101
+	'description' => '_MI_MYIFRAME_OPT1_DSC',
102
+	'formtype'    => 'yesno',
103
+	'valuetype'   => 'int',
104
+	'default'     => 1,
105 105
 ];
106 106
 
107 107
 // Make Sample button visible?
108 108
 $modversion['config'][] = [
109
-    'name'        => 'displaySampleButton',
110
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
111
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
112
-    'formtype'    => 'yesno',
113
-    'valuetype'   => 'int',
114
-    'default'     => 1,
109
+	'name'        => 'displaySampleButton',
110
+	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
111
+	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
112
+	'formtype'    => 'yesno',
113
+	'valuetype'   => 'int',
114
+	'default'     => 1,
115 115
 ];
116 116
 // Maintained by
117 117
 $modversion['config'][] = [
118
-    'name'        => 'maintainedby',
119
-    'title'       => '\_MI_MYMODULE_MAINTAINEDBY',
120
-    'description' => '\_MI_MYMODULE_MAINTAINEDBY_DESC',
121
-    'formtype'    => 'textbox',
122
-    'valuetype'   => 'text',
123
-    'default'     => 'https://xoops.org/modules/newbb',
118
+	'name'        => 'maintainedby',
119
+	'title'       => '\_MI_MYMODULE_MAINTAINEDBY',
120
+	'description' => '\_MI_MYMODULE_MAINTAINEDBY_DESC',
121
+	'formtype'    => 'textbox',
122
+	'valuetype'   => 'text',
123
+	'default'     => 'https://xoops.org/modules/newbb',
124 124
 ];
125 125
 
126 126
 // Search
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined.');
10 10
 
11
-require_once __DIR__ . '/preloads/autoloader.php';
11
+require_once __DIR__.'/preloads/autoloader.php';
12 12
 
13 13
 $moduleDirName      = \basename(__DIR__);
14 14
 $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 
73 73
 if (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $modversion['dirname'] && $xoopsModule->getVar('isactive')) {
74 74
     $i = 0;
75
-    require_once XOOPS_ROOT_PATH . '/modules/myiframe/include/functions.php';
75
+    require_once XOOPS_ROOT_PATH.'/modules/myiframe/include/functions.php';
76 76
     $myts = \MyTextSanitizer::getInstance();
77 77
     if (myiframe_getmoduleoption('showinmenu')) {
78
-        $sql    = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' ORDER BY frame_description';
78
+        $sql    = 'SELECT * FROM '.$GLOBALS['xoopsDB']->prefix('myiframe').' ORDER BY frame_description';
79 79
         $result = $GLOBALS['xoopsDB']->query($sql);
80 80
         while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
81 81
             if ('' !== xoops_trim($myrow['frame_description'])) {
82 82
                 $modversion['sub'][$i]['name'] = htmlspecialchars($myrow['frame_description'], ENT_QUOTES | ENT_HTML5);
83
-                $modversion['sub'][$i]['url']  = 'index.php?iframeid=' . (int)$myrow['frame_frameid'];
83
+                $modversion['sub'][$i]['url']  = 'index.php?iframeid='.(int) $myrow['frame_frameid'];
84 84
                 $i++;
85 85
             }
86 86
         }
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 // Make Sample button visible?
108 108
 $modversion['config'][] = [
109 109
     'name'        => 'displaySampleButton',
110
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
111
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
110
+    'title'       => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON',
111
+    'description' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON_DESC',
112 112
     'formtype'    => 'yesno',
113 113
     'valuetype'   => 'int',
114 114
     'default'     => 1,
Please login to merge, or discard this patch.