Passed
Pull Request — master (#2)
by Michael
07:48 queued 04:06
created
admin/votes.php 2 patches
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -22,102 +22,102 @@  discard block
 block discarded – undo
22 22
 $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
23 23
 
24 24
 switch ($op) {
25
-    default:
26
-    case 'votes':
27
-        switch ($fct) {
28
-            default:
29
-            case 'list':
30
-                $adminObject = Admin::getInstance();
31
-                $adminObject->displayNavigation(basename(__FILE__));
32
-
33
-                /** @var VotesHandler $votesHandler */
34
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
35
-
36
-                $criteria        = $votesHandler->getFilterCriteria($GLOBALS['filter']);
37
-                $ttl             = $votesHandler->getCount($criteria);
38
-                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
39
-
40
-                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
41
-                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
42
-
43
-                foreach ($votesHandler->filterFields() as $id => $key) {
44
-                    $GLOBALS['xoopsTpl']->assign(
45
-                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
46
-                        '<a href="'
47
-                        . $_SERVER['SCRIPT_NAME']
48
-                        . '?start='
49
-                        . $GLOBALS['start']
50
-                        . '&limit='
51
-                        . $GLOBALS['limit']
52
-                        . '&sort='
53
-                        . $key
54
-                        . '&order='
55
-                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
56
-                        . '&op='
57
-                        . $GLOBALS['op']
58
-                        . '&filter='
59
-                        . $GLOBALS['filter']
60
-                        . '">'
61
-                        . (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
62
-                        . '</a>'
63
-                    );
64
-                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $votesHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
65
-                }
66
-
67
-                $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
68
-                $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
69
-                $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
70
-                $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
71
-                $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
72
-                $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
73
-
74
-                $criteria->setStart($GLOBALS['start']);
75
-                $criteria->setLimit($GLOBALS['limit']);
76
-                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
77
-                $criteria->setOrder($GLOBALS['order']);
78
-
79
-                $votess = $votesHandler->getObjects($criteria, true);
80
-                foreach ($votess as $cid => $votes) {
81
-                    if (is_object($votes)) {
82
-                        $GLOBALS['xoopsTpl']->append('categories', $votes->toArray());
83
-                    }
84
-                }
85
-                //$GLOBALS['xoopsTpl']->assign('form', FormController::votes_get_form(false));
86
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
87
-                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_votes_list.tpl');
88
-                break;
89
-            case 'new':
90
-            case 'edit':
91
-                $adminObject = Admin::getInstance();
92
-                $adminObject->displayNavigation(basename(__FILE__));
93
-
94
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
95
-                if (Request::hasVar('id', 'REQUEST')) {
96
-                    $votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
97
-                } else {
98
-                    $votes = $votesHandler->create();
99
-                }
100
-
101
-                $GLOBALS['xoopsTpl']->assign('form', $votes->getForm());
102
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
103
-                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_votes_edit.tpl');
104
-                break;
105
-            case 'save':
106
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
107
-                $id           = 0;
108
-                $id           = Request::getInt('id', 0, 'REQUEST');
109
-                if ($id) {
110
-                    $votes = $votesHandler->get($id);
111
-                } else {
112
-                    $votes = $votesHandler->create();
113
-                }
114
-                $votes->setVars($_POST[$id]);
115
-
116
-                if (!$id = $votesHandler->insert($votes)) {
117
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE);
118
-                    exit(0);
119
-                }
120
-                if (Request::hasVar('image', 'FILES') && !empty($_FILES['image']['name'])) {
25
+	default:
26
+	case 'votes':
27
+		switch ($fct) {
28
+			default:
29
+			case 'list':
30
+				$adminObject = Admin::getInstance();
31
+				$adminObject->displayNavigation(basename(__FILE__));
32
+
33
+				/** @var VotesHandler $votesHandler */
34
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
35
+
36
+				$criteria        = $votesHandler->getFilterCriteria($GLOBALS['filter']);
37
+				$ttl             = $votesHandler->getCount($criteria);
38
+				$GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
39
+
40
+				$pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
41
+				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
42
+
43
+				foreach ($votesHandler->filterFields() as $id => $key) {
44
+					$GLOBALS['xoopsTpl']->assign(
45
+						\mb_strtolower(str_replace('-', '_', $key) . '_th'),
46
+						'<a href="'
47
+						. $_SERVER['SCRIPT_NAME']
48
+						. '?start='
49
+						. $GLOBALS['start']
50
+						. '&limit='
51
+						. $GLOBALS['limit']
52
+						. '&sort='
53
+						. $key
54
+						. '&order='
55
+						. (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
56
+						. '&op='
57
+						. $GLOBALS['op']
58
+						. '&filter='
59
+						. $GLOBALS['filter']
60
+						. '">'
61
+						. (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
62
+						. '</a>'
63
+					);
64
+					$GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $votesHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
65
+				}
66
+
67
+				$GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
68
+				$GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
69
+				$GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
70
+				$GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
71
+				$GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
72
+				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
73
+
74
+				$criteria->setStart($GLOBALS['start']);
75
+				$criteria->setLimit($GLOBALS['limit']);
76
+				$criteria->setSort('`' . $GLOBALS['sort'] . '`');
77
+				$criteria->setOrder($GLOBALS['order']);
78
+
79
+				$votess = $votesHandler->getObjects($criteria, true);
80
+				foreach ($votess as $cid => $votes) {
81
+					if (is_object($votes)) {
82
+						$GLOBALS['xoopsTpl']->append('categories', $votes->toArray());
83
+					}
84
+				}
85
+				//$GLOBALS['xoopsTpl']->assign('form', FormController::votes_get_form(false));
86
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
87
+				$GLOBALS['xoopsTpl']->display('db:songlist_cpanel_votes_list.tpl');
88
+				break;
89
+			case 'new':
90
+			case 'edit':
91
+				$adminObject = Admin::getInstance();
92
+				$adminObject->displayNavigation(basename(__FILE__));
93
+
94
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
95
+				if (Request::hasVar('id', 'REQUEST')) {
96
+					$votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
97
+				} else {
98
+					$votes = $votesHandler->create();
99
+				}
100
+
101
+				$GLOBALS['xoopsTpl']->assign('form', $votes->getForm());
102
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
103
+				$GLOBALS['xoopsTpl']->display('db:songlist_cpanel_votes_edit.tpl');
104
+				break;
105
+			case 'save':
106
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
107
+				$id           = 0;
108
+				$id           = Request::getInt('id', 0, 'REQUEST');
109
+				if ($id) {
110
+					$votes = $votesHandler->get($id);
111
+				} else {
112
+					$votes = $votesHandler->create();
113
+				}
114
+				$votes->setVars($_POST[$id]);
115
+
116
+				if (!$id = $votesHandler->insert($votes)) {
117
+					redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE);
118
+					exit(0);
119
+				}
120
+				if (Request::hasVar('image', 'FILES') && !empty($_FILES['image']['name'])) {
121 121
 //                    if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) {
122 122
 //                        foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
123 123
 //                            foreach (explode('/', $folders) as $folder) {
@@ -130,99 +130,99 @@  discard block
 block discarded – undo
130 130
 //                    }
131 131
 
132 132
 //                    require_once $GLOBALS['xoops']->path('modules/songlist/include/uploader.php');
133
-                    $votes    = $votesHandler->get($id);
134
-                    $uploader = new Uploader(
135
-                        $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']),
136
-                        explode('|', $GLOBALS['songlistModuleConfig']['allowed_mimetype']),
137
-                        $GLOBALS['songlistModuleConfig']['filesize_upload'],
138
-                        0,
139
-                        0,
140
-                        explode('|', $GLOBALS['songlistModuleConfig']['allowed_extensions'])
141
-                    );
142
-                    try {
143
-                        $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13));
144
-                    } catch (Exception $e) {
145
-                    }
146
-
147
-                    if ($uploader->fetchMedia('image')) {
148
-                        if (!$uploader->upload()) {
149
-                            $adminObject = Admin::getInstance();
150
-                            $adminObject->displayNavigation(basename(__FILE__));
151
-                            echo $uploader->getErrors();
152
-                            require __DIR__ . '/admin_footer.php';
153
-                            exit(0);
154
-                        }
155
-                        if (mb_strlen($votes->getVar('image'))) {
156
-                            unlink($GLOBALS['xoops']->path($votes->getVar('path')) . $votes->getVar('image'));
157
-                        }
158
-
159
-                        $votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']);
160
-                        $votes->setVar('image', $uploader->getSavedFileName());
161
-                        @$votesHandler->insert($votes);
162
-                    } else {
163
-                        $adminObject = Admin::getInstance();
164
-                        $adminObject->displayNavigation(basename(__FILE__));
165
-                        echo $uploader->getErrors();
166
-                        require __DIR__ . '/admin_footer.php';
167
-                        exit(0);
168
-                    }
169
-                }
170
-
171
-                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
172
-                    redirect_header(
173
-                        $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
174
-                        10,
175
-                        _AM_SONGLIST_MSG_VOTES_SAVEDOKEY
176
-                    );
177
-                } else {
178
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_SAVEDOKEY);
179
-                }
180
-                exit(0);
181
-
182
-                break;
183
-            case 'savelist':
184
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
185
-                foreach ($_REQUEST['id'] as $id) {
186
-                    $votes = $votesHandler->get($id);
187
-                    $votes->setVars($_POST[$id]);
188
-                    if (!$votesHandler->insert($votes)) {
189
-                        redirect_header(
190
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
191
-                            10,
192
-                            _AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE
193
-                        );
194
-                        exit(0);
195
-                    }
196
-                }
197
-                redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_SAVEDOKEY);
198
-                exit(0);
199
-                break;
200
-            case 'delete':
201
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
202
-                $id           = 0;
203
-                if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
204
-                    $votes = $votesHandler->get($id);
205
-                    if (!$votesHandler->delete($votes)) {
206
-                        redirect_header(
207
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
208
-                            10,
209
-                            _AM_SONGLIST_MSG_VOTES_FAILEDTODELETE
210
-                        );
211
-                        exit(0);
212
-                    }
213
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_DELETED);
214
-                    exit(0);
215
-                }
216
-                $votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
217
-                xoops_confirm(
218
-                    ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
219
-                    $_SERVER['SCRIPT_NAME'],
220
-                    sprintf(_AM_SONGLIST_MSG_VOTES_DELETE, $votes->getVar('name'))
221
-                );
222
-
223
-                break;
224
-        }
225
-        break;
133
+					$votes    = $votesHandler->get($id);
134
+					$uploader = new Uploader(
135
+						$GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']),
136
+						explode('|', $GLOBALS['songlistModuleConfig']['allowed_mimetype']),
137
+						$GLOBALS['songlistModuleConfig']['filesize_upload'],
138
+						0,
139
+						0,
140
+						explode('|', $GLOBALS['songlistModuleConfig']['allowed_extensions'])
141
+					);
142
+					try {
143
+						$uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13));
144
+					} catch (Exception $e) {
145
+					}
146
+
147
+					if ($uploader->fetchMedia('image')) {
148
+						if (!$uploader->upload()) {
149
+							$adminObject = Admin::getInstance();
150
+							$adminObject->displayNavigation(basename(__FILE__));
151
+							echo $uploader->getErrors();
152
+							require __DIR__ . '/admin_footer.php';
153
+							exit(0);
154
+						}
155
+						if (mb_strlen($votes->getVar('image'))) {
156
+							unlink($GLOBALS['xoops']->path($votes->getVar('path')) . $votes->getVar('image'));
157
+						}
158
+
159
+						$votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']);
160
+						$votes->setVar('image', $uploader->getSavedFileName());
161
+						@$votesHandler->insert($votes);
162
+					} else {
163
+						$adminObject = Admin::getInstance();
164
+						$adminObject->displayNavigation(basename(__FILE__));
165
+						echo $uploader->getErrors();
166
+						require __DIR__ . '/admin_footer.php';
167
+						exit(0);
168
+					}
169
+				}
170
+
171
+				if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
172
+					redirect_header(
173
+						$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
174
+						10,
175
+						_AM_SONGLIST_MSG_VOTES_SAVEDOKEY
176
+					);
177
+				} else {
178
+					redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_SAVEDOKEY);
179
+				}
180
+				exit(0);
181
+
182
+				break;
183
+			case 'savelist':
184
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
185
+				foreach ($_REQUEST['id'] as $id) {
186
+					$votes = $votesHandler->get($id);
187
+					$votes->setVars($_POST[$id]);
188
+					if (!$votesHandler->insert($votes)) {
189
+						redirect_header(
190
+							$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
191
+							10,
192
+							_AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE
193
+						);
194
+						exit(0);
195
+					}
196
+				}
197
+				redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_SAVEDOKEY);
198
+				exit(0);
199
+				break;
200
+			case 'delete':
201
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
202
+				$id           = 0;
203
+				if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
204
+					$votes = $votesHandler->get($id);
205
+					if (!$votesHandler->delete($votes)) {
206
+						redirect_header(
207
+							$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
208
+							10,
209
+							_AM_SONGLIST_MSG_VOTES_FAILEDTODELETE
210
+						);
211
+						exit(0);
212
+					}
213
+					redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_DELETED);
214
+					exit(0);
215
+				}
216
+				$votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
217
+				xoops_confirm(
218
+					['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
219
+					$_SERVER['SCRIPT_NAME'],
220
+					sprintf(_AM_SONGLIST_MSG_VOTES_DELETE, $votes->getVar('name'))
221
+				);
222
+
223
+				break;
224
+		}
225
+		break;
226 226
 }
227 227
 
228 228
 xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use XoopsModules\Songlist\VotesHandler;
8 8
 use XoopsModules\Songlist\Form\FormController;
9 9
 
10
-require __DIR__ . '/header.php';
10
+require __DIR__.'/header.php';
11 11
 
12 12
 xoops_loadLanguage('admin', 'songlist');
13 13
 
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 $limit  = Request::getInt('limit', 30, 'REQUEST');
19 19
 $start  = Request::getInt('start', 0, 'REQUEST');
20 20
 $order  = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
21
-$sort   = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
22
-$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
21
+$sort   = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created';
22
+$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1';
23 23
 
24 24
 switch ($op) {
25 25
     default:
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 
36 36
                 $criteria        = $votesHandler->getFilterCriteria($GLOBALS['filter']);
37 37
                 $ttl             = $votesHandler->getCount($criteria);
38
-                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
38
+                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created';
39 39
 
40
-                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
40
+                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit='.$GLOBALS['limit'].'&sort='.$GLOBALS['sort'].'&order='.$GLOBALS['order'].'&op='.$GLOBALS['op'].'&fct='.$GLOBALS['fct'].'&filter='.$GLOBALS['filter']);
41 41
                 $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
42 42
 
43 43
                 foreach ($votesHandler->filterFields() as $id => $key) {
44 44
                     $GLOBALS['xoopsTpl']->assign(
45
-                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
45
+                        \mb_strtolower(str_replace('-', '_', $key).'_th'),
46 46
                         '<a href="'
47 47
                         . $_SERVER['SCRIPT_NAME']
48 48
                         . '?start='
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
                         . '&sort='
53 53
                         . $key
54 54
                         . '&order='
55
-                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
55
+                        . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
56 56
                         . '&op='
57 57
                         . $GLOBALS['op']
58 58
                         . '&filter='
59 59
                         . $GLOBALS['filter']
60 60
                         . '">'
61
-                        . (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
61
+                        . (defined('_AM_SONGLIST_TH_'.\mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_'.\mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_'.\mb_strtoupper(str_replace('-', '_', $key)))
62 62
                         . '</a>'
63 63
                     );
64
-                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $votesHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
64
+                    $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $votesHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
65 65
                 }
66 66
 
67 67
                 $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
                 $criteria->setStart($GLOBALS['start']);
75 75
                 $criteria->setLimit($GLOBALS['limit']);
76
-                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
76
+                $criteria->setSort('`'.$GLOBALS['sort'].'`');
77 77
                 $criteria->setOrder($GLOBALS['order']);
78 78
 
79 79
                 $votess = $votesHandler->getObjects($criteria, true);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 $votes->setVars($_POST[$id]);
115 115
 
116 116
                 if (!$id = $votesHandler->insert($votes)) {
117
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE);
117
+                    redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE);
118 118
                     exit(0);
119 119
                 }
120 120
                 if (Request::hasVar('image', 'FILES') && !empty($_FILES['image']['name'])) {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                         explode('|', $GLOBALS['songlistModuleConfig']['allowed_extensions'])
141 141
                     );
142 142
                     try {
143
-                        $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13));
143
+                        $uploader->setPrefix(mb_substr(md5((string) microtime(true)), random_int(0, 20), 13));
144 144
                     } catch (Exception $e) {
145 145
                     }
146 146
 
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
                             $adminObject = Admin::getInstance();
150 150
                             $adminObject->displayNavigation(basename(__FILE__));
151 151
                             echo $uploader->getErrors();
152
-                            require __DIR__ . '/admin_footer.php';
152
+                            require __DIR__.'/admin_footer.php';
153 153
                             exit(0);
154 154
                         }
155 155
                         if (mb_strlen($votes->getVar('image'))) {
156
-                            unlink($GLOBALS['xoops']->path($votes->getVar('path')) . $votes->getVar('image'));
156
+                            unlink($GLOBALS['xoops']->path($votes->getVar('path')).$votes->getVar('image'));
157 157
                         }
158 158
 
159 159
                         $votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']);
@@ -163,19 +163,19 @@  discard block
 block discarded – undo
163 163
                         $adminObject = Admin::getInstance();
164 164
                         $adminObject->displayNavigation(basename(__FILE__));
165 165
                         echo $uploader->getErrors();
166
-                        require __DIR__ . '/admin_footer.php';
166
+                        require __DIR__.'/admin_footer.php';
167 167
                         exit(0);
168 168
                     }
169 169
                 }
170 170
 
171
-                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
171
+                if ('new'===$_REQUEST['state'][$_REQUEST['id']]) {
172 172
                     redirect_header(
173
-                        $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
173
+                        $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'].'&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
174 174
                         10,
175 175
                         _AM_SONGLIST_MSG_VOTES_SAVEDOKEY
176 176
                     );
177 177
                 } else {
178
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_SAVEDOKEY);
178
+                    redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_SAVEDOKEY);
179 179
                 }
180 180
                 exit(0);
181 181
 
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
                     $votes->setVars($_POST[$id]);
188 188
                     if (!$votesHandler->insert($votes)) {
189 189
                         redirect_header(
190
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
190
+                            $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
191 191
                             10,
192 192
                             _AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE
193 193
                         );
194 194
                         exit(0);
195 195
                     }
196 196
                 }
197
-                redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_SAVEDOKEY);
197
+                redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_SAVEDOKEY);
198 198
                 exit(0);
199 199
                 break;
200 200
             case 'delete':
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
                     $votes = $votesHandler->get($id);
205 205
                     if (!$votesHandler->delete($votes)) {
206 206
                         redirect_header(
207
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
207
+                            $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
208 208
                             10,
209 209
                             _AM_SONGLIST_MSG_VOTES_FAILEDTODELETE
210 210
                         );
211 211
                         exit(0);
212 212
                     }
213
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_DELETED);
213
+                    redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOTES_DELETED);
214 214
                     exit(0);
215 215
                 }
216 216
                 $votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
Please login to merge, or discard this patch.
admin/field_permissions.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -38,28 +38,28 @@  discard block
 block discarded – undo
38 38
 
39 39
 $perm_desc = '';
40 40
 switch ($op) {
41
-    case 'visibility':
42
-        //header("Location: visibility.php");
43
-        redirect_header('field_visibility.php', 0, _AM_SONGLIST_PROF_VISIBLE);
44
-        break;
45
-    case 'edit':
46
-        $title_of_form = _AM_SONGLIST_PROF_EDITABLE;
47
-        $perm_name     = 'songlist_edit';
48
-        $restriction   = 'field_edit';
49
-        $anonymous     = false;
50
-        break;
51
-    case 'post':
52
-        $title_of_form = _AM_SONGLIST_PROF_POST;
53
-        $perm_name     = 'songlist_post';
54
-        $restriction   = '';
55
-        $anonymous     = true;
56
-        break;
57
-    case 'search':
58
-        $title_of_form = _AM_SONGLIST_PROF_SEARCH;
59
-        $perm_name     = 'songlist_search';
60
-        $restriction   = '';
61
-        $anonymous     = true;
62
-        break;
41
+	case 'visibility':
42
+		//header("Location: visibility.php");
43
+		redirect_header('field_visibility.php', 0, _AM_SONGLIST_PROF_VISIBLE);
44
+		break;
45
+	case 'edit':
46
+		$title_of_form = _AM_SONGLIST_PROF_EDITABLE;
47
+		$perm_name     = 'songlist_edit';
48
+		$restriction   = 'field_edit';
49
+		$anonymous     = false;
50
+		break;
51
+	case 'post':
52
+		$title_of_form = _AM_SONGLIST_PROF_POST;
53
+		$perm_name     = 'songlist_post';
54
+		$restriction   = '';
55
+		$anonymous     = true;
56
+		break;
57
+	case 'search':
58
+		$title_of_form = _AM_SONGLIST_PROF_SEARCH;
59
+		$perm_name     = 'songlist_search';
60
+		$restriction   = '';
61
+		$anonymous     = true;
62
+		break;
63 63
 }
64 64
 
65 65
 $module_id = $GLOBALS['songlistModule']->getVar('mid');
@@ -67,43 +67,43 @@  discard block
 block discarded – undo
67 67
 $form = new \XoopsGroupPermForm($title_of_form, $module_id, $perm_name, $perm_desc, 'admin/field_permissions.php', $anonymous);
68 68
 
69 69
 if ('access' === $op) {
70
-    /** @var \XoopsMemberHandler $memberHandler */
71
-    $memberHandler = xoops_getHandler('member');
72
-    $glist         = $memberHandler->getGroupList();
73
-    foreach (array_keys($glist) as $i) {
74
-        if (XOOPS_GROUP_ANONYMOUS != $i) {
75
-            $form->addItem($i, $glist[$i]);
76
-        }
77
-    }
70
+	/** @var \XoopsMemberHandler $memberHandler */
71
+	$memberHandler = xoops_getHandler('member');
72
+	$glist         = $memberHandler->getGroupList();
73
+	foreach (array_keys($glist) as $i) {
74
+		if (XOOPS_GROUP_ANONYMOUS != $i) {
75
+			$form->addItem($i, $glist[$i]);
76
+		}
77
+	}
78 78
 } else {
79
-    $extrasHandler = Helper::getInstance()->getHandler('Extras');
80
-    $tempFields    = $extrasHandler->loadFields();
81
-    if ($tempFields && is_array($tempFields)) {
82
-        $fields = array_merge([], $tempFields);
83
-        if ('search' !== $op) {
84
-            foreach (array_keys($fields) as $i) {
85
-                if ('' == $restriction || $fields[$i]->getVar($restriction)) {
86
-                    $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25));
87
-                }
88
-            }
89
-        } else {
90
-            $searchable_types = [
91
-                'textbox',
92
-                'select',
93
-                'radio',
94
-                'yesno',
95
-                'date',
96
-                'datetime',
97
-                'timezone',
98
-                'language',
99
-            ];
100
-            foreach (array_keys($fields) as $i) {
101
-                if (in_array($fields[$i]->getVar('field_type'), $searchable_types, true)) {
102
-                    $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25));
103
-                }
104
-            }
105
-        }
106
-    }
79
+	$extrasHandler = Helper::getInstance()->getHandler('Extras');
80
+	$tempFields    = $extrasHandler->loadFields();
81
+	if ($tempFields && is_array($tempFields)) {
82
+		$fields = array_merge([], $tempFields);
83
+		if ('search' !== $op) {
84
+			foreach (array_keys($fields) as $i) {
85
+				if ('' == $restriction || $fields[$i]->getVar($restriction)) {
86
+					$form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25));
87
+				}
88
+			}
89
+		} else {
90
+			$searchable_types = [
91
+				'textbox',
92
+				'select',
93
+				'radio',
94
+				'yesno',
95
+				'date',
96
+				'datetime',
97
+				'timezone',
98
+				'language',
99
+			];
100
+			foreach (array_keys($fields) as $i) {
101
+				if (in_array($fields[$i]->getVar('field_type'), $searchable_types, true)) {
102
+					$form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25));
103
+				}
104
+			}
105
+		}
106
+	}
107 107
 }
108 108
 $form->display();
109 109
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 use Xmf\Module\Admin;
18 18
 use XoopsModules\Songlist\Helper;
19 19
 
20
-require_once __DIR__ . '/header.php';
20
+require_once __DIR__.'/header.php';
21 21
 xoops_cp_header();
22 22
 
23 23
 $adminObject = Admin::getInstance();
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 require_once $GLOBALS['xoops']->path('/class/xoopsform/grouppermform.php');
67 67
 $form = new \XoopsGroupPermForm($title_of_form, $module_id, $perm_name, $perm_desc, 'admin/field_permissions.php', $anonymous);
68 68
 
69
-if ('access' === $op) {
69
+if ('access'===$op) {
70 70
     /** @var \XoopsMemberHandler $memberHandler */
71 71
     $memberHandler = xoops_getHandler('member');
72 72
     $glist         = $memberHandler->getGroupList();
73 73
     foreach (array_keys($glist) as $i) {
74
-        if (XOOPS_GROUP_ANONYMOUS != $i) {
74
+        if (XOOPS_GROUP_ANONYMOUS!=$i) {
75 75
             $form->addItem($i, $glist[$i]);
76 76
         }
77 77
     }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
     $tempFields    = $extrasHandler->loadFields();
81 81
     if ($tempFields && is_array($tempFields)) {
82 82
         $fields = array_merge([], $tempFields);
83
-        if ('search' !== $op) {
83
+        if ('search'!==$op) {
84 84
             foreach (array_keys($fields) as $i) {
85
-                if ('' == $restriction || $fields[$i]->getVar($restriction)) {
85
+                if (''==$restriction || $fields[$i]->getVar($restriction)) {
86 86
                     $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25));
87 87
                 }
88 88
             }
Please login to merge, or discard this patch.
admin/clone.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 
21 21
 use Xmf\Request;
22 22
 use XoopsModules\Songlist\{
23
-    Common\Cloner,
24
-    Helper,
25
-    Utility
23
+	Common\Cloner,
24
+	Helper,
25
+	Utility
26 26
 };
27 27
 
28 28
 require_once __DIR__ . '/admin_header.php';
@@ -32,53 +32,53 @@  discard block
 block discarded – undo
32 32
 $helper = Helper::getInstance();
33 33
 
34 34
 if ('submit' === Request::getString('op', '', 'POST')) {
35
-    if (!$GLOBALS['xoopsSecurity']->check()) {
36
-        redirect_header('clone.php', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
37
-    }
35
+	if (!$GLOBALS['xoopsSecurity']->check()) {
36
+		redirect_header('clone.php', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
37
+	}
38 38
 
39
-    //    $clone = $_POST['clone'];
40
-    $clone = Request::getString('clone', '', 'POST');
39
+	//    $clone = $_POST['clone'];
40
+	$clone = Request::getString('clone', '', 'POST');
41 41
 
42
-    //check if name is valid
43
-    if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) {
44
-        redirect_header('clone.php', 3, sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_INVALIDNAME'), $clone));
45
-    }
42
+	//check if name is valid
43
+	if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) {
44
+		redirect_header('clone.php', 3, sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_INVALIDNAME'), $clone));
45
+	}
46 46
 
47
-    // Check wether the cloned module exists or not
48
-    if ($clone && is_dir($GLOBALS['xoops']->path('modules/' . $clone))) {
49
-        redirect_header('clone.php', 3, sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_EXISTS'), $clone));
50
-    }
47
+	// Check wether the cloned module exists or not
48
+	if ($clone && is_dir($GLOBALS['xoops']->path('modules/' . $clone))) {
49
+		redirect_header('clone.php', 3, sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_EXISTS'), $clone));
50
+	}
51 51
 
52
-    $patterns = [
53
-        \mb_strtolower($helper->dirname())          => \mb_strtolower($clone),
54
-        \mb_strtoupper($helper->dirname())          => \mb_strtoupper($clone),
55
-        ucfirst(mb_strtolower($helper->dirname())) => ucfirst(mb_strtolower($clone)),
56
-    ];
52
+	$patterns = [
53
+		\mb_strtolower($helper->dirname())          => \mb_strtolower($clone),
54
+		\mb_strtoupper($helper->dirname())          => \mb_strtoupper($clone),
55
+		ucfirst(mb_strtolower($helper->dirname())) => ucfirst(mb_strtolower($clone)),
56
+	];
57 57
 
58
-    $patKeys   = array_keys($patterns);
59
-    $patValues = array_values($patterns);
60
-    Cloner::cloneFileFolder($helper->path());
61
-    $logocreated = Cloner::createLogo(mb_strtolower($clone));
58
+	$patKeys   = array_keys($patterns);
59
+	$patValues = array_values($patterns);
60
+	Cloner::cloneFileFolder($helper->path());
61
+	$logocreated = Cloner::createLogo(mb_strtolower($clone));
62 62
 
63
-    $msg = '';
64
-    if (is_dir($GLOBALS['xoops']->path('modules/' . \mb_strtolower($clone)))) {
65
-        $msg .= sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_CONGRAT'), "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin'>" . ucfirst(mb_strtolower($clone)) . '</a>') . "<br>\n";
66
-        if (!$logocreated) {
67
-            $msg .= constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_IMAGEFAIL');
68
-        }
69
-    } else {
70
-        $msg .= constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_FAIL');
71
-    }
72
-    echo $msg;
63
+	$msg = '';
64
+	if (is_dir($GLOBALS['xoops']->path('modules/' . \mb_strtolower($clone)))) {
65
+		$msg .= sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_CONGRAT'), "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin'>" . ucfirst(mb_strtolower($clone)) . '</a>') . "<br>\n";
66
+		if (!$logocreated) {
67
+			$msg .= constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_IMAGEFAIL');
68
+		}
69
+	} else {
70
+		$msg .= constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_FAIL');
71
+	}
72
+	echo $msg;
73 73
 } else {
74
-    require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
75
-    $form  = new \XoopsThemeForm(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_TITLE'), (string)$helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
76
-    $clone = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_NAME'), 'clone', 20, 20, '');
77
-    $clone->setDescription(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_NAME_DSC'));
78
-    $form->addElement($clone, true);
79
-    $form->addElement(new \XoopsFormHidden('op', 'submit'));
80
-    $form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit'));
81
-    $form->display();
74
+	require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
75
+	$form  = new \XoopsThemeForm(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_TITLE'), (string)$helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
76
+	$clone = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_NAME'), 'clone', 20, 20, '');
77
+	$clone->setDescription(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_NAME_DSC'));
78
+	$form->addElement($clone, true);
79
+	$form->addElement(new \XoopsFormHidden('op', 'submit'));
80
+	$form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit'));
81
+	$form->display();
82 82
 }
83 83
 
84 84
 require_once __DIR__ . '/admin_footer.php';
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
     Utility
26 26
 };
27 27
 
28
-require_once __DIR__ . '/admin_header.php';
28
+require_once __DIR__.'/admin_header.php';
29 29
 
30 30
 xoops_cp_header();
31 31
 
32 32
 $helper = Helper::getInstance();
33 33
 
34
-if ('submit' === Request::getString('op', '', 'POST')) {
34
+if ('submit'===Request::getString('op', '', 'POST')) {
35 35
     if (!$GLOBALS['xoopsSecurity']->check()) {
36 36
         redirect_header('clone.php', 3, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
37 37
     }
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 
42 42
     //check if name is valid
43 43
     if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) {
44
-        redirect_header('clone.php', 3, sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_INVALIDNAME'), $clone));
44
+        redirect_header('clone.php', 3, sprintf(constant('CO_'.$moduleDirNameUpper.'_'.'CLONE_INVALIDNAME'), $clone));
45 45
     }
46 46
 
47 47
     // Check wether the cloned module exists or not
48
-    if ($clone && is_dir($GLOBALS['xoops']->path('modules/' . $clone))) {
49
-        redirect_header('clone.php', 3, sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_EXISTS'), $clone));
48
+    if ($clone && is_dir($GLOBALS['xoops']->path('modules/'.$clone))) {
49
+        redirect_header('clone.php', 3, sprintf(constant('CO_'.$moduleDirNameUpper.'_'.'CLONE_EXISTS'), $clone));
50 50
     }
51 51
 
52 52
     $patterns = [
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
     $logocreated = Cloner::createLogo(mb_strtolower($clone));
62 62
 
63 63
     $msg = '';
64
-    if (is_dir($GLOBALS['xoops']->path('modules/' . \mb_strtolower($clone)))) {
65
-        $msg .= sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_CONGRAT'), "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin'>" . ucfirst(mb_strtolower($clone)) . '</a>') . "<br>\n";
64
+    if (is_dir($GLOBALS['xoops']->path('modules/'.\mb_strtolower($clone)))) {
65
+        $msg .= sprintf(constant('CO_'.$moduleDirNameUpper.'_'.'CLONE_CONGRAT'), "<a href='".XOOPS_URL."/modules/system/admin.php?fct=modulesadmin'>".ucfirst(mb_strtolower($clone)).'</a>')."<br>\n";
66 66
         if (!$logocreated) {
67
-            $msg .= constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_IMAGEFAIL');
67
+            $msg .= constant('CO_'.$moduleDirNameUpper.'_'.'CLONE_IMAGEFAIL');
68 68
         }
69 69
     } else {
70
-        $msg .= constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_FAIL');
70
+        $msg .= constant('CO_'.$moduleDirNameUpper.'_'.'CLONE_FAIL');
71 71
     }
72 72
     echo $msg;
73 73
 } else {
74 74
     require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
75
-    $form  = new \XoopsThemeForm(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_TITLE'), (string)$helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
76
-    $clone = new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_NAME'), 'clone', 20, 20, '');
77
-    $clone->setDescription(constant('CO_' . $moduleDirNameUpper . '_' . 'CLONE_NAME_DSC'));
75
+    $form  = new \XoopsThemeForm(sprintf(constant('CO_'.$moduleDirNameUpper.'_'.'CLONE_TITLE'), (string) $helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
76
+    $clone = new \XoopsFormText(constant('CO_'.$moduleDirNameUpper.'_'.'CLONE_NAME'), 'clone', 20, 20, '');
77
+    $clone->setDescription(constant('CO_'.$moduleDirNameUpper.'_'.'CLONE_NAME_DSC'));
78 78
     $form->addElement($clone, true);
79 79
     $form->addElement(new \XoopsFormHidden('op', 'submit'));
80 80
     $form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit'));
81 81
     $form->display();
82 82
 }
83 83
 
84
-require_once __DIR__ . '/admin_footer.php';
84
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/requests.php 2 patches
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -21,156 +21,156 @@
 block discarded – undo
21 21
 $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
22 22
 
23 23
 switch ($op) {
24
-    default:
25
-    case 'requests':
26
-        switch ($fct) {
27
-            default:
28
-            case 'list':
29
-                $adminObject = Admin::getInstance();
30
-                $adminObject->displayNavigation(basename(__FILE__));
31
-
32
-            /** @var RequestsHandler $requestsHandler */
33
-            $requestsHandler = Helper::getInstance()->getHandler('Requests');
34
-
35
-                $criteria        = $requestsHandler->getFilterCriteria($GLOBALS['filter']);
36
-                $ttl             = $requestsHandler->getCount($criteria);
37
-                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
38
-
39
-                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
40
-                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
41
-
42
-                foreach ($requestsHandler->filterFields() as $id => $key) {
43
-                    $GLOBALS['xoopsTpl']->assign(
44
-                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
45
-                        '<a href="'
46
-                        . $_SERVER['SCRIPT_NAME']
47
-                        . '?start='
48
-                        . $GLOBALS['start']
49
-                        . '&limit='
50
-                        . $GLOBALS['limit']
51
-                        . '&sort='
52
-                        . $key
53
-                        . '&order='
54
-                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
55
-                        . '&op='
56
-                        . $GLOBALS['op']
57
-                        . '&filter='
58
-                        . $GLOBALS['filter']
59
-                        . '">'
60
-                        . (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
61
-                        . '</a>'
62
-                    );
63
-                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $requestsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
64
-                }
65
-
66
-                $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
67
-                $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
68
-                $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
69
-                $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
70
-                $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
71
-                $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
72
-
73
-                $criteria->setStart($GLOBALS['start']);
74
-                $criteria->setLimit($GLOBALS['limit']);
75
-                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
76
-                $criteria->setOrder($GLOBALS['order']);
77
-
78
-                $requestss = $requestsHandler->getObjects($criteria, true);
79
-                foreach ($requestss as $cid => $requests) {
80
-                    if (is_object($requests)) {
81
-                        $GLOBALS['xoopsTpl']->append('requests', $requests->toArray());
82
-                    }
83
-                }
84
-                $GLOBALS['xoopsTpl']->assign('form', FormController::getFormRequests(false));
85
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
86
-                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_requests_list.tpl');
87
-                break;
88
-            case 'new':
89
-            case 'edit':
90
-                $adminObject = Admin::getInstance();
91
-                $adminObject->displayNavigation(basename(__FILE__));
92
-
93
-                $requestsHandler = Helper::getInstance()->getHandler('Requests');
94
-                if (Request::hasVar('id', 'REQUEST')) {
95
-                    $requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
96
-                } else {
97
-                    $requests = $requestsHandler->create();
98
-                }
99
-
100
-                $GLOBALS['xoopsTpl']->assign('form', $requests->getForm());
101
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
102
-                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_requests_edit.tpl');
103
-                break;
104
-            case 'save':
105
-                $requestsHandler = Helper::getInstance()->getHandler('Requests');
106
-                $id              = 0;
107
-                $id              = Request::getInt('id', 0, 'REQUEST');
108
-                if ($id) {
109
-                    $requests = $requestsHandler->get($id);
110
-                } else {
111
-                    $requests = $requestsHandler->create();
112
-                }
113
-                $requests->setVars($_POST[$id]);
114
-
115
-                if (!$id = $requestsHandler->insert($requests)) {
116
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE);
117
-                    exit(0);
118
-                }
119
-                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
120
-                    redirect_header(
121
-                        $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
122
-                        10,
123
-                        _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY
124
-                    );
125
-                } else {
126
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY);
127
-                }
128
-                exit(0);
129
-
130
-                break;
131
-            case 'savelist':
132
-                $requestsHandler = Helper::getInstance()->getHandler('Requests');
133
-                foreach ($_REQUEST['id'] as $id) {
134
-                    $requests = $requestsHandler->get($id);
135
-                    $requests->setVars($_POST[$id]);
136
-                    if (!$requestsHandler->insert($requests)) {
137
-                        redirect_header(
138
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
139
-                            10,
140
-                            _AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE
141
-                        );
142
-                        exit(0);
143
-                    }
144
-                }
145
-                redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY);
146
-                exit(0);
147
-                break;
148
-            case 'delete':
149
-                $requestsHandler = Helper::getInstance()->getHandler('Requests');
150
-                $id              = 0;
151
-                if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
152
-                    $requests = $requestsHandler->get($id);
153
-                    if (!$requestsHandler->delete($requests)) {
154
-                        redirect_header(
155
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
156
-                            10,
157
-                            _AM_SONGLIST_MSG_REQUESTS_FAILEDTODELETE
158
-                        );
159
-                        exit(0);
160
-                    }
161
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_DELETED);
162
-                    exit(0);
163
-                }
164
-                $requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
165
-                xoops_confirm(
166
-                    ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
167
-                    $_SERVER['SCRIPT_NAME'],
168
-                    sprintf(_AM_SONGLIST_MSG_REQUESTS_DELETE, $requests->getVar('name'))
169
-                );
170
-
171
-                break;
172
-        }
173
-        break;
24
+	default:
25
+	case 'requests':
26
+		switch ($fct) {
27
+			default:
28
+			case 'list':
29
+				$adminObject = Admin::getInstance();
30
+				$adminObject->displayNavigation(basename(__FILE__));
31
+
32
+			/** @var RequestsHandler $requestsHandler */
33
+			$requestsHandler = Helper::getInstance()->getHandler('Requests');
34
+
35
+				$criteria        = $requestsHandler->getFilterCriteria($GLOBALS['filter']);
36
+				$ttl             = $requestsHandler->getCount($criteria);
37
+				$GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
38
+
39
+				$pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
40
+				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
41
+
42
+				foreach ($requestsHandler->filterFields() as $id => $key) {
43
+					$GLOBALS['xoopsTpl']->assign(
44
+						\mb_strtolower(str_replace('-', '_', $key) . '_th'),
45
+						'<a href="'
46
+						. $_SERVER['SCRIPT_NAME']
47
+						. '?start='
48
+						. $GLOBALS['start']
49
+						. '&limit='
50
+						. $GLOBALS['limit']
51
+						. '&sort='
52
+						. $key
53
+						. '&order='
54
+						. (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
55
+						. '&op='
56
+						. $GLOBALS['op']
57
+						. '&filter='
58
+						. $GLOBALS['filter']
59
+						. '">'
60
+						. (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
61
+						. '</a>'
62
+					);
63
+					$GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $requestsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
64
+				}
65
+
66
+				$GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
67
+				$GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
68
+				$GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
69
+				$GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
70
+				$GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
71
+				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
72
+
73
+				$criteria->setStart($GLOBALS['start']);
74
+				$criteria->setLimit($GLOBALS['limit']);
75
+				$criteria->setSort('`' . $GLOBALS['sort'] . '`');
76
+				$criteria->setOrder($GLOBALS['order']);
77
+
78
+				$requestss = $requestsHandler->getObjects($criteria, true);
79
+				foreach ($requestss as $cid => $requests) {
80
+					if (is_object($requests)) {
81
+						$GLOBALS['xoopsTpl']->append('requests', $requests->toArray());
82
+					}
83
+				}
84
+				$GLOBALS['xoopsTpl']->assign('form', FormController::getFormRequests(false));
85
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
86
+				$GLOBALS['xoopsTpl']->display('db:songlist_cpanel_requests_list.tpl');
87
+				break;
88
+			case 'new':
89
+			case 'edit':
90
+				$adminObject = Admin::getInstance();
91
+				$adminObject->displayNavigation(basename(__FILE__));
92
+
93
+				$requestsHandler = Helper::getInstance()->getHandler('Requests');
94
+				if (Request::hasVar('id', 'REQUEST')) {
95
+					$requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
96
+				} else {
97
+					$requests = $requestsHandler->create();
98
+				}
99
+
100
+				$GLOBALS['xoopsTpl']->assign('form', $requests->getForm());
101
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
102
+				$GLOBALS['xoopsTpl']->display('db:songlist_cpanel_requests_edit.tpl');
103
+				break;
104
+			case 'save':
105
+				$requestsHandler = Helper::getInstance()->getHandler('Requests');
106
+				$id              = 0;
107
+				$id              = Request::getInt('id', 0, 'REQUEST');
108
+				if ($id) {
109
+					$requests = $requestsHandler->get($id);
110
+				} else {
111
+					$requests = $requestsHandler->create();
112
+				}
113
+				$requests->setVars($_POST[$id]);
114
+
115
+				if (!$id = $requestsHandler->insert($requests)) {
116
+					redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE);
117
+					exit(0);
118
+				}
119
+				if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
120
+					redirect_header(
121
+						$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
122
+						10,
123
+						_AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY
124
+					);
125
+				} else {
126
+					redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY);
127
+				}
128
+				exit(0);
129
+
130
+				break;
131
+			case 'savelist':
132
+				$requestsHandler = Helper::getInstance()->getHandler('Requests');
133
+				foreach ($_REQUEST['id'] as $id) {
134
+					$requests = $requestsHandler->get($id);
135
+					$requests->setVars($_POST[$id]);
136
+					if (!$requestsHandler->insert($requests)) {
137
+						redirect_header(
138
+							$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
139
+							10,
140
+							_AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE
141
+						);
142
+						exit(0);
143
+					}
144
+				}
145
+				redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY);
146
+				exit(0);
147
+				break;
148
+			case 'delete':
149
+				$requestsHandler = Helper::getInstance()->getHandler('Requests');
150
+				$id              = 0;
151
+				if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
152
+					$requests = $requestsHandler->get($id);
153
+					if (!$requestsHandler->delete($requests)) {
154
+						redirect_header(
155
+							$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
156
+							10,
157
+							_AM_SONGLIST_MSG_REQUESTS_FAILEDTODELETE
158
+						);
159
+						exit(0);
160
+					}
161
+					redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_DELETED);
162
+					exit(0);
163
+				}
164
+				$requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
165
+				xoops_confirm(
166
+					['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
167
+					$_SERVER['SCRIPT_NAME'],
168
+					sprintf(_AM_SONGLIST_MSG_REQUESTS_DELETE, $requests->getVar('name'))
169
+				);
170
+
171
+				break;
172
+		}
173
+		break;
174 174
 }
175 175
 
176 176
 xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use XoopsModules\Songlist\RequestsHandler;
7 7
 use XoopsModules\Songlist\Form\FormController;
8 8
 
9
-require __DIR__ . '/header.php';
9
+require __DIR__.'/header.php';
10 10
 
11 11
 xoops_loadLanguage('admin', 'songlist');
12 12
 
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 $limit  = Request::getInt('limit', 30, 'REQUEST');
18 18
 $start  = Request::getInt('start', 0, 'REQUEST');
19 19
 $order  = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
20
-$sort   = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
21
-$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
20
+$sort   = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created';
21
+$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1';
22 22
 
23 23
 switch ($op) {
24 24
     default:
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 
35 35
                 $criteria        = $requestsHandler->getFilterCriteria($GLOBALS['filter']);
36 36
                 $ttl             = $requestsHandler->getCount($criteria);
37
-                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
37
+                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created';
38 38
 
39
-                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
39
+                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit='.$GLOBALS['limit'].'&sort='.$GLOBALS['sort'].'&order='.$GLOBALS['order'].'&op='.$GLOBALS['op'].'&fct='.$GLOBALS['fct'].'&filter='.$GLOBALS['filter']);
40 40
                 $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
41 41
 
42 42
                 foreach ($requestsHandler->filterFields() as $id => $key) {
43 43
                     $GLOBALS['xoopsTpl']->assign(
44
-                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
44
+                        \mb_strtolower(str_replace('-', '_', $key).'_th'),
45 45
                         '<a href="'
46 46
                         . $_SERVER['SCRIPT_NAME']
47 47
                         . '?start='
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
                         . '&sort='
52 52
                         . $key
53 53
                         . '&order='
54
-                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
54
+                        . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
55 55
                         . '&op='
56 56
                         . $GLOBALS['op']
57 57
                         . '&filter='
58 58
                         . $GLOBALS['filter']
59 59
                         . '">'
60
-                        . (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
60
+                        . (defined('_AM_SONGLIST_TH_'.\mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_'.\mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_'.\mb_strtoupper(str_replace('-', '_', $key)))
61 61
                         . '</a>'
62 62
                     );
63
-                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $requestsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
63
+                    $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $requestsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
64 64
                 }
65 65
 
66 66
                 $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
                 $criteria->setStart($GLOBALS['start']);
74 74
                 $criteria->setLimit($GLOBALS['limit']);
75
-                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
75
+                $criteria->setSort('`'.$GLOBALS['sort'].'`');
76 76
                 $criteria->setOrder($GLOBALS['order']);
77 77
 
78 78
                 $requestss = $requestsHandler->getObjects($criteria, true);
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
                 $requests->setVars($_POST[$id]);
114 114
 
115 115
                 if (!$id = $requestsHandler->insert($requests)) {
116
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE);
116
+                    redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE);
117 117
                     exit(0);
118 118
                 }
119
-                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
119
+                if ('new'===$_REQUEST['state'][$_REQUEST['id']]) {
120 120
                     redirect_header(
121
-                        $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
121
+                        $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'].'&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
122 122
                         10,
123 123
                         _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY
124 124
                     );
125 125
                 } else {
126
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY);
126
+                    redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY);
127 127
                 }
128 128
                 exit(0);
129 129
 
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
                     $requests->setVars($_POST[$id]);
136 136
                     if (!$requestsHandler->insert($requests)) {
137 137
                         redirect_header(
138
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
138
+                            $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
139 139
                             10,
140 140
                             _AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE
141 141
                         );
142 142
                         exit(0);
143 143
                     }
144 144
                 }
145
-                redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY);
145
+                redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY);
146 146
                 exit(0);
147 147
                 break;
148 148
             case 'delete':
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
                     $requests = $requestsHandler->get($id);
153 153
                     if (!$requestsHandler->delete($requests)) {
154 154
                         redirect_header(
155
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
155
+                            $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
156 156
                             10,
157 157
                             _AM_SONGLIST_MSG_REQUESTS_FAILEDTODELETE
158 158
                         );
159 159
                         exit(0);
160 160
                     }
161
-                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_DELETED);
161
+                    redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_REQUESTS_DELETED);
162 162
                     exit(0);
163 163
                 }
164 164
                 $requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
Please login to merge, or discard this patch.
list.tag.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2 2
 
3
-require_once __DIR__ . '/header.php';
4
-require_once XOOPS_ROOT_PATH . '/modules/tag/list.tag.php';
3
+require_once __DIR__.'/header.php';
4
+require_once XOOPS_ROOT_PATH.'/modules/tag/list.tag.php';
Please login to merge, or discard this patch.
include/oninstall.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function xoops_module_pre_install_songlist(\XoopsModule $module): bool
31 31
 {
32
-    require_once \dirname(__DIR__) . '/preloads/autoloader.php';
33
-    $utility      = new Utility();
34
-    $xoopsSuccess = $utility::checkVerXoops($module);
35
-    $phpSuccess   = $utility::checkVerPhp($module);
32
+	require_once \dirname(__DIR__) . '/preloads/autoloader.php';
33
+	$utility      = new Utility();
34
+	$xoopsSuccess = $utility::checkVerXoops($module);
35
+	$phpSuccess   = $utility::checkVerPhp($module);
36 36
 
37
-    if ($xoopsSuccess && $phpSuccess) {
38
-        $moduleTables = &$module->getInfo('tables');
39
-        foreach ($moduleTables as $table) {
40
-            $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';');
41
-        }
42
-    }
37
+	if ($xoopsSuccess && $phpSuccess) {
38
+		$moduleTables = &$module->getInfo('tables');
39
+		foreach ($moduleTables as $table) {
40
+			$GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';');
41
+		}
42
+	}
43 43
 
44
-    return $xoopsSuccess && $phpSuccess;
44
+	return $xoopsSuccess && $phpSuccess;
45 45
 }
46 46
 
47 47
 /**
@@ -52,48 +52,48 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function xoops_module_install_songlist(\XoopsModule $module): bool
54 54
 {
55
-    require \dirname(__DIR__, 3) . '/mainfile.php';
55
+	require \dirname(__DIR__, 3) . '/mainfile.php';
56 56
 
57
-    $moduleDirName = \basename(\dirname(__DIR__));
58
-    $helper        = Helper::getInstance();
59
-    $utility       = new Utility();
60
-    $configurator  = new Songlist\Common\Configurator();
61
-    // Load language files
62
-    $helper->loadLanguage('admin');
63
-    $helper->loadLanguage('modinfo');
57
+	$moduleDirName = \basename(\dirname(__DIR__));
58
+	$helper        = Helper::getInstance();
59
+	$utility       = new Utility();
60
+	$configurator  = new Songlist\Common\Configurator();
61
+	// Load language files
62
+	$helper->loadLanguage('admin');
63
+	$helper->loadLanguage('modinfo');
64 64
 
65
-    // default Permission Settings ----------------------
66
-    global $xoopsModule;
67
-    $moduleId = $xoopsModule->getVar('mid');
68
-    // $moduleId2        = \XoopsModules\Songlist\Helper::getInstance()->getModule()->mid();
69
-    /** @var \XoopsGroupPermHandler $grouppermHandler */
70
-    $grouppermHandler = xoops_getHandler('groupperm');
71
-    // access rights ------------------------------------------
72
-    $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
73
-    $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
74
-    $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
75
-    $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId);
76
-    $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
65
+	// default Permission Settings ----------------------
66
+	global $xoopsModule;
67
+	$moduleId = $xoopsModule->getVar('mid');
68
+	// $moduleId2        = \XoopsModules\Songlist\Helper::getInstance()->getModule()->mid();
69
+	/** @var \XoopsGroupPermHandler $grouppermHandler */
70
+	$grouppermHandler = xoops_getHandler('groupperm');
71
+	// access rights ------------------------------------------
72
+	$grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
73
+	$grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
74
+	$grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
75
+	$grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId);
76
+	$grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
77 77
 
78
-    //  ---  CREATE FOLDERS ---------------
79
-    if (count($configurator->uploadFolders) > 0) {
80
-        //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
81
-        foreach (array_keys($configurator->uploadFolders) as $i) {
82
-            $utility::createFolder($configurator->uploadFolders[$i]);
83
-        }
84
-    }
78
+	//  ---  CREATE FOLDERS ---------------
79
+	if (count($configurator->uploadFolders) > 0) {
80
+		//    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
81
+		foreach (array_keys($configurator->uploadFolders) as $i) {
82
+			$utility::createFolder($configurator->uploadFolders[$i]);
83
+		}
84
+	}
85 85
 
86
-    //  ---  COPY blank.png FILES ---------------
87
-    if (count($configurator->copyBlankFiles) > 0) {
88
-        $file = \dirname(__DIR__) . '/assets/images/blank.png';
89
-        foreach (array_keys($configurator->copyBlankFiles) as $i) {
90
-            $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
91
-            $utility::copyFile($file, $dest);
92
-        }
93
-    }
94
-    //delete .html entries from the tpl table
95
-    $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.tpl%'";
96
-    $GLOBALS['xoopsDB']->queryF($sql);
86
+	//  ---  COPY blank.png FILES ---------------
87
+	if (count($configurator->copyBlankFiles) > 0) {
88
+		$file = \dirname(__DIR__) . '/assets/images/blank.png';
89
+		foreach (array_keys($configurator->copyBlankFiles) as $i) {
90
+			$dest = $configurator->copyBlankFiles[$i] . '/blank.png';
91
+			$utility::copyFile($file, $dest);
92
+		}
93
+	}
94
+	//delete .html entries from the tpl table
95
+	$sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.tpl%'";
96
+	$GLOBALS['xoopsDB']->queryF($sql);
97 97
 
98
-    return true;
98
+	return true;
99 99
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function xoops_module_pre_install_songlist(\XoopsModule $module): bool
31 31
 {
32
-    require_once \dirname(__DIR__) . '/preloads/autoloader.php';
32
+    require_once \dirname(__DIR__).'/preloads/autoloader.php';
33 33
     $utility      = new Utility();
34 34
     $xoopsSuccess = $utility::checkVerXoops($module);
35 35
     $phpSuccess   = $utility::checkVerPhp($module);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     if ($xoopsSuccess && $phpSuccess) {
38 38
         $moduleTables = &$module->getInfo('tables');
39 39
         foreach ($moduleTables as $table) {
40
-            $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';');
40
+            $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS '.$GLOBALS['xoopsDB']->prefix($table).';');
41 41
         }
42 42
     }
43 43
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function xoops_module_install_songlist(\XoopsModule $module): bool
54 54
 {
55
-    require \dirname(__DIR__, 3) . '/mainfile.php';
55
+    require \dirname(__DIR__, 3).'/mainfile.php';
56 56
 
57 57
     $moduleDirName = \basename(\dirname(__DIR__));
58 58
     $helper        = Helper::getInstance();
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
     /** @var \XoopsGroupPermHandler $grouppermHandler */
70 70
     $grouppermHandler = xoops_getHandler('groupperm');
71 71
     // access rights ------------------------------------------
72
-    $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
73
-    $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
74
-    $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
75
-    $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId);
76
-    $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
72
+    $grouppermHandler->addRight($moduleDirName.'_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
73
+    $grouppermHandler->addRight($moduleDirName.'_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
74
+    $grouppermHandler->addRight($moduleDirName.'_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
75
+    $grouppermHandler->addRight($moduleDirName.'_view', 1, XOOPS_GROUP_USERS, $moduleId);
76
+    $grouppermHandler->addRight($moduleDirName.'_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
77 77
 
78 78
     //  ---  CREATE FOLDERS ---------------
79
-    if (count($configurator->uploadFolders) > 0) {
79
+    if (count($configurator->uploadFolders)>0) {
80 80
         //    foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
81 81
         foreach (array_keys($configurator->uploadFolders) as $i) {
82 82
             $utility::createFolder($configurator->uploadFolders[$i]);
@@ -84,15 +84,15 @@  discard block
 block discarded – undo
84 84
     }
85 85
 
86 86
     //  ---  COPY blank.png FILES ---------------
87
-    if (count($configurator->copyBlankFiles) > 0) {
88
-        $file = \dirname(__DIR__) . '/assets/images/blank.png';
87
+    if (count($configurator->copyBlankFiles)>0) {
88
+        $file = \dirname(__DIR__).'/assets/images/blank.png';
89 89
         foreach (array_keys($configurator->copyBlankFiles) as $i) {
90
-            $dest = $configurator->copyBlankFiles[$i] . '/blank.png';
90
+            $dest = $configurator->copyBlankFiles[$i].'/blank.png';
91 91
             $utility::copyFile($file, $dest);
92 92
         }
93 93
     }
94 94
     //delete .html entries from the tpl table
95
-    $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.tpl%'";
95
+    $sql = 'DELETE FROM '.$GLOBALS['xoopsDB']->prefix('tplfile')." WHERE `tpl_module` = '".$xoopsModule->getVar('dirname', 'n')."' AND `tpl_file` LIKE '%.tpl%'";
96 96
     $GLOBALS['xoopsDB']->queryF($sql);
97 97
 
98 98
     return true;
Please login to merge, or discard this patch.
include/songlist.object.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
 /** @var \XoopsConfigHandler $configHandler */
6 6
 $configHandler = xoops_getHandler('config');
7 7
 if (!isset($GLOBALS['songlistModule'])) {
8
-    $GLOBALS['songlistModule'] = $moduleHandler->getByDirname('songlist');
8
+	$GLOBALS['songlistModule'] = $moduleHandler->getByDirname('songlist');
9 9
 }
10 10
 if (is_object($GLOBALS['songlistModule'])) {
11
-    if (!isset($GLOBALS['songlistModuleConfig'])) {
12
-        $GLOBALS['songlistModuleConfig'] = $configHandler->getConfigList($GLOBALS['songlistModule']->getVar('mid'));
13
-    }
11
+	if (!isset($GLOBALS['songlistModuleConfig'])) {
12
+		$GLOBALS['songlistModuleConfig'] = $configHandler->getConfigList($GLOBALS['songlistModule']->getVar('mid'));
13
+	}
14 14
 }
15 15
 
16 16
 require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
Please login to merge, or discard this patch.
include/update.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@  discard block
 block discarded – undo
6 6
  */
7 7
 function xoops_module_update_songlist(&$module): bool
8 8
 {
9
-    $sql = [];
9
+	$sql = [];
10 10
 
11
-    $sql[] = 'CREATE TABLE `'
12
-             . $GLOBALS['xoopsDB']->prefix('songlist_voice')
13
-             . "` (  `vcid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,  `name` VARCHAR(128) DEFAULT NULL,  `artists` INT(12) UNSIGNED DEFAULT '0',  `albums` INT(12) UNSIGNED DEFAULT '0',  `songs` INT(12) UNSIGNED DEFAULT '0',  `rank` DECIMAL(10,3) UNSIGNED DEFAULT '0.000',  `votes` INT(10) UNSIGNED DEFAULT '0',  `created` INT(12) UNSIGNED DEFAULT '0',  `updated` INT(12) UNSIGNED DEFAULT '0',  PRIMARY KEY (`vcid`),  KEY `SORT` (`name`(32),`rank`,`votes`,`created`)) ENGINE=InnoDB DEFAULT CHARSET=utf8";
14
-    $sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . "` ADD COLUMN `vcid` INT(12) UNSIGNED DEFAULT '0'";
15
-    $sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . '` CHANGE COLUMN `lyrics` `lyrics` LONGTEXT';
16
-    $sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . "` ADD COLUMN `mp3` VARCHAR(500) DEFAULT ''";
17
-    $sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . '` CHANGE COLUMN `traxid` `traxid` INT(4) UNSIGNED ZEROFILL DEFAULT NULL';
11
+	$sql[] = 'CREATE TABLE `'
12
+			 . $GLOBALS['xoopsDB']->prefix('songlist_voice')
13
+			 . "` (  `vcid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,  `name` VARCHAR(128) DEFAULT NULL,  `artists` INT(12) UNSIGNED DEFAULT '0',  `albums` INT(12) UNSIGNED DEFAULT '0',  `songs` INT(12) UNSIGNED DEFAULT '0',  `rank` DECIMAL(10,3) UNSIGNED DEFAULT '0.000',  `votes` INT(10) UNSIGNED DEFAULT '0',  `created` INT(12) UNSIGNED DEFAULT '0',  `updated` INT(12) UNSIGNED DEFAULT '0',  PRIMARY KEY (`vcid`),  KEY `SORT` (`name`(32),`rank`,`votes`,`created`)) ENGINE=InnoDB DEFAULT CHARSET=utf8";
14
+	$sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . "` ADD COLUMN `vcid` INT(12) UNSIGNED DEFAULT '0'";
15
+	$sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . '` CHANGE COLUMN `lyrics` `lyrics` LONGTEXT';
16
+	$sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . "` ADD COLUMN `mp3` VARCHAR(500) DEFAULT ''";
17
+	$sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . '` CHANGE COLUMN `traxid` `traxid` INT(4) UNSIGNED ZEROFILL DEFAULT NULL';
18 18
 
19
-    return xoops_module_update_vs_executesql($sql);
19
+	return xoops_module_update_vs_executesql($sql);
20 20
 }
21 21
 
22 22
 /**
@@ -25,31 +25,31 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function xoops_module_update_vs_executesql($sql): bool
27 27
 {
28
-    if (is_string($sql)) {
29
-        if ($GLOBALS['xoopsDB']->queryF($sql)) {
30
-            xoops_error($sql, 'SQL Executed Successfully!!!');
31
-        }
32
-    } elseif (is_array($sql)) {
33
-        foreach ($sql as $id => $question) {
34
-            if (is_array($question)) {
35
-                foreach ($question as $kquestion => $questionb) {
36
-                    if ($GLOBALS['xoopsDB']->queryF($kquestion)) {
37
-                        xoops_error($kquestion, 'SQL Executed Successfully!!!');
38
-                        xoops_module_update_vs_executesql($questionb);
39
-                    }
40
-                }
41
-            } elseif ($GLOBALS['xoopsDB']->queryF($id)) {
42
-                    xoops_error($id, 'SQL Executed Successfully!!!');
43
-                    if ($GLOBALS['xoopsDB']->queryF($question)) {
44
-                        xoops_error($question, 'SQL Executed Successfully!!!');
45
-                    }
46
-                } elseif ($GLOBALS['xoopsDB']->queryF($question)) {
47
-                    xoops_error($question, 'SQL Executed Successfully!!!');
48
-            }
49
-        }
50
-    } else {
51
-        return false;
52
-    }
28
+	if (is_string($sql)) {
29
+		if ($GLOBALS['xoopsDB']->queryF($sql)) {
30
+			xoops_error($sql, 'SQL Executed Successfully!!!');
31
+		}
32
+	} elseif (is_array($sql)) {
33
+		foreach ($sql as $id => $question) {
34
+			if (is_array($question)) {
35
+				foreach ($question as $kquestion => $questionb) {
36
+					if ($GLOBALS['xoopsDB']->queryF($kquestion)) {
37
+						xoops_error($kquestion, 'SQL Executed Successfully!!!');
38
+						xoops_module_update_vs_executesql($questionb);
39
+					}
40
+				}
41
+			} elseif ($GLOBALS['xoopsDB']->queryF($id)) {
42
+					xoops_error($id, 'SQL Executed Successfully!!!');
43
+					if ($GLOBALS['xoopsDB']->queryF($question)) {
44
+						xoops_error($question, 'SQL Executed Successfully!!!');
45
+					}
46
+				} elseif ($GLOBALS['xoopsDB']->queryF($question)) {
47
+					xoops_error($question, 'SQL Executed Successfully!!!');
48
+			}
49
+		}
50
+	} else {
51
+		return false;
52
+	}
53 53
 
54
-    return true;
54
+	return true;
55 55
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
     $sql[] = 'CREATE TABLE `'
12 12
              . $GLOBALS['xoopsDB']->prefix('songlist_voice')
13 13
              . "` (  `vcid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,  `name` VARCHAR(128) DEFAULT NULL,  `artists` INT(12) UNSIGNED DEFAULT '0',  `albums` INT(12) UNSIGNED DEFAULT '0',  `songs` INT(12) UNSIGNED DEFAULT '0',  `rank` DECIMAL(10,3) UNSIGNED DEFAULT '0.000',  `votes` INT(10) UNSIGNED DEFAULT '0',  `created` INT(12) UNSIGNED DEFAULT '0',  `updated` INT(12) UNSIGNED DEFAULT '0',  PRIMARY KEY (`vcid`),  KEY `SORT` (`name`(32),`rank`,`votes`,`created`)) ENGINE=InnoDB DEFAULT CHARSET=utf8";
14
-    $sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . "` ADD COLUMN `vcid` INT(12) UNSIGNED DEFAULT '0'";
15
-    $sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . '` CHANGE COLUMN `lyrics` `lyrics` LONGTEXT';
16
-    $sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . "` ADD COLUMN `mp3` VARCHAR(500) DEFAULT ''";
17
-    $sql[] = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . '` CHANGE COLUMN `traxid` `traxid` INT(4) UNSIGNED ZEROFILL DEFAULT NULL';
14
+    $sql[] = 'ALTER TABLE `'.$GLOBALS['xoopsDB']->prefix('songlist_songs')."` ADD COLUMN `vcid` INT(12) UNSIGNED DEFAULT '0'";
15
+    $sql[] = 'ALTER TABLE `'.$GLOBALS['xoopsDB']->prefix('songlist_songs').'` CHANGE COLUMN `lyrics` `lyrics` LONGTEXT';
16
+    $sql[] = 'ALTER TABLE `'.$GLOBALS['xoopsDB']->prefix('songlist_songs')."` ADD COLUMN `mp3` VARCHAR(500) DEFAULT ''";
17
+    $sql[] = 'ALTER TABLE `'.$GLOBALS['xoopsDB']->prefix('songlist_songs').'` CHANGE COLUMN `traxid` `traxid` INT(4) UNSIGNED ZEROFILL DEFAULT NULL';
18 18
 
19 19
     return xoops_module_update_vs_executesql($sql);
20 20
 }
Please login to merge, or discard this patch.
include/onuninstall.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function xoops_module_pre_uninstall_songlist(\XoopsModule $module): bool
22 22
 {
23
-    // Do some synchronization
24
-    return true;
23
+	// Do some synchronization
24
+	return true;
25 25
 }
26 26
 
27 27
 /**
@@ -32,26 +32,26 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function xoops_module_uninstall_songlist(\XoopsModule $module): bool
34 34
 {
35
-    $moduleDirName      = \basename(\dirname(__DIR__));
36
-    $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
37
-    $helper             = Helper::getInstance();
35
+	$moduleDirName      = \basename(\dirname(__DIR__));
36
+	$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
37
+	$helper             = Helper::getInstance();
38 38
 
39
-    $success = true;
40
-    $helper->loadLanguage('admin');
39
+	$success = true;
40
+	$helper->loadLanguage('admin');
41 41
 
42
-    // Rename uploads folder to BAK and add date to name
43
-    $uploadDirectory = $GLOBALS['xoops']->path("uploads/$moduleDirName");
44
-    $dirInfo = new \SplFileInfo($uploadDirectory);
45
-    if ($dirInfo->isDir()) {
46
-        // The directory exists so rename it
47
-        $date = date('Y-m-d');
48
-        if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) {
49
-            $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR_FOLDER_RENAME_FAILED'), $uploadDirectory));
50
-            $success = false;
51
-        }
52
-    }
53
-    unset($dirInfo);
54
-    /*
42
+	// Rename uploads folder to BAK and add date to name
43
+	$uploadDirectory = $GLOBALS['xoops']->path("uploads/$moduleDirName");
44
+	$dirInfo = new \SplFileInfo($uploadDirectory);
45
+	if ($dirInfo->isDir()) {
46
+		// The directory exists so rename it
47
+		$date = date('Y-m-d');
48
+		if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) {
49
+			$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR_FOLDER_RENAME_FAILED'), $uploadDirectory));
50
+			$success = false;
51
+		}
52
+	}
53
+	unset($dirInfo);
54
+	/*
55 55
     //------------ START ----------------
56 56
     //------------------------------------------------------------------
57 57
     // Remove xsitemap.xml from XOOPS root folder if it exists
@@ -65,6 +65,6 @@  discard block
 block discarded – undo
65 65
 //    return $success && $delOk; // use this if you're using this routine
66 66
 */
67 67
 
68
-    return $success;
69
-    //------------ END  ----------------
68
+	return $success;
69
+	//------------ END  ----------------
70 70
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@
 block discarded – undo
45 45
     if ($dirInfo->isDir()) {
46 46
         // The directory exists so rename it
47 47
         $date = date('Y-m-d');
48
-        if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) {
49
-            $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR_FOLDER_RENAME_FAILED'), $uploadDirectory));
48
+        if (!rename($uploadDirectory, $uploadDirectory."_bak_$date")) {
49
+            $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_'.'ERROR_FOLDER_RENAME_FAILED'), $uploadDirectory));
50 50
             $success = false;
51 51
         }
52 52
     }
Please login to merge, or discard this patch.