Passed
Pull Request — master (#8)
by Michael
14:42
created
class/MyiframeBaseHandler.php 1 patch
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -15,216 +15,216 @@
 block discarded – undo
15 15
  */
16 16
 class MyiframeBaseHandler extends \XoopsObjectHandler
17 17
 {
18
-    /**
19
-     * @param bool $isNew
20
-     * @return myiframe
21
-     */
22
-    public function create($isNew = true)
23
-    {
24
-        $object = new MyiframeBase();
25
-        if ($isNew) {
26
-            $object->setNew();
27
-        }
28
-
29
-        return $object;
30
-    }
31
-
32
-    /**
33
-     * @param int $id
34
-     * @return myiframe|null
35
-     */
36
-    public function get($id)
37
-    {
38
-        $ret = null;
39
-        $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . '  WHERE frame_frameid=' . (int)$id;
40
-        if (!$result = $this->db->query($sql)) {
41
-            return $ret;
42
-        }
43
-        $numrows = $this->db->getRowsNum($result);
44
-        if (1 == $numrows) {
45
-            $object = new MyiframeBase();
46
-            $object->assignVars($this->db->fetchArray($result));
47
-
48
-            return $object;
49
-        }
50
-
51
-        return $ret;
52
-    }
53
-
54
-    /**
55
-     * @param bool $force
56
-     * @return bool
57
-     */
58
-    public function insert(\XoopsObject $object, $force = false)
59
-    {
60
-        if (!$object instanceof MyiframeBase) {
61
-            return false;
62
-        }
63
-        if (!$object->isDirty()) {
64
-            return true;
65
-        }
66
-        if (!$object->cleanVars()) {
67
-            foreach ($object->getErrors() as $oneerror) {
68
-                \trigger_error($oneerror);
69
-            }
70
-
71
-            return false;
72
-        }
73
-        foreach ($object->cleanVars as $k => $v) {
74
-            ${$k} = $v;
75
-        }
76
-
77
-        if ($object->isNew()) {
78
-            $format = 'INSERT INTO %s (frame_created, frame_uid, frame_description, frame_width, frame_height, frame_align, frame_frameborder, frame_marginwidth, frame_marginheight, frame_scrolling, frame_hits, frame_url) VALUES (%u, %u, %s, %s, %s, %d, %d, %d, %d, %d, %u, %s)';
79
-            $sql    = \sprintf(
80
-                $format,
81
-                $this->db->prefix('myiframe'),
82
-                $frame_created,
83
-                $frame_uid,
84
-                $this->db->quoteString($frame_description),
85
-                $this->db->quoteString($frame_width),
86
-                $this->db->quoteString($frame_height),
87
-                $frame_align,
88
-                $frame_frameborder,
89
-                $frame_marginwidth,
90
-                $frame_marginheight,
91
-                $frame_scrolling,
92
-                $frame_hits,
93
-                $this->db->quoteString($frame_url)
94
-            );
95
-            $force  = true;
96
-        } else {
97
-            $format = 'UPDATE %s SET frame_description=%s, frame_width=%s, frame_height=%s, frame_align="%d", frame_frameborder="%d", frame_marginwidth="%d", frame_marginheight="%d", frame_scrolling="%d", frame_hits="%u", frame_url=%s WHERE frame_frameid=%u';
98
-            $sql    = \sprintf(
99
-                $format,
100
-                $this->db->prefix('myiframe'),
101
-                $this->db->quoteString($frame_description),
102
-                $this->db->quoteString($frame_width),
103
-                $this->db->quoteString($frame_height),
104
-                $frame_align,
105
-                $frame_frameborder,
106
-                $frame_marginwidth,
107
-                $frame_marginheight,
108
-                $frame_scrolling,
109
-                $frame_hits,
110
-                $this->db->quoteString($frame_url),
111
-                $frame_frameid
112
-            );
113
-        }
114
-        if (false !== $force) {
115
-            $result = $this->db->queryF($sql);
116
-        } else {
117
-            $result = $this->db->query($sql);
118
-        }
119
-        if (!$result) {
120
-            return false;
121
-        }
122
-        if (empty($frame_frameid)) {
123
-            $frame_frameid = $this->db->getInsertId();
124
-        }
125
-        $object->assignVar('frame_frameid', $frame_frameid);
126
-
127
-        return $frame_frameid;
128
-    }
129
-
130
-    /**
131
-     * @param bool $force
132
-     * @return bool
133
-     */
134
-    public function delete(\XoopsObject $object, $force = false)
135
-    {
136
-        if (!$object instanceof \MyiframeBase) {
137
-            return false;
138
-        }
139
-        $sql = \sprintf('DELETE FROM %s WHERE frame_frameid = "%u"', $this->db->prefix('myiframe'), $object->getVar('frame_frameid'));
140
-        if (false !== $force) {
141
-            $result = $this->db->queryF($sql);
142
-        } else {
143
-            $result = $this->db->query($sql);
144
-        }
145
-        if (!$result) {
146
-            return false;
147
-        }
148
-
149
-        return true;
150
-    }
151
-
152
-    /**
153
-     * @param \XoopsModules\Myiframe\Criteria $criteria
154
-     * @param bool                            $id_as_key
155
-     * @return array
156
-     */
157
-    public function &getObjects(\Criteria $criteria = null, $id_as_key = false)
158
-    {
159
-        $ret   = [];
160
-        $limit = $start = 0;
161
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('myiframe');
162
-        if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
163
-            $sql .= ' ' . $criteria->renderWhere();
164
-            if ('' !== $criteria->getSort()) {
165
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
166
-            }
167
-            $limit = $criteria->getLimit();
168
-            $start = $criteria->getStart();
169
-        }
170
-        $result = $this->db->query($sql, $limit, $start);
171
-        /** @var array $myrow */
172
-        if ($result instanceof \mysqli_result) {
173
-
174
-            while (false !== ($myrow = $this->db->fetchArray($result))) {
175
-                if (!$id_as_key) {
176
-                    $ret[] = new MyiframeBase($myrow);
177
-                } else {
178
-                    $ret[$myrow['frame_frameid']] = new MyiframeBase($myrow);
179
-                }
180
-            }
181
-        }
182
-
183
-        return $ret;
184
-    }
185
-
186
-    /**
187
-     * @param \XoopsModules\Myiframe\CriteriaCompo $criteria
188
-     * @return int
189
-     */
190
-    public function getCount(\CriteriaCompo $criteria = null)
191
-    {
192
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('myiframe');
193
-        if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
194
-            $sql .= ' ' . $criteria->renderWhere();
195
-        }
196
-        $result = $this->db->query($sql);
197
-        if (!$result) {
198
-            return 0;
199
-        }
200
-        [$count] = $this->db->fetchRow($result);
201
-
202
-        return $count;
203
-    }
204
-
205
-    /**
206
-     * @param \XoopsModules\Myiframe\CriteriaCompo $criteria
207
-     * @return bool
208
-     */
209
-    public function deleteAll(\CriteriaCompo $criteria = null)
210
-    {
211
-        $sql = 'DELETE FROM ' . $this->db->prefix('myiframe');
212
-        if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
213
-            $sql .= ' ' . $criteria->renderWhere();
214
-        }
215
-        if (!$result = $this->db->query($sql)) {
216
-            return false;
217
-        }
218
-
219
-        return true;
220
-    }
221
-
222
-    /**
223
-     * @param $frame_id
224
-     */
225
-    public function updatehits($frame_id): void
226
-    {
227
-        $sql = \sprintf('UPDATE %s SET frame_hits = frame_hits+1 WHERE frame_frameid="%u"', $this->db->prefix('myiframe'), (int)$frame_id);
228
-        $this->db->queryF($sql);
229
-    }
18
+	/**
19
+	 * @param bool $isNew
20
+	 * @return myiframe
21
+	 */
22
+	public function create($isNew = true)
23
+	{
24
+		$object = new MyiframeBase();
25
+		if ($isNew) {
26
+			$object->setNew();
27
+		}
28
+
29
+		return $object;
30
+	}
31
+
32
+	/**
33
+	 * @param int $id
34
+	 * @return myiframe|null
35
+	 */
36
+	public function get($id)
37
+	{
38
+		$ret = null;
39
+		$sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . '  WHERE frame_frameid=' . (int)$id;
40
+		if (!$result = $this->db->query($sql)) {
41
+			return $ret;
42
+		}
43
+		$numrows = $this->db->getRowsNum($result);
44
+		if (1 == $numrows) {
45
+			$object = new MyiframeBase();
46
+			$object->assignVars($this->db->fetchArray($result));
47
+
48
+			return $object;
49
+		}
50
+
51
+		return $ret;
52
+	}
53
+
54
+	/**
55
+	 * @param bool $force
56
+	 * @return bool
57
+	 */
58
+	public function insert(\XoopsObject $object, $force = false)
59
+	{
60
+		if (!$object instanceof MyiframeBase) {
61
+			return false;
62
+		}
63
+		if (!$object->isDirty()) {
64
+			return true;
65
+		}
66
+		if (!$object->cleanVars()) {
67
+			foreach ($object->getErrors() as $oneerror) {
68
+				\trigger_error($oneerror);
69
+			}
70
+
71
+			return false;
72
+		}
73
+		foreach ($object->cleanVars as $k => $v) {
74
+			${$k} = $v;
75
+		}
76
+
77
+		if ($object->isNew()) {
78
+			$format = 'INSERT INTO %s (frame_created, frame_uid, frame_description, frame_width, frame_height, frame_align, frame_frameborder, frame_marginwidth, frame_marginheight, frame_scrolling, frame_hits, frame_url) VALUES (%u, %u, %s, %s, %s, %d, %d, %d, %d, %d, %u, %s)';
79
+			$sql    = \sprintf(
80
+				$format,
81
+				$this->db->prefix('myiframe'),
82
+				$frame_created,
83
+				$frame_uid,
84
+				$this->db->quoteString($frame_description),
85
+				$this->db->quoteString($frame_width),
86
+				$this->db->quoteString($frame_height),
87
+				$frame_align,
88
+				$frame_frameborder,
89
+				$frame_marginwidth,
90
+				$frame_marginheight,
91
+				$frame_scrolling,
92
+				$frame_hits,
93
+				$this->db->quoteString($frame_url)
94
+			);
95
+			$force  = true;
96
+		} else {
97
+			$format = 'UPDATE %s SET frame_description=%s, frame_width=%s, frame_height=%s, frame_align="%d", frame_frameborder="%d", frame_marginwidth="%d", frame_marginheight="%d", frame_scrolling="%d", frame_hits="%u", frame_url=%s WHERE frame_frameid=%u';
98
+			$sql    = \sprintf(
99
+				$format,
100
+				$this->db->prefix('myiframe'),
101
+				$this->db->quoteString($frame_description),
102
+				$this->db->quoteString($frame_width),
103
+				$this->db->quoteString($frame_height),
104
+				$frame_align,
105
+				$frame_frameborder,
106
+				$frame_marginwidth,
107
+				$frame_marginheight,
108
+				$frame_scrolling,
109
+				$frame_hits,
110
+				$this->db->quoteString($frame_url),
111
+				$frame_frameid
112
+			);
113
+		}
114
+		if (false !== $force) {
115
+			$result = $this->db->queryF($sql);
116
+		} else {
117
+			$result = $this->db->query($sql);
118
+		}
119
+		if (!$result) {
120
+			return false;
121
+		}
122
+		if (empty($frame_frameid)) {
123
+			$frame_frameid = $this->db->getInsertId();
124
+		}
125
+		$object->assignVar('frame_frameid', $frame_frameid);
126
+
127
+		return $frame_frameid;
128
+	}
129
+
130
+	/**
131
+	 * @param bool $force
132
+	 * @return bool
133
+	 */
134
+	public function delete(\XoopsObject $object, $force = false)
135
+	{
136
+		if (!$object instanceof \MyiframeBase) {
137
+			return false;
138
+		}
139
+		$sql = \sprintf('DELETE FROM %s WHERE frame_frameid = "%u"', $this->db->prefix('myiframe'), $object->getVar('frame_frameid'));
140
+		if (false !== $force) {
141
+			$result = $this->db->queryF($sql);
142
+		} else {
143
+			$result = $this->db->query($sql);
144
+		}
145
+		if (!$result) {
146
+			return false;
147
+		}
148
+
149
+		return true;
150
+	}
151
+
152
+	/**
153
+	 * @param \XoopsModules\Myiframe\Criteria $criteria
154
+	 * @param bool                            $id_as_key
155
+	 * @return array
156
+	 */
157
+	public function &getObjects(\Criteria $criteria = null, $id_as_key = false)
158
+	{
159
+		$ret   = [];
160
+		$limit = $start = 0;
161
+		$sql   = 'SELECT * FROM ' . $this->db->prefix('myiframe');
162
+		if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
163
+			$sql .= ' ' . $criteria->renderWhere();
164
+			if ('' !== $criteria->getSort()) {
165
+				$sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
166
+			}
167
+			$limit = $criteria->getLimit();
168
+			$start = $criteria->getStart();
169
+		}
170
+		$result = $this->db->query($sql, $limit, $start);
171
+		/** @var array $myrow */
172
+		if ($result instanceof \mysqli_result) {
173
+
174
+			while (false !== ($myrow = $this->db->fetchArray($result))) {
175
+				if (!$id_as_key) {
176
+					$ret[] = new MyiframeBase($myrow);
177
+				} else {
178
+					$ret[$myrow['frame_frameid']] = new MyiframeBase($myrow);
179
+				}
180
+			}
181
+		}
182
+
183
+		return $ret;
184
+	}
185
+
186
+	/**
187
+	 * @param \XoopsModules\Myiframe\CriteriaCompo $criteria
188
+	 * @return int
189
+	 */
190
+	public function getCount(\CriteriaCompo $criteria = null)
191
+	{
192
+		$sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('myiframe');
193
+		if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
194
+			$sql .= ' ' . $criteria->renderWhere();
195
+		}
196
+		$result = $this->db->query($sql);
197
+		if (!$result) {
198
+			return 0;
199
+		}
200
+		[$count] = $this->db->fetchRow($result);
201
+
202
+		return $count;
203
+	}
204
+
205
+	/**
206
+	 * @param \XoopsModules\Myiframe\CriteriaCompo $criteria
207
+	 * @return bool
208
+	 */
209
+	public function deleteAll(\CriteriaCompo $criteria = null)
210
+	{
211
+		$sql = 'DELETE FROM ' . $this->db->prefix('myiframe');
212
+		if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
213
+			$sql .= ' ' . $criteria->renderWhere();
214
+		}
215
+		if (!$result = $this->db->query($sql)) {
216
+			return false;
217
+		}
218
+
219
+		return true;
220
+	}
221
+
222
+	/**
223
+	 * @param $frame_id
224
+	 */
225
+	public function updatehits($frame_id): void
226
+	{
227
+		$sql = \sprintf('UPDATE %s SET frame_hits = frame_hits+1 WHERE frame_frameid="%u"', $this->db->prefix('myiframe'), (int)$frame_id);
228
+		$this->db->queryF($sql);
229
+	}
230 230
 }
Please login to merge, or discard this patch.
class/Constants.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,28 +27,28 @@
 block discarded – undo
27 27
  */
28 28
 final class Constants
29 29
 {
30
-    /**#@+
30
+	/**#@+
31 31
      * Constant definition
32 32
      */
33 33
 
34
-    public const DISALLOW = 0;
35
-
36
-    /**
37
-     * no delay XOOPS redirect delay (in seconds)
38
-     */
39
-    public const REDIRECT_DELAY_NONE = 0;
40
-    /**
41
-     * short XOOPS redirect delay (in seconds)
42
-     */
43
-    public const REDIRECT_DELAY_SHORT = 1;
44
-    /**
45
-     * medium XOOPS redirect delay (in seconds)
46
-     */
47
-    public const REDIRECT_DELAY_MEDIUM = 3;
48
-    /**
49
-     * long XOOPS redirect delay (in seconds)
50
-     */
51
-    public const REDIRECT_DELAY_LONG = 7;
52
-
53
-    /**#@-*/
34
+	public const DISALLOW = 0;
35
+
36
+	/**
37
+	 * no delay XOOPS redirect delay (in seconds)
38
+	 */
39
+	public const REDIRECT_DELAY_NONE = 0;
40
+	/**
41
+	 * short XOOPS redirect delay (in seconds)
42
+	 */
43
+	public const REDIRECT_DELAY_SHORT = 1;
44
+	/**
45
+	 * medium XOOPS redirect delay (in seconds)
46
+	 */
47
+	public const REDIRECT_DELAY_MEDIUM = 3;
48
+	/**
49
+	 * long XOOPS redirect delay (in seconds)
50
+	 */
51
+	public const REDIRECT_DELAY_LONG = 7;
52
+
53
+	/**#@-*/
54 54
 }
Please login to merge, or discard this patch.
class/Common/FilesManagement.php 1 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 $file
44
-     * @param $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)
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)
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)
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)
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 $file
44
+	 * @param $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)
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)
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)
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)
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/TestdataButtons.php 1 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/Helper.php 1 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()
57
-    {
58
-        return $this->dirname;
59
-    }
53
+	/**
54
+	 * @return string
55
+	 */
56
+	public function getDirname()
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.
xoops_version.php 1 patch
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.